dwc-xlgmac-reg.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  1. /* Synopsys DesignWare Core Enterprise Ethernet (XLGMAC) Driver
  2. *
  3. * Copyright (c) 2017 Synopsys, Inc. (www.synopsys.com)
  4. *
  5. * This program is dual-licensed; you may select either version 2 of
  6. * the GNU General Public License ("GPL") or BSD license ("BSD").
  7. *
  8. * This Synopsys DWC XLGMAC software driver and associated documentation
  9. * (hereinafter the "Software") is an unsupported proprietary work of
  10. * Synopsys, Inc. unless otherwise expressly agreed to in writing between
  11. * Synopsys and you. The Software IS NOT an item of Licensed Software or a
  12. * Licensed Product under any End User Software License Agreement or
  13. * Agreement for Licensed Products with Synopsys or any supplement thereto.
  14. * Synopsys is a registered trademark of Synopsys, Inc. Other names included
  15. * in the SOFTWARE may be the trademarks of their respective owners.
  16. */
  17. #ifndef __DWC_XLGMAC_REG_H__
  18. #define __DWC_XLGMAC_REG_H__
  19. /* MAC register offsets */
  20. #define MAC_TCR 0x0000
  21. #define MAC_RCR 0x0004
  22. #define MAC_PFR 0x0008
  23. #define MAC_HTR0 0x0010
  24. #define MAC_VLANTR 0x0050
  25. #define MAC_VLANHTR 0x0058
  26. #define MAC_VLANIR 0x0060
  27. #define MAC_Q0TFCR 0x0070
  28. #define MAC_RFCR 0x0090
  29. #define MAC_RQC0R 0x00a0
  30. #define MAC_RQC1R 0x00a4
  31. #define MAC_RQC2R 0x00a8
  32. #define MAC_RQC3R 0x00ac
  33. #define MAC_ISR 0x00b0
  34. #define MAC_IER 0x00b4
  35. #define MAC_VR 0x0110
  36. #define MAC_HWF0R 0x011c
  37. #define MAC_HWF1R 0x0120
  38. #define MAC_HWF2R 0x0124
  39. #define MAC_MACA0HR 0x0300
  40. #define MAC_MACA0LR 0x0304
  41. #define MAC_MACA1HR 0x0308
  42. #define MAC_MACA1LR 0x030c
  43. #define MAC_RSSCR 0x0c80
  44. #define MAC_RSSAR 0x0c88
  45. #define MAC_RSSDR 0x0c8c
  46. #define MAC_QTFCR_INC 4
  47. #define MAC_MACA_INC 4
  48. #define MAC_HTR_INC 4
  49. #define MAC_RQC2_INC 4
  50. #define MAC_RQC2_Q_PER_REG 4
  51. /* MAC register entry bit positions and sizes */
  52. #define MAC_HWF0R_ADDMACADRSEL_POS 18
  53. #define MAC_HWF0R_ADDMACADRSEL_LEN 5
  54. #define MAC_HWF0R_ARPOFFSEL_POS 9
  55. #define MAC_HWF0R_ARPOFFSEL_LEN 1
  56. #define MAC_HWF0R_EEESEL_POS 13
  57. #define MAC_HWF0R_EEESEL_LEN 1
  58. #define MAC_HWF0R_PHYIFSEL_POS 1
  59. #define MAC_HWF0R_PHYIFSEL_LEN 2
  60. #define MAC_HWF0R_MGKSEL_POS 7
  61. #define MAC_HWF0R_MGKSEL_LEN 1
  62. #define MAC_HWF0R_MMCSEL_POS 8
  63. #define MAC_HWF0R_MMCSEL_LEN 1
  64. #define MAC_HWF0R_RWKSEL_POS 6
  65. #define MAC_HWF0R_RWKSEL_LEN 1
  66. #define MAC_HWF0R_RXCOESEL_POS 16
  67. #define MAC_HWF0R_RXCOESEL_LEN 1
  68. #define MAC_HWF0R_SAVLANINS_POS 27
  69. #define MAC_HWF0R_SAVLANINS_LEN 1
  70. #define MAC_HWF0R_SMASEL_POS 5
  71. #define MAC_HWF0R_SMASEL_LEN 1
  72. #define MAC_HWF0R_TSSEL_POS 12
  73. #define MAC_HWF0R_TSSEL_LEN 1
  74. #define MAC_HWF0R_TSSTSSEL_POS 25
  75. #define MAC_HWF0R_TSSTSSEL_LEN 2
  76. #define MAC_HWF0R_TXCOESEL_POS 14
  77. #define MAC_HWF0R_TXCOESEL_LEN 1
  78. #define MAC_HWF0R_VLHASH_POS 4
  79. #define MAC_HWF0R_VLHASH_LEN 1
  80. #define MAC_HWF1R_ADDR64_POS 14
  81. #define MAC_HWF1R_ADDR64_LEN 2
  82. #define MAC_HWF1R_ADVTHWORD_POS 13
  83. #define MAC_HWF1R_ADVTHWORD_LEN 1
  84. #define MAC_HWF1R_DBGMEMA_POS 19
  85. #define MAC_HWF1R_DBGMEMA_LEN 1
  86. #define MAC_HWF1R_DCBEN_POS 16
  87. #define MAC_HWF1R_DCBEN_LEN 1
  88. #define MAC_HWF1R_HASHTBLSZ_POS 24
  89. #define MAC_HWF1R_HASHTBLSZ_LEN 3
  90. #define MAC_HWF1R_L3L4FNUM_POS 27
  91. #define MAC_HWF1R_L3L4FNUM_LEN 4
  92. #define MAC_HWF1R_NUMTC_POS 21
  93. #define MAC_HWF1R_NUMTC_LEN 3
  94. #define MAC_HWF1R_RSSEN_POS 20
  95. #define MAC_HWF1R_RSSEN_LEN 1
  96. #define MAC_HWF1R_RXFIFOSIZE_POS 0
  97. #define MAC_HWF1R_RXFIFOSIZE_LEN 5
  98. #define MAC_HWF1R_SPHEN_POS 17
  99. #define MAC_HWF1R_SPHEN_LEN 1
  100. #define MAC_HWF1R_TSOEN_POS 18
  101. #define MAC_HWF1R_TSOEN_LEN 1
  102. #define MAC_HWF1R_TXFIFOSIZE_POS 6
  103. #define MAC_HWF1R_TXFIFOSIZE_LEN 5
  104. #define MAC_HWF2R_AUXSNAPNUM_POS 28
  105. #define MAC_HWF2R_AUXSNAPNUM_LEN 3
  106. #define MAC_HWF2R_PPSOUTNUM_POS 24
  107. #define MAC_HWF2R_PPSOUTNUM_LEN 3
  108. #define MAC_HWF2R_RXCHCNT_POS 12
  109. #define MAC_HWF2R_RXCHCNT_LEN 4
  110. #define MAC_HWF2R_RXQCNT_POS 0
  111. #define MAC_HWF2R_RXQCNT_LEN 4
  112. #define MAC_HWF2R_TXCHCNT_POS 18
  113. #define MAC_HWF2R_TXCHCNT_LEN 4
  114. #define MAC_HWF2R_TXQCNT_POS 6
  115. #define MAC_HWF2R_TXQCNT_LEN 4
  116. #define MAC_IER_TSIE_POS 12
  117. #define MAC_IER_TSIE_LEN 1
  118. #define MAC_ISR_MMCRXIS_POS 9
  119. #define MAC_ISR_MMCRXIS_LEN 1
  120. #define MAC_ISR_MMCTXIS_POS 10
  121. #define MAC_ISR_MMCTXIS_LEN 1
  122. #define MAC_ISR_PMTIS_POS 4
  123. #define MAC_ISR_PMTIS_LEN 1
  124. #define MAC_ISR_TSIS_POS 12
  125. #define MAC_ISR_TSIS_LEN 1
  126. #define MAC_MACA1HR_AE_POS 31
  127. #define MAC_MACA1HR_AE_LEN 1
  128. #define MAC_PFR_HMC_POS 2
  129. #define MAC_PFR_HMC_LEN 1
  130. #define MAC_PFR_HPF_POS 10
  131. #define MAC_PFR_HPF_LEN 1
  132. #define MAC_PFR_HUC_POS 1
  133. #define MAC_PFR_HUC_LEN 1
  134. #define MAC_PFR_PM_POS 4
  135. #define MAC_PFR_PM_LEN 1
  136. #define MAC_PFR_PR_POS 0
  137. #define MAC_PFR_PR_LEN 1
  138. #define MAC_PFR_VTFE_POS 16
  139. #define MAC_PFR_VTFE_LEN 1
  140. #define MAC_Q0TFCR_PT_POS 16
  141. #define MAC_Q0TFCR_PT_LEN 16
  142. #define MAC_Q0TFCR_TFE_POS 1
  143. #define MAC_Q0TFCR_TFE_LEN 1
  144. #define MAC_RCR_ACS_POS 1
  145. #define MAC_RCR_ACS_LEN 1
  146. #define MAC_RCR_CST_POS 2
  147. #define MAC_RCR_CST_LEN 1
  148. #define MAC_RCR_DCRCC_POS 3
  149. #define MAC_RCR_DCRCC_LEN 1
  150. #define MAC_RCR_HDSMS_POS 12
  151. #define MAC_RCR_HDSMS_LEN 3
  152. #define MAC_RCR_IPC_POS 9
  153. #define MAC_RCR_IPC_LEN 1
  154. #define MAC_RCR_JE_POS 8
  155. #define MAC_RCR_JE_LEN 1
  156. #define MAC_RCR_LM_POS 10
  157. #define MAC_RCR_LM_LEN 1
  158. #define MAC_RCR_RE_POS 0
  159. #define MAC_RCR_RE_LEN 1
  160. #define MAC_RFCR_PFCE_POS 8
  161. #define MAC_RFCR_PFCE_LEN 1
  162. #define MAC_RFCR_RFE_POS 0
  163. #define MAC_RFCR_RFE_LEN 1
  164. #define MAC_RFCR_UP_POS 1
  165. #define MAC_RFCR_UP_LEN 1
  166. #define MAC_RQC0R_RXQ0EN_POS 0
  167. #define MAC_RQC0R_RXQ0EN_LEN 2
  168. #define MAC_RSSAR_ADDRT_POS 2
  169. #define MAC_RSSAR_ADDRT_LEN 1
  170. #define MAC_RSSAR_CT_POS 1
  171. #define MAC_RSSAR_CT_LEN 1
  172. #define MAC_RSSAR_OB_POS 0
  173. #define MAC_RSSAR_OB_LEN 1
  174. #define MAC_RSSAR_RSSIA_POS 8
  175. #define MAC_RSSAR_RSSIA_LEN 8
  176. #define MAC_RSSCR_IP2TE_POS 1
  177. #define MAC_RSSCR_IP2TE_LEN 1
  178. #define MAC_RSSCR_RSSE_POS 0
  179. #define MAC_RSSCR_RSSE_LEN 1
  180. #define MAC_RSSCR_TCP4TE_POS 2
  181. #define MAC_RSSCR_TCP4TE_LEN 1
  182. #define MAC_RSSCR_UDP4TE_POS 3
  183. #define MAC_RSSCR_UDP4TE_LEN 1
  184. #define MAC_RSSDR_DMCH_POS 0
  185. #define MAC_RSSDR_DMCH_LEN 4
  186. #define MAC_TCR_SS_POS 28
  187. #define MAC_TCR_SS_LEN 3
  188. #define MAC_TCR_TE_POS 0
  189. #define MAC_TCR_TE_LEN 1
  190. #define MAC_VLANHTR_VLHT_POS 0
  191. #define MAC_VLANHTR_VLHT_LEN 16
  192. #define MAC_VLANIR_VLTI_POS 20
  193. #define MAC_VLANIR_VLTI_LEN 1
  194. #define MAC_VLANIR_CSVL_POS 19
  195. #define MAC_VLANIR_CSVL_LEN 1
  196. #define MAC_VLANTR_DOVLTC_POS 20
  197. #define MAC_VLANTR_DOVLTC_LEN 1
  198. #define MAC_VLANTR_ERSVLM_POS 19
  199. #define MAC_VLANTR_ERSVLM_LEN 1
  200. #define MAC_VLANTR_ESVL_POS 18
  201. #define MAC_VLANTR_ESVL_LEN 1
  202. #define MAC_VLANTR_ETV_POS 16
  203. #define MAC_VLANTR_ETV_LEN 1
  204. #define MAC_VLANTR_EVLS_POS 21
  205. #define MAC_VLANTR_EVLS_LEN 2
  206. #define MAC_VLANTR_EVLRXS_POS 24
  207. #define MAC_VLANTR_EVLRXS_LEN 1
  208. #define MAC_VLANTR_VL_POS 0
  209. #define MAC_VLANTR_VL_LEN 16
  210. #define MAC_VLANTR_VTHM_POS 25
  211. #define MAC_VLANTR_VTHM_LEN 1
  212. #define MAC_VLANTR_VTIM_POS 17
  213. #define MAC_VLANTR_VTIM_LEN 1
  214. #define MAC_VR_DEVID_POS 8
  215. #define MAC_VR_DEVID_LEN 8
  216. #define MAC_VR_SNPSVER_POS 0
  217. #define MAC_VR_SNPSVER_LEN 8
  218. #define MAC_VR_USERVER_POS 16
  219. #define MAC_VR_USERVER_LEN 8
  220. /* MMC register offsets */
  221. #define MMC_CR 0x0800
  222. #define MMC_RISR 0x0804
  223. #define MMC_TISR 0x0808
  224. #define MMC_RIER 0x080c
  225. #define MMC_TIER 0x0810
  226. #define MMC_TXOCTETCOUNT_GB_LO 0x0814
  227. #define MMC_TXFRAMECOUNT_GB_LO 0x081c
  228. #define MMC_TXBROADCASTFRAMES_G_LO 0x0824
  229. #define MMC_TXMULTICASTFRAMES_G_LO 0x082c
  230. #define MMC_TX64OCTETS_GB_LO 0x0834
  231. #define MMC_TX65TO127OCTETS_GB_LO 0x083c
  232. #define MMC_TX128TO255OCTETS_GB_LO 0x0844
  233. #define MMC_TX256TO511OCTETS_GB_LO 0x084c
  234. #define MMC_TX512TO1023OCTETS_GB_LO 0x0854
  235. #define MMC_TX1024TOMAXOCTETS_GB_LO 0x085c
  236. #define MMC_TXUNICASTFRAMES_GB_LO 0x0864
  237. #define MMC_TXMULTICASTFRAMES_GB_LO 0x086c
  238. #define MMC_TXBROADCASTFRAMES_GB_LO 0x0874
  239. #define MMC_TXUNDERFLOWERROR_LO 0x087c
  240. #define MMC_TXOCTETCOUNT_G_LO 0x0884
  241. #define MMC_TXFRAMECOUNT_G_LO 0x088c
  242. #define MMC_TXPAUSEFRAMES_LO 0x0894
  243. #define MMC_TXVLANFRAMES_G_LO 0x089c
  244. #define MMC_RXFRAMECOUNT_GB_LO 0x0900
  245. #define MMC_RXOCTETCOUNT_GB_LO 0x0908
  246. #define MMC_RXOCTETCOUNT_G_LO 0x0910
  247. #define MMC_RXBROADCASTFRAMES_G_LO 0x0918
  248. #define MMC_RXMULTICASTFRAMES_G_LO 0x0920
  249. #define MMC_RXCRCERROR_LO 0x0928
  250. #define MMC_RXRUNTERROR 0x0930
  251. #define MMC_RXJABBERERROR 0x0934
  252. #define MMC_RXUNDERSIZE_G 0x0938
  253. #define MMC_RXOVERSIZE_G 0x093c
  254. #define MMC_RX64OCTETS_GB_LO 0x0940
  255. #define MMC_RX65TO127OCTETS_GB_LO 0x0948
  256. #define MMC_RX128TO255OCTETS_GB_LO 0x0950
  257. #define MMC_RX256TO511OCTETS_GB_LO 0x0958
  258. #define MMC_RX512TO1023OCTETS_GB_LO 0x0960
  259. #define MMC_RX1024TOMAXOCTETS_GB_LO 0x0968
  260. #define MMC_RXUNICASTFRAMES_G_LO 0x0970
  261. #define MMC_RXLENGTHERROR_LO 0x0978
  262. #define MMC_RXOUTOFRANGETYPE_LO 0x0980
  263. #define MMC_RXPAUSEFRAMES_LO 0x0988
  264. #define MMC_RXFIFOOVERFLOW_LO 0x0990
  265. #define MMC_RXVLANFRAMES_GB_LO 0x0998
  266. #define MMC_RXWATCHDOGERROR 0x09a0
  267. /* MMC register entry bit positions and sizes */
  268. #define MMC_CR_CR_POS 0
  269. #define MMC_CR_CR_LEN 1
  270. #define MMC_CR_CSR_POS 1
  271. #define MMC_CR_CSR_LEN 1
  272. #define MMC_CR_ROR_POS 2
  273. #define MMC_CR_ROR_LEN 1
  274. #define MMC_CR_MCF_POS 3
  275. #define MMC_CR_MCF_LEN 1
  276. #define MMC_CR_MCT_POS 4
  277. #define MMC_CR_MCT_LEN 2
  278. #define MMC_RIER_ALL_INTERRUPTS_POS 0
  279. #define MMC_RIER_ALL_INTERRUPTS_LEN 23
  280. #define MMC_RISR_RXFRAMECOUNT_GB_POS 0
  281. #define MMC_RISR_RXFRAMECOUNT_GB_LEN 1
  282. #define MMC_RISR_RXOCTETCOUNT_GB_POS 1
  283. #define MMC_RISR_RXOCTETCOUNT_GB_LEN 1
  284. #define MMC_RISR_RXOCTETCOUNT_G_POS 2
  285. #define MMC_RISR_RXOCTETCOUNT_G_LEN 1
  286. #define MMC_RISR_RXBROADCASTFRAMES_G_POS 3
  287. #define MMC_RISR_RXBROADCASTFRAMES_G_LEN 1
  288. #define MMC_RISR_RXMULTICASTFRAMES_G_POS 4
  289. #define MMC_RISR_RXMULTICASTFRAMES_G_LEN 1
  290. #define MMC_RISR_RXCRCERROR_POS 5
  291. #define MMC_RISR_RXCRCERROR_LEN 1
  292. #define MMC_RISR_RXRUNTERROR_POS 6
  293. #define MMC_RISR_RXRUNTERROR_LEN 1
  294. #define MMC_RISR_RXJABBERERROR_POS 7
  295. #define MMC_RISR_RXJABBERERROR_LEN 1
  296. #define MMC_RISR_RXUNDERSIZE_G_POS 8
  297. #define MMC_RISR_RXUNDERSIZE_G_LEN 1
  298. #define MMC_RISR_RXOVERSIZE_G_POS 9
  299. #define MMC_RISR_RXOVERSIZE_G_LEN 1
  300. #define MMC_RISR_RX64OCTETS_GB_POS 10
  301. #define MMC_RISR_RX64OCTETS_GB_LEN 1
  302. #define MMC_RISR_RX65TO127OCTETS_GB_POS 11
  303. #define MMC_RISR_RX65TO127OCTETS_GB_LEN 1
  304. #define MMC_RISR_RX128TO255OCTETS_GB_POS 12
  305. #define MMC_RISR_RX128TO255OCTETS_GB_LEN 1
  306. #define MMC_RISR_RX256TO511OCTETS_GB_POS 13
  307. #define MMC_RISR_RX256TO511OCTETS_GB_LEN 1
  308. #define MMC_RISR_RX512TO1023OCTETS_GB_POS 14
  309. #define MMC_RISR_RX512TO1023OCTETS_GB_LEN 1
  310. #define MMC_RISR_RX1024TOMAXOCTETS_GB_POS 15
  311. #define MMC_RISR_RX1024TOMAXOCTETS_GB_LEN 1
  312. #define MMC_RISR_RXUNICASTFRAMES_G_POS 16
  313. #define MMC_RISR_RXUNICASTFRAMES_G_LEN 1
  314. #define MMC_RISR_RXLENGTHERROR_POS 17
  315. #define MMC_RISR_RXLENGTHERROR_LEN 1
  316. #define MMC_RISR_RXOUTOFRANGETYPE_POS 18
  317. #define MMC_RISR_RXOUTOFRANGETYPE_LEN 1
  318. #define MMC_RISR_RXPAUSEFRAMES_POS 19
  319. #define MMC_RISR_RXPAUSEFRAMES_LEN 1
  320. #define MMC_RISR_RXFIFOOVERFLOW_POS 20
  321. #define MMC_RISR_RXFIFOOVERFLOW_LEN 1
  322. #define MMC_RISR_RXVLANFRAMES_GB_POS 21
  323. #define MMC_RISR_RXVLANFRAMES_GB_LEN 1
  324. #define MMC_RISR_RXWATCHDOGERROR_POS 22
  325. #define MMC_RISR_RXWATCHDOGERROR_LEN 1
  326. #define MMC_TIER_ALL_INTERRUPTS_POS 0
  327. #define MMC_TIER_ALL_INTERRUPTS_LEN 18
  328. #define MMC_TISR_TXOCTETCOUNT_GB_POS 0
  329. #define MMC_TISR_TXOCTETCOUNT_GB_LEN 1
  330. #define MMC_TISR_TXFRAMECOUNT_GB_POS 1
  331. #define MMC_TISR_TXFRAMECOUNT_GB_LEN 1
  332. #define MMC_TISR_TXBROADCASTFRAMES_G_POS 2
  333. #define MMC_TISR_TXBROADCASTFRAMES_G_LEN 1
  334. #define MMC_TISR_TXMULTICASTFRAMES_G_POS 3
  335. #define MMC_TISR_TXMULTICASTFRAMES_G_LEN 1
  336. #define MMC_TISR_TX64OCTETS_GB_POS 4
  337. #define MMC_TISR_TX64OCTETS_GB_LEN 1
  338. #define MMC_TISR_TX65TO127OCTETS_GB_POS 5
  339. #define MMC_TISR_TX65TO127OCTETS_GB_LEN 1
  340. #define MMC_TISR_TX128TO255OCTETS_GB_POS 6
  341. #define MMC_TISR_TX128TO255OCTETS_GB_LEN 1
  342. #define MMC_TISR_TX256TO511OCTETS_GB_POS 7
  343. #define MMC_TISR_TX256TO511OCTETS_GB_LEN 1
  344. #define MMC_TISR_TX512TO1023OCTETS_GB_POS 8
  345. #define MMC_TISR_TX512TO1023OCTETS_GB_LEN 1
  346. #define MMC_TISR_TX1024TOMAXOCTETS_GB_POS 9
  347. #define MMC_TISR_TX1024TOMAXOCTETS_GB_LEN 1
  348. #define MMC_TISR_TXUNICASTFRAMES_GB_POS 10
  349. #define MMC_TISR_TXUNICASTFRAMES_GB_LEN 1
  350. #define MMC_TISR_TXMULTICASTFRAMES_GB_POS 11
  351. #define MMC_TISR_TXMULTICASTFRAMES_GB_LEN 1
  352. #define MMC_TISR_TXBROADCASTFRAMES_GB_POS 12
  353. #define MMC_TISR_TXBROADCASTFRAMES_GB_LEN 1
  354. #define MMC_TISR_TXUNDERFLOWERROR_POS 13
  355. #define MMC_TISR_TXUNDERFLOWERROR_LEN 1
  356. #define MMC_TISR_TXOCTETCOUNT_G_POS 14
  357. #define MMC_TISR_TXOCTETCOUNT_G_LEN 1
  358. #define MMC_TISR_TXFRAMECOUNT_G_POS 15
  359. #define MMC_TISR_TXFRAMECOUNT_G_LEN 1
  360. #define MMC_TISR_TXPAUSEFRAMES_POS 16
  361. #define MMC_TISR_TXPAUSEFRAMES_LEN 1
  362. #define MMC_TISR_TXVLANFRAMES_G_POS 17
  363. #define MMC_TISR_TXVLANFRAMES_G_LEN 1
  364. /* MTL register offsets */
  365. #define MTL_OMR 0x1000
  366. #define MTL_FDDR 0x1010
  367. #define MTL_RQDCM0R 0x1030
  368. #define MTL_RQDCM_INC 4
  369. #define MTL_RQDCM_Q_PER_REG 4
  370. /* MTL register entry bit positions and sizes */
  371. #define MTL_OMR_ETSALG_POS 5
  372. #define MTL_OMR_ETSALG_LEN 2
  373. #define MTL_OMR_RAA_POS 2
  374. #define MTL_OMR_RAA_LEN 1
  375. /* MTL queue register offsets
  376. * Multiple queues can be active. The first queue has registers
  377. * that begin at 0x1100. Each subsequent queue has registers that
  378. * are accessed using an offset of 0x80 from the previous queue.
  379. */
  380. #define MTL_Q_BASE 0x1100
  381. #define MTL_Q_INC 0x80
  382. #define MTL_Q_TQOMR 0x00
  383. #define MTL_Q_RQOMR 0x40
  384. #define MTL_Q_RQDR 0x48
  385. #define MTL_Q_RQFCR 0x50
  386. #define MTL_Q_IER 0x70
  387. #define MTL_Q_ISR 0x74
  388. /* MTL queue register entry bit positions and sizes */
  389. #define MTL_Q_RQDR_PRXQ_POS 16
  390. #define MTL_Q_RQDR_PRXQ_LEN 14
  391. #define MTL_Q_RQDR_RXQSTS_POS 4
  392. #define MTL_Q_RQDR_RXQSTS_LEN 2
  393. #define MTL_Q_RQFCR_RFA_POS 1
  394. #define MTL_Q_RQFCR_RFA_LEN 6
  395. #define MTL_Q_RQFCR_RFD_POS 17
  396. #define MTL_Q_RQFCR_RFD_LEN 6
  397. #define MTL_Q_RQOMR_EHFC_POS 7
  398. #define MTL_Q_RQOMR_EHFC_LEN 1
  399. #define MTL_Q_RQOMR_RQS_POS 16
  400. #define MTL_Q_RQOMR_RQS_LEN 9
  401. #define MTL_Q_RQOMR_RSF_POS 5
  402. #define MTL_Q_RQOMR_RSF_LEN 1
  403. #define MTL_Q_RQOMR_FEP_POS 4
  404. #define MTL_Q_RQOMR_FEP_LEN 1
  405. #define MTL_Q_RQOMR_FUP_POS 3
  406. #define MTL_Q_RQOMR_FUP_LEN 1
  407. #define MTL_Q_RQOMR_RTC_POS 0
  408. #define MTL_Q_RQOMR_RTC_LEN 2
  409. #define MTL_Q_TQOMR_FTQ_POS 0
  410. #define MTL_Q_TQOMR_FTQ_LEN 1
  411. #define MTL_Q_TQOMR_Q2TCMAP_POS 8
  412. #define MTL_Q_TQOMR_Q2TCMAP_LEN 3
  413. #define MTL_Q_TQOMR_TQS_POS 16
  414. #define MTL_Q_TQOMR_TQS_LEN 10
  415. #define MTL_Q_TQOMR_TSF_POS 1
  416. #define MTL_Q_TQOMR_TSF_LEN 1
  417. #define MTL_Q_TQOMR_TTC_POS 4
  418. #define MTL_Q_TQOMR_TTC_LEN 3
  419. #define MTL_Q_TQOMR_TXQEN_POS 2
  420. #define MTL_Q_TQOMR_TXQEN_LEN 2
  421. /* MTL queue register value */
  422. #define MTL_RSF_DISABLE 0x00
  423. #define MTL_RSF_ENABLE 0x01
  424. #define MTL_TSF_DISABLE 0x00
  425. #define MTL_TSF_ENABLE 0x01
  426. #define MTL_RX_THRESHOLD_64 0x00
  427. #define MTL_RX_THRESHOLD_96 0x02
  428. #define MTL_RX_THRESHOLD_128 0x03
  429. #define MTL_TX_THRESHOLD_64 0x00
  430. #define MTL_TX_THRESHOLD_96 0x02
  431. #define MTL_TX_THRESHOLD_128 0x03
  432. #define MTL_TX_THRESHOLD_192 0x04
  433. #define MTL_TX_THRESHOLD_256 0x05
  434. #define MTL_TX_THRESHOLD_384 0x06
  435. #define MTL_TX_THRESHOLD_512 0x07
  436. #define MTL_ETSALG_WRR 0x00
  437. #define MTL_ETSALG_WFQ 0x01
  438. #define MTL_ETSALG_DWRR 0x02
  439. #define MTL_RAA_SP 0x00
  440. #define MTL_RAA_WSP 0x01
  441. #define MTL_Q_DISABLED 0x00
  442. #define MTL_Q_ENABLED 0x02
  443. #define MTL_RQDCM0R_Q0MDMACH 0x0
  444. #define MTL_RQDCM0R_Q1MDMACH 0x00000100
  445. #define MTL_RQDCM0R_Q2MDMACH 0x00020000
  446. #define MTL_RQDCM0R_Q3MDMACH 0x03000000
  447. #define MTL_RQDCM1R_Q4MDMACH 0x00000004
  448. #define MTL_RQDCM1R_Q5MDMACH 0x00000500
  449. #define MTL_RQDCM1R_Q6MDMACH 0x00060000
  450. #define MTL_RQDCM1R_Q7MDMACH 0x07000000
  451. #define MTL_RQDCM2R_Q8MDMACH 0x00000008
  452. #define MTL_RQDCM2R_Q9MDMACH 0x00000900
  453. #define MTL_RQDCM2R_Q10MDMACH 0x000A0000
  454. #define MTL_RQDCM2R_Q11MDMACH 0x0B000000
  455. /* MTL traffic class register offsets
  456. * Multiple traffic classes can be active. The first class has registers
  457. * that begin at 0x1100. Each subsequent queue has registers that
  458. * are accessed using an offset of 0x80 from the previous queue.
  459. */
  460. #define MTL_TC_BASE MTL_Q_BASE
  461. #define MTL_TC_INC MTL_Q_INC
  462. #define MTL_TC_ETSCR 0x10
  463. #define MTL_TC_ETSSR 0x14
  464. #define MTL_TC_QWR 0x18
  465. /* MTL traffic class register entry bit positions and sizes */
  466. #define MTL_TC_ETSCR_TSA_POS 0
  467. #define MTL_TC_ETSCR_TSA_LEN 2
  468. #define MTL_TC_QWR_QW_POS 0
  469. #define MTL_TC_QWR_QW_LEN 21
  470. /* MTL traffic class register value */
  471. #define MTL_TSA_SP 0x00
  472. #define MTL_TSA_ETS 0x02
  473. /* DMA register offsets */
  474. #define DMA_MR 0x3000
  475. #define DMA_SBMR 0x3004
  476. #define DMA_ISR 0x3008
  477. #define DMA_DSR0 0x3020
  478. #define DMA_DSR1 0x3024
  479. /* DMA register entry bit positions and sizes */
  480. #define DMA_ISR_MACIS_POS 17
  481. #define DMA_ISR_MACIS_LEN 1
  482. #define DMA_ISR_MTLIS_POS 16
  483. #define DMA_ISR_MTLIS_LEN 1
  484. #define DMA_MR_SWR_POS 0
  485. #define DMA_MR_SWR_LEN 1
  486. #define DMA_SBMR_EAME_POS 11
  487. #define DMA_SBMR_EAME_LEN 1
  488. #define DMA_SBMR_BLEN_64_POS 5
  489. #define DMA_SBMR_BLEN_64_LEN 1
  490. #define DMA_SBMR_BLEN_128_POS 6
  491. #define DMA_SBMR_BLEN_128_LEN 1
  492. #define DMA_SBMR_BLEN_256_POS 7
  493. #define DMA_SBMR_BLEN_256_LEN 1
  494. #define DMA_SBMR_UNDEF_POS 0
  495. #define DMA_SBMR_UNDEF_LEN 1
  496. /* DMA register values */
  497. #define DMA_DSR_RPS_LEN 4
  498. #define DMA_DSR_TPS_LEN 4
  499. #define DMA_DSR_Q_LEN (DMA_DSR_RPS_LEN + DMA_DSR_TPS_LEN)
  500. #define DMA_DSR0_TPS_START 12
  501. #define DMA_DSRX_FIRST_QUEUE 3
  502. #define DMA_DSRX_INC 4
  503. #define DMA_DSRX_QPR 4
  504. #define DMA_DSRX_TPS_START 4
  505. #define DMA_TPS_STOPPED 0x00
  506. #define DMA_TPS_SUSPENDED 0x06
  507. /* DMA channel register offsets
  508. * Multiple channels can be active. The first channel has registers
  509. * that begin at 0x3100. Each subsequent channel has registers that
  510. * are accessed using an offset of 0x80 from the previous channel.
  511. */
  512. #define DMA_CH_BASE 0x3100
  513. #define DMA_CH_INC 0x80
  514. #define DMA_CH_CR 0x00
  515. #define DMA_CH_TCR 0x04
  516. #define DMA_CH_RCR 0x08
  517. #define DMA_CH_TDLR_HI 0x10
  518. #define DMA_CH_TDLR_LO 0x14
  519. #define DMA_CH_RDLR_HI 0x18
  520. #define DMA_CH_RDLR_LO 0x1c
  521. #define DMA_CH_TDTR_LO 0x24
  522. #define DMA_CH_RDTR_LO 0x2c
  523. #define DMA_CH_TDRLR 0x30
  524. #define DMA_CH_RDRLR 0x34
  525. #define DMA_CH_IER 0x38
  526. #define DMA_CH_RIWT 0x3c
  527. #define DMA_CH_SR 0x60
  528. /* DMA channel register entry bit positions and sizes */
  529. #define DMA_CH_CR_PBLX8_POS 16
  530. #define DMA_CH_CR_PBLX8_LEN 1
  531. #define DMA_CH_CR_SPH_POS 24
  532. #define DMA_CH_CR_SPH_LEN 1
  533. #define DMA_CH_IER_AIE_POS 15
  534. #define DMA_CH_IER_AIE_LEN 1
  535. #define DMA_CH_IER_FBEE_POS 12
  536. #define DMA_CH_IER_FBEE_LEN 1
  537. #define DMA_CH_IER_NIE_POS 16
  538. #define DMA_CH_IER_NIE_LEN 1
  539. #define DMA_CH_IER_RBUE_POS 7
  540. #define DMA_CH_IER_RBUE_LEN 1
  541. #define DMA_CH_IER_RIE_POS 6
  542. #define DMA_CH_IER_RIE_LEN 1
  543. #define DMA_CH_IER_RSE_POS 8
  544. #define DMA_CH_IER_RSE_LEN 1
  545. #define DMA_CH_IER_TBUE_POS 2
  546. #define DMA_CH_IER_TBUE_LEN 1
  547. #define DMA_CH_IER_TIE_POS 0
  548. #define DMA_CH_IER_TIE_LEN 1
  549. #define DMA_CH_IER_TXSE_POS 1
  550. #define DMA_CH_IER_TXSE_LEN 1
  551. #define DMA_CH_RCR_PBL_POS 16
  552. #define DMA_CH_RCR_PBL_LEN 6
  553. #define DMA_CH_RCR_RBSZ_POS 1
  554. #define DMA_CH_RCR_RBSZ_LEN 14
  555. #define DMA_CH_RCR_SR_POS 0
  556. #define DMA_CH_RCR_SR_LEN 1
  557. #define DMA_CH_RIWT_RWT_POS 0
  558. #define DMA_CH_RIWT_RWT_LEN 8
  559. #define DMA_CH_SR_FBE_POS 12
  560. #define DMA_CH_SR_FBE_LEN 1
  561. #define DMA_CH_SR_RBU_POS 7
  562. #define DMA_CH_SR_RBU_LEN 1
  563. #define DMA_CH_SR_RI_POS 6
  564. #define DMA_CH_SR_RI_LEN 1
  565. #define DMA_CH_SR_RPS_POS 8
  566. #define DMA_CH_SR_RPS_LEN 1
  567. #define DMA_CH_SR_TBU_POS 2
  568. #define DMA_CH_SR_TBU_LEN 1
  569. #define DMA_CH_SR_TI_POS 0
  570. #define DMA_CH_SR_TI_LEN 1
  571. #define DMA_CH_SR_TPS_POS 1
  572. #define DMA_CH_SR_TPS_LEN 1
  573. #define DMA_CH_TCR_OSP_POS 4
  574. #define DMA_CH_TCR_OSP_LEN 1
  575. #define DMA_CH_TCR_PBL_POS 16
  576. #define DMA_CH_TCR_PBL_LEN 6
  577. #define DMA_CH_TCR_ST_POS 0
  578. #define DMA_CH_TCR_ST_LEN 1
  579. #define DMA_CH_TCR_TSE_POS 12
  580. #define DMA_CH_TCR_TSE_LEN 1
  581. /* DMA channel register values */
  582. #define DMA_OSP_DISABLE 0x00
  583. #define DMA_OSP_ENABLE 0x01
  584. #define DMA_PBL_1 1
  585. #define DMA_PBL_2 2
  586. #define DMA_PBL_4 4
  587. #define DMA_PBL_8 8
  588. #define DMA_PBL_16 16
  589. #define DMA_PBL_32 32
  590. #define DMA_PBL_64 64
  591. #define DMA_PBL_128 128
  592. #define DMA_PBL_256 256
  593. #define DMA_PBL_X8_DISABLE 0x00
  594. #define DMA_PBL_X8_ENABLE 0x01
  595. /* Descriptor/Packet entry bit positions and sizes */
  596. #define RX_PACKET_ERRORS_CRC_POS 2
  597. #define RX_PACKET_ERRORS_CRC_LEN 1
  598. #define RX_PACKET_ERRORS_FRAME_POS 3
  599. #define RX_PACKET_ERRORS_FRAME_LEN 1
  600. #define RX_PACKET_ERRORS_LENGTH_POS 0
  601. #define RX_PACKET_ERRORS_LENGTH_LEN 1
  602. #define RX_PACKET_ERRORS_OVERRUN_POS 1
  603. #define RX_PACKET_ERRORS_OVERRUN_LEN 1
  604. #define RX_PACKET_ATTRIBUTES_CSUM_DONE_POS 0
  605. #define RX_PACKET_ATTRIBUTES_CSUM_DONE_LEN 1
  606. #define RX_PACKET_ATTRIBUTES_VLAN_CTAG_POS 1
  607. #define RX_PACKET_ATTRIBUTES_VLAN_CTAG_LEN 1
  608. #define RX_PACKET_ATTRIBUTES_INCOMPLETE_POS 2
  609. #define RX_PACKET_ATTRIBUTES_INCOMPLETE_LEN 1
  610. #define RX_PACKET_ATTRIBUTES_CONTEXT_NEXT_POS 3
  611. #define RX_PACKET_ATTRIBUTES_CONTEXT_NEXT_LEN 1
  612. #define RX_PACKET_ATTRIBUTES_CONTEXT_POS 4
  613. #define RX_PACKET_ATTRIBUTES_CONTEXT_LEN 1
  614. #define RX_PACKET_ATTRIBUTES_RX_TSTAMP_POS 5
  615. #define RX_PACKET_ATTRIBUTES_RX_TSTAMP_LEN 1
  616. #define RX_PACKET_ATTRIBUTES_RSS_HASH_POS 6
  617. #define RX_PACKET_ATTRIBUTES_RSS_HASH_LEN 1
  618. #define RX_NORMAL_DESC0_OVT_POS 0
  619. #define RX_NORMAL_DESC0_OVT_LEN 16
  620. #define RX_NORMAL_DESC2_HL_POS 0
  621. #define RX_NORMAL_DESC2_HL_LEN 10
  622. #define RX_NORMAL_DESC3_CDA_POS 27
  623. #define RX_NORMAL_DESC3_CDA_LEN 1
  624. #define RX_NORMAL_DESC3_CTXT_POS 30
  625. #define RX_NORMAL_DESC3_CTXT_LEN 1
  626. #define RX_NORMAL_DESC3_ES_POS 15
  627. #define RX_NORMAL_DESC3_ES_LEN 1
  628. #define RX_NORMAL_DESC3_ETLT_POS 16
  629. #define RX_NORMAL_DESC3_ETLT_LEN 4
  630. #define RX_NORMAL_DESC3_FD_POS 29
  631. #define RX_NORMAL_DESC3_FD_LEN 1
  632. #define RX_NORMAL_DESC3_INTE_POS 30
  633. #define RX_NORMAL_DESC3_INTE_LEN 1
  634. #define RX_NORMAL_DESC3_L34T_POS 20
  635. #define RX_NORMAL_DESC3_L34T_LEN 4
  636. #define RX_NORMAL_DESC3_LD_POS 28
  637. #define RX_NORMAL_DESC3_LD_LEN 1
  638. #define RX_NORMAL_DESC3_OWN_POS 31
  639. #define RX_NORMAL_DESC3_OWN_LEN 1
  640. #define RX_NORMAL_DESC3_PL_POS 0
  641. #define RX_NORMAL_DESC3_PL_LEN 14
  642. #define RX_NORMAL_DESC3_RSV_POS 26
  643. #define RX_NORMAL_DESC3_RSV_LEN 1
  644. #define RX_DESC3_L34T_IPV4_TCP 1
  645. #define RX_DESC3_L34T_IPV4_UDP 2
  646. #define RX_DESC3_L34T_IPV4_ICMP 3
  647. #define RX_DESC3_L34T_IPV6_TCP 9
  648. #define RX_DESC3_L34T_IPV6_UDP 10
  649. #define RX_DESC3_L34T_IPV6_ICMP 11
  650. #define RX_CONTEXT_DESC3_TSA_POS 4
  651. #define RX_CONTEXT_DESC3_TSA_LEN 1
  652. #define RX_CONTEXT_DESC3_TSD_POS 6
  653. #define RX_CONTEXT_DESC3_TSD_LEN 1
  654. #define TX_PACKET_ATTRIBUTES_CSUM_ENABLE_POS 0
  655. #define TX_PACKET_ATTRIBUTES_CSUM_ENABLE_LEN 1
  656. #define TX_PACKET_ATTRIBUTES_TSO_ENABLE_POS 1
  657. #define TX_PACKET_ATTRIBUTES_TSO_ENABLE_LEN 1
  658. #define TX_PACKET_ATTRIBUTES_VLAN_CTAG_POS 2
  659. #define TX_PACKET_ATTRIBUTES_VLAN_CTAG_LEN 1
  660. #define TX_PACKET_ATTRIBUTES_PTP_POS 3
  661. #define TX_PACKET_ATTRIBUTES_PTP_LEN 1
  662. #define TX_CONTEXT_DESC2_MSS_POS 0
  663. #define TX_CONTEXT_DESC2_MSS_LEN 15
  664. #define TX_CONTEXT_DESC3_CTXT_POS 30
  665. #define TX_CONTEXT_DESC3_CTXT_LEN 1
  666. #define TX_CONTEXT_DESC3_TCMSSV_POS 26
  667. #define TX_CONTEXT_DESC3_TCMSSV_LEN 1
  668. #define TX_CONTEXT_DESC3_VLTV_POS 16
  669. #define TX_CONTEXT_DESC3_VLTV_LEN 1
  670. #define TX_CONTEXT_DESC3_VT_POS 0
  671. #define TX_CONTEXT_DESC3_VT_LEN 16
  672. #define TX_NORMAL_DESC2_HL_B1L_POS 0
  673. #define TX_NORMAL_DESC2_HL_B1L_LEN 14
  674. #define TX_NORMAL_DESC2_IC_POS 31
  675. #define TX_NORMAL_DESC2_IC_LEN 1
  676. #define TX_NORMAL_DESC2_TTSE_POS 30
  677. #define TX_NORMAL_DESC2_TTSE_LEN 1
  678. #define TX_NORMAL_DESC2_VTIR_POS 14
  679. #define TX_NORMAL_DESC2_VTIR_LEN 2
  680. #define TX_NORMAL_DESC3_CIC_POS 16
  681. #define TX_NORMAL_DESC3_CIC_LEN 2
  682. #define TX_NORMAL_DESC3_CPC_POS 26
  683. #define TX_NORMAL_DESC3_CPC_LEN 2
  684. #define TX_NORMAL_DESC3_CTXT_POS 30
  685. #define TX_NORMAL_DESC3_CTXT_LEN 1
  686. #define TX_NORMAL_DESC3_FD_POS 29
  687. #define TX_NORMAL_DESC3_FD_LEN 1
  688. #define TX_NORMAL_DESC3_FL_POS 0
  689. #define TX_NORMAL_DESC3_FL_LEN 15
  690. #define TX_NORMAL_DESC3_LD_POS 28
  691. #define TX_NORMAL_DESC3_LD_LEN 1
  692. #define TX_NORMAL_DESC3_OWN_POS 31
  693. #define TX_NORMAL_DESC3_OWN_LEN 1
  694. #define TX_NORMAL_DESC3_TCPHDRLEN_POS 19
  695. #define TX_NORMAL_DESC3_TCPHDRLEN_LEN 4
  696. #define TX_NORMAL_DESC3_TCPPL_POS 0
  697. #define TX_NORMAL_DESC3_TCPPL_LEN 18
  698. #define TX_NORMAL_DESC3_TSE_POS 18
  699. #define TX_NORMAL_DESC3_TSE_LEN 1
  700. #define TX_NORMAL_DESC2_VLAN_INSERT 0x2
  701. #define XLGMAC_MTL_REG(pdata, n, reg) \
  702. ((pdata)->mac_regs + MTL_Q_BASE + ((n) * MTL_Q_INC) + (reg))
  703. #define XLGMAC_DMA_REG(channel, reg) ((channel)->dma_regs + (reg))
  704. #endif /* __DWC_XLGMAC_REG_H__ */