blob: efd6985b44a179c8b5ae73e3875d2fd9c75e63e4 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Purna Chandra Mandal5c2dcd22016-01-28 15:30:16 +05302/*
3 * (c) 2015 Purna Chandra Mandal <purna.mandal@microchip.com>
4 *
Purna Chandra Mandal5c2dcd22016-01-28 15:30:16 +05305 */
6
Purna Chandra Mandal5c2dcd22016-01-28 15:30:16 +05307#include <asm/io.h>
8#include <mach/pic32.h>
9
10/* SYSKEY */
11#define UNLOCK_KEY1 0xaa996655
12#define UNLOCK_KEY2 0x556699aa
13#define LOCK_KEY 0
14
15#define RSWRST 0x1250
16
17void _machine_restart(void)
18{
19 void __iomem *base;
20
21 base = pic32_get_syscfg_base();
22
23 /* unlock sequence */
24 writel(LOCK_KEY, base + SYSKEY);
25 writel(UNLOCK_KEY1, base + SYSKEY);
26 writel(UNLOCK_KEY2, base + SYSKEY);
27
28 /* soft reset */
29 writel(0x1, base + RSWRST);
30 (void) readl(base + RSWRST);
31
32 while (1)
33 ;
34}