linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: imx: fix .is_enabled() of shared gate clock
@ 2014-09-16  1:35 Shawn Guo
  2014-09-16  1:43 ` Fabio Estevam
  2014-09-23  4:49 ` Olof Johansson
  0 siblings, 2 replies; 3+ messages in thread
From: Shawn Guo @ 2014-09-16  1:35 UTC (permalink / raw)
  To: linux-arm-kernel

Commit 63288b721a80 ("ARM: imx: fix shared gate clock") attempted to fix
an issue with particular enable/disable sequence from two shared gate
clocks.  But unfortunately, while it partially fixed the issue, it also
did something wrong in .is_enabled() function hook.  In case of shared
gate, the function shouldn't really query the hardware state via
share_count, because the function is trying to query the enabling state
of the clock in question, not the hardware state which is shared by
multiple clocks.

Fix the issue by returning the enable_count of the clock itself which is
maintained by clock core, in case it's a clock sharing hardware gate
with others.  As the result, the initialization of share_count per
hardware state is not needed now.  So remove it.

Reported-by: Fabio Estevam <fabio.estevam@freescale.com>
Fixes: 63288b721a80 ("ARM: imx: fix shared gate clock")
Cc: <stable@vger.kernel.org>
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
---
Hi arm-soc folks,

Please apply it for 3.17.  Thanks.

Shawn

 arch/arm/mach-imx/clk-gate2.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/arm/mach-imx/clk-gate2.c b/arch/arm/mach-imx/clk-gate2.c
index 84acdfd1d715..5a75cdc81891 100644
--- a/arch/arm/mach-imx/clk-gate2.c
+++ b/arch/arm/mach-imx/clk-gate2.c
@@ -97,7 +97,7 @@ static int clk_gate2_is_enabled(struct clk_hw *hw)
 	struct clk_gate2 *gate = to_clk_gate2(hw);
 
 	if (gate->share_count)
-		return !!(*gate->share_count);
+		return !!__clk_get_enable_count(hw->clk);
 	else
 		return clk_gate2_reg_is_enabled(gate->reg, gate->bit_idx);
 }
@@ -127,10 +127,6 @@ struct clk *clk_register_gate2(struct device *dev, const char *name,
 	gate->bit_idx = bit_idx;
 	gate->flags = clk_gate2_flags;
 	gate->lock = lock;
-
-	/* Initialize share_count per hardware state */
-	if (share_count)
-		*share_count = clk_gate2_reg_is_enabled(reg, bit_idx) ? 1 : 0;
 	gate->share_count = share_count;
 
 	init.name = name;
-- 
1.9.1

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

* [PATCH] ARM: imx: fix .is_enabled() of shared gate clock
  2014-09-16  1:35 [PATCH] ARM: imx: fix .is_enabled() of shared gate clock Shawn Guo
@ 2014-09-16  1:43 ` Fabio Estevam
  2014-09-23  4:49 ` Olof Johansson
  1 sibling, 0 replies; 3+ messages in thread
From: Fabio Estevam @ 2014-09-16  1:43 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Sep 15, 2014 at 10:35 PM, Shawn Guo <shawn.guo@freescale.com> wrote:
> Commit 63288b721a80 ("ARM: imx: fix shared gate clock") attempted to fix
> an issue with particular enable/disable sequence from two shared gate
> clocks.  But unfortunately, while it partially fixed the issue, it also
> did something wrong in .is_enabled() function hook.  In case of shared
> gate, the function shouldn't really query the hardware state via
> share_count, because the function is trying to query the enabling state
> of the clock in question, not the hardware state which is shared by
> multiple clocks.
>
> Fix the issue by returning the enable_count of the clock itself which is
> maintained by clock core, in case it's a clock sharing hardware gate
> with others.  As the result, the initialization of share_count per
> hardware state is not needed now.  So remove it.
>
> Reported-by: Fabio Estevam <fabio.estevam@freescale.com>
> Fixes: 63288b721a80 ("ARM: imx: fix shared gate clock")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Shawn Guo <shawn.guo@freescale.com>

Tested-by: Fabio Estevam <fabio.estevam@freescale.com>

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

* [PATCH] ARM: imx: fix .is_enabled() of shared gate clock
  2014-09-16  1:35 [PATCH] ARM: imx: fix .is_enabled() of shared gate clock Shawn Guo
  2014-09-16  1:43 ` Fabio Estevam
@ 2014-09-23  4:49 ` Olof Johansson
  1 sibling, 0 replies; 3+ messages in thread
From: Olof Johansson @ 2014-09-23  4:49 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Sep 16, 2014 at 09:35:33AM +0800, Shawn Guo wrote:
> Commit 63288b721a80 ("ARM: imx: fix shared gate clock") attempted to fix
> an issue with particular enable/disable sequence from two shared gate
> clocks.  But unfortunately, while it partially fixed the issue, it also
> did something wrong in .is_enabled() function hook.  In case of shared
> gate, the function shouldn't really query the hardware state via
> share_count, because the function is trying to query the enabling state
> of the clock in question, not the hardware state which is shared by
> multiple clocks.
> 
> Fix the issue by returning the enable_count of the clock itself which is
> maintained by clock core, in case it's a clock sharing hardware gate
> with others.  As the result, the initialization of share_count per
> hardware state is not needed now.  So remove it.
> 
> Reported-by: Fabio Estevam <fabio.estevam@freescale.com>
> Fixes: 63288b721a80 ("ARM: imx: fix shared gate clock")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
> ---
> Hi arm-soc folks,
> 
> Please apply it for 3.17.  Thanks.

Applied.


-Olof

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

end of thread, other threads:[~2014-09-23  4:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-16  1:35 [PATCH] ARM: imx: fix .is_enabled() of shared gate clock Shawn Guo
2014-09-16  1:43 ` Fabio Estevam
2014-09-23  4:49 ` Olof Johansson

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