blob: ce5e098c48889347227d876fd181023babc1e31b [file] [log] [blame]
Russell Kingdd1661e2011-11-05 21:10:37 +00001/*
2 * arch/arm/plat-spear/restart.c
3 *
4 * SPEAr platform specific restart functions
5 *
6 * Copyright (C) 2009 ST Microelectronics
Viresh Kumar10d89352012-06-20 12:53:02 -07007 * Viresh Kumar <viresh.linux@gmail.com>
Russell Kingdd1661e2011-11-05 21:10:37 +00008 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13#include <linux/io.h>
Catalin Marinasda660b42013-01-04 14:17:15 +000014#include <linux/amba/sp810.h>
Robin Holt7b6d8642013-07-08 16:01:40 -070015#include <linux/reboot.h>
David Howells9f97da72012-03-28 18:30:01 +010016#include <asm/system_misc.h>
Arnd Bergmann5019f0b2012-04-11 17:30:11 +000017#include <mach/spear.h>
Arnd Bergmann2b9c6132012-12-02 15:49:04 +010018#include "generic.h"
Russell Kingdd1661e2011-11-05 21:10:37 +000019
Viresh Kumare3978dc2012-04-19 22:23:13 +053020#define SPEAR13XX_SYS_SW_RES (VA_MISC_BASE + 0x204)
Robin Holt7b6d8642013-07-08 16:01:40 -070021void spear_restart(enum reboot_mode mode, const char *cmd)
Russell Kingdd1661e2011-11-05 21:10:37 +000022{
Robin Holt7b6d8642013-07-08 16:01:40 -070023 if (mode == REBOOT_SOFT) {
Russell Kingdd1661e2011-11-05 21:10:37 +000024 /* software reset, Jump into ROM at address 0 */
25 soft_restart(0);
26 } else {
27 /* hardware reset, Use on-chip reset capability */
Viresh Kumare3978dc2012-04-19 22:23:13 +053028#ifdef CONFIG_ARCH_SPEAR13XX
29 writel_relaxed(0x01, SPEAR13XX_SYS_SW_RES);
Arnd Bergmannaf632752013-01-25 23:09:57 +000030#endif
31#if defined(CONFIG_ARCH_SPEAR3XX) || defined(CONFIG_ARCH_SPEAR6XX)
Russell Kingdd1661e2011-11-05 21:10:37 +000032 sysctl_soft_reset((void __iomem *)VA_SPEAR_SYS_CTRL_BASE);
Viresh Kumare3978dc2012-04-19 22:23:13 +053033#endif
Russell Kingdd1661e2011-11-05 21:10:37 +000034 }
35}