blob: 43e27d12c3e15a3dd1c7103f5ab6e1db3f87f9c5 [file] [log] [blame]
Masahiro Yamada5894ca02014-10-03 19:21:06 +09001/*
Masahiro Yamada928f3242016-08-25 21:03:41 +09002 * Copyright (C) 2012-2014 Panasonic Corporation
3 * Copyright (C) 2015-2016 Socionext Inc.
4 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada5894ca02014-10-03 19:21:06 +09005 *
6 * SPDX-License-Identifier: GPL-2.0+
7 */
8
9#include <common.h>
Masahiro Yamadaf6e7f072015-05-29 17:30:00 +090010#include <linux/io.h>
Masahiro Yamada928f3242016-08-25 21:03:41 +090011#include <asm/secure.h>
Masahiro Yamada107b3fb2016-01-09 01:51:13 +090012
13#include "sc-regs.h"
Masahiro Yamada5894ca02014-10-03 19:21:06 +090014
Masahiro Yamada928f3242016-08-25 21:03:41 +090015/* If PSCI is enabled, this is used for SYSTEM_RESET function */
16#ifdef CONFIG_ARMV7_PSCI
17#define __SECURE __secure
18#else
19#define __SECURE
20#endif
21
22void __SECURE reset_cpu(unsigned long ignored)
Masahiro Yamada5894ca02014-10-03 19:21:06 +090023{
24 u32 tmp;
25
Masahiro Yamada5894ca02014-10-03 19:21:06 +090026 writel(5, SC_IRQTIMSET); /* default value */
27
28 tmp = readl(SC_SLFRSTSEL);
29 tmp &= ~0x3; /* mask [1:0] */
30 tmp |= 0x0; /* XRST reboot */
31 writel(tmp, SC_SLFRSTSEL);
32
33 tmp = readl(SC_SLFRSTCTL);
34 tmp |= 0x1;
35 writel(tmp, SC_SLFRSTCTL);
36}