From patchwork Thu Nov 30 02:35:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeffy Chen X-Patchwork-Id: 10084111 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DA7EB6020B for ; Thu, 30 Nov 2017 02:35:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C739129C91 for ; Thu, 30 Nov 2017 02:35:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BBADE29C9A; Thu, 30 Nov 2017 02:35:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2BCF229C91 for ; Thu, 30 Nov 2017 02:35:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=4nkqu1iT+dZEJN704Y7uciW8fqDcYtsBZNdSXoAENnQ=; b=r2j 3tiHA9vMWv8Qk85O0W1Dymcq6rfvzBAS1cyEGqhGvByHUXVEbPy+UgSxoGNo5mz6xaEbWDxqDAF0Y c5AdUMWTyyk2qAAi2xO0oSfU1qWbwj+k5KWY43u7dl/xBxsr+tqTgMhqqzK0lEC7iQ7jSHf+b2GjG acmv7YkCakDOpERcUZEO4PV+w7B1IzHyZMb2aI9PAAq9mVFr0tWNe/aDVN2YaCTdaPkTCBG+GaL8Q QWfDqpr3Y0AHcfnHLbxgxiEzxhcBM9zqquL7CsXRpKTCssNOI2gb3+QK4q4TDf8zRq8RQkagnhBgA 2k2LcGApDEy2v/FCLuSKR5mDMujpTPg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eKEhg-00070c-L4; Thu, 30 Nov 2017 02:35:56 +0000 Received: from regular1.263xmail.com ([211.150.99.131]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eKEhd-0006z0-AM; Thu, 30 Nov 2017 02:35:55 +0000 Received: from jeffy.chen?rock-chips.com (unknown [192.168.167.12]) by regular1.263xmail.com (Postfix) with ESMTP id 7E18362A0; Thu, 30 Nov 2017 10:35:25 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 Received: from localhost (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTPA id 59CC7375; Thu, 30 Nov 2017 10:35:19 +0800 (CST) X-RL-SENDER: jeffy.chen@rock-chips.com X-FST-TO: linux-kernel@vger.kernel.org X-SENDER-IP: 103.29.142.67 X-LOGIN-NAME: jeffy.chen@rock-chips.com X-UNIQUE-TAG: <069598bd0ae7bd2a69a93de797b4f3a2> X-ATTACHMENT-NUM: 0 X-SENDER: cjf@rock-chips.com X-DNS-TYPE: 0 Received: from localhost (unknown [103.29.142.67]) by smtp.263.net (Postfix) whith ESMTP id 10079HI0U7E; Thu, 30 Nov 2017 10:35:22 +0800 (CST) From: Jeffy Chen To: linux-kernel@vger.kernel.org Subject: [PATCH] clk: rockchip: protect cpu and ddr clks Date: Thu, 30 Nov 2017 10:35:15 +0800 Message-Id: <20171130023515.27833-1-jeffy.chen@rock-chips.com> X-Mailer: git-send-email 2.11.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171129_183553_750235_9D8BF55E X-CRM114-Status: UNSURE ( 6.36 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Stuebner , Michael Turquette , Jeffy Chen , Stephen Boyd , linux-rockchip@lists.infradead.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP These clks can never be turned off, so protect them as what we do in the sunxi clock-tree. Signed-off-by: Jeffy Chen --- drivers/clk/rockchip/clk-cpu.c | 5 +++++ drivers/clk/rockchip/clk-ddr.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/drivers/clk/rockchip/clk-cpu.c b/drivers/clk/rockchip/clk-cpu.c index 32c19c0f1e14..b741c23a18d1 100644 --- a/drivers/clk/rockchip/clk-cpu.c +++ b/drivers/clk/rockchip/clk-cpu.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include "clk.h" @@ -334,6 +335,10 @@ struct clk *rockchip_clk_register_cpuclk(const char *name, goto free_rate_table; } + /* Protect CPU clock */ + __clk_get(cclk); + clk_prepare_enable(cclk); + return cclk; free_rate_table: diff --git a/drivers/clk/rockchip/clk-ddr.c b/drivers/clk/rockchip/clk-ddr.c index e8075359366b..9f85335d92f2 100644 --- a/drivers/clk/rockchip/clk-ddr.c +++ b/drivers/clk/rockchip/clk-ddr.c @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -147,5 +148,9 @@ struct clk *rockchip_clk_register_ddrclk(const char *name, int flags, if (IS_ERR(clk)) kfree(ddrclk); + /* Protect DDR clock */ + __clk_get(clk); + clk_prepare_enable(clk); + return clk; }