blob: 8071b13f7b48deb4ea7199abb27936ad69cbbff9 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Purna Chandra Mandalbe961fa2016-01-28 15:30:16 +05302/*
3 * (c) 2015 Purna Chandra Mandal <purna.mandal@microchip.com>
4 *
Purna Chandra Mandalbe961fa2016-01-28 15:30:16 +05305 */
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
18void _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}