hw.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826
  1. /*
  2. * hw.h - DesignWare HS OTG Controller hardware definitions
  3. *
  4. * Copyright 2004-2013 Synopsys, Inc.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. * 1. Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions, and the following disclaimer,
  11. * without modification.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * 3. The names of the above-listed copyright holders may not be used
  16. * to endorse or promote products derived from this software without
  17. * specific prior written permission.
  18. *
  19. * ALTERNATIVELY, this software may be distributed under the terms of the
  20. * GNU General Public License ("GPL") as published by the Free Software
  21. * Foundation; either version 2 of the License, or (at your option) any
  22. * later version.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  25. * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  26. * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  27. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  28. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  29. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  30. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  31. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  32. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  33. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  34. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  35. */
  36. #ifndef __DWC2_HW_H__
  37. #define __DWC2_HW_H__
  38. #define HSOTG_REG(x) (x)
  39. #define GOTGCTL HSOTG_REG(0x000)
  40. #define GOTGCTL_CHIRPEN (1 << 27)
  41. #define GOTGCTL_MULT_VALID_BC_MASK (0x1f << 22)
  42. #define GOTGCTL_MULT_VALID_BC_SHIFT 22
  43. #define GOTGCTL_OTGVER (1 << 20)
  44. #define GOTGCTL_BSESVLD (1 << 19)
  45. #define GOTGCTL_ASESVLD (1 << 18)
  46. #define GOTGCTL_DBNC_SHORT (1 << 17)
  47. #define GOTGCTL_CONID_B (1 << 16)
  48. #define GOTGCTL_DBNCE_FLTR_BYPASS (1 << 15)
  49. #define GOTGCTL_DEVHNPEN (1 << 11)
  50. #define GOTGCTL_HSTSETHNPEN (1 << 10)
  51. #define GOTGCTL_HNPREQ (1 << 9)
  52. #define GOTGCTL_HSTNEGSCS (1 << 8)
  53. #define GOTGCTL_SESREQ (1 << 1)
  54. #define GOTGCTL_SESREQSCS (1 << 0)
  55. #define GOTGINT HSOTG_REG(0x004)
  56. #define GOTGINT_DBNCE_DONE (1 << 19)
  57. #define GOTGINT_A_DEV_TOUT_CHG (1 << 18)
  58. #define GOTGINT_HST_NEG_DET (1 << 17)
  59. #define GOTGINT_HST_NEG_SUC_STS_CHNG (1 << 9)
  60. #define GOTGINT_SES_REQ_SUC_STS_CHNG (1 << 8)
  61. #define GOTGINT_SES_END_DET (1 << 2)
  62. #define GAHBCFG HSOTG_REG(0x008)
  63. #define GAHBCFG_AHB_SINGLE (1 << 23)
  64. #define GAHBCFG_NOTI_ALL_DMA_WRIT (1 << 22)
  65. #define GAHBCFG_REM_MEM_SUPP (1 << 21)
  66. #define GAHBCFG_P_TXF_EMP_LVL (1 << 8)
  67. #define GAHBCFG_NP_TXF_EMP_LVL (1 << 7)
  68. #define GAHBCFG_DMA_EN (1 << 5)
  69. #define GAHBCFG_HBSTLEN_MASK (0xf << 1)
  70. #define GAHBCFG_HBSTLEN_SHIFT 1
  71. #define GAHBCFG_HBSTLEN_SINGLE 0
  72. #define GAHBCFG_HBSTLEN_INCR 1
  73. #define GAHBCFG_HBSTLEN_INCR4 3
  74. #define GAHBCFG_HBSTLEN_INCR8 5
  75. #define GAHBCFG_HBSTLEN_INCR16 7
  76. #define GAHBCFG_GLBL_INTR_EN (1 << 0)
  77. #define GAHBCFG_CTRL_MASK (GAHBCFG_P_TXF_EMP_LVL | \
  78. GAHBCFG_NP_TXF_EMP_LVL | \
  79. GAHBCFG_DMA_EN | \
  80. GAHBCFG_GLBL_INTR_EN)
  81. #define GUSBCFG HSOTG_REG(0x00C)
  82. #define GUSBCFG_FORCEDEVMODE (1 << 30)
  83. #define GUSBCFG_FORCEHOSTMODE (1 << 29)
  84. #define GUSBCFG_TXENDDELAY (1 << 28)
  85. #define GUSBCFG_ICTRAFFICPULLREMOVE (1 << 27)
  86. #define GUSBCFG_ICUSBCAP (1 << 26)
  87. #define GUSBCFG_ULPI_INT_PROT_DIS (1 << 25)
  88. #define GUSBCFG_INDICATORPASSTHROUGH (1 << 24)
  89. #define GUSBCFG_INDICATORCOMPLEMENT (1 << 23)
  90. #define GUSBCFG_TERMSELDLPULSE (1 << 22)
  91. #define GUSBCFG_ULPI_INT_VBUS_IND (1 << 21)
  92. #define GUSBCFG_ULPI_EXT_VBUS_DRV (1 << 20)
  93. #define GUSBCFG_ULPI_CLK_SUSP_M (1 << 19)
  94. #define GUSBCFG_ULPI_AUTO_RES (1 << 18)
  95. #define GUSBCFG_ULPI_FS_LS (1 << 17)
  96. #define GUSBCFG_OTG_UTMI_FS_SEL (1 << 16)
  97. #define GUSBCFG_PHY_LP_CLK_SEL (1 << 15)
  98. #define GUSBCFG_USBTRDTIM_MASK (0xf << 10)
  99. #define GUSBCFG_USBTRDTIM_SHIFT 10
  100. #define GUSBCFG_HNPCAP (1 << 9)
  101. #define GUSBCFG_SRPCAP (1 << 8)
  102. #define GUSBCFG_DDRSEL (1 << 7)
  103. #define GUSBCFG_PHYSEL (1 << 6)
  104. #define GUSBCFG_FSINTF (1 << 5)
  105. #define GUSBCFG_ULPI_UTMI_SEL (1 << 4)
  106. #define GUSBCFG_PHYIF16 (1 << 3)
  107. #define GUSBCFG_PHYIF8 (0 << 3)
  108. #define GUSBCFG_TOUTCAL_MASK (0x7 << 0)
  109. #define GUSBCFG_TOUTCAL_SHIFT 0
  110. #define GUSBCFG_TOUTCAL_LIMIT 0x7
  111. #define GUSBCFG_TOUTCAL(_x) ((_x) << 0)
  112. #define GRSTCTL HSOTG_REG(0x010)
  113. #define GRSTCTL_AHBIDLE (1 << 31)
  114. #define GRSTCTL_DMAREQ (1 << 30)
  115. #define GRSTCTL_TXFNUM_MASK (0x1f << 6)
  116. #define GRSTCTL_TXFNUM_SHIFT 6
  117. #define GRSTCTL_TXFNUM_LIMIT 0x1f
  118. #define GRSTCTL_TXFNUM(_x) ((_x) << 6)
  119. #define GRSTCTL_TXFFLSH (1 << 5)
  120. #define GRSTCTL_RXFFLSH (1 << 4)
  121. #define GRSTCTL_IN_TKNQ_FLSH (1 << 3)
  122. #define GRSTCTL_FRMCNTRRST (1 << 2)
  123. #define GRSTCTL_HSFTRST (1 << 1)
  124. #define GRSTCTL_CSFTRST (1 << 0)
  125. #define GINTSTS HSOTG_REG(0x014)
  126. #define GINTMSK HSOTG_REG(0x018)
  127. #define GINTSTS_WKUPINT (1 << 31)
  128. #define GINTSTS_SESSREQINT (1 << 30)
  129. #define GINTSTS_DISCONNINT (1 << 29)
  130. #define GINTSTS_CONIDSTSCHNG (1 << 28)
  131. #define GINTSTS_LPMTRANRCVD (1 << 27)
  132. #define GINTSTS_PTXFEMP (1 << 26)
  133. #define GINTSTS_HCHINT (1 << 25)
  134. #define GINTSTS_PRTINT (1 << 24)
  135. #define GINTSTS_RESETDET (1 << 23)
  136. #define GINTSTS_FET_SUSP (1 << 22)
  137. #define GINTSTS_INCOMPL_IP (1 << 21)
  138. #define GINTSTS_INCOMPL_SOOUT (1 << 21)
  139. #define GINTSTS_INCOMPL_SOIN (1 << 20)
  140. #define GINTSTS_OEPINT (1 << 19)
  141. #define GINTSTS_IEPINT (1 << 18)
  142. #define GINTSTS_EPMIS (1 << 17)
  143. #define GINTSTS_RESTOREDONE (1 << 16)
  144. #define GINTSTS_EOPF (1 << 15)
  145. #define GINTSTS_ISOUTDROP (1 << 14)
  146. #define GINTSTS_ENUMDONE (1 << 13)
  147. #define GINTSTS_USBRST (1 << 12)
  148. #define GINTSTS_USBSUSP (1 << 11)
  149. #define GINTSTS_ERLYSUSP (1 << 10)
  150. #define GINTSTS_I2CINT (1 << 9)
  151. #define GINTSTS_ULPI_CK_INT (1 << 8)
  152. #define GINTSTS_GOUTNAKEFF (1 << 7)
  153. #define GINTSTS_GINNAKEFF (1 << 6)
  154. #define GINTSTS_NPTXFEMP (1 << 5)
  155. #define GINTSTS_RXFLVL (1 << 4)
  156. #define GINTSTS_SOF (1 << 3)
  157. #define GINTSTS_OTGINT (1 << 2)
  158. #define GINTSTS_MODEMIS (1 << 1)
  159. #define GINTSTS_CURMODE_HOST (1 << 0)
  160. #define GRXSTSR HSOTG_REG(0x01C)
  161. #define GRXSTSP HSOTG_REG(0x020)
  162. #define GRXSTS_FN_MASK (0x7f << 25)
  163. #define GRXSTS_FN_SHIFT 25
  164. #define GRXSTS_PKTSTS_MASK (0xf << 17)
  165. #define GRXSTS_PKTSTS_SHIFT 17
  166. #define GRXSTS_PKTSTS_GLOBALOUTNAK 1
  167. #define GRXSTS_PKTSTS_OUTRX 2
  168. #define GRXSTS_PKTSTS_HCHIN 2
  169. #define GRXSTS_PKTSTS_OUTDONE 3
  170. #define GRXSTS_PKTSTS_HCHIN_XFER_COMP 3
  171. #define GRXSTS_PKTSTS_SETUPDONE 4
  172. #define GRXSTS_PKTSTS_DATATOGGLEERR 5
  173. #define GRXSTS_PKTSTS_SETUPRX 6
  174. #define GRXSTS_PKTSTS_HCHHALTED 7
  175. #define GRXSTS_HCHNUM_MASK (0xf << 0)
  176. #define GRXSTS_HCHNUM_SHIFT 0
  177. #define GRXSTS_DPID_MASK (0x3 << 15)
  178. #define GRXSTS_DPID_SHIFT 15
  179. #define GRXSTS_BYTECNT_MASK (0x7ff << 4)
  180. #define GRXSTS_BYTECNT_SHIFT 4
  181. #define GRXSTS_EPNUM_MASK (0xf << 0)
  182. #define GRXSTS_EPNUM_SHIFT 0
  183. #define GRXFSIZ HSOTG_REG(0x024)
  184. #define GRXFSIZ_DEPTH_MASK (0xffff << 0)
  185. #define GRXFSIZ_DEPTH_SHIFT 0
  186. #define GNPTXFSIZ HSOTG_REG(0x028)
  187. /* Use FIFOSIZE_* constants to access this register */
  188. #define GNPTXSTS HSOTG_REG(0x02C)
  189. #define GNPTXSTS_NP_TXQ_TOP_MASK (0x7f << 24)
  190. #define GNPTXSTS_NP_TXQ_TOP_SHIFT 24
  191. #define GNPTXSTS_NP_TXQ_SPC_AVAIL_MASK (0xff << 16)
  192. #define GNPTXSTS_NP_TXQ_SPC_AVAIL_SHIFT 16
  193. #define GNPTXSTS_NP_TXQ_SPC_AVAIL_GET(_v) (((_v) >> 16) & 0xff)
  194. #define GNPTXSTS_NP_TXF_SPC_AVAIL_MASK (0xffff << 0)
  195. #define GNPTXSTS_NP_TXF_SPC_AVAIL_SHIFT 0
  196. #define GNPTXSTS_NP_TXF_SPC_AVAIL_GET(_v) (((_v) >> 0) & 0xffff)
  197. #define GI2CCTL HSOTG_REG(0x0030)
  198. #define GI2CCTL_BSYDNE (1 << 31)
  199. #define GI2CCTL_RW (1 << 30)
  200. #define GI2CCTL_I2CDATSE0 (1 << 28)
  201. #define GI2CCTL_I2CDEVADDR_MASK (0x3 << 26)
  202. #define GI2CCTL_I2CDEVADDR_SHIFT 26
  203. #define GI2CCTL_I2CSUSPCTL (1 << 25)
  204. #define GI2CCTL_ACK (1 << 24)
  205. #define GI2CCTL_I2CEN (1 << 23)
  206. #define GI2CCTL_ADDR_MASK (0x7f << 16)
  207. #define GI2CCTL_ADDR_SHIFT 16
  208. #define GI2CCTL_REGADDR_MASK (0xff << 8)
  209. #define GI2CCTL_REGADDR_SHIFT 8
  210. #define GI2CCTL_RWDATA_MASK (0xff << 0)
  211. #define GI2CCTL_RWDATA_SHIFT 0
  212. #define GPVNDCTL HSOTG_REG(0x0034)
  213. #define GGPIO HSOTG_REG(0x0038)
  214. #define GUID HSOTG_REG(0x003c)
  215. #define GSNPSID HSOTG_REG(0x0040)
  216. #define GHWCFG1 HSOTG_REG(0x0044)
  217. #define GHWCFG2 HSOTG_REG(0x0048)
  218. #define GHWCFG2_OTG_ENABLE_IC_USB (1 << 31)
  219. #define GHWCFG2_DEV_TOKEN_Q_DEPTH_MASK (0x1f << 26)
  220. #define GHWCFG2_DEV_TOKEN_Q_DEPTH_SHIFT 26
  221. #define GHWCFG2_HOST_PERIO_TX_Q_DEPTH_MASK (0x3 << 24)
  222. #define GHWCFG2_HOST_PERIO_TX_Q_DEPTH_SHIFT 24
  223. #define GHWCFG2_NONPERIO_TX_Q_DEPTH_MASK (0x3 << 22)
  224. #define GHWCFG2_NONPERIO_TX_Q_DEPTH_SHIFT 22
  225. #define GHWCFG2_MULTI_PROC_INT (1 << 20)
  226. #define GHWCFG2_DYNAMIC_FIFO (1 << 19)
  227. #define GHWCFG2_PERIO_EP_SUPPORTED (1 << 18)
  228. #define GHWCFG2_NUM_HOST_CHAN_MASK (0xf << 14)
  229. #define GHWCFG2_NUM_HOST_CHAN_SHIFT 14
  230. #define GHWCFG2_NUM_DEV_EP_MASK (0xf << 10)
  231. #define GHWCFG2_NUM_DEV_EP_SHIFT 10
  232. #define GHWCFG2_FS_PHY_TYPE_MASK (0x3 << 8)
  233. #define GHWCFG2_FS_PHY_TYPE_SHIFT 8
  234. #define GHWCFG2_FS_PHY_TYPE_NOT_SUPPORTED 0
  235. #define GHWCFG2_FS_PHY_TYPE_DEDICATED 1
  236. #define GHWCFG2_FS_PHY_TYPE_SHARED_UTMI 2
  237. #define GHWCFG2_FS_PHY_TYPE_SHARED_ULPI 3
  238. #define GHWCFG2_HS_PHY_TYPE_MASK (0x3 << 6)
  239. #define GHWCFG2_HS_PHY_TYPE_SHIFT 6
  240. #define GHWCFG2_HS_PHY_TYPE_NOT_SUPPORTED 0
  241. #define GHWCFG2_HS_PHY_TYPE_UTMI 1
  242. #define GHWCFG2_HS_PHY_TYPE_ULPI 2
  243. #define GHWCFG2_HS_PHY_TYPE_UTMI_ULPI 3
  244. #define GHWCFG2_POINT2POINT (1 << 5)
  245. #define GHWCFG2_ARCHITECTURE_MASK (0x3 << 3)
  246. #define GHWCFG2_ARCHITECTURE_SHIFT 3
  247. #define GHWCFG2_SLAVE_ONLY_ARCH 0
  248. #define GHWCFG2_EXT_DMA_ARCH 1
  249. #define GHWCFG2_INT_DMA_ARCH 2
  250. #define GHWCFG2_OP_MODE_MASK (0x7 << 0)
  251. #define GHWCFG2_OP_MODE_SHIFT 0
  252. #define GHWCFG2_OP_MODE_HNP_SRP_CAPABLE 0
  253. #define GHWCFG2_OP_MODE_SRP_ONLY_CAPABLE 1
  254. #define GHWCFG2_OP_MODE_NO_HNP_SRP_CAPABLE 2
  255. #define GHWCFG2_OP_MODE_SRP_CAPABLE_DEVICE 3
  256. #define GHWCFG2_OP_MODE_NO_SRP_CAPABLE_DEVICE 4
  257. #define GHWCFG2_OP_MODE_SRP_CAPABLE_HOST 5
  258. #define GHWCFG2_OP_MODE_NO_SRP_CAPABLE_HOST 6
  259. #define GHWCFG2_OP_MODE_UNDEFINED 7
  260. #define GHWCFG3 HSOTG_REG(0x004c)
  261. #define GHWCFG3_DFIFO_DEPTH_MASK (0xffff << 16)
  262. #define GHWCFG3_DFIFO_DEPTH_SHIFT 16
  263. #define GHWCFG3_OTG_LPM_EN (1 << 15)
  264. #define GHWCFG3_BC_SUPPORT (1 << 14)
  265. #define GHWCFG3_OTG_ENABLE_HSIC (1 << 13)
  266. #define GHWCFG3_ADP_SUPP (1 << 12)
  267. #define GHWCFG3_SYNCH_RESET_TYPE (1 << 11)
  268. #define GHWCFG3_OPTIONAL_FEATURES (1 << 10)
  269. #define GHWCFG3_VENDOR_CTRL_IF (1 << 9)
  270. #define GHWCFG3_I2C (1 << 8)
  271. #define GHWCFG3_OTG_FUNC (1 << 7)
  272. #define GHWCFG3_PACKET_SIZE_CNTR_WIDTH_MASK (0x7 << 4)
  273. #define GHWCFG3_PACKET_SIZE_CNTR_WIDTH_SHIFT 4
  274. #define GHWCFG3_XFER_SIZE_CNTR_WIDTH_MASK (0xf << 0)
  275. #define GHWCFG3_XFER_SIZE_CNTR_WIDTH_SHIFT 0
  276. #define GHWCFG4 HSOTG_REG(0x0050)
  277. #define GHWCFG4_DESC_DMA_DYN (1 << 31)
  278. #define GHWCFG4_DESC_DMA (1 << 30)
  279. #define GHWCFG4_NUM_IN_EPS_MASK (0xf << 26)
  280. #define GHWCFG4_NUM_IN_EPS_SHIFT 26
  281. #define GHWCFG4_DED_FIFO_EN (1 << 25)
  282. #define GHWCFG4_DED_FIFO_SHIFT 25
  283. #define GHWCFG4_SESSION_END_FILT_EN (1 << 24)
  284. #define GHWCFG4_B_VALID_FILT_EN (1 << 23)
  285. #define GHWCFG4_A_VALID_FILT_EN (1 << 22)
  286. #define GHWCFG4_VBUS_VALID_FILT_EN (1 << 21)
  287. #define GHWCFG4_IDDIG_FILT_EN (1 << 20)
  288. #define GHWCFG4_NUM_DEV_MODE_CTRL_EP_MASK (0xf << 16)
  289. #define GHWCFG4_NUM_DEV_MODE_CTRL_EP_SHIFT 16
  290. #define GHWCFG4_UTMI_PHY_DATA_WIDTH_MASK (0x3 << 14)
  291. #define GHWCFG4_UTMI_PHY_DATA_WIDTH_SHIFT 14
  292. #define GHWCFG4_UTMI_PHY_DATA_WIDTH_8 0
  293. #define GHWCFG4_UTMI_PHY_DATA_WIDTH_16 1
  294. #define GHWCFG4_UTMI_PHY_DATA_WIDTH_8_OR_16 2
  295. #define GHWCFG4_XHIBER (1 << 7)
  296. #define GHWCFG4_HIBER (1 << 6)
  297. #define GHWCFG4_MIN_AHB_FREQ (1 << 5)
  298. #define GHWCFG4_POWER_OPTIMIZ (1 << 4)
  299. #define GHWCFG4_NUM_DEV_PERIO_IN_EP_MASK (0xf << 0)
  300. #define GHWCFG4_NUM_DEV_PERIO_IN_EP_SHIFT 0
  301. #define GLPMCFG HSOTG_REG(0x0054)
  302. #define GLPMCFG_INV_SEL_HSIC (1 << 31)
  303. #define GLPMCFG_HSIC_CONNECT (1 << 30)
  304. #define GLPMCFG_RETRY_COUNT_STS_MASK (0x7 << 25)
  305. #define GLPMCFG_RETRY_COUNT_STS_SHIFT 25
  306. #define GLPMCFG_SEND_LPM (1 << 24)
  307. #define GLPMCFG_RETRY_COUNT_MASK (0x7 << 21)
  308. #define GLPMCFG_RETRY_COUNT_SHIFT 21
  309. #define GLPMCFG_LPM_CHAN_INDEX_MASK (0xf << 17)
  310. #define GLPMCFG_LPM_CHAN_INDEX_SHIFT 17
  311. #define GLPMCFG_SLEEP_STATE_RESUMEOK (1 << 16)
  312. #define GLPMCFG_PRT_SLEEP_STS (1 << 15)
  313. #define GLPMCFG_LPM_RESP_MASK (0x3 << 13)
  314. #define GLPMCFG_LPM_RESP_SHIFT 13
  315. #define GLPMCFG_HIRD_THRES_MASK (0x1f << 8)
  316. #define GLPMCFG_HIRD_THRES_SHIFT 8
  317. #define GLPMCFG_HIRD_THRES_EN (0x10 << 8)
  318. #define GLPMCFG_EN_UTMI_SLEEP (1 << 7)
  319. #define GLPMCFG_REM_WKUP_EN (1 << 6)
  320. #define GLPMCFG_HIRD_MASK (0xf << 2)
  321. #define GLPMCFG_HIRD_SHIFT 2
  322. #define GLPMCFG_APPL_RESP (1 << 1)
  323. #define GLPMCFG_LPM_CAP_EN (1 << 0)
  324. #define GPWRDN HSOTG_REG(0x0058)
  325. #define GPWRDN_MULT_VAL_ID_BC_MASK (0x1f << 24)
  326. #define GPWRDN_MULT_VAL_ID_BC_SHIFT 24
  327. #define GPWRDN_ADP_INT (1 << 23)
  328. #define GPWRDN_BSESSVLD (1 << 22)
  329. #define GPWRDN_IDSTS (1 << 21)
  330. #define GPWRDN_LINESTATE_MASK (0x3 << 19)
  331. #define GPWRDN_LINESTATE_SHIFT 19
  332. #define GPWRDN_STS_CHGINT_MSK (1 << 18)
  333. #define GPWRDN_STS_CHGINT (1 << 17)
  334. #define GPWRDN_SRP_DET_MSK (1 << 16)
  335. #define GPWRDN_SRP_DET (1 << 15)
  336. #define GPWRDN_CONNECT_DET_MSK (1 << 14)
  337. #define GPWRDN_CONNECT_DET (1 << 13)
  338. #define GPWRDN_DISCONN_DET_MSK (1 << 12)
  339. #define GPWRDN_DISCONN_DET (1 << 11)
  340. #define GPWRDN_RST_DET_MSK (1 << 10)
  341. #define GPWRDN_RST_DET (1 << 9)
  342. #define GPWRDN_LNSTSCHG_MSK (1 << 8)
  343. #define GPWRDN_LNSTSCHG (1 << 7)
  344. #define GPWRDN_DIS_VBUS (1 << 6)
  345. #define GPWRDN_PWRDNSWTCH (1 << 5)
  346. #define GPWRDN_PWRDNRSTN (1 << 4)
  347. #define GPWRDN_PWRDNCLMP (1 << 3)
  348. #define GPWRDN_RESTORE (1 << 2)
  349. #define GPWRDN_PMUACTV (1 << 1)
  350. #define GPWRDN_PMUINTSEL (1 << 0)
  351. #define GDFIFOCFG HSOTG_REG(0x005c)
  352. #define GDFIFOCFG_EPINFOBASE_MASK (0xffff << 16)
  353. #define GDFIFOCFG_EPINFOBASE_SHIFT 16
  354. #define GDFIFOCFG_GDFIFOCFG_MASK (0xffff << 0)
  355. #define GDFIFOCFG_GDFIFOCFG_SHIFT 0
  356. #define ADPCTL HSOTG_REG(0x0060)
  357. #define ADPCTL_AR_MASK (0x3 << 27)
  358. #define ADPCTL_AR_SHIFT 27
  359. #define ADPCTL_ADP_TMOUT_INT_MSK (1 << 26)
  360. #define ADPCTL_ADP_SNS_INT_MSK (1 << 25)
  361. #define ADPCTL_ADP_PRB_INT_MSK (1 << 24)
  362. #define ADPCTL_ADP_TMOUT_INT (1 << 23)
  363. #define ADPCTL_ADP_SNS_INT (1 << 22)
  364. #define ADPCTL_ADP_PRB_INT (1 << 21)
  365. #define ADPCTL_ADPENA (1 << 20)
  366. #define ADPCTL_ADPRES (1 << 19)
  367. #define ADPCTL_ENASNS (1 << 18)
  368. #define ADPCTL_ENAPRB (1 << 17)
  369. #define ADPCTL_RTIM_MASK (0x7ff << 6)
  370. #define ADPCTL_RTIM_SHIFT 6
  371. #define ADPCTL_PRB_PER_MASK (0x3 << 4)
  372. #define ADPCTL_PRB_PER_SHIFT 4
  373. #define ADPCTL_PRB_DELTA_MASK (0x3 << 2)
  374. #define ADPCTL_PRB_DELTA_SHIFT 2
  375. #define ADPCTL_PRB_DSCHRG_MASK (0x3 << 0)
  376. #define ADPCTL_PRB_DSCHRG_SHIFT 0
  377. #define HPTXFSIZ HSOTG_REG(0x100)
  378. /* Use FIFOSIZE_* constants to access this register */
  379. #define DPTXFSIZN(_a) HSOTG_REG(0x104 + (((_a) - 1) * 4))
  380. /* Use FIFOSIZE_* constants to access this register */
  381. /* These apply to the GNPTXFSIZ, HPTXFSIZ and DPTXFSIZN registers */
  382. #define FIFOSIZE_DEPTH_MASK (0xffff << 16)
  383. #define FIFOSIZE_DEPTH_SHIFT 16
  384. #define FIFOSIZE_STARTADDR_MASK (0xffff << 0)
  385. #define FIFOSIZE_STARTADDR_SHIFT 0
  386. #define FIFOSIZE_DEPTH_GET(_x) (((_x) >> 16) & 0xffff)
  387. /* Device mode registers */
  388. #define DCFG HSOTG_REG(0x800)
  389. #define DCFG_EPMISCNT_MASK (0x1f << 18)
  390. #define DCFG_EPMISCNT_SHIFT 18
  391. #define DCFG_EPMISCNT_LIMIT 0x1f
  392. #define DCFG_EPMISCNT(_x) ((_x) << 18)
  393. #define DCFG_PERFRINT_MASK (0x3 << 11)
  394. #define DCFG_PERFRINT_SHIFT 11
  395. #define DCFG_PERFRINT_LIMIT 0x3
  396. #define DCFG_PERFRINT(_x) ((_x) << 11)
  397. #define DCFG_DEVADDR_MASK (0x7f << 4)
  398. #define DCFG_DEVADDR_SHIFT 4
  399. #define DCFG_DEVADDR_LIMIT 0x7f
  400. #define DCFG_DEVADDR(_x) ((_x) << 4)
  401. #define DCFG_NZ_STS_OUT_HSHK (1 << 2)
  402. #define DCFG_DEVSPD_MASK (0x3 << 0)
  403. #define DCFG_DEVSPD_SHIFT 0
  404. #define DCFG_DEVSPD_HS 0
  405. #define DCFG_DEVSPD_FS 1
  406. #define DCFG_DEVSPD_LS 2
  407. #define DCFG_DEVSPD_FS48 3
  408. #define DCTL HSOTG_REG(0x804)
  409. #define DCTL_PWRONPRGDONE (1 << 11)
  410. #define DCTL_CGOUTNAK (1 << 10)
  411. #define DCTL_SGOUTNAK (1 << 9)
  412. #define DCTL_CGNPINNAK (1 << 8)
  413. #define DCTL_SGNPINNAK (1 << 7)
  414. #define DCTL_TSTCTL_MASK (0x7 << 4)
  415. #define DCTL_TSTCTL_SHIFT 4
  416. #define DCTL_GOUTNAKSTS (1 << 3)
  417. #define DCTL_GNPINNAKSTS (1 << 2)
  418. #define DCTL_SFTDISCON (1 << 1)
  419. #define DCTL_RMTWKUPSIG (1 << 0)
  420. #define DSTS HSOTG_REG(0x808)
  421. #define DSTS_SOFFN_MASK (0x3fff << 8)
  422. #define DSTS_SOFFN_SHIFT 8
  423. #define DSTS_SOFFN_LIMIT 0x3fff
  424. #define DSTS_SOFFN(_x) ((_x) << 8)
  425. #define DSTS_ERRATICERR (1 << 3)
  426. #define DSTS_ENUMSPD_MASK (0x3 << 1)
  427. #define DSTS_ENUMSPD_SHIFT 1
  428. #define DSTS_ENUMSPD_HS 0
  429. #define DSTS_ENUMSPD_FS 1
  430. #define DSTS_ENUMSPD_LS 2
  431. #define DSTS_ENUMSPD_FS48 3
  432. #define DSTS_SUSPSTS (1 << 0)
  433. #define DIEPMSK HSOTG_REG(0x810)
  434. #define DIEPMSK_NAKMSK (1 << 13)
  435. #define DIEPMSK_BNAININTRMSK (1 << 9)
  436. #define DIEPMSK_TXFIFOUNDRNMSK (1 << 8)
  437. #define DIEPMSK_TXFIFOEMPTY (1 << 7)
  438. #define DIEPMSK_INEPNAKEFFMSK (1 << 6)
  439. #define DIEPMSK_INTKNEPMISMSK (1 << 5)
  440. #define DIEPMSK_INTKNTXFEMPMSK (1 << 4)
  441. #define DIEPMSK_TIMEOUTMSK (1 << 3)
  442. #define DIEPMSK_AHBERRMSK (1 << 2)
  443. #define DIEPMSK_EPDISBLDMSK (1 << 1)
  444. #define DIEPMSK_XFERCOMPLMSK (1 << 0)
  445. #define DOEPMSK HSOTG_REG(0x814)
  446. #define DOEPMSK_BACK2BACKSETUP (1 << 6)
  447. #define DOEPMSK_STSPHSERCVDMSK (1 << 5)
  448. #define DOEPMSK_OUTTKNEPDISMSK (1 << 4)
  449. #define DOEPMSK_SETUPMSK (1 << 3)
  450. #define DOEPMSK_AHBERRMSK (1 << 2)
  451. #define DOEPMSK_EPDISBLDMSK (1 << 1)
  452. #define DOEPMSK_XFERCOMPLMSK (1 << 0)
  453. #define DAINT HSOTG_REG(0x818)
  454. #define DAINTMSK HSOTG_REG(0x81C)
  455. #define DAINT_OUTEP_SHIFT 16
  456. #define DAINT_OUTEP(_x) (1 << ((_x) + 16))
  457. #define DAINT_INEP(_x) (1 << (_x))
  458. #define DTKNQR1 HSOTG_REG(0x820)
  459. #define DTKNQR2 HSOTG_REG(0x824)
  460. #define DTKNQR3 HSOTG_REG(0x830)
  461. #define DTKNQR4 HSOTG_REG(0x834)
  462. #define DIEPEMPMSK HSOTG_REG(0x834)
  463. #define DVBUSDIS HSOTG_REG(0x828)
  464. #define DVBUSPULSE HSOTG_REG(0x82C)
  465. #define DIEPCTL0 HSOTG_REG(0x900)
  466. #define DIEPCTL(_a) HSOTG_REG(0x900 + ((_a) * 0x20))
  467. #define DOEPCTL0 HSOTG_REG(0xB00)
  468. #define DOEPCTL(_a) HSOTG_REG(0xB00 + ((_a) * 0x20))
  469. /* EP0 specialness:
  470. * bits[29..28] - reserved (no SetD0PID, SetD1PID)
  471. * bits[25..22] - should always be zero, this isn't a periodic endpoint
  472. * bits[10..0] - MPS setting different for EP0
  473. */
  474. #define D0EPCTL_MPS_MASK (0x3 << 0)
  475. #define D0EPCTL_MPS_SHIFT 0
  476. #define D0EPCTL_MPS_64 0
  477. #define D0EPCTL_MPS_32 1
  478. #define D0EPCTL_MPS_16 2
  479. #define D0EPCTL_MPS_8 3
  480. #define DXEPCTL_EPENA (1 << 31)
  481. #define DXEPCTL_EPDIS (1 << 30)
  482. #define DXEPCTL_SETD1PID (1 << 29)
  483. #define DXEPCTL_SETODDFR (1 << 29)
  484. #define DXEPCTL_SETD0PID (1 << 28)
  485. #define DXEPCTL_SETEVENFR (1 << 28)
  486. #define DXEPCTL_SNAK (1 << 27)
  487. #define DXEPCTL_CNAK (1 << 26)
  488. #define DXEPCTL_TXFNUM_MASK (0xf << 22)
  489. #define DXEPCTL_TXFNUM_SHIFT 22
  490. #define DXEPCTL_TXFNUM_LIMIT 0xf
  491. #define DXEPCTL_TXFNUM(_x) ((_x) << 22)
  492. #define DXEPCTL_STALL (1 << 21)
  493. #define DXEPCTL_SNP (1 << 20)
  494. #define DXEPCTL_EPTYPE_MASK (0x3 << 18)
  495. #define DXEPCTL_EPTYPE_CONTROL (0x0 << 18)
  496. #define DXEPCTL_EPTYPE_ISO (0x1 << 18)
  497. #define DXEPCTL_EPTYPE_BULK (0x2 << 18)
  498. #define DXEPCTL_EPTYPE_INTERRUPT (0x3 << 18)
  499. #define DXEPCTL_NAKSTS (1 << 17)
  500. #define DXEPCTL_DPID (1 << 16)
  501. #define DXEPCTL_EOFRNUM (1 << 16)
  502. #define DXEPCTL_USBACTEP (1 << 15)
  503. #define DXEPCTL_NEXTEP_MASK (0xf << 11)
  504. #define DXEPCTL_NEXTEP_SHIFT 11
  505. #define DXEPCTL_NEXTEP_LIMIT 0xf
  506. #define DXEPCTL_NEXTEP(_x) ((_x) << 11)
  507. #define DXEPCTL_MPS_MASK (0x7ff << 0)
  508. #define DXEPCTL_MPS_SHIFT 0
  509. #define DXEPCTL_MPS_LIMIT 0x7ff
  510. #define DXEPCTL_MPS(_x) ((_x) << 0)
  511. #define DIEPINT(_a) HSOTG_REG(0x908 + ((_a) * 0x20))
  512. #define DOEPINT(_a) HSOTG_REG(0xB08 + ((_a) * 0x20))
  513. #define DXEPINT_SETUP_RCVD (1 << 15)
  514. #define DXEPINT_NYETINTRPT (1 << 14)
  515. #define DXEPINT_NAKINTRPT (1 << 13)
  516. #define DXEPINT_BBLEERRINTRPT (1 << 12)
  517. #define DXEPINT_PKTDRPSTS (1 << 11)
  518. #define DXEPINT_BNAINTR (1 << 9)
  519. #define DXEPINT_TXFIFOUNDRN (1 << 8)
  520. #define DXEPINT_OUTPKTERR (1 << 8)
  521. #define DXEPINT_TXFEMP (1 << 7)
  522. #define DXEPINT_INEPNAKEFF (1 << 6)
  523. #define DXEPINT_BACK2BACKSETUP (1 << 6)
  524. #define DXEPINT_INTKNEPMIS (1 << 5)
  525. #define DXEPINT_STSPHSERCVD (1 << 5)
  526. #define DXEPINT_INTKNTXFEMP (1 << 4)
  527. #define DXEPINT_OUTTKNEPDIS (1 << 4)
  528. #define DXEPINT_TIMEOUT (1 << 3)
  529. #define DXEPINT_SETUP (1 << 3)
  530. #define DXEPINT_AHBERR (1 << 2)
  531. #define DXEPINT_EPDISBLD (1 << 1)
  532. #define DXEPINT_XFERCOMPL (1 << 0)
  533. #define DIEPTSIZ0 HSOTG_REG(0x910)
  534. #define DIEPTSIZ0_PKTCNT_MASK (0x3 << 19)
  535. #define DIEPTSIZ0_PKTCNT_SHIFT 19
  536. #define DIEPTSIZ0_PKTCNT_LIMIT 0x3
  537. #define DIEPTSIZ0_PKTCNT(_x) ((_x) << 19)
  538. #define DIEPTSIZ0_XFERSIZE_MASK (0x7f << 0)
  539. #define DIEPTSIZ0_XFERSIZE_SHIFT 0
  540. #define DIEPTSIZ0_XFERSIZE_LIMIT 0x7f
  541. #define DIEPTSIZ0_XFERSIZE(_x) ((_x) << 0)
  542. #define DOEPTSIZ0 HSOTG_REG(0xB10)
  543. #define DOEPTSIZ0_SUPCNT_MASK (0x3 << 29)
  544. #define DOEPTSIZ0_SUPCNT_SHIFT 29
  545. #define DOEPTSIZ0_SUPCNT_LIMIT 0x3
  546. #define DOEPTSIZ0_SUPCNT(_x) ((_x) << 29)
  547. #define DOEPTSIZ0_PKTCNT (1 << 19)
  548. #define DOEPTSIZ0_XFERSIZE_MASK (0x7f << 0)
  549. #define DOEPTSIZ0_XFERSIZE_SHIFT 0
  550. #define DIEPTSIZ(_a) HSOTG_REG(0x910 + ((_a) * 0x20))
  551. #define DOEPTSIZ(_a) HSOTG_REG(0xB10 + ((_a) * 0x20))
  552. #define DXEPTSIZ_MC_MASK (0x3 << 29)
  553. #define DXEPTSIZ_MC_SHIFT 29
  554. #define DXEPTSIZ_MC_LIMIT 0x3
  555. #define DXEPTSIZ_MC(_x) ((_x) << 29)
  556. #define DXEPTSIZ_PKTCNT_MASK (0x3ff << 19)
  557. #define DXEPTSIZ_PKTCNT_SHIFT 19
  558. #define DXEPTSIZ_PKTCNT_LIMIT 0x3ff
  559. #define DXEPTSIZ_PKTCNT_GET(_v) (((_v) >> 19) & 0x3ff)
  560. #define DXEPTSIZ_PKTCNT(_x) ((_x) << 19)
  561. #define DXEPTSIZ_XFERSIZE_MASK (0x7ffff << 0)
  562. #define DXEPTSIZ_XFERSIZE_SHIFT 0
  563. #define DXEPTSIZ_XFERSIZE_LIMIT 0x7ffff
  564. #define DXEPTSIZ_XFERSIZE_GET(_v) (((_v) >> 0) & 0x7ffff)
  565. #define DXEPTSIZ_XFERSIZE(_x) ((_x) << 0)
  566. #define DIEPDMA(_a) HSOTG_REG(0x914 + ((_a) * 0x20))
  567. #define DOEPDMA(_a) HSOTG_REG(0xB14 + ((_a) * 0x20))
  568. #define DTXFSTS(_a) HSOTG_REG(0x918 + ((_a) * 0x20))
  569. #define PCGCTL HSOTG_REG(0x0e00)
  570. #define PCGCTL_IF_DEV_MODE (1 << 31)
  571. #define PCGCTL_P2HD_PRT_SPD_MASK (0x3 << 29)
  572. #define PCGCTL_P2HD_PRT_SPD_SHIFT 29
  573. #define PCGCTL_P2HD_DEV_ENUM_SPD_MASK (0x3 << 27)
  574. #define PCGCTL_P2HD_DEV_ENUM_SPD_SHIFT 27
  575. #define PCGCTL_MAC_DEV_ADDR_MASK (0x7f << 20)
  576. #define PCGCTL_MAC_DEV_ADDR_SHIFT 20
  577. #define PCGCTL_MAX_TERMSEL (1 << 19)
  578. #define PCGCTL_MAX_XCVRSELECT_MASK (0x3 << 17)
  579. #define PCGCTL_MAX_XCVRSELECT_SHIFT 17
  580. #define PCGCTL_PORT_POWER (1 << 16)
  581. #define PCGCTL_PRT_CLK_SEL_MASK (0x3 << 14)
  582. #define PCGCTL_PRT_CLK_SEL_SHIFT 14
  583. #define PCGCTL_ESS_REG_RESTORED (1 << 13)
  584. #define PCGCTL_EXTND_HIBER_SWITCH (1 << 12)
  585. #define PCGCTL_EXTND_HIBER_PWRCLMP (1 << 11)
  586. #define PCGCTL_ENBL_EXTND_HIBER (1 << 10)
  587. #define PCGCTL_RESTOREMODE (1 << 9)
  588. #define PCGCTL_RESETAFTSUSP (1 << 8)
  589. #define PCGCTL_DEEP_SLEEP (1 << 7)
  590. #define PCGCTL_PHY_IN_SLEEP (1 << 6)
  591. #define PCGCTL_ENBL_SLEEP_GATING (1 << 5)
  592. #define PCGCTL_RSTPDWNMODULE (1 << 3)
  593. #define PCGCTL_PWRCLMP (1 << 2)
  594. #define PCGCTL_GATEHCLK (1 << 1)
  595. #define PCGCTL_STOPPCLK (1 << 0)
  596. #define EPFIFO(_a) HSOTG_REG(0x1000 + ((_a) * 0x1000))
  597. /* Host Mode Registers */
  598. #define HCFG HSOTG_REG(0x0400)
  599. #define HCFG_MODECHTIMEN (1 << 31)
  600. #define HCFG_PERSCHEDENA (1 << 26)
  601. #define HCFG_FRLISTEN_MASK (0x3 << 24)
  602. #define HCFG_FRLISTEN_SHIFT 24
  603. #define HCFG_FRLISTEN_8 (0 << 24)
  604. #define FRLISTEN_8_SIZE 8
  605. #define HCFG_FRLISTEN_16 (1 << 24)
  606. #define FRLISTEN_16_SIZE 16
  607. #define HCFG_FRLISTEN_32 (2 << 24)
  608. #define FRLISTEN_32_SIZE 32
  609. #define HCFG_FRLISTEN_64 (3 << 24)
  610. #define FRLISTEN_64_SIZE 64
  611. #define HCFG_DESCDMA (1 << 23)
  612. #define HCFG_RESVALID_MASK (0xff << 8)
  613. #define HCFG_RESVALID_SHIFT 8
  614. #define HCFG_ENA32KHZ (1 << 7)
  615. #define HCFG_FSLSSUPP (1 << 2)
  616. #define HCFG_FSLSPCLKSEL_MASK (0x3 << 0)
  617. #define HCFG_FSLSPCLKSEL_SHIFT 0
  618. #define HCFG_FSLSPCLKSEL_30_60_MHZ 0
  619. #define HCFG_FSLSPCLKSEL_48_MHZ 1
  620. #define HCFG_FSLSPCLKSEL_6_MHZ 2
  621. #define HFIR HSOTG_REG(0x0404)
  622. #define HFIR_FRINT_MASK (0xffff << 0)
  623. #define HFIR_FRINT_SHIFT 0
  624. #define HFIR_RLDCTRL (1 << 16)
  625. #define HFNUM HSOTG_REG(0x0408)
  626. #define HFNUM_FRREM_MASK (0xffff << 16)
  627. #define HFNUM_FRREM_SHIFT 16
  628. #define HFNUM_FRNUM_MASK (0xffff << 0)
  629. #define HFNUM_FRNUM_SHIFT 0
  630. #define HFNUM_MAX_FRNUM 0x3fff
  631. #define HPTXSTS HSOTG_REG(0x0410)
  632. #define TXSTS_QTOP_ODD (1 << 31)
  633. #define TXSTS_QTOP_CHNEP_MASK (0xf << 27)
  634. #define TXSTS_QTOP_CHNEP_SHIFT 27
  635. #define TXSTS_QTOP_TOKEN_MASK (0x3 << 25)
  636. #define TXSTS_QTOP_TOKEN_SHIFT 25
  637. #define TXSTS_QTOP_TERMINATE (1 << 24)
  638. #define TXSTS_QSPCAVAIL_MASK (0xff << 16)
  639. #define TXSTS_QSPCAVAIL_SHIFT 16
  640. #define TXSTS_FSPCAVAIL_MASK (0xffff << 0)
  641. #define TXSTS_FSPCAVAIL_SHIFT 0
  642. #define HAINT HSOTG_REG(0x0414)
  643. #define HAINTMSK HSOTG_REG(0x0418)
  644. #define HFLBADDR HSOTG_REG(0x041c)
  645. #define HPRT0 HSOTG_REG(0x0440)
  646. #define HPRT0_SPD_MASK (0x3 << 17)
  647. #define HPRT0_SPD_SHIFT 17
  648. #define HPRT0_SPD_HIGH_SPEED 0
  649. #define HPRT0_SPD_FULL_SPEED 1
  650. #define HPRT0_SPD_LOW_SPEED 2
  651. #define HPRT0_TSTCTL_MASK (0xf << 13)
  652. #define HPRT0_TSTCTL_SHIFT 13
  653. #define HPRT0_PWR (1 << 12)
  654. #define HPRT0_LNSTS_MASK (0x3 << 10)
  655. #define HPRT0_LNSTS_SHIFT 10
  656. #define HPRT0_RST (1 << 8)
  657. #define HPRT0_SUSP (1 << 7)
  658. #define HPRT0_RES (1 << 6)
  659. #define HPRT0_OVRCURRCHG (1 << 5)
  660. #define HPRT0_OVRCURRACT (1 << 4)
  661. #define HPRT0_ENACHG (1 << 3)
  662. #define HPRT0_ENA (1 << 2)
  663. #define HPRT0_CONNDET (1 << 1)
  664. #define HPRT0_CONNSTS (1 << 0)
  665. #define HCCHAR(_ch) HSOTG_REG(0x0500 + 0x20 * (_ch))
  666. #define HCCHAR_CHENA (1 << 31)
  667. #define HCCHAR_CHDIS (1 << 30)
  668. #define HCCHAR_ODDFRM (1 << 29)
  669. #define HCCHAR_DEVADDR_MASK (0x7f << 22)
  670. #define HCCHAR_DEVADDR_SHIFT 22
  671. #define HCCHAR_MULTICNT_MASK (0x3 << 20)
  672. #define HCCHAR_MULTICNT_SHIFT 20
  673. #define HCCHAR_EPTYPE_MASK (0x3 << 18)
  674. #define HCCHAR_EPTYPE_SHIFT 18
  675. #define HCCHAR_LSPDDEV (1 << 17)
  676. #define HCCHAR_EPDIR (1 << 15)
  677. #define HCCHAR_EPNUM_MASK (0xf << 11)
  678. #define HCCHAR_EPNUM_SHIFT 11
  679. #define HCCHAR_MPS_MASK (0x7ff << 0)
  680. #define HCCHAR_MPS_SHIFT 0
  681. #define HCSPLT(_ch) HSOTG_REG(0x0504 + 0x20 * (_ch))
  682. #define HCSPLT_SPLTENA (1 << 31)
  683. #define HCSPLT_COMPSPLT (1 << 16)
  684. #define HCSPLT_XACTPOS_MASK (0x3 << 14)
  685. #define HCSPLT_XACTPOS_SHIFT 14
  686. #define HCSPLT_XACTPOS_MID 0
  687. #define HCSPLT_XACTPOS_END 1
  688. #define HCSPLT_XACTPOS_BEGIN 2
  689. #define HCSPLT_XACTPOS_ALL 3
  690. #define HCSPLT_HUBADDR_MASK (0x7f << 7)
  691. #define HCSPLT_HUBADDR_SHIFT 7
  692. #define HCSPLT_PRTADDR_MASK (0x7f << 0)
  693. #define HCSPLT_PRTADDR_SHIFT 0
  694. #define HCINT(_ch) HSOTG_REG(0x0508 + 0x20 * (_ch))
  695. #define HCINTMSK(_ch) HSOTG_REG(0x050c + 0x20 * (_ch))
  696. #define HCINTMSK_RESERVED14_31 (0x3ffff << 14)
  697. #define HCINTMSK_FRM_LIST_ROLL (1 << 13)
  698. #define HCINTMSK_XCS_XACT (1 << 12)
  699. #define HCINTMSK_BNA (1 << 11)
  700. #define HCINTMSK_DATATGLERR (1 << 10)
  701. #define HCINTMSK_FRMOVRUN (1 << 9)
  702. #define HCINTMSK_BBLERR (1 << 8)
  703. #define HCINTMSK_XACTERR (1 << 7)
  704. #define HCINTMSK_NYET (1 << 6)
  705. #define HCINTMSK_ACK (1 << 5)
  706. #define HCINTMSK_NAK (1 << 4)
  707. #define HCINTMSK_STALL (1 << 3)
  708. #define HCINTMSK_AHBERR (1 << 2)
  709. #define HCINTMSK_CHHLTD (1 << 1)
  710. #define HCINTMSK_XFERCOMPL (1 << 0)
  711. #define HCTSIZ(_ch) HSOTG_REG(0x0510 + 0x20 * (_ch))
  712. #define TSIZ_DOPNG (1 << 31)
  713. #define TSIZ_SC_MC_PID_MASK (0x3 << 29)
  714. #define TSIZ_SC_MC_PID_SHIFT 29
  715. #define TSIZ_SC_MC_PID_DATA0 0
  716. #define TSIZ_SC_MC_PID_DATA2 1
  717. #define TSIZ_SC_MC_PID_DATA1 2
  718. #define TSIZ_SC_MC_PID_MDATA 3
  719. #define TSIZ_SC_MC_PID_SETUP 3
  720. #define TSIZ_PKTCNT_MASK (0x3ff << 19)
  721. #define TSIZ_PKTCNT_SHIFT 19
  722. #define TSIZ_NTD_MASK (0xff << 8)
  723. #define TSIZ_NTD_SHIFT 8
  724. #define TSIZ_SCHINFO_MASK (0xff << 0)
  725. #define TSIZ_SCHINFO_SHIFT 0
  726. #define TSIZ_XFERSIZE_MASK (0x7ffff << 0)
  727. #define TSIZ_XFERSIZE_SHIFT 0
  728. #define HCDMA(_ch) HSOTG_REG(0x0514 + 0x20 * (_ch))
  729. #define HCDMAB(_ch) HSOTG_REG(0x051c + 0x20 * (_ch))
  730. #define HCFIFO(_ch) HSOTG_REG(0x1000 + 0x1000 * (_ch))
  731. /**
  732. * struct dwc2_hcd_dma_desc - Host-mode DMA descriptor structure
  733. *
  734. * @status: DMA descriptor status quadlet
  735. * @buf: DMA descriptor data buffer pointer
  736. *
  737. * DMA Descriptor structure contains two quadlets:
  738. * Status quadlet and Data buffer pointer.
  739. */
  740. struct dwc2_hcd_dma_desc {
  741. u32 status;
  742. u32 buf;
  743. };
  744. #define HOST_DMA_A (1 << 31)
  745. #define HOST_DMA_STS_MASK (0x3 << 28)
  746. #define HOST_DMA_STS_SHIFT 28
  747. #define HOST_DMA_STS_PKTERR (1 << 28)
  748. #define HOST_DMA_EOL (1 << 26)
  749. #define HOST_DMA_IOC (1 << 25)
  750. #define HOST_DMA_SUP (1 << 24)
  751. #define HOST_DMA_ALT_QTD (1 << 23)
  752. #define HOST_DMA_QTD_OFFSET_MASK (0x3f << 17)
  753. #define HOST_DMA_QTD_OFFSET_SHIFT 17
  754. #define HOST_DMA_ISOC_NBYTES_MASK (0xfff << 0)
  755. #define HOST_DMA_ISOC_NBYTES_SHIFT 0
  756. #define HOST_DMA_NBYTES_MASK (0x1ffff << 0)
  757. #define HOST_DMA_NBYTES_SHIFT 0
  758. #define MAX_DMA_DESC_SIZE 131071
  759. #define MAX_DMA_DESC_NUM_GENERIC 64
  760. #define MAX_DMA_DESC_NUM_HS_ISOC 256
  761. #endif /* __DWC2_HW_H__ */