reset.c 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #include <common.h>
  2. #include <asm/arch/sysctl.h>
  3. #include <asm/arch/pinmux.h>
  4. #include <asm/arch/clock.h>
  5. void reset_cpu(ulong addr)
  6. {
  7. u32 value;
  8. // Assert reset to cores as per power on defaults
  9. // Don't touch the DDR interface as things will come to an impromptu stop
  10. // NB Possibly should be asserting reset for PLLB, but there are timing
  11. // concerns here according to the docs
  12. value =
  13. BIT(SYS_CTRL_RST_COPRO ) |
  14. BIT(SYS_CTRL_RST_USBHS ) |
  15. BIT(SYS_CTRL_RST_USBHSPHYA ) |
  16. BIT(SYS_CTRL_RST_MACA ) |
  17. BIT(SYS_CTRL_RST_PCIEA ) |
  18. BIT(SYS_CTRL_RST_SGDMA ) |
  19. BIT(SYS_CTRL_RST_CIPHER ) |
  20. BIT(SYS_CTRL_RST_SATA ) |
  21. BIT(SYS_CTRL_RST_SATA_LINK ) |
  22. BIT(SYS_CTRL_RST_SATA_PHY ) |
  23. BIT(SYS_CTRL_RST_PCIEPHY ) |
  24. BIT(SYS_CTRL_RST_STATIC ) |
  25. BIT(SYS_CTRL_RST_UART1 ) |
  26. BIT(SYS_CTRL_RST_UART2 ) |
  27. BIT(SYS_CTRL_RST_MISC ) |
  28. BIT(SYS_CTRL_RST_I2S ) |
  29. BIT(SYS_CTRL_RST_SD ) |
  30. BIT(SYS_CTRL_RST_MACB ) |
  31. BIT(SYS_CTRL_RST_PCIEB ) |
  32. BIT(SYS_CTRL_RST_VIDEO ) |
  33. BIT(SYS_CTRL_RST_USBHSPHYB ) |
  34. BIT(SYS_CTRL_RST_USBDEV );
  35. writel(value, SYS_CTRL_RST_SET_CTRL);
  36. // Release reset to cores as per power on defaults
  37. writel(BIT(SYS_CTRL_RST_GPIO), SYS_CTRL_RST_CLR_CTRL);
  38. // Disable clocks to cores as per power-on defaults - must leave DDR
  39. // related clocks enabled otherwise we'll stop rather abruptly.
  40. value =
  41. BIT(SYS_CTRL_CLK_COPRO) |
  42. BIT(SYS_CTRL_CLK_DMA) |
  43. BIT(SYS_CTRL_CLK_CIPHER) |
  44. BIT(SYS_CTRL_CLK_SD) |
  45. BIT(SYS_CTRL_CLK_SATA) |
  46. BIT(SYS_CTRL_CLK_I2S) |
  47. BIT(SYS_CTRL_CLK_USBHS) |
  48. BIT(SYS_CTRL_CLK_MAC) |
  49. BIT(SYS_CTRL_CLK_PCIEA) |
  50. BIT(SYS_CTRL_CLK_STATIC) |
  51. BIT(SYS_CTRL_CLK_MACB) |
  52. BIT(SYS_CTRL_CLK_PCIEB) |
  53. BIT(SYS_CTRL_CLK_REF600) |
  54. BIT(SYS_CTRL_CLK_USBDEV);
  55. writel(value, SYS_CTRL_CLK_CLR_CTRL);
  56. // Enable clocks to cores as per power-on defaults
  57. // Set sys-control pin mux'ing as per power-on defaults
  58. writel(0, SYS_CONTROL_BASE + PINMUX_SECONDARY_SEL);
  59. writel(0, SYS_CONTROL_BASE + PINMUX_TERTIARY_SEL);
  60. writel(0, SYS_CONTROL_BASE + PINMUX_QUATERNARY_SEL);
  61. writel(0, SYS_CONTROL_BASE + PINMUX_DEBUG_SEL);
  62. writel(0, SYS_CONTROL_BASE + PINMUX_ALTERNATIVE_SEL);
  63. writel(0, SYS_CONTROL_BASE + PINMUX_PULLUP_SEL);
  64. writel(0, SEC_CONTROL_BASE + PINMUX_SECONDARY_SEL);
  65. writel(0, SEC_CONTROL_BASE + PINMUX_TERTIARY_SEL);
  66. writel(0, SEC_CONTROL_BASE + PINMUX_QUATERNARY_SEL);
  67. writel(0, SEC_CONTROL_BASE + PINMUX_DEBUG_SEL);
  68. writel(0, SEC_CONTROL_BASE + PINMUX_ALTERNATIVE_SEL);
  69. writel(0, SEC_CONTROL_BASE + PINMUX_PULLUP_SEL);
  70. // No need to save any state, as the ROM loader can determine whether reset
  71. // is due to power cycling or programatic action, just hit the (self-
  72. // clearing) CPU reset bit of the block reset register
  73. value =
  74. BIT(SYS_CTRL_RST_SCU) |
  75. BIT(SYS_CTRL_RST_ARM0) |
  76. BIT(SYS_CTRL_RST_ARM1);
  77. writel(value, SYS_CTRL_RST_SET_CTRL);
  78. }