unipro.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. /*
  2. * drivers/scsi/ufs/unipro.h
  3. *
  4. * Copyright (C) 2013 Samsung Electronics Co., Ltd.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. */
  11. #ifndef _UNIPRO_H_
  12. #define _UNIPRO_H_
  13. /*
  14. * M-TX Configuration Attributes
  15. */
  16. #define TX_HIBERN8TIME_CAPABILITY 0x000F
  17. #define TX_MODE 0x0021
  18. #define TX_HSRATE_SERIES 0x0022
  19. #define TX_HSGEAR 0x0023
  20. #define TX_PWMGEAR 0x0024
  21. #define TX_AMPLITUDE 0x0025
  22. #define TX_HS_SLEWRATE 0x0026
  23. #define TX_SYNC_SOURCE 0x0027
  24. #define TX_HS_SYNC_LENGTH 0x0028
  25. #define TX_HS_PREPARE_LENGTH 0x0029
  26. #define TX_LS_PREPARE_LENGTH 0x002A
  27. #define TX_HIBERN8_CONTROL 0x002B
  28. #define TX_LCC_ENABLE 0x002C
  29. #define TX_PWM_BURST_CLOSURE_EXTENSION 0x002D
  30. #define TX_BYPASS_8B10B_ENABLE 0x002E
  31. #define TX_DRIVER_POLARITY 0x002F
  32. #define TX_HS_UNTERMINATED_LINE_DRIVE_ENABLE 0x0030
  33. #define TX_LS_TERMINATED_LINE_DRIVE_ENABLE 0x0031
  34. #define TX_LCC_SEQUENCER 0x0032
  35. #define TX_MIN_ACTIVATETIME 0x0033
  36. #define TX_PWM_G6_G7_SYNC_LENGTH 0x0034
  37. #define TX_REFCLKFREQ 0x00EB
  38. #define TX_CFGCLKFREQVAL 0x00EC
  39. #define CFGEXTRATTR 0x00F0
  40. #define DITHERCTRL2 0x00F1
  41. /*
  42. * M-RX Configuration Attributes
  43. */
  44. #define RX_MODE 0x00A1
  45. #define RX_HSRATE_SERIES 0x00A2
  46. #define RX_HSGEAR 0x00A3
  47. #define RX_PWMGEAR 0x00A4
  48. #define RX_LS_TERMINATED_ENABLE 0x00A5
  49. #define RX_HS_UNTERMINATED_ENABLE 0x00A6
  50. #define RX_ENTER_HIBERN8 0x00A7
  51. #define RX_BYPASS_8B10B_ENABLE 0x00A8
  52. #define RX_TERMINATION_FORCE_ENABLE 0x0089
  53. #define RX_MIN_ACTIVATETIME_CAPABILITY 0x008F
  54. #define RX_HIBERN8TIME_CAPABILITY 0x0092
  55. #define RX_REFCLKFREQ 0x00EB
  56. #define RX_CFGCLKFREQVAL 0x00EC
  57. #define CFGWIDEINLN 0x00F0
  58. #define CFGRXCDR8 0x00BA
  59. #define ENARXDIRECTCFG4 0x00F2
  60. #define CFGRXOVR8 0x00BD
  61. #define RXDIRECTCTRL2 0x00C7
  62. #define ENARXDIRECTCFG3 0x00F3
  63. #define RXCALCTRL 0x00B4
  64. #define ENARXDIRECTCFG2 0x00F4
  65. #define CFGRXOVR4 0x00E9
  66. #define RXSQCTRL 0x00B5
  67. #define CFGRXOVR6 0x00BF
  68. #define is_mphy_tx_attr(attr) (attr < RX_MODE)
  69. #define RX_MIN_ACTIVATETIME_UNIT_US 100
  70. #define HIBERN8TIME_UNIT_US 100
  71. /*
  72. * Common Block Attributes
  73. */
  74. #define TX_GLOBALHIBERNATE UNIPRO_CB_OFFSET(0x002B)
  75. #define REFCLKMODE UNIPRO_CB_OFFSET(0x00BF)
  76. #define DIRECTCTRL19 UNIPRO_CB_OFFSET(0x00CD)
  77. #define DIRECTCTRL10 UNIPRO_CB_OFFSET(0x00E6)
  78. #define CDIRECTCTRL6 UNIPRO_CB_OFFSET(0x00EA)
  79. #define RTOBSERVESELECT UNIPRO_CB_OFFSET(0x00F0)
  80. #define CBDIVFACTOR UNIPRO_CB_OFFSET(0x00F1)
  81. #define CBDCOCTRL5 UNIPRO_CB_OFFSET(0x00F3)
  82. #define CBPRGPLL2 UNIPRO_CB_OFFSET(0x00F8)
  83. #define CBPRGTUNING UNIPRO_CB_OFFSET(0x00FB)
  84. #define UNIPRO_CB_OFFSET(x) (0x8000 | x)
  85. /*
  86. * PHY Adpater attributes
  87. */
  88. #define PA_ACTIVETXDATALANES 0x1560
  89. #define PA_ACTIVERXDATALANES 0x1580
  90. #define PA_TXTRAILINGCLOCKS 0x1564
  91. #define PA_PHY_TYPE 0x1500
  92. #define PA_AVAILTXDATALANES 0x1520
  93. #define PA_AVAILRXDATALANES 0x1540
  94. #define PA_MINRXTRAILINGCLOCKS 0x1543
  95. #define PA_TXPWRSTATUS 0x1567
  96. #define PA_RXPWRSTATUS 0x1582
  97. #define PA_TXFORCECLOCK 0x1562
  98. #define PA_TXPWRMODE 0x1563
  99. #define PA_LEGACYDPHYESCDL 0x1570
  100. #define PA_MAXTXSPEEDFAST 0x1521
  101. #define PA_MAXTXSPEEDSLOW 0x1522
  102. #define PA_MAXRXSPEEDFAST 0x1541
  103. #define PA_MAXRXSPEEDSLOW 0x1542
  104. #define PA_TXLINKSTARTUPHS 0x1544
  105. #define PA_LOCAL_TX_LCC_ENABLE 0x155E
  106. #define PA_TXSPEEDFAST 0x1565
  107. #define PA_TXSPEEDSLOW 0x1566
  108. #define PA_REMOTEVERINFO 0x15A0
  109. #define PA_TXGEAR 0x1568
  110. #define PA_TXTERMINATION 0x1569
  111. #define PA_HSSERIES 0x156A
  112. #define PA_PWRMODE 0x1571
  113. #define PA_RXGEAR 0x1583
  114. #define PA_RXTERMINATION 0x1584
  115. #define PA_MAXRXPWMGEAR 0x1586
  116. #define PA_MAXRXHSGEAR 0x1587
  117. #define PA_RXHSUNTERMCAP 0x15A5
  118. #define PA_RXLSTERMCAP 0x15A6
  119. #define PA_GRANULARITY 0x15AA
  120. #define PA_PACPREQTIMEOUT 0x1590
  121. #define PA_PACPREQEOBTIMEOUT 0x1591
  122. #define PA_HIBERN8TIME 0x15A7
  123. #define PA_LOCALVERINFO 0x15A9
  124. #define PA_TACTIVATE 0x15A8
  125. #define PA_PACPFRAMECOUNT 0x15C0
  126. #define PA_PACPERRORCOUNT 0x15C1
  127. #define PA_PHYTESTCONTROL 0x15C2
  128. #define PA_PWRMODEUSERDATA0 0x15B0
  129. #define PA_PWRMODEUSERDATA1 0x15B1
  130. #define PA_PWRMODEUSERDATA2 0x15B2
  131. #define PA_PWRMODEUSERDATA3 0x15B3
  132. #define PA_PWRMODEUSERDATA4 0x15B4
  133. #define PA_PWRMODEUSERDATA5 0x15B5
  134. #define PA_PWRMODEUSERDATA6 0x15B6
  135. #define PA_PWRMODEUSERDATA7 0x15B7
  136. #define PA_PWRMODEUSERDATA8 0x15B8
  137. #define PA_PWRMODEUSERDATA9 0x15B9
  138. #define PA_PWRMODEUSERDATA10 0x15BA
  139. #define PA_PWRMODEUSERDATA11 0x15BB
  140. #define PA_CONNECTEDTXDATALANES 0x1561
  141. #define PA_CONNECTEDRXDATALANES 0x1581
  142. #define PA_LOGICALLANEMAP 0x15A1
  143. #define PA_SLEEPNOCONFIGTIME 0x15A2
  144. #define PA_STALLNOCONFIGTIME 0x15A3
  145. #define PA_SAVECONFIGTIME 0x15A4
  146. #define PA_TACTIVATE_TIME_UNIT_US 10
  147. #define PA_HIBERN8_TIME_UNIT_US 100
  148. /*Other attributes*/
  149. #define VS_MPHYCFGUPDT 0xD085
  150. #define VS_DEBUGOMC 0xD09E
  151. #define VS_POWERSTATE 0xD083
  152. #define PA_GRANULARITY_MIN_VAL 1
  153. #define PA_GRANULARITY_MAX_VAL 6
  154. /* PHY Adapter Protocol Constants */
  155. #define PA_MAXDATALANES 4
  156. /* PA power modes */
  157. enum {
  158. FAST_MODE = 1,
  159. SLOW_MODE = 2,
  160. FASTAUTO_MODE = 4,
  161. SLOWAUTO_MODE = 5,
  162. UNCHANGED = 7,
  163. };
  164. /* PA TX/RX Frequency Series */
  165. enum {
  166. PA_HS_MODE_A = 1,
  167. PA_HS_MODE_B = 2,
  168. };
  169. enum ufs_pwm_gear_tag {
  170. UFS_PWM_DONT_CHANGE, /* Don't change Gear */
  171. UFS_PWM_G1, /* PWM Gear 1 (default for reset) */
  172. UFS_PWM_G2, /* PWM Gear 2 */
  173. UFS_PWM_G3, /* PWM Gear 3 */
  174. UFS_PWM_G4, /* PWM Gear 4 */
  175. UFS_PWM_G5, /* PWM Gear 5 */
  176. UFS_PWM_G6, /* PWM Gear 6 */
  177. UFS_PWM_G7, /* PWM Gear 7 */
  178. };
  179. enum ufs_hs_gear_tag {
  180. UFS_HS_DONT_CHANGE, /* Don't change Gear */
  181. UFS_HS_G1, /* HS Gear 1 (default for reset) */
  182. UFS_HS_G2, /* HS Gear 2 */
  183. UFS_HS_G3, /* HS Gear 3 */
  184. };
  185. enum ufs_unipro_ver {
  186. UFS_UNIPRO_VER_RESERVED = 0,
  187. UFS_UNIPRO_VER_1_40 = 1, /* UniPro version 1.40 */
  188. UFS_UNIPRO_VER_1_41 = 2, /* UniPro version 1.41 */
  189. UFS_UNIPRO_VER_1_6 = 3, /* UniPro version 1.6 */
  190. UFS_UNIPRO_VER_MAX = 4, /* UniPro unsupported version */
  191. /* UniPro version field mask in PA_LOCALVERINFO */
  192. UFS_UNIPRO_VER_MASK = 0xF,
  193. };
  194. /*
  195. * Data Link Layer Attributes
  196. */
  197. #define DL_TC0TXFCTHRESHOLD 0x2040
  198. #define DL_FC0PROTTIMEOUTVAL 0x2041
  199. #define DL_TC0REPLAYTIMEOUTVAL 0x2042
  200. #define DL_AFC0REQTIMEOUTVAL 0x2043
  201. #define DL_AFC0CREDITTHRESHOLD 0x2044
  202. #define DL_TC0OUTACKTHRESHOLD 0x2045
  203. #define DL_TC1TXFCTHRESHOLD 0x2060
  204. #define DL_FC1PROTTIMEOUTVAL 0x2061
  205. #define DL_TC1REPLAYTIMEOUTVAL 0x2062
  206. #define DL_AFC1REQTIMEOUTVAL 0x2063
  207. #define DL_AFC1CREDITTHRESHOLD 0x2064
  208. #define DL_TC1OUTACKTHRESHOLD 0x2065
  209. #define DL_TXPREEMPTIONCAP 0x2000
  210. #define DL_TC0TXMAXSDUSIZE 0x2001
  211. #define DL_TC0RXINITCREDITVAL 0x2002
  212. #define DL_TC0TXBUFFERSIZE 0x2005
  213. #define DL_PEERTC0PRESENT 0x2046
  214. #define DL_PEERTC0RXINITCREVAL 0x2047
  215. #define DL_TC1TXMAXSDUSIZE 0x2003
  216. #define DL_TC1RXINITCREDITVAL 0x2004
  217. #define DL_TC1TXBUFFERSIZE 0x2006
  218. #define DL_PEERTC1PRESENT 0x2066
  219. #define DL_PEERTC1RXINITCREVAL 0x2067
  220. /*
  221. * Network Layer Attributes
  222. */
  223. #define N_DEVICEID 0x3000
  224. #define N_DEVICEID_VALID 0x3001
  225. #define N_TC0TXMAXSDUSIZE 0x3020
  226. #define N_TC1TXMAXSDUSIZE 0x3021
  227. /*
  228. * Transport Layer Attributes
  229. */
  230. #define T_NUMCPORTS 0x4000
  231. #define T_NUMTESTFEATURES 0x4001
  232. #define T_CONNECTIONSTATE 0x4020
  233. #define T_PEERDEVICEID 0x4021
  234. #define T_PEERCPORTID 0x4022
  235. #define T_TRAFFICCLASS 0x4023
  236. #define T_PROTOCOLID 0x4024
  237. #define T_CPORTFLAGS 0x4025
  238. #define T_TXTOKENVALUE 0x4026
  239. #define T_RXTOKENVALUE 0x4027
  240. #define T_LOCALBUFFERSPACE 0x4028
  241. #define T_PEERBUFFERSPACE 0x4029
  242. #define T_CREDITSTOSEND 0x402A
  243. #define T_CPORTMODE 0x402B
  244. #define T_TC0TXMAXSDUSIZE 0x4060
  245. #define T_TC1TXMAXSDUSIZE 0x4061
  246. #ifdef FALSE
  247. #undef FALSE
  248. #endif
  249. #ifdef TRUE
  250. #undef TRUE
  251. #endif
  252. /* Boolean attribute values */
  253. enum {
  254. FALSE = 0,
  255. TRUE,
  256. };
  257. #endif /* _UNIPRO_H_ */