devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Liao <jamesjj.liao@mediatek.com>
To: Stephen Boyd <sboyd@codeaurora.org>,
	Mike Turquette <mturquette@baylibre.com>,
	Lee Jones <lee.jones@linaro.org>
Cc: Matthias Brugger <matthias.bgg@gmail.com>,
	Rob Herring <robh@kernel.org>, John Crispin <blogic@openwrt.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Sascha Hauer <kernel@pengutronix.de>,
	Daniel Kurtz <djkurtz@chromium.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
	linux-clk@vger.kernel.org, srv_heupstream@mediatek.com
Subject: Re: [PATCH v7 7/9] clk: mediatek: Enable critical clocks for MT2701
Date: Wed, 11 May 2016 10:51:29 +0800	[thread overview]
Message-ID: <1462935089.28773.11.camel@mtksdaap41> (raw)
In-Reply-To: <20160509221321.GT3492@codeaurora.org>

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 <jamesjj.liao@mediatek.com>
> > > > ---
> > > 
> > > 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?

------------------------------------------------------------
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);
+               }
        }

        /*
------------------------------------------------------------


Best regards,

James


  parent reply	other threads:[~2016-05-11  2:51 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-14  8:11 [PATCH v7 0/9] Add clock support for Mediatek MT2701 James Liao
2016-04-14  8:11 ` [PATCH v7 4/9] clk: mediatek: Add MT2701 clock support James Liao
2016-04-22 18:43   ` Matthias Brugger
2016-05-06 23:11   ` Stephen Boyd
2016-05-09  6:38     ` James Liao
2016-05-09 22:29       ` Stephen Boyd
2016-05-10  2:30         ` James Liao
2016-04-14  8:11 ` [PATCH v7 5/9] reset: mediatek: Add MT2701 reset controller dt-binding file James Liao
2016-04-14  8:11 ` [PATCH v7 7/9] clk: mediatek: Enable critical clocks for MT2701 James Liao
2016-05-06 23:12   ` Stephen Boyd
2016-05-09  5:40     ` James Liao
2016-05-09 22:13       ` Stephen Boyd
2016-05-10  2:20         ` James Liao
2016-05-11  2:51         ` James Liao [this message]
     [not found] ` <1460621514-65191-1-git-send-email-jamesjj.liao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2016-04-14  8:11   ` [PATCH v7 1/9] clk: mediatek: Refine the makefile to support multiple clock drivers James Liao
2016-04-22  9:02     ` Matthias Brugger
2016-04-14  8:11   ` [PATCH v7 2/9] dt-bindings: ARM: Mediatek: Document bindings for MT2701 James Liao
2016-04-14  8:11   ` [PATCH v7 3/9] clk: mediatek: Add dt-bindings for MT2701 clocks James Liao
2016-04-22  9:06     ` Matthias Brugger
2016-04-14  8:11   ` [PATCH v7 6/9] reset: mediatek: Add MT2701 reset driver James Liao
2016-04-14  8:11   ` [PATCH v7 8/9] clk: mediatek: Add config options for MT2701 subsystem clocks James Liao
2016-05-06 23:02     ` Stephen Boyd
     [not found]       ` <20160506230214.GH3492-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2016-05-09  5:37         ` James Liao
2016-05-09 22:13           ` Stephen Boyd
2016-04-14  8:11 ` [PATCH v7 9/9] arm: dts: mt2701: Add clock controller device nodes James Liao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1462935089.28773.11.camel@mtksdaap41 \
    --to=jamesjj.liao@mediatek.com \
    --cc=arnd@arndb.de \
    --cc=blogic@openwrt.org \
    --cc=devicetree@vger.kernel.org \
    --cc=djkurtz@chromium.org \
    --cc=kernel@pengutronix.de \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mturquette@baylibre.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh@kernel.org \
    --cc=sboyd@codeaurora.org \
    --cc=srv_heupstream@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).