reset.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * OMAP1 reset support
  3. */
  4. #include <linux/kernel.h>
  5. #include <linux/io.h>
  6. #include <mach/hardware.h>
  7. #include "iomap.h"
  8. #include "common.h"
  9. /* ARM_SYSST bit shifts related to SoC reset sources */
  10. #define ARM_SYSST_POR_SHIFT 5
  11. #define ARM_SYSST_EXT_RST_SHIFT 4
  12. #define ARM_SYSST_ARM_WDRST_SHIFT 2
  13. #define ARM_SYSST_GLOB_SWRST_SHIFT 1
  14. /* Standardized reset source bits (across all OMAP SoCs) */
  15. #define OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT 0
  16. #define OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT 1
  17. #define OMAP_MPU_WD_RST_SRC_ID_SHIFT 3
  18. #define OMAP_EXTWARM_RST_SRC_ID_SHIFT 5
  19. void omap1_restart(char mode, const char *cmd)
  20. {
  21. /*
  22. * Workaround for 5912/1611b bug mentioned in sprz209d.pdf p. 28
  23. * "Global Software Reset Affects Traffic Controller Frequency".
  24. */
  25. if (cpu_is_omap5912()) {
  26. omap_writew(omap_readw(DPLL_CTL) & ~(1 << 4), DPLL_CTL);
  27. omap_writew(0x8, ARM_RSTCT1);
  28. }
  29. omap_writew(1, ARM_RSTCT1);
  30. }
  31. /**
  32. * omap1_get_reset_sources - return the source of the SoC's last reset
  33. *
  34. * Returns bits that represent the last reset source for the SoC. The
  35. * format is standardized across OMAPs for use by the OMAP watchdog.
  36. */
  37. u32 omap1_get_reset_sources(void)
  38. {
  39. u32 ret = 0;
  40. u16 rs;
  41. rs = __raw_readw(OMAP1_IO_ADDRESS(ARM_SYSST));
  42. if (rs & (1 << ARM_SYSST_POR_SHIFT))
  43. ret |= 1 << OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT;
  44. if (rs & (1 << ARM_SYSST_EXT_RST_SHIFT))
  45. ret |= 1 << OMAP_EXTWARM_RST_SRC_ID_SHIFT;
  46. if (rs & (1 << ARM_SYSST_ARM_WDRST_SHIFT))
  47. ret |= 1 << OMAP_MPU_WD_RST_SRC_ID_SHIFT;
  48. if (rs & (1 << ARM_SYSST_GLOB_SWRST_SHIFT))
  49. ret |= 1 << OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT;
  50. return ret;
  51. }