Lines Matching +full:- +full:clk
1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 2012 ST-Ericsson SA
11 #include <linux/clk-provider.h>
12 #include <linux/mfd/dbx500-prcmu.h>
14 #include "clk.h"
16 #include "reset-prcc.h"
18 static struct clk *prcc_pclk[(PRCC_NUM_PERIPH_CLUSTERS + 1) * PRCC_PERIPHS_PER_CLUSTER];
19 static struct clk *prcc_kclk[(PRCC_NUM_PERIPH_CLUSTERS + 1) * PRCC_PERIPHS_PER_CLUSTER];
22 #define PRCC_SHOW(clk, base, bit) \ argument
23 clk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit]
24 #define PRCC_PCLK_STORE(clk, base, bit) \ argument
25 prcc_pclk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit] = clk
26 #define PRCC_KCLK_STORE(clk, base, bit) \ argument
27 prcc_kclk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit] = clk
29 static struct clk *ux500_twocell_get(struct of_phandle_args *clkspec, in ux500_twocell_get()
32 struct clk **clk_data = data; in ux500_twocell_get()
35 if (clkspec->args_count != 2) in ux500_twocell_get()
36 return ERR_PTR(-EINVAL); in ux500_twocell_get()
38 base = clkspec->args[0]; in ux500_twocell_get()
39 bit = clkspec->args[1]; in ux500_twocell_get()
43 return ERR_PTR(-EINVAL); in ux500_twocell_get()
80 if (clkspec->args_count != 3) in ux500_clkout_get()
81 return ERR_PTR(-EINVAL); in ux500_clkout_get()
83 id = clkspec->args[0]; in ux500_clkout_get()
84 source = clkspec->args[1]; in ux500_clkout_get()
85 divider = clkspec->args[2]; in ux500_clkout_get()
89 return ERR_PTR(-EINVAL); in ux500_clkout_get()
100 return ERR_PTR(-EINVAL); in ux500_clkout_get()
105 return ERR_PTR(-EINVAL); in ux500_clkout_get()
130 struct clk *clk, *rtc_clk, *twd_clk; in u8500_clk_init() local
152 rstc->phy_base[i] = r.start; in u8500_clk_init()
169 * Read-only clocks that only return their current rate, only used in u8500_clk_init()
187 switch (fw_version->project) { in u8500_clk_init()
302 /* PRCC P-clocks */ in u8500_clk_init()
303 clk = clk_reg_prcc_pclk("p1_pclk0", "per1clk", bases[CLKRST1_INDEX], in u8500_clk_init()
305 PRCC_PCLK_STORE(clk, 1, 0); in u8500_clk_init()
307 clk = clk_reg_prcc_pclk("p1_pclk1", "per1clk", bases[CLKRST1_INDEX], in u8500_clk_init()
309 PRCC_PCLK_STORE(clk, 1, 1); in u8500_clk_init()
311 clk = clk_reg_prcc_pclk("p1_pclk2", "per1clk", bases[CLKRST1_INDEX], in u8500_clk_init()
313 PRCC_PCLK_STORE(clk, 1, 2); in u8500_clk_init()
315 clk = clk_reg_prcc_pclk("p1_pclk3", "per1clk", bases[CLKRST1_INDEX], in u8500_clk_init()
317 PRCC_PCLK_STORE(clk, 1, 3); in u8500_clk_init()
319 clk = clk_reg_prcc_pclk("p1_pclk4", "per1clk", bases[CLKRST1_INDEX], in u8500_clk_init()
321 PRCC_PCLK_STORE(clk, 1, 4); in u8500_clk_init()
323 clk = clk_reg_prcc_pclk("p1_pclk5", "per1clk", bases[CLKRST1_INDEX], in u8500_clk_init()
325 PRCC_PCLK_STORE(clk, 1, 5); in u8500_clk_init()
327 clk = clk_reg_prcc_pclk("p1_pclk6", "per1clk", bases[CLKRST1_INDEX], in u8500_clk_init()
329 PRCC_PCLK_STORE(clk, 1, 6); in u8500_clk_init()
331 clk = clk_reg_prcc_pclk("p1_pclk7", "per1clk", bases[CLKRST1_INDEX], in u8500_clk_init()
333 PRCC_PCLK_STORE(clk, 1, 7); in u8500_clk_init()
335 clk = clk_reg_prcc_pclk("p1_pclk8", "per1clk", bases[CLKRST1_INDEX], in u8500_clk_init()
337 PRCC_PCLK_STORE(clk, 1, 8); in u8500_clk_init()
339 clk = clk_reg_prcc_pclk("p1_pclk9", "per1clk", bases[CLKRST1_INDEX], in u8500_clk_init()
341 PRCC_PCLK_STORE(clk, 1, 9); in u8500_clk_init()
343 clk = clk_reg_prcc_pclk("p1_pclk10", "per1clk", bases[CLKRST1_INDEX], in u8500_clk_init()
345 PRCC_PCLK_STORE(clk, 1, 10); in u8500_clk_init()
347 clk = clk_reg_prcc_pclk("p1_pclk11", "per1clk", bases[CLKRST1_INDEX], in u8500_clk_init()
349 PRCC_PCLK_STORE(clk, 1, 11); in u8500_clk_init()
351 clk = clk_reg_prcc_pclk("p2_pclk0", "per2clk", bases[CLKRST2_INDEX], in u8500_clk_init()
353 PRCC_PCLK_STORE(clk, 2, 0); in u8500_clk_init()
355 clk = clk_reg_prcc_pclk("p2_pclk1", "per2clk", bases[CLKRST2_INDEX], in u8500_clk_init()
357 PRCC_PCLK_STORE(clk, 2, 1); in u8500_clk_init()
359 clk = clk_reg_prcc_pclk("p2_pclk2", "per2clk", bases[CLKRST2_INDEX], in u8500_clk_init()
361 PRCC_PCLK_STORE(clk, 2, 2); in u8500_clk_init()
363 clk = clk_reg_prcc_pclk("p2_pclk3", "per2clk", bases[CLKRST2_INDEX], in u8500_clk_init()
365 PRCC_PCLK_STORE(clk, 2, 3); in u8500_clk_init()
367 clk = clk_reg_prcc_pclk("p2_pclk4", "per2clk", bases[CLKRST2_INDEX], in u8500_clk_init()
369 PRCC_PCLK_STORE(clk, 2, 4); in u8500_clk_init()
371 clk = clk_reg_prcc_pclk("p2_pclk5", "per2clk", bases[CLKRST2_INDEX], in u8500_clk_init()
373 PRCC_PCLK_STORE(clk, 2, 5); in u8500_clk_init()
375 clk = clk_reg_prcc_pclk("p2_pclk6", "per2clk", bases[CLKRST2_INDEX], in u8500_clk_init()
377 PRCC_PCLK_STORE(clk, 2, 6); in u8500_clk_init()
379 clk = clk_reg_prcc_pclk("p2_pclk7", "per2clk", bases[CLKRST2_INDEX], in u8500_clk_init()
381 PRCC_PCLK_STORE(clk, 2, 7); in u8500_clk_init()
383 clk = clk_reg_prcc_pclk("p2_pclk8", "per2clk", bases[CLKRST2_INDEX], in u8500_clk_init()
385 PRCC_PCLK_STORE(clk, 2, 8); in u8500_clk_init()
387 clk = clk_reg_prcc_pclk("p2_pclk9", "per2clk", bases[CLKRST2_INDEX], in u8500_clk_init()
389 PRCC_PCLK_STORE(clk, 2, 9); in u8500_clk_init()
391 clk = clk_reg_prcc_pclk("p2_pclk10", "per2clk", bases[CLKRST2_INDEX], in u8500_clk_init()
393 PRCC_PCLK_STORE(clk, 2, 10); in u8500_clk_init()
395 clk = clk_reg_prcc_pclk("p2_pclk11", "per2clk", bases[CLKRST2_INDEX], in u8500_clk_init()
397 PRCC_PCLK_STORE(clk, 2, 11); in u8500_clk_init()
399 clk = clk_reg_prcc_pclk("p2_pclk12", "per2clk", bases[CLKRST2_INDEX], in u8500_clk_init()
401 PRCC_PCLK_STORE(clk, 2, 12); in u8500_clk_init()
403 clk = clk_reg_prcc_pclk("p3_pclk0", "per3clk", bases[CLKRST3_INDEX], in u8500_clk_init()
405 PRCC_PCLK_STORE(clk, 3, 0); in u8500_clk_init()
407 clk = clk_reg_prcc_pclk("p3_pclk1", "per3clk", bases[CLKRST3_INDEX], in u8500_clk_init()
409 PRCC_PCLK_STORE(clk, 3, 1); in u8500_clk_init()
411 clk = clk_reg_prcc_pclk("p3_pclk2", "per3clk", bases[CLKRST3_INDEX], in u8500_clk_init()
413 PRCC_PCLK_STORE(clk, 3, 2); in u8500_clk_init()
415 clk = clk_reg_prcc_pclk("p3_pclk3", "per3clk", bases[CLKRST3_INDEX], in u8500_clk_init()
417 PRCC_PCLK_STORE(clk, 3, 3); in u8500_clk_init()
419 clk = clk_reg_prcc_pclk("p3_pclk4", "per3clk", bases[CLKRST3_INDEX], in u8500_clk_init()
421 PRCC_PCLK_STORE(clk, 3, 4); in u8500_clk_init()
423 clk = clk_reg_prcc_pclk("p3_pclk5", "per3clk", bases[CLKRST3_INDEX], in u8500_clk_init()
425 PRCC_PCLK_STORE(clk, 3, 5); in u8500_clk_init()
427 clk = clk_reg_prcc_pclk("p3_pclk6", "per3clk", bases[CLKRST3_INDEX], in u8500_clk_init()
429 PRCC_PCLK_STORE(clk, 3, 6); in u8500_clk_init()
431 clk = clk_reg_prcc_pclk("p3_pclk7", "per3clk", bases[CLKRST3_INDEX], in u8500_clk_init()
433 PRCC_PCLK_STORE(clk, 3, 7); in u8500_clk_init()
435 clk = clk_reg_prcc_pclk("p3_pclk8", "per3clk", bases[CLKRST3_INDEX], in u8500_clk_init()
437 PRCC_PCLK_STORE(clk, 3, 8); in u8500_clk_init()
439 clk = clk_reg_prcc_pclk("p5_pclk0", "per5clk", bases[CLKRST5_INDEX], in u8500_clk_init()
441 PRCC_PCLK_STORE(clk, 5, 0); in u8500_clk_init()
443 clk = clk_reg_prcc_pclk("p5_pclk1", "per5clk", bases[CLKRST5_INDEX], in u8500_clk_init()
445 PRCC_PCLK_STORE(clk, 5, 1); in u8500_clk_init()
447 clk = clk_reg_prcc_pclk("p6_pclk0", "per6clk", bases[CLKRST6_INDEX], in u8500_clk_init()
449 PRCC_PCLK_STORE(clk, 6, 0); in u8500_clk_init()
451 clk = clk_reg_prcc_pclk("p6_pclk1", "per6clk", bases[CLKRST6_INDEX], in u8500_clk_init()
453 PRCC_PCLK_STORE(clk, 6, 1); in u8500_clk_init()
455 clk = clk_reg_prcc_pclk("p6_pclk2", "per6clk", bases[CLKRST6_INDEX], in u8500_clk_init()
457 PRCC_PCLK_STORE(clk, 6, 2); in u8500_clk_init()
459 clk = clk_reg_prcc_pclk("p6_pclk3", "per6clk", bases[CLKRST6_INDEX], in u8500_clk_init()
461 PRCC_PCLK_STORE(clk, 6, 3); in u8500_clk_init()
463 clk = clk_reg_prcc_pclk("p6_pclk4", "per6clk", bases[CLKRST6_INDEX], in u8500_clk_init()
465 PRCC_PCLK_STORE(clk, 6, 4); in u8500_clk_init()
467 clk = clk_reg_prcc_pclk("p6_pclk5", "per6clk", bases[CLKRST6_INDEX], in u8500_clk_init()
469 PRCC_PCLK_STORE(clk, 6, 5); in u8500_clk_init()
471 clk = clk_reg_prcc_pclk("p6_pclk6", "per6clk", bases[CLKRST6_INDEX], in u8500_clk_init()
473 PRCC_PCLK_STORE(clk, 6, 6); in u8500_clk_init()
475 clk = clk_reg_prcc_pclk("p6_pclk7", "per6clk", bases[CLKRST6_INDEX], in u8500_clk_init()
477 PRCC_PCLK_STORE(clk, 6, 7); in u8500_clk_init()
479 /* PRCC K-clocks in u8500_clk_init()
482 * by enabling just the K-clock, even if it is not a valid parent to in u8500_clk_init()
483 * the K-clock. Until drivers get fixed we might need some kind of in u8500_clk_init()
488 clk = clk_reg_prcc_kclk("p1_uart0_kclk", "uartclk", in u8500_clk_init()
490 PRCC_KCLK_STORE(clk, 1, 0); in u8500_clk_init()
492 clk = clk_reg_prcc_kclk("p1_uart1_kclk", "uartclk", in u8500_clk_init()
494 PRCC_KCLK_STORE(clk, 1, 1); in u8500_clk_init()
496 clk = clk_reg_prcc_kclk("p1_i2c1_kclk", "i2cclk", in u8500_clk_init()
498 PRCC_KCLK_STORE(clk, 1, 2); in u8500_clk_init()
500 clk = clk_reg_prcc_kclk("p1_msp0_kclk", "msp02clk", in u8500_clk_init()
502 PRCC_KCLK_STORE(clk, 1, 3); in u8500_clk_init()
504 clk = clk_reg_prcc_kclk("p1_msp1_kclk", "msp1clk", in u8500_clk_init()
506 PRCC_KCLK_STORE(clk, 1, 4); in u8500_clk_init()
508 clk = clk_reg_prcc_kclk("p1_sdi0_kclk", "sdmmcclk", in u8500_clk_init()
510 PRCC_KCLK_STORE(clk, 1, 5); in u8500_clk_init()
512 clk = clk_reg_prcc_kclk("p1_i2c2_kclk", "i2cclk", in u8500_clk_init()
514 PRCC_KCLK_STORE(clk, 1, 6); in u8500_clk_init()
516 clk = clk_reg_prcc_kclk("p1_slimbus0_kclk", "slimclk", in u8500_clk_init()
518 PRCC_KCLK_STORE(clk, 1, 8); in u8500_clk_init()
520 clk = clk_reg_prcc_kclk("p1_i2c4_kclk", "i2cclk", in u8500_clk_init()
522 PRCC_KCLK_STORE(clk, 1, 9); in u8500_clk_init()
524 clk = clk_reg_prcc_kclk("p1_msp3_kclk", "msp1clk", in u8500_clk_init()
526 PRCC_KCLK_STORE(clk, 1, 10); in u8500_clk_init()
529 clk = clk_reg_prcc_kclk("p2_i2c3_kclk", "i2cclk", in u8500_clk_init()
531 PRCC_KCLK_STORE(clk, 2, 0); in u8500_clk_init()
533 clk = clk_reg_prcc_kclk("p2_sdi4_kclk", "sdmmcclk", in u8500_clk_init()
535 PRCC_KCLK_STORE(clk, 2, 2); in u8500_clk_init()
537 clk = clk_reg_prcc_kclk("p2_msp2_kclk", "msp02clk", in u8500_clk_init()
539 PRCC_KCLK_STORE(clk, 2, 3); in u8500_clk_init()
541 clk = clk_reg_prcc_kclk("p2_sdi1_kclk", "sdmmcclk", in u8500_clk_init()
543 PRCC_KCLK_STORE(clk, 2, 4); in u8500_clk_init()
545 clk = clk_reg_prcc_kclk("p2_sdi3_kclk", "sdmmcclk", in u8500_clk_init()
547 PRCC_KCLK_STORE(clk, 2, 5); in u8500_clk_init()
550 clk = clk_reg_prcc_kclk("p2_ssirx_kclk", "hsirxclk", in u8500_clk_init()
553 PRCC_KCLK_STORE(clk, 2, 6); in u8500_clk_init()
555 clk = clk_reg_prcc_kclk("p2_ssitx_kclk", "hsitxclk", in u8500_clk_init()
558 PRCC_KCLK_STORE(clk, 2, 7); in u8500_clk_init()
561 clk = clk_reg_prcc_kclk("p3_ssp0_kclk", "sspclk", in u8500_clk_init()
563 PRCC_KCLK_STORE(clk, 3, 1); in u8500_clk_init()
565 clk = clk_reg_prcc_kclk("p3_ssp1_kclk", "sspclk", in u8500_clk_init()
567 PRCC_KCLK_STORE(clk, 3, 2); in u8500_clk_init()
569 clk = clk_reg_prcc_kclk("p3_i2c0_kclk", "i2cclk", in u8500_clk_init()
571 PRCC_KCLK_STORE(clk, 3, 3); in u8500_clk_init()
573 clk = clk_reg_prcc_kclk("p3_sdi2_kclk", "sdmmcclk", in u8500_clk_init()
575 PRCC_KCLK_STORE(clk, 3, 4); in u8500_clk_init()
577 clk = clk_reg_prcc_kclk("p3_ske_kclk", "rtc32k", in u8500_clk_init()
579 PRCC_KCLK_STORE(clk, 3, 5); in u8500_clk_init()
581 clk = clk_reg_prcc_kclk("p3_uart2_kclk", "uartclk", in u8500_clk_init()
583 PRCC_KCLK_STORE(clk, 3, 6); in u8500_clk_init()
585 clk = clk_reg_prcc_kclk("p3_sdi5_kclk", "sdmmcclk", in u8500_clk_init()
587 PRCC_KCLK_STORE(clk, 3, 7); in u8500_clk_init()
590 clk = clk_reg_prcc_kclk("p3_rng_kclk", "rngclk", in u8500_clk_init()
592 PRCC_KCLK_STORE(clk, 6, 0); in u8500_clk_init()
595 if (of_node_name_eq(child, "prcmu-clock")) in u8500_clk_init()
599 if (of_node_name_eq(child, "clkout-clock")) in u8500_clk_init()
602 if (of_node_name_eq(child, "prcc-periph-clock")) in u8500_clk_init()
605 if (of_node_name_eq(child, "prcc-kernel-clock")) in u8500_clk_init()
608 if (of_node_name_eq(child, "rtc32k-clock")) in u8500_clk_init()
611 if (of_node_name_eq(child, "smp-twd-clock")) in u8500_clk_init()
614 if (of_node_name_eq(child, "prcc-reset-controller")) in u8500_clk_init()
618 CLK_OF_DECLARE(u8500_clks, "stericsson,u8500-clks", u8500_clk_init);