From patchwork Wed Jan 23 16:53:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2026141 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 E9748DF2E5 for ; Wed, 23 Jan 2013 16:56:38 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Ty3Zz-0000Yl-5U; Wed, 23 Jan 2013 16:53:39 +0000 Received: from moutng.kundenserver.de ([212.227.126.171]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Ty3Zw-0000Xi-3Z for linux-arm-kernel@lists.infradead.org; Wed, 23 Jan 2013 16:53:37 +0000 Received: from axis700.grange (dslb-178-006-250-035.pools.arcor-ip.net [178.6.250.35]) by mrelayeu.kundenserver.de (node=mreu1) with ESMTP (Nemesis) id 0MWORa-1UVhZ51dSU-00X8Uc; Wed, 23 Jan 2013 17:53:29 +0100 Received: by axis700.grange (Postfix, from userid 1000) id F3AF740B99; Wed, 23 Jan 2013 17:53:28 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id E79FE40B98; Wed, 23 Jan 2013 17:53:28 +0100 (CET) Date: Wed, 23 Jan 2013 17:53:28 +0100 (CET) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: linux-sh@vger.kernel.org Subject: [PATCH] ARM: shmobile: fix armadillo800eva clock initialisation in reference DT set up Message-ID: MIME-Version: 1.0 X-Provags-ID: V02:K0:+mu3nwxq0DM0S7jR3A9GK0HrD1CVRUIl/PBiLeDg3rL pVKnokfj2bbVjBYyVDFbRWkM8yhuHRY7wqV4pupWkvHEPOtsl8 wqyPlFQAv5V4387ldjp66TRQ7j0NsEi1e0BiuZMl68sRlmRaDV w11agQPg98wQSOq/AaAhlN//q63Ih1vhilBwxxAZXRIK7rlpJd CF+0K9pbnWMxS5PRxupO5Met77pICornB8LWeu4eGM1ZDxRvTF trbyq0YX/DqGUd6ehXVVMqEydTT9eSW4gBoYilK1X6IDX+EKS+ LsOD0twSCODs9pTm/Wh9IWJWlIAZE23UQLNWEQQn9lH9NcZ0rv XFJqPgm4BDxloiKvJoVdwdvp60NDpbkryHFZTNzK5htRgGuAFH ThhX+WJtWHT1A== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130123_115336_376308_E42C4CA1 X-CRM114-Status: GOOD ( 14.95 ) 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 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (g.liakhovetski[at]gmx.de) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [212.227.126.171 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -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: Bastian Hecht , Simon Horman , Magnus Damm , 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: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Clock configuration on armadillo800eva in reference DT set up must be the same, as in the board-code case: the clock tree and oscillator frequencies have to be fixed. Signed-off-by: Guennadi Liakhovetski --- This goes on top of my DT/mmc/pinctrl patch-series from today, which in turn is based on Simon's (no longer existing) pfc4 branch. .../board-armadillo800eva-reference.c | 56 +++++++++++++++++++- arch/arm/mach-shmobile/setup-r8a7740.c | 13 +++-- 2 files changed, 64 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-shmobile/board-armadillo800eva-reference.c b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c index f929931..92d7106 100644 --- a/arch/arm/mach-shmobile/board-armadillo800eva-reference.c +++ b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c @@ -25,11 +25,13 @@ */ #include +#include #include #include #include #include #include +#include #include #include @@ -102,6 +104,41 @@ * # amixer set "Headphone" 50 */ +static void __init eva_clock_init(void) +{ + struct clk *system = clk_get(NULL, "system_clk"); + struct clk *xtal1 = clk_get(NULL, "extal1"); + struct clk *usb24s = clk_get(NULL, "usb24s"); + struct clk *fsibck = clk_get(NULL, "fsibck"); + + if (IS_ERR(system) || + IS_ERR(xtal1) || + IS_ERR(usb24s) || + IS_ERR(fsibck)) { + pr_err("armadillo800eva board clock init failed\n"); + goto clock_error; + } + + /* armadillo 800 eva extal1 is 24MHz */ + clk_set_rate(xtal1, 24000000); + + /* usb24s use extal1 (= system) clock (= 24MHz) */ + clk_set_parent(usb24s, system); + + /* FSIBCK is 12.288MHz, and it is parent of FSI-B */ + clk_set_rate(fsibck, 12288000); + +clock_error: + if (!IS_ERR(system)) + clk_put(system); + if (!IS_ERR(xtal1)) + clk_put(xtal1); + if (!IS_ERR(usb24s)) + clk_put(usb24s); + if (!IS_ERR(fsibck)) + clk_put(fsibck); +} + /* * board init */ @@ -145,6 +182,23 @@ static void __init eva_init(void) #endif } +static void __init eva_earlytimer_init(void) +{ + r8a7740_clock_init(MD_CK0 | MD_CK2); + shmobile_earlytimer_init(); + + /* the rate of extal1 clock must be set before late_time_init */ + eva_clock_init(); +} + +static void __init eva_add_early_devices(void) +{ + r8a7740_add_early_devices_dt(); + + /* override timer setup with board-specific code */ + shmobile_timer.init = eva_earlytimer_init; +} + #define RESCNT2 IOMEM(0xe6188020) static void eva_restart(char mode, const char *cmd) { @@ -159,7 +213,7 @@ static const char *eva_boards_compat_dt[] __initdata = { DT_MACHINE_START(ARMADILLO800EVA_DT, "armadillo800eva-reference") .map_io = r8a7740_map_io, - .init_early = r8a7740_add_early_devices_dt, + .init_early = eva_add_early_devices, .init_irq = r8a7740_init_irq_of, .nr_irqs = NR_IRQS_LEGACY, .handle_irq = shmobile_handle_irq_intc, diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c index 9fe7ca8..cb5aa31 100644 --- a/arch/arm/mach-shmobile/setup-r8a7740.c +++ b/arch/arm/mach-shmobile/setup-r8a7740.c @@ -861,9 +861,6 @@ static const struct of_dev_auxdata r8a7740_auxdata_lookup[] __initconst = { void __init r8a7740_add_standard_devices_dt(void) { - /* clocks are setup late during boot in the case of DT */ - r8a7740_clock_init(0); - platform_add_devices(r8a7740_early_devices, ARRAY_SIZE(r8a7740_early_devices)); @@ -871,6 +868,14 @@ void __init r8a7740_add_standard_devices_dt(void) r8a7740_auxdata_lookup, NULL); } +static void __init add_standard_devices(void) +{ + /* clocks are setup late during boot in the case of DT */ + r8a7740_clock_init(0); + + r8a7740_add_standard_devices_dt(); +} + static const char *r8a7740_boards_compat_dt[] __initdata = { "renesas,r8a7740", NULL, @@ -881,7 +886,7 @@ DT_MACHINE_START(R8A7740_DT, "Generic R8A7740 (Flattened Device Tree)") .init_early = r8a7740_add_early_devices_dt, .init_irq = r8a7740_init_irq_of, .handle_irq = shmobile_handle_irq_intc, - .init_machine = r8a7740_add_standard_devices_dt, + .init_machine = add_standard_devices, .timer = &shmobile_timer, .dt_compat = r8a7740_boards_compat_dt, MACHINE_END