clk: samsung: exynos5433: Add suspend state for TOP, CPIF & PERIC CMUs
authorMarek Szyprowski <m.szyprowski@samsung.com>
Wed, 29 Aug 2018 16:00:13 +0000 (18:00 +0200)
committerJunghoon Kim <jhoon20.kim@samsung.com>
Thu, 14 Feb 2019 05:58:04 +0000 (14:58 +0900)
Before entering system suspend, one has to ensure that some clocks from
TOP, CPIF and PERIC CMUs are enabled. This is needed by the firmware
to properly perform system suspend operation. Instead of adding more and
more clocks with CRITICAL flag, simply enable those clocks directly in
respective CMU registers using 'suspend_regs' feature.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Change-Id: I1dab71d4834fcbd13634411d44ecb11775c46cde

drivers/clk/samsung/clk-exynos5433.c

index 65b5795..1d4b177 100644 (file)
@@ -177,6 +177,15 @@ static const unsigned long top_clk_regs[] __initconst = {
        ENABLE_CMU_TOP_DIV_STAT,
 };
 
+static const struct samsung_clk_reg_dump top_suspend_regs[] = {
+       /* force all aclk clocks enabled */
+       { ENABLE_ACLK_TOP, 0x67ecffed },
+       /* ISP PLL has to be enabled for suspend: reset value + ENABLE bit */
+       { ISP_PLL_CON0, 0x85cc0502 },
+       /* ISP PLL has to be enabled for suspend: reset value + ENABLE bit */
+       { AUD_PLL_CON0, 0x84830202 },
+};
+
 /* list of all parent clock list */
 PNAME(mout_aud_pll_p)          = { "oscclk", "fout_aud_pll", };
 PNAME(mout_isp_pll_p)          = { "oscclk", "fout_isp_pll", };
@@ -792,6 +801,8 @@ static const struct samsung_cmu_info top_cmu_info __initconst = {
        .nr_clk_ids             = TOP_NR_CLK,
        .clk_regs               = top_clk_regs,
        .nr_clk_regs            = ARRAY_SIZE(top_clk_regs),
+       .suspend_regs           = top_suspend_regs,
+       .nr_suspend_regs        = ARRAY_SIZE(top_suspend_regs),
 };
 
 static void __init exynos5433_cmu_top_init(struct device_node *np)
@@ -822,6 +833,13 @@ static const unsigned long cpif_clk_regs[] __initconst = {
        ENABLE_SCLK_CPIF,
 };
 
+static const struct samsung_clk_reg_dump cpif_suspend_regs[] = {
+       /* force all sclk clocks enabled */
+       { ENABLE_SCLK_CPIF, 0x3ff },
+       /* MPHY PLL has to be enabled for suspend: reset value + ENABLE bit */
+       { MPHY_PLL_CON0, 0x81c70601 },
+};
+
 /* list of all parent clock list */
 PNAME(mout_mphy_pll_p)         = { "oscclk", "fout_mphy_pll", };
 
@@ -862,6 +880,8 @@ static const struct samsung_cmu_info cpif_cmu_info __initconst = {
        .nr_clk_ids             = CPIF_NR_CLK,
        .clk_regs               = cpif_clk_regs,
        .nr_clk_regs            = ARRAY_SIZE(cpif_clk_regs),
+       .suspend_regs           = cpif_suspend_regs,
+       .nr_suspend_regs        = ARRAY_SIZE(cpif_suspend_regs),
 };
 
 static void __init exynos5433_cmu_cpif_init(struct device_node *np)
@@ -1547,6 +1567,13 @@ static const unsigned long peric_clk_regs[] __initconst = {
        ENABLE_IP_PERIC2,
 };
 
+static const struct samsung_clk_reg_dump peric_suspend_regs[] = {
+       /* pclk: sci, pmu, sysreg, gpio_{finger, ese, touch, nfc}, uart2-0 */
+       { ENABLE_PCLK_PERIC0, 0xe00ff000 },
+       /* sclk: uart2-0 */
+       { ENABLE_SCLK_PERIC, 0x7 },
+};
+
 static const struct samsung_div_clock peric_div_clks[] __initconst = {
        /* DIV_PERIC */
        DIV(CLK_DIV_SCLK_SCI, "div_sclk_sci", "oscclk", DIV_PERIC, 4, 4),
@@ -1708,6 +1735,8 @@ static const struct samsung_cmu_info peric_cmu_info __initconst = {
        .nr_clk_ids             = PERIC_NR_CLK,
        .clk_regs               = peric_clk_regs,
        .nr_clk_regs            = ARRAY_SIZE(peric_clk_regs),
+       .suspend_regs           = peric_suspend_regs,
+       .nr_suspend_regs        = ARRAY_SIZE(peric_suspend_regs),
 };
 
 static void __init exynos5433_cmu_peric_init(struct device_node *np)