xref: /linux/arch/arm/mach-spear/restart.c (revision 6c8c1406)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * arch/arm/plat-spear/restart.c
4  *
5  * SPEAr platform specific restart functions
6  *
7  * Copyright (C) 2009 ST Microelectronics
8  * Viresh Kumar <vireshk@kernel.org>
9  */
10 #include <linux/io.h>
11 #include <linux/amba/sp810.h>
12 #include <linux/reboot.h>
13 #include <asm/system_misc.h>
14 #include "spear.h"
15 #include "generic.h"
16 
17 #define SPEAR13XX_SYS_SW_RES			(VA_MISC_BASE + 0x204)
18 void spear_restart(enum reboot_mode mode, const char *cmd)
19 {
20 	if (mode == REBOOT_SOFT) {
21 		/* software reset, Jump into ROM at address 0 */
22 		soft_restart(0);
23 	} else {
24 		/* hardware reset, Use on-chip reset capability */
25 #ifdef CONFIG_ARCH_SPEAR13XX
26 		writel_relaxed(0x01, SPEAR13XX_SYS_SW_RES);
27 #endif
28 #if defined(CONFIG_ARCH_SPEAR3XX) || defined(CONFIG_ARCH_SPEAR6XX)
29 		sysctl_soft_reset((void __iomem *)VA_SPEAR_SYS_CTRL_BASE);
30 #endif
31 	}
32 }
33