Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Masahiro Yamada | 5894ca0 | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 2 | /* |
Masahiro Yamada | 928f324 | 2016-08-25 21:03:41 +0900 | [diff] [blame] | 3 | * Copyright (C) 2012-2014 Panasonic Corporation |
| 4 | * Copyright (C) 2015-2016 Socionext Inc. |
| 5 | * Author: Masahiro Yamada <yamada.masahiro@socionext.com> |
Masahiro Yamada | 5894ca0 | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 6 | */ |
| 7 | |
Simon Glass | 9a3b4ce | 2019-12-28 10:45:01 -0700 | [diff] [blame] | 8 | #include <cpu_func.h> |
Masahiro Yamada | f6e7f07 | 2015-05-29 17:30:00 +0900 | [diff] [blame] | 9 | #include <linux/io.h> |
Masahiro Yamada | 928f324 | 2016-08-25 21:03:41 +0900 | [diff] [blame] | 10 | #include <asm/secure.h> |
Masahiro Yamada | 107b3fb | 2016-01-09 01:51:13 +0900 | [diff] [blame] | 11 | |
| 12 | #include "sc-regs.h" |
Masahiro Yamada | 5894ca0 | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 13 | |
Masahiro Yamada | 928f324 | 2016-08-25 21:03:41 +0900 | [diff] [blame] | 14 | /* If PSCI is enabled, this is used for SYSTEM_RESET function */ |
| 15 | #ifdef CONFIG_ARMV7_PSCI |
| 16 | #define __SECURE __secure |
| 17 | #else |
| 18 | #define __SECURE |
| 19 | #endif |
| 20 | |
| 21 | void __SECURE reset_cpu(unsigned long ignored) |
Masahiro Yamada | 5894ca0 | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 22 | { |
| 23 | u32 tmp; |
| 24 | |
Masahiro Yamada | 739ba41 | 2019-07-10 20:07:41 +0900 | [diff] [blame] | 25 | writel(5, sc_base + SC_IRQTIMSET); /* default value */ |
Masahiro Yamada | 5894ca0 | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 26 | |
Masahiro Yamada | 739ba41 | 2019-07-10 20:07:41 +0900 | [diff] [blame] | 27 | tmp = readl(sc_base + SC_SLFRSTSEL); |
Masahiro Yamada | 5894ca0 | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 28 | tmp &= ~0x3; /* mask [1:0] */ |
| 29 | tmp |= 0x0; /* XRST reboot */ |
Masahiro Yamada | 739ba41 | 2019-07-10 20:07:41 +0900 | [diff] [blame] | 30 | writel(tmp, sc_base + SC_SLFRSTSEL); |
Masahiro Yamada | 5894ca0 | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 31 | |
Masahiro Yamada | 739ba41 | 2019-07-10 20:07:41 +0900 | [diff] [blame] | 32 | tmp = readl(sc_base + SC_SLFRSTCTL); |
Masahiro Yamada | 5894ca0 | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 33 | tmp |= 0x1; |
Masahiro Yamada | 739ba41 | 2019-07-10 20:07:41 +0900 | [diff] [blame] | 34 | writel(tmp, sc_base + SC_SLFRSTCTL); |
Masahiro Yamada | 5894ca0 | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 35 | } |