linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] ARM: pxa: use software nodes/properties for GPIOs
@ 2024-06-28 18:08 Dmitry Torokhov
  2024-06-28 18:08 ` [PATCH 01/10] ARM: spitz: fix GPIO assignment for backlight Dmitry Torokhov
                   ` (11 more replies)
  0 siblings, 12 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2024-06-28 18:08 UTC (permalink / raw)
  To: Haojian Zhuang, Daniel Mack, Robert Jarzmik, Arnd Bergmann,
	Linus Walleij, soc
  Cc: linux-arm-kernel, linux-kernel

This series converts legacy pxa boards (spitz, gumstix) to use software
nodes/properties to describe various GPIOs instead of relying on GPIO
lookup tables. The benefit is that structure and behavior is closer to
DT-described GPIOs.

The very first patch ("ARM: spitz: fix GPIO assignment for backlight")
is actually a fix that IMO should be applied sooner rather than later,
the rest of patches are enhancements. The reason it is sent with the
rest of the series is that later changes contextually depend on it.

The last patch ("ARM: spitz: Use software nodes for the ADS7846
touchscreen") soft-depends on corresponding changes by Linus Walleij to
the ads7846 driver in input tree. It compiles without it, but the device
will not sync with display refreshes. I have created an immutable branch
(branched from v6.9) at:

git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git ib/ads7846-hsync

in case you wish to pull it in.

Regretfully it was only compiled as I do not have access to the relevant
hardware.

Dmitry Torokhov (8):
  ARM: spitz: fix GPIO assignment for backlight
  ARM: pxa: consolidate GPIO chip platform data
  ARM: pxa/gumstix: convert vbus gpio to use software nodes
  ARM: spitz: Simplify instantiating SPI controller
  ARM: spitz: Use software nodes to describe audio GPIOs
  ARM: spitz: Use software nodes to describe LCD GPIOs
  ARM: spitz: Use software nodes to describe MMC GPIOs
  ARM: spitz: Use software nodes to describe LED GPIOs

Linus Walleij (2):
  ARM: spitz: Use software nodes to describe SPI CS lines
  ARM: spitz: Use software nodes for the ADS7846 touchscreen

 arch/arm/mach-pxa/devices.c              |  53 +++--
 arch/arm/mach-pxa/devices.h              |   5 +-
 arch/arm/mach-pxa/gumstix.c              |  24 +-
 arch/arm/mach-pxa/pxa25x.c               |   8 +-
 arch/arm/mach-pxa/pxa27x.c               |   9 +-
 arch/arm/mach-pxa/spitz.c                | 284 ++++++++++++-----------
 include/linux/platform_data/mmc-pxamci.h |   4 +-
 7 files changed, 208 insertions(+), 179 deletions(-)

Thanks.

-- 
2.45.2.803.g4e1b14247a-goog



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

* [PATCH 01/10] ARM: spitz: fix GPIO assignment for backlight
  2024-06-28 18:08 [PATCH 00/10] ARM: pxa: use software nodes/properties for GPIOs Dmitry Torokhov
@ 2024-06-28 18:08 ` Dmitry Torokhov
  2024-06-28 18:08 ` [PATCH 02/10] ARM: pxa: consolidate GPIO chip platform data Dmitry Torokhov
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2024-06-28 18:08 UTC (permalink / raw)
  To: Haojian Zhuang, Daniel Mack, Robert Jarzmik, Arnd Bergmann,
	Linus Walleij, soc
  Cc: linux-arm-kernel, linux-kernel

GPIOs controlling backlight on Spitz and Akita are coming from GPIO
expanders, not the pxa27xx-gpio block, correct it.

Additionally GPIO lookup tables operate with pin numbers rather than
legacy GPIO numbers, fix that as well. Use raw numbers instead of legacy
GPIO names to avoid confusion.

Fixes: ee0c8e494cc3 ("backlight: corgi: Convert to use GPIO descriptors")
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 arch/arm/mach-pxa/spitz.c | 30 ++++++++++--------------------
 1 file changed, 10 insertions(+), 20 deletions(-)

diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 3c5f5a3cb480..10ab16dcd827 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -520,10 +520,8 @@ static struct gpiod_lookup_table spitz_ads7846_gpio_table = {
 static struct gpiod_lookup_table spitz_lcdcon_gpio_table = {
 	.dev_id = "spi2.1",
 	.table = {
-		GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_BACKLIGHT_CONT,
-			    "BL_CONT", GPIO_ACTIVE_LOW),
-		GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_BACKLIGHT_ON,
-			    "BL_ON", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("sharp-scoop.1", 6, "BL_CONT", GPIO_ACTIVE_LOW),
+		GPIO_LOOKUP("sharp-scoop.1", 7, "BL_ON", GPIO_ACTIVE_HIGH),
 		{ },
 	},
 };
@@ -531,10 +529,8 @@ static struct gpiod_lookup_table spitz_lcdcon_gpio_table = {
 static struct gpiod_lookup_table akita_lcdcon_gpio_table = {
 	.dev_id = "spi2.1",
 	.table = {
-		GPIO_LOOKUP("gpio-pxa", AKITA_GPIO_BACKLIGHT_CONT,
-			    "BL_CONT", GPIO_ACTIVE_LOW),
-		GPIO_LOOKUP("gpio-pxa", AKITA_GPIO_BACKLIGHT_ON,
-			    "BL_ON", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("i2c-max7310", 3, "BL_ON", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("i2c-max7310", 4, "BL_CONT", GPIO_ACTIVE_LOW),
 		{ },
 	},
 };
@@ -964,12 +960,9 @@ static inline void spitz_i2c_init(void) {}
 static struct gpiod_lookup_table spitz_audio_gpio_table = {
 	.dev_id = "spitz-audio",
 	.table = {
-		GPIO_LOOKUP("sharp-scoop.0", SPITZ_GPIO_MUTE_L - SPITZ_SCP_GPIO_BASE,
-			    "mute-l", GPIO_ACTIVE_HIGH),
-		GPIO_LOOKUP("sharp-scoop.0", SPITZ_GPIO_MUTE_R - SPITZ_SCP_GPIO_BASE,
-			    "mute-r", GPIO_ACTIVE_HIGH),
-		GPIO_LOOKUP("sharp-scoop.1", SPITZ_GPIO_MIC_BIAS - SPITZ_SCP2_GPIO_BASE,
-			    "mic", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("sharp-scoop.0", 3, "mute-l", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("sharp-scoop.0", 4, "mute-r", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("sharp-scoop.1", 8, "mic", GPIO_ACTIVE_HIGH),
 		{ },
 	},
 };
@@ -977,12 +970,9 @@ static struct gpiod_lookup_table spitz_audio_gpio_table = {
 static struct gpiod_lookup_table akita_audio_gpio_table = {
 	.dev_id = "spitz-audio",
 	.table = {
-		GPIO_LOOKUP("sharp-scoop.0", SPITZ_GPIO_MUTE_L - SPITZ_SCP_GPIO_BASE,
-			    "mute-l", GPIO_ACTIVE_HIGH),
-		GPIO_LOOKUP("sharp-scoop.0", SPITZ_GPIO_MUTE_R - SPITZ_SCP_GPIO_BASE,
-			    "mute-r", GPIO_ACTIVE_HIGH),
-		GPIO_LOOKUP("i2c-max7310", AKITA_GPIO_MIC_BIAS - AKITA_IOEXP_GPIO_BASE,
-			    "mic", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("sharp-scoop.0", 3, "mute-l", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("sharp-scoop.0", 4, "mute-r", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("i2c-max7310", 2, "mic", GPIO_ACTIVE_HIGH),
 		{ },
 	},
 };
-- 
2.45.2.803.g4e1b14247a-goog



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

* [PATCH 02/10] ARM: pxa: consolidate GPIO chip platform data
  2024-06-28 18:08 [PATCH 00/10] ARM: pxa: use software nodes/properties for GPIOs Dmitry Torokhov
  2024-06-28 18:08 ` [PATCH 01/10] ARM: spitz: fix GPIO assignment for backlight Dmitry Torokhov
@ 2024-06-28 18:08 ` Dmitry Torokhov
  2024-06-28 18:08 ` [PATCH 03/10] ARM: pxa/gumstix: convert vbus gpio to use software nodes Dmitry Torokhov
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2024-06-28 18:08 UTC (permalink / raw)
  To: Haojian Zhuang, Daniel Mack, Robert Jarzmik, Arnd Bergmann,
	Linus Walleij, soc
  Cc: linux-arm-kernel, linux-kernel

The platform data for the GPIO controllers for the boards using non-DT
setup is the same between PXA25x (gumstix) and PXA27x (Spitz) devices.
Move it into devices.c to consolidate code. It will help with conversion
to software nodes/properties.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 arch/arm/mach-pxa/devices.c | 13 +++++++++++++
 arch/arm/mach-pxa/pxa25x.c  |  7 +------
 arch/arm/mach-pxa/pxa27x.c  |  8 +-------
 3 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
index 1e4cd502340e..7cc6db2d1615 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -7,6 +7,7 @@
 #include <linux/clk-provider.h>
 #include <linux/dma-mapping.h>
 #include <linux/dmaengine.h>
+#include <linux/gpio-pxa.h>
 #include <linux/platform_data/i2c-pxa.h>
 #include <linux/soc/pxa/cpu.h>
 
@@ -17,6 +18,7 @@
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 #include <linux/platform_data/mmp_dma.h>
 
+#include "mfp-pxa2xx.h"
 #include "regs-ost.h"
 #include "reset.h"
 #include "devices.h"
@@ -650,11 +652,19 @@ struct resource pxa_resource_gpio[] = {
 	},
 };
 
+static struct pxa_gpio_platform_data pxa2xx_gpio_info = {
+	.irq_base	= PXA_GPIO_TO_IRQ(0),
+	.gpio_set_wake	= gpio_set_wake,
+};
+
 struct platform_device pxa25x_device_gpio = {
 	.name		= "pxa25x-gpio",
 	.id		= -1,
 	.num_resources	= ARRAY_SIZE(pxa_resource_gpio),
 	.resource	= pxa_resource_gpio,
+	.dev		= {
+		.platform_data	= &pxa2xx_gpio_info,
+	},
 };
 
 struct platform_device pxa27x_device_gpio = {
@@ -662,6 +672,9 @@ struct platform_device pxa27x_device_gpio = {
 	.id		= -1,
 	.num_resources	= ARRAY_SIZE(pxa_resource_gpio),
 	.resource	= pxa_resource_gpio,
+	.dev		= {
+		.platform_data	= &pxa2xx_gpio_info,
+	},
 };
 
 static struct resource pxa_dma_resource[] = {
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 02712d24be82..2ab3d8d66466 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -178,12 +178,8 @@ void __init pxa25x_map_io(void)
 	pxa25x_get_clk_frequency_khz(1);
 }
 
-static struct pxa_gpio_platform_data pxa25x_gpio_info __initdata = {
-	.irq_base	= PXA_GPIO_TO_IRQ(0),
-	.gpio_set_wake	= gpio_set_wake,
-};
-
 static struct platform_device *pxa25x_devices[] __initdata = {
+	&pxa25x_device_gpio,
 	&pxa25x_device_udc,
 	&pxa_device_pmu,
 	&pxa_device_i2s,
@@ -244,7 +240,6 @@ static int __init pxa25x_init(void)
 
 		if (!of_have_populated_dt()) {
 			pxa2xx_set_dmac_info(&pxa25x_dma_pdata);
-			pxa_register_device(&pxa25x_device_gpio, &pxa25x_gpio_info);
 			ret = platform_add_devices(pxa25x_devices,
 						   ARRAY_SIZE(pxa25x_devices));
 		}
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index d71491e2e1d6..b135b9ef665c 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -276,12 +276,8 @@ void __init pxa27x_set_i2c_power_info(struct i2c_pxa_platform_data *info)
 	pxa_register_device(&pxa27x_device_i2c_power, info);
 }
 
-static struct pxa_gpio_platform_data pxa27x_gpio_info __initdata = {
-	.irq_base	= PXA_GPIO_TO_IRQ(0),
-	.gpio_set_wake	= gpio_set_wake,
-};
-
 static struct platform_device *devices[] __initdata = {
+	&pxa27x_device_gpio,
 	&pxa27x_device_udc,
 	&pxa_device_pmu,
 	&pxa_device_i2s,
@@ -345,8 +341,6 @@ static int __init pxa27x_init(void)
 		register_syscore_ops(&pxa2xx_mfp_syscore_ops);
 
 		if (!of_have_populated_dt()) {
-			pxa_register_device(&pxa27x_device_gpio,
-					    &pxa27x_gpio_info);
 			pxa2xx_set_dmac_info(&pxa27x_dma_pdata);
 			ret = platform_add_devices(devices,
 						   ARRAY_SIZE(devices));
-- 
2.45.2.803.g4e1b14247a-goog



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

* [PATCH 03/10] ARM: pxa/gumstix: convert vbus gpio to use software nodes
  2024-06-28 18:08 [PATCH 00/10] ARM: pxa: use software nodes/properties for GPIOs Dmitry Torokhov
  2024-06-28 18:08 ` [PATCH 01/10] ARM: spitz: fix GPIO assignment for backlight Dmitry Torokhov
  2024-06-28 18:08 ` [PATCH 02/10] ARM: pxa: consolidate GPIO chip platform data Dmitry Torokhov
@ 2024-06-28 18:08 ` Dmitry Torokhov
  2024-08-06  7:19   ` Arnd Bergmann
  2024-06-28 18:08 ` [PATCH 04/10] ARM: spitz: Simplify instantiating SPI controller Dmitry Torokhov
                   ` (8 subsequent siblings)
  11 siblings, 1 reply; 20+ messages in thread
From: Dmitry Torokhov @ 2024-06-28 18:08 UTC (permalink / raw)
  To: Haojian Zhuang, Daniel Mack, Robert Jarzmik, Arnd Bergmann,
	Linus Walleij, soc
  Cc: linux-arm-kernel, linux-kernel

Switch vbus gpios from using a custom GPIO lookup table to software
properties using PROPERTY_ENTRY_GPIO() constructs which closely mimic
device tree gpio properties.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 arch/arm/mach-pxa/devices.c |  4 ++++
 arch/arm/mach-pxa/devices.h |  4 ++--
 arch/arm/mach-pxa/gumstix.c | 22 +++++++++-------------
 arch/arm/mach-pxa/pxa25x.c  |  1 +
 4 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
index 7cc6db2d1615..e2758c94fd77 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -629,6 +629,10 @@ struct platform_device pxa27x_device_pwm1 = {
 };
 #endif /* CONFIG_PXA27x || CONFIG_PXA3xx */
 
+const struct software_node pxa2xx_gpiochip_node = {
+	.name	= "gpio-pxa",
+};
+
 struct resource pxa_resource_gpio[] = {
 	{
 		.start	= 0x40e00000,
diff --git a/arch/arm/mach-pxa/devices.h b/arch/arm/mach-pxa/devices.h
index 82c83939017a..b7c0e138ef61 100644
--- a/arch/arm/mach-pxa/devices.h
+++ b/arch/arm/mach-pxa/devices.h
@@ -53,8 +53,8 @@ extern struct platform_device pxa_device_asoc_ssp4;
 
 extern struct platform_device pxa25x_device_gpio;
 extern struct platform_device pxa27x_device_gpio;
-extern struct platform_device pxa3xx_device_gpio;
-extern struct platform_device pxa93x_device_gpio;
+
+extern const struct software_node pxa2xx_gpiochip_node;
 
 void __init pxa_register_device(struct platform_device *dev, void *data);
 void __init pxa2xx_set_dmac_info(struct mmp_dma_platdata *dma_pdata);
diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c
index c9f0f62187bd..b9eddc691097 100644
--- a/arch/arm/mach-pxa/gumstix.c
+++ b/arch/arm/mach-pxa/gumstix.c
@@ -100,26 +100,22 @@ static void __init gumstix_mmc_init(void)
 #endif
 
 #ifdef CONFIG_USB_PXA25X
-static struct gpiod_lookup_table gumstix_gpio_vbus_gpiod_table = {
-	.dev_id = "gpio-vbus",
-	.table = {
-		GPIO_LOOKUP("gpio-pxa", GPIO_GUMSTIX_USB_GPIOn,
-			    "vbus", GPIO_ACTIVE_HIGH),
-		GPIO_LOOKUP("gpio-pxa", GPIO_GUMSTIX_USB_GPIOx,
-			    "pullup", GPIO_ACTIVE_HIGH),
-		{ },
-	},
+static const struct property_entry spitz_mci_props[] __initconst = {
+	PROPERTY_ENTRY_GPIO("vbus-gpios", &pxa2xx_gpiochip_node,
+			    GPIO_GUMSTIX_USB_GPIOn, GPIO_ACTIVE_HIGH),
+	PROPERTY_ENTRY_GPIO("pullup-gpios", &pxa2xx_gpiochip_node,
+			    GPIO_GUMSTIX_USB_GPIOx, GPIO_ACTIVE_HIGH),
+	{ }
 };
 
-static struct platform_device gumstix_gpio_vbus = {
+static const struct platform_device_info gumstix_gpio_vbus_info __initconst = {
 	.name	= "gpio-vbus",
-	.id	= -1,
+	.id	= PLATFORM_DEVID_NONE,
 };
 
 static void __init gumstix_udc_init(void)
 {
-	gpiod_add_lookup_table(&gumstix_gpio_vbus_gpiod_table);
-	platform_device_register(&gumstix_gpio_vbus);
+	platform_device_register_full(&gumstix_gpio_vbus_info);
 }
 #else
 static void gumstix_udc_init(void)
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 2ab3d8d66466..03e34841fc00 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -239,6 +239,7 @@ static int __init pxa25x_init(void)
 		register_syscore_ops(&pxa2xx_mfp_syscore_ops);
 
 		if (!of_have_populated_dt()) {
+			software_node_register(&pxa2xx_gpiochip_node);
 			pxa2xx_set_dmac_info(&pxa25x_dma_pdata);
 			ret = platform_add_devices(pxa25x_devices,
 						   ARRAY_SIZE(pxa25x_devices));
-- 
2.45.2.803.g4e1b14247a-goog



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

* [PATCH 04/10] ARM: spitz: Simplify instantiating SPI controller
  2024-06-28 18:08 [PATCH 00/10] ARM: pxa: use software nodes/properties for GPIOs Dmitry Torokhov
                   ` (2 preceding siblings ...)
  2024-06-28 18:08 ` [PATCH 03/10] ARM: pxa/gumstix: convert vbus gpio to use software nodes Dmitry Torokhov
@ 2024-06-28 18:08 ` Dmitry Torokhov
  2024-06-28 18:08 ` [PATCH 05/10] ARM: spitz: Use software nodes to describe SPI CS lines Dmitry Torokhov
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2024-06-28 18:08 UTC (permalink / raw)
  To: Haojian Zhuang, Daniel Mack, Robert Jarzmik, Arnd Bergmann,
	Linus Walleij, soc
  Cc: linux-arm-kernel, linux-kernel

platform_device_register_full() to instantiate SPI controller in one go
instead of allocating it, creating a software node, and registering the
platform device as separate steps.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 arch/arm/mach-pxa/spitz.c | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 10ab16dcd827..b14eb2a54f80 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -580,14 +580,16 @@ static const struct property_entry spitz_spi_properties[] = {
 	{ }
 };
 
-static const struct software_node spitz_spi_node = {
+static const struct platform_device_info spitz_spi_device_info = {
+	.name = "pxa2xx-spi",
+	/* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1 */
+	.id = 2,
 	.properties = spitz_spi_properties,
 };
 
 static void __init spitz_spi_init(void)
 {
 	struct platform_device *pd;
-	int id = 2;
 	int err;
 
 	if (machine_is_akita())
@@ -598,19 +600,11 @@ static void __init spitz_spi_init(void)
 	gpiod_add_lookup_table(&spitz_ads7846_gpio_table);
 	gpiod_add_lookup_table(&spitz_spi_gpio_table);
 
-	/* 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 {
-		err = device_add_software_node(&pd->dev, &spitz_spi_node);
-		if (err) {
-			platform_device_put(pd);
-			pr_err("pxa2xx-spi: failed to add software node\n");
-		} else {
-			platform_device_add(pd);
-		}
-	}
+	pd = platform_device_register_full(&spitz_spi_device_info);
+	err = PTR_ERR_OR_ZERO(pd);
+	if (err)
+		pr_err("pxa2xx-spi: failed to instantiate SPI controller: %d\n",
+		       err);
 
 	spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices));
 }
-- 
2.45.2.803.g4e1b14247a-goog



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

* [PATCH 05/10] ARM: spitz: Use software nodes to describe SPI CS lines
  2024-06-28 18:08 [PATCH 00/10] ARM: pxa: use software nodes/properties for GPIOs Dmitry Torokhov
                   ` (3 preceding siblings ...)
  2024-06-28 18:08 ` [PATCH 04/10] ARM: spitz: Simplify instantiating SPI controller Dmitry Torokhov
@ 2024-06-28 18:08 ` Dmitry Torokhov
  2024-06-28 18:08 ` [PATCH 06/10] ARM: spitz: Use software nodes to describe audio GPIOs Dmitry Torokhov
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2024-06-28 18:08 UTC (permalink / raw)
  To: Haojian Zhuang, Daniel Mack, Robert Jarzmik, Arnd Bergmann,
	Linus Walleij, soc
  Cc: linux-arm-kernel, linux-kernel

From: Linus Walleij <linus.walleij@linaro.org>

Convert the Spitz to use software nodes for specifying SPI CS. Because
the SPI core can figure out the number of chipselects from the number
of GPIO handles specified in properties, setting "num-cs" property is
no longer needed.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 arch/arm/mach-pxa/pxa27x.c |  1 +
 arch/arm/mach-pxa/spitz.c  | 21 ++++++++++-----------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index b135b9ef665c..f8382477d629 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -341,6 +341,7 @@ static int __init pxa27x_init(void)
 		register_syscore_ops(&pxa2xx_mfp_syscore_ops);
 
 		if (!of_have_populated_dt()) {
+			software_node_register(&pxa2xx_gpiochip_node);
 			pxa2xx_set_dmac_info(&pxa27x_dma_pdata);
 			ret = platform_add_devices(devices,
 						   ARRAY_SIZE(devices));
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index b14eb2a54f80..504d04bb2df7 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -14,6 +14,7 @@
 #include <linux/gpio_keys.h>
 #include <linux/gpio.h>
 #include <linux/gpio/machine.h>
+#include <linux/gpio/property.h>
 #include <linux/leds.h>
 #include <linux/i2c.h>
 #include <linux/platform_data/i2c-pxa.h>
@@ -28,6 +29,7 @@
 #include <linux/input/matrix_keypad.h>
 #include <linux/regulator/machine.h>
 #include <linux/io.h>
+#include <linux/property.h>
 #include <linux/reboot.h>
 #include <linux/memblock.h>
 
@@ -128,7 +130,6 @@ static unsigned long spitz_pin_config[] __initdata = {
 	GPIO1_GPIO | WAKEUP_ON_EDGE_FALL,	/* SPITZ_GPIO_RESET */
 };
 
-
 /******************************************************************************
  * Scoop GPIO expander
  ******************************************************************************/
@@ -565,18 +566,17 @@ static struct spi_board_info spitz_spi_devices[] = {
 	},
 };
 
-static struct gpiod_lookup_table spitz_spi_gpio_table = {
-	.dev_id = "spi2",
-	.table = {
-		GPIO_LOOKUP_IDX("gpio-pxa", SPITZ_GPIO_ADS7846_CS, "cs", 0, GPIO_ACTIVE_LOW),
-		GPIO_LOOKUP_IDX("gpio-pxa", SPITZ_GPIO_LCDCON_CS, "cs", 1, GPIO_ACTIVE_LOW),
-		GPIO_LOOKUP_IDX("gpio-pxa", SPITZ_GPIO_MAX1111_CS, "cs", 2, GPIO_ACTIVE_LOW),
-		{ },
-	},
+static const struct software_node_ref_args spitz_spi_gpio_refs[] = {
+	SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, SPITZ_GPIO_ADS7846_CS,
+				GPIO_ACTIVE_LOW),
+	SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, SPITZ_GPIO_LCDCON_CS,
+				GPIO_ACTIVE_LOW),
+	SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, SPITZ_GPIO_MAX1111_CS,
+				GPIO_ACTIVE_LOW),
 };
 
 static const struct property_entry spitz_spi_properties[] = {
-	PROPERTY_ENTRY_U32("num-cs", 3),
+	PROPERTY_ENTRY_REF_ARRAY("gpios", spitz_spi_gpio_refs),
 	{ }
 };
 
@@ -598,7 +598,6 @@ static void __init spitz_spi_init(void)
 		gpiod_add_lookup_table(&spitz_lcdcon_gpio_table);
 
 	gpiod_add_lookup_table(&spitz_ads7846_gpio_table);
-	gpiod_add_lookup_table(&spitz_spi_gpio_table);
 
 	pd = platform_device_register_full(&spitz_spi_device_info);
 	err = PTR_ERR_OR_ZERO(pd);
-- 
2.45.2.803.g4e1b14247a-goog



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

* [PATCH 06/10] ARM: spitz: Use software nodes to describe audio GPIOs
  2024-06-28 18:08 [PATCH 00/10] ARM: pxa: use software nodes/properties for GPIOs Dmitry Torokhov
                   ` (4 preceding siblings ...)
  2024-06-28 18:08 ` [PATCH 05/10] ARM: spitz: Use software nodes to describe SPI CS lines Dmitry Torokhov
@ 2024-06-28 18:08 ` Dmitry Torokhov
  2024-06-28 18:08 ` [PATCH 07/10] ARM: spitz: Use software nodes to describe LCD GPIOs Dmitry Torokhov
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2024-06-28 18:08 UTC (permalink / raw)
  To: Haojian Zhuang, Daniel Mack, Robert Jarzmik, Arnd Bergmann,
	Linus Walleij, soc
  Cc: linux-arm-kernel, linux-kernel

Convert Spitz to use software nodes for specifying GPIOs for the audio
chip.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 arch/arm/mach-pxa/spitz.c | 66 ++++++++++++++++++++++++++-------------
 1 file changed, 44 insertions(+), 22 deletions(-)

diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 504d04bb2df7..278d49ed7a9c 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -130,6 +130,20 @@ static unsigned long spitz_pin_config[] __initdata = {
 	GPIO1_GPIO | WAKEUP_ON_EDGE_FALL,	/* SPITZ_GPIO_RESET */
 };
 
+static const struct software_node spitz_scoop_1_gpiochip_node = {
+	.name = "sharp-scoop.0",
+};
+
+/* Only on Spitz */
+static const struct software_node spitz_scoop_2_gpiochip_node = {
+	.name = "sharp-scoop.1",
+};
+
+/* Only on Akita */
+static const struct software_node akita_max7310_gpiochip_node = {
+	.name = "i2c-max7310",
+};
+
 /******************************************************************************
  * Scoop GPIO expander
  ******************************************************************************/
@@ -950,24 +964,24 @@ static void __init spitz_i2c_init(void)
 static inline void spitz_i2c_init(void) {}
 #endif
 
-static struct gpiod_lookup_table spitz_audio_gpio_table = {
-	.dev_id = "spitz-audio",
-	.table = {
-		GPIO_LOOKUP("sharp-scoop.0", 3, "mute-l", GPIO_ACTIVE_HIGH),
-		GPIO_LOOKUP("sharp-scoop.0", 4, "mute-r", GPIO_ACTIVE_HIGH),
-		GPIO_LOOKUP("sharp-scoop.1", 8, "mic", GPIO_ACTIVE_HIGH),
-		{ },
-	},
+static const struct property_entry spitz_audio_props[] = {
+	PROPERTY_ENTRY_GPIO("mute-l-gpios", &spitz_scoop_1_gpiochip_node, 3,
+			    GPIO_ACTIVE_HIGH),
+	PROPERTY_ENTRY_GPIO("mute-r-gpios", &spitz_scoop_1_gpiochip_node, 4,
+			    GPIO_ACTIVE_HIGH),
+	PROPERTY_ENTRY_GPIO("mic-gpios", &spitz_scoop_2_gpiochip_node, 8,
+			    GPIO_ACTIVE_HIGH),
+	{ }
 };
 
-static struct gpiod_lookup_table akita_audio_gpio_table = {
-	.dev_id = "spitz-audio",
-	.table = {
-		GPIO_LOOKUP("sharp-scoop.0", 3, "mute-l", GPIO_ACTIVE_HIGH),
-		GPIO_LOOKUP("sharp-scoop.0", 4, "mute-r", GPIO_ACTIVE_HIGH),
-		GPIO_LOOKUP("i2c-max7310", 2, "mic", GPIO_ACTIVE_HIGH),
-		{ },
-	},
+static const struct property_entry akita_audio_props[] = {
+	PROPERTY_ENTRY_GPIO("mute-l-gpios", &spitz_scoop_1_gpiochip_node, 3,
+			    GPIO_ACTIVE_HIGH),
+	PROPERTY_ENTRY_GPIO("mute-r-gpios", &spitz_scoop_1_gpiochip_node, 4,
+			    GPIO_ACTIVE_HIGH),
+	PROPERTY_ENTRY_GPIO("mic-gpios", &akita_max7310_gpiochip_node, 2,
+			    GPIO_ACTIVE_HIGH),
+	{ }
 };
 
 /******************************************************************************
@@ -975,12 +989,14 @@ static struct gpiod_lookup_table akita_audio_gpio_table = {
  ******************************************************************************/
 static inline void spitz_audio_init(void)
 {
-	if (machine_is_akita())
-		gpiod_add_lookup_table(&akita_audio_gpio_table);
-	else
-		gpiod_add_lookup_table(&spitz_audio_gpio_table);
-
-	platform_device_register_simple("spitz-audio", -1, NULL, 0);
+	struct platform_device_info audio_info = {
+		.name = "spitz-audio",
+		.id = PLATFORM_DEVID_NONE,
+		.properties = machine_is_akita() ?
+				akita_audio_props : spitz_audio_props,
+	};
+
+	platform_device_register_full(&audio_info);
 }
 
 /******************************************************************************
@@ -1003,6 +1019,12 @@ static void spitz_restart(enum reboot_mode mode, const char *cmd)
 
 static void __init spitz_init(void)
 {
+	software_node_register(&spitz_scoop_1_gpiochip_node);
+	if (machine_is_akita())
+		software_node_register(&akita_max7310_gpiochip_node);
+	else
+		software_node_register(&spitz_scoop_2_gpiochip_node);
+
 	init_gpio_reset(SPITZ_GPIO_ON_RESET, 1, 0);
 	pm_power_off = spitz_poweroff;
 
-- 
2.45.2.803.g4e1b14247a-goog



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

* [PATCH 07/10] ARM: spitz: Use software nodes to describe LCD GPIOs
  2024-06-28 18:08 [PATCH 00/10] ARM: pxa: use software nodes/properties for GPIOs Dmitry Torokhov
                   ` (5 preceding siblings ...)
  2024-06-28 18:08 ` [PATCH 06/10] ARM: spitz: Use software nodes to describe audio GPIOs Dmitry Torokhov
@ 2024-06-28 18:08 ` Dmitry Torokhov
  2024-06-28 18:08 ` [PATCH 08/10] ARM: spitz: Use software nodes to describe MMC GPIOs Dmitry Torokhov
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2024-06-28 18:08 UTC (permalink / raw)
  To: Haojian Zhuang, Daniel Mack, Robert Jarzmik, Arnd Bergmann,
	Linus Walleij, soc
  Cc: linux-arm-kernel, linux-kernel

Convert Spitz to use software nodes for specifying GPIOs for the LCD.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 arch/arm/mach-pxa/spitz.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 278d49ed7a9c..c79510185ce3 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -532,22 +532,24 @@ static struct gpiod_lookup_table spitz_ads7846_gpio_table = {
 	},
 };
 
-static struct gpiod_lookup_table spitz_lcdcon_gpio_table = {
-	.dev_id = "spi2.1",
-	.table = {
-		GPIO_LOOKUP("sharp-scoop.1", 6, "BL_CONT", GPIO_ACTIVE_LOW),
-		GPIO_LOOKUP("sharp-scoop.1", 7, "BL_ON", GPIO_ACTIVE_HIGH),
-		{ },
-	},
+static const struct property_entry spitz_lcdcon_props[] = {
+	PROPERTY_ENTRY_GPIO("BL_CONT-gpios",
+			    &spitz_scoop_2_gpiochip_node, 6, GPIO_ACTIVE_LOW),
+	PROPERTY_ENTRY_GPIO("BL_ON-gpios",
+			    &spitz_scoop_2_gpiochip_node, 7, GPIO_ACTIVE_HIGH),
+	{ }
 };
 
-static struct gpiod_lookup_table akita_lcdcon_gpio_table = {
-	.dev_id = "spi2.1",
-	.table = {
-		GPIO_LOOKUP("i2c-max7310", 3, "BL_ON", GPIO_ACTIVE_HIGH),
-		GPIO_LOOKUP("i2c-max7310", 4, "BL_CONT", GPIO_ACTIVE_LOW),
-		{ },
-	},
+static const struct property_entry akita_lcdcon_props[] = {
+	PROPERTY_ENTRY_GPIO("BL_ON-gpios",
+			    &akita_max7310_gpiochip_node, 3, GPIO_ACTIVE_HIGH),
+	PROPERTY_ENTRY_GPIO("BL_CONT-gpios",
+			    &akita_max7310_gpiochip_node, 4, GPIO_ACTIVE_LOW),
+	{ }
+};
+
+static struct software_node spitz_lcdcon_node = {
+	.name = "spitz-lcdcon",
 };
 
 static struct corgi_lcd_platform_data spitz_lcdcon_info = {
@@ -572,6 +574,7 @@ static struct spi_board_info spitz_spi_devices[] = {
 		.bus_num		= 2,
 		.chip_select		= 1,
 		.platform_data		= &spitz_lcdcon_info,
+		.swnode			= &spitz_lcdcon_node,
 	}, {
 		.modalias		= "max1111",
 		.max_speed_hz		= 450000,
@@ -606,11 +609,6 @@ static void __init spitz_spi_init(void)
 	struct platform_device *pd;
 	int err;
 
-	if (machine_is_akita())
-		gpiod_add_lookup_table(&akita_lcdcon_gpio_table);
-	else
-		gpiod_add_lookup_table(&spitz_lcdcon_gpio_table);
-
 	gpiod_add_lookup_table(&spitz_ads7846_gpio_table);
 
 	pd = platform_device_register_full(&spitz_spi_device_info);
@@ -619,6 +617,8 @@ static void __init spitz_spi_init(void)
 		pr_err("pxa2xx-spi: failed to instantiate SPI controller: %d\n",
 		       err);
 
+	spitz_lcdcon_node.properties = machine_is_akita() ?
+					akita_lcdcon_props : spitz_lcdcon_props;
 	spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices));
 }
 #else
-- 
2.45.2.803.g4e1b14247a-goog



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

* [PATCH 08/10] ARM: spitz: Use software nodes to describe MMC GPIOs
  2024-06-28 18:08 [PATCH 00/10] ARM: pxa: use software nodes/properties for GPIOs Dmitry Torokhov
                   ` (6 preceding siblings ...)
  2024-06-28 18:08 ` [PATCH 07/10] ARM: spitz: Use software nodes to describe LCD GPIOs Dmitry Torokhov
@ 2024-06-28 18:08 ` Dmitry Torokhov
  2024-06-28 18:08 ` [PATCH 09/10] ARM: spitz: Use software nodes to describe LED GPIOs Dmitry Torokhov
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2024-06-28 18:08 UTC (permalink / raw)
  To: Haojian Zhuang, Daniel Mack, Robert Jarzmik, Arnd Bergmann,
	Linus Walleij, soc
  Cc: linux-arm-kernel, linux-kernel

Convert Spitz to use software nodes for specifying GPIOs for the MMC.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 arch/arm/mach-pxa/devices.c              | 36 +++++++++++++-----------
 arch/arm/mach-pxa/devices.h              |  1 -
 arch/arm/mach-pxa/gumstix.c              |  2 +-
 arch/arm/mach-pxa/spitz.c                | 18 +++++-------
 include/linux/platform_data/mmc-pxamci.h |  4 ++-
 5 files changed, 31 insertions(+), 30 deletions(-)

diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
index e2758c94fd77..d050a4c78f97 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -48,7 +48,7 @@ struct platform_device pxa_device_pmu = {
 	.num_resources	= 1,
 };
 
-static struct resource pxamci_resources[] = {
+static const struct resource pxamci_resources[] = {
 	[0] = {
 		.start	= 0x41100000,
 		.end	= 0x41100fff,
@@ -61,22 +61,26 @@ static struct resource pxamci_resources[] = {
 	},
 };
 
-static u64 pxamci_dmamask = 0xffffffffUL;
-
-struct platform_device pxa_device_mci = {
-	.name		= "pxa2xx-mci",
-	.id		= 0,
-	.dev		= {
-		.dma_mask = &pxamci_dmamask,
-		.coherent_dma_mask = 0xffffffff,
-	},
-	.num_resources	= ARRAY_SIZE(pxamci_resources),
-	.resource	= pxamci_resources,
-};
-
-void __init pxa_set_mci_info(struct pxamci_platform_data *info)
+void __init pxa_set_mci_info(const struct pxamci_platform_data *info,
+			     const struct property_entry *props)
 {
-	pxa_register_device(&pxa_device_mci, info);
+	const struct platform_device_info mci_info = {
+		.name		= "pxa2xx-mci",
+		.id		= 0,
+		.res		= pxamci_resources,
+		.num_res	= ARRAY_SIZE(pxamci_resources),
+		.data		= info,
+		.size_data	= sizeof(*info),
+		.dma_mask	= 0xffffffffUL,
+		.properties	= props,
+	};
+	struct platform_device *mci_dev;
+	int err;
+
+	mci_dev = platform_device_register_full(&mci_info);
+	err = PTR_ERR_OR_ZERO(mci_dev);
+	if (err)
+		pr_err("Unable to create mci device: %d\n", err);
 }
 
 static struct pxa2xx_udc_mach_info pxa_udc_info = {
diff --git a/arch/arm/mach-pxa/devices.h b/arch/arm/mach-pxa/devices.h
index b7c0e138ef61..72c556ff67db 100644
--- a/arch/arm/mach-pxa/devices.h
+++ b/arch/arm/mach-pxa/devices.h
@@ -4,7 +4,6 @@
 struct mmp_dma_platdata;
 
 extern struct platform_device pxa_device_pmu;
-extern struct platform_device pxa_device_mci;
 extern struct platform_device pxa3xx_device_mci2;
 extern struct platform_device pxa3xx_device_mci3;
 extern struct platform_device pxa25x_device_udc;
diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c
index b9eddc691097..efa6faa62a2c 100644
--- a/arch/arm/mach-pxa/gumstix.c
+++ b/arch/arm/mach-pxa/gumstix.c
@@ -90,7 +90,7 @@ static struct pxamci_platform_data gumstix_mci_platform_data = {
 
 static void __init gumstix_mmc_init(void)
 {
-	pxa_set_mci_info(&gumstix_mci_platform_data);
+	pxa_set_mci_info(&gumstix_mci_platform_data, NULL);
 }
 #else
 static void __init gumstix_mmc_init(void)
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index c79510185ce3..4720a40587f1 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -651,21 +651,17 @@ static struct pxamci_platform_data spitz_mci_platform_data = {
 	.setpower		= spitz_mci_setpower,
 };
 
-static struct gpiod_lookup_table spitz_mci_gpio_table = {
-	.dev_id = "pxa2xx-mci.0",
-	.table = {
-		GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_nSD_DETECT,
-			    "cd", GPIO_ACTIVE_LOW),
-		GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_nSD_WP,
-			    "wp", GPIO_ACTIVE_LOW),
-		{ },
-	},
+static const struct property_entry spitz_mci_props[] __initconst = {
+	PROPERTY_ENTRY_GPIO("cd-gpios", &pxa2xx_gpiochip_node,
+			    SPITZ_GPIO_nSD_DETECT, GPIO_ACTIVE_LOW),
+	PROPERTY_ENTRY_GPIO("wp-gpios", &pxa2xx_gpiochip_node,
+			    SPITZ_GPIO_nSD_WP, GPIO_ACTIVE_LOW),
+	{ }
 };
 
 static void __init spitz_mmc_init(void)
 {
-	gpiod_add_lookup_table(&spitz_mci_gpio_table);
-	pxa_set_mci_info(&spitz_mci_platform_data);
+	pxa_set_mci_info(&spitz_mci_platform_data, spitz_mci_props);
 }
 #else
 static inline void spitz_mmc_init(void) {}
diff --git a/include/linux/platform_data/mmc-pxamci.h b/include/linux/platform_data/mmc-pxamci.h
index 7e44e84e7150..652f323b5ecc 100644
--- a/include/linux/platform_data/mmc-pxamci.h
+++ b/include/linux/platform_data/mmc-pxamci.h
@@ -7,6 +7,7 @@
 
 struct device;
 struct mmc_host;
+struct property_entry;
 
 struct pxamci_platform_data {
 	unsigned int ocr_mask;			/* available voltages */
@@ -18,7 +19,8 @@ struct pxamci_platform_data {
 	bool gpio_card_ro_invert;		/* gpio ro is inverted */
 };
 
-extern void pxa_set_mci_info(struct pxamci_platform_data *info);
+extern void pxa_set_mci_info(const struct pxamci_platform_data *info,
+			     const struct property_entry *props);
 extern void pxa3xx_set_mci2_info(struct pxamci_platform_data *info);
 extern void pxa3xx_set_mci3_info(struct pxamci_platform_data *info);
 
-- 
2.45.2.803.g4e1b14247a-goog



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

* [PATCH 09/10] ARM: spitz: Use software nodes to describe LED GPIOs
  2024-06-28 18:08 [PATCH 00/10] ARM: pxa: use software nodes/properties for GPIOs Dmitry Torokhov
                   ` (7 preceding siblings ...)
  2024-06-28 18:08 ` [PATCH 08/10] ARM: spitz: Use software nodes to describe MMC GPIOs Dmitry Torokhov
@ 2024-06-28 18:08 ` Dmitry Torokhov
  2024-06-28 18:08 ` [PATCH 10/10] ARM: spitz: Use software nodes for the ADS7846 touchscreen Dmitry Torokhov
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2024-06-28 18:08 UTC (permalink / raw)
  To: Haojian Zhuang, Daniel Mack, Robert Jarzmik, Arnd Bergmann,
	Linus Walleij, soc
  Cc: linux-arm-kernel, linux-kernel

Convert Spitz to use software nodes for specifying GPIOs for the LEDs.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 arch/arm/mach-pxa/spitz.c | 71 +++++++++++++++++++++++++++------------
 1 file changed, 50 insertions(+), 21 deletions(-)

diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 4720a40587f1..b19d4ed35192 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -467,35 +467,64 @@ static inline void spitz_keys_init(void) {}
  * LEDs
  ******************************************************************************/
 #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
-static struct gpio_led spitz_gpio_leds[] = {
-	{
-		.name			= "spitz:amber:charge",
-		.default_trigger	= "sharpsl-charge",
-		.gpio			= SPITZ_GPIO_LED_ORANGE,
-	},
-	{
-		.name			= "spitz:green:hddactivity",
-		.default_trigger	= "disk-activity",
-		.gpio			= SPITZ_GPIO_LED_GREEN,
-	},
+static const struct software_node spitz_gpio_leds_node = {
+	.name = "spitz-leds",
 };
 
-static struct gpio_led_platform_data spitz_gpio_leds_info = {
-	.leds		= spitz_gpio_leds,
-	.num_leds	= ARRAY_SIZE(spitz_gpio_leds),
+static const struct property_entry spitz_orange_led_props[] = {
+	PROPERTY_ENTRY_STRING("linux,default-trigger", "sharpsl-charge"),
+	PROPERTY_ENTRY_GPIO("gpios",
+			    &spitz_scoop_1_gpiochip_node, 6, GPIO_ACTIVE_HIGH),
+	{ }
 };
 
-static struct platform_device spitz_led_device = {
-	.name		= "leds-gpio",
-	.id		= -1,
-	.dev		= {
-		.platform_data	= &spitz_gpio_leds_info,
-	},
+static const struct software_node spitz_orange_led_node = {
+	.name = "spitz:amber:charge",
+	.parent = &spitz_gpio_leds_node,
+	.properties = spitz_orange_led_props,
+};
+
+static const struct property_entry spitz_green_led_props[] = {
+	PROPERTY_ENTRY_STRING("linux,default-trigger", "disk-activity"),
+	PROPERTY_ENTRY_GPIO("gpios",
+			    &spitz_scoop_1_gpiochip_node, 0, GPIO_ACTIVE_HIGH),
+	{ }
+};
+
+static const struct software_node spitz_green_led_node = {
+	.name = "spitz:green:hddactivity",
+	.parent = &spitz_gpio_leds_node,
+	.properties = spitz_green_led_props,
+};
+
+static const struct software_node *spitz_gpio_leds_swnodes[] = {
+	&spitz_gpio_leds_node,
+	&spitz_orange_led_node,
+	&spitz_green_led_node,
+	NULL
 };
 
 static void __init spitz_leds_init(void)
 {
-	platform_device_register(&spitz_led_device);
+	struct platform_device_info led_info = {
+		.name	= "leds-gpio",
+		.id	= PLATFORM_DEVID_NONE,
+	};
+	struct platform_device *led_dev;
+	int err;
+
+	err = software_node_register_node_group(spitz_gpio_leds_swnodes);
+	if (err) {
+		pr_err("failed to register LED software nodes: %d\n", err);
+		return;
+	}
+
+	led_info.fwnode = software_node_fwnode(&spitz_gpio_leds_node);
+
+	led_dev = platform_device_register_full(&led_info);
+	err = PTR_ERR_OR_ZERO(led_dev);
+	if (err)
+		pr_err("failed to create LED device: %d\n", err);
 }
 #else
 static inline void spitz_leds_init(void) {}
-- 
2.45.2.803.g4e1b14247a-goog



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

* [PATCH 10/10] ARM: spitz: Use software nodes for the ADS7846 touchscreen
  2024-06-28 18:08 [PATCH 00/10] ARM: pxa: use software nodes/properties for GPIOs Dmitry Torokhov
                   ` (8 preceding siblings ...)
  2024-06-28 18:08 ` [PATCH 09/10] ARM: spitz: Use software nodes to describe LED GPIOs Dmitry Torokhov
@ 2024-06-28 18:08 ` Dmitry Torokhov
  2024-06-28 20:59 ` [PATCH 00/10] ARM: pxa: use software nodes/properties for GPIOs Arnd Bergmann
  2024-06-30  8:07 ` Linus Walleij
  11 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2024-06-28 18:08 UTC (permalink / raw)
  To: Haojian Zhuang, Daniel Mack, Robert Jarzmik, Arnd Bergmann,
	Linus Walleij, soc
  Cc: linux-arm-kernel, linux-kernel

From: Linus Walleij <linus.walleij@linaro.org>

Convert the Spitz to use software nodes to describe GPIOs for the
ADS7846 touchscreen. As part of the conversion switch from the custom
wait_for_sync() callback to defining hsync GPIO that can be used by
the ads7846 driver to detect hsync.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 arch/arm/mach-pxa/spitz.c | 40 +++++++++++++++------------------------
 1 file changed, 15 insertions(+), 25 deletions(-)

diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index b19d4ed35192..452bf7aac1fa 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -534,31 +534,23 @@ static inline void spitz_leds_init(void) {}
  * SSP Devices
  ******************************************************************************/
 #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
-static void spitz_ads7846_wait_for_hsync(void)
-{
-	while (gpio_get_value(SPITZ_GPIO_HSYNC))
-		cpu_relax();
-
-	while (!gpio_get_value(SPITZ_GPIO_HSYNC))
-		cpu_relax();
-}
 
-static struct ads7846_platform_data spitz_ads7846_info = {
-	.model			= 7846,
-	.vref_delay_usecs	= 100,
-	.x_plate_ohms		= 419,
-	.y_plate_ohms		= 486,
-	.pressure_max		= 1024,
-	.wait_for_sync		= spitz_ads7846_wait_for_hsync,
+static const struct property_entry spitz_ads7846_props[] = {
+	PROPERTY_ENTRY_STRING("compatible", "ti,ads7846"),
+	PROPERTY_ENTRY_U32("touchscreen-max-pressure", 1024),
+	PROPERTY_ENTRY_U16("ti,x-plate-ohms", 419),
+	PROPERTY_ENTRY_U16("ti,y-plate-ohms", 486),
+	PROPERTY_ENTRY_U16("ti,vref-delay-usecs", 100),
+	PROPERTY_ENTRY_GPIO("pendown-gpios", &pxa2xx_gpiochip_node,
+			    SPITZ_GPIO_TP_INT, GPIO_ACTIVE_LOW),
+	PROPERTY_ENTRY_GPIO("ti,hsync-gpios", &pxa2xx_gpiochip_node,
+			    SPITZ_GPIO_HSYNC, GPIO_ACTIVE_LOW),
+	{ }
 };
 
-static struct gpiod_lookup_table spitz_ads7846_gpio_table = {
-	.dev_id = "spi2.0",
-	.table = {
-		GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_TP_INT,
-			    "pendown", GPIO_ACTIVE_LOW),
-		{ }
-	},
+static const struct software_node spitz_ads7846_swnode = {
+	.name = "ads7846",
+	.properties = spitz_ads7846_props,
 };
 
 static const struct property_entry spitz_lcdcon_props[] = {
@@ -595,7 +587,7 @@ static struct spi_board_info spitz_spi_devices[] = {
 		.max_speed_hz		= 1200000,
 		.bus_num		= 2,
 		.chip_select		= 0,
-		.platform_data		= &spitz_ads7846_info,
+		.swnode			= &spitz_ads7846_swnode,
 		.irq			= PXA_GPIO_TO_IRQ(SPITZ_GPIO_TP_INT),
 	}, {
 		.modalias		= "corgi-lcd",
@@ -638,8 +630,6 @@ static void __init spitz_spi_init(void)
 	struct platform_device *pd;
 	int err;
 
-	gpiod_add_lookup_table(&spitz_ads7846_gpio_table);
-
 	pd = platform_device_register_full(&spitz_spi_device_info);
 	err = PTR_ERR_OR_ZERO(pd);
 	if (err)
-- 
2.45.2.803.g4e1b14247a-goog



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

* Re: [PATCH 00/10] ARM: pxa: use software nodes/properties for GPIOs
  2024-06-28 18:08 [PATCH 00/10] ARM: pxa: use software nodes/properties for GPIOs Dmitry Torokhov
                   ` (9 preceding siblings ...)
  2024-06-28 18:08 ` [PATCH 10/10] ARM: spitz: Use software nodes for the ADS7846 touchscreen Dmitry Torokhov
@ 2024-06-28 20:59 ` Arnd Bergmann
  2024-06-28 21:08   ` Arnd Bergmann
  2024-06-28 21:44   ` Dmitry Torokhov
  2024-06-30  8:07 ` Linus Walleij
  11 siblings, 2 replies; 20+ messages in thread
From: Arnd Bergmann @ 2024-06-28 20:59 UTC (permalink / raw)
  To: Dmitry Torokhov, Haojian Zhuang, Daniel Mack, Robert Jarzmik,
	Linus Walleij, soc
  Cc: linux-arm-kernel, linux-kernel

On Fri, Jun 28, 2024, at 20:08, Dmitry Torokhov wrote:
> This series converts legacy pxa boards (spitz, gumstix) to use software
> nodes/properties to describe various GPIOs instead of relying on GPIO
> lookup tables. The benefit is that structure and behavior is closer to
> DT-described GPIOs.
>
> The very first patch ("ARM: spitz: fix GPIO assignment for backlight")
> is actually a fix that IMO should be applied sooner rather than later,
> the rest of patches are enhancements. The reason it is sent with the
> rest of the series is that later changes contextually depend on it.
>
> The last patch ("ARM: spitz: Use software nodes for the ADS7846
> touchscreen") soft-depends on corresponding changes by Linus Walleij to
> the ads7846 driver in input tree. It compiles without it, but the device
> will not sync with display refreshes. I have created an immutable branch
> (branched from v6.9) at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git ib/ads7846-hsync
>
> in case you wish to pull it in.
>
> Regretfully it was only compiled as I do not have access to the relevant
> hardware.

Hi Dmitry,

I'm happy to pull these in directly, hopefully with some extra
review or ack from the maintainers. If there are no negative
comments, feel free to resend them to soc@kernel.org for me
to pick up.

Is your goal to of the series to eventually convert all
gpio descriptors over to software nodes, or are you working
towards converting all of mach-pxa to DT?

In the latter case, note that the reason we kept these
specific board files is that they have reasonable support in
qemu and you can probably figure out how to test them if you
try hard enough. I have not tried myself though, and there is
a high chance that current kernels won't boot without extra
fixes.

If your goal is to change all board files to software nodes,
I think we should take a step back, since most of those boards
are likely to get removed anyway. Two years ago, I removed
almost 90% of the board files remaining at the time after
showing that they were pretty much all unused. I kept the
ones that either had known users, or that someone wanted to
keep for some reason and work on doing the DT conversion.
For most of these (including PXA), there has been no work
on this in the past two years, so I think we should ask the
same question again and see which ones we can just remove
this time.

      Arnd


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

* Re: [PATCH 00/10] ARM: pxa: use software nodes/properties for GPIOs
  2024-06-28 20:59 ` [PATCH 00/10] ARM: pxa: use software nodes/properties for GPIOs Arnd Bergmann
@ 2024-06-28 21:08   ` Arnd Bergmann
  2024-06-28 21:44   ` Dmitry Torokhov
  1 sibling, 0 replies; 20+ messages in thread
From: Arnd Bergmann @ 2024-06-28 21:08 UTC (permalink / raw)
  To: Dmitry Torokhov, Haojian Zhuang, Daniel Mack, Robert Jarzmik,
	Linus Walleij, soc
  Cc: linux-arm-kernel, linux-kernel

On Fri, Jun 28, 2024, at 22:59, Arnd Bergmann wrote:
> I'm happy to pull these in directly, hopefully with some extra
> review or ack from the maintainers. If there are no negative
> comments, feel free to resend them to soc@kernel.org for me
> to pick up.

I just saw that you did in fact send it to soc@kernel.org
already. I'll wait for comments then and just merge it
if nobody has any objections.

      Arnd


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

* Re: [PATCH 00/10] ARM: pxa: use software nodes/properties for GPIOs
  2024-06-28 20:59 ` [PATCH 00/10] ARM: pxa: use software nodes/properties for GPIOs Arnd Bergmann
  2024-06-28 21:08   ` Arnd Bergmann
@ 2024-06-28 21:44   ` Dmitry Torokhov
  2024-06-29  7:34     ` Arnd Bergmann
  1 sibling, 1 reply; 20+ messages in thread
From: Dmitry Torokhov @ 2024-06-28 21:44 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Haojian Zhuang, Daniel Mack, Robert Jarzmik, Linus Walleij, soc,
	linux-arm-kernel, linux-kernel

Hi Arnd,

On Fri, Jun 28, 2024 at 10:59:53PM +0200, Arnd Bergmann wrote:
> On Fri, Jun 28, 2024, at 20:08, Dmitry Torokhov wrote:
> > This series converts legacy pxa boards (spitz, gumstix) to use software
> > nodes/properties to describe various GPIOs instead of relying on GPIO
> > lookup tables. The benefit is that structure and behavior is closer to
> > DT-described GPIOs.
> >
> > The very first patch ("ARM: spitz: fix GPIO assignment for backlight")
> > is actually a fix that IMO should be applied sooner rather than later,
> > the rest of patches are enhancements. The reason it is sent with the
> > rest of the series is that later changes contextually depend on it.
> >
> > The last patch ("ARM: spitz: Use software nodes for the ADS7846
> > touchscreen") soft-depends on corresponding changes by Linus Walleij to
> > the ads7846 driver in input tree. It compiles without it, but the device
> > will not sync with display refreshes. I have created an immutable branch
> > (branched from v6.9) at:
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git ib/ads7846-hsync
> >
> > in case you wish to pull it in.
> >
> > Regretfully it was only compiled as I do not have access to the relevant
> > hardware.
> 
> Hi Dmitry,
> 
> I'm happy to pull these in directly, hopefully with some extra
> review or ack from the maintainers. If there are no negative
> comments, feel free to resend them to soc@kernel.org for me
> to pick up.
> 
> Is your goal to of the series to eventually convert all
> gpio descriptors over to software nodes, or are you working
> towards converting all of mach-pxa to DT?
> 
> In the latter case, note that the reason we kept these
> specific board files is that they have reasonable support in
> qemu and you can probably figure out how to test them if you
> try hard enough. I have not tried myself though, and there is
> a high chance that current kernels won't boot without extra
> fixes.
> 
> If your goal is to change all board files to software nodes,
> I think we should take a step back, since most of those boards
> are likely to get removed anyway. Two years ago, I removed
> almost 90% of the board files remaining at the time after
> showing that they were pretty much all unused. I kept the
> ones that either had known users, or that someone wanted to
> keep for some reason and work on doing the DT conversion.
> For most of these (including PXA), there has been no work
> on this in the past two years, so I think we should ask the
> same question again and see which ones we can just remove
> this time.

I would like to eventually switch everything to the software
nodes/property entries. The GPIO lookup tables were introduced before we
had software nodes and were really convenient way to describe GPIOs on
non-ACPI non-DT boards. However now that we have software
nodes/properties we can move away from both custom platform data and
lookup tables in the board code and remove platform data support from
the drivers, unifying the driver behavior.

I am not in any rush with this, so if some boards are on a cutting block
I am happy to wait. I started poking at Spitz and the rest of mach-pxa
because Linus W sent out a patch to ads7846 ;) and I also remembered
that you already dropped bunch of PXA boards that were no longer
relevant so I assumed spitz and gumstix still have some use.

Could you tell me which ones are likely to stay vs ones that might go? I
think arch/arm/mach-s3c/mach-crag* is staying? jornada720?

Thanks.

-- 
Dmitry


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

* Re: [PATCH 00/10] ARM: pxa: use software nodes/properties for GPIOs
  2024-06-28 21:44   ` Dmitry Torokhov
@ 2024-06-29  7:34     ` Arnd Bergmann
  0 siblings, 0 replies; 20+ messages in thread
From: Arnd Bergmann @ 2024-06-29  7:34 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Haojian Zhuang, Daniel Mack, Robert Jarzmik, Linus Walleij, soc,
	linux-arm-kernel, linux-kernel

On Fri, Jun 28, 2024, at 23:44, Dmitry Torokhov wrote:
> I would like to eventually switch everything to the software
> nodes/property entries. The GPIO lookup tables were introduced before we
> had software nodes and were really convenient way to describe GPIOs on
> non-ACPI non-DT boards. However now that we have software
> nodes/properties we can move away from both custom platform data and
> lookup tables in the board code and remove platform data support from
> the drivers, unifying the driver behavior.

Right, makes sense.

> I am not in any rush with this, so if some boards are on a cutting block
> I am happy to wait. I started poking at Spitz and the rest of mach-pxa
> because Linus W sent out a patch to ads7846 ;) and I also remembered
> that you already dropped bunch of PXA boards that were no longer
> relevant so I assumed spitz and gumstix still have some use.
>
> Could you tell me which ones are likely to stay vs ones that might go? I
> think arch/arm/mach-s3c/mach-crag* is staying? jornada720?

I think in the long run all of them will either get removed
or converted to DT, though it looks like the DT conversion has
not picked up for anything other than ep93xx.

For the timeline, I need to ask the same people again that
wanted the board files to stay two years ago. omap1 might be
a good one to prioritize for software nodes, as that likely
still has users and it would help getting closer to a DT
version.

     Arnd


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

* Re: [PATCH 00/10] ARM: pxa: use software nodes/properties for GPIOs
  2024-06-28 18:08 [PATCH 00/10] ARM: pxa: use software nodes/properties for GPIOs Dmitry Torokhov
                   ` (10 preceding siblings ...)
  2024-06-28 20:59 ` [PATCH 00/10] ARM: pxa: use software nodes/properties for GPIOs Arnd Bergmann
@ 2024-06-30  8:07 ` Linus Walleij
  2024-06-30  8:41   ` Arnd Bergmann
  11 siblings, 1 reply; 20+ messages in thread
From: Linus Walleij @ 2024-06-30  8:07 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Haojian Zhuang, Daniel Mack, Robert Jarzmik, Arnd Bergmann, soc,
	linux-arm-kernel, linux-kernel

On Fri, Jun 28, 2024 at 8:09 PM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:

> This series converts legacy pxa boards (spitz, gumstix) to use software
> nodes/properties to describe various GPIOs instead of relying on GPIO
> lookup tables. The benefit is that structure and behavior is closer to
> DT-described GPIOs.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
for the patches I didn't write myself.

What this really needs is testing... :/

If nobody is testing, I think you should just send a pull request
to soc@kernel.org and users can find out the hard way and help
fixing regressions. It's a bit hopeless to work on this sometimes.

Yours,
Linus Walleij


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

* Re: [PATCH 00/10] ARM: pxa: use software nodes/properties for GPIOs
  2024-06-30  8:07 ` Linus Walleij
@ 2024-06-30  8:41   ` Arnd Bergmann
  0 siblings, 0 replies; 20+ messages in thread
From: Arnd Bergmann @ 2024-06-30  8:41 UTC (permalink / raw)
  To: Linus Walleij, Dmitry Torokhov
  Cc: Haojian Zhuang, Daniel Mack, Robert Jarzmik, soc,
	linux-arm-kernel, linux-kernel

On Sun, Jun 30, 2024, at 10:07, Linus Walleij wrote:
> On Fri, Jun 28, 2024 at 8:09 PM Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
>
>> This series converts legacy pxa boards (spitz, gumstix) to use software
>> nodes/properties to describe various GPIOs instead of relying on GPIO
>> lookup tables. The benefit is that structure and behavior is closer to
>> DT-described GPIOs.
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> for the patches I didn't write myself.

Thanks for the review!

> What this really needs is testing... :/
>
> If nobody is testing, I think you should just send a pull request
> to soc@kernel.org and users can find out the hard way and help
> fixing regressions. It's a bit hopeless to work on this sometimes.

No need, the patches are already in my patchwork queue and I
will just apply them directly.

       Arnd


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

* Re: [PATCH 03/10] ARM: pxa/gumstix: convert vbus gpio to use software nodes
  2024-06-28 18:08 ` [PATCH 03/10] ARM: pxa/gumstix: convert vbus gpio to use software nodes Dmitry Torokhov
@ 2024-08-06  7:19   ` Arnd Bergmann
  2024-08-06 16:58     ` Dmitry Torokhov
  0 siblings, 1 reply; 20+ messages in thread
From: Arnd Bergmann @ 2024-08-06  7:19 UTC (permalink / raw)
  To: Dmitry Torokhov, Haojian Zhuang, Daniel Mack, Robert Jarzmik,
	Linus Walleij, soc
  Cc: linux-arm-kernel, linux-kernel

On Fri, Jun 28, 2024, at 20:08, Dmitry Torokhov wrote:
> Switch vbus gpios from using a custom GPIO lookup table to software
> properties using PROPERTY_ENTRY_GPIO() constructs which closely mimic
> device tree gpio properties.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

I ran into some randconfig build failures with this one now:

> index c9f0f62187bd..b9eddc691097 100644
> --- a/arch/arm/mach-pxa/gumstix.c
> +++ b/arch/arm/mach-pxa/gumstix.c
> @@ -100,26 +100,22 @@ static void __init gumstix_mmc_init(void)
>  #endif
> 
>  #ifdef CONFIG_USB_PXA25X
> -static struct gpiod_lookup_table gumstix_gpio_vbus_gpiod_table = {
> -	.dev_id = "gpio-vbus",
> -	.table = {
> -		GPIO_LOOKUP("gpio-pxa", GPIO_GUMSTIX_USB_GPIOn,
> -			    "vbus", GPIO_ACTIVE_HIGH),
> -		GPIO_LOOKUP("gpio-pxa", GPIO_GUMSTIX_USB_GPIOx,
> -			    "pullup", GPIO_ACTIVE_HIGH),
> -		{ },
> -	},
> +static const struct property_entry spitz_mci_props[] __initconst = {
> +	PROPERTY_ENTRY_GPIO("vbus-gpios", &pxa2xx_gpiochip_node,
> +			    GPIO_GUMSTIX_USB_GPIOn, GPIO_ACTIVE_HIGH),
> +	PROPERTY_ENTRY_GPIO("pullup-gpios", &pxa2xx_gpiochip_node,
> +			    GPIO_GUMSTIX_USB_GPIOx, GPIO_ACTIVE_HIGH),
> +	{ }
>  };
> 

This is missing a few #include, the name spitz_mci_props[]
is wrong for this file and the array is not referenced anywhere.

I assume the gumstix_gpio_vbus_info needs to be turned into
an swnode, but I haven't figured out how to do this.

Based on the recent board deprecation discussion, I expect
that there are no users and that we will remove this machine
early next year, so we don't need to care about making it
pretty now, but maybe you can send a patch to make it build
again.

    Arnd


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

* Re: [PATCH 03/10] ARM: pxa/gumstix: convert vbus gpio to use software nodes
  2024-08-06  7:19   ` Arnd Bergmann
@ 2024-08-06 16:58     ` Dmitry Torokhov
  2024-08-06 20:36       ` Arnd Bergmann
  0 siblings, 1 reply; 20+ messages in thread
From: Dmitry Torokhov @ 2024-08-06 16:58 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Haojian Zhuang, Daniel Mack, Robert Jarzmik, Linus Walleij, soc,
	linux-arm-kernel, linux-kernel

On Tue, Aug 06, 2024 at 09:19:55AM +0200, Arnd Bergmann wrote:
> On Fri, Jun 28, 2024, at 20:08, Dmitry Torokhov wrote:
> > Switch vbus gpios from using a custom GPIO lookup table to software
> > properties using PROPERTY_ENTRY_GPIO() constructs which closely mimic
> > device tree gpio properties.
> >
> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> 
> I ran into some randconfig build failures with this one now:
> 
> > index c9f0f62187bd..b9eddc691097 100644
> > --- a/arch/arm/mach-pxa/gumstix.c
> > +++ b/arch/arm/mach-pxa/gumstix.c
> > @@ -100,26 +100,22 @@ static void __init gumstix_mmc_init(void)
> >  #endif
> > 
> >  #ifdef CONFIG_USB_PXA25X
> > -static struct gpiod_lookup_table gumstix_gpio_vbus_gpiod_table = {
> > -	.dev_id = "gpio-vbus",
> > -	.table = {
> > -		GPIO_LOOKUP("gpio-pxa", GPIO_GUMSTIX_USB_GPIOn,
> > -			    "vbus", GPIO_ACTIVE_HIGH),
> > -		GPIO_LOOKUP("gpio-pxa", GPIO_GUMSTIX_USB_GPIOx,
> > -			    "pullup", GPIO_ACTIVE_HIGH),
> > -		{ },
> > -	},
> > +static const struct property_entry spitz_mci_props[] __initconst = {
> > +	PROPERTY_ENTRY_GPIO("vbus-gpios", &pxa2xx_gpiochip_node,
> > +			    GPIO_GUMSTIX_USB_GPIOn, GPIO_ACTIVE_HIGH),
> > +	PROPERTY_ENTRY_GPIO("pullup-gpios", &pxa2xx_gpiochip_node,
> > +			    GPIO_GUMSTIX_USB_GPIOx, GPIO_ACTIVE_HIGH),
> > +	{ }
> >  };
> > 
> 
> This is missing a few #include, the name spitz_mci_props[]
> is wrong for this file and the array is not referenced anywhere.

Ugh, you are right. Its weird that it does not warn me that the compiler
did not warn me that it is not used... It built for me with
pxa_defconfig so I assumed it was all good.

Ahh, by default it forces CONFIG_USB_PXA25X to be a module and that
skips that block in gumstix.c. I'll change it to IS_ENABLED() because it
should not matter if USB/UDC is built-in or is a module.

> 
> I assume the gumstix_gpio_vbus_info needs to be turned into
> an swnode, but I haven't figured out how to do this.

It is just a matter of initializing .properties in
gumstix_gpio_vbus_info. 

> 
> Based on the recent board deprecation discussion, I expect
> that there are no users and that we will remove this machine
> early next year, so we don't need to care about making it
> pretty now, but maybe you can send a patch to make it build
> again.

Yes, of course. Could you please try the patch below? And if you see
failures, please share your .config.

> 
>     Arnd

-- 
Dmitry

From cff436e3405b7f938e60f693ca7c8410266a893b Mon Sep 17 00:00:00 2001
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: Tue, 6 Aug 2024 09:12:58 -0700
Subject: [PATCH] ARM: pxa/gumstix: fix attaching properties to vbus gpio device

Commit f1d6588af93b tried to convert GPIO lookup tables to software
properties for the vbus gpio device, bit forgot the most important
step: actually attaching the new properties to the device.

Also fix up the name of the property array to reflect the board name,
and add missing gpio/property.h and devices.h includes absence of which
causes compile failures on some configurations.

Switch "#ifdef CONFIG_USB_PXA25X" to "#if IS_ENABLED(CONFIG_USB_PXA25X)"
because it should not matter if the driver is buolt in or a module, it
still need vbus controls.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Fixes: f1d6588af93b ("ARM: pxa/gumstix: convert vbus gpio to use software nodes")
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 arch/arm/mach-pxa/gumstix.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c
index efa6faa62a2c..1713bdf3b71e 100644
--- a/arch/arm/mach-pxa/gumstix.c
+++ b/arch/arm/mach-pxa/gumstix.c
@@ -21,6 +21,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/gpio/machine.h>
+#include <linux/gpio/property.h>
 #include <linux/gpio.h>
 #include <linux/err.h>
 #include <linux/clk.h>
@@ -40,6 +41,7 @@
 #include <linux/platform_data/mmc-pxamci.h>
 #include "udc.h"
 #include "gumstix.h"
+#include "devices.h"
 
 #include "generic.h"
 
@@ -99,8 +101,8 @@ static void __init gumstix_mmc_init(void)
 }
 #endif
 
-#ifdef CONFIG_USB_PXA25X
-static const struct property_entry spitz_mci_props[] __initconst = {
+#if IS_ENABLED(CONFIG_USB_PXA25X)
+static const struct property_entry gumstix_vbus_props[] __initconst = {
 	PROPERTY_ENTRY_GPIO("vbus-gpios", &pxa2xx_gpiochip_node,
 			    GPIO_GUMSTIX_USB_GPIOn, GPIO_ACTIVE_HIGH),
 	PROPERTY_ENTRY_GPIO("pullup-gpios", &pxa2xx_gpiochip_node,
@@ -109,8 +111,9 @@ static const struct property_entry spitz_mci_props[] __initconst = {
 };
 
 static const struct platform_device_info gumstix_gpio_vbus_info __initconst = {
-	.name	= "gpio-vbus",
-	.id	= PLATFORM_DEVID_NONE,
+	.name		= "gpio-vbus",
+	.id		= PLATFORM_DEVID_NONE,
+	.properties	= gumstix_vbus_props,
 };
 
 static void __init gumstix_udc_init(void)
-- 
2.46.0.rc2.264.g509ed76dc8-goog




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

* Re: [PATCH 03/10] ARM: pxa/gumstix: convert vbus gpio to use software nodes
  2024-08-06 16:58     ` Dmitry Torokhov
@ 2024-08-06 20:36       ` Arnd Bergmann
  0 siblings, 0 replies; 20+ messages in thread
From: Arnd Bergmann @ 2024-08-06 20:36 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Haojian Zhuang, Daniel Mack, Robert Jarzmik, Linus Walleij, soc,
	linux-arm-kernel, linux-kernel

On Tue, Aug 6, 2024, at 18:58, Dmitry Torokhov wrote:
> On Tue, Aug 06, 2024 at 09:19:55AM +0200, Arnd Bergmann wrote:
>
> Ugh, you are right. Its weird that it does not warn me that the compiler
> did not warn me that it is not used... It built for me with
> pxa_defconfig so I assumed it was all good.
>
> Ahh, by default it forces CONFIG_USB_PXA25X to be a module and that
> skips that block in gumstix.c. I'll change it to IS_ENABLED() because it
> should not matter if USB/UDC is built-in or is a module.
>
>> 
>> I assume the gumstix_gpio_vbus_info needs to be turned into
>> an swnode, but I haven't figured out how to do this.
>
> It is just a matter of initializing .properties in
> gumstix_gpio_vbus_info. 

Right, makes sense.

>> Based on the recent board deprecation discussion, I expect
>> that there are no users and that we will remove this machine
>> early next year, so we don't need to care about making it
>> pretty now, but maybe you can send a patch to make it build
>> again.
>
> Yes, of course. Could you please try the patch below? And if you see
> failures, please share your .config.

This addresses the configs that failed earlier, and I'm not
seeing any new ones.

I've applied this to the arm/fixes branch now and will send
this branch later this week.

Thanks for the quick fix!

     Arnd


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

end of thread, other threads:[~2024-08-06 20:37 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-28 18:08 [PATCH 00/10] ARM: pxa: use software nodes/properties for GPIOs Dmitry Torokhov
2024-06-28 18:08 ` [PATCH 01/10] ARM: spitz: fix GPIO assignment for backlight Dmitry Torokhov
2024-06-28 18:08 ` [PATCH 02/10] ARM: pxa: consolidate GPIO chip platform data Dmitry Torokhov
2024-06-28 18:08 ` [PATCH 03/10] ARM: pxa/gumstix: convert vbus gpio to use software nodes Dmitry Torokhov
2024-08-06  7:19   ` Arnd Bergmann
2024-08-06 16:58     ` Dmitry Torokhov
2024-08-06 20:36       ` Arnd Bergmann
2024-06-28 18:08 ` [PATCH 04/10] ARM: spitz: Simplify instantiating SPI controller Dmitry Torokhov
2024-06-28 18:08 ` [PATCH 05/10] ARM: spitz: Use software nodes to describe SPI CS lines Dmitry Torokhov
2024-06-28 18:08 ` [PATCH 06/10] ARM: spitz: Use software nodes to describe audio GPIOs Dmitry Torokhov
2024-06-28 18:08 ` [PATCH 07/10] ARM: spitz: Use software nodes to describe LCD GPIOs Dmitry Torokhov
2024-06-28 18:08 ` [PATCH 08/10] ARM: spitz: Use software nodes to describe MMC GPIOs Dmitry Torokhov
2024-06-28 18:08 ` [PATCH 09/10] ARM: spitz: Use software nodes to describe LED GPIOs Dmitry Torokhov
2024-06-28 18:08 ` [PATCH 10/10] ARM: spitz: Use software nodes for the ADS7846 touchscreen Dmitry Torokhov
2024-06-28 20:59 ` [PATCH 00/10] ARM: pxa: use software nodes/properties for GPIOs Arnd Bergmann
2024-06-28 21:08   ` Arnd Bergmann
2024-06-28 21:44   ` Dmitry Torokhov
2024-06-29  7:34     ` Arnd Bergmann
2024-06-30  8:07 ` Linus Walleij
2024-06-30  8:41   ` Arnd Bergmann

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).