diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2011-12-06 01:29:15 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2011-12-06 01:58:05 -0500 |
commit | d4775356bb39eaa305844cc6cc4c267236535956 (patch) | |
tree | 4132bc277991fdc1d26deeca4dcfdf9d34cb5dad /arch/arm/mach-shmobile/clock-sh73a0.c | |
parent | 171f1bc77c2d34308392841bcffa69b8a22c2e09 (diff) |
sh: clkfwk: clock-sh73a0: all div6_clks use SH_CLK_DIV6_EXT()
Current div6 clocks can specify their current parent clocks
from its register value if it is registered
by sh_clk_div6_reparent_register().
This patch modifies all div6 clocks into SH_CLK_DIV6_EXT().
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/arm/mach-shmobile/clock-sh73a0.c')
-rw-r--r-- | arch/arm/mach-shmobile/clock-sh73a0.c | 146 |
1 files changed, 124 insertions, 22 deletions
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c index 61a846bb30f2..8ea8c810144b 100644 --- a/arch/arm/mach-shmobile/clock-sh73a0.c +++ b/arch/arm/mach-shmobile/clock-sh73a0.c | |||
@@ -92,6 +92,24 @@ static struct clk_ops div2_clk_ops = { | |||
92 | .recalc = div2_recalc, | 92 | .recalc = div2_recalc, |
93 | }; | 93 | }; |
94 | 94 | ||
95 | static unsigned long div7_recalc(struct clk *clk) | ||
96 | { | ||
97 | return clk->parent->rate / 7; | ||
98 | } | ||
99 | |||
100 | static struct clk_ops div7_clk_ops = { | ||
101 | .recalc = div7_recalc, | ||
102 | }; | ||
103 | |||
104 | static unsigned long div13_recalc(struct clk *clk) | ||
105 | { | ||
106 | return clk->parent->rate / 13; | ||
107 | } | ||
108 | |||
109 | static struct clk_ops div13_clk_ops = { | ||
110 | .recalc = div13_recalc, | ||
111 | }; | ||
112 | |||
95 | /* Divide extal1 by two */ | 113 | /* Divide extal1 by two */ |
96 | static struct clk extal1_div2_clk = { | 114 | static struct clk extal1_div2_clk = { |
97 | .ops = &div2_clk_ops, | 115 | .ops = &div2_clk_ops, |
@@ -113,6 +131,11 @@ static struct clk main_clk = { | |||
113 | .ops = &main_clk_ops, | 131 | .ops = &main_clk_ops, |
114 | }; | 132 | }; |
115 | 133 | ||
134 | static struct clk main_div2_clk = { | ||
135 | .ops = &div2_clk_ops, | ||
136 | .parent = &main_clk, | ||
137 | }; | ||
138 | |||
116 | /* PLL0, PLL1, PLL2, PLL3 */ | 139 | /* PLL0, PLL1, PLL2, PLL3 */ |
117 | static unsigned long pll_recalc(struct clk *clk) | 140 | static unsigned long pll_recalc(struct clk *clk) |
118 | { | 141 | { |
@@ -168,12 +191,29 @@ static struct clk pll3_clk = { | |||
168 | .enable_bit = 3, | 191 | .enable_bit = 3, |
169 | }; | 192 | }; |
170 | 193 | ||
171 | /* Divide PLL1 by two */ | 194 | /* Divide PLL */ |
172 | static struct clk pll1_div2_clk = { | 195 | static struct clk pll1_div2_clk = { |
173 | .ops = &div2_clk_ops, | 196 | .ops = &div2_clk_ops, |
174 | .parent = &pll1_clk, | 197 | .parent = &pll1_clk, |
175 | }; | 198 | }; |
176 | 199 | ||
200 | static struct clk pll1_div7_clk = { | ||
201 | .ops = &div7_clk_ops, | ||
202 | .parent = &pll1_clk, | ||
203 | }; | ||
204 | |||
205 | static struct clk pll1_div13_clk = { | ||
206 | .ops = &div13_clk_ops, | ||
207 | .parent = &pll1_clk, | ||
208 | }; | ||
209 | |||
210 | /* External input clock */ | ||
211 | struct clk sh73a0_extcki_clk = { | ||
212 | }; | ||
213 | |||
214 | struct clk sh73a0_extalr_clk = { | ||
215 | }; | ||
216 | |||
177 | static struct clk *main_clks[] = { | 217 | static struct clk *main_clks[] = { |
178 | &r_clk, | 218 | &r_clk, |
179 | &sh73a0_extal1_clk, | 219 | &sh73a0_extal1_clk, |
@@ -181,11 +221,16 @@ static struct clk *main_clks[] = { | |||
181 | &extal1_div2_clk, | 221 | &extal1_div2_clk, |
182 | &extal2_div2_clk, | 222 | &extal2_div2_clk, |
183 | &main_clk, | 223 | &main_clk, |
224 | &main_div2_clk, | ||
184 | &pll0_clk, | 225 | &pll0_clk, |
185 | &pll1_clk, | 226 | &pll1_clk, |
186 | &pll2_clk, | 227 | &pll2_clk, |
187 | &pll3_clk, | 228 | &pll3_clk, |
188 | &pll1_div2_clk, | 229 | &pll1_div2_clk, |
230 | &pll1_div7_clk, | ||
231 | &pll1_div13_clk, | ||
232 | &sh73a0_extcki_clk, | ||
233 | &sh73a0_extalr_clk, | ||
189 | }; | 234 | }; |
190 | 235 | ||
191 | static void div4_kick(struct clk *clk) | 236 | static void div4_kick(struct clk *clk) |
@@ -239,27 +284,84 @@ enum { DIV6_VCK1, DIV6_VCK2, DIV6_VCK3, DIV6_ZB1, | |||
239 | DIV6_DSIT, DIV6_DSI0P, DIV6_DSI1P, | 284 | DIV6_DSIT, DIV6_DSI0P, DIV6_DSI1P, |
240 | DIV6_NR }; | 285 | DIV6_NR }; |
241 | 286 | ||
287 | static struct clk *vck_parent[8] = { | ||
288 | [0] = &pll1_div2_clk, | ||
289 | [1] = &pll2_clk, | ||
290 | [2] = &sh73a0_extcki_clk, | ||
291 | [3] = &sh73a0_extal2_clk, | ||
292 | [4] = &main_div2_clk, | ||
293 | [5] = &sh73a0_extalr_clk, | ||
294 | [6] = &main_clk, | ||
295 | }; | ||
296 | |||
297 | static struct clk *pll_parent[4] = { | ||
298 | [0] = &pll1_div2_clk, | ||
299 | [1] = &pll2_clk, | ||
300 | [2] = &pll1_div13_clk, | ||
301 | }; | ||
302 | |||
303 | static struct clk *hsi_parent[4] = { | ||
304 | [0] = &pll1_div2_clk, | ||
305 | [1] = &pll2_clk, | ||
306 | [2] = &pll1_div7_clk, | ||
307 | }; | ||
308 | |||
309 | static struct clk *pll_extal2_parent[] = { | ||
310 | [0] = &pll1_div2_clk, | ||
311 | [1] = &pll2_clk, | ||
312 | [2] = &sh73a0_extal2_clk, | ||
313 | [3] = &sh73a0_extal2_clk, | ||
314 | }; | ||
315 | |||
316 | static struct clk *dsi_parent[8] = { | ||
317 | [0] = &pll1_div2_clk, | ||
318 | [1] = &pll2_clk, | ||
319 | [2] = &main_clk, | ||
320 | [3] = &sh73a0_extal2_clk, | ||
321 | [4] = &sh73a0_extcki_clk, | ||
322 | }; | ||
323 | |||
242 | static struct clk div6_clks[DIV6_NR] = { | 324 | static struct clk div6_clks[DIV6_NR] = { |
243 | [DIV6_VCK1] = SH_CLK_DIV6(&pll1_div2_clk, VCLKCR1, 0), | 325 | [DIV6_VCK1] = SH_CLK_DIV6_EXT(VCLKCR1, 0, |
244 | [DIV6_VCK2] = SH_CLK_DIV6(&pll1_div2_clk, VCLKCR2, 0), | 326 | vck_parent, ARRAY_SIZE(vck_parent), 12, 3), |
245 | [DIV6_VCK3] = SH_CLK_DIV6(&pll1_div2_clk, VCLKCR3, 0), | 327 | [DIV6_VCK2] = SH_CLK_DIV6_EXT(VCLKCR2, 0, |
246 | [DIV6_ZB1] = SH_CLK_DIV6(&pll1_div2_clk, ZBCKCR, 0), | 328 | vck_parent, ARRAY_SIZE(vck_parent), 12, 3), |
247 | [DIV6_FLCTL] = SH_CLK_DIV6(&pll1_div2_clk, FLCKCR, 0), | 329 | [DIV6_VCK3] = SH_CLK_DIV6_EXT(VCLKCR3, 0, |
248 | [DIV6_SDHI0] = SH_CLK_DIV6(&pll1_div2_clk, SD0CKCR, 0), | 330 | vck_parent, ARRAY_SIZE(vck_parent), 12, 3), |
249 | [DIV6_SDHI1] = SH_CLK_DIV6(&pll1_div2_clk, SD1CKCR, 0), | 331 | [DIV6_ZB1] = SH_CLK_DIV6_EXT(ZBCKCR, 0, |
250 | [DIV6_SDHI2] = SH_CLK_DIV6(&pll1_div2_clk, SD2CKCR, 0), | 332 | pll_parent, ARRAY_SIZE(pll_parent), 7, 1), |
251 | [DIV6_FSIA] = SH_CLK_DIV6(&pll1_div2_clk, FSIACKCR, 0), | 333 | [DIV6_FLCTL] = SH_CLK_DIV6_EXT(FLCKCR, 0, |
252 | [DIV6_FSIB] = SH_CLK_DIV6(&pll1_div2_clk, FSIBCKCR, 0), | 334 | pll_parent, ARRAY_SIZE(pll_parent), 7, 1), |
253 | [DIV6_SUB] = SH_CLK_DIV6(&sh73a0_extal2_clk, SUBCKCR, 0), | 335 | [DIV6_SDHI0] = SH_CLK_DIV6_EXT(SD0CKCR, 0, |
254 | [DIV6_SPUA] = SH_CLK_DIV6(&pll1_div2_clk, SPUACKCR, 0), | 336 | pll_parent, ARRAY_SIZE(pll_parent), 6, 2), |
255 | [DIV6_SPUV] = SH_CLK_DIV6(&pll1_div2_clk, SPUVCKCR, 0), | 337 | [DIV6_SDHI1] = SH_CLK_DIV6_EXT(SD1CKCR, 0, |
256 | [DIV6_MSU] = SH_CLK_DIV6(&pll1_div2_clk, MSUCKCR, 0), | 338 | pll_parent, ARRAY_SIZE(pll_parent), 6, 2), |
257 | [DIV6_HSI] = SH_CLK_DIV6(&pll1_div2_clk, HSICKCR, 0), | 339 | [DIV6_SDHI2] = SH_CLK_DIV6_EXT(SD2CKCR, 0, |
258 | [DIV6_MFG1] = SH_CLK_DIV6(&pll1_div2_clk, MFCK1CR, 0), | 340 | pll_parent, ARRAY_SIZE(pll_parent), 6, 2), |
259 | [DIV6_MFG2] = SH_CLK_DIV6(&pll1_div2_clk, MFCK2CR, 0), | 341 | [DIV6_FSIA] = SH_CLK_DIV6_EXT(FSIACKCR, 0, |
260 | [DIV6_DSIT] = SH_CLK_DIV6(&pll1_div2_clk, DSITCKCR, 0), | 342 | pll_parent, ARRAY_SIZE(pll_parent), 6, 1), |
261 | [DIV6_DSI0P] = SH_CLK_DIV6(&pll1_div2_clk, DSI0PCKCR, 0), | 343 | [DIV6_FSIB] = SH_CLK_DIV6_EXT(FSIBCKCR, 0, |
262 | [DIV6_DSI1P] = SH_CLK_DIV6(&pll1_div2_clk, DSI1PCKCR, 0), | 344 | pll_parent, ARRAY_SIZE(pll_parent), 6, 1), |
345 | [DIV6_SUB] = SH_CLK_DIV6_EXT(SUBCKCR, 0, | ||
346 | pll_extal2_parent, ARRAY_SIZE(pll_extal2_parent), 6, 2), | ||
347 | [DIV6_SPUA] = SH_CLK_DIV6_EXT(SPUACKCR, 0, | ||
348 | pll_extal2_parent, ARRAY_SIZE(pll_extal2_parent), 6, 2), | ||
349 | [DIV6_SPUV] = SH_CLK_DIV6_EXT(SPUVCKCR, 0, | ||
350 | pll_extal2_parent, ARRAY_SIZE(pll_extal2_parent), 6, 2), | ||
351 | [DIV6_MSU] = SH_CLK_DIV6_EXT(MSUCKCR, 0, | ||
352 | pll_parent, ARRAY_SIZE(pll_parent), 7, 1), | ||
353 | [DIV6_HSI] = SH_CLK_DIV6_EXT(HSICKCR, 0, | ||
354 | hsi_parent, ARRAY_SIZE(hsi_parent), 6, 2), | ||
355 | [DIV6_MFG1] = SH_CLK_DIV6_EXT(MFCK1CR, 0, | ||
356 | pll_parent, ARRAY_SIZE(pll_parent), 7, 1), | ||
357 | [DIV6_MFG2] = SH_CLK_DIV6_EXT(MFCK2CR, 0, | ||
358 | pll_parent, ARRAY_SIZE(pll_parent), 7, 1), | ||
359 | [DIV6_DSIT] = SH_CLK_DIV6_EXT(DSITCKCR, 0, | ||
360 | pll_parent, ARRAY_SIZE(pll_parent), 7, 1), | ||
361 | [DIV6_DSI0P] = SH_CLK_DIV6_EXT(DSI0PCKCR, 0, | ||
362 | dsi_parent, ARRAY_SIZE(dsi_parent), 12, 3), | ||
363 | [DIV6_DSI1P] = SH_CLK_DIV6_EXT(DSI1PCKCR, 0, | ||
364 | dsi_parent, ARRAY_SIZE(dsi_parent), 12, 3), | ||
263 | }; | 365 | }; |
264 | 366 | ||
265 | enum { MSTP001, | 367 | enum { MSTP001, |
@@ -387,7 +489,7 @@ void __init sh73a0_clock_init(void) | |||
387 | ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table); | 489 | ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table); |
388 | 490 | ||
389 | if (!ret) | 491 | if (!ret) |
390 | ret = sh_clk_div6_register(div6_clks, DIV6_NR); | 492 | ret = sh_clk_div6_reparent_register(div6_clks, DIV6_NR); |
391 | 493 | ||
392 | if (!ret) | 494 | if (!ret) |
393 | ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR); | 495 | ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR); |