twl4030_hw.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. /*
  2. * Copyright (c) 2008 Travis Geiselbrecht
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining
  5. * a copy of this software and associated documentation files
  6. * (the "Software"), to deal in the Software without restriction,
  7. * including without limitation the rights to use, copy, modify, merge,
  8. * publish, distribute, sublicense, and/or sell copies of the Software,
  9. * and to permit persons to whom the Software is furnished to do so,
  10. * subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice shall be
  13. * included in all copies or substantial portions of the Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  16. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  18. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  19. * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  20. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  21. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22. */
  23. #ifndef __TWL4030_HW_H
  24. #define __TWL4030_HW_H
  25. /* TWL i2c addresses */
  26. #define TWL_I2C_ADDR0 0x48
  27. #define TWL_I2C_ADDR1 0x49
  28. #define TWL_I2C_ADDR2 0x4a
  29. #define TWL_I2C_ADDR3 0x4b
  30. #define TWL_USB_ADDR TWL_I2C_ADDR0
  31. #define TWL_INTBR_ADDR TWL_I2C_ADDR1
  32. #define TWL_PM_RECEIVER_ADDR TWL_I2C_ADDR3
  33. /* TWL registers */
  34. #define PROTECT_KEY 0x44
  35. #define VAUX1_DEV_GRP 0x72
  36. #define VAUX1_TYPE 0x73
  37. #define VAUX1_REMAP 0x74
  38. #define VAUX1_DEDICATED 0x75
  39. #define VAUX2_DEV_GRP 0x76
  40. #define VAUX2_TYPE 0x77
  41. #define VAUX2_REMAP 0x78
  42. #define VAUX2_DEDICATED 0x79
  43. #define VAUX3_DEV_GRP 0x7a
  44. #define VAUX3_TYPE 0x7b
  45. #define VAUX3_REMAP 0x7c
  46. #define VAUX3_DEDICATED 0x7d
  47. #define VAUX4_DEV_GRP 0x7e
  48. #define VAUX4_TYPE 0x7f
  49. #define VAUX4_REMAP 0x80
  50. #define VAUX4_DEDICATED 0x81
  51. #define VMMC1_DEV_GRP 0x82
  52. #define VMMC1_TYPE 0x83
  53. #define VMMC1_REMAP 0x84
  54. #define VMMC1_DEDICATED 0x85
  55. #define VMMC2_DEV_GRP 0x86
  56. #define VMMC2_TYPE 0x87
  57. #define VMMC2_REMAP 0x88
  58. #define VMMC2_DEDICATED 0x89
  59. #define VPLL1_DEV_GRP 0x8a
  60. #define VPLL1_TYPE 0x8b
  61. #define VPLL1_REMAP 0x8c
  62. #define VPLL1_DEDICATED 0x8d
  63. #define VPLL2_DEV_GRP 0x8e
  64. #define VPLL2_TYPE 0x8f
  65. #define VPLL2_REMAP 0x90
  66. #define VPLL2_DEDICATED 0x91
  67. #define VDAC_DEV_GRP 0x96
  68. #define VDAC_DEDICATED 0x99
  69. #define VDD2_DEV_GRP 0xBE
  70. #define VDD2_TYPE 0xBF
  71. #define VDD2_REMAP 0xC0
  72. #define VDD2_CFG 0xC1
  73. #define VSIM_DEV_GRP 0x92
  74. #define VSIM_TYPE 0x93
  75. #define VSIM_REMAP 0x94
  76. #define VSIM_DEDICATED 0x95
  77. #define PMBR1 0x92
  78. #define SECONDS_REG 0x1C
  79. #define MINUTES_REG 0x1D
  80. #define ALARM_SECONDS_REG 0x23
  81. #define ALARM_MINUTES_REG 0x24
  82. #define ALARM_HOURS_REG 0x25
  83. #define RTC_STATUS_REG 0x2A
  84. #define RTC_INTERRUPTS_REG 0x2B
  85. #define PWR_ISR1 0x2E
  86. #define PWR_IMR1 0x2F
  87. #define PWR_ISR2 0x30
  88. #define PWR_IMR2 0x31
  89. #define PWR_EDR1 0x33
  90. #define CFG_PWRANA2 0x3F
  91. #define RTC_INTERRUPTS_REG 0x2B
  92. #define STS_HW_CONDITIONS 0x45
  93. #define P1_SW_EVENTS 0x46
  94. #define P2_SW_EVENTS 0x47
  95. #define P3_SW_EVENTS 0x48
  96. #define VDD1_TRIM1 0x62
  97. #define VDD1_TRIM2 0x63
  98. #define VDD1_VFLOOR 0xBB
  99. #define VDD1_VROOF 0xBC
  100. #define PB_CFG 0x4A
  101. #define PB_WORD_MSB 0x4B
  102. #define PB_WORD_LSB 0x4C
  103. #define VSIM_REMAP 0x94
  104. #define VDAC_REMAP 0x98
  105. #define VINTANA1_DEV_GRP 0x9A
  106. #define VINTANA1_REMAP 0x9C
  107. #define VINTANA2_REMAP 0xA0
  108. #define VINTANA2_DEV_GRP 0x9E
  109. #define VINTDIG_DEV_GRP 0xA2
  110. #define VINTDIG_REMAP 0xA4
  111. #define VIO_DEV_GRP 0xA6
  112. #define VIO_REMAP 0xA8
  113. #define VDD1_REMAP 0xB2
  114. #define VDD2_REMAP 0xC0
  115. #define REGEN_REMAP 0xDC
  116. #define NRESPWRON_REMAP 0xDF
  117. #define CLKEN_REMAP 0xE2
  118. #define SYSEN_REMAP 0xE5
  119. #define HFCLKOUT_REMAP 0xE8
  120. #define HFCLKOUT_DEV_GRP 0xE6
  121. #define T32KCLKOUT_REMAP 0xEB
  122. #define TRITON_RESET_REMAP 0xEE
  123. #define MAINREF_REMAP 0xF1
  124. #define VIBRA_CTL 0x45
  125. #define VUSB1V5_DEV_GRP 0xCC
  126. #define VUSB1V5_TYPE 0xCD
  127. #define VUSB1V5_REMAP 0xCE
  128. #define VUSB1V8_DEV_GRP 0xCF
  129. #define VUSB1V8_TYPE 0xD0
  130. #define VUSB1V8_REMAP 0xD1
  131. #define VUSB3V1_DEV_GRP 0xD2
  132. #define VUSB3V1_TYPE 0xD3
  133. #define VUSB3V1_REMAP 0xD4
  134. #define VUSBCP_DEV_GRP 0xD5
  135. #define VUSBCP_TYPE 0xD6
  136. #define VUSBCP_REMAP 0xD7
  137. #define VUSB_DEDICATED1 0xD8
  138. #define VUSB_DEDICATED2 0xD9
  139. /* USB registers */
  140. #define VENDOR_ID_LO 0x0
  141. #define VENDOR_ID_HI 0x1
  142. #define PRODUCT_ID_LO 0x2
  143. #define PRODUCT_ID_HI 0x3
  144. #define FUNC_CTRL 0x4
  145. #define FUNC_CTRL_SET 0x5
  146. #define FUNC_CTRL_CLR 0x6
  147. # define SUSPENDM (1 << 6)
  148. # define RESET (1 << 5)
  149. # define OPMODE_MASK (3 << 3) /* bits 3 and 4 */
  150. # define OPMODE_NORMAL (0 << 3)
  151. # define OPMODE_NONDRIVING (1 << 3)
  152. # define OPMODE_DISABLE_BIT_NRZI (2 << 3)
  153. # define TERMSELECT (1 << 2)
  154. # define XCVRSELECT_MASK (3 << 0) /* bits 0 and 1 */
  155. # define XCVRSELECT_HS (0 << 0)
  156. # define XCVRSELECT_FS (1 << 0)
  157. # define XCVRSELECT_LS (2 << 0)
  158. # define XCVRSELECT_FS4LS (3 << 0)
  159. #define IFC_CTRL 0x7
  160. #define IFC_CTRL_SET 0x8
  161. #define IFC_CTRL_CLR 0x9
  162. # define INTERFACE_PROTECT_DISABLE (1 << 7)
  163. # define AUTORESUME (1 << 4)
  164. # define CLOCKSUSPENDM (1 << 3)
  165. # define CARKITMODE (1 << 2)
  166. # define FSLSSERIALMODE_3PIN (1 << 1)
  167. #define OTG_CTRL 0xa
  168. #define OTG_CTRL_SET 0xb
  169. #define OTG_CTRL_CLR 0xc
  170. #define DRVVBUS (1 << 5)
  171. #define CHRGVBUS (1 << 4)
  172. #define DISCHRGVBUS (1 << 3)
  173. #define DMPULLDOWN (1 << 2)
  174. #define DPPULLDOWN (1 << 1)
  175. #define IDPULLUP (1 << 0)
  176. #define USB_INT_EN_RISE 0xd
  177. #define USB_INT_EN_RISE_SET 0xe
  178. #define USB_INT_EN_RISE_CLR 0xf
  179. #define USB_INT_EN_FALL 0x10
  180. #define USB_INT_EN_FALL_SET 0x11
  181. #define USB_INT_EN_FALL_CLR 0x12
  182. # define HOSTDISCONNECT (1 << 0)
  183. #define USB_INT_STS 0x13
  184. #define USB_INT_LATCH 0x14
  185. #define USB_DEBUG 0x15
  186. #define SCRATCH_REG 0x16
  187. #define SCRATCH_REG_SET 0x17
  188. #define SCRATCH_REG_CLR 0x18
  189. #define CARKIT_CTRL 0x19
  190. #define CARKIT_CTRL_SET 0x1a
  191. #define CARKIT_CTRL_CLR 0x1b
  192. #define MICEN (1 << 6)
  193. #define SPKRIGHTEN (1 << 5)
  194. #define SPKLEFTEN (1 << 4)
  195. #define RXDEN (1 << 3)
  196. #define TXDEN (1 << 2)
  197. #define IDGNDDRV (1 << 1)
  198. #define CARKITPWR (1 << 0)
  199. #define CARKIT_INT_DELAY 0x1c
  200. #define CARKIT_INT_EN 0x1d
  201. #define CARKIT_INT_EN_SET 0x1e
  202. #define CARKIT_INT_EN_CLR 0x1f
  203. #define CARKIT_INT_STS 0x20
  204. #define CARKIT_INT_LATCH 0x21
  205. #define CARKIT_PLS_CTRL 0x22
  206. #define CARKIT_PLS_CTRL_SET 0x23
  207. #define CARKIT_PLS_CTRL_CLR 0x24
  208. # define SPKRRIGHT_BIASEN (1 << 3)
  209. # define SPKRLEFT_BIASEN (1 << 2)
  210. # define RXPLSEN (1 << 1)
  211. # define TXPLSEN (1 << 0)
  212. #define TRANS_POS_WIDTH 0x25
  213. #define TRANS_NEG_WIDTH 0x26
  214. #define RCV_PLTY_RECOVERY 0x27
  215. #define MCPC_CTRL 0x30
  216. #define MCPC_CTRL_SET 0x31
  217. #define MCPC_CTRL_CLR 0x32
  218. #define RTSOL (1 << 7)
  219. #define EXTSWR (1 << 6)
  220. #define EXTSWC (1 << 5)
  221. #define VOICESW (1 << 4)
  222. #define OUT64K (1 << 3)
  223. #define RTSCTSSW (1 << 2)
  224. #define HS_UART (1 << 0)
  225. #define MCPC_IO_CTRL 0x033
  226. #define MCPC_IO_CTRL_SET 0x034
  227. #define MCPC_IO_CTRL_CLR 0x035
  228. #define MICBIASEN (1<< 5)
  229. #define CTS_NPU (1 << 4)
  230. #define RXD_PU (1 << 3)
  231. #define TXDTYP (1 << 2)
  232. #define CTSTYP (1 << 1)
  233. #define RTSTYP (1 << 0)
  234. #define MCPC_CTRL2 0x036
  235. #define MCPC_CTRL2_SET 0x037
  236. #define MCPC_CTRL2_CLR 0x038
  237. # define MCPC_CK_EN (1 << 0)
  238. #define OTHER_FUNC_CTRL 0x080
  239. #define OTHER_FUNC_CTRL_SET 0x081
  240. #define OTHER_FUNC_CTRL_CLR 0x082
  241. #define BDIS_ACON_EN (1<< 4)
  242. #define FIVEWIRE_MODE (1 << 2)
  243. #define OTHER_IFC_CTRL 0x083
  244. #define OTHER_IFC_CTRL_SET 0x084
  245. #define OTHER_IFC_CTRL_CLR 0x085
  246. # define OE_INT_EN (1 << 6)
  247. # define CEA2011_MODE (1 << 5)
  248. # define FSLSSERIALMODE_4PIN (1 << 4)
  249. # define HIZ_ULPI_60MHZ_OUT (1 << 3)
  250. # define HIZ_ULPI (1 << 2)
  251. # define ALT_INT_REROUTE (1 << 0)
  252. #define OTHER_INT_EN_RISE 0x086
  253. #define OTHER_INT_EN_RISE_SET 0x087
  254. #define OTHER_INT_EN_RISE_CLR 0x088
  255. #define OTHER_INT_EN_FALL 0x089
  256. #define OTHER_INT_EN_FALL_SET 0x08A
  257. #define OTHER_INT_EN_FALL_CLR 0x08B
  258. #define OTHER_INT_STS 0x8C
  259. #define OTHER_INT_LATCH 0x8D
  260. #define ID_INT_EN_RISE 0x08E
  261. #define ID_INT_EN_RISE_SET 0x08F
  262. #define ID_INT_EN_RISE_CLR 0x090
  263. #define ID_INT_EN_FALL 0x091
  264. #define ID_INT_EN_FALL_SET 0x092
  265. #define ID_INT_EN_FALL_CLR 0x093
  266. #define ID_INT_STS 0x094
  267. #define ID_INT_LATCH 0x95
  268. #define ID_STATUS 0x96
  269. #define CARKIT_SM_1_INT_EN 0x097
  270. #define CARKIT_SM_1_INT_EN_SET 0x098
  271. #define CARKIT_SM_1_INT_EN_CLR 0x099
  272. #define CARKIT_SM_1_INT_STS 0x09A
  273. #define CARKIT_SM_1_INT_LATCH 0x9B
  274. #define CARKIT_SM_2_INT_EN 0x09C
  275. #define CARKIT_SM_2_INT_EN_SET 0x09D
  276. #define CARKIT_SM_2_INT_EN_CLR 0x09E
  277. #define CARKIT_SM_2_INT_STS 0x09F
  278. #define CARKIT_SM_2_INT_LATCH 0xA0
  279. #define CARKIT_SM_CTRL 0x0A1
  280. #define CARKIT_SM_CTRL_SET 0x0A2
  281. #define CARKIT_SM_CTRL_CLR 0x0A3
  282. #define CARKIT_SM_CMD 0x0A4
  283. #define CARKIT_SM_CMD_SET 0x0A5
  284. #define CARKIT_SM_CMD_CLR 0x0A6
  285. #define CARKIT_SM_CMD_STS 0xA7
  286. #define CARKIT_SM_STATUS 0xA8
  287. #define CARKIT_SM_NEXT_STATUS 0xA9
  288. #define CARKIT_SM_ERR_STATUS 0xAA
  289. #define CARKIT_SM_CTRL_STATE 0xAB
  290. #define POWER_CTRL 0xAC
  291. #define POWER_CTRL_SET 0xAD
  292. #define POWER_CTRL_CLR 0xAE
  293. # define OTG_ENAB (1 << 5)
  294. #define OTHER_IFC_CTRL2 0xAF
  295. #define OTHER_IFC_CTRL2_SET 0xB0
  296. #define OTHER_IFC_CTRL2_CLR 0xB1
  297. # define ULPI_TXEN_POL (1 << 3)
  298. # define ULPI_4PIN_2430 (1 << 2)
  299. #define REG_CTRL_EN 0xB2
  300. #define REG_CTRL_EN_SET 0xB3
  301. #define REG_CTRL_EN_CLR 0xB4
  302. #define REG_CTRL_ERROR 0xB5
  303. #define ULPI_I2C_CONFLICT_INTEN (1 << 0)
  304. #define OTHER_FUNC_CTRL2 0xB8
  305. #define OTHER_FUNC_CTRL2_SET 0xB9
  306. #define OTHER_FUNC_CTRL2_CLR 0xBA
  307. #define VBAT_TIMER_EN (1 << 0)
  308. #define CARKIT_ANA_CTRL 0xBB
  309. #define CARKIT_ANA_CTRL_SET 0xBC
  310. #define CARKIT_ANA_CTRL_CLR 0xBD
  311. #define VBUS_DEBOUNCE 0xC0
  312. #define ID_DEBOUNCE 0xC1
  313. #define TPH_DP_CON_MIN 0xC2
  314. #define TPH_DP_CON_MAX 0xC3
  315. #define TCR_DP_CON_MIN 0xC4
  316. #define TCR_DP_CON_MAX 0xC5
  317. #define TPH_DP_PD_SHORT 0xC6
  318. #define TPH_CMD_DLY 0xC7
  319. #define TPH_DET_RST 0xC8
  320. #define TPH_AUD_BIAS 0xC9
  321. #define TCR_UART_DET_MIN 0xCA
  322. #define TCR_UART_DET_MAX 0xCB
  323. #define TPH_ID_INT_PW 0xCD
  324. #define TACC_ID_INT_WAIT 0xCE
  325. #define TACC_ID_INT_PW 0xCF
  326. #define TPH_CMD_WAIT 0xD0
  327. #define TPH_ACK_WAIT 0xD1
  328. #define TPH_DP_DISC_DET 0xD2
  329. #define VBAT_TIMER 0xD3
  330. #define CARKIT_4W_DEBUG 0xE0
  331. #define CARKIT_5W_DEBUG 0xE1
  332. #define CARKIT_5W_DEBUG 0xE1
  333. #define TEST_CTRL_CLR 0xEB
  334. #define TEST_CARKIT_SET 0xEC
  335. #define TEST_CARKIT_CLR 0xED
  336. #define TEST_POWER_SET 0xEE
  337. #define TEST_POWER_CLR 0xEF
  338. #define TEST_ULPI 0xF0
  339. #define TXVR_EN_TEST_SET 0xF2
  340. #define TXVR_EN_TEST_CLR 0xF3
  341. #define VBUS_EN_TEST 0xF4
  342. #define ID_EN_TEST 0xF5
  343. #define PSM_EN_TEST_SET 0xF6
  344. #define PSM_EN_TEST_CLR 0xF7
  345. #define PHY_TRIM_CTRL 0xFC
  346. #define PHY_PWR_CTRL 0xFD
  347. # define PHYPWD (1 << 0)
  348. #define PHY_CLK_CTRL 0xFE
  349. # define CLOCKGATING_EN (1 << 2)
  350. # define CLK32K_EN (1 << 1)
  351. # define REQ_PHY_DPLL_CLK (1 << 0)
  352. #define PHY_CLK_CTRL_STS 0xFF
  353. # define PHY_DPLL_CLK (1 << 0)
  354. #endif