Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Purna Chandra Mandal | 5c2dcd2 | 2016-01-28 15:30:16 +0530 | [diff] [blame] | 2 | /* |
| 3 | * (c) 2015 Purna Chandra Mandal <purna.mandal@microchip.com> |
| 4 | * |
Purna Chandra Mandal | 5c2dcd2 | 2016-01-28 15:30:16 +0530 | [diff] [blame] | 5 | */ |
| 6 | |
Purna Chandra Mandal | 5c2dcd2 | 2016-01-28 15:30:16 +0530 | [diff] [blame] | 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 | |
| 17 | void _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 | } |