Skip to contentSkip to conversation

sh: sh7724 clock framework rewrite

PATCH In review Magnus Damm 2 participants 8 messages Jun 2, 2009 – Jun 10, 2009 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sh: sh7724 clock framework rewrite

From: Magnus Damm <[email protected]>

This patch contains a rewrite of the sh7724 clock framework code. The new code makes use of the recently merged div4, div6 and mstp32 helper code.

---

Untested due to lack of hardware.

 arch/sh/Kconfig                        |    2 
 arch/sh/kernel/cpu/sh4a/Makefile       |    2 
 arch/sh/kernel/cpu/sh4a/clock-sh7722.c |   85 --------------
 arch/sh/kernel/cpu/sh4a/clock-sh7724.c |  183 ++++++++++++++++++++++++++++++++
 4 files changed, 190 insertions(+), 82 deletions(-)
arch/sh/Kconfig +1 -1
@@ -516,7 +516,7 @@ config SH_CLK_CPG
 
 config SH_CLK_CPG_LEGACY
 	depends on SH_CLK_CPG
-	def_bool y if !CPU_SUBTYPE_SH7785 && !CPU_SUBTYPE_SH7723
+	def_bool y if !CPU_SUBTYPE_SH7785 && !CPU_SUBTYPE_SH7723 && !CPU_SUBTYPE_SH7724
 
 config SH_CLK_MD
 	int "CPU Mode Pin Setting"
arch/sh/kernel/cpu/sh4a/Makefile +1 -1
@@ -27,7 +27,7 @@ clock-$(CONFIG_CPU_SUBTYPE_SH7786)	:= cl
 clock-$(CONFIG_CPU_SUBTYPE_SH7343)	:= clock-sh7722.o
 clock-$(CONFIG_CPU_SUBTYPE_SH7722)	:= clock-sh7722.o
 clock-$(CONFIG_CPU_SUBTYPE_SH7723)	:= clock-sh7723.o
-clock-$(CONFIG_CPU_SUBTYPE_SH7724)	:= clock-sh7722.o
+clock-$(CONFIG_CPU_SUBTYPE_SH7724)	:= clock-sh7724.o
 clock-$(CONFIG_CPU_SUBTYPE_SH7366)	:= clock-sh7722.o
 clock-$(CONFIG_CPU_SUBTYPE_SHX3)	:= clock-shx3.o
 
arch/sh/kernel/cpu/sh4a/clock-sh7722.c +5 -80

137 lines not on this page · raw message

arch/sh/kernel/cpu/sh4a/clock-sh7724.c new file +183 -0

183 lines not on this page · raw message

#1 lore raw

Dear Magnus

thank you for nice patch.

on new clock-sh7724.c

arch/sh/kernel/cpu/sh4a/clock-sh7724.c line 58

Quoted 4 lines
arch/sh/kernel/cpu/sh4a/clock-sh7724.c new file +4 -0
+static unsigned long pll_recalc(struct clk *clk)
+{
+	return clk->parent->rate * (((__raw_readl(FRQCRA) >> 24) & 0x3f) + 1);
+}

sh7724 needs "* 2" here.
please check old clock-sh7722.c

arch/sh/kernel/cpu/sh4a/clock-sh7722.c static void adjust_clocks(int originate, · line 137

Quoted 5 lines
arch/sh/kernel/cpu/sh4a/clock-sh7722.c +0 -4
-#if defined(CONFIG_CPU_SUBTYPE_SH7724)
-#define STCPLL(frqcr) ((((frqcr >> 24) & 0x3f) + 1) * 2)
-#else
 #define STCPLL(frqcr) (((frqcr >> 24) & 0x1f) + 1)
-#endif

If I add "*2" here, It works =).

Best regards
--
Kuninori Morimoto

#2 lore raw

PATCH 1/1 sh: sh7724 clock framework rewrite V2

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

This patch contains V2 of the sh7724 clock framework rewrite. The new code makes use of the recently merged div4, div6 and mstp32 helper code. Both extal and fll are supported as input clocks to the pll. The div6 clocks are fed through a divide-by-3 block.

---

Untested. Thanks to Morimoto-san for feedback.

 arch/sh/Kconfig                        |    2 
 arch/sh/kernel/cpu/sh4a/Makefile       |    2 
 arch/sh/kernel/cpu/sh4a/clock-sh7722.c |   57 --------
 arch/sh/kernel/cpu/sh4a/clock-sh7723.c |  222 ++++++++++++++++++++++++++++++++
 4 files changed, 225 insertions(+), 58 deletions(-)
arch/sh/Kconfig +1 -1
@@ -516,7 +516,7 @@ config SH_CLK_CPG
 
 config SH_CLK_CPG_LEGACY
 	depends on SH_CLK_CPG
-	def_bool y if !CPU_SUBTYPE_SH7785 && !CPU_SUBTYPE_SH7723
+	def_bool y if !CPU_SUBTYPE_SH7785 && !CPU_SUBTYPE_SH7723 && !CPU_SUBTYPE_SH7724
 
 config SH_CLK_MD
 	int "CPU Mode Pin Setting"
arch/sh/kernel/cpu/sh4a/Makefile +1 -1
@@ -27,7 +27,7 @@ clock-$(CONFIG_CPU_SUBTYPE_SH7786)	:= cl
 clock-$(CONFIG_CPU_SUBTYPE_SH7343)	:= clock-sh7722.o
 clock-$(CONFIG_CPU_SUBTYPE_SH7722)	:= clock-sh7722.o
 clock-$(CONFIG_CPU_SUBTYPE_SH7723)	:= clock-sh7723.o
-clock-$(CONFIG_CPU_SUBTYPE_SH7724)	:= clock-sh7722.o
+clock-$(CONFIG_CPU_SUBTYPE_SH7724)	:= clock-sh7724.o
 clock-$(CONFIG_CPU_SUBTYPE_SH7366)	:= clock-sh7722.o
 clock-$(CONFIG_CPU_SUBTYPE_SHX3)	:= clock-shx3.o
 
arch/sh/kernel/cpu/sh4a/clock-sh7722.c +5 -80

137 lines not on this page · raw message

arch/sh/kernel/cpu/sh4a/clock-sh7724.c new file +242 -0

242 lines not on this page · raw message

#3 lore raw
In reply to Magnus Damm

Hi Morimoto-san,

Thanks for checking the patch!

Quoted 9 lines · Kuninori Morimoto

on new clock-sh7724.c

arch/sh/kernel/cpu/sh4a/clock-sh7724.c line 58

Quoted 4 lines
arch/sh/kernel/cpu/sh4a/clock-sh7724.c new file +4 -0
+static unsigned long pll_recalc(struct clk *clk)
+{
+     return clk->parent->rate * (((__raw_readl(FRQCRA) >> 24) & 0x3f) + 1);
+}

sh7724 needs "* 2" here.
please check old clock-sh7722.c

Yes, you are correct. Thanks for finding this problem.

I've fixed this in V2 that I posted yesterday. Let me know if you find any other issues.

Thanks,

/ magnus

#4 lore raw
In reply to Magnus Damm

Hi Magnus

Quoted 4 lines
Quoted 2 lines

sh7724 needs "* 2" here.
please check old clock-sh7722.c

Yes, you are correct. Thanks for finding this problem.

no problem.

Quoted 2 lines

I've fixed this in V2 that I posted yesterday. Let me know if you find any other issues.

OK. I will try this patch next week.

Best regards
--
Kuninori Morimoto

#5 lore raw

Re: [PATCH] sh: sh7724 clock framework rewrite V2

In reply to Magnus Damm

Hi Magnus

I checked this patch. and it works.
But I found bug

Quoted 8 lines

This patch contains V2 of the sh7724 clock framework rewrite. The new code makes use of the recently merged div4, div6 and mstp32 helper code. Both extal and fll are supported as input clocks to the pll. The div6 clocks are fed through a divide-by-3 block.

arch/sh/kernel/cpu/sh4a/clock-sh7722.c +0 -1
-	MSTPCR("tmu1", "peripheral_clk", 0, 10, 0),

(snip)

arch/sh/kernel/cpu/sh4a/clock-sh7724.c line 126

Quoted 1 line
arch/sh/kernel/cpu/sh4a/clock-sh7724.c new file +1 -0
+	MSTP("flctl0", &div4_clks[DIV4_P], MSTPCR0, 10, 0, 1, 0),

I wonder your manual is old one.
old manual is very bad, and it say lie sometimes.

correct MSTP010 is "tmu1" here

Best regards
--
Kuninori Morimoto

#6 lore raw

Re: [PATCH] sh: sh7724 clock framework rewrite V2

In reply to Magnus Damm

Hi Morimoto-san,

Thanks for checking the patch.

Quoted 9 lines · Kuninori Morimoto
Quoted 7 lines

This patch contains V2 of the sh7724 clock framework rewrite. The new code makes use of the recently merged div4, div6 and mstp32 helper code. Both extal and fll are supported as input clocks to the pll. The div6 clocks are fed through a divide-by-3 block.

-     MSTPCR("tmu1", "peripheral_clk", 0, 10, 0),

(snip)

Quoted 1 line

+     MSTP("flctl0", &div4_clks[DIV4_P], MSTPCR0, 10, 0, 1, 0),

Yeah, you are correct.

Quoted 4 lines

I wonder your manual is old one.
old manual is very bad, and it say lie sometimes.

correct MSTP010 is "tmu1" here

I used the Japanese version of Rev 0.10 for this code, but it contains "tmu1" for MSTP010.
So this must be my typo. Sorry about that.

I'll repost V3 in the near future. Thank you!

/ magnus

#7 lore raw

PATCH 1/1 sh: sh7724 clock framework rewrite V3

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

This patch contains V3 of the sh7724 clock framework rewrite. The new code makes use of the recently merged div4, div6 and mstp32 helper code. Both extal and fll are supported as input clocks to the pll. The div6 clocks are fed through a divide-by-3 block.

---

Apply V3 in the same order as V2 and V1 - after the sh7723 patch.

Changes since V2:
- Fixed MSTP010 from "flctl0" to "tmu1", thanks Morimoto-san!

 arch/sh/Kconfig                        |    2 
 arch/sh/kernel/cpu/sh4a/Makefile       |    2 
 arch/sh/kernel/cpu/sh4a/clock-sh7722.c |   85 -----------
 arch/sh/kernel/cpu/sh4a/clock-sh7724.c |  242 ++++++++++++++++++++++++++++++++
 4 files changed, 249 insertions(+), 82 deletions(-)
arch/sh/Kconfig +1 -1
@@ -516,7 +516,7 @@ config SH_CLK_CPG
 
 config SH_CLK_CPG_LEGACY
 	depends on SH_CLK_CPG
-	def_bool y if !CPU_SUBTYPE_SH7785 && !CPU_SUBTYPE_SH7723
+	def_bool y if !CPU_SUBTYPE_SH7785 && !CPU_SUBTYPE_SH7723 && !CPU_SUBTYPE_SH7724
 
 config SH_CLK_MD
 	int "CPU Mode Pin Setting"
arch/sh/kernel/cpu/sh4a/Makefile +1 -1
@@ -27,7 +27,7 @@ clock-$(CONFIG_CPU_SUBTYPE_SH7786)	:= cl
 clock-$(CONFIG_CPU_SUBTYPE_SH7343)	:= clock-sh7722.o
 clock-$(CONFIG_CPU_SUBTYPE_SH7722)	:= clock-sh7722.o
 clock-$(CONFIG_CPU_SUBTYPE_SH7723)	:= clock-sh7723.o
-clock-$(CONFIG_CPU_SUBTYPE_SH7724)	:= clock-sh7722.o
+clock-$(CONFIG_CPU_SUBTYPE_SH7724)	:= clock-sh7724.o
 clock-$(CONFIG_CPU_SUBTYPE_SH7366)	:= clock-sh7722.o
 clock-$(CONFIG_CPU_SUBTYPE_SHX3)	:= clock-shx3.o
 
arch/sh/kernel/cpu/sh4a/clock-sh7722.c +5 -80

137 lines not on this page · raw message

arch/sh/kernel/cpu/sh4a/clock-sh7724.c new file +242 -0

242 lines not on this page · raw message