1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * (c) 2015 Purna Chandra Mandal <purna.mandal@microchip.com>
4 *
5 */
6
7#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}
35