ARM: sa1100: Initialize gpio after gpio subsystem has been initialized
Subsystems (2)
PATCH 1/1 ARM: sa1100: Initialize gpio after gpio subsystem has been initialized
The sa1100 gpio driver was initialized from interrupt initialization code, which is earlier than the gpio subsystem is initialized. Since commit ff2b13592299 ("gpio: make the gpiochip a real device"), this is fatal and causes the system to crash.
The sa1100 gpio driver must be initialized prior to arch_initcall, since its gpio pins are used in arch_initcall code, but after the gpio subsystem is initialized (core_initcall). Initialize it with postcore_initcall.
---
Tested by building collie_defconfig and:
qemu-system-arm -M collie -kernel arch/arm/boot/zImage \ -no-reboot -initrd busybox-armv4.cpio \ --append "rdinit=/sbin/init console=ttySA1" -monitor null -nographic
arch/arm/mach-sa1100/generic.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
arch/arm/mach-sa1100/generic.c +9 -2
@@ -321,6 +321,15 @@ static int __init sa1100_init(void)arch_initcall (sa1100_init); +static int __init sa1100_gpio_init (void ) +{ +sa1100_init_gpio (); + +return 0 ; +} + +postcore_initcall (sa1100_gpio_init); +void __init sa11x0_init_late (void ) {sa11x0_pm_init ();
@@ -386,8 +395,6 @@ void __init sa1100_init_irq(void)request_resource (&iomem_resource, &irq_resource);sa11x0_init_irq_nodt (IRQ_GPIO0_SC , irq_resource.start); - -sa1100_init_gpio (); }/*
Signature · 1 line
2.5.0
Quoted 5 lines · Guenter Roeck
The sa1100 gpio driver was initialized from interrupt initialization code, which is earlier than the gpio subsystem is initialized. Since commit
ff2b13592299("gpio: make the gpiochip a real device"), this is fatal and causes the system to crash.
Quoted 7 lines
The sa1100 gpio driver must be initialized prior to
arch_initcall, since its gpio pins are used inarch_initcallcode, but after the gpio subsystem is initialized (core_initcall). Initialize it withpostcore_initcall.Fixes ff2b13592299 ("gpio: make the gpiochip a real device")Cc Linus Walleij <[email protected]>Signed-off-by Guenter Roeck <[email protected]>
Please ignore/drop this patch - a better (cleaner) fix is in the works for gpiolib.
Thanks,
Guenter
Quoted 43 lines
---
Tested by building
collie_defconfigand:qemu-system-arm -M collie -kernel arch/arm/boot/zImage \ -no-reboot -initrd busybox-armv4.cpio \ --append "rdinit=/sbin/init console=ttySA1" -monitor null -nographicarch/arm/mach-sa1100/generic.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)arch/arm/mach-sa1100/generic.c +9
-2@@ -321,6 +321,15 @@ static int __init sa1100_init(void)arch_initcall (sa1100_init); +static int __init sa1100_gpio_init (void ) +{ +sa1100_init_gpio (); + +return 0 ; +} + +postcore_initcall (sa1100_gpio_init); +void __init sa11x0_init_late (void ) {sa11x0_pm_init ();@@ -386,8 +395,6 @@ void __init sa1100_init_irq(void)request_resource (&iomem_resource, &irq_resource);sa11x0_init_irq_nodt (IRQ_GPIO0_SC , irq_resource.start); - -sa1100_init_gpio (); }/* Signature · 1 line
2.5.0
Quoted 10 lines · Guenter Roeck
Quoted 9 lines · Guenter Roeck
The sa1100 gpio driver was initialized from interrupt initialization code, which is earlier than the gpio subsystem is initialized. Since commit
ff2b13592299("gpio: make the gpiochip a real device"), this is fatal and causes the system to crash.The sa1100 gpio driver must be initialized prior to
arch_initcall, since its gpio pins are used inarch_initcallcode, but after the gpio subsystem is initialized (core_initcall). Initialize it withpostcore_initcall.
Quoted 6 lines
Quoted 3 lines
Fixes ff2b13592299 ("gpio: make the gpiochip a real device")Cc Linus Walleij <[email protected]>Signed-off-by Guenter Roeck <[email protected]>Please ignore/drop this patch - a better (cleaner) fix is in the works for gpiolib.
This delivers though. I tested it on my also regressing iPAQ.
Yours,
Linus Walleij
Quoted 11 lines · Linus Walleij
Quoted 10 lines · Guenter Roeck
Quoted 9 lines · Guenter Roeck
The sa1100 gpio driver was initialized from interrupt initialization code, which is earlier than the gpio subsystem is initialized. Since commit
ff2b13592299("gpio: make the gpiochip a real device"), this is fatal and causes the system to crash.The sa1100 gpio driver must be initialized prior to
arch_initcall, since its gpio pins are used inarch_initcallcode, but after the gpio subsystem is initialized (core_initcall). Initialize it withpostcore_initcall.
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
Fixes ff2b13592299 ("gpio: make the gpiochip a real device")Cc Linus Walleij <[email protected]>Signed-off-by Guenter Roeck <[email protected]>Please ignore/drop this patch - a better (cleaner) fix is in the works for gpiolib.
This delivers though. I tested it on my also regressing iPAQ.
I am a bit concerned that the gpio initialization was that early on purpose, and that by moving it we might miss some use cases. I did not find any, but that doesn't mean that there are none. Without knowing _why_ the initialization was that early, I would prefer not to touch the code if it can be avoided.
Thanks,
Guenter
Quoted 11 lines · Guenter Roeck
Quoted 5 lines · Linus Walleij
Quoted 2 lines
Please ignore/drop this patch - a better (cleaner) fix is in the works for gpiolib.
This delivers though. I tested it on my also regressing iPAQ.
I am a bit concerned that the gpio initialization was that early on purpose, and that by moving it we might miss some use cases. I did not find any, but that doesn't mean that there are none. Without knowing _why_ the initialization was that early, I would prefer not to touch the code if it can be avoided.
I think we'll go for the other patch to gpiolib. It seems much more clean and generic to support this kind of cases.
Yours,
Linus Walleij