linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm: kirkwood: register DT devices earlier
@ 2012-12-18 14:07 Thomas Petazzoni
  2012-12-18 14:19 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni @ 2012-12-18 14:07 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/arm/mach-kirkwood/board-dt.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index ff4150a..d8a0275 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -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[] = {
-- 
1.7.9.5

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

end of thread, other threads:[~2012-12-18 14:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-18 14:07 [PATCH] arm: kirkwood: register DT devices earlier Thomas Petazzoni
2012-12-18 14:19 ` Andrew Lunn
2012-12-18 14:33   ` Thomas Petazzoni

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