aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/clk/mediatek/clk-mt6797.c68
1 files changed, 43 insertions, 25 deletions
diff --git a/drivers/clk/mediatek/clk-mt6797.c b/drivers/clk/mediatek/clk-mt6797.c
index 5702bc974ed9..c2b46b184b9a 100644
--- a/drivers/clk/mediatek/clk-mt6797.c
+++ b/drivers/clk/mediatek/clk-mt6797.c
@@ -324,6 +324,10 @@ static const char * const anc_md32_parents[] = {
324 "univpll_d5", 324 "univpll_d5",
325}; 325};
326 326
327/*
328 * Clock mux ddrphycfg is needed by the DRAM controller. We mark it as
329 * critical as otherwise the system will hang after boot.
330 */
327static const struct mtk_composite top_muxes[] = { 331static const struct mtk_composite top_muxes[] = {
328 MUX(CLK_TOP_MUX_ULPOSC_AXI_CK_MUX_PRE, "ulposc_axi_ck_mux_pre", 332 MUX(CLK_TOP_MUX_ULPOSC_AXI_CK_MUX_PRE, "ulposc_axi_ck_mux_pre",
329 ulposc_axi_ck_mux_pre_parents, 0x0040, 3, 1), 333 ulposc_axi_ck_mux_pre_parents, 0x0040, 3, 1),
@@ -331,8 +335,8 @@ static const struct mtk_composite top_muxes[] = {
331 ulposc_axi_ck_mux_parents, 0x0040, 2, 1), 335 ulposc_axi_ck_mux_parents, 0x0040, 2, 1),
332 MUX(CLK_TOP_MUX_AXI, "axi_sel", axi_parents, 336 MUX(CLK_TOP_MUX_AXI, "axi_sel", axi_parents,
333 0x0040, 0, 2), 337 0x0040, 0, 2),
334 MUX(CLK_TOP_MUX_DDRPHYCFG, "ddrphycfg_sel", ddrphycfg_parents, 338 MUX_FLAGS(CLK_TOP_MUX_DDRPHYCFG, "ddrphycfg_sel", ddrphycfg_parents,
335 0x0040, 16, 2), 339 0x0040, 16, 2, CLK_IS_CRITICAL | CLK_SET_RATE_PARENT),
336 MUX(CLK_TOP_MUX_MM, "mm_sel", mm_parents, 340 MUX(CLK_TOP_MUX_MM, "mm_sel", mm_parents,
337 0x0040, 24, 2), 341 0x0040, 24, 2),
338 MUX_GATE(CLK_TOP_MUX_PWM, "pwm_sel", pwm_parents, 0x0050, 0, 3, 7), 342 MUX_GATE(CLK_TOP_MUX_PWM, "pwm_sel", pwm_parents, 0x0050, 0, 3, 7),
@@ -424,33 +428,45 @@ static const struct mtk_gate_regs infra2_cg_regs = {
424 .sta_ofs = 0x00b0, 428 .sta_ofs = 0x00b0,
425}; 429};
426 430
427#define GATE_ICG0(_id, _name, _parent, _shift) { \ 431#define GATE_ICG0(_id, _name, _parent, _shift) { \
428 .id = _id, \ 432 .id = _id, \
429 .name = _name, \ 433 .name = _name, \
430 .parent_name = _parent, \ 434 .parent_name = _parent, \
431 .regs = &infra0_cg_regs, \ 435 .regs = &infra0_cg_regs, \
432 .shift = _shift, \ 436 .shift = _shift, \
433 .ops = &mtk_clk_gate_ops_setclr, \ 437 .ops = &mtk_clk_gate_ops_setclr, \
434} 438}
435 439
436#define GATE_ICG1(_id, _name, _parent, _shift) { \ 440#define GATE_ICG1(_id, _name, _parent, _shift) \
437 .id = _id, \ 441 GATE_ICG1_FLAGS(_id, _name, _parent, _shift, 0)
438 .name = _name, \ 442
439 .parent_name = _parent, \ 443#define GATE_ICG1_FLAGS(_id, _name, _parent, _shift, _flags) { \
440 .regs = &infra1_cg_regs, \ 444 .id = _id, \
441 .shift = _shift, \ 445 .name = _name, \
442 .ops = &mtk_clk_gate_ops_setclr, \ 446 .parent_name = _parent, \
447 .regs = &infra1_cg_regs, \
448 .shift = _shift, \
449 .ops = &mtk_clk_gate_ops_setclr, \
450 .flags = _flags, \
443} 451}
444 452
445#define GATE_ICG2(_id, _name, _parent, _shift) { \ 453#define GATE_ICG2(_id, _name, _parent, _shift) \
446 .id = _id, \ 454 GATE_ICG2_FLAGS(_id, _name, _parent, _shift, 0)
447 .name = _name, \ 455
448 .parent_name = _parent, \ 456#define GATE_ICG2_FLAGS(_id, _name, _parent, _shift, _flags) { \
449 .regs = &infra2_cg_regs, \ 457 .id = _id, \
450 .shift = _shift, \ 458 .name = _name, \
451 .ops = &mtk_clk_gate_ops_setclr, \ 459 .parent_name = _parent, \
460 .regs = &infra2_cg_regs, \
461 .shift = _shift, \
462 .ops = &mtk_clk_gate_ops_setclr, \
463 .flags = _flags, \
452} 464}
453 465
466/*
467 * Clock gates dramc and dramc_b are needed by the DRAM controller.
468 * We mark them as critical as otherwise the system will hang after boot.
469 */
454static const struct mtk_gate infra_clks[] = { 470static const struct mtk_gate infra_clks[] = {
455 GATE_ICG0(CLK_INFRA_PMIC_TMR, "infra_pmic_tmr", "ulposc", 0), 471 GATE_ICG0(CLK_INFRA_PMIC_TMR, "infra_pmic_tmr", "ulposc", 0),
456 GATE_ICG0(CLK_INFRA_PMIC_AP, "infra_pmic_ap", "pmicspi_sel", 1), 472 GATE_ICG0(CLK_INFRA_PMIC_AP, "infra_pmic_ap", "pmicspi_sel", 1),
@@ -505,7 +521,8 @@ static const struct mtk_gate infra_clks[] = {
505 GATE_ICG1(CLK_INFRA_CCIF_AP, "infra_ccif_ap", "axi_sel", 23), 521 GATE_ICG1(CLK_INFRA_CCIF_AP, "infra_ccif_ap", "axi_sel", 23),
506 GATE_ICG1(CLK_INFRA_AUDIO, "infra_audio", "axi_sel", 25), 522 GATE_ICG1(CLK_INFRA_AUDIO, "infra_audio", "axi_sel", 25),
507 GATE_ICG1(CLK_INFRA_CCIF_MD, "infra_ccif_md", "axi_sel", 26), 523 GATE_ICG1(CLK_INFRA_CCIF_MD, "infra_ccif_md", "axi_sel", 26),
508 GATE_ICG1(CLK_INFRA_DRAMC_F26M, "infra_dramc_f26m", "clk26m", 31), 524 GATE_ICG1_FLAGS(CLK_INFRA_DRAMC_F26M, "infra_dramc_f26m",
525 "clk26m", 31, CLK_IS_CRITICAL),
509 GATE_ICG2(CLK_INFRA_I2C4, "infra_i2c4", "axi_sel", 0), 526 GATE_ICG2(CLK_INFRA_I2C4, "infra_i2c4", "axi_sel", 0),
510 GATE_ICG2(CLK_INFRA_I2C_APPM, "infra_i2c_appm", "axi_sel", 1), 527 GATE_ICG2(CLK_INFRA_I2C_APPM, "infra_i2c_appm", "axi_sel", 1),
511 GATE_ICG2(CLK_INFRA_I2C_GPUPM, "infra_i2c_gpupm", "axi_sel", 2), 528 GATE_ICG2(CLK_INFRA_I2C_GPUPM, "infra_i2c_gpupm", "axi_sel", 2),
@@ -516,7 +533,8 @@ static const struct mtk_gate infra_clks[] = {
516 GATE_ICG2(CLK_INFRA_I2C5, "infra_i2c5", "axi_sel", 7), 533 GATE_ICG2(CLK_INFRA_I2C5, "infra_i2c5", "axi_sel", 7),
517 GATE_ICG2(CLK_INFRA_SYS_CIRQ, "infra_sys_cirq", "axi_sel", 8), 534 GATE_ICG2(CLK_INFRA_SYS_CIRQ, "infra_sys_cirq", "axi_sel", 8),
518 GATE_ICG2(CLK_INFRA_SPI1, "infra_spi1", "spi_sel", 10), 535 GATE_ICG2(CLK_INFRA_SPI1, "infra_spi1", "spi_sel", 10),
519 GATE_ICG2(CLK_INFRA_DRAMC_B_F26M, "infra_dramc_b_f26m", "clk26m", 11), 536 GATE_ICG2_FLAGS(CLK_INFRA_DRAMC_B_F26M, "infra_dramc_b_f26m",
537 "clk26m", 11, CLK_IS_CRITICAL),
520 GATE_ICG2(CLK_INFRA_ANC_MD32, "infra_anc_md32", "anc_md32_sel", 12), 538 GATE_ICG2(CLK_INFRA_ANC_MD32, "infra_anc_md32", "anc_md32_sel", 12),
521 GATE_ICG2(CLK_INFRA_ANC_MD32_32K, "infra_anc_md32_32k", "clk26m", 13), 539 GATE_ICG2(CLK_INFRA_ANC_MD32_32K, "infra_anc_md32_32k", "clk26m", 13),
522 GATE_ICG2(CLK_INFRA_DVFS_SPM1, "infra_dvfs_spm1", "axi_sel", 15), 540 GATE_ICG2(CLK_INFRA_DVFS_SPM1, "infra_dvfs_spm1", "axi_sel", 15),