linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: tegra: fix disable unused for clocks sharing enable bit
@ 2017-03-02 13:22 Peter De Schrijver
  2017-03-20 13:15 ` Thierry Reding
  0 siblings, 1 reply; 5+ messages in thread
From: Peter De Schrijver @ 2017-03-02 13:22 UTC (permalink / raw)
  To: Peter De Schrijver, Prashant Gaikwad, Michael Turquette,
	Stephen Boyd, Stephen Warren, Thierry Reding, Alexandre Courbot,
	linux-clk, linux-tegra, linux-kernel

In case 2 clocks share an enable bit and one of them is enabled by a driver
and the other one is not, CCF will think it's enabled because it will only
look at the hw state. Therefor it will disable the clock and thus also
disable the other clock which was enabled. Solve this by reading the
initial state of the enable bit and incrementing the refcount if it's set.

Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
---
 drivers/clk/tegra/clk-periph-gate.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/clk/tegra/clk-periph-gate.c b/drivers/clk/tegra/clk-periph-gate.c
index 8812782..303ef32 100644
--- a/drivers/clk/tegra/clk-periph-gate.c
+++ b/drivers/clk/tegra/clk-periph-gate.c
@@ -159,6 +159,9 @@ struct clk *tegra_clk_register_periph_gate(const char *name,
 	gate->enable_refcnt = enable_refcnt;
 	gate->regs = pregs;
 
+	if (read_enb(gate) & periph_clk_to_bit(gate))
+		enable_refcnt[clk_num]++;
+
 	/* Data in .init is copied by clk_register(), so stack variable OK */
 	gate->hw.init = &init;
 
-- 
1.9.1

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

* [PATCH] clk: tegra: fix disable unused for clocks sharing enable bit
@ 2017-03-15 14:10 Peter De Schrijver
  2017-03-20 13:27 ` Thierry Reding
  0 siblings, 1 reply; 5+ messages in thread
From: Peter De Schrijver @ 2017-03-15 14:10 UTC (permalink / raw)
  To: Peter De Schrijver, Prashant Gaikwad, Michael Turquette,
	Stephen Boyd, Stephen Warren, Thierry Reding, Alexandre Courbot,
	linux-clk, linux-tegra, linux-kernel

In case 2 clocks share an enable bit and one of them is enabled by a driver
and the other one is not, CCF will think it's enabled because it will only
look at the hw state. Therefor it will disable the clock and thus also
disable the other clock which was enabled. Solve this by reading the
initial state of the enable bit and incrementing the refcount if it's set.

Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
---
 drivers/clk/tegra/clk-periph-gate.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/clk/tegra/clk-periph-gate.c b/drivers/clk/tegra/clk-periph-gate.c
index 8812782..303ef32 100644
--- a/drivers/clk/tegra/clk-periph-gate.c
+++ b/drivers/clk/tegra/clk-periph-gate.c
@@ -159,6 +159,9 @@ struct clk *tegra_clk_register_periph_gate(const char *name,
 	gate->enable_refcnt = enable_refcnt;
 	gate->regs = pregs;
 
+	if (read_enb(gate) & periph_clk_to_bit(gate))
+		enable_refcnt[clk_num]++;
+
 	/* Data in .init is copied by clk_register(), so stack variable OK */
 	gate->hw.init = &init;
 
-- 
1.9.1

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

* Re: [PATCH] clk: tegra: fix disable unused for clocks sharing enable bit
  2017-03-02 13:22 [PATCH] clk: tegra: fix disable unused for clocks sharing enable bit Peter De Schrijver
@ 2017-03-20 13:15 ` Thierry Reding
  0 siblings, 0 replies; 5+ messages in thread
From: Thierry Reding @ 2017-03-20 13:15 UTC (permalink / raw)
  To: Peter De Schrijver
  Cc: Prashant Gaikwad, Michael Turquette, Stephen Boyd, Stephen Warren,
	Alexandre Courbot, linux-clk, linux-tegra, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 639 bytes --]

On Thu, Mar 02, 2017 at 03:22:05PM +0200, Peter De Schrijver wrote:
> In case 2 clocks share an enable bit and one of them is enabled by a driver
> and the other one is not, CCF will think it's enabled because it will only
> look at the hw state. Therefor it will disable the clock and thus also
> disable the other clock which was enabled. Solve this by reading the
> initial state of the enable bit and incrementing the refcount if it's set.
> 
> Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
> ---
>  drivers/clk/tegra/clk-periph-gate.c | 3 +++
>  1 file changed, 3 insertions(+)

Applied, thanks.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] clk: tegra: fix disable unused for clocks sharing enable bit
  2017-03-15 14:10 Peter De Schrijver
@ 2017-03-20 13:27 ` Thierry Reding
  2017-03-20 14:29   ` Peter De Schrijver
  0 siblings, 1 reply; 5+ messages in thread
From: Thierry Reding @ 2017-03-20 13:27 UTC (permalink / raw)
  To: Peter De Schrijver
  Cc: Prashant Gaikwad, Michael Turquette, Stephen Boyd, Stephen Warren,
	Alexandre Courbot, linux-clk, linux-tegra, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 777 bytes --]

On Wed, Mar 15, 2017 at 04:10:54PM +0200, Peter De Schrijver wrote:
> In case 2 clocks share an enable bit and one of them is enabled by a driver
> and the other one is not, CCF will think it's enabled because it will only
> look at the hw state. Therefor it will disable the clock and thus also
> disable the other clock which was enabled. Solve this by reading the
> initial state of the enable bit and incrementing the refcount if it's set.
> 
> Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
> ---
>  drivers/clk/tegra/clk-periph-gate.c | 3 +++
>  1 file changed, 3 insertions(+)

I think you had already sent a version of this patch a couple of weeks
ago. I've applied the first version since I couldn't spot any delta
between them.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] clk: tegra: fix disable unused for clocks sharing enable bit
  2017-03-20 13:27 ` Thierry Reding
@ 2017-03-20 14:29   ` Peter De Schrijver
  0 siblings, 0 replies; 5+ messages in thread
From: Peter De Schrijver @ 2017-03-20 14:29 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Prashant Gaikwad, Michael Turquette, Stephen Boyd, Stephen Warren,
	Alexandre Courbot, linux-clk, linux-tegra, linux-kernel

On Mon, Mar 20, 2017 at 02:27:46PM +0100, Thierry Reding wrote:
> * PGP Signed by an unknown key
> 
> On Wed, Mar 15, 2017 at 04:10:54PM +0200, Peter De Schrijver wrote:
> > In case 2 clocks share an enable bit and one of them is enabled by a driver
> > and the other one is not, CCF will think it's enabled because it will only
> > look at the hw state. Therefor it will disable the clock and thus also
> > disable the other clock which was enabled. Solve this by reading the
> > initial state of the enable bit and incrementing the refcount if it's set.
> > 
> > Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
> > ---
> >  drivers/clk/tegra/clk-periph-gate.c | 3 +++
> >  1 file changed, 3 insertions(+)
> 
> I think you had already sent a version of this patch a couple of weeks
> ago. I've applied the first version since I couldn't spot any delta
> between them.

Hmm. Could be.

Cheers,

Peter.

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

end of thread, other threads:[~2017-03-20 14:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-02 13:22 [PATCH] clk: tegra: fix disable unused for clocks sharing enable bit Peter De Schrijver
2017-03-20 13:15 ` Thierry Reding
  -- strict thread matches above, loose matches on Subject: below --
2017-03-15 14:10 Peter De Schrijver
2017-03-20 13:27 ` Thierry Reding
2017-03-20 14:29   ` Peter De Schrijver

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