From patchwork Fri May 30 16:32:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 4272311 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 12F6F9F30B for ; Fri, 30 May 2014 16:35:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3B7F020395 for ; Fri, 30 May 2014 16:35:28 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5872B201E4 for ; Fri, 30 May 2014 16:35:27 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WqPk4-0004I8-Ri; Fri, 30 May 2014 16:33:16 +0000 Received: from mail-oa0-f73.google.com ([209.85.219.73]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WqPk2-0004DI-QY for linux-arm-kernel@lists.infradead.org; Fri, 30 May 2014 16:33:15 +0000 Received: by mail-oa0-f73.google.com with SMTP id g18so418858oah.0 for ; Fri, 30 May 2014 09:32:52 -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:in-reply-to :references; bh=87Ln5vtCz7Jsg0H1+yCViPtE+CHyzGE1QNIPGfmLD9U=; b=a7Lb30mEwlIQ8lUm5rpY/l9ZuRVJGwHS+O5lNtSeaqK/gSAZ9pxRFZnVccuTzBBDmv bGkGIspvVqORW4vhaCg8za4GSodSHqwhDokrRCB9RlEuLwwXiLtCMXHPCHWkgaEsCkJq gw8atCGXdxJrAm2DAO9lNDzjy/y5OLYBr5OIvj4o0N5lsMCAb00U3DzOSRxfngVIIvLV EnyeCdxuAKh7yVnhs3DzYy2In1odlGWE2M7pnf6owu75/K0J0HKdpVHKHnKnzYFOOJYZ C0Xk5vnB6lem6w6KVyh18sQWxC2/yj4a/9rssnR29FxXDXjG3/CFqYBkxIK293I8iH63 x6HQ== X-Gm-Message-State: ALoCoQmaphXrNm4x4643Dgvhrre1MbZkHudzS2WOBYFjsolzZs/BSsdioi94OU8dL1FEkpKs0nZK X-Received: by 10.182.204.10 with SMTP id ku10mr361015obc.7.1401467572470; Fri, 30 May 2014 09:32:52 -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 i65si311044yhg.2.2014.05.30.09.32.52 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 30 May 2014 09:32:52 -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 2D2495A4491; Fri, 30 May 2014 09:32:52 -0700 (PDT) Received: by tictac.mtv.corp.google.com (Postfix, from userid 121310) id C63688080B; Fri, 30 May 2014 09:32:51 -0700 (PDT) From: Doug Anderson To: Tomasz Figa , Mike Turquette , Kukjin Kim Subject: [PATCH v2] clk: exynos5420: Keep aclk66_peric enabled during boot Date: Fri, 30 May 2014 09:32:42 -0700 Message-Id: <1401467562-5585-1-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 1.9.1.423.g4596e3a In-Reply-To: <1401398496-4624-1-git-send-email-dianders@chromium.org> References: <1401398496-4624-1-git-send-email-dianders@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140530_093314_941720_BBAACA33 X-CRM114-Status: GOOD ( 17.31 ) X-Spam-Score: -1.4 (-) Cc: linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Doug Anderson , olof@lixom.net, javier.martinez@collabora.co.uk, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,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 --- Changes in v2: - Use GATE_A and clk_get(). Save the clock for putting later. - Return 0 from exynos5420_clk_late_init(). drivers/clk/samsung/clk-exynos5420.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c index 9d7d7ee..70b607a 100644 --- a/drivers/clk/samsung/clk-exynos5420.c +++ b/drivers/clk/samsung/clk-exynos5420.c @@ -890,8 +890,8 @@ static struct samsung_gate_clock exynos5x_gate_clks[] __initdata = { GATE_BUS_TOP, 9, CLK_IGNORE_UNUSED, 0), GATE(0, "aclk66_psgen", "mout_user_aclk66_psgen", GATE_BUS_TOP, 10, CLK_IGNORE_UNUSED, 0), - GATE(CLK_ACLK66_PERIC, "aclk66_peric", "mout_user_aclk66_peric", - GATE_BUS_TOP, 11, CLK_IGNORE_UNUSED, 0), + GATE_A(CLK_ACLK66_PERIC, "aclk66_peric", "mout_user_aclk66_peric", + GATE_BUS_TOP, 11, CLK_IGNORE_UNUSED, 0, "aclk66_peric"), GATE(0, "aclk266_isp", "mout_user_aclk266_isp", GATE_BUS_TOP, 13, 0, 0), GATE(0, "aclk166", "mout_user_aclk166", @@ -1172,11 +1172,22 @@ static struct of_device_id ext_clk_match[] __initdata = { { }, }; +/* Keep these clocks on until late_initcall */ +struct boot_clock { + char *name; + struct clk *clk; +}; + +static struct boot_clock boot_clocks[] __initdata = { + { .name = "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 +1237,11 @@ static void __init exynos5x_clk_init(struct device_node *np, } exynos5420_clk_sleep_init(); + + for (i = 0; i < ARRAY_SIZE(boot_clocks); i++) { + boot_clocks[i].clk = clk_get(NULL, boot_clocks[i].name); + clk_prepare_enable(boot_clocks[i].clk); + } } static void __init exynos5420_clk_init(struct device_node *np) @@ -1239,3 +1255,16 @@ 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++) { + clk_disable_unprepare(boot_clocks[i].clk); + clk_put(boot_clocks[i].clk); + } + + return 0; +} +late_initcall(exynos5420_clk_late_init);