0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #include <linux/clk-provider.h>
0013 #include <linux/init.h>
0014 #include <linux/of_device.h>
0015 #include <linux/platform_device.h>
0016 #include <linux/module.h>
0017
0018 #include "clk-regmap.h"
0019 #include "clk-pll.h"
0020 #include "clk-mpll.h"
0021 #include "axg.h"
0022 #include "meson-eeclk.h"
0023
0024 static DEFINE_SPINLOCK(meson_clk_lock);
0025
0026 static struct clk_regmap axg_fixed_pll_dco = {
0027 .data = &(struct meson_clk_pll_data){
0028 .en = {
0029 .reg_off = HHI_MPLL_CNTL,
0030 .shift = 30,
0031 .width = 1,
0032 },
0033 .m = {
0034 .reg_off = HHI_MPLL_CNTL,
0035 .shift = 0,
0036 .width = 9,
0037 },
0038 .n = {
0039 .reg_off = HHI_MPLL_CNTL,
0040 .shift = 9,
0041 .width = 5,
0042 },
0043 .frac = {
0044 .reg_off = HHI_MPLL_CNTL2,
0045 .shift = 0,
0046 .width = 12,
0047 },
0048 .l = {
0049 .reg_off = HHI_MPLL_CNTL,
0050 .shift = 31,
0051 .width = 1,
0052 },
0053 .rst = {
0054 .reg_off = HHI_MPLL_CNTL,
0055 .shift = 29,
0056 .width = 1,
0057 },
0058 },
0059 .hw.init = &(struct clk_init_data){
0060 .name = "fixed_pll_dco",
0061 .ops = &meson_clk_pll_ro_ops,
0062 .parent_data = &(const struct clk_parent_data) {
0063 .fw_name = "xtal",
0064 },
0065 .num_parents = 1,
0066 },
0067 };
0068
0069 static struct clk_regmap axg_fixed_pll = {
0070 .data = &(struct clk_regmap_div_data){
0071 .offset = HHI_MPLL_CNTL,
0072 .shift = 16,
0073 .width = 2,
0074 .flags = CLK_DIVIDER_POWER_OF_TWO,
0075 },
0076 .hw.init = &(struct clk_init_data){
0077 .name = "fixed_pll",
0078 .ops = &clk_regmap_divider_ro_ops,
0079 .parent_hws = (const struct clk_hw *[]) {
0080 &axg_fixed_pll_dco.hw
0081 },
0082 .num_parents = 1,
0083
0084
0085
0086
0087 },
0088 };
0089
0090 static struct clk_regmap axg_sys_pll_dco = {
0091 .data = &(struct meson_clk_pll_data){
0092 .en = {
0093 .reg_off = HHI_SYS_PLL_CNTL,
0094 .shift = 30,
0095 .width = 1,
0096 },
0097 .m = {
0098 .reg_off = HHI_SYS_PLL_CNTL,
0099 .shift = 0,
0100 .width = 9,
0101 },
0102 .n = {
0103 .reg_off = HHI_SYS_PLL_CNTL,
0104 .shift = 9,
0105 .width = 5,
0106 },
0107 .l = {
0108 .reg_off = HHI_SYS_PLL_CNTL,
0109 .shift = 31,
0110 .width = 1,
0111 },
0112 .rst = {
0113 .reg_off = HHI_SYS_PLL_CNTL,
0114 .shift = 29,
0115 .width = 1,
0116 },
0117 },
0118 .hw.init = &(struct clk_init_data){
0119 .name = "sys_pll_dco",
0120 .ops = &meson_clk_pll_ro_ops,
0121 .parent_data = &(const struct clk_parent_data) {
0122 .fw_name = "xtal",
0123 },
0124 .num_parents = 1,
0125 },
0126 };
0127
0128 static struct clk_regmap axg_sys_pll = {
0129 .data = &(struct clk_regmap_div_data){
0130 .offset = HHI_SYS_PLL_CNTL,
0131 .shift = 16,
0132 .width = 2,
0133 .flags = CLK_DIVIDER_POWER_OF_TWO,
0134 },
0135 .hw.init = &(struct clk_init_data){
0136 .name = "sys_pll",
0137 .ops = &clk_regmap_divider_ro_ops,
0138 .parent_hws = (const struct clk_hw *[]) {
0139 &axg_sys_pll_dco.hw
0140 },
0141 .num_parents = 1,
0142 .flags = CLK_SET_RATE_PARENT,
0143 },
0144 };
0145
0146 static const struct pll_params_table axg_gp0_pll_params_table[] = {
0147 PLL_PARAMS(40, 1),
0148 PLL_PARAMS(41, 1),
0149 PLL_PARAMS(42, 1),
0150 PLL_PARAMS(43, 1),
0151 PLL_PARAMS(44, 1),
0152 PLL_PARAMS(45, 1),
0153 PLL_PARAMS(46, 1),
0154 PLL_PARAMS(47, 1),
0155 PLL_PARAMS(48, 1),
0156 PLL_PARAMS(49, 1),
0157 PLL_PARAMS(50, 1),
0158 PLL_PARAMS(51, 1),
0159 PLL_PARAMS(52, 1),
0160 PLL_PARAMS(53, 1),
0161 PLL_PARAMS(54, 1),
0162 PLL_PARAMS(55, 1),
0163 PLL_PARAMS(56, 1),
0164 PLL_PARAMS(57, 1),
0165 PLL_PARAMS(58, 1),
0166 PLL_PARAMS(59, 1),
0167 PLL_PARAMS(60, 1),
0168 PLL_PARAMS(61, 1),
0169 PLL_PARAMS(62, 1),
0170 PLL_PARAMS(63, 1),
0171 PLL_PARAMS(64, 1),
0172 PLL_PARAMS(65, 1),
0173 PLL_PARAMS(66, 1),
0174 PLL_PARAMS(67, 1),
0175 PLL_PARAMS(68, 1),
0176 { },
0177 };
0178
0179 static const struct reg_sequence axg_gp0_init_regs[] = {
0180 { .reg = HHI_GP0_PLL_CNTL1, .def = 0xc084b000 },
0181 { .reg = HHI_GP0_PLL_CNTL2, .def = 0xb75020be },
0182 { .reg = HHI_GP0_PLL_CNTL3, .def = 0x0a59a288 },
0183 { .reg = HHI_GP0_PLL_CNTL4, .def = 0xc000004d },
0184 { .reg = HHI_GP0_PLL_CNTL5, .def = 0x00078000 },
0185 };
0186
0187 static struct clk_regmap axg_gp0_pll_dco = {
0188 .data = &(struct meson_clk_pll_data){
0189 .en = {
0190 .reg_off = HHI_GP0_PLL_CNTL,
0191 .shift = 30,
0192 .width = 1,
0193 },
0194 .m = {
0195 .reg_off = HHI_GP0_PLL_CNTL,
0196 .shift = 0,
0197 .width = 9,
0198 },
0199 .n = {
0200 .reg_off = HHI_GP0_PLL_CNTL,
0201 .shift = 9,
0202 .width = 5,
0203 },
0204 .frac = {
0205 .reg_off = HHI_GP0_PLL_CNTL1,
0206 .shift = 0,
0207 .width = 10,
0208 },
0209 .l = {
0210 .reg_off = HHI_GP0_PLL_CNTL,
0211 .shift = 31,
0212 .width = 1,
0213 },
0214 .rst = {
0215 .reg_off = HHI_GP0_PLL_CNTL,
0216 .shift = 29,
0217 .width = 1,
0218 },
0219 .table = axg_gp0_pll_params_table,
0220 .init_regs = axg_gp0_init_regs,
0221 .init_count = ARRAY_SIZE(axg_gp0_init_regs),
0222 },
0223 .hw.init = &(struct clk_init_data){
0224 .name = "gp0_pll_dco",
0225 .ops = &meson_clk_pll_ops,
0226 .parent_data = &(const struct clk_parent_data) {
0227 .fw_name = "xtal",
0228 },
0229 .num_parents = 1,
0230 },
0231 };
0232
0233 static struct clk_regmap axg_gp0_pll = {
0234 .data = &(struct clk_regmap_div_data){
0235 .offset = HHI_GP0_PLL_CNTL,
0236 .shift = 16,
0237 .width = 2,
0238 .flags = CLK_DIVIDER_POWER_OF_TWO,
0239 },
0240 .hw.init = &(struct clk_init_data){
0241 .name = "gp0_pll",
0242 .ops = &clk_regmap_divider_ops,
0243 .parent_hws = (const struct clk_hw *[]) {
0244 &axg_gp0_pll_dco.hw
0245 },
0246 .num_parents = 1,
0247 .flags = CLK_SET_RATE_PARENT,
0248 },
0249 };
0250
0251 static const struct reg_sequence axg_hifi_init_regs[] = {
0252 { .reg = HHI_HIFI_PLL_CNTL1, .def = 0xc084b000 },
0253 { .reg = HHI_HIFI_PLL_CNTL2, .def = 0xb75020be },
0254 { .reg = HHI_HIFI_PLL_CNTL3, .def = 0x0a6a3a88 },
0255 { .reg = HHI_HIFI_PLL_CNTL4, .def = 0xc000004d },
0256 { .reg = HHI_HIFI_PLL_CNTL5, .def = 0x00058000 },
0257 };
0258
0259 static struct clk_regmap axg_hifi_pll_dco = {
0260 .data = &(struct meson_clk_pll_data){
0261 .en = {
0262 .reg_off = HHI_HIFI_PLL_CNTL,
0263 .shift = 30,
0264 .width = 1,
0265 },
0266 .m = {
0267 .reg_off = HHI_HIFI_PLL_CNTL,
0268 .shift = 0,
0269 .width = 9,
0270 },
0271 .n = {
0272 .reg_off = HHI_HIFI_PLL_CNTL,
0273 .shift = 9,
0274 .width = 5,
0275 },
0276 .frac = {
0277 .reg_off = HHI_HIFI_PLL_CNTL5,
0278 .shift = 0,
0279 .width = 13,
0280 },
0281 .l = {
0282 .reg_off = HHI_HIFI_PLL_CNTL,
0283 .shift = 31,
0284 .width = 1,
0285 },
0286 .rst = {
0287 .reg_off = HHI_HIFI_PLL_CNTL,
0288 .shift = 29,
0289 .width = 1,
0290 },
0291 .table = axg_gp0_pll_params_table,
0292 .init_regs = axg_hifi_init_regs,
0293 .init_count = ARRAY_SIZE(axg_hifi_init_regs),
0294 .flags = CLK_MESON_PLL_ROUND_CLOSEST,
0295 },
0296 .hw.init = &(struct clk_init_data){
0297 .name = "hifi_pll_dco",
0298 .ops = &meson_clk_pll_ops,
0299 .parent_data = &(const struct clk_parent_data) {
0300 .fw_name = "xtal",
0301 },
0302 .num_parents = 1,
0303 },
0304 };
0305
0306 static struct clk_regmap axg_hifi_pll = {
0307 .data = &(struct clk_regmap_div_data){
0308 .offset = HHI_HIFI_PLL_CNTL,
0309 .shift = 16,
0310 .width = 2,
0311 .flags = CLK_DIVIDER_POWER_OF_TWO,
0312 },
0313 .hw.init = &(struct clk_init_data){
0314 .name = "hifi_pll",
0315 .ops = &clk_regmap_divider_ops,
0316 .parent_hws = (const struct clk_hw *[]) {
0317 &axg_hifi_pll_dco.hw
0318 },
0319 .num_parents = 1,
0320 .flags = CLK_SET_RATE_PARENT,
0321 },
0322 };
0323
0324 static struct clk_fixed_factor axg_fclk_div2_div = {
0325 .mult = 1,
0326 .div = 2,
0327 .hw.init = &(struct clk_init_data){
0328 .name = "fclk_div2_div",
0329 .ops = &clk_fixed_factor_ops,
0330 .parent_hws = (const struct clk_hw *[]) { &axg_fixed_pll.hw },
0331 .num_parents = 1,
0332 },
0333 };
0334
0335 static struct clk_regmap axg_fclk_div2 = {
0336 .data = &(struct clk_regmap_gate_data){
0337 .offset = HHI_MPLL_CNTL6,
0338 .bit_idx = 27,
0339 },
0340 .hw.init = &(struct clk_init_data){
0341 .name = "fclk_div2",
0342 .ops = &clk_regmap_gate_ops,
0343 .parent_hws = (const struct clk_hw *[]) {
0344 &axg_fclk_div2_div.hw
0345 },
0346 .num_parents = 1,
0347 .flags = CLK_IS_CRITICAL,
0348 },
0349 };
0350
0351 static struct clk_fixed_factor axg_fclk_div3_div = {
0352 .mult = 1,
0353 .div = 3,
0354 .hw.init = &(struct clk_init_data){
0355 .name = "fclk_div3_div",
0356 .ops = &clk_fixed_factor_ops,
0357 .parent_hws = (const struct clk_hw *[]) { &axg_fixed_pll.hw },
0358 .num_parents = 1,
0359 },
0360 };
0361
0362 static struct clk_regmap axg_fclk_div3 = {
0363 .data = &(struct clk_regmap_gate_data){
0364 .offset = HHI_MPLL_CNTL6,
0365 .bit_idx = 28,
0366 },
0367 .hw.init = &(struct clk_init_data){
0368 .name = "fclk_div3",
0369 .ops = &clk_regmap_gate_ops,
0370 .parent_hws = (const struct clk_hw *[]) {
0371 &axg_fclk_div3_div.hw
0372 },
0373 .num_parents = 1,
0374
0375
0376
0377
0378
0379
0380
0381
0382
0383
0384
0385 .flags = CLK_IS_CRITICAL,
0386 },
0387 };
0388
0389 static struct clk_fixed_factor axg_fclk_div4_div = {
0390 .mult = 1,
0391 .div = 4,
0392 .hw.init = &(struct clk_init_data){
0393 .name = "fclk_div4_div",
0394 .ops = &clk_fixed_factor_ops,
0395 .parent_hws = (const struct clk_hw *[]) { &axg_fixed_pll.hw },
0396 .num_parents = 1,
0397 },
0398 };
0399
0400 static struct clk_regmap axg_fclk_div4 = {
0401 .data = &(struct clk_regmap_gate_data){
0402 .offset = HHI_MPLL_CNTL6,
0403 .bit_idx = 29,
0404 },
0405 .hw.init = &(struct clk_init_data){
0406 .name = "fclk_div4",
0407 .ops = &clk_regmap_gate_ops,
0408 .parent_hws = (const struct clk_hw *[]) {
0409 &axg_fclk_div4_div.hw
0410 },
0411 .num_parents = 1,
0412 },
0413 };
0414
0415 static struct clk_fixed_factor axg_fclk_div5_div = {
0416 .mult = 1,
0417 .div = 5,
0418 .hw.init = &(struct clk_init_data){
0419 .name = "fclk_div5_div",
0420 .ops = &clk_fixed_factor_ops,
0421 .parent_hws = (const struct clk_hw *[]) { &axg_fixed_pll.hw },
0422 .num_parents = 1,
0423 },
0424 };
0425
0426 static struct clk_regmap axg_fclk_div5 = {
0427 .data = &(struct clk_regmap_gate_data){
0428 .offset = HHI_MPLL_CNTL6,
0429 .bit_idx = 30,
0430 },
0431 .hw.init = &(struct clk_init_data){
0432 .name = "fclk_div5",
0433 .ops = &clk_regmap_gate_ops,
0434 .parent_hws = (const struct clk_hw *[]) {
0435 &axg_fclk_div5_div.hw
0436 },
0437 .num_parents = 1,
0438 },
0439 };
0440
0441 static struct clk_fixed_factor axg_fclk_div7_div = {
0442 .mult = 1,
0443 .div = 7,
0444 .hw.init = &(struct clk_init_data){
0445 .name = "fclk_div7_div",
0446 .ops = &clk_fixed_factor_ops,
0447 .parent_hws = (const struct clk_hw *[]) {
0448 &axg_fixed_pll.hw
0449 },
0450 .num_parents = 1,
0451 },
0452 };
0453
0454 static struct clk_regmap axg_fclk_div7 = {
0455 .data = &(struct clk_regmap_gate_data){
0456 .offset = HHI_MPLL_CNTL6,
0457 .bit_idx = 31,
0458 },
0459 .hw.init = &(struct clk_init_data){
0460 .name = "fclk_div7",
0461 .ops = &clk_regmap_gate_ops,
0462 .parent_hws = (const struct clk_hw *[]) {
0463 &axg_fclk_div7_div.hw
0464 },
0465 .num_parents = 1,
0466 },
0467 };
0468
0469 static struct clk_regmap axg_mpll_prediv = {
0470 .data = &(struct clk_regmap_div_data){
0471 .offset = HHI_MPLL_CNTL5,
0472 .shift = 12,
0473 .width = 1,
0474 },
0475 .hw.init = &(struct clk_init_data){
0476 .name = "mpll_prediv",
0477 .ops = &clk_regmap_divider_ro_ops,
0478 .parent_hws = (const struct clk_hw *[]) {
0479 &axg_fixed_pll.hw
0480 },
0481 .num_parents = 1,
0482 },
0483 };
0484
0485 static struct clk_regmap axg_mpll0_div = {
0486 .data = &(struct meson_clk_mpll_data){
0487 .sdm = {
0488 .reg_off = HHI_MPLL_CNTL7,
0489 .shift = 0,
0490 .width = 14,
0491 },
0492 .sdm_en = {
0493 .reg_off = HHI_MPLL_CNTL7,
0494 .shift = 15,
0495 .width = 1,
0496 },
0497 .n2 = {
0498 .reg_off = HHI_MPLL_CNTL7,
0499 .shift = 16,
0500 .width = 9,
0501 },
0502 .misc = {
0503 .reg_off = HHI_PLL_TOP_MISC,
0504 .shift = 0,
0505 .width = 1,
0506 },
0507 .lock = &meson_clk_lock,
0508 .flags = CLK_MESON_MPLL_ROUND_CLOSEST,
0509 },
0510 .hw.init = &(struct clk_init_data){
0511 .name = "mpll0_div",
0512 .ops = &meson_clk_mpll_ops,
0513 .parent_hws = (const struct clk_hw *[]) {
0514 &axg_mpll_prediv.hw
0515 },
0516 .num_parents = 1,
0517 },
0518 };
0519
0520 static struct clk_regmap axg_mpll0 = {
0521 .data = &(struct clk_regmap_gate_data){
0522 .offset = HHI_MPLL_CNTL7,
0523 .bit_idx = 14,
0524 },
0525 .hw.init = &(struct clk_init_data){
0526 .name = "mpll0",
0527 .ops = &clk_regmap_gate_ops,
0528 .parent_hws = (const struct clk_hw *[]) {
0529 &axg_mpll0_div.hw
0530 },
0531 .num_parents = 1,
0532 .flags = CLK_SET_RATE_PARENT,
0533 },
0534 };
0535
0536 static struct clk_regmap axg_mpll1_div = {
0537 .data = &(struct meson_clk_mpll_data){
0538 .sdm = {
0539 .reg_off = HHI_MPLL_CNTL8,
0540 .shift = 0,
0541 .width = 14,
0542 },
0543 .sdm_en = {
0544 .reg_off = HHI_MPLL_CNTL8,
0545 .shift = 15,
0546 .width = 1,
0547 },
0548 .n2 = {
0549 .reg_off = HHI_MPLL_CNTL8,
0550 .shift = 16,
0551 .width = 9,
0552 },
0553 .misc = {
0554 .reg_off = HHI_PLL_TOP_MISC,
0555 .shift = 1,
0556 .width = 1,
0557 },
0558 .lock = &meson_clk_lock,
0559 .flags = CLK_MESON_MPLL_ROUND_CLOSEST,
0560 },
0561 .hw.init = &(struct clk_init_data){
0562 .name = "mpll1_div",
0563 .ops = &meson_clk_mpll_ops,
0564 .parent_hws = (const struct clk_hw *[]) {
0565 &axg_mpll_prediv.hw
0566 },
0567 .num_parents = 1,
0568 },
0569 };
0570
0571 static struct clk_regmap axg_mpll1 = {
0572 .data = &(struct clk_regmap_gate_data){
0573 .offset = HHI_MPLL_CNTL8,
0574 .bit_idx = 14,
0575 },
0576 .hw.init = &(struct clk_init_data){
0577 .name = "mpll1",
0578 .ops = &clk_regmap_gate_ops,
0579 .parent_hws = (const struct clk_hw *[]) {
0580 &axg_mpll1_div.hw
0581 },
0582 .num_parents = 1,
0583 .flags = CLK_SET_RATE_PARENT,
0584 },
0585 };
0586
0587 static struct clk_regmap axg_mpll2_div = {
0588 .data = &(struct meson_clk_mpll_data){
0589 .sdm = {
0590 .reg_off = HHI_MPLL_CNTL9,
0591 .shift = 0,
0592 .width = 14,
0593 },
0594 .sdm_en = {
0595 .reg_off = HHI_MPLL_CNTL9,
0596 .shift = 15,
0597 .width = 1,
0598 },
0599 .n2 = {
0600 .reg_off = HHI_MPLL_CNTL9,
0601 .shift = 16,
0602 .width = 9,
0603 },
0604 .ssen = {
0605 .reg_off = HHI_MPLL_CNTL,
0606 .shift = 25,
0607 .width = 1,
0608 },
0609 .misc = {
0610 .reg_off = HHI_PLL_TOP_MISC,
0611 .shift = 2,
0612 .width = 1,
0613 },
0614 .lock = &meson_clk_lock,
0615 .flags = CLK_MESON_MPLL_ROUND_CLOSEST,
0616 },
0617 .hw.init = &(struct clk_init_data){
0618 .name = "mpll2_div",
0619 .ops = &meson_clk_mpll_ops,
0620 .parent_hws = (const struct clk_hw *[]) {
0621 &axg_mpll_prediv.hw
0622 },
0623 .num_parents = 1,
0624 },
0625 };
0626
0627 static struct clk_regmap axg_mpll2 = {
0628 .data = &(struct clk_regmap_gate_data){
0629 .offset = HHI_MPLL_CNTL9,
0630 .bit_idx = 14,
0631 },
0632 .hw.init = &(struct clk_init_data){
0633 .name = "mpll2",
0634 .ops = &clk_regmap_gate_ops,
0635 .parent_hws = (const struct clk_hw *[]) {
0636 &axg_mpll2_div.hw
0637 },
0638 .num_parents = 1,
0639 .flags = CLK_SET_RATE_PARENT,
0640 },
0641 };
0642
0643 static struct clk_regmap axg_mpll3_div = {
0644 .data = &(struct meson_clk_mpll_data){
0645 .sdm = {
0646 .reg_off = HHI_MPLL3_CNTL0,
0647 .shift = 12,
0648 .width = 14,
0649 },
0650 .sdm_en = {
0651 .reg_off = HHI_MPLL3_CNTL0,
0652 .shift = 11,
0653 .width = 1,
0654 },
0655 .n2 = {
0656 .reg_off = HHI_MPLL3_CNTL0,
0657 .shift = 2,
0658 .width = 9,
0659 },
0660 .misc = {
0661 .reg_off = HHI_PLL_TOP_MISC,
0662 .shift = 3,
0663 .width = 1,
0664 },
0665 .lock = &meson_clk_lock,
0666 .flags = CLK_MESON_MPLL_ROUND_CLOSEST,
0667 },
0668 .hw.init = &(struct clk_init_data){
0669 .name = "mpll3_div",
0670 .ops = &meson_clk_mpll_ops,
0671 .parent_hws = (const struct clk_hw *[]) {
0672 &axg_mpll_prediv.hw
0673 },
0674 .num_parents = 1,
0675 },
0676 };
0677
0678 static struct clk_regmap axg_mpll3 = {
0679 .data = &(struct clk_regmap_gate_data){
0680 .offset = HHI_MPLL3_CNTL0,
0681 .bit_idx = 0,
0682 },
0683 .hw.init = &(struct clk_init_data){
0684 .name = "mpll3",
0685 .ops = &clk_regmap_gate_ops,
0686 .parent_hws = (const struct clk_hw *[]) {
0687 &axg_mpll3_div.hw
0688 },
0689 .num_parents = 1,
0690 .flags = CLK_SET_RATE_PARENT,
0691 },
0692 };
0693
0694 static const struct pll_params_table axg_pcie_pll_params_table[] = {
0695 {
0696 .m = 200,
0697 .n = 3,
0698 },
0699 { },
0700 };
0701
0702 static const struct reg_sequence axg_pcie_init_regs[] = {
0703 { .reg = HHI_PCIE_PLL_CNTL1, .def = 0x0084a2aa },
0704 { .reg = HHI_PCIE_PLL_CNTL2, .def = 0xb75020be },
0705 { .reg = HHI_PCIE_PLL_CNTL3, .def = 0x0a47488e },
0706 { .reg = HHI_PCIE_PLL_CNTL4, .def = 0xc000004d },
0707 { .reg = HHI_PCIE_PLL_CNTL5, .def = 0x00078000 },
0708 { .reg = HHI_PCIE_PLL_CNTL6, .def = 0x002323c6 },
0709 { .reg = HHI_PCIE_PLL_CNTL, .def = 0x400106c8 },
0710 };
0711
0712 static struct clk_regmap axg_pcie_pll_dco = {
0713 .data = &(struct meson_clk_pll_data){
0714 .en = {
0715 .reg_off = HHI_PCIE_PLL_CNTL,
0716 .shift = 30,
0717 .width = 1,
0718 },
0719 .m = {
0720 .reg_off = HHI_PCIE_PLL_CNTL,
0721 .shift = 0,
0722 .width = 9,
0723 },
0724 .n = {
0725 .reg_off = HHI_PCIE_PLL_CNTL,
0726 .shift = 9,
0727 .width = 5,
0728 },
0729 .frac = {
0730 .reg_off = HHI_PCIE_PLL_CNTL1,
0731 .shift = 0,
0732 .width = 12,
0733 },
0734 .l = {
0735 .reg_off = HHI_PCIE_PLL_CNTL,
0736 .shift = 31,
0737 .width = 1,
0738 },
0739 .rst = {
0740 .reg_off = HHI_PCIE_PLL_CNTL,
0741 .shift = 29,
0742 .width = 1,
0743 },
0744 .table = axg_pcie_pll_params_table,
0745 .init_regs = axg_pcie_init_regs,
0746 .init_count = ARRAY_SIZE(axg_pcie_init_regs),
0747 },
0748 .hw.init = &(struct clk_init_data){
0749 .name = "pcie_pll_dco",
0750 .ops = &meson_clk_pll_ops,
0751 .parent_data = &(const struct clk_parent_data) {
0752 .fw_name = "xtal",
0753 },
0754 .num_parents = 1,
0755 },
0756 };
0757
0758 static struct clk_regmap axg_pcie_pll_od = {
0759 .data = &(struct clk_regmap_div_data){
0760 .offset = HHI_PCIE_PLL_CNTL,
0761 .shift = 16,
0762 .width = 2,
0763 .flags = CLK_DIVIDER_POWER_OF_TWO,
0764 },
0765 .hw.init = &(struct clk_init_data){
0766 .name = "pcie_pll_od",
0767 .ops = &clk_regmap_divider_ops,
0768 .parent_hws = (const struct clk_hw *[]) {
0769 &axg_pcie_pll_dco.hw
0770 },
0771 .num_parents = 1,
0772 .flags = CLK_SET_RATE_PARENT,
0773 },
0774 };
0775
0776 static struct clk_regmap axg_pcie_pll = {
0777 .data = &(struct clk_regmap_div_data){
0778 .offset = HHI_PCIE_PLL_CNTL6,
0779 .shift = 6,
0780 .width = 2,
0781 .flags = CLK_DIVIDER_POWER_OF_TWO,
0782 },
0783 .hw.init = &(struct clk_init_data){
0784 .name = "pcie_pll",
0785 .ops = &clk_regmap_divider_ops,
0786 .parent_hws = (const struct clk_hw *[]) {
0787 &axg_pcie_pll_od.hw
0788 },
0789 .num_parents = 1,
0790 .flags = CLK_SET_RATE_PARENT,
0791 },
0792 };
0793
0794 static struct clk_regmap axg_pcie_mux = {
0795 .data = &(struct clk_regmap_mux_data){
0796 .offset = HHI_PCIE_PLL_CNTL6,
0797 .mask = 0x1,
0798 .shift = 2,
0799
0800 .table = (u32[]){ 1 },
0801 },
0802 .hw.init = &(struct clk_init_data){
0803 .name = "pcie_mux",
0804 .ops = &clk_regmap_mux_ops,
0805 .parent_hws = (const struct clk_hw *[]) { &axg_pcie_pll.hw },
0806 .num_parents = 1,
0807 .flags = CLK_SET_RATE_PARENT,
0808 },
0809 };
0810
0811 static struct clk_regmap axg_pcie_ref = {
0812 .data = &(struct clk_regmap_mux_data){
0813 .offset = HHI_PCIE_PLL_CNTL6,
0814 .mask = 0x1,
0815 .shift = 1,
0816
0817 .table = (u32[]){ 1 },
0818 },
0819 .hw.init = &(struct clk_init_data){
0820 .name = "pcie_ref",
0821 .ops = &clk_regmap_mux_ops,
0822 .parent_hws = (const struct clk_hw *[]) { &axg_pcie_mux.hw },
0823 .num_parents = 1,
0824 .flags = CLK_SET_RATE_PARENT,
0825 },
0826 };
0827
0828 static struct clk_regmap axg_pcie_cml_en0 = {
0829 .data = &(struct clk_regmap_gate_data){
0830 .offset = HHI_PCIE_PLL_CNTL6,
0831 .bit_idx = 4,
0832 },
0833 .hw.init = &(struct clk_init_data) {
0834 .name = "pcie_cml_en0",
0835 .ops = &clk_regmap_gate_ops,
0836 .parent_hws = (const struct clk_hw *[]) { &axg_pcie_ref.hw },
0837 .num_parents = 1,
0838 .flags = CLK_SET_RATE_PARENT,
0839
0840 },
0841 };
0842
0843 static struct clk_regmap axg_pcie_cml_en1 = {
0844 .data = &(struct clk_regmap_gate_data){
0845 .offset = HHI_PCIE_PLL_CNTL6,
0846 .bit_idx = 3,
0847 },
0848 .hw.init = &(struct clk_init_data) {
0849 .name = "pcie_cml_en1",
0850 .ops = &clk_regmap_gate_ops,
0851 .parent_hws = (const struct clk_hw *[]) { &axg_pcie_ref.hw },
0852 .num_parents = 1,
0853 .flags = CLK_SET_RATE_PARENT,
0854 },
0855 };
0856
0857 static u32 mux_table_clk81[] = { 0, 2, 3, 4, 5, 6, 7 };
0858 static const struct clk_parent_data clk81_parent_data[] = {
0859 { .fw_name = "xtal", },
0860 { .hw = &axg_fclk_div7.hw },
0861 { .hw = &axg_mpll1.hw },
0862 { .hw = &axg_mpll2.hw },
0863 { .hw = &axg_fclk_div4.hw },
0864 { .hw = &axg_fclk_div3.hw },
0865 { .hw = &axg_fclk_div5.hw },
0866 };
0867
0868 static struct clk_regmap axg_mpeg_clk_sel = {
0869 .data = &(struct clk_regmap_mux_data){
0870 .offset = HHI_MPEG_CLK_CNTL,
0871 .mask = 0x7,
0872 .shift = 12,
0873 .table = mux_table_clk81,
0874 },
0875 .hw.init = &(struct clk_init_data){
0876 .name = "mpeg_clk_sel",
0877 .ops = &clk_regmap_mux_ro_ops,
0878 .parent_data = clk81_parent_data,
0879 .num_parents = ARRAY_SIZE(clk81_parent_data),
0880 },
0881 };
0882
0883 static struct clk_regmap axg_mpeg_clk_div = {
0884 .data = &(struct clk_regmap_div_data){
0885 .offset = HHI_MPEG_CLK_CNTL,
0886 .shift = 0,
0887 .width = 7,
0888 },
0889 .hw.init = &(struct clk_init_data){
0890 .name = "mpeg_clk_div",
0891 .ops = &clk_regmap_divider_ops,
0892 .parent_hws = (const struct clk_hw *[]) {
0893 &axg_mpeg_clk_sel.hw
0894 },
0895 .num_parents = 1,
0896 .flags = CLK_SET_RATE_PARENT,
0897 },
0898 };
0899
0900 static struct clk_regmap axg_clk81 = {
0901 .data = &(struct clk_regmap_gate_data){
0902 .offset = HHI_MPEG_CLK_CNTL,
0903 .bit_idx = 7,
0904 },
0905 .hw.init = &(struct clk_init_data){
0906 .name = "clk81",
0907 .ops = &clk_regmap_gate_ops,
0908 .parent_hws = (const struct clk_hw *[]) {
0909 &axg_mpeg_clk_div.hw
0910 },
0911 .num_parents = 1,
0912 .flags = (CLK_SET_RATE_PARENT | CLK_IS_CRITICAL),
0913 },
0914 };
0915
0916 static const struct clk_parent_data axg_sd_emmc_clk0_parent_data[] = {
0917 { .fw_name = "xtal", },
0918 { .hw = &axg_fclk_div2.hw },
0919 { .hw = &axg_fclk_div3.hw },
0920 { .hw = &axg_fclk_div5.hw },
0921 { .hw = &axg_fclk_div7.hw },
0922
0923
0924
0925
0926
0927
0928 };
0929
0930
0931 static struct clk_regmap axg_sd_emmc_b_clk0_sel = {
0932 .data = &(struct clk_regmap_mux_data){
0933 .offset = HHI_SD_EMMC_CLK_CNTL,
0934 .mask = 0x7,
0935 .shift = 25,
0936 },
0937 .hw.init = &(struct clk_init_data) {
0938 .name = "sd_emmc_b_clk0_sel",
0939 .ops = &clk_regmap_mux_ops,
0940 .parent_data = axg_sd_emmc_clk0_parent_data,
0941 .num_parents = ARRAY_SIZE(axg_sd_emmc_clk0_parent_data),
0942 .flags = CLK_SET_RATE_PARENT,
0943 },
0944 };
0945
0946 static struct clk_regmap axg_sd_emmc_b_clk0_div = {
0947 .data = &(struct clk_regmap_div_data){
0948 .offset = HHI_SD_EMMC_CLK_CNTL,
0949 .shift = 16,
0950 .width = 7,
0951 .flags = CLK_DIVIDER_ROUND_CLOSEST,
0952 },
0953 .hw.init = &(struct clk_init_data) {
0954 .name = "sd_emmc_b_clk0_div",
0955 .ops = &clk_regmap_divider_ops,
0956 .parent_hws = (const struct clk_hw *[]) {
0957 &axg_sd_emmc_b_clk0_sel.hw
0958 },
0959 .num_parents = 1,
0960 .flags = CLK_SET_RATE_PARENT,
0961 },
0962 };
0963
0964 static struct clk_regmap axg_sd_emmc_b_clk0 = {
0965 .data = &(struct clk_regmap_gate_data){
0966 .offset = HHI_SD_EMMC_CLK_CNTL,
0967 .bit_idx = 23,
0968 },
0969 .hw.init = &(struct clk_init_data){
0970 .name = "sd_emmc_b_clk0",
0971 .ops = &clk_regmap_gate_ops,
0972 .parent_hws = (const struct clk_hw *[]) {
0973 &axg_sd_emmc_b_clk0_div.hw
0974 },
0975 .num_parents = 1,
0976 .flags = CLK_SET_RATE_PARENT,
0977 },
0978 };
0979
0980
0981 static struct clk_regmap axg_sd_emmc_c_clk0_sel = {
0982 .data = &(struct clk_regmap_mux_data){
0983 .offset = HHI_NAND_CLK_CNTL,
0984 .mask = 0x7,
0985 .shift = 9,
0986 },
0987 .hw.init = &(struct clk_init_data) {
0988 .name = "sd_emmc_c_clk0_sel",
0989 .ops = &clk_regmap_mux_ops,
0990 .parent_data = axg_sd_emmc_clk0_parent_data,
0991 .num_parents = ARRAY_SIZE(axg_sd_emmc_clk0_parent_data),
0992 .flags = CLK_SET_RATE_PARENT,
0993 },
0994 };
0995
0996 static struct clk_regmap axg_sd_emmc_c_clk0_div = {
0997 .data = &(struct clk_regmap_div_data){
0998 .offset = HHI_NAND_CLK_CNTL,
0999 .shift = 0,
1000 .width = 7,
1001 .flags = CLK_DIVIDER_ROUND_CLOSEST,
1002 },
1003 .hw.init = &(struct clk_init_data) {
1004 .name = "sd_emmc_c_clk0_div",
1005 .ops = &clk_regmap_divider_ops,
1006 .parent_hws = (const struct clk_hw *[]) {
1007 &axg_sd_emmc_c_clk0_sel.hw
1008 },
1009 .num_parents = 1,
1010 .flags = CLK_SET_RATE_PARENT,
1011 },
1012 };
1013
1014 static struct clk_regmap axg_sd_emmc_c_clk0 = {
1015 .data = &(struct clk_regmap_gate_data){
1016 .offset = HHI_NAND_CLK_CNTL,
1017 .bit_idx = 7,
1018 },
1019 .hw.init = &(struct clk_init_data){
1020 .name = "sd_emmc_c_clk0",
1021 .ops = &clk_regmap_gate_ops,
1022 .parent_hws = (const struct clk_hw *[]) {
1023 &axg_sd_emmc_c_clk0_div.hw
1024 },
1025 .num_parents = 1,
1026 .flags = CLK_SET_RATE_PARENT,
1027 },
1028 };
1029
1030
1031
1032 static const struct clk_hw *axg_vpu_parent_hws[] = {
1033 &axg_fclk_div4.hw,
1034 &axg_fclk_div3.hw,
1035 &axg_fclk_div5.hw,
1036 &axg_fclk_div7.hw,
1037 };
1038
1039 static struct clk_regmap axg_vpu_0_sel = {
1040 .data = &(struct clk_regmap_mux_data){
1041 .offset = HHI_VPU_CLK_CNTL,
1042 .mask = 0x3,
1043 .shift = 9,
1044 },
1045 .hw.init = &(struct clk_init_data){
1046 .name = "vpu_0_sel",
1047 .ops = &clk_regmap_mux_ops,
1048 .parent_hws = axg_vpu_parent_hws,
1049 .num_parents = ARRAY_SIZE(axg_vpu_parent_hws),
1050
1051 .flags = CLK_SET_RATE_NO_REPARENT,
1052 },
1053 };
1054
1055 static struct clk_regmap axg_vpu_0_div = {
1056 .data = &(struct clk_regmap_div_data){
1057 .offset = HHI_VPU_CLK_CNTL,
1058 .shift = 0,
1059 .width = 7,
1060 },
1061 .hw.init = &(struct clk_init_data){
1062 .name = "vpu_0_div",
1063 .ops = &clk_regmap_divider_ops,
1064 .parent_hws = (const struct clk_hw *[]) { &axg_vpu_0_sel.hw },
1065 .num_parents = 1,
1066 .flags = CLK_SET_RATE_PARENT,
1067 },
1068 };
1069
1070 static struct clk_regmap axg_vpu_0 = {
1071 .data = &(struct clk_regmap_gate_data){
1072 .offset = HHI_VPU_CLK_CNTL,
1073 .bit_idx = 8,
1074 },
1075 .hw.init = &(struct clk_init_data) {
1076 .name = "vpu_0",
1077 .ops = &clk_regmap_gate_ops,
1078 .parent_hws = (const struct clk_hw *[]) { &axg_vpu_0_div.hw },
1079 .num_parents = 1,
1080
1081
1082
1083
1084 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
1085 },
1086 };
1087
1088 static struct clk_regmap axg_vpu_1_sel = {
1089 .data = &(struct clk_regmap_mux_data){
1090 .offset = HHI_VPU_CLK_CNTL,
1091 .mask = 0x3,
1092 .shift = 25,
1093 },
1094 .hw.init = &(struct clk_init_data){
1095 .name = "vpu_1_sel",
1096 .ops = &clk_regmap_mux_ops,
1097 .parent_hws = axg_vpu_parent_hws,
1098 .num_parents = ARRAY_SIZE(axg_vpu_parent_hws),
1099
1100 .flags = CLK_SET_RATE_NO_REPARENT,
1101 },
1102 };
1103
1104 static struct clk_regmap axg_vpu_1_div = {
1105 .data = &(struct clk_regmap_div_data){
1106 .offset = HHI_VPU_CLK_CNTL,
1107 .shift = 16,
1108 .width = 7,
1109 },
1110 .hw.init = &(struct clk_init_data){
1111 .name = "vpu_1_div",
1112 .ops = &clk_regmap_divider_ops,
1113 .parent_hws = (const struct clk_hw *[]) { &axg_vpu_1_sel.hw },
1114 .num_parents = 1,
1115 .flags = CLK_SET_RATE_PARENT,
1116 },
1117 };
1118
1119 static struct clk_regmap axg_vpu_1 = {
1120 .data = &(struct clk_regmap_gate_data){
1121 .offset = HHI_VPU_CLK_CNTL,
1122 .bit_idx = 24,
1123 },
1124 .hw.init = &(struct clk_init_data) {
1125 .name = "vpu_1",
1126 .ops = &clk_regmap_gate_ops,
1127 .parent_hws = (const struct clk_hw *[]) { &axg_vpu_1_div.hw },
1128 .num_parents = 1,
1129
1130
1131
1132
1133 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
1134 },
1135 };
1136
1137 static struct clk_regmap axg_vpu = {
1138 .data = &(struct clk_regmap_mux_data){
1139 .offset = HHI_VPU_CLK_CNTL,
1140 .mask = 1,
1141 .shift = 31,
1142 },
1143 .hw.init = &(struct clk_init_data){
1144 .name = "vpu",
1145 .ops = &clk_regmap_mux_ops,
1146 .parent_hws = (const struct clk_hw *[]) {
1147 &axg_vpu_0.hw,
1148 &axg_vpu_1.hw
1149 },
1150 .num_parents = 2,
1151 .flags = CLK_SET_RATE_NO_REPARENT,
1152 },
1153 };
1154
1155
1156
1157 static struct clk_regmap axg_vapb_0_sel = {
1158 .data = &(struct clk_regmap_mux_data){
1159 .offset = HHI_VAPBCLK_CNTL,
1160 .mask = 0x3,
1161 .shift = 9,
1162 },
1163 .hw.init = &(struct clk_init_data){
1164 .name = "vapb_0_sel",
1165 .ops = &clk_regmap_mux_ops,
1166 .parent_hws = axg_vpu_parent_hws,
1167 .num_parents = ARRAY_SIZE(axg_vpu_parent_hws),
1168 .flags = CLK_SET_RATE_NO_REPARENT,
1169 },
1170 };
1171
1172 static struct clk_regmap axg_vapb_0_div = {
1173 .data = &(struct clk_regmap_div_data){
1174 .offset = HHI_VAPBCLK_CNTL,
1175 .shift = 0,
1176 .width = 7,
1177 },
1178 .hw.init = &(struct clk_init_data){
1179 .name = "vapb_0_div",
1180 .ops = &clk_regmap_divider_ops,
1181 .parent_hws = (const struct clk_hw *[]) {
1182 &axg_vapb_0_sel.hw
1183 },
1184 .num_parents = 1,
1185 .flags = CLK_SET_RATE_PARENT,
1186 },
1187 };
1188
1189 static struct clk_regmap axg_vapb_0 = {
1190 .data = &(struct clk_regmap_gate_data){
1191 .offset = HHI_VAPBCLK_CNTL,
1192 .bit_idx = 8,
1193 },
1194 .hw.init = &(struct clk_init_data) {
1195 .name = "vapb_0",
1196 .ops = &clk_regmap_gate_ops,
1197 .parent_hws = (const struct clk_hw *[]) {
1198 &axg_vapb_0_div.hw
1199 },
1200 .num_parents = 1,
1201 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
1202 },
1203 };
1204
1205 static struct clk_regmap axg_vapb_1_sel = {
1206 .data = &(struct clk_regmap_mux_data){
1207 .offset = HHI_VAPBCLK_CNTL,
1208 .mask = 0x3,
1209 .shift = 25,
1210 },
1211 .hw.init = &(struct clk_init_data){
1212 .name = "vapb_1_sel",
1213 .ops = &clk_regmap_mux_ops,
1214 .parent_hws = axg_vpu_parent_hws,
1215 .num_parents = ARRAY_SIZE(axg_vpu_parent_hws),
1216 .flags = CLK_SET_RATE_NO_REPARENT,
1217 },
1218 };
1219
1220 static struct clk_regmap axg_vapb_1_div = {
1221 .data = &(struct clk_regmap_div_data){
1222 .offset = HHI_VAPBCLK_CNTL,
1223 .shift = 16,
1224 .width = 7,
1225 },
1226 .hw.init = &(struct clk_init_data){
1227 .name = "vapb_1_div",
1228 .ops = &clk_regmap_divider_ops,
1229 .parent_hws = (const struct clk_hw *[]) {
1230 &axg_vapb_1_sel.hw
1231 },
1232 .num_parents = 1,
1233 .flags = CLK_SET_RATE_PARENT,
1234 },
1235 };
1236
1237 static struct clk_regmap axg_vapb_1 = {
1238 .data = &(struct clk_regmap_gate_data){
1239 .offset = HHI_VAPBCLK_CNTL,
1240 .bit_idx = 24,
1241 },
1242 .hw.init = &(struct clk_init_data) {
1243 .name = "vapb_1",
1244 .ops = &clk_regmap_gate_ops,
1245 .parent_hws = (const struct clk_hw *[]) {
1246 &axg_vapb_1_div.hw
1247 },
1248 .num_parents = 1,
1249 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
1250 },
1251 };
1252
1253 static struct clk_regmap axg_vapb_sel = {
1254 .data = &(struct clk_regmap_mux_data){
1255 .offset = HHI_VAPBCLK_CNTL,
1256 .mask = 1,
1257 .shift = 31,
1258 },
1259 .hw.init = &(struct clk_init_data){
1260 .name = "vapb_sel",
1261 .ops = &clk_regmap_mux_ops,
1262 .parent_hws = (const struct clk_hw *[]) {
1263 &axg_vapb_0.hw,
1264 &axg_vapb_1.hw
1265 },
1266 .num_parents = 2,
1267 .flags = CLK_SET_RATE_NO_REPARENT,
1268 },
1269 };
1270
1271 static struct clk_regmap axg_vapb = {
1272 .data = &(struct clk_regmap_gate_data){
1273 .offset = HHI_VAPBCLK_CNTL,
1274 .bit_idx = 30,
1275 },
1276 .hw.init = &(struct clk_init_data) {
1277 .name = "vapb",
1278 .ops = &clk_regmap_gate_ops,
1279 .parent_hws = (const struct clk_hw *[]) { &axg_vapb_sel.hw },
1280 .num_parents = 1,
1281 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
1282 },
1283 };
1284
1285
1286
1287 static const struct clk_hw *axg_vclk_parent_hws[] = {
1288 &axg_gp0_pll.hw,
1289 &axg_fclk_div4.hw,
1290 &axg_fclk_div3.hw,
1291 &axg_fclk_div5.hw,
1292 &axg_fclk_div2.hw,
1293 &axg_fclk_div7.hw,
1294 &axg_mpll1.hw,
1295 };
1296
1297 static struct clk_regmap axg_vclk_sel = {
1298 .data = &(struct clk_regmap_mux_data){
1299 .offset = HHI_VID_CLK_CNTL,
1300 .mask = 0x7,
1301 .shift = 16,
1302 },
1303 .hw.init = &(struct clk_init_data){
1304 .name = "vclk_sel",
1305 .ops = &clk_regmap_mux_ops,
1306 .parent_hws = axg_vclk_parent_hws,
1307 .num_parents = ARRAY_SIZE(axg_vclk_parent_hws),
1308 .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
1309 },
1310 };
1311
1312 static struct clk_regmap axg_vclk2_sel = {
1313 .data = &(struct clk_regmap_mux_data){
1314 .offset = HHI_VIID_CLK_CNTL,
1315 .mask = 0x7,
1316 .shift = 16,
1317 },
1318 .hw.init = &(struct clk_init_data){
1319 .name = "vclk2_sel",
1320 .ops = &clk_regmap_mux_ops,
1321 .parent_hws = axg_vclk_parent_hws,
1322 .num_parents = ARRAY_SIZE(axg_vclk_parent_hws),
1323 .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
1324 },
1325 };
1326
1327 static struct clk_regmap axg_vclk_input = {
1328 .data = &(struct clk_regmap_gate_data){
1329 .offset = HHI_VID_CLK_DIV,
1330 .bit_idx = 16,
1331 },
1332 .hw.init = &(struct clk_init_data) {
1333 .name = "vclk_input",
1334 .ops = &clk_regmap_gate_ops,
1335 .parent_hws = (const struct clk_hw *[]) { &axg_vclk_sel.hw },
1336 .num_parents = 1,
1337 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
1338 },
1339 };
1340
1341 static struct clk_regmap axg_vclk2_input = {
1342 .data = &(struct clk_regmap_gate_data){
1343 .offset = HHI_VIID_CLK_DIV,
1344 .bit_idx = 16,
1345 },
1346 .hw.init = &(struct clk_init_data) {
1347 .name = "vclk2_input",
1348 .ops = &clk_regmap_gate_ops,
1349 .parent_hws = (const struct clk_hw *[]) { &axg_vclk2_sel.hw },
1350 .num_parents = 1,
1351 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
1352 },
1353 };
1354
1355 static struct clk_regmap axg_vclk_div = {
1356 .data = &(struct clk_regmap_div_data){
1357 .offset = HHI_VID_CLK_DIV,
1358 .shift = 0,
1359 .width = 8,
1360 },
1361 .hw.init = &(struct clk_init_data){
1362 .name = "vclk_div",
1363 .ops = &clk_regmap_divider_ops,
1364 .parent_hws = (const struct clk_hw *[]) {
1365 &axg_vclk_input.hw
1366 },
1367 .num_parents = 1,
1368 .flags = CLK_GET_RATE_NOCACHE,
1369 },
1370 };
1371
1372 static struct clk_regmap axg_vclk2_div = {
1373 .data = &(struct clk_regmap_div_data){
1374 .offset = HHI_VIID_CLK_DIV,
1375 .shift = 0,
1376 .width = 8,
1377 },
1378 .hw.init = &(struct clk_init_data){
1379 .name = "vclk2_div",
1380 .ops = &clk_regmap_divider_ops,
1381 .parent_hws = (const struct clk_hw *[]) {
1382 &axg_vclk2_input.hw
1383 },
1384 .num_parents = 1,
1385 .flags = CLK_GET_RATE_NOCACHE,
1386 },
1387 };
1388
1389 static struct clk_regmap axg_vclk = {
1390 .data = &(struct clk_regmap_gate_data){
1391 .offset = HHI_VID_CLK_CNTL,
1392 .bit_idx = 19,
1393 },
1394 .hw.init = &(struct clk_init_data) {
1395 .name = "vclk",
1396 .ops = &clk_regmap_gate_ops,
1397 .parent_hws = (const struct clk_hw *[]) { &axg_vclk_div.hw },
1398 .num_parents = 1,
1399 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
1400 },
1401 };
1402
1403 static struct clk_regmap axg_vclk2 = {
1404 .data = &(struct clk_regmap_gate_data){
1405 .offset = HHI_VIID_CLK_CNTL,
1406 .bit_idx = 19,
1407 },
1408 .hw.init = &(struct clk_init_data) {
1409 .name = "vclk2",
1410 .ops = &clk_regmap_gate_ops,
1411 .parent_hws = (const struct clk_hw *[]) { &axg_vclk2_div.hw },
1412 .num_parents = 1,
1413 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
1414 },
1415 };
1416
1417 static struct clk_regmap axg_vclk_div1 = {
1418 .data = &(struct clk_regmap_gate_data){
1419 .offset = HHI_VID_CLK_CNTL,
1420 .bit_idx = 0,
1421 },
1422 .hw.init = &(struct clk_init_data) {
1423 .name = "vclk_div1",
1424 .ops = &clk_regmap_gate_ops,
1425 .parent_hws = (const struct clk_hw *[]) { &axg_vclk.hw },
1426 .num_parents = 1,
1427 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
1428 },
1429 };
1430
1431 static struct clk_regmap axg_vclk_div2_en = {
1432 .data = &(struct clk_regmap_gate_data){
1433 .offset = HHI_VID_CLK_CNTL,
1434 .bit_idx = 1,
1435 },
1436 .hw.init = &(struct clk_init_data) {
1437 .name = "vclk_div2_en",
1438 .ops = &clk_regmap_gate_ops,
1439 .parent_hws = (const struct clk_hw *[]) { &axg_vclk.hw },
1440 .num_parents = 1,
1441 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
1442 },
1443 };
1444
1445 static struct clk_regmap axg_vclk_div4_en = {
1446 .data = &(struct clk_regmap_gate_data){
1447 .offset = HHI_VID_CLK_CNTL,
1448 .bit_idx = 2,
1449 },
1450 .hw.init = &(struct clk_init_data) {
1451 .name = "vclk_div4_en",
1452 .ops = &clk_regmap_gate_ops,
1453 .parent_hws = (const struct clk_hw *[]) { &axg_vclk.hw },
1454 .num_parents = 1,
1455 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
1456 },
1457 };
1458
1459 static struct clk_regmap axg_vclk_div6_en = {
1460 .data = &(struct clk_regmap_gate_data){
1461 .offset = HHI_VID_CLK_CNTL,
1462 .bit_idx = 3,
1463 },
1464 .hw.init = &(struct clk_init_data) {
1465 .name = "vclk_div6_en",
1466 .ops = &clk_regmap_gate_ops,
1467 .parent_hws = (const struct clk_hw *[]) { &axg_vclk.hw },
1468 .num_parents = 1,
1469 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
1470 },
1471 };
1472
1473 static struct clk_regmap axg_vclk_div12_en = {
1474 .data = &(struct clk_regmap_gate_data){
1475 .offset = HHI_VID_CLK_CNTL,
1476 .bit_idx = 4,
1477 },
1478 .hw.init = &(struct clk_init_data) {
1479 .name = "vclk_div12_en",
1480 .ops = &clk_regmap_gate_ops,
1481 .parent_hws = (const struct clk_hw *[]) { &axg_vclk.hw },
1482 .num_parents = 1,
1483 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
1484 },
1485 };
1486
1487 static struct clk_regmap axg_vclk2_div1 = {
1488 .data = &(struct clk_regmap_gate_data){
1489 .offset = HHI_VIID_CLK_CNTL,
1490 .bit_idx = 0,
1491 },
1492 .hw.init = &(struct clk_init_data) {
1493 .name = "vclk2_div1",
1494 .ops = &clk_regmap_gate_ops,
1495 .parent_hws = (const struct clk_hw *[]) { &axg_vclk2.hw },
1496 .num_parents = 1,
1497 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
1498 },
1499 };
1500
1501 static struct clk_regmap axg_vclk2_div2_en = {
1502 .data = &(struct clk_regmap_gate_data){
1503 .offset = HHI_VIID_CLK_CNTL,
1504 .bit_idx = 1,
1505 },
1506 .hw.init = &(struct clk_init_data) {
1507 .name = "vclk2_div2_en",
1508 .ops = &clk_regmap_gate_ops,
1509 .parent_hws = (const struct clk_hw *[]) { &axg_vclk2.hw },
1510 .num_parents = 1,
1511 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
1512 },
1513 };
1514
1515 static struct clk_regmap axg_vclk2_div4_en = {
1516 .data = &(struct clk_regmap_gate_data){
1517 .offset = HHI_VIID_CLK_CNTL,
1518 .bit_idx = 2,
1519 },
1520 .hw.init = &(struct clk_init_data) {
1521 .name = "vclk2_div4_en",
1522 .ops = &clk_regmap_gate_ops,
1523 .parent_hws = (const struct clk_hw *[]) { &axg_vclk2.hw },
1524 .num_parents = 1,
1525 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
1526 },
1527 };
1528
1529 static struct clk_regmap axg_vclk2_div6_en = {
1530 .data = &(struct clk_regmap_gate_data){
1531 .offset = HHI_VIID_CLK_CNTL,
1532 .bit_idx = 3,
1533 },
1534 .hw.init = &(struct clk_init_data) {
1535 .name = "vclk2_div6_en",
1536 .ops = &clk_regmap_gate_ops,
1537 .parent_hws = (const struct clk_hw *[]) { &axg_vclk2.hw },
1538 .num_parents = 1,
1539 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
1540 },
1541 };
1542
1543 static struct clk_regmap axg_vclk2_div12_en = {
1544 .data = &(struct clk_regmap_gate_data){
1545 .offset = HHI_VIID_CLK_CNTL,
1546 .bit_idx = 4,
1547 },
1548 .hw.init = &(struct clk_init_data) {
1549 .name = "vclk2_div12_en",
1550 .ops = &clk_regmap_gate_ops,
1551 .parent_hws = (const struct clk_hw *[]) { &axg_vclk2.hw },
1552 .num_parents = 1,
1553 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
1554 },
1555 };
1556
1557 static struct clk_fixed_factor axg_vclk_div2 = {
1558 .mult = 1,
1559 .div = 2,
1560 .hw.init = &(struct clk_init_data){
1561 .name = "vclk_div2",
1562 .ops = &clk_fixed_factor_ops,
1563 .parent_hws = (const struct clk_hw *[]) {
1564 &axg_vclk_div2_en.hw
1565 },
1566 .num_parents = 1,
1567 },
1568 };
1569
1570 static struct clk_fixed_factor axg_vclk_div4 = {
1571 .mult = 1,
1572 .div = 4,
1573 .hw.init = &(struct clk_init_data){
1574 .name = "vclk_div4",
1575 .ops = &clk_fixed_factor_ops,
1576 .parent_hws = (const struct clk_hw *[]) {
1577 &axg_vclk_div4_en.hw
1578 },
1579 .num_parents = 1,
1580 },
1581 };
1582
1583 static struct clk_fixed_factor axg_vclk_div6 = {
1584 .mult = 1,
1585 .div = 6,
1586 .hw.init = &(struct clk_init_data){
1587 .name = "vclk_div6",
1588 .ops = &clk_fixed_factor_ops,
1589 .parent_hws = (const struct clk_hw *[]) {
1590 &axg_vclk_div6_en.hw
1591 },
1592 .num_parents = 1,
1593 },
1594 };
1595
1596 static struct clk_fixed_factor axg_vclk_div12 = {
1597 .mult = 1,
1598 .div = 12,
1599 .hw.init = &(struct clk_init_data){
1600 .name = "vclk_div12",
1601 .ops = &clk_fixed_factor_ops,
1602 .parent_hws = (const struct clk_hw *[]) {
1603 &axg_vclk_div12_en.hw
1604 },
1605 .num_parents = 1,
1606 },
1607 };
1608
1609 static struct clk_fixed_factor axg_vclk2_div2 = {
1610 .mult = 1,
1611 .div = 2,
1612 .hw.init = &(struct clk_init_data){
1613 .name = "vclk2_div2",
1614 .ops = &clk_fixed_factor_ops,
1615 .parent_hws = (const struct clk_hw *[]) {
1616 &axg_vclk2_div2_en.hw
1617 },
1618 .num_parents = 1,
1619 },
1620 };
1621
1622 static struct clk_fixed_factor axg_vclk2_div4 = {
1623 .mult = 1,
1624 .div = 4,
1625 .hw.init = &(struct clk_init_data){
1626 .name = "vclk2_div4",
1627 .ops = &clk_fixed_factor_ops,
1628 .parent_hws = (const struct clk_hw *[]) {
1629 &axg_vclk2_div4_en.hw
1630 },
1631 .num_parents = 1,
1632 },
1633 };
1634
1635 static struct clk_fixed_factor axg_vclk2_div6 = {
1636 .mult = 1,
1637 .div = 6,
1638 .hw.init = &(struct clk_init_data){
1639 .name = "vclk2_div6",
1640 .ops = &clk_fixed_factor_ops,
1641 .parent_hws = (const struct clk_hw *[]) {
1642 &axg_vclk2_div6_en.hw
1643 },
1644 .num_parents = 1,
1645 },
1646 };
1647
1648 static struct clk_fixed_factor axg_vclk2_div12 = {
1649 .mult = 1,
1650 .div = 12,
1651 .hw.init = &(struct clk_init_data){
1652 .name = "vclk2_div12",
1653 .ops = &clk_fixed_factor_ops,
1654 .parent_hws = (const struct clk_hw *[]) {
1655 &axg_vclk2_div12_en.hw
1656 },
1657 .num_parents = 1,
1658 },
1659 };
1660
1661 static u32 mux_table_cts_sel[] = { 0, 1, 2, 3, 4, 8, 9, 10, 11, 12 };
1662 static const struct clk_hw *axg_cts_parent_hws[] = {
1663 &axg_vclk_div1.hw,
1664 &axg_vclk_div2.hw,
1665 &axg_vclk_div4.hw,
1666 &axg_vclk_div6.hw,
1667 &axg_vclk_div12.hw,
1668 &axg_vclk2_div1.hw,
1669 &axg_vclk2_div2.hw,
1670 &axg_vclk2_div4.hw,
1671 &axg_vclk2_div6.hw,
1672 &axg_vclk2_div12.hw,
1673 };
1674
1675 static struct clk_regmap axg_cts_encl_sel = {
1676 .data = &(struct clk_regmap_mux_data){
1677 .offset = HHI_VIID_CLK_DIV,
1678 .mask = 0xf,
1679 .shift = 12,
1680 .table = mux_table_cts_sel,
1681 },
1682 .hw.init = &(struct clk_init_data){
1683 .name = "cts_encl_sel",
1684 .ops = &clk_regmap_mux_ops,
1685 .parent_hws = axg_cts_parent_hws,
1686 .num_parents = ARRAY_SIZE(axg_cts_parent_hws),
1687 .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
1688 },
1689 };
1690
1691 static struct clk_regmap axg_cts_encl = {
1692 .data = &(struct clk_regmap_gate_data){
1693 .offset = HHI_VID_CLK_CNTL2,
1694 .bit_idx = 3,
1695 },
1696 .hw.init = &(struct clk_init_data) {
1697 .name = "cts_encl",
1698 .ops = &clk_regmap_gate_ops,
1699 .parent_hws = (const struct clk_hw *[]) {
1700 &axg_cts_encl_sel.hw
1701 },
1702 .num_parents = 1,
1703 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
1704 },
1705 };
1706
1707
1708
1709 static u32 mux_table_axg_vdin_meas[] = { 0, 1, 2, 3, 6, 7 };
1710 static const struct clk_parent_data axg_vdin_meas_parent_data[] = {
1711 { .fw_name = "xtal", },
1712 { .hw = &axg_fclk_div4.hw },
1713 { .hw = &axg_fclk_div3.hw },
1714 { .hw = &axg_fclk_div5.hw },
1715 { .hw = &axg_fclk_div2.hw },
1716 { .hw = &axg_fclk_div7.hw },
1717 };
1718
1719 static struct clk_regmap axg_vdin_meas_sel = {
1720 .data = &(struct clk_regmap_mux_data){
1721 .offset = HHI_VDIN_MEAS_CLK_CNTL,
1722 .mask = 0x7,
1723 .shift = 21,
1724 .flags = CLK_MUX_ROUND_CLOSEST,
1725 .table = mux_table_axg_vdin_meas,
1726 },
1727 .hw.init = &(struct clk_init_data){
1728 .name = "vdin_meas_sel",
1729 .ops = &clk_regmap_mux_ops,
1730 .parent_data = axg_vdin_meas_parent_data,
1731 .num_parents = ARRAY_SIZE(axg_vdin_meas_parent_data),
1732 .flags = CLK_SET_RATE_PARENT,
1733 },
1734 };
1735
1736 static struct clk_regmap axg_vdin_meas_div = {
1737 .data = &(struct clk_regmap_div_data){
1738 .offset = HHI_VDIN_MEAS_CLK_CNTL,
1739 .shift = 12,
1740 .width = 7,
1741 },
1742 .hw.init = &(struct clk_init_data){
1743 .name = "vdin_meas_div",
1744 .ops = &clk_regmap_divider_ops,
1745 .parent_hws = (const struct clk_hw *[]) {
1746 &axg_vdin_meas_sel.hw },
1747 .num_parents = 1,
1748 .flags = CLK_SET_RATE_PARENT,
1749 },
1750 };
1751
1752 static struct clk_regmap axg_vdin_meas = {
1753 .data = &(struct clk_regmap_gate_data){
1754 .offset = HHI_VDIN_MEAS_CLK_CNTL,
1755 .bit_idx = 20,
1756 },
1757 .hw.init = &(struct clk_init_data) {
1758 .name = "vdin_meas",
1759 .ops = &clk_regmap_gate_ops,
1760 .parent_hws = (const struct clk_hw *[]) {
1761 &axg_vdin_meas_div.hw },
1762 .num_parents = 1,
1763 .flags = CLK_SET_RATE_PARENT,
1764 },
1765 };
1766
1767 static u32 mux_table_gen_clk[] = { 0, 4, 5, 6, 7, 8,
1768 9, 10, 11, 13, 14, };
1769 static const struct clk_parent_data gen_clk_parent_data[] = {
1770 { .fw_name = "xtal", },
1771 { .hw = &axg_hifi_pll.hw },
1772 { .hw = &axg_mpll0.hw },
1773 { .hw = &axg_mpll1.hw },
1774 { .hw = &axg_mpll2.hw },
1775 { .hw = &axg_mpll3.hw },
1776 { .hw = &axg_fclk_div4.hw },
1777 { .hw = &axg_fclk_div3.hw },
1778 { .hw = &axg_fclk_div5.hw },
1779 { .hw = &axg_fclk_div7.hw },
1780 { .hw = &axg_gp0_pll.hw },
1781 };
1782
1783 static struct clk_regmap axg_gen_clk_sel = {
1784 .data = &(struct clk_regmap_mux_data){
1785 .offset = HHI_GEN_CLK_CNTL,
1786 .mask = 0xf,
1787 .shift = 12,
1788 .table = mux_table_gen_clk,
1789 },
1790 .hw.init = &(struct clk_init_data){
1791 .name = "gen_clk_sel",
1792 .ops = &clk_regmap_mux_ops,
1793
1794
1795
1796
1797
1798
1799 .parent_data = gen_clk_parent_data,
1800 .num_parents = ARRAY_SIZE(gen_clk_parent_data),
1801 },
1802 };
1803
1804 static struct clk_regmap axg_gen_clk_div = {
1805 .data = &(struct clk_regmap_div_data){
1806 .offset = HHI_GEN_CLK_CNTL,
1807 .shift = 0,
1808 .width = 11,
1809 },
1810 .hw.init = &(struct clk_init_data){
1811 .name = "gen_clk_div",
1812 .ops = &clk_regmap_divider_ops,
1813 .parent_hws = (const struct clk_hw *[]) {
1814 &axg_gen_clk_sel.hw
1815 },
1816 .num_parents = 1,
1817 .flags = CLK_SET_RATE_PARENT,
1818 },
1819 };
1820
1821 static struct clk_regmap axg_gen_clk = {
1822 .data = &(struct clk_regmap_gate_data){
1823 .offset = HHI_GEN_CLK_CNTL,
1824 .bit_idx = 7,
1825 },
1826 .hw.init = &(struct clk_init_data){
1827 .name = "gen_clk",
1828 .ops = &clk_regmap_gate_ops,
1829 .parent_hws = (const struct clk_hw *[]) {
1830 &axg_gen_clk_div.hw
1831 },
1832 .num_parents = 1,
1833 .flags = CLK_SET_RATE_PARENT,
1834 },
1835 };
1836
1837 #define MESON_GATE(_name, _reg, _bit) \
1838 MESON_PCLK(_name, _reg, _bit, &axg_clk81.hw)
1839
1840
1841 static MESON_GATE(axg_ddr, HHI_GCLK_MPEG0, 0);
1842 static MESON_GATE(axg_audio_locker, HHI_GCLK_MPEG0, 2);
1843 static MESON_GATE(axg_mipi_dsi_host, HHI_GCLK_MPEG0, 3);
1844 static MESON_GATE(axg_isa, HHI_GCLK_MPEG0, 5);
1845 static MESON_GATE(axg_pl301, HHI_GCLK_MPEG0, 6);
1846 static MESON_GATE(axg_periphs, HHI_GCLK_MPEG0, 7);
1847 static MESON_GATE(axg_spicc_0, HHI_GCLK_MPEG0, 8);
1848 static MESON_GATE(axg_i2c, HHI_GCLK_MPEG0, 9);
1849 static MESON_GATE(axg_rng0, HHI_GCLK_MPEG0, 12);
1850 static MESON_GATE(axg_uart0, HHI_GCLK_MPEG0, 13);
1851 static MESON_GATE(axg_mipi_dsi_phy, HHI_GCLK_MPEG0, 14);
1852 static MESON_GATE(axg_spicc_1, HHI_GCLK_MPEG0, 15);
1853 static MESON_GATE(axg_pcie_a, HHI_GCLK_MPEG0, 16);
1854 static MESON_GATE(axg_pcie_b, HHI_GCLK_MPEG0, 17);
1855 static MESON_GATE(axg_hiu_reg, HHI_GCLK_MPEG0, 19);
1856 static MESON_GATE(axg_assist_misc, HHI_GCLK_MPEG0, 23);
1857 static MESON_GATE(axg_emmc_b, HHI_GCLK_MPEG0, 25);
1858 static MESON_GATE(axg_emmc_c, HHI_GCLK_MPEG0, 26);
1859 static MESON_GATE(axg_dma, HHI_GCLK_MPEG0, 27);
1860 static MESON_GATE(axg_spi, HHI_GCLK_MPEG0, 30);
1861
1862 static MESON_GATE(axg_audio, HHI_GCLK_MPEG1, 0);
1863 static MESON_GATE(axg_eth_core, HHI_GCLK_MPEG1, 3);
1864 static MESON_GATE(axg_uart1, HHI_GCLK_MPEG1, 16);
1865 static MESON_GATE(axg_g2d, HHI_GCLK_MPEG1, 20);
1866 static MESON_GATE(axg_usb0, HHI_GCLK_MPEG1, 21);
1867 static MESON_GATE(axg_usb1, HHI_GCLK_MPEG1, 22);
1868 static MESON_GATE(axg_reset, HHI_GCLK_MPEG1, 23);
1869 static MESON_GATE(axg_usb_general, HHI_GCLK_MPEG1, 26);
1870 static MESON_GATE(axg_ahb_arb0, HHI_GCLK_MPEG1, 29);
1871 static MESON_GATE(axg_efuse, HHI_GCLK_MPEG1, 30);
1872 static MESON_GATE(axg_boot_rom, HHI_GCLK_MPEG1, 31);
1873
1874 static MESON_GATE(axg_ahb_data_bus, HHI_GCLK_MPEG2, 1);
1875 static MESON_GATE(axg_ahb_ctrl_bus, HHI_GCLK_MPEG2, 2);
1876 static MESON_GATE(axg_usb1_to_ddr, HHI_GCLK_MPEG2, 8);
1877 static MESON_GATE(axg_usb0_to_ddr, HHI_GCLK_MPEG2, 9);
1878 static MESON_GATE(axg_mmc_pclk, HHI_GCLK_MPEG2, 11);
1879 static MESON_GATE(axg_vpu_intr, HHI_GCLK_MPEG2, 25);
1880 static MESON_GATE(axg_sec_ahb_ahb3_bridge, HHI_GCLK_MPEG2, 26);
1881 static MESON_GATE(axg_gic, HHI_GCLK_MPEG2, 30);
1882
1883
1884
1885 static MESON_GATE(axg_ao_media_cpu, HHI_GCLK_AO, 0);
1886 static MESON_GATE(axg_ao_ahb_sram, HHI_GCLK_AO, 1);
1887 static MESON_GATE(axg_ao_ahb_bus, HHI_GCLK_AO, 2);
1888 static MESON_GATE(axg_ao_iface, HHI_GCLK_AO, 3);
1889 static MESON_GATE(axg_ao_i2c, HHI_GCLK_AO, 4);
1890
1891
1892
1893 static struct clk_hw_onecell_data axg_hw_onecell_data = {
1894 .hws = {
1895 [CLKID_SYS_PLL] = &axg_sys_pll.hw,
1896 [CLKID_FIXED_PLL] = &axg_fixed_pll.hw,
1897 [CLKID_FCLK_DIV2] = &axg_fclk_div2.hw,
1898 [CLKID_FCLK_DIV3] = &axg_fclk_div3.hw,
1899 [CLKID_FCLK_DIV4] = &axg_fclk_div4.hw,
1900 [CLKID_FCLK_DIV5] = &axg_fclk_div5.hw,
1901 [CLKID_FCLK_DIV7] = &axg_fclk_div7.hw,
1902 [CLKID_GP0_PLL] = &axg_gp0_pll.hw,
1903 [CLKID_MPEG_SEL] = &axg_mpeg_clk_sel.hw,
1904 [CLKID_MPEG_DIV] = &axg_mpeg_clk_div.hw,
1905 [CLKID_CLK81] = &axg_clk81.hw,
1906 [CLKID_MPLL0] = &axg_mpll0.hw,
1907 [CLKID_MPLL1] = &axg_mpll1.hw,
1908 [CLKID_MPLL2] = &axg_mpll2.hw,
1909 [CLKID_MPLL3] = &axg_mpll3.hw,
1910 [CLKID_DDR] = &axg_ddr.hw,
1911 [CLKID_AUDIO_LOCKER] = &axg_audio_locker.hw,
1912 [CLKID_MIPI_DSI_HOST] = &axg_mipi_dsi_host.hw,
1913 [CLKID_ISA] = &axg_isa.hw,
1914 [CLKID_PL301] = &axg_pl301.hw,
1915 [CLKID_PERIPHS] = &axg_periphs.hw,
1916 [CLKID_SPICC0] = &axg_spicc_0.hw,
1917 [CLKID_I2C] = &axg_i2c.hw,
1918 [CLKID_RNG0] = &axg_rng0.hw,
1919 [CLKID_UART0] = &axg_uart0.hw,
1920 [CLKID_MIPI_DSI_PHY] = &axg_mipi_dsi_phy.hw,
1921 [CLKID_SPICC1] = &axg_spicc_1.hw,
1922 [CLKID_PCIE_A] = &axg_pcie_a.hw,
1923 [CLKID_PCIE_B] = &axg_pcie_b.hw,
1924 [CLKID_HIU_IFACE] = &axg_hiu_reg.hw,
1925 [CLKID_ASSIST_MISC] = &axg_assist_misc.hw,
1926 [CLKID_SD_EMMC_B] = &axg_emmc_b.hw,
1927 [CLKID_SD_EMMC_C] = &axg_emmc_c.hw,
1928 [CLKID_DMA] = &axg_dma.hw,
1929 [CLKID_SPI] = &axg_spi.hw,
1930 [CLKID_AUDIO] = &axg_audio.hw,
1931 [CLKID_ETH] = &axg_eth_core.hw,
1932 [CLKID_UART1] = &axg_uart1.hw,
1933 [CLKID_G2D] = &axg_g2d.hw,
1934 [CLKID_USB0] = &axg_usb0.hw,
1935 [CLKID_USB1] = &axg_usb1.hw,
1936 [CLKID_RESET] = &axg_reset.hw,
1937 [CLKID_USB] = &axg_usb_general.hw,
1938 [CLKID_AHB_ARB0] = &axg_ahb_arb0.hw,
1939 [CLKID_EFUSE] = &axg_efuse.hw,
1940 [CLKID_BOOT_ROM] = &axg_boot_rom.hw,
1941 [CLKID_AHB_DATA_BUS] = &axg_ahb_data_bus.hw,
1942 [CLKID_AHB_CTRL_BUS] = &axg_ahb_ctrl_bus.hw,
1943 [CLKID_USB1_DDR_BRIDGE] = &axg_usb1_to_ddr.hw,
1944 [CLKID_USB0_DDR_BRIDGE] = &axg_usb0_to_ddr.hw,
1945 [CLKID_MMC_PCLK] = &axg_mmc_pclk.hw,
1946 [CLKID_VPU_INTR] = &axg_vpu_intr.hw,
1947 [CLKID_SEC_AHB_AHB3_BRIDGE] = &axg_sec_ahb_ahb3_bridge.hw,
1948 [CLKID_GIC] = &axg_gic.hw,
1949 [CLKID_AO_MEDIA_CPU] = &axg_ao_media_cpu.hw,
1950 [CLKID_AO_AHB_SRAM] = &axg_ao_ahb_sram.hw,
1951 [CLKID_AO_AHB_BUS] = &axg_ao_ahb_bus.hw,
1952 [CLKID_AO_IFACE] = &axg_ao_iface.hw,
1953 [CLKID_AO_I2C] = &axg_ao_i2c.hw,
1954 [CLKID_SD_EMMC_B_CLK0_SEL] = &axg_sd_emmc_b_clk0_sel.hw,
1955 [CLKID_SD_EMMC_B_CLK0_DIV] = &axg_sd_emmc_b_clk0_div.hw,
1956 [CLKID_SD_EMMC_B_CLK0] = &axg_sd_emmc_b_clk0.hw,
1957 [CLKID_SD_EMMC_C_CLK0_SEL] = &axg_sd_emmc_c_clk0_sel.hw,
1958 [CLKID_SD_EMMC_C_CLK0_DIV] = &axg_sd_emmc_c_clk0_div.hw,
1959 [CLKID_SD_EMMC_C_CLK0] = &axg_sd_emmc_c_clk0.hw,
1960 [CLKID_MPLL0_DIV] = &axg_mpll0_div.hw,
1961 [CLKID_MPLL1_DIV] = &axg_mpll1_div.hw,
1962 [CLKID_MPLL2_DIV] = &axg_mpll2_div.hw,
1963 [CLKID_MPLL3_DIV] = &axg_mpll3_div.hw,
1964 [CLKID_HIFI_PLL] = &axg_hifi_pll.hw,
1965 [CLKID_MPLL_PREDIV] = &axg_mpll_prediv.hw,
1966 [CLKID_FCLK_DIV2_DIV] = &axg_fclk_div2_div.hw,
1967 [CLKID_FCLK_DIV3_DIV] = &axg_fclk_div3_div.hw,
1968 [CLKID_FCLK_DIV4_DIV] = &axg_fclk_div4_div.hw,
1969 [CLKID_FCLK_DIV5_DIV] = &axg_fclk_div5_div.hw,
1970 [CLKID_FCLK_DIV7_DIV] = &axg_fclk_div7_div.hw,
1971 [CLKID_PCIE_PLL] = &axg_pcie_pll.hw,
1972 [CLKID_PCIE_MUX] = &axg_pcie_mux.hw,
1973 [CLKID_PCIE_REF] = &axg_pcie_ref.hw,
1974 [CLKID_PCIE_CML_EN0] = &axg_pcie_cml_en0.hw,
1975 [CLKID_PCIE_CML_EN1] = &axg_pcie_cml_en1.hw,
1976 [CLKID_GEN_CLK_SEL] = &axg_gen_clk_sel.hw,
1977 [CLKID_GEN_CLK_DIV] = &axg_gen_clk_div.hw,
1978 [CLKID_GEN_CLK] = &axg_gen_clk.hw,
1979 [CLKID_SYS_PLL_DCO] = &axg_sys_pll_dco.hw,
1980 [CLKID_FIXED_PLL_DCO] = &axg_fixed_pll_dco.hw,
1981 [CLKID_GP0_PLL_DCO] = &axg_gp0_pll_dco.hw,
1982 [CLKID_HIFI_PLL_DCO] = &axg_hifi_pll_dco.hw,
1983 [CLKID_PCIE_PLL_DCO] = &axg_pcie_pll_dco.hw,
1984 [CLKID_PCIE_PLL_OD] = &axg_pcie_pll_od.hw,
1985 [CLKID_VPU_0_DIV] = &axg_vpu_0_div.hw,
1986 [CLKID_VPU_0_SEL] = &axg_vpu_0_sel.hw,
1987 [CLKID_VPU_0] = &axg_vpu_0.hw,
1988 [CLKID_VPU_1_DIV] = &axg_vpu_1_div.hw,
1989 [CLKID_VPU_1_SEL] = &axg_vpu_1_sel.hw,
1990 [CLKID_VPU_1] = &axg_vpu_1.hw,
1991 [CLKID_VPU] = &axg_vpu.hw,
1992 [CLKID_VAPB_0_DIV] = &axg_vapb_0_div.hw,
1993 [CLKID_VAPB_0_SEL] = &axg_vapb_0_sel.hw,
1994 [CLKID_VAPB_0] = &axg_vapb_0.hw,
1995 [CLKID_VAPB_1_DIV] = &axg_vapb_1_div.hw,
1996 [CLKID_VAPB_1_SEL] = &axg_vapb_1_sel.hw,
1997 [CLKID_VAPB_1] = &axg_vapb_1.hw,
1998 [CLKID_VAPB_SEL] = &axg_vapb_sel.hw,
1999 [CLKID_VAPB] = &axg_vapb.hw,
2000 [CLKID_VCLK] = &axg_vclk.hw,
2001 [CLKID_VCLK2] = &axg_vclk2.hw,
2002 [CLKID_VCLK_SEL] = &axg_vclk_sel.hw,
2003 [CLKID_VCLK2_SEL] = &axg_vclk2_sel.hw,
2004 [CLKID_VCLK_INPUT] = &axg_vclk_input.hw,
2005 [CLKID_VCLK2_INPUT] = &axg_vclk2_input.hw,
2006 [CLKID_VCLK_DIV] = &axg_vclk_div.hw,
2007 [CLKID_VCLK2_DIV] = &axg_vclk2_div.hw,
2008 [CLKID_VCLK_DIV2_EN] = &axg_vclk_div2_en.hw,
2009 [CLKID_VCLK_DIV4_EN] = &axg_vclk_div4_en.hw,
2010 [CLKID_VCLK_DIV6_EN] = &axg_vclk_div6_en.hw,
2011 [CLKID_VCLK_DIV12_EN] = &axg_vclk_div12_en.hw,
2012 [CLKID_VCLK2_DIV2_EN] = &axg_vclk2_div2_en.hw,
2013 [CLKID_VCLK2_DIV4_EN] = &axg_vclk2_div4_en.hw,
2014 [CLKID_VCLK2_DIV6_EN] = &axg_vclk2_div6_en.hw,
2015 [CLKID_VCLK2_DIV12_EN] = &axg_vclk2_div12_en.hw,
2016 [CLKID_VCLK_DIV1] = &axg_vclk_div1.hw,
2017 [CLKID_VCLK_DIV2] = &axg_vclk_div2.hw,
2018 [CLKID_VCLK_DIV4] = &axg_vclk_div4.hw,
2019 [CLKID_VCLK_DIV6] = &axg_vclk_div6.hw,
2020 [CLKID_VCLK_DIV12] = &axg_vclk_div12.hw,
2021 [CLKID_VCLK2_DIV1] = &axg_vclk2_div1.hw,
2022 [CLKID_VCLK2_DIV2] = &axg_vclk2_div2.hw,
2023 [CLKID_VCLK2_DIV4] = &axg_vclk2_div4.hw,
2024 [CLKID_VCLK2_DIV6] = &axg_vclk2_div6.hw,
2025 [CLKID_VCLK2_DIV12] = &axg_vclk2_div12.hw,
2026 [CLKID_CTS_ENCL_SEL] = &axg_cts_encl_sel.hw,
2027 [CLKID_CTS_ENCL] = &axg_cts_encl.hw,
2028 [CLKID_VDIN_MEAS_SEL] = &axg_vdin_meas_sel.hw,
2029 [CLKID_VDIN_MEAS_DIV] = &axg_vdin_meas_div.hw,
2030 [CLKID_VDIN_MEAS] = &axg_vdin_meas.hw,
2031 [NR_CLKS] = NULL,
2032 },
2033 .num = NR_CLKS,
2034 };
2035
2036
2037 static struct clk_regmap *const axg_clk_regmaps[] = {
2038 &axg_clk81,
2039 &axg_ddr,
2040 &axg_audio_locker,
2041 &axg_mipi_dsi_host,
2042 &axg_isa,
2043 &axg_pl301,
2044 &axg_periphs,
2045 &axg_spicc_0,
2046 &axg_i2c,
2047 &axg_rng0,
2048 &axg_uart0,
2049 &axg_mipi_dsi_phy,
2050 &axg_spicc_1,
2051 &axg_pcie_a,
2052 &axg_pcie_b,
2053 &axg_hiu_reg,
2054 &axg_assist_misc,
2055 &axg_emmc_b,
2056 &axg_emmc_c,
2057 &axg_dma,
2058 &axg_spi,
2059 &axg_audio,
2060 &axg_eth_core,
2061 &axg_uart1,
2062 &axg_g2d,
2063 &axg_usb0,
2064 &axg_usb1,
2065 &axg_reset,
2066 &axg_usb_general,
2067 &axg_ahb_arb0,
2068 &axg_efuse,
2069 &axg_boot_rom,
2070 &axg_ahb_data_bus,
2071 &axg_ahb_ctrl_bus,
2072 &axg_usb1_to_ddr,
2073 &axg_usb0_to_ddr,
2074 &axg_mmc_pclk,
2075 &axg_vpu_intr,
2076 &axg_sec_ahb_ahb3_bridge,
2077 &axg_gic,
2078 &axg_ao_media_cpu,
2079 &axg_ao_ahb_sram,
2080 &axg_ao_ahb_bus,
2081 &axg_ao_iface,
2082 &axg_ao_i2c,
2083 &axg_sd_emmc_b_clk0,
2084 &axg_sd_emmc_c_clk0,
2085 &axg_mpeg_clk_div,
2086 &axg_sd_emmc_b_clk0_div,
2087 &axg_sd_emmc_c_clk0_div,
2088 &axg_mpeg_clk_sel,
2089 &axg_sd_emmc_b_clk0_sel,
2090 &axg_sd_emmc_c_clk0_sel,
2091 &axg_mpll0,
2092 &axg_mpll1,
2093 &axg_mpll2,
2094 &axg_mpll3,
2095 &axg_mpll0_div,
2096 &axg_mpll1_div,
2097 &axg_mpll2_div,
2098 &axg_mpll3_div,
2099 &axg_fixed_pll,
2100 &axg_sys_pll,
2101 &axg_gp0_pll,
2102 &axg_hifi_pll,
2103 &axg_mpll_prediv,
2104 &axg_fclk_div2,
2105 &axg_fclk_div3,
2106 &axg_fclk_div4,
2107 &axg_fclk_div5,
2108 &axg_fclk_div7,
2109 &axg_pcie_pll_dco,
2110 &axg_pcie_pll_od,
2111 &axg_pcie_pll,
2112 &axg_pcie_mux,
2113 &axg_pcie_ref,
2114 &axg_pcie_cml_en0,
2115 &axg_pcie_cml_en1,
2116 &axg_gen_clk_sel,
2117 &axg_gen_clk_div,
2118 &axg_gen_clk,
2119 &axg_fixed_pll_dco,
2120 &axg_sys_pll_dco,
2121 &axg_gp0_pll_dco,
2122 &axg_hifi_pll_dco,
2123 &axg_pcie_pll_dco,
2124 &axg_pcie_pll_od,
2125 &axg_vpu_0_div,
2126 &axg_vpu_0_sel,
2127 &axg_vpu_0,
2128 &axg_vpu_1_div,
2129 &axg_vpu_1_sel,
2130 &axg_vpu_1,
2131 &axg_vpu,
2132 &axg_vapb_0_div,
2133 &axg_vapb_0_sel,
2134 &axg_vapb_0,
2135 &axg_vapb_1_div,
2136 &axg_vapb_1_sel,
2137 &axg_vapb_1,
2138 &axg_vapb_sel,
2139 &axg_vapb,
2140 &axg_vclk,
2141 &axg_vclk2,
2142 &axg_vclk_sel,
2143 &axg_vclk2_sel,
2144 &axg_vclk_input,
2145 &axg_vclk2_input,
2146 &axg_vclk_div,
2147 &axg_vclk2_div,
2148 &axg_vclk_div2_en,
2149 &axg_vclk_div4_en,
2150 &axg_vclk_div6_en,
2151 &axg_vclk_div12_en,
2152 &axg_vclk2_div2_en,
2153 &axg_vclk2_div4_en,
2154 &axg_vclk2_div6_en,
2155 &axg_vclk2_div12_en,
2156 &axg_cts_encl_sel,
2157 &axg_cts_encl,
2158 &axg_vdin_meas_sel,
2159 &axg_vdin_meas_div,
2160 &axg_vdin_meas,
2161 };
2162
2163 static const struct meson_eeclkc_data axg_clkc_data = {
2164 .regmap_clks = axg_clk_regmaps,
2165 .regmap_clk_num = ARRAY_SIZE(axg_clk_regmaps),
2166 .hw_onecell_data = &axg_hw_onecell_data,
2167 };
2168
2169
2170 static const struct of_device_id clkc_match_table[] = {
2171 { .compatible = "amlogic,axg-clkc", .data = &axg_clkc_data },
2172 {}
2173 };
2174 MODULE_DEVICE_TABLE(of, clkc_match_table);
2175
2176 static struct platform_driver axg_driver = {
2177 .probe = meson_eeclkc_probe,
2178 .driver = {
2179 .name = "axg-clkc",
2180 .of_match_table = clkc_match_table,
2181 },
2182 };
2183
2184 module_platform_driver(axg_driver);
2185 MODULE_LICENSE("GPL v2");