ARM: pxa: use software nodes/properties for GPIOs
Subsystems (3)
cover ARM: pxa: use software nodes/properties for GPIOs
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.
Signature · 1 line
2.45.2.803.g4e1b14247a-goog
PATCH 1/10 ARM: spitz: fix GPIO assignment for backlight
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.
--- arch/arm/mach-pxa/spitz.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-)
arch/arm/mach-pxa/spitz.c +10 -20
@@ -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 ), { }, }, };
Signature · 1 line
2.45.2.803.g4e1b14247a-goog
PATCH 2/10 ARM: pxa: consolidate GPIO chip platform data
In reply to Dmitry TorokhovThe 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.
--- 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(-)
arch/arm/mach-pxa/devices.c +13 -0
@@ -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[] = {
arch/arm/mach-pxa/pxa25x.c +1 -6
@@ -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)); }
arch/arm/mach-pxa/pxa27x.c +1 -7
@@ -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));
Signature · 1 line
2.45.2.803.g4e1b14247a-goog
PATCH 3/10 ARM: pxa/gumstix: convert vbus gpio to use software nodes
In reply to Dmitry TorokhovSwitch vbus gpios from using a custom GPIO lookup table to software properties using PROPERTY_ENTRY_GPIO() constructs which closely mimic device tree gpio properties.
--- 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(-)
arch/arm/mach-pxa/devices.c +4 -0
@@ -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 ,
arch/arm/mach-pxa/devices.h +2 -2
@@ -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);
arch/arm/mach-pxa/gumstix.c +9 -13
@@ -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 )
arch/arm/mach-pxa/pxa25x.c +1 -0
@@ -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));
Signature · 1 line
2.45.2.803.g4e1b14247a-goog
Re: [PATCH 03/10] ARM: pxa/gumstix: convert vbus gpio to use software nodes
Quoted 5 lines · Dmitry Torokhov
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 <[email protected]>
I ran into some randconfig build failures with this one now:
Quoted 14 lines
index
c9f0f62187bd..b9eddc691097100644arch/arm/mach-pxa/gumstix.c +0
-7@@ -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),
arch/arm/mach-pxa/gumstix.c static void __init gumstix_mmc_init(void) · line 110
Quoted 10 lines
arch/arm/mach-pxa/gumstix.c +6
-2- { }, - }, +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
Re: [PATCH 03/10] ARM: pxa/gumstix: convert vbus gpio to use software nodes
Quoted 28 lines · Arnd Bergmann
Quoted 5 lines · Dmitry Torokhov
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 <[email protected]>I ran into some randconfig build failures with this one now:
Quoted 19 lines
index
c9f0f62187bd..b9eddc691097100644arch/arm/mach-pxa/gumstix.c +3
-9@@ -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),
Quoted 8 lines
arch/arm/mach-pxa/gumstix.c static void __init gumstix_mmc_init(void) · line 110
Quoted 5 lines
arch/arm/mach-pxa/gumstix.c +3
-0+ 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.
Quoted 3 lines
I assume the
gumstix_gpio_vbus_infoneeds 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.
Quoted 6 lines
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.
Quoted 2 lines
Arnd
Signature · 25 lines
Dmitry From cff436e3405b7f938e60f693ca7c8410266a893b Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov <[email protected]> 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 <[email protected]> Fixes: f1d6588af93b ("ARM: pxa/gumstix: convert vbus gpio to use software nodes") Signed-off-by: Dmitry Torokhov <[email protected]> --- arch/arm/mach-pxa/gumstix.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
arch/arm/mach-pxa/gumstix.c +7 -4
@@ -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 )
Signature · 1 line
2.46.0.rc2.264.g509ed76dc8-goog
Re: [PATCH 03/10] ARM: pxa/gumstix: convert vbus gpio to use software nodes
Quoted 11 lines · Dmitry Torokhov
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_defconfigso I assumed it was all good.Ahh, by default it forces
CONFIG_USB_PXA25Xto be a module and that skips that block ingumstix.c. I'll change it toIS_ENABLED()because it should not matter if USB/UDC is built-in or is a module.Quoted 1 line
Quoted 5 lines
Quoted 2 lines
I assume the
gumstix_gpio_vbus_infoneeds 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.
Quoted 8 lines
Quoted 5 lines
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
PATCH 4/10 ARM: spitz: Simplify instantiating SPI controller
In reply to Dmitry Torokhovplatform_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.
--- arch/arm/mach-pxa/spitz.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-)
arch/arm/mach-pxa/spitz.c +9 -15
@@ -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)); }
Signature · 1 line
2.45.2.803.g4e1b14247a-goog
PATCH 5/10 ARM: spitz: Use software nodes to describe SPI CS lines
In reply to Dmitry TorokhovFrom: Linus Walleij <[email protected]>
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.
--- arch/arm/mach-pxa/pxa27x.c | 1 + arch/arm/mach-pxa/spitz.c | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 11 deletions(-)
arch/arm/mach-pxa/pxa27x.c +1 -0
@@ -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));
arch/arm/mach-pxa/spitz.c +10 -11
@@ -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);
Signature · 1 line
2.45.2.803.g4e1b14247a-goog
PATCH 6/10 ARM: spitz: Use software nodes to describe audio GPIOs
In reply to Dmitry TorokhovConvert Spitz to use software nodes for specifying GPIOs for the audio chip.
--- arch/arm/mach-pxa/spitz.c | 66 ++++++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 22 deletions(-)
arch/arm/mach-pxa/spitz.c +44 -22
@@ -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;
Signature · 1 line
2.45.2.803.g4e1b14247a-goog
PATCH 7/10 ARM: spitz: Use software nodes to describe LCD GPIOs
In reply to Dmitry TorokhovConvert Spitz to use software nodes for specifying GPIOs for the LCD.
--- arch/arm/mach-pxa/spitz.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-)
arch/arm/mach-pxa/spitz.c +19 -19
@@ -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
Signature · 1 line
2.45.2.803.g4e1b14247a-goog
PATCH 8/10 ARM: spitz: Use software nodes to describe MMC GPIOs
In reply to Dmitry TorokhovConvert Spitz to use software nodes for specifying GPIOs for the MMC.
--- 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(-)
arch/arm/mach-pxa/devices.c +20 -16
@@ -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 = {
arch/arm/mach-pxa/devices.h +0 -1
@@ -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;
arch/arm/mach-pxa/gumstix.c +1 -1
@@ -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 )
arch/arm/mach-pxa/spitz.c +7 -11
@@ -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 ) {}
include/linux/platform_data/mmc-pxamci.h +3 -1
@@ -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);
Signature · 1 line
2.45.2.803.g4e1b14247a-goog
PATCH 9/10 ARM: spitz: Use software nodes to describe LED GPIOs
In reply to Dmitry TorokhovConvert Spitz to use software nodes for specifying GPIOs for the LEDs.
--- arch/arm/mach-pxa/spitz.c | 71 +++++++++++++++++++++++++++------------ 1 file changed, 50 insertions(+), 21 deletions(-)
arch/arm/mach-pxa/spitz.c +50 -21
@@ -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 ) {}
Signature · 1 line
2.45.2.803.g4e1b14247a-goog
PATCH 10/10 ARM: spitz: Use software nodes for the ADS7846 touchscreen
In reply to Dmitry TorokhovFrom: Linus Walleij <[email protected]>
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.
--- arch/arm/mach-pxa/spitz.c | 40 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 25 deletions(-)
arch/arm/mach-pxa/spitz.c +15 -25
@@ -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)
Signature · 1 line
2.45.2.803.g4e1b14247a-goog
Quoted 16 lines · Dmitry Torokhov
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:
Quoted 6 lines
git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.gitib/ads7846-hsyncin 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 [email protected] 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
Quoted 4 lines · Arnd Bergmann
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 [email protected] for me to pick up.
I just saw that you did in fact send it to [email protected] already. I'll wait for comments then and just merge it if nobody has any objections.
Arnd
Hi Arnd,
Quoted 42 lines · Arnd Bergmann
Quoted 16 lines · Dmitry Torokhov
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:
Quoted 6 lines
git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.gitib/ads7846-hsyncin 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 [email protected] 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.
Quoted 11 lines
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.
Signature · 1 line
Dmitry
Quoted 7 lines · Dmitry Torokhov
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.
Quoted 8 lines
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
Quoted 4 lines · Dmitry Torokhov
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.
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 [email protected] 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
Quoted 8 lines · Linus Walleij
Quoted 4 lines · Dmitry Torokhov
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 <[email protected]>for the patches I didn't write myself.
Thanks for the review!
Quoted 5 lines
What this really needs is testing... :/
If nobody is testing, I think you should just send a pull request to [email protected] 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
This series was applied to soc/soc.git (for-next) by Arnd Bergmann <[email protected]>:
Hello:
This series was applied to soc/soc.git (for-next)
by Arnd Bergmann <[email protected]>:
Quoted 11 lines · On Fri, 28 Jun 2024 11:08:40 -0700 you 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.
[...]
Here is the summary with links:
- [01/10] ARM: spitz: fix GPIO assignment for backlight
https://git.kernel.org/soc/soc/c/78ab3d352f29 - [02/10] ARM: pxa: consolidate GPIO chip platform data https://git.kernel.org/soc/soc/c/917195d6f829 - [03/10] ARM: pxa/gumstix: convert vbus gpio to use software nodes https://git.kernel.org/soc/soc/c/f1d6588af93b - [04/10] ARM: spitz: Simplify instantiating SPI controller https://git.kernel.org/soc/soc/c/6eabaf9d6e2a - [05/10] ARM: spitz: Use software nodes to describe SPI CS lines https://git.kernel.org/soc/soc/c/224b9329fb9f - [06/10] ARM: spitz: Use software nodes to describe audio GPIOs https://git.kernel.org/soc/soc/c/9d91c7c39e3c - [07/10] ARM: spitz: Use software nodes to describe LCD GPIOs https://git.kernel.org/soc/soc/c/1447c7df3820 - [08/10] ARM: spitz: Use software nodes to describe MMC GPIOs https://git.kernel.org/soc/soc/c/444b89875fc0 - [09/10] ARM: spitz: Use software nodes to describe LED GPIOs https://git.kernel.org/soc/soc/c/29c4e69f8e12 - [10/10] ARM: spitz: Use software nodes for the ADS7846 touchscreen https://git.kernel.org/soc/soc/c/38b2482a27c8
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html