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 | |
| 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 | } |