reset.c 1.6 KB

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