aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJerome Brunet <jbrunet@baylibre.com>2018-02-12 09:58:37 -0500
committerNeil Armstrong <narmstrong@baylibre.com>2018-03-13 05:04:00 -0400
commitf06ddd2852b3f45cf37e2abd6b0de4f9cec80f0f (patch)
tree345e332d1286fe40db97dc243d8d98129b24c8a4
parent7f9768a5405192d49c5d963f5e29c740315efca7 (diff)
clk: meson: migrate dividers to clk_regmap
Move meson8b, gxbb and axg clocks using clk_divider to clk_regmap Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
-rw-r--r--drivers/clk/meson/axg.c61
-rw-r--r--drivers/clk/meson/gxbb.c217
-rw-r--r--drivers/clk/meson/meson8b.c23
3 files changed, 142 insertions, 159 deletions
diff --git a/drivers/clk/meson/axg.c b/drivers/clk/meson/axg.c
index ed14f6ea7b07..f8b8ff2eba6c 100644
--- a/drivers/clk/meson/axg.c
+++ b/drivers/clk/meson/axg.c
@@ -433,14 +433,15 @@ static struct clk_mux axg_mpeg_clk_sel = {
433 }, 433 },
434}; 434};
435 435
436static struct clk_divider axg_mpeg_clk_div = { 436static struct clk_regmap axg_mpeg_clk_div = {
437 .reg = (void *)HHI_MPEG_CLK_CNTL, 437 .data = &(struct clk_regmap_div_data){
438 .shift = 0, 438 .offset = HHI_MPEG_CLK_CNTL,
439 .width = 7, 439 .shift = 0,
440 .lock = &meson_clk_lock, 440 .width = 7,
441 },
441 .hw.init = &(struct clk_init_data){ 442 .hw.init = &(struct clk_init_data){
442 .name = "mpeg_clk_div", 443 .name = "mpeg_clk_div",
443 .ops = &clk_divider_ops, 444 .ops = &clk_regmap_divider_ops,
444 .parent_names = (const char *[]){ "mpeg_clk_sel" }, 445 .parent_names = (const char *[]){ "mpeg_clk_sel" },
445 .num_parents = 1, 446 .num_parents = 1,
446 .flags = CLK_SET_RATE_PARENT, 447 .flags = CLK_SET_RATE_PARENT,
@@ -487,15 +488,16 @@ static struct clk_mux axg_sd_emmc_b_clk0_sel = {
487 }, 488 },
488}; 489};
489 490
490static struct clk_divider axg_sd_emmc_b_clk0_div = { 491static struct clk_regmap axg_sd_emmc_b_clk0_div = {
491 .reg = (void *)HHI_SD_EMMC_CLK_CNTL, 492 .data = &(struct clk_regmap_div_data){
492 .shift = 16, 493 .offset = HHI_SD_EMMC_CLK_CNTL,
493 .width = 7, 494 .shift = 16,
494 .lock = &meson_clk_lock, 495 .width = 7,
495 .flags = CLK_DIVIDER_ROUND_CLOSEST, 496 .flags = CLK_DIVIDER_ROUND_CLOSEST,
497 },
496 .hw.init = &(struct clk_init_data) { 498 .hw.init = &(struct clk_init_data) {
497 .name = "sd_emmc_b_clk0_div", 499 .name = "sd_emmc_b_clk0_div",
498 .ops = &clk_divider_ops, 500 .ops = &clk_regmap_divider_ops,
499 .parent_names = (const char *[]){ "sd_emmc_b_clk0_sel" }, 501 .parent_names = (const char *[]){ "sd_emmc_b_clk0_sel" },
500 .num_parents = 1, 502 .num_parents = 1,
501 .flags = CLK_SET_RATE_PARENT, 503 .flags = CLK_SET_RATE_PARENT,
@@ -531,15 +533,16 @@ static struct clk_mux axg_sd_emmc_c_clk0_sel = {
531 }, 533 },
532}; 534};
533 535
534static struct clk_divider axg_sd_emmc_c_clk0_div = { 536static struct clk_regmap axg_sd_emmc_c_clk0_div = {
535 .reg = (void *)HHI_NAND_CLK_CNTL, 537 .data = &(struct clk_regmap_div_data){
536 .shift = 0, 538 .offset = HHI_NAND_CLK_CNTL,
537 .width = 7, 539 .shift = 0,
538 .lock = &meson_clk_lock, 540 .width = 7,
539 .flags = CLK_DIVIDER_ROUND_CLOSEST, 541 .flags = CLK_DIVIDER_ROUND_CLOSEST,
542 },
540 .hw.init = &(struct clk_init_data) { 543 .hw.init = &(struct clk_init_data) {
541 .name = "sd_emmc_c_clk0_div", 544 .name = "sd_emmc_c_clk0_div",
542 .ops = &clk_divider_ops, 545 .ops = &clk_regmap_divider_ops,
543 .parent_names = (const char *[]){ "sd_emmc_c_clk0_sel" }, 546 .parent_names = (const char *[]){ "sd_emmc_c_clk0_sel" },
544 .num_parents = 1, 547 .num_parents = 1,
545 .flags = CLK_SET_RATE_PARENT, 548 .flags = CLK_SET_RATE_PARENT,
@@ -706,12 +709,6 @@ static struct clk_mux *const axg_clk_muxes[] = {
706 &axg_sd_emmc_c_clk0_sel, 709 &axg_sd_emmc_c_clk0_sel,
707}; 710};
708 711
709static struct clk_divider *const axg_clk_dividers[] = {
710 &axg_mpeg_clk_div,
711 &axg_sd_emmc_b_clk0_div,
712 &axg_sd_emmc_c_clk0_div,
713};
714
715static struct clk_regmap *const axg_clk_regmaps[] = { 712static struct clk_regmap *const axg_clk_regmaps[] = {
716 &axg_clk81, 713 &axg_clk81,
717 &axg_ddr, 714 &axg_ddr,
@@ -760,6 +757,9 @@ static struct clk_regmap *const axg_clk_regmaps[] = {
760 &axg_ao_i2c, 757 &axg_ao_i2c,
761 &axg_sd_emmc_b_clk0, 758 &axg_sd_emmc_b_clk0,
762 &axg_sd_emmc_c_clk0, 759 &axg_sd_emmc_c_clk0,
760 &axg_mpeg_clk_div,
761 &axg_sd_emmc_b_clk0_div,
762 &axg_sd_emmc_c_clk0_div,
763}; 763};
764 764
765struct clkc_data { 765struct clkc_data {
@@ -769,8 +769,6 @@ struct clkc_data {
769 unsigned int clk_plls_count; 769 unsigned int clk_plls_count;
770 struct clk_mux *const *clk_muxes; 770 struct clk_mux *const *clk_muxes;
771 unsigned int clk_muxes_count; 771 unsigned int clk_muxes_count;
772 struct clk_divider *const *clk_dividers;
773 unsigned int clk_dividers_count;
774 struct clk_hw_onecell_data *hw_onecell_data; 772 struct clk_hw_onecell_data *hw_onecell_data;
775}; 773};
776 774
@@ -781,8 +779,6 @@ static const struct clkc_data axg_clkc_data = {
781 .clk_plls_count = ARRAY_SIZE(axg_clk_plls), 779 .clk_plls_count = ARRAY_SIZE(axg_clk_plls),
782 .clk_muxes = axg_clk_muxes, 780 .clk_muxes = axg_clk_muxes,
783 .clk_muxes_count = ARRAY_SIZE(axg_clk_muxes), 781 .clk_muxes_count = ARRAY_SIZE(axg_clk_muxes),
784 .clk_dividers = axg_clk_dividers,
785 .clk_dividers_count = ARRAY_SIZE(axg_clk_dividers),
786 .hw_onecell_data = &axg_hw_onecell_data, 782 .hw_onecell_data = &axg_hw_onecell_data,
787}; 783};
788 784
@@ -838,11 +834,6 @@ static int axg_clkc_probe(struct platform_device *pdev)
838 clkc_data->clk_muxes[i]->reg = clk_base + 834 clkc_data->clk_muxes[i]->reg = clk_base +
839 (u64)clkc_data->clk_muxes[i]->reg; 835 (u64)clkc_data->clk_muxes[i]->reg;
840 836
841 /* Populate base address for dividers */
842 for (i = 0; i < clkc_data->clk_dividers_count; i++)
843 clkc_data->clk_dividers[i]->reg = clk_base +
844 (u64)clkc_data->clk_dividers[i]->reg;
845
846 /* Populate regmap for the regmap backed clocks */ 837 /* Populate regmap for the regmap backed clocks */
847 for (i = 0; i < ARRAY_SIZE(axg_clk_regmaps); i++) 838 for (i = 0; i < ARRAY_SIZE(axg_clk_regmaps); i++)
848 axg_clk_regmaps[i]->map = map; 839 axg_clk_regmaps[i]->map = map;
diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c
index ccbbebb6a69b..ec515dc71476 100644
--- a/drivers/clk/meson/gxbb.c
+++ b/drivers/clk/meson/gxbb.c
@@ -604,14 +604,15 @@ static struct clk_mux gxbb_mpeg_clk_sel = {
604 }, 604 },
605}; 605};
606 606
607static struct clk_divider gxbb_mpeg_clk_div = { 607static struct clk_regmap gxbb_mpeg_clk_div = {
608 .reg = (void *)HHI_MPEG_CLK_CNTL, 608 .data = &(struct clk_regmap_div_data){
609 .shift = 0, 609 .offset = HHI_MPEG_CLK_CNTL,
610 .width = 7, 610 .shift = 0,
611 .lock = &meson_clk_lock, 611 .width = 7,
612 },
612 .hw.init = &(struct clk_init_data){ 613 .hw.init = &(struct clk_init_data){
613 .name = "mpeg_clk_div", 614 .name = "mpeg_clk_div",
614 .ops = &clk_divider_ops, 615 .ops = &clk_regmap_divider_ops,
615 .parent_names = (const char *[]){ "mpeg_clk_sel" }, 616 .parent_names = (const char *[]){ "mpeg_clk_sel" },
616 .num_parents = 1, 617 .num_parents = 1,
617 .flags = (CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED), 618 .flags = (CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED),
@@ -647,14 +648,15 @@ static struct clk_mux gxbb_sar_adc_clk_sel = {
647 }, 648 },
648}; 649};
649 650
650static struct clk_divider gxbb_sar_adc_clk_div = { 651static struct clk_regmap gxbb_sar_adc_clk_div = {
651 .reg = (void *)HHI_SAR_CLK_CNTL, 652 .data = &(struct clk_regmap_div_data){
652 .shift = 0, 653 .offset = HHI_SAR_CLK_CNTL,
653 .width = 8, 654 .shift = 0,
654 .lock = &meson_clk_lock, 655 .width = 8,
656 },
655 .hw.init = &(struct clk_init_data){ 657 .hw.init = &(struct clk_init_data){
656 .name = "sar_adc_clk_div", 658 .name = "sar_adc_clk_div",
657 .ops = &clk_divider_ops, 659 .ops = &clk_regmap_divider_ops,
658 .parent_names = (const char *[]){ "sar_adc_clk_sel" }, 660 .parent_names = (const char *[]){ "sar_adc_clk_sel" },
659 .num_parents = 1, 661 .num_parents = 1,
660 }, 662 },
@@ -705,14 +707,15 @@ static struct clk_mux gxbb_mali_0_sel = {
705 }, 707 },
706}; 708};
707 709
708static struct clk_divider gxbb_mali_0_div = { 710static struct clk_regmap gxbb_mali_0_div = {
709 .reg = (void *)HHI_MALI_CLK_CNTL, 711 .data = &(struct clk_regmap_div_data){
710 .shift = 0, 712 .offset = HHI_MALI_CLK_CNTL,
711 .width = 7, 713 .shift = 0,
712 .lock = &meson_clk_lock, 714 .width = 7,
715 },
713 .hw.init = &(struct clk_init_data){ 716 .hw.init = &(struct clk_init_data){
714 .name = "mali_0_div", 717 .name = "mali_0_div",
715 .ops = &clk_divider_ops, 718 .ops = &clk_regmap_divider_ops,
716 .parent_names = (const char *[]){ "mali_0_sel" }, 719 .parent_names = (const char *[]){ "mali_0_sel" },
717 .num_parents = 1, 720 .num_parents = 1,
718 .flags = CLK_SET_RATE_NO_REPARENT, 721 .flags = CLK_SET_RATE_NO_REPARENT,
@@ -753,14 +756,15 @@ static struct clk_mux gxbb_mali_1_sel = {
753 }, 756 },
754}; 757};
755 758
756static struct clk_divider gxbb_mali_1_div = { 759static struct clk_regmap gxbb_mali_1_div = {
757 .reg = (void *)HHI_MALI_CLK_CNTL, 760 .data = &(struct clk_regmap_div_data){
758 .shift = 16, 761 .offset = HHI_MALI_CLK_CNTL,
759 .width = 7, 762 .shift = 16,
760 .lock = &meson_clk_lock, 763 .width = 7,
764 },
761 .hw.init = &(struct clk_init_data){ 765 .hw.init = &(struct clk_init_data){
762 .name = "mali_1_div", 766 .name = "mali_1_div",
763 .ops = &clk_divider_ops, 767 .ops = &clk_regmap_divider_ops,
764 .parent_names = (const char *[]){ "mali_1_sel" }, 768 .parent_names = (const char *[]){ "mali_1_sel" },
765 .num_parents = 1, 769 .num_parents = 1,
766 .flags = CLK_SET_RATE_NO_REPARENT, 770 .flags = CLK_SET_RATE_NO_REPARENT,
@@ -864,15 +868,16 @@ static struct clk_mux gxbb_cts_mclk_i958_sel = {
864 }, 868 },
865}; 869};
866 870
867static struct clk_divider gxbb_cts_mclk_i958_div = { 871static struct clk_regmap gxbb_cts_mclk_i958_div = {
868 .reg = (void *)HHI_AUD_CLK_CNTL2, 872 .data = &(struct clk_regmap_div_data){
869 .shift = 16, 873 .offset = HHI_AUD_CLK_CNTL2,
870 .width = 8, 874 .shift = 16,
871 .lock = &meson_clk_lock, 875 .width = 8,
872 .flags = CLK_DIVIDER_ROUND_CLOSEST, 876 .flags = CLK_DIVIDER_ROUND_CLOSEST,
877 },
873 .hw.init = &(struct clk_init_data) { 878 .hw.init = &(struct clk_init_data) {
874 .name = "cts_mclk_i958_div", 879 .name = "cts_mclk_i958_div",
875 .ops = &clk_divider_ops, 880 .ops = &clk_regmap_divider_ops,
876 .parent_names = (const char *[]){ "cts_mclk_i958_sel" }, 881 .parent_names = (const char *[]){ "cts_mclk_i958_sel" },
877 .num_parents = 1, 882 .num_parents = 1,
878 .flags = CLK_SET_RATE_PARENT, 883 .flags = CLK_SET_RATE_PARENT,
@@ -911,14 +916,15 @@ static struct clk_mux gxbb_cts_i958 = {
911 }, 916 },
912}; 917};
913 918
914static struct clk_divider gxbb_32k_clk_div = { 919static struct clk_regmap gxbb_32k_clk_div = {
915 .reg = (void *)HHI_32K_CLK_CNTL, 920 .data = &(struct clk_regmap_div_data){
916 .shift = 0, 921 .offset = HHI_32K_CLK_CNTL,
917 .width = 14, 922 .shift = 0,
918 .lock = &meson_clk_lock, 923 .width = 14,
924 },
919 .hw.init = &(struct clk_init_data){ 925 .hw.init = &(struct clk_init_data){
920 .name = "32k_clk_div", 926 .name = "32k_clk_div",
921 .ops = &clk_divider_ops, 927 .ops = &clk_regmap_divider_ops,
922 .parent_names = (const char *[]){ "32k_clk_sel" }, 928 .parent_names = (const char *[]){ "32k_clk_sel" },
923 .num_parents = 1, 929 .num_parents = 1,
924 .flags = CLK_SET_RATE_PARENT | CLK_DIVIDER_ROUND_CLOSEST, 930 .flags = CLK_SET_RATE_PARENT | CLK_DIVIDER_ROUND_CLOSEST,
@@ -983,15 +989,16 @@ static struct clk_mux gxbb_sd_emmc_a_clk0_sel = {
983 }, 989 },
984}; 990};
985 991
986static struct clk_divider gxbb_sd_emmc_a_clk0_div = { 992static struct clk_regmap gxbb_sd_emmc_a_clk0_div = {
987 .reg = (void *)HHI_SD_EMMC_CLK_CNTL, 993 .data = &(struct clk_regmap_div_data){
988 .shift = 0, 994 .offset = HHI_SD_EMMC_CLK_CNTL,
989 .width = 7, 995 .shift = 0,
990 .lock = &meson_clk_lock, 996 .width = 7,
991 .flags = CLK_DIVIDER_ROUND_CLOSEST, 997 .flags = CLK_DIVIDER_ROUND_CLOSEST,
998 },
992 .hw.init = &(struct clk_init_data) { 999 .hw.init = &(struct clk_init_data) {
993 .name = "sd_emmc_a_clk0_div", 1000 .name = "sd_emmc_a_clk0_div",
994 .ops = &clk_divider_ops, 1001 .ops = &clk_regmap_divider_ops,
995 .parent_names = (const char *[]){ "sd_emmc_a_clk0_sel" }, 1002 .parent_names = (const char *[]){ "sd_emmc_a_clk0_sel" },
996 .num_parents = 1, 1003 .num_parents = 1,
997 .flags = CLK_SET_RATE_PARENT, 1004 .flags = CLK_SET_RATE_PARENT,
@@ -1027,15 +1034,16 @@ static struct clk_mux gxbb_sd_emmc_b_clk0_sel = {
1027 }, 1034 },
1028}; 1035};
1029 1036
1030static struct clk_divider gxbb_sd_emmc_b_clk0_div = { 1037static struct clk_regmap gxbb_sd_emmc_b_clk0_div = {
1031 .reg = (void *)HHI_SD_EMMC_CLK_CNTL, 1038 .data = &(struct clk_regmap_div_data){
1032 .shift = 16, 1039 .offset = HHI_SD_EMMC_CLK_CNTL,
1033 .width = 7, 1040 .shift = 16,
1034 .lock = &meson_clk_lock, 1041 .width = 7,
1035 .flags = CLK_DIVIDER_ROUND_CLOSEST, 1042 .flags = CLK_DIVIDER_ROUND_CLOSEST,
1043 },
1036 .hw.init = &(struct clk_init_data) { 1044 .hw.init = &(struct clk_init_data) {
1037 .name = "sd_emmc_b_clk0_div", 1045 .name = "sd_emmc_b_clk0_div",
1038 .ops = &clk_divider_ops, 1046 .ops = &clk_regmap_divider_ops,
1039 .parent_names = (const char *[]){ "sd_emmc_b_clk0_sel" }, 1047 .parent_names = (const char *[]){ "sd_emmc_b_clk0_sel" },
1040 .num_parents = 1, 1048 .num_parents = 1,
1041 .flags = CLK_SET_RATE_PARENT, 1049 .flags = CLK_SET_RATE_PARENT,
@@ -1071,15 +1079,16 @@ static struct clk_mux gxbb_sd_emmc_c_clk0_sel = {
1071 }, 1079 },
1072}; 1080};
1073 1081
1074static struct clk_divider gxbb_sd_emmc_c_clk0_div = { 1082static struct clk_regmap gxbb_sd_emmc_c_clk0_div = {
1075 .reg = (void *)HHI_NAND_CLK_CNTL, 1083 .data = &(struct clk_regmap_div_data){
1076 .shift = 0, 1084 .offset = HHI_NAND_CLK_CNTL,
1077 .width = 7, 1085 .shift = 0,
1078 .lock = &meson_clk_lock, 1086 .width = 7,
1079 .flags = CLK_DIVIDER_ROUND_CLOSEST, 1087 .flags = CLK_DIVIDER_ROUND_CLOSEST,
1088 },
1080 .hw.init = &(struct clk_init_data) { 1089 .hw.init = &(struct clk_init_data) {
1081 .name = "sd_emmc_c_clk0_div", 1090 .name = "sd_emmc_c_clk0_div",
1082 .ops = &clk_divider_ops, 1091 .ops = &clk_regmap_divider_ops,
1083 .parent_names = (const char *[]){ "sd_emmc_c_clk0_sel" }, 1092 .parent_names = (const char *[]){ "sd_emmc_c_clk0_sel" },
1084 .num_parents = 1, 1093 .num_parents = 1,
1085 .flags = CLK_SET_RATE_PARENT, 1094 .flags = CLK_SET_RATE_PARENT,
@@ -1126,14 +1135,15 @@ static struct clk_mux gxbb_vpu_0_sel = {
1126 }, 1135 },
1127}; 1136};
1128 1137
1129static struct clk_divider gxbb_vpu_0_div = { 1138static struct clk_regmap gxbb_vpu_0_div = {
1130 .reg = (void *)HHI_VPU_CLK_CNTL, 1139 .data = &(struct clk_regmap_div_data){
1131 .shift = 0, 1140 .offset = HHI_VPU_CLK_CNTL,
1132 .width = 7, 1141 .shift = 0,
1133 .lock = &meson_clk_lock, 1142 .width = 7,
1143 },
1134 .hw.init = &(struct clk_init_data){ 1144 .hw.init = &(struct clk_init_data){
1135 .name = "vpu_0_div", 1145 .name = "vpu_0_div",
1136 .ops = &clk_divider_ops, 1146 .ops = &clk_regmap_divider_ops,
1137 .parent_names = (const char *[]){ "vpu_0_sel" }, 1147 .parent_names = (const char *[]){ "vpu_0_sel" },
1138 .num_parents = 1, 1148 .num_parents = 1,
1139 .flags = CLK_SET_RATE_PARENT, 1149 .flags = CLK_SET_RATE_PARENT,
@@ -1173,14 +1183,15 @@ static struct clk_mux gxbb_vpu_1_sel = {
1173 }, 1183 },
1174}; 1184};
1175 1185
1176static struct clk_divider gxbb_vpu_1_div = { 1186static struct clk_regmap gxbb_vpu_1_div = {
1177 .reg = (void *)HHI_VPU_CLK_CNTL, 1187 .data = &(struct clk_regmap_div_data){
1178 .shift = 16, 1188 .offset = HHI_VPU_CLK_CNTL,
1179 .width = 7, 1189 .shift = 16,
1180 .lock = &meson_clk_lock, 1190 .width = 7,
1191 },
1181 .hw.init = &(struct clk_init_data){ 1192 .hw.init = &(struct clk_init_data){
1182 .name = "vpu_1_div", 1193 .name = "vpu_1_div",
1183 .ops = &clk_divider_ops, 1194 .ops = &clk_regmap_divider_ops,
1184 .parent_names = (const char *[]){ "vpu_1_sel" }, 1195 .parent_names = (const char *[]){ "vpu_1_sel" },
1185 .num_parents = 1, 1196 .num_parents = 1,
1186 .flags = CLK_SET_RATE_PARENT, 1197 .flags = CLK_SET_RATE_PARENT,
@@ -1245,14 +1256,15 @@ static struct clk_mux gxbb_vapb_0_sel = {
1245 }, 1256 },
1246}; 1257};
1247 1258
1248static struct clk_divider gxbb_vapb_0_div = { 1259static struct clk_regmap gxbb_vapb_0_div = {
1249 .reg = (void *)HHI_VAPBCLK_CNTL, 1260 .data = &(struct clk_regmap_div_data){
1250 .shift = 0, 1261 .offset = HHI_VAPBCLK_CNTL,
1251 .width = 7, 1262 .shift = 0,
1252 .lock = &meson_clk_lock, 1263 .width = 7,
1264 },
1253 .hw.init = &(struct clk_init_data){ 1265 .hw.init = &(struct clk_init_data){
1254 .name = "vapb_0_div", 1266 .name = "vapb_0_div",
1255 .ops = &clk_divider_ops, 1267 .ops = &clk_regmap_divider_ops,
1256 .parent_names = (const char *[]){ "vapb_0_sel" }, 1268 .parent_names = (const char *[]){ "vapb_0_sel" },
1257 .num_parents = 1, 1269 .num_parents = 1,
1258 .flags = CLK_SET_RATE_PARENT, 1270 .flags = CLK_SET_RATE_PARENT,
@@ -1292,14 +1304,15 @@ static struct clk_mux gxbb_vapb_1_sel = {
1292 }, 1304 },
1293}; 1305};
1294 1306
1295static struct clk_divider gxbb_vapb_1_div = { 1307static struct clk_regmap gxbb_vapb_1_div = {
1296 .reg = (void *)HHI_VAPBCLK_CNTL, 1308 .data = &(struct clk_regmap_div_data){
1297 .shift = 16, 1309 .offset = HHI_VAPBCLK_CNTL,
1298 .width = 7, 1310 .shift = 16,
1299 .lock = &meson_clk_lock, 1311 .width = 7,
1312 },
1300 .hw.init = &(struct clk_init_data){ 1313 .hw.init = &(struct clk_init_data){
1301 .name = "vapb_1_div", 1314 .name = "vapb_1_div",
1302 .ops = &clk_divider_ops, 1315 .ops = &clk_regmap_divider_ops,
1303 .parent_names = (const char *[]){ "vapb_1_sel" }, 1316 .parent_names = (const char *[]){ "vapb_1_sel" },
1304 .num_parents = 1, 1317 .num_parents = 1,
1305 .flags = CLK_SET_RATE_PARENT, 1318 .flags = CLK_SET_RATE_PARENT,
@@ -1781,22 +1794,6 @@ static struct clk_mux *const gxbb_clk_muxes[] = {
1781 &gxbb_vapb_sel, 1794 &gxbb_vapb_sel,
1782}; 1795};
1783 1796
1784static struct clk_divider *const gxbb_clk_dividers[] = {
1785 &gxbb_mpeg_clk_div,
1786 &gxbb_sar_adc_clk_div,
1787 &gxbb_mali_0_div,
1788 &gxbb_mali_1_div,
1789 &gxbb_cts_mclk_i958_div,
1790 &gxbb_32k_clk_div,
1791 &gxbb_sd_emmc_a_clk0_div,
1792 &gxbb_sd_emmc_b_clk0_div,
1793 &gxbb_sd_emmc_c_clk0_div,
1794 &gxbb_vpu_0_div,
1795 &gxbb_vpu_1_div,
1796 &gxbb_vapb_0_div,
1797 &gxbb_vapb_1_div,
1798};
1799
1800static struct meson_clk_audio_divider *const gxbb_audio_dividers[] = { 1797static struct meson_clk_audio_divider *const gxbb_audio_dividers[] = {
1801 &gxbb_cts_amclk_div, 1798 &gxbb_cts_amclk_div,
1802}; 1799};
@@ -1898,6 +1895,19 @@ static struct clk_regmap *const gx_clk_regmaps[] = {
1898 &gxbb_vapb_0, 1895 &gxbb_vapb_0,
1899 &gxbb_vapb_1, 1896 &gxbb_vapb_1,
1900 &gxbb_vapb, 1897 &gxbb_vapb,
1898 &gxbb_mpeg_clk_div,
1899 &gxbb_sar_adc_clk_div,
1900 &gxbb_mali_0_div,
1901 &gxbb_mali_1_div,
1902 &gxbb_cts_mclk_i958_div,
1903 &gxbb_32k_clk_div,
1904 &gxbb_sd_emmc_a_clk0_div,
1905 &gxbb_sd_emmc_b_clk0_div,
1906 &gxbb_sd_emmc_c_clk0_div,
1907 &gxbb_vpu_0_div,
1908 &gxbb_vpu_1_div,
1909 &gxbb_vapb_0_div,
1910 &gxbb_vapb_1_div,
1901}; 1911};
1902 1912
1903struct clkc_data { 1913struct clkc_data {
@@ -1907,8 +1917,6 @@ struct clkc_data {
1907 unsigned int clk_plls_count; 1917 unsigned int clk_plls_count;
1908 struct clk_mux *const *clk_muxes; 1918 struct clk_mux *const *clk_muxes;
1909 unsigned int clk_muxes_count; 1919 unsigned int clk_muxes_count;
1910 struct clk_divider *const *clk_dividers;
1911 unsigned int clk_dividers_count;
1912 struct meson_clk_audio_divider *const *clk_audio_dividers; 1920 struct meson_clk_audio_divider *const *clk_audio_dividers;
1913 unsigned int clk_audio_dividers_count; 1921 unsigned int clk_audio_dividers_count;
1914 struct clk_hw_onecell_data *hw_onecell_data; 1922 struct clk_hw_onecell_data *hw_onecell_data;
@@ -1921,8 +1929,6 @@ static const struct clkc_data gxbb_clkc_data = {
1921 .clk_plls_count = ARRAY_SIZE(gxbb_clk_plls), 1929 .clk_plls_count = ARRAY_SIZE(gxbb_clk_plls),
1922 .clk_muxes = gxbb_clk_muxes, 1930 .clk_muxes = gxbb_clk_muxes,
1923 .clk_muxes_count = ARRAY_SIZE(gxbb_clk_muxes), 1931 .clk_muxes_count = ARRAY_SIZE(gxbb_clk_muxes),
1924 .clk_dividers = gxbb_clk_dividers,
1925 .clk_dividers_count = ARRAY_SIZE(gxbb_clk_dividers),
1926 .clk_audio_dividers = gxbb_audio_dividers, 1932 .clk_audio_dividers = gxbb_audio_dividers,
1927 .clk_audio_dividers_count = ARRAY_SIZE(gxbb_audio_dividers), 1933 .clk_audio_dividers_count = ARRAY_SIZE(gxbb_audio_dividers),
1928 .hw_onecell_data = &gxbb_hw_onecell_data, 1934 .hw_onecell_data = &gxbb_hw_onecell_data,
@@ -1935,8 +1941,6 @@ static const struct clkc_data gxl_clkc_data = {
1935 .clk_plls_count = ARRAY_SIZE(gxl_clk_plls), 1941 .clk_plls_count = ARRAY_SIZE(gxl_clk_plls),
1936 .clk_muxes = gxbb_clk_muxes, 1942 .clk_muxes = gxbb_clk_muxes,
1937 .clk_muxes_count = ARRAY_SIZE(gxbb_clk_muxes), 1943 .clk_muxes_count = ARRAY_SIZE(gxbb_clk_muxes),
1938 .clk_dividers = gxbb_clk_dividers,
1939 .clk_dividers_count = ARRAY_SIZE(gxbb_clk_dividers),
1940 .clk_audio_dividers = gxbb_audio_dividers, 1944 .clk_audio_dividers = gxbb_audio_dividers,
1941 .clk_audio_dividers_count = ARRAY_SIZE(gxbb_audio_dividers), 1945 .clk_audio_dividers_count = ARRAY_SIZE(gxbb_audio_dividers),
1942 .hw_onecell_data = &gxl_hw_onecell_data, 1946 .hw_onecell_data = &gxl_hw_onecell_data,
@@ -1994,11 +1998,6 @@ static int gxbb_clkc_probe(struct platform_device *pdev)
1994 clkc_data->clk_muxes[i]->reg = clk_base + 1998 clkc_data->clk_muxes[i]->reg = clk_base +
1995 (u64)clkc_data->clk_muxes[i]->reg; 1999 (u64)clkc_data->clk_muxes[i]->reg;
1996 2000
1997 /* Populate base address for dividers */
1998 for (i = 0; i < clkc_data->clk_dividers_count; i++)
1999 clkc_data->clk_dividers[i]->reg = clk_base +
2000 (u64)clkc_data->clk_dividers[i]->reg;
2001
2002 /* Populate base address for the audio dividers */ 2001 /* Populate base address for the audio dividers */
2003 for (i = 0; i < clkc_data->clk_audio_dividers_count; i++) 2002 for (i = 0; i < clkc_data->clk_audio_dividers_count; i++)
2004 clkc_data->clk_audio_dividers[i]->base = clk_base; 2003 clkc_data->clk_audio_dividers[i]->base = clk_base;
diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c
index 835dbb1d2c9d..e9c5278072cd 100644
--- a/drivers/clk/meson/meson8b.c
+++ b/drivers/clk/meson/meson8b.c
@@ -393,14 +393,15 @@ struct clk_mux meson8b_mpeg_clk_sel = {
393 }, 393 },
394}; 394};
395 395
396struct clk_divider meson8b_mpeg_clk_div = { 396struct clk_regmap meson8b_mpeg_clk_div = {
397 .reg = (void *)HHI_MPEG_CLK_CNTL, 397 .data = &(struct clk_regmap_div_data){
398 .shift = 0, 398 .offset = HHI_MPEG_CLK_CNTL,
399 .width = 7, 399 .shift = 0,
400 .lock = &meson_clk_lock, 400 .width = 7,
401 },
401 .hw.init = &(struct clk_init_data){ 402 .hw.init = &(struct clk_init_data){
402 .name = "mpeg_clk_div", 403 .name = "mpeg_clk_div",
403 .ops = &clk_divider_ops, 404 .ops = &clk_regmap_divider_ops,
404 .parent_names = (const char *[]){ "mpeg_clk_sel" }, 405 .parent_names = (const char *[]){ "mpeg_clk_sel" },
405 .num_parents = 1, 406 .num_parents = 1,
406 .flags = (CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED), 407 .flags = (CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED),
@@ -623,10 +624,6 @@ static struct clk_mux *const meson8b_clk_muxes[] = {
623 &meson8b_mpeg_clk_sel, 624 &meson8b_mpeg_clk_sel,
624}; 625};
625 626
626static struct clk_divider *const meson8b_clk_dividers[] = {
627 &meson8b_mpeg_clk_div,
628};
629
630static struct clk_regmap *const meson8b_clk_regmaps[] = { 627static struct clk_regmap *const meson8b_clk_regmaps[] = {
631 &meson8b_clk81, 628 &meson8b_clk81,
632 &meson8b_ddr, 629 &meson8b_ddr,
@@ -706,6 +703,7 @@ static struct clk_regmap *const meson8b_clk_regmaps[] = {
706 &meson8b_ao_ahb_sram, 703 &meson8b_ao_ahb_sram,
707 &meson8b_ao_ahb_bus, 704 &meson8b_ao_ahb_bus,
708 &meson8b_ao_iface, 705 &meson8b_ao_iface,
706 &meson8b_mpeg_clk_div,
709}; 707};
710 708
711static const struct meson8b_clk_reset_line { 709static const struct meson8b_clk_reset_line {
@@ -844,11 +842,6 @@ static int meson8b_clkc_probe(struct platform_device *pdev)
844 meson8b_clk_muxes[i]->reg = clk_base + 842 meson8b_clk_muxes[i]->reg = clk_base +
845 (u32)meson8b_clk_muxes[i]->reg; 843 (u32)meson8b_clk_muxes[i]->reg;
846 844
847 /* Populate base address for dividers */
848 for (i = 0; i < ARRAY_SIZE(meson8b_clk_dividers); i++)
849 meson8b_clk_dividers[i]->reg = clk_base +
850 (u32)meson8b_clk_dividers[i]->reg;
851
852 /* Populate regmap for the regmap backed clocks */ 845 /* Populate regmap for the regmap backed clocks */
853 for (i = 0; i < ARRAY_SIZE(meson8b_clk_regmaps); i++) 846 for (i = 0; i < ARRAY_SIZE(meson8b_clk_regmaps); i++)
854 meson8b_clk_regmaps[i]->map = map; 847 meson8b_clk_regmaps[i]->map = map;