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: 9064541 X-Patchwork-Delegate: sboyd@codeaurora.org Return-Path: X-Original-To: patchwork-linux-clk@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 727EE9F30C for ; Wed, 11 May 2016 02:51:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8950A2012B for ; Wed, 11 May 2016 02:51:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A764620155 for ; Wed, 11 May 2016 02:51:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751344AbcEKCvi (ORCPT ); Tue, 10 May 2016 22:51:38 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:58385 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751231AbcEKCvh (ORCPT ); Tue, 10 May 2016 22:51:37 -0400 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 CC: Matthias Brugger , Rob Herring , John Crispin , Arnd Bergmann , Sascha Hauer , Daniel Kurtz , Philipp Zabel , , , , , , 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 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Spam-Status: No, score=-9.0 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 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 --- To unsubscribe from this list: send the line "unsubscribe linux-clk" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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); + } }