Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+30
+2
drivers/clk/rockchip/clk-rk3188.c
··· 735 735 736 736 rockchip_register_softrst(np, 9, reg_base + RK2928_SOFTRST_CON(0), 737 737 ROCKCHIP_SOFTRST_HIWORD_MASK); 738 + 739 + rockchip_register_restart_notifier(RK2928_GLB_SRST_FST); 738 740 } 739 741 740 742 static void __init rk3066a_clk_init(struct device_node *np)
+2
drivers/clk/rockchip/clk-rk3288.c
··· 808 808 809 809 rockchip_register_softrst(np, 12, reg_base + RK3288_SOFTRST_CON(0), 810 810 ROCKCHIP_SOFTRST_HIWORD_MASK); 811 + 812 + rockchip_register_restart_notifier(RK3288_GLB_SRST_FST); 811 813 } 812 814 CLK_OF_DECLARE(rk3288_cru, "rockchip,rk3288-cru", rk3288_clk_init);
+25
drivers/clk/rockchip/clk.c
··· 25 25 #include <linux/clk-provider.h> 26 26 #include <linux/mfd/syscon.h> 27 27 #include <linux/regmap.h> 28 + #include <linux/reboot.h> 28 29 #include "clk.h" 29 30 30 31 /** ··· 330 329 if (clk) 331 330 clk_prepare_enable(clk); 332 331 } 332 + } 333 + 334 + static unsigned int reg_restart; 335 + static int rockchip_restart_notify(struct notifier_block *this, 336 + unsigned long mode, void *cmd) 337 + { 338 + writel(0xfdb9, reg_base + reg_restart); 339 + return NOTIFY_DONE; 340 + } 341 + 342 + static struct notifier_block rockchip_restart_handler = { 343 + .notifier_call = rockchip_restart_notify, 344 + .priority = 128, 345 + }; 346 + 347 + void __init rockchip_register_restart_notifier(unsigned int reg) 348 + { 349 + int ret; 350 + 351 + reg_restart = reg; 352 + ret = register_restart_handler(&rockchip_restart_handler); 353 + if (ret) 354 + pr_err("%s: cannot register restart handler, %d\n", 355 + __func__, ret); 333 356 }
+1
drivers/clk/rockchip/clk.h
··· 367 367 const struct rockchip_cpuclk_rate_table *rates, 368 368 int nrates); 369 369 void rockchip_clk_protect_critical(const char *clocks[], int nclocks); 370 + void rockchip_register_restart_notifier(unsigned int reg); 370 371 371 372 #define ROCKCHIP_SOFTRST_HIWORD_MASK BIT(0) 372 373