From patchwork Thu May 29 21:21:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 4267321 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2EC58BEEA7 for ; Thu, 29 May 2014 21:22:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5CB212037A for ; Thu, 29 May 2014 21:22:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 80EDB20268 for ; Thu, 29 May 2014 21:22:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932927AbaE2VWa (ORCPT ); Thu, 29 May 2014 17:22:30 -0400 Received: from mail-ie0-f202.google.com ([209.85.223.202]:43832 "EHLO mail-ie0-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932208AbaE2VW2 (ORCPT ); Thu, 29 May 2014 17:22:28 -0400 Received: by mail-ie0-f202.google.com with SMTP id rd18so205428iec.5 for ; Thu, 29 May 2014 14:22:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=aqw/3ZRgAXLNKR6DQURtbejmHEt7N3agRHr20kHhriw=; b=Kv7N8DPJQhTo30Wqp7sAe4cBOBICvxw90Dp+fLb9jM7Am3jw4Yn3lBXFc9xFLY6Jv3 //70qSDxDaUSEqPHdXe3o35A7cMHEY6Hgyvwdb8gk84hWSgyosbQFH9DjUwI6JmaGnhW XwhuVjch3btIiFZDeliA5vigrTak/J4ssowX2iNPQZOJG424D+JYpa7aWzgYEiU5vudA yva+7SXn0Uacx6Ieu6fK7dJ1BcpcFCT9GuuVZ0U19GLMjdds9yvmykiz3BpkjIonPnCT kS+3KyBlozOk4EB2fkD/mk0NMnNOV/hJJzeqO+3jraWV8DLtBLGp3gKLu47AwfDeAsW5 Ch3g== X-Gm-Message-State: ALoCoQldOr6LSuwM/OU8/BiQ7m4/cCLu0CfQL8wtw+p5iZ/G1P4yKSZaYCgjReZEixV+YkQcb7BW X-Received: by 10.182.20.17 with SMTP id j17mr4424311obe.24.1401398547900; Thu, 29 May 2014 14:22:27 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id h13si139622yhj.0.2014.05.29.14.22.27 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 May 2014 14:22:27 -0700 (PDT) Received: from tictac.mtv.corp.google.com (tictac.mtv.corp.google.com [172.22.72.141]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id BB67B5A43B3; Thu, 29 May 2014 14:22:27 -0700 (PDT) Received: by tictac.mtv.corp.google.com (Postfix, from userid 121310) id 5D635808F7; Thu, 29 May 2014 14:22:27 -0700 (PDT) From: Doug Anderson To: Tomasz Figa , Mike Turquette , Kukjin Kim Cc: olof@lixom.net, javier.martinez@collabora.co.uk, Doug Anderson , linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] clk: exynos5420: Keep aclk66_peric enabled during boot Date: Thu, 29 May 2014 14:21:36 -0700 Message-Id: <1401398496-4624-1-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 1.9.1.423.g4596e3a Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Right now if you've got earlyprintk enabled on exynos5420-peach-pit then you'll get a hang on boot. Here's why: 1. The i2c-s3c2410 driver will probe at subsys_initcall. It will enable its clock and disable it. This is the clock "i2c2". 2. The act of disabling "i2c2" will disable its parents. In this case the parent is "aclk66_peric". There are no other children of "aclk66_peric" officially enabled, so "aclk66_peric" will be turned off (despite being CLK_IGNORE_UNUSED, but that's by design). 3. The next time you try to earlyprintk you'll do so without the UART clock enabled. That's because the UART clocks are also children of "aclk66_peric". You'll hang. There's no good place to put a clock enable for earlyprintk, which is handled by a bunch of assembly code. The best we can do is to handle this in the clock driver. Signed-off-by: Doug Anderson Tested-by: Javier Martinez Canillas --- drivers/clk/samsung/clk-exynos5420.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c index 9d7d7ee..1e586be 100644 --- a/drivers/clk/samsung/clk-exynos5420.c +++ b/drivers/clk/samsung/clk-exynos5420.c @@ -1172,11 +1172,17 @@ static struct of_device_id ext_clk_match[] __initdata = { { }, }; +/* Keep these clocks on until late_initcall */ +static const char *boot_clocks[] __initconst = { + "aclk66_peric", +}; + /* register exynos5420 clocks */ static void __init exynos5x_clk_init(struct device_node *np, enum exynos5x_soc soc) { struct samsung_clk_provider *ctx; + int i; if (np) { reg_base = of_iomap(np, 0); @@ -1226,6 +1232,12 @@ static void __init exynos5x_clk_init(struct device_node *np, } exynos5420_clk_sleep_init(); + + for (i = 0; i < ARRAY_SIZE(boot_clocks); i++) { + struct clk *to_enable = __clk_lookup(boot_clocks[i]); + + clk_prepare_enable(to_enable); + } } static void __init exynos5420_clk_init(struct device_node *np) @@ -1239,3 +1251,15 @@ static void __init exynos5800_clk_init(struct device_node *np) exynos5x_clk_init(np, EXYNOS5800); } CLK_OF_DECLARE(exynos5800_clk, "samsung,exynos5800-clock", exynos5800_clk_init); + +static int __init exynos5420_clk_late_init(void) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(boot_clocks); i++) { + struct clk *to_disable = __clk_lookup(boot_clocks[i]); + + clk_disable_unprepare(to_disable); + } +} +late_initcall(exynos5420_clk_late_init);