diff options
author | Lee Jones <lee.jones@linaro.org> | 2013-09-17 05:31:39 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-09-26 05:05:45 -0400 |
commit | 2d0803001f0736c22ef6c05d8ae683166059f0bf (patch) | |
tree | 46f576379d8fe25c283e757245194ccd7bb2a5ba /drivers/clk | |
parent | f9fcb8e8c8f40c7edbeb7d70bcaed5c6a1095676 (diff) |
clk: ux500: Add Device Tree support for the PRCC Peripheral clock
This patch enables clocks to be specified from Device Tree via phandles
to the "prcc-periph-clock" node.
Acked-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/clk')
-rw-r--r-- | drivers/clk/ux500/u8500_of_clk.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/drivers/clk/ux500/u8500_of_clk.c b/drivers/clk/ux500/u8500_of_clk.c index f5534fdaba6b..dcc736afde77 100644 --- a/drivers/clk/ux500/u8500_of_clk.c +++ b/drivers/clk/ux500/u8500_of_clk.c | |||
@@ -15,10 +15,16 @@ | |||
15 | #include <linux/platform_data/clk-ux500.h> | 15 | #include <linux/platform_data/clk-ux500.h> |
16 | #include "clk.h" | 16 | #include "clk.h" |
17 | 17 | ||
18 | #define PRCC_NUM_PERIPH_CLUSTERS 6 | ||
19 | #define PRCC_PERIPHS_PER_CLUSTER 32 | ||
20 | |||
18 | static struct clk *prcmu_clk[PRCMU_NUM_CLKS]; | 21 | static struct clk *prcmu_clk[PRCMU_NUM_CLKS]; |
22 | static struct clk *prcc_pclk[(PRCC_NUM_PERIPH_CLUSTERS + 1) * PRCC_PERIPHS_PER_CLUSTER]; | ||
19 | 23 | ||
20 | #define PRCC_SHOW(clk, base, bit) \ | 24 | #define PRCC_SHOW(clk, base, bit) \ |
21 | clk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit] | 25 | clk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit] |
26 | #define PRCC_PCLK_STORE(clk, base, bit) \ | ||
27 | prcc_pclk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit] = clk | ||
22 | 28 | ||
23 | struct clk *ux500_twocell_get(struct of_phandle_args *clkspec, void *data) | 29 | struct clk *ux500_twocell_get(struct of_phandle_args *clkspec, void *data) |
24 | { | 30 | { |
@@ -237,135 +243,179 @@ void u8500_of_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base, | |||
237 | /* PRCC P-clocks */ | 243 | /* PRCC P-clocks */ |
238 | clk = clk_reg_prcc_pclk("p1_pclk0", "per1clk", clkrst1_base, | 244 | clk = clk_reg_prcc_pclk("p1_pclk0", "per1clk", clkrst1_base, |
239 | BIT(0), 0); | 245 | BIT(0), 0); |
246 | PRCC_PCLK_STORE(clk, 1, 0); | ||
240 | 247 | ||
241 | clk = clk_reg_prcc_pclk("p1_pclk1", "per1clk", clkrst1_base, | 248 | clk = clk_reg_prcc_pclk("p1_pclk1", "per1clk", clkrst1_base, |
242 | BIT(1), 0); | 249 | BIT(1), 0); |
250 | PRCC_PCLK_STORE(clk, 1, 1); | ||
243 | 251 | ||
244 | clk = clk_reg_prcc_pclk("p1_pclk2", "per1clk", clkrst1_base, | 252 | clk = clk_reg_prcc_pclk("p1_pclk2", "per1clk", clkrst1_base, |
245 | BIT(2), 0); | 253 | BIT(2), 0); |
254 | PRCC_PCLK_STORE(clk, 1, 2); | ||
246 | 255 | ||
247 | clk = clk_reg_prcc_pclk("p1_pclk3", "per1clk", clkrst1_base, | 256 | clk = clk_reg_prcc_pclk("p1_pclk3", "per1clk", clkrst1_base, |
248 | BIT(3), 0); | 257 | BIT(3), 0); |
258 | PRCC_PCLK_STORE(clk, 1, 3); | ||
249 | 259 | ||
250 | clk = clk_reg_prcc_pclk("p1_pclk4", "per1clk", clkrst1_base, | 260 | clk = clk_reg_prcc_pclk("p1_pclk4", "per1clk", clkrst1_base, |
251 | BIT(4), 0); | 261 | BIT(4), 0); |
262 | PRCC_PCLK_STORE(clk, 1, 4); | ||
252 | 263 | ||
253 | clk = clk_reg_prcc_pclk("p1_pclk5", "per1clk", clkrst1_base, | 264 | clk = clk_reg_prcc_pclk("p1_pclk5", "per1clk", clkrst1_base, |
254 | BIT(5), 0); | 265 | BIT(5), 0); |
266 | PRCC_PCLK_STORE(clk, 1, 5); | ||
255 | 267 | ||
256 | clk = clk_reg_prcc_pclk("p1_pclk6", "per1clk", clkrst1_base, | 268 | clk = clk_reg_prcc_pclk("p1_pclk6", "per1clk", clkrst1_base, |
257 | BIT(6), 0); | 269 | BIT(6), 0); |
270 | PRCC_PCLK_STORE(clk, 1, 6); | ||
258 | 271 | ||
259 | clk = clk_reg_prcc_pclk("p1_pclk7", "per1clk", clkrst1_base, | 272 | clk = clk_reg_prcc_pclk("p1_pclk7", "per1clk", clkrst1_base, |
260 | BIT(7), 0); | 273 | BIT(7), 0); |
274 | PRCC_PCLK_STORE(clk, 1, 7); | ||
261 | 275 | ||
262 | clk = clk_reg_prcc_pclk("p1_pclk8", "per1clk", clkrst1_base, | 276 | clk = clk_reg_prcc_pclk("p1_pclk8", "per1clk", clkrst1_base, |
263 | BIT(8), 0); | 277 | BIT(8), 0); |
278 | PRCC_PCLK_STORE(clk, 1, 8); | ||
264 | 279 | ||
265 | clk = clk_reg_prcc_pclk("p1_pclk9", "per1clk", clkrst1_base, | 280 | clk = clk_reg_prcc_pclk("p1_pclk9", "per1clk", clkrst1_base, |
266 | BIT(9), 0); | 281 | BIT(9), 0); |
282 | PRCC_PCLK_STORE(clk, 1, 9); | ||
267 | 283 | ||
268 | clk = clk_reg_prcc_pclk("p1_pclk10", "per1clk", clkrst1_base, | 284 | clk = clk_reg_prcc_pclk("p1_pclk10", "per1clk", clkrst1_base, |
269 | BIT(10), 0); | 285 | BIT(10), 0); |
286 | PRCC_PCLK_STORE(clk, 1, 10); | ||
270 | 287 | ||
271 | clk = clk_reg_prcc_pclk("p1_pclk11", "per1clk", clkrst1_base, | 288 | clk = clk_reg_prcc_pclk("p1_pclk11", "per1clk", clkrst1_base, |
272 | BIT(11), 0); | 289 | BIT(11), 0); |
290 | PRCC_PCLK_STORE(clk, 1, 11); | ||
273 | 291 | ||
274 | clk = clk_reg_prcc_pclk("p2_pclk0", "per2clk", clkrst2_base, | 292 | clk = clk_reg_prcc_pclk("p2_pclk0", "per2clk", clkrst2_base, |
275 | BIT(0), 0); | 293 | BIT(0), 0); |
294 | PRCC_PCLK_STORE(clk, 2, 0); | ||
276 | 295 | ||
277 | clk = clk_reg_prcc_pclk("p2_pclk1", "per2clk", clkrst2_base, | 296 | clk = clk_reg_prcc_pclk("p2_pclk1", "per2clk", clkrst2_base, |
278 | BIT(1), 0); | 297 | BIT(1), 0); |
298 | PRCC_PCLK_STORE(clk, 2, 1); | ||
279 | 299 | ||
280 | clk = clk_reg_prcc_pclk("p2_pclk2", "per2clk", clkrst2_base, | 300 | clk = clk_reg_prcc_pclk("p2_pclk2", "per2clk", clkrst2_base, |
281 | BIT(2), 0); | 301 | BIT(2), 0); |
302 | PRCC_PCLK_STORE(clk, 2, 2); | ||
282 | 303 | ||
283 | clk = clk_reg_prcc_pclk("p2_pclk3", "per2clk", clkrst2_base, | 304 | clk = clk_reg_prcc_pclk("p2_pclk3", "per2clk", clkrst2_base, |
284 | BIT(3), 0); | 305 | BIT(3), 0); |
306 | PRCC_PCLK_STORE(clk, 2, 3); | ||
285 | 307 | ||
286 | clk = clk_reg_prcc_pclk("p2_pclk4", "per2clk", clkrst2_base, | 308 | clk = clk_reg_prcc_pclk("p2_pclk4", "per2clk", clkrst2_base, |
287 | BIT(4), 0); | 309 | BIT(4), 0); |
310 | PRCC_PCLK_STORE(clk, 2, 4); | ||
288 | 311 | ||
289 | clk = clk_reg_prcc_pclk("p2_pclk5", "per2clk", clkrst2_base, | 312 | clk = clk_reg_prcc_pclk("p2_pclk5", "per2clk", clkrst2_base, |
290 | BIT(5), 0); | 313 | BIT(5), 0); |
314 | PRCC_PCLK_STORE(clk, 2, 5); | ||
291 | 315 | ||
292 | clk = clk_reg_prcc_pclk("p2_pclk6", "per2clk", clkrst2_base, | 316 | clk = clk_reg_prcc_pclk("p2_pclk6", "per2clk", clkrst2_base, |
293 | BIT(6), 0); | 317 | BIT(6), 0); |
318 | PRCC_PCLK_STORE(clk, 2, 6); | ||
294 | 319 | ||
295 | clk = clk_reg_prcc_pclk("p2_pclk7", "per2clk", clkrst2_base, | 320 | clk = clk_reg_prcc_pclk("p2_pclk7", "per2clk", clkrst2_base, |
296 | BIT(7), 0); | 321 | BIT(7), 0); |
322 | PRCC_PCLK_STORE(clk, 2, 7); | ||
297 | 323 | ||
298 | clk = clk_reg_prcc_pclk("p2_pclk8", "per2clk", clkrst2_base, | 324 | clk = clk_reg_prcc_pclk("p2_pclk8", "per2clk", clkrst2_base, |
299 | BIT(8), 0); | 325 | BIT(8), 0); |
326 | PRCC_PCLK_STORE(clk, 2, 8); | ||
300 | 327 | ||
301 | clk = clk_reg_prcc_pclk("p2_pclk9", "per2clk", clkrst2_base, | 328 | clk = clk_reg_prcc_pclk("p2_pclk9", "per2clk", clkrst2_base, |
302 | BIT(9), 0); | 329 | BIT(9), 0); |
330 | PRCC_PCLK_STORE(clk, 2, 9); | ||
303 | 331 | ||
304 | clk = clk_reg_prcc_pclk("p2_pclk10", "per2clk", clkrst2_base, | 332 | clk = clk_reg_prcc_pclk("p2_pclk10", "per2clk", clkrst2_base, |
305 | BIT(10), 0); | 333 | BIT(10), 0); |
334 | PRCC_PCLK_STORE(clk, 2, 10); | ||
306 | 335 | ||
307 | clk = clk_reg_prcc_pclk("p2_pclk11", "per2clk", clkrst2_base, | 336 | clk = clk_reg_prcc_pclk("p2_pclk11", "per2clk", clkrst2_base, |
308 | BIT(11), 0); | 337 | BIT(11), 0); |
338 | PRCC_PCLK_STORE(clk, 2, 1); | ||
309 | 339 | ||
310 | clk = clk_reg_prcc_pclk("p2_pclk12", "per2clk", clkrst2_base, | 340 | clk = clk_reg_prcc_pclk("p2_pclk12", "per2clk", clkrst2_base, |
311 | BIT(12), 0); | 341 | BIT(12), 0); |
342 | PRCC_PCLK_STORE(clk, 2, 12); | ||
312 | 343 | ||
313 | clk = clk_reg_prcc_pclk("p3_pclk0", "per3clk", clkrst3_base, | 344 | clk = clk_reg_prcc_pclk("p3_pclk0", "per3clk", clkrst3_base, |
314 | BIT(0), 0); | 345 | BIT(0), 0); |
346 | PRCC_PCLK_STORE(clk, 3, 0); | ||
315 | 347 | ||
316 | clk = clk_reg_prcc_pclk("p3_pclk1", "per3clk", clkrst3_base, | 348 | clk = clk_reg_prcc_pclk("p3_pclk1", "per3clk", clkrst3_base, |
317 | BIT(1), 0); | 349 | BIT(1), 0); |
350 | PRCC_PCLK_STORE(clk, 3, 1); | ||
318 | 351 | ||
319 | clk = clk_reg_prcc_pclk("p3_pclk2", "per3clk", clkrst3_base, | 352 | clk = clk_reg_prcc_pclk("p3_pclk2", "per3clk", clkrst3_base, |
320 | BIT(2), 0); | 353 | BIT(2), 0); |
354 | PRCC_PCLK_STORE(clk, 3, 2); | ||
321 | 355 | ||
322 | clk = clk_reg_prcc_pclk("p3_pclk3", "per3clk", clkrst3_base, | 356 | clk = clk_reg_prcc_pclk("p3_pclk3", "per3clk", clkrst3_base, |
323 | BIT(3), 0); | 357 | BIT(3), 0); |
358 | PRCC_PCLK_STORE(clk, 3, 3); | ||
324 | 359 | ||
325 | clk = clk_reg_prcc_pclk("p3_pclk4", "per3clk", clkrst3_base, | 360 | clk = clk_reg_prcc_pclk("p3_pclk4", "per3clk", clkrst3_base, |
326 | BIT(4), 0); | 361 | BIT(4), 0); |
362 | PRCC_PCLK_STORE(clk, 3, 4); | ||
327 | 363 | ||
328 | clk = clk_reg_prcc_pclk("p3_pclk5", "per3clk", clkrst3_base, | 364 | clk = clk_reg_prcc_pclk("p3_pclk5", "per3clk", clkrst3_base, |
329 | BIT(5), 0); | 365 | BIT(5), 0); |
366 | PRCC_PCLK_STORE(clk, 3, 5); | ||
330 | 367 | ||
331 | clk = clk_reg_prcc_pclk("p3_pclk6", "per3clk", clkrst3_base, | 368 | clk = clk_reg_prcc_pclk("p3_pclk6", "per3clk", clkrst3_base, |
332 | BIT(6), 0); | 369 | BIT(6), 0); |
370 | PRCC_PCLK_STORE(clk, 3, 6); | ||
333 | 371 | ||
334 | clk = clk_reg_prcc_pclk("p3_pclk7", "per3clk", clkrst3_base, | 372 | clk = clk_reg_prcc_pclk("p3_pclk7", "per3clk", clkrst3_base, |
335 | BIT(7), 0); | 373 | BIT(7), 0); |
374 | PRCC_PCLK_STORE(clk, 3, 7); | ||
336 | 375 | ||
337 | clk = clk_reg_prcc_pclk("p3_pclk8", "per3clk", clkrst3_base, | 376 | clk = clk_reg_prcc_pclk("p3_pclk8", "per3clk", clkrst3_base, |
338 | BIT(8), 0); | 377 | BIT(8), 0); |
378 | PRCC_PCLK_STORE(clk, 3, 8); | ||
339 | 379 | ||
340 | clk = clk_reg_prcc_pclk("p5_pclk0", "per5clk", clkrst5_base, | 380 | clk = clk_reg_prcc_pclk("p5_pclk0", "per5clk", clkrst5_base, |
341 | BIT(0), 0); | 381 | BIT(0), 0); |
382 | PRCC_PCLK_STORE(clk, 5, 0); | ||
342 | 383 | ||
343 | clk = clk_reg_prcc_pclk("p5_pclk1", "per5clk", clkrst5_base, | 384 | clk = clk_reg_prcc_pclk("p5_pclk1", "per5clk", clkrst5_base, |
344 | BIT(1), 0); | 385 | BIT(1), 0); |
386 | PRCC_PCLK_STORE(clk, 5, 1); | ||
345 | 387 | ||
346 | clk = clk_reg_prcc_pclk("p6_pclk0", "per6clk", clkrst6_base, | 388 | clk = clk_reg_prcc_pclk("p6_pclk0", "per6clk", clkrst6_base, |
347 | BIT(0), 0); | 389 | BIT(0), 0); |
390 | PRCC_PCLK_STORE(clk, 6, 0); | ||
348 | 391 | ||
349 | clk = clk_reg_prcc_pclk("p6_pclk1", "per6clk", clkrst6_base, | 392 | clk = clk_reg_prcc_pclk("p6_pclk1", "per6clk", clkrst6_base, |
350 | BIT(1), 0); | 393 | BIT(1), 0); |
394 | PRCC_PCLK_STORE(clk, 6, 1); | ||
351 | 395 | ||
352 | clk = clk_reg_prcc_pclk("p6_pclk2", "per6clk", clkrst6_base, | 396 | clk = clk_reg_prcc_pclk("p6_pclk2", "per6clk", clkrst6_base, |
353 | BIT(2), 0); | 397 | BIT(2), 0); |
398 | PRCC_PCLK_STORE(clk, 6, 2); | ||
354 | 399 | ||
355 | clk = clk_reg_prcc_pclk("p6_pclk3", "per6clk", clkrst6_base, | 400 | clk = clk_reg_prcc_pclk("p6_pclk3", "per6clk", clkrst6_base, |
356 | BIT(3), 0); | 401 | BIT(3), 0); |
402 | PRCC_PCLK_STORE(clk, 6, 3); | ||
357 | 403 | ||
358 | clk = clk_reg_prcc_pclk("p6_pclk4", "per6clk", clkrst6_base, | 404 | clk = clk_reg_prcc_pclk("p6_pclk4", "per6clk", clkrst6_base, |
359 | BIT(4), 0); | 405 | BIT(4), 0); |
406 | PRCC_PCLK_STORE(clk, 6, 4); | ||
360 | 407 | ||
361 | clk = clk_reg_prcc_pclk("p6_pclk5", "per6clk", clkrst6_base, | 408 | clk = clk_reg_prcc_pclk("p6_pclk5", "per6clk", clkrst6_base, |
362 | BIT(5), 0); | 409 | BIT(5), 0); |
410 | PRCC_PCLK_STORE(clk, 6, 5); | ||
363 | 411 | ||
364 | clk = clk_reg_prcc_pclk("p6_pclk6", "per6clk", clkrst6_base, | 412 | clk = clk_reg_prcc_pclk("p6_pclk6", "per6clk", clkrst6_base, |
365 | BIT(6), 0); | 413 | BIT(6), 0); |
414 | PRCC_PCLK_STORE(clk, 6, 6); | ||
366 | 415 | ||
367 | clk = clk_reg_prcc_pclk("p6_pclk7", "per6clk", clkrst6_base, | 416 | clk = clk_reg_prcc_pclk("p6_pclk7", "per6clk", clkrst6_base, |
368 | BIT(7), 0); | 417 | BIT(7), 0); |
418 | PRCC_PCLK_STORE(clk, 6, 7); | ||
369 | 419 | ||
370 | /* PRCC K-clocks | 420 | /* PRCC K-clocks |
371 | * | 421 | * |
@@ -464,5 +514,7 @@ void u8500_of_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base, | |||
464 | clk_data.clk_num = ARRAY_SIZE(prcmu_clk); | 514 | clk_data.clk_num = ARRAY_SIZE(prcmu_clk); |
465 | of_clk_add_provider(child, of_clk_src_onecell_get, &clk_data); | 515 | of_clk_add_provider(child, of_clk_src_onecell_get, &clk_data); |
466 | } | 516 | } |
517 | if (!of_node_cmp(child->name, "prcc-periph-clock")) | ||
518 | of_clk_add_provider(child, ux500_twocell_get, prcc_pclk); | ||
467 | } | 519 | } |
468 | } | 520 | } |