prm2xxx_3xxx.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. /*
  2. * OMAP2xxx/3xxx-common Power/Reset Management (PRM) register definitions
  3. *
  4. * Copyright (C) 2007-2009, 2011-2012 Texas Instruments, Inc.
  5. * Copyright (C) 2008-2010 Nokia Corporation
  6. * Paul Walmsley
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. * The PRM hardware modules on the OMAP2/3 are quite similar to each
  13. * other. The PRM on OMAP4 has a new register layout, and is handled
  14. * in a separate file.
  15. */
  16. #ifndef __ARCH_ARM_MACH_OMAP2_PRM2XXX_3XXX_H
  17. #define __ARCH_ARM_MACH_OMAP2_PRM2XXX_3XXX_H
  18. #include "prcm-common.h"
  19. #include "prm.h"
  20. /*
  21. * Module specific PRM register offsets from PRM_BASE + domain offset
  22. *
  23. * Use prm_{read,write}_mod_reg() with these registers.
  24. *
  25. * With a few exceptions, these are the register names beginning with
  26. * {PM,RM}_* on both OMAP2/3 SoC families.. (The exceptions are the
  27. * IRQSTATUS and IRQENABLE bits.)
  28. */
  29. /* Register offsets appearing on both OMAP2 and OMAP3 */
  30. #define OMAP2_RM_RSTCTRL 0x0050
  31. #define OMAP2_RM_RSTTIME 0x0054
  32. #define OMAP2_RM_RSTST 0x0058
  33. #define OMAP2_PM_PWSTCTRL 0x00e0
  34. #define OMAP2_PM_PWSTST 0x00e4
  35. #define PM_WKEN 0x00a0
  36. #define PM_WKEN1 PM_WKEN
  37. #define PM_WKST 0x00b0
  38. #define PM_WKST1 PM_WKST
  39. #define PM_WKDEP 0x00c8
  40. #define PM_EVGENCTRL 0x00d4
  41. #define PM_EVGENONTIM 0x00d8
  42. #define PM_EVGENOFFTIM 0x00dc
  43. #ifndef __ASSEMBLER__
  44. #include <linux/io.h>
  45. #include "powerdomain.h"
  46. /* Power/reset management domain register get/set */
  47. static inline u32 omap2_prm_read_mod_reg(s16 module, u16 idx)
  48. {
  49. return readl_relaxed(prm_base + module + idx);
  50. }
  51. static inline void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx)
  52. {
  53. writel_relaxed(val, prm_base + module + idx);
  54. }
  55. /* Read-modify-write a register in a PRM module. Caller must lock */
  56. static inline u32 omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module,
  57. s16 idx)
  58. {
  59. u32 v;
  60. v = omap2_prm_read_mod_reg(module, idx);
  61. v &= ~mask;
  62. v |= bits;
  63. omap2_prm_write_mod_reg(v, module, idx);
  64. return v;
  65. }
  66. /* Read a PRM register, AND it, and shift the result down to bit 0 */
  67. static inline u32 omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)
  68. {
  69. u32 v;
  70. v = omap2_prm_read_mod_reg(domain, idx);
  71. v &= mask;
  72. v >>= __ffs(mask);
  73. return v;
  74. }
  75. static inline u32 omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
  76. {
  77. return omap2_prm_rmw_mod_reg_bits(bits, bits, module, idx);
  78. }
  79. static inline u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
  80. {
  81. return omap2_prm_rmw_mod_reg_bits(bits, 0x0, module, idx);
  82. }
  83. /* These omap2_ PRM functions apply to both OMAP2 and 3 */
  84. int omap2_prm_is_hardreset_asserted(u8 shift, u8 part, s16 prm_mod, u16 offset);
  85. int omap2_prm_assert_hardreset(u8 shift, u8 part, s16 prm_mod,
  86. u16 offset);
  87. int omap2_prm_deassert_hardreset(u8 rst_shift, u8 st_shift, u8 part,
  88. s16 prm_mod, u16 reset_offset,
  89. u16 st_offset);
  90. extern int omap2_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst);
  91. extern int omap2_pwrdm_read_next_pwrst(struct powerdomain *pwrdm);
  92. extern int omap2_pwrdm_read_pwrst(struct powerdomain *pwrdm);
  93. extern int omap2_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
  94. u8 pwrst);
  95. extern int omap2_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
  96. u8 pwrst);
  97. extern int omap2_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank);
  98. extern int omap2_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank);
  99. extern int omap2_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst);
  100. extern int omap2_pwrdm_wait_transition(struct powerdomain *pwrdm);
  101. extern int omap2_clkdm_add_wkdep(struct clockdomain *clkdm1,
  102. struct clockdomain *clkdm2);
  103. extern int omap2_clkdm_del_wkdep(struct clockdomain *clkdm1,
  104. struct clockdomain *clkdm2);
  105. extern int omap2_clkdm_read_wkdep(struct clockdomain *clkdm1,
  106. struct clockdomain *clkdm2);
  107. extern int omap2_clkdm_clear_all_wkdeps(struct clockdomain *clkdm);
  108. #endif /* __ASSEMBLER */
  109. /*
  110. * Bits common to specific registers
  111. *
  112. * The 3430 register and bit names are generally used,
  113. * since they tend to make more sense
  114. */
  115. /* PM_EVGENONTIM_MPU */
  116. /* Named PM_EVEGENONTIM_MPU on the 24XX */
  117. #define OMAP_ONTIMEVAL_SHIFT 0
  118. #define OMAP_ONTIMEVAL_MASK (0xffffffff << 0)
  119. /* PM_EVGENOFFTIM_MPU */
  120. /* Named PM_EVEGENOFFTIM_MPU on the 24XX */
  121. #define OMAP_OFFTIMEVAL_SHIFT 0
  122. #define OMAP_OFFTIMEVAL_MASK (0xffffffff << 0)
  123. /* PRM_CLKSETUP and PRCM_VOLTSETUP */
  124. /* Named PRCM_CLKSSETUP on the 24XX */
  125. #define OMAP_SETUP_TIME_SHIFT 0
  126. #define OMAP_SETUP_TIME_MASK (0xffff << 0)
  127. /* PRM_CLKSRC_CTRL */
  128. /* Named PRCM_CLKSRC_CTRL on the 24XX */
  129. #define OMAP_SYSCLKDIV_SHIFT 6
  130. #define OMAP_SYSCLKDIV_MASK (0x3 << 6)
  131. #define OMAP_SYSCLKDIV_WIDTH 2
  132. #define OMAP_AUTOEXTCLKMODE_SHIFT 3
  133. #define OMAP_AUTOEXTCLKMODE_MASK (0x3 << 3)
  134. #define OMAP_SYSCLKSEL_SHIFT 0
  135. #define OMAP_SYSCLKSEL_MASK (0x3 << 0)
  136. /* PM_EVGENCTRL_MPU */
  137. #define OMAP_OFFLOADMODE_SHIFT 3
  138. #define OMAP_OFFLOADMODE_MASK (0x3 << 3)
  139. #define OMAP_ONLOADMODE_SHIFT 1
  140. #define OMAP_ONLOADMODE_MASK (0x3 << 1)
  141. #define OMAP_ENABLE_MASK (1 << 0)
  142. /* PRM_RSTTIME */
  143. /* Named RM_RSTTIME_WKUP on the 24xx */
  144. #define OMAP_RSTTIME2_SHIFT 8
  145. #define OMAP_RSTTIME2_MASK (0x1f << 8)
  146. #define OMAP_RSTTIME1_SHIFT 0
  147. #define OMAP_RSTTIME1_MASK (0xff << 0)
  148. /* PRM_RSTCTRL */
  149. /* Named RM_RSTCTRL_WKUP on the 24xx */
  150. /* 2420 calls RST_DPLL3 'RST_DPLL' */
  151. #define OMAP_RST_DPLL3_MASK (1 << 2)
  152. #define OMAP_RST_GS_MASK (1 << 1)
  153. /*
  154. * Bits common to module-shared registers
  155. *
  156. * Not all registers of a particular type support all of these bits -
  157. * check TRM if you are unsure
  158. */
  159. /*
  160. * 24XX: RM_RSTST_MPU and RM_RSTST_DSP - on 24XX, 'COREDOMAINWKUP_RST' is
  161. * called 'COREWKUP_RST'
  162. *
  163. * 3430: RM_RSTST_IVA2, RM_RSTST_MPU, RM_RSTST_GFX, RM_RSTST_DSS,
  164. * RM_RSTST_CAM, RM_RSTST_PER, RM_RSTST_NEON
  165. */
  166. #define OMAP_COREDOMAINWKUP_RST_MASK (1 << 3)
  167. /*
  168. * 24XX: RM_RSTST_MPU, RM_RSTST_GFX, RM_RSTST_DSP
  169. *
  170. * 2430: RM_RSTST_MDM
  171. *
  172. * 3430: RM_RSTST_CORE, RM_RSTST_EMU
  173. */
  174. #define OMAP_DOMAINWKUP_RST_MASK (1 << 2)
  175. /*
  176. * 24XX: RM_RSTST_MPU, RM_RSTST_WKUP, RM_RSTST_DSP
  177. * On 24XX, 'GLOBALWARM_RST' is called 'GLOBALWMPU_RST'.
  178. *
  179. * 2430: RM_RSTST_MDM
  180. *
  181. * 3430: RM_RSTST_CORE, RM_RSTST_EMU
  182. */
  183. #define OMAP_GLOBALWARM_RST_SHIFT 1
  184. #define OMAP_GLOBALWARM_RST_MASK (1 << 1)
  185. #define OMAP_GLOBALCOLD_RST_SHIFT 0
  186. #define OMAP_GLOBALCOLD_RST_MASK (1 << 0)
  187. /*
  188. * 24XX: PM_WKDEP_GFX, PM_WKDEP_MPU, PM_WKDEP_CORE, PM_WKDEP_DSP
  189. * 2420 TRM sometimes uses "EN_WAKEUP" instead of "EN_WKUP"
  190. *
  191. * 2430: PM_WKDEP_MDM
  192. *
  193. * 3430: PM_WKDEP_IVA2, PM_WKDEP_GFX, PM_WKDEP_DSS, PM_WKDEP_CAM,
  194. * PM_WKDEP_PER
  195. */
  196. #define OMAP_EN_WKUP_SHIFT 4
  197. #define OMAP_EN_WKUP_MASK (1 << 4)
  198. /*
  199. * 24XX: PM_PWSTCTRL_MPU, PM_PWSTCTRL_CORE, PM_PWSTCTRL_GFX,
  200. * PM_PWSTCTRL_DSP
  201. *
  202. * 2430: PM_PWSTCTRL_MDM
  203. *
  204. * 3430: PM_PWSTCTRL_IVA2, PM_PWSTCTRL_CORE, PM_PWSTCTRL_GFX,
  205. * PM_PWSTCTRL_DSS, PM_PWSTCTRL_CAM, PM_PWSTCTRL_PER,
  206. * PM_PWSTCTRL_NEON
  207. */
  208. #define OMAP_LOGICRETSTATE_MASK (1 << 2)
  209. #endif