xref: /openbmc/u-boot/arch/mips/mach-pic32/reset.c (revision 90c08fa0)
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * (c) 2015 Purna Chandra Mandal <purna.mandal@microchip.com>
4  *
5  */
6 
7 #include <common.h>
8 #include <asm/io.h>
9 #include <mach/pic32.h>
10 
11 /* SYSKEY */
12 #define UNLOCK_KEY1	0xaa996655
13 #define UNLOCK_KEY2	0x556699aa
14 #define LOCK_KEY	0
15 
16 #define RSWRST          0x1250
17 
18 void _machine_restart(void)
19 {
20 	void __iomem *base;
21 
22 	base = pic32_get_syscfg_base();
23 
24 	/* unlock sequence */
25 	writel(LOCK_KEY, base + SYSKEY);
26 	writel(UNLOCK_KEY1, base + SYSKEY);
27 	writel(UNLOCK_KEY2, base + SYSKEY);
28 
29 	/* soft reset */
30 	writel(0x1, base + RSWRST);
31 	(void) readl(base + RSWRST);
32 
33 	while (1)
34 		;
35 }
36