From patchwork Tue Dec 18 14:07:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 1892121 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 6DE873FCD4 for ; Tue, 18 Dec 2012 14:11:13 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Tkxpw-00088h-Vv; Tue, 18 Dec 2012 14:08:01 +0000 Received: from mail.free-electrons.com ([94.23.32.191]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Tkxpt-00088M-Vi for linux-arm-kernel@lists.infradead.org; Tue, 18 Dec 2012 14:07:58 +0000 Received: by mail.free-electrons.com (Postfix, from userid 106) id 6D69A175; Tue, 18 Dec 2012 15:07:56 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham version=3.3.1 Received: from localhost (col31-4-88-188-83-94.fbx.proxad.net [88.188.83.94]) by mail.free-electrons.com (Postfix) with ESMTPSA id 665A2DB; Tue, 18 Dec 2012 15:07:49 +0100 (CET) From: Thomas Petazzoni To: Jason Cooper , Sebastian Hesselbarth , Andrew Lunn Subject: [PATCH] arm: kirkwood: register DT devices earlier Date: Tue, 18 Dec 2012 15:07:47 +0100 Message-Id: <1355839667-1487-1-git-send-email-thomas.petazzoni@free-electrons.com> X-Mailer: git-send-email 1.7.9.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121218_090758_171338_D60534C9 X-CRM114-Status: GOOD ( 14.46 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Gregory Clement , Lior Amsalem , linux-arm-kernel@lists.infradead.org, Maen Suleiman X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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 --- 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[] = {