1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * Copyright (c) 2015 Endless Mobile, Inc. 4 * Author: Carlo Caione <carlo@endlessm.com> 5 * 6 * Copyright (c) 2016 BayLibre, Inc. 7 * Michael Turquette <mturquette@baylibre.com> 8 */ 9 10 #include <linux/clk.h> 11 #include <linux/clk-provider.h> 12 #include <linux/init.h> 13 #include <linux/mfd/syscon.h> 14 #include <linux/of_address.h> 15 #include <linux/reset-controller.h> 16 #include <linux/slab.h> 17 #include <linux/regmap.h> 18 19 #include "meson8b.h" 20 #include "clk-regmap.h" 21 #include "clk-pll.h" 22 #include "clk-mpll.h" 23 24 static DEFINE_SPINLOCK(meson_clk_lock); 25 26 struct meson8b_clk_reset { 27 struct reset_controller_dev reset; 28 struct regmap *regmap; 29 }; 30 31 static const struct pll_params_table sys_pll_params_table[] = { 32 PLL_PARAMS(50, 1), 33 PLL_PARAMS(51, 1), 34 PLL_PARAMS(52, 1), 35 PLL_PARAMS(53, 1), 36 PLL_PARAMS(54, 1), 37 PLL_PARAMS(55, 1), 38 PLL_PARAMS(56, 1), 39 PLL_PARAMS(57, 1), 40 PLL_PARAMS(58, 1), 41 PLL_PARAMS(59, 1), 42 PLL_PARAMS(60, 1), 43 PLL_PARAMS(61, 1), 44 PLL_PARAMS(62, 1), 45 PLL_PARAMS(63, 1), 46 PLL_PARAMS(64, 1), 47 PLL_PARAMS(65, 1), 48 PLL_PARAMS(66, 1), 49 PLL_PARAMS(67, 1), 50 PLL_PARAMS(68, 1), 51 PLL_PARAMS(84, 1), 52 { /* sentinel */ }, 53 }; 54 55 static struct clk_fixed_rate meson8b_xtal = { 56 .fixed_rate = 24000000, 57 .hw.init = &(struct clk_init_data){ 58 .name = "xtal", 59 .num_parents = 0, 60 .ops = &clk_fixed_rate_ops, 61 }, 62 }; 63 64 static struct clk_regmap meson8b_fixed_pll_dco = { 65 .data = &(struct meson_clk_pll_data){ 66 .en = { 67 .reg_off = HHI_MPLL_CNTL, 68 .shift = 30, 69 .width = 1, 70 }, 71 .m = { 72 .reg_off = HHI_MPLL_CNTL, 73 .shift = 0, 74 .width = 9, 75 }, 76 .n = { 77 .reg_off = HHI_MPLL_CNTL, 78 .shift = 9, 79 .width = 5, 80 }, 81 .frac = { 82 .reg_off = HHI_MPLL_CNTL2, 83 .shift = 0, 84 .width = 12, 85 }, 86 .l = { 87 .reg_off = HHI_MPLL_CNTL, 88 .shift = 31, 89 .width = 1, 90 }, 91 .rst = { 92 .reg_off = HHI_MPLL_CNTL, 93 .shift = 29, 94 .width = 1, 95 }, 96 }, 97 .hw.init = &(struct clk_init_data){ 98 .name = "fixed_pll_dco", 99 .ops = &meson_clk_pll_ro_ops, 100 .parent_data = &(const struct clk_parent_data) { 101 .fw_name = "xtal", 102 .name = "xtal", 103 .index = -1, 104 }, 105 .num_parents = 1, 106 }, 107 }; 108 109 static struct clk_regmap meson8b_fixed_pll = { 110 .data = &(struct clk_regmap_div_data){ 111 .offset = HHI_MPLL_CNTL, 112 .shift = 16, 113 .width = 2, 114 .flags = CLK_DIVIDER_POWER_OF_TWO, 115 }, 116 .hw.init = &(struct clk_init_data){ 117 .name = "fixed_pll", 118 .ops = &clk_regmap_divider_ro_ops, 119 .parent_hws = (const struct clk_hw *[]) { 120 &meson8b_fixed_pll_dco.hw 121 }, 122 .num_parents = 1, 123 /* 124 * This clock won't ever change at runtime so 125 * CLK_SET_RATE_PARENT is not required 126 */ 127 }, 128 }; 129 130 static struct clk_regmap meson8b_hdmi_pll_dco = { 131 .data = &(struct meson_clk_pll_data){ 132 .en = { 133 .reg_off = HHI_VID_PLL_CNTL, 134 .shift = 30, 135 .width = 1, 136 }, 137 .m = { 138 .reg_off = HHI_VID_PLL_CNTL, 139 .shift = 0, 140 .width = 9, 141 }, 142 .n = { 143 .reg_off = HHI_VID_PLL_CNTL, 144 .shift = 10, 145 .width = 5, 146 }, 147 .frac = { 148 .reg_off = HHI_VID_PLL_CNTL2, 149 .shift = 0, 150 .width = 12, 151 }, 152 .l = { 153 .reg_off = HHI_VID_PLL_CNTL, 154 .shift = 31, 155 .width = 1, 156 }, 157 .rst = { 158 .reg_off = HHI_VID_PLL_CNTL, 159 .shift = 29, 160 .width = 1, 161 }, 162 }, 163 .hw.init = &(struct clk_init_data){ 164 /* sometimes also called "HPLL" or "HPLL PLL" */ 165 .name = "hdmi_pll_dco", 166 .ops = &meson_clk_pll_ro_ops, 167 .parent_data = &(const struct clk_parent_data) { 168 .fw_name = "xtal", 169 .name = "xtal", 170 .index = -1, 171 }, 172 .num_parents = 1, 173 }, 174 }; 175 176 static struct clk_regmap meson8b_hdmi_pll_lvds_out = { 177 .data = &(struct clk_regmap_div_data){ 178 .offset = HHI_VID_PLL_CNTL, 179 .shift = 16, 180 .width = 2, 181 .flags = CLK_DIVIDER_POWER_OF_TWO, 182 }, 183 .hw.init = &(struct clk_init_data){ 184 .name = "hdmi_pll_lvds_out", 185 .ops = &clk_regmap_divider_ro_ops, 186 .parent_hws = (const struct clk_hw *[]) { 187 &meson8b_hdmi_pll_dco.hw 188 }, 189 .num_parents = 1, 190 .flags = CLK_SET_RATE_PARENT, 191 }, 192 }; 193 194 static struct clk_regmap meson8b_hdmi_pll_hdmi_out = { 195 .data = &(struct clk_regmap_div_data){ 196 .offset = HHI_VID_PLL_CNTL, 197 .shift = 18, 198 .width = 2, 199 .flags = CLK_DIVIDER_POWER_OF_TWO, 200 }, 201 .hw.init = &(struct clk_init_data){ 202 .name = "hdmi_pll_hdmi_out", 203 .ops = &clk_regmap_divider_ro_ops, 204 .parent_hws = (const struct clk_hw *[]) { 205 &meson8b_hdmi_pll_dco.hw 206 }, 207 .num_parents = 1, 208 .flags = CLK_SET_RATE_PARENT, 209 }, 210 }; 211 212 static struct clk_regmap meson8b_sys_pll_dco = { 213 .data = &(struct meson_clk_pll_data){ 214 .en = { 215 .reg_off = HHI_SYS_PLL_CNTL, 216 .shift = 30, 217 .width = 1, 218 }, 219 .m = { 220 .reg_off = HHI_SYS_PLL_CNTL, 221 .shift = 0, 222 .width = 9, 223 }, 224 .n = { 225 .reg_off = HHI_SYS_PLL_CNTL, 226 .shift = 9, 227 .width = 5, 228 }, 229 .l = { 230 .reg_off = HHI_SYS_PLL_CNTL, 231 .shift = 31, 232 .width = 1, 233 }, 234 .rst = { 235 .reg_off = HHI_SYS_PLL_CNTL, 236 .shift = 29, 237 .width = 1, 238 }, 239 .table = sys_pll_params_table, 240 }, 241 .hw.init = &(struct clk_init_data){ 242 .name = "sys_pll_dco", 243 .ops = &meson_clk_pll_ops, 244 .parent_data = &(const struct clk_parent_data) { 245 .fw_name = "xtal", 246 .name = "xtal", 247 .index = -1, 248 }, 249 .num_parents = 1, 250 }, 251 }; 252 253 static struct clk_regmap meson8b_sys_pll = { 254 .data = &(struct clk_regmap_div_data){ 255 .offset = HHI_SYS_PLL_CNTL, 256 .shift = 16, 257 .width = 2, 258 .flags = CLK_DIVIDER_POWER_OF_TWO, 259 }, 260 .hw.init = &(struct clk_init_data){ 261 .name = "sys_pll", 262 .ops = &clk_regmap_divider_ops, 263 .parent_hws = (const struct clk_hw *[]) { 264 &meson8b_sys_pll_dco.hw 265 }, 266 .num_parents = 1, 267 .flags = CLK_SET_RATE_PARENT, 268 }, 269 }; 270 271 static struct clk_fixed_factor meson8b_fclk_div2_div = { 272 .mult = 1, 273 .div = 2, 274 .hw.init = &(struct clk_init_data){ 275 .name = "fclk_div2_div", 276 .ops = &clk_fixed_factor_ops, 277 .parent_hws = (const struct clk_hw *[]) { 278 &meson8b_fixed_pll.hw 279 }, 280 .num_parents = 1, 281 }, 282 }; 283 284 static struct clk_regmap meson8b_fclk_div2 = { 285 .data = &(struct clk_regmap_gate_data){ 286 .offset = HHI_MPLL_CNTL6, 287 .bit_idx = 27, 288 }, 289 .hw.init = &(struct clk_init_data){ 290 .name = "fclk_div2", 291 .ops = &clk_regmap_gate_ops, 292 .parent_hws = (const struct clk_hw *[]) { 293 &meson8b_fclk_div2_div.hw 294 }, 295 .num_parents = 1, 296 /* 297 * FIXME: Ethernet with a RGMII PHYs is not working if 298 * fclk_div2 is disabled. it is currently unclear why this 299 * is. keep it enabled until the Ethernet driver knows how 300 * to manage this clock. 301 */ 302 .flags = CLK_IS_CRITICAL, 303 }, 304 }; 305 306 static struct clk_fixed_factor meson8b_fclk_div3_div = { 307 .mult = 1, 308 .div = 3, 309 .hw.init = &(struct clk_init_data){ 310 .name = "fclk_div3_div", 311 .ops = &clk_fixed_factor_ops, 312 .parent_hws = (const struct clk_hw *[]) { 313 &meson8b_fixed_pll.hw 314 }, 315 .num_parents = 1, 316 }, 317 }; 318 319 static struct clk_regmap meson8b_fclk_div3 = { 320 .data = &(struct clk_regmap_gate_data){ 321 .offset = HHI_MPLL_CNTL6, 322 .bit_idx = 28, 323 }, 324 .hw.init = &(struct clk_init_data){ 325 .name = "fclk_div3", 326 .ops = &clk_regmap_gate_ops, 327 .parent_hws = (const struct clk_hw *[]) { 328 &meson8b_fclk_div3_div.hw 329 }, 330 .num_parents = 1, 331 }, 332 }; 333 334 static struct clk_fixed_factor meson8b_fclk_div4_div = { 335 .mult = 1, 336 .div = 4, 337 .hw.init = &(struct clk_init_data){ 338 .name = "fclk_div4_div", 339 .ops = &clk_fixed_factor_ops, 340 .parent_hws = (const struct clk_hw *[]) { 341 &meson8b_fixed_pll.hw 342 }, 343 .num_parents = 1, 344 }, 345 }; 346 347 static struct clk_regmap meson8b_fclk_div4 = { 348 .data = &(struct clk_regmap_gate_data){ 349 .offset = HHI_MPLL_CNTL6, 350 .bit_idx = 29, 351 }, 352 .hw.init = &(struct clk_init_data){ 353 .name = "fclk_div4", 354 .ops = &clk_regmap_gate_ops, 355 .parent_hws = (const struct clk_hw *[]) { 356 &meson8b_fclk_div4_div.hw 357 }, 358 .num_parents = 1, 359 }, 360 }; 361 362 static struct clk_fixed_factor meson8b_fclk_div5_div = { 363 .mult = 1, 364 .div = 5, 365 .hw.init = &(struct clk_init_data){ 366 .name = "fclk_div5_div", 367 .ops = &clk_fixed_factor_ops, 368 .parent_hws = (const struct clk_hw *[]) { 369 &meson8b_fixed_pll.hw 370 }, 371 .num_parents = 1, 372 }, 373 }; 374 375 static struct clk_regmap meson8b_fclk_div5 = { 376 .data = &(struct clk_regmap_gate_data){ 377 .offset = HHI_MPLL_CNTL6, 378 .bit_idx = 30, 379 }, 380 .hw.init = &(struct clk_init_data){ 381 .name = "fclk_div5", 382 .ops = &clk_regmap_gate_ops, 383 .parent_hws = (const struct clk_hw *[]) { 384 &meson8b_fclk_div5_div.hw 385 }, 386 .num_parents = 1, 387 }, 388 }; 389 390 static struct clk_fixed_factor meson8b_fclk_div7_div = { 391 .mult = 1, 392 .div = 7, 393 .hw.init = &(struct clk_init_data){ 394 .name = "fclk_div7_div", 395 .ops = &clk_fixed_factor_ops, 396 .parent_hws = (const struct clk_hw *[]) { 397 &meson8b_fixed_pll.hw 398 }, 399 .num_parents = 1, 400 }, 401 }; 402 403 static struct clk_regmap meson8b_fclk_div7 = { 404 .data = &(struct clk_regmap_gate_data){ 405 .offset = HHI_MPLL_CNTL6, 406 .bit_idx = 31, 407 }, 408 .hw.init = &(struct clk_init_data){ 409 .name = "fclk_div7", 410 .ops = &clk_regmap_gate_ops, 411 .parent_hws = (const struct clk_hw *[]) { 412 &meson8b_fclk_div7_div.hw 413 }, 414 .num_parents = 1, 415 }, 416 }; 417 418 static struct clk_regmap meson8b_mpll_prediv = { 419 .data = &(struct clk_regmap_div_data){ 420 .offset = HHI_MPLL_CNTL5, 421 .shift = 12, 422 .width = 1, 423 }, 424 .hw.init = &(struct clk_init_data){ 425 .name = "mpll_prediv", 426 .ops = &clk_regmap_divider_ro_ops, 427 .parent_hws = (const struct clk_hw *[]) { 428 &meson8b_fixed_pll.hw 429 }, 430 .num_parents = 1, 431 }, 432 }; 433 434 static struct clk_regmap meson8b_mpll0_div = { 435 .data = &(struct meson_clk_mpll_data){ 436 .sdm = { 437 .reg_off = HHI_MPLL_CNTL7, 438 .shift = 0, 439 .width = 14, 440 }, 441 .sdm_en = { 442 .reg_off = HHI_MPLL_CNTL7, 443 .shift = 15, 444 .width = 1, 445 }, 446 .n2 = { 447 .reg_off = HHI_MPLL_CNTL7, 448 .shift = 16, 449 .width = 9, 450 }, 451 .ssen = { 452 .reg_off = HHI_MPLL_CNTL, 453 .shift = 25, 454 .width = 1, 455 }, 456 .lock = &meson_clk_lock, 457 }, 458 .hw.init = &(struct clk_init_data){ 459 .name = "mpll0_div", 460 .ops = &meson_clk_mpll_ops, 461 .parent_hws = (const struct clk_hw *[]) { 462 &meson8b_mpll_prediv.hw 463 }, 464 .num_parents = 1, 465 }, 466 }; 467 468 static struct clk_regmap meson8b_mpll0 = { 469 .data = &(struct clk_regmap_gate_data){ 470 .offset = HHI_MPLL_CNTL7, 471 .bit_idx = 14, 472 }, 473 .hw.init = &(struct clk_init_data){ 474 .name = "mpll0", 475 .ops = &clk_regmap_gate_ops, 476 .parent_hws = (const struct clk_hw *[]) { 477 &meson8b_mpll0_div.hw 478 }, 479 .num_parents = 1, 480 .flags = CLK_SET_RATE_PARENT, 481 }, 482 }; 483 484 static struct clk_regmap meson8b_mpll1_div = { 485 .data = &(struct meson_clk_mpll_data){ 486 .sdm = { 487 .reg_off = HHI_MPLL_CNTL8, 488 .shift = 0, 489 .width = 14, 490 }, 491 .sdm_en = { 492 .reg_off = HHI_MPLL_CNTL8, 493 .shift = 15, 494 .width = 1, 495 }, 496 .n2 = { 497 .reg_off = HHI_MPLL_CNTL8, 498 .shift = 16, 499 .width = 9, 500 }, 501 .lock = &meson_clk_lock, 502 }, 503 .hw.init = &(struct clk_init_data){ 504 .name = "mpll1_div", 505 .ops = &meson_clk_mpll_ops, 506 .parent_hws = (const struct clk_hw *[]) { 507 &meson8b_mpll_prediv.hw 508 }, 509 .num_parents = 1, 510 }, 511 }; 512 513 static struct clk_regmap meson8b_mpll1 = { 514 .data = &(struct clk_regmap_gate_data){ 515 .offset = HHI_MPLL_CNTL8, 516 .bit_idx = 14, 517 }, 518 .hw.init = &(struct clk_init_data){ 519 .name = "mpll1", 520 .ops = &clk_regmap_gate_ops, 521 .parent_hws = (const struct clk_hw *[]) { 522 &meson8b_mpll1_div.hw 523 }, 524 .num_parents = 1, 525 .flags = CLK_SET_RATE_PARENT, 526 }, 527 }; 528 529 static struct clk_regmap meson8b_mpll2_div = { 530 .data = &(struct meson_clk_mpll_data){ 531 .sdm = { 532 .reg_off = HHI_MPLL_CNTL9, 533 .shift = 0, 534 .width = 14, 535 }, 536 .sdm_en = { 537 .reg_off = HHI_MPLL_CNTL9, 538 .shift = 15, 539 .width = 1, 540 }, 541 .n2 = { 542 .reg_off = HHI_MPLL_CNTL9, 543 .shift = 16, 544 .width = 9, 545 }, 546 .lock = &meson_clk_lock, 547 }, 548 .hw.init = &(struct clk_init_data){ 549 .name = "mpll2_div", 550 .ops = &meson_clk_mpll_ops, 551 .parent_hws = (const struct clk_hw *[]) { 552 &meson8b_mpll_prediv.hw 553 }, 554 .num_parents = 1, 555 }, 556 }; 557 558 static struct clk_regmap meson8b_mpll2 = { 559 .data = &(struct clk_regmap_gate_data){ 560 .offset = HHI_MPLL_CNTL9, 561 .bit_idx = 14, 562 }, 563 .hw.init = &(struct clk_init_data){ 564 .name = "mpll2", 565 .ops = &clk_regmap_gate_ops, 566 .parent_hws = (const struct clk_hw *[]) { 567 &meson8b_mpll2_div.hw 568 }, 569 .num_parents = 1, 570 .flags = CLK_SET_RATE_PARENT, 571 }, 572 }; 573 574 static u32 mux_table_clk81[] = { 6, 5, 7 }; 575 static struct clk_regmap meson8b_mpeg_clk_sel = { 576 .data = &(struct clk_regmap_mux_data){ 577 .offset = HHI_MPEG_CLK_CNTL, 578 .mask = 0x7, 579 .shift = 12, 580 .table = mux_table_clk81, 581 }, 582 .hw.init = &(struct clk_init_data){ 583 .name = "mpeg_clk_sel", 584 .ops = &clk_regmap_mux_ro_ops, 585 /* 586 * FIXME bits 14:12 selects from 8 possible parents: 587 * xtal, 1'b0 (wtf), fclk_div7, mpll_clkout1, mpll_clkout2, 588 * fclk_div4, fclk_div3, fclk_div5 589 */ 590 .parent_hws = (const struct clk_hw *[]) { 591 &meson8b_fclk_div3.hw, 592 &meson8b_fclk_div4.hw, 593 &meson8b_fclk_div5.hw, 594 }, 595 .num_parents = 3, 596 }, 597 }; 598 599 static struct clk_regmap meson8b_mpeg_clk_div = { 600 .data = &(struct clk_regmap_div_data){ 601 .offset = HHI_MPEG_CLK_CNTL, 602 .shift = 0, 603 .width = 7, 604 }, 605 .hw.init = &(struct clk_init_data){ 606 .name = "mpeg_clk_div", 607 .ops = &clk_regmap_divider_ro_ops, 608 .parent_hws = (const struct clk_hw *[]) { 609 &meson8b_mpeg_clk_sel.hw 610 }, 611 .num_parents = 1, 612 }, 613 }; 614 615 static struct clk_regmap meson8b_clk81 = { 616 .data = &(struct clk_regmap_gate_data){ 617 .offset = HHI_MPEG_CLK_CNTL, 618 .bit_idx = 7, 619 }, 620 .hw.init = &(struct clk_init_data){ 621 .name = "clk81", 622 .ops = &clk_regmap_gate_ops, 623 .parent_hws = (const struct clk_hw *[]) { 624 &meson8b_mpeg_clk_div.hw 625 }, 626 .num_parents = 1, 627 .flags = CLK_IS_CRITICAL, 628 }, 629 }; 630 631 static struct clk_regmap meson8b_cpu_in_sel = { 632 .data = &(struct clk_regmap_mux_data){ 633 .offset = HHI_SYS_CPU_CLK_CNTL0, 634 .mask = 0x1, 635 .shift = 0, 636 }, 637 .hw.init = &(struct clk_init_data){ 638 .name = "cpu_in_sel", 639 .ops = &clk_regmap_mux_ops, 640 .parent_data = (const struct clk_parent_data[]) { 641 { .fw_name = "xtal", .name = "xtal", .index = -1, }, 642 { .hw = &meson8b_sys_pll.hw, }, 643 }, 644 .num_parents = 2, 645 .flags = (CLK_SET_RATE_PARENT | 646 CLK_SET_RATE_NO_REPARENT), 647 }, 648 }; 649 650 static struct clk_fixed_factor meson8b_cpu_in_div2 = { 651 .mult = 1, 652 .div = 2, 653 .hw.init = &(struct clk_init_data){ 654 .name = "cpu_in_div2", 655 .ops = &clk_fixed_factor_ops, 656 .parent_hws = (const struct clk_hw *[]) { 657 &meson8b_cpu_in_sel.hw 658 }, 659 .num_parents = 1, 660 .flags = CLK_SET_RATE_PARENT, 661 }, 662 }; 663 664 static struct clk_fixed_factor meson8b_cpu_in_div3 = { 665 .mult = 1, 666 .div = 3, 667 .hw.init = &(struct clk_init_data){ 668 .name = "cpu_in_div3", 669 .ops = &clk_fixed_factor_ops, 670 .parent_hws = (const struct clk_hw *[]) { 671 &meson8b_cpu_in_sel.hw 672 }, 673 .num_parents = 1, 674 .flags = CLK_SET_RATE_PARENT, 675 }, 676 }; 677 678 static const struct clk_div_table cpu_scale_table[] = { 679 { .val = 1, .div = 4 }, 680 { .val = 2, .div = 6 }, 681 { .val = 3, .div = 8 }, 682 { .val = 4, .div = 10 }, 683 { .val = 5, .div = 12 }, 684 { .val = 6, .div = 14 }, 685 { .val = 7, .div = 16 }, 686 { .val = 8, .div = 18 }, 687 { /* sentinel */ }, 688 }; 689 690 static struct clk_regmap meson8b_cpu_scale_div = { 691 .data = &(struct clk_regmap_div_data){ 692 .offset = HHI_SYS_CPU_CLK_CNTL1, 693 .shift = 20, 694 .width = 10, 695 .table = cpu_scale_table, 696 .flags = CLK_DIVIDER_ALLOW_ZERO, 697 }, 698 .hw.init = &(struct clk_init_data){ 699 .name = "cpu_scale_div", 700 .ops = &clk_regmap_divider_ops, 701 .parent_hws = (const struct clk_hw *[]) { 702 &meson8b_cpu_in_sel.hw 703 }, 704 .num_parents = 1, 705 .flags = CLK_SET_RATE_PARENT, 706 }, 707 }; 708 709 static u32 mux_table_cpu_scale_out_sel[] = { 0, 1, 3 }; 710 static struct clk_regmap meson8b_cpu_scale_out_sel = { 711 .data = &(struct clk_regmap_mux_data){ 712 .offset = HHI_SYS_CPU_CLK_CNTL0, 713 .mask = 0x3, 714 .shift = 2, 715 .table = mux_table_cpu_scale_out_sel, 716 }, 717 .hw.init = &(struct clk_init_data){ 718 .name = "cpu_scale_out_sel", 719 .ops = &clk_regmap_mux_ops, 720 /* 721 * NOTE: We are skipping the parent with value 0x2 (which is 722 * meson8b_cpu_in_div3) because it results in a duty cycle of 723 * 33% which makes the system unstable and can result in a 724 * lockup of the whole system. 725 */ 726 .parent_hws = (const struct clk_hw *[]) { 727 &meson8b_cpu_in_sel.hw, 728 &meson8b_cpu_in_div2.hw, 729 &meson8b_cpu_scale_div.hw, 730 }, 731 .num_parents = 3, 732 .flags = CLK_SET_RATE_PARENT, 733 }, 734 }; 735 736 static struct clk_regmap meson8b_cpu_clk = { 737 .data = &(struct clk_regmap_mux_data){ 738 .offset = HHI_SYS_CPU_CLK_CNTL0, 739 .mask = 0x1, 740 .shift = 7, 741 }, 742 .hw.init = &(struct clk_init_data){ 743 .name = "cpu_clk", 744 .ops = &clk_regmap_mux_ops, 745 .parent_data = (const struct clk_parent_data[]) { 746 { .fw_name = "xtal", .name = "xtal", .index = -1, }, 747 { .hw = &meson8b_cpu_scale_out_sel.hw, }, 748 }, 749 .num_parents = 2, 750 .flags = (CLK_SET_RATE_PARENT | 751 CLK_SET_RATE_NO_REPARENT | 752 CLK_IS_CRITICAL), 753 }, 754 }; 755 756 static struct clk_regmap meson8b_nand_clk_sel = { 757 .data = &(struct clk_regmap_mux_data){ 758 .offset = HHI_NAND_CLK_CNTL, 759 .mask = 0x7, 760 .shift = 9, 761 .flags = CLK_MUX_ROUND_CLOSEST, 762 }, 763 .hw.init = &(struct clk_init_data){ 764 .name = "nand_clk_sel", 765 .ops = &clk_regmap_mux_ops, 766 /* FIXME all other parents are unknown: */ 767 .parent_data = (const struct clk_parent_data[]) { 768 { .hw = &meson8b_fclk_div4.hw, }, 769 { .hw = &meson8b_fclk_div3.hw, }, 770 { .hw = &meson8b_fclk_div5.hw, }, 771 { .hw = &meson8b_fclk_div7.hw, }, 772 { .fw_name = "xtal", .name = "xtal", .index = -1, }, 773 }, 774 .num_parents = 5, 775 .flags = CLK_SET_RATE_PARENT, 776 }, 777 }; 778 779 static struct clk_regmap meson8b_nand_clk_div = { 780 .data = &(struct clk_regmap_div_data){ 781 .offset = HHI_NAND_CLK_CNTL, 782 .shift = 0, 783 .width = 7, 784 .flags = CLK_DIVIDER_ROUND_CLOSEST, 785 }, 786 .hw.init = &(struct clk_init_data){ 787 .name = "nand_clk_div", 788 .ops = &clk_regmap_divider_ops, 789 .parent_hws = (const struct clk_hw *[]) { 790 &meson8b_nand_clk_sel.hw 791 }, 792 .num_parents = 1, 793 .flags = CLK_SET_RATE_PARENT, 794 }, 795 }; 796 797 static struct clk_regmap meson8b_nand_clk_gate = { 798 .data = &(struct clk_regmap_gate_data){ 799 .offset = HHI_NAND_CLK_CNTL, 800 .bit_idx = 8, 801 }, 802 .hw.init = &(struct clk_init_data){ 803 .name = "nand_clk_gate", 804 .ops = &clk_regmap_gate_ops, 805 .parent_hws = (const struct clk_hw *[]) { 806 &meson8b_nand_clk_div.hw 807 }, 808 .num_parents = 1, 809 .flags = CLK_SET_RATE_PARENT, 810 }, 811 }; 812 813 static struct clk_fixed_factor meson8b_cpu_clk_div2 = { 814 .mult = 1, 815 .div = 2, 816 .hw.init = &(struct clk_init_data){ 817 .name = "cpu_clk_div2", 818 .ops = &clk_fixed_factor_ops, 819 .parent_hws = (const struct clk_hw *[]) { 820 &meson8b_cpu_clk.hw 821 }, 822 .num_parents = 1, 823 }, 824 }; 825 826 static struct clk_fixed_factor meson8b_cpu_clk_div3 = { 827 .mult = 1, 828 .div = 3, 829 .hw.init = &(struct clk_init_data){ 830 .name = "cpu_clk_div3", 831 .ops = &clk_fixed_factor_ops, 832 .parent_hws = (const struct clk_hw *[]) { 833 &meson8b_cpu_clk.hw 834 }, 835 .num_parents = 1, 836 }, 837 }; 838 839 static struct clk_fixed_factor meson8b_cpu_clk_div4 = { 840 .mult = 1, 841 .div = 4, 842 .hw.init = &(struct clk_init_data){ 843 .name = "cpu_clk_div4", 844 .ops = &clk_fixed_factor_ops, 845 .parent_hws = (const struct clk_hw *[]) { 846 &meson8b_cpu_clk.hw 847 }, 848 .num_parents = 1, 849 }, 850 }; 851 852 static struct clk_fixed_factor meson8b_cpu_clk_div5 = { 853 .mult = 1, 854 .div = 5, 855 .hw.init = &(struct clk_init_data){ 856 .name = "cpu_clk_div5", 857 .ops = &clk_fixed_factor_ops, 858 .parent_hws = (const struct clk_hw *[]) { 859 &meson8b_cpu_clk.hw 860 }, 861 .num_parents = 1, 862 }, 863 }; 864 865 static struct clk_fixed_factor meson8b_cpu_clk_div6 = { 866 .mult = 1, 867 .div = 6, 868 .hw.init = &(struct clk_init_data){ 869 .name = "cpu_clk_div6", 870 .ops = &clk_fixed_factor_ops, 871 .parent_hws = (const struct clk_hw *[]) { 872 &meson8b_cpu_clk.hw 873 }, 874 .num_parents = 1, 875 }, 876 }; 877 878 static struct clk_fixed_factor meson8b_cpu_clk_div7 = { 879 .mult = 1, 880 .div = 7, 881 .hw.init = &(struct clk_init_data){ 882 .name = "cpu_clk_div7", 883 .ops = &clk_fixed_factor_ops, 884 .parent_hws = (const struct clk_hw *[]) { 885 &meson8b_cpu_clk.hw 886 }, 887 .num_parents = 1, 888 }, 889 }; 890 891 static struct clk_fixed_factor meson8b_cpu_clk_div8 = { 892 .mult = 1, 893 .div = 8, 894 .hw.init = &(struct clk_init_data){ 895 .name = "cpu_clk_div8", 896 .ops = &clk_fixed_factor_ops, 897 .parent_hws = (const struct clk_hw *[]) { 898 &meson8b_cpu_clk.hw 899 }, 900 .num_parents = 1, 901 }, 902 }; 903 904 static u32 mux_table_apb[] = { 1, 2, 3, 4, 5, 6, 7 }; 905 static struct clk_regmap meson8b_apb_clk_sel = { 906 .data = &(struct clk_regmap_mux_data){ 907 .offset = HHI_SYS_CPU_CLK_CNTL1, 908 .mask = 0x7, 909 .shift = 3, 910 .table = mux_table_apb, 911 }, 912 .hw.init = &(struct clk_init_data){ 913 .name = "apb_clk_sel", 914 .ops = &clk_regmap_mux_ops, 915 .parent_hws = (const struct clk_hw *[]) { 916 &meson8b_cpu_clk_div2.hw, 917 &meson8b_cpu_clk_div3.hw, 918 &meson8b_cpu_clk_div4.hw, 919 &meson8b_cpu_clk_div5.hw, 920 &meson8b_cpu_clk_div6.hw, 921 &meson8b_cpu_clk_div7.hw, 922 &meson8b_cpu_clk_div8.hw, 923 }, 924 .num_parents = 7, 925 }, 926 }; 927 928 static struct clk_regmap meson8b_apb_clk_gate = { 929 .data = &(struct clk_regmap_gate_data){ 930 .offset = HHI_SYS_CPU_CLK_CNTL1, 931 .bit_idx = 16, 932 .flags = CLK_GATE_SET_TO_DISABLE, 933 }, 934 .hw.init = &(struct clk_init_data){ 935 .name = "apb_clk_dis", 936 .ops = &clk_regmap_gate_ro_ops, 937 .parent_hws = (const struct clk_hw *[]) { 938 &meson8b_apb_clk_sel.hw 939 }, 940 .num_parents = 1, 941 .flags = CLK_SET_RATE_PARENT, 942 }, 943 }; 944 945 static struct clk_regmap meson8b_periph_clk_sel = { 946 .data = &(struct clk_regmap_mux_data){ 947 .offset = HHI_SYS_CPU_CLK_CNTL1, 948 .mask = 0x7, 949 .shift = 6, 950 }, 951 .hw.init = &(struct clk_init_data){ 952 .name = "periph_clk_sel", 953 .ops = &clk_regmap_mux_ops, 954 .parent_hws = (const struct clk_hw *[]) { 955 &meson8b_cpu_clk_div2.hw, 956 &meson8b_cpu_clk_div3.hw, 957 &meson8b_cpu_clk_div4.hw, 958 &meson8b_cpu_clk_div5.hw, 959 &meson8b_cpu_clk_div6.hw, 960 &meson8b_cpu_clk_div7.hw, 961 &meson8b_cpu_clk_div8.hw, 962 }, 963 .num_parents = 7, 964 }, 965 }; 966 967 static struct clk_regmap meson8b_periph_clk_gate = { 968 .data = &(struct clk_regmap_gate_data){ 969 .offset = HHI_SYS_CPU_CLK_CNTL1, 970 .bit_idx = 17, 971 .flags = CLK_GATE_SET_TO_DISABLE, 972 }, 973 .hw.init = &(struct clk_init_data){ 974 .name = "periph_clk_dis", 975 .ops = &clk_regmap_gate_ro_ops, 976 .parent_hws = (const struct clk_hw *[]) { 977 &meson8b_periph_clk_sel.hw 978 }, 979 .num_parents = 1, 980 .flags = CLK_SET_RATE_PARENT, 981 }, 982 }; 983 984 static u32 mux_table_axi[] = { 1, 2, 3, 4, 5, 6, 7 }; 985 static struct clk_regmap meson8b_axi_clk_sel = { 986 .data = &(struct clk_regmap_mux_data){ 987 .offset = HHI_SYS_CPU_CLK_CNTL1, 988 .mask = 0x7, 989 .shift = 9, 990 .table = mux_table_axi, 991 }, 992 .hw.init = &(struct clk_init_data){ 993 .name = "axi_clk_sel", 994 .ops = &clk_regmap_mux_ops, 995 .parent_hws = (const struct clk_hw *[]) { 996 &meson8b_cpu_clk_div2.hw, 997 &meson8b_cpu_clk_div3.hw, 998 &meson8b_cpu_clk_div4.hw, 999 &meson8b_cpu_clk_div5.hw, 1000 &meson8b_cpu_clk_div6.hw, 1001 &meson8b_cpu_clk_div7.hw, 1002 &meson8b_cpu_clk_div8.hw, 1003 }, 1004 .num_parents = 7, 1005 }, 1006 }; 1007 1008 static struct clk_regmap meson8b_axi_clk_gate = { 1009 .data = &(struct clk_regmap_gate_data){ 1010 .offset = HHI_SYS_CPU_CLK_CNTL1, 1011 .bit_idx = 18, 1012 .flags = CLK_GATE_SET_TO_DISABLE, 1013 }, 1014 .hw.init = &(struct clk_init_data){ 1015 .name = "axi_clk_dis", 1016 .ops = &clk_regmap_gate_ro_ops, 1017 .parent_hws = (const struct clk_hw *[]) { 1018 &meson8b_axi_clk_sel.hw 1019 }, 1020 .num_parents = 1, 1021 .flags = CLK_SET_RATE_PARENT, 1022 }, 1023 }; 1024 1025 static struct clk_regmap meson8b_l2_dram_clk_sel = { 1026 .data = &(struct clk_regmap_mux_data){ 1027 .offset = HHI_SYS_CPU_CLK_CNTL1, 1028 .mask = 0x7, 1029 .shift = 12, 1030 }, 1031 .hw.init = &(struct clk_init_data){ 1032 .name = "l2_dram_clk_sel", 1033 .ops = &clk_regmap_mux_ops, 1034 .parent_hws = (const struct clk_hw *[]) { 1035 &meson8b_cpu_clk_div2.hw, 1036 &meson8b_cpu_clk_div3.hw, 1037 &meson8b_cpu_clk_div4.hw, 1038 &meson8b_cpu_clk_div5.hw, 1039 &meson8b_cpu_clk_div6.hw, 1040 &meson8b_cpu_clk_div7.hw, 1041 &meson8b_cpu_clk_div8.hw, 1042 }, 1043 .num_parents = 7, 1044 }, 1045 }; 1046 1047 static struct clk_regmap meson8b_l2_dram_clk_gate = { 1048 .data = &(struct clk_regmap_gate_data){ 1049 .offset = HHI_SYS_CPU_CLK_CNTL1, 1050 .bit_idx = 19, 1051 .flags = CLK_GATE_SET_TO_DISABLE, 1052 }, 1053 .hw.init = &(struct clk_init_data){ 1054 .name = "l2_dram_clk_dis", 1055 .ops = &clk_regmap_gate_ro_ops, 1056 .parent_hws = (const struct clk_hw *[]) { 1057 &meson8b_l2_dram_clk_sel.hw 1058 }, 1059 .num_parents = 1, 1060 .flags = CLK_SET_RATE_PARENT, 1061 }, 1062 }; 1063 1064 static struct clk_regmap meson8b_vid_pll_in_sel = { 1065 .data = &(struct clk_regmap_mux_data){ 1066 .offset = HHI_VID_DIVIDER_CNTL, 1067 .mask = 0x1, 1068 .shift = 15, 1069 }, 1070 .hw.init = &(struct clk_init_data){ 1071 .name = "vid_pll_in_sel", 1072 .ops = &clk_regmap_mux_ro_ops, 1073 /* 1074 * TODO: depending on the SoC there is also a second parent: 1075 * Meson8: unknown 1076 * Meson8b: hdmi_pll_dco 1077 * Meson8m2: vid2_pll 1078 */ 1079 .parent_hws = (const struct clk_hw *[]) { 1080 &meson8b_hdmi_pll_dco.hw 1081 }, 1082 .num_parents = 1, 1083 .flags = CLK_SET_RATE_PARENT, 1084 }, 1085 }; 1086 1087 static struct clk_regmap meson8b_vid_pll_in_en = { 1088 .data = &(struct clk_regmap_gate_data){ 1089 .offset = HHI_VID_DIVIDER_CNTL, 1090 .bit_idx = 16, 1091 }, 1092 .hw.init = &(struct clk_init_data){ 1093 .name = "vid_pll_in_en", 1094 .ops = &clk_regmap_gate_ro_ops, 1095 .parent_hws = (const struct clk_hw *[]) { 1096 &meson8b_vid_pll_in_sel.hw 1097 }, 1098 .num_parents = 1, 1099 .flags = CLK_SET_RATE_PARENT, 1100 }, 1101 }; 1102 1103 static struct clk_regmap meson8b_vid_pll_pre_div = { 1104 .data = &(struct clk_regmap_div_data){ 1105 .offset = HHI_VID_DIVIDER_CNTL, 1106 .shift = 4, 1107 .width = 3, 1108 }, 1109 .hw.init = &(struct clk_init_data){ 1110 .name = "vid_pll_pre_div", 1111 .ops = &clk_regmap_divider_ro_ops, 1112 .parent_hws = (const struct clk_hw *[]) { 1113 &meson8b_vid_pll_in_en.hw 1114 }, 1115 .num_parents = 1, 1116 .flags = CLK_SET_RATE_PARENT, 1117 }, 1118 }; 1119 1120 static struct clk_regmap meson8b_vid_pll_post_div = { 1121 .data = &(struct clk_regmap_div_data){ 1122 .offset = HHI_VID_DIVIDER_CNTL, 1123 .shift = 12, 1124 .width = 3, 1125 }, 1126 .hw.init = &(struct clk_init_data){ 1127 .name = "vid_pll_post_div", 1128 .ops = &clk_regmap_divider_ro_ops, 1129 .parent_hws = (const struct clk_hw *[]) { 1130 &meson8b_vid_pll_pre_div.hw 1131 }, 1132 .num_parents = 1, 1133 .flags = CLK_SET_RATE_PARENT, 1134 }, 1135 }; 1136 1137 static struct clk_regmap meson8b_vid_pll = { 1138 .data = &(struct clk_regmap_mux_data){ 1139 .offset = HHI_VID_DIVIDER_CNTL, 1140 .mask = 0x3, 1141 .shift = 8, 1142 }, 1143 .hw.init = &(struct clk_init_data){ 1144 .name = "vid_pll", 1145 .ops = &clk_regmap_mux_ro_ops, 1146 /* TODO: parent 0x2 is vid_pll_pre_div_mult7_div2 */ 1147 .parent_hws = (const struct clk_hw *[]) { 1148 &meson8b_vid_pll_pre_div.hw, 1149 &meson8b_vid_pll_post_div.hw, 1150 }, 1151 .num_parents = 2, 1152 .flags = CLK_SET_RATE_PARENT, 1153 }, 1154 }; 1155 1156 static struct clk_regmap meson8b_vid_pll_final_div = { 1157 .data = &(struct clk_regmap_div_data){ 1158 .offset = HHI_VID_CLK_DIV, 1159 .shift = 0, 1160 .width = 8, 1161 }, 1162 .hw.init = &(struct clk_init_data){ 1163 .name = "vid_pll_final_div", 1164 .ops = &clk_regmap_divider_ro_ops, 1165 .parent_hws = (const struct clk_hw *[]) { 1166 &meson8b_vid_pll.hw 1167 }, 1168 .num_parents = 1, 1169 .flags = CLK_SET_RATE_PARENT, 1170 }, 1171 }; 1172 1173 static const struct clk_hw *meson8b_vclk_mux_parent_hws[] = { 1174 &meson8b_vid_pll_final_div.hw, 1175 &meson8b_fclk_div4.hw, 1176 &meson8b_fclk_div3.hw, 1177 &meson8b_fclk_div5.hw, 1178 &meson8b_vid_pll_final_div.hw, 1179 &meson8b_fclk_div7.hw, 1180 &meson8b_mpll1.hw, 1181 }; 1182 1183 static struct clk_regmap meson8b_vclk_in_sel = { 1184 .data = &(struct clk_regmap_mux_data){ 1185 .offset = HHI_VID_CLK_CNTL, 1186 .mask = 0x7, 1187 .shift = 16, 1188 }, 1189 .hw.init = &(struct clk_init_data){ 1190 .name = "vclk_in_sel", 1191 .ops = &clk_regmap_mux_ro_ops, 1192 .parent_hws = meson8b_vclk_mux_parent_hws, 1193 .num_parents = ARRAY_SIZE(meson8b_vclk_mux_parent_hws), 1194 .flags = CLK_SET_RATE_PARENT, 1195 }, 1196 }; 1197 1198 static struct clk_regmap meson8b_vclk_in_en = { 1199 .data = &(struct clk_regmap_gate_data){ 1200 .offset = HHI_VID_CLK_DIV, 1201 .bit_idx = 16, 1202 }, 1203 .hw.init = &(struct clk_init_data){ 1204 .name = "vclk_in_en", 1205 .ops = &clk_regmap_gate_ro_ops, 1206 .parent_hws = (const struct clk_hw *[]) { 1207 &meson8b_vclk_in_sel.hw 1208 }, 1209 .num_parents = 1, 1210 .flags = CLK_SET_RATE_PARENT, 1211 }, 1212 }; 1213 1214 static struct clk_regmap meson8b_vclk_div1_gate = { 1215 .data = &(struct clk_regmap_gate_data){ 1216 .offset = HHI_VID_CLK_DIV, 1217 .bit_idx = 0, 1218 }, 1219 .hw.init = &(struct clk_init_data){ 1220 .name = "vclk_div1_en", 1221 .ops = &clk_regmap_gate_ro_ops, 1222 .parent_hws = (const struct clk_hw *[]) { 1223 &meson8b_vclk_in_en.hw 1224 }, 1225 .num_parents = 1, 1226 .flags = CLK_SET_RATE_PARENT, 1227 }, 1228 }; 1229 1230 static struct clk_fixed_factor meson8b_vclk_div2_div = { 1231 .mult = 1, 1232 .div = 2, 1233 .hw.init = &(struct clk_init_data){ 1234 .name = "vclk_div2", 1235 .ops = &clk_fixed_factor_ops, 1236 .parent_hws = (const struct clk_hw *[]) { 1237 &meson8b_vclk_in_en.hw 1238 }, 1239 .num_parents = 1, 1240 .flags = CLK_SET_RATE_PARENT, 1241 } 1242 }; 1243 1244 static struct clk_regmap meson8b_vclk_div2_div_gate = { 1245 .data = &(struct clk_regmap_gate_data){ 1246 .offset = HHI_VID_CLK_DIV, 1247 .bit_idx = 1, 1248 }, 1249 .hw.init = &(struct clk_init_data){ 1250 .name = "vclk_div2_en", 1251 .ops = &clk_regmap_gate_ro_ops, 1252 .parent_hws = (const struct clk_hw *[]) { 1253 &meson8b_vclk_div2_div.hw 1254 }, 1255 .num_parents = 1, 1256 .flags = CLK_SET_RATE_PARENT, 1257 }, 1258 }; 1259 1260 static struct clk_fixed_factor meson8b_vclk_div4_div = { 1261 .mult = 1, 1262 .div = 4, 1263 .hw.init = &(struct clk_init_data){ 1264 .name = "vclk_div4", 1265 .ops = &clk_fixed_factor_ops, 1266 .parent_hws = (const struct clk_hw *[]) { 1267 &meson8b_vclk_in_en.hw 1268 }, 1269 .num_parents = 1, 1270 .flags = CLK_SET_RATE_PARENT, 1271 } 1272 }; 1273 1274 static struct clk_regmap meson8b_vclk_div4_div_gate = { 1275 .data = &(struct clk_regmap_gate_data){ 1276 .offset = HHI_VID_CLK_DIV, 1277 .bit_idx = 2, 1278 }, 1279 .hw.init = &(struct clk_init_data){ 1280 .name = "vclk_div4_en", 1281 .ops = &clk_regmap_gate_ro_ops, 1282 .parent_hws = (const struct clk_hw *[]) { 1283 &meson8b_vclk_div4_div.hw 1284 }, 1285 .num_parents = 1, 1286 .flags = CLK_SET_RATE_PARENT, 1287 }, 1288 }; 1289 1290 static struct clk_fixed_factor meson8b_vclk_div6_div = { 1291 .mult = 1, 1292 .div = 6, 1293 .hw.init = &(struct clk_init_data){ 1294 .name = "vclk_div6", 1295 .ops = &clk_fixed_factor_ops, 1296 .parent_hws = (const struct clk_hw *[]) { 1297 &meson8b_vclk_in_en.hw 1298 }, 1299 .num_parents = 1, 1300 .flags = CLK_SET_RATE_PARENT, 1301 } 1302 }; 1303 1304 static struct clk_regmap meson8b_vclk_div6_div_gate = { 1305 .data = &(struct clk_regmap_gate_data){ 1306 .offset = HHI_VID_CLK_DIV, 1307 .bit_idx = 3, 1308 }, 1309 .hw.init = &(struct clk_init_data){ 1310 .name = "vclk_div6_en", 1311 .ops = &clk_regmap_gate_ro_ops, 1312 .parent_hws = (const struct clk_hw *[]) { 1313 &meson8b_vclk_div6_div.hw 1314 }, 1315 .num_parents = 1, 1316 .flags = CLK_SET_RATE_PARENT, 1317 }, 1318 }; 1319 1320 static struct clk_fixed_factor meson8b_vclk_div12_div = { 1321 .mult = 1, 1322 .div = 12, 1323 .hw.init = &(struct clk_init_data){ 1324 .name = "vclk_div12", 1325 .ops = &clk_fixed_factor_ops, 1326 .parent_hws = (const struct clk_hw *[]) { 1327 &meson8b_vclk_in_en.hw 1328 }, 1329 .num_parents = 1, 1330 .flags = CLK_SET_RATE_PARENT, 1331 } 1332 }; 1333 1334 static struct clk_regmap meson8b_vclk_div12_div_gate = { 1335 .data = &(struct clk_regmap_gate_data){ 1336 .offset = HHI_VID_CLK_DIV, 1337 .bit_idx = 4, 1338 }, 1339 .hw.init = &(struct clk_init_data){ 1340 .name = "vclk_div12_en", 1341 .ops = &clk_regmap_gate_ro_ops, 1342 .parent_hws = (const struct clk_hw *[]) { 1343 &meson8b_vclk_div12_div.hw 1344 }, 1345 .num_parents = 1, 1346 .flags = CLK_SET_RATE_PARENT, 1347 }, 1348 }; 1349 1350 static struct clk_regmap meson8b_vclk2_in_sel = { 1351 .data = &(struct clk_regmap_mux_data){ 1352 .offset = HHI_VIID_CLK_CNTL, 1353 .mask = 0x7, 1354 .shift = 16, 1355 }, 1356 .hw.init = &(struct clk_init_data){ 1357 .name = "vclk2_in_sel", 1358 .ops = &clk_regmap_mux_ro_ops, 1359 .parent_hws = meson8b_vclk_mux_parent_hws, 1360 .num_parents = ARRAY_SIZE(meson8b_vclk_mux_parent_hws), 1361 .flags = CLK_SET_RATE_PARENT, 1362 }, 1363 }; 1364 1365 static struct clk_regmap meson8b_vclk2_clk_in_en = { 1366 .data = &(struct clk_regmap_gate_data){ 1367 .offset = HHI_VIID_CLK_DIV, 1368 .bit_idx = 16, 1369 }, 1370 .hw.init = &(struct clk_init_data){ 1371 .name = "vclk2_in_en", 1372 .ops = &clk_regmap_gate_ro_ops, 1373 .parent_hws = (const struct clk_hw *[]) { 1374 &meson8b_vclk2_in_sel.hw 1375 }, 1376 .num_parents = 1, 1377 .flags = CLK_SET_RATE_PARENT, 1378 }, 1379 }; 1380 1381 static struct clk_regmap meson8b_vclk2_div1_gate = { 1382 .data = &(struct clk_regmap_gate_data){ 1383 .offset = HHI_VIID_CLK_DIV, 1384 .bit_idx = 0, 1385 }, 1386 .hw.init = &(struct clk_init_data){ 1387 .name = "vclk2_div1_en", 1388 .ops = &clk_regmap_gate_ro_ops, 1389 .parent_hws = (const struct clk_hw *[]) { 1390 &meson8b_vclk2_clk_in_en.hw 1391 }, 1392 .num_parents = 1, 1393 .flags = CLK_SET_RATE_PARENT, 1394 }, 1395 }; 1396 1397 static struct clk_fixed_factor meson8b_vclk2_div2_div = { 1398 .mult = 1, 1399 .div = 2, 1400 .hw.init = &(struct clk_init_data){ 1401 .name = "vclk2_div2", 1402 .ops = &clk_fixed_factor_ops, 1403 .parent_hws = (const struct clk_hw *[]) { 1404 &meson8b_vclk2_clk_in_en.hw 1405 }, 1406 .num_parents = 1, 1407 .flags = CLK_SET_RATE_PARENT, 1408 } 1409 }; 1410 1411 static struct clk_regmap meson8b_vclk2_div2_div_gate = { 1412 .data = &(struct clk_regmap_gate_data){ 1413 .offset = HHI_VIID_CLK_DIV, 1414 .bit_idx = 1, 1415 }, 1416 .hw.init = &(struct clk_init_data){ 1417 .name = "vclk2_div2_en", 1418 .ops = &clk_regmap_gate_ro_ops, 1419 .parent_hws = (const struct clk_hw *[]) { 1420 &meson8b_vclk2_div2_div.hw 1421 }, 1422 .num_parents = 1, 1423 .flags = CLK_SET_RATE_PARENT, 1424 }, 1425 }; 1426 1427 static struct clk_fixed_factor meson8b_vclk2_div4_div = { 1428 .mult = 1, 1429 .div = 4, 1430 .hw.init = &(struct clk_init_data){ 1431 .name = "vclk2_div4", 1432 .ops = &clk_fixed_factor_ops, 1433 .parent_hws = (const struct clk_hw *[]) { 1434 &meson8b_vclk2_clk_in_en.hw 1435 }, 1436 .num_parents = 1, 1437 .flags = CLK_SET_RATE_PARENT, 1438 } 1439 }; 1440 1441 static struct clk_regmap meson8b_vclk2_div4_div_gate = { 1442 .data = &(struct clk_regmap_gate_data){ 1443 .offset = HHI_VIID_CLK_DIV, 1444 .bit_idx = 2, 1445 }, 1446 .hw.init = &(struct clk_init_data){ 1447 .name = "vclk2_div4_en", 1448 .ops = &clk_regmap_gate_ro_ops, 1449 .parent_hws = (const struct clk_hw *[]) { 1450 &meson8b_vclk2_div4_div.hw 1451 }, 1452 .num_parents = 1, 1453 .flags = CLK_SET_RATE_PARENT, 1454 }, 1455 }; 1456 1457 static struct clk_fixed_factor meson8b_vclk2_div6_div = { 1458 .mult = 1, 1459 .div = 6, 1460 .hw.init = &(struct clk_init_data){ 1461 .name = "vclk2_div6", 1462 .ops = &clk_fixed_factor_ops, 1463 .parent_hws = (const struct clk_hw *[]) { 1464 &meson8b_vclk2_clk_in_en.hw 1465 }, 1466 .num_parents = 1, 1467 .flags = CLK_SET_RATE_PARENT, 1468 } 1469 }; 1470 1471 static struct clk_regmap meson8b_vclk2_div6_div_gate = { 1472 .data = &(struct clk_regmap_gate_data){ 1473 .offset = HHI_VIID_CLK_DIV, 1474 .bit_idx = 3, 1475 }, 1476 .hw.init = &(struct clk_init_data){ 1477 .name = "vclk2_div6_en", 1478 .ops = &clk_regmap_gate_ro_ops, 1479 .parent_hws = (const struct clk_hw *[]) { 1480 &meson8b_vclk2_div6_div.hw 1481 }, 1482 .num_parents = 1, 1483 .flags = CLK_SET_RATE_PARENT, 1484 }, 1485 }; 1486 1487 static struct clk_fixed_factor meson8b_vclk2_div12_div = { 1488 .mult = 1, 1489 .div = 12, 1490 .hw.init = &(struct clk_init_data){ 1491 .name = "vclk2_div12", 1492 .ops = &clk_fixed_factor_ops, 1493 .parent_hws = (const struct clk_hw *[]) { 1494 &meson8b_vclk2_clk_in_en.hw 1495 }, 1496 .num_parents = 1, 1497 .flags = CLK_SET_RATE_PARENT, 1498 } 1499 }; 1500 1501 static struct clk_regmap meson8b_vclk2_div12_div_gate = { 1502 .data = &(struct clk_regmap_gate_data){ 1503 .offset = HHI_VIID_CLK_DIV, 1504 .bit_idx = 4, 1505 }, 1506 .hw.init = &(struct clk_init_data){ 1507 .name = "vclk2_div12_en", 1508 .ops = &clk_regmap_gate_ro_ops, 1509 .parent_hws = (const struct clk_hw *[]) { 1510 &meson8b_vclk2_div12_div.hw 1511 }, 1512 .num_parents = 1, 1513 .flags = CLK_SET_RATE_PARENT, 1514 }, 1515 }; 1516 1517 static const struct clk_hw *meson8b_vclk_enc_mux_parent_hws[] = { 1518 &meson8b_vclk_div1_gate.hw, 1519 &meson8b_vclk_div2_div_gate.hw, 1520 &meson8b_vclk_div4_div_gate.hw, 1521 &meson8b_vclk_div6_div_gate.hw, 1522 &meson8b_vclk_div12_div_gate.hw, 1523 }; 1524 1525 static struct clk_regmap meson8b_cts_enct_sel = { 1526 .data = &(struct clk_regmap_mux_data){ 1527 .offset = HHI_VID_CLK_DIV, 1528 .mask = 0xf, 1529 .shift = 20, 1530 }, 1531 .hw.init = &(struct clk_init_data){ 1532 .name = "cts_enct_sel", 1533 .ops = &clk_regmap_mux_ro_ops, 1534 .parent_hws = meson8b_vclk_enc_mux_parent_hws, 1535 .num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parent_hws), 1536 .flags = CLK_SET_RATE_PARENT, 1537 }, 1538 }; 1539 1540 static struct clk_regmap meson8b_cts_enct = { 1541 .data = &(struct clk_regmap_gate_data){ 1542 .offset = HHI_VID_CLK_CNTL2, 1543 .bit_idx = 1, 1544 }, 1545 .hw.init = &(struct clk_init_data){ 1546 .name = "cts_enct", 1547 .ops = &clk_regmap_gate_ro_ops, 1548 .parent_hws = (const struct clk_hw *[]) { 1549 &meson8b_cts_enct_sel.hw 1550 }, 1551 .num_parents = 1, 1552 .flags = CLK_SET_RATE_PARENT, 1553 }, 1554 }; 1555 1556 static struct clk_regmap meson8b_cts_encp_sel = { 1557 .data = &(struct clk_regmap_mux_data){ 1558 .offset = HHI_VID_CLK_DIV, 1559 .mask = 0xf, 1560 .shift = 24, 1561 }, 1562 .hw.init = &(struct clk_init_data){ 1563 .name = "cts_encp_sel", 1564 .ops = &clk_regmap_mux_ro_ops, 1565 .parent_hws = meson8b_vclk_enc_mux_parent_hws, 1566 .num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parent_hws), 1567 .flags = CLK_SET_RATE_PARENT, 1568 }, 1569 }; 1570 1571 static struct clk_regmap meson8b_cts_encp = { 1572 .data = &(struct clk_regmap_gate_data){ 1573 .offset = HHI_VID_CLK_CNTL2, 1574 .bit_idx = 2, 1575 }, 1576 .hw.init = &(struct clk_init_data){ 1577 .name = "cts_encp", 1578 .ops = &clk_regmap_gate_ro_ops, 1579 .parent_hws = (const struct clk_hw *[]) { 1580 &meson8b_cts_encp_sel.hw 1581 }, 1582 .num_parents = 1, 1583 .flags = CLK_SET_RATE_PARENT, 1584 }, 1585 }; 1586 1587 static struct clk_regmap meson8b_cts_enci_sel = { 1588 .data = &(struct clk_regmap_mux_data){ 1589 .offset = HHI_VID_CLK_DIV, 1590 .mask = 0xf, 1591 .shift = 28, 1592 }, 1593 .hw.init = &(struct clk_init_data){ 1594 .name = "cts_enci_sel", 1595 .ops = &clk_regmap_mux_ro_ops, 1596 .parent_hws = meson8b_vclk_enc_mux_parent_hws, 1597 .num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parent_hws), 1598 .flags = CLK_SET_RATE_PARENT, 1599 }, 1600 }; 1601 1602 static struct clk_regmap meson8b_cts_enci = { 1603 .data = &(struct clk_regmap_gate_data){ 1604 .offset = HHI_VID_CLK_CNTL2, 1605 .bit_idx = 0, 1606 }, 1607 .hw.init = &(struct clk_init_data){ 1608 .name = "cts_enci", 1609 .ops = &clk_regmap_gate_ro_ops, 1610 .parent_hws = (const struct clk_hw *[]) { 1611 &meson8b_cts_enci_sel.hw 1612 }, 1613 .num_parents = 1, 1614 .flags = CLK_SET_RATE_PARENT, 1615 }, 1616 }; 1617 1618 static struct clk_regmap meson8b_hdmi_tx_pixel_sel = { 1619 .data = &(struct clk_regmap_mux_data){ 1620 .offset = HHI_HDMI_CLK_CNTL, 1621 .mask = 0xf, 1622 .shift = 16, 1623 }, 1624 .hw.init = &(struct clk_init_data){ 1625 .name = "hdmi_tx_pixel_sel", 1626 .ops = &clk_regmap_mux_ro_ops, 1627 .parent_hws = meson8b_vclk_enc_mux_parent_hws, 1628 .num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parent_hws), 1629 .flags = CLK_SET_RATE_PARENT, 1630 }, 1631 }; 1632 1633 static struct clk_regmap meson8b_hdmi_tx_pixel = { 1634 .data = &(struct clk_regmap_gate_data){ 1635 .offset = HHI_VID_CLK_CNTL2, 1636 .bit_idx = 5, 1637 }, 1638 .hw.init = &(struct clk_init_data){ 1639 .name = "hdmi_tx_pixel", 1640 .ops = &clk_regmap_gate_ro_ops, 1641 .parent_hws = (const struct clk_hw *[]) { 1642 &meson8b_hdmi_tx_pixel_sel.hw 1643 }, 1644 .num_parents = 1, 1645 .flags = CLK_SET_RATE_PARENT, 1646 }, 1647 }; 1648 1649 static const struct clk_hw *meson8b_vclk2_enc_mux_parent_hws[] = { 1650 &meson8b_vclk2_div1_gate.hw, 1651 &meson8b_vclk2_div2_div_gate.hw, 1652 &meson8b_vclk2_div4_div_gate.hw, 1653 &meson8b_vclk2_div6_div_gate.hw, 1654 &meson8b_vclk2_div12_div_gate.hw, 1655 }; 1656 1657 static struct clk_regmap meson8b_cts_encl_sel = { 1658 .data = &(struct clk_regmap_mux_data){ 1659 .offset = HHI_VIID_CLK_DIV, 1660 .mask = 0xf, 1661 .shift = 12, 1662 }, 1663 .hw.init = &(struct clk_init_data){ 1664 .name = "cts_encl_sel", 1665 .ops = &clk_regmap_mux_ro_ops, 1666 .parent_hws = meson8b_vclk2_enc_mux_parent_hws, 1667 .num_parents = ARRAY_SIZE(meson8b_vclk2_enc_mux_parent_hws), 1668 .flags = CLK_SET_RATE_PARENT, 1669 }, 1670 }; 1671 1672 static struct clk_regmap meson8b_cts_encl = { 1673 .data = &(struct clk_regmap_gate_data){ 1674 .offset = HHI_VID_CLK_CNTL2, 1675 .bit_idx = 3, 1676 }, 1677 .hw.init = &(struct clk_init_data){ 1678 .name = "cts_encl", 1679 .ops = &clk_regmap_gate_ro_ops, 1680 .parent_hws = (const struct clk_hw *[]) { 1681 &meson8b_cts_encl_sel.hw 1682 }, 1683 .num_parents = 1, 1684 .flags = CLK_SET_RATE_PARENT, 1685 }, 1686 }; 1687 1688 static struct clk_regmap meson8b_cts_vdac0_sel = { 1689 .data = &(struct clk_regmap_mux_data){ 1690 .offset = HHI_VIID_CLK_DIV, 1691 .mask = 0xf, 1692 .shift = 28, 1693 }, 1694 .hw.init = &(struct clk_init_data){ 1695 .name = "cts_vdac0_sel", 1696 .ops = &clk_regmap_mux_ro_ops, 1697 .parent_hws = meson8b_vclk2_enc_mux_parent_hws, 1698 .num_parents = ARRAY_SIZE(meson8b_vclk2_enc_mux_parent_hws), 1699 .flags = CLK_SET_RATE_PARENT, 1700 }, 1701 }; 1702 1703 static struct clk_regmap meson8b_cts_vdac0 = { 1704 .data = &(struct clk_regmap_gate_data){ 1705 .offset = HHI_VID_CLK_CNTL2, 1706 .bit_idx = 4, 1707 }, 1708 .hw.init = &(struct clk_init_data){ 1709 .name = "cts_vdac0", 1710 .ops = &clk_regmap_gate_ro_ops, 1711 .parent_hws = (const struct clk_hw *[]) { 1712 &meson8b_cts_vdac0_sel.hw 1713 }, 1714 .num_parents = 1, 1715 .flags = CLK_SET_RATE_PARENT, 1716 }, 1717 }; 1718 1719 static struct clk_regmap meson8b_hdmi_sys_sel = { 1720 .data = &(struct clk_regmap_mux_data){ 1721 .offset = HHI_HDMI_CLK_CNTL, 1722 .mask = 0x3, 1723 .shift = 9, 1724 .flags = CLK_MUX_ROUND_CLOSEST, 1725 }, 1726 .hw.init = &(struct clk_init_data){ 1727 .name = "hdmi_sys_sel", 1728 .ops = &clk_regmap_mux_ro_ops, 1729 /* FIXME: all other parents are unknown */ 1730 .parent_data = &(const struct clk_parent_data) { 1731 .fw_name = "xtal", 1732 .name = "xtal", 1733 .index = -1, 1734 }, 1735 .num_parents = 1, 1736 .flags = CLK_SET_RATE_NO_REPARENT, 1737 }, 1738 }; 1739 1740 static struct clk_regmap meson8b_hdmi_sys_div = { 1741 .data = &(struct clk_regmap_div_data){ 1742 .offset = HHI_HDMI_CLK_CNTL, 1743 .shift = 0, 1744 .width = 7, 1745 }, 1746 .hw.init = &(struct clk_init_data){ 1747 .name = "hdmi_sys_div", 1748 .ops = &clk_regmap_divider_ro_ops, 1749 .parent_hws = (const struct clk_hw *[]) { 1750 &meson8b_hdmi_sys_sel.hw 1751 }, 1752 .num_parents = 1, 1753 .flags = CLK_SET_RATE_PARENT, 1754 }, 1755 }; 1756 1757 static struct clk_regmap meson8b_hdmi_sys = { 1758 .data = &(struct clk_regmap_gate_data){ 1759 .offset = HHI_HDMI_CLK_CNTL, 1760 .bit_idx = 8, 1761 }, 1762 .hw.init = &(struct clk_init_data) { 1763 .name = "hdmi_sys", 1764 .ops = &clk_regmap_gate_ro_ops, 1765 .parent_hws = (const struct clk_hw *[]) { 1766 &meson8b_hdmi_sys_div.hw 1767 }, 1768 .num_parents = 1, 1769 .flags = CLK_SET_RATE_PARENT, 1770 }, 1771 }; 1772 1773 /* 1774 * The MALI IP is clocked by two identical clocks (mali_0 and mali_1) 1775 * muxed by a glitch-free switch on Meson8b and Meson8m2. The CCF can 1776 * actually manage this glitch-free mux because it does top-to-bottom 1777 * updates the each clock tree and switches to the "inactive" one when 1778 * CLK_SET_RATE_GATE is set. 1779 * Meson8 only has mali_0 and no glitch-free mux. 1780 */ 1781 static const struct clk_parent_data meson8b_mali_0_1_parent_data[] = { 1782 { .fw_name = "xtal", .name = "xtal", .index = -1, }, 1783 { .hw = &meson8b_mpll2.hw, }, 1784 { .hw = &meson8b_mpll1.hw, }, 1785 { .hw = &meson8b_fclk_div7.hw, }, 1786 { .hw = &meson8b_fclk_div4.hw, }, 1787 { .hw = &meson8b_fclk_div3.hw, }, 1788 { .hw = &meson8b_fclk_div5.hw, }, 1789 }; 1790 1791 static u32 meson8b_mali_0_1_mux_table[] = { 0, 2, 3, 4, 5, 6, 7 }; 1792 1793 static struct clk_regmap meson8b_mali_0_sel = { 1794 .data = &(struct clk_regmap_mux_data){ 1795 .offset = HHI_MALI_CLK_CNTL, 1796 .mask = 0x7, 1797 .shift = 9, 1798 .table = meson8b_mali_0_1_mux_table, 1799 }, 1800 .hw.init = &(struct clk_init_data){ 1801 .name = "mali_0_sel", 1802 .ops = &clk_regmap_mux_ops, 1803 .parent_data = meson8b_mali_0_1_parent_data, 1804 .num_parents = ARRAY_SIZE(meson8b_mali_0_1_parent_data), 1805 /* 1806 * Don't propagate rate changes up because the only changeable 1807 * parents are mpll1 and mpll2 but we need those for audio and 1808 * RGMII (Ethernet). We don't want to change the audio or 1809 * Ethernet clocks when setting the GPU frequency. 1810 */ 1811 .flags = 0, 1812 }, 1813 }; 1814 1815 static struct clk_regmap meson8b_mali_0_div = { 1816 .data = &(struct clk_regmap_div_data){ 1817 .offset = HHI_MALI_CLK_CNTL, 1818 .shift = 0, 1819 .width = 7, 1820 }, 1821 .hw.init = &(struct clk_init_data){ 1822 .name = "mali_0_div", 1823 .ops = &clk_regmap_divider_ops, 1824 .parent_hws = (const struct clk_hw *[]) { 1825 &meson8b_mali_0_sel.hw 1826 }, 1827 .num_parents = 1, 1828 .flags = CLK_SET_RATE_PARENT, 1829 }, 1830 }; 1831 1832 static struct clk_regmap meson8b_mali_0 = { 1833 .data = &(struct clk_regmap_gate_data){ 1834 .offset = HHI_MALI_CLK_CNTL, 1835 .bit_idx = 8, 1836 }, 1837 .hw.init = &(struct clk_init_data){ 1838 .name = "mali_0", 1839 .ops = &clk_regmap_gate_ops, 1840 .parent_hws = (const struct clk_hw *[]) { 1841 &meson8b_mali_0_div.hw 1842 }, 1843 .num_parents = 1, 1844 .flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT, 1845 }, 1846 }; 1847 1848 static struct clk_regmap meson8b_mali_1_sel = { 1849 .data = &(struct clk_regmap_mux_data){ 1850 .offset = HHI_MALI_CLK_CNTL, 1851 .mask = 0x7, 1852 .shift = 25, 1853 .table = meson8b_mali_0_1_mux_table, 1854 }, 1855 .hw.init = &(struct clk_init_data){ 1856 .name = "mali_1_sel", 1857 .ops = &clk_regmap_mux_ops, 1858 .parent_data = meson8b_mali_0_1_parent_data, 1859 .num_parents = ARRAY_SIZE(meson8b_mali_0_1_parent_data), 1860 /* 1861 * Don't propagate rate changes up because the only changeable 1862 * parents are mpll1 and mpll2 but we need those for audio and 1863 * RGMII (Ethernet). We don't want to change the audio or 1864 * Ethernet clocks when setting the GPU frequency. 1865 */ 1866 .flags = 0, 1867 }, 1868 }; 1869 1870 static struct clk_regmap meson8b_mali_1_div = { 1871 .data = &(struct clk_regmap_div_data){ 1872 .offset = HHI_MALI_CLK_CNTL, 1873 .shift = 16, 1874 .width = 7, 1875 }, 1876 .hw.init = &(struct clk_init_data){ 1877 .name = "mali_1_div", 1878 .ops = &clk_regmap_divider_ops, 1879 .parent_hws = (const struct clk_hw *[]) { 1880 &meson8b_mali_1_sel.hw 1881 }, 1882 .num_parents = 1, 1883 .flags = CLK_SET_RATE_PARENT, 1884 }, 1885 }; 1886 1887 static struct clk_regmap meson8b_mali_1 = { 1888 .data = &(struct clk_regmap_gate_data){ 1889 .offset = HHI_MALI_CLK_CNTL, 1890 .bit_idx = 24, 1891 }, 1892 .hw.init = &(struct clk_init_data){ 1893 .name = "mali_1", 1894 .ops = &clk_regmap_gate_ops, 1895 .parent_hws = (const struct clk_hw *[]) { 1896 &meson8b_mali_1_div.hw 1897 }, 1898 .num_parents = 1, 1899 .flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT, 1900 }, 1901 }; 1902 1903 static struct clk_regmap meson8b_mali = { 1904 .data = &(struct clk_regmap_mux_data){ 1905 .offset = HHI_MALI_CLK_CNTL, 1906 .mask = 1, 1907 .shift = 31, 1908 }, 1909 .hw.init = &(struct clk_init_data){ 1910 .name = "mali", 1911 .ops = &clk_regmap_mux_ops, 1912 .parent_hws = (const struct clk_hw *[]) { 1913 &meson8b_mali_0.hw, 1914 &meson8b_mali_1.hw, 1915 }, 1916 .num_parents = 2, 1917 .flags = CLK_SET_RATE_PARENT, 1918 }, 1919 }; 1920 1921 static const struct pll_params_table meson8m2_gp_pll_params_table[] = { 1922 PLL_PARAMS(182, 3), 1923 { /* sentinel */ }, 1924 }; 1925 1926 static struct clk_regmap meson8m2_gp_pll_dco = { 1927 .data = &(struct meson_clk_pll_data){ 1928 .en = { 1929 .reg_off = HHI_GP_PLL_CNTL, 1930 .shift = 30, 1931 .width = 1, 1932 }, 1933 .m = { 1934 .reg_off = HHI_GP_PLL_CNTL, 1935 .shift = 0, 1936 .width = 9, 1937 }, 1938 .n = { 1939 .reg_off = HHI_GP_PLL_CNTL, 1940 .shift = 9, 1941 .width = 5, 1942 }, 1943 .l = { 1944 .reg_off = HHI_GP_PLL_CNTL, 1945 .shift = 31, 1946 .width = 1, 1947 }, 1948 .rst = { 1949 .reg_off = HHI_GP_PLL_CNTL, 1950 .shift = 29, 1951 .width = 1, 1952 }, 1953 .table = meson8m2_gp_pll_params_table, 1954 }, 1955 .hw.init = &(struct clk_init_data){ 1956 .name = "gp_pll_dco", 1957 .ops = &meson_clk_pll_ops, 1958 .parent_data = &(const struct clk_parent_data) { 1959 .fw_name = "xtal", 1960 .name = "xtal", 1961 .index = -1, 1962 }, 1963 .num_parents = 1, 1964 }, 1965 }; 1966 1967 static struct clk_regmap meson8m2_gp_pll = { 1968 .data = &(struct clk_regmap_div_data){ 1969 .offset = HHI_GP_PLL_CNTL, 1970 .shift = 16, 1971 .width = 2, 1972 .flags = CLK_DIVIDER_POWER_OF_TWO, 1973 }, 1974 .hw.init = &(struct clk_init_data){ 1975 .name = "gp_pll", 1976 .ops = &clk_regmap_divider_ops, 1977 .parent_hws = (const struct clk_hw *[]) { 1978 &meson8m2_gp_pll_dco.hw 1979 }, 1980 .num_parents = 1, 1981 .flags = CLK_SET_RATE_PARENT, 1982 }, 1983 }; 1984 1985 static const struct clk_hw *meson8b_vpu_0_1_parent_hws[] = { 1986 &meson8b_fclk_div4.hw, 1987 &meson8b_fclk_div3.hw, 1988 &meson8b_fclk_div5.hw, 1989 &meson8b_fclk_div7.hw, 1990 }; 1991 1992 static const struct clk_hw *mmeson8m2_vpu_0_1_parent_hws[] = { 1993 &meson8b_fclk_div4.hw, 1994 &meson8b_fclk_div3.hw, 1995 &meson8b_fclk_div5.hw, 1996 &meson8m2_gp_pll.hw, 1997 }; 1998 1999 static struct clk_regmap meson8b_vpu_0_sel = { 2000 .data = &(struct clk_regmap_mux_data){ 2001 .offset = HHI_VPU_CLK_CNTL, 2002 .mask = 0x3, 2003 .shift = 9, 2004 }, 2005 .hw.init = &(struct clk_init_data){ 2006 .name = "vpu_0_sel", 2007 .ops = &clk_regmap_mux_ops, 2008 .parent_hws = meson8b_vpu_0_1_parent_hws, 2009 .num_parents = ARRAY_SIZE(meson8b_vpu_0_1_parent_hws), 2010 .flags = CLK_SET_RATE_PARENT, 2011 }, 2012 }; 2013 2014 static struct clk_regmap meson8m2_vpu_0_sel = { 2015 .data = &(struct clk_regmap_mux_data){ 2016 .offset = HHI_VPU_CLK_CNTL, 2017 .mask = 0x3, 2018 .shift = 9, 2019 }, 2020 .hw.init = &(struct clk_init_data){ 2021 .name = "vpu_0_sel", 2022 .ops = &clk_regmap_mux_ops, 2023 .parent_hws = mmeson8m2_vpu_0_1_parent_hws, 2024 .num_parents = ARRAY_SIZE(mmeson8m2_vpu_0_1_parent_hws), 2025 .flags = CLK_SET_RATE_PARENT, 2026 }, 2027 }; 2028 2029 static struct clk_regmap meson8b_vpu_0_div = { 2030 .data = &(struct clk_regmap_div_data){ 2031 .offset = HHI_VPU_CLK_CNTL, 2032 .shift = 0, 2033 .width = 7, 2034 }, 2035 .hw.init = &(struct clk_init_data){ 2036 .name = "vpu_0_div", 2037 .ops = &clk_regmap_divider_ops, 2038 .parent_data = &(const struct clk_parent_data) { 2039 /* 2040 * Note: 2041 * meson8b and meson8m2 have different vpu_0_sels (with 2042 * different struct clk_hw). We fallback to the global 2043 * naming string mechanism so vpu_0_div picks up the 2044 * appropriate one. 2045 */ 2046 .name = "vpu_0_sel", 2047 .index = -1, 2048 }, 2049 .num_parents = 1, 2050 .flags = CLK_SET_RATE_PARENT, 2051 }, 2052 }; 2053 2054 static struct clk_regmap meson8b_vpu_0 = { 2055 .data = &(struct clk_regmap_gate_data){ 2056 .offset = HHI_VPU_CLK_CNTL, 2057 .bit_idx = 8, 2058 }, 2059 .hw.init = &(struct clk_init_data) { 2060 .name = "vpu_0", 2061 .ops = &clk_regmap_gate_ops, 2062 .parent_hws = (const struct clk_hw *[]) { 2063 &meson8b_vpu_0_div.hw 2064 }, 2065 .num_parents = 1, 2066 .flags = CLK_SET_RATE_PARENT, 2067 }, 2068 }; 2069 2070 static struct clk_regmap meson8b_vpu_1_sel = { 2071 .data = &(struct clk_regmap_mux_data){ 2072 .offset = HHI_VPU_CLK_CNTL, 2073 .mask = 0x3, 2074 .shift = 25, 2075 }, 2076 .hw.init = &(struct clk_init_data){ 2077 .name = "vpu_1_sel", 2078 .ops = &clk_regmap_mux_ops, 2079 .parent_hws = meson8b_vpu_0_1_parent_hws, 2080 .num_parents = ARRAY_SIZE(meson8b_vpu_0_1_parent_hws), 2081 .flags = CLK_SET_RATE_PARENT, 2082 }, 2083 }; 2084 2085 static struct clk_regmap meson8m2_vpu_1_sel = { 2086 .data = &(struct clk_regmap_mux_data){ 2087 .offset = HHI_VPU_CLK_CNTL, 2088 .mask = 0x3, 2089 .shift = 25, 2090 }, 2091 .hw.init = &(struct clk_init_data){ 2092 .name = "vpu_1_sel", 2093 .ops = &clk_regmap_mux_ops, 2094 .parent_hws = mmeson8m2_vpu_0_1_parent_hws, 2095 .num_parents = ARRAY_SIZE(mmeson8m2_vpu_0_1_parent_hws), 2096 .flags = CLK_SET_RATE_PARENT, 2097 }, 2098 }; 2099 2100 static struct clk_regmap meson8b_vpu_1_div = { 2101 .data = &(struct clk_regmap_div_data){ 2102 .offset = HHI_VPU_CLK_CNTL, 2103 .shift = 16, 2104 .width = 7, 2105 }, 2106 .hw.init = &(struct clk_init_data){ 2107 .name = "vpu_1_div", 2108 .ops = &clk_regmap_divider_ops, 2109 .parent_data = &(const struct clk_parent_data) { 2110 /* 2111 * Note: 2112 * meson8b and meson8m2 have different vpu_1_sels (with 2113 * different struct clk_hw). We fallback to the global 2114 * naming string mechanism so vpu_1_div picks up the 2115 * appropriate one. 2116 */ 2117 .name = "vpu_1_sel", 2118 .index = -1, 2119 }, 2120 .num_parents = 1, 2121 .flags = CLK_SET_RATE_PARENT, 2122 }, 2123 }; 2124 2125 static struct clk_regmap meson8b_vpu_1 = { 2126 .data = &(struct clk_regmap_gate_data){ 2127 .offset = HHI_VPU_CLK_CNTL, 2128 .bit_idx = 24, 2129 }, 2130 .hw.init = &(struct clk_init_data) { 2131 .name = "vpu_1", 2132 .ops = &clk_regmap_gate_ops, 2133 .parent_hws = (const struct clk_hw *[]) { 2134 &meson8b_vpu_1_div.hw 2135 }, 2136 .num_parents = 1, 2137 .flags = CLK_SET_RATE_PARENT, 2138 }, 2139 }; 2140 2141 static struct clk_regmap meson8b_vpu = { 2142 .data = &(struct clk_regmap_mux_data){ 2143 .offset = HHI_VPU_CLK_CNTL, 2144 .mask = 1, 2145 .shift = 31, 2146 }, 2147 .hw.init = &(struct clk_init_data){ 2148 .name = "vpu", 2149 .ops = &clk_regmap_mux_ops, 2150 .parent_hws = (const struct clk_hw *[]) { 2151 &meson8b_vpu_0.hw, 2152 &meson8b_vpu_1.hw, 2153 }, 2154 .num_parents = 2, 2155 .flags = CLK_SET_RATE_NO_REPARENT, 2156 }, 2157 }; 2158 2159 static const struct clk_hw *meson8b_vdec_parent_hws[] = { 2160 &meson8b_fclk_div4.hw, 2161 &meson8b_fclk_div3.hw, 2162 &meson8b_fclk_div5.hw, 2163 &meson8b_fclk_div7.hw, 2164 &meson8b_mpll2.hw, 2165 &meson8b_mpll1.hw, 2166 }; 2167 2168 static struct clk_regmap meson8b_vdec_1_sel = { 2169 .data = &(struct clk_regmap_mux_data){ 2170 .offset = HHI_VDEC_CLK_CNTL, 2171 .mask = 0x3, 2172 .shift = 9, 2173 .flags = CLK_MUX_ROUND_CLOSEST, 2174 }, 2175 .hw.init = &(struct clk_init_data){ 2176 .name = "vdec_1_sel", 2177 .ops = &clk_regmap_mux_ops, 2178 .parent_hws = meson8b_vdec_parent_hws, 2179 .num_parents = ARRAY_SIZE(meson8b_vdec_parent_hws), 2180 .flags = CLK_SET_RATE_PARENT, 2181 }, 2182 }; 2183 2184 static struct clk_regmap meson8b_vdec_1_1_div = { 2185 .data = &(struct clk_regmap_div_data){ 2186 .offset = HHI_VDEC_CLK_CNTL, 2187 .shift = 0, 2188 .width = 7, 2189 .flags = CLK_DIVIDER_ROUND_CLOSEST, 2190 }, 2191 .hw.init = &(struct clk_init_data){ 2192 .name = "vdec_1_1_div", 2193 .ops = &clk_regmap_divider_ops, 2194 .parent_hws = (const struct clk_hw *[]) { 2195 &meson8b_vdec_1_sel.hw 2196 }, 2197 .num_parents = 1, 2198 .flags = CLK_SET_RATE_PARENT, 2199 }, 2200 }; 2201 2202 static struct clk_regmap meson8b_vdec_1_1 = { 2203 .data = &(struct clk_regmap_gate_data){ 2204 .offset = HHI_VDEC_CLK_CNTL, 2205 .bit_idx = 8, 2206 }, 2207 .hw.init = &(struct clk_init_data) { 2208 .name = "vdec_1_1", 2209 .ops = &clk_regmap_gate_ops, 2210 .parent_hws = (const struct clk_hw *[]) { 2211 &meson8b_vdec_1_1_div.hw 2212 }, 2213 .num_parents = 1, 2214 .flags = CLK_SET_RATE_PARENT, 2215 }, 2216 }; 2217 2218 static struct clk_regmap meson8b_vdec_1_2_div = { 2219 .data = &(struct clk_regmap_div_data){ 2220 .offset = HHI_VDEC3_CLK_CNTL, 2221 .shift = 0, 2222 .width = 7, 2223 .flags = CLK_DIVIDER_ROUND_CLOSEST, 2224 }, 2225 .hw.init = &(struct clk_init_data){ 2226 .name = "vdec_1_2_div", 2227 .ops = &clk_regmap_divider_ops, 2228 .parent_hws = (const struct clk_hw *[]) { 2229 &meson8b_vdec_1_sel.hw 2230 }, 2231 .num_parents = 1, 2232 .flags = CLK_SET_RATE_PARENT, 2233 }, 2234 }; 2235 2236 static struct clk_regmap meson8b_vdec_1_2 = { 2237 .data = &(struct clk_regmap_gate_data){ 2238 .offset = HHI_VDEC3_CLK_CNTL, 2239 .bit_idx = 8, 2240 }, 2241 .hw.init = &(struct clk_init_data) { 2242 .name = "vdec_1_2", 2243 .ops = &clk_regmap_gate_ops, 2244 .parent_hws = (const struct clk_hw *[]) { 2245 &meson8b_vdec_1_2_div.hw 2246 }, 2247 .num_parents = 1, 2248 .flags = CLK_SET_RATE_PARENT, 2249 }, 2250 }; 2251 2252 static struct clk_regmap meson8b_vdec_1 = { 2253 .data = &(struct clk_regmap_mux_data){ 2254 .offset = HHI_VDEC3_CLK_CNTL, 2255 .mask = 0x1, 2256 .shift = 15, 2257 .flags = CLK_MUX_ROUND_CLOSEST, 2258 }, 2259 .hw.init = &(struct clk_init_data){ 2260 .name = "vdec_1", 2261 .ops = &clk_regmap_mux_ops, 2262 .parent_hws = (const struct clk_hw *[]) { 2263 &meson8b_vdec_1_1.hw, 2264 &meson8b_vdec_1_2.hw, 2265 }, 2266 .num_parents = 2, 2267 .flags = CLK_SET_RATE_PARENT, 2268 }, 2269 }; 2270 2271 static struct clk_regmap meson8b_vdec_hcodec_sel = { 2272 .data = &(struct clk_regmap_mux_data){ 2273 .offset = HHI_VDEC_CLK_CNTL, 2274 .mask = 0x3, 2275 .shift = 25, 2276 .flags = CLK_MUX_ROUND_CLOSEST, 2277 }, 2278 .hw.init = &(struct clk_init_data){ 2279 .name = "vdec_hcodec_sel", 2280 .ops = &clk_regmap_mux_ops, 2281 .parent_hws = meson8b_vdec_parent_hws, 2282 .num_parents = ARRAY_SIZE(meson8b_vdec_parent_hws), 2283 .flags = CLK_SET_RATE_PARENT, 2284 }, 2285 }; 2286 2287 static struct clk_regmap meson8b_vdec_hcodec_div = { 2288 .data = &(struct clk_regmap_div_data){ 2289 .offset = HHI_VDEC_CLK_CNTL, 2290 .shift = 16, 2291 .width = 7, 2292 .flags = CLK_DIVIDER_ROUND_CLOSEST, 2293 }, 2294 .hw.init = &(struct clk_init_data){ 2295 .name = "vdec_hcodec_div", 2296 .ops = &clk_regmap_divider_ops, 2297 .parent_hws = (const struct clk_hw *[]) { 2298 &meson8b_vdec_hcodec_sel.hw 2299 }, 2300 .num_parents = 1, 2301 .flags = CLK_SET_RATE_PARENT, 2302 }, 2303 }; 2304 2305 static struct clk_regmap meson8b_vdec_hcodec = { 2306 .data = &(struct clk_regmap_gate_data){ 2307 .offset = HHI_VDEC_CLK_CNTL, 2308 .bit_idx = 24, 2309 }, 2310 .hw.init = &(struct clk_init_data) { 2311 .name = "vdec_hcodec", 2312 .ops = &clk_regmap_gate_ops, 2313 .parent_hws = (const struct clk_hw *[]) { 2314 &meson8b_vdec_hcodec_div.hw 2315 }, 2316 .num_parents = 1, 2317 .flags = CLK_SET_RATE_PARENT, 2318 }, 2319 }; 2320 2321 static struct clk_regmap meson8b_vdec_2_sel = { 2322 .data = &(struct clk_regmap_mux_data){ 2323 .offset = HHI_VDEC2_CLK_CNTL, 2324 .mask = 0x3, 2325 .shift = 9, 2326 .flags = CLK_MUX_ROUND_CLOSEST, 2327 }, 2328 .hw.init = &(struct clk_init_data){ 2329 .name = "vdec_2_sel", 2330 .ops = &clk_regmap_mux_ops, 2331 .parent_hws = meson8b_vdec_parent_hws, 2332 .num_parents = ARRAY_SIZE(meson8b_vdec_parent_hws), 2333 .flags = CLK_SET_RATE_PARENT, 2334 }, 2335 }; 2336 2337 static struct clk_regmap meson8b_vdec_2_div = { 2338 .data = &(struct clk_regmap_div_data){ 2339 .offset = HHI_VDEC2_CLK_CNTL, 2340 .shift = 0, 2341 .width = 7, 2342 .flags = CLK_DIVIDER_ROUND_CLOSEST, 2343 }, 2344 .hw.init = &(struct clk_init_data){ 2345 .name = "vdec_2_div", 2346 .ops = &clk_regmap_divider_ops, 2347 .parent_hws = (const struct clk_hw *[]) { 2348 &meson8b_vdec_2_sel.hw 2349 }, 2350 .num_parents = 1, 2351 .flags = CLK_SET_RATE_PARENT, 2352 }, 2353 }; 2354 2355 static struct clk_regmap meson8b_vdec_2 = { 2356 .data = &(struct clk_regmap_gate_data){ 2357 .offset = HHI_VDEC2_CLK_CNTL, 2358 .bit_idx = 8, 2359 }, 2360 .hw.init = &(struct clk_init_data) { 2361 .name = "vdec_2", 2362 .ops = &clk_regmap_gate_ops, 2363 .parent_hws = (const struct clk_hw *[]) { 2364 &meson8b_vdec_2_div.hw 2365 }, 2366 .num_parents = 1, 2367 .flags = CLK_SET_RATE_PARENT, 2368 }, 2369 }; 2370 2371 static struct clk_regmap meson8b_vdec_hevc_sel = { 2372 .data = &(struct clk_regmap_mux_data){ 2373 .offset = HHI_VDEC2_CLK_CNTL, 2374 .mask = 0x3, 2375 .shift = 25, 2376 .flags = CLK_MUX_ROUND_CLOSEST, 2377 }, 2378 .hw.init = &(struct clk_init_data){ 2379 .name = "vdec_hevc_sel", 2380 .ops = &clk_regmap_mux_ops, 2381 .parent_hws = meson8b_vdec_parent_hws, 2382 .num_parents = ARRAY_SIZE(meson8b_vdec_parent_hws), 2383 .flags = CLK_SET_RATE_PARENT, 2384 }, 2385 }; 2386 2387 static struct clk_regmap meson8b_vdec_hevc_div = { 2388 .data = &(struct clk_regmap_div_data){ 2389 .offset = HHI_VDEC2_CLK_CNTL, 2390 .shift = 16, 2391 .width = 7, 2392 .flags = CLK_DIVIDER_ROUND_CLOSEST, 2393 }, 2394 .hw.init = &(struct clk_init_data){ 2395 .name = "vdec_hevc_div", 2396 .ops = &clk_regmap_divider_ops, 2397 .parent_hws = (const struct clk_hw *[]) { 2398 &meson8b_vdec_hevc_sel.hw 2399 }, 2400 .num_parents = 1, 2401 .flags = CLK_SET_RATE_PARENT, 2402 }, 2403 }; 2404 2405 static struct clk_regmap meson8b_vdec_hevc_en = { 2406 .data = &(struct clk_regmap_gate_data){ 2407 .offset = HHI_VDEC2_CLK_CNTL, 2408 .bit_idx = 24, 2409 }, 2410 .hw.init = &(struct clk_init_data) { 2411 .name = "vdec_hevc_en", 2412 .ops = &clk_regmap_gate_ops, 2413 .parent_hws = (const struct clk_hw *[]) { 2414 &meson8b_vdec_hevc_div.hw 2415 }, 2416 .num_parents = 1, 2417 .flags = CLK_SET_RATE_PARENT, 2418 }, 2419 }; 2420 2421 static struct clk_regmap meson8b_vdec_hevc = { 2422 .data = &(struct clk_regmap_mux_data){ 2423 .offset = HHI_VDEC2_CLK_CNTL, 2424 .mask = 0x1, 2425 .shift = 31, 2426 .flags = CLK_MUX_ROUND_CLOSEST, 2427 }, 2428 .hw.init = &(struct clk_init_data){ 2429 .name = "vdec_hevc", 2430 .ops = &clk_regmap_mux_ops, 2431 /* TODO: The second parent is currently unknown */ 2432 .parent_hws = (const struct clk_hw *[]) { 2433 &meson8b_vdec_hevc_en.hw 2434 }, 2435 .num_parents = 1, 2436 .flags = CLK_SET_RATE_PARENT, 2437 }, 2438 }; 2439 2440 /* TODO: the clock at index 0 is "DDR_PLL" which we don't support yet */ 2441 static const struct clk_hw *meson8b_cts_amclk_parent_hws[] = { 2442 &meson8b_mpll0.hw, 2443 &meson8b_mpll1.hw, 2444 &meson8b_mpll2.hw 2445 }; 2446 2447 static u32 meson8b_cts_amclk_mux_table[] = { 1, 2, 3 }; 2448 2449 static struct clk_regmap meson8b_cts_amclk_sel = { 2450 .data = &(struct clk_regmap_mux_data){ 2451 .offset = HHI_AUD_CLK_CNTL, 2452 .mask = 0x3, 2453 .shift = 9, 2454 .table = meson8b_cts_amclk_mux_table, 2455 .flags = CLK_MUX_ROUND_CLOSEST, 2456 }, 2457 .hw.init = &(struct clk_init_data){ 2458 .name = "cts_amclk_sel", 2459 .ops = &clk_regmap_mux_ops, 2460 .parent_hws = meson8b_cts_amclk_parent_hws, 2461 .num_parents = ARRAY_SIZE(meson8b_cts_amclk_parent_hws), 2462 }, 2463 }; 2464 2465 static struct clk_regmap meson8b_cts_amclk_div = { 2466 .data = &(struct clk_regmap_div_data) { 2467 .offset = HHI_AUD_CLK_CNTL, 2468 .shift = 0, 2469 .width = 8, 2470 .flags = CLK_DIVIDER_ROUND_CLOSEST, 2471 }, 2472 .hw.init = &(struct clk_init_data){ 2473 .name = "cts_amclk_div", 2474 .ops = &clk_regmap_divider_ops, 2475 .parent_hws = (const struct clk_hw *[]) { 2476 &meson8b_cts_amclk_sel.hw 2477 }, 2478 .num_parents = 1, 2479 .flags = CLK_SET_RATE_PARENT, 2480 }, 2481 }; 2482 2483 static struct clk_regmap meson8b_cts_amclk = { 2484 .data = &(struct clk_regmap_gate_data){ 2485 .offset = HHI_AUD_CLK_CNTL, 2486 .bit_idx = 8, 2487 }, 2488 .hw.init = &(struct clk_init_data){ 2489 .name = "cts_amclk", 2490 .ops = &clk_regmap_gate_ops, 2491 .parent_hws = (const struct clk_hw *[]) { 2492 &meson8b_cts_amclk_div.hw 2493 }, 2494 .num_parents = 1, 2495 .flags = CLK_SET_RATE_PARENT, 2496 }, 2497 }; 2498 2499 /* TODO: the clock at index 0 is "DDR_PLL" which we don't support yet */ 2500 static const struct clk_hw *meson8b_cts_mclk_i958_parent_hws[] = { 2501 &meson8b_mpll0.hw, 2502 &meson8b_mpll1.hw, 2503 &meson8b_mpll2.hw 2504 }; 2505 2506 static u32 meson8b_cts_mclk_i958_mux_table[] = { 1, 2, 3 }; 2507 2508 static struct clk_regmap meson8b_cts_mclk_i958_sel = { 2509 .data = &(struct clk_regmap_mux_data){ 2510 .offset = HHI_AUD_CLK_CNTL2, 2511 .mask = 0x3, 2512 .shift = 25, 2513 .table = meson8b_cts_mclk_i958_mux_table, 2514 .flags = CLK_MUX_ROUND_CLOSEST, 2515 }, 2516 .hw.init = &(struct clk_init_data) { 2517 .name = "cts_mclk_i958_sel", 2518 .ops = &clk_regmap_mux_ops, 2519 .parent_hws = meson8b_cts_mclk_i958_parent_hws, 2520 .num_parents = ARRAY_SIZE(meson8b_cts_mclk_i958_parent_hws), 2521 }, 2522 }; 2523 2524 static struct clk_regmap meson8b_cts_mclk_i958_div = { 2525 .data = &(struct clk_regmap_div_data){ 2526 .offset = HHI_AUD_CLK_CNTL2, 2527 .shift = 16, 2528 .width = 8, 2529 .flags = CLK_DIVIDER_ROUND_CLOSEST, 2530 }, 2531 .hw.init = &(struct clk_init_data) { 2532 .name = "cts_mclk_i958_div", 2533 .ops = &clk_regmap_divider_ops, 2534 .parent_hws = (const struct clk_hw *[]) { 2535 &meson8b_cts_mclk_i958_sel.hw 2536 }, 2537 .num_parents = 1, 2538 .flags = CLK_SET_RATE_PARENT, 2539 }, 2540 }; 2541 2542 static struct clk_regmap meson8b_cts_mclk_i958 = { 2543 .data = &(struct clk_regmap_gate_data){ 2544 .offset = HHI_AUD_CLK_CNTL2, 2545 .bit_idx = 24, 2546 }, 2547 .hw.init = &(struct clk_init_data){ 2548 .name = "cts_mclk_i958", 2549 .ops = &clk_regmap_gate_ops, 2550 .parent_hws = (const struct clk_hw *[]) { 2551 &meson8b_cts_mclk_i958_div.hw 2552 }, 2553 .num_parents = 1, 2554 .flags = CLK_SET_RATE_PARENT, 2555 }, 2556 }; 2557 2558 static struct clk_regmap meson8b_cts_i958 = { 2559 .data = &(struct clk_regmap_mux_data){ 2560 .offset = HHI_AUD_CLK_CNTL2, 2561 .mask = 0x1, 2562 .shift = 27, 2563 }, 2564 .hw.init = &(struct clk_init_data){ 2565 .name = "cts_i958", 2566 .ops = &clk_regmap_mux_ops, 2567 .parent_hws = (const struct clk_hw *[]) { 2568 &meson8b_cts_amclk.hw, 2569 &meson8b_cts_mclk_i958.hw 2570 }, 2571 .num_parents = 2, 2572 /* 2573 * The parent is specific to origin of the audio data. Let the 2574 * consumer choose the appropriate parent. 2575 */ 2576 .flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT, 2577 }, 2578 }; 2579 2580 #define MESON_GATE(_name, _reg, _bit) \ 2581 MESON_PCLK(_name, _reg, _bit, &meson8b_clk81.hw) 2582 2583 /* Everything Else (EE) domain gates */ 2584 2585 static MESON_GATE(meson8b_ddr, HHI_GCLK_MPEG0, 0); 2586 static MESON_GATE(meson8b_dos, HHI_GCLK_MPEG0, 1); 2587 static MESON_GATE(meson8b_isa, HHI_GCLK_MPEG0, 5); 2588 static MESON_GATE(meson8b_pl301, HHI_GCLK_MPEG0, 6); 2589 static MESON_GATE(meson8b_periphs, HHI_GCLK_MPEG0, 7); 2590 static MESON_GATE(meson8b_spicc, HHI_GCLK_MPEG0, 8); 2591 static MESON_GATE(meson8b_i2c, HHI_GCLK_MPEG0, 9); 2592 static MESON_GATE(meson8b_sar_adc, HHI_GCLK_MPEG0, 10); 2593 static MESON_GATE(meson8b_smart_card, HHI_GCLK_MPEG0, 11); 2594 static MESON_GATE(meson8b_rng0, HHI_GCLK_MPEG0, 12); 2595 static MESON_GATE(meson8b_uart0, HHI_GCLK_MPEG0, 13); 2596 static MESON_GATE(meson8b_sdhc, HHI_GCLK_MPEG0, 14); 2597 static MESON_GATE(meson8b_stream, HHI_GCLK_MPEG0, 15); 2598 static MESON_GATE(meson8b_async_fifo, HHI_GCLK_MPEG0, 16); 2599 static MESON_GATE(meson8b_sdio, HHI_GCLK_MPEG0, 17); 2600 static MESON_GATE(meson8b_abuf, HHI_GCLK_MPEG0, 18); 2601 static MESON_GATE(meson8b_hiu_iface, HHI_GCLK_MPEG0, 19); 2602 static MESON_GATE(meson8b_assist_misc, HHI_GCLK_MPEG0, 23); 2603 static MESON_GATE(meson8b_spi, HHI_GCLK_MPEG0, 30); 2604 2605 static MESON_GATE(meson8b_i2s_spdif, HHI_GCLK_MPEG1, 2); 2606 static MESON_GATE(meson8b_eth, HHI_GCLK_MPEG1, 3); 2607 static MESON_GATE(meson8b_demux, HHI_GCLK_MPEG1, 4); 2608 static MESON_GATE(meson8b_aiu_glue, HHI_GCLK_MPEG1, 6); 2609 static MESON_GATE(meson8b_iec958, HHI_GCLK_MPEG1, 7); 2610 static MESON_GATE(meson8b_i2s_out, HHI_GCLK_MPEG1, 8); 2611 static MESON_GATE(meson8b_amclk, HHI_GCLK_MPEG1, 9); 2612 static MESON_GATE(meson8b_aififo2, HHI_GCLK_MPEG1, 10); 2613 static MESON_GATE(meson8b_mixer, HHI_GCLK_MPEG1, 11); 2614 static MESON_GATE(meson8b_mixer_iface, HHI_GCLK_MPEG1, 12); 2615 static MESON_GATE(meson8b_adc, HHI_GCLK_MPEG1, 13); 2616 static MESON_GATE(meson8b_blkmv, HHI_GCLK_MPEG1, 14); 2617 static MESON_GATE(meson8b_aiu, HHI_GCLK_MPEG1, 15); 2618 static MESON_GATE(meson8b_uart1, HHI_GCLK_MPEG1, 16); 2619 static MESON_GATE(meson8b_g2d, HHI_GCLK_MPEG1, 20); 2620 static MESON_GATE(meson8b_usb0, HHI_GCLK_MPEG1, 21); 2621 static MESON_GATE(meson8b_usb1, HHI_GCLK_MPEG1, 22); 2622 static MESON_GATE(meson8b_reset, HHI_GCLK_MPEG1, 23); 2623 static MESON_GATE(meson8b_nand, HHI_GCLK_MPEG1, 24); 2624 static MESON_GATE(meson8b_dos_parser, HHI_GCLK_MPEG1, 25); 2625 static MESON_GATE(meson8b_usb, HHI_GCLK_MPEG1, 26); 2626 static MESON_GATE(meson8b_vdin1, HHI_GCLK_MPEG1, 28); 2627 static MESON_GATE(meson8b_ahb_arb0, HHI_GCLK_MPEG1, 29); 2628 static MESON_GATE(meson8b_efuse, HHI_GCLK_MPEG1, 30); 2629 static MESON_GATE(meson8b_boot_rom, HHI_GCLK_MPEG1, 31); 2630 2631 static MESON_GATE(meson8b_ahb_data_bus, HHI_GCLK_MPEG2, 1); 2632 static MESON_GATE(meson8b_ahb_ctrl_bus, HHI_GCLK_MPEG2, 2); 2633 static MESON_GATE(meson8b_hdmi_intr_sync, HHI_GCLK_MPEG2, 3); 2634 static MESON_GATE(meson8b_hdmi_pclk, HHI_GCLK_MPEG2, 4); 2635 static MESON_GATE(meson8b_usb1_ddr_bridge, HHI_GCLK_MPEG2, 8); 2636 static MESON_GATE(meson8b_usb0_ddr_bridge, HHI_GCLK_MPEG2, 9); 2637 static MESON_GATE(meson8b_mmc_pclk, HHI_GCLK_MPEG2, 11); 2638 static MESON_GATE(meson8b_dvin, HHI_GCLK_MPEG2, 12); 2639 static MESON_GATE(meson8b_uart2, HHI_GCLK_MPEG2, 15); 2640 static MESON_GATE(meson8b_sana, HHI_GCLK_MPEG2, 22); 2641 static MESON_GATE(meson8b_vpu_intr, HHI_GCLK_MPEG2, 25); 2642 static MESON_GATE(meson8b_sec_ahb_ahb3_bridge, HHI_GCLK_MPEG2, 26); 2643 static MESON_GATE(meson8b_clk81_a9, HHI_GCLK_MPEG2, 29); 2644 2645 static MESON_GATE(meson8b_vclk2_venci0, HHI_GCLK_OTHER, 1); 2646 static MESON_GATE(meson8b_vclk2_venci1, HHI_GCLK_OTHER, 2); 2647 static MESON_GATE(meson8b_vclk2_vencp0, HHI_GCLK_OTHER, 3); 2648 static MESON_GATE(meson8b_vclk2_vencp1, HHI_GCLK_OTHER, 4); 2649 static MESON_GATE(meson8b_gclk_venci_int, HHI_GCLK_OTHER, 8); 2650 static MESON_GATE(meson8b_gclk_vencp_int, HHI_GCLK_OTHER, 9); 2651 static MESON_GATE(meson8b_dac_clk, HHI_GCLK_OTHER, 10); 2652 static MESON_GATE(meson8b_aoclk_gate, HHI_GCLK_OTHER, 14); 2653 static MESON_GATE(meson8b_iec958_gate, HHI_GCLK_OTHER, 16); 2654 static MESON_GATE(meson8b_enc480p, HHI_GCLK_OTHER, 20); 2655 static MESON_GATE(meson8b_rng1, HHI_GCLK_OTHER, 21); 2656 static MESON_GATE(meson8b_gclk_vencl_int, HHI_GCLK_OTHER, 22); 2657 static MESON_GATE(meson8b_vclk2_venclmcc, HHI_GCLK_OTHER, 24); 2658 static MESON_GATE(meson8b_vclk2_vencl, HHI_GCLK_OTHER, 25); 2659 static MESON_GATE(meson8b_vclk2_other, HHI_GCLK_OTHER, 26); 2660 static MESON_GATE(meson8b_edp, HHI_GCLK_OTHER, 31); 2661 2662 /* Always On (AO) domain gates */ 2663 2664 static MESON_GATE(meson8b_ao_media_cpu, HHI_GCLK_AO, 0); 2665 static MESON_GATE(meson8b_ao_ahb_sram, HHI_GCLK_AO, 1); 2666 static MESON_GATE(meson8b_ao_ahb_bus, HHI_GCLK_AO, 2); 2667 static MESON_GATE(meson8b_ao_iface, HHI_GCLK_AO, 3); 2668 2669 static struct clk_hw_onecell_data meson8_hw_onecell_data = { 2670 .hws = { 2671 [CLKID_XTAL] = &meson8b_xtal.hw, 2672 [CLKID_PLL_FIXED] = &meson8b_fixed_pll.hw, 2673 [CLKID_PLL_VID] = &meson8b_vid_pll.hw, 2674 [CLKID_PLL_SYS] = &meson8b_sys_pll.hw, 2675 [CLKID_FCLK_DIV2] = &meson8b_fclk_div2.hw, 2676 [CLKID_FCLK_DIV3] = &meson8b_fclk_div3.hw, 2677 [CLKID_FCLK_DIV4] = &meson8b_fclk_div4.hw, 2678 [CLKID_FCLK_DIV5] = &meson8b_fclk_div5.hw, 2679 [CLKID_FCLK_DIV7] = &meson8b_fclk_div7.hw, 2680 [CLKID_CPUCLK] = &meson8b_cpu_clk.hw, 2681 [CLKID_MPEG_SEL] = &meson8b_mpeg_clk_sel.hw, 2682 [CLKID_MPEG_DIV] = &meson8b_mpeg_clk_div.hw, 2683 [CLKID_CLK81] = &meson8b_clk81.hw, 2684 [CLKID_DDR] = &meson8b_ddr.hw, 2685 [CLKID_DOS] = &meson8b_dos.hw, 2686 [CLKID_ISA] = &meson8b_isa.hw, 2687 [CLKID_PL301] = &meson8b_pl301.hw, 2688 [CLKID_PERIPHS] = &meson8b_periphs.hw, 2689 [CLKID_SPICC] = &meson8b_spicc.hw, 2690 [CLKID_I2C] = &meson8b_i2c.hw, 2691 [CLKID_SAR_ADC] = &meson8b_sar_adc.hw, 2692 [CLKID_SMART_CARD] = &meson8b_smart_card.hw, 2693 [CLKID_RNG0] = &meson8b_rng0.hw, 2694 [CLKID_UART0] = &meson8b_uart0.hw, 2695 [CLKID_SDHC] = &meson8b_sdhc.hw, 2696 [CLKID_STREAM] = &meson8b_stream.hw, 2697 [CLKID_ASYNC_FIFO] = &meson8b_async_fifo.hw, 2698 [CLKID_SDIO] = &meson8b_sdio.hw, 2699 [CLKID_ABUF] = &meson8b_abuf.hw, 2700 [CLKID_HIU_IFACE] = &meson8b_hiu_iface.hw, 2701 [CLKID_ASSIST_MISC] = &meson8b_assist_misc.hw, 2702 [CLKID_SPI] = &meson8b_spi.hw, 2703 [CLKID_I2S_SPDIF] = &meson8b_i2s_spdif.hw, 2704 [CLKID_ETH] = &meson8b_eth.hw, 2705 [CLKID_DEMUX] = &meson8b_demux.hw, 2706 [CLKID_AIU_GLUE] = &meson8b_aiu_glue.hw, 2707 [CLKID_IEC958] = &meson8b_iec958.hw, 2708 [CLKID_I2S_OUT] = &meson8b_i2s_out.hw, 2709 [CLKID_AMCLK] = &meson8b_amclk.hw, 2710 [CLKID_AIFIFO2] = &meson8b_aififo2.hw, 2711 [CLKID_MIXER] = &meson8b_mixer.hw, 2712 [CLKID_MIXER_IFACE] = &meson8b_mixer_iface.hw, 2713 [CLKID_ADC] = &meson8b_adc.hw, 2714 [CLKID_BLKMV] = &meson8b_blkmv.hw, 2715 [CLKID_AIU] = &meson8b_aiu.hw, 2716 [CLKID_UART1] = &meson8b_uart1.hw, 2717 [CLKID_G2D] = &meson8b_g2d.hw, 2718 [CLKID_USB0] = &meson8b_usb0.hw, 2719 [CLKID_USB1] = &meson8b_usb1.hw, 2720 [CLKID_RESET] = &meson8b_reset.hw, 2721 [CLKID_NAND] = &meson8b_nand.hw, 2722 [CLKID_DOS_PARSER] = &meson8b_dos_parser.hw, 2723 [CLKID_USB] = &meson8b_usb.hw, 2724 [CLKID_VDIN1] = &meson8b_vdin1.hw, 2725 [CLKID_AHB_ARB0] = &meson8b_ahb_arb0.hw, 2726 [CLKID_EFUSE] = &meson8b_efuse.hw, 2727 [CLKID_BOOT_ROM] = &meson8b_boot_rom.hw, 2728 [CLKID_AHB_DATA_BUS] = &meson8b_ahb_data_bus.hw, 2729 [CLKID_AHB_CTRL_BUS] = &meson8b_ahb_ctrl_bus.hw, 2730 [CLKID_HDMI_INTR_SYNC] = &meson8b_hdmi_intr_sync.hw, 2731 [CLKID_HDMI_PCLK] = &meson8b_hdmi_pclk.hw, 2732 [CLKID_USB1_DDR_BRIDGE] = &meson8b_usb1_ddr_bridge.hw, 2733 [CLKID_USB0_DDR_BRIDGE] = &meson8b_usb0_ddr_bridge.hw, 2734 [CLKID_MMC_PCLK] = &meson8b_mmc_pclk.hw, 2735 [CLKID_DVIN] = &meson8b_dvin.hw, 2736 [CLKID_UART2] = &meson8b_uart2.hw, 2737 [CLKID_SANA] = &meson8b_sana.hw, 2738 [CLKID_VPU_INTR] = &meson8b_vpu_intr.hw, 2739 [CLKID_SEC_AHB_AHB3_BRIDGE] = &meson8b_sec_ahb_ahb3_bridge.hw, 2740 [CLKID_CLK81_A9] = &meson8b_clk81_a9.hw, 2741 [CLKID_VCLK2_VENCI0] = &meson8b_vclk2_venci0.hw, 2742 [CLKID_VCLK2_VENCI1] = &meson8b_vclk2_venci1.hw, 2743 [CLKID_VCLK2_VENCP0] = &meson8b_vclk2_vencp0.hw, 2744 [CLKID_VCLK2_VENCP1] = &meson8b_vclk2_vencp1.hw, 2745 [CLKID_GCLK_VENCI_INT] = &meson8b_gclk_venci_int.hw, 2746 [CLKID_GCLK_VENCP_INT] = &meson8b_gclk_vencp_int.hw, 2747 [CLKID_DAC_CLK] = &meson8b_dac_clk.hw, 2748 [CLKID_AOCLK_GATE] = &meson8b_aoclk_gate.hw, 2749 [CLKID_IEC958_GATE] = &meson8b_iec958_gate.hw, 2750 [CLKID_ENC480P] = &meson8b_enc480p.hw, 2751 [CLKID_RNG1] = &meson8b_rng1.hw, 2752 [CLKID_GCLK_VENCL_INT] = &meson8b_gclk_vencl_int.hw, 2753 [CLKID_VCLK2_VENCLMCC] = &meson8b_vclk2_venclmcc.hw, 2754 [CLKID_VCLK2_VENCL] = &meson8b_vclk2_vencl.hw, 2755 [CLKID_VCLK2_OTHER] = &meson8b_vclk2_other.hw, 2756 [CLKID_EDP] = &meson8b_edp.hw, 2757 [CLKID_AO_MEDIA_CPU] = &meson8b_ao_media_cpu.hw, 2758 [CLKID_AO_AHB_SRAM] = &meson8b_ao_ahb_sram.hw, 2759 [CLKID_AO_AHB_BUS] = &meson8b_ao_ahb_bus.hw, 2760 [CLKID_AO_IFACE] = &meson8b_ao_iface.hw, 2761 [CLKID_MPLL0] = &meson8b_mpll0.hw, 2762 [CLKID_MPLL1] = &meson8b_mpll1.hw, 2763 [CLKID_MPLL2] = &meson8b_mpll2.hw, 2764 [CLKID_MPLL0_DIV] = &meson8b_mpll0_div.hw, 2765 [CLKID_MPLL1_DIV] = &meson8b_mpll1_div.hw, 2766 [CLKID_MPLL2_DIV] = &meson8b_mpll2_div.hw, 2767 [CLKID_CPU_IN_SEL] = &meson8b_cpu_in_sel.hw, 2768 [CLKID_CPU_IN_DIV2] = &meson8b_cpu_in_div2.hw, 2769 [CLKID_CPU_IN_DIV3] = &meson8b_cpu_in_div3.hw, 2770 [CLKID_CPU_SCALE_DIV] = &meson8b_cpu_scale_div.hw, 2771 [CLKID_CPU_SCALE_OUT_SEL] = &meson8b_cpu_scale_out_sel.hw, 2772 [CLKID_MPLL_PREDIV] = &meson8b_mpll_prediv.hw, 2773 [CLKID_FCLK_DIV2_DIV] = &meson8b_fclk_div2_div.hw, 2774 [CLKID_FCLK_DIV3_DIV] = &meson8b_fclk_div3_div.hw, 2775 [CLKID_FCLK_DIV4_DIV] = &meson8b_fclk_div4_div.hw, 2776 [CLKID_FCLK_DIV5_DIV] = &meson8b_fclk_div5_div.hw, 2777 [CLKID_FCLK_DIV7_DIV] = &meson8b_fclk_div7_div.hw, 2778 [CLKID_NAND_SEL] = &meson8b_nand_clk_sel.hw, 2779 [CLKID_NAND_DIV] = &meson8b_nand_clk_div.hw, 2780 [CLKID_NAND_CLK] = &meson8b_nand_clk_gate.hw, 2781 [CLKID_PLL_FIXED_DCO] = &meson8b_fixed_pll_dco.hw, 2782 [CLKID_HDMI_PLL_DCO] = &meson8b_hdmi_pll_dco.hw, 2783 [CLKID_PLL_SYS_DCO] = &meson8b_sys_pll_dco.hw, 2784 [CLKID_CPU_CLK_DIV2] = &meson8b_cpu_clk_div2.hw, 2785 [CLKID_CPU_CLK_DIV3] = &meson8b_cpu_clk_div3.hw, 2786 [CLKID_CPU_CLK_DIV4] = &meson8b_cpu_clk_div4.hw, 2787 [CLKID_CPU_CLK_DIV5] = &meson8b_cpu_clk_div5.hw, 2788 [CLKID_CPU_CLK_DIV6] = &meson8b_cpu_clk_div6.hw, 2789 [CLKID_CPU_CLK_DIV7] = &meson8b_cpu_clk_div7.hw, 2790 [CLKID_CPU_CLK_DIV8] = &meson8b_cpu_clk_div8.hw, 2791 [CLKID_APB_SEL] = &meson8b_apb_clk_sel.hw, 2792 [CLKID_APB] = &meson8b_apb_clk_gate.hw, 2793 [CLKID_PERIPH_SEL] = &meson8b_periph_clk_sel.hw, 2794 [CLKID_PERIPH] = &meson8b_periph_clk_gate.hw, 2795 [CLKID_AXI_SEL] = &meson8b_axi_clk_sel.hw, 2796 [CLKID_AXI] = &meson8b_axi_clk_gate.hw, 2797 [CLKID_L2_DRAM_SEL] = &meson8b_l2_dram_clk_sel.hw, 2798 [CLKID_L2_DRAM] = &meson8b_l2_dram_clk_gate.hw, 2799 [CLKID_HDMI_PLL_LVDS_OUT] = &meson8b_hdmi_pll_lvds_out.hw, 2800 [CLKID_HDMI_PLL_HDMI_OUT] = &meson8b_hdmi_pll_hdmi_out.hw, 2801 [CLKID_VID_PLL_IN_SEL] = &meson8b_vid_pll_in_sel.hw, 2802 [CLKID_VID_PLL_IN_EN] = &meson8b_vid_pll_in_en.hw, 2803 [CLKID_VID_PLL_PRE_DIV] = &meson8b_vid_pll_pre_div.hw, 2804 [CLKID_VID_PLL_POST_DIV] = &meson8b_vid_pll_post_div.hw, 2805 [CLKID_VID_PLL_FINAL_DIV] = &meson8b_vid_pll_final_div.hw, 2806 [CLKID_VCLK_IN_SEL] = &meson8b_vclk_in_sel.hw, 2807 [CLKID_VCLK_IN_EN] = &meson8b_vclk_in_en.hw, 2808 [CLKID_VCLK_DIV1] = &meson8b_vclk_div1_gate.hw, 2809 [CLKID_VCLK_DIV2_DIV] = &meson8b_vclk_div2_div.hw, 2810 [CLKID_VCLK_DIV2] = &meson8b_vclk_div2_div_gate.hw, 2811 [CLKID_VCLK_DIV4_DIV] = &meson8b_vclk_div4_div.hw, 2812 [CLKID_VCLK_DIV4] = &meson8b_vclk_div4_div_gate.hw, 2813 [CLKID_VCLK_DIV6_DIV] = &meson8b_vclk_div6_div.hw, 2814 [CLKID_VCLK_DIV6] = &meson8b_vclk_div6_div_gate.hw, 2815 [CLKID_VCLK_DIV12_DIV] = &meson8b_vclk_div12_div.hw, 2816 [CLKID_VCLK_DIV12] = &meson8b_vclk_div12_div_gate.hw, 2817 [CLKID_VCLK2_IN_SEL] = &meson8b_vclk2_in_sel.hw, 2818 [CLKID_VCLK2_IN_EN] = &meson8b_vclk2_clk_in_en.hw, 2819 [CLKID_VCLK2_DIV1] = &meson8b_vclk2_div1_gate.hw, 2820 [CLKID_VCLK2_DIV2_DIV] = &meson8b_vclk2_div2_div.hw, 2821 [CLKID_VCLK2_DIV2] = &meson8b_vclk2_div2_div_gate.hw, 2822 [CLKID_VCLK2_DIV4_DIV] = &meson8b_vclk2_div4_div.hw, 2823 [CLKID_VCLK2_DIV4] = &meson8b_vclk2_div4_div_gate.hw, 2824 [CLKID_VCLK2_DIV6_DIV] = &meson8b_vclk2_div6_div.hw, 2825 [CLKID_VCLK2_DIV6] = &meson8b_vclk2_div6_div_gate.hw, 2826 [CLKID_VCLK2_DIV12_DIV] = &meson8b_vclk2_div12_div.hw, 2827 [CLKID_VCLK2_DIV12] = &meson8b_vclk2_div12_div_gate.hw, 2828 [CLKID_CTS_ENCT_SEL] = &meson8b_cts_enct_sel.hw, 2829 [CLKID_CTS_ENCT] = &meson8b_cts_enct.hw, 2830 [CLKID_CTS_ENCP_SEL] = &meson8b_cts_encp_sel.hw, 2831 [CLKID_CTS_ENCP] = &meson8b_cts_encp.hw, 2832 [CLKID_CTS_ENCI_SEL] = &meson8b_cts_enci_sel.hw, 2833 [CLKID_CTS_ENCI] = &meson8b_cts_enci.hw, 2834 [CLKID_HDMI_TX_PIXEL_SEL] = &meson8b_hdmi_tx_pixel_sel.hw, 2835 [CLKID_HDMI_TX_PIXEL] = &meson8b_hdmi_tx_pixel.hw, 2836 [CLKID_CTS_ENCL_SEL] = &meson8b_cts_encl_sel.hw, 2837 [CLKID_CTS_ENCL] = &meson8b_cts_encl.hw, 2838 [CLKID_CTS_VDAC0_SEL] = &meson8b_cts_vdac0_sel.hw, 2839 [CLKID_CTS_VDAC0] = &meson8b_cts_vdac0.hw, 2840 [CLKID_HDMI_SYS_SEL] = &meson8b_hdmi_sys_sel.hw, 2841 [CLKID_HDMI_SYS_DIV] = &meson8b_hdmi_sys_div.hw, 2842 [CLKID_HDMI_SYS] = &meson8b_hdmi_sys.hw, 2843 [CLKID_MALI_0_SEL] = &meson8b_mali_0_sel.hw, 2844 [CLKID_MALI_0_DIV] = &meson8b_mali_0_div.hw, 2845 [CLKID_MALI] = &meson8b_mali_0.hw, 2846 [CLKID_VPU_0_SEL] = &meson8b_vpu_0_sel.hw, 2847 [CLKID_VPU_0_DIV] = &meson8b_vpu_0_div.hw, 2848 [CLKID_VPU] = &meson8b_vpu_0.hw, 2849 [CLKID_VDEC_1_SEL] = &meson8b_vdec_1_sel.hw, 2850 [CLKID_VDEC_1_1_DIV] = &meson8b_vdec_1_1_div.hw, 2851 [CLKID_VDEC_1] = &meson8b_vdec_1_1.hw, 2852 [CLKID_VDEC_HCODEC_SEL] = &meson8b_vdec_hcodec_sel.hw, 2853 [CLKID_VDEC_HCODEC_DIV] = &meson8b_vdec_hcodec_div.hw, 2854 [CLKID_VDEC_HCODEC] = &meson8b_vdec_hcodec.hw, 2855 [CLKID_VDEC_2_SEL] = &meson8b_vdec_2_sel.hw, 2856 [CLKID_VDEC_2_DIV] = &meson8b_vdec_2_div.hw, 2857 [CLKID_VDEC_2] = &meson8b_vdec_2.hw, 2858 [CLKID_VDEC_HEVC_SEL] = &meson8b_vdec_hevc_sel.hw, 2859 [CLKID_VDEC_HEVC_DIV] = &meson8b_vdec_hevc_div.hw, 2860 [CLKID_VDEC_HEVC_EN] = &meson8b_vdec_hevc_en.hw, 2861 [CLKID_VDEC_HEVC] = &meson8b_vdec_hevc.hw, 2862 [CLKID_CTS_AMCLK_SEL] = &meson8b_cts_amclk_sel.hw, 2863 [CLKID_CTS_AMCLK_DIV] = &meson8b_cts_amclk_div.hw, 2864 [CLKID_CTS_AMCLK] = &meson8b_cts_amclk.hw, 2865 [CLKID_CTS_MCLK_I958_SEL] = &meson8b_cts_mclk_i958_sel.hw, 2866 [CLKID_CTS_MCLK_I958_DIV] = &meson8b_cts_mclk_i958_div.hw, 2867 [CLKID_CTS_MCLK_I958] = &meson8b_cts_mclk_i958.hw, 2868 [CLKID_CTS_I958] = &meson8b_cts_i958.hw, 2869 [CLK_NR_CLKS] = NULL, 2870 }, 2871 .num = CLK_NR_CLKS, 2872 }; 2873 2874 static struct clk_hw_onecell_data meson8b_hw_onecell_data = { 2875 .hws = { 2876 [CLKID_XTAL] = &meson8b_xtal.hw, 2877 [CLKID_PLL_FIXED] = &meson8b_fixed_pll.hw, 2878 [CLKID_PLL_VID] = &meson8b_vid_pll.hw, 2879 [CLKID_PLL_SYS] = &meson8b_sys_pll.hw, 2880 [CLKID_FCLK_DIV2] = &meson8b_fclk_div2.hw, 2881 [CLKID_FCLK_DIV3] = &meson8b_fclk_div3.hw, 2882 [CLKID_FCLK_DIV4] = &meson8b_fclk_div4.hw, 2883 [CLKID_FCLK_DIV5] = &meson8b_fclk_div5.hw, 2884 [CLKID_FCLK_DIV7] = &meson8b_fclk_div7.hw, 2885 [CLKID_CPUCLK] = &meson8b_cpu_clk.hw, 2886 [CLKID_MPEG_SEL] = &meson8b_mpeg_clk_sel.hw, 2887 [CLKID_MPEG_DIV] = &meson8b_mpeg_clk_div.hw, 2888 [CLKID_CLK81] = &meson8b_clk81.hw, 2889 [CLKID_DDR] = &meson8b_ddr.hw, 2890 [CLKID_DOS] = &meson8b_dos.hw, 2891 [CLKID_ISA] = &meson8b_isa.hw, 2892 [CLKID_PL301] = &meson8b_pl301.hw, 2893 [CLKID_PERIPHS] = &meson8b_periphs.hw, 2894 [CLKID_SPICC] = &meson8b_spicc.hw, 2895 [CLKID_I2C] = &meson8b_i2c.hw, 2896 [CLKID_SAR_ADC] = &meson8b_sar_adc.hw, 2897 [CLKID_SMART_CARD] = &meson8b_smart_card.hw, 2898 [CLKID_RNG0] = &meson8b_rng0.hw, 2899 [CLKID_UART0] = &meson8b_uart0.hw, 2900 [CLKID_SDHC] = &meson8b_sdhc.hw, 2901 [CLKID_STREAM] = &meson8b_stream.hw, 2902 [CLKID_ASYNC_FIFO] = &meson8b_async_fifo.hw, 2903 [CLKID_SDIO] = &meson8b_sdio.hw, 2904 [CLKID_ABUF] = &meson8b_abuf.hw, 2905 [CLKID_HIU_IFACE] = &meson8b_hiu_iface.hw, 2906 [CLKID_ASSIST_MISC] = &meson8b_assist_misc.hw, 2907 [CLKID_SPI] = &meson8b_spi.hw, 2908 [CLKID_I2S_SPDIF] = &meson8b_i2s_spdif.hw, 2909 [CLKID_ETH] = &meson8b_eth.hw, 2910 [CLKID_DEMUX] = &meson8b_demux.hw, 2911 [CLKID_AIU_GLUE] = &meson8b_aiu_glue.hw, 2912 [CLKID_IEC958] = &meson8b_iec958.hw, 2913 [CLKID_I2S_OUT] = &meson8b_i2s_out.hw, 2914 [CLKID_AMCLK] = &meson8b_amclk.hw, 2915 [CLKID_AIFIFO2] = &meson8b_aififo2.hw, 2916 [CLKID_MIXER] = &meson8b_mixer.hw, 2917 [CLKID_MIXER_IFACE] = &meson8b_mixer_iface.hw, 2918 [CLKID_ADC] = &meson8b_adc.hw, 2919 [CLKID_BLKMV] = &meson8b_blkmv.hw, 2920 [CLKID_AIU] = &meson8b_aiu.hw, 2921 [CLKID_UART1] = &meson8b_uart1.hw, 2922 [CLKID_G2D] = &meson8b_g2d.hw, 2923 [CLKID_USB0] = &meson8b_usb0.hw, 2924 [CLKID_USB1] = &meson8b_usb1.hw, 2925 [CLKID_RESET] = &meson8b_reset.hw, 2926 [CLKID_NAND] = &meson8b_nand.hw, 2927 [CLKID_DOS_PARSER] = &meson8b_dos_parser.hw, 2928 [CLKID_USB] = &meson8b_usb.hw, 2929 [CLKID_VDIN1] = &meson8b_vdin1.hw, 2930 [CLKID_AHB_ARB0] = &meson8b_ahb_arb0.hw, 2931 [CLKID_EFUSE] = &meson8b_efuse.hw, 2932 [CLKID_BOOT_ROM] = &meson8b_boot_rom.hw, 2933 [CLKID_AHB_DATA_BUS] = &meson8b_ahb_data_bus.hw, 2934 [CLKID_AHB_CTRL_BUS] = &meson8b_ahb_ctrl_bus.hw, 2935 [CLKID_HDMI_INTR_SYNC] = &meson8b_hdmi_intr_sync.hw, 2936 [CLKID_HDMI_PCLK] = &meson8b_hdmi_pclk.hw, 2937 [CLKID_USB1_DDR_BRIDGE] = &meson8b_usb1_ddr_bridge.hw, 2938 [CLKID_USB0_DDR_BRIDGE] = &meson8b_usb0_ddr_bridge.hw, 2939 [CLKID_MMC_PCLK] = &meson8b_mmc_pclk.hw, 2940 [CLKID_DVIN] = &meson8b_dvin.hw, 2941 [CLKID_UART2] = &meson8b_uart2.hw, 2942 [CLKID_SANA] = &meson8b_sana.hw, 2943 [CLKID_VPU_INTR] = &meson8b_vpu_intr.hw, 2944 [CLKID_SEC_AHB_AHB3_BRIDGE] = &meson8b_sec_ahb_ahb3_bridge.hw, 2945 [CLKID_CLK81_A9] = &meson8b_clk81_a9.hw, 2946 [CLKID_VCLK2_VENCI0] = &meson8b_vclk2_venci0.hw, 2947 [CLKID_VCLK2_VENCI1] = &meson8b_vclk2_venci1.hw, 2948 [CLKID_VCLK2_VENCP0] = &meson8b_vclk2_vencp0.hw, 2949 [CLKID_VCLK2_VENCP1] = &meson8b_vclk2_vencp1.hw, 2950 [CLKID_GCLK_VENCI_INT] = &meson8b_gclk_venci_int.hw, 2951 [CLKID_GCLK_VENCP_INT] = &meson8b_gclk_vencp_int.hw, 2952 [CLKID_DAC_CLK] = &meson8b_dac_clk.hw, 2953 [CLKID_AOCLK_GATE] = &meson8b_aoclk_gate.hw, 2954 [CLKID_IEC958_GATE] = &meson8b_iec958_gate.hw, 2955 [CLKID_ENC480P] = &meson8b_enc480p.hw, 2956 [CLKID_RNG1] = &meson8b_rng1.hw, 2957 [CLKID_GCLK_VENCL_INT] = &meson8b_gclk_vencl_int.hw, 2958 [CLKID_VCLK2_VENCLMCC] = &meson8b_vclk2_venclmcc.hw, 2959 [CLKID_VCLK2_VENCL] = &meson8b_vclk2_vencl.hw, 2960 [CLKID_VCLK2_OTHER] = &meson8b_vclk2_other.hw, 2961 [CLKID_EDP] = &meson8b_edp.hw, 2962 [CLKID_AO_MEDIA_CPU] = &meson8b_ao_media_cpu.hw, 2963 [CLKID_AO_AHB_SRAM] = &meson8b_ao_ahb_sram.hw, 2964 [CLKID_AO_AHB_BUS] = &meson8b_ao_ahb_bus.hw, 2965 [CLKID_AO_IFACE] = &meson8b_ao_iface.hw, 2966 [CLKID_MPLL0] = &meson8b_mpll0.hw, 2967 [CLKID_MPLL1] = &meson8b_mpll1.hw, 2968 [CLKID_MPLL2] = &meson8b_mpll2.hw, 2969 [CLKID_MPLL0_DIV] = &meson8b_mpll0_div.hw, 2970 [CLKID_MPLL1_DIV] = &meson8b_mpll1_div.hw, 2971 [CLKID_MPLL2_DIV] = &meson8b_mpll2_div.hw, 2972 [CLKID_CPU_IN_SEL] = &meson8b_cpu_in_sel.hw, 2973 [CLKID_CPU_IN_DIV2] = &meson8b_cpu_in_div2.hw, 2974 [CLKID_CPU_IN_DIV3] = &meson8b_cpu_in_div3.hw, 2975 [CLKID_CPU_SCALE_DIV] = &meson8b_cpu_scale_div.hw, 2976 [CLKID_CPU_SCALE_OUT_SEL] = &meson8b_cpu_scale_out_sel.hw, 2977 [CLKID_MPLL_PREDIV] = &meson8b_mpll_prediv.hw, 2978 [CLKID_FCLK_DIV2_DIV] = &meson8b_fclk_div2_div.hw, 2979 [CLKID_FCLK_DIV3_DIV] = &meson8b_fclk_div3_div.hw, 2980 [CLKID_FCLK_DIV4_DIV] = &meson8b_fclk_div4_div.hw, 2981 [CLKID_FCLK_DIV5_DIV] = &meson8b_fclk_div5_div.hw, 2982 [CLKID_FCLK_DIV7_DIV] = &meson8b_fclk_div7_div.hw, 2983 [CLKID_NAND_SEL] = &meson8b_nand_clk_sel.hw, 2984 [CLKID_NAND_DIV] = &meson8b_nand_clk_div.hw, 2985 [CLKID_NAND_CLK] = &meson8b_nand_clk_gate.hw, 2986 [CLKID_PLL_FIXED_DCO] = &meson8b_fixed_pll_dco.hw, 2987 [CLKID_HDMI_PLL_DCO] = &meson8b_hdmi_pll_dco.hw, 2988 [CLKID_PLL_SYS_DCO] = &meson8b_sys_pll_dco.hw, 2989 [CLKID_CPU_CLK_DIV2] = &meson8b_cpu_clk_div2.hw, 2990 [CLKID_CPU_CLK_DIV3] = &meson8b_cpu_clk_div3.hw, 2991 [CLKID_CPU_CLK_DIV4] = &meson8b_cpu_clk_div4.hw, 2992 [CLKID_CPU_CLK_DIV5] = &meson8b_cpu_clk_div5.hw, 2993 [CLKID_CPU_CLK_DIV6] = &meson8b_cpu_clk_div6.hw, 2994 [CLKID_CPU_CLK_DIV7] = &meson8b_cpu_clk_div7.hw, 2995 [CLKID_CPU_CLK_DIV8] = &meson8b_cpu_clk_div8.hw, 2996 [CLKID_APB_SEL] = &meson8b_apb_clk_sel.hw, 2997 [CLKID_APB] = &meson8b_apb_clk_gate.hw, 2998 [CLKID_PERIPH_SEL] = &meson8b_periph_clk_sel.hw, 2999 [CLKID_PERIPH] = &meson8b_periph_clk_gate.hw, 3000 [CLKID_AXI_SEL] = &meson8b_axi_clk_sel.hw, 3001 [CLKID_AXI] = &meson8b_axi_clk_gate.hw, 3002 [CLKID_L2_DRAM_SEL] = &meson8b_l2_dram_clk_sel.hw, 3003 [CLKID_L2_DRAM] = &meson8b_l2_dram_clk_gate.hw, 3004 [CLKID_HDMI_PLL_LVDS_OUT] = &meson8b_hdmi_pll_lvds_out.hw, 3005 [CLKID_HDMI_PLL_HDMI_OUT] = &meson8b_hdmi_pll_hdmi_out.hw, 3006 [CLKID_VID_PLL_IN_SEL] = &meson8b_vid_pll_in_sel.hw, 3007 [CLKID_VID_PLL_IN_EN] = &meson8b_vid_pll_in_en.hw, 3008 [CLKID_VID_PLL_PRE_DIV] = &meson8b_vid_pll_pre_div.hw, 3009 [CLKID_VID_PLL_POST_DIV] = &meson8b_vid_pll_post_div.hw, 3010 [CLKID_VID_PLL_FINAL_DIV] = &meson8b_vid_pll_final_div.hw, 3011 [CLKID_VCLK_IN_SEL] = &meson8b_vclk_in_sel.hw, 3012 [CLKID_VCLK_IN_EN] = &meson8b_vclk_in_en.hw, 3013 [CLKID_VCLK_DIV1] = &meson8b_vclk_div1_gate.hw, 3014 [CLKID_VCLK_DIV2_DIV] = &meson8b_vclk_div2_div.hw, 3015 [CLKID_VCLK_DIV2] = &meson8b_vclk_div2_div_gate.hw, 3016 [CLKID_VCLK_DIV4_DIV] = &meson8b_vclk_div4_div.hw, 3017 [CLKID_VCLK_DIV4] = &meson8b_vclk_div4_div_gate.hw, 3018 [CLKID_VCLK_DIV6_DIV] = &meson8b_vclk_div6_div.hw, 3019 [CLKID_VCLK_DIV6] = &meson8b_vclk_div6_div_gate.hw, 3020 [CLKID_VCLK_DIV12_DIV] = &meson8b_vclk_div12_div.hw, 3021 [CLKID_VCLK_DIV12] = &meson8b_vclk_div12_div_gate.hw, 3022 [CLKID_VCLK2_IN_SEL] = &meson8b_vclk2_in_sel.hw, 3023 [CLKID_VCLK2_IN_EN] = &meson8b_vclk2_clk_in_en.hw, 3024 [CLKID_VCLK2_DIV1] = &meson8b_vclk2_div1_gate.hw, 3025 [CLKID_VCLK2_DIV2_DIV] = &meson8b_vclk2_div2_div.hw, 3026 [CLKID_VCLK2_DIV2] = &meson8b_vclk2_div2_div_gate.hw, 3027 [CLKID_VCLK2_DIV4_DIV] = &meson8b_vclk2_div4_div.hw, 3028 [CLKID_VCLK2_DIV4] = &meson8b_vclk2_div4_div_gate.hw, 3029 [CLKID_VCLK2_DIV6_DIV] = &meson8b_vclk2_div6_div.hw, 3030 [CLKID_VCLK2_DIV6] = &meson8b_vclk2_div6_div_gate.hw, 3031 [CLKID_VCLK2_DIV12_DIV] = &meson8b_vclk2_div12_div.hw, 3032 [CLKID_VCLK2_DIV12] = &meson8b_vclk2_div12_div_gate.hw, 3033 [CLKID_CTS_ENCT_SEL] = &meson8b_cts_enct_sel.hw, 3034 [CLKID_CTS_ENCT] = &meson8b_cts_enct.hw, 3035 [CLKID_CTS_ENCP_SEL] = &meson8b_cts_encp_sel.hw, 3036 [CLKID_CTS_ENCP] = &meson8b_cts_encp.hw, 3037 [CLKID_CTS_ENCI_SEL] = &meson8b_cts_enci_sel.hw, 3038 [CLKID_CTS_ENCI] = &meson8b_cts_enci.hw, 3039 [CLKID_HDMI_TX_PIXEL_SEL] = &meson8b_hdmi_tx_pixel_sel.hw, 3040 [CLKID_HDMI_TX_PIXEL] = &meson8b_hdmi_tx_pixel.hw, 3041 [CLKID_CTS_ENCL_SEL] = &meson8b_cts_encl_sel.hw, 3042 [CLKID_CTS_ENCL] = &meson8b_cts_encl.hw, 3043 [CLKID_CTS_VDAC0_SEL] = &meson8b_cts_vdac0_sel.hw, 3044 [CLKID_CTS_VDAC0] = &meson8b_cts_vdac0.hw, 3045 [CLKID_HDMI_SYS_SEL] = &meson8b_hdmi_sys_sel.hw, 3046 [CLKID_HDMI_SYS_DIV] = &meson8b_hdmi_sys_div.hw, 3047 [CLKID_HDMI_SYS] = &meson8b_hdmi_sys.hw, 3048 [CLKID_MALI_0_SEL] = &meson8b_mali_0_sel.hw, 3049 [CLKID_MALI_0_DIV] = &meson8b_mali_0_div.hw, 3050 [CLKID_MALI_0] = &meson8b_mali_0.hw, 3051 [CLKID_MALI_1_SEL] = &meson8b_mali_1_sel.hw, 3052 [CLKID_MALI_1_DIV] = &meson8b_mali_1_div.hw, 3053 [CLKID_MALI_1] = &meson8b_mali_1.hw, 3054 [CLKID_MALI] = &meson8b_mali.hw, 3055 [CLKID_VPU_0_SEL] = &meson8b_vpu_0_sel.hw, 3056 [CLKID_VPU_0_DIV] = &meson8b_vpu_0_div.hw, 3057 [CLKID_VPU_0] = &meson8b_vpu_0.hw, 3058 [CLKID_VPU_1_SEL] = &meson8b_vpu_1_sel.hw, 3059 [CLKID_VPU_1_DIV] = &meson8b_vpu_1_div.hw, 3060 [CLKID_VPU_1] = &meson8b_vpu_1.hw, 3061 [CLKID_VPU] = &meson8b_vpu.hw, 3062 [CLKID_VDEC_1_SEL] = &meson8b_vdec_1_sel.hw, 3063 [CLKID_VDEC_1_1_DIV] = &meson8b_vdec_1_1_div.hw, 3064 [CLKID_VDEC_1_1] = &meson8b_vdec_1_1.hw, 3065 [CLKID_VDEC_1_2_DIV] = &meson8b_vdec_1_2_div.hw, 3066 [CLKID_VDEC_1_2] = &meson8b_vdec_1_2.hw, 3067 [CLKID_VDEC_1] = &meson8b_vdec_1.hw, 3068 [CLKID_VDEC_HCODEC_SEL] = &meson8b_vdec_hcodec_sel.hw, 3069 [CLKID_VDEC_HCODEC_DIV] = &meson8b_vdec_hcodec_div.hw, 3070 [CLKID_VDEC_HCODEC] = &meson8b_vdec_hcodec.hw, 3071 [CLKID_VDEC_2_SEL] = &meson8b_vdec_2_sel.hw, 3072 [CLKID_VDEC_2_DIV] = &meson8b_vdec_2_div.hw, 3073 [CLKID_VDEC_2] = &meson8b_vdec_2.hw, 3074 [CLKID_VDEC_HEVC_SEL] = &meson8b_vdec_hevc_sel.hw, 3075 [CLKID_VDEC_HEVC_DIV] = &meson8b_vdec_hevc_div.hw, 3076 [CLKID_VDEC_HEVC_EN] = &meson8b_vdec_hevc_en.hw, 3077 [CLKID_VDEC_HEVC] = &meson8b_vdec_hevc.hw, 3078 [CLKID_CTS_AMCLK_SEL] = &meson8b_cts_amclk_sel.hw, 3079 [CLKID_CTS_AMCLK_DIV] = &meson8b_cts_amclk_div.hw, 3080 [CLKID_CTS_AMCLK] = &meson8b_cts_amclk.hw, 3081 [CLKID_CTS_MCLK_I958_SEL] = &meson8b_cts_mclk_i958_sel.hw, 3082 [CLKID_CTS_MCLK_I958_DIV] = &meson8b_cts_mclk_i958_div.hw, 3083 [CLKID_CTS_MCLK_I958] = &meson8b_cts_mclk_i958.hw, 3084 [CLKID_CTS_I958] = &meson8b_cts_i958.hw, 3085 [CLK_NR_CLKS] = NULL, 3086 }, 3087 .num = CLK_NR_CLKS, 3088 }; 3089 3090 static struct clk_hw_onecell_data meson8m2_hw_onecell_data = { 3091 .hws = { 3092 [CLKID_XTAL] = &meson8b_xtal.hw, 3093 [CLKID_PLL_FIXED] = &meson8b_fixed_pll.hw, 3094 [CLKID_PLL_VID] = &meson8b_vid_pll.hw, 3095 [CLKID_PLL_SYS] = &meson8b_sys_pll.hw, 3096 [CLKID_FCLK_DIV2] = &meson8b_fclk_div2.hw, 3097 [CLKID_FCLK_DIV3] = &meson8b_fclk_div3.hw, 3098 [CLKID_FCLK_DIV4] = &meson8b_fclk_div4.hw, 3099 [CLKID_FCLK_DIV5] = &meson8b_fclk_div5.hw, 3100 [CLKID_FCLK_DIV7] = &meson8b_fclk_div7.hw, 3101 [CLKID_CPUCLK] = &meson8b_cpu_clk.hw, 3102 [CLKID_MPEG_SEL] = &meson8b_mpeg_clk_sel.hw, 3103 [CLKID_MPEG_DIV] = &meson8b_mpeg_clk_div.hw, 3104 [CLKID_CLK81] = &meson8b_clk81.hw, 3105 [CLKID_DDR] = &meson8b_ddr.hw, 3106 [CLKID_DOS] = &meson8b_dos.hw, 3107 [CLKID_ISA] = &meson8b_isa.hw, 3108 [CLKID_PL301] = &meson8b_pl301.hw, 3109 [CLKID_PERIPHS] = &meson8b_periphs.hw, 3110 [CLKID_SPICC] = &meson8b_spicc.hw, 3111 [CLKID_I2C] = &meson8b_i2c.hw, 3112 [CLKID_SAR_ADC] = &meson8b_sar_adc.hw, 3113 [CLKID_SMART_CARD] = &meson8b_smart_card.hw, 3114 [CLKID_RNG0] = &meson8b_rng0.hw, 3115 [CLKID_UART0] = &meson8b_uart0.hw, 3116 [CLKID_SDHC] = &meson8b_sdhc.hw, 3117 [CLKID_STREAM] = &meson8b_stream.hw, 3118 [CLKID_ASYNC_FIFO] = &meson8b_async_fifo.hw, 3119 [CLKID_SDIO] = &meson8b_sdio.hw, 3120 [CLKID_ABUF] = &meson8b_abuf.hw, 3121 [CLKID_HIU_IFACE] = &meson8b_hiu_iface.hw, 3122 [CLKID_ASSIST_MISC] = &meson8b_assist_misc.hw, 3123 [CLKID_SPI] = &meson8b_spi.hw, 3124 [CLKID_I2S_SPDIF] = &meson8b_i2s_spdif.hw, 3125 [CLKID_ETH] = &meson8b_eth.hw, 3126 [CLKID_DEMUX] = &meson8b_demux.hw, 3127 [CLKID_AIU_GLUE] = &meson8b_aiu_glue.hw, 3128 [CLKID_IEC958] = &meson8b_iec958.hw, 3129 [CLKID_I2S_OUT] = &meson8b_i2s_out.hw, 3130 [CLKID_AMCLK] = &meson8b_amclk.hw, 3131 [CLKID_AIFIFO2] = &meson8b_aififo2.hw, 3132 [CLKID_MIXER] = &meson8b_mixer.hw, 3133 [CLKID_MIXER_IFACE] = &meson8b_mixer_iface.hw, 3134 [CLKID_ADC] = &meson8b_adc.hw, 3135 [CLKID_BLKMV] = &meson8b_blkmv.hw, 3136 [CLKID_AIU] = &meson8b_aiu.hw, 3137 [CLKID_UART1] = &meson8b_uart1.hw, 3138 [CLKID_G2D] = &meson8b_g2d.hw, 3139 [CLKID_USB0] = &meson8b_usb0.hw, 3140 [CLKID_USB1] = &meson8b_usb1.hw, 3141 [CLKID_RESET] = &meson8b_reset.hw, 3142 [CLKID_NAND] = &meson8b_nand.hw, 3143 [CLKID_DOS_PARSER] = &meson8b_dos_parser.hw, 3144 [CLKID_USB] = &meson8b_usb.hw, 3145 [CLKID_VDIN1] = &meson8b_vdin1.hw, 3146 [CLKID_AHB_ARB0] = &meson8b_ahb_arb0.hw, 3147 [CLKID_EFUSE] = &meson8b_efuse.hw, 3148 [CLKID_BOOT_ROM] = &meson8b_boot_rom.hw, 3149 [CLKID_AHB_DATA_BUS] = &meson8b_ahb_data_bus.hw, 3150 [CLKID_AHB_CTRL_BUS] = &meson8b_ahb_ctrl_bus.hw, 3151 [CLKID_HDMI_INTR_SYNC] = &meson8b_hdmi_intr_sync.hw, 3152 [CLKID_HDMI_PCLK] = &meson8b_hdmi_pclk.hw, 3153 [CLKID_USB1_DDR_BRIDGE] = &meson8b_usb1_ddr_bridge.hw, 3154 [CLKID_USB0_DDR_BRIDGE] = &meson8b_usb0_ddr_bridge.hw, 3155 [CLKID_MMC_PCLK] = &meson8b_mmc_pclk.hw, 3156 [CLKID_DVIN] = &meson8b_dvin.hw, 3157 [CLKID_UART2] = &meson8b_uart2.hw, 3158 [CLKID_SANA] = &meson8b_sana.hw, 3159 [CLKID_VPU_INTR] = &meson8b_vpu_intr.hw, 3160 [CLKID_SEC_AHB_AHB3_BRIDGE] = &meson8b_sec_ahb_ahb3_bridge.hw, 3161 [CLKID_CLK81_A9] = &meson8b_clk81_a9.hw, 3162 [CLKID_VCLK2_VENCI0] = &meson8b_vclk2_venci0.hw, 3163 [CLKID_VCLK2_VENCI1] = &meson8b_vclk2_venci1.hw, 3164 [CLKID_VCLK2_VENCP0] = &meson8b_vclk2_vencp0.hw, 3165 [CLKID_VCLK2_VENCP1] = &meson8b_vclk2_vencp1.hw, 3166 [CLKID_GCLK_VENCI_INT] = &meson8b_gclk_venci_int.hw, 3167 [CLKID_GCLK_VENCP_INT] = &meson8b_gclk_vencp_int.hw, 3168 [CLKID_DAC_CLK] = &meson8b_dac_clk.hw, 3169 [CLKID_AOCLK_GATE] = &meson8b_aoclk_gate.hw, 3170 [CLKID_IEC958_GATE] = &meson8b_iec958_gate.hw, 3171 [CLKID_ENC480P] = &meson8b_enc480p.hw, 3172 [CLKID_RNG1] = &meson8b_rng1.hw, 3173 [CLKID_GCLK_VENCL_INT] = &meson8b_gclk_vencl_int.hw, 3174 [CLKID_VCLK2_VENCLMCC] = &meson8b_vclk2_venclmcc.hw, 3175 [CLKID_VCLK2_VENCL] = &meson8b_vclk2_vencl.hw, 3176 [CLKID_VCLK2_OTHER] = &meson8b_vclk2_other.hw, 3177 [CLKID_EDP] = &meson8b_edp.hw, 3178 [CLKID_AO_MEDIA_CPU] = &meson8b_ao_media_cpu.hw, 3179 [CLKID_AO_AHB_SRAM] = &meson8b_ao_ahb_sram.hw, 3180 [CLKID_AO_AHB_BUS] = &meson8b_ao_ahb_bus.hw, 3181 [CLKID_AO_IFACE] = &meson8b_ao_iface.hw, 3182 [CLKID_MPLL0] = &meson8b_mpll0.hw, 3183 [CLKID_MPLL1] = &meson8b_mpll1.hw, 3184 [CLKID_MPLL2] = &meson8b_mpll2.hw, 3185 [CLKID_MPLL0_DIV] = &meson8b_mpll0_div.hw, 3186 [CLKID_MPLL1_DIV] = &meson8b_mpll1_div.hw, 3187 [CLKID_MPLL2_DIV] = &meson8b_mpll2_div.hw, 3188 [CLKID_CPU_IN_SEL] = &meson8b_cpu_in_sel.hw, 3189 [CLKID_CPU_IN_DIV2] = &meson8b_cpu_in_div2.hw, 3190 [CLKID_CPU_IN_DIV3] = &meson8b_cpu_in_div3.hw, 3191 [CLKID_CPU_SCALE_DIV] = &meson8b_cpu_scale_div.hw, 3192 [CLKID_CPU_SCALE_OUT_SEL] = &meson8b_cpu_scale_out_sel.hw, 3193 [CLKID_MPLL_PREDIV] = &meson8b_mpll_prediv.hw, 3194 [CLKID_FCLK_DIV2_DIV] = &meson8b_fclk_div2_div.hw, 3195 [CLKID_FCLK_DIV3_DIV] = &meson8b_fclk_div3_div.hw, 3196 [CLKID_FCLK_DIV4_DIV] = &meson8b_fclk_div4_div.hw, 3197 [CLKID_FCLK_DIV5_DIV] = &meson8b_fclk_div5_div.hw, 3198 [CLKID_FCLK_DIV7_DIV] = &meson8b_fclk_div7_div.hw, 3199 [CLKID_NAND_SEL] = &meson8b_nand_clk_sel.hw, 3200 [CLKID_NAND_DIV] = &meson8b_nand_clk_div.hw, 3201 [CLKID_NAND_CLK] = &meson8b_nand_clk_gate.hw, 3202 [CLKID_PLL_FIXED_DCO] = &meson8b_fixed_pll_dco.hw, 3203 [CLKID_HDMI_PLL_DCO] = &meson8b_hdmi_pll_dco.hw, 3204 [CLKID_PLL_SYS_DCO] = &meson8b_sys_pll_dco.hw, 3205 [CLKID_CPU_CLK_DIV2] = &meson8b_cpu_clk_div2.hw, 3206 [CLKID_CPU_CLK_DIV3] = &meson8b_cpu_clk_div3.hw, 3207 [CLKID_CPU_CLK_DIV4] = &meson8b_cpu_clk_div4.hw, 3208 [CLKID_CPU_CLK_DIV5] = &meson8b_cpu_clk_div5.hw, 3209 [CLKID_CPU_CLK_DIV6] = &meson8b_cpu_clk_div6.hw, 3210 [CLKID_CPU_CLK_DIV7] = &meson8b_cpu_clk_div7.hw, 3211 [CLKID_CPU_CLK_DIV8] = &meson8b_cpu_clk_div8.hw, 3212 [CLKID_APB_SEL] = &meson8b_apb_clk_sel.hw, 3213 [CLKID_APB] = &meson8b_apb_clk_gate.hw, 3214 [CLKID_PERIPH_SEL] = &meson8b_periph_clk_sel.hw, 3215 [CLKID_PERIPH] = &meson8b_periph_clk_gate.hw, 3216 [CLKID_AXI_SEL] = &meson8b_axi_clk_sel.hw, 3217 [CLKID_AXI] = &meson8b_axi_clk_gate.hw, 3218 [CLKID_L2_DRAM_SEL] = &meson8b_l2_dram_clk_sel.hw, 3219 [CLKID_L2_DRAM] = &meson8b_l2_dram_clk_gate.hw, 3220 [CLKID_HDMI_PLL_LVDS_OUT] = &meson8b_hdmi_pll_lvds_out.hw, 3221 [CLKID_HDMI_PLL_HDMI_OUT] = &meson8b_hdmi_pll_hdmi_out.hw, 3222 [CLKID_VID_PLL_IN_SEL] = &meson8b_vid_pll_in_sel.hw, 3223 [CLKID_VID_PLL_IN_EN] = &meson8b_vid_pll_in_en.hw, 3224 [CLKID_VID_PLL_PRE_DIV] = &meson8b_vid_pll_pre_div.hw, 3225 [CLKID_VID_PLL_POST_DIV] = &meson8b_vid_pll_post_div.hw, 3226 [CLKID_VID_PLL_FINAL_DIV] = &meson8b_vid_pll_final_div.hw, 3227 [CLKID_VCLK_IN_SEL] = &meson8b_vclk_in_sel.hw, 3228 [CLKID_VCLK_IN_EN] = &meson8b_vclk_in_en.hw, 3229 [CLKID_VCLK_DIV1] = &meson8b_vclk_div1_gate.hw, 3230 [CLKID_VCLK_DIV2_DIV] = &meson8b_vclk_div2_div.hw, 3231 [CLKID_VCLK_DIV2] = &meson8b_vclk_div2_div_gate.hw, 3232 [CLKID_VCLK_DIV4_DIV] = &meson8b_vclk_div4_div.hw, 3233 [CLKID_VCLK_DIV4] = &meson8b_vclk_div4_div_gate.hw, 3234 [CLKID_VCLK_DIV6_DIV] = &meson8b_vclk_div6_div.hw, 3235 [CLKID_VCLK_DIV6] = &meson8b_vclk_div6_div_gate.hw, 3236 [CLKID_VCLK_DIV12_DIV] = &meson8b_vclk_div12_div.hw, 3237 [CLKID_VCLK_DIV12] = &meson8b_vclk_div12_div_gate.hw, 3238 [CLKID_VCLK2_IN_SEL] = &meson8b_vclk2_in_sel.hw, 3239 [CLKID_VCLK2_IN_EN] = &meson8b_vclk2_clk_in_en.hw, 3240 [CLKID_VCLK2_DIV1] = &meson8b_vclk2_div1_gate.hw, 3241 [CLKID_VCLK2_DIV2_DIV] = &meson8b_vclk2_div2_div.hw, 3242 [CLKID_VCLK2_DIV2] = &meson8b_vclk2_div2_div_gate.hw, 3243 [CLKID_VCLK2_DIV4_DIV] = &meson8b_vclk2_div4_div.hw, 3244 [CLKID_VCLK2_DIV4] = &meson8b_vclk2_div4_div_gate.hw, 3245 [CLKID_VCLK2_DIV6_DIV] = &meson8b_vclk2_div6_div.hw, 3246 [CLKID_VCLK2_DIV6] = &meson8b_vclk2_div6_div_gate.hw, 3247 [CLKID_VCLK2_DIV12_DIV] = &meson8b_vclk2_div12_div.hw, 3248 [CLKID_VCLK2_DIV12] = &meson8b_vclk2_div12_div_gate.hw, 3249 [CLKID_CTS_ENCT_SEL] = &meson8b_cts_enct_sel.hw, 3250 [CLKID_CTS_ENCT] = &meson8b_cts_enct.hw, 3251 [CLKID_CTS_ENCP_SEL] = &meson8b_cts_encp_sel.hw, 3252 [CLKID_CTS_ENCP] = &meson8b_cts_encp.hw, 3253 [CLKID_CTS_ENCI_SEL] = &meson8b_cts_enci_sel.hw, 3254 [CLKID_CTS_ENCI] = &meson8b_cts_enci.hw, 3255 [CLKID_HDMI_TX_PIXEL_SEL] = &meson8b_hdmi_tx_pixel_sel.hw, 3256 [CLKID_HDMI_TX_PIXEL] = &meson8b_hdmi_tx_pixel.hw, 3257 [CLKID_CTS_ENCL_SEL] = &meson8b_cts_encl_sel.hw, 3258 [CLKID_CTS_ENCL] = &meson8b_cts_encl.hw, 3259 [CLKID_CTS_VDAC0_SEL] = &meson8b_cts_vdac0_sel.hw, 3260 [CLKID_CTS_VDAC0] = &meson8b_cts_vdac0.hw, 3261 [CLKID_HDMI_SYS_SEL] = &meson8b_hdmi_sys_sel.hw, 3262 [CLKID_HDMI_SYS_DIV] = &meson8b_hdmi_sys_div.hw, 3263 [CLKID_HDMI_SYS] = &meson8b_hdmi_sys.hw, 3264 [CLKID_MALI_0_SEL] = &meson8b_mali_0_sel.hw, 3265 [CLKID_MALI_0_DIV] = &meson8b_mali_0_div.hw, 3266 [CLKID_MALI_0] = &meson8b_mali_0.hw, 3267 [CLKID_MALI_1_SEL] = &meson8b_mali_1_sel.hw, 3268 [CLKID_MALI_1_DIV] = &meson8b_mali_1_div.hw, 3269 [CLKID_MALI_1] = &meson8b_mali_1.hw, 3270 [CLKID_MALI] = &meson8b_mali.hw, 3271 [CLKID_GP_PLL_DCO] = &meson8m2_gp_pll_dco.hw, 3272 [CLKID_GP_PLL] = &meson8m2_gp_pll.hw, 3273 [CLKID_VPU_0_SEL] = &meson8m2_vpu_0_sel.hw, 3274 [CLKID_VPU_0_DIV] = &meson8b_vpu_0_div.hw, 3275 [CLKID_VPU_0] = &meson8b_vpu_0.hw, 3276 [CLKID_VPU_1_SEL] = &meson8m2_vpu_1_sel.hw, 3277 [CLKID_VPU_1_DIV] = &meson8b_vpu_1_div.hw, 3278 [CLKID_VPU_1] = &meson8b_vpu_1.hw, 3279 [CLKID_VPU] = &meson8b_vpu.hw, 3280 [CLKID_VDEC_1_SEL] = &meson8b_vdec_1_sel.hw, 3281 [CLKID_VDEC_1_1_DIV] = &meson8b_vdec_1_1_div.hw, 3282 [CLKID_VDEC_1_1] = &meson8b_vdec_1_1.hw, 3283 [CLKID_VDEC_1_2_DIV] = &meson8b_vdec_1_2_div.hw, 3284 [CLKID_VDEC_1_2] = &meson8b_vdec_1_2.hw, 3285 [CLKID_VDEC_1] = &meson8b_vdec_1.hw, 3286 [CLKID_VDEC_HCODEC_SEL] = &meson8b_vdec_hcodec_sel.hw, 3287 [CLKID_VDEC_HCODEC_DIV] = &meson8b_vdec_hcodec_div.hw, 3288 [CLKID_VDEC_HCODEC] = &meson8b_vdec_hcodec.hw, 3289 [CLKID_VDEC_2_SEL] = &meson8b_vdec_2_sel.hw, 3290 [CLKID_VDEC_2_DIV] = &meson8b_vdec_2_div.hw, 3291 [CLKID_VDEC_2] = &meson8b_vdec_2.hw, 3292 [CLKID_VDEC_HEVC_SEL] = &meson8b_vdec_hevc_sel.hw, 3293 [CLKID_VDEC_HEVC_DIV] = &meson8b_vdec_hevc_div.hw, 3294 [CLKID_VDEC_HEVC_EN] = &meson8b_vdec_hevc_en.hw, 3295 [CLKID_VDEC_HEVC] = &meson8b_vdec_hevc.hw, 3296 [CLKID_CTS_AMCLK_SEL] = &meson8b_cts_amclk_sel.hw, 3297 [CLKID_CTS_AMCLK_DIV] = &meson8b_cts_amclk_div.hw, 3298 [CLKID_CTS_AMCLK] = &meson8b_cts_amclk.hw, 3299 [CLKID_CTS_MCLK_I958_SEL] = &meson8b_cts_mclk_i958_sel.hw, 3300 [CLKID_CTS_MCLK_I958_DIV] = &meson8b_cts_mclk_i958_div.hw, 3301 [CLKID_CTS_MCLK_I958] = &meson8b_cts_mclk_i958.hw, 3302 [CLKID_CTS_I958] = &meson8b_cts_i958.hw, 3303 [CLK_NR_CLKS] = NULL, 3304 }, 3305 .num = CLK_NR_CLKS, 3306 }; 3307 3308 static struct clk_regmap *const meson8b_clk_regmaps[] = { 3309 &meson8b_clk81, 3310 &meson8b_ddr, 3311 &meson8b_dos, 3312 &meson8b_isa, 3313 &meson8b_pl301, 3314 &meson8b_periphs, 3315 &meson8b_spicc, 3316 &meson8b_i2c, 3317 &meson8b_sar_adc, 3318 &meson8b_smart_card, 3319 &meson8b_rng0, 3320 &meson8b_uart0, 3321 &meson8b_sdhc, 3322 &meson8b_stream, 3323 &meson8b_async_fifo, 3324 &meson8b_sdio, 3325 &meson8b_abuf, 3326 &meson8b_hiu_iface, 3327 &meson8b_assist_misc, 3328 &meson8b_spi, 3329 &meson8b_i2s_spdif, 3330 &meson8b_eth, 3331 &meson8b_demux, 3332 &meson8b_aiu_glue, 3333 &meson8b_iec958, 3334 &meson8b_i2s_out, 3335 &meson8b_amclk, 3336 &meson8b_aififo2, 3337 &meson8b_mixer, 3338 &meson8b_mixer_iface, 3339 &meson8b_adc, 3340 &meson8b_blkmv, 3341 &meson8b_aiu, 3342 &meson8b_uart1, 3343 &meson8b_g2d, 3344 &meson8b_usb0, 3345 &meson8b_usb1, 3346 &meson8b_reset, 3347 &meson8b_nand, 3348 &meson8b_dos_parser, 3349 &meson8b_usb, 3350 &meson8b_vdin1, 3351 &meson8b_ahb_arb0, 3352 &meson8b_efuse, 3353 &meson8b_boot_rom, 3354 &meson8b_ahb_data_bus, 3355 &meson8b_ahb_ctrl_bus, 3356 &meson8b_hdmi_intr_sync, 3357 &meson8b_hdmi_pclk, 3358 &meson8b_usb1_ddr_bridge, 3359 &meson8b_usb0_ddr_bridge, 3360 &meson8b_mmc_pclk, 3361 &meson8b_dvin, 3362 &meson8b_uart2, 3363 &meson8b_sana, 3364 &meson8b_vpu_intr, 3365 &meson8b_sec_ahb_ahb3_bridge, 3366 &meson8b_clk81_a9, 3367 &meson8b_vclk2_venci0, 3368 &meson8b_vclk2_venci1, 3369 &meson8b_vclk2_vencp0, 3370 &meson8b_vclk2_vencp1, 3371 &meson8b_gclk_venci_int, 3372 &meson8b_gclk_vencp_int, 3373 &meson8b_dac_clk, 3374 &meson8b_aoclk_gate, 3375 &meson8b_iec958_gate, 3376 &meson8b_enc480p, 3377 &meson8b_rng1, 3378 &meson8b_gclk_vencl_int, 3379 &meson8b_vclk2_venclmcc, 3380 &meson8b_vclk2_vencl, 3381 &meson8b_vclk2_other, 3382 &meson8b_edp, 3383 &meson8b_ao_media_cpu, 3384 &meson8b_ao_ahb_sram, 3385 &meson8b_ao_ahb_bus, 3386 &meson8b_ao_iface, 3387 &meson8b_mpeg_clk_div, 3388 &meson8b_mpeg_clk_sel, 3389 &meson8b_mpll0, 3390 &meson8b_mpll1, 3391 &meson8b_mpll2, 3392 &meson8b_mpll0_div, 3393 &meson8b_mpll1_div, 3394 &meson8b_mpll2_div, 3395 &meson8b_fixed_pll, 3396 &meson8b_sys_pll, 3397 &meson8b_cpu_in_sel, 3398 &meson8b_cpu_scale_div, 3399 &meson8b_cpu_scale_out_sel, 3400 &meson8b_cpu_clk, 3401 &meson8b_mpll_prediv, 3402 &meson8b_fclk_div2, 3403 &meson8b_fclk_div3, 3404 &meson8b_fclk_div4, 3405 &meson8b_fclk_div5, 3406 &meson8b_fclk_div7, 3407 &meson8b_nand_clk_sel, 3408 &meson8b_nand_clk_div, 3409 &meson8b_nand_clk_gate, 3410 &meson8b_fixed_pll_dco, 3411 &meson8b_hdmi_pll_dco, 3412 &meson8b_sys_pll_dco, 3413 &meson8b_apb_clk_sel, 3414 &meson8b_apb_clk_gate, 3415 &meson8b_periph_clk_sel, 3416 &meson8b_periph_clk_gate, 3417 &meson8b_axi_clk_sel, 3418 &meson8b_axi_clk_gate, 3419 &meson8b_l2_dram_clk_sel, 3420 &meson8b_l2_dram_clk_gate, 3421 &meson8b_hdmi_pll_lvds_out, 3422 &meson8b_hdmi_pll_hdmi_out, 3423 &meson8b_vid_pll_in_sel, 3424 &meson8b_vid_pll_in_en, 3425 &meson8b_vid_pll_pre_div, 3426 &meson8b_vid_pll_post_div, 3427 &meson8b_vid_pll, 3428 &meson8b_vid_pll_final_div, 3429 &meson8b_vclk_in_sel, 3430 &meson8b_vclk_in_en, 3431 &meson8b_vclk_div1_gate, 3432 &meson8b_vclk_div2_div_gate, 3433 &meson8b_vclk_div4_div_gate, 3434 &meson8b_vclk_div6_div_gate, 3435 &meson8b_vclk_div12_div_gate, 3436 &meson8b_vclk2_in_sel, 3437 &meson8b_vclk2_clk_in_en, 3438 &meson8b_vclk2_div1_gate, 3439 &meson8b_vclk2_div2_div_gate, 3440 &meson8b_vclk2_div4_div_gate, 3441 &meson8b_vclk2_div6_div_gate, 3442 &meson8b_vclk2_div12_div_gate, 3443 &meson8b_cts_enct_sel, 3444 &meson8b_cts_enct, 3445 &meson8b_cts_encp_sel, 3446 &meson8b_cts_encp, 3447 &meson8b_cts_enci_sel, 3448 &meson8b_cts_enci, 3449 &meson8b_hdmi_tx_pixel_sel, 3450 &meson8b_hdmi_tx_pixel, 3451 &meson8b_cts_encl_sel, 3452 &meson8b_cts_encl, 3453 &meson8b_cts_vdac0_sel, 3454 &meson8b_cts_vdac0, 3455 &meson8b_hdmi_sys_sel, 3456 &meson8b_hdmi_sys_div, 3457 &meson8b_hdmi_sys, 3458 &meson8b_mali_0_sel, 3459 &meson8b_mali_0_div, 3460 &meson8b_mali_0, 3461 &meson8b_mali_1_sel, 3462 &meson8b_mali_1_div, 3463 &meson8b_mali_1, 3464 &meson8b_mali, 3465 &meson8m2_gp_pll_dco, 3466 &meson8m2_gp_pll, 3467 &meson8b_vpu_0_sel, 3468 &meson8m2_vpu_0_sel, 3469 &meson8b_vpu_0_div, 3470 &meson8b_vpu_0, 3471 &meson8b_vpu_1_sel, 3472 &meson8m2_vpu_1_sel, 3473 &meson8b_vpu_1_div, 3474 &meson8b_vpu_1, 3475 &meson8b_vpu, 3476 &meson8b_vdec_1_sel, 3477 &meson8b_vdec_1_1_div, 3478 &meson8b_vdec_1_1, 3479 &meson8b_vdec_1_2_div, 3480 &meson8b_vdec_1_2, 3481 &meson8b_vdec_1, 3482 &meson8b_vdec_hcodec_sel, 3483 &meson8b_vdec_hcodec_div, 3484 &meson8b_vdec_hcodec, 3485 &meson8b_vdec_2_sel, 3486 &meson8b_vdec_2_div, 3487 &meson8b_vdec_2, 3488 &meson8b_vdec_hevc_sel, 3489 &meson8b_vdec_hevc_div, 3490 &meson8b_vdec_hevc_en, 3491 &meson8b_vdec_hevc, 3492 &meson8b_cts_amclk, 3493 &meson8b_cts_amclk_sel, 3494 &meson8b_cts_amclk_div, 3495 &meson8b_cts_mclk_i958_sel, 3496 &meson8b_cts_mclk_i958_div, 3497 &meson8b_cts_mclk_i958, 3498 &meson8b_cts_i958, 3499 }; 3500 3501 static const struct meson8b_clk_reset_line { 3502 u32 reg; 3503 u8 bit_idx; 3504 } meson8b_clk_reset_bits[] = { 3505 [CLKC_RESET_L2_CACHE_SOFT_RESET] = { 3506 .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 30 3507 }, 3508 [CLKC_RESET_AXI_64_TO_128_BRIDGE_A5_SOFT_RESET] = { 3509 .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 29 3510 }, 3511 [CLKC_RESET_SCU_SOFT_RESET] = { 3512 .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 28 3513 }, 3514 [CLKC_RESET_CPU3_SOFT_RESET] = { 3515 .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 27 3516 }, 3517 [CLKC_RESET_CPU2_SOFT_RESET] = { 3518 .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 26 3519 }, 3520 [CLKC_RESET_CPU1_SOFT_RESET] = { 3521 .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 25 3522 }, 3523 [CLKC_RESET_CPU0_SOFT_RESET] = { 3524 .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 24 3525 }, 3526 [CLKC_RESET_A5_GLOBAL_RESET] = { 3527 .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 18 3528 }, 3529 [CLKC_RESET_A5_AXI_SOFT_RESET] = { 3530 .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 17 3531 }, 3532 [CLKC_RESET_A5_ABP_SOFT_RESET] = { 3533 .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 16 3534 }, 3535 [CLKC_RESET_AXI_64_TO_128_BRIDGE_MMC_SOFT_RESET] = { 3536 .reg = HHI_SYS_CPU_CLK_CNTL1, .bit_idx = 30 3537 }, 3538 [CLKC_RESET_VID_CLK_CNTL_SOFT_RESET] = { 3539 .reg = HHI_VID_CLK_CNTL, .bit_idx = 15 3540 }, 3541 [CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_POST] = { 3542 .reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 7 3543 }, 3544 [CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_PRE] = { 3545 .reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 3 3546 }, 3547 [CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_POST] = { 3548 .reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 1 3549 }, 3550 [CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_PRE] = { 3551 .reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 0 3552 }, 3553 }; 3554 3555 static int meson8b_clk_reset_update(struct reset_controller_dev *rcdev, 3556 unsigned long id, bool assert) 3557 { 3558 struct meson8b_clk_reset *meson8b_clk_reset = 3559 container_of(rcdev, struct meson8b_clk_reset, reset); 3560 unsigned long flags; 3561 const struct meson8b_clk_reset_line *reset; 3562 3563 if (id >= ARRAY_SIZE(meson8b_clk_reset_bits)) 3564 return -EINVAL; 3565 3566 reset = &meson8b_clk_reset_bits[id]; 3567 3568 spin_lock_irqsave(&meson_clk_lock, flags); 3569 3570 if (assert) 3571 regmap_update_bits(meson8b_clk_reset->regmap, reset->reg, 3572 BIT(reset->bit_idx), BIT(reset->bit_idx)); 3573 else 3574 regmap_update_bits(meson8b_clk_reset->regmap, reset->reg, 3575 BIT(reset->bit_idx), 0); 3576 3577 spin_unlock_irqrestore(&meson_clk_lock, flags); 3578 3579 return 0; 3580 } 3581 3582 static int meson8b_clk_reset_assert(struct reset_controller_dev *rcdev, 3583 unsigned long id) 3584 { 3585 return meson8b_clk_reset_update(rcdev, id, true); 3586 } 3587 3588 static int meson8b_clk_reset_deassert(struct reset_controller_dev *rcdev, 3589 unsigned long id) 3590 { 3591 return meson8b_clk_reset_update(rcdev, id, false); 3592 } 3593 3594 static const struct reset_control_ops meson8b_clk_reset_ops = { 3595 .assert = meson8b_clk_reset_assert, 3596 .deassert = meson8b_clk_reset_deassert, 3597 }; 3598 3599 struct meson8b_nb_data { 3600 struct notifier_block nb; 3601 struct clk_hw *cpu_clk; 3602 }; 3603 3604 static int meson8b_cpu_clk_notifier_cb(struct notifier_block *nb, 3605 unsigned long event, void *data) 3606 { 3607 struct meson8b_nb_data *nb_data = 3608 container_of(nb, struct meson8b_nb_data, nb); 3609 struct clk_hw *parent_clk; 3610 int ret; 3611 3612 switch (event) { 3613 case PRE_RATE_CHANGE: 3614 /* xtal */ 3615 parent_clk = clk_hw_get_parent_by_index(nb_data->cpu_clk, 0); 3616 break; 3617 3618 case POST_RATE_CHANGE: 3619 /* cpu_scale_out_sel */ 3620 parent_clk = clk_hw_get_parent_by_index(nb_data->cpu_clk, 1); 3621 break; 3622 3623 default: 3624 return NOTIFY_DONE; 3625 } 3626 3627 ret = clk_hw_set_parent(nb_data->cpu_clk, parent_clk); 3628 if (ret) 3629 return notifier_from_errno(ret); 3630 3631 udelay(100); 3632 3633 return NOTIFY_OK; 3634 } 3635 3636 static struct meson8b_nb_data meson8b_cpu_nb_data = { 3637 .nb.notifier_call = meson8b_cpu_clk_notifier_cb, 3638 }; 3639 3640 static const struct regmap_config clkc_regmap_config = { 3641 .reg_bits = 32, 3642 .val_bits = 32, 3643 .reg_stride = 4, 3644 }; 3645 3646 static void __init meson8b_clkc_init_common(struct device_node *np, 3647 struct clk_hw_onecell_data *clk_hw_onecell_data) 3648 { 3649 struct meson8b_clk_reset *rstc; 3650 const char *notifier_clk_name; 3651 struct clk *notifier_clk; 3652 void __iomem *clk_base; 3653 struct regmap *map; 3654 int i, ret; 3655 3656 map = syscon_node_to_regmap(of_get_parent(np)); 3657 if (IS_ERR(map)) { 3658 pr_info("failed to get HHI regmap - Trying obsolete regs\n"); 3659 3660 /* Generic clocks, PLLs and some of the reset-bits */ 3661 clk_base = of_iomap(np, 1); 3662 if (!clk_base) { 3663 pr_err("%s: Unable to map clk base\n", __func__); 3664 return; 3665 } 3666 3667 map = regmap_init_mmio(NULL, clk_base, &clkc_regmap_config); 3668 if (IS_ERR(map)) 3669 return; 3670 } 3671 3672 rstc = kzalloc(sizeof(*rstc), GFP_KERNEL); 3673 if (!rstc) 3674 return; 3675 3676 /* Reset Controller */ 3677 rstc->regmap = map; 3678 rstc->reset.ops = &meson8b_clk_reset_ops; 3679 rstc->reset.nr_resets = ARRAY_SIZE(meson8b_clk_reset_bits); 3680 rstc->reset.of_node = np; 3681 ret = reset_controller_register(&rstc->reset); 3682 if (ret) { 3683 pr_err("%s: Failed to register clkc reset controller: %d\n", 3684 __func__, ret); 3685 return; 3686 } 3687 3688 /* Populate regmap for the regmap backed clocks */ 3689 for (i = 0; i < ARRAY_SIZE(meson8b_clk_regmaps); i++) 3690 meson8b_clk_regmaps[i]->map = map; 3691 3692 /* 3693 * always skip CLKID_UNUSED and also skip XTAL if the .dtb provides the 3694 * XTAL clock as input. 3695 */ 3696 if (!IS_ERR(of_clk_get_by_name(np, "xtal"))) 3697 i = CLKID_PLL_FIXED; 3698 else 3699 i = CLKID_XTAL; 3700 3701 /* register all clks */ 3702 for (; i < CLK_NR_CLKS; i++) { 3703 /* array might be sparse */ 3704 if (!clk_hw_onecell_data->hws[i]) 3705 continue; 3706 3707 ret = of_clk_hw_register(np, clk_hw_onecell_data->hws[i]); 3708 if (ret) 3709 return; 3710 } 3711 3712 meson8b_cpu_nb_data.cpu_clk = clk_hw_onecell_data->hws[CLKID_CPUCLK]; 3713 3714 /* 3715 * FIXME we shouldn't program the muxes in notifier handlers. The 3716 * tricky programming sequence will be handled by the forthcoming 3717 * coordinated clock rates mechanism once that feature is released. 3718 */ 3719 notifier_clk_name = clk_hw_get_name(&meson8b_cpu_scale_out_sel.hw); 3720 notifier_clk = __clk_lookup(notifier_clk_name); 3721 ret = clk_notifier_register(notifier_clk, &meson8b_cpu_nb_data.nb); 3722 if (ret) { 3723 pr_err("%s: failed to register the CPU clock notifier\n", 3724 __func__); 3725 return; 3726 } 3727 3728 ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, 3729 clk_hw_onecell_data); 3730 if (ret) 3731 pr_err("%s: failed to register clock provider\n", __func__); 3732 } 3733 3734 static void __init meson8_clkc_init(struct device_node *np) 3735 { 3736 return meson8b_clkc_init_common(np, &meson8_hw_onecell_data); 3737 } 3738 3739 static void __init meson8b_clkc_init(struct device_node *np) 3740 { 3741 return meson8b_clkc_init_common(np, &meson8b_hw_onecell_data); 3742 } 3743 3744 static void __init meson8m2_clkc_init(struct device_node *np) 3745 { 3746 return meson8b_clkc_init_common(np, &meson8m2_hw_onecell_data); 3747 } 3748 3749 CLK_OF_DECLARE_DRIVER(meson8_clkc, "amlogic,meson8-clkc", 3750 meson8_clkc_init); 3751 CLK_OF_DECLARE_DRIVER(meson8b_clkc, "amlogic,meson8b-clkc", 3752 meson8b_clkc_init); 3753 CLK_OF_DECLARE_DRIVER(meson8m2_clkc, "amlogic,meson8m2-clkc", 3754 meson8m2_clkc_init); 3755