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