On Fri, Jul 12, 2024, at 07:31, Dmitry Torokhov wrote: > @@ -684,6 +685,7 @@ struct platform_device pxa27x_device_gpio = { > .platform_data = &pxa2xx_gpio_info, > }, > }; > +#endif /* CONFIG_PXA25x || CONFIG_PXA27x */ > > static struct resource pxa_dma_resource[] = { > [0] = { > > If you are OK with this I'll submit proper patch. Right, that's probably the easiest way. I was trying a more elaborate change (see below), but there is a good chance I introduce another regression in that, so let's go with your patch. Please send it directly to soc@xxxxxxxxxx Cc:linux-arm-kernel and I'll pick it up. One more thing I noticed: if you are doing more patches to convert devices in board files to use software nodes, we should probably try to move them away from static platform_device definitions towards a dynamic platform_device_register_simple() or similar interface at the same time. Arnd diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c index d050a4c78f97..8813a5d179ed 100644 --- a/arch/arm/mach-pxa/devices.c +++ b/arch/arm/mach-pxa/devices.c @@ -633,58 +633,6 @@ 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, - .end = 0x40e0ffff, - .flags = IORESOURCE_MEM, - }, { - .start = IRQ_GPIO0, - .end = IRQ_GPIO0, - .name = "gpio0", - .flags = IORESOURCE_IRQ, - }, { - .start = IRQ_GPIO1, - .end = IRQ_GPIO1, - .name = "gpio1", - .flags = IORESOURCE_IRQ, - }, { - .start = IRQ_GPIO_2_x, - .end = IRQ_GPIO_2_x, - .name = "gpio_mux", - .flags = IORESOURCE_IRQ, - }, -}; - -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 = { - .name = "pxa27x-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[] = { [0] = { .start = 0x40000000, diff --git a/arch/arm/mach-pxa/mfp-pxa2xx.c b/arch/arm/mach-pxa/mfp-pxa2xx.c index f5a3d890f682..e0ac1f525f77 100644 --- a/arch/arm/mach-pxa/mfp-pxa2xx.c +++ b/arch/arm/mach-pxa/mfp-pxa2xx.c @@ -15,12 +15,16 @@ #include <linux/kernel.h> #include <linux/init.h> #include <linux/io.h> +#include <linux/ioport.h> +#include <linux/property.h> +#include <linux/platform_device.h> #include <linux/syscore_ops.h> #include <linux/soc/pxa/cpu.h> #include "pxa2xx-regs.h" #include "mfp-pxa2xx.h" #include "mfp-pxa27x.h" +#include "irqs.h" #include "generic.h" @@ -151,24 +155,6 @@ void pxa2xx_mfp_config(unsigned long *mfp_cfgs, int num) } } -void pxa2xx_mfp_set_lpm(int mfp, unsigned long lpm) -{ - unsigned long flags, c; - int gpio; - - gpio = __mfp_validate(mfp); - if (gpio < 0) - return; - - local_irq_save(flags); - - c = gpio_desc[gpio].config; - c = (c & ~MFP_LPM_STATE_MASK) | lpm; - __mfp_config_gpio(gpio, c); - - local_irq_restore(flags); -} - int gpio_set_wake(unsigned int gpio, unsigned int on) { struct gpio_desc *d; @@ -221,7 +207,49 @@ int gpio_set_wake(unsigned int gpio, unsigned int on) return 0; } +const struct software_node pxa2xx_gpiochip_node = { + .name = "gpio-pxa", +}; + +struct resource pxa_resource_gpio[] = { + { + .start = 0x40e00000, + .end = 0x40e0ffff, + .flags = IORESOURCE_MEM, + }, { + .start = IRQ_GPIO0, + .end = IRQ_GPIO0, + .name = "gpio0", + .flags = IORESOURCE_IRQ, + }, { + .start = IRQ_GPIO1, + .end = IRQ_GPIO1, + .name = "gpio1", + .flags = IORESOURCE_IRQ, + }, { + .start = IRQ_GPIO_2_x, + .end = IRQ_GPIO_2_x, + .name = "gpio_mux", + .flags = IORESOURCE_IRQ, + }, +}; + +static struct pxa_gpio_platform_data pxa2xx_gpio_info = { + .irq_base = PXA_GPIO_TO_IRQ(0), + .gpio_set_wake = gpio_set_wake, +}; + #ifdef CONFIG_PXA25x +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, + }, +}; + static void __init pxa25x_mfp_init(void) { int i; @@ -247,6 +275,16 @@ static inline void pxa25x_mfp_init(void) {} #endif /* CONFIG_PXA25x */ #ifdef CONFIG_PXA27x +struct platform_device pxa27x_device_gpio = { + .name = "pxa27x-gpio", + .id = -1, + .num_resources = ARRAY_SIZE(pxa_resource_gpio), + .resource = pxa_resource_gpio, + .dev = { + .platform_data = &pxa2xx_gpio_info, + }, +}; + static int pxa27x_pkwr_gpio[] = { 13, 16, 17, 34, 36, 37, 38, 39, 90, 91, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102