18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * arch/arm/plat-spear/restart.c
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * SPEAr platform specific restart functions
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Copyright (C) 2009 ST Microelectronics
78c2ecf20Sopenharmony_ci * Viresh Kumar <vireshk@kernel.org>
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * This file is licensed under the terms of the GNU General Public
108c2ecf20Sopenharmony_ci * License version 2. This program is licensed "as is" without any
118c2ecf20Sopenharmony_ci * warranty of any kind, whether express or implied.
128c2ecf20Sopenharmony_ci */
138c2ecf20Sopenharmony_ci#include <linux/io.h>
148c2ecf20Sopenharmony_ci#include <linux/amba/sp810.h>
158c2ecf20Sopenharmony_ci#include <linux/reboot.h>
168c2ecf20Sopenharmony_ci#include <asm/system_misc.h>
178c2ecf20Sopenharmony_ci#include <mach/spear.h>
188c2ecf20Sopenharmony_ci#include "generic.h"
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define SPEAR13XX_SYS_SW_RES			(VA_MISC_BASE + 0x204)
218c2ecf20Sopenharmony_civoid spear_restart(enum reboot_mode mode, const char *cmd)
228c2ecf20Sopenharmony_ci{
238c2ecf20Sopenharmony_ci	if (mode == REBOOT_SOFT) {
248c2ecf20Sopenharmony_ci		/* software reset, Jump into ROM at address 0 */
258c2ecf20Sopenharmony_ci		soft_restart(0);
268c2ecf20Sopenharmony_ci	} else {
278c2ecf20Sopenharmony_ci		/* hardware reset, Use on-chip reset capability */
288c2ecf20Sopenharmony_ci#ifdef CONFIG_ARCH_SPEAR13XX
298c2ecf20Sopenharmony_ci		writel_relaxed(0x01, SPEAR13XX_SYS_SW_RES);
308c2ecf20Sopenharmony_ci#endif
318c2ecf20Sopenharmony_ci#if defined(CONFIG_ARCH_SPEAR3XX) || defined(CONFIG_ARCH_SPEAR6XX)
328c2ecf20Sopenharmony_ci		sysctl_soft_reset((void __iomem *)VA_SPEAR_SYS_CTRL_BASE);
338c2ecf20Sopenharmony_ci#endif
348c2ecf20Sopenharmony_ci	}
358c2ecf20Sopenharmony_ci}
36