linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] clk: x86: Do not gate clocks enabled by the firmware
@ 2017-07-13  9:42 Carlo Caione
  2017-07-13 10:06 ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Carlo Caione @ 2017-07-13  9:42 UTC (permalink / raw)
  To: mturquette, linux-clk, dvhart, pierre-louis.bossart, sboyd, linux,
	eballetbo, andriy.shevchenko
  Cc: Carlo Caione

From: Carlo Caione <carlo@endlessm.com>

Read the enable register to determine if the clock is already in use by
the firmware. In this case avoid gating the clock.

Tested-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Carlo Caione <carlo@endlessm.com>
---
 drivers/clk/x86/clk-pmc-atom.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/clk/x86/clk-pmc-atom.c b/drivers/clk/x86/clk-pmc-atom.c
index 2b60577703ef..3c73d2e564ca 100644
--- a/drivers/clk/x86/clk-pmc-atom.c
+++ b/drivers/clk/x86/clk-pmc-atom.c
@@ -185,6 +185,13 @@ static struct clk_plt *plt_clk_register(struct platform_device *pdev, int id,
 	pclk->reg = base + PMC_CLK_CTL_OFFSET + id * PMC_CLK_CTL_SIZE;
 	spin_lock_init(&pclk->lock);
 
+	/*
+	 * If the clock was already enabled by the firmware mark is a critical
+	 * to avoid it being gated by the clock framework if no driver owns it
+	 */
+	if (plt_clk_is_enabled(&pclk->hw))
+		init.flags |= CLK_IS_CRITICAL;
+
 	ret = devm_clk_hw_register(&pdev->dev, &pclk->hw);
 	if (ret) {
 		pclk = ERR_PTR(ret);
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] clk: x86: Do not gate clocks enabled by the firmware
  2017-07-13  9:42 [PATCH v2] clk: x86: Do not gate clocks enabled by the firmware Carlo Caione
@ 2017-07-13 10:06 ` Andy Shevchenko
  2017-07-13 15:54   ` Darren Hart
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2017-07-13 10:06 UTC (permalink / raw)
  To: Carlo Caione, mturquette, linux-clk, dvhart, pierre-louis.bossart,
	sboyd, linux, eballetbo
  Cc: Carlo Caione

On Thu, 2017-07-13 at 11:42 +0200, Carlo Caione wrote:
> From: Carlo Caione <carlo@endlessm.com>
> 
> Read the enable register to determine if the clock is already in use
> by
> the firmware. In this case avoid gating the clock.
> 

Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

I suppose it should go via clock tree.

> Tested-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> Signed-off-by: Carlo Caione <carlo@endlessm.com>
> ---
>  drivers/clk/x86/clk-pmc-atom.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/clk/x86/clk-pmc-atom.c b/drivers/clk/x86/clk-pmc-
> atom.c
> index 2b60577703ef..3c73d2e564ca 100644
> --- a/drivers/clk/x86/clk-pmc-atom.c
> +++ b/drivers/clk/x86/clk-pmc-atom.c
> @@ -185,6 +185,13 @@ static struct clk_plt *plt_clk_register(struct
> platform_device *pdev, int id,
>  	pclk->reg = base + PMC_CLK_CTL_OFFSET + id *
> PMC_CLK_CTL_SIZE;
>  	spin_lock_init(&pclk->lock);
>  
> +	/*
> +	 * If the clock was already enabled by the firmware mark is a
> critical
> +	 * to avoid it being gated by the clock framework if no
> driver owns it
> +	 */
> +	if (plt_clk_is_enabled(&pclk->hw))
> +		init.flags |= CLK_IS_CRITICAL;
> +
>  	ret = devm_clk_hw_register(&pdev->dev, &pclk->hw);
>  	if (ret) {
>  		pclk = ERR_PTR(ret);

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] clk: x86: Do not gate clocks enabled by the firmware
  2017-07-13 10:06 ` Andy Shevchenko
@ 2017-07-13 15:54   ` Darren Hart
  2017-07-14  8:19     ` Carlo Caione
  0 siblings, 1 reply; 4+ messages in thread
From: Darren Hart @ 2017-07-13 15:54 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Carlo Caione, mturquette, linux-clk, pierre-louis.bossart, sboyd,
	linux, eballetbo, Carlo Caione

On Thu, Jul 13, 2017 at 01:06:14PM +0300, Andy Shevchenko wrote:
> On Thu, 2017-07-13 at 11:42 +0200, Carlo Caione wrote:
> > From: Carlo Caione <carlo@endlessm.com>
> > 
> > Read the enable register to determine if the clock is already in use
> > by
> > the firmware. In this case avoid gating the clock.
> > 
> 
> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> I suppose it should go via clock tree.
> 
> > Tested-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> > Signed-off-by: Carlo Caione <carlo@endlessm.com>
> > ---
> >  drivers/clk/x86/clk-pmc-atom.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/drivers/clk/x86/clk-pmc-atom.c b/drivers/clk/x86/clk-pmc-
> > atom.c
> > index 2b60577703ef..3c73d2e564ca 100644
> > --- a/drivers/clk/x86/clk-pmc-atom.c
> > +++ b/drivers/clk/x86/clk-pmc-atom.c
> > @@ -185,6 +185,13 @@ static struct clk_plt *plt_clk_register(struct
> > platform_device *pdev, int id,
> >  	pclk->reg = base + PMC_CLK_CTL_OFFSET + id *
> > PMC_CLK_CTL_SIZE;
> >  	spin_lock_init(&pclk->lock);
> >  
> > +	/*
> > +	 * If the clock was already enabled by the firmware mark is a
> > critical

Nit... I think this should read... "mark it as critical" ?

> > +	 * to avoid it being gated by the clock framework if no
> > driver owns it

owns it.

Acked-by: Darren Hart (VMware) <dvhart@infradead.org>

-- 
Darren Hart
VMware Open Source Technology Center

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] clk: x86: Do not gate clocks enabled by the firmware
  2017-07-13 15:54   ` Darren Hart
@ 2017-07-14  8:19     ` Carlo Caione
  0 siblings, 0 replies; 4+ messages in thread
From: Carlo Caione @ 2017-07-14  8:19 UTC (permalink / raw)
  To: Darren Hart
  Cc: Andy Shevchenko, Carlo Caione, Michael Turquette, linux-clk,
	Pierre-Louis Bossart, Stephen Boyd, Linux Upstreaming Team,
	Enric Balletbo Serra

On Thu, Jul 13, 2017 at 5:54 PM, Darren Hart <dvhart@infradead.org> wrote:
> On Thu, Jul 13, 2017 at 01:06:14PM +0300, Andy Shevchenko wrote:
>> On Thu, 2017-07-13 at 11:42 +0200, Carlo Caione wrote:
>> > From: Carlo Caione <carlo@endlessm.com>
>> >
>> > Read the enable register to determine if the clock is already in use
>> > by
>> > the firmware. In this case avoid gating the clock.
>> >
>>
>> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>>
>> I suppose it should go via clock tree.
>>
>> > Tested-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
>> > Signed-off-by: Carlo Caione <carlo@endlessm.com>
>> > ---
>> >  drivers/clk/x86/clk-pmc-atom.c | 7 +++++++
>> >  1 file changed, 7 insertions(+)
>> >
>> > diff --git a/drivers/clk/x86/clk-pmc-atom.c b/drivers/clk/x86/clk-pmc-
>> > atom.c
>> > index 2b60577703ef..3c73d2e564ca 100644
>> > --- a/drivers/clk/x86/clk-pmc-atom.c
>> > +++ b/drivers/clk/x86/clk-pmc-atom.c
>> > @@ -185,6 +185,13 @@ static struct clk_plt *plt_clk_register(struct
>> > platform_device *pdev, int id,
>> >     pclk->reg = base + PMC_CLK_CTL_OFFSET + id *
>> > PMC_CLK_CTL_SIZE;
>> >     spin_lock_init(&pclk->lock);
>> >
>> > +   /*
>> > +    * If the clock was already enabled by the firmware mark is a
>> > critical
>
> Nit... I think this should read... "mark it as critical" ?
>
>> > +    * to avoid it being gated by the clock framework if no
>> > driver owns it
>
> owns it.

Ooops. Yeah, submitting a v3 with better spelling and your ACKs.

Thanks,

-- 
Carlo Caione  |  +39.340.80.30.096  |  Endless

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-07-14  8:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-13  9:42 [PATCH v2] clk: x86: Do not gate clocks enabled by the firmware Carlo Caione
2017-07-13 10:06 ` Andy Shevchenko
2017-07-13 15:54   ` Darren Hart
2017-07-14  8:19     ` Carlo Caione

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).