diff options
author | Mike Turquette <mturquette@linaro.org> | 2014-10-01 14:19:10 -0400 |
---|---|---|
committer | Mike Turquette <mturquette@linaro.org> | 2014-10-01 14:19:10 -0400 |
commit | a7979009500df9766ba7d78554a6da9dea18dc26 (patch) | |
tree | 81bc6683d6a4c35761a64fb1c2eeaf59af1aff9f /drivers/clk | |
parent | e156ee56cbe26c9e8df6619dac1a993245afc1d5 (diff) | |
parent | e317c19470f6d690122519bf9ed1c9f21ea11906 (diff) |
Merge tag 'v3.18-rockchip-clk2' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip into clk-next
Allow parent rate changes for i2s on rk3288
and rockchip as well as s3c24xx restart handlers.
Diffstat (limited to 'drivers/clk')
-rw-r--r-- | drivers/clk/rockchip/clk-rk3188.c | 2 | ||||
-rw-r--r-- | drivers/clk/rockchip/clk-rk3288.c | 10 | ||||
-rw-r--r-- | drivers/clk/rockchip/clk.c | 25 | ||||
-rw-r--r-- | drivers/clk/rockchip/clk.h | 1 | ||||
-rw-r--r-- | drivers/clk/samsung/clk-s3c2412.c | 29 | ||||
-rw-r--r-- | drivers/clk/samsung/clk-s3c2443.c | 19 |
6 files changed, 82 insertions, 4 deletions
diff --git a/drivers/clk/rockchip/clk-rk3188.c b/drivers/clk/rockchip/clk-rk3188.c index ceabce595498..beed49c79126 100644 --- a/drivers/clk/rockchip/clk-rk3188.c +++ b/drivers/clk/rockchip/clk-rk3188.c | |||
@@ -735,6 +735,8 @@ static void __init rk3188_common_clk_init(struct device_node *np) | |||
735 | 735 | ||
736 | rockchip_register_softrst(np, 9, reg_base + RK2928_SOFTRST_CON(0), | 736 | rockchip_register_softrst(np, 9, reg_base + RK2928_SOFTRST_CON(0), |
737 | ROCKCHIP_SOFTRST_HIWORD_MASK); | 737 | ROCKCHIP_SOFTRST_HIWORD_MASK); |
738 | |||
739 | rockchip_register_restart_notifier(RK2928_GLB_SRST_FST); | ||
738 | } | 740 | } |
739 | 741 | ||
740 | static void __init rk3066a_clk_init(struct device_node *np) | 742 | static void __init rk3066a_clk_init(struct device_node *np) |
diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c index d053529113f8..23278291da44 100644 --- a/drivers/clk/rockchip/clk-rk3288.c +++ b/drivers/clk/rockchip/clk-rk3288.c | |||
@@ -300,15 +300,15 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { | |||
300 | COMPOSITE(0, "i2s_src", mux_pll_src_cpll_gpll_p, 0, | 300 | COMPOSITE(0, "i2s_src", mux_pll_src_cpll_gpll_p, 0, |
301 | RK3288_CLKSEL_CON(4), 15, 1, MFLAGS, 0, 7, DFLAGS, | 301 | RK3288_CLKSEL_CON(4), 15, 1, MFLAGS, 0, 7, DFLAGS, |
302 | RK3288_CLKGATE_CON(4), 1, GFLAGS), | 302 | RK3288_CLKGATE_CON(4), 1, GFLAGS), |
303 | COMPOSITE_FRAC(0, "i2s_frac", "i2s_src", 0, | 303 | COMPOSITE_FRAC(0, "i2s_frac", "i2s_src", CLK_SET_RATE_PARENT, |
304 | RK3288_CLKSEL_CON(8), 0, | 304 | RK3288_CLKSEL_CON(8), 0, |
305 | RK3288_CLKGATE_CON(4), 2, GFLAGS), | 305 | RK3288_CLKGATE_CON(4), 2, GFLAGS), |
306 | MUX(0, "i2s_pre", mux_i2s_pre_p, 0, | 306 | MUX(0, "i2s_pre", mux_i2s_pre_p, CLK_SET_RATE_PARENT, |
307 | RK3288_CLKSEL_CON(4), 8, 2, MFLAGS), | 307 | RK3288_CLKSEL_CON(4), 8, 2, MFLAGS), |
308 | COMPOSITE_NODIV(0, "i2s0_clkout", mux_i2s_clkout_p, 0, | 308 | COMPOSITE_NODIV(0, "i2s0_clkout", mux_i2s_clkout_p, CLK_SET_RATE_PARENT, |
309 | RK3288_CLKSEL_CON(4), 12, 1, MFLAGS, | 309 | RK3288_CLKSEL_CON(4), 12, 1, MFLAGS, |
310 | RK3288_CLKGATE_CON(4), 0, GFLAGS), | 310 | RK3288_CLKGATE_CON(4), 0, GFLAGS), |
311 | GATE(SCLK_I2S0, "sclk_i2s0", "i2s_pre", 0, | 311 | GATE(SCLK_I2S0, "sclk_i2s0", "i2s_pre", CLK_SET_RATE_PARENT, |
312 | RK3288_CLKGATE_CON(4), 3, GFLAGS), | 312 | RK3288_CLKGATE_CON(4), 3, GFLAGS), |
313 | 313 | ||
314 | MUX(0, "spdif_src", mux_pll_src_cpll_gpll_p, 0, | 314 | MUX(0, "spdif_src", mux_pll_src_cpll_gpll_p, 0, |
@@ -808,5 +808,7 @@ static void __init rk3288_clk_init(struct device_node *np) | |||
808 | 808 | ||
809 | rockchip_register_softrst(np, 12, reg_base + RK3288_SOFTRST_CON(0), | 809 | rockchip_register_softrst(np, 12, reg_base + RK3288_SOFTRST_CON(0), |
810 | ROCKCHIP_SOFTRST_HIWORD_MASK); | 810 | ROCKCHIP_SOFTRST_HIWORD_MASK); |
811 | |||
812 | rockchip_register_restart_notifier(RK3288_GLB_SRST_FST); | ||
811 | } | 813 | } |
812 | CLK_OF_DECLARE(rk3288_cru, "rockchip,rk3288-cru", rk3288_clk_init); | 814 | CLK_OF_DECLARE(rk3288_cru, "rockchip,rk3288-cru", rk3288_clk_init); |
diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c index fd3b5ef87e29..1e68bff481b8 100644 --- a/drivers/clk/rockchip/clk.c +++ b/drivers/clk/rockchip/clk.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/clk-provider.h> | 25 | #include <linux/clk-provider.h> |
26 | #include <linux/mfd/syscon.h> | 26 | #include <linux/mfd/syscon.h> |
27 | #include <linux/regmap.h> | 27 | #include <linux/regmap.h> |
28 | #include <linux/reboot.h> | ||
28 | #include "clk.h" | 29 | #include "clk.h" |
29 | 30 | ||
30 | /** | 31 | /** |
@@ -330,3 +331,27 @@ void __init rockchip_clk_protect_critical(const char *clocks[], int nclocks) | |||
330 | clk_prepare_enable(clk); | 331 | clk_prepare_enable(clk); |
331 | } | 332 | } |
332 | } | 333 | } |
334 | |||
335 | static unsigned int reg_restart; | ||
336 | static int rockchip_restart_notify(struct notifier_block *this, | ||
337 | unsigned long mode, void *cmd) | ||
338 | { | ||
339 | writel(0xfdb9, reg_base + reg_restart); | ||
340 | return NOTIFY_DONE; | ||
341 | } | ||
342 | |||
343 | static struct notifier_block rockchip_restart_handler = { | ||
344 | .notifier_call = rockchip_restart_notify, | ||
345 | .priority = 128, | ||
346 | }; | ||
347 | |||
348 | void __init rockchip_register_restart_notifier(unsigned int reg) | ||
349 | { | ||
350 | int ret; | ||
351 | |||
352 | reg_restart = reg; | ||
353 | ret = register_restart_handler(&rockchip_restart_handler); | ||
354 | if (ret) | ||
355 | pr_err("%s: cannot register restart handler, %d\n", | ||
356 | __func__, ret); | ||
357 | } | ||
diff --git a/drivers/clk/rockchip/clk.h b/drivers/clk/rockchip/clk.h index f4791fbb3da9..ca009ab0a33a 100644 --- a/drivers/clk/rockchip/clk.h +++ b/drivers/clk/rockchip/clk.h | |||
@@ -367,6 +367,7 @@ void rockchip_clk_register_armclk(unsigned int lookup_id, const char *name, | |||
367 | const struct rockchip_cpuclk_rate_table *rates, | 367 | const struct rockchip_cpuclk_rate_table *rates, |
368 | int nrates); | 368 | int nrates); |
369 | void rockchip_clk_protect_critical(const char *clocks[], int nclocks); | 369 | void rockchip_clk_protect_critical(const char *clocks[], int nclocks); |
370 | void rockchip_register_restart_notifier(unsigned int reg); | ||
370 | 371 | ||
371 | #define ROCKCHIP_SOFTRST_HIWORD_MASK BIT(0) | 372 | #define ROCKCHIP_SOFTRST_HIWORD_MASK BIT(0) |
372 | 373 | ||
diff --git a/drivers/clk/samsung/clk-s3c2412.c b/drivers/clk/samsung/clk-s3c2412.c index 34af09f6a155..2ceedaf8ce18 100644 --- a/drivers/clk/samsung/clk-s3c2412.c +++ b/drivers/clk/samsung/clk-s3c2412.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/of.h> | 14 | #include <linux/of.h> |
15 | #include <linux/of_address.h> | 15 | #include <linux/of_address.h> |
16 | #include <linux/syscore_ops.h> | 16 | #include <linux/syscore_ops.h> |
17 | #include <linux/reboot.h> | ||
17 | 18 | ||
18 | #include <dt-bindings/clock/s3c2412.h> | 19 | #include <dt-bindings/clock/s3c2412.h> |
19 | 20 | ||
@@ -26,6 +27,7 @@ | |||
26 | #define CLKCON 0x0c | 27 | #define CLKCON 0x0c |
27 | #define CLKDIVN 0x14 | 28 | #define CLKDIVN 0x14 |
28 | #define CLKSRC 0x1c | 29 | #define CLKSRC 0x1c |
30 | #define SWRST 0x30 | ||
29 | 31 | ||
30 | /* list of PLLs to be registered */ | 32 | /* list of PLLs to be registered */ |
31 | enum s3c2412_plls { | 33 | enum s3c2412_plls { |
@@ -204,6 +206,28 @@ struct samsung_clock_alias s3c2412_aliases[] __initdata = { | |||
204 | ALIAS(MSYSCLK, NULL, "fclk"), | 206 | ALIAS(MSYSCLK, NULL, "fclk"), |
205 | }; | 207 | }; |
206 | 208 | ||
209 | static int s3c2412_restart(struct notifier_block *this, | ||
210 | unsigned long mode, void *cmd) | ||
211 | { | ||
212 | /* errata "Watch-dog/Software Reset Problem" specifies that | ||
213 | * this reset must be done with the SYSCLK sourced from | ||
214 | * EXTCLK instead of FOUT to avoid a glitch in the reset | ||
215 | * mechanism. | ||
216 | * | ||
217 | * See the watchdog section of the S3C2412 manual for more | ||
218 | * information on this fix. | ||
219 | */ | ||
220 | |||
221 | __raw_writel(0x00, reg_base + CLKSRC); | ||
222 | __raw_writel(0x533C2412, reg_base + SWRST); | ||
223 | return NOTIFY_DONE; | ||
224 | } | ||
225 | |||
226 | static struct notifier_block s3c2412_restart_handler = { | ||
227 | .notifier_call = s3c2412_restart, | ||
228 | .priority = 129, | ||
229 | }; | ||
230 | |||
207 | /* | 231 | /* |
208 | * fixed rate clocks generated outside the soc | 232 | * fixed rate clocks generated outside the soc |
209 | * Only necessary until the devicetree-move is complete | 233 | * Only necessary until the devicetree-move is complete |
@@ -233,6 +257,7 @@ void __init s3c2412_common_clk_init(struct device_node *np, unsigned long xti_f, | |||
233 | unsigned long ext_f, void __iomem *base) | 257 | unsigned long ext_f, void __iomem *base) |
234 | { | 258 | { |
235 | struct samsung_clk_provider *ctx; | 259 | struct samsung_clk_provider *ctx; |
260 | int ret; | ||
236 | reg_base = base; | 261 | reg_base = base; |
237 | 262 | ||
238 | if (np) { | 263 | if (np) { |
@@ -267,6 +292,10 @@ void __init s3c2412_common_clk_init(struct device_node *np, unsigned long xti_f, | |||
267 | s3c2412_clk_sleep_init(); | 292 | s3c2412_clk_sleep_init(); |
268 | 293 | ||
269 | samsung_clk_of_add_provider(np, ctx); | 294 | samsung_clk_of_add_provider(np, ctx); |
295 | |||
296 | ret = register_restart_handler(&s3c2412_restart_handler); | ||
297 | if (ret) | ||
298 | pr_warn("cannot register restart handler, %d\n", ret); | ||
270 | } | 299 | } |
271 | 300 | ||
272 | static void __init s3c2412_clk_init(struct device_node *np) | 301 | static void __init s3c2412_clk_init(struct device_node *np) |
diff --git a/drivers/clk/samsung/clk-s3c2443.c b/drivers/clk/samsung/clk-s3c2443.c index c92f853fca9f..0c3c182b902a 100644 --- a/drivers/clk/samsung/clk-s3c2443.c +++ b/drivers/clk/samsung/clk-s3c2443.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/of.h> | 14 | #include <linux/of.h> |
15 | #include <linux/of_address.h> | 15 | #include <linux/of_address.h> |
16 | #include <linux/syscore_ops.h> | 16 | #include <linux/syscore_ops.h> |
17 | #include <linux/reboot.h> | ||
17 | 18 | ||
18 | #include <dt-bindings/clock/s3c2443.h> | 19 | #include <dt-bindings/clock/s3c2443.h> |
19 | 20 | ||
@@ -33,6 +34,7 @@ | |||
33 | #define HCLKCON 0x30 | 34 | #define HCLKCON 0x30 |
34 | #define PCLKCON 0x34 | 35 | #define PCLKCON 0x34 |
35 | #define SCLKCON 0x38 | 36 | #define SCLKCON 0x38 |
37 | #define SWRST 0x44 | ||
36 | 38 | ||
37 | /* the soc types */ | 39 | /* the soc types */ |
38 | enum supported_socs { | 40 | enum supported_socs { |
@@ -354,6 +356,18 @@ struct samsung_clock_alias s3c2450_aliases[] __initdata = { | |||
354 | ALIAS(PCLK_I2C1, "s3c2410-i2c.1", "i2c"), | 356 | ALIAS(PCLK_I2C1, "s3c2410-i2c.1", "i2c"), |
355 | }; | 357 | }; |
356 | 358 | ||
359 | static int s3c2443_restart(struct notifier_block *this, | ||
360 | unsigned long mode, void *cmd) | ||
361 | { | ||
362 | __raw_writel(0x533c2443, reg_base + SWRST); | ||
363 | return NOTIFY_DONE; | ||
364 | } | ||
365 | |||
366 | static struct notifier_block s3c2443_restart_handler = { | ||
367 | .notifier_call = s3c2443_restart, | ||
368 | .priority = 129, | ||
369 | }; | ||
370 | |||
357 | /* | 371 | /* |
358 | * fixed rate clocks generated outside the soc | 372 | * fixed rate clocks generated outside the soc |
359 | * Only necessary until the devicetree-move is complete | 373 | * Only necessary until the devicetree-move is complete |
@@ -378,6 +392,7 @@ void __init s3c2443_common_clk_init(struct device_node *np, unsigned long xti_f, | |||
378 | void __iomem *base) | 392 | void __iomem *base) |
379 | { | 393 | { |
380 | struct samsung_clk_provider *ctx; | 394 | struct samsung_clk_provider *ctx; |
395 | int ret; | ||
381 | reg_base = base; | 396 | reg_base = base; |
382 | 397 | ||
383 | if (np) { | 398 | if (np) { |
@@ -447,6 +462,10 @@ void __init s3c2443_common_clk_init(struct device_node *np, unsigned long xti_f, | |||
447 | s3c2443_clk_sleep_init(); | 462 | s3c2443_clk_sleep_init(); |
448 | 463 | ||
449 | samsung_clk_of_add_provider(np, ctx); | 464 | samsung_clk_of_add_provider(np, ctx); |
465 | |||
466 | ret = register_restart_handler(&s3c2443_restart_handler); | ||
467 | if (ret) | ||
468 | pr_warn("cannot register restart handler, %d\n", ret); | ||
450 | } | 469 | } |
451 | 470 | ||
452 | static void __init s3c2416_clk_init(struct device_node *np) | 471 | static void __init s3c2416_clk_init(struct device_node *np) |