reset.c 618 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * (c) 2015 Purna Chandra Mandal <purna.mandal@microchip.com>
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. *
  6. */
  7. #include <common.h>
  8. #include <asm/io.h>
  9. #include <mach/pic32.h>
  10. /* SYSKEY */
  11. #define UNLOCK_KEY1 0xaa996655
  12. #define UNLOCK_KEY2 0x556699aa
  13. #define LOCK_KEY 0
  14. #define RSWRST 0x1250
  15. void _machine_restart(void)
  16. {
  17. void __iomem *base;
  18. base = pic32_get_syscfg_base();
  19. /* unlock sequence */
  20. writel(LOCK_KEY, base + SYSKEY);
  21. writel(UNLOCK_KEY1, base + SYSKEY);
  22. writel(UNLOCK_KEY2, base + SYSKEY);
  23. /* soft reset */
  24. writel(0x1, base + RSWRST);
  25. (void) readl(base + RSWRST);
  26. while (1)
  27. ;
  28. }