Skip to contentSkip to conversation

spi: pxa2xx: Clean up linux/spi/pxa2xx_spi.h

PATCH Superseded Andy Shevchenko 2 participants 8 messages Mar 7, 2024 – Mar 8, 2024

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover spi: pxa2xx: Clean up linux/spi/pxa2xx_spi.h

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

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

 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 +---------
 4 files changed, 15 insertions(+), 29 deletions(-)
Signature · 1 line
2.43.0.rc1.1.gbec44491f096
#1 lore raw

PATCH v2 1/3 spi: pxa2xx: Kill pxa2xx_set_spi_info()

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

---
 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(-)
arch/arm/mach-pxa/devices.c +0 -18
index 661b3fc43275..1e4cd502340e 100644
@@ -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,
arch/arm/mach-pxa/spitz.c +13 -1
index cc691b199429..be7a3574e951 100644
@@ -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 = info;
+		platform_device_add(pd);
+	}
+
 	spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices));
 }
 #else
include/linux/spi/pxa2xx_spi.h +0 -8
index ca2cd4e30ead..56aba2f737b1 100644
@@ -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 */
Signature · 1 line
2.43.0.rc1.1.gbec44491f096
#2 lore raw

Re: [PATCH v2 1/3] spi: pxa2xx: Kill pxa2xx_set_spi_info()

On Thu, Mar 07, 2024 at 07:03:15PM +0200, Andy Shevchenko wrote:

...

arch/arm/mach-pxa/spitz.c static void __init spitz_spi_init(void) · line 604

Quoted 1 line
arch/arm/mach-pxa/spitz.c +1 -0
+		pd->dev.platform_data = info;

Oops, this won't compile :-)

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw

PATCH v2 2/3 spi: pxa2xx: Make num_chipselect 8-bit in the struct pxa2xx_spi_controller

In reply to Andy Shevchenko

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

---
 include/linux/spi/pxa2xx_spi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/spi/pxa2xx_spi.h +1 -1
index 56aba2f737b1..e5a4a045fb67 100644
@@ -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;
Signature · 1 line
2.43.0.rc1.1.gbec44491f096
#4 lore raw

PATCH v2 3/3 spi: pxa2xx: Use proper SSP header in soc/pxa/ssp.c

In reply to Andy Shevchenko

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

---
 drivers/soc/pxa/ssp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/pxa/ssp.c +1 -1
index 7af04e8b8163..854d32e04558 100644
@@ -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>
Signature · 1 line
2.43.0.rc1.1.gbec44491f096
#7 lore raw
In reply to Andy Shevchenko
Quoted 1 line · Andy Shevchenko

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

Besides obvious compilation error I think I can follow Arnd's suggestion to get rid of the pxa2xx_spi.h altogether. Stay tuned!

Signature · 2 lines
With Best Regards,
Andy Shevchenko