diff options
author | Heiko Stübner <heiko@sntech.de> | 2014-08-19 17:45:38 -0700 |
---|---|---|
committer | Heiko Stuebner <heiko@sntech.de> | 2014-10-01 14:11:42 +0200 |
commit | 6f1294b5a87238c2f87f74a9942faf2f4ffa63b2 (patch) | |
tree | 25c78581a04c4d0bbfabed3ff6116a6e54952efe /drivers/clk/rockchip/clk.c | |
parent | aec1d96c530674f634730bbc604a807f1ba65bfb (diff) | |
download | talos-obmc-linux-6f1294b5a87238c2f87f74a9942faf2f4ffa63b2.tar.gz talos-obmc-linux-6f1294b5a87238c2f87f74a9942faf2f4ffa63b2.zip |
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>
Diffstat (limited to 'drivers/clk/rockchip/clk.c')
-rw-r--r-- | drivers/clk/rockchip/clk.c | 25 |
1 files changed, 25 insertions, 0 deletions
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 @@ #include <linux/clk-provider.h> #include <linux/mfd/syscon.h> #include <linux/regmap.h> +#include <linux/reboot.h> #include "clk.h" /** @@ -330,3 +331,27 @@ void __init rockchip_clk_protect_critical(const char *clocks[], int nclocks) clk_prepare_enable(clk); } } + +static unsigned int reg_restart; +static int rockchip_restart_notify(struct notifier_block *this, + unsigned long mode, void *cmd) +{ + writel(0xfdb9, reg_base + reg_restart); + return NOTIFY_DONE; +} + +static struct notifier_block rockchip_restart_handler = { + .notifier_call = rockchip_restart_notify, + .priority = 128, +}; + +void __init rockchip_register_restart_notifier(unsigned int reg) +{ + int ret; + + reg_restart = reg; + ret = register_restart_handler(&rockchip_restart_handler); + if (ret) + pr_err("%s: cannot register restart handler, %d\n", + __func__, ret); +} |