xgbe-common.h 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093
  1. /*
  2. * AMD 10Gb Ethernet driver
  3. *
  4. * This file is available to you under your choice of the following two
  5. * licenses:
  6. *
  7. * License 1: GPLv2
  8. *
  9. * Copyright (c) 2014 Advanced Micro Devices, Inc.
  10. *
  11. * This file is free software; you may copy, redistribute and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation, either version 2 of the License, or (at
  14. * your option) any later version.
  15. *
  16. * This file is distributed in the hope that it will be useful, but
  17. * WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. * General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  23. *
  24. * This file incorporates work covered by the following copyright and
  25. * permission notice:
  26. * The Synopsys DWC ETHER XGMAC Software Driver and documentation
  27. * (hereinafter "Software") is an unsupported proprietary work of Synopsys,
  28. * Inc. unless otherwise expressly agreed to in writing between Synopsys
  29. * and you.
  30. *
  31. * The Software IS NOT an item of Licensed Software or Licensed Product
  32. * under any End User Software License Agreement or Agreement for Licensed
  33. * Product with Synopsys or any supplement thereto. Permission is hereby
  34. * granted, free of charge, to any person obtaining a copy of this software
  35. * annotated with this license and the Software, to deal in the Software
  36. * without restriction, including without limitation the rights to use,
  37. * copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  38. * of the Software, and to permit persons to whom the Software is furnished
  39. * to do so, subject to the following conditions:
  40. *
  41. * The above copyright notice and this permission notice shall be included
  42. * in all copies or substantial portions of the Software.
  43. *
  44. * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS"
  45. * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  46. * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  47. * PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS
  48. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  49. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  50. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  51. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  52. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  53. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  54. * THE POSSIBILITY OF SUCH DAMAGE.
  55. *
  56. *
  57. * License 2: Modified BSD
  58. *
  59. * Copyright (c) 2014 Advanced Micro Devices, Inc.
  60. * All rights reserved.
  61. *
  62. * Redistribution and use in source and binary forms, with or without
  63. * modification, are permitted provided that the following conditions are met:
  64. * * Redistributions of source code must retain the above copyright
  65. * notice, this list of conditions and the following disclaimer.
  66. * * Redistributions in binary form must reproduce the above copyright
  67. * notice, this list of conditions and the following disclaimer in the
  68. * documentation and/or other materials provided with the distribution.
  69. * * Neither the name of Advanced Micro Devices, Inc. nor the
  70. * names of its contributors may be used to endorse or promote products
  71. * derived from this software without specific prior written permission.
  72. *
  73. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  74. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  75. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  76. * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  77. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  78. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  79. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  80. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  81. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  82. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  83. *
  84. * This file incorporates work covered by the following copyright and
  85. * permission notice:
  86. * The Synopsys DWC ETHER XGMAC Software Driver and documentation
  87. * (hereinafter "Software") is an unsupported proprietary work of Synopsys,
  88. * Inc. unless otherwise expressly agreed to in writing between Synopsys
  89. * and you.
  90. *
  91. * The Software IS NOT an item of Licensed Software or Licensed Product
  92. * under any End User Software License Agreement or Agreement for Licensed
  93. * Product with Synopsys or any supplement thereto. Permission is hereby
  94. * granted, free of charge, to any person obtaining a copy of this software
  95. * annotated with this license and the Software, to deal in the Software
  96. * without restriction, including without limitation the rights to use,
  97. * copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  98. * of the Software, and to permit persons to whom the Software is furnished
  99. * to do so, subject to the following conditions:
  100. *
  101. * The above copyright notice and this permission notice shall be included
  102. * in all copies or substantial portions of the Software.
  103. *
  104. * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS"
  105. * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  106. * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  107. * PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS
  108. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  109. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  110. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  111. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  112. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  113. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  114. * THE POSSIBILITY OF SUCH DAMAGE.
  115. */
  116. #ifndef __XGBE_COMMON_H__
  117. #define __XGBE_COMMON_H__
  118. /* DMA register offsets */
  119. #define DMA_MR 0x3000
  120. #define DMA_SBMR 0x3004
  121. #define DMA_ISR 0x3008
  122. #define DMA_AXIARCR 0x3010
  123. #define DMA_AXIAWCR 0x3018
  124. #define DMA_DSR0 0x3020
  125. #define DMA_DSR1 0x3024
  126. #define DMA_DSR2 0x3028
  127. #define DMA_DSR3 0x302c
  128. #define DMA_DSR4 0x3030
  129. /* DMA register entry bit positions and sizes */
  130. #define DMA_AXIARCR_DRC_INDEX 0
  131. #define DMA_AXIARCR_DRC_WIDTH 4
  132. #define DMA_AXIARCR_DRD_INDEX 4
  133. #define DMA_AXIARCR_DRD_WIDTH 2
  134. #define DMA_AXIARCR_TEC_INDEX 8
  135. #define DMA_AXIARCR_TEC_WIDTH 4
  136. #define DMA_AXIARCR_TED_INDEX 12
  137. #define DMA_AXIARCR_TED_WIDTH 2
  138. #define DMA_AXIARCR_THC_INDEX 16
  139. #define DMA_AXIARCR_THC_WIDTH 4
  140. #define DMA_AXIARCR_THD_INDEX 20
  141. #define DMA_AXIARCR_THD_WIDTH 2
  142. #define DMA_AXIAWCR_DWC_INDEX 0
  143. #define DMA_AXIAWCR_DWC_WIDTH 4
  144. #define DMA_AXIAWCR_DWD_INDEX 4
  145. #define DMA_AXIAWCR_DWD_WIDTH 2
  146. #define DMA_AXIAWCR_RPC_INDEX 8
  147. #define DMA_AXIAWCR_RPC_WIDTH 4
  148. #define DMA_AXIAWCR_RPD_INDEX 12
  149. #define DMA_AXIAWCR_RPD_WIDTH 2
  150. #define DMA_AXIAWCR_RHC_INDEX 16
  151. #define DMA_AXIAWCR_RHC_WIDTH 4
  152. #define DMA_AXIAWCR_RHD_INDEX 20
  153. #define DMA_AXIAWCR_RHD_WIDTH 2
  154. #define DMA_AXIAWCR_TDC_INDEX 24
  155. #define DMA_AXIAWCR_TDC_WIDTH 4
  156. #define DMA_AXIAWCR_TDD_INDEX 28
  157. #define DMA_AXIAWCR_TDD_WIDTH 2
  158. #define DMA_DSR0_RPS_INDEX 8
  159. #define DMA_DSR0_RPS_WIDTH 4
  160. #define DMA_DSR0_TPS_INDEX 12
  161. #define DMA_DSR0_TPS_WIDTH 4
  162. #define DMA_ISR_MACIS_INDEX 17
  163. #define DMA_ISR_MACIS_WIDTH 1
  164. #define DMA_ISR_MTLIS_INDEX 16
  165. #define DMA_ISR_MTLIS_WIDTH 1
  166. #define DMA_MR_SWR_INDEX 0
  167. #define DMA_MR_SWR_WIDTH 1
  168. #define DMA_SBMR_EAME_INDEX 11
  169. #define DMA_SBMR_EAME_WIDTH 1
  170. #define DMA_SBMR_BLEN_256_INDEX 7
  171. #define DMA_SBMR_BLEN_256_WIDTH 1
  172. #define DMA_SBMR_UNDEF_INDEX 0
  173. #define DMA_SBMR_UNDEF_WIDTH 1
  174. /* DMA channel register offsets
  175. * Multiple channels can be active. The first channel has registers
  176. * that begin at 0x3100. Each subsequent channel has registers that
  177. * are accessed using an offset of 0x80 from the previous channel.
  178. */
  179. #define DMA_CH_BASE 0x3100
  180. #define DMA_CH_INC 0x80
  181. #define DMA_CH_CR 0x00
  182. #define DMA_CH_TCR 0x04
  183. #define DMA_CH_RCR 0x08
  184. #define DMA_CH_TDLR_HI 0x10
  185. #define DMA_CH_TDLR_LO 0x14
  186. #define DMA_CH_RDLR_HI 0x18
  187. #define DMA_CH_RDLR_LO 0x1c
  188. #define DMA_CH_TDTR_LO 0x24
  189. #define DMA_CH_RDTR_LO 0x2c
  190. #define DMA_CH_TDRLR 0x30
  191. #define DMA_CH_RDRLR 0x34
  192. #define DMA_CH_IER 0x38
  193. #define DMA_CH_RIWT 0x3c
  194. #define DMA_CH_CATDR_LO 0x44
  195. #define DMA_CH_CARDR_LO 0x4c
  196. #define DMA_CH_CATBR_HI 0x50
  197. #define DMA_CH_CATBR_LO 0x54
  198. #define DMA_CH_CARBR_HI 0x58
  199. #define DMA_CH_CARBR_LO 0x5c
  200. #define DMA_CH_SR 0x60
  201. /* DMA channel register entry bit positions and sizes */
  202. #define DMA_CH_CR_PBLX8_INDEX 16
  203. #define DMA_CH_CR_PBLX8_WIDTH 1
  204. #define DMA_CH_IER_AIE_INDEX 15
  205. #define DMA_CH_IER_AIE_WIDTH 1
  206. #define DMA_CH_IER_FBEE_INDEX 12
  207. #define DMA_CH_IER_FBEE_WIDTH 1
  208. #define DMA_CH_IER_NIE_INDEX 16
  209. #define DMA_CH_IER_NIE_WIDTH 1
  210. #define DMA_CH_IER_RBUE_INDEX 7
  211. #define DMA_CH_IER_RBUE_WIDTH 1
  212. #define DMA_CH_IER_RIE_INDEX 6
  213. #define DMA_CH_IER_RIE_WIDTH 1
  214. #define DMA_CH_IER_RSE_INDEX 8
  215. #define DMA_CH_IER_RSE_WIDTH 1
  216. #define DMA_CH_IER_TBUE_INDEX 2
  217. #define DMA_CH_IER_TBUE_WIDTH 1
  218. #define DMA_CH_IER_TIE_INDEX 0
  219. #define DMA_CH_IER_TIE_WIDTH 1
  220. #define DMA_CH_IER_TXSE_INDEX 1
  221. #define DMA_CH_IER_TXSE_WIDTH 1
  222. #define DMA_CH_RCR_PBL_INDEX 16
  223. #define DMA_CH_RCR_PBL_WIDTH 6
  224. #define DMA_CH_RCR_RBSZ_INDEX 1
  225. #define DMA_CH_RCR_RBSZ_WIDTH 14
  226. #define DMA_CH_RCR_SR_INDEX 0
  227. #define DMA_CH_RCR_SR_WIDTH 1
  228. #define DMA_CH_RIWT_RWT_INDEX 0
  229. #define DMA_CH_RIWT_RWT_WIDTH 8
  230. #define DMA_CH_SR_FBE_INDEX 12
  231. #define DMA_CH_SR_FBE_WIDTH 1
  232. #define DMA_CH_SR_RBU_INDEX 7
  233. #define DMA_CH_SR_RBU_WIDTH 1
  234. #define DMA_CH_SR_RI_INDEX 6
  235. #define DMA_CH_SR_RI_WIDTH 1
  236. #define DMA_CH_SR_RPS_INDEX 8
  237. #define DMA_CH_SR_RPS_WIDTH 1
  238. #define DMA_CH_SR_TBU_INDEX 2
  239. #define DMA_CH_SR_TBU_WIDTH 1
  240. #define DMA_CH_SR_TI_INDEX 0
  241. #define DMA_CH_SR_TI_WIDTH 1
  242. #define DMA_CH_SR_TPS_INDEX 1
  243. #define DMA_CH_SR_TPS_WIDTH 1
  244. #define DMA_CH_TCR_OSP_INDEX 4
  245. #define DMA_CH_TCR_OSP_WIDTH 1
  246. #define DMA_CH_TCR_PBL_INDEX 16
  247. #define DMA_CH_TCR_PBL_WIDTH 6
  248. #define DMA_CH_TCR_ST_INDEX 0
  249. #define DMA_CH_TCR_ST_WIDTH 1
  250. #define DMA_CH_TCR_TSE_INDEX 12
  251. #define DMA_CH_TCR_TSE_WIDTH 1
  252. /* DMA channel register values */
  253. #define DMA_OSP_DISABLE 0x00
  254. #define DMA_OSP_ENABLE 0x01
  255. #define DMA_PBL_1 1
  256. #define DMA_PBL_2 2
  257. #define DMA_PBL_4 4
  258. #define DMA_PBL_8 8
  259. #define DMA_PBL_16 16
  260. #define DMA_PBL_32 32
  261. #define DMA_PBL_64 64 /* 8 x 8 */
  262. #define DMA_PBL_128 128 /* 8 x 16 */
  263. #define DMA_PBL_256 256 /* 8 x 32 */
  264. #define DMA_PBL_X8_DISABLE 0x00
  265. #define DMA_PBL_X8_ENABLE 0x01
  266. /* MAC register offsets */
  267. #define MAC_TCR 0x0000
  268. #define MAC_RCR 0x0004
  269. #define MAC_PFR 0x0008
  270. #define MAC_WTR 0x000c
  271. #define MAC_HTR0 0x0010
  272. #define MAC_VLANTR 0x0050
  273. #define MAC_VLANHTR 0x0058
  274. #define MAC_VLANIR 0x0060
  275. #define MAC_IVLANIR 0x0064
  276. #define MAC_RETMR 0x006c
  277. #define MAC_Q0TFCR 0x0070
  278. #define MAC_RFCR 0x0090
  279. #define MAC_RQC0R 0x00a0
  280. #define MAC_RQC1R 0x00a4
  281. #define MAC_RQC2R 0x00a8
  282. #define MAC_RQC3R 0x00ac
  283. #define MAC_ISR 0x00b0
  284. #define MAC_IER 0x00b4
  285. #define MAC_RTSR 0x00b8
  286. #define MAC_PMTCSR 0x00c0
  287. #define MAC_RWKPFR 0x00c4
  288. #define MAC_LPICSR 0x00d0
  289. #define MAC_LPITCR 0x00d4
  290. #define MAC_VR 0x0110
  291. #define MAC_DR 0x0114
  292. #define MAC_HWF0R 0x011c
  293. #define MAC_HWF1R 0x0120
  294. #define MAC_HWF2R 0x0124
  295. #define MAC_GPIOCR 0x0278
  296. #define MAC_GPIOSR 0x027c
  297. #define MAC_MACA0HR 0x0300
  298. #define MAC_MACA0LR 0x0304
  299. #define MAC_MACA1HR 0x0308
  300. #define MAC_MACA1LR 0x030c
  301. #define MAC_TSCR 0x0d00
  302. #define MAC_SSIR 0x0d04
  303. #define MAC_STSR 0x0d08
  304. #define MAC_STNR 0x0d0c
  305. #define MAC_STSUR 0x0d10
  306. #define MAC_STNUR 0x0d14
  307. #define MAC_TSAR 0x0d18
  308. #define MAC_TSSR 0x0d20
  309. #define MAC_TXSNR 0x0d30
  310. #define MAC_TXSSR 0x0d34
  311. #define MAC_QTFCR_INC 4
  312. #define MAC_MACA_INC 4
  313. #define MAC_HTR_INC 4
  314. #define MAC_RQC2_INC 4
  315. #define MAC_RQC2_Q_PER_REG 4
  316. /* MAC register entry bit positions and sizes */
  317. #define MAC_HWF0R_ADDMACADRSEL_INDEX 18
  318. #define MAC_HWF0R_ADDMACADRSEL_WIDTH 5
  319. #define MAC_HWF0R_ARPOFFSEL_INDEX 9
  320. #define MAC_HWF0R_ARPOFFSEL_WIDTH 1
  321. #define MAC_HWF0R_EEESEL_INDEX 13
  322. #define MAC_HWF0R_EEESEL_WIDTH 1
  323. #define MAC_HWF0R_GMIISEL_INDEX 1
  324. #define MAC_HWF0R_GMIISEL_WIDTH 1
  325. #define MAC_HWF0R_MGKSEL_INDEX 7
  326. #define MAC_HWF0R_MGKSEL_WIDTH 1
  327. #define MAC_HWF0R_MMCSEL_INDEX 8
  328. #define MAC_HWF0R_MMCSEL_WIDTH 1
  329. #define MAC_HWF0R_RWKSEL_INDEX 6
  330. #define MAC_HWF0R_RWKSEL_WIDTH 1
  331. #define MAC_HWF0R_RXCOESEL_INDEX 16
  332. #define MAC_HWF0R_RXCOESEL_WIDTH 1
  333. #define MAC_HWF0R_SAVLANINS_INDEX 27
  334. #define MAC_HWF0R_SAVLANINS_WIDTH 1
  335. #define MAC_HWF0R_SMASEL_INDEX 5
  336. #define MAC_HWF0R_SMASEL_WIDTH 1
  337. #define MAC_HWF0R_TSSEL_INDEX 12
  338. #define MAC_HWF0R_TSSEL_WIDTH 1
  339. #define MAC_HWF0R_TSSTSSEL_INDEX 25
  340. #define MAC_HWF0R_TSSTSSEL_WIDTH 2
  341. #define MAC_HWF0R_TXCOESEL_INDEX 14
  342. #define MAC_HWF0R_TXCOESEL_WIDTH 1
  343. #define MAC_HWF0R_VLHASH_INDEX 4
  344. #define MAC_HWF0R_VLHASH_WIDTH 1
  345. #define MAC_HWF1R_ADVTHWORD_INDEX 13
  346. #define MAC_HWF1R_ADVTHWORD_WIDTH 1
  347. #define MAC_HWF1R_DBGMEMA_INDEX 19
  348. #define MAC_HWF1R_DBGMEMA_WIDTH 1
  349. #define MAC_HWF1R_DCBEN_INDEX 16
  350. #define MAC_HWF1R_DCBEN_WIDTH 1
  351. #define MAC_HWF1R_HASHTBLSZ_INDEX 24
  352. #define MAC_HWF1R_HASHTBLSZ_WIDTH 3
  353. #define MAC_HWF1R_L3L4FNUM_INDEX 27
  354. #define MAC_HWF1R_L3L4FNUM_WIDTH 4
  355. #define MAC_HWF1R_NUMTC_INDEX 21
  356. #define MAC_HWF1R_NUMTC_WIDTH 3
  357. #define MAC_HWF1R_RSSEN_INDEX 20
  358. #define MAC_HWF1R_RSSEN_WIDTH 1
  359. #define MAC_HWF1R_RXFIFOSIZE_INDEX 0
  360. #define MAC_HWF1R_RXFIFOSIZE_WIDTH 5
  361. #define MAC_HWF1R_SPHEN_INDEX 17
  362. #define MAC_HWF1R_SPHEN_WIDTH 1
  363. #define MAC_HWF1R_TSOEN_INDEX 18
  364. #define MAC_HWF1R_TSOEN_WIDTH 1
  365. #define MAC_HWF1R_TXFIFOSIZE_INDEX 6
  366. #define MAC_HWF1R_TXFIFOSIZE_WIDTH 5
  367. #define MAC_HWF2R_AUXSNAPNUM_INDEX 28
  368. #define MAC_HWF2R_AUXSNAPNUM_WIDTH 3
  369. #define MAC_HWF2R_PPSOUTNUM_INDEX 24
  370. #define MAC_HWF2R_PPSOUTNUM_WIDTH 3
  371. #define MAC_HWF2R_RXCHCNT_INDEX 12
  372. #define MAC_HWF2R_RXCHCNT_WIDTH 4
  373. #define MAC_HWF2R_RXQCNT_INDEX 0
  374. #define MAC_HWF2R_RXQCNT_WIDTH 4
  375. #define MAC_HWF2R_TXCHCNT_INDEX 18
  376. #define MAC_HWF2R_TXCHCNT_WIDTH 4
  377. #define MAC_HWF2R_TXQCNT_INDEX 6
  378. #define MAC_HWF2R_TXQCNT_WIDTH 4
  379. #define MAC_IER_TSIE_INDEX 12
  380. #define MAC_IER_TSIE_WIDTH 1
  381. #define MAC_ISR_MMCRXIS_INDEX 9
  382. #define MAC_ISR_MMCRXIS_WIDTH 1
  383. #define MAC_ISR_MMCTXIS_INDEX 10
  384. #define MAC_ISR_MMCTXIS_WIDTH 1
  385. #define MAC_ISR_PMTIS_INDEX 4
  386. #define MAC_ISR_PMTIS_WIDTH 1
  387. #define MAC_ISR_TSIS_INDEX 12
  388. #define MAC_ISR_TSIS_WIDTH 1
  389. #define MAC_MACA1HR_AE_INDEX 31
  390. #define MAC_MACA1HR_AE_WIDTH 1
  391. #define MAC_PFR_HMC_INDEX 2
  392. #define MAC_PFR_HMC_WIDTH 1
  393. #define MAC_PFR_HPF_INDEX 10
  394. #define MAC_PFR_HPF_WIDTH 1
  395. #define MAC_PFR_HUC_INDEX 1
  396. #define MAC_PFR_HUC_WIDTH 1
  397. #define MAC_PFR_PM_INDEX 4
  398. #define MAC_PFR_PM_WIDTH 1
  399. #define MAC_PFR_PR_INDEX 0
  400. #define MAC_PFR_PR_WIDTH 1
  401. #define MAC_PFR_VTFE_INDEX 16
  402. #define MAC_PFR_VTFE_WIDTH 1
  403. #define MAC_PMTCSR_MGKPKTEN_INDEX 1
  404. #define MAC_PMTCSR_MGKPKTEN_WIDTH 1
  405. #define MAC_PMTCSR_PWRDWN_INDEX 0
  406. #define MAC_PMTCSR_PWRDWN_WIDTH 1
  407. #define MAC_PMTCSR_RWKFILTRST_INDEX 31
  408. #define MAC_PMTCSR_RWKFILTRST_WIDTH 1
  409. #define MAC_PMTCSR_RWKPKTEN_INDEX 2
  410. #define MAC_PMTCSR_RWKPKTEN_WIDTH 1
  411. #define MAC_Q0TFCR_PT_INDEX 16
  412. #define MAC_Q0TFCR_PT_WIDTH 16
  413. #define MAC_Q0TFCR_TFE_INDEX 1
  414. #define MAC_Q0TFCR_TFE_WIDTH 1
  415. #define MAC_RCR_ACS_INDEX 1
  416. #define MAC_RCR_ACS_WIDTH 1
  417. #define MAC_RCR_CST_INDEX 2
  418. #define MAC_RCR_CST_WIDTH 1
  419. #define MAC_RCR_DCRCC_INDEX 3
  420. #define MAC_RCR_DCRCC_WIDTH 1
  421. #define MAC_RCR_IPC_INDEX 9
  422. #define MAC_RCR_IPC_WIDTH 1
  423. #define MAC_RCR_JE_INDEX 8
  424. #define MAC_RCR_JE_WIDTH 1
  425. #define MAC_RCR_LM_INDEX 10
  426. #define MAC_RCR_LM_WIDTH 1
  427. #define MAC_RCR_RE_INDEX 0
  428. #define MAC_RCR_RE_WIDTH 1
  429. #define MAC_RFCR_PFCE_INDEX 8
  430. #define MAC_RFCR_PFCE_WIDTH 1
  431. #define MAC_RFCR_RFE_INDEX 0
  432. #define MAC_RFCR_RFE_WIDTH 1
  433. #define MAC_RFCR_UP_INDEX 1
  434. #define MAC_RFCR_UP_WIDTH 1
  435. #define MAC_RQC0R_RXQ0EN_INDEX 0
  436. #define MAC_RQC0R_RXQ0EN_WIDTH 2
  437. #define MAC_SSIR_SNSINC_INDEX 8
  438. #define MAC_SSIR_SNSINC_WIDTH 8
  439. #define MAC_SSIR_SSINC_INDEX 16
  440. #define MAC_SSIR_SSINC_WIDTH 8
  441. #define MAC_TCR_SS_INDEX 29
  442. #define MAC_TCR_SS_WIDTH 2
  443. #define MAC_TCR_TE_INDEX 0
  444. #define MAC_TCR_TE_WIDTH 1
  445. #define MAC_TSCR_AV8021ASMEN_INDEX 28
  446. #define MAC_TSCR_AV8021ASMEN_WIDTH 1
  447. #define MAC_TSCR_SNAPTYPSEL_INDEX 16
  448. #define MAC_TSCR_SNAPTYPSEL_WIDTH 2
  449. #define MAC_TSCR_TSADDREG_INDEX 5
  450. #define MAC_TSCR_TSADDREG_WIDTH 1
  451. #define MAC_TSCR_TSCFUPDT_INDEX 1
  452. #define MAC_TSCR_TSCFUPDT_WIDTH 1
  453. #define MAC_TSCR_TSCTRLSSR_INDEX 9
  454. #define MAC_TSCR_TSCTRLSSR_WIDTH 1
  455. #define MAC_TSCR_TSENA_INDEX 0
  456. #define MAC_TSCR_TSENA_WIDTH 1
  457. #define MAC_TSCR_TSENALL_INDEX 8
  458. #define MAC_TSCR_TSENALL_WIDTH 1
  459. #define MAC_TSCR_TSEVNTENA_INDEX 14
  460. #define MAC_TSCR_TSEVNTENA_WIDTH 1
  461. #define MAC_TSCR_TSINIT_INDEX 2
  462. #define MAC_TSCR_TSINIT_WIDTH 1
  463. #define MAC_TSCR_TSIPENA_INDEX 11
  464. #define MAC_TSCR_TSIPENA_WIDTH 1
  465. #define MAC_TSCR_TSIPV4ENA_INDEX 13
  466. #define MAC_TSCR_TSIPV4ENA_WIDTH 1
  467. #define MAC_TSCR_TSIPV6ENA_INDEX 12
  468. #define MAC_TSCR_TSIPV6ENA_WIDTH 1
  469. #define MAC_TSCR_TSMSTRENA_INDEX 15
  470. #define MAC_TSCR_TSMSTRENA_WIDTH 1
  471. #define MAC_TSCR_TSVER2ENA_INDEX 10
  472. #define MAC_TSCR_TSVER2ENA_WIDTH 1
  473. #define MAC_TSCR_TXTSSTSM_INDEX 24
  474. #define MAC_TSCR_TXTSSTSM_WIDTH 1
  475. #define MAC_TSSR_TXTSC_INDEX 15
  476. #define MAC_TSSR_TXTSC_WIDTH 1
  477. #define MAC_TXSNR_TXTSSTSMIS_INDEX 31
  478. #define MAC_TXSNR_TXTSSTSMIS_WIDTH 1
  479. #define MAC_VLANHTR_VLHT_INDEX 0
  480. #define MAC_VLANHTR_VLHT_WIDTH 16
  481. #define MAC_VLANIR_VLTI_INDEX 20
  482. #define MAC_VLANIR_VLTI_WIDTH 1
  483. #define MAC_VLANIR_CSVL_INDEX 19
  484. #define MAC_VLANIR_CSVL_WIDTH 1
  485. #define MAC_VLANTR_DOVLTC_INDEX 20
  486. #define MAC_VLANTR_DOVLTC_WIDTH 1
  487. #define MAC_VLANTR_ERSVLM_INDEX 19
  488. #define MAC_VLANTR_ERSVLM_WIDTH 1
  489. #define MAC_VLANTR_ESVL_INDEX 18
  490. #define MAC_VLANTR_ESVL_WIDTH 1
  491. #define MAC_VLANTR_ETV_INDEX 16
  492. #define MAC_VLANTR_ETV_WIDTH 1
  493. #define MAC_VLANTR_EVLS_INDEX 21
  494. #define MAC_VLANTR_EVLS_WIDTH 2
  495. #define MAC_VLANTR_EVLRXS_INDEX 24
  496. #define MAC_VLANTR_EVLRXS_WIDTH 1
  497. #define MAC_VLANTR_VL_INDEX 0
  498. #define MAC_VLANTR_VL_WIDTH 16
  499. #define MAC_VLANTR_VTHM_INDEX 25
  500. #define MAC_VLANTR_VTHM_WIDTH 1
  501. #define MAC_VLANTR_VTIM_INDEX 17
  502. #define MAC_VLANTR_VTIM_WIDTH 1
  503. #define MAC_VR_DEVID_INDEX 8
  504. #define MAC_VR_DEVID_WIDTH 8
  505. #define MAC_VR_SNPSVER_INDEX 0
  506. #define MAC_VR_SNPSVER_WIDTH 8
  507. #define MAC_VR_USERVER_INDEX 16
  508. #define MAC_VR_USERVER_WIDTH 8
  509. /* MMC register offsets */
  510. #define MMC_CR 0x0800
  511. #define MMC_RISR 0x0804
  512. #define MMC_TISR 0x0808
  513. #define MMC_RIER 0x080c
  514. #define MMC_TIER 0x0810
  515. #define MMC_TXOCTETCOUNT_GB_LO 0x0814
  516. #define MMC_TXOCTETCOUNT_GB_HI 0x0818
  517. #define MMC_TXFRAMECOUNT_GB_LO 0x081c
  518. #define MMC_TXFRAMECOUNT_GB_HI 0x0820
  519. #define MMC_TXBROADCASTFRAMES_G_LO 0x0824
  520. #define MMC_TXBROADCASTFRAMES_G_HI 0x0828
  521. #define MMC_TXMULTICASTFRAMES_G_LO 0x082c
  522. #define MMC_TXMULTICASTFRAMES_G_HI 0x0830
  523. #define MMC_TX64OCTETS_GB_LO 0x0834
  524. #define MMC_TX64OCTETS_GB_HI 0x0838
  525. #define MMC_TX65TO127OCTETS_GB_LO 0x083c
  526. #define MMC_TX65TO127OCTETS_GB_HI 0x0840
  527. #define MMC_TX128TO255OCTETS_GB_LO 0x0844
  528. #define MMC_TX128TO255OCTETS_GB_HI 0x0848
  529. #define MMC_TX256TO511OCTETS_GB_LO 0x084c
  530. #define MMC_TX256TO511OCTETS_GB_HI 0x0850
  531. #define MMC_TX512TO1023OCTETS_GB_LO 0x0854
  532. #define MMC_TX512TO1023OCTETS_GB_HI 0x0858
  533. #define MMC_TX1024TOMAXOCTETS_GB_LO 0x085c
  534. #define MMC_TX1024TOMAXOCTETS_GB_HI 0x0860
  535. #define MMC_TXUNICASTFRAMES_GB_LO 0x0864
  536. #define MMC_TXUNICASTFRAMES_GB_HI 0x0868
  537. #define MMC_TXMULTICASTFRAMES_GB_LO 0x086c
  538. #define MMC_TXMULTICASTFRAMES_GB_HI 0x0870
  539. #define MMC_TXBROADCASTFRAMES_GB_LO 0x0874
  540. #define MMC_TXBROADCASTFRAMES_GB_HI 0x0878
  541. #define MMC_TXUNDERFLOWERROR_LO 0x087c
  542. #define MMC_TXUNDERFLOWERROR_HI 0x0880
  543. #define MMC_TXOCTETCOUNT_G_LO 0x0884
  544. #define MMC_TXOCTETCOUNT_G_HI 0x0888
  545. #define MMC_TXFRAMECOUNT_G_LO 0x088c
  546. #define MMC_TXFRAMECOUNT_G_HI 0x0890
  547. #define MMC_TXPAUSEFRAMES_LO 0x0894
  548. #define MMC_TXPAUSEFRAMES_HI 0x0898
  549. #define MMC_TXVLANFRAMES_G_LO 0x089c
  550. #define MMC_TXVLANFRAMES_G_HI 0x08a0
  551. #define MMC_RXFRAMECOUNT_GB_LO 0x0900
  552. #define MMC_RXFRAMECOUNT_GB_HI 0x0904
  553. #define MMC_RXOCTETCOUNT_GB_LO 0x0908
  554. #define MMC_RXOCTETCOUNT_GB_HI 0x090c
  555. #define MMC_RXOCTETCOUNT_G_LO 0x0910
  556. #define MMC_RXOCTETCOUNT_G_HI 0x0914
  557. #define MMC_RXBROADCASTFRAMES_G_LO 0x0918
  558. #define MMC_RXBROADCASTFRAMES_G_HI 0x091c
  559. #define MMC_RXMULTICASTFRAMES_G_LO 0x0920
  560. #define MMC_RXMULTICASTFRAMES_G_HI 0x0924
  561. #define MMC_RXCRCERROR_LO 0x0928
  562. #define MMC_RXCRCERROR_HI 0x092c
  563. #define MMC_RXRUNTERROR 0x0930
  564. #define MMC_RXJABBERERROR 0x0934
  565. #define MMC_RXUNDERSIZE_G 0x0938
  566. #define MMC_RXOVERSIZE_G 0x093c
  567. #define MMC_RX64OCTETS_GB_LO 0x0940
  568. #define MMC_RX64OCTETS_GB_HI 0x0944
  569. #define MMC_RX65TO127OCTETS_GB_LO 0x0948
  570. #define MMC_RX65TO127OCTETS_GB_HI 0x094c
  571. #define MMC_RX128TO255OCTETS_GB_LO 0x0950
  572. #define MMC_RX128TO255OCTETS_GB_HI 0x0954
  573. #define MMC_RX256TO511OCTETS_GB_LO 0x0958
  574. #define MMC_RX256TO511OCTETS_GB_HI 0x095c
  575. #define MMC_RX512TO1023OCTETS_GB_LO 0x0960
  576. #define MMC_RX512TO1023OCTETS_GB_HI 0x0964
  577. #define MMC_RX1024TOMAXOCTETS_GB_LO 0x0968
  578. #define MMC_RX1024TOMAXOCTETS_GB_HI 0x096c
  579. #define MMC_RXUNICASTFRAMES_G_LO 0x0970
  580. #define MMC_RXUNICASTFRAMES_G_HI 0x0974
  581. #define MMC_RXLENGTHERROR_LO 0x0978
  582. #define MMC_RXLENGTHERROR_HI 0x097c
  583. #define MMC_RXOUTOFRANGETYPE_LO 0x0980
  584. #define MMC_RXOUTOFRANGETYPE_HI 0x0984
  585. #define MMC_RXPAUSEFRAMES_LO 0x0988
  586. #define MMC_RXPAUSEFRAMES_HI 0x098c
  587. #define MMC_RXFIFOOVERFLOW_LO 0x0990
  588. #define MMC_RXFIFOOVERFLOW_HI 0x0994
  589. #define MMC_RXVLANFRAMES_GB_LO 0x0998
  590. #define MMC_RXVLANFRAMES_GB_HI 0x099c
  591. #define MMC_RXWATCHDOGERROR 0x09a0
  592. /* MMC register entry bit positions and sizes */
  593. #define MMC_CR_CR_INDEX 0
  594. #define MMC_CR_CR_WIDTH 1
  595. #define MMC_CR_CSR_INDEX 1
  596. #define MMC_CR_CSR_WIDTH 1
  597. #define MMC_CR_ROR_INDEX 2
  598. #define MMC_CR_ROR_WIDTH 1
  599. #define MMC_CR_MCF_INDEX 3
  600. #define MMC_CR_MCF_WIDTH 1
  601. #define MMC_CR_MCT_INDEX 4
  602. #define MMC_CR_MCT_WIDTH 2
  603. #define MMC_RIER_ALL_INTERRUPTS_INDEX 0
  604. #define MMC_RIER_ALL_INTERRUPTS_WIDTH 23
  605. #define MMC_RISR_RXFRAMECOUNT_GB_INDEX 0
  606. #define MMC_RISR_RXFRAMECOUNT_GB_WIDTH 1
  607. #define MMC_RISR_RXOCTETCOUNT_GB_INDEX 1
  608. #define MMC_RISR_RXOCTETCOUNT_GB_WIDTH 1
  609. #define MMC_RISR_RXOCTETCOUNT_G_INDEX 2
  610. #define MMC_RISR_RXOCTETCOUNT_G_WIDTH 1
  611. #define MMC_RISR_RXBROADCASTFRAMES_G_INDEX 3
  612. #define MMC_RISR_RXBROADCASTFRAMES_G_WIDTH 1
  613. #define MMC_RISR_RXMULTICASTFRAMES_G_INDEX 4
  614. #define MMC_RISR_RXMULTICASTFRAMES_G_WIDTH 1
  615. #define MMC_RISR_RXCRCERROR_INDEX 5
  616. #define MMC_RISR_RXCRCERROR_WIDTH 1
  617. #define MMC_RISR_RXRUNTERROR_INDEX 6
  618. #define MMC_RISR_RXRUNTERROR_WIDTH 1
  619. #define MMC_RISR_RXJABBERERROR_INDEX 7
  620. #define MMC_RISR_RXJABBERERROR_WIDTH 1
  621. #define MMC_RISR_RXUNDERSIZE_G_INDEX 8
  622. #define MMC_RISR_RXUNDERSIZE_G_WIDTH 1
  623. #define MMC_RISR_RXOVERSIZE_G_INDEX 9
  624. #define MMC_RISR_RXOVERSIZE_G_WIDTH 1
  625. #define MMC_RISR_RX64OCTETS_GB_INDEX 10
  626. #define MMC_RISR_RX64OCTETS_GB_WIDTH 1
  627. #define MMC_RISR_RX65TO127OCTETS_GB_INDEX 11
  628. #define MMC_RISR_RX65TO127OCTETS_GB_WIDTH 1
  629. #define MMC_RISR_RX128TO255OCTETS_GB_INDEX 12
  630. #define MMC_RISR_RX128TO255OCTETS_GB_WIDTH 1
  631. #define MMC_RISR_RX256TO511OCTETS_GB_INDEX 13
  632. #define MMC_RISR_RX256TO511OCTETS_GB_WIDTH 1
  633. #define MMC_RISR_RX512TO1023OCTETS_GB_INDEX 14
  634. #define MMC_RISR_RX512TO1023OCTETS_GB_WIDTH 1
  635. #define MMC_RISR_RX1024TOMAXOCTETS_GB_INDEX 15
  636. #define MMC_RISR_RX1024TOMAXOCTETS_GB_WIDTH 1
  637. #define MMC_RISR_RXUNICASTFRAMES_G_INDEX 16
  638. #define MMC_RISR_RXUNICASTFRAMES_G_WIDTH 1
  639. #define MMC_RISR_RXLENGTHERROR_INDEX 17
  640. #define MMC_RISR_RXLENGTHERROR_WIDTH 1
  641. #define MMC_RISR_RXOUTOFRANGETYPE_INDEX 18
  642. #define MMC_RISR_RXOUTOFRANGETYPE_WIDTH 1
  643. #define MMC_RISR_RXPAUSEFRAMES_INDEX 19
  644. #define MMC_RISR_RXPAUSEFRAMES_WIDTH 1
  645. #define MMC_RISR_RXFIFOOVERFLOW_INDEX 20
  646. #define MMC_RISR_RXFIFOOVERFLOW_WIDTH 1
  647. #define MMC_RISR_RXVLANFRAMES_GB_INDEX 21
  648. #define MMC_RISR_RXVLANFRAMES_GB_WIDTH 1
  649. #define MMC_RISR_RXWATCHDOGERROR_INDEX 22
  650. #define MMC_RISR_RXWATCHDOGERROR_WIDTH 1
  651. #define MMC_TIER_ALL_INTERRUPTS_INDEX 0
  652. #define MMC_TIER_ALL_INTERRUPTS_WIDTH 18
  653. #define MMC_TISR_TXOCTETCOUNT_GB_INDEX 0
  654. #define MMC_TISR_TXOCTETCOUNT_GB_WIDTH 1
  655. #define MMC_TISR_TXFRAMECOUNT_GB_INDEX 1
  656. #define MMC_TISR_TXFRAMECOUNT_GB_WIDTH 1
  657. #define MMC_TISR_TXBROADCASTFRAMES_G_INDEX 2
  658. #define MMC_TISR_TXBROADCASTFRAMES_G_WIDTH 1
  659. #define MMC_TISR_TXMULTICASTFRAMES_G_INDEX 3
  660. #define MMC_TISR_TXMULTICASTFRAMES_G_WIDTH 1
  661. #define MMC_TISR_TX64OCTETS_GB_INDEX 4
  662. #define MMC_TISR_TX64OCTETS_GB_WIDTH 1
  663. #define MMC_TISR_TX65TO127OCTETS_GB_INDEX 5
  664. #define MMC_TISR_TX65TO127OCTETS_GB_WIDTH 1
  665. #define MMC_TISR_TX128TO255OCTETS_GB_INDEX 6
  666. #define MMC_TISR_TX128TO255OCTETS_GB_WIDTH 1
  667. #define MMC_TISR_TX256TO511OCTETS_GB_INDEX 7
  668. #define MMC_TISR_TX256TO511OCTETS_GB_WIDTH 1
  669. #define MMC_TISR_TX512TO1023OCTETS_GB_INDEX 8
  670. #define MMC_TISR_TX512TO1023OCTETS_GB_WIDTH 1
  671. #define MMC_TISR_TX1024TOMAXOCTETS_GB_INDEX 9
  672. #define MMC_TISR_TX1024TOMAXOCTETS_GB_WIDTH 1
  673. #define MMC_TISR_TXUNICASTFRAMES_GB_INDEX 10
  674. #define MMC_TISR_TXUNICASTFRAMES_GB_WIDTH 1
  675. #define MMC_TISR_TXMULTICASTFRAMES_GB_INDEX 11
  676. #define MMC_TISR_TXMULTICASTFRAMES_GB_WIDTH 1
  677. #define MMC_TISR_TXBROADCASTFRAMES_GB_INDEX 12
  678. #define MMC_TISR_TXBROADCASTFRAMES_GB_WIDTH 1
  679. #define MMC_TISR_TXUNDERFLOWERROR_INDEX 13
  680. #define MMC_TISR_TXUNDERFLOWERROR_WIDTH 1
  681. #define MMC_TISR_TXOCTETCOUNT_G_INDEX 14
  682. #define MMC_TISR_TXOCTETCOUNT_G_WIDTH 1
  683. #define MMC_TISR_TXFRAMECOUNT_G_INDEX 15
  684. #define MMC_TISR_TXFRAMECOUNT_G_WIDTH 1
  685. #define MMC_TISR_TXPAUSEFRAMES_INDEX 16
  686. #define MMC_TISR_TXPAUSEFRAMES_WIDTH 1
  687. #define MMC_TISR_TXVLANFRAMES_G_INDEX 17
  688. #define MMC_TISR_TXVLANFRAMES_G_WIDTH 1
  689. /* MTL register offsets */
  690. #define MTL_OMR 0x1000
  691. #define MTL_FDCR 0x1008
  692. #define MTL_FDSR 0x100c
  693. #define MTL_FDDR 0x1010
  694. #define MTL_ISR 0x1020
  695. #define MTL_RQDCM0R 0x1030
  696. #define MTL_TCPM0R 0x1040
  697. #define MTL_TCPM1R 0x1044
  698. #define MTL_RQDCM_INC 4
  699. #define MTL_RQDCM_Q_PER_REG 4
  700. #define MTL_TCPM_INC 4
  701. #define MTL_TCPM_TC_PER_REG 4
  702. /* MTL register entry bit positions and sizes */
  703. #define MTL_OMR_ETSALG_INDEX 5
  704. #define MTL_OMR_ETSALG_WIDTH 2
  705. #define MTL_OMR_RAA_INDEX 2
  706. #define MTL_OMR_RAA_WIDTH 1
  707. /* MTL queue register offsets
  708. * Multiple queues can be active. The first queue has registers
  709. * that begin at 0x1100. Each subsequent queue has registers that
  710. * are accessed using an offset of 0x80 from the previous queue.
  711. */
  712. #define MTL_Q_BASE 0x1100
  713. #define MTL_Q_INC 0x80
  714. #define MTL_Q_TQOMR 0x00
  715. #define MTL_Q_TQUR 0x04
  716. #define MTL_Q_TQDR 0x08
  717. #define MTL_Q_RQOMR 0x40
  718. #define MTL_Q_RQMPOCR 0x44
  719. #define MTL_Q_RQDR 0x4c
  720. #define MTL_Q_IER 0x70
  721. #define MTL_Q_ISR 0x74
  722. /* MTL queue register entry bit positions and sizes */
  723. #define MTL_Q_RQOMR_EHFC_INDEX 7
  724. #define MTL_Q_RQOMR_EHFC_WIDTH 1
  725. #define MTL_Q_RQOMR_RFA_INDEX 8
  726. #define MTL_Q_RQOMR_RFA_WIDTH 3
  727. #define MTL_Q_RQOMR_RFD_INDEX 13
  728. #define MTL_Q_RQOMR_RFD_WIDTH 3
  729. #define MTL_Q_RQOMR_RQS_INDEX 16
  730. #define MTL_Q_RQOMR_RQS_WIDTH 9
  731. #define MTL_Q_RQOMR_RSF_INDEX 5
  732. #define MTL_Q_RQOMR_RSF_WIDTH 1
  733. #define MTL_Q_RQOMR_RTC_INDEX 0
  734. #define MTL_Q_RQOMR_RTC_WIDTH 2
  735. #define MTL_Q_TQOMR_FTQ_INDEX 0
  736. #define MTL_Q_TQOMR_FTQ_WIDTH 1
  737. #define MTL_Q_TQOMR_Q2TCMAP_INDEX 8
  738. #define MTL_Q_TQOMR_Q2TCMAP_WIDTH 3
  739. #define MTL_Q_TQOMR_TQS_INDEX 16
  740. #define MTL_Q_TQOMR_TQS_WIDTH 10
  741. #define MTL_Q_TQOMR_TSF_INDEX 1
  742. #define MTL_Q_TQOMR_TSF_WIDTH 1
  743. #define MTL_Q_TQOMR_TTC_INDEX 4
  744. #define MTL_Q_TQOMR_TTC_WIDTH 3
  745. #define MTL_Q_TQOMR_TXQEN_INDEX 2
  746. #define MTL_Q_TQOMR_TXQEN_WIDTH 2
  747. /* MTL queue register value */
  748. #define MTL_RSF_DISABLE 0x00
  749. #define MTL_RSF_ENABLE 0x01
  750. #define MTL_TSF_DISABLE 0x00
  751. #define MTL_TSF_ENABLE 0x01
  752. #define MTL_RX_THRESHOLD_64 0x00
  753. #define MTL_RX_THRESHOLD_96 0x02
  754. #define MTL_RX_THRESHOLD_128 0x03
  755. #define MTL_TX_THRESHOLD_32 0x01
  756. #define MTL_TX_THRESHOLD_64 0x00
  757. #define MTL_TX_THRESHOLD_96 0x02
  758. #define MTL_TX_THRESHOLD_128 0x03
  759. #define MTL_TX_THRESHOLD_192 0x04
  760. #define MTL_TX_THRESHOLD_256 0x05
  761. #define MTL_TX_THRESHOLD_384 0x06
  762. #define MTL_TX_THRESHOLD_512 0x07
  763. #define MTL_ETSALG_WRR 0x00
  764. #define MTL_ETSALG_WFQ 0x01
  765. #define MTL_ETSALG_DWRR 0x02
  766. #define MTL_RAA_SP 0x00
  767. #define MTL_RAA_WSP 0x01
  768. #define MTL_Q_DISABLED 0x00
  769. #define MTL_Q_ENABLED 0x02
  770. /* MTL traffic class register offsets
  771. * Multiple traffic classes can be active. The first class has registers
  772. * that begin at 0x1100. Each subsequent queue has registers that
  773. * are accessed using an offset of 0x80 from the previous queue.
  774. */
  775. #define MTL_TC_BASE MTL_Q_BASE
  776. #define MTL_TC_INC MTL_Q_INC
  777. #define MTL_TC_ETSCR 0x10
  778. #define MTL_TC_ETSSR 0x14
  779. #define MTL_TC_QWR 0x18
  780. /* MTL traffic class register entry bit positions and sizes */
  781. #define MTL_TC_ETSCR_TSA_INDEX 0
  782. #define MTL_TC_ETSCR_TSA_WIDTH 2
  783. #define MTL_TC_QWR_QW_INDEX 0
  784. #define MTL_TC_QWR_QW_WIDTH 21
  785. /* MTL traffic class register value */
  786. #define MTL_TSA_SP 0x00
  787. #define MTL_TSA_ETS 0x02
  788. /* PCS MMD select register offset
  789. * The MMD select register is used for accessing PCS registers
  790. * when the underlying APB3 interface is using indirect addressing.
  791. * Indirect addressing requires accessing registers in two phases,
  792. * an address phase and a data phase. The address phases requires
  793. * writing an address selection value to the MMD select regiesters.
  794. */
  795. #define PCS_MMD_SELECT 0xff
  796. /* Descriptor/Packet entry bit positions and sizes */
  797. #define RX_PACKET_ERRORS_CRC_INDEX 2
  798. #define RX_PACKET_ERRORS_CRC_WIDTH 1
  799. #define RX_PACKET_ERRORS_FRAME_INDEX 3
  800. #define RX_PACKET_ERRORS_FRAME_WIDTH 1
  801. #define RX_PACKET_ERRORS_LENGTH_INDEX 0
  802. #define RX_PACKET_ERRORS_LENGTH_WIDTH 1
  803. #define RX_PACKET_ERRORS_OVERRUN_INDEX 1
  804. #define RX_PACKET_ERRORS_OVERRUN_WIDTH 1
  805. #define RX_PACKET_ATTRIBUTES_CSUM_DONE_INDEX 0
  806. #define RX_PACKET_ATTRIBUTES_CSUM_DONE_WIDTH 1
  807. #define RX_PACKET_ATTRIBUTES_VLAN_CTAG_INDEX 1
  808. #define RX_PACKET_ATTRIBUTES_VLAN_CTAG_WIDTH 1
  809. #define RX_PACKET_ATTRIBUTES_INCOMPLETE_INDEX 2
  810. #define RX_PACKET_ATTRIBUTES_INCOMPLETE_WIDTH 1
  811. #define RX_PACKET_ATTRIBUTES_CONTEXT_NEXT_INDEX 3
  812. #define RX_PACKET_ATTRIBUTES_CONTEXT_NEXT_WIDTH 1
  813. #define RX_PACKET_ATTRIBUTES_CONTEXT_INDEX 4
  814. #define RX_PACKET_ATTRIBUTES_CONTEXT_WIDTH 1
  815. #define RX_PACKET_ATTRIBUTES_RX_TSTAMP_INDEX 5
  816. #define RX_PACKET_ATTRIBUTES_RX_TSTAMP_WIDTH 1
  817. #define RX_NORMAL_DESC0_OVT_INDEX 0
  818. #define RX_NORMAL_DESC0_OVT_WIDTH 16
  819. #define RX_NORMAL_DESC3_CDA_INDEX 27
  820. #define RX_NORMAL_DESC3_CDA_WIDTH 1
  821. #define RX_NORMAL_DESC3_CTXT_INDEX 30
  822. #define RX_NORMAL_DESC3_CTXT_WIDTH 1
  823. #define RX_NORMAL_DESC3_ES_INDEX 15
  824. #define RX_NORMAL_DESC3_ES_WIDTH 1
  825. #define RX_NORMAL_DESC3_ETLT_INDEX 16
  826. #define RX_NORMAL_DESC3_ETLT_WIDTH 4
  827. #define RX_NORMAL_DESC3_INTE_INDEX 30
  828. #define RX_NORMAL_DESC3_INTE_WIDTH 1
  829. #define RX_NORMAL_DESC3_LD_INDEX 28
  830. #define RX_NORMAL_DESC3_LD_WIDTH 1
  831. #define RX_NORMAL_DESC3_OWN_INDEX 31
  832. #define RX_NORMAL_DESC3_OWN_WIDTH 1
  833. #define RX_NORMAL_DESC3_PL_INDEX 0
  834. #define RX_NORMAL_DESC3_PL_WIDTH 14
  835. #define RX_CONTEXT_DESC3_TSA_INDEX 4
  836. #define RX_CONTEXT_DESC3_TSA_WIDTH 1
  837. #define RX_CONTEXT_DESC3_TSD_INDEX 6
  838. #define RX_CONTEXT_DESC3_TSD_WIDTH 1
  839. #define TX_PACKET_ATTRIBUTES_CSUM_ENABLE_INDEX 0
  840. #define TX_PACKET_ATTRIBUTES_CSUM_ENABLE_WIDTH 1
  841. #define TX_PACKET_ATTRIBUTES_TSO_ENABLE_INDEX 1
  842. #define TX_PACKET_ATTRIBUTES_TSO_ENABLE_WIDTH 1
  843. #define TX_PACKET_ATTRIBUTES_VLAN_CTAG_INDEX 2
  844. #define TX_PACKET_ATTRIBUTES_VLAN_CTAG_WIDTH 1
  845. #define TX_PACKET_ATTRIBUTES_PTP_INDEX 3
  846. #define TX_PACKET_ATTRIBUTES_PTP_WIDTH 1
  847. #define TX_CONTEXT_DESC2_MSS_INDEX 0
  848. #define TX_CONTEXT_DESC2_MSS_WIDTH 15
  849. #define TX_CONTEXT_DESC3_CTXT_INDEX 30
  850. #define TX_CONTEXT_DESC3_CTXT_WIDTH 1
  851. #define TX_CONTEXT_DESC3_TCMSSV_INDEX 26
  852. #define TX_CONTEXT_DESC3_TCMSSV_WIDTH 1
  853. #define TX_CONTEXT_DESC3_VLTV_INDEX 16
  854. #define TX_CONTEXT_DESC3_VLTV_WIDTH 1
  855. #define TX_CONTEXT_DESC3_VT_INDEX 0
  856. #define TX_CONTEXT_DESC3_VT_WIDTH 16
  857. #define TX_NORMAL_DESC2_HL_B1L_INDEX 0
  858. #define TX_NORMAL_DESC2_HL_B1L_WIDTH 14
  859. #define TX_NORMAL_DESC2_IC_INDEX 31
  860. #define TX_NORMAL_DESC2_IC_WIDTH 1
  861. #define TX_NORMAL_DESC2_TTSE_INDEX 30
  862. #define TX_NORMAL_DESC2_TTSE_WIDTH 1
  863. #define TX_NORMAL_DESC2_VTIR_INDEX 14
  864. #define TX_NORMAL_DESC2_VTIR_WIDTH 2
  865. #define TX_NORMAL_DESC3_CIC_INDEX 16
  866. #define TX_NORMAL_DESC3_CIC_WIDTH 2
  867. #define TX_NORMAL_DESC3_CPC_INDEX 26
  868. #define TX_NORMAL_DESC3_CPC_WIDTH 2
  869. #define TX_NORMAL_DESC3_CTXT_INDEX 30
  870. #define TX_NORMAL_DESC3_CTXT_WIDTH 1
  871. #define TX_NORMAL_DESC3_FD_INDEX 29
  872. #define TX_NORMAL_DESC3_FD_WIDTH 1
  873. #define TX_NORMAL_DESC3_FL_INDEX 0
  874. #define TX_NORMAL_DESC3_FL_WIDTH 15
  875. #define TX_NORMAL_DESC3_LD_INDEX 28
  876. #define TX_NORMAL_DESC3_LD_WIDTH 1
  877. #define TX_NORMAL_DESC3_OWN_INDEX 31
  878. #define TX_NORMAL_DESC3_OWN_WIDTH 1
  879. #define TX_NORMAL_DESC3_TCPHDRLEN_INDEX 19
  880. #define TX_NORMAL_DESC3_TCPHDRLEN_WIDTH 4
  881. #define TX_NORMAL_DESC3_TCPPL_INDEX 0
  882. #define TX_NORMAL_DESC3_TCPPL_WIDTH 18
  883. #define TX_NORMAL_DESC3_TSE_INDEX 18
  884. #define TX_NORMAL_DESC3_TSE_WIDTH 1
  885. #define TX_NORMAL_DESC2_VLAN_INSERT 0x2
  886. /* MDIO undefined or vendor specific registers */
  887. #ifndef MDIO_AN_COMP_STAT
  888. #define MDIO_AN_COMP_STAT 0x0030
  889. #endif
  890. /* Bit setting and getting macros
  891. * The get macro will extract the current bit field value from within
  892. * the variable
  893. *
  894. * The set macro will clear the current bit field value within the
  895. * variable and then set the bit field of the variable to the
  896. * specified value
  897. */
  898. #define GET_BITS(_var, _index, _width) \
  899. (((_var) >> (_index)) & ((0x1 << (_width)) - 1))
  900. #define SET_BITS(_var, _index, _width, _val) \
  901. do { \
  902. (_var) &= ~(((0x1 << (_width)) - 1) << (_index)); \
  903. (_var) |= (((_val) & ((0x1 << (_width)) - 1)) << (_index)); \
  904. } while (0)
  905. #define GET_BITS_LE(_var, _index, _width) \
  906. ((le32_to_cpu((_var)) >> (_index)) & ((0x1 << (_width)) - 1))
  907. #define SET_BITS_LE(_var, _index, _width, _val) \
  908. do { \
  909. (_var) &= cpu_to_le32(~(((0x1 << (_width)) - 1) << (_index))); \
  910. (_var) |= cpu_to_le32((((_val) & \
  911. ((0x1 << (_width)) - 1)) << (_index))); \
  912. } while (0)
  913. /* Bit setting and getting macros based on register fields
  914. * The get macro uses the bit field definitions formed using the input
  915. * names to extract the current bit field value from within the
  916. * variable
  917. *
  918. * The set macro uses the bit field definitions formed using the input
  919. * names to set the bit field of the variable to the specified value
  920. */
  921. #define XGMAC_GET_BITS(_var, _prefix, _field) \
  922. GET_BITS((_var), \
  923. _prefix##_##_field##_INDEX, \
  924. _prefix##_##_field##_WIDTH)
  925. #define XGMAC_SET_BITS(_var, _prefix, _field, _val) \
  926. SET_BITS((_var), \
  927. _prefix##_##_field##_INDEX, \
  928. _prefix##_##_field##_WIDTH, (_val))
  929. #define XGMAC_GET_BITS_LE(_var, _prefix, _field) \
  930. GET_BITS_LE((_var), \
  931. _prefix##_##_field##_INDEX, \
  932. _prefix##_##_field##_WIDTH)
  933. #define XGMAC_SET_BITS_LE(_var, _prefix, _field, _val) \
  934. SET_BITS_LE((_var), \
  935. _prefix##_##_field##_INDEX, \
  936. _prefix##_##_field##_WIDTH, (_val))
  937. /* Macros for reading or writing registers
  938. * The ioread macros will get bit fields or full values using the
  939. * register definitions formed using the input names
  940. *
  941. * The iowrite macros will set bit fields or full values using the
  942. * register definitions formed using the input names
  943. */
  944. #define XGMAC_IOREAD(_pdata, _reg) \
  945. ioread32((_pdata)->xgmac_regs + _reg)
  946. #define XGMAC_IOREAD_BITS(_pdata, _reg, _field) \
  947. GET_BITS(XGMAC_IOREAD((_pdata), _reg), \
  948. _reg##_##_field##_INDEX, \
  949. _reg##_##_field##_WIDTH)
  950. #define XGMAC_IOWRITE(_pdata, _reg, _val) \
  951. iowrite32((_val), (_pdata)->xgmac_regs + _reg)
  952. #define XGMAC_IOWRITE_BITS(_pdata, _reg, _field, _val) \
  953. do { \
  954. u32 reg_val = XGMAC_IOREAD((_pdata), _reg); \
  955. SET_BITS(reg_val, \
  956. _reg##_##_field##_INDEX, \
  957. _reg##_##_field##_WIDTH, (_val)); \
  958. XGMAC_IOWRITE((_pdata), _reg, reg_val); \
  959. } while (0)
  960. /* Macros for reading or writing MTL queue or traffic class registers
  961. * Similar to the standard read and write macros except that the
  962. * base register value is calculated by the queue or traffic class number
  963. */
  964. #define XGMAC_MTL_IOREAD(_pdata, _n, _reg) \
  965. ioread32((_pdata)->xgmac_regs + \
  966. MTL_Q_BASE + ((_n) * MTL_Q_INC) + _reg)
  967. #define XGMAC_MTL_IOREAD_BITS(_pdata, _n, _reg, _field) \
  968. GET_BITS(XGMAC_MTL_IOREAD((_pdata), (_n), _reg), \
  969. _reg##_##_field##_INDEX, \
  970. _reg##_##_field##_WIDTH)
  971. #define XGMAC_MTL_IOWRITE(_pdata, _n, _reg, _val) \
  972. iowrite32((_val), (_pdata)->xgmac_regs + \
  973. MTL_Q_BASE + ((_n) * MTL_Q_INC) + _reg)
  974. #define XGMAC_MTL_IOWRITE_BITS(_pdata, _n, _reg, _field, _val) \
  975. do { \
  976. u32 reg_val = XGMAC_MTL_IOREAD((_pdata), (_n), _reg); \
  977. SET_BITS(reg_val, \
  978. _reg##_##_field##_INDEX, \
  979. _reg##_##_field##_WIDTH, (_val)); \
  980. XGMAC_MTL_IOWRITE((_pdata), (_n), _reg, reg_val); \
  981. } while (0)
  982. /* Macros for reading or writing DMA channel registers
  983. * Similar to the standard read and write macros except that the
  984. * base register value is obtained from the ring
  985. */
  986. #define XGMAC_DMA_IOREAD(_channel, _reg) \
  987. ioread32((_channel)->dma_regs + _reg)
  988. #define XGMAC_DMA_IOREAD_BITS(_channel, _reg, _field) \
  989. GET_BITS(XGMAC_DMA_IOREAD((_channel), _reg), \
  990. _reg##_##_field##_INDEX, \
  991. _reg##_##_field##_WIDTH)
  992. #define XGMAC_DMA_IOWRITE(_channel, _reg, _val) \
  993. iowrite32((_val), (_channel)->dma_regs + _reg)
  994. #define XGMAC_DMA_IOWRITE_BITS(_channel, _reg, _field, _val) \
  995. do { \
  996. u32 reg_val = XGMAC_DMA_IOREAD((_channel), _reg); \
  997. SET_BITS(reg_val, \
  998. _reg##_##_field##_INDEX, \
  999. _reg##_##_field##_WIDTH, (_val)); \
  1000. XGMAC_DMA_IOWRITE((_channel), _reg, reg_val); \
  1001. } while (0)
  1002. /* Macros for building, reading or writing register values or bits
  1003. * within the register values of XPCS registers.
  1004. */
  1005. #define XPCS_IOWRITE(_pdata, _off, _val) \
  1006. iowrite32(_val, (_pdata)->xpcs_regs + (_off))
  1007. #define XPCS_IOREAD(_pdata, _off) \
  1008. ioread32((_pdata)->xpcs_regs + (_off))
  1009. /* Macros for building, reading or writing register values or bits
  1010. * using MDIO. Different from above because of the use of standardized
  1011. * Linux include values. No shifting is performed with the bit
  1012. * operations, everything works on mask values.
  1013. */
  1014. #define XMDIO_READ(_pdata, _mmd, _reg) \
  1015. ((_pdata)->hw_if.read_mmd_regs((_pdata), 0, \
  1016. MII_ADDR_C45 | (_mmd << 16) | ((_reg) & 0xffff)))
  1017. #define XMDIO_READ_BITS(_pdata, _mmd, _reg, _mask) \
  1018. (XMDIO_READ((_pdata), _mmd, _reg) & _mask)
  1019. #define XMDIO_WRITE(_pdata, _mmd, _reg, _val) \
  1020. ((_pdata)->hw_if.write_mmd_regs((_pdata), 0, \
  1021. MII_ADDR_C45 | (_mmd << 16) | ((_reg) & 0xffff), (_val)))
  1022. #define XMDIO_WRITE_BITS(_pdata, _mmd, _reg, _mask, _val) \
  1023. do { \
  1024. u32 mmd_val = XMDIO_READ((_pdata), _mmd, _reg); \
  1025. mmd_val &= ~_mask; \
  1026. mmd_val |= (_val); \
  1027. XMDIO_WRITE((_pdata), _mmd, _reg, mmd_val); \
  1028. } while (0)
  1029. #endif