diff mbox

sh: clkfwk: bugfix: sh_clk_div_enable() care sh_clk_div_set_rate() if div6

Message ID 87pq45mxd9.wl%kuninori.morimoto.gx@renesas.com (mailing list archive)
State Superseded
Headers show

Commit Message

Kuninori Morimoto Oct. 26, 2012, 8:49 a.m. UTC
764f4e4e33d18cde4dcaf8a0d860b749c6d6d08b
(sh: clkfwk: Use shared sh_clk_div_enable/disable())
shared enable/disable funcions for div4/div6.
But new sh_clk_div_enable() didn't care sh_clk_div_set_rate()
which is required on div6 clock.
This patch fixes it, and is tested by HDMI sound output on armadillo800eva

Reported-by: Cao Minh Hiep <hiepcm@gmail.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
Paul

This is bugfix patch which should go to v3.6/v3.7.
But please check this style.
It is checking CLK_MASK_DIV_ON_DISABLE for div6 or not.

 drivers/sh/clk/cpg.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Paul Mundt Oct. 27, 2012, 7:45 a.m. UTC | #1
On Fri, Oct 26, 2012 at 01:49:26AM -0700, Kuninori Morimoto wrote:
> 764f4e4e33d18cde4dcaf8a0d860b749c6d6d08b
> (sh: clkfwk: Use shared sh_clk_div_enable/disable())
> shared enable/disable funcions for div4/div6.
> But new sh_clk_div_enable() didn't care sh_clk_div_set_rate()
> which is required on div6 clock.
> This patch fixes it, and is tested by HDMI sound output on armadillo800eva
> 
> Reported-by: Cao Minh Hiep <hiepcm@gmail.com>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Looks good, I'll queue it up, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kuninori Morimoto Oct. 31, 2012, 7:01 a.m. UTC | #2
Hi Paul

> > 764f4e4e33d18cde4dcaf8a0d860b749c6d6d08b
> > (sh: clkfwk: Use shared sh_clk_div_enable/disable())
> > shared enable/disable funcions for div4/div6.
> > But new sh_clk_div_enable() didn't care sh_clk_div_set_rate()
> > which is required on div6 clock.
> > This patch fixes it, and is tested by HDMI sound output on armadillo800eva
> > 
> > Reported-by: Cao Minh Hiep <hiepcm@gmail.com>
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> Looks good, I'll queue it up, thanks.

Thanks.
But which branch can I find it ?

Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Paul Mundt Nov. 1, 2012, 12:22 a.m. UTC | #3
On Wed, Oct 31, 2012 at 12:01:03AM -0700, Kuninori Morimoto wrote:
> 
> Hi Paul
> 
> > > 764f4e4e33d18cde4dcaf8a0d860b749c6d6d08b
> > > (sh: clkfwk: Use shared sh_clk_div_enable/disable())
> > > shared enable/disable funcions for div4/div6.
> > > But new sh_clk_div_enable() didn't care sh_clk_div_set_rate()
> > > which is required on div6 clock.
> > > This patch fixes it, and is tested by HDMI sound output on armadillo800eva
> > > 
> > > Reported-by: Cao Minh Hiep <hiepcm@gmail.com>
> > > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > 
> > Looks good, I'll queue it up, thanks.
> 
> Thanks.
> But which branch can I find it ?
> 
I have it on my laptop and haven't had a chance to push it yet. Now that
I think about it though, I'm not sure that CLK_MASK_DIV_ON_DISABLE should
be depended on. If you require this to only apply for div6 you are better
off checking the div mask directly (ie, testing SH_CLK_DIV6_MSK).
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/sh/clk/cpg.c b/drivers/sh/clk/cpg.c
index 07e9fb4..fe6dbef 100644
--- a/drivers/sh/clk/cpg.c
+++ b/drivers/sh/clk/cpg.c
@@ -126,7 +126,14 @@  static int sh_clk_div_set_rate(struct clk *clk, unsigned long rate)
 
 static int sh_clk_div_enable(struct clk *clk)
 {
-	sh_clk_write(sh_clk_read(clk) & ~CPG_CKSTP_BIT, clk);
+	int ret = 0;
+
+	if (clk->flags & CLK_MASK_DIV_ON_DISABLE)
+		ret = sh_clk_div_set_rate(clk, clk->rate);
+
+	if (ret == 0)
+		sh_clk_write(sh_clk_read(clk) & ~CPG_CKSTP_BIT, clk);
+
 	return 0;
 }