1 /*
2  * Driver for Synopsys DesignWare MAC
3  *
4  * Copyright (c) 2021 BayLibre SAS
5  *
6  * SPDX-License-Identifier: Apache-2.0
7  *
8  * Definitions in this file are based on:
9  *
10  *   DesignWare Cores Ethernet Quality-of-Service Databook
11  *   Version 5.10a, December 2017
12  */
13 
14 #ifndef ZEPHYR_DRIVERS_ETHERNET_ETH_DWMAC_PRIV_H_
15 #define ZEPHYR_DRIVERS_ETHERNET_ETH_DWMAC_PRIV_H_
16 
17 /*
18  * Global driver parameters
19  */
20 
21 /* number of hardware descriptors in uncached memory */
22 #define NB_TX_DESCS		CONFIG_DWMAC_NB_TX_DESCS
23 #define NB_RX_DESCS		CONFIG_DWMAC_NB_RX_DESCS
24 
25 /* stack size for RX refill thread */
26 #define RX_REFILL_STACK_SIZE	1024
27 
28 /*
29  * Common structure definitions
30  */
31 
32 /* hardware descriptor representation */
33 struct dwmac_dma_desc {
34 	uint32_t des0;
35 	uint32_t des1;
36 	uint32_t des2;
37 	uint32_t des3;
38 };
39 
40 /* our private instance structure */
41 struct dwmac_priv {
42 	mem_addr_t base_addr;
43 	struct net_if *iface;
44 	const struct device *clock;
45 
46 	uint8_t mac_addr[6];
47 
48 	uint32_t feature0;
49 	uint32_t feature1;
50 	uint32_t feature2;
51 	uint32_t feature3;
52 
53 	struct dwmac_dma_desc *tx_descs, *rx_descs;
54 	struct k_sem free_tx_descs, free_rx_descs;
55 	unsigned int tx_desc_head, tx_desc_tail;
56 	unsigned int rx_desc_head, rx_desc_tail;
57 
58 #ifdef CONFIG_MMU
59 	uintptr_t tx_descs_phys, rx_descs_phys;
60 #endif
61 
62 	struct net_buf *tx_frags[NB_TX_DESCS]; /* index shared with tx_descs */
63 	struct net_buf *rx_frags[NB_RX_DESCS]; /* index shared with rx_descs */
64 
65 	struct net_pkt *rx_pkt;
66 	unsigned int rx_bytes;
67 
68 	K_KERNEL_STACK_MEMBER(rx_refill_thread_stack, RX_REFILL_STACK_SIZE);
69 	struct k_thread rx_refill_thread;
70 };
71 
72 /*
73  * Handy register accessors
74  */
75 
76 #define REG_READ(r) sys_read32(p->base_addr + (r))
77 #define REG_WRITE(r, v) sys_write32((v), p->base_addr + (r))
78 
79 /*
80  * Shared declarations between core and platform glue code
81  */
82 
83 int dwmac_probe(const struct device *dev);
84 int dwmac_bus_init(struct dwmac_priv *p);
85 void dwmac_platform_init(struct dwmac_priv *p);
86 void dwmac_isr(const struct device *ddev);
87 extern const struct ethernet_api dwmac_api;
88 
89 /*
90  * MAC Register Definitions
91  */
92 
93 /* 17.1.1 */
94 
95 #define MAC_CONF				0x0000
96 
97 #define MAC_CONF_ARPEN					BIT(31)
98 #define MAC_CONF_SARC				GENMASK(30, 28)
99 #define MAC_CONF_IPC				BIT(27)
100 #define MAC_CONF_IPG				GENMASK(26, 24)
101 #define MAC_CONF_GPSLCE				BIT(23)
102 #define MAC_CONF_S2KP				BIT(22)
103 #define MAC_CONF_CST				BIT(21)
104 #define MAC_CONF_ACS				BIT(20)
105 #define MAC_CONF_WD				BIT(19)
106 #define MAC_CONF_BE				BIT(18)
107 #define MAC_CONF_JD				BIT(17)
108 #define MAC_CONF_JE				BIT(16)
109 #define MAC_CONF_PS				BIT(15)
110 #define MAC_CONF_FES				BIT(14)
111 #define MAC_CONF_DM				BIT(13)
112 #define MAC_CONF_LM				BIT(12)
113 #define MAC_CONF_ECRSFD				BIT(11)
114 #define MAC_CONF_DO				BIT(10)
115 #define MAC_CONF_DCRS				BIT(9)
116 #define MAC_CONF_DR				BIT(8)
117 #define MAC_CONF_BL				GENMASK(6, 5)
118 #define MAC_CONF_DC				BIT(4)
119 #define MAC_CONF_PRELEN				GENMASK(3, 2)
120 #define MAC_CONF_TE				BIT(1)
121 #define MAC_CONF_RE				BIT(0)
122 
123 /* 17.1.2 */
124 
125 #define MAC_EXT_CONF				0x0004
126 
127 #define MAC_EXT_CONF_FHE			BIT(31)
128 #define MAC_EXT_CONF_EIPG			GENMASK(29, 25)
129 #define MAC_EXT_CONF_EIPGEN			BIT(24)
130 #define MAC_EXT_CONF_HDSMS			GENMASK(22, 20)
131 #define MAC_EXT_CONF_PDC			BIT(19)
132 #define MAC_EXT_CONF_USP			BIT(18)
133 #define MAC_EXT_CONF_SPEN			BIT(17)
134 #define MAC_EXT_CONF_DCRCC			BIT(16)
135 #define MAC_EXT_CONF_GPSL			GENMASK(13, 0)
136 
137 /* 17.1.3 */
138 
139 #define MAC_PKT_FILTER				0x0008
140 
141 #define MAC_PKT_FILTER_RA			BIT(31)
142 #define MAC_PKT_FILTER_DNTU			BIT(21)
143 #define MAC_PKT_FILTER_IPFE			BIT(20)
144 #define MAC_PKT_FILTER_VTFE			BIT(16)
145 #define MAC_PKT_FILTER_HPF			it(10)
146 #define MAC_PKT_FILTER_SAF			BIT(9)
147 #define MAC_PKT_FILTER_SAIF			BIT(8)
148 #define MAC_PKT_FILTER_PCF			GENMASK(7, 6)
149 #define MAC_PKT_FILTER_DBF			BIT(5)
150 #define MAC_PKT_FILTER_PM			BIT(4)
151 #define MAC_PKT_FILTER_DAIF			BIT(3)
152 #define MAC_PKT_FILTER_HMC			BIT(2)
153 #define MAC_PKT_FILTER_HUC			BIT(1)
154 #define MAC_PKT_FILTER_PR			BIT(0)
155 
156 /* 17.1.4 */
157 
158 #define MAC_WDOG_TIMEOUT			0x000c
159 
160 #define MAC_WDOG_TIMEOUT_PWE			BIT(8)
161 #define MAC_WDOG_TIMEOUT_WTO			GENMASK(3, 0)
162 
163 /* 17.1.5 ... 17.1.12 */
164 
165 #define MAC_HASH_TABLE(n)			(0x0010 + 4 * (n))
166 
167 /* 17.1.13 */
168 
169 #define MAC_VLAN_TAG				0x0050
170 
171 /* 17.1.14 */
172 
173 #define MAC_VLAN_TAG_CTRL			0x0050
174 
175 #define MAC_VLAN_TAG_CTRL_EIVLRXS		BIT(31)
176 #define MAC_VLAN_TAG_CTRL_EIVLS			GENMASK(29, 28)
177 #define MAC_VLAN_TAG_CTRL_ERIVLT		BIT(27)
178 #define MAC_VLAN_TAG_CTRL_EDVLP			BIT(26)
179 #define MAC_VLAN_TAG_CTRL_VTHM			BIT(25)
180 #define MAC_VLAN_TAG_CTRL_EVLRXS		BIT(24)
181 #define MAC_VLAN_TAG_CTRL_EVLS			GENMASK(22, 21)
182 #define MAC_VLAN_TAG_CTRL_DOVLTC		BIT(20)
183 #define MAC_VLAN_TAG_CTRL_ERSVLM		BIT(19)
184 #define MAC_VLAN_TAG_CTRL_ESVL			BIT(18)
185 #define MAC_VLAN_TAG_CTRL_VTIM			BIT(17)
186 #define MAC_VLAN_TAG_CTRL_ETV			BIT(16)
187 #define MAC_VLAN_TAG_CTRL_VL			GENMASK(15, 0)
188 #define MAC_VLAN_TAG_CTRL_OFS			GENMASK(6, 2)
189 #define MAC_VLAN_TAG_CTRL_CT			BIT(1)
190 #define MAC_VLAN_TAG_CTRL_OB			BIT(0)
191 
192 /* 17.1.15 */
193 
194 #define MAC_VLAN_TAG_DATA			0x0054
195 
196 /* 17.1.17 */
197 
198 #define MAC_VLAN_HASH_TBL			0x0058
199 
200 /* 17.1.19 */
201 
202 #define MAC_VLAN_INCL				0x0060
203 
204 /* 17.1.20 */
205 
206 #define MAC_INNER_VLAN_INCL			0x0064
207 
208 /* 17.1.21 */
209 
210 #define MAC_Qn_TX_FLOW_CTRL(n)			(0x0070 + 4 * (n))
211 
212 #define MAC_Qn_TX_FLOW_CTRL_PT			GENMASK(31, 16)
213 #define MAC_Qn_TX_FLOW_CTRL_DZPQ		BIT(7)
214 #define MAC_Qn_TX_FLOW_CTRL_PLT			GENMASK(6, 4)
215 #define MAC_Qn_TX_FLOW_CTRL_TFE			BIT(1)
216 #define MAC_Qn_TX_FLOW_CTRL_FCB_BPA		BIT(0)
217 
218 /* 17.1.23 */
219 
220 #define MAC_RX_FLOW_CTRL			0x0090
221 
222 #define MAC_RX_FLOW_CTRL_PFCE			BIT(8)
223 #define MAC_RX_FLOW_CTRL_UP			BIT(1)
224 #define MAC_RX_FLOW_CTRL_RFE			BIT(0)
225 
226 /* 17.1.24 */
227 
228 #define MAC_RXQ_CTRL4				0x0094
229 
230 /* 17.1.5 */
231 
232 #define MAC_TXQ_PRTY_MAP0			0x0098
233 
234 /* 17.1.26 */
235 
236 #define MAC_TXQ_PRTY_MAP1			0x009c
237 
238 /* 17.1.27 */
239 
240 #define MAC_RXQ_CTRL0				0x00a0
241 
242 /* 17.1.28 */
243 
244 #define MAC_RXQ_CTRL1				0x00a4
245 
246 /* 17.1.29 */
247 
248 #define MAC_RXQ_CTRL2				0x00a8
249 
250 /* 17.1.30 */
251 
252 #define MAC_RXQ_CTRL3				0x00ac
253 
254 /* 17.1.31 */
255 
256 #define MAC_IRQ_STATUS				0x00b0
257 
258 #define MAC_IRQ_STATUS_MFRIS			BIT(20)
259 #define MAC_IRQ_STATUS_MFTIS			BIT(19)
260 #define MAC_IRQ_STATUS_MDIOIS			BIT(18)
261 #define MAC_IRQ_STATUS_FPEIS			BIT(17)
262 #define MAC_IRQ_STATUS_GPIIS			BIT(15)
263 #define MAC_IRQ_STATUS_RXSTSIS			BIT(14)
264 #define MAC_IRQ_STATUS_TXSTSIS			BIT(13)
265 #define MAC_IRQ_STATUS_TSIS			BIT(12)
266 #define MAC_IRQ_STATUS_MMCRXIPIS		BIT(11)
267 #define MAC_IRQ_STATUS_MMCTXIS			BIT(10)
268 #define MAC_IRQ_STATUS_MMCRXIS			BIT(9)
269 #define MAC_IRQ_STATUS_MMCIS			BIT(8)
270 #define MAC_IRQ_STATUS_LPIIS			BIT(5)
271 #define MAC_IRQ_STATUS_PMTIS			BIT(4)
272 #define MAC_IRQ_STATUS_PHYIS			BIT(3)
273 #define MAC_IRQ_STATUS_PCSANCIS			BIT(2)
274 #define MAC_IRQ_STATUS_PCSLCHGIS		BIT(1)
275 #define MAC_IRQ_STATUS_RGSMIIIS			BIT(0)
276 
277 /* 17.1.32 */
278 
279 #define MAC_IRQ_ENABLE				0x00b4
280 
281 #define MAC_IRQ_ENABLE_MDIOIE			BIT(18)
282 #define MAC_IRQ_ENABLE_FPEIE			BIT(17)
283 #define MAC_IRQ_ENABLE_RXSTSIE			BIT(14)
284 #define MAC_IRQ_ENABLE_TXSTSIE			BIT(13)
285 #define MAC_IRQ_ENABLE_TSIE			BIT(12)
286 #define MAC_IRQ_ENABLE_LPIIE			BIT(5)
287 #define MAC_IRQ_ENABLE_PMTIE			BIT(4)
288 #define MAC_IRQ_ENABLE_PHYIE			BIT(3)
289 #define MAC_IRQ_ENABLE_PCSANCIE			BIT(2)
290 #define MAC_IRQ_ENABLE_PCSLCHGIE		BIT(1)
291 #define MAC_IRQ_ENABLE_RGSMIIIE			BIT(0)
292 
293 /* 17.1.33 */
294 
295 #define MAC_RX_TX_STATUS			0x00b8
296 
297 #define MAC_RX_TX_STATUS_WT			BIT(8)
298 #define MAC_RX_TX_STATUS_EXCOL			BIT(5)
299 #define MAC_RX_TX_STATUS_LCOL			BIT(4)
300 #define MAC_RX_TX_STATUS_EXDEF			BIT(3)
301 #define MAC_RX_TX_STATUS_LCARR			BIT(2)
302 #define MAC_RX_TX_STATUS_NCARR			BIT(1)
303 #define MAC_RX_TX_STATUS_TJT			BIT(0)
304 
305 /* 17.1.34 */
306 
307 #define MAC_PMT_CTRL_STATUS			0x00c0
308 
309 #define MAC_PMT_CTRL_STATUS_RWKFILTRST		BIT(31)
310 #define MAC_PMT_CTRL_STATUS_RWKPTR		GENMASK(28, 24)
311 #define MAC_PMT_CTRL_STATUS_RWKPFE		BIT(10)
312 #define MAC_PMT_CTRL_STATUS_GLBLUCAST		BIT(9)
313 #define MAC_PMT_CTRL_STATUS_RWKPRCVD		BIT(6)
314 #define MAC_PMT_CTRL_STATUS_MGKPRCVD		BIT(5)
315 #define MAC_PMT_CTRL_STATUS_RWKPKTEN		BIT(2)
316 #define MAC_PMT_CTRL_STATUS_MGKPKTEN		BIT(1)
317 #define MAC_PMT_CTRL_STATUS_PWRDWN		BIT(0)
318 
319 /* 17.1.35 */
320 
321 #define MAC_RWK_PKT_FILTER			0x00c4
322 
323 /* 17.1.40 */
324 
325 #define MAC_LPI_CTRL_STATUS			0x00d0
326 
327 #define MAC_LPI_CTRL_STATUS_LPITCSE		BIT(21)
328 #define MAC_LPI_CTRL_STATUS_LPIATE		BIT(20)
329 #define MAC_LPI_CTRL_STATUS_LPITXA		BIT(19)
330 #define MAC_LPI_CTRL_STATUS_PLSEN		BIT(18)
331 #define MAC_LPI_CTRL_STATUS_PLS			BIT(17)
332 #define MAC_LPI_CTRL_STATUS_LPIEN		BIT(16)
333 #define MAC_LPI_CTRL_STATUS_RLPIST		BIT(9)
334 #define MAC_LPI_CTRL_STATUS_TLPIST		BIT(8)
335 #define MAC_LPI_CTRL_STATUS_RLPIEX		BIT(3)
336 #define MAC_LPI_CTRL_STATUS_RLPIEN		BIT(2)
337 #define MAC_LPI_CTRL_STATUS_TLPIEX		BIT(1)
338 #define MAC_LPI_CTRL_STATUS_TLPIEN		BIT(0)
339 
340 /* 17.1.41 */
341 
342 #define MAC_LPI_TIMERS_CTRL			0x00d4
343 
344 /* 17.1.42 */
345 
346 #define MAC_LPI_ENTRY_TIMER			0x00d8
347 
348 /* 17.1.43 */
349 
350 #define MAC_1US_TIC_COUNTERR			0x00dc
351 
352 /* 17.1.44 */
353 
354 #define MAC_AN_CTRL				0x00e0
355 
356 #define MAC_AN_CTRL_SGMRAL			BIT(18)
357 #define MAC_AN_CTRL_LR				BIT(17)
358 #define MAC_AN_CTRL_ECD				BIT(16)
359 #define MAC_AN_CTRL_ELE				BIT(14)
360 #define MAC_AN_CTRL_ANE				BIT(12)
361 #define MAC_AN_CTRL_RAN				BIT(9)
362 
363 /* 17.1.45 */
364 
365 #define MAC_AN_STATUS				0x00e4
366 
367 #define MAC_AN_STATUS_ES			BIT(8)
368 #define MAC_AN_STATUS_ANC			BIT(5)
369 #define MAC_AN_STATUS_ANA			BIT(3)
370 #define MAC_AN_STATUS_LS			BIT(2)
371 
372 /* 17.1.46 */
373 
374 #define MAC_AN_ADVERT				0x00e8
375 
376 #define MAC_AN_ADVERT_NP			BIT(15)
377 #define MAC_AN_ADVERT_RFE			GENMASK(13, 12)
378 #define MAC_AN_ADVERT_PSE			GENMASK(8, 7)
379 #define MAC_AN_ADVERT_HD			BIT(6)
380 #define MAC_AN_ADVERT_FD			BIT(5)
381 
382 /* 17.1.47 */
383 
384 #define MAC_AN_LINK_PRTNR			0x00ec
385 
386 #define MAC_AN_LINK_PRTNR_NP			BIT(15)
387 #define MAC_AN_LINK_PRTNR_ACK			BIT(14)
388 #define MAC_AN_LINK_PRTNR_RFE			GENMASK(13, 12)
389 #define MAC_AN_LINK_PRTNR_PSE			GENMASK(8, 7)
390 #define MAC_AN_LINK_PRTNR_HD			BIT(6)
391 #define MAC_AN_LINK_PRTNR_FD			BIT(5)
392 
393 /* 17.1.48 */
394 
395 #define MAC_AN_EXPANSION			0x00f0
396 
397 #define MAC_AN_EXPANSION_NPA			BIT(2)
398 #define MAC_AN_EXPANSION_NPR			BIT(1)
399 
400 /* 17.1.49 */
401 
402 #define MAC_TBI_EXT_STATUS			0x00f4
403 
404 #define MAC_TBI_EXT_STATUS_GFD			BIT(15)
405 #define MAC_TBI_EXT_STATUS_GHD			BIT(14)
406 
407 /* 17.1.50 */
408 
409 #define MAC_PHYIF_CTRL_STATUS			0x00f8
410 
411 #define MAC_PHYIF_CTRL_STATUS_FALSCARDET	BIT(21)
412 #define MAC_PHYIF_CTRL_STATUS_JABTO		BIT(20)
413 #define MAC_PHYIF_CTRL_STATUS_LNKSTS		BIT(19)
414 #define MAC_PHYIF_CTRL_STATUS_LNKSPEED		GENMASK(18, 17)
415 #define MAC_PHYIF_CTRL_STATUS_LNKMOD		BIT(16)
416 #define MAC_PHYIF_CTRL_STATUS_SMIDRXS		BIT(4)
417 #define MAC_PHYIF_CTRL_STATUS_SFTERR		BIT(2)
418 #define MAC_PHYIF_CTRL_STATUS_LUD		BIT(1)
419 #define MAC_PHYIF_CTRL_STATUS_TC		BIT(0)
420 
421 /* 17.1.51 */
422 
423 #define MAC_VERSION				0x0110
424 
425 #define MAC_VERSION_USERVER			GENMASK(15, 8)
426 #define MAC_VERSION_SNPSVER			GENMASK(7, 0)
427 
428 /* 17.1.52 */
429 
430 #define MAC_DEBUG				0x0114
431 
432 /* 17.1.53 */
433 
434 #define MAC_HW_FEATURE0				0x011c
435 
436 #define MAC_HW_FEATURE0_ACTPHYSEL		GENMASK(30, 28)
437 #define MAC_HW_FEATURE0_SAVLANINS		BIT(27)
438 #define MAC_HW_FEATURE0_TSSTSSEL		GENMASK(26, 25)
439 #define MAC_HW_FEATURE0_MACADR64SEL		BIT(24)
440 #define MAC_HW_FEATURE0_MACADR32SEL		BIT(23)
441 #define MAC_HW_FEATURE0_ADDMACADRSEL		GENMASK(22, 18)
442 #define MAC_HW_FEATURE0_RXCOESEL		BIT(16)
443 #define MAC_HW_FEATURE0_TXCOESEL		BIT(14)
444 #define MAC_HW_FEATURE0_EEESEL			BIT(13)
445 #define MAC_HW_FEATURE0_TSSEL			BIT(12)
446 #define MAC_HW_FEATURE0_ARPOFFSEL		BIT(9)
447 #define MAC_HW_FEATURE0_MMCSEL			BIT(8)
448 #define MAC_HW_FEATURE0_MGKSEL			BIT(7)
449 #define MAC_HW_FEATURE0_RWKSEL			BIT(6)
450 #define MAC_HW_FEATURE0_SMASEL			BIT(5)
451 #define MAC_HW_FEATURE0_VLHASH			BIT(4)
452 #define MAC_HW_FEATURE0_PCSSEL			BIT(3)
453 #define MAC_HW_FEATURE0_HDSEL			BIT(2)
454 #define MAC_HW_FEATURE0_GMIISEL			BIT(1)
455 #define MAC_HW_FEATURE0_MIISEL			BIT(0)
456 
457 /* 17.1.54 */
458 
459 #define MAC_HW_FEATURE1				0x0120
460 
461 #define MAC_HW_FEATURE1_L3L4FNUM		GENMASK(30, 27)
462 #define MAC_HW_FEATURE1_HASHTBLSZ		GENMASK(25, 24)
463 #define MAC_HW_FEATURE1_POUOST			BIT(23)
464 #define MAC_HW_FEATURE1_RAVSEL			BIT(21)
465 #define MAC_HW_FEATURE1_AVSEL			BIT(20)
466 #define MAC_HW_FEATURE1_DBGMEMA			BIT(19)
467 #define MAC_HW_FEATURE1_TSOEN			BIT(18)
468 #define MAC_HW_FEATURE1_SPHEN			BIT(17)
469 #define MAC_HW_FEATURE1_DCBEN			BIT(16)
470 #define MAC_HW_FEATURE1_ADDR64			GENMASK(15, 14)
471 #define MAC_HW_FEATURE1_ADVTHWORD		BIT(13)
472 #define MAC_HW_FEATURE1_PTOEN			BIT(12)
473 #define MAC_HW_FEATURE1_OSTEN			BIT(11)
474 #define MAC_HW_FEATURE1_TXFIFOSIZE		GENMASK(10, 6)
475 #define MAC_HW_FEATURE1_SPRAM			BIT(5)
476 #define MAC_HW_FEATURE1_RXFIFOSIZE		GENMASK(4, 0)
477 
478 /* 17.1.55 */
479 
480 #define MAC_HW_FEATURE2				0x0124
481 
482 #define MAC_HW_FEATURE2_AUXSNAPNUM		GENMASK(30, 28)
483 #define MAC_HW_FEATURE2_PPSOUTNUM		GENMASK(28, 24)
484 #define MAC_HW_FEATURE2_TXCHCNT			GENMASK(21, 18)
485 #define MAC_HW_FEATURE2_RXCHCNT			GENMASK(15, 12)
486 #define MAC_HW_FEATURE2_TXQCNT			GENMASK(9, 6)
487 #define MAC_HW_FEATURE2_RXQCNT			GENMASK(3, 0)
488 
489 /* 17.1.56 */
490 
491 #define MAC_HW_FEATURE3				0x0128
492 
493 #define MAC_HW_FEATURE3_ASP			GENMASK(29, 28)
494 #define MAC_HW_FEATURE3_TBSSEL			BIT(27)
495 #define MAC_HW_FEATURE3_FPESEL			BIT(26)
496 #define MAC_HW_FEATURE3_ESTWID			GENMASK(21, 20)
497 #define MAC_HW_FEATURE3_ESTDEP			GENMASK(19, 17)
498 #define MAC_HW_FEATURE3_ESTSEL			BIT(16)
499 #define MAC_HW_FEATURE3_FRPES			GENMASK(14, 13)
500 #define MAC_HW_FEATURE3_FRPBS			GENMASK(12, 11)
501 #define MAC_HW_FEATURE3_FRPSEL			BIT(10)
502 #define MAC_HW_FEATURE3_PDUPSEL			BIT(9)
503 #define MAC_HW_FEATURE3_DVLAN			BIT(5)
504 #define MAC_HW_FEATURE3_CBTISEL			BIT(4)
505 #define MAC_HW_FEATURE3_NRVF			GENMASK(2, 0)
506 
507 /* 17.1.57 */
508 
509 #define MAC_DPP_FSM_IRQ_STATUS			0x0140
510 
511 #define MAC_DPP_FSM_IRQ_STATUS_FSMPES		BIT(24)
512 #define MAC_DPP_FSM_IRQ_STATUS_SLVTES		BIT(17)
513 #define MAC_DPP_FSM_IRQ_STATUS_MSTTES		BIT(16)
514 #define MAC_DPP_FSM_IRQ_STATUS_RVCTES		BIT(15)
515 #define MAC_DPP_FSM_IRQ_STATUS_R125ES		BIT(14)
516 #define MAC_DPP_FSM_IRQ_STATUS_T125ES		BIT(13)
517 #define MAC_DPP_FSM_IRQ_STATUS_PTES		BIT(12)
518 #define MAC_DPP_FSM_IRQ_STATUS_ATES		BIT(11)
519 #define MAC_DPP_FSM_IRQ_STATUS_CTES		BIT(10)
520 #define MAC_DPP_FSM_IRQ_STATUS_RTES		BIT(9)
521 #define MAC_DPP_FSM_IRQ_STATUS_TTES		BIT(8)
522 #define MAC_DPP_FSM_IRQ_STATUS_ASRPES		BIT(7)
523 #define MAC_DPP_FSM_IRQ_STATUS_CWPES		BIT(6)
524 #define MAC_DPP_FSM_IRQ_STATUS_ARPES		BIT(5)
525 #define MAC_DPP_FSM_IRQ_STATUS_MTSPES		BIT(4)
526 #define MAC_DPP_FSM_IRQ_STATUS_MPES		BIT(3)
527 #define MAC_DPP_FSM_IRQ_STATUS_RDPES		BIT(2)
528 #define MAC_DPP_FSM_IRQ_STATUS_TPES		BIT(1)
529 #define MAC_DPP_FSM_IRQ_STATUS_ATPES		BIT(0)
530 
531 /* 17.1.58 */
532 
533 #define MAC_AXI_SLV_DPE_ADDR_STATUS		0x0144
534 
535 #define MAC_AXI_SLV_DPE_ADDR_STATUS_ASPEAS	GENMASK(13, 0)
536 
537 /* 17.1.59 */
538 
539 #define MAC_FSM_CTRL				0x0148
540 
541 #define MAC_FSM_CTRL_RVCLGRNML			BIT(31)
542 #define MAC_FSM_CTRL_R125LGRNML			BIT(30)
543 #define MAC_FSM_CTRL_T125LGRNML			BIT(29)
544 #define MAC_FSM_CTRL_PLGRNML			BIT(28)
545 #define MAC_FSM_CTRL_ALGRNML			BIT(27)
546 #define MAC_FSM_CTRL_CLGRNML			BIT(26)
547 #define MAC_FSM_CTRL_RLGRNML			BIT(25)
548 #define MAC_FSM_CTRL_TLGRNML			BIT(24)
549 #define MAC_FSM_CTRL_RVCPEIN			BIT(23)
550 #define MAC_FSM_CTRL_R125PEIN			BIT(22)
551 #define MAC_FSM_CTRL_T125PEIN			BIT(21)
552 #define MAC_FSM_CTRL_PPEIN			BIT(20)
553 #define MAC_FSM_CTRL_APEIN			BIT(19)
554 #define MAC_FSM_CTRL_CPEIN			BIT(18)
555 #define MAC_FSM_CTRL_RPEIN			BIT(17)
556 #define MAC_FSM_CTRL_TPEIN			BIT(16)
557 #define MAC_FSM_CTRL_RVCTEIN			BIT(15)
558 #define MAC_FSM_CTRL_R125TEIN			BIT(14)
559 #define MAC_FSM_CTRL_T125TEIN			BIT(13)
560 #define MAC_FSM_CTRL_PTEIN			BIT(12)
561 #define MAC_FSM_CTRL_ATEIN			BIT(11)
562 #define MAC_FSM_CTRL_CTEIN			BIT(10)
563 #define MAC_FSM_CTRL_RTEIN			BIT(9)
564 #define MAC_FSM_CTRL_TTEIN			BIT(8)
565 #define MAC_FSM_CTRL_PRTYEN			BIT(1)
566 #define MAC_FSM_CTRL_TMOUTEN			BIT(0)
567 
568 /* 17.1.60 */
569 
570 #define MAC_FSM_ACT_TIMER			0x014c
571 
572 #define MAC_FSM_ACT_TIMER_LTMRMD		GENMASK(23, 20)
573 #define MAC_FSM_ACT_TIMER_NTMRMD		GENMASK(19, 16)
574 #define MAC_FSM_ACT_TIMER_TMR			GENMASK(9, 0)
575 
576 /* 17.1.62 */
577 
578 #define MAC_MDIO_ADDRESS			0x0200
579 
580 #define MAC_MDIO_ADDRESS_PSE			BIT(27)
581 #define MAC_MDIO_ADDRESS_BTB			BIT(26)
582 #define MAC_MDIO_ADDRESS_PA			GENMASK(25, 21)
583 #define MAC_MDIO_ADDRESS_RDA			GENMASK(20, 16)
584 #define MAC_MDIO_ADDRESS_NTC			GENMASK(14, 12)
585 #define MAC_MDIO_ADDRESS_CR			BIT(11, 8)
586 #define MAC_MDIO_ADDRESS_SKAP			BIT(4)
587 #define MAC_MDIO_ADDRESS_GOC_1			BIT(3)
588 #define MAC_MDIO_ADDRESS_GOC_0			BIT(2)
589 #define MAC_MDIO_ADDRESS_GOC_C45E			BIT(1)
590 #define MAC_MDIO_ADDRESS_GOC_GB			BIT(0)
591 
592 /* 17.1.63 */
593 
594 #define MAC_MDIO_DATA				0x0204
595 
596 #define MAC_MDIO_DATA_RA			GENMASK(31, 16)
597 #define MAC_MDIO_DATA_GD			GENMASK(15, 0)
598 
599 /* 17.1.64 */
600 
601 #define MAC_GPIO_CTRL				0x0208
602 
603 /* 17.1.65 */
604 
605 #define MAC_GPIO_STATUS				0x020c
606 
607 /* 17.1.66 */
608 
609 #define MAC_ARP_ADDRESS				0x0210
610 
611 /* 17.1.67 */
612 
613 #define MAC_CSR_SW_CTRL				0x0230
614 
615 /* 17.1.68 */
616 
617 #define MAC_FPE_CTRL_STS			0x0234
618 
619 /* 17.1.69 */
620 
621 #define MAC_EXT_CFG1				0x0238
622 
623 #define MAC_EXT_CFG1_SPLM			GENMASK(9, 8)
624 #define MAC_EXT_CFG1_SPLOFST			GENMASK(6, 0)
625 
626 /* 17.1.70 */
627 
628 #define MAC_PRESN_TIME_NS			0x0240
629 
630 /* 17.1.71 */
631 
632 #define MAC_PRESN_TIME_UPDT			0x0244
633 
634 /* 17.1.72, 17.1.74 */
635 
636 #define MAC_ADDRESS_HIGH(n)			(0x0300 + 8 * (n))
637 
638 #define MAC_ADDRESS_HIGH_AE			BIT(31)
639 
640 /* 17.1.73, 17.1.75 */
641 
642 #define MAC_ADDRESS_LOW(n)			(0x0304 + 8 * (n))
643 
644 /*
645  * MTL Register Definitions
646  */
647 
648 /* 17.2.1 */
649 
650 #define MTL_OPERATION_MODE			0x0c00
651 
652 /* 17.2.2 */
653 
654 #define MTL_DBG_CTL				0x0c08
655 
656 /* 17.2.3 */
657 
658 #define MTL_DBG_STS				0x0c0c
659 
660 /* 17.2.4 */
661 
662 #define MTL_FIFO_DEBUG_DATA			0x0c10
663 
664 /* 17.2.5 */
665 
666 #define MTL_IRQ_STATUS				0x0c20
667 
668 #define MTL_IRQ_STATUS_MTLPIS			BIT(23)
669 #define MTL_IRQ_STATUS_ESTIS			BIT(18)
670 #define MTL_IRQ_STATUS_DBGIS			BIT(17)
671 #define MTL_IRQ_STATUS_MACIS			BIT(16)
672 #define MTL_IRQ_STATUS_Q7IS			BIT(7)
673 #define MTL_IRQ_STATUS_Q6IS			BIT(6)
674 #define MTL_IRQ_STATUS_Q5IS			BIT(5)
675 #define MTL_IRQ_STATUS_Q4IS			BIT(4)
676 #define MTL_IRQ_STATUS_Q3IS			BIT(3)
677 #define MTL_IRQ_STATUS_Q2IS			BIT(2)
678 #define MTL_IRQ_STATUS_Q1IS			BIT(1)
679 #define MTL_IRQ_STATUS_Q0IS			BIT(0)
680 
681 /* 17.2.6 */
682 
683 #define MTL_RXQ_DMA_MAP0			0x0c30
684 
685 /* 17.2.7 */
686 
687 #define MTL_RXQ_DMA_MAP1			0x0c34
688 
689 /* 17.2.8 */
690 
691 #define MTL_TBS_CTRL				0x0c40
692 
693 /* 17.2.9 */
694 
695 #define MTL_EST_CTRL				0x0c50
696 
697 /* 17.2.10 */
698 
699 #define MTL_EST_STATUS				0x0c58
700 
701 /* 17.2.11 */
702 
703 #define MTL_EST_SCH_ERROR			0x0c60
704 
705 /* 17.2.12 */
706 
707 #define MTL_EST_FRM_SIZE_ERROR			0x0c64
708 
709 /* 17.2.13 */
710 
711 #define MTL_EST_FRM_SIZE_CAPTURE		0x0c68
712 
713 /* 17.2.14 */
714 
715 #define MTL_EST_IRQ_ENABLE			0x0c70
716 
717 /* 17.2.15 */
718 
719 #define MTL_EST_GCL_CONTROL			0x0c80
720 
721 /* 17.2.16 */
722 
723 #define MTL_EST_GCL_DATA			0x0c84
724 
725 /* 17.2.17 */
726 
727 #define MTL_FPE_CTRL_STS			0x0c90
728 
729 /* 17.2.18 */
730 
731 #define MTL_FPE_ADVANCE				0x0c94
732 
733 /* 17.2.19 */
734 
735 #define MTL_RXP_CTRL_STATUS			0x0ca0
736 
737 /* 17.2.20 */
738 
739 #define MTL_RXP_IRQ_CTRL_STATUS			0x0ca4
740 
741 /* 17.2.21 */
742 
743 #define MTL_RXP_DROP_CNT			0x0ca8
744 
745 /* 17.2.22 */
746 
747 #define MTL_RXP_ERROR_CNT			0x0cac
748 
749 /* 17.2.23 */
750 
751 #define MTL_RXP_INDIRECT_ACC_CTRL_STATUS	0x0cb0
752 
753 /* 17.2.24 */
754 
755 #define MTL_RXP_INDIRECT_ACC_DATA		0x0cb4
756 
757 /* 17.2.25 */
758 
759 #define MTL_ECC_CTRL				0x0cc0
760 
761 /* 17.2.26 */
762 
763 #define MTL_SAFETY_IRQ_STATUS			0x0cc4
764 
765 /* 17.2.27 */
766 
767 #define MTL_ECC_IRQ_ENABLE			0x0cc8
768 
769 /* 17.2.28 */
770 
771 #define MTL_ECC_IRQ_STATUS			0x0ccc
772 
773 /* 17.2.29 */
774 
775 #define MTL_ECC_ERR_STS_RCTL			0x0cd0
776 
777 /* 17.2.30 */
778 
779 #define MTL_ECC_ERR_ADDR_STATUS			0x0cd4
780 
781 /* 17.2.31 */
782 
783 #define MTL_ECC_ERR_CNTR_STATUS			0x0cd8
784 
785 /* 17.2.32 */
786 
787 #define MTL_DPP_CTRL				0x0ce0
788 
789 /* 17.3.1, 17.4.1 */
790 
791 #define MTL_TXQn_OPERATION_MODE(n)		(0x0d00 + 0x40 * (n))
792 
793 /* 17.3.2, 17.4.2 */
794 
795 #define MTL_TXQn_UNDERFLOW(n)			(0x0d04 + 0x40 * (n))
796 
797 /* 17.3.3, 17.4.3 */
798 
799 #define MTL_TXQn_DEBUG(n)			(0x0d08 + 0x40 * (n))
800 
801 /* 17.4.4 */
802 
803 #define MTL_TXQn_ETS_CTRL(n)			(0x0d10 + 0x40 * (n))
804 
805 /* 17.3.4, 17.4.5 */
806 
807 #define MTL_TXQn_ETS_STATUS(n)			(0x0d14 + 0x40 * (n))
808 
809 /* 17.3.5, 17.4.6 */
810 
811 #define MTL_TXQn_QUANTUM_WEIGHT(n)		(0x0d18 + 0x40 * (n))
812 
813 /* 17.4.7 */
814 
815 #define MTL_TXQn_SENDSLOPECREDIT(n)		(0x0d1c + 0x40 * (n))
816 
817 /* 17.4.8 */
818 
819 #define MTL_TXQn_HICREDIT(n)			(0x0d20 + 0x40 * (n))
820 
821 /* 17.4.9 */
822 
823 #define MTL_TXQn_LOCREDIT(n)			(0x0d24 + 0x40 * (n))
824 
825 /* 17.3.6, 17.4.10 */
826 
827 #define MTL_Qn_IRQ_CTRL_STATUS(n)		(0x0d2c + 0x40 * (n))
828 
829 /* 17.3.7, 17.4.11 */
830 
831 #define MTL_RXQn_OPERATION_MODE(n)		(0x0d30 + 0x40 * (n))
832 
833 /* 17.3.8, 17.4.12 */
834 
835 #define MTL_RXQn_MISSED_PKT_OVFL_CNT(n)		(0x0d34 + 0x40 * (n))
836 
837 /* 17.3.9, 17.4.13 */
838 
839 #define MTL_RXQn_DEBUG(n)			(0x0d38 + 0x40 * (n))
840 
841 /* 17.3.10, 17.4.14 */
842 
843 #define MTL_RXQn_CTRL(n)			(0x0d3c + 0x40 * (n))
844 
845 /*
846  * DMA Register Definitions
847  */
848 
849 /* 17.5.1 */
850 
851 #define DMA_MODE				0x1000
852 
853 #define DMA_MODE_INTM				GENMASK(17, 16)
854 #define DMA_MODE_PR				GENMASK(14, 12)
855 #define DMA_MODE_TXPR				BIT(12)
856 #define DMA_MODE_ARBC				BIT(9)
857 #define DMA_MODE_DSPW				BIT(8)
858 #define DMA_MODE_TAA				GENMASK(4, 2)
859 #define DMA_MODE_DA				BIT(1)
860 #define DMA_MODE_SWR				BIT(0)
861 
862 /* 17.5.2 */
863 
864 #define DMA_SYSBUS_MODE				0x1004
865 
866 #define DMA_SYSBUS_MODE_EN_LPI			BIT(31)
867 #define DMA_SYSBUS_MODE_LPI_XIT_PKT		BIT(30)
868 #define DMA_SYSBUS_MODE_WR_OSR_LMT		GENMASK(27, 24)
869 #define DMA_SYSBUS_MODE_RD_OSR_LMT		GENMASK(19, 16)
870 #define DMA_SYSBUS_MODE_RB			BIT(15)
871 #define DMA_SYSBUS_MODE_MB			BIT(14)
872 #define DMA_SYSBUS_MODE_ONEKBBE			BIT(13)
873 #define DMA_SYSBUS_MODE_AAL			BIT(12)
874 #define DMA_SYSBUS_MODE_EAME			BIT(11)
875 #define DMA_SYSBUS_MODE_AALE			BIT(10)
876 #define DMA_SYSBUS_MODE_BLEN256			BIT(7)
877 #define DMA_SYSBUS_MODE_BLEN128			BIT(6)
878 #define DMA_SYSBUS_MODE_BLEN64			BIT(5)
879 #define DMA_SYSBUS_MODE_BLEN32			BIT(4)
880 #define DMA_SYSBUS_MODE_BLEN16			BIT(3)
881 #define DMA_SYSBUS_MODE_BLEN8			BIT(2)
882 #define DMA_SYSBUS_MODE_BLEN4			BIT(1)
883 #define DMA_SYSBUS_MODE_FB			BIT(0)
884 
885 /* 17.5.3 */
886 
887 #define DMA_IRQ_STATUS				0x1008
888 
889 #define DMA_IRQ_STATUS_MACIS			BIT(17)
890 #define DMA_IRQ_STATUS_MTLIS			BIT(16)
891 #define DMA_IRQ_STATUS_DC7IS			BIT(7)
892 #define DMA_IRQ_STATUS_DC6IS			BIT(6)
893 #define DMA_IRQ_STATUS_DC5IS			BIT(5)
894 #define DMA_IRQ_STATUS_DC4IS			BIT(4)
895 #define DMA_IRQ_STATUS_DC3IS			BIT(3)
896 #define DMA_IRQ_STATUS_DC2IS			BIT(2)
897 #define DMA_IRQ_STATUS_DC1IS			BIT(1)
898 #define DMA_IRQ_STATUS_DC0IS			BIT(0)
899 
900 /* 17.5.4 */
901 
902 #define DMA_DEBUG_STATUS0			0x100c
903 
904 /* 17.5.5 */
905 
906 #define DMA_DEBUG_STATUS1			0x1010
907 
908 /* 17.5.6 */
909 
910 #define DMA_DEBUG_STATUS2			0x1014
911 
912 /* 17.5.7 */
913 
914 #define AXI4_TX_AR_ACE_CTRL			0x1020
915 
916 /* 17.5.8 */
917 
918 #define AXI4_RX_AW_ACE_CTRL			0x1024
919 
920 /* 17.5.9 */
921 
922 #define AXI4_TXRX_AWAR_ACE_CTRL			0x1028
923 
924 /* 17.5.10 */
925 
926 #define AXI_LPI_ENTRY_INTERVAL			0x1040
927 
928 /* 17.5.11 */
929 
930 #define DMA_TBS_CTRL				0x1050
931 
932 /* 17.5.12 */
933 
934 #define DMA_SAFETY_IRQ_STATUS			0x1080
935 
936 /* 17.5.13 */
937 
938 #define DMA_ECC_IRQ_ENABLE			0x1084
939 
940 /* 17.5.14 */
941 
942 #define DMA_ECC_IRQ_STATUS			0x1088
943 
944 /* 17.6.1 */
945 
946 #define DMA_CHn_CTRL(n)				(0x1100 + 0x80 * (n))
947 
948 #define DMA_CHn_CTRL_SPH			BIT(24)
949 #define DMA_CHn_CTRL_DSL			GENMASK(20, 18)
950 #define DMA_CHn_CTRL_PBLx8			BIT(16)
951 #define DMA_CHn_CTRL_MSS			GENMASK(13, 0)
952 
953 /* 17.6.2 */
954 
955 #define DMA_CHn_TX_CTRL(n)			(0x1104 + 0x80 * (n))
956 
957 #define DMA_CHn_TX_CTRL_EDSE			BIT(28)
958 #define DMA_CHn_TX_CTRL_TQOS			GENMASK(27, 24)
959 #define DMA_CHn_TX_CTRL_ETIC			BIT(22)
960 #define DMA_CHn_TX_CTRL_PBL			GENMASK(21, 16)
961 #define DMA_CHn_TX_CTRL_IPBL			BIT(15)
962 #define DMA_CHn_TX_CTRL_TSE_MODE		GENMASK(14, 13)
963 #define DMA_CHn_TX_CTRL_TSE			BIT(12)
964 #define DMA_CHn_TX_CTRL_OSF			BIT(4)
965 #define DMA_CHn_TX_CTRL_TCW			GENMASK(3, 1)
966 #define DMA_CHn_TX_CTRL_St			BIT(0)
967 
968 /* 17.6.3 */
969 
970 #define DMA_CHn_RX_CTRL(n)			(0x1108 + 0x80 * (n))
971 
972 #define DMA_CHn_RX_CTRL_RPF			BIT(31)
973 #define DMA_CHn_RX_CTRL_RQOS			GENMASK(27, 24)
974 #define DMA_CHn_RX_CTRL_ERIC			BIT(22)
975 #define DMA_CHn_RX_CTRL_PBL			GENMASK(21, 16)
976 #define DMA_CHn_RX_CTRL_RBSZ			GENMASK(14, 1)
977 #define DMA_CHn_RX_CTRL_SR			BIT(0)
978 
979 /* 17.6.4 */
980 
981 #define DMA_CHn_TXDESC_LIST_HADDR(n)		(0x1110 + 0x80 * (n))
982 
983 /* 17.6.5 */
984 
985 #define DMA_CHn_TXDESC_LIST_ADDR(n)		(0x1114 + 0x80 * (n))
986 
987 /* 17.6.6 */
988 
989 #define DMA_CHn_RXDESC_LIST_HADDR(n)		(0x1118 + 0x80 * (n))
990 
991 /* 17.6.7 */
992 
993 #define DMA_CHn_RXDESC_LIST_ADDR(n)		(0x111c + 0x80 * (n))
994 
995 /* 17.6.8 */
996 
997 #define DMA_CHn_TXDESC_TAIL_PTR(n)		(0x1120 + 0x80 * (n))
998 
999 /* 17.6.9 */
1000 
1001 #define DMA_CHn_RXDESC_TAIL_PTR(n)		(0x1128 + 0x80 * (n))
1002 
1003 /* 17.6.10 */
1004 
1005 #define DMA_CHn_TXDESC_RING_LENGTH(n)		(0x112c + 0x80 * (n))
1006 
1007 /* 17.6.11 */
1008 
1009 #define DMA_CHn_RXDESC_RING_LENGTH(n)		(0x1130 + 0x80 * (n))
1010 
1011 /* 17.6.12 */
1012 
1013 #define DMA_CHn_IRQ_ENABLE(n)			(0x1134 + 0x80 * (n))
1014 
1015 #define DMA_CHn_IRQ_ENABLE_NIE			BIT(15)
1016 #define DMA_CHn_IRQ_ENABLE_AIE			BIT(14)
1017 #define DMA_CHn_IRQ_ENABLE_CDEE			BIT(13)
1018 #define DMA_CHn_IRQ_ENABLE_FBEE			BIT(12)
1019 #define DMA_CHn_IRQ_ENABLE_ERIE			BIT(11)
1020 #define DMA_CHn_IRQ_ENABLE_ETIE			BIT(10)
1021 #define DMA_CHn_IRQ_ENABLE_RWTE			BIT(9)
1022 #define DMA_CHn_IRQ_ENABLE_RSE			BIT(8)
1023 #define DMA_CHn_IRQ_ENABLE_RBUE			BIT(7)
1024 #define DMA_CHn_IRQ_ENABLE_RIE			BIT(6)
1025 #define DMA_CHn_IRQ_ENABLE_TBUE			BIT(2)
1026 #define DMA_CHn_IRQ_ENABLE_TXSE			BIT(1)
1027 #define DMA_CHn_IRQ_ENABLE_TIE			BIT(0)
1028 
1029 /* 17.6.13 */
1030 
1031 #define DMA_CHn_RX_IRQ_WATCHDOG_TIMER(n)	(0x1138 + 0x80 * (n))
1032 
1033 /* 17.6.14 */
1034 
1035 #define DMA_CHn_SLOT_FN_CTRL_STATUS(n)		(0x113c + 0x80 * (n))
1036 
1037 /* 17.6.15 */
1038 
1039 #define DMA_CHn_CURR_APP_TXDESC(n)		(0x1144 + 0x80 * (n))
1040 
1041 /* 17.6.16 */
1042 
1043 #define DMA_CHn_CURR_APP_RXDESC(n)		(0x114c + 0x80 * (n))
1044 
1045 /* 17.6.17 */
1046 
1047 #define DMA_CHn_CURR_APP_TX_BUF_H(n)		(0x1150 + 0x80 * (n))
1048 
1049 /* 17.6.18 */
1050 
1051 #define DMA_CHn_CURR_APP_TX_BUF(n)		(0x1154 + 0x80 * (n))
1052 
1053 /* 17.6.19 */
1054 
1055 #define DMA_CHn_CURR_APP_RX_BUF_H(n)		(0x1158 + 0x80 * (n))
1056 
1057 /* 17.6.20 */
1058 
1059 #define DMA_CHn_CURR_APP_RX_BUF(n)		(0x115c + 0x80 * (n))
1060 
1061 /* 17.6.21 */
1062 
1063 #define DMA_CHn_STATUS(n)			(0x1160 + 0x80 * (n))
1064 
1065 #define DMA_CHn_STATUS_REB			GENMASK(21, 19)
1066 #define DMA_CHn_STATUS_TEB			GENMASK(18, 16)
1067 #define DMA_CHn_STATUS_NIS			BIT(15)
1068 #define DMA_CHn_STATUS_AIS			BIT(14)
1069 #define DMA_CHn_STATUS_CDE			BIT(13)
1070 #define DMA_CHn_STATUS_FBE			BIT(12)
1071 #define DMA_CHn_STATUS_ERI			BIT(11)
1072 #define DMA_CHn_STATUS_ETI			BIT(10)
1073 #define DMA_CHn_STATUS_RWT			BIT(9)
1074 #define DMA_CHn_STATUS_RPS			BIT(8)
1075 #define DMA_CHn_STATUS_RBU			BIT(7)
1076 #define DMA_CHn_STATUS_RI			BIT(6)
1077 #define DMA_CHn_STATUS_TBU			BIT(2)
1078 #define DMA_CHn_STATUS_TPS			BIT(1)
1079 #define DMA_CHn_STATUS_TI			BIT(0)
1080 
1081 /* 17.6.22 */
1082 
1083 #define DMA_CHn_MISS_FRAME_CNT(n)		(0x1164 + 0x80 * (n))
1084 
1085 /* 17.6.23 */
1086 
1087 #define DMA_CHn_RXP_ACCEPT_CNT(n)		(0x1168 + 0x80 * (n))
1088 
1089 /* 17.6.24 */
1090 
1091 #define DMA_CHn_RX_ERI_CNT(n)			(0x116c + 0x80 * (n))
1092 
1093 /*
1094  * DMA Descriptor Flag Definitions
1095  */
1096 
1097 /* 19.5.1.3 */
1098 
1099 #define TDES2_IOC				BIT(31)
1100 #define TDES2_TTSE				BIT(30)
1101 #define TDES2_TMWD				BIT(30)
1102 #define TDES2_B2L				GENMASK(29, 16)
1103 #define TDES2_VTIR				GENMASK(15, 14)
1104 #define TDES2_HL				GENMASK(13, 0)
1105 #define TDES2_B1L				GENMASK(13, 0)
1106 
1107 /* 19.5.1.4 */
1108 
1109 #define TDES3_OWN				BIT(31)
1110 #define TDES3_CTXT				BIT(30)
1111 #define TDES3_FD				BIT(29)
1112 #define TDES3_LD				BIT(28)
1113 #define TDES3_CPC				GENMASK(27, 26)
1114 #define TDES3_SAIC				GENMASK(25, 23)
1115 #define TDES3_SLOTNUM				GENMASK(22, 19)
1116 #define TDES3_THL				GENMASK(22, 19)
1117 #define TDES3_TSE				BIT(18)
1118 #define TDES3_CIC				GENMASK(17, 16)
1119 #define TDES3_TPL				GENMASK(17, 0)
1120 #define TDES3_FL				GENMASK(14, 0)
1121 
1122 /* 19.5.1.9 */
1123 
1124      /* TDES3_OWN				BIT(31) */
1125 #define TDES3_CTXT				BIT(30)
1126      /* TDES3_FD				BIT(29) */
1127      /* TDES3_LD				BIT(28) */
1128 #define TDES3_DE				BIT(23)
1129 #define TDES3_TTSS				BIT(17)
1130 #define TDES3_EUE				BIT(16)
1131 #define TDES3_ES				BIT(15)
1132 #define TDES3_JT				BIT(14)
1133 #define TDES3_FF				BIT(13)
1134 #define TDES3_PCE				BIT(12)
1135 #define TDES3_LoC				BIT(11)
1136 #define TDES3_NC				BIT(10)
1137 #define TDES3_LC				BIT(9)
1138 #define TDES3_EC				BIT(8)
1139 #define TDES3_CC				GENMASK(7, 4)
1140 #define TDES3_ED				BIT(3)
1141 #define TDES3_UF				BIT(2)
1142 #define TDES3_DB				BIT(1)
1143 #define TDES3_IHE				BIT(0)
1144 
1145 /* 19.6.1.4 */
1146 
1147 #define RDES3_OWN				BIT(31)
1148 #define RDES3_IOC				BIT(30)
1149 #define RDES3_BUF2V				BIT(25)
1150 #define RDES3_BUF1V				BIT(24)
1151 
1152 /* 19.6.2.1 */
1153 
1154 #define RDES0_IVT				GENMASK(31, 16)
1155 #define RDES0_OVT				GENMASK(15, 0)
1156 
1157 /* 19.6.2.2 */
1158 
1159 #define RDES1_OPC				GENMASK(31, 16)
1160 #define RDES1_TD				BIT(15)
1161 #define RDES1_TSA				BIT(14)
1162 #define RDES1_PV				BIT(13)
1163 #define RDES1_PFT				BIT(12)
1164 #define RDES1_PMT				GENMASK(11, 8)
1165 #define RDES1_ipce				BIT(7)
1166 #define RDES1_IPCB				BIT(6)
1167 #define RDES1_IPV6				BIT(5)
1168 #define RDES1_IPV4				BIT(4)
1169 #define RDES1_IPHE				BIT(3)
1170 #define RDES1_PT				GENMASK(2, 0)
1171 
1172 /* 19.6.2.3 */
1173 
1174 #define RDES2_L3L4FM				GENMASK(31, 29)
1175 #define RDES2_L4FM				BIT(28)
1176 #define RDES2_L3FM				BIT(27)
1177 #define RDES2_MADRM				GENMASK(26, 19)
1178 #define RDES2_HF				BIT(18)
1179 #define RDES2_DAF				BIT(17)
1180 #define RDES2_RXPI				BIT(17)
1181 #define RDES2_SAF				BIT(16)
1182 #define RDES2_RXPD				BIT(16)
1183 #define RDES2_OTS				BIT(15)
1184 #define RDES2_ITS				BIT(14)
1185 #define RDES2_ARPNR				BIT(10)
1186 #define RDES2_HL				GENMASK(9, 0)
1187 
1188 /* 19.6.2.4 */
1189 
1190      /* RDES3_OWN				BIT(31) */
1191 #define RDES3_CTXT				BIT(30)
1192 #define RDES3_FD				BIT(29)
1193 #define RDES3_LD				BIT(28)
1194 #define RDES3_RS2V				BIT(27)
1195 #define RDES3_RS1V				BIT(26)
1196 #define RDES3_RS0V				BIT(25)
1197 #define RDES3_CE				BIT(24)
1198 #define RDES3_GP				BIT(23)
1199 #define RDES3_RWT				BIT(22)
1200 #define RDES3_OE				BIT(21)
1201 #define RDES3_RE				BIT(20)
1202 #define RDES3_DE				BIT(19)
1203 #define RDES3_LT				GENMASK(18, 16)
1204 #define RDES3_ES				BIT(15)
1205 #define RDES3_PL				GENMASK(14, 0)
1206 
1207 
1208 #endif /* ZEPHYR_DRIVERS_ETHERNET_ETH_DWMAC_PRIV_H_ */
1209