Merge tag 'u-boot-atmel-fixes-2020.07-a' of https://gitlab.denx.de/u-boot/custodians...
[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 <cpu_func.h>
9 #include <linux/io.h>
10 #include <asm/secure.h>
11
12 #include "sc-regs.h"
13
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)
22 {
23         u32 tmp;
24
25         writel(5, sc_base + SC_IRQTIMSET); /* default value */
26
27         tmp  = readl(sc_base + SC_SLFRSTSEL);
28         tmp &= ~0x3; /* mask [1:0] */
29         tmp |= 0x0;  /* XRST reboot */
30         writel(tmp, sc_base + SC_SLFRSTSEL);
31
32         tmp = readl(sc_base + SC_SLFRSTCTL);
33         tmp |= 0x1;
34         writel(tmp, sc_base + SC_SLFRSTCTL);
35 }