aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk/samsung/clk-exynos5420.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/clk/samsung/clk-exynos5420.c')
-rw-r--r--drivers/clk/samsung/clk-exynos5420.c61
1 files changed, 60 insertions, 1 deletions
diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c
index 61eccf0dd72f..bc772f8585d6 100644
--- a/drivers/clk/samsung/clk-exynos5420.c
+++ b/drivers/clk/samsung/clk-exynos5420.c
@@ -28,6 +28,7 @@
28#define GATE_BUS_CPU 0x700 28#define GATE_BUS_CPU 0x700
29#define GATE_SCLK_CPU 0x800 29#define GATE_SCLK_CPU 0x800
30#define CLKOUT_CMU_CPU 0xa00 30#define CLKOUT_CMU_CPU 0xa00
31#define SRC_MASK_CPERI 0x4300
31#define GATE_IP_G2D 0x8800 32#define GATE_IP_G2D 0x8800
32#define CPLL_LOCK 0x10020 33#define CPLL_LOCK 0x10020
33#define DPLL_LOCK 0x10030 34#define DPLL_LOCK 0x10030
@@ -70,6 +71,8 @@
70#define SRC_TOP11 0x10284 71#define SRC_TOP11 0x10284
71#define SRC_TOP12 0x10288 72#define SRC_TOP12 0x10288
72#define SRC_TOP13 0x1028c /* 5800 specific */ 73#define SRC_TOP13 0x1028c /* 5800 specific */
74#define SRC_MASK_TOP0 0x10300
75#define SRC_MASK_TOP1 0x10304
73#define SRC_MASK_TOP2 0x10308 76#define SRC_MASK_TOP2 0x10308
74#define SRC_MASK_TOP7 0x1031c 77#define SRC_MASK_TOP7 0x1031c
75#define SRC_MASK_DISP10 0x1032c 78#define SRC_MASK_DISP10 0x1032c
@@ -77,6 +80,7 @@
77#define SRC_MASK_FSYS 0x10340 80#define SRC_MASK_FSYS 0x10340
78#define SRC_MASK_PERIC0 0x10350 81#define SRC_MASK_PERIC0 0x10350
79#define SRC_MASK_PERIC1 0x10354 82#define SRC_MASK_PERIC1 0x10354
83#define SRC_MASK_ISP 0x10370
80#define DIV_TOP0 0x10500 84#define DIV_TOP0 0x10500
81#define DIV_TOP1 0x10504 85#define DIV_TOP1 0x10504
82#define DIV_TOP2 0x10508 86#define DIV_TOP2 0x10508
@@ -98,6 +102,7 @@
98#define DIV2_RATIO0 0x10590 102#define DIV2_RATIO0 0x10590
99#define DIV4_RATIO 0x105a0 103#define DIV4_RATIO 0x105a0
100#define GATE_BUS_TOP 0x10700 104#define GATE_BUS_TOP 0x10700
105#define GATE_BUS_DISP1 0x10728
101#define GATE_BUS_GEN 0x1073c 106#define GATE_BUS_GEN 0x1073c
102#define GATE_BUS_FSYS0 0x10740 107#define GATE_BUS_FSYS0 0x10740
103#define GATE_BUS_FSYS2 0x10748 108#define GATE_BUS_FSYS2 0x10748
@@ -190,6 +195,10 @@ static unsigned long exynos5x_clk_regs[] __initdata = {
190 SRC_MASK_FSYS, 195 SRC_MASK_FSYS,
191 SRC_MASK_PERIC0, 196 SRC_MASK_PERIC0,
192 SRC_MASK_PERIC1, 197 SRC_MASK_PERIC1,
198 SRC_MASK_TOP0,
199 SRC_MASK_TOP1,
200 SRC_MASK_MAU,
201 SRC_MASK_ISP,
193 SRC_ISP, 202 SRC_ISP,
194 DIV_TOP0, 203 DIV_TOP0,
195 DIV_TOP1, 204 DIV_TOP1,
@@ -208,6 +217,7 @@ static unsigned long exynos5x_clk_regs[] __initdata = {
208 SCLK_DIV_ISP1, 217 SCLK_DIV_ISP1,
209 DIV2_RATIO0, 218 DIV2_RATIO0,
210 DIV4_RATIO, 219 DIV4_RATIO,
220 GATE_BUS_DISP1,
211 GATE_BUS_TOP, 221 GATE_BUS_TOP,
212 GATE_BUS_GEN, 222 GATE_BUS_GEN,
213 GATE_BUS_FSYS0, 223 GATE_BUS_FSYS0,
@@ -249,6 +259,22 @@ static unsigned long exynos5800_clk_regs[] __initdata = {
249 GATE_IP_CAM, 259 GATE_IP_CAM,
250}; 260};
251 261
262static const struct samsung_clk_reg_dump exynos5420_set_clksrc[] = {
263 { .offset = SRC_MASK_CPERI, .value = 0xffffffff, },
264 { .offset = SRC_MASK_TOP0, .value = 0x11111111, },
265 { .offset = SRC_MASK_TOP1, .value = 0x11101111, },
266 { .offset = SRC_MASK_TOP2, .value = 0x11111110, },
267 { .offset = SRC_MASK_TOP7, .value = 0x00111100, },
268 { .offset = SRC_MASK_DISP10, .value = 0x11111110, },
269 { .offset = SRC_MASK_MAU, .value = 0x10000000, },
270 { .offset = SRC_MASK_FSYS, .value = 0x11111110, },
271 { .offset = SRC_MASK_PERIC0, .value = 0x11111110, },
272 { .offset = SRC_MASK_PERIC1, .value = 0x11111100, },
273 { .offset = SRC_MASK_ISP, .value = 0x11111000, },
274 { .offset = GATE_BUS_DISP1, .value = 0xffffffff, },
275 { .offset = GATE_IP_PERIC, .value = 0xffffffff, },
276};
277
252static int exynos5420_clk_suspend(void) 278static int exynos5420_clk_suspend(void)
253{ 279{
254 samsung_clk_save(reg_base, exynos5x_save, 280 samsung_clk_save(reg_base, exynos5x_save,
@@ -258,6 +284,9 @@ static int exynos5420_clk_suspend(void)
258 samsung_clk_save(reg_base, exynos5800_save, 284 samsung_clk_save(reg_base, exynos5800_save,
259 ARRAY_SIZE(exynos5800_clk_regs)); 285 ARRAY_SIZE(exynos5800_clk_regs));
260 286
287 samsung_clk_restore(reg_base, exynos5420_set_clksrc,
288 ARRAY_SIZE(exynos5420_set_clksrc));
289
261 return 0; 290 return 0;
262} 291}
263 292
@@ -1167,6 +1196,28 @@ static struct samsung_gate_clock exynos5x_gate_clks[] __initdata = {
1167 GATE(CLK_G3D, "g3d", "mout_user_aclk_g3d", GATE_IP_G3D, 9, 0, 0), 1196 GATE(CLK_G3D, "g3d", "mout_user_aclk_g3d", GATE_IP_G3D, 9, 0, 0),
1168}; 1197};
1169 1198
1199static const struct samsung_pll_rate_table exynos5420_pll2550x_24mhz_tbl[] = {
1200 PLL_35XX_RATE(2000000000, 250, 3, 0),
1201 PLL_35XX_RATE(1900000000, 475, 6, 0),
1202 PLL_35XX_RATE(1800000000, 225, 3, 0),
1203 PLL_35XX_RATE(1700000000, 425, 6, 0),
1204 PLL_35XX_RATE(1600000000, 200, 3, 0),
1205 PLL_35XX_RATE(1500000000, 250, 4, 0),
1206 PLL_35XX_RATE(1400000000, 175, 3, 0),
1207 PLL_35XX_RATE(1300000000, 325, 6, 0),
1208 PLL_35XX_RATE(1200000000, 200, 2, 1),
1209 PLL_35XX_RATE(1100000000, 275, 3, 1),
1210 PLL_35XX_RATE(1000000000, 250, 3, 1),
1211 PLL_35XX_RATE(900000000, 150, 2, 1),
1212 PLL_35XX_RATE(800000000, 200, 3, 1),
1213 PLL_35XX_RATE(700000000, 175, 3, 1),
1214 PLL_35XX_RATE(600000000, 200, 2, 2),
1215 PLL_35XX_RATE(500000000, 250, 3, 2),
1216 PLL_35XX_RATE(400000000, 200, 3, 2),
1217 PLL_35XX_RATE(300000000, 200, 2, 3),
1218 PLL_35XX_RATE(200000000, 200, 3, 3),
1219};
1220
1170static struct samsung_pll_clock exynos5x_plls[nr_plls] __initdata = { 1221static struct samsung_pll_clock exynos5x_plls[nr_plls] __initdata = {
1171 [apll] = PLL(pll_2550, CLK_FOUT_APLL, "fout_apll", "fin_pll", APLL_LOCK, 1222 [apll] = PLL(pll_2550, CLK_FOUT_APLL, "fout_apll", "fin_pll", APLL_LOCK,
1172 APLL_CON0, NULL), 1223 APLL_CON0, NULL),
@@ -1192,7 +1243,7 @@ static struct samsung_pll_clock exynos5x_plls[nr_plls] __initdata = {
1192 KPLL_CON0, NULL), 1243 KPLL_CON0, NULL),
1193}; 1244};
1194 1245
1195static struct of_device_id ext_clk_match[] __initdata = { 1246static const struct of_device_id ext_clk_match[] __initconst = {
1196 { .compatible = "samsung,exynos5420-oscclk", .data = (void *)0, }, 1247 { .compatible = "samsung,exynos5420-oscclk", .data = (void *)0, },
1197 { }, 1248 { },
1198}; 1249};
@@ -1220,6 +1271,12 @@ static void __init exynos5x_clk_init(struct device_node *np,
1220 samsung_clk_of_register_fixed_ext(ctx, exynos5x_fixed_rate_ext_clks, 1271 samsung_clk_of_register_fixed_ext(ctx, exynos5x_fixed_rate_ext_clks,
1221 ARRAY_SIZE(exynos5x_fixed_rate_ext_clks), 1272 ARRAY_SIZE(exynos5x_fixed_rate_ext_clks),
1222 ext_clk_match); 1273 ext_clk_match);
1274
1275 if (_get_rate("fin_pll") == 24 * MHZ) {
1276 exynos5x_plls[apll].rate_table = exynos5420_pll2550x_24mhz_tbl;
1277 exynos5x_plls[kpll].rate_table = exynos5420_pll2550x_24mhz_tbl;
1278 }
1279
1223 samsung_clk_register_pll(ctx, exynos5x_plls, ARRAY_SIZE(exynos5x_plls), 1280 samsung_clk_register_pll(ctx, exynos5x_plls, ARRAY_SIZE(exynos5x_plls),
1224 reg_base); 1281 reg_base);
1225 samsung_clk_register_fixed_rate(ctx, exynos5x_fixed_rate_clks, 1282 samsung_clk_register_fixed_rate(ctx, exynos5x_fixed_rate_clks,
@@ -1251,6 +1308,8 @@ static void __init exynos5x_clk_init(struct device_node *np,
1251 } 1308 }
1252 1309
1253 exynos5420_clk_sleep_init(); 1310 exynos5420_clk_sleep_init();
1311
1312 samsung_clk_of_add_provider(np, ctx);
1254} 1313}
1255 1314
1256static void __init exynos5420_clk_init(struct device_node *np) 1315static void __init exynos5420_clk_init(struct device_node *np)