From patchwork Sat Sep 21 01:03:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Emilio_L=C3=B3pez?= X-Patchwork-Id: 276830 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from casper.infradead.org (unknown [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1300C2C00FC for ; Sat, 21 Sep 2013 11:06:49 +1000 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VNBdi-0000s7-NP; Sat, 21 Sep 2013 01:05:39 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VNBdM-0000gL-U9; Sat, 21 Sep 2013 01:05:16 +0000 Received: from zetta.elopez.com.ar ([199.30.59.35]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VNBd8-0000dw-5y for linux-arm-kernel@lists.infradead.org; Sat, 21 Sep 2013 01:05:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=elopez.com.ar; s=mail; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=bt+P7KEf1mWAO3Nqo2o0xGamoV/4IQ9Qg2/ufbArWVg=; b=QBvkq82mHeY5Su1CmX4JLbM/aid/XmSY+JiV5slJJ86/7nRBG2XNyZGlfvh35vGEzGKV92XkgeeNlrDj3A5X8x4V4W84uugc7VOEg+cijwfHgpNCDcmCEaMhRIA6Y02FZ0OYANiPqozJmr2Ee/OU3gGPj7lh4kthKvge+/UJlnVUt0FYpbel8q1oizCGoZJZ19gB9uAsYnmec7tScfIuhIz5nGTpFsm0ptsR/FxOjXT7MO/CvGDMalqfZm14oCHkUuN9fyQC1OVMJyrKo8VEqs+mEkZz3G1KeD/Wt0Yi/Z9wRRZ6twZsg7WMA1/OMiwFoI+jOW+KaGfyx4gRSMLeqQ==; Received: from 201-212-126-35.prima.net.ar ([201.212.126.35] helo=desktop.lan) by zetta.elopez.com.ar with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) id 1VNBcp-00072F-TD; Fri, 20 Sep 2013 22:04:44 -0300 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= To: Mike Turquette , Maxime Ripard Subject: [PATCH 3/3] clk: sunxi: protect core clocks from accidental shutdown Date: Fri, 20 Sep 2013 22:03:12 -0300 Message-Id: <1379725392-30202-4-git-send-email-emilio@elopez.com.ar> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1379725392-30202-1-git-send-email-emilio@elopez.com.ar> References: <1379725392-30202-1-git-send-email-emilio@elopez.com.ar> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130920_210502_444334_7B00589B X-CRM114-Status: UNSURE ( 8.94 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 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] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: =?UTF-8?q?Emilio=20L=C3=B3pez?= , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org Some important clocks may get disabled as a side effect of another clock being disabled, because they have no consumers. This patch implements a mechanism so those clocks can be claimed by the driver and therefore remain enabled at all times. Signed-off-by: Emilio López Acked-by: Maxime Ripard --- drivers/clk/sunxi/clk-sunxi.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c index 34ee69f..83d3eac 100644 --- a/drivers/clk/sunxi/clk-sunxi.c +++ b/drivers/clk/sunxi/clk-sunxi.c @@ -617,6 +617,31 @@ static void __init of_sunxi_table_clock_setup(const struct of_device_id *clk_mat } } +/** + * System clock protection + * + * By enabling these critical clocks, we prevent their accidental gating + * by the framework + */ +static void __init sunxi_clock_protect(void) +{ + struct clk *clk; + + /* memory bus clock - sun5i+ */ + clk = clk_get(NULL, "mbus"); + if (!IS_ERR(clk)) { + clk_prepare_enable(clk); + clk_put(clk); + } + + /* DDR clock - sun4i+ */ + clk = clk_get(NULL, "pll5_ddr"); + if (!IS_ERR(clk)) { + clk_prepare_enable(clk); + clk_put(clk); + } +} + void __init sunxi_init_clocks(void) { /* Register all the simple and basic clocks on DT */ @@ -633,4 +658,7 @@ void __init sunxi_init_clocks(void) /* Register gate clocks */ of_sunxi_table_clock_setup(clk_gates_match, sunxi_gates_clk_setup); + + /* Enable core system clocks */ + sunxi_clock_protect(); }