aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/clk/rockchip/clk-rk3288.c48
-rw-r--r--include/dt-bindings/clock/rk3288-cru.h4
2 files changed, 39 insertions, 13 deletions
diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c
index 11194b8329fe..eeadbb6b5206 100644
--- a/drivers/clk/rockchip/clk-rk3288.c
+++ b/drivers/clk/rockchip/clk-rk3288.c
@@ -535,44 +535,44 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = {
535 COMPOSITE(0, "uart0_src", mux_pll_src_cpll_gll_usb_npll_p, 0, 535 COMPOSITE(0, "uart0_src", mux_pll_src_cpll_gll_usb_npll_p, 0,
536 RK3288_CLKSEL_CON(13), 13, 2, MFLAGS, 0, 7, DFLAGS, 536 RK3288_CLKSEL_CON(13), 13, 2, MFLAGS, 0, 7, DFLAGS,
537 RK3288_CLKGATE_CON(1), 8, GFLAGS), 537 RK3288_CLKGATE_CON(1), 8, GFLAGS),
538 COMPOSITE_FRAC(0, "uart0_frac", "uart0_src", 0, 538 COMPOSITE_FRAC(0, "uart0_frac", "uart0_src", CLK_SET_RATE_PARENT,
539 RK3288_CLKSEL_CON(17), 0, 539 RK3288_CLKSEL_CON(17), 0,
540 RK3288_CLKGATE_CON(1), 9, GFLAGS), 540 RK3288_CLKGATE_CON(1), 9, GFLAGS),
541 MUX(SCLK_UART0, "sclk_uart0", mux_uart0_p, 0, 541 MUX(SCLK_UART0, "sclk_uart0", mux_uart0_p, CLK_SET_RATE_PARENT,
542 RK3288_CLKSEL_CON(13), 8, 2, MFLAGS), 542 RK3288_CLKSEL_CON(13), 8, 2, MFLAGS),
543 MUX(0, "uart_src", mux_pll_src_cpll_gpll_p, 0, 543 MUX(0, "uart_src", mux_pll_src_cpll_gpll_p, 0,
544 RK3288_CLKSEL_CON(13), 15, 1, MFLAGS), 544 RK3288_CLKSEL_CON(13), 15, 1, MFLAGS),
545 COMPOSITE_NOMUX(0, "uart1_src", "uart_src", 0, 545 COMPOSITE_NOMUX(0, "uart1_src", "uart_src", 0,
546 RK3288_CLKSEL_CON(14), 0, 7, DFLAGS, 546 RK3288_CLKSEL_CON(14), 0, 7, DFLAGS,
547 RK3288_CLKGATE_CON(1), 10, GFLAGS), 547 RK3288_CLKGATE_CON(1), 10, GFLAGS),
548 COMPOSITE_FRAC(0, "uart1_frac", "uart1_src", 0, 548 COMPOSITE_FRAC(0, "uart1_frac", "uart1_src", CLK_SET_RATE_PARENT,
549 RK3288_CLKSEL_CON(18), 0, 549 RK3288_CLKSEL_CON(18), 0,
550 RK3288_CLKGATE_CON(1), 11, GFLAGS), 550 RK3288_CLKGATE_CON(1), 11, GFLAGS),
551 MUX(SCLK_UART1, "sclk_uart1", mux_uart1_p, 0, 551 MUX(SCLK_UART1, "sclk_uart1", mux_uart1_p, CLK_SET_RATE_PARENT,
552 RK3288_CLKSEL_CON(14), 8, 2, MFLAGS), 552 RK3288_CLKSEL_CON(14), 8, 2, MFLAGS),
553 COMPOSITE_NOMUX(0, "uart2_src", "uart_src", 0, 553 COMPOSITE_NOMUX(0, "uart2_src", "uart_src", 0,
554 RK3288_CLKSEL_CON(15), 0, 7, DFLAGS, 554 RK3288_CLKSEL_CON(15), 0, 7, DFLAGS,
555 RK3288_CLKGATE_CON(1), 12, GFLAGS), 555 RK3288_CLKGATE_CON(1), 12, GFLAGS),
556 COMPOSITE_FRAC(0, "uart2_frac", "uart2_src", 0, 556 COMPOSITE_FRAC(0, "uart2_frac", "uart2_src", CLK_SET_RATE_PARENT,
557 RK3288_CLKSEL_CON(19), 0, 557 RK3288_CLKSEL_CON(19), 0,
558 RK3288_CLKGATE_CON(1), 13, GFLAGS), 558 RK3288_CLKGATE_CON(1), 13, GFLAGS),
559 MUX(SCLK_UART2, "sclk_uart2", mux_uart2_p, 0, 559 MUX(SCLK_UART2, "sclk_uart2", mux_uart2_p, CLK_SET_RATE_PARENT,
560 RK3288_CLKSEL_CON(15), 8, 2, MFLAGS), 560 RK3288_CLKSEL_CON(15), 8, 2, MFLAGS),
561 COMPOSITE_NOMUX(0, "uart3_src", "uart_src", 0, 561 COMPOSITE_NOMUX(0, "uart3_src", "uart_src", 0,
562 RK3288_CLKSEL_CON(16), 0, 7, DFLAGS, 562 RK3288_CLKSEL_CON(16), 0, 7, DFLAGS,
563 RK3288_CLKGATE_CON(1), 14, GFLAGS), 563 RK3288_CLKGATE_CON(1), 14, GFLAGS),
564 COMPOSITE_FRAC(0, "uart3_frac", "uart3_src", 0, 564 COMPOSITE_FRAC(0, "uart3_frac", "uart3_src", CLK_SET_RATE_PARENT,
565 RK3288_CLKSEL_CON(20), 0, 565 RK3288_CLKSEL_CON(20), 0,
566 RK3288_CLKGATE_CON(1), 15, GFLAGS), 566 RK3288_CLKGATE_CON(1), 15, GFLAGS),
567 MUX(SCLK_UART3, "sclk_uart3", mux_uart3_p, 0, 567 MUX(SCLK_UART3, "sclk_uart3", mux_uart3_p, CLK_SET_RATE_PARENT,
568 RK3288_CLKSEL_CON(16), 8, 2, MFLAGS), 568 RK3288_CLKSEL_CON(16), 8, 2, MFLAGS),
569 COMPOSITE_NOMUX(0, "uart4_src", "uart_src", 0, 569 COMPOSITE_NOMUX(0, "uart4_src", "uart_src", 0,
570 RK3288_CLKSEL_CON(3), 0, 7, DFLAGS, 570 RK3288_CLKSEL_CON(3), 0, 7, DFLAGS,
571 RK3288_CLKGATE_CON(2), 12, GFLAGS), 571 RK3288_CLKGATE_CON(2), 12, GFLAGS),
572 COMPOSITE_FRAC(0, "uart4_frac", "uart4_src", 0, 572 COMPOSITE_FRAC(0, "uart4_frac", "uart4_src", CLK_SET_RATE_PARENT,
573 RK3288_CLKSEL_CON(7), 0, 573 RK3288_CLKSEL_CON(7), 0,
574 RK3288_CLKGATE_CON(2), 13, GFLAGS), 574 RK3288_CLKGATE_CON(2), 13, GFLAGS),
575 MUX(SCLK_UART4, "sclk_uart4", mux_uart4_p, 0, 575 MUX(SCLK_UART4, "sclk_uart4", mux_uart4_p, CLK_SET_RATE_PARENT,
576 RK3288_CLKSEL_CON(3), 8, 2, MFLAGS), 576 RK3288_CLKSEL_CON(3), 8, 2, MFLAGS),
577 577
578 COMPOSITE(0, "mac_src", mux_pll_src_npll_cpll_gpll_p, 0, 578 COMPOSITE(0, "mac_src", mux_pll_src_npll_cpll_gpll_p, 0,
@@ -598,7 +598,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = {
598 GATE(0, "jtag", "ext_jtag", 0, 598 GATE(0, "jtag", "ext_jtag", 0,
599 RK3288_CLKGATE_CON(4), 14, GFLAGS), 599 RK3288_CLKGATE_CON(4), 14, GFLAGS),
600 600
601 COMPOSITE_NODIV(0, "usbphy480m_src", mux_usbphy480m_p, 0, 601 COMPOSITE_NODIV(SCLK_USBPHY480M_SRC, "usbphy480m_src", mux_usbphy480m_p, 0,
602 RK3288_CLKSEL_CON(13), 11, 2, MFLAGS, 602 RK3288_CLKSEL_CON(13), 11, 2, MFLAGS,
603 RK3288_CLKGATE_CON(5), 14, GFLAGS), 603 RK3288_CLKGATE_CON(5), 14, GFLAGS),
604 COMPOSITE_NODIV(SCLK_HSICPHY480M, "sclk_hsicphy480m", mux_hsicphy480m_p, 0, 604 COMPOSITE_NODIV(SCLK_HSICPHY480M, "sclk_hsicphy480m", mux_hsicphy480m_p, 0,
@@ -704,8 +704,8 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = {
704 704
705 GATE(SCLK_LCDC_PWM0, "sclk_lcdc_pwm0", "xin24m", 0, RK3288_CLKGATE_CON(13), 10, GFLAGS), 705 GATE(SCLK_LCDC_PWM0, "sclk_lcdc_pwm0", "xin24m", 0, RK3288_CLKGATE_CON(13), 10, GFLAGS),
706 GATE(SCLK_LCDC_PWM1, "sclk_lcdc_pwm1", "xin24m", 0, RK3288_CLKGATE_CON(13), 11, GFLAGS), 706 GATE(SCLK_LCDC_PWM1, "sclk_lcdc_pwm1", "xin24m", 0, RK3288_CLKGATE_CON(13), 11, GFLAGS),
707 GATE(0, "sclk_pvtm_core", "xin24m", 0, RK3288_CLKGATE_CON(5), 9, GFLAGS), 707 GATE(SCLK_PVTM_CORE, "sclk_pvtm_core", "xin24m", 0, RK3288_CLKGATE_CON(5), 9, GFLAGS),
708 GATE(0, "sclk_pvtm_gpu", "xin24m", 0, RK3288_CLKGATE_CON(5), 10, GFLAGS), 708 GATE(SCLK_PVTM_GPU, "sclk_pvtm_gpu", "xin24m", 0, RK3288_CLKGATE_CON(5), 10, GFLAGS),
709 GATE(0, "sclk_mipidsi_24m", "xin24m", 0, RK3288_CLKGATE_CON(5), 15, GFLAGS), 709 GATE(0, "sclk_mipidsi_24m", "xin24m", 0, RK3288_CLKGATE_CON(5), 15, GFLAGS),
710 710
711 /* sclk_gpu gates */ 711 /* sclk_gpu gates */
@@ -805,6 +805,20 @@ static int rk3288_clk_suspend(void)
805 rk3288_saved_cru_regs[i] = 805 rk3288_saved_cru_regs[i] =
806 readl_relaxed(rk3288_cru_base + reg_id); 806 readl_relaxed(rk3288_cru_base + reg_id);
807 } 807 }
808
809 /*
810 * Switch PLLs other than DPLL (for SDRAM) to slow mode to
811 * avoid crashes on resume. The Mask ROM on the system will
812 * put APLL, CPLL, and GPLL into slow mode at resume time
813 * anyway (which is why we restore them), but we might not
814 * even make it to the Mask ROM if this isn't done at suspend
815 * time.
816 *
817 * NOTE: only APLL truly matters here, but we'll do them all.
818 */
819
820 writel_relaxed(0xf3030000, rk3288_cru_base + RK3288_MODE_CON);
821
808 return 0; 822 return 0;
809} 823}
810 824
@@ -866,6 +880,14 @@ static void __init rk3288_clk_init(struct device_node *np)
866 pr_warn("%s: could not register clock hclk_vcodec_pre: %ld\n", 880 pr_warn("%s: could not register clock hclk_vcodec_pre: %ld\n",
867 __func__, PTR_ERR(clk)); 881 __func__, PTR_ERR(clk));
868 882
883 /* Watchdog pclk is controlled by RK3288_SGRF_SOC_CON0[1]. */
884 clk = clk_register_fixed_factor(NULL, "pclk_wdt", "pclk_pd_alive", 0, 1, 1);
885 if (IS_ERR(clk))
886 pr_warn("%s: could not register clock pclk_wdt: %ld\n",
887 __func__, PTR_ERR(clk));
888 else
889 rockchip_clk_add_lookup(clk, PCLK_WDT);
890
869 rockchip_clk_register_plls(rk3288_pll_clks, 891 rockchip_clk_register_plls(rk3288_pll_clks,
870 ARRAY_SIZE(rk3288_pll_clks), 892 ARRAY_SIZE(rk3288_pll_clks),
871 RK3288_GRF_SOC_STATUS1); 893 RK3288_GRF_SOC_STATUS1);
diff --git a/include/dt-bindings/clock/rk3288-cru.h b/include/dt-bindings/clock/rk3288-cru.h
index f60ce72a2b2c..1e626335acf3 100644
--- a/include/dt-bindings/clock/rk3288-cru.h
+++ b/include/dt-bindings/clock/rk3288-cru.h
@@ -80,6 +80,9 @@
80#define SCLK_SDIO0_SAMPLE 119 80#define SCLK_SDIO0_SAMPLE 119
81#define SCLK_SDIO1_SAMPLE 120 81#define SCLK_SDIO1_SAMPLE 120
82#define SCLK_EMMC_SAMPLE 121 82#define SCLK_EMMC_SAMPLE 121
83#define SCLK_USBPHY480M_SRC 122
84#define SCLK_PVTM_CORE 123
85#define SCLK_PVTM_GPU 124
83 86
84#define DCLK_VOP0 190 87#define DCLK_VOP0 190
85#define DCLK_VOP1 191 88#define DCLK_VOP1 191
@@ -154,6 +157,7 @@
154#define PCLK_PUBL0 365 157#define PCLK_PUBL0 365
155#define PCLK_DDRUPCTL1 366 158#define PCLK_DDRUPCTL1 366
156#define PCLK_PUBL1 367 159#define PCLK_PUBL1 367
160#define PCLK_WDT 368
157 161
158/* hclk gates */ 162/* hclk gates */
159#define HCLK_GPS 448 163#define HCLK_GPS 448