92a8b925474f098274d93eaa97f995691fd20a57
[oweals/u-boot.git] / arch / arm / mach-uniphier / reset.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2012-2014 Panasonic Corporation
4  * Copyright (C) 2015-2016 Socionext Inc.
5  *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
6  */
7
8 #include <common.h>
9 #include <cpu_func.h>
10 #include <linux/io.h>
11 #include <asm/secure.h>
12
13 #include "sc-regs.h"
14
15 /* 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
22 void __SECURE reset_cpu(unsigned long ignored)
23 {
24         u32 tmp;
25
26         writel(5, sc_base + SC_IRQTIMSET); /* default value */
27
28         tmp  = readl(sc_base + SC_SLFRSTSEL);
29         tmp &= ~0x3; /* mask [1:0] */
30         tmp |= 0x0;  /* XRST reboot */
31         writel(tmp, sc_base + SC_SLFRSTSEL);
32
33         tmp = readl(sc_base + SC_SLFRSTCTL);
34         tmp |= 0x1;
35         writel(tmp, sc_base + SC_SLFRSTCTL);
36 }