prcm-common.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. #ifndef __ARCH_ASM_MACH_OMAP2_PRCM_COMMON_H
  2. #define __ARCH_ASM_MACH_OMAP2_PRCM_COMMON_H
  3. /*
  4. * OMAP2/3 PRCM base and module definitions
  5. *
  6. * Copyright (C) 2007-2009, 2011 Texas Instruments, Inc.
  7. * Copyright (C) 2007-2009 Nokia Corporation
  8. *
  9. * Written by Paul Walmsley
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. */
  15. /* Module offsets from both CM_BASE & PRM_BASE */
  16. /*
  17. * Offsets that are the same on 24xx and 34xx
  18. *
  19. * Technically, in terms of the TRM, OCP_MOD is 34xx only; PLL_MOD is
  20. * CCR_MOD on 3430; and GFX_MOD only exists < 3430ES2.
  21. */
  22. #define OCP_MOD 0x000
  23. #define MPU_MOD 0x100
  24. #define CORE_MOD 0x200
  25. #define GFX_MOD 0x300
  26. #define WKUP_MOD 0x400
  27. #define PLL_MOD 0x500
  28. /* Chip-specific module offsets */
  29. #define OMAP24XX_GR_MOD OCP_MOD
  30. #define OMAP24XX_DSP_MOD 0x800
  31. #define OMAP2430_MDM_MOD 0xc00
  32. /* IVA2 module is < base on 3430 */
  33. #define OMAP3430_IVA2_MOD -0x800
  34. #define OMAP3430ES2_SGX_MOD GFX_MOD
  35. #define OMAP3430_CCR_MOD PLL_MOD
  36. #define OMAP3430_DSS_MOD 0x600
  37. #define OMAP3430_CAM_MOD 0x700
  38. #define OMAP3430_PER_MOD 0x800
  39. #define OMAP3430_EMU_MOD 0x900
  40. #define OMAP3430_GR_MOD 0xa00
  41. #define OMAP3430_NEON_MOD 0xb00
  42. #define OMAP3430ES2_USBHOST_MOD 0xc00
  43. /*
  44. * TI81XX PRM module offsets
  45. */
  46. #define TI814X_PRM_DSP_MOD 0x0a00
  47. #define TI814X_PRM_HDVICP_MOD 0x0c00
  48. #define TI814X_PRM_ISP_MOD 0x0d00
  49. #define TI814X_PRM_HDVPSS_MOD 0x0e00
  50. #define TI814X_PRM_GFX_MOD 0x0f00
  51. #define TI81XX_PRM_DEVICE_MOD 0x0000
  52. #define TI816X_PRM_ACTIVE_MOD 0x0a00
  53. #define TI81XX_PRM_DEFAULT_MOD 0x0b00
  54. #define TI816X_PRM_IVAHD0_MOD 0x0c00
  55. #define TI816X_PRM_IVAHD1_MOD 0x0d00
  56. #define TI816X_PRM_IVAHD2_MOD 0x0e00
  57. #define TI816X_PRM_SGX_MOD 0x0f00
  58. #define TI81XX_PRM_ALWON_MOD 0x1800
  59. /* 24XX register bits shared between CM & PRM registers */
  60. /* CM_FCLKEN1_CORE, CM_ICLKEN1_CORE, PM_WKEN1_CORE shared bits */
  61. #define OMAP2420_EN_MMC_SHIFT 26
  62. #define OMAP2420_EN_MMC_MASK (1 << 26)
  63. #define OMAP24XX_EN_UART2_SHIFT 22
  64. #define OMAP24XX_EN_UART2_MASK (1 << 22)
  65. #define OMAP24XX_EN_UART1_SHIFT 21
  66. #define OMAP24XX_EN_UART1_MASK (1 << 21)
  67. #define OMAP24XX_EN_MCSPI2_SHIFT 18
  68. #define OMAP24XX_EN_MCSPI2_MASK (1 << 18)
  69. #define OMAP24XX_EN_MCSPI1_SHIFT 17
  70. #define OMAP24XX_EN_MCSPI1_MASK (1 << 17)
  71. #define OMAP24XX_EN_MCBSP2_SHIFT 16
  72. #define OMAP24XX_EN_MCBSP2_MASK (1 << 16)
  73. #define OMAP24XX_EN_MCBSP1_SHIFT 15
  74. #define OMAP24XX_EN_MCBSP1_MASK (1 << 15)
  75. #define OMAP24XX_EN_GPT12_SHIFT 14
  76. #define OMAP24XX_EN_GPT12_MASK (1 << 14)
  77. #define OMAP24XX_EN_GPT11_SHIFT 13
  78. #define OMAP24XX_EN_GPT11_MASK (1 << 13)
  79. #define OMAP24XX_EN_GPT10_SHIFT 12
  80. #define OMAP24XX_EN_GPT10_MASK (1 << 12)
  81. #define OMAP24XX_EN_GPT9_SHIFT 11
  82. #define OMAP24XX_EN_GPT9_MASK (1 << 11)
  83. #define OMAP24XX_EN_GPT8_SHIFT 10
  84. #define OMAP24XX_EN_GPT8_MASK (1 << 10)
  85. #define OMAP24XX_EN_GPT7_SHIFT 9
  86. #define OMAP24XX_EN_GPT7_MASK (1 << 9)
  87. #define OMAP24XX_EN_GPT6_SHIFT 8
  88. #define OMAP24XX_EN_GPT6_MASK (1 << 8)
  89. #define OMAP24XX_EN_GPT5_SHIFT 7
  90. #define OMAP24XX_EN_GPT5_MASK (1 << 7)
  91. #define OMAP24XX_EN_GPT4_SHIFT 6
  92. #define OMAP24XX_EN_GPT4_MASK (1 << 6)
  93. #define OMAP24XX_EN_GPT3_SHIFT 5
  94. #define OMAP24XX_EN_GPT3_MASK (1 << 5)
  95. #define OMAP24XX_EN_GPT2_SHIFT 4
  96. #define OMAP24XX_EN_GPT2_MASK (1 << 4)
  97. #define OMAP2420_EN_VLYNQ_SHIFT 3
  98. #define OMAP2420_EN_VLYNQ_MASK (1 << 3)
  99. /* CM_FCLKEN2_CORE, CM_ICLKEN2_CORE, PM_WKEN2_CORE shared bits */
  100. #define OMAP2430_EN_GPIO5_SHIFT 10
  101. #define OMAP2430_EN_GPIO5_MASK (1 << 10)
  102. #define OMAP2430_EN_MCSPI3_SHIFT 9
  103. #define OMAP2430_EN_MCSPI3_MASK (1 << 9)
  104. #define OMAP2430_EN_MMCHS2_SHIFT 8
  105. #define OMAP2430_EN_MMCHS2_MASK (1 << 8)
  106. #define OMAP2430_EN_MMCHS1_SHIFT 7
  107. #define OMAP2430_EN_MMCHS1_MASK (1 << 7)
  108. #define OMAP24XX_EN_UART3_SHIFT 2
  109. #define OMAP24XX_EN_UART3_MASK (1 << 2)
  110. #define OMAP24XX_EN_USB_SHIFT 0
  111. #define OMAP24XX_EN_USB_MASK (1 << 0)
  112. /* CM_ICLKEN2_CORE, PM_WKEN2_CORE shared bits */
  113. #define OMAP2430_EN_MDM_INTC_SHIFT 11
  114. #define OMAP2430_EN_MDM_INTC_MASK (1 << 11)
  115. #define OMAP2430_EN_USBHS_SHIFT 6
  116. #define OMAP2430_EN_USBHS_MASK (1 << 6)
  117. #define OMAP24XX_EN_GPMC_SHIFT 1
  118. #define OMAP24XX_EN_GPMC_MASK (1 << 1)
  119. /* CM_IDLEST1_CORE, PM_WKST1_CORE shared bits */
  120. #define OMAP2420_ST_MMC_SHIFT 26
  121. #define OMAP2420_ST_MMC_MASK (1 << 26)
  122. #define OMAP24XX_ST_UART2_SHIFT 22
  123. #define OMAP24XX_ST_UART2_MASK (1 << 22)
  124. #define OMAP24XX_ST_UART1_SHIFT 21
  125. #define OMAP24XX_ST_UART1_MASK (1 << 21)
  126. #define OMAP24XX_ST_MCSPI2_SHIFT 18
  127. #define OMAP24XX_ST_MCSPI2_MASK (1 << 18)
  128. #define OMAP24XX_ST_MCSPI1_SHIFT 17
  129. #define OMAP24XX_ST_MCSPI1_MASK (1 << 17)
  130. #define OMAP24XX_ST_MCBSP2_SHIFT 16
  131. #define OMAP24XX_ST_MCBSP2_MASK (1 << 16)
  132. #define OMAP24XX_ST_MCBSP1_SHIFT 15
  133. #define OMAP24XX_ST_MCBSP1_MASK (1 << 15)
  134. #define OMAP24XX_ST_GPT12_SHIFT 14
  135. #define OMAP24XX_ST_GPT12_MASK (1 << 14)
  136. #define OMAP24XX_ST_GPT11_SHIFT 13
  137. #define OMAP24XX_ST_GPT11_MASK (1 << 13)
  138. #define OMAP24XX_ST_GPT10_SHIFT 12
  139. #define OMAP24XX_ST_GPT10_MASK (1 << 12)
  140. #define OMAP24XX_ST_GPT9_SHIFT 11
  141. #define OMAP24XX_ST_GPT9_MASK (1 << 11)
  142. #define OMAP24XX_ST_GPT8_SHIFT 10
  143. #define OMAP24XX_ST_GPT8_MASK (1 << 10)
  144. #define OMAP24XX_ST_GPT7_SHIFT 9
  145. #define OMAP24XX_ST_GPT7_MASK (1 << 9)
  146. #define OMAP24XX_ST_GPT6_SHIFT 8
  147. #define OMAP24XX_ST_GPT6_MASK (1 << 8)
  148. #define OMAP24XX_ST_GPT5_SHIFT 7
  149. #define OMAP24XX_ST_GPT5_MASK (1 << 7)
  150. #define OMAP24XX_ST_GPT4_SHIFT 6
  151. #define OMAP24XX_ST_GPT4_MASK (1 << 6)
  152. #define OMAP24XX_ST_GPT3_SHIFT 5
  153. #define OMAP24XX_ST_GPT3_MASK (1 << 5)
  154. #define OMAP24XX_ST_GPT2_SHIFT 4
  155. #define OMAP24XX_ST_GPT2_MASK (1 << 4)
  156. #define OMAP2420_ST_VLYNQ_SHIFT 3
  157. #define OMAP2420_ST_VLYNQ_MASK (1 << 3)
  158. /* CM_IDLEST2_CORE, PM_WKST2_CORE shared bits */
  159. #define OMAP2430_ST_MDM_INTC_SHIFT 11
  160. #define OMAP2430_ST_MDM_INTC_MASK (1 << 11)
  161. #define OMAP2430_ST_GPIO5_SHIFT 10
  162. #define OMAP2430_ST_GPIO5_MASK (1 << 10)
  163. #define OMAP2430_ST_MCSPI3_SHIFT 9
  164. #define OMAP2430_ST_MCSPI3_MASK (1 << 9)
  165. #define OMAP2430_ST_MMCHS2_SHIFT 8
  166. #define OMAP2430_ST_MMCHS2_MASK (1 << 8)
  167. #define OMAP2430_ST_MMCHS1_SHIFT 7
  168. #define OMAP2430_ST_MMCHS1_MASK (1 << 7)
  169. #define OMAP2430_ST_USBHS_SHIFT 6
  170. #define OMAP2430_ST_USBHS_MASK (1 << 6)
  171. #define OMAP24XX_ST_UART3_SHIFT 2
  172. #define OMAP24XX_ST_UART3_MASK (1 << 2)
  173. #define OMAP24XX_ST_USB_SHIFT 0
  174. #define OMAP24XX_ST_USB_MASK (1 << 0)
  175. /* CM_FCLKEN_WKUP, CM_ICLKEN_WKUP, PM_WKEN_WKUP shared bits */
  176. #define OMAP24XX_EN_GPIOS_SHIFT 2
  177. #define OMAP24XX_EN_GPIOS_MASK (1 << 2)
  178. #define OMAP24XX_EN_GPT1_SHIFT 0
  179. #define OMAP24XX_EN_GPT1_MASK (1 << 0)
  180. /* PM_WKST_WKUP, CM_IDLEST_WKUP shared bits */
  181. #define OMAP24XX_ST_GPIOS_SHIFT 2
  182. #define OMAP24XX_ST_GPIOS_MASK (1 << 2)
  183. #define OMAP24XX_ST_32KSYNC_SHIFT 1
  184. #define OMAP24XX_ST_32KSYNC_MASK (1 << 1)
  185. #define OMAP24XX_ST_GPT1_SHIFT 0
  186. #define OMAP24XX_ST_GPT1_MASK (1 << 0)
  187. /* CM_IDLEST_MDM and PM_WKST_MDM shared bits */
  188. #define OMAP2430_ST_MDM_SHIFT 0
  189. #define OMAP2430_ST_MDM_MASK (1 << 0)
  190. /* 3430 register bits shared between CM & PRM registers */
  191. /* CM_REVISION, PRM_REVISION shared bits */
  192. #define OMAP3430_REV_SHIFT 0
  193. #define OMAP3430_REV_MASK (0xff << 0)
  194. /* CM_SYSCONFIG, PRM_SYSCONFIG shared bits */
  195. #define OMAP3430_AUTOIDLE_MASK (1 << 0)
  196. /* CM_FCLKEN1_CORE, CM_ICLKEN1_CORE, PM_WKEN1_CORE shared bits */
  197. #define OMAP3430_EN_MMC3_MASK (1 << 30)
  198. #define OMAP3430_EN_MMC3_SHIFT 30
  199. #define OMAP3430_EN_MMC2_MASK (1 << 25)
  200. #define OMAP3430_EN_MMC2_SHIFT 25
  201. #define OMAP3430_EN_MMC1_MASK (1 << 24)
  202. #define OMAP3430_EN_MMC1_SHIFT 24
  203. #define AM35XX_EN_UART4_MASK (1 << 23)
  204. #define AM35XX_EN_UART4_SHIFT 23
  205. #define OMAP3430_EN_MCSPI4_MASK (1 << 21)
  206. #define OMAP3430_EN_MCSPI4_SHIFT 21
  207. #define OMAP3430_EN_MCSPI3_MASK (1 << 20)
  208. #define OMAP3430_EN_MCSPI3_SHIFT 20
  209. #define OMAP3430_EN_MCSPI2_MASK (1 << 19)
  210. #define OMAP3430_EN_MCSPI2_SHIFT 19
  211. #define OMAP3430_EN_MCSPI1_MASK (1 << 18)
  212. #define OMAP3430_EN_MCSPI1_SHIFT 18
  213. #define OMAP3430_EN_I2C3_MASK (1 << 17)
  214. #define OMAP3430_EN_I2C3_SHIFT 17
  215. #define OMAP3430_EN_I2C2_MASK (1 << 16)
  216. #define OMAP3430_EN_I2C2_SHIFT 16
  217. #define OMAP3430_EN_I2C1_MASK (1 << 15)
  218. #define OMAP3430_EN_I2C1_SHIFT 15
  219. #define OMAP3430_EN_UART2_MASK (1 << 14)
  220. #define OMAP3430_EN_UART2_SHIFT 14
  221. #define OMAP3430_EN_UART1_MASK (1 << 13)
  222. #define OMAP3430_EN_UART1_SHIFT 13
  223. #define OMAP3430_EN_GPT11_MASK (1 << 12)
  224. #define OMAP3430_EN_GPT11_SHIFT 12
  225. #define OMAP3430_EN_GPT10_MASK (1 << 11)
  226. #define OMAP3430_EN_GPT10_SHIFT 11
  227. #define OMAP3430_EN_MCBSP5_MASK (1 << 10)
  228. #define OMAP3430_EN_MCBSP5_SHIFT 10
  229. #define OMAP3430_EN_MCBSP1_MASK (1 << 9)
  230. #define OMAP3430_EN_MCBSP1_SHIFT 9
  231. #define OMAP3430_EN_FSHOSTUSB_MASK (1 << 5)
  232. #define OMAP3430_EN_FSHOSTUSB_SHIFT 5
  233. #define OMAP3430_EN_D2D_MASK (1 << 3)
  234. #define OMAP3430_EN_D2D_SHIFT 3
  235. /* CM_ICLKEN1_CORE, PM_WKEN1_CORE shared bits */
  236. #define OMAP3430_EN_HSOTGUSB_MASK (1 << 4)
  237. #define OMAP3430_EN_HSOTGUSB_SHIFT 4
  238. /* PM_WKST1_CORE, CM_IDLEST1_CORE shared bits */
  239. #define OMAP3430_ST_MMC3_SHIFT 30
  240. #define OMAP3430_ST_MMC3_MASK (1 << 30)
  241. #define OMAP3430_ST_MMC2_SHIFT 25
  242. #define OMAP3430_ST_MMC2_MASK (1 << 25)
  243. #define OMAP3430_ST_MMC1_SHIFT 24
  244. #define OMAP3430_ST_MMC1_MASK (1 << 24)
  245. #define OMAP3430_ST_MCSPI4_SHIFT 21
  246. #define OMAP3430_ST_MCSPI4_MASK (1 << 21)
  247. #define OMAP3430_ST_MCSPI3_SHIFT 20
  248. #define OMAP3430_ST_MCSPI3_MASK (1 << 20)
  249. #define OMAP3430_ST_MCSPI2_SHIFT 19
  250. #define OMAP3430_ST_MCSPI2_MASK (1 << 19)
  251. #define OMAP3430_ST_MCSPI1_SHIFT 18
  252. #define OMAP3430_ST_MCSPI1_MASK (1 << 18)
  253. #define OMAP3430_ST_I2C3_SHIFT 17
  254. #define OMAP3430_ST_I2C3_MASK (1 << 17)
  255. #define OMAP3430_ST_I2C2_SHIFT 16
  256. #define OMAP3430_ST_I2C2_MASK (1 << 16)
  257. #define OMAP3430_ST_I2C1_SHIFT 15
  258. #define OMAP3430_ST_I2C1_MASK (1 << 15)
  259. #define OMAP3430_ST_UART2_SHIFT 14
  260. #define OMAP3430_ST_UART2_MASK (1 << 14)
  261. #define OMAP3430_ST_UART1_SHIFT 13
  262. #define OMAP3430_ST_UART1_MASK (1 << 13)
  263. #define OMAP3430_ST_GPT11_SHIFT 12
  264. #define OMAP3430_ST_GPT11_MASK (1 << 12)
  265. #define OMAP3430_ST_GPT10_SHIFT 11
  266. #define OMAP3430_ST_GPT10_MASK (1 << 11)
  267. #define OMAP3430_ST_MCBSP5_SHIFT 10
  268. #define OMAP3430_ST_MCBSP5_MASK (1 << 10)
  269. #define OMAP3430_ST_MCBSP1_SHIFT 9
  270. #define OMAP3430_ST_MCBSP1_MASK (1 << 9)
  271. #define OMAP3430ES1_ST_FSHOSTUSB_SHIFT 5
  272. #define OMAP3430ES1_ST_FSHOSTUSB_MASK (1 << 5)
  273. #define OMAP3430ES1_ST_HSOTGUSB_SHIFT 4
  274. #define OMAP3430ES1_ST_HSOTGUSB_MASK (1 << 4)
  275. #define OMAP3430ES2_ST_HSOTGUSB_IDLE_SHIFT 5
  276. #define OMAP3430ES2_ST_HSOTGUSB_IDLE_MASK (1 << 5)
  277. #define OMAP3430ES2_ST_HSOTGUSB_STDBY_SHIFT 4
  278. #define OMAP3430ES2_ST_HSOTGUSB_STDBY_MASK (1 << 4)
  279. #define OMAP3430_ST_D2D_SHIFT 3
  280. #define OMAP3430_ST_D2D_MASK (1 << 3)
  281. /* CM_FCLKEN_WKUP, CM_ICLKEN_WKUP, PM_WKEN_WKUP shared bits */
  282. #define OMAP3430_EN_GPIO1_MASK (1 << 3)
  283. #define OMAP3430_EN_GPIO1_SHIFT 3
  284. #define OMAP3430_EN_GPT12_MASK (1 << 1)
  285. #define OMAP3430_EN_GPT12_SHIFT 1
  286. #define OMAP3430_EN_GPT1_MASK (1 << 0)
  287. #define OMAP3430_EN_GPT1_SHIFT 0
  288. /* CM_FCLKEN_WKUP, PM_WKEN_WKUP shared bits */
  289. #define OMAP3430_EN_SR2_MASK (1 << 7)
  290. #define OMAP3430_EN_SR2_SHIFT 7
  291. #define OMAP3430_EN_SR1_MASK (1 << 6)
  292. #define OMAP3430_EN_SR1_SHIFT 6
  293. /* CM_ICLKEN_WKUP, PM_WKEN_WKUP shared bits */
  294. #define OMAP3430_EN_GPT12_MASK (1 << 1)
  295. #define OMAP3430_EN_GPT12_SHIFT 1
  296. /* CM_IDLEST_WKUP, PM_WKST_WKUP shared bits */
  297. #define OMAP3430_ST_SR2_SHIFT 7
  298. #define OMAP3430_ST_SR2_MASK (1 << 7)
  299. #define OMAP3430_ST_SR1_SHIFT 6
  300. #define OMAP3430_ST_SR1_MASK (1 << 6)
  301. #define OMAP3430_ST_GPIO1_SHIFT 3
  302. #define OMAP3430_ST_GPIO1_MASK (1 << 3)
  303. #define OMAP3430_ST_32KSYNC_SHIFT 2
  304. #define OMAP3430_ST_32KSYNC_MASK (1 << 2)
  305. #define OMAP3430_ST_GPT12_SHIFT 1
  306. #define OMAP3430_ST_GPT12_MASK (1 << 1)
  307. #define OMAP3430_ST_GPT1_SHIFT 0
  308. #define OMAP3430_ST_GPT1_MASK (1 << 0)
  309. /*
  310. * CM_SLEEPDEP_GFX, CM_SLEEPDEP_DSS, CM_SLEEPDEP_CAM,
  311. * CM_SLEEPDEP_PER, PM_WKDEP_IVA2, PM_WKDEP_GFX,
  312. * PM_WKDEP_DSS, PM_WKDEP_CAM, PM_WKDEP_PER, PM_WKDEP_NEON shared bits
  313. */
  314. #define OMAP3430_EN_MPU_MASK (1 << 1)
  315. #define OMAP3430_EN_MPU_SHIFT 1
  316. /* CM_FCLKEN_PER, CM_ICLKEN_PER, PM_WKEN_PER shared bits */
  317. #define OMAP3630_EN_UART4_MASK (1 << 18)
  318. #define OMAP3630_EN_UART4_SHIFT 18
  319. #define OMAP3430_EN_GPIO6_MASK (1 << 17)
  320. #define OMAP3430_EN_GPIO6_SHIFT 17
  321. #define OMAP3430_EN_GPIO5_MASK (1 << 16)
  322. #define OMAP3430_EN_GPIO5_SHIFT 16
  323. #define OMAP3430_EN_GPIO4_MASK (1 << 15)
  324. #define OMAP3430_EN_GPIO4_SHIFT 15
  325. #define OMAP3430_EN_GPIO3_MASK (1 << 14)
  326. #define OMAP3430_EN_GPIO3_SHIFT 14
  327. #define OMAP3430_EN_GPIO2_MASK (1 << 13)
  328. #define OMAP3430_EN_GPIO2_SHIFT 13
  329. #define OMAP3430_EN_UART3_MASK (1 << 11)
  330. #define OMAP3430_EN_UART3_SHIFT 11
  331. #define OMAP3430_EN_GPT9_MASK (1 << 10)
  332. #define OMAP3430_EN_GPT9_SHIFT 10
  333. #define OMAP3430_EN_GPT8_MASK (1 << 9)
  334. #define OMAP3430_EN_GPT8_SHIFT 9
  335. #define OMAP3430_EN_GPT7_MASK (1 << 8)
  336. #define OMAP3430_EN_GPT7_SHIFT 8
  337. #define OMAP3430_EN_GPT6_MASK (1 << 7)
  338. #define OMAP3430_EN_GPT6_SHIFT 7
  339. #define OMAP3430_EN_GPT5_MASK (1 << 6)
  340. #define OMAP3430_EN_GPT5_SHIFT 6
  341. #define OMAP3430_EN_GPT4_MASK (1 << 5)
  342. #define OMAP3430_EN_GPT4_SHIFT 5
  343. #define OMAP3430_EN_GPT3_MASK (1 << 4)
  344. #define OMAP3430_EN_GPT3_SHIFT 4
  345. #define OMAP3430_EN_GPT2_MASK (1 << 3)
  346. #define OMAP3430_EN_GPT2_SHIFT 3
  347. /* CM_FCLKEN_PER, CM_ICLKEN_PER, PM_WKEN_PER, PM_WKST_PER shared bits */
  348. /* XXX Possible TI documentation bug: should the PM_WKST_PER EN_* bits
  349. * be ST_* bits instead? */
  350. #define OMAP3430_EN_MCBSP4_MASK (1 << 2)
  351. #define OMAP3430_EN_MCBSP4_SHIFT 2
  352. #define OMAP3430_EN_MCBSP3_MASK (1 << 1)
  353. #define OMAP3430_EN_MCBSP3_SHIFT 1
  354. #define OMAP3430_EN_MCBSP2_MASK (1 << 0)
  355. #define OMAP3430_EN_MCBSP2_SHIFT 0
  356. /* CM_IDLEST_PER, PM_WKST_PER shared bits */
  357. #define OMAP3630_ST_UART4_SHIFT 18
  358. #define OMAP3630_ST_UART4_MASK (1 << 18)
  359. #define OMAP3430_ST_GPIO6_SHIFT 17
  360. #define OMAP3430_ST_GPIO6_MASK (1 << 17)
  361. #define OMAP3430_ST_GPIO5_SHIFT 16
  362. #define OMAP3430_ST_GPIO5_MASK (1 << 16)
  363. #define OMAP3430_ST_GPIO4_SHIFT 15
  364. #define OMAP3430_ST_GPIO4_MASK (1 << 15)
  365. #define OMAP3430_ST_GPIO3_SHIFT 14
  366. #define OMAP3430_ST_GPIO3_MASK (1 << 14)
  367. #define OMAP3430_ST_GPIO2_SHIFT 13
  368. #define OMAP3430_ST_GPIO2_MASK (1 << 13)
  369. #define OMAP3430_ST_UART3_SHIFT 11
  370. #define OMAP3430_ST_UART3_MASK (1 << 11)
  371. #define OMAP3430_ST_GPT9_SHIFT 10
  372. #define OMAP3430_ST_GPT9_MASK (1 << 10)
  373. #define OMAP3430_ST_GPT8_SHIFT 9
  374. #define OMAP3430_ST_GPT8_MASK (1 << 9)
  375. #define OMAP3430_ST_GPT7_SHIFT 8
  376. #define OMAP3430_ST_GPT7_MASK (1 << 8)
  377. #define OMAP3430_ST_GPT6_SHIFT 7
  378. #define OMAP3430_ST_GPT6_MASK (1 << 7)
  379. #define OMAP3430_ST_GPT5_SHIFT 6
  380. #define OMAP3430_ST_GPT5_MASK (1 << 6)
  381. #define OMAP3430_ST_GPT4_SHIFT 5
  382. #define OMAP3430_ST_GPT4_MASK (1 << 5)
  383. #define OMAP3430_ST_GPT3_SHIFT 4
  384. #define OMAP3430_ST_GPT3_MASK (1 << 4)
  385. #define OMAP3430_ST_GPT2_SHIFT 3
  386. #define OMAP3430_ST_GPT2_MASK (1 << 3)
  387. /* CM_SLEEPDEP_PER, PM_WKDEP_IVA2, PM_WKDEP_MPU, PM_WKDEP_PER shared bits */
  388. #define OMAP3430_EN_CORE_SHIFT 0
  389. #define OMAP3430_EN_CORE_MASK (1 << 0)
  390. /*
  391. * Maximum time(us) it takes to output the signal WUCLKOUT of the last
  392. * pad of the I/O ring after asserting WUCLKIN high. Tero measured
  393. * the actual time at 7 to 8 microseconds on OMAP3 and 2 to 4
  394. * microseconds on OMAP4, so this timeout may be too high.
  395. */
  396. #define MAX_IOPAD_LATCH_TIME 100
  397. # ifndef __ASSEMBLER__
  398. #include <linux/delay.h>
  399. /**
  400. * omap_test_timeout - busy-loop, testing a condition
  401. * @cond: condition to test until it evaluates to true
  402. * @timeout: maximum number of microseconds in the timeout
  403. * @index: loop index (integer)
  404. *
  405. * Loop waiting for @cond to become true or until at least @timeout
  406. * microseconds have passed. To use, define some integer @index in the
  407. * calling code. After running, if @index == @timeout, then the loop has
  408. * timed out.
  409. */
  410. #define omap_test_timeout(cond, timeout, index) \
  411. ({ \
  412. for (index = 0; index < timeout; index++) { \
  413. if (cond) \
  414. break; \
  415. udelay(1); \
  416. } \
  417. })
  418. /**
  419. * struct omap_prcm_irq - describes a PRCM interrupt bit
  420. * @name: a short name describing the interrupt type, e.g. "wkup" or "io"
  421. * @offset: the bit shift of the interrupt inside the IRQ{ENABLE,STATUS} regs
  422. * @priority: should this interrupt be handled before @priority=false IRQs?
  423. *
  424. * Describes interrupt bits inside the PRM_IRQ{ENABLE,STATUS}_MPU* registers.
  425. * On systems with multiple PRM MPU IRQ registers, the bitfields read from
  426. * the registers are concatenated, so @offset could be > 31 on these systems -
  427. * see omap_prm_irq_handler() for more details. I/O ring interrupts should
  428. * have @priority set to true.
  429. */
  430. struct omap_prcm_irq {
  431. const char *name;
  432. unsigned int offset;
  433. bool priority;
  434. };
  435. /**
  436. * struct omap_prcm_irq_setup - PRCM interrupt controller details
  437. * @ack: PRM register offset for the first PRM_IRQSTATUS_MPU register
  438. * @mask: PRM register offset for the first PRM_IRQENABLE_MPU register
  439. * @pm_ctrl: PRM register offset for the PRM_IO_PMCTRL register
  440. * @nr_regs: number of PRM_IRQ{STATUS,ENABLE}_MPU* registers
  441. * @nr_irqs: number of entries in the @irqs array
  442. * @irqs: ptr to an array of PRCM interrupt bits (see @nr_irqs)
  443. * @irq: MPU IRQ asserted when a PRCM interrupt arrives
  444. * @read_pending_irqs: fn ptr to determine if any PRCM IRQs are pending
  445. * @ocp_barrier: fn ptr to force buffered PRM writes to complete
  446. * @save_and_clear_irqen: fn ptr to save and clear IRQENABLE regs
  447. * @restore_irqen: fn ptr to save and clear IRQENABLE regs
  448. * @reconfigure_io_chain: fn ptr to reconfigure IO chain
  449. * @saved_mask: IRQENABLE regs are saved here during suspend
  450. * @priority_mask: 1 bit per IRQ, set to 1 if omap_prcm_irq.priority = true
  451. * @base_irq: base dynamic IRQ number, returned from irq_alloc_descs() in init
  452. * @suspended: set to true after Linux suspend code has called our ->prepare()
  453. * @suspend_save_flag: set to true after IRQ masks have been saved and disabled
  454. *
  455. * @saved_mask, @priority_mask, @base_irq, @suspended, and
  456. * @suspend_save_flag are populated dynamically, and are not to be
  457. * specified in static initializers.
  458. */
  459. struct omap_prcm_irq_setup {
  460. u16 ack;
  461. u16 mask;
  462. u16 pm_ctrl;
  463. u8 nr_regs;
  464. u8 nr_irqs;
  465. const struct omap_prcm_irq *irqs;
  466. int irq;
  467. unsigned int (*xlate_irq)(unsigned int);
  468. void (*read_pending_irqs)(unsigned long *events);
  469. void (*ocp_barrier)(void);
  470. void (*save_and_clear_irqen)(u32 *saved_mask);
  471. void (*restore_irqen)(u32 *saved_mask);
  472. void (*reconfigure_io_chain)(void);
  473. u32 *saved_mask;
  474. u32 *priority_mask;
  475. int base_irq;
  476. bool suspended;
  477. bool suspend_save_flag;
  478. };
  479. /* OMAP_PRCM_IRQ: convenience macro for creating struct omap_prcm_irq records */
  480. #define OMAP_PRCM_IRQ(_name, _offset, _priority) { \
  481. .name = _name, \
  482. .offset = _offset, \
  483. .priority = _priority \
  484. }
  485. /**
  486. * struct omap_prcm_init_data - PRCM driver init data
  487. * @index: clock memory mapping index to be used
  488. * @mem: IO mem pointer for this module
  489. * @offset: module base address offset from the IO base
  490. * @flags: PRCM module init flags
  491. * @device_inst_offset: device instance offset within the module address space
  492. * @init: low level PRCM init function for this module
  493. * @np: device node for this PRCM module
  494. */
  495. struct omap_prcm_init_data {
  496. int index;
  497. void __iomem *mem;
  498. s16 offset;
  499. u16 flags;
  500. s32 device_inst_offset;
  501. int (*init)(const struct omap_prcm_init_data *data);
  502. struct device_node *np;
  503. };
  504. extern void omap_prcm_irq_cleanup(void);
  505. extern int omap_prcm_register_chain_handler(
  506. struct omap_prcm_irq_setup *irq_setup);
  507. extern int omap_prcm_event_to_irq(const char *event);
  508. extern void omap_prcm_irq_prepare(void);
  509. extern void omap_prcm_irq_complete(void);
  510. # endif
  511. #endif