.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) 2013 Samsung Electronics Co., Ltd. |
---|
3 | 4 | * Copyright (c) 2013 Linaro Ltd. |
---|
4 | 5 | * 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. |
---|
9 | 6 | * |
---|
10 | 7 | * Common Clock Framework support for Exynos5250 SoC. |
---|
11 | 8 | */ |
---|
12 | 9 | |
---|
13 | 10 | #include <dt-bindings/clock/exynos5250.h> |
---|
14 | 11 | #include <linux/clk-provider.h> |
---|
| 12 | +#include <linux/io.h> |
---|
15 | 13 | #include <linux/of.h> |
---|
16 | 14 | #include <linux/of_address.h> |
---|
17 | | -#include <linux/syscore_ops.h> |
---|
18 | 15 | |
---|
19 | 16 | #include "clk.h" |
---|
20 | 17 | #include "clk-cpu.h" |
---|
.. | .. |
---|
111 | 108 | |
---|
112 | 109 | static void __iomem *reg_base; |
---|
113 | 110 | |
---|
114 | | -#ifdef CONFIG_PM_SLEEP |
---|
115 | | -static struct samsung_clk_reg_dump *exynos5250_save; |
---|
116 | | - |
---|
117 | 111 | /* |
---|
118 | 112 | * list of controller registers to be saved and restored during a |
---|
119 | 113 | * suspend/resume cycle. |
---|
.. | .. |
---|
171 | 165 | GATE_IP_ISP0, |
---|
172 | 166 | GATE_IP_ISP1, |
---|
173 | 167 | }; |
---|
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 |
---|
209 | 168 | |
---|
210 | 169 | /* list of all parent clock list */ |
---|
211 | 170 | PNAME(mout_apll_p) = { "fin_pll", "fout_apll", }; |
---|
.. | .. |
---|
294 | 253 | /* |
---|
295 | 254 | * CMU_CPU |
---|
296 | 255 | */ |
---|
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, |
---|
298 | 257 | CLK_SET_RATE_PARENT, 0), |
---|
299 | 258 | MUX(0, "mout_cpu", mout_cpu_p, SRC_CPU, 16, 1), |
---|
300 | 259 | |
---|
301 | 260 | /* |
---|
302 | 261 | * CMU_CORE |
---|
303 | 262 | */ |
---|
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), |
---|
305 | 264 | |
---|
306 | 265 | /* |
---|
307 | 266 | * CMU_TOP |
---|
.. | .. |
---|
722 | 681 | .pd_name = "DISP1", |
---|
723 | 682 | }; |
---|
724 | 683 | |
---|
| 684 | +static const struct exynos5_subcmu_info *exynos5250_subcmus[] = { |
---|
| 685 | + &exynos5250_disp_subcmu, |
---|
| 686 | +}; |
---|
| 687 | + |
---|
725 | 688 | static const struct samsung_pll_rate_table vpll_24mhz_tbl[] __initconst = { |
---|
726 | 689 | /* sorted in descending order */ |
---|
727 | 690 | /* PLL_36XX_RATE(rate, m, p, s, k) */ |
---|
.. | .. |
---|
819 | 782 | { |
---|
820 | 783 | struct samsung_clk_provider *ctx; |
---|
821 | 784 | unsigned int tmp; |
---|
| 785 | + struct clk_hw **hws; |
---|
822 | 786 | |
---|
823 | 787 | if (np) { |
---|
824 | 788 | reg_base = of_iomap(np, 0); |
---|
.. | .. |
---|
829 | 793 | } |
---|
830 | 794 | |
---|
831 | 795 | ctx = samsung_clk_init(np, reg_base, CLK_NR_CLKS); |
---|
| 796 | + hws = ctx->clk_data.hws; |
---|
832 | 797 | |
---|
833 | 798 | samsung_clk_of_register_fixed_ext(ctx, exynos5250_fixed_rate_ext_clks, |
---|
834 | 799 | ARRAY_SIZE(exynos5250_fixed_rate_ext_clks), |
---|
.. | .. |
---|
858 | 823 | samsung_clk_register_gate(ctx, exynos5250_gate_clks, |
---|
859 | 824 | ARRAY_SIZE(exynos5250_gate_clks)); |
---|
860 | 825 | 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, |
---|
862 | 827 | exynos5250_armclk_d, ARRAY_SIZE(exynos5250_armclk_d), |
---|
863 | 828 | CLK_CPU_HAS_DIV1); |
---|
864 | 829 | |
---|
.. | .. |
---|
882 | 847 | PWR_CTRL2_CORE2_UP_RATIO | PWR_CTRL2_CORE1_UP_RATIO); |
---|
883 | 848 | __raw_writel(tmp, reg_base + PWR_CTRL2); |
---|
884 | 849 | |
---|
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); |
---|
887 | 854 | |
---|
888 | 855 | samsung_clk_of_add_provider(np, ctx); |
---|
889 | 856 | |
---|