linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] spi: pxa2xx: Clean up linux/spi/pxa2xx_spi.h
@ 2024-03-07 19:47 Andy Shevchenko
  2024-03-07 19:47 ` [PATCH v3 1/3] spi: pxa2xx: Kill pxa2xx_set_spi_info() Andy Shevchenko
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Andy Shevchenko @ 2024-03-07 19:47 UTC (permalink / raw)
  To: Andy Shevchenko, Arnd Bergmann, linux-spi, linux-kernel,
	linux-arm-kernel
  Cc: Mark Brown, Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King

A couple of cleanups against linux/spi/pxa2xx_spi.h.

I'm sending this as v3 to land in the SPI subsystem. Meanwhile I'm
preparing an update to make linux/spi/pxa2xx_spi.h private to the
subsystem (PXA2xx driver). But the second part will be presented later
on (likely after v6.9-rc1). That said, this can be routed either via
SoC tree or SPI, up to respective maintainers.

In v3:
- fixed compilation error
- updated documentation file as well

In v2:
- preserved a comment (Arnd)
- added tag (Arnd)
- added new patch to avoid using unneeded header in soc/pxa/ssp.c

Andy Shevchenko (3):
  spi: pxa2xx: Kill pxa2xx_set_spi_info()
  spi: pxa2xx: Make num_chipselect 8-bit in the struct
    pxa2xx_spi_controller
  spi: pxa2xx: Use proper SSP header in soc/pxa/ssp.c

 Documentation/spi/pxa2xx.rst   |  2 +-
 arch/arm/mach-pxa/devices.c    | 18 ------------------
 arch/arm/mach-pxa/spitz.c      | 14 +++++++++++++-
 drivers/soc/pxa/ssp.c          |  2 +-
 include/linux/spi/pxa2xx_spi.h | 10 +---------
 5 files changed, 16 insertions(+), 30 deletions(-)

-- 
2.43.0.rc1.1.gbec44491f096


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3 1/3] spi: pxa2xx: Kill pxa2xx_set_spi_info()
  2024-03-07 19:47 [PATCH v3 0/3] spi: pxa2xx: Clean up linux/spi/pxa2xx_spi.h Andy Shevchenko
@ 2024-03-07 19:47 ` Andy Shevchenko
  2024-03-07 22:07   ` Arnd Bergmann
  2024-03-07 19:47 ` [PATCH v3 2/3] spi: pxa2xx: Make num_chipselect 8-bit in the struct pxa2xx_spi_controller Andy Shevchenko
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Andy Shevchenko @ 2024-03-07 19:47 UTC (permalink / raw)
  To: Andy Shevchenko, Arnd Bergmann, linux-spi, linux-kernel,
	linux-arm-kernel
  Cc: Mark Brown, Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King

There is the only one user of the pxa2xx_set_spi_info(). Unexport it
and inline to the actual user.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 arch/arm/mach-pxa/devices.c    | 18 ------------------
 arch/arm/mach-pxa/spitz.c      | 14 +++++++++++++-
 include/linux/spi/pxa2xx_spi.h |  8 --------
 3 files changed, 13 insertions(+), 27 deletions(-)

diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
index 661b3fc43275..1e4cd502340e 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -7,7 +7,6 @@
 #include <linux/clk-provider.h>
 #include <linux/dma-mapping.h>
 #include <linux/dmaengine.h>
-#include <linux/spi/pxa2xx_spi.h>
 #include <linux/platform_data/i2c-pxa.h>
 #include <linux/soc/pxa/cpu.h>
 
@@ -665,23 +664,6 @@ struct platform_device pxa27x_device_gpio = {
 	.resource	= pxa_resource_gpio,
 };
 
-/* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1.
- * See comment in arch/arm/mach-pxa/ssp.c::ssp_probe() */
-void __init pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_controller *info)
-{
-	struct platform_device *pd;
-
-	pd = platform_device_alloc("pxa2xx-spi", id);
-	if (pd == NULL) {
-		printk(KERN_ERR "pxa2xx-spi: failed to allocate device id %d\n",
-		       id);
-		return;
-	}
-
-	pd->dev.platform_data = info;
-	platform_device_add(pd);
-}
-
 static struct resource pxa_dma_resource[] = {
 	[0] = {
 		.start	= 0x40000000,
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index cc691b199429..318402ad685e 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -585,6 +585,9 @@ static struct gpiod_lookup_table spitz_spi_gpio_table = {
 
 static void __init spitz_spi_init(void)
 {
+	struct platform_device *pd;
+	int id = 2;
+
 	if (machine_is_akita())
 		gpiod_add_lookup_table(&akita_lcdcon_gpio_table);
 	else
@@ -592,7 +595,16 @@ static void __init spitz_spi_init(void)
 
 	gpiod_add_lookup_table(&spitz_ads7846_gpio_table);
 	gpiod_add_lookup_table(&spitz_spi_gpio_table);
-	pxa2xx_set_spi_info(2, &spitz_spi_info);
+
+	/* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1 */
+	pd = platform_device_alloc("pxa2xx-spi", id);
+	if (pd == NULL) {
+		pr_err("pxa2xx-spi: failed to allocate device id %d\n", id);
+	} else {
+		pd->dev.platform_data = &spitz_spi_info;
+		platform_device_add(pd);
+	}
+
 	spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices));
 }
 #else
diff --git a/include/linux/spi/pxa2xx_spi.h b/include/linux/spi/pxa2xx_spi.h
index ca2cd4e30ead..56aba2f737b1 100644
--- a/include/linux/spi/pxa2xx_spi.h
+++ b/include/linux/spi/pxa2xx_spi.h
@@ -45,12 +45,4 @@ struct pxa2xx_spi_chip {
 	u32 timeout;
 };
 
-#if defined(CONFIG_ARCH_PXA) || defined(CONFIG_ARCH_MMP)
-
-#include <linux/clk.h>
-
-extern void pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_controller *info);
-
-#endif
-
 #endif	/* __LINUX_SPI_PXA2XX_SPI_H */
-- 
2.43.0.rc1.1.gbec44491f096


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 2/3] spi: pxa2xx: Make num_chipselect 8-bit in the struct pxa2xx_spi_controller
  2024-03-07 19:47 [PATCH v3 0/3] spi: pxa2xx: Clean up linux/spi/pxa2xx_spi.h Andy Shevchenko
  2024-03-07 19:47 ` [PATCH v3 1/3] spi: pxa2xx: Kill pxa2xx_set_spi_info() Andy Shevchenko
@ 2024-03-07 19:47 ` Andy Shevchenko
  2024-03-07 19:47 ` [PATCH v3 3/3] spi: pxa2xx: Use proper SSP header in soc/pxa/ssp.c Andy Shevchenko
  2024-03-26 12:39 ` [PATCH v3 0/3] spi: pxa2xx: Clean up linux/spi/pxa2xx_spi.h Mark Brown
  3 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2024-03-07 19:47 UTC (permalink / raw)
  To: Andy Shevchenko, Arnd Bergmann, linux-spi, linux-kernel,
	linux-arm-kernel
  Cc: Mark Brown, Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King

There is no use for whole 16-bit for the number of chip select pins.
Drop it to 8 bits.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 Documentation/spi/pxa2xx.rst   | 2 +-
 include/linux/spi/pxa2xx_spi.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/spi/pxa2xx.rst b/Documentation/spi/pxa2xx.rst
index 19479b801826..0997d8eaf190 100644
--- a/Documentation/spi/pxa2xx.rst
+++ b/Documentation/spi/pxa2xx.rst
@@ -24,7 +24,7 @@ arch/.../mach-*/board-*.c as a "platform device". The host controller configurat
 is passed to the driver via a table found in include/linux/spi/pxa2xx_spi.h::
 
   struct pxa2xx_spi_controller {
-	u16 num_chipselect;
+	u8 num_chipselect;
 	u8 enable_dma;
 	...
   };
diff --git a/include/linux/spi/pxa2xx_spi.h b/include/linux/spi/pxa2xx_spi.h
index 56aba2f737b1..e5a4a045fb67 100644
--- a/include/linux/spi/pxa2xx_spi.h
+++ b/include/linux/spi/pxa2xx_spi.h
@@ -17,7 +17,7 @@ struct dma_chan;
  * (resides in device.platform_data).
  */
 struct pxa2xx_spi_controller {
-	u16 num_chipselect;
+	u8 num_chipselect;
 	u8 enable_dma;
 	u8 dma_burst_size;
 	bool is_target;
-- 
2.43.0.rc1.1.gbec44491f096


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 3/3] spi: pxa2xx: Use proper SSP header in soc/pxa/ssp.c
  2024-03-07 19:47 [PATCH v3 0/3] spi: pxa2xx: Clean up linux/spi/pxa2xx_spi.h Andy Shevchenko
  2024-03-07 19:47 ` [PATCH v3 1/3] spi: pxa2xx: Kill pxa2xx_set_spi_info() Andy Shevchenko
  2024-03-07 19:47 ` [PATCH v3 2/3] spi: pxa2xx: Make num_chipselect 8-bit in the struct pxa2xx_spi_controller Andy Shevchenko
@ 2024-03-07 19:47 ` Andy Shevchenko
  2024-03-08 15:03   ` Andy Shevchenko
  2024-03-26 12:39 ` [PATCH v3 0/3] spi: pxa2xx: Clean up linux/spi/pxa2xx_spi.h Mark Brown
  3 siblings, 1 reply; 8+ messages in thread
From: Andy Shevchenko @ 2024-03-07 19:47 UTC (permalink / raw)
  To: Andy Shevchenko, Arnd Bergmann, linux-spi, linux-kernel,
	linux-arm-kernel
  Cc: Mark Brown, Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King

There is nothing from pxa2xx_spi.h used by soc/pxa/ssp.c.
Replace it with pxa2xx_ssp.h.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/soc/pxa/ssp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/pxa/ssp.c b/drivers/soc/pxa/ssp.c
index 7af04e8b8163..854d32e04558 100644
--- a/drivers/soc/pxa/ssp.c
+++ b/drivers/soc/pxa/ssp.c
@@ -25,7 +25,7 @@
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/platform_device.h>
-#include <linux/spi/pxa2xx_spi.h>
+#include <linux/pxa2xx_ssp.h>
 #include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
-- 
2.43.0.rc1.1.gbec44491f096


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 1/3] spi: pxa2xx: Kill pxa2xx_set_spi_info()
  2024-03-07 19:47 ` [PATCH v3 1/3] spi: pxa2xx: Kill pxa2xx_set_spi_info() Andy Shevchenko
@ 2024-03-07 22:07   ` Arnd Bergmann
  0 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2024-03-07 22:07 UTC (permalink / raw)
  To: Andy Shevchenko, linux-spi, linux-kernel, linux-arm-kernel
  Cc: Mark Brown, Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King

On Thu, Mar 7, 2024, at 20:47, Andy Shevchenko wrote:
> There is the only one user of the pxa2xx_set_spi_info(). Unexport it
> and inline to the actual user.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---

Acked-by: Arnd Bergmann <arnd@arndb.de>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 3/3] spi: pxa2xx: Use proper SSP header in soc/pxa/ssp.c
  2024-03-07 19:47 ` [PATCH v3 3/3] spi: pxa2xx: Use proper SSP header in soc/pxa/ssp.c Andy Shevchenko
@ 2024-03-08 15:03   ` Andy Shevchenko
  2024-03-08 16:55     ` Arnd Bergmann
  0 siblings, 1 reply; 8+ messages in thread
From: Andy Shevchenko @ 2024-03-08 15:03 UTC (permalink / raw)
  To: Arnd Bergmann, linux-spi, linux-kernel, linux-arm-kernel
  Cc: Mark Brown, Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King

On Thu, Mar 07, 2024 at 09:47:47PM +0200, Andy Shevchenko wrote:
> There is nothing from pxa2xx_spi.h used by soc/pxa/ssp.c.
> Replace it with pxa2xx_ssp.h.

Acked-by: Arnd Bergmann <arnd@arndb.de>

P.S.
I dared to add Arnd's tag from previous version as this patch
hasn't been changed.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 3/3] spi: pxa2xx: Use proper SSP header in soc/pxa/ssp.c
  2024-03-08 15:03   ` Andy Shevchenko
@ 2024-03-08 16:55     ` Arnd Bergmann
  0 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2024-03-08 16:55 UTC (permalink / raw)
  To: Andy Shevchenko, linux-spi, linux-kernel, linux-arm-kernel
  Cc: Mark Brown, Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King

On Fri, Mar 8, 2024, at 16:03, Andy Shevchenko wrote:
> On Thu, Mar 07, 2024 at 09:47:47PM +0200, Andy Shevchenko wrote:
>> There is nothing from pxa2xx_spi.h used by soc/pxa/ssp.c.
>> Replace it with pxa2xx_ssp.h.
>
> Acked-by: Arnd Bergmann <arnd@arndb.de>
>
> P.S.
> I dared to add Arnd's tag from previous version as this patch
> hasn't been changed.
>

Thanks, I mixed up the two messages and thought I had replied to v3.

    Arnd

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 0/3] spi: pxa2xx: Clean up linux/spi/pxa2xx_spi.h
  2024-03-07 19:47 [PATCH v3 0/3] spi: pxa2xx: Clean up linux/spi/pxa2xx_spi.h Andy Shevchenko
                   ` (2 preceding siblings ...)
  2024-03-07 19:47 ` [PATCH v3 3/3] spi: pxa2xx: Use proper SSP header in soc/pxa/ssp.c Andy Shevchenko
@ 2024-03-26 12:39 ` Mark Brown
  3 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2024-03-26 12:39 UTC (permalink / raw)
  To: Arnd Bergmann, linux-spi, linux-kernel, linux-arm-kernel,
	Andy Shevchenko
  Cc: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King

On Thu, 07 Mar 2024 21:47:44 +0200, Andy Shevchenko wrote:
> A couple of cleanups against linux/spi/pxa2xx_spi.h.
> 
> I'm sending this as v3 to land in the SPI subsystem. Meanwhile I'm
> preparing an update to make linux/spi/pxa2xx_spi.h private to the
> subsystem (PXA2xx driver). But the second part will be presented later
> on (likely after v6.9-rc1). That said, this can be routed either via
> SoC tree or SPI, up to respective maintainers.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/3] spi: pxa2xx: Kill pxa2xx_set_spi_info()
      commit: 7fd54c205f104317b853fc417ac7e9d0b9531ddb
[2/3] spi: pxa2xx: Make num_chipselect 8-bit in the struct pxa2xx_spi_controller
      commit: e3f209e269d32ebc0ba7f497f5d2af21ed4f0dd0
[3/3] spi: pxa2xx: Use proper SSP header in soc/pxa/ssp.c
      commit: b5867a5c0d7a6bf36f59f3d472c7aed33ca4d02c

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-03-26 12:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-07 19:47 [PATCH v3 0/3] spi: pxa2xx: Clean up linux/spi/pxa2xx_spi.h Andy Shevchenko
2024-03-07 19:47 ` [PATCH v3 1/3] spi: pxa2xx: Kill pxa2xx_set_spi_info() Andy Shevchenko
2024-03-07 22:07   ` Arnd Bergmann
2024-03-07 19:47 ` [PATCH v3 2/3] spi: pxa2xx: Make num_chipselect 8-bit in the struct pxa2xx_spi_controller Andy Shevchenko
2024-03-07 19:47 ` [PATCH v3 3/3] spi: pxa2xx: Use proper SSP header in soc/pxa/ssp.c Andy Shevchenko
2024-03-08 15:03   ` Andy Shevchenko
2024-03-08 16:55     ` Arnd Bergmann
2024-03-26 12:39 ` [PATCH v3 0/3] spi: pxa2xx: Clean up linux/spi/pxa2xx_spi.h Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).