aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJerome Brunet <jbrunet@baylibre.com>2018-02-19 06:21:44 -0500
committerNeil Armstrong <narmstrong@baylibre.com>2018-03-13 05:09:56 -0400
commit513b67ac39b0ef91761d94d1d6e31bb84e380744 (patch)
treea9b7add7308b61715accd57b598a8f426c8860e6
parent093c3fac4619d267136dc4cb87b916c692fa07db (diff)
clk: meson: add mpll pre-divider
mpll clocks parent can actually be divided by 1 or 2. So far, this divider has always been set to 1, so the calculation was correct. Now that we know it exists, model the tree correctly. If we ever get a platform where the divider is different, we won't get into trouble Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
-rw-r--r--drivers/clk/meson/axg.c24
-rw-r--r--drivers/clk/meson/axg.h3
-rw-r--r--drivers/clk/meson/gxbb.c23
-rw-r--r--drivers/clk/meson/gxbb.h3
-rw-r--r--drivers/clk/meson/meson8b.c22
-rw-r--r--drivers/clk/meson/meson8b.h3
6 files changed, 65 insertions, 13 deletions
diff --git a/drivers/clk/meson/axg.c b/drivers/clk/meson/axg.c
index ed4a645753c4..2989087fb52d 100644
--- a/drivers/clk/meson/axg.c
+++ b/drivers/clk/meson/axg.c
@@ -354,6 +354,20 @@ static struct clk_fixed_factor axg_fclk_div7 = {
354 }, 354 },
355}; 355};
356 356
357static struct clk_regmap axg_mpll_prediv = {
358 .data = &(struct clk_regmap_div_data){
359 .offset = HHI_MPLL_CNTL5,
360 .shift = 12,
361 .width = 1,
362 },
363 .hw.init = &(struct clk_init_data){
364 .name = "mpll_prediv",
365 .ops = &clk_regmap_divider_ro_ops,
366 .parent_names = (const char *[]){ "fixed_pll" },
367 .num_parents = 1,
368 },
369};
370
357static struct clk_regmap axg_mpll0_div = { 371static struct clk_regmap axg_mpll0_div = {
358 .data = &(struct meson_clk_mpll_data){ 372 .data = &(struct meson_clk_mpll_data){
359 .sdm = { 373 .sdm = {
@@ -386,7 +400,7 @@ static struct clk_regmap axg_mpll0_div = {
386 .hw.init = &(struct clk_init_data){ 400 .hw.init = &(struct clk_init_data){
387 .name = "mpll0_div", 401 .name = "mpll0_div",
388 .ops = &meson_clk_mpll_ops, 402 .ops = &meson_clk_mpll_ops,
389 .parent_names = (const char *[]){ "fixed_pll" }, 403 .parent_names = (const char *[]){ "mpll_prediv" },
390 .num_parents = 1, 404 .num_parents = 1,
391 }, 405 },
392}; 406};
@@ -432,7 +446,7 @@ static struct clk_regmap axg_mpll1_div = {
432 .hw.init = &(struct clk_init_data){ 446 .hw.init = &(struct clk_init_data){
433 .name = "mpll1_div", 447 .name = "mpll1_div",
434 .ops = &meson_clk_mpll_ops, 448 .ops = &meson_clk_mpll_ops,
435 .parent_names = (const char *[]){ "fixed_pll" }, 449 .parent_names = (const char *[]){ "mpll_prediv" },
436 .num_parents = 1, 450 .num_parents = 1,
437 }, 451 },
438}; 452};
@@ -478,7 +492,7 @@ static struct clk_regmap axg_mpll2_div = {
478 .hw.init = &(struct clk_init_data){ 492 .hw.init = &(struct clk_init_data){
479 .name = "mpll2_div", 493 .name = "mpll2_div",
480 .ops = &meson_clk_mpll_ops, 494 .ops = &meson_clk_mpll_ops,
481 .parent_names = (const char *[]){ "fixed_pll" }, 495 .parent_names = (const char *[]){ "mpll_prediv" },
482 .num_parents = 1, 496 .num_parents = 1,
483 }, 497 },
484}; 498};
@@ -524,7 +538,7 @@ static struct clk_regmap axg_mpll3_div = {
524 .hw.init = &(struct clk_init_data){ 538 .hw.init = &(struct clk_init_data){
525 .name = "mpll3_div", 539 .name = "mpll3_div",
526 .ops = &meson_clk_mpll_ops, 540 .ops = &meson_clk_mpll_ops,
527 .parent_names = (const char *[]){ "fixed_pll" }, 541 .parent_names = (const char *[]){ "mpll_prediv" },
528 .num_parents = 1, 542 .num_parents = 1,
529 }, 543 },
530}; 544};
@@ -821,6 +835,7 @@ static struct clk_hw_onecell_data axg_hw_onecell_data = {
821 [CLKID_MPLL2_DIV] = &axg_mpll2_div.hw, 835 [CLKID_MPLL2_DIV] = &axg_mpll2_div.hw,
822 [CLKID_MPLL3_DIV] = &axg_mpll3_div.hw, 836 [CLKID_MPLL3_DIV] = &axg_mpll3_div.hw,
823 [CLKID_HIFI_PLL] = &axg_hifi_pll.hw, 837 [CLKID_HIFI_PLL] = &axg_hifi_pll.hw,
838 [CLKID_MPLL_PREDIV] = &axg_mpll_prediv.hw,
824 [NR_CLKS] = NULL, 839 [NR_CLKS] = NULL,
825 }, 840 },
826 .num = NR_CLKS, 841 .num = NR_CLKS,
@@ -893,6 +908,7 @@ static struct clk_regmap *const axg_clk_regmaps[] = {
893 &axg_sys_pll, 908 &axg_sys_pll,
894 &axg_gp0_pll, 909 &axg_gp0_pll,
895 &axg_hifi_pll, 910 &axg_hifi_pll,
911 &axg_mpll_prediv,
896}; 912};
897 913
898static const struct of_device_id clkc_match_table[] = { 914static const struct of_device_id clkc_match_table[] = {
diff --git a/drivers/clk/meson/axg.h b/drivers/clk/meson/axg.h
index 4916c7045c48..6e5dc65041b5 100644
--- a/drivers/clk/meson/axg.h
+++ b/drivers/clk/meson/axg.h
@@ -121,8 +121,9 @@
121#define CLKID_MPLL1_DIV 66 121#define CLKID_MPLL1_DIV 66
122#define CLKID_MPLL2_DIV 67 122#define CLKID_MPLL2_DIV 67
123#define CLKID_MPLL3_DIV 68 123#define CLKID_MPLL3_DIV 68
124#define CLKID_MPLL_PREDIV 70
124 125
125#define NR_CLKS 70 126#define NR_CLKS 71
126 127
127/* include the CLKIDs that have been made part of the DT binding */ 128/* include the CLKIDs that have been made part of the DT binding */
128#include <dt-bindings/clock/axg-clkc.h> 129#include <dt-bindings/clock/axg-clkc.h>
diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c
index fdeb372863de..b62d181a6d33 100644
--- a/drivers/clk/meson/gxbb.c
+++ b/drivers/clk/meson/gxbb.c
@@ -545,6 +545,20 @@ static struct clk_fixed_factor gxbb_fclk_div7 = {
545 }, 545 },
546}; 546};
547 547
548static struct clk_regmap gxbb_mpll_prediv = {
549 .data = &(struct clk_regmap_div_data){
550 .offset = HHI_MPLL_CNTL5,
551 .shift = 12,
552 .width = 1,
553 },
554 .hw.init = &(struct clk_init_data){
555 .name = "mpll_prediv",
556 .ops = &clk_regmap_divider_ro_ops,
557 .parent_names = (const char *[]){ "fixed_pll" },
558 .num_parents = 1,
559 },
560};
561
548static struct clk_regmap gxbb_mpll0_div = { 562static struct clk_regmap gxbb_mpll0_div = {
549 .data = &(struct meson_clk_mpll_data){ 563 .data = &(struct meson_clk_mpll_data){
550 .sdm = { 564 .sdm = {
@@ -572,7 +586,7 @@ static struct clk_regmap gxbb_mpll0_div = {
572 .hw.init = &(struct clk_init_data){ 586 .hw.init = &(struct clk_init_data){
573 .name = "mpll0_div", 587 .name = "mpll0_div",
574 .ops = &meson_clk_mpll_ops, 588 .ops = &meson_clk_mpll_ops,
575 .parent_names = (const char *[]){ "fixed_pll" }, 589 .parent_names = (const char *[]){ "mpll_prediv" },
576 .num_parents = 1, 590 .num_parents = 1,
577 }, 591 },
578}; 592};
@@ -613,7 +627,7 @@ static struct clk_regmap gxbb_mpll1_div = {
613 .hw.init = &(struct clk_init_data){ 627 .hw.init = &(struct clk_init_data){
614 .name = "mpll1_div", 628 .name = "mpll1_div",
615 .ops = &meson_clk_mpll_ops, 629 .ops = &meson_clk_mpll_ops,
616 .parent_names = (const char *[]){ "fixed_pll" }, 630 .parent_names = (const char *[]){ "mpll_prediv" },
617 .num_parents = 1, 631 .num_parents = 1,
618 }, 632 },
619}; 633};
@@ -654,7 +668,7 @@ static struct clk_regmap gxbb_mpll2_div = {
654 .hw.init = &(struct clk_init_data){ 668 .hw.init = &(struct clk_init_data){
655 .name = "mpll2_div", 669 .name = "mpll2_div",
656 .ops = &meson_clk_mpll_ops, 670 .ops = &meson_clk_mpll_ops,
657 .parent_names = (const char *[]){ "fixed_pll" }, 671 .parent_names = (const char *[]){ "mpll_prediv" },
658 .num_parents = 1, 672 .num_parents = 1,
659 }, 673 },
660}; 674};
@@ -1703,6 +1717,7 @@ static struct clk_hw_onecell_data gxbb_hw_onecell_data = {
1703 [CLKID_MPLL0_DIV] = &gxbb_mpll0_div.hw, 1717 [CLKID_MPLL0_DIV] = &gxbb_mpll0_div.hw,
1704 [CLKID_MPLL1_DIV] = &gxbb_mpll1_div.hw, 1718 [CLKID_MPLL1_DIV] = &gxbb_mpll1_div.hw,
1705 [CLKID_MPLL2_DIV] = &gxbb_mpll2_div.hw, 1719 [CLKID_MPLL2_DIV] = &gxbb_mpll2_div.hw,
1720 [CLKID_MPLL_PREDIV] = &gxbb_mpll_prediv.hw,
1706 [NR_CLKS] = NULL, 1721 [NR_CLKS] = NULL,
1707 }, 1722 },
1708 .num = NR_CLKS, 1723 .num = NR_CLKS,
@@ -1853,6 +1868,7 @@ static struct clk_hw_onecell_data gxl_hw_onecell_data = {
1853 [CLKID_MPLL0_DIV] = &gxbb_mpll0_div.hw, 1868 [CLKID_MPLL0_DIV] = &gxbb_mpll0_div.hw,
1854 [CLKID_MPLL1_DIV] = &gxbb_mpll1_div.hw, 1869 [CLKID_MPLL1_DIV] = &gxbb_mpll1_div.hw,
1855 [CLKID_MPLL2_DIV] = &gxbb_mpll2_div.hw, 1870 [CLKID_MPLL2_DIV] = &gxbb_mpll2_div.hw,
1871 [CLKID_MPLL_PREDIV] = &gxbb_mpll_prediv.hw,
1856 [NR_CLKS] = NULL, 1872 [NR_CLKS] = NULL,
1857 }, 1873 },
1858 .num = NR_CLKS, 1874 .num = NR_CLKS,
@@ -2005,6 +2021,7 @@ static struct clk_regmap *const gx_clk_regmaps[] = {
2005 &gxbb_cts_amclk_div, 2021 &gxbb_cts_amclk_div,
2006 &gxbb_fixed_pll, 2022 &gxbb_fixed_pll,
2007 &gxbb_sys_pll, 2023 &gxbb_sys_pll,
2024 &gxbb_mpll_prediv,
2008}; 2025};
2009 2026
2010struct clkc_data { 2027struct clkc_data {
diff --git a/drivers/clk/meson/gxbb.h b/drivers/clk/meson/gxbb.h
index a8e7b8884e95..afae007ae1ec 100644
--- a/drivers/clk/meson/gxbb.h
+++ b/drivers/clk/meson/gxbb.h
@@ -198,8 +198,9 @@
198#define CLKID_MPLL0_DIV 142 198#define CLKID_MPLL0_DIV 142
199#define CLKID_MPLL1_DIV 143 199#define CLKID_MPLL1_DIV 143
200#define CLKID_MPLL2_DIV 144 200#define CLKID_MPLL2_DIV 144
201#define CLKID_MPLL_PREDIV 145
201 202
202#define NR_CLKS 145 203#define NR_CLKS 146
203 204
204/* include the CLKIDs that have been made part of the DT binding */ 205/* include the CLKIDs that have been made part of the DT binding */
205#include <dt-bindings/clock/gxbb-clkc.h> 206#include <dt-bindings/clock/gxbb-clkc.h>
diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c
index 62c54a75a1d2..f8b2f23c49de 100644
--- a/drivers/clk/meson/meson8b.c
+++ b/drivers/clk/meson/meson8b.c
@@ -280,6 +280,20 @@ static struct clk_fixed_factor meson8b_fclk_div7 = {
280 }, 280 },
281}; 281};
282 282
283static struct clk_regmap meson8b_mpll_prediv = {
284 .data = &(struct clk_regmap_div_data){
285 .offset = HHI_MPLL_CNTL5,
286 .shift = 12,
287 .width = 1,
288 },
289 .hw.init = &(struct clk_init_data){
290 .name = "mpll_prediv",
291 .ops = &clk_regmap_divider_ro_ops,
292 .parent_names = (const char *[]){ "fixed_pll" },
293 .num_parents = 1,
294 },
295};
296
283static struct clk_regmap meson8b_mpll0_div = { 297static struct clk_regmap meson8b_mpll0_div = {
284 .data = &(struct meson_clk_mpll_data){ 298 .data = &(struct meson_clk_mpll_data){
285 .sdm = { 299 .sdm = {
@@ -307,7 +321,7 @@ static struct clk_regmap meson8b_mpll0_div = {
307 .hw.init = &(struct clk_init_data){ 321 .hw.init = &(struct clk_init_data){
308 .name = "mpll0_div", 322 .name = "mpll0_div",
309 .ops = &meson_clk_mpll_ops, 323 .ops = &meson_clk_mpll_ops,
310 .parent_names = (const char *[]){ "fixed_pll" }, 324 .parent_names = (const char *[]){ "mpll_prediv" },
311 .num_parents = 1, 325 .num_parents = 1,
312 }, 326 },
313}; 327};
@@ -348,7 +362,7 @@ static struct clk_regmap meson8b_mpll1_div = {
348 .hw.init = &(struct clk_init_data){ 362 .hw.init = &(struct clk_init_data){
349 .name = "mpll1_div", 363 .name = "mpll1_div",
350 .ops = &meson_clk_mpll_ops, 364 .ops = &meson_clk_mpll_ops,
351 .parent_names = (const char *[]){ "fixed_pll" }, 365 .parent_names = (const char *[]){ "mpll_prediv" },
352 .num_parents = 1, 366 .num_parents = 1,
353 }, 367 },
354}; 368};
@@ -389,7 +403,7 @@ static struct clk_regmap meson8b_mpll2_div = {
389 .hw.init = &(struct clk_init_data){ 403 .hw.init = &(struct clk_init_data){
390 .name = "mpll2_div", 404 .name = "mpll2_div",
391 .ops = &meson_clk_mpll_ops, 405 .ops = &meson_clk_mpll_ops,
392 .parent_names = (const char *[]){ "fixed_pll" }, 406 .parent_names = (const char *[]){ "mpll_prediv" },
393 .num_parents = 1, 407 .num_parents = 1,
394 }, 408 },
395}; 409};
@@ -751,6 +765,7 @@ static struct clk_hw_onecell_data meson8b_hw_onecell_data = {
751 [CLKID_CPU_DIV3] = &meson8b_cpu_div3.hw, 765 [CLKID_CPU_DIV3] = &meson8b_cpu_div3.hw,
752 [CLKID_CPU_SCALE_DIV] = &meson8b_cpu_scale_div.hw, 766 [CLKID_CPU_SCALE_DIV] = &meson8b_cpu_scale_div.hw,
753 [CLKID_CPU_SCALE_OUT_SEL] = &meson8b_cpu_scale_out_sel.hw, 767 [CLKID_CPU_SCALE_OUT_SEL] = &meson8b_cpu_scale_out_sel.hw,
768 [CLKID_MPLL_PREDIV] = &meson8b_mpll_prediv.hw,
754 [CLK_NR_CLKS] = NULL, 769 [CLK_NR_CLKS] = NULL,
755 }, 770 },
756 .num = CLK_NR_CLKS, 771 .num = CLK_NR_CLKS,
@@ -850,6 +865,7 @@ static struct clk_regmap *const meson8b_clk_regmaps[] = {
850 &meson8b_cpu_scale_div, 865 &meson8b_cpu_scale_div,
851 &meson8b_cpu_scale_out_sel, 866 &meson8b_cpu_scale_out_sel,
852 &meson8b_cpu_clk, 867 &meson8b_cpu_clk,
868 &meson8b_mpll_prediv,
853}; 869};
854 870
855static const struct meson8b_clk_reset_line { 871static const struct meson8b_clk_reset_line {
diff --git a/drivers/clk/meson/meson8b.h b/drivers/clk/meson/meson8b.h
index 73dae83d9932..839ffc9da5f7 100644
--- a/drivers/clk/meson/meson8b.h
+++ b/drivers/clk/meson/meson8b.h
@@ -77,8 +77,9 @@
77#define CLKID_CPU_DIV3 101 77#define CLKID_CPU_DIV3 101
78#define CLKID_CPU_SCALE_DIV 102 78#define CLKID_CPU_SCALE_DIV 102
79#define CLKID_CPU_SCALE_OUT_SEL 103 79#define CLKID_CPU_SCALE_OUT_SEL 103
80#define CLKID_MPLL_PREDIV 104
80 81
81#define CLK_NR_CLKS 104 82#define CLK_NR_CLKS 105
82 83
83/* 84/*
84 * include the CLKID and RESETID that have 85 * include the CLKID and RESETID that have