reset.c 615 B

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