From patchwork Tue Nov 27 19:53:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 1812501 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 94A9CDF254 for ; Tue, 27 Nov 2012 19:57:11 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TdREm-0001Ym-6l; Tue, 27 Nov 2012 19:54:32 +0000 Received: from mail-vb0-f73.google.com ([209.85.212.73]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TdREj-0001Y3-9I for linux-arm-kernel@lists.infradead.org; Tue, 27 Nov 2012 19:54:29 +0000 Received: by mail-vb0-f73.google.com with SMTP id fr13so809107vbb.0 for ; Tue, 27 Nov 2012 11:54:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=J9aCn0H8SWtU+l8vHbxVjYSDMNc3iPGbkJia6qNBHRw=; b=TM9bt6gPn7FsMMQmDySY4E1SrGRxQkAZkEDtc2yf/tlGuXA7trYQiy/UIR3TshDPPB k+ac/JH9cQwt6uz2K8GCa6zpbnIoZ5wWZVj3OlQnrLK1k1fEok3lWlY+TaBL04huGK6d xLGAMqad27T50giBza0yVp0wABYj/wgKD7LPbn3d1fLF+E/cCd1L+s6Z0DhSFDsW7c5f Q73vhmyatklGvc+oaI0SvDCxUd7f7ociOn4apVTaJntl7OHKkUTATv/7cirFK/3uC4XK es3HsgZRptvc1g4ZsBg9sFxErSNL+crh6ttzWleYw3FaCiccu2gGJ6nnnIsf/1Y3vv0r g7CQ== Received: by 10.236.48.99 with SMTP id u63mr10465732yhb.46.1354046066778; Tue, 27 Nov 2012 11:54:26 -0800 (PST) Received: from wpzn4.hot.corp.google.com (216-239-44-65.google.com [216.239.44.65]) by gmr-mx.google.com with ESMTPS id t49si64068yhc.1.2012.11.27.11.54.26 (version=TLSv1/SSLv3 cipher=AES128-SHA); Tue, 27 Nov 2012 11:54:26 -0800 (PST) Received: from tictac.mtv.corp.google.com (tictac.mtv.corp.google.com [172.22.73.80]) by wpzn4.hot.corp.google.com (Postfix) with ESMTP id A70FB82004A; Tue, 27 Nov 2012 11:54:26 -0800 (PST) Received: by tictac.mtv.corp.google.com (Postfix, from userid 121310) id 4B3A9806B1; Tue, 27 Nov 2012 11:54:26 -0800 (PST) From: Doug Anderson To: Olof Johansson Subject: [PATCH] ARM: EXYNOS: Avoid early use of of_machine_is_compatible() Date: Tue, 27 Nov 2012 11:53:14 -0800 Message-Id: <1354045994-8977-1-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 1.7.7.3 X-Gm-Message-State: ALoCoQm3AgiPtxWZoTUjFZsd/YR+hrNopI+U5iVM6biwYNvdpvPL4IY/n+bjuc2LF3WwCLCm7CuggY5Kt08dQimQWZX+hixajKySAw0NB/mNLynjoEpBwzmNpkw6Ydy+SuFDtUd4qws+LzmHLH27JMF/+JaoJyOaKEA4/24di/z24/OeqzLudDugQQoGb/Cy86zkLuM6EHYGrTQBo0nrzkYn7Zff21UUpg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121127_145429_415727_40E4F5F7 X-CRM114-Status: GOOD ( 15.10 ) X-Spam-Score: -3.3 (---) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-3.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.73 listed in list.dnswl.org] -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: Kukjin Kim , Russell King , Arnd Bergmann , Doug Anderson , linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 recent commit "ARM: EXYNOS: add support for EXYNOS5440 SoC" broke support for exynos5250 because of_machine_is_compatible() was used too early in the boot process. It also probably meant that the exynos5440 failed to use the proper iotable. Switch to use of_flat_dt_is_compatible() in both of these cases. The failure I was seeing in exynos5250 because of this was: Division by zero in kernel. [<80015ed4>] (unwind_backtrace+0x0/0xec) from [<8045c7a4>] (dump_stack+0x20/0x24) [<8045c7a4>] (dump_stack+0x20/0x24) from [<80012990>] (__div0+0x20/0x28) [<80012990>] (__div0+0x20/0x28) from [<8021ab04>] (Ldiv0_64+0x8/0x18) [<8021ab04>] (Ldiv0_64+0x8/0x18) from [<80068560>] (__clocksource_updatefreq_scale+0x54/0x134) [<80068560>] (__clocksource_updatefreq_scale+0x54/0x134) from [<8006865c>] (__clocksource_register_scale+0x1c/0x54) [<8006865c>] (__clocksource_register_scale+0x1c/0x54) from [<80612a18>] (exynos_timer_init+0x100/0x1e8) [<80612a18>] (exynos_timer_init+0x100/0x1e8) from [<8060d184>] (time_init+0x28/0x38) [<8060d184>] (time_init+0x28/0x38) from [<8060a754>] (start_kernel+0x1e0/0x3c8) [<8060a754>] (start_kernel+0x1e0/0x3c8) from [<40008078>] (0x40008078) Signed-off-by: Doug Anderson Acked-by: Kukjin Kim --- arch/arm/mach-exynos/common.c | 5 ++++- arch/arm/mach-exynos/mach-exynos5-dt.c | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c index 73b940f..b919f5f 100644 --- a/arch/arm/mach-exynos/common.c +++ b/arch/arm/mach-exynos/common.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -335,8 +336,10 @@ void __init exynos_init_late(void) void __init exynos_init_io(struct map_desc *mach_desc, int size) { + unsigned long root = of_get_flat_dt_root(); + /* initialize the io descriptors we need for initialization */ - if (of_machine_is_compatible("samsung,exynos5440")) + if (of_flat_dt_is_compatible(root, "samsung,exynos5440")) iotable_init(exynos5440_iodesc, ARRAY_SIZE(exynos5440_iodesc)); else iotable_init(exynos_iodesc, ARRAY_SIZE(exynos_iodesc)); diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c index 67fa3c2..7b76c3f 100644 --- a/arch/arm/mach-exynos/mach-exynos5-dt.c +++ b/arch/arm/mach-exynos/mach-exynos5-dt.c @@ -122,9 +122,11 @@ static const struct of_dev_auxdata exynos5440_auxdata_lookup[] __initconst = { static void __init exynos5_dt_map_io(void) { + unsigned long root = of_get_flat_dt_root(); + exynos_init_io(NULL, 0); - if (of_machine_is_compatible("samsung,exynos5250")) + if (of_flat_dt_is_compatible(root, "samsung,exynos5250")) s3c24xx_init_clocks(24000000); }