From patchwork Wed May 11 02:51:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Liao X-Patchwork-Id: 9064571 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0B357BF29F for ; Wed, 11 May 2016 02:53:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3473420142 for ; Wed, 11 May 2016 02:53:43 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2338E2012D for ; Wed, 11 May 2016 02:53:42 +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 1b0KFm-0004Ny-Om; Wed, 11 May 2016 02:52:02 +0000 Received: from [210.61.82.183] (helo=mailgw01.mediatek.com) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b0KFh-0004JZ-GB; Wed, 11 May 2016 02:51:58 +0000 Received: from mtkhts09.mediatek.inc [(172.21.101.70)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 251963566; Wed, 11 May 2016 10:51:31 +0800 Received: from [172.21.77.4] (172.21.77.4) by mtkhts09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 14.3.266.1; Wed, 11 May 2016 10:51:29 +0800 Message-ID: <1462935089.28773.11.camel@mtksdaap41> Subject: Re: [PATCH v7 7/9] clk: mediatek: Enable critical clocks for MT2701 From: James Liao To: Stephen Boyd , Mike Turquette , Lee Jones Date: Wed, 11 May 2016 10:51:29 +0800 In-Reply-To: <20160509221321.GT3492@codeaurora.org> References: <1460621514-65191-1-git-send-email-jamesjj.liao@mediatek.com> <1460621514-65191-8-git-send-email-jamesjj.liao@mediatek.com> <20160506231229.GJ3492@codeaurora.org> <1462772426.5344.7.camel@mtksdaap41> <20160509221321.GT3492@codeaurora.org> X-Mailer: Evolution 3.2.3-0ubuntu6 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160510_195157_764222_E5196355 X-CRM114-Status: GOOD ( 20.36 ) X-Spam-Score: -1.1 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Philipp Zabel , Arnd Bergmann , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Daniel Kurtz , srv_heupstream@mediatek.com, linux-mediatek@lists.infradead.org, Sascha Hauer , Matthias Brugger , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, John Crispin Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 Hi Stephen, Mike, Lee, On Mon, 2016-05-09 at 15:13 -0700, Stephen Boyd wrote: > On 05/09, James Liao wrote: > > Hi Stephen, > > > > On Fri, 2016-05-06 at 16:12 -0700, Stephen Boyd wrote: > > > On 04/14, James Liao wrote: > > > > Some system clocks should be turned on by default on MT2701. > > > > This patch enable these clocks when related clocks have > > > > been registered. > > > > > > > > Signed-off-by: James Liao > > > > --- > > > > > > critical clks got merged now (sorry I'm slowly getting back to > > > looking at patches). Please use that flag. > > > > I don't see critical clock support in v4.6-rc7. Is there a repo/branch > > that has critical clocks merged? > > > > Right, it's in clk-next in the clk tree. I got the latest code from clk-next and tried to use CLK_IS_CRITICAL fro critical clocks. But There is something wrong with CLK_IS_CRITICAL. For example, if we set vdec_sel as a critical clock, we'll get the following result: vdecpll 0 0 vdecpll_ck 1 1 vdec_sel 1 1 vdec_sel and vdecpll_ck are TOPCKGEN clocks. vdecpll is a APMIXEDSYS PLL, which will be registered after TOPCKGEN clocks. The prepare and enable count are incorrect in this case. We may need to prepare/enable a parent clock if an enabled orphan clock re-parent to it. I tried the following modification and it can resolve this issue. But I'm not sure it's a correct place to enable parent clcoks. May I have your comment on this? ------------------------------------------------------------ /* ------------------------------------------------------------ Best regards, James diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index ce39add..db1bc3a 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -2388,8 +2388,15 @@ static int __clk_core_init(struct clk_core *core) hlist_for_each_entry_safe(orphan, tmp2, &clk_orphan_list, child_node) { struct clk_core *parent = __clk_init_parent(orphan); - if (parent) + if (parent) { clk_core_reparent(orphan, parent); + + if (orphan->prepare_count) + clk_core_prepare(parent); + + if (orphan->enable_count ) + clk_core_enable(parent); + } }