ab8500-sysctrl.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. /*
  2. * Copyright (C) ST-Ericsson SA 2010
  3. * Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com> for ST Ericsson.
  4. * License terms: GNU General Public License (GPL) version 2
  5. */
  6. #ifndef __AB8500_SYSCTRL_H
  7. #define __AB8500_SYSCTRL_H
  8. #include <linux/bitops.h>
  9. #ifdef CONFIG_AB8500_CORE
  10. int ab8500_sysctrl_read(u16 reg, u8 *value);
  11. int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value);
  12. #else
  13. static inline int ab8500_sysctrl_read(u16 reg, u8 *value)
  14. {
  15. return 0;
  16. }
  17. static inline int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value)
  18. {
  19. return 0;
  20. }
  21. #endif /* CONFIG_AB8500_CORE */
  22. static inline int ab8500_sysctrl_set(u16 reg, u8 bits)
  23. {
  24. return ab8500_sysctrl_write(reg, bits, bits);
  25. }
  26. static inline int ab8500_sysctrl_clear(u16 reg, u8 bits)
  27. {
  28. return ab8500_sysctrl_write(reg, bits, 0);
  29. }
  30. /* Configuration data for SysClkReq1RfClkBuf - SysClkReq8RfClkBuf */
  31. struct ab8500_sysctrl_platform_data {
  32. u8 initial_req_buf_config[8];
  33. u16 (*reboot_reason_code)(const char *cmd);
  34. };
  35. /* Registers */
  36. #define AB8500_TURNONSTATUS 0x100
  37. #define AB8500_RESETSTATUS 0x101
  38. #define AB8500_PONKEY1PRESSSTATUS 0x102
  39. #define AB8500_SYSCLKREQSTATUS 0x142
  40. #define AB8500_STW4500CTRL1 0x180
  41. #define AB8500_STW4500CTRL2 0x181
  42. #define AB8500_STW4500CTRL3 0x200
  43. #define AB8500_MAINWDOGCTRL 0x201
  44. #define AB8500_MAINWDOGTIMER 0x202
  45. #define AB8500_LOWBAT 0x203
  46. #define AB8500_BATTOK 0x204
  47. #define AB8500_SYSCLKTIMER 0x205
  48. #define AB8500_SMPSCLKCTRL 0x206
  49. #define AB8500_SMPSCLKSEL1 0x207
  50. #define AB8500_SMPSCLKSEL2 0x208
  51. #define AB8500_SMPSCLKSEL3 0x209
  52. #define AB8500_SYSULPCLKCONF 0x20A
  53. #define AB8500_SYSULPCLKCTRL1 0x20B
  54. #define AB8500_SYSCLKCTRL 0x20C
  55. #define AB8500_SYSCLKREQ1VALID 0x20D
  56. #define AB8500_SYSTEMCTRLSUP 0x20F
  57. #define AB8500_SYSCLKREQ1RFCLKBUF 0x210
  58. #define AB8500_SYSCLKREQ2RFCLKBUF 0x211
  59. #define AB8500_SYSCLKREQ3RFCLKBUF 0x212
  60. #define AB8500_SYSCLKREQ4RFCLKBUF 0x213
  61. #define AB8500_SYSCLKREQ5RFCLKBUF 0x214
  62. #define AB8500_SYSCLKREQ6RFCLKBUF 0x215
  63. #define AB8500_SYSCLKREQ7RFCLKBUF 0x216
  64. #define AB8500_SYSCLKREQ8RFCLKBUF 0x217
  65. #define AB8500_DITHERCLKCTRL 0x220
  66. #define AB8500_SWATCTRL 0x230
  67. #define AB8500_HIQCLKCTRL 0x232
  68. #define AB8500_VSIMSYSCLKCTRL 0x233
  69. #define AB9540_SYSCLK12BUFCTRL 0x234
  70. #define AB9540_SYSCLK12CONFCTRL 0x235
  71. #define AB9540_SYSCLK12BUFCTRL2 0x236
  72. #define AB9540_SYSCLK12BUF1VALID 0x237
  73. #define AB9540_SYSCLK12BUF2VALID 0x238
  74. #define AB9540_SYSCLK12BUF3VALID 0x239
  75. #define AB9540_SYSCLK12BUF4VALID 0x23A
  76. /* Bits */
  77. #define AB8500_TURNONSTATUS_PORNVBAT BIT(0)
  78. #define AB8500_TURNONSTATUS_PONKEY1DBF BIT(1)
  79. #define AB8500_TURNONSTATUS_PONKEY2DBF BIT(2)
  80. #define AB8500_TURNONSTATUS_RTCALARM BIT(3)
  81. #define AB8500_TURNONSTATUS_MAINCHDET BIT(4)
  82. #define AB8500_TURNONSTATUS_VBUSDET BIT(5)
  83. #define AB8500_TURNONSTATUS_USBIDDETECT BIT(6)
  84. #define AB8500_RESETSTATUS_RESETN4500NSTATUS BIT(0)
  85. #define AB8500_RESETSTATUS_SWRESETN4500NSTATUS BIT(2)
  86. #define AB8500_PONKEY1PRESSSTATUS_PONKEY1PRESSTIME_MASK 0x7F
  87. #define AB8500_PONKEY1PRESSSTATUS_PONKEY1PRESSTIME_SHIFT 0
  88. #define AB8500_SYSCLKREQSTATUS_SYSCLKREQ1STATUS BIT(0)
  89. #define AB8500_SYSCLKREQSTATUS_SYSCLKREQ2STATUS BIT(1)
  90. #define AB8500_SYSCLKREQSTATUS_SYSCLKREQ3STATUS BIT(2)
  91. #define AB8500_SYSCLKREQSTATUS_SYSCLKREQ4STATUS BIT(3)
  92. #define AB8500_SYSCLKREQSTATUS_SYSCLKREQ5STATUS BIT(4)
  93. #define AB8500_SYSCLKREQSTATUS_SYSCLKREQ6STATUS BIT(5)
  94. #define AB8500_SYSCLKREQSTATUS_SYSCLKREQ7STATUS BIT(6)
  95. #define AB8500_SYSCLKREQSTATUS_SYSCLKREQ8STATUS BIT(7)
  96. #define AB8500_STW4500CTRL1_SWOFF BIT(0)
  97. #define AB8500_STW4500CTRL1_SWRESET4500N BIT(1)
  98. #define AB8500_STW4500CTRL1_THDB8500SWOFF BIT(2)
  99. #define AB8500_STW4500CTRL2_RESETNVAUX1VALID BIT(0)
  100. #define AB8500_STW4500CTRL2_RESETNVAUX2VALID BIT(1)
  101. #define AB8500_STW4500CTRL2_RESETNVAUX3VALID BIT(2)
  102. #define AB8500_STW4500CTRL2_RESETNVMODVALID BIT(3)
  103. #define AB8500_STW4500CTRL2_RESETNVEXTSUPPLY1VALID BIT(4)
  104. #define AB8500_STW4500CTRL2_RESETNVEXTSUPPLY2VALID BIT(5)
  105. #define AB8500_STW4500CTRL2_RESETNVEXTSUPPLY3VALID BIT(6)
  106. #define AB8500_STW4500CTRL2_RESETNVSMPS1VALID BIT(7)
  107. #define AB8500_STW4500CTRL3_CLK32KOUT2DIS BIT(0)
  108. #define AB8500_STW4500CTRL3_RESETAUDN BIT(1)
  109. #define AB8500_STW4500CTRL3_RESETDENCN BIT(2)
  110. #define AB8500_STW4500CTRL3_THSDENA BIT(3)
  111. #define AB8500_MAINWDOGCTRL_MAINWDOGENA BIT(0)
  112. #define AB8500_MAINWDOGCTRL_MAINWDOGKICK BIT(1)
  113. #define AB8500_MAINWDOGCTRL_WDEXPTURNONVALID BIT(4)
  114. #define AB8500_MAINWDOGTIMER_MAINWDOGTIMER_MASK 0x7F
  115. #define AB8500_MAINWDOGTIMER_MAINWDOGTIMER_SHIFT 0
  116. #define AB8500_LOWBAT_LOWBATENA BIT(0)
  117. #define AB8500_LOWBAT_LOWBAT_MASK 0x7E
  118. #define AB8500_LOWBAT_LOWBAT_SHIFT 1
  119. #define AB8500_BATTOK_BATTOKSEL0THF_MASK 0x0F
  120. #define AB8500_BATTOK_BATTOKSEL0THF_SHIFT 0
  121. #define AB8500_BATTOK_BATTOKSEL1THF_MASK 0xF0
  122. #define AB8500_BATTOK_BATTOKSEL1THF_SHIFT 4
  123. #define AB8500_SYSCLKTIMER_SYSCLKTIMER_MASK 0x0F
  124. #define AB8500_SYSCLKTIMER_SYSCLKTIMER_SHIFT 0
  125. #define AB8500_SYSCLKTIMER_SYSCLKTIMERADJ_MASK 0xF0
  126. #define AB8500_SYSCLKTIMER_SYSCLKTIMERADJ_SHIFT 4
  127. #define AB8500_SMPSCLKCTRL_SMPSCLKINTSEL_MASK 0x03
  128. #define AB8500_SMPSCLKCTRL_SMPSCLKINTSEL_SHIFT 0
  129. #define AB8500_SMPSCLKCTRL_3M2CLKINTENA BIT(2)
  130. #define AB8500_SMPSCLKSEL1_VARMCLKSEL_MASK 0x07
  131. #define AB8500_SMPSCLKSEL1_VARMCLKSEL_SHIFT 0
  132. #define AB8500_SMPSCLKSEL1_VAPECLKSEL_MASK 0x38
  133. #define AB8500_SMPSCLKSEL1_VAPECLKSEL_SHIFT 3
  134. #define AB8500_SMPSCLKSEL2_VMODCLKSEL_MASK 0x07
  135. #define AB8500_SMPSCLKSEL2_VMODCLKSEL_SHIFT 0
  136. #define AB8500_SMPSCLKSEL2_VSMPS1CLKSEL_MASK 0x38
  137. #define AB8500_SMPSCLKSEL2_VSMPS1CLKSEL_SHIFT 3
  138. #define AB8500_SMPSCLKSEL3_VSMPS2CLKSEL_MASK 0x07
  139. #define AB8500_SMPSCLKSEL3_VSMPS2CLKSEL_SHIFT 0
  140. #define AB8500_SMPSCLKSEL3_VSMPS3CLKSEL_MASK 0x38
  141. #define AB8500_SMPSCLKSEL3_VSMPS3CLKSEL_SHIFT 3
  142. #define AB8500_SYSULPCLKCONF_ULPCLKCONF_MASK 0x03
  143. #define AB8500_SYSULPCLKCONF_ULPCLKCONF_SHIFT 0
  144. #define AB8500_SYSULPCLKCONF_CLK27MHZSTRE BIT(2)
  145. #define AB8500_SYSULPCLKCONF_TVOUTCLKDELN BIT(3)
  146. #define AB8500_SYSULPCLKCONF_TVOUTCLKINV BIT(4)
  147. #define AB8500_SYSULPCLKCONF_ULPCLKSTRE BIT(5)
  148. #define AB8500_SYSULPCLKCONF_CLK27MHZBUFENA BIT(6)
  149. #define AB8500_SYSULPCLKCONF_CLK27MHZPDENA BIT(7)
  150. #define AB8500_SYSULPCLKCTRL1_SYSULPCLKINTSEL_MASK 0x03
  151. #define AB8500_SYSULPCLKCTRL1_SYSULPCLKINTSEL_SHIFT 0
  152. #define AB8500_SYSULPCLKCTRL1_ULPCLKREQ BIT(2)
  153. #define AB8500_SYSULPCLKCTRL1_4500SYSCLKREQ BIT(3)
  154. #define AB8500_SYSULPCLKCTRL1_AUDIOCLKENA BIT(4)
  155. #define AB8500_SYSULPCLKCTRL1_SYSCLKBUF2REQ BIT(5)
  156. #define AB8500_SYSULPCLKCTRL1_SYSCLKBUF3REQ BIT(6)
  157. #define AB8500_SYSULPCLKCTRL1_SYSCLKBUF4REQ BIT(7)
  158. #define AB8500_SYSCLKCTRL_TVOUTPLLENA BIT(0)
  159. #define AB8500_SYSCLKCTRL_TVOUTCLKENA BIT(1)
  160. #define AB8500_SYSCLKCTRL_USBCLKENA BIT(2)
  161. #define AB8500_SYSCLKREQ1VALID_SYSCLKREQ1VALID BIT(0)
  162. #define AB8500_SYSCLKREQ1VALID_ULPCLKREQ1VALID BIT(1)
  163. #define AB8500_SYSCLKREQ1VALID_USBSYSCLKREQ1VALID BIT(2)
  164. #define AB8500_SYSTEMCTRLSUP_EXTSUP12LPNCLKSEL_MASK 0x03
  165. #define AB8500_SYSTEMCTRLSUP_EXTSUP12LPNCLKSEL_SHIFT 0
  166. #define AB8500_SYSTEMCTRLSUP_EXTSUP3LPNCLKSEL_MASK 0x0C
  167. #define AB8500_SYSTEMCTRLSUP_EXTSUP3LPNCLKSEL_SHIFT 2
  168. #define AB8500_SYSTEMCTRLSUP_INTDB8500NOD BIT(4)
  169. #define AB8500_SYSCLKREQ1RFCLKBUF_SYSCLKREQ1RFCLKBUF2 BIT(2)
  170. #define AB8500_SYSCLKREQ1RFCLKBUF_SYSCLKREQ1RFCLKBUF3 BIT(3)
  171. #define AB8500_SYSCLKREQ1RFCLKBUF_SYSCLKREQ1RFCLKBUF4 BIT(4)
  172. #define AB8500_SYSCLKREQ2RFCLKBUF_SYSCLKREQ2RFCLKBUF2 BIT(2)
  173. #define AB8500_SYSCLKREQ2RFCLKBUF_SYSCLKREQ2RFCLKBUF3 BIT(3)
  174. #define AB8500_SYSCLKREQ2RFCLKBUF_SYSCLKREQ2RFCLKBUF4 BIT(4)
  175. #define AB8500_SYSCLKREQ3RFCLKBUF_SYSCLKREQ3RFCLKBUF2 BIT(2)
  176. #define AB8500_SYSCLKREQ3RFCLKBUF_SYSCLKREQ3RFCLKBUF3 BIT(3)
  177. #define AB8500_SYSCLKREQ3RFCLKBUF_SYSCLKREQ3RFCLKBUF4 BIT(4)
  178. #define AB8500_SYSCLKREQ4RFCLKBUF_SYSCLKREQ4RFCLKBUF2 BIT(2)
  179. #define AB8500_SYSCLKREQ4RFCLKBUF_SYSCLKREQ4RFCLKBUF3 BIT(3)
  180. #define AB8500_SYSCLKREQ4RFCLKBUF_SYSCLKREQ4RFCLKBUF4 BIT(4)
  181. #define AB8500_SYSCLKREQ5RFCLKBUF_SYSCLKREQ5RFCLKBUF2 BIT(2)
  182. #define AB8500_SYSCLKREQ5RFCLKBUF_SYSCLKREQ5RFCLKBUF3 BIT(3)
  183. #define AB8500_SYSCLKREQ5RFCLKBUF_SYSCLKREQ5RFCLKBUF4 BIT(4)
  184. #define AB8500_SYSCLKREQ6RFCLKBUF_SYSCLKREQ6RFCLKBUF2 BIT(2)
  185. #define AB8500_SYSCLKREQ6RFCLKBUF_SYSCLKREQ6RFCLKBUF3 BIT(3)
  186. #define AB8500_SYSCLKREQ6RFCLKBUF_SYSCLKREQ6RFCLKBUF4 BIT(4)
  187. #define AB8500_SYSCLKREQ7RFCLKBUF_SYSCLKREQ7RFCLKBUF2 BIT(2)
  188. #define AB8500_SYSCLKREQ7RFCLKBUF_SYSCLKREQ7RFCLKBUF3 BIT(3)
  189. #define AB8500_SYSCLKREQ7RFCLKBUF_SYSCLKREQ7RFCLKBUF4 BIT(4)
  190. #define AB8500_SYSCLKREQ8RFCLKBUF_SYSCLKREQ8RFCLKBUF2 BIT(2)
  191. #define AB8500_SYSCLKREQ8RFCLKBUF_SYSCLKREQ8RFCLKBUF3 BIT(3)
  192. #define AB8500_SYSCLKREQ8RFCLKBUF_SYSCLKREQ8RFCLKBUF4 BIT(4)
  193. #define AB8500_DITHERCLKCTRL_VARMDITHERENA BIT(0)
  194. #define AB8500_DITHERCLKCTRL_VSMPS3DITHERENA BIT(1)
  195. #define AB8500_DITHERCLKCTRL_VSMPS1DITHERENA BIT(2)
  196. #define AB8500_DITHERCLKCTRL_VSMPS2DITHERENA BIT(3)
  197. #define AB8500_DITHERCLKCTRL_VMODDITHERENA BIT(4)
  198. #define AB8500_DITHERCLKCTRL_VAPEDITHERENA BIT(5)
  199. #define AB8500_DITHERCLKCTRL_DITHERDEL_MASK 0xC0
  200. #define AB8500_DITHERCLKCTRL_DITHERDEL_SHIFT 6
  201. #define AB8500_SWATCTRL_UPDATERF BIT(0)
  202. #define AB8500_SWATCTRL_SWATENABLE BIT(1)
  203. #define AB8500_SWATCTRL_RFOFFTIMER_MASK 0x1C
  204. #define AB8500_SWATCTRL_RFOFFTIMER_SHIFT 2
  205. #define AB8500_SWATCTRL_SWATBIT5 BIT(6)
  206. #define AB8500_HIQCLKCTRL_SYSCLKREQ1HIQENAVALID BIT(0)
  207. #define AB8500_HIQCLKCTRL_SYSCLKREQ2HIQENAVALID BIT(1)
  208. #define AB8500_HIQCLKCTRL_SYSCLKREQ3HIQENAVALID BIT(2)
  209. #define AB8500_HIQCLKCTRL_SYSCLKREQ4HIQENAVALID BIT(3)
  210. #define AB8500_HIQCLKCTRL_SYSCLKREQ5HIQENAVALID BIT(4)
  211. #define AB8500_HIQCLKCTRL_SYSCLKREQ6HIQENAVALID BIT(5)
  212. #define AB8500_HIQCLKCTRL_SYSCLKREQ7HIQENAVALID BIT(6)
  213. #define AB8500_HIQCLKCTRL_SYSCLKREQ8HIQENAVALID BIT(7)
  214. #define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ1VALID BIT(0)
  215. #define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ2VALID BIT(1)
  216. #define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ3VALID BIT(2)
  217. #define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ4VALID BIT(3)
  218. #define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ5VALID BIT(4)
  219. #define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ6VALID BIT(5)
  220. #define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ7VALID BIT(6)
  221. #define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ8VALID BIT(7)
  222. #define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF1ENA BIT(0)
  223. #define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF2ENA BIT(1)
  224. #define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF3ENA BIT(2)
  225. #define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF4ENA BIT(3)
  226. #define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUFENA_MASK 0x0F
  227. #define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF1STRE BIT(4)
  228. #define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF2STRE BIT(5)
  229. #define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF3STRE BIT(6)
  230. #define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF4STRE BIT(7)
  231. #define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUFSTRE_MASK 0xF0
  232. #define AB9540_SYSCLK12CONFCTRL_PLL26TO38ENA BIT(0)
  233. #define AB9540_SYSCLK12CONFCTRL_SYSCLK12USBMUXSEL BIT(1)
  234. #define AB9540_SYSCLK12CONFCTRL_INT384MHZMUXSEL0 BIT(2)
  235. #define AB9540_SYSCLK12CONFCTRL_INT384MHZMUXSEL1 BIT(3)
  236. #define AB9540_SYSCLK12CONFCTRL_SYSCLK12BUFMUX BIT(4)
  237. #define AB9540_SYSCLK12CONFCTRL_SYSCLK12PLLMUX BIT(5)
  238. #define AB9540_SYSCLK12CONFCTRL_SYSCLK2MUXVALID BIT(6)
  239. #define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF1PDENA BIT(0)
  240. #define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF2PDENA BIT(1)
  241. #define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF3PDENA BIT(2)
  242. #define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF4PDENA BIT(3)
  243. #define AB9540_SYSCLK12BUF1VALID_SYSCLK12BUF1VALID_MASK 0xFF
  244. #define AB9540_SYSCLK12BUF1VALID_SYSCLK12BUF1VALID_SHIFT 0
  245. #define AB9540_SYSCLK12BUF2VALID_SYSCLK12BUF2VALID_MASK 0xFF
  246. #define AB9540_SYSCLK12BUF2VALID_SYSCLK12BUF2VALID_SHIFT 0
  247. #define AB9540_SYSCLK12BUF3VALID_SYSCLK12BUF3VALID_MASK 0xFF
  248. #define AB9540_SYSCLK12BUF3VALID_SYSCLK12BUF3VALID_SHIFT 0
  249. #define AB9540_SYSCLK12BUF4VALID_SYSCLK12BUF4VALID_MASK 0xFF
  250. #define AB9540_SYSCLK12BUF4VALID_SYSCLK12BUF4VALID_SHIFT 0
  251. #define AB8500_ENABLE_WD 0x1
  252. #define AB8500_KICK_WD 0x2
  253. #define AB8500_WD_RESTART_ON_EXPIRE 0x10
  254. #endif /* __AB8500_SYSCTRL_H */