18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Faraday FTGMAC100 Gigabit Ethernet
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * (C) Copyright 2009-2011 Faraday Technology
68c2ecf20Sopenharmony_ci * Po-Yu Chuang <ratbert@faraday-tech.com>
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifndef __FTGMAC100_H
108c2ecf20Sopenharmony_ci#define __FTGMAC100_H
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_ISR		0x00
138c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_IER		0x04
148c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_MAC_MADR	0x08
158c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_MAC_LADR	0x0c
168c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_MAHT0		0x10
178c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_MAHT1		0x14
188c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_NPTXPD		0x18
198c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_RXPD		0x1c
208c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_NPTXR_BADR	0x20
218c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_RXR_BADR	0x24
228c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_HPTXPD		0x28
238c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_HPTXR_BADR	0x2c
248c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_ITC		0x30
258c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_APTC		0x34
268c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_DBLAC		0x38
278c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_DMAFIFOS	0x3c
288c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_REVR		0x40
298c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_FEAR		0x44
308c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_TPAFCR		0x48
318c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_RBSR		0x4c
328c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_MACCR		0x50
338c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_MACSR		0x54
348c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_TM		0x58
358c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_PHYCR		0x60
368c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_PHYDATA	0x64
378c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_FCR		0x68
388c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_BPR		0x6c
398c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_WOLCR		0x70
408c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_WOLSR		0x74
418c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_WFCRC		0x78
428c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_WFBM1		0x80
438c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_WFBM2		0x84
448c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_WFBM3		0x88
458c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_WFBM4		0x8c
468c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_NPTXR_PTR	0x90
478c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_HPTXR_PTR	0x94
488c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_RXR_PTR	0x98
498c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_TX		0xa0
508c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_TX_MCOL_SCOL	0xa4
518c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_TX_ECOL_FAIL	0xa8
528c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_TX_LCOL_UND	0xac
538c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_RX		0xb0
548c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_RX_BC		0xb4
558c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_RX_MC		0xb8
568c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_RX_PF_AEP	0xbc
578c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_RX_RUNT	0xc0
588c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_RX_CRCER_FTL	0xc4
598c2ecf20Sopenharmony_ci#define FTGMAC100_OFFSET_RX_COL_LOST	0xc8
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci/*
628c2ecf20Sopenharmony_ci * Interrupt status register & interrupt enable register
638c2ecf20Sopenharmony_ci */
648c2ecf20Sopenharmony_ci#define FTGMAC100_INT_RPKT_BUF		(1 << 0)
658c2ecf20Sopenharmony_ci#define FTGMAC100_INT_RPKT_FIFO		(1 << 1)
668c2ecf20Sopenharmony_ci#define FTGMAC100_INT_NO_RXBUF		(1 << 2)
678c2ecf20Sopenharmony_ci#define FTGMAC100_INT_RPKT_LOST		(1 << 3)
688c2ecf20Sopenharmony_ci#define FTGMAC100_INT_XPKT_ETH		(1 << 4)
698c2ecf20Sopenharmony_ci#define FTGMAC100_INT_XPKT_FIFO		(1 << 5)
708c2ecf20Sopenharmony_ci#define FTGMAC100_INT_NO_NPTXBUF	(1 << 6)
718c2ecf20Sopenharmony_ci#define FTGMAC100_INT_XPKT_LOST		(1 << 7)
728c2ecf20Sopenharmony_ci#define FTGMAC100_INT_AHB_ERR		(1 << 8)
738c2ecf20Sopenharmony_ci#define FTGMAC100_INT_PHYSTS_CHG	(1 << 9)
748c2ecf20Sopenharmony_ci#define FTGMAC100_INT_NO_HPTXBUF	(1 << 10)
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci/* Interrupts we care about in NAPI mode */
778c2ecf20Sopenharmony_ci#define FTGMAC100_INT_BAD  (FTGMAC100_INT_RPKT_LOST | \
788c2ecf20Sopenharmony_ci			    FTGMAC100_INT_XPKT_LOST | \
798c2ecf20Sopenharmony_ci			    FTGMAC100_INT_AHB_ERR   | \
808c2ecf20Sopenharmony_ci			    FTGMAC100_INT_NO_RXBUF)
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci/* Normal RX/TX interrupts, enabled when NAPI off */
838c2ecf20Sopenharmony_ci#define FTGMAC100_INT_RXTX (FTGMAC100_INT_XPKT_ETH  | \
848c2ecf20Sopenharmony_ci			    FTGMAC100_INT_RPKT_BUF)
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci/* All the interrupts we care about */
878c2ecf20Sopenharmony_ci#define FTGMAC100_INT_ALL (FTGMAC100_INT_RPKT_BUF  |  \
888c2ecf20Sopenharmony_ci			   FTGMAC100_INT_BAD)
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci/*
918c2ecf20Sopenharmony_ci * Interrupt timer control register
928c2ecf20Sopenharmony_ci */
938c2ecf20Sopenharmony_ci#define FTGMAC100_ITC_RXINT_CNT(x)	(((x) & 0xf) << 0)
948c2ecf20Sopenharmony_ci#define FTGMAC100_ITC_RXINT_THR(x)	(((x) & 0x7) << 4)
958c2ecf20Sopenharmony_ci#define FTGMAC100_ITC_RXINT_TIME_SEL	(1 << 7)
968c2ecf20Sopenharmony_ci#define FTGMAC100_ITC_TXINT_CNT(x)	(((x) & 0xf) << 8)
978c2ecf20Sopenharmony_ci#define FTGMAC100_ITC_TXINT_THR(x)	(((x) & 0x7) << 12)
988c2ecf20Sopenharmony_ci#define FTGMAC100_ITC_TXINT_TIME_SEL	(1 << 15)
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci/*
1018c2ecf20Sopenharmony_ci * Automatic polling timer control register
1028c2ecf20Sopenharmony_ci */
1038c2ecf20Sopenharmony_ci#define FTGMAC100_APTC_RXPOLL_CNT(x)	(((x) & 0xf) << 0)
1048c2ecf20Sopenharmony_ci#define FTGMAC100_APTC_RXPOLL_TIME_SEL	(1 << 4)
1058c2ecf20Sopenharmony_ci#define FTGMAC100_APTC_TXPOLL_CNT(x)	(((x) & 0xf) << 8)
1068c2ecf20Sopenharmony_ci#define FTGMAC100_APTC_TXPOLL_TIME_SEL	(1 << 12)
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci/*
1098c2ecf20Sopenharmony_ci * DMA burst length and arbitration control register
1108c2ecf20Sopenharmony_ci */
1118c2ecf20Sopenharmony_ci#define FTGMAC100_DBLAC_RXFIFO_LTHR(x)	(((x) & 0x7) << 0)
1128c2ecf20Sopenharmony_ci#define FTGMAC100_DBLAC_RXFIFO_HTHR(x)	(((x) & 0x7) << 3)
1138c2ecf20Sopenharmony_ci#define FTGMAC100_DBLAC_RX_THR_EN	(1 << 6)
1148c2ecf20Sopenharmony_ci#define FTGMAC100_DBLAC_RXBURST_SIZE(x)	(((x) & 0x3) << 8)
1158c2ecf20Sopenharmony_ci#define FTGMAC100_DBLAC_TXBURST_SIZE(x)	(((x) & 0x3) << 10)
1168c2ecf20Sopenharmony_ci#define FTGMAC100_DBLAC_RXDES_SIZE(x)	(((x) & 0xf) << 12)
1178c2ecf20Sopenharmony_ci#define FTGMAC100_DBLAC_TXDES_SIZE(x)	(((x) & 0xf) << 16)
1188c2ecf20Sopenharmony_ci#define FTGMAC100_DBLAC_IFG_CNT(x)	(((x) & 0x7) << 20)
1198c2ecf20Sopenharmony_ci#define FTGMAC100_DBLAC_IFG_INC		(1 << 23)
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci/*
1228c2ecf20Sopenharmony_ci * DMA FIFO status register
1238c2ecf20Sopenharmony_ci */
1248c2ecf20Sopenharmony_ci#define FTGMAC100_DMAFIFOS_RXDMA1_SM(dmafifos)	((dmafifos) & 0xf)
1258c2ecf20Sopenharmony_ci#define FTGMAC100_DMAFIFOS_RXDMA2_SM(dmafifos)	(((dmafifos) >> 4) & 0xf)
1268c2ecf20Sopenharmony_ci#define FTGMAC100_DMAFIFOS_RXDMA3_SM(dmafifos)	(((dmafifos) >> 8) & 0x7)
1278c2ecf20Sopenharmony_ci#define FTGMAC100_DMAFIFOS_TXDMA1_SM(dmafifos)	(((dmafifos) >> 12) & 0xf)
1288c2ecf20Sopenharmony_ci#define FTGMAC100_DMAFIFOS_TXDMA2_SM(dmafifos)	(((dmafifos) >> 16) & 0x3)
1298c2ecf20Sopenharmony_ci#define FTGMAC100_DMAFIFOS_TXDMA3_SM(dmafifos)	(((dmafifos) >> 18) & 0xf)
1308c2ecf20Sopenharmony_ci#define FTGMAC100_DMAFIFOS_RXFIFO_EMPTY		(1 << 26)
1318c2ecf20Sopenharmony_ci#define FTGMAC100_DMAFIFOS_TXFIFO_EMPTY		(1 << 27)
1328c2ecf20Sopenharmony_ci#define FTGMAC100_DMAFIFOS_RXDMA_GRANT		(1 << 28)
1338c2ecf20Sopenharmony_ci#define FTGMAC100_DMAFIFOS_TXDMA_GRANT		(1 << 29)
1348c2ecf20Sopenharmony_ci#define FTGMAC100_DMAFIFOS_RXDMA_REQ		(1 << 30)
1358c2ecf20Sopenharmony_ci#define FTGMAC100_DMAFIFOS_TXDMA_REQ		(1 << 31)
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci/*
1388c2ecf20Sopenharmony_ci * Feature Register
1398c2ecf20Sopenharmony_ci */
1408c2ecf20Sopenharmony_ci#define FTGMAC100_REVR_NEW_MDIO_INTERFACE	BIT(31)
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci/*
1438c2ecf20Sopenharmony_ci * Receive buffer size register
1448c2ecf20Sopenharmony_ci */
1458c2ecf20Sopenharmony_ci#define FTGMAC100_RBSR_SIZE(x)		((x) & 0x3fff)
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci/*
1488c2ecf20Sopenharmony_ci * MAC control register
1498c2ecf20Sopenharmony_ci */
1508c2ecf20Sopenharmony_ci#define FTGMAC100_MACCR_TXDMA_EN	(1 << 0)
1518c2ecf20Sopenharmony_ci#define FTGMAC100_MACCR_RXDMA_EN	(1 << 1)
1528c2ecf20Sopenharmony_ci#define FTGMAC100_MACCR_TXMAC_EN	(1 << 2)
1538c2ecf20Sopenharmony_ci#define FTGMAC100_MACCR_RXMAC_EN	(1 << 3)
1548c2ecf20Sopenharmony_ci#define FTGMAC100_MACCR_RM_VLAN		(1 << 4)
1558c2ecf20Sopenharmony_ci#define FTGMAC100_MACCR_HPTXR_EN	(1 << 5)
1568c2ecf20Sopenharmony_ci#define FTGMAC100_MACCR_LOOP_EN		(1 << 6)
1578c2ecf20Sopenharmony_ci#define FTGMAC100_MACCR_ENRX_IN_HALFTX	(1 << 7)
1588c2ecf20Sopenharmony_ci#define FTGMAC100_MACCR_FULLDUP		(1 << 8)
1598c2ecf20Sopenharmony_ci#define FTGMAC100_MACCR_GIGA_MODE	(1 << 9)
1608c2ecf20Sopenharmony_ci#define FTGMAC100_MACCR_CRC_APD		(1 << 10)
1618c2ecf20Sopenharmony_ci#define FTGMAC100_MACCR_PHY_LINK_LEVEL	(1 << 11)
1628c2ecf20Sopenharmony_ci#define FTGMAC100_MACCR_RX_RUNT		(1 << 12)
1638c2ecf20Sopenharmony_ci#define FTGMAC100_MACCR_JUMBO_LF	(1 << 13)
1648c2ecf20Sopenharmony_ci#define FTGMAC100_MACCR_RX_ALL		(1 << 14)
1658c2ecf20Sopenharmony_ci#define FTGMAC100_MACCR_HT_MULTI_EN	(1 << 15)
1668c2ecf20Sopenharmony_ci#define FTGMAC100_MACCR_RX_MULTIPKT	(1 << 16)
1678c2ecf20Sopenharmony_ci#define FTGMAC100_MACCR_RX_BROADPKT	(1 << 17)
1688c2ecf20Sopenharmony_ci#define FTGMAC100_MACCR_DISCARD_CRCERR	(1 << 18)
1698c2ecf20Sopenharmony_ci#define FTGMAC100_MACCR_FAST_MODE	(1 << 19)
1708c2ecf20Sopenharmony_ci#define FTGMAC100_MACCR_SW_RST		(1 << 31)
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci/*
1738c2ecf20Sopenharmony_ci * test mode control register
1748c2ecf20Sopenharmony_ci */
1758c2ecf20Sopenharmony_ci#define FTGMAC100_TM_RQ_TX_VALID_DIS (1 << 28)
1768c2ecf20Sopenharmony_ci#define FTGMAC100_TM_RQ_RR_IDLE_PREV (1 << 27)
1778c2ecf20Sopenharmony_ci#define FTGMAC100_TM_DEFAULT                                                   \
1788c2ecf20Sopenharmony_ci	(FTGMAC100_TM_RQ_TX_VALID_DIS | FTGMAC100_TM_RQ_RR_IDLE_PREV)
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_ci/*
1818c2ecf20Sopenharmony_ci * PHY control register
1828c2ecf20Sopenharmony_ci */
1838c2ecf20Sopenharmony_ci#define FTGMAC100_PHYCR_MDC_CYCTHR_MASK	0x3f
1848c2ecf20Sopenharmony_ci#define FTGMAC100_PHYCR_MDC_CYCTHR(x)	((x) & 0x3f)
1858c2ecf20Sopenharmony_ci#define FTGMAC100_PHYCR_PHYAD(x)	(((x) & 0x1f) << 16)
1868c2ecf20Sopenharmony_ci#define FTGMAC100_PHYCR_REGAD(x)	(((x) & 0x1f) << 21)
1878c2ecf20Sopenharmony_ci#define FTGMAC100_PHYCR_MIIRD		(1 << 26)
1888c2ecf20Sopenharmony_ci#define FTGMAC100_PHYCR_MIIWR		(1 << 27)
1898c2ecf20Sopenharmony_ci
1908c2ecf20Sopenharmony_ci/*
1918c2ecf20Sopenharmony_ci * PHY data register
1928c2ecf20Sopenharmony_ci */
1938c2ecf20Sopenharmony_ci#define FTGMAC100_PHYDATA_MIIWDATA(x)		((x) & 0xffff)
1948c2ecf20Sopenharmony_ci#define FTGMAC100_PHYDATA_MIIRDATA(phydata)	(((phydata) >> 16) & 0xffff)
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci/*
1978c2ecf20Sopenharmony_ci * Flow control register
1988c2ecf20Sopenharmony_ci */
1998c2ecf20Sopenharmony_ci#define FTGMAC100_FCR_FC_EN		(1 << 0)
2008c2ecf20Sopenharmony_ci#define FTGMAC100_FCR_FCTHR_EN		(1 << 2)
2018c2ecf20Sopenharmony_ci#define FTGMAC100_FCR_PAUSE_TIME(x)	(((x) & 0xffff) << 16)
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci/*
2048c2ecf20Sopenharmony_ci * Transmit descriptor, aligned to 16 bytes
2058c2ecf20Sopenharmony_ci */
2068c2ecf20Sopenharmony_cistruct ftgmac100_txdes {
2078c2ecf20Sopenharmony_ci	__le32	txdes0; /* Control & status bits */
2088c2ecf20Sopenharmony_ci	__le32	txdes1; /* Irq, checksum and vlan control */
2098c2ecf20Sopenharmony_ci	__le32	txdes2; /* Reserved */
2108c2ecf20Sopenharmony_ci	__le32	txdes3; /* DMA buffer address */
2118c2ecf20Sopenharmony_ci} __attribute__ ((aligned(16)));
2128c2ecf20Sopenharmony_ci
2138c2ecf20Sopenharmony_ci#define FTGMAC100_TXDES0_TXBUF_SIZE(x)	((x) & 0x3fff)
2148c2ecf20Sopenharmony_ci#define FTGMAC100_TXDES0_CRC_ERR	(1 << 19)
2158c2ecf20Sopenharmony_ci#define FTGMAC100_TXDES0_LTS		(1 << 28)
2168c2ecf20Sopenharmony_ci#define FTGMAC100_TXDES0_FTS		(1 << 29)
2178c2ecf20Sopenharmony_ci#define FTGMAC100_TXDES0_TXDMA_OWN	(1 << 31)
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci#define FTGMAC100_TXDES1_VLANTAG_CI(x)	((x) & 0xffff)
2208c2ecf20Sopenharmony_ci#define FTGMAC100_TXDES1_INS_VLANTAG	(1 << 16)
2218c2ecf20Sopenharmony_ci#define FTGMAC100_TXDES1_TCP_CHKSUM	(1 << 17)
2228c2ecf20Sopenharmony_ci#define FTGMAC100_TXDES1_UDP_CHKSUM	(1 << 18)
2238c2ecf20Sopenharmony_ci#define FTGMAC100_TXDES1_IP_CHKSUM	(1 << 19)
2248c2ecf20Sopenharmony_ci#define FTGMAC100_TXDES1_LLC		(1 << 22)
2258c2ecf20Sopenharmony_ci#define FTGMAC100_TXDES1_TX2FIC		(1 << 30)
2268c2ecf20Sopenharmony_ci#define FTGMAC100_TXDES1_TXIC		(1 << 31)
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci/*
2298c2ecf20Sopenharmony_ci * Receive descriptor, aligned to 16 bytes
2308c2ecf20Sopenharmony_ci */
2318c2ecf20Sopenharmony_cistruct ftgmac100_rxdes {
2328c2ecf20Sopenharmony_ci	__le32	rxdes0; /* Control & status bits */
2338c2ecf20Sopenharmony_ci	__le32	rxdes1;	/* Checksum and vlan status */
2348c2ecf20Sopenharmony_ci	__le32	rxdes2; /* length/type on AST2500 */
2358c2ecf20Sopenharmony_ci	__le32	rxdes3;	/* DMA buffer address */
2368c2ecf20Sopenharmony_ci} __attribute__ ((aligned(16)));
2378c2ecf20Sopenharmony_ci
2388c2ecf20Sopenharmony_ci#define FTGMAC100_RXDES0_VDBC		0x3fff
2398c2ecf20Sopenharmony_ci#define FTGMAC100_RXDES0_MULTICAST	(1 << 16)
2408c2ecf20Sopenharmony_ci#define FTGMAC100_RXDES0_BROADCAST	(1 << 17)
2418c2ecf20Sopenharmony_ci#define FTGMAC100_RXDES0_RX_ERR		(1 << 18)
2428c2ecf20Sopenharmony_ci#define FTGMAC100_RXDES0_CRC_ERR	(1 << 19)
2438c2ecf20Sopenharmony_ci#define FTGMAC100_RXDES0_FTL		(1 << 20)
2448c2ecf20Sopenharmony_ci#define FTGMAC100_RXDES0_RUNT		(1 << 21)
2458c2ecf20Sopenharmony_ci#define FTGMAC100_RXDES0_RX_ODD_NB	(1 << 22)
2468c2ecf20Sopenharmony_ci#define FTGMAC100_RXDES0_FIFO_FULL	(1 << 23)
2478c2ecf20Sopenharmony_ci#define FTGMAC100_RXDES0_PAUSE_OPCODE	(1 << 24)
2488c2ecf20Sopenharmony_ci#define FTGMAC100_RXDES0_PAUSE_FRAME	(1 << 25)
2498c2ecf20Sopenharmony_ci#define FTGMAC100_RXDES0_LRS		(1 << 28)
2508c2ecf20Sopenharmony_ci#define FTGMAC100_RXDES0_FRS		(1 << 29)
2518c2ecf20Sopenharmony_ci#define FTGMAC100_RXDES0_RXPKT_RDY	(1 << 31)
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_ci/* Errors we care about for dropping packets */
2548c2ecf20Sopenharmony_ci#define RXDES0_ANY_ERROR		( \
2558c2ecf20Sopenharmony_ci	FTGMAC100_RXDES0_RX_ERR		| \
2568c2ecf20Sopenharmony_ci	FTGMAC100_RXDES0_CRC_ERR	| \
2578c2ecf20Sopenharmony_ci	FTGMAC100_RXDES0_FTL		| \
2588c2ecf20Sopenharmony_ci	FTGMAC100_RXDES0_RUNT		| \
2598c2ecf20Sopenharmony_ci	FTGMAC100_RXDES0_RX_ODD_NB)
2608c2ecf20Sopenharmony_ci
2618c2ecf20Sopenharmony_ci#define FTGMAC100_RXDES1_VLANTAG_CI	0xffff
2628c2ecf20Sopenharmony_ci#define FTGMAC100_RXDES1_PROT_MASK	(0x3 << 20)
2638c2ecf20Sopenharmony_ci#define FTGMAC100_RXDES1_PROT_NONIP	(0x0 << 20)
2648c2ecf20Sopenharmony_ci#define FTGMAC100_RXDES1_PROT_IP	(0x1 << 20)
2658c2ecf20Sopenharmony_ci#define FTGMAC100_RXDES1_PROT_TCPIP	(0x2 << 20)
2668c2ecf20Sopenharmony_ci#define FTGMAC100_RXDES1_PROT_UDPIP	(0x3 << 20)
2678c2ecf20Sopenharmony_ci#define FTGMAC100_RXDES1_LLC		(1 << 22)
2688c2ecf20Sopenharmony_ci#define FTGMAC100_RXDES1_DF		(1 << 23)
2698c2ecf20Sopenharmony_ci#define FTGMAC100_RXDES1_VLANTAG_AVAIL	(1 << 24)
2708c2ecf20Sopenharmony_ci#define FTGMAC100_RXDES1_TCP_CHKSUM_ERR	(1 << 25)
2718c2ecf20Sopenharmony_ci#define FTGMAC100_RXDES1_UDP_CHKSUM_ERR	(1 << 26)
2728c2ecf20Sopenharmony_ci#define FTGMAC100_RXDES1_IP_CHKSUM_ERR	(1 << 27)
2738c2ecf20Sopenharmony_ci
2748c2ecf20Sopenharmony_ci#endif /* __FTGMAC100_H */
275