xref: /OK3568_Linux_fs/kernel/arch/arm/mach-spear/restart.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * arch/arm/plat-spear/restart.c
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * SPEAr platform specific restart functions
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * Copyright (C) 2009 ST Microelectronics
7*4882a593Smuzhiyun  * Viresh Kumar <vireshk@kernel.org>
8*4882a593Smuzhiyun  *
9*4882a593Smuzhiyun  * This file is licensed under the terms of the GNU General Public
10*4882a593Smuzhiyun  * License version 2. This program is licensed "as is" without any
11*4882a593Smuzhiyun  * warranty of any kind, whether express or implied.
12*4882a593Smuzhiyun  */
13*4882a593Smuzhiyun #include <linux/io.h>
14*4882a593Smuzhiyun #include <linux/amba/sp810.h>
15*4882a593Smuzhiyun #include <linux/reboot.h>
16*4882a593Smuzhiyun #include <asm/system_misc.h>
17*4882a593Smuzhiyun #include <mach/spear.h>
18*4882a593Smuzhiyun #include "generic.h"
19*4882a593Smuzhiyun 
20*4882a593Smuzhiyun #define SPEAR13XX_SYS_SW_RES			(VA_MISC_BASE + 0x204)
spear_restart(enum reboot_mode mode,const char * cmd)21*4882a593Smuzhiyun void spear_restart(enum reboot_mode mode, const char *cmd)
22*4882a593Smuzhiyun {
23*4882a593Smuzhiyun 	if (mode == REBOOT_SOFT) {
24*4882a593Smuzhiyun 		/* software reset, Jump into ROM at address 0 */
25*4882a593Smuzhiyun 		soft_restart(0);
26*4882a593Smuzhiyun 	} else {
27*4882a593Smuzhiyun 		/* hardware reset, Use on-chip reset capability */
28*4882a593Smuzhiyun #ifdef CONFIG_ARCH_SPEAR13XX
29*4882a593Smuzhiyun 		writel_relaxed(0x01, SPEAR13XX_SYS_SW_RES);
30*4882a593Smuzhiyun #endif
31*4882a593Smuzhiyun #if defined(CONFIG_ARCH_SPEAR3XX) || defined(CONFIG_ARCH_SPEAR6XX)
32*4882a593Smuzhiyun 		sysctl_soft_reset((void __iomem *)VA_SPEAR_SYS_CTRL_BASE);
33*4882a593Smuzhiyun #endif
34*4882a593Smuzhiyun 	}
35*4882a593Smuzhiyun }
36