dwhcihw.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. /*++
  2. Copyright (c) 2014 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. dwhcihw.h
  5. Abstract:
  6. This header contains DesignWare Hi-Speed USB 2.0 On-The-Go (HS OTG)
  7. hardware definitions.
  8. Copyright (C) 2004-2013 by Synopsis, Inc.
  9. Redistribution and use in source and binary forms, with or without
  10. modification, are permitted provided that the following conditions are met:
  11. 1. Redistributions of source code must retain the above copyright notice,
  12. this list of conditions, and the following disclaimer, without
  13. modification.
  14. 2. Redistributions in binary form must reproduce the above copyright
  15. notice, this list of conditions and the following disclaimer in the
  16. documentation and/or other materials provided with the distribution.
  17. 3. The names of the above-listed copyright holders may not be used to
  18. endorse or promote products derived from this software without specific
  19. prior written permission.
  20. This software is provided by the copyright holders and contributors "AS IS"
  21. and any express or implied warranties, including, by not limited to, the
  22. implied warranties or mechantability and fitness for a particular purpose
  23. are disclained. In no event shall the copyright owner or contributors be
  24. liable for any direct, indirect, incidental, special, exemplary, or
  25. consequential damages (including, but not limited to, procurement of
  26. substitue goods or services; loss of use, data, or profits; or business
  27. interruption) however caused and on any theory of liability, whether in
  28. contract, strict liability, or tort (including negligence or otherwise)
  29. arising in any way out of the use of this software, even if advised of the
  30. possibility of such damage.
  31. Author:
  32. Chris Stevens 27-Mar-2014
  33. --*/
  34. //
  35. // ------------------------------------------------------------------- Includes
  36. //
  37. //
  38. // ---------------------------------------------------------------- Definitions
  39. //
  40. //
  41. // Define the number of host ports.
  42. //
  43. #define DWHCI_HOST_PORT_COUNT 1
  44. //
  45. // Define the flags for the OTG control register.
  46. //
  47. #define DWHCI_OTG_CONTROL_OTG_VERSION (1 << 20)
  48. #define DWHCI_OTG_CONTROL_HOST_SET_HNP_ENABLE (1 << 10)
  49. //
  50. // Define the flags for the AHB configuration register.
  51. //
  52. #define DWHCI_AHB_CONFIGURATION_DMA_REMAINDER_MODE_INCREMENTAL (0x0 << 23)
  53. #define DWHCI_AHB_CONFIGURATION_DMA_REMAINDER_MODE_SINGLE (0x1 << 23)
  54. #define DWHCI_AHB_CONFIGURATION_DMA_REMAINDER_MODE_MASK (0x1 << 23)
  55. #define DWHCI_AHB_CONFIGURATION_DMA_REMAINDER_MODE_SHIFT 23
  56. #define DWHCI_AHB_CONFIGURATION_NOTIFY_ALL_DMA_WRITES (1 << 22)
  57. #define DWHCI_AHB_CONFIGURATION_REMOTE_MEMORY_SUPPORTED (1 << 21)
  58. #define DWHCI_AHB_CONFIGURATION_PERIODIC_TRANSFER_EMPTY (1 << 8)
  59. #define DWHCI_AHB_CONFIGURATION_TRANSFER_EMPTY (1 << 7)
  60. #define DWHCI_AHB_CONFIGURATION_DMA_ENABLE (1 << 5)
  61. #define DWHCI_AHB_CONFIGURATION_WAIT_FOR_AXI_WRITES (1 << 4)
  62. #define DWHCI_AHB_CONFIGURATION_AXI_BURST_LENGTH_SINGLE (0x0 << 1)
  63. #define DWHCI_AHB_CONFIGURATION_AXI_BURST_LENGTH_INCREMENT_2 (0x1 << 1)
  64. #define DWHCI_AHB_CONFIGURATION_AXI_BURST_LENGTH_INCREMENT_4 (0x3 << 1)
  65. #define DWHCI_AHB_CONFIGURATION_AXI_BURST_LENGTH_INCREMENT_8 (0x5 << 1)
  66. #define DWHCI_AHB_CONFIGURATION_AXI_BURST_LENGTH_INCREMENT_16 (0x7 << 1)
  67. #define DWHCI_AHB_CONFIGURATION_AXI_BURST_LENGTH_MASK (0xF << 1)
  68. #define DWHCI_AHB_CONFIGURATION_AXI_BURST_LENGTH_SHIFT 1
  69. #define DWHCI_AHB_CONFIGURATION_INTERRUPT_ENABLE (1 << 0)
  70. //
  71. // Define the flags for the USB configuration register.
  72. //
  73. #define DWHCI_USB_CONFIGURATION_FORCE_DEVICE_MODE (1 << 30)
  74. #define DWHCI_USB_CONFIGURATION_FORCE_HOST_MODE (1 << 29)
  75. #define DWHCI_USB_CONFIGURATION_TRANSMIT_END_DEALY (1 << 28)
  76. #define DWHCI_USB_CONFIGURATION_IC_TRAFFIC_PULL_REMOVE (1 << 27)
  77. #define DWHCI_USB_CONFIGURATION_IC_USB_CAPABLE (1 << 26)
  78. #define DWHCI_USB_CONFIGURATION_ULPI_INTERRUPT_PROT_DISABLED (1 << 25)
  79. #define DWHCI_USB_CONFIGURATION_INDICATOR_PASS_THROUGH (1 << 24)
  80. #define DWHCI_USB_CONFIGURATION_INDICATOR_COMPLEMENT (1 << 23)
  81. #define DWHCI_USB_CONFIGURATION_TS_DLINE_PULSE_ENABLE (1 << 22)
  82. #define DWHCI_USB_CONFIGURATION_ULPI_INTERRUPT_VBUS_INDICATOR (1 << 21)
  83. #define DWHCI_USB_CONFIGURATION_ULPI_DRIVER_EXTERNAL_VBUS (1 << 20)
  84. #define DWHCI_USB_CONFIGURATION_ULPI_CLOCK_SUSPEND_MODE (1 << 19)
  85. #define DWHCI_USB_CONFIGURATION_ULPI_AUTO_RESET (1 << 18)
  86. #define DWHCI_USB_CONFIGURATION_ULPI_FULL_SPEED_LOW_SPEED_SELECT (1 << 17)
  87. #define DWHCI_USB_CONFIGURATION_OTG_UTMI_FULL_SPEED_SELECT (1 << 16)
  88. #define DWHCI_USB_CONFIGURATION_PHY_LOW_POWER_LOCK_SELECT (1 << 15)
  89. #define DWHCI_USB_CONFIGURATION_USB_TRIED_TIME_MASK (0xF << 10)
  90. #define DWHCI_USB_CONFIGURATION_USB_TRIED_TIME_SHIFT 10
  91. #define DWHCI_USB_CONFIGURATION_HNP_CAPABLE (1 << 9)
  92. #define DWHCI_USB_CONFIGURATION_SRP_CAPABLE (1 << 8)
  93. #define DWHCI_USB_CONFIGURATION_DDR_SELECT (1 << 7)
  94. #define DWHCI_USB_CONFIGURATION_PHY_SELECT (1 << 6)
  95. #define DWHCI_USB_CONFIGURATION_FULL_SPEED_INTERFACE (1 << 5)
  96. #define DWHCI_USB_CONFIGURATION_MODE_SELECT_UTMI (0x0 << 4)
  97. #define DWHCI_USB_CONFIGURATION_MODE_SELECT_ULPI (0x1 << 4)
  98. #define DWHCI_USB_CONFIGURATION_MODE_SELECT_MASK (0x1 << 4)
  99. #define DWHCI_USB_CONFIGURATION_MODE_SELECT_SHIFT 4
  100. #define DWHCI_USB_CONFIGURATION_PHY_INTERFACE_16 (1 << 3)
  101. #define DWHCI_USB_CONFIGURATION_TIMEOUT_MASK (0x7 << 0)
  102. #define DWHCI_USB_CONFIGURATION_TIMEOUT_SHIFT 0
  103. //
  104. // Define the flags for the core reset register.
  105. //
  106. #define DWHCI_CORE_RESET_AHB_MASTER_IDLE (1 << 31)
  107. #define DWHCI_CORE_RESET_DMA_REQUEST_SIGNAL (1 << 30)
  108. #define DWHCI_CORE_RESET_TRANSMIT_FIFO_FLUSH_ALL (0x10 << 6)
  109. #define DWHCI_CORE_RESET_TRANSMIT_FIFO_FLUSH_PERIODIC_MASK (0xF << 6)
  110. #define DWHCI_CORE_RESET_TRANSMIT_FIFO_FLUSH_PERIODIC_SHIFT 6
  111. #define DWHCI_CORE_RESET_TRANSMIT_FIFO_FLUSH_NON_PERIODIC (0x0 << 6)
  112. #define DWHCI_CORE_RESET_TRANSMIT_FIFO_FLUSH_MASK (0x1F << 6)
  113. #define DWHCI_CORE_RESET_TRANSMIT_FIFO_FLUSH_SHIFT 6
  114. #define DWHCI_CORE_RESET_TRANSMIT_FIFO_FLUSH (1 << 5)
  115. #define DWHCI_CORE_RESET_RECEIVE_FIFO_FLUSH (1 << 4)
  116. #define DWHCI_CORE_RESET_IN_TOKEN_QUEUE_FLUSH (1 << 3)
  117. #define DWHCI_CORE_RESET_HOST_FRAME_COUNTER (1 << 2)
  118. #define DWHCI_CORE_RESET_HOST_SOFT_RESET (1 << 1)
  119. #define DWHCI_CORE_RESET_CORE_SOFT_RESET (1 << 0)
  120. //
  121. // Define the flags for the core interrupts.
  122. //
  123. #define DWHCI_CORE_INTERRUPT_WAKEUP (1 << 31)
  124. #define DWHCI_CORE_INTERRUPT_SESSION_REQUEST (1 << 30)
  125. #define DWHCI_CORE_INTERRUPT_DISCONNECT (1 << 29)
  126. #define DWHCI_CORE_INTERRUPT_CONNECTION_ID_STATUS (1 << 28)
  127. #define DWHCI_CORE_INTERRUPT_LOW_POWER_MODE_TRANSMIT (1 << 27)
  128. #define DWHCI_CORE_INTERRUPT_PERIODIC_FIFO_EMPTY (1 << 26)
  129. #define DWHCI_CORE_INTERRUPT_HOST_CHANNEL (1 << 25)
  130. #define DWHCI_CORE_INTERRUPT_PORT (1 << 24)
  131. #define DWHCI_CORE_INTERRUPT_RESET_DETECTED (1 << 23)
  132. #define DWHCI_CORE_INTERRUPT_FET_SETUP (1 << 22)
  133. #define DWHCI_CORE_INTERRUPT_INCOMPLETE_ISOCHRONOUS_OUT (1 << 21)
  134. #define DWHCI_CORE_INTERRUPT_INCOMPLETE_ISOCHRONOUS_IN (1 << 20)
  135. #define DWHCI_CORE_INTERRUPT_OUT_ENDPOINT (1 << 19)
  136. #define DWHCI_CORE_INTERRUPT_IN_ENDPOINT (1 << 18)
  137. #define DWHCI_CORE_INTERRUPT_ENDPOINT_MISMATCH (1 << 17)
  138. #define DWHCI_CORE_INTERRUPT_RESTORE_COMPLETE (1 << 16)
  139. #define DWHCI_CORE_INTERRUPT_EOP_FRAME (1 << 15)
  140. #define DWHCI_CORE_INTERRUPT_ISOCHRONOUS_OUT_DROP (1 << 14)
  141. #define DWHCI_CORE_INTERRUPT_ENUMERATION_COMPLETE (1 << 13)
  142. #define DWHCI_CORE_INTERRUPT_USB_RESET (1 << 12)
  143. #define DWHCI_CORE_INTERRUPT_USB_SUSPEND (1 << 11)
  144. #define DWHCI_CORE_INTERRUPT_EARLY_SUSPEND (1 << 10)
  145. #define DWHCI_CORE_INTERRUPT_I2C (1 << 9)
  146. #define DWHCI_CORE_INTERRUPT_ULPI (1 << 8)
  147. #define DWHCI_CORE_INTERRUPT_GLOBAL_OUT_NAK (1 << 7)
  148. #define DWHCI_CORE_INTERRUPT_GLOBAL_IN_NAK (1 << 6)
  149. #define DWHCI_CORE_INTERRUPT_NON_PERIODIC_FIFO_EMPTY (1 << 5)
  150. #define DWHCI_CORE_INTERRUPT_RECEIVE_FIFO_PACKET (1 << 4)
  151. #define DWHCI_CORE_INTERRUPT_START_OF_FRAME (1 << 3)
  152. #define DWHCI_CORE_INTERRUPT_OTG (1 << 2)
  153. #define DWHCI_CORE_INTERRUPT_MODE_MISMATCH (1 << 1)
  154. #define DWHCI_CORE_INTERRUPT_HOST_MODE (1 << 0)
  155. //
  156. // Define the flags for the receive FIFO status.
  157. //
  158. #define DWHCI_RECEIVE_FIFO_PACKET_STATUS_NAK (0x1 << 17)
  159. #define DWHCI_RECEIVE_FIFO_PACKET_STATUS_IN (0x2 << 17)
  160. #define DWHCI_RECEIVE_FIFO_PACKET_STATUS_OUT (0x2 << 17)
  161. #define DWHCI_RECEIVE_FIFO_PACKET_STATUS_COMPLETE (0x3 << 17)
  162. #define DWHCI_RECEIVE_FIFO_PACKET_STATUS_SETUP_COMPLETE (0x4 << 17)
  163. #define DWHCI_RECEIVE_FIFO_PACKET_STATUS_DATA_TOGGLE_ERROR (0x5 << 17)
  164. #define DWHCI_RECEIVE_FIFO_PACKET_STATUS_SETUP_RECEVIED (0x6 << 17)
  165. #define DWHCI_RECEIVE_FIFO_PACKET_STATUS_CHANNEL_HALTED (0x7 << 17)
  166. #define DWHCI_RECEIVE_FIFO_PACKET_STATUS_MASK (0xF << 17)
  167. #define DWHCI_RECEIVE_FIFO_PACKET_STATUS_SHIFT 17
  168. #define DWHCI_RECEIVE_FIFO_PID_MASK (0x3 << 15)
  169. #define DWHCI_RECEIVE_FIFO_PID_SHIFT 15
  170. #define DWHCI_RECEIVE_FIFO_TOTAL_BYTES_MASK (0x7FF << 4)
  171. #define DWHCI_RECEIVE_FIFO_TOTAL_BYTES_SHIFT 4
  172. #define DWHCI_RECEIVE_FIFO_CHANNEL_MASK (0xF << 0)
  173. #define DWHCI_RECEIVE_FIFO_CHANNEL_SHIFT 0
  174. //
  175. // Define the flags for the receive FIFO size register.
  176. //
  177. #define DWHCI_RECEIVE_FIFO_SIZE_DEPTH_MASK (0xFFFF << 0)
  178. #define DWHCI_RECEIVE_FIFO_SIZE_DEPTH_SHIFT 0
  179. //
  180. // Define the flags for the transmit FIFO status.
  181. //
  182. #define DWHCI_TRANSMIT_FIFO_ODD (1 << 31)
  183. #define DWHCI_TRANSMIT_FIFO_CHANNEL_MASK (0xF << 27)
  184. #define DWHCI_TRANSMIT_FIFO_CHANNEL_SHIFT 27
  185. #define DWHCI_TRANSMIT_FIFO_TOKEN_TYPE_IN_OUT (0x0 << 25)
  186. #define DWHCI_TRANSMIT_FIFO_TOKEN_TYPE_ZERO_LENGTH_OUT (0x1 << 25)
  187. #define DWHCI_TRANSMIT_FIFO_TOKEN_TYPE_PING_COMPLETE_SPLIT (0x2 << 25)
  188. #define DWHCI_TRANSMIT_FIFO_TOKEN_TYPE_CHANNEL_HALT (0x3 << 25)
  189. #define DWHCI_TRANSMIT_FIFO_TOKEN_TYPE_MASK (0x3 << 25)
  190. #define DWHCI_TRANSMIT_FIFO_TOKEN_TYPE_SHIFT 25
  191. #define DWHCI_TRANSMIT_FIFO_TERMINATE (1 << 24)
  192. #define DWHCI_TRANSMIT_FIFO_QUEUE_SPACE_MASK (0xFF << 16)
  193. #define DWHCI_TRANSMIT_FIFO_QUEUE_SPACE_SHIFT 16
  194. #define DWHCI_TRANSMIT_FIFO_SPACE_MASK (0xFFFF << 0)
  195. #define DWHCI_TRANSMIT_FIFO_SPACE_SHIFT 0
  196. //
  197. // Define the flags for the transmit FIFO size registers.
  198. //
  199. #define DWHCI_TRANSMIT_FIFO_SIZE_DEPTH_MASK (0xFFFF << 16)
  200. #define DWHCI_TRANSMIT_FIFO_SIZE_DEPTH_SHIFT 16
  201. #define DWHCI_TRANSMIT_FIFO_SIZE_START_ADDRESS_MASK (0xFFFF << 0)
  202. #define DWHCI_TRANSMIT_FIFO_SIZE_START_ADDRESS_SHIFT 0
  203. //
  204. // Define the flags for the 2nd host controller hardware register.
  205. //
  206. #define DWHCI_HARDWARE2_ENABLE_IC_USB (1 << 31)
  207. #define DWHCI_HARDWARE2_DEVICE_TOKEN_QUEUE_DEPTH_MASK (0x1F << 26)
  208. #define DWHCI_HARDWARE2_DEVICE_TOKEN_QUEUE_DEPTH_SHIFT 26
  209. #define DWHCI_HARDWARE2_PERIODIC_QUEUE_DEPTH_MASK (0x3 << 24)
  210. #define DWHCI_HARDWARE2_PERIODIC_QUEUE_DEPTH_SHIFT 24
  211. #define DWHCI_HARDWARE2_NON_PERIODIC_QUEUE_DEPTH_MASK (0x3 << 22)
  212. #define DWHCI_HARDWARE2_NON_PERIODIC_QUEUE_DEPTH_SHIFT 22
  213. #define DWHCI_HARDWARE2_MULTI_PROC_INT (0x1 << 20)
  214. #define DWHCI_HARDWARE2_DYNAMIC_FIFO (0x1 << 19)
  215. #define DWHCI_HARDWARE2_SUPPORTS_PERIODIC_ENDPOINTS (0x1 << 18)
  216. #define DWHCI_HARDWARE2_HOST_CHANNEL_COUNT_MASK (0xF << 14)
  217. #define DWHCI_HARDWARE2_HOST_CHANNEL_COUNT_SHIFT 14
  218. #define DWHCI_HARDWARE2_DEVICE_ENDPOINT_COUNT_MASK (0xF << 10)
  219. #define DWHCI_HARDWARE2_DEVICE_ENDPOINT_COUNT_SHIFT 10
  220. #define DWHCI_HARDWARE2_FULL_SPEED_NOT_SUPPORTED (0x0 << 8)
  221. #define DWHCI_HARDWARE2_FULL_SPEED_DEDICATED (0x1 << 8)
  222. #define DWHCI_HARDWARE2_FULL_SPEED_SHARED_ULPI (0x2 << 8)
  223. #define DWHCI_HARDWARE2_FULL_SPEED_SHARED_UTMI (0x3 << 8)
  224. #define DWHCI_HARDWARE2_FULL_SPEED_MASK (0x3 << 8)
  225. #define DWHCI_HARDWARE2_FULL_SPEED_SHIFT 8
  226. #define DWHCI_HARDWARE2_HIGH_SPEED_NOT_SUPPORTED (0x0 << 6)
  227. #define DWHCI_HARDWARE2_HIGH_SPEED_UTMI (0x1 << 6)
  228. #define DWHCI_HARDWARE2_HIGH_SPEED_ULPI (0x2 << 6)
  229. #define DWHCI_HARDWARE2_HIGH_SPEED_UTMI_ULPI (0x3 << 6)
  230. #define DWHCI_HARDWARE2_HIGH_SPEED_MASK (0x3 << 6)
  231. #define DWHCI_HARDWARE2_HIGH_SPEED_SHIFT 6
  232. #define DWHCI_HARDWARE2_POINT_TO_POINT (1 << 5)
  233. #define DWHCI_HARDWARE2_ARCHITECTURE_SLAVE_ONLY (0x0 << 3)
  234. #define DWHCI_HARDWARE2_ARCHITECTURE_EXTERNAL_DMA (0x1 << 3)
  235. #define DWHCI_HARDWARE2_ARCHITECTURE_INTERNAL_DMA (0x2 << 3)
  236. #define DWHCI_HARDWARE2_ARCHITECTURE_MASK (0x3 << 3)
  237. #define DWHCI_HARDWARE2_ARCHITECTURE_SHIFT 3
  238. #define DWHCI_HARDWARE2_MODE_HNP_SRP (0x0 << 0)
  239. #define DWHCI_HARDWARE2_MODE_SRP_ONLY (0x1 << 0)
  240. #define DWHCI_HARDWARE2_MODE_NO_HNP_SRP (0x2 << 0)
  241. #define DWHCI_HARDWARE2_MODE_SRP_DEVICE (0x3 << 0)
  242. #define DWHCI_HARDWARE2_MODE_NO_SRP_DEVICE (0x4 << 0)
  243. #define DWHCI_HARDWARE2_MODE_SRP_HOST (0x5 << 0)
  244. #define DWHCI_HARDWARE2_MODE_NO_SRP_HOST (0x6 << 0)
  245. #define DWHCI_HARDWARE2_MODE_MASK (0x7 << 0)
  246. #define DWHCI_HARDWARE2_MODE_SHIFT 0
  247. //
  248. // Define flags for the 3rd host controller hardware register.
  249. //
  250. #define DWHCI_HARDWARE3_PACKET_COUNT_WIDTH_MASK (0x7 << 4)
  251. #define DWHCI_HARDWARE3_PACKET_COUNT_WIDTH_SHIFT 4
  252. #define DWHCI_HARDWARE3_PACKET_COUNT_WIDTH_OFFSET 4
  253. #define DWHCI_HARDWARE3_TRANSFER_SIZE_WIDTH_MASK (0xf << 0)
  254. #define DWHCI_HARDWARE3_TRANSFER_SIZE_WIDTH_SHIFT 0
  255. #define DWHCI_HARDWARE3_TRANSFER_SIZE_WIDTH_OFFSET 11
  256. //
  257. // Define flags for the 4th host controller hardware register.
  258. //
  259. #define DWHCI_HARDWARE4_DMA_DYNAMIC_DESCRIPTOR_MODE (1 << 31)
  260. #define DWHCI_HARDWARE4_DMA_DESCRIPTOR_MODE (1 << 30)
  261. #define DWHCI_HARDWARE4_IN_ENDPOINT_COUNT_MASK (0xF << 26)
  262. #define DWHCI_HARDWARE4_IN_ENDPOINT_COUNT_SHIFT 26
  263. #define DWHCI_HARDWARE4_DEDICATED_FIFO_ENABLE (1 << 25)
  264. #define DWHCI_HARDWARE4_SESSION_END_FILTER_ENABLE (1 << 24)
  265. #define DWHCI_HARDWARE4_VALID_B_FILTER_ENABLE (1 << 23)
  266. #define DWHCI_HARDWARE4_VALID_A_FILTER_ENABLE (1 << 22)
  267. #define DWHCI_HARDWARE4_VALID_VBUS_FILTER_ENABLE (1 << 21)
  268. #define DWHCI_HARDWARE4_VALID_IDDIG_FILTER_ENABLE (1 << 20)
  269. #define DWHCI_HARDWARE4_MODE_CONTROL_ENDPOINT_COUNT_MASK (0xF << 16)
  270. #define DWHCI_HARDWARE4_MODE_CONTROL_ENDPOINT_COUNT_SHIFT 16
  271. #define DWHCI_HARDWARE4_UTMI_PHYSICAL_DATA_WIDTH_8_BIT (0x0 << 14)
  272. #define DWHCI_HARDWARE4_UTMI_PHYSICAL_DATA_WIDTH_16_BIT (0x1 << 14)
  273. #define DWHCI_HARDWARE4_UTMI_PHYSICAL_DATA_WIDTH_8_OR_16_BIT (0x2 << 14)
  274. #define DWHCI_HARDWARE4_UTMI_PHYSICAL_DATA_WIDTH_MASK (0x3 << 14)
  275. #define DWHCI_HARDWARE4_UTMI_PHYSICAL_DATA_WIDTH_SHIFT 14
  276. #define DWHCI_HARDWARE4_PARTIAL_POWER_OFF (1 << 6)
  277. #define DWHCI_HARDWARE4_MINIMUM_AHB_FREQUENCY (1 << 5)
  278. #define DWHCI_HARDWARE4_POWER_OPTIMIZATION (1 << 4)
  279. #define DWHCI_HARDWARE4_PERIODIC_IN_ENDPOINT_COUNT_MASK (0xF << 0)
  280. #define DWHCI_HARDWARE4_PERIODIC_IN_ENDPOINT_COUNT_SHIFT 0
  281. //
  282. // Define the flags for the host configuration port.
  283. //
  284. #define DWHCI_HOST_CONFIGURATION_MODE_CHANGE_TIME (1 << 31)
  285. #define DWHCI_HOST_CONFIGURATION_PERIODIC_SCHEDULE_STATUS (1 << 27)
  286. #define DWHCI_HOST_CONFIGURATION_PERIODIC_SCHEDULE_ENABLE (1 << 26)
  287. #define DWHCI_HOST_CONFIGURATION_FRAME_LIST_ENTRIES_MASK (0x3 << 24)
  288. #define DWHCI_HOST_CONFIGURATION_FRAME_LIST_ENTRIES_SHIFT 24
  289. #define DWHCI_HOST_CONFIGURATION_ENABLE_DMA_DESCRIPTOR (1 << 23)
  290. #define DWHCI_HOST_CONFIGURATION_RESPOND_VALID_PERIOD_MASK (0xFF << 8)
  291. #define DWHCI_HOST_CONFIGURATION_RESPOND_VALID_PERIOD_SHIFT 8
  292. #define DWHCI_HOST_CONFIGURATION_ENABLE_32_KHZ_SUSPEND (1 << 7)
  293. #define DWHCI_HOST_CONFIGURATION_FULL_SPEED_LOW_SPEED_ONLY (1 << 2)
  294. #define DWHCI_HOST_CONFIGURATION_CLOCK_30_60_MHZ (0x0 << 0)
  295. #define DWHCI_HOST_CONFIGURATION_CLOCK_48_MHZ (0x1 << 0)
  296. #define DWHCI_HOST_CONFIGURATION_CLOCK_6_MHZ (0x2 << 0)
  297. #define DWHCI_HOST_CONFIGURATION_CLOCK_RATE_MASK (0x3 << 0)
  298. #define DWHCI_HOST_CONFIGURATION_CLOCK_RATE_SHIFT 0
  299. //
  300. // Define the flags for the frame number register.
  301. //
  302. #define DWHCI_FRAME_NUMBER_REMAINING_MASK (0xFFFF << 16)
  303. #define DWHCI_FRAME_NUMBER_REMAINING_SHIFT 16
  304. #define DWHCI_FRAME_NUMBER_MASK (0xFFFF << 0)
  305. #define DWHCI_FRAME_NUMBER_SHIFT 0
  306. #define DWHCI_FRAME_NUMBER_MAX 0x3FFF
  307. #define DWHCI_FRAME_NUMBER_HIGH_BIT 0x2000
  308. //
  309. // Define the flags for the host's only port.
  310. //
  311. #define DWHCI_HOST_PORT_SPEED_HIGH (0x0 << 17)
  312. #define DWHCI_HOST_PORT_SPEED_FULL (0x1 << 17)
  313. #define DWHCI_HOST_PORT_SPEED_LOW (0x2 << 17)
  314. #define DWHCI_HOST_PORT_SPEED_MASK (0x3 << 17)
  315. #define DWHCI_HOST_PORT_TEST_CONTROL_MASK (0xF << 13)
  316. #define DWHCI_HOST_PORT_POWER (1 << 12)
  317. #define DWHCI_HOST_PORT_LINE_STATE_MASK (0x3 << 10)
  318. #define DWHCI_HOST_PORT_RESET (1 << 8)
  319. #define DWHCI_HOST_PORT_SUSPEND (1 << 7)
  320. #define DWHCI_HOST_PORT_RESUME (1 << 6)
  321. #define DWHCI_HOST_PORT_OVER_CURRENT_CHANGE (1 << 5)
  322. #define DWHCI_HOST_PORT_OVER_CURRENT_ACTIVE (1 << 4)
  323. #define DWHCI_HOST_PORT_ENABLE_CHANGE (1 << 3)
  324. #define DWHCI_HOST_PORT_ENABLE (1 << 2)
  325. #define DWHCI_HOST_PORT_CONNECT_STATUS_CHANGE (1 << 1)
  326. #define DWHCI_HOST_PORT_CONNECT_STATUS (1 << 0)
  327. #define DWHCI_HOST_PORT_WRITE_TO_CLEAR_MASK \
  328. (DWHCI_HOST_PORT_ENABLE | \
  329. DWHCI_HOST_PORT_CONNECT_STATUS_CHANGE | \
  330. DWHCI_HOST_PORT_ENABLE_CHANGE | \
  331. DWHCI_HOST_PORT_OVER_CURRENT_CHANGE)
  332. #define DWHCI_HOST_PORT_INTERRUPT_MASK \
  333. (DWHCI_HOST_PORT_CONNECT_STATUS_CHANGE | \
  334. DWHCI_HOST_PORT_ENABLE_CHANGE | \
  335. DWHCI_HOST_PORT_OVER_CURRENT_CHANGE)
  336. //
  337. // Define the flags for the channel control registers.
  338. //
  339. #define DWHCI_CHANNEL_CONTROL_ENABLE (1 << 31)
  340. #define DWHCI_CHANNEL_CONTROL_DISABLE (1 << 30)
  341. #define DWHCI_CHANNEL_CONTROL_ODD_FRAME (1 << 29)
  342. #define DWHCI_CHANNEL_CONTROL_DEVICE_ADDRESS_MASK (0x7F << 22)
  343. #define DWHCI_CHANNEL_CONTROL_DEVICE_ADDRESS_SHIFT 22
  344. #define DWHCI_CHANNEL_CONTROL_PACKETS_PER_FRAME_MASK (0x3 << 20)
  345. #define DWHCI_CHANNEL_CONTROL_PACKETS_PER_FRAME_SHIFT 20
  346. #define DWHCI_CHANNEL_CONTROL_ENDPOINT_CONTROL (0x0 << 18)
  347. #define DWHCI_CHANNEL_CONTROL_ENDPOINT_ISOCHRONOUS (0x1 << 18)
  348. #define DWHCI_CHANNEL_CONTROL_ENDPOINT_BULK (0x2 << 18)
  349. #define DWHCI_CHANNEL_CONTROL_ENDPOINT_INTERRUPT (0x3 << 18)
  350. #define DWHCI_CHANNEL_CONTROL_ENDPOINT_TYPE_MASK (0x3 << 18)
  351. #define DWHCI_CHANNEL_CONTROL_ENDPOINT_TYPE_SHIFT 18
  352. #define DWHCI_CHANNEL_CONTROL_LOW_SPEED (1 << 17)
  353. #define DWHCI_CHANNEL_CONTROL_ENDPOINT_DIRECTION_IN (1 << 15)
  354. #define DWHCI_CHANNEL_CONTROL_ENDPOINT_MASK (0xF << 11)
  355. #define DWHCI_CHANNEL_CONTROL_ENDPOINT_SHIFT 11
  356. #define DWHCI_CHANNEL_CONTROL_MAX_PACKET_SIZE_WIDTH 11
  357. #define DWHCI_CHANNEL_CONTROL_MAX_PACKET_SIZE_MASK (0x7ff << 0)
  358. #define DWHCI_CHANNEL_CONTROL_MAX_PACKET_SIZE_SHIFT 0
  359. //
  360. // Define the flags for the channel split control registers.
  361. //
  362. #define DWHCI_CHANNEL_SPLIT_CONTROL_ENABLE (0x1 << 31)
  363. #define DWHCI_CHANNEL_SPLIT_CONTROL_COMPLETE_SPLIT (0x1 << 16)
  364. #define DWHCI_CHANNEL_SPLIT_CONTROL_POSITION_MIDDLE (0x0 << 14)
  365. #define DWHCI_CHANNEL_SPLIT_CONTROL_POSITION_END (0x1 << 14)
  366. #define DWHCI_CHANNEL_SPLIT_CONTROL_POSITION_BEGIN (0x2 << 14)
  367. #define DWHCI_CHANNEL_SPLIT_CONTROL_POSITION_ALL (0x3 << 14)
  368. #define DWHCI_CHANNEL_SPLIT_CONTROL_POSITION_MASK (0x3 << 14)
  369. #define DWHCI_CHANNEL_SPLIT_CONTROL_POSITION_SHIFT 14
  370. #define DWHCI_CHANNEL_SPLIT_CONTROL_HUB_ADDRESS_MASK (0x7F << 7)
  371. #define DWHCI_CHANNEL_SPLIT_CONTROL_HUB_ADDRESS_SHIFT 7
  372. #define DWHCI_CHANNEL_SPLIT_CONTROL_PORT_ADDRESS_MASK (0x7F << 0)
  373. #define DWHCI_CHANNEL_SPLIT_CONTROL_PORT_ADDRESS_SHIFT 0
  374. //
  375. // Define the flags for the channel interrupt and interrupt mask registers.
  376. //
  377. #define DWHCI_CHANNEL_INTERRUPT_FRAME_LIST_ROLLOVER (1 << 13)
  378. #define DWHCI_CHANNEL_INTERRUPT_DMA_EXCESSIVE_TRANSACTION (1 << 12)
  379. #define DWHCI_CHANNEL_INTERRUPT_DMA_BUFFER_NOT_AVAILABLE (1 << 11)
  380. #define DWHCI_CHANNEL_INTERRUPT_DATA_TOGGLE_ERROR (1 << 10)
  381. #define DWHCI_CHANNEL_INTERRUPT_FRAME_OVERRUN (1 << 9)
  382. #define DWHCI_CHANNEL_INTERRUPT_BABBLE_ERROR (1 << 8)
  383. #define DWHCI_CHANNEL_INTERRUPT_TRANSACTION_ERROR (1 << 7)
  384. #define DWHCI_CHANNEL_INTERRUPT_NOT_YET (1 << 6)
  385. #define DWHCI_CHANNEL_INTERRUPT_ACK (1 << 5)
  386. #define DWHCI_CHANNEL_INTERRUPT_NAK (1 << 4)
  387. #define DWHCI_CHANNEL_INTERRUPT_STALL (1 << 3)
  388. #define DWHCI_CHANNEL_INTERRUPT_AHB_ERROR (1 << 2)
  389. #define DWHCI_CHANNEL_INTERRUPT_HALTED (1 << 1)
  390. #define DWHCI_CHANNEL_INTERRUPT_TRANSFER_COMPLETE (1 << 0)
  391. #define DWHCI_CHANNEL_INTERRUPT_ERROR_MASK \
  392. (DWHCI_CHANNEL_INTERRUPT_AHB_ERROR | \
  393. DWHCI_CHANNEL_INTERRUPT_STALL | \
  394. DWHCI_CHANNEL_INTERRUPT_TRANSACTION_ERROR | \
  395. DWHCI_CHANNEL_INTERRUPT_BABBLE_ERROR | \
  396. DWHCI_CHANNEL_INTERRUPT_DATA_TOGGLE_ERROR | \
  397. DWHCI_CHANNEL_INTERRUPT_DMA_BUFFER_NOT_AVAILABLE | \
  398. DWHCI_CHANNEL_INTERRUPT_DMA_EXCESSIVE_TRANSACTION)
  399. //
  400. // Define the different PID codes.
  401. //
  402. #define DWHCI_PID_CODE_DATA_0 0
  403. #define DWHCI_PID_CODE_DATA_1 2
  404. #define DWHCI_PID_CODE_DATA_2 1
  405. #define DWHCI_PID_CODE_MORE_DATA 3
  406. #define DWHCI_PID_CODE_SETUP 3
  407. //
  408. // Define the flags for the channel transfer registers.
  409. //
  410. #define DWHCI_CHANNEL_TOKEN_PING (1 << 31)
  411. #define DWHCI_CHANNEL_TOKEN_PID_CODE_DATA_0 (DWHCI_PID_CODE_DATA_0 << 29)
  412. #define DWHCI_CHANNEL_TOKEN_PID_CODE_DATA_1 (DWHCI_PID_CODE_DATA_1 << 29)
  413. #define DWHCI_CHANNEL_TOKEN_PID_CODE_DATA_2 (DWHCI_PID_CODE_DATA_2 << 29)
  414. #define DWHCI_CHANNEL_TOKEN_PID_CODE_MORE_DATA (DWHCI_PID_CODE_MORE_DATA << 29)
  415. #define DWHCI_CHANNEL_TOKEN_PID_CODE_SETUP (DWHCI_PID_CODE_SETUP << 29)
  416. #define DWHCI_CHANNEL_TOKEN_PID_MASK (0x3 << 29)
  417. #define DWHCI_CHANNEL_TOKEN_PID_SHIFT 29
  418. #define DWHCI_CHANNEL_TOKEN_PACKET_COUNT_MASK (0x3FF << 19)
  419. #define DWHCI_CHANNEL_TOKEN_PACKET_COUNT_SHIFT 19
  420. #define DWHCI_CHANNEL_TOKEN_TRANSFER_SIZE_MASK (0x7FFFF << 0)
  421. #define DWHCI_CHANNEL_TOKEN_TRANSFER_SIZE_SHIFT 0
  422. //
  423. // Define the maximum allowed transfer size and packet counts.
  424. //
  425. #define DWHCI_MAX_PACKET_COUNT 0x3FF
  426. #define DWHCI_MAX_TRANSFER_SIZE 0x7FFFF
  427. //
  428. // Define the flags for the DWHCI power and clock configuration register.
  429. //
  430. #define DWHCI_POWER_AND_CLOCK_RESET_AFTER_SUSPEND (1 << 8)
  431. #define DWHCI_POWER_AND_CLOCK_DEEP_SLEEP (1 << 7)
  432. #define DWHCI_POWER_AND_CLOCK_PHY_SLEEPING (1 << 6)
  433. #define DWHCI_POWER_AND_CLOCK_SLEEP_CLOCK_GATING_ENABLE (1 << 5)
  434. #define DWHCI_POWER_AND_CLOCK_PHY_SUSPENDED (1 << 4)
  435. #define DWHCI_POWER_AND_CLOCK_POWER_DOWN_MODULES (1 << 3)
  436. #define DWHCI_POWER_AND_CLOCK_POWER_CLAMP (1 << 2)
  437. #define DWHCI_POWER_AND_CLOCK_GATE_H_CLOCK (1 << 1)
  438. #define DWHCI_POWER_AND_CLOCK_STOP_P_CLOCK (1 << 0)
  439. //
  440. // ------------------------------------------------------ Data Type Definitions
  441. //
  442. //
  443. // Define the offsets to host controller registers, in bytes.
  444. //
  445. typedef enum _DWHCI_REGISTER {
  446. DwhciRegisterOtgControl = 0x0,
  447. DwhciRegisterOtgInterrupt = 0x4,
  448. DwhciRegisterAhbConfiguration = 0x8,
  449. DwhciRegisterUsbConfiguration = 0xC,
  450. DwhciRegisterCoreReset = 0x10,
  451. DwhciRegisterCoreInterrupt = 0x14,
  452. DwhciRegisterCoreInterruptMask = 0x18,
  453. DwhciRegisterReceiveFifoStatus = 0x1C,
  454. DwhciRegisterReceiveFifoStatusAndPop = 0x20,
  455. DwhciRegisterReceiveFifoSize = 0x24,
  456. DwhciRegisterNonPeriodicFifoSize = 0x28,
  457. DwhciRegisterNonPeriodicFifoStatus = 0x2c,
  458. DwhciRegisterCoreId = 0x40,
  459. DwhciRegisterHardware1 = 0x44,
  460. DwhciRegisterHardware2 = 0x48,
  461. DwhciRegisterHardware3 = 0x4C,
  462. DwhciRegisterHardware4 = 0x50,
  463. DwhciRegisterPeriodicFifoSize = 0x100,
  464. DwhciRegisterHostConfiguration = 0x400,
  465. DwhciRegisterFrameNumber = 0x408,
  466. DwhciRegisterPeriodicFifoStatus = 0x410,
  467. DwhciRegisterHostChannelInterrupt = 0x414,
  468. DwhciRegisterHostChannelInterruptMask = 0x418,
  469. DwhciRegisterHostPort = 0x440,
  470. DwhciRegisterChannelBase = 0x500,
  471. DwhciRegisterPowerAndClock = 0xE00,
  472. } DWHCI_REGISTER, *PDWHCI_REGISTER;
  473. //
  474. // Define the offsets to host controller channel registers, in byte.
  475. //
  476. typedef enum _DWHCI_CHANNEL_REGISTER {
  477. DwhciChannelRegisterControl = 0x0,
  478. DwhciChannelRegisterSplitControl = 0x4,
  479. DwhciChannelRegisterInterrupt = 0x8,
  480. DwhciChannelRegisterInterruptMask = 0xC,
  481. DwhciChannelRegisterToken = 0x10,
  482. DwhciChannelRegisterDmaAddress = 0x14,
  483. DwhciChannelRegisterDmaBufferAddress = 0x1C,
  484. DwhciChannelRegistersSize = 0x20
  485. } DWHCI_CHANNEL_REGISTER, *PDWHCI_CHANNEL_REGISTER;
  486. //
  487. // -------------------------------------------------------------------- Globals
  488. //
  489. //
  490. // -------------------------------------------------------- Function Prototypes
  491. //