linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andi Shyti <andi@etezian.org>
To: Heiko Stuebner <heiko@sntech.de>
Cc: andi.shyti@gmail.com, Jeffy Chen <jeffy.chen@rock-chips.com>,
	Xing Zheng <zhengxing@rock-chips.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@codeaurora.org>,
	linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	Andi Shyti <andi@etezian.org>
Subject: Re: [PATCH 1/2] clk: clk-rk3*: set CLK_IS_CRITICAL flag to critical clocks
Date: Wed, 29 Jun 2016 01:09:22 +0900	[thread overview]
Message-ID: <20160628160922.GN424@jack.zhora.eu> (raw)
In-Reply-To: <29356205.Gk5k6xKH6K@phil>

Hi Heiko,

> >  			RK2928_CLKSEL_CON(0), 14, 2, MFLAGS, 8, 5, DFLAGS),
> > -	GATE(ACLK_CPU, "aclk_cpu", "aclk_cpu_src", CLK_IGNORE_UNUSED,
> > +	GATE(ACLK_CPU, "aclk_cpu", "aclk_cpu_src",
> > +			CLK_IS_CRITICAL | CLK_IGNORE_UNUSED,
> 
> - you'll never need both critical and ignore_unused

Indeed I was unsure whether I should remove the
CLK_IGNORE_UNUSED, but then I decided to leave it because that's
basically what the driver is currently doing. Thanks!

> Happens in some more cases below, but otherwise looks ok ... as written in 
> the cover-letter I'm just still trying to make up my mind if it's worth 
> waiting for the handoff mechanism.

You mean something similar (*)?

Thanks,
Andi

(*)

@@ -2403,7 +2407,7 @@ static int __clk_core_init(struct clk_core *core)
        if (core->ops->init)
                core->ops->init(core->hw);
 
-       if (core->flags & CLK_IS_CRITICAL) {
+       if (core->flags & CLK_IS_CRITICAL || core->flags & CLK_HANDOFF) {
                unsigned long flags;
 
                clk_core_prepare(core);
diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
index 89cc700..5698ef1 100644
--- a/drivers/clk/clkdev.c
+++ b/drivers/clk/clkdev.c
@@ -201,11 +201,19 @@ struct clk *clk_get(struct device *dev, const char *con_id)
 
        if (dev) {
                clk = __of_clk_get_by_name(dev->of_node, dev_id, con_id);
-               if (!IS_ERR(clk) || PTR_ERR(clk) == -EPROBE_DEFER)
+               if (!IS_ERR(clk)) {
+                       clk->clk_core->flags &= ~CLK_HANDOFF;
+                       return clk;
+               }
+               if (PTR_ERR(clk) == -EPROBE_DEFER)
                        return clk;
        }
 
-       return clk_get_sys(dev_id, con_id);
+       clk = clk_get_sys(dev_id, con_id);
+       if (!IS_ERR(clk))
+               clk->clk_core->flags &= ~CLK_HANDOFF;
+
+       return clk;
 }
 EXPORT_SYMBOL(clk_get);

 
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index fb39d5a..39684ec 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -33,6 +33,7 @@
 #define CLK_RECALC_NEW_RATES   BIT(9) /* recalc rates after notifications */
 #define CLK_SET_RATE_UNGATE    BIT(10) /* clock needs to run to set rate */
 #define CLK_IS_CRITICAL                BIT(11) /* do not gate, ever */
+#define CLK_HANDOFF         BIT(12) /* do not gate, ever */
 
 struct clk;
 struct clk_hw;

  reply	other threads:[~2016-06-28 16:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-28 14:45 [PATCH 0/2] use the CLK_IS_CRITICAL flag for critical clocks andi.shyti
2016-06-28 14:45 ` [PATCH 1/2] clk: clk-rk3*: set CLK_IS_CRITICAL flag to " andi.shyti
2016-06-28 15:17   ` Heiko Stuebner
2016-06-28 16:09     ` Andi Shyti [this message]
2016-06-28 16:32       ` Heiko Stuebner
2016-06-28 14:45 ` [PATCH 2/2] clk: rockchip: remove unused rockchip_clk_protect_critical function andi.shyti
2016-06-28 15:11 ` [PATCH 0/2] use the CLK_IS_CRITICAL flag for critical clocks Heiko Stuebner

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=20160628160922.GN424@jack.zhora.eu \
    --to=andi@etezian.org \
    --cc=andi.shyti@gmail.com \
    --cc=heiko@sntech.de \
    --cc=jeffy.chen@rock-chips.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@codeaurora.org \
    --cc=zhengxing@rock-chips.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).