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