arm: kirkwood: register DT devices earlier
Subsystems (2)
PATCH 1/1 arm: kirkwood: register DT devices earlier
The board-dt.c initialization functions calls the per-board legacy init functions (to probe devices that have not yet been converted to the Device Tree) before probing the devices declared in the Device Tree.
This unfortunately causes a boot crash on Topkick, because the board-specific initialization function sets a GPIO to some value. Unfortunately, since the devices declared in the Device Tree haven't been probed, the GPIO controllers haven't been probed, and the gpio_set_value() call causes the following crash:
Unable to handle kernel NULL pointer dereference at virtual address 00000040 pgd = c0004000 [00000040] *pgd=00000000 Internal error: Oops: 5 [#1] PREEMPT ARM Modules linked in: CPU: 0 Not tainted (3.7.0-rc7-01461-g2ef9d7a-dirty #91) PC is at __gpio_set_value+0x20/0xb4 LR is at usi_topkick_init+0x18/0x2c
Therefore, we invert the order of initialization: we first probe Device Tree devices, and then allow per-board initialization functions to do add more devices if they wish.
--- arch/arm/mach-kirkwood/board-dt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm/mach-kirkwood/board-dt.c +1 -2
@@ -97,6 +97,7 @@ static void __init kirkwood_dt_init(void)#ifdef CONFIG_KEXEC kexec_reinit = kirkwood_enable_pcie;#endif +of_platform_populate (NULL , kirkwood_dt_match_table,NULL ,NULL );if (of_machine_is_compatible ("globalscale,dreamplug" ))dreamplug_init ();
@@ -146,8 +147,6 @@ static void __init kirkwood_dt_init(void)if (of_machine_is_compatible ("zyxel,nsa310" ))nsa310_init (); - -of_platform_populate (NULL , kirkwood_dt_match_table,NULL ,NULL ); }static const char *const kirkwood_dt_board_compat[] = {
Signature · 1 line
1.7.9.5
PATCH 1/1 arm: kirkwood: register DT devices earlier
Quoted 10 lines · Thomas Petazzoni
The
board-dt.cinitialization functions calls the per-board legacy init functions (to probe devices that have not yet been converted to the Device Tree) before probing the devices declared in the Device Tree.This unfortunately causes a boot crash on Topkick, because the board-specific initialization function sets a GPIO to some value. Unfortunately, since the devices declared in the Device Tree haven't been probed, the GPIO controllers haven't been probed, and the
gpio_set_value()call causes the following crash:
Hi Thomas
I have a different fix for this.
The gpio is being used to supply power to SATA. So i turn it into a fixed-regulator, using DT.
I will send the patch tonight.
Andrew
PATCH 1/1 arm: kirkwood: register DT devices earlier
Dear Andrew Lunn,
Quoted 6 lines · Andrew Lunn
I have a different fix for this.
The gpio is being used to supply power to SATA. So i turn it into a fixed-regulator, using DT.
I will send the patch tonight.
Indeed sounds a much better fix than mine. My patch posting was mainly to raise the issue, and ensure we get some fix for it, I was quite sure there was a better way of fixing this.
Thanks,
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com