prm.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*
  2. * OMAP2/3/4 Power/Reset Management (PRM) bitfield definitions
  3. *
  4. * Copyright (C) 2007-2009, 2012 Texas Instruments, Inc.
  5. * Copyright (C) 2010 Nokia Corporation
  6. *
  7. * Paul Walmsley
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #ifndef __ARCH_ARM_MACH_OMAP2_PRM_H
  14. #define __ARCH_ARM_MACH_OMAP2_PRM_H
  15. #include "prcm-common.h"
  16. # ifndef __ASSEMBLER__
  17. extern void __iomem *prm_base;
  18. extern void omap2_set_globals_prm(void __iomem *prm);
  19. # endif
  20. /*
  21. * MAX_MODULE_SOFTRESET_WAIT: Maximum microseconds to wait for OMAP
  22. * module to softreset
  23. */
  24. #define MAX_MODULE_SOFTRESET_WAIT 10000
  25. /*
  26. * MAX_MODULE_HARDRESET_WAIT: Maximum microseconds to wait for an OMAP
  27. * submodule to exit hardreset
  28. */
  29. #define MAX_MODULE_HARDRESET_WAIT 10000
  30. /*
  31. * Register bitfields
  32. */
  33. /*
  34. * 24XX: PM_PWSTST_CORE, PM_PWSTST_GFX, PM_PWSTST_MPU, PM_PWSTST_DSP
  35. *
  36. * 2430: PM_PWSTST_MDM
  37. *
  38. * 3430: PM_PWSTST_IVA2, PM_PWSTST_MPU, PM_PWSTST_CORE, PM_PWSTST_GFX,
  39. * PM_PWSTST_DSS, PM_PWSTST_CAM, PM_PWSTST_PER, PM_PWSTST_EMU,
  40. * PM_PWSTST_NEON
  41. */
  42. #define OMAP_INTRANSITION_MASK (1 << 20)
  43. /*
  44. * 24XX: PM_PWSTST_GFX, PM_PWSTST_DSP
  45. *
  46. * 2430: PM_PWSTST_MDM
  47. *
  48. * 3430: PM_PWSTST_IVA2, PM_PWSTST_MPU, PM_PWSTST_CORE, PM_PWSTST_GFX,
  49. * PM_PWSTST_DSS, PM_PWSTST_CAM, PM_PWSTST_PER, PM_PWSTST_EMU,
  50. * PM_PWSTST_NEON
  51. */
  52. #define OMAP_POWERSTATEST_SHIFT 0
  53. #define OMAP_POWERSTATEST_MASK (0x3 << 0)
  54. /*
  55. * 24XX: PM_PWSTCTRL_MPU, PM_PWSTCTRL_CORE, PM_PWSTCTRL_GFX,
  56. * PM_PWSTCTRL_DSP, PM_PWSTST_MPU
  57. *
  58. * 2430: PM_PWSTCTRL_MDM shared bits
  59. *
  60. * 3430: PM_PWSTCTRL_IVA2, PM_PWSTCTRL_MPU, PM_PWSTCTRL_CORE,
  61. * PM_PWSTCTRL_GFX, PM_PWSTCTRL_DSS, PM_PWSTCTRL_CAM, PM_PWSTCTRL_PER,
  62. * PM_PWSTCTRL_NEON shared bits
  63. */
  64. #define OMAP_POWERSTATE_SHIFT 0
  65. #define OMAP_POWERSTATE_MASK (0x3 << 0)
  66. /*
  67. * Standardized OMAP reset source bits
  68. *
  69. * To the extent these happen to match the hardware register bit
  70. * shifts, it's purely coincidental. Used by omap-wdt.c.
  71. * OMAP_UNKNOWN_RST_SRC_ID_SHIFT is a special value, used whenever
  72. * there are any bits remaining in the global PRM_RSTST register that
  73. * haven't been identified, or when the PRM code for the current SoC
  74. * doesn't know how to interpret the register.
  75. */
  76. #define OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT 0
  77. #define OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT 1
  78. #define OMAP_SECU_VIOL_RST_SRC_ID_SHIFT 2
  79. #define OMAP_MPU_WD_RST_SRC_ID_SHIFT 3
  80. #define OMAP_SECU_WD_RST_SRC_ID_SHIFT 4
  81. #define OMAP_EXTWARM_RST_SRC_ID_SHIFT 5
  82. #define OMAP_VDD_MPU_VM_RST_SRC_ID_SHIFT 6
  83. #define OMAP_VDD_IVA_VM_RST_SRC_ID_SHIFT 7
  84. #define OMAP_VDD_CORE_VM_RST_SRC_ID_SHIFT 8
  85. #define OMAP_ICEPICK_RST_SRC_ID_SHIFT 9
  86. #define OMAP_ICECRUSHER_RST_SRC_ID_SHIFT 10
  87. #define OMAP_C2C_RST_SRC_ID_SHIFT 11
  88. #define OMAP_UNKNOWN_RST_SRC_ID_SHIFT 12
  89. #ifndef __ASSEMBLER__
  90. /**
  91. * struct prm_reset_src_map - map register bitshifts to standard bitshifts
  92. * @reg_shift: bitshift in the PRM reset source register
  93. * @std_shift: bitshift equivalent in the standard reset source list
  94. *
  95. * The fields are signed because -1 is used as a terminator.
  96. */
  97. struct prm_reset_src_map {
  98. s8 reg_shift;
  99. s8 std_shift;
  100. };
  101. /**
  102. * struct prm_ll_data - fn ptrs to per-SoC PRM function implementations
  103. * @read_reset_sources: ptr to the SoC PRM-specific get_reset_source impl
  104. * @was_any_context_lost_old: ptr to the SoC PRM context loss test fn
  105. * @clear_context_loss_flags_old: ptr to the SoC PRM context loss flag clear fn
  106. *
  107. * XXX @was_any_context_lost_old and @clear_context_loss_flags_old are
  108. * deprecated.
  109. */
  110. struct prm_ll_data {
  111. u32 (*read_reset_sources)(void);
  112. bool (*was_any_context_lost_old)(u8 part, s16 inst, u16 idx);
  113. void (*clear_context_loss_flags_old)(u8 part, s16 inst, u16 idx);
  114. };
  115. extern int prm_register(struct prm_ll_data *pld);
  116. extern int prm_unregister(struct prm_ll_data *pld);
  117. extern u32 prm_read_reset_sources(void);
  118. extern bool prm_was_any_context_lost_old(u8 part, s16 inst, u16 idx);
  119. extern void prm_clear_context_loss_flags_old(u8 part, s16 inst, u16 idx);
  120. #endif
  121. #endif