aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2009-05-11 14:50:44 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-05-11 14:50:44 -0400
commita02cb230bb4fca04f091746c593de720a0e3a94a (patch)
treeb492976b4a4ee701c93fa12882510ddd41e2a26c
parentb68d8201433a91cabbcbeae48b53d8c1c426433a (diff)
sh: clkfwk: Add a followparent_recalc() helper.
This adds a followparent_recalc() helper for clocks that just follow the parent's rate. Switch over the few CPUs that use this scheme for some of their clocks. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--arch/sh/include/asm/clock.h2
-rw-r--r--arch/sh/kernel/cpu/clock.c6
-rw-r--r--arch/sh/kernel/cpu/sh2/clock-sh7619.c7
-rw-r--r--arch/sh/kernel/cpu/sh2a/clock-sh7203.c7
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7722.c7
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7763.c7
6 files changed, 11 insertions, 25 deletions
diff --git a/arch/sh/include/asm/clock.h b/arch/sh/include/asm/clock.h
index d63352b375cc..241f1c1d9ce1 100644
--- a/arch/sh/include/asm/clock.h
+++ b/arch/sh/include/asm/clock.h
@@ -44,7 +44,7 @@ int __init arch_clk_init(void);
44 44
45/* arch/sh/kernel/cpu/clock.c */ 45/* arch/sh/kernel/cpu/clock.c */
46int clk_init(void); 46int clk_init(void);
47 47unsigned long followparent_recalc(struct clk *clk);
48void clk_recalc_rate(struct clk *); 48void clk_recalc_rate(struct clk *);
49 49
50int clk_register(struct clk *); 50int clk_register(struct clk *);
diff --git a/arch/sh/kernel/cpu/clock.c b/arch/sh/kernel/cpu/clock.c
index b022affb44cd..17f6c078e851 100644
--- a/arch/sh/kernel/cpu/clock.c
+++ b/arch/sh/kernel/cpu/clock.c
@@ -90,6 +90,12 @@ static void propagate_rate(struct clk *clk)
90 } 90 }
91} 91}
92 92
93/* Used for clocks that always have same value as the parent clock */
94unsigned long followparent_recalc(struct clk *clk)
95{
96 return clk->parent->rate;
97}
98
93static void __clk_init(struct clk *clk) 99static void __clk_init(struct clk *clk)
94{ 100{
95 /* 101 /*
diff --git a/arch/sh/kernel/cpu/sh2/clock-sh7619.c b/arch/sh/kernel/cpu/sh2/clock-sh7619.c
index 26799139aa7a..4fe863170e31 100644
--- a/arch/sh/kernel/cpu/sh2/clock-sh7619.c
+++ b/arch/sh/kernel/cpu/sh2/clock-sh7619.c
@@ -57,13 +57,8 @@ static struct clk_ops sh7619_bus_clk_ops = {
57 .recalc = bus_clk_recalc, 57 .recalc = bus_clk_recalc,
58}; 58};
59 59
60static unsigned long cpu_clk_recalc(struct clk *clk)
61{
62 return clk->parent->rate;
63}
64
65static struct clk_ops sh7619_cpu_clk_ops = { 60static struct clk_ops sh7619_cpu_clk_ops = {
66 .recalc = cpu_clk_recalc, 61 .recalc = followparent_recalc,
67}; 62};
68 63
69static struct clk_ops *sh7619_clk_ops[] = { 64static struct clk_ops *sh7619_clk_ops[] = {
diff --git a/arch/sh/kernel/cpu/sh2a/clock-sh7203.c b/arch/sh/kernel/cpu/sh2a/clock-sh7203.c
index f8c6933857b3..940986965102 100644
--- a/arch/sh/kernel/cpu/sh2a/clock-sh7203.c
+++ b/arch/sh/kernel/cpu/sh2a/clock-sh7203.c
@@ -66,13 +66,8 @@ static struct clk_ops sh7203_bus_clk_ops = {
66 .recalc = bus_clk_recalc, 66 .recalc = bus_clk_recalc,
67}; 67};
68 68
69static unsigned long cpu_clk_recalc(struct clk *clk)
70{
71 return clk->parent->rate;
72}
73
74static struct clk_ops sh7203_cpu_clk_ops = { 69static struct clk_ops sh7203_cpu_clk_ops = {
75 .recalc = cpu_clk_recalc, 70 .recalc = followparent_recalc,
76}; 71};
77 72
78static struct clk_ops *sh7203_clk_ops[] = { 73static struct clk_ops *sh7203_clk_ops[] = {
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
index 5b1427f1ed41..4bdae84aa6b0 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
@@ -646,15 +646,10 @@ static void sh7722_mstpcr_disable(struct clk *clk)
646 sh7722_mstpcr_start_stop(clk, 0); 646 sh7722_mstpcr_start_stop(clk, 0);
647} 647}
648 648
649static unsigned long sh7722_mstpcr_recalc(struct clk *clk)
650{
651 return clk->parent->rate;
652}
653
654static struct clk_ops sh7722_mstpcr_clk_ops = { 649static struct clk_ops sh7722_mstpcr_clk_ops = {
655 .enable = sh7722_mstpcr_enable, 650 .enable = sh7722_mstpcr_enable,
656 .disable = sh7722_mstpcr_disable, 651 .disable = sh7722_mstpcr_disable,
657 .recalc = sh7722_mstpcr_recalc, 652 .recalc = followparent_recalc,
658}; 653};
659 654
660#define MSTPCR(_name, _parent, regnr, bitnr) \ 655#define MSTPCR(_name, _parent, regnr, bitnr) \
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7763.c b/arch/sh/kernel/cpu/sh4a/clock-sh7763.c
index 26630fb190c7..db51cffc5d5b 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7763.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7763.c
@@ -49,13 +49,8 @@ static struct clk_ops sh7763_bus_clk_ops = {
49 .recalc = bus_clk_recalc, 49 .recalc = bus_clk_recalc,
50}; 50};
51 51
52static unsigned long cpu_clk_recalc(struct clk *clk)
53{
54 return clk->parent->rate;
55}
56
57static struct clk_ops sh7763_cpu_clk_ops = { 52static struct clk_ops sh7763_cpu_clk_ops = {
58 .recalc = cpu_clk_recalc, 53 .recalc = followparent_recalc,
59}; 54};
60 55
61static struct clk_ops *sh7763_clk_ops[] = { 56static struct clk_ops *sh7763_clk_ops[] = {