diff options
author | Magnus Damm <damm@opensource.se> | 2010-02-19 04:22:25 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-02-22 05:11:20 -0500 |
commit | 0a5f337ecd20e70e84a5cfc0f2c24d0366087026 (patch) | |
tree | 947f3063cb56ca8e7b168b46432b1bd35475e075 /arch/sh/kernel | |
parent | de7ca2144c36291a491bd39afad172f56432a4bb (diff) |
sh: introduce struct clk_div4_table
This patch introduces struct clk_div4_table. The structure
will be used to keep div4 specific data, and is with this
patch replacing the struct clk_div_mult_table pointer arg
used by the sh_clk_div4_register() functions.
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel')
-rw-r--r-- | arch/sh/kernel/cpu/clock-cpg.c | 16 | ||||
-rw-r--r-- | arch/sh/kernel/cpu/sh4a/clock-sh7343.c | 6 | ||||
-rw-r--r-- | arch/sh/kernel/cpu/sh4a/clock-sh7366.c | 6 | ||||
-rw-r--r-- | arch/sh/kernel/cpu/sh4a/clock-sh7722.c | 6 | ||||
-rw-r--r-- | arch/sh/kernel/cpu/sh4a/clock-sh7723.c | 6 | ||||
-rw-r--r-- | arch/sh/kernel/cpu/sh4a/clock-sh7724.c | 6 | ||||
-rw-r--r-- | arch/sh/kernel/cpu/sh4a/clock-sh7785.c | 6 | ||||
-rw-r--r-- | arch/sh/kernel/cpu/sh4a/clock-sh7786.c | 6 |
8 files changed, 44 insertions, 14 deletions
diff --git a/arch/sh/kernel/cpu/clock-cpg.c b/arch/sh/kernel/cpu/clock-cpg.c index 72a5e621a9bb..1fc8a0e50603 100644 --- a/arch/sh/kernel/cpu/clock-cpg.c +++ b/arch/sh/kernel/cpu/clock-cpg.c | |||
@@ -149,7 +149,8 @@ int __init sh_clk_div6_register(struct clk *clks, int nr) | |||
149 | 149 | ||
150 | static unsigned long sh_clk_div4_recalc(struct clk *clk) | 150 | static unsigned long sh_clk_div4_recalc(struct clk *clk) |
151 | { | 151 | { |
152 | struct clk_div_mult_table *table = clk->priv; | 152 | struct clk_div4_table *d4t = clk->priv; |
153 | struct clk_div_mult_table *table = d4t->div_mult_table; | ||
153 | unsigned int idx; | 154 | unsigned int idx; |
154 | 155 | ||
155 | clk_rate_table_build(clk, clk->freq_table, table->nr_divisors, | 156 | clk_rate_table_build(clk, clk->freq_table, table->nr_divisors, |
@@ -162,7 +163,8 @@ static unsigned long sh_clk_div4_recalc(struct clk *clk) | |||
162 | 163 | ||
163 | static int sh_clk_div4_set_parent(struct clk *clk, struct clk *parent) | 164 | static int sh_clk_div4_set_parent(struct clk *clk, struct clk *parent) |
164 | { | 165 | { |
165 | struct clk_div_mult_table *table = clk->priv; | 166 | struct clk_div4_table *d4t = clk->priv; |
167 | struct clk_div_mult_table *table = d4t->div_mult_table; | ||
166 | u32 value; | 168 | u32 value; |
167 | int ret; | 169 | int ret; |
168 | 170 | ||
@@ -234,11 +236,11 @@ static struct clk_ops sh_clk_div4_reparent_clk_ops = { | |||
234 | }; | 236 | }; |
235 | 237 | ||
236 | static int __init sh_clk_div4_register_ops(struct clk *clks, int nr, | 238 | static int __init sh_clk_div4_register_ops(struct clk *clks, int nr, |
237 | struct clk_div_mult_table *table, struct clk_ops *ops) | 239 | struct clk_div4_table *table, struct clk_ops *ops) |
238 | { | 240 | { |
239 | struct clk *clkp; | 241 | struct clk *clkp; |
240 | void *freq_table; | 242 | void *freq_table; |
241 | int nr_divs = table->nr_divisors; | 243 | int nr_divs = table->div_mult_table->nr_divisors; |
242 | int freq_table_size = sizeof(struct cpufreq_frequency_table); | 244 | int freq_table_size = sizeof(struct cpufreq_frequency_table); |
243 | int ret = 0; | 245 | int ret = 0; |
244 | int k; | 246 | int k; |
@@ -267,20 +269,20 @@ static int __init sh_clk_div4_register_ops(struct clk *clks, int nr, | |||
267 | } | 269 | } |
268 | 270 | ||
269 | int __init sh_clk_div4_register(struct clk *clks, int nr, | 271 | int __init sh_clk_div4_register(struct clk *clks, int nr, |
270 | struct clk_div_mult_table *table) | 272 | struct clk_div4_table *table) |
271 | { | 273 | { |
272 | return sh_clk_div4_register_ops(clks, nr, table, &sh_clk_div4_clk_ops); | 274 | return sh_clk_div4_register_ops(clks, nr, table, &sh_clk_div4_clk_ops); |
273 | } | 275 | } |
274 | 276 | ||
275 | int __init sh_clk_div4_enable_register(struct clk *clks, int nr, | 277 | int __init sh_clk_div4_enable_register(struct clk *clks, int nr, |
276 | struct clk_div_mult_table *table) | 278 | struct clk_div4_table *table) |
277 | { | 279 | { |
278 | return sh_clk_div4_register_ops(clks, nr, table, | 280 | return sh_clk_div4_register_ops(clks, nr, table, |
279 | &sh_clk_div4_enable_clk_ops); | 281 | &sh_clk_div4_enable_clk_ops); |
280 | } | 282 | } |
281 | 283 | ||
282 | int __init sh_clk_div4_reparent_register(struct clk *clks, int nr, | 284 | int __init sh_clk_div4_reparent_register(struct clk *clks, int nr, |
283 | struct clk_div_mult_table *table) | 285 | struct clk_div4_table *table) |
284 | { | 286 | { |
285 | return sh_clk_div4_register_ops(clks, nr, table, | 287 | return sh_clk_div4_register_ops(clks, nr, table, |
286 | &sh_clk_div4_reparent_clk_ops); | 288 | &sh_clk_div4_reparent_clk_ops); |
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7343.c b/arch/sh/kernel/cpu/sh4a/clock-sh7343.c index 0ee3ee861252..2c16df37eda6 100644 --- a/arch/sh/kernel/cpu/sh4a/clock-sh7343.c +++ b/arch/sh/kernel/cpu/sh4a/clock-sh7343.c | |||
@@ -107,13 +107,17 @@ struct clk *main_clks[] = { | |||
107 | static int multipliers[] = { 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; | 107 | static int multipliers[] = { 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; |
108 | static int divisors[] = { 1, 3, 2, 5, 3, 4, 5, 6, 8, 10, 12, 16, 20 }; | 108 | static int divisors[] = { 1, 3, 2, 5, 3, 4, 5, 6, 8, 10, 12, 16, 20 }; |
109 | 109 | ||
110 | static struct clk_div_mult_table div4_table = { | 110 | static struct clk_div_mult_table div4_div_mult_table = { |
111 | .divisors = divisors, | 111 | .divisors = divisors, |
112 | .nr_divisors = ARRAY_SIZE(divisors), | 112 | .nr_divisors = ARRAY_SIZE(divisors), |
113 | .multipliers = multipliers, | 113 | .multipliers = multipliers, |
114 | .nr_multipliers = ARRAY_SIZE(multipliers), | 114 | .nr_multipliers = ARRAY_SIZE(multipliers), |
115 | }; | 115 | }; |
116 | 116 | ||
117 | static struct clk_div4_table div4_table = { | ||
118 | .div_mult_table = &div4_div_mult_table, | ||
119 | }; | ||
120 | |||
117 | enum { DIV4_I, DIV4_U, DIV4_SH, DIV4_B, DIV4_B3, DIV4_P, | 121 | enum { DIV4_I, DIV4_U, DIV4_SH, DIV4_B, DIV4_B3, DIV4_P, |
118 | DIV4_SIUA, DIV4_SIUB, DIV4_NR }; | 122 | DIV4_SIUA, DIV4_SIUB, DIV4_NR }; |
119 | 123 | ||
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7366.c b/arch/sh/kernel/cpu/sh4a/clock-sh7366.c index a95ebaba095c..91588d280cd8 100644 --- a/arch/sh/kernel/cpu/sh4a/clock-sh7366.c +++ b/arch/sh/kernel/cpu/sh4a/clock-sh7366.c | |||
@@ -110,13 +110,17 @@ struct clk *main_clks[] = { | |||
110 | static int multipliers[] = { 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; | 110 | static int multipliers[] = { 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; |
111 | static int divisors[] = { 1, 3, 2, 5, 3, 4, 5, 6, 8, 10, 12, 16, 20 }; | 111 | static int divisors[] = { 1, 3, 2, 5, 3, 4, 5, 6, 8, 10, 12, 16, 20 }; |
112 | 112 | ||
113 | static struct clk_div_mult_table div4_table = { | 113 | static struct clk_div_mult_table div4_div_mult_table = { |
114 | .divisors = divisors, | 114 | .divisors = divisors, |
115 | .nr_divisors = ARRAY_SIZE(divisors), | 115 | .nr_divisors = ARRAY_SIZE(divisors), |
116 | .multipliers = multipliers, | 116 | .multipliers = multipliers, |
117 | .nr_multipliers = ARRAY_SIZE(multipliers), | 117 | .nr_multipliers = ARRAY_SIZE(multipliers), |
118 | }; | 118 | }; |
119 | 119 | ||
120 | static struct clk_div4_table div4_table = { | ||
121 | .div_mult_table = &div4_div_mult_table, | ||
122 | }; | ||
123 | |||
120 | enum { DIV4_I, DIV4_U, DIV4_SH, DIV4_B, DIV4_B3, DIV4_P, | 124 | enum { DIV4_I, DIV4_U, DIV4_SH, DIV4_B, DIV4_B3, DIV4_P, |
121 | DIV4_SIUA, DIV4_SIUB, DIV4_NR }; | 125 | DIV4_SIUA, DIV4_SIUB, DIV4_NR }; |
122 | 126 | ||
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c index 860ee2bf4bf0..15db6d521c5c 100644 --- a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c +++ b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c | |||
@@ -110,13 +110,17 @@ struct clk *main_clks[] = { | |||
110 | static int multipliers[] = { 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; | 110 | static int multipliers[] = { 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; |
111 | static int divisors[] = { 1, 3, 2, 5, 3, 4, 5, 6, 8, 10, 12, 16, 20 }; | 111 | static int divisors[] = { 1, 3, 2, 5, 3, 4, 5, 6, 8, 10, 12, 16, 20 }; |
112 | 112 | ||
113 | static struct clk_div_mult_table div4_table = { | 113 | static struct clk_div_mult_table div4_div_mult_table = { |
114 | .divisors = divisors, | 114 | .divisors = divisors, |
115 | .nr_divisors = ARRAY_SIZE(divisors), | 115 | .nr_divisors = ARRAY_SIZE(divisors), |
116 | .multipliers = multipliers, | 116 | .multipliers = multipliers, |
117 | .nr_multipliers = ARRAY_SIZE(multipliers), | 117 | .nr_multipliers = ARRAY_SIZE(multipliers), |
118 | }; | 118 | }; |
119 | 119 | ||
120 | static struct clk_div4_table div4_table = { | ||
121 | .div_mult_table = &div4_div_mult_table, | ||
122 | }; | ||
123 | |||
120 | #define DIV4(_str, _reg, _bit, _mask, _flags) \ | 124 | #define DIV4(_str, _reg, _bit, _mask, _flags) \ |
121 | SH_CLK_DIV4(_str, &pll_clk, _reg, _bit, _mask, _flags) | 125 | SH_CLK_DIV4(_str, &pll_clk, _reg, _bit, _mask, _flags) |
122 | 126 | ||
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7723.c b/arch/sh/kernel/cpu/sh4a/clock-sh7723.c index 76731b61998e..50babe01fe44 100644 --- a/arch/sh/kernel/cpu/sh4a/clock-sh7723.c +++ b/arch/sh/kernel/cpu/sh4a/clock-sh7723.c | |||
@@ -110,13 +110,17 @@ struct clk *main_clks[] = { | |||
110 | static int multipliers[] = { 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; | 110 | static int multipliers[] = { 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; |
111 | static int divisors[] = { 1, 3, 2, 5, 3, 4, 5, 6, 8, 10, 12, 16, 20 }; | 111 | static int divisors[] = { 1, 3, 2, 5, 3, 4, 5, 6, 8, 10, 12, 16, 20 }; |
112 | 112 | ||
113 | static struct clk_div_mult_table div4_table = { | 113 | static struct clk_div_mult_table div4_div_mult_table = { |
114 | .divisors = divisors, | 114 | .divisors = divisors, |
115 | .nr_divisors = ARRAY_SIZE(divisors), | 115 | .nr_divisors = ARRAY_SIZE(divisors), |
116 | .multipliers = multipliers, | 116 | .multipliers = multipliers, |
117 | .nr_multipliers = ARRAY_SIZE(multipliers), | 117 | .nr_multipliers = ARRAY_SIZE(multipliers), |
118 | }; | 118 | }; |
119 | 119 | ||
120 | static struct clk_div4_table div4_table = { | ||
121 | .div_mult_table = &div4_div_mult_table, | ||
122 | }; | ||
123 | |||
120 | enum { DIV4_I, DIV4_U, DIV4_SH, DIV4_B, DIV4_B3, DIV4_P, DIV4_NR }; | 124 | enum { DIV4_I, DIV4_U, DIV4_SH, DIV4_B, DIV4_B3, DIV4_P, DIV4_NR }; |
121 | 125 | ||
122 | #define DIV4(_str, _reg, _bit, _mask, _flags) \ | 126 | #define DIV4(_str, _reg, _bit, _mask, _flags) \ |
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c index 9db743802f06..70517900ef8f 100644 --- a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c +++ b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c | |||
@@ -129,11 +129,15 @@ struct clk *main_clks[] = { | |||
129 | 129 | ||
130 | static int divisors[] = { 2, 3, 4, 6, 8, 12, 16, 0, 24, 32, 36, 48, 0, 72 }; | 130 | static int divisors[] = { 2, 3, 4, 6, 8, 12, 16, 0, 24, 32, 36, 48, 0, 72 }; |
131 | 131 | ||
132 | static struct clk_div_mult_table div4_table = { | 132 | static struct clk_div_mult_table div4_div_mult_table = { |
133 | .divisors = divisors, | 133 | .divisors = divisors, |
134 | .nr_divisors = ARRAY_SIZE(divisors), | 134 | .nr_divisors = ARRAY_SIZE(divisors), |
135 | }; | 135 | }; |
136 | 136 | ||
137 | static struct clk_div4_table div4_table = { | ||
138 | .div_mult_table = &div4_div_mult_table, | ||
139 | }; | ||
140 | |||
137 | enum { DIV4_I, DIV4_SH, DIV4_B, DIV4_P, DIV4_M1, DIV4_NR }; | 141 | enum { DIV4_I, DIV4_SH, DIV4_B, DIV4_P, DIV4_M1, DIV4_NR }; |
138 | 142 | ||
139 | #define DIV4(_str, _reg, _bit, _mask, _flags) \ | 143 | #define DIV4(_str, _reg, _bit, _mask, _flags) \ |
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7785.c b/arch/sh/kernel/cpu/sh4a/clock-sh7785.c index 73abfbf2f16d..d997f0a25b10 100644 --- a/arch/sh/kernel/cpu/sh4a/clock-sh7785.c +++ b/arch/sh/kernel/cpu/sh4a/clock-sh7785.c | |||
@@ -57,11 +57,15 @@ static struct clk *clks[] = { | |||
57 | static unsigned int div2[] = { 1, 2, 4, 6, 8, 12, 16, 18, | 57 | static unsigned int div2[] = { 1, 2, 4, 6, 8, 12, 16, 18, |
58 | 24, 32, 36, 48 }; | 58 | 24, 32, 36, 48 }; |
59 | 59 | ||
60 | static struct clk_div_mult_table div4_table = { | 60 | static struct clk_div_mult_table div4_div_mult_table = { |
61 | .divisors = div2, | 61 | .divisors = div2, |
62 | .nr_divisors = ARRAY_SIZE(div2), | 62 | .nr_divisors = ARRAY_SIZE(div2), |
63 | }; | 63 | }; |
64 | 64 | ||
65 | static struct clk_div4_table div4_table = { | ||
66 | .div_mult_table = &div4_div_mult_table, | ||
67 | }; | ||
68 | |||
65 | enum { DIV4_I, DIV4_U, DIV4_SH, DIV4_B, DIV4_DDR, DIV4_GA, | 69 | enum { DIV4_I, DIV4_U, DIV4_SH, DIV4_B, DIV4_DDR, DIV4_GA, |
66 | DIV4_DU, DIV4_P, DIV4_NR }; | 70 | DIV4_DU, DIV4_P, DIV4_NR }; |
67 | 71 | ||
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7786.c b/arch/sh/kernel/cpu/sh4a/clock-sh7786.c index 494c636012bb..af69fd468703 100644 --- a/arch/sh/kernel/cpu/sh4a/clock-sh7786.c +++ b/arch/sh/kernel/cpu/sh4a/clock-sh7786.c | |||
@@ -59,11 +59,15 @@ static struct clk *clks[] = { | |||
59 | static unsigned int div2[] = { 1, 2, 4, 6, 8, 12, 16, 18, | 59 | static unsigned int div2[] = { 1, 2, 4, 6, 8, 12, 16, 18, |
60 | 24, 32, 36, 48 }; | 60 | 24, 32, 36, 48 }; |
61 | 61 | ||
62 | static struct clk_div_mult_table div4_table = { | 62 | static struct clk_div_mult_table div4_div_mult_table = { |
63 | .divisors = div2, | 63 | .divisors = div2, |
64 | .nr_divisors = ARRAY_SIZE(div2), | 64 | .nr_divisors = ARRAY_SIZE(div2), |
65 | }; | 65 | }; |
66 | 66 | ||
67 | static struct clk_div4_table div4_table = { | ||
68 | .div_mult_table = &div4_div_mult_table, | ||
69 | }; | ||
70 | |||
67 | enum { DIV4_I, DIV4_SH, DIV4_B, DIV4_DDR, DIV4_DU, DIV4_P, DIV4_NR }; | 71 | enum { DIV4_I, DIV4_SH, DIV4_B, DIV4_DDR, DIV4_DU, DIV4_P, DIV4_NR }; |
68 | 72 | ||
69 | #define DIV4(_str, _bit, _mask, _flags) \ | 73 | #define DIV4(_str, _bit, _mask, _flags) \ |