diff options
| author | Heiko Stübner <heiko@sntech.de> | 2014-08-19 20:45:38 -0400 |
|---|---|---|
| committer | Heiko Stuebner <heiko@sntech.de> | 2014-10-01 08:11:42 -0400 |
| commit | 6f1294b5a87238c2f87f74a9942faf2f4ffa63b2 (patch) | |
| tree | 25c78581a04c4d0bbfabed3ff6116a6e54952efe | |
| parent | aec1d96c530674f634730bbc604a807f1ba65bfb (diff) | |
clk: rockchip: add restart handler
Add infrastructure to write the correct value to the restart register and
register the restart notifier for both rk3188 (including rk3066) and rk3288.
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| -rw-r--r-- | drivers/clk/rockchip/clk-rk3188.c | 2 | ||||
| -rw-r--r-- | drivers/clk/rockchip/clk-rk3288.c | 2 | ||||
| -rw-r--r-- | drivers/clk/rockchip/clk.c | 25 | ||||
| -rw-r--r-- | drivers/clk/rockchip/clk.h | 1 |
4 files changed, 30 insertions, 0 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 b488f6a48d19..23278291da44 100644 --- a/drivers/clk/rockchip/clk-rk3288.c +++ b/drivers/clk/rockchip/clk-rk3288.c | |||
| @@ -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 | ||
