usb338x.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. /*
  2. * USB 338x super/high/full speed USB device controller.
  3. * Unlike many such controllers, this one talks PCI.
  4. *
  5. * Copyright (C) 2002 NetChip Technology, Inc. (http://www.netchip.com)
  6. * Copyright (C) 2003 David Brownell
  7. * Copyright (C) 2014 Ricardo Ribalda - Qtechnology/AS
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. */
  20. #ifndef __LINUX_USB_USB338X_H
  21. #define __LINUX_USB_USB338X_H
  22. #include <linux/usb/net2280.h>
  23. /*
  24. * Extra defined bits for net2280 registers
  25. */
  26. #define SCRATCH 0x0b
  27. #define DEFECT7374_FSM_FIELD 28
  28. #define SUPER_SPEED 8
  29. #define DMA_REQUEST_OUTSTANDING 5
  30. #define DMA_PAUSE_DONE_INTERRUPT 26
  31. #define SET_ISOCHRONOUS_DELAY 24
  32. #define SET_SEL 22
  33. #define SUPER_SPEED_MODE 8
  34. /*ep_cfg*/
  35. #define MAX_BURST_SIZE 24
  36. #define EP_FIFO_BYTE_COUNT 16
  37. #define IN_ENDPOINT_ENABLE 14
  38. #define IN_ENDPOINT_TYPE 12
  39. #define OUT_ENDPOINT_ENABLE 10
  40. #define OUT_ENDPOINT_TYPE 8
  41. #define USB3380_EP_CFG_MASK_IN ((0x3 << IN_ENDPOINT_TYPE) | \
  42. BIT(IN_ENDPOINT_ENABLE))
  43. #define USB3380_EP_CFG_MASK_OUT ((0x3 << OUT_ENDPOINT_TYPE) | \
  44. BIT(OUT_ENDPOINT_ENABLE))
  45. struct usb338x_usb_ext_regs {
  46. u32 usbclass;
  47. #define DEVICE_PROTOCOL 16
  48. #define DEVICE_SUB_CLASS 8
  49. #define DEVICE_CLASS 0
  50. u32 ss_sel;
  51. #define U2_SYSTEM_EXIT_LATENCY 8
  52. #define U1_SYSTEM_EXIT_LATENCY 0
  53. u32 ss_del;
  54. #define U2_DEVICE_EXIT_LATENCY 8
  55. #define U1_DEVICE_EXIT_LATENCY 0
  56. u32 usb2lpm;
  57. #define USB_L1_LPM_HIRD 2
  58. #define USB_L1_LPM_REMOTE_WAKE 1
  59. #define USB_L1_LPM_SUPPORT 0
  60. u32 usb3belt;
  61. #define BELT_MULTIPLIER 10
  62. #define BEST_EFFORT_LATENCY_TOLERANCE 0
  63. u32 usbctl2;
  64. #define LTM_ENABLE 7
  65. #define U2_ENABLE 6
  66. #define U1_ENABLE 5
  67. #define FUNCTION_SUSPEND 4
  68. #define USB3_CORE_ENABLE 3
  69. #define USB2_CORE_ENABLE 2
  70. #define SERIAL_NUMBER_STRING_ENABLE 0
  71. u32 in_timeout;
  72. #define GPEP3_TIMEOUT 19
  73. #define GPEP2_TIMEOUT 18
  74. #define GPEP1_TIMEOUT 17
  75. #define GPEP0_TIMEOUT 16
  76. #define GPEP3_TIMEOUT_VALUE 13
  77. #define GPEP3_TIMEOUT_ENABLE 12
  78. #define GPEP2_TIMEOUT_VALUE 9
  79. #define GPEP2_TIMEOUT_ENABLE 8
  80. #define GPEP1_TIMEOUT_VALUE 5
  81. #define GPEP1_TIMEOUT_ENABLE 4
  82. #define GPEP0_TIMEOUT_VALUE 1
  83. #define GPEP0_TIMEOUT_ENABLE 0
  84. u32 isodelay;
  85. #define ISOCHRONOUS_DELAY 0
  86. } __packed;
  87. struct usb338x_fifo_regs {
  88. /* offset 0x0500, 0x0520, 0x0540, 0x0560, 0x0580 */
  89. u32 ep_fifo_size_base;
  90. #define IN_FIFO_BASE_ADDRESS 22
  91. #define IN_FIFO_SIZE 16
  92. #define OUT_FIFO_BASE_ADDRESS 6
  93. #define OUT_FIFO_SIZE 0
  94. u32 ep_fifo_out_wrptr;
  95. u32 ep_fifo_out_rdptr;
  96. u32 ep_fifo_in_wrptr;
  97. u32 ep_fifo_in_rdptr;
  98. u32 unused[3];
  99. } __packed;
  100. /* Link layer */
  101. struct usb338x_ll_regs {
  102. /* offset 0x700 */
  103. u32 ll_ltssm_ctrl1;
  104. u32 ll_ltssm_ctrl2;
  105. u32 ll_ltssm_ctrl3;
  106. u32 unused[2];
  107. u32 ll_general_ctrl0;
  108. u32 ll_general_ctrl1;
  109. #define PM_U3_AUTO_EXIT 29
  110. #define PM_U2_AUTO_EXIT 28
  111. #define PM_U1_AUTO_EXIT 27
  112. #define PM_FORCE_U2_ENTRY 26
  113. #define PM_FORCE_U1_ENTRY 25
  114. #define PM_LGO_COLLISION_SEND_LAU 24
  115. #define PM_DIR_LINK_REJECT 23
  116. #define PM_FORCE_LINK_ACCEPT 22
  117. #define PM_DIR_ENTRY_U3 20
  118. #define PM_DIR_ENTRY_U2 19
  119. #define PM_DIR_ENTRY_U1 18
  120. #define PM_U2_ENABLE 17
  121. #define PM_U1_ENABLE 16
  122. #define SKP_THRESHOLD_ADJUST_FMW 8
  123. #define RESEND_DPP_ON_LRTY_FMW 7
  124. #define DL_BIT_VALUE_FMW 6
  125. #define FORCE_DL_BIT 5
  126. u32 ll_general_ctrl2;
  127. #define SELECT_INVERT_LANE_POLARITY 7
  128. #define FORCE_INVERT_LANE_POLARITY 6
  129. u32 ll_general_ctrl3;
  130. u32 ll_general_ctrl4;
  131. u32 ll_error_gen;
  132. } __packed;
  133. struct usb338x_ll_lfps_regs {
  134. /* offset 0x748 */
  135. u32 ll_lfps_5;
  136. #define TIMER_LFPS_6US 16
  137. u32 ll_lfps_6;
  138. #define TIMER_LFPS_80US 0
  139. } __packed;
  140. struct usb338x_ll_tsn_regs {
  141. /* offset 0x77C */
  142. u32 ll_tsn_counters_2;
  143. #define HOT_TX_NORESET_TS2 24
  144. u32 ll_tsn_counters_3;
  145. #define HOT_RX_RESET_TS2 0
  146. } __packed;
  147. struct usb338x_ll_chi_regs {
  148. /* offset 0x79C */
  149. u32 ll_tsn_chicken_bit;
  150. #define RECOVERY_IDLE_TO_RECOVER_FMW 3
  151. } __packed;
  152. /* protocol layer */
  153. struct usb338x_pl_regs {
  154. /* offset 0x800 */
  155. u32 pl_reg_1;
  156. u32 pl_reg_2;
  157. u32 pl_reg_3;
  158. u32 pl_reg_4;
  159. u32 pl_ep_ctrl;
  160. /* Protocol Layer Endpoint Control*/
  161. #define PL_EP_CTRL 0x810
  162. #define ENDPOINT_SELECT 0
  163. /* [4:0] */
  164. #define EP_INITIALIZED 16
  165. #define SEQUENCE_NUMBER_RESET 17
  166. #define CLEAR_ACK_ERROR_CODE 20
  167. u32 pl_reg_6;
  168. u32 pl_reg_7;
  169. u32 pl_reg_8;
  170. u32 pl_ep_status_1;
  171. /* Protocol Layer Endpoint Status 1*/
  172. #define PL_EP_STATUS_1 0x820
  173. #define STATE 16
  174. #define ACK_GOOD_NORMAL 0x11
  175. #define ACK_GOOD_MORE_ACKS_TO_COME 0x16
  176. u32 pl_ep_status_2;
  177. u32 pl_ep_status_3;
  178. /* Protocol Layer Endpoint Status 3*/
  179. #define PL_EP_STATUS_3 0x828
  180. #define SEQUENCE_NUMBER 0
  181. u32 pl_ep_status_4;
  182. /* Protocol Layer Endpoint Status 4*/
  183. #define PL_EP_STATUS_4 0x82c
  184. u32 pl_ep_cfg_4;
  185. /* Protocol Layer Endpoint Configuration 4*/
  186. #define PL_EP_CFG_4 0x830
  187. #define NON_CTRL_IN_TOLERATE_BAD_DIR 6
  188. } __packed;
  189. #endif /* __LINUX_USB_USB338X_H */