reset_manager.c 873 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2013 Altera Corporation <www.altera.com>
  4. */
  5. #include <common.h>
  6. #include <asm/io.h>
  7. #include <asm/arch/reset_manager.h>
  8. #if defined(CONFIG_TARGET_SOCFPGA_STRATIX10)
  9. #include <asm/arch/mailbox_s10.h>
  10. #endif
  11. DECLARE_GLOBAL_DATA_PTR;
  12. #if !defined(CONFIG_TARGET_SOCFPGA_STRATIX10)
  13. static const struct socfpga_reset_manager *reset_manager_base =
  14. (void *)SOCFPGA_RSTMGR_ADDRESS;
  15. #endif
  16. /*
  17. * Write the reset manager register to cause reset
  18. */
  19. void reset_cpu(ulong addr)
  20. {
  21. /* request a warm reset */
  22. #if defined(CONFIG_TARGET_SOCFPGA_STRATIX10)
  23. puts("Mailbox: Issuing mailbox cmd REBOOT_HPS\n");
  24. mbox_reset_cold();
  25. #else
  26. writel(1 << RSTMGR_CTRL_SWWARMRSTREQ_LSB,
  27. &reset_manager_base->ctrl);
  28. #endif
  29. /*
  30. * infinite loop here as watchdog will trigger and reset
  31. * the processor
  32. */
  33. while (1)
  34. ;
  35. }