hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/clk/samsung/clk-exynos5250.c
....@@ -1,20 +1,17 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
34 * Copyright (c) 2013 Linaro Ltd.
45 * Author: Thomas Abraham <thomas.ab@samsung.com>
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License version 2 as
8
- * published by the Free Software Foundation.
96 *
107 * Common Clock Framework support for Exynos5250 SoC.
118 */
129
1310 #include <dt-bindings/clock/exynos5250.h>
1411 #include <linux/clk-provider.h>
12
+#include <linux/io.h>
1513 #include <linux/of.h>
1614 #include <linux/of_address.h>
17
-#include <linux/syscore_ops.h>
1815
1916 #include "clk.h"
2017 #include "clk-cpu.h"
....@@ -111,9 +108,6 @@
111108
112109 static void __iomem *reg_base;
113110
114
-#ifdef CONFIG_PM_SLEEP
115
-static struct samsung_clk_reg_dump *exynos5250_save;
116
-
117111 /*
118112 * list of controller registers to be saved and restored during a
119113 * suspend/resume cycle.
....@@ -171,41 +165,6 @@
171165 GATE_IP_ISP0,
172166 GATE_IP_ISP1,
173167 };
174
-
175
-static int exynos5250_clk_suspend(void)
176
-{
177
- samsung_clk_save(reg_base, exynos5250_save,
178
- ARRAY_SIZE(exynos5250_clk_regs));
179
-
180
- return 0;
181
-}
182
-
183
-static void exynos5250_clk_resume(void)
184
-{
185
- samsung_clk_restore(reg_base, exynos5250_save,
186
- ARRAY_SIZE(exynos5250_clk_regs));
187
-}
188
-
189
-static struct syscore_ops exynos5250_clk_syscore_ops = {
190
- .suspend = exynos5250_clk_suspend,
191
- .resume = exynos5250_clk_resume,
192
-};
193
-
194
-static void __init exynos5250_clk_sleep_init(void)
195
-{
196
- exynos5250_save = samsung_clk_alloc_reg_dump(exynos5250_clk_regs,
197
- ARRAY_SIZE(exynos5250_clk_regs));
198
- if (!exynos5250_save) {
199
- pr_warn("%s: failed to allocate sleep save data, no sleep support!\n",
200
- __func__);
201
- return;
202
- }
203
-
204
- register_syscore_ops(&exynos5250_clk_syscore_ops);
205
-}
206
-#else
207
-static void __init exynos5250_clk_sleep_init(void) {}
208
-#endif
209168
210169 /* list of all parent clock list */
211170 PNAME(mout_apll_p) = { "fin_pll", "fout_apll", };
....@@ -294,14 +253,14 @@
294253 /*
295254 * CMU_CPU
296255 */
297
- MUX_F(0, "mout_apll", mout_apll_p, SRC_CPU, 0, 1,
256
+ MUX_F(CLK_MOUT_APLL, "mout_apll", mout_apll_p, SRC_CPU, 0, 1,
298257 CLK_SET_RATE_PARENT, 0),
299258 MUX(0, "mout_cpu", mout_cpu_p, SRC_CPU, 16, 1),
300259
301260 /*
302261 * CMU_CORE
303262 */
304
- MUX(0, "mout_mpll", mout_mpll_p, SRC_CORE1, 8, 1),
263
+ MUX(CLK_MOUT_MPLL, "mout_mpll", mout_mpll_p, SRC_CORE1, 8, 1),
305264
306265 /*
307266 * CMU_TOP
....@@ -722,6 +681,10 @@
722681 .pd_name = "DISP1",
723682 };
724683
684
+static const struct exynos5_subcmu_info *exynos5250_subcmus[] = {
685
+ &exynos5250_disp_subcmu,
686
+};
687
+
725688 static const struct samsung_pll_rate_table vpll_24mhz_tbl[] __initconst = {
726689 /* sorted in descending order */
727690 /* PLL_36XX_RATE(rate, m, p, s, k) */
....@@ -819,6 +782,7 @@
819782 {
820783 struct samsung_clk_provider *ctx;
821784 unsigned int tmp;
785
+ struct clk_hw **hws;
822786
823787 if (np) {
824788 reg_base = of_iomap(np, 0);
....@@ -829,6 +793,7 @@
829793 }
830794
831795 ctx = samsung_clk_init(np, reg_base, CLK_NR_CLKS);
796
+ hws = ctx->clk_data.hws;
832797
833798 samsung_clk_of_register_fixed_ext(ctx, exynos5250_fixed_rate_ext_clks,
834799 ARRAY_SIZE(exynos5250_fixed_rate_ext_clks),
....@@ -858,7 +823,7 @@
858823 samsung_clk_register_gate(ctx, exynos5250_gate_clks,
859824 ARRAY_SIZE(exynos5250_gate_clks));
860825 exynos_register_cpu_clock(ctx, CLK_ARM_CLK, "armclk",
861
- mout_cpu_p[0], mout_cpu_p[1], 0x200,
826
+ hws[CLK_MOUT_APLL], hws[CLK_MOUT_MPLL], 0x200,
862827 exynos5250_armclk_d, ARRAY_SIZE(exynos5250_armclk_d),
863828 CLK_CPU_HAS_DIV1);
864829
....@@ -882,8 +847,10 @@
882847 PWR_CTRL2_CORE2_UP_RATIO | PWR_CTRL2_CORE1_UP_RATIO);
883848 __raw_writel(tmp, reg_base + PWR_CTRL2);
884849
885
- exynos5250_clk_sleep_init();
886
- exynos5_subcmus_init(ctx, 1, &exynos5250_disp_subcmu);
850
+ samsung_clk_sleep_init(reg_base, exynos5250_clk_regs,
851
+ ARRAY_SIZE(exynos5250_clk_regs));
852
+ exynos5_subcmus_init(ctx, ARRAY_SIZE(exynos5250_subcmus),
853
+ exynos5250_subcmus);
887854
888855 samsung_clk_of_add_provider(np, ctx);
889856