xref: /openbmc/linux/arch/arm/mach-omap2/ti81xx-restart.c (revision 2612e3bbc0386368a850140a6c9b990cd496a5ec)
1d2912cb1SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
2bc7235c9STony Lindgren #include <linux/kernel.h>
3bc7235c9STony Lindgren #include <linux/init.h>
4bc7235c9STony Lindgren #include <linux/reboot.h>
5bc7235c9STony Lindgren 
6bc7235c9STony Lindgren #include "iomap.h"
7bc7235c9STony Lindgren #include "common.h"
8bc7235c9STony Lindgren #include "control.h"
9bc7235c9STony Lindgren #include "prm3xxx.h"
10bc7235c9STony Lindgren 
11bc7235c9STony Lindgren #define TI81XX_PRM_DEVICE_RSTCTRL	0x00a0
12bc7235c9STony Lindgren #define TI81XX_GLOBAL_RST_COLD		BIT(1)
13bc7235c9STony Lindgren 
14bc7235c9STony Lindgren /**
15bc7235c9STony Lindgren  * ti81xx_restart - trigger a software restart of the SoC
16bc7235c9STony Lindgren  * @mode: the "reboot mode", see arch/arm/kernel/{setup,process}.c
17bc7235c9STony Lindgren  * @cmd: passed from the userspace program rebooting the system (if provided)
18bc7235c9STony Lindgren  *
19bc7235c9STony Lindgren  * Resets the SoC.  For @cmd, see the 'reboot' syscall in
20bc7235c9STony Lindgren  * kernel/sys.c.  No return value.
21bc7235c9STony Lindgren  *
22bc7235c9STony Lindgren  * NOTE: Warm reset does not seem to work, may require resetting
23bc7235c9STony Lindgren  * clocks to bypass mode.
24bc7235c9STony Lindgren  */
ti81xx_restart(enum reboot_mode mode,const char * cmd)25bc7235c9STony Lindgren void ti81xx_restart(enum reboot_mode mode, const char *cmd)
26bc7235c9STony Lindgren {
27bc7235c9STony Lindgren 	omap2_prm_set_mod_reg_bits(TI81XX_GLOBAL_RST_COLD, 0,
28bc7235c9STony Lindgren 				   TI81XX_PRM_DEVICE_RSTCTRL);
29*937e8722SFranziska Naepelt 	while (1)
30*937e8722SFranziska Naepelt 		;
31bc7235c9STony Lindgren }
32