gemini.h 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959
  1. // SPDX-License-Identifier: GPL-2.0
  2. /* Register definitions for Gemini GMAC Ethernet device driver
  3. *
  4. * Copyright (C) 2006 Storlink, Corp.
  5. * Copyright (C) 2008-2009 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
  6. * Copyright (C) 2010 Michał Mirosław <mirq-linux@rere.qmqm.pl>
  7. * Copytight (C) 2017 Linus Walleij <linus.walleij@linaro.org>
  8. */
  9. #ifndef _GEMINI_ETHERNET_H
  10. #define _GEMINI_ETHERNET_H
  11. #include <linux/bitops.h>
  12. /* Base Registers */
  13. #define TOE_NONTOE_QUE_HDR_BASE 0x2000
  14. #define TOE_TOE_QUE_HDR_BASE 0x3000
  15. /* Queue ID */
  16. #define TOE_SW_FREE_QID 0x00
  17. #define TOE_HW_FREE_QID 0x01
  18. #define TOE_GMAC0_SW_TXQ0_QID 0x02
  19. #define TOE_GMAC0_SW_TXQ1_QID 0x03
  20. #define TOE_GMAC0_SW_TXQ2_QID 0x04
  21. #define TOE_GMAC0_SW_TXQ3_QID 0x05
  22. #define TOE_GMAC0_SW_TXQ4_QID 0x06
  23. #define TOE_GMAC0_SW_TXQ5_QID 0x07
  24. #define TOE_GMAC0_HW_TXQ0_QID 0x08
  25. #define TOE_GMAC0_HW_TXQ1_QID 0x09
  26. #define TOE_GMAC0_HW_TXQ2_QID 0x0A
  27. #define TOE_GMAC0_HW_TXQ3_QID 0x0B
  28. #define TOE_GMAC1_SW_TXQ0_QID 0x12
  29. #define TOE_GMAC1_SW_TXQ1_QID 0x13
  30. #define TOE_GMAC1_SW_TXQ2_QID 0x14
  31. #define TOE_GMAC1_SW_TXQ3_QID 0x15
  32. #define TOE_GMAC1_SW_TXQ4_QID 0x16
  33. #define TOE_GMAC1_SW_TXQ5_QID 0x17
  34. #define TOE_GMAC1_HW_TXQ0_QID 0x18
  35. #define TOE_GMAC1_HW_TXQ1_QID 0x19
  36. #define TOE_GMAC1_HW_TXQ2_QID 0x1A
  37. #define TOE_GMAC1_HW_TXQ3_QID 0x1B
  38. #define TOE_GMAC0_DEFAULT_QID 0x20
  39. #define TOE_GMAC1_DEFAULT_QID 0x21
  40. #define TOE_CLASSIFICATION_QID(x) (0x22 + x) /* 0x22 ~ 0x2F */
  41. #define TOE_TOE_QID(x) (0x40 + x) /* 0x40 ~ 0x7F */
  42. /* TOE DMA Queue Size should be 2^n, n = 6...12
  43. * TOE DMA Queues are the following queue types:
  44. * SW Free Queue, HW Free Queue,
  45. * GMAC 0/1 SW TX Q0-5, and GMAC 0/1 HW TX Q0-5
  46. * The base address and descriptor number are configured at
  47. * DMA Queues Descriptor Ring Base Address/Size Register (offset 0x0004)
  48. */
  49. #define GET_WPTR(addr) readw((addr) + 2)
  50. #define GET_RPTR(addr) readw((addr))
  51. #define SET_WPTR(addr, data) writew((data), (addr) + 2)
  52. #define SET_RPTR(addr, data) writew((data), (addr))
  53. #define __RWPTR_NEXT(x, mask) (((unsigned int)(x) + 1) & (mask))
  54. #define __RWPTR_PREV(x, mask) (((unsigned int)(x) - 1) & (mask))
  55. #define __RWPTR_DISTANCE(r, w, mask) (((unsigned int)(w) - (r)) & (mask))
  56. #define __RWPTR_MASK(order) ((1 << (order)) - 1)
  57. #define RWPTR_NEXT(x, order) __RWPTR_NEXT((x), __RWPTR_MASK((order)))
  58. #define RWPTR_PREV(x, order) __RWPTR_PREV((x), __RWPTR_MASK((order)))
  59. #define RWPTR_DISTANCE(r, w, order) __RWPTR_DISTANCE((r), (w), \
  60. __RWPTR_MASK((order)))
  61. /* Global registers */
  62. #define GLOBAL_TOE_VERSION_REG 0x0000
  63. #define GLOBAL_SW_FREEQ_BASE_SIZE_REG 0x0004
  64. #define GLOBAL_HW_FREEQ_BASE_SIZE_REG 0x0008
  65. #define GLOBAL_DMA_SKB_SIZE_REG 0x0010
  66. #define GLOBAL_SWFQ_RWPTR_REG 0x0014
  67. #define GLOBAL_HWFQ_RWPTR_REG 0x0018
  68. #define GLOBAL_INTERRUPT_STATUS_0_REG 0x0020
  69. #define GLOBAL_INTERRUPT_ENABLE_0_REG 0x0024
  70. #define GLOBAL_INTERRUPT_SELECT_0_REG 0x0028
  71. #define GLOBAL_INTERRUPT_STATUS_1_REG 0x0030
  72. #define GLOBAL_INTERRUPT_ENABLE_1_REG 0x0034
  73. #define GLOBAL_INTERRUPT_SELECT_1_REG 0x0038
  74. #define GLOBAL_INTERRUPT_STATUS_2_REG 0x0040
  75. #define GLOBAL_INTERRUPT_ENABLE_2_REG 0x0044
  76. #define GLOBAL_INTERRUPT_SELECT_2_REG 0x0048
  77. #define GLOBAL_INTERRUPT_STATUS_3_REG 0x0050
  78. #define GLOBAL_INTERRUPT_ENABLE_3_REG 0x0054
  79. #define GLOBAL_INTERRUPT_SELECT_3_REG 0x0058
  80. #define GLOBAL_INTERRUPT_STATUS_4_REG 0x0060
  81. #define GLOBAL_INTERRUPT_ENABLE_4_REG 0x0064
  82. #define GLOBAL_INTERRUPT_SELECT_4_REG 0x0068
  83. #define GLOBAL_HASH_TABLE_BASE_REG 0x006C
  84. #define GLOBAL_QUEUE_THRESHOLD_REG 0x0070
  85. /* GMAC 0/1 DMA/TOE register */
  86. #define GMAC_DMA_CTRL_REG 0x0000
  87. #define GMAC_TX_WEIGHTING_CTRL_0_REG 0x0004
  88. #define GMAC_TX_WEIGHTING_CTRL_1_REG 0x0008
  89. #define GMAC_SW_TX_QUEUE0_PTR_REG 0x000C
  90. #define GMAC_SW_TX_QUEUE1_PTR_REG 0x0010
  91. #define GMAC_SW_TX_QUEUE2_PTR_REG 0x0014
  92. #define GMAC_SW_TX_QUEUE3_PTR_REG 0x0018
  93. #define GMAC_SW_TX_QUEUE4_PTR_REG 0x001C
  94. #define GMAC_SW_TX_QUEUE5_PTR_REG 0x0020
  95. #define GMAC_SW_TX_QUEUE_PTR_REG(i) (GMAC_SW_TX_QUEUE0_PTR_REG + 4 * (i))
  96. #define GMAC_HW_TX_QUEUE0_PTR_REG 0x0024
  97. #define GMAC_HW_TX_QUEUE1_PTR_REG 0x0028
  98. #define GMAC_HW_TX_QUEUE2_PTR_REG 0x002C
  99. #define GMAC_HW_TX_QUEUE3_PTR_REG 0x0030
  100. #define GMAC_HW_TX_QUEUE_PTR_REG(i) (GMAC_HW_TX_QUEUE0_PTR_REG + 4 * (i))
  101. #define GMAC_DMA_TX_FIRST_DESC_REG 0x0038
  102. #define GMAC_DMA_TX_CURR_DESC_REG 0x003C
  103. #define GMAC_DMA_TX_DESC_WORD0_REG 0x0040
  104. #define GMAC_DMA_TX_DESC_WORD1_REG 0x0044
  105. #define GMAC_DMA_TX_DESC_WORD2_REG 0x0048
  106. #define GMAC_DMA_TX_DESC_WORD3_REG 0x004C
  107. #define GMAC_SW_TX_QUEUE_BASE_REG 0x0050
  108. #define GMAC_HW_TX_QUEUE_BASE_REG 0x0054
  109. #define GMAC_DMA_RX_FIRST_DESC_REG 0x0058
  110. #define GMAC_DMA_RX_CURR_DESC_REG 0x005C
  111. #define GMAC_DMA_RX_DESC_WORD0_REG 0x0060
  112. #define GMAC_DMA_RX_DESC_WORD1_REG 0x0064
  113. #define GMAC_DMA_RX_DESC_WORD2_REG 0x0068
  114. #define GMAC_DMA_RX_DESC_WORD3_REG 0x006C
  115. #define GMAC_HASH_ENGINE_REG0 0x0070
  116. #define GMAC_HASH_ENGINE_REG1 0x0074
  117. /* matching rule 0 Control register 0 */
  118. #define GMAC_MR0CR0 0x0078
  119. #define GMAC_MR0CR1 0x007C
  120. #define GMAC_MR0CR2 0x0080
  121. #define GMAC_MR1CR0 0x0084
  122. #define GMAC_MR1CR1 0x0088
  123. #define GMAC_MR1CR2 0x008C
  124. #define GMAC_MR2CR0 0x0090
  125. #define GMAC_MR2CR1 0x0094
  126. #define GMAC_MR2CR2 0x0098
  127. #define GMAC_MR3CR0 0x009C
  128. #define GMAC_MR3CR1 0x00A0
  129. #define GMAC_MR3CR2 0x00A4
  130. /* Support Protocol Register 0 */
  131. #define GMAC_SPR0 0x00A8
  132. #define GMAC_SPR1 0x00AC
  133. #define GMAC_SPR2 0x00B0
  134. #define GMAC_SPR3 0x00B4
  135. #define GMAC_SPR4 0x00B8
  136. #define GMAC_SPR5 0x00BC
  137. #define GMAC_SPR6 0x00C0
  138. #define GMAC_SPR7 0x00C4
  139. /* GMAC Hash/Rx/Tx AHB Weighting register */
  140. #define GMAC_AHB_WEIGHT_REG 0x00C8
  141. /* TOE GMAC 0/1 register */
  142. #define GMAC_STA_ADD0 0x0000
  143. #define GMAC_STA_ADD1 0x0004
  144. #define GMAC_STA_ADD2 0x0008
  145. #define GMAC_RX_FLTR 0x000c
  146. #define GMAC_MCAST_FIL0 0x0010
  147. #define GMAC_MCAST_FIL1 0x0014
  148. #define GMAC_CONFIG0 0x0018
  149. #define GMAC_CONFIG1 0x001c
  150. #define GMAC_CONFIG2 0x0020
  151. #define GMAC_CONFIG3 0x0024
  152. #define GMAC_RESERVED 0x0028
  153. #define GMAC_STATUS 0x002c
  154. #define GMAC_IN_DISCARDS 0x0030
  155. #define GMAC_IN_ERRORS 0x0034
  156. #define GMAC_IN_MCAST 0x0038
  157. #define GMAC_IN_BCAST 0x003c
  158. #define GMAC_IN_MAC1 0x0040 /* for STA 1 MAC Address */
  159. #define GMAC_IN_MAC2 0x0044 /* for STA 2 MAC Address */
  160. #define RX_STATS_NUM 6
  161. /* DMA Queues description Ring Base Address/Size Register (offset 0x0004) */
  162. union dma_q_base_size {
  163. unsigned int bits32;
  164. unsigned int base_size;
  165. };
  166. #define DMA_Q_BASE_MASK (~0x0f)
  167. /* DMA SKB Buffer register (offset 0x0008) */
  168. union dma_skb_size {
  169. unsigned int bits32;
  170. struct bit_0008 {
  171. unsigned int sw_skb_size : 16; /* SW Free poll SKB Size */
  172. unsigned int hw_skb_size : 16; /* HW Free poll SKB Size */
  173. } bits;
  174. };
  175. /* DMA SW Free Queue Read/Write Pointer Register (offset 0x000c) */
  176. union dma_rwptr {
  177. unsigned int bits32;
  178. struct bit_000c {
  179. unsigned int rptr : 16; /* Read Ptr, RO */
  180. unsigned int wptr : 16; /* Write Ptr, RW */
  181. } bits;
  182. };
  183. /* Interrupt Status Register 0 (offset 0x0020)
  184. * Interrupt Mask Register 0 (offset 0x0024)
  185. * Interrupt Select Register 0 (offset 0x0028)
  186. */
  187. #define GMAC1_TXDERR_INT_BIT BIT(31)
  188. #define GMAC1_TXPERR_INT_BIT BIT(30)
  189. #define GMAC0_TXDERR_INT_BIT BIT(29)
  190. #define GMAC0_TXPERR_INT_BIT BIT(28)
  191. #define GMAC1_RXDERR_INT_BIT BIT(27)
  192. #define GMAC1_RXPERR_INT_BIT BIT(26)
  193. #define GMAC0_RXDERR_INT_BIT BIT(25)
  194. #define GMAC0_RXPERR_INT_BIT BIT(24)
  195. #define GMAC1_SWTQ15_FIN_INT_BIT BIT(23)
  196. #define GMAC1_SWTQ14_FIN_INT_BIT BIT(22)
  197. #define GMAC1_SWTQ13_FIN_INT_BIT BIT(21)
  198. #define GMAC1_SWTQ12_FIN_INT_BIT BIT(20)
  199. #define GMAC1_SWTQ11_FIN_INT_BIT BIT(19)
  200. #define GMAC1_SWTQ10_FIN_INT_BIT BIT(18)
  201. #define GMAC0_SWTQ05_FIN_INT_BIT BIT(17)
  202. #define GMAC0_SWTQ04_FIN_INT_BIT BIT(16)
  203. #define GMAC0_SWTQ03_FIN_INT_BIT BIT(15)
  204. #define GMAC0_SWTQ02_FIN_INT_BIT BIT(14)
  205. #define GMAC0_SWTQ01_FIN_INT_BIT BIT(13)
  206. #define GMAC0_SWTQ00_FIN_INT_BIT BIT(12)
  207. #define GMAC1_SWTQ15_EOF_INT_BIT BIT(11)
  208. #define GMAC1_SWTQ14_EOF_INT_BIT BIT(10)
  209. #define GMAC1_SWTQ13_EOF_INT_BIT BIT(9)
  210. #define GMAC1_SWTQ12_EOF_INT_BIT BIT(8)
  211. #define GMAC1_SWTQ11_EOF_INT_BIT BIT(7)
  212. #define GMAC1_SWTQ10_EOF_INT_BIT BIT(6)
  213. #define GMAC0_SWTQ05_EOF_INT_BIT BIT(5)
  214. #define GMAC0_SWTQ04_EOF_INT_BIT BIT(4)
  215. #define GMAC0_SWTQ03_EOF_INT_BIT BIT(3)
  216. #define GMAC0_SWTQ02_EOF_INT_BIT BIT(2)
  217. #define GMAC0_SWTQ01_EOF_INT_BIT BIT(1)
  218. #define GMAC0_SWTQ00_EOF_INT_BIT BIT(0)
  219. /* Interrupt Status Register 1 (offset 0x0030)
  220. * Interrupt Mask Register 1 (offset 0x0034)
  221. * Interrupt Select Register 1 (offset 0x0038)
  222. */
  223. #define TOE_IQ3_FULL_INT_BIT BIT(31)
  224. #define TOE_IQ2_FULL_INT_BIT BIT(30)
  225. #define TOE_IQ1_FULL_INT_BIT BIT(29)
  226. #define TOE_IQ0_FULL_INT_BIT BIT(28)
  227. #define TOE_IQ3_INT_BIT BIT(27)
  228. #define TOE_IQ2_INT_BIT BIT(26)
  229. #define TOE_IQ1_INT_BIT BIT(25)
  230. #define TOE_IQ0_INT_BIT BIT(24)
  231. #define GMAC1_HWTQ13_EOF_INT_BIT BIT(23)
  232. #define GMAC1_HWTQ12_EOF_INT_BIT BIT(22)
  233. #define GMAC1_HWTQ11_EOF_INT_BIT BIT(21)
  234. #define GMAC1_HWTQ10_EOF_INT_BIT BIT(20)
  235. #define GMAC0_HWTQ03_EOF_INT_BIT BIT(19)
  236. #define GMAC0_HWTQ02_EOF_INT_BIT BIT(18)
  237. #define GMAC0_HWTQ01_EOF_INT_BIT BIT(17)
  238. #define GMAC0_HWTQ00_EOF_INT_BIT BIT(16)
  239. #define CLASS_RX_INT_BIT(x) BIT((x + 2))
  240. #define DEFAULT_Q1_INT_BIT BIT(1)
  241. #define DEFAULT_Q0_INT_BIT BIT(0)
  242. #define TOE_IQ_INT_BITS (TOE_IQ0_INT_BIT | TOE_IQ1_INT_BIT | \
  243. TOE_IQ2_INT_BIT | TOE_IQ3_INT_BIT)
  244. #define TOE_IQ_FULL_BITS (TOE_IQ0_FULL_INT_BIT | TOE_IQ1_FULL_INT_BIT | \
  245. TOE_IQ2_FULL_INT_BIT | TOE_IQ3_FULL_INT_BIT)
  246. #define TOE_IQ_ALL_BITS (TOE_IQ_INT_BITS | TOE_IQ_FULL_BITS)
  247. #define TOE_CLASS_RX_INT_BITS 0xfffc
  248. /* Interrupt Status Register 2 (offset 0x0040)
  249. * Interrupt Mask Register 2 (offset 0x0044)
  250. * Interrupt Select Register 2 (offset 0x0048)
  251. */
  252. #define TOE_QL_FULL_INT_BIT(x) BIT(x)
  253. /* Interrupt Status Register 3 (offset 0x0050)
  254. * Interrupt Mask Register 3 (offset 0x0054)
  255. * Interrupt Select Register 3 (offset 0x0058)
  256. */
  257. #define TOE_QH_FULL_INT_BIT(x) BIT(x - 32)
  258. /* Interrupt Status Register 4 (offset 0x0060)
  259. * Interrupt Mask Register 4 (offset 0x0064)
  260. * Interrupt Select Register 4 (offset 0x0068)
  261. */
  262. #define GMAC1_RESERVED_INT_BIT BIT(31)
  263. #define GMAC1_MIB_INT_BIT BIT(30)
  264. #define GMAC1_RX_PAUSE_ON_INT_BIT BIT(29)
  265. #define GMAC1_TX_PAUSE_ON_INT_BIT BIT(28)
  266. #define GMAC1_RX_PAUSE_OFF_INT_BIT BIT(27)
  267. #define GMAC1_TX_PAUSE_OFF_INT_BIT BIT(26)
  268. #define GMAC1_RX_OVERRUN_INT_BIT BIT(25)
  269. #define GMAC1_STATUS_CHANGE_INT_BIT BIT(24)
  270. #define GMAC0_RESERVED_INT_BIT BIT(23)
  271. #define GMAC0_MIB_INT_BIT BIT(22)
  272. #define GMAC0_RX_PAUSE_ON_INT_BIT BIT(21)
  273. #define GMAC0_TX_PAUSE_ON_INT_BIT BIT(20)
  274. #define GMAC0_RX_PAUSE_OFF_INT_BIT BIT(19)
  275. #define GMAC0_TX_PAUSE_OFF_INT_BIT BIT(18)
  276. #define GMAC0_RX_OVERRUN_INT_BIT BIT(17)
  277. #define GMAC0_STATUS_CHANGE_INT_BIT BIT(16)
  278. #define CLASS_RX_FULL_INT_BIT(x) BIT(x + 2)
  279. #define HWFQ_EMPTY_INT_BIT BIT(1)
  280. #define SWFQ_EMPTY_INT_BIT BIT(0)
  281. #define GMAC0_INT_BITS (GMAC0_RESERVED_INT_BIT | GMAC0_MIB_INT_BIT | \
  282. GMAC0_RX_PAUSE_ON_INT_BIT | \
  283. GMAC0_TX_PAUSE_ON_INT_BIT | \
  284. GMAC0_RX_PAUSE_OFF_INT_BIT | \
  285. GMAC0_TX_PAUSE_OFF_INT_BIT | \
  286. GMAC0_RX_OVERRUN_INT_BIT | \
  287. GMAC0_STATUS_CHANGE_INT_BIT)
  288. #define GMAC1_INT_BITS (GMAC1_RESERVED_INT_BIT | GMAC1_MIB_INT_BIT | \
  289. GMAC1_RX_PAUSE_ON_INT_BIT | \
  290. GMAC1_TX_PAUSE_ON_INT_BIT | \
  291. GMAC1_RX_PAUSE_OFF_INT_BIT | \
  292. GMAC1_TX_PAUSE_OFF_INT_BIT | \
  293. GMAC1_RX_OVERRUN_INT_BIT | \
  294. GMAC1_STATUS_CHANGE_INT_BIT)
  295. #define CLASS_RX_FULL_INT_BITS 0xfffc
  296. /* GLOBAL_QUEUE_THRESHOLD_REG (offset 0x0070) */
  297. union queue_threshold {
  298. unsigned int bits32;
  299. struct bit_0070_2 {
  300. /* 7:0 Software Free Queue Empty Threshold */
  301. unsigned int swfq_empty:8;
  302. /* 15:8 Hardware Free Queue Empty Threshold */
  303. unsigned int hwfq_empty:8;
  304. /* 23:16 */
  305. unsigned int intrq:8;
  306. /* 31:24 */
  307. unsigned int toe_class:8;
  308. } bits;
  309. };
  310. /* GMAC DMA Control Register
  311. * GMAC0 offset 0x8000
  312. * GMAC1 offset 0xC000
  313. */
  314. union gmac_dma_ctrl {
  315. unsigned int bits32;
  316. struct bit_8000 {
  317. /* bit 1:0 Peripheral Bus Width */
  318. unsigned int td_bus:2;
  319. /* bit 3:2 TxDMA max burst size for every AHB request */
  320. unsigned int td_burst_size:2;
  321. /* bit 7:4 TxDMA protection control */
  322. unsigned int td_prot:4;
  323. /* bit 9:8 Peripheral Bus Width */
  324. unsigned int rd_bus:2;
  325. /* bit 11:10 DMA max burst size for every AHB request */
  326. unsigned int rd_burst_size:2;
  327. /* bit 15:12 DMA Protection Control */
  328. unsigned int rd_prot:4;
  329. /* bit 17:16 */
  330. unsigned int rd_insert_bytes:2;
  331. /* bit 27:18 */
  332. unsigned int reserved:10;
  333. /* bit 28 1: Drop, 0: Accept */
  334. unsigned int drop_small_ack:1;
  335. /* bit 29 Loopback TxDMA to RxDMA */
  336. unsigned int loopback:1;
  337. /* bit 30 Tx DMA Enable */
  338. unsigned int td_enable:1;
  339. /* bit 31 Rx DMA Enable */
  340. unsigned int rd_enable:1;
  341. } bits;
  342. };
  343. /* GMAC Tx Weighting Control Register 0
  344. * GMAC0 offset 0x8004
  345. * GMAC1 offset 0xC004
  346. */
  347. union gmac_tx_wcr0 {
  348. unsigned int bits32;
  349. struct bit_8004 {
  350. /* bit 5:0 HW TX Queue 3 */
  351. unsigned int hw_tq0:6;
  352. /* bit 11:6 HW TX Queue 2 */
  353. unsigned int hw_tq1:6;
  354. /* bit 17:12 HW TX Queue 1 */
  355. unsigned int hw_tq2:6;
  356. /* bit 23:18 HW TX Queue 0 */
  357. unsigned int hw_tq3:6;
  358. /* bit 31:24 */
  359. unsigned int reserved:8;
  360. } bits;
  361. };
  362. /* GMAC Tx Weighting Control Register 1
  363. * GMAC0 offset 0x8008
  364. * GMAC1 offset 0xC008
  365. */
  366. union gmac_tx_wcr1 {
  367. unsigned int bits32;
  368. struct bit_8008 {
  369. /* bit 4:0 SW TX Queue 0 */
  370. unsigned int sw_tq0:5;
  371. /* bit 9:5 SW TX Queue 1 */
  372. unsigned int sw_tq1:5;
  373. /* bit 14:10 SW TX Queue 2 */
  374. unsigned int sw_tq2:5;
  375. /* bit 19:15 SW TX Queue 3 */
  376. unsigned int sw_tq3:5;
  377. /* bit 24:20 SW TX Queue 4 */
  378. unsigned int sw_tq4:5;
  379. /* bit 29:25 SW TX Queue 5 */
  380. unsigned int sw_tq5:5;
  381. /* bit 31:30 */
  382. unsigned int reserved:2;
  383. } bits;
  384. };
  385. /* GMAC DMA Tx Description Word 0 Register
  386. * GMAC0 offset 0x8040
  387. * GMAC1 offset 0xC040
  388. */
  389. union gmac_txdesc_0 {
  390. unsigned int bits32;
  391. struct bit_8040 {
  392. /* bit 15:0 Transfer size */
  393. unsigned int buffer_size:16;
  394. /* bit 21:16 number of descriptors used for the current frame */
  395. unsigned int desc_count:6;
  396. /* bit 22 Tx Status, 1: Successful 0: Failed */
  397. unsigned int status_tx_ok:1;
  398. /* bit 28:23 Tx Status, Reserved bits */
  399. unsigned int status_rvd:6;
  400. /* bit 29 protocol error during processing this descriptor */
  401. unsigned int perr:1;
  402. /* bit 30 data error during processing this descriptor */
  403. unsigned int derr:1;
  404. /* bit 31 */
  405. unsigned int reserved:1;
  406. } bits;
  407. };
  408. /* GMAC DMA Tx Description Word 1 Register
  409. * GMAC0 offset 0x8044
  410. * GMAC1 offset 0xC044
  411. */
  412. union gmac_txdesc_1 {
  413. unsigned int bits32;
  414. struct txdesc_word1 {
  415. /* bit 15: 0 Tx Frame Byte Count */
  416. unsigned int byte_count:16;
  417. /* bit 16 TSS segmentation use MTU setting */
  418. unsigned int mtu_enable:1;
  419. /* bit 17 IPV4 Header Checksum Enable */
  420. unsigned int ip_chksum:1;
  421. /* bit 18 IPV6 Tx Enable */
  422. unsigned int ipv6_enable:1;
  423. /* bit 19 TCP Checksum Enable */
  424. unsigned int tcp_chksum:1;
  425. /* bit 20 UDP Checksum Enable */
  426. unsigned int udp_chksum:1;
  427. /* bit 21 Bypass HW offload engine */
  428. unsigned int bypass_tss:1;
  429. /* bit 22 Don't update IP length field */
  430. unsigned int ip_fixed_len:1;
  431. /* bit 31:23 Tx Flag, Reserved */
  432. unsigned int reserved:9;
  433. } bits;
  434. };
  435. #define TSS_IP_FIXED_LEN_BIT BIT(22)
  436. #define TSS_BYPASS_BIT BIT(21)
  437. #define TSS_UDP_CHKSUM_BIT BIT(20)
  438. #define TSS_TCP_CHKSUM_BIT BIT(19)
  439. #define TSS_IPV6_ENABLE_BIT BIT(18)
  440. #define TSS_IP_CHKSUM_BIT BIT(17)
  441. #define TSS_MTU_ENABLE_BIT BIT(16)
  442. #define TSS_CHECKUM_ENABLE \
  443. (TSS_IP_CHKSUM_BIT | TSS_IPV6_ENABLE_BIT | \
  444. TSS_TCP_CHKSUM_BIT | TSS_UDP_CHKSUM_BIT)
  445. /* GMAC DMA Tx Description Word 2 Register
  446. * GMAC0 offset 0x8048
  447. * GMAC1 offset 0xC048
  448. */
  449. union gmac_txdesc_2 {
  450. unsigned int bits32;
  451. unsigned int buf_adr;
  452. };
  453. /* GMAC DMA Tx Description Word 3 Register
  454. * GMAC0 offset 0x804C
  455. * GMAC1 offset 0xC04C
  456. */
  457. union gmac_txdesc_3 {
  458. unsigned int bits32;
  459. struct txdesc_word3 {
  460. /* bit 12: 0 Tx Frame Byte Count */
  461. unsigned int mtu_size:13;
  462. /* bit 28:13 */
  463. unsigned int reserved:16;
  464. /* bit 29 End of frame interrupt enable */
  465. unsigned int eofie:1;
  466. /* bit 31:30 11: only one, 10: first, 01: last, 00: linking */
  467. unsigned int sof_eof:2;
  468. } bits;
  469. };
  470. #define SOF_EOF_BIT_MASK 0x3fffffff
  471. #define SOF_BIT 0x80000000
  472. #define EOF_BIT 0x40000000
  473. #define EOFIE_BIT BIT(29)
  474. #define MTU_SIZE_BIT_MASK 0x1fff
  475. /* GMAC Tx Descriptor */
  476. struct gmac_txdesc {
  477. union gmac_txdesc_0 word0;
  478. union gmac_txdesc_1 word1;
  479. union gmac_txdesc_2 word2;
  480. union gmac_txdesc_3 word3;
  481. };
  482. /* GMAC DMA Rx Description Word 0 Register
  483. * GMAC0 offset 0x8060
  484. * GMAC1 offset 0xC060
  485. */
  486. union gmac_rxdesc_0 {
  487. unsigned int bits32;
  488. struct bit_8060 {
  489. /* bit 15:0 number of descriptors used for the current frame */
  490. unsigned int buffer_size:16;
  491. /* bit 21:16 number of descriptors used for the current frame */
  492. unsigned int desc_count:6;
  493. /* bit 24:22 Status of rx frame */
  494. unsigned int status:4;
  495. /* bit 28:26 Check Sum Status */
  496. unsigned int chksum_status:3;
  497. /* bit 29 protocol error during processing this descriptor */
  498. unsigned int perr:1;
  499. /* bit 30 data error during processing this descriptor */
  500. unsigned int derr:1;
  501. /* bit 31 TOE/CIS Queue Full dropped packet to default queue */
  502. unsigned int drop:1;
  503. } bits;
  504. };
  505. #define GMAC_RXDESC_0_T_derr BIT(30)
  506. #define GMAC_RXDESC_0_T_perr BIT(29)
  507. #define GMAC_RXDESC_0_T_chksum_status(x) BIT(x + 26)
  508. #define GMAC_RXDESC_0_T_status(x) BIT(x + 22)
  509. #define GMAC_RXDESC_0_T_desc_count(x) BIT(x + 16)
  510. #define RX_CHKSUM_IP_UDP_TCP_OK 0
  511. #define RX_CHKSUM_IP_OK_ONLY 1
  512. #define RX_CHKSUM_NONE 2
  513. #define RX_CHKSUM_IP_ERR_UNKNOWN 4
  514. #define RX_CHKSUM_IP_ERR 5
  515. #define RX_CHKSUM_TCP_UDP_ERR 6
  516. #define RX_CHKSUM_NUM 8
  517. #define RX_STATUS_GOOD_FRAME 0
  518. #define RX_STATUS_TOO_LONG_GOOD_CRC 1
  519. #define RX_STATUS_RUNT_FRAME 2
  520. #define RX_STATUS_SFD_NOT_FOUND 3
  521. #define RX_STATUS_CRC_ERROR 4
  522. #define RX_STATUS_TOO_LONG_BAD_CRC 5
  523. #define RX_STATUS_ALIGNMENT_ERROR 6
  524. #define RX_STATUS_TOO_LONG_BAD_ALIGN 7
  525. #define RX_STATUS_RX_ERR 8
  526. #define RX_STATUS_DA_FILTERED 9
  527. #define RX_STATUS_BUFFER_FULL 10
  528. #define RX_STATUS_NUM 16
  529. #define RX_ERROR_LENGTH(s) \
  530. ((s) == RX_STATUS_TOO_LONG_GOOD_CRC || \
  531. (s) == RX_STATUS_TOO_LONG_BAD_CRC || \
  532. (s) == RX_STATUS_TOO_LONG_BAD_ALIGN)
  533. #define RX_ERROR_OVER(s) \
  534. ((s) == RX_STATUS_BUFFER_FULL)
  535. #define RX_ERROR_CRC(s) \
  536. ((s) == RX_STATUS_CRC_ERROR || \
  537. (s) == RX_STATUS_TOO_LONG_BAD_CRC)
  538. #define RX_ERROR_FRAME(s) \
  539. ((s) == RX_STATUS_ALIGNMENT_ERROR || \
  540. (s) == RX_STATUS_TOO_LONG_BAD_ALIGN)
  541. #define RX_ERROR_FIFO(s) \
  542. (0)
  543. /* GMAC DMA Rx Description Word 1 Register
  544. * GMAC0 offset 0x8064
  545. * GMAC1 offset 0xC064
  546. */
  547. union gmac_rxdesc_1 {
  548. unsigned int bits32;
  549. struct rxdesc_word1 {
  550. /* bit 15: 0 Rx Frame Byte Count */
  551. unsigned int byte_count:16;
  552. /* bit 31:16 Software ID */
  553. unsigned int sw_id:16;
  554. } bits;
  555. };
  556. /* GMAC DMA Rx Description Word 2 Register
  557. * GMAC0 offset 0x8068
  558. * GMAC1 offset 0xC068
  559. */
  560. union gmac_rxdesc_2 {
  561. unsigned int bits32;
  562. unsigned int buf_adr;
  563. };
  564. #define RX_INSERT_NONE 0
  565. #define RX_INSERT_1_BYTE 1
  566. #define RX_INSERT_2_BYTE 2
  567. #define RX_INSERT_3_BYTE 3
  568. /* GMAC DMA Rx Description Word 3 Register
  569. * GMAC0 offset 0x806C
  570. * GMAC1 offset 0xC06C
  571. */
  572. union gmac_rxdesc_3 {
  573. unsigned int bits32;
  574. struct rxdesc_word3 {
  575. /* bit 7: 0 L3 data offset */
  576. unsigned int l3_offset:8;
  577. /* bit 15: 8 L4 data offset */
  578. unsigned int l4_offset:8;
  579. /* bit 23: 16 L7 data offset */
  580. unsigned int l7_offset:8;
  581. /* bit 24 Duplicated ACK detected */
  582. unsigned int dup_ack:1;
  583. /* bit 25 abnormal case found */
  584. unsigned int abnormal:1;
  585. /* bit 26 IPV4 option or IPV6 extension header */
  586. unsigned int option:1;
  587. /* bit 27 Out of Sequence packet */
  588. unsigned int out_of_seq:1;
  589. /* bit 28 Control Flag is present */
  590. unsigned int ctrl_flag:1;
  591. /* bit 29 End of frame interrupt enable */
  592. unsigned int eofie:1;
  593. /* bit 31:30 11: only one, 10: first, 01: last, 00: linking */
  594. unsigned int sof_eof:2;
  595. } bits;
  596. };
  597. /* GMAC Rx Descriptor, this is simply fitted over the queue registers */
  598. struct gmac_rxdesc {
  599. union gmac_rxdesc_0 word0;
  600. union gmac_rxdesc_1 word1;
  601. union gmac_rxdesc_2 word2;
  602. union gmac_rxdesc_3 word3;
  603. };
  604. /* GMAC Matching Rule Control Register 0
  605. * GMAC0 offset 0x8078
  606. * GMAC1 offset 0xC078
  607. */
  608. #define MR_L2_BIT BIT(31)
  609. #define MR_L3_BIT BIT(30)
  610. #define MR_L4_BIT BIT(29)
  611. #define MR_L7_BIT BIT(28)
  612. #define MR_PORT_BIT BIT(27)
  613. #define MR_PRIORITY_BIT BIT(26)
  614. #define MR_DA_BIT BIT(23)
  615. #define MR_SA_BIT BIT(22)
  616. #define MR_ETHER_TYPE_BIT BIT(21)
  617. #define MR_VLAN_BIT BIT(20)
  618. #define MR_PPPOE_BIT BIT(19)
  619. #define MR_IP_VER_BIT BIT(15)
  620. #define MR_IP_HDR_LEN_BIT BIT(14)
  621. #define MR_FLOW_LABLE_BIT BIT(13)
  622. #define MR_TOS_TRAFFIC_BIT BIT(12)
  623. #define MR_SPR_BIT(x) BIT(x)
  624. #define MR_SPR_BITS 0xff
  625. /* GMAC_AHB_WEIGHT registers
  626. * GMAC0 offset 0x80C8
  627. * GMAC1 offset 0xC0C8
  628. */
  629. union gmac_ahb_weight {
  630. unsigned int bits32;
  631. struct bit_80C8 {
  632. /* 4:0 */
  633. unsigned int hash_weight:5;
  634. /* 9:5 */
  635. unsigned int rx_weight:5;
  636. /* 14:10 */
  637. unsigned int tx_weight:5;
  638. /* 19:15 Rx Data Pre Request FIFO Threshold */
  639. unsigned int pre_req:5;
  640. /* 24:20 DMA TqCtrl to Start tqDV FIFO Threshold */
  641. unsigned int tq_dv_threshold:5;
  642. /* 31:25 */
  643. unsigned int reserved:7;
  644. } bits;
  645. };
  646. /* GMAC RX FLTR
  647. * GMAC0 Offset 0xA00C
  648. * GMAC1 Offset 0xE00C
  649. */
  650. union gmac_rx_fltr {
  651. unsigned int bits32;
  652. struct bit1_000c {
  653. /* Enable receive of unicast frames that are sent to STA
  654. * address
  655. */
  656. unsigned int unicast:1;
  657. /* Enable receive of multicast frames that pass multicast
  658. * filter
  659. */
  660. unsigned int multicast:1;
  661. /* Enable receive of broadcast frames */
  662. unsigned int broadcast:1;
  663. /* Enable receive of all frames */
  664. unsigned int promiscuous:1;
  665. /* Enable receive of all error frames */
  666. unsigned int error:1;
  667. unsigned int reserved:27;
  668. } bits;
  669. };
  670. /* GMAC Configuration 0
  671. * GMAC0 Offset 0xA018
  672. * GMAC1 Offset 0xE018
  673. */
  674. union gmac_config0 {
  675. unsigned int bits32;
  676. struct bit1_0018 {
  677. /* 0: disable transmit */
  678. unsigned int dis_tx:1;
  679. /* 1: disable receive */
  680. unsigned int dis_rx:1;
  681. /* 2: transmit data loopback enable */
  682. unsigned int loop_back:1;
  683. /* 3: flow control also trigged by Rx queues */
  684. unsigned int flow_ctrl:1;
  685. /* 4-7: adjust IFG from 96+/-56 */
  686. unsigned int adj_ifg:4;
  687. /* 8-10 maximum receive frame length allowed */
  688. unsigned int max_len:3;
  689. /* 11: disable back-off function */
  690. unsigned int dis_bkoff:1;
  691. /* 12: disable 16 collisions abort function */
  692. unsigned int dis_col:1;
  693. /* 13: speed up timers in simulation */
  694. unsigned int sim_test:1;
  695. /* 14: RX flow control enable */
  696. unsigned int rx_fc_en:1;
  697. /* 15: TX flow control enable */
  698. unsigned int tx_fc_en:1;
  699. /* 16: RGMII in-band status enable */
  700. unsigned int rgmii_en:1;
  701. /* 17: IPv4 RX Checksum enable */
  702. unsigned int ipv4_rx_chksum:1;
  703. /* 18: IPv6 RX Checksum enable */
  704. unsigned int ipv6_rx_chksum:1;
  705. /* 19: Remove Rx VLAN tag */
  706. unsigned int rx_tag_remove:1;
  707. /* 20 */
  708. unsigned int rgmm_edge:1;
  709. /* 21 */
  710. unsigned int rxc_inv:1;
  711. /* 22 */
  712. unsigned int ipv6_exthdr_order:1;
  713. /* 23 */
  714. unsigned int rx_err_detect:1;
  715. /* 24 */
  716. unsigned int port0_chk_hwq:1;
  717. /* 25 */
  718. unsigned int port1_chk_hwq:1;
  719. /* 26 */
  720. unsigned int port0_chk_toeq:1;
  721. /* 27 */
  722. unsigned int port1_chk_toeq:1;
  723. /* 28 */
  724. unsigned int port0_chk_classq:1;
  725. /* 29 */
  726. unsigned int port1_chk_classq:1;
  727. /* 30, 31 */
  728. unsigned int reserved:2;
  729. } bits;
  730. };
  731. #define CONFIG0_TX_RX_DISABLE (BIT(1) | BIT(0))
  732. #define CONFIG0_RX_CHKSUM (BIT(18) | BIT(17))
  733. #define CONFIG0_FLOW_RX BIT(14)
  734. #define CONFIG0_FLOW_TX BIT(15)
  735. #define CONFIG0_FLOW_TX_RX (BIT(14) | BIT(15))
  736. #define CONFIG0_FLOW_CTL (BIT(14) | BIT(15))
  737. #define CONFIG0_MAXLEN_SHIFT 8
  738. #define CONFIG0_MAXLEN_MASK (7 << CONFIG0_MAXLEN_SHIFT)
  739. #define CONFIG0_MAXLEN_1536 0
  740. #define CONFIG0_MAXLEN_1518 1
  741. #define CONFIG0_MAXLEN_1522 2
  742. #define CONFIG0_MAXLEN_1542 3
  743. #define CONFIG0_MAXLEN_9k 4 /* 9212 */
  744. #define CONFIG0_MAXLEN_10k 5 /* 10236 */
  745. #define CONFIG0_MAXLEN_1518__6 6
  746. #define CONFIG0_MAXLEN_1518__7 7
  747. /* GMAC Configuration 1
  748. * GMAC0 Offset 0xA01C
  749. * GMAC1 Offset 0xE01C
  750. */
  751. union gmac_config1 {
  752. unsigned int bits32;
  753. struct bit1_001c {
  754. /* Flow control set threshold */
  755. unsigned int set_threshold:8;
  756. /* Flow control release threshold */
  757. unsigned int rel_threshold:8;
  758. unsigned int reserved:16;
  759. } bits;
  760. };
  761. #define GMAC_FLOWCTRL_SET_MAX 32
  762. #define GMAC_FLOWCTRL_SET_MIN 0
  763. #define GMAC_FLOWCTRL_RELEASE_MAX 32
  764. #define GMAC_FLOWCTRL_RELEASE_MIN 0
  765. /* GMAC Configuration 2
  766. * GMAC0 Offset 0xA020
  767. * GMAC1 Offset 0xE020
  768. */
  769. union gmac_config2 {
  770. unsigned int bits32;
  771. struct bit1_0020 {
  772. /* Flow control set threshold */
  773. unsigned int set_threshold:16;
  774. /* Flow control release threshold */
  775. unsigned int rel_threshold:16;
  776. } bits;
  777. };
  778. /* GMAC Configuration 3
  779. * GMAC0 Offset 0xA024
  780. * GMAC1 Offset 0xE024
  781. */
  782. union gmac_config3 {
  783. unsigned int bits32;
  784. struct bit1_0024 {
  785. /* Flow control set threshold */
  786. unsigned int set_threshold:16;
  787. /* Flow control release threshold */
  788. unsigned int rel_threshold:16;
  789. } bits;
  790. };
  791. /* GMAC STATUS
  792. * GMAC0 Offset 0xA02C
  793. * GMAC1 Offset 0xE02C
  794. */
  795. union gmac_status {
  796. unsigned int bits32;
  797. struct bit1_002c {
  798. /* Link status */
  799. unsigned int link:1;
  800. /* Link speed(00->2.5M 01->25M 10->125M) */
  801. unsigned int speed:2;
  802. /* Duplex mode */
  803. unsigned int duplex:1;
  804. unsigned int reserved_1:1;
  805. /* PHY interface type */
  806. unsigned int mii_rmii:2;
  807. unsigned int reserved_2:25;
  808. } bits;
  809. };
  810. #define GMAC_SPEED_10 0
  811. #define GMAC_SPEED_100 1
  812. #define GMAC_SPEED_1000 2
  813. #define GMAC_PHY_MII 0
  814. #define GMAC_PHY_GMII 1
  815. #define GMAC_PHY_RGMII_100_10 2
  816. #define GMAC_PHY_RGMII_1000 3
  817. /* Queue Header
  818. * (1) TOE Queue Header
  819. * (2) Non-TOE Queue Header
  820. * (3) Interrupt Queue Header
  821. *
  822. * memory Layout
  823. * TOE Queue Header
  824. * 0x60003000 +---------------------------+ 0x0000
  825. * | TOE Queue 0 Header |
  826. * | 8 * 4 Bytes |
  827. * +---------------------------+ 0x0020
  828. * | TOE Queue 1 Header |
  829. * | 8 * 4 Bytes |
  830. * +---------------------------+ 0x0040
  831. * | ...... |
  832. * | |
  833. * +---------------------------+
  834. *
  835. * Non TOE Queue Header
  836. * 0x60002000 +---------------------------+ 0x0000
  837. * | Default Queue 0 Header |
  838. * | 2 * 4 Bytes |
  839. * +---------------------------+ 0x0008
  840. * | Default Queue 1 Header |
  841. * | 2 * 4 Bytes |
  842. * +---------------------------+ 0x0010
  843. * | Classification Queue 0 |
  844. * | 2 * 4 Bytes |
  845. * +---------------------------+
  846. * | Classification Queue 1 |
  847. * | 2 * 4 Bytes |
  848. * +---------------------------+ (n * 8 + 0x10)
  849. * | ... |
  850. * | 2 * 4 Bytes |
  851. * +---------------------------+ (13 * 8 + 0x10)
  852. * | Classification Queue 13 |
  853. * | 2 * 4 Bytes |
  854. * +---------------------------+ 0x80
  855. * | Interrupt Queue 0 |
  856. * | 2 * 4 Bytes |
  857. * +---------------------------+
  858. * | Interrupt Queue 1 |
  859. * | 2 * 4 Bytes |
  860. * +---------------------------+
  861. * | Interrupt Queue 2 |
  862. * | 2 * 4 Bytes |
  863. * +---------------------------+
  864. * | Interrupt Queue 3 |
  865. * | 2 * 4 Bytes |
  866. * +---------------------------+
  867. *
  868. */
  869. #define TOE_QUEUE_HDR_ADDR(n) (TOE_TOE_QUE_HDR_BASE + n * 32)
  870. #define TOE_Q_HDR_AREA_END (TOE_QUEUE_HDR_ADDR(TOE_TOE_QUEUE_MAX + 1))
  871. #define TOE_DEFAULT_Q_HDR_BASE(x) (TOE_NONTOE_QUE_HDR_BASE + 0x08 * (x))
  872. #define TOE_CLASS_Q_HDR_BASE (TOE_NONTOE_QUE_HDR_BASE + 0x10)
  873. #define TOE_INTR_Q_HDR_BASE (TOE_NONTOE_QUE_HDR_BASE + 0x80)
  874. #define INTERRUPT_QUEUE_HDR_ADDR(n) (TOE_INTR_Q_HDR_BASE + n * 8)
  875. #define NONTOE_Q_HDR_AREA_END (INTERRUPT_QUEUE_HDR_ADDR(TOE_INTR_QUEUE_MAX + 1))
  876. /* NONTOE Queue Header Word 0 */
  877. union nontoe_qhdr0 {
  878. unsigned int bits32;
  879. unsigned int base_size;
  880. };
  881. #define NONTOE_QHDR0_BASE_MASK (~0x0f)
  882. /* NONTOE Queue Header Word 1 */
  883. union nontoe_qhdr1 {
  884. unsigned int bits32;
  885. struct bit_nonqhdr1 {
  886. /* bit 15:0 */
  887. unsigned int rptr:16;
  888. /* bit 31:16 */
  889. unsigned int wptr:16;
  890. } bits;
  891. };
  892. /* Non-TOE Queue Header */
  893. struct nontoe_qhdr {
  894. union nontoe_qhdr0 word0;
  895. union nontoe_qhdr1 word1;
  896. };
  897. #endif /* _GEMINI_ETHERNET_H */