xref: /openbmc/qemu/include/hw/net/npcm_gmac.h (revision 08f787a3)
1*08f787a3SHao Wu /*
2*08f787a3SHao Wu  * Nuvoton NPCM7xx/8xx GMAC Module
3*08f787a3SHao Wu  *
4*08f787a3SHao Wu  * Copyright 2024 Google LLC
5*08f787a3SHao Wu  * Authors:
6*08f787a3SHao Wu  * Hao Wu <wuhaotsh@google.com>
7*08f787a3SHao Wu  * Nabih Estefan <nabihestefan@google.com>
8*08f787a3SHao Wu  *
9*08f787a3SHao Wu  * This program is free software; you can redistribute it and/or modify it
10*08f787a3SHao Wu  * under the terms of the GNU General Public License as published by the
11*08f787a3SHao Wu  * Free Software Foundation; either version 2 of the License, or
12*08f787a3SHao Wu  * (at your option) any later version.
13*08f787a3SHao Wu  *
14*08f787a3SHao Wu  * This program is distributed in the hope that it will be useful, but WITHOUT
15*08f787a3SHao Wu  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16*08f787a3SHao Wu  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17*08f787a3SHao Wu  * for more details.
18*08f787a3SHao Wu  */
19*08f787a3SHao Wu 
20*08f787a3SHao Wu #ifndef NPCM_GMAC_H
21*08f787a3SHao Wu #define NPCM_GMAC_H
22*08f787a3SHao Wu 
23*08f787a3SHao Wu #include "hw/irq.h"
24*08f787a3SHao Wu #include "hw/sysbus.h"
25*08f787a3SHao Wu #include "net/net.h"
26*08f787a3SHao Wu 
27*08f787a3SHao Wu #define NPCM_GMAC_NR_REGS (0x1060 / sizeof(uint32_t))
28*08f787a3SHao Wu 
29*08f787a3SHao Wu #define NPCM_GMAC_MAX_PHYS 32
30*08f787a3SHao Wu #define NPCM_GMAC_MAX_PHY_REGS 32
31*08f787a3SHao Wu 
32*08f787a3SHao Wu struct NPCMGMACRxDesc {
33*08f787a3SHao Wu     uint32_t rdes0;
34*08f787a3SHao Wu     uint32_t rdes1;
35*08f787a3SHao Wu     uint32_t rdes2;
36*08f787a3SHao Wu     uint32_t rdes3;
37*08f787a3SHao Wu };
38*08f787a3SHao Wu 
39*08f787a3SHao Wu /* NPCMGMACRxDesc.flags values */
40*08f787a3SHao Wu /* RDES2 and RDES3 are buffer addresses */
41*08f787a3SHao Wu /* Owner: 0 = software, 1 = dma */
42*08f787a3SHao Wu #define RX_DESC_RDES0_OWN BIT(31)
43*08f787a3SHao Wu /* Destination Address Filter Fail */
44*08f787a3SHao Wu #define RX_DESC_RDES0_DEST_ADDR_FILT_FAIL BIT(30)
45*08f787a3SHao Wu /* Frame length */
46*08f787a3SHao Wu #define RX_DESC_RDES0_FRAME_LEN_MASK(word) extract32(word, 16, 14)
47*08f787a3SHao Wu /* Frame length Shift*/
48*08f787a3SHao Wu #define RX_DESC_RDES0_FRAME_LEN_SHIFT 16
49*08f787a3SHao Wu /* Error Summary */
50*08f787a3SHao Wu #define RX_DESC_RDES0_ERR_SUMM_MASK BIT(15)
51*08f787a3SHao Wu /* Descriptor Error */
52*08f787a3SHao Wu #define RX_DESC_RDES0_DESC_ERR_MASK BIT(14)
53*08f787a3SHao Wu /* Source Address Filter Fail */
54*08f787a3SHao Wu #define RX_DESC_RDES0_SRC_ADDR_FILT_FAIL_MASK BIT(13)
55*08f787a3SHao Wu /* Length Error */
56*08f787a3SHao Wu #define RX_DESC_RDES0_LEN_ERR_MASK BIT(12)
57*08f787a3SHao Wu /* Overflow Error */
58*08f787a3SHao Wu #define RX_DESC_RDES0_OVRFLW_ERR_MASK BIT(11)
59*08f787a3SHao Wu /* VLAN Tag */
60*08f787a3SHao Wu #define RX_DESC_RDES0_VLAN_TAG_MASK BIT(10)
61*08f787a3SHao Wu /* First Descriptor */
62*08f787a3SHao Wu #define RX_DESC_RDES0_FIRST_DESC_MASK BIT(9)
63*08f787a3SHao Wu /* Last Descriptor */
64*08f787a3SHao Wu #define RX_DESC_RDES0_LAST_DESC_MASK BIT(8)
65*08f787a3SHao Wu /* IPC Checksum Error/Giant Frame */
66*08f787a3SHao Wu #define RX_DESC_RDES0_IPC_CHKSM_ERR_GNT_FRM_MASK BIT(7)
67*08f787a3SHao Wu /* Late Collision */
68*08f787a3SHao Wu #define RX_DESC_RDES0_LT_COLL_MASK BIT(6)
69*08f787a3SHao Wu /* Frame Type */
70*08f787a3SHao Wu #define RX_DESC_RDES0_FRM_TYPE_MASK BIT(5)
71*08f787a3SHao Wu /* Receive Watchdog Timeout */
72*08f787a3SHao Wu #define RX_DESC_RDES0_REC_WTCHDG_TMT_MASK BIT(4)
73*08f787a3SHao Wu /* Receive Error */
74*08f787a3SHao Wu #define RX_DESC_RDES0_RCV_ERR_MASK BIT(3)
75*08f787a3SHao Wu /* Dribble Bit Error */
76*08f787a3SHao Wu #define RX_DESC_RDES0_DRBL_BIT_ERR_MASK BIT(2)
77*08f787a3SHao Wu /* Cyclcic Redundancy Check Error */
78*08f787a3SHao Wu #define RX_DESC_RDES0_CRC_ERR_MASK BIT(1)
79*08f787a3SHao Wu /* Rx MAC Address/Payload Checksum Error */
80*08f787a3SHao Wu #define RC_DESC_RDES0_RCE_MASK BIT(0)
81*08f787a3SHao Wu 
82*08f787a3SHao Wu /* Disable Interrupt on Completion */
83*08f787a3SHao Wu #define RX_DESC_RDES1_DIS_INTR_COMP_MASK BIT(31)
84*08f787a3SHao Wu /* Recieve end of ring */
85*08f787a3SHao Wu #define RX_DESC_RDES1_RC_END_RING_MASK BIT(25)
86*08f787a3SHao Wu /* Second Address Chained */
87*08f787a3SHao Wu #define RX_DESC_RDES1_SEC_ADDR_CHND_MASK BIT(24)
88*08f787a3SHao Wu /* Receive Buffer 2 Size */
89*08f787a3SHao Wu #define RX_DESC_RDES1_BFFR2_SZ_SHIFT 11
90*08f787a3SHao Wu #define RX_DESC_RDES1_BFFR2_SZ_MASK(word) extract32(word, \
91*08f787a3SHao Wu     RX_DESC_RDES1_BFFR2_SZ_SHIFT, 11)
92*08f787a3SHao Wu /* Receive Buffer 1 Size */
93*08f787a3SHao Wu #define RX_DESC_RDES1_BFFR1_SZ_MASK(word) extract32(word, 0, 11)
94*08f787a3SHao Wu 
95*08f787a3SHao Wu 
96*08f787a3SHao Wu struct NPCMGMACTxDesc {
97*08f787a3SHao Wu     uint32_t tdes0;
98*08f787a3SHao Wu     uint32_t tdes1;
99*08f787a3SHao Wu     uint32_t tdes2;
100*08f787a3SHao Wu     uint32_t tdes3;
101*08f787a3SHao Wu };
102*08f787a3SHao Wu 
103*08f787a3SHao Wu /* NPCMGMACTxDesc.flags values */
104*08f787a3SHao Wu /* TDES2 and TDES3 are buffer addresses */
105*08f787a3SHao Wu /* Owner: 0 = software, 1 = gmac */
106*08f787a3SHao Wu #define TX_DESC_TDES0_OWN BIT(31)
107*08f787a3SHao Wu /* Tx Time Stamp Status */
108*08f787a3SHao Wu #define TX_DESC_TDES0_TTSS_MASK BIT(17)
109*08f787a3SHao Wu /* IP Header Error */
110*08f787a3SHao Wu #define TX_DESC_TDES0_IP_HEAD_ERR_MASK BIT(16)
111*08f787a3SHao Wu /* Error Summary */
112*08f787a3SHao Wu #define TX_DESC_TDES0_ERR_SUMM_MASK BIT(15)
113*08f787a3SHao Wu /* Jabber Timeout */
114*08f787a3SHao Wu #define TX_DESC_TDES0_JBBR_TMT_MASK BIT(14)
115*08f787a3SHao Wu /* Frame Flushed */
116*08f787a3SHao Wu #define TX_DESC_TDES0_FRM_FLSHD_MASK BIT(13)
117*08f787a3SHao Wu /* Payload Checksum Error */
118*08f787a3SHao Wu #define TX_DESC_TDES0_PYLD_CHKSM_ERR_MASK BIT(12)
119*08f787a3SHao Wu /* Loss of Carrier */
120*08f787a3SHao Wu #define TX_DESC_TDES0_LSS_CARR_MASK BIT(11)
121*08f787a3SHao Wu /* No Carrier */
122*08f787a3SHao Wu #define TX_DESC_TDES0_NO_CARR_MASK BIT(10)
123*08f787a3SHao Wu /* Late Collision */
124*08f787a3SHao Wu #define TX_DESC_TDES0_LATE_COLL_MASK BIT(9)
125*08f787a3SHao Wu /* Excessive Collision */
126*08f787a3SHao Wu #define TX_DESC_TDES0_EXCS_COLL_MASK BIT(8)
127*08f787a3SHao Wu /* VLAN Frame */
128*08f787a3SHao Wu #define TX_DESC_TDES0_VLAN_FRM_MASK BIT(7)
129*08f787a3SHao Wu /* Collision Count */
130*08f787a3SHao Wu #define TX_DESC_TDES0_COLL_CNT_MASK(word) extract32(word, 3, 4)
131*08f787a3SHao Wu /* Excessive Deferral */
132*08f787a3SHao Wu #define TX_DESC_TDES0_EXCS_DEF_MASK BIT(2)
133*08f787a3SHao Wu /* Underflow Error */
134*08f787a3SHao Wu #define TX_DESC_TDES0_UNDRFLW_ERR_MASK BIT(1)
135*08f787a3SHao Wu /* Deferred Bit */
136*08f787a3SHao Wu #define TX_DESC_TDES0_DFRD_BIT_MASK BIT(0)
137*08f787a3SHao Wu 
138*08f787a3SHao Wu /* Interrupt of Completion */
139*08f787a3SHao Wu #define TX_DESC_TDES1_INTERR_COMP_MASK BIT(31)
140*08f787a3SHao Wu /* Last Segment */
141*08f787a3SHao Wu #define TX_DESC_TDES1_LAST_SEG_MASK BIT(30)
142*08f787a3SHao Wu /* First Segment */
143*08f787a3SHao Wu #define TX_DESC_TDES1_FIRST_SEG_MASK BIT(29)
144*08f787a3SHao Wu /* Checksum Insertion Control */
145*08f787a3SHao Wu #define TX_DESC_TDES1_CHKSM_INS_CTRL_MASK(word) extract32(word, 27, 2)
146*08f787a3SHao Wu /* Disable Cyclic Redundancy Check */
147*08f787a3SHao Wu #define TX_DESC_TDES1_DIS_CDC_MASK BIT(26)
148*08f787a3SHao Wu /* Transmit End of Ring */
149*08f787a3SHao Wu #define TX_DESC_TDES1_TX_END_RING_MASK BIT(25)
150*08f787a3SHao Wu /* Secondary Address Chained */
151*08f787a3SHao Wu #define TX_DESC_TDES1_SEC_ADDR_CHND_MASK BIT(24)
152*08f787a3SHao Wu /* Transmit Buffer 2 Size */
153*08f787a3SHao Wu #define TX_DESC_TDES1_BFFR2_SZ_MASK(word) extract32(word, 11, 11)
154*08f787a3SHao Wu /* Transmit Buffer 1 Size */
155*08f787a3SHao Wu #define TX_DESC_TDES1_BFFR1_SZ_MASK(word) extract32(word, 0, 11)
156*08f787a3SHao Wu 
157*08f787a3SHao Wu typedef struct NPCMGMACState {
158*08f787a3SHao Wu     SysBusDevice parent;
159*08f787a3SHao Wu 
160*08f787a3SHao Wu     MemoryRegion iomem;
161*08f787a3SHao Wu     qemu_irq irq;
162*08f787a3SHao Wu 
163*08f787a3SHao Wu     NICState *nic;
164*08f787a3SHao Wu     NICConf conf;
165*08f787a3SHao Wu 
166*08f787a3SHao Wu     uint32_t regs[NPCM_GMAC_NR_REGS];
167*08f787a3SHao Wu     uint16_t phy_regs[NPCM_GMAC_MAX_PHYS][NPCM_GMAC_MAX_PHY_REGS];
168*08f787a3SHao Wu } NPCMGMACState;
169*08f787a3SHao Wu 
170*08f787a3SHao Wu #define TYPE_NPCM_GMAC "npcm-gmac"
171*08f787a3SHao Wu OBJECT_DECLARE_SIMPLE_TYPE(NPCMGMACState, NPCM_GMAC)
172*08f787a3SHao Wu 
173*08f787a3SHao Wu /* Mask for RO bits in Status */
174*08f787a3SHao Wu #define NPCM_DMA_STATUS_RO_MASK(word) (word & 0xfffe0000)
175*08f787a3SHao Wu /* Mask for RO bits in Status */
176*08f787a3SHao Wu #define NPCM_DMA_STATUS_W1C_MASK(word) (word & 0x1e7ff)
177*08f787a3SHao Wu 
178*08f787a3SHao Wu /* Transmit Process State */
179*08f787a3SHao Wu #define NPCM_DMA_STATUS_TX_PROCESS_STATE_SHIFT 20
180*08f787a3SHao Wu /* Transmit States */
181*08f787a3SHao Wu #define NPCM_DMA_STATUS_TX_STOPPED_STATE \
182*08f787a3SHao Wu     (0b000)
183*08f787a3SHao Wu #define NPCM_DMA_STATUS_TX_RUNNING_FETCHING_STATE \
184*08f787a3SHao Wu     (0b001)
185*08f787a3SHao Wu #define NPCM_DMA_STATUS_TX_RUNNING_WAITING_STATE \
186*08f787a3SHao Wu     (0b010)
187*08f787a3SHao Wu #define NPCM_DMA_STATUS_TX_RUNNING_READ_STATE \
188*08f787a3SHao Wu     (0b011)
189*08f787a3SHao Wu #define NPCM_DMA_STATUS_TX_SUSPENDED_STATE \
190*08f787a3SHao Wu     (0b110)
191*08f787a3SHao Wu #define NPCM_DMA_STATUS_TX_RUNNING_CLOSING_STATE \
192*08f787a3SHao Wu     (0b111)
193*08f787a3SHao Wu /* Transmit Process State */
194*08f787a3SHao Wu #define NPCM_DMA_STATUS_RX_PROCESS_STATE_SHIFT 17
195*08f787a3SHao Wu /* Receive States */
196*08f787a3SHao Wu #define NPCM_DMA_STATUS_RX_STOPPED_STATE \
197*08f787a3SHao Wu     (0b000)
198*08f787a3SHao Wu #define NPCM_DMA_STATUS_RX_RUNNING_FETCHING_STATE \
199*08f787a3SHao Wu     (0b001)
200*08f787a3SHao Wu #define NPCM_DMA_STATUS_RX_RUNNING_WAITING_STATE \
201*08f787a3SHao Wu     (0b011)
202*08f787a3SHao Wu #define NPCM_DMA_STATUS_RX_SUSPENDED_STATE \
203*08f787a3SHao Wu     (0b100)
204*08f787a3SHao Wu #define NPCM_DMA_STATUS_RX_RUNNING_CLOSING_STATE \
205*08f787a3SHao Wu     (0b101)
206*08f787a3SHao Wu #define NPCM_DMA_STATUS_RX_RUNNING_TRANSFERRING_STATE \
207*08f787a3SHao Wu     (0b111)
208*08f787a3SHao Wu 
209*08f787a3SHao Wu 
210*08f787a3SHao Wu /* Early Receive Interrupt */
211*08f787a3SHao Wu #define NPCM_DMA_STATUS_ERI BIT(14)
212*08f787a3SHao Wu /* Fatal Bus Error Interrupt */
213*08f787a3SHao Wu #define NPCM_DMA_STATUS_FBI BIT(13)
214*08f787a3SHao Wu /* Early transmit Interrupt */
215*08f787a3SHao Wu #define NPCM_DMA_STATUS_ETI BIT(10)
216*08f787a3SHao Wu /* Receive Watchdog Timout */
217*08f787a3SHao Wu #define NPCM_DMA_STATUS_RWT BIT(9)
218*08f787a3SHao Wu /* Receive Process Stopped */
219*08f787a3SHao Wu #define NPCM_DMA_STATUS_RPS BIT(8)
220*08f787a3SHao Wu /* Receive Buffer Unavailable */
221*08f787a3SHao Wu #define NPCM_DMA_STATUS_RU BIT(7)
222*08f787a3SHao Wu /* Receive Interrupt */
223*08f787a3SHao Wu #define NPCM_DMA_STATUS_RI BIT(6)
224*08f787a3SHao Wu /* Transmit Underflow */
225*08f787a3SHao Wu #define NPCM_DMA_STATUS_UNF BIT(5)
226*08f787a3SHao Wu /* Receive Overflow */
227*08f787a3SHao Wu #define NPCM_DMA_STATUS_OVF BIT(4)
228*08f787a3SHao Wu /* Transmit Jabber Timeout */
229*08f787a3SHao Wu #define NPCM_DMA_STATUS_TJT BIT(3)
230*08f787a3SHao Wu /* Transmit Buffer Unavailable */
231*08f787a3SHao Wu #define NPCM_DMA_STATUS_TU BIT(2)
232*08f787a3SHao Wu /* Transmit Process Stopped */
233*08f787a3SHao Wu #define NPCM_DMA_STATUS_TPS BIT(1)
234*08f787a3SHao Wu /* Transmit Interrupt */
235*08f787a3SHao Wu #define NPCM_DMA_STATUS_TI BIT(0)
236*08f787a3SHao Wu 
237*08f787a3SHao Wu /* Normal Interrupt Summary */
238*08f787a3SHao Wu #define NPCM_DMA_STATUS_NIS BIT(16)
239*08f787a3SHao Wu /* Interrupts enabled by NIE */
240*08f787a3SHao Wu #define NPCM_DMA_STATUS_NIS_BITS (NPCM_DMA_STATUS_TI | \
241*08f787a3SHao Wu                                   NPCM_DMA_STATUS_TU | \
242*08f787a3SHao Wu                                   NPCM_DMA_STATUS_RI | \
243*08f787a3SHao Wu                                   NPCM_DMA_STATUS_ERI)
244*08f787a3SHao Wu /* Abnormal Interrupt Summary */
245*08f787a3SHao Wu #define NPCM_DMA_STATUS_AIS BIT(15)
246*08f787a3SHao Wu /* Interrupts enabled by AIE */
247*08f787a3SHao Wu #define NPCM_DMA_STATUS_AIS_BITS (NPCM_DMA_STATUS_TPS | \
248*08f787a3SHao Wu                                   NPCM_DMA_STATUS_TJT | \
249*08f787a3SHao Wu                                   NPCM_DMA_STATUS_OVF | \
250*08f787a3SHao Wu                                   NPCM_DMA_STATUS_UNF | \
251*08f787a3SHao Wu                                   NPCM_DMA_STATUS_RU  | \
252*08f787a3SHao Wu                                   NPCM_DMA_STATUS_RPS | \
253*08f787a3SHao Wu                                   NPCM_DMA_STATUS_RWT | \
254*08f787a3SHao Wu                                   NPCM_DMA_STATUS_ETI | \
255*08f787a3SHao Wu                                   NPCM_DMA_STATUS_FBI)
256*08f787a3SHao Wu 
257*08f787a3SHao Wu /* Early Receive Interrupt Enable */
258*08f787a3SHao Wu #define NPCM_DMA_INTR_ENAB_ERE BIT(14)
259*08f787a3SHao Wu /* Fatal Bus Error Interrupt Enable */
260*08f787a3SHao Wu #define NPCM_DMA_INTR_ENAB_FBE BIT(13)
261*08f787a3SHao Wu /* Early transmit Interrupt Enable */
262*08f787a3SHao Wu #define NPCM_DMA_INTR_ENAB_ETE BIT(10)
263*08f787a3SHao Wu /* Receive Watchdog Timout Enable */
264*08f787a3SHao Wu #define NPCM_DMA_INTR_ENAB_RWE BIT(9)
265*08f787a3SHao Wu /* Receive Process Stopped Enable */
266*08f787a3SHao Wu #define NPCM_DMA_INTR_ENAB_RSE BIT(8)
267*08f787a3SHao Wu /* Receive Buffer Unavailable Enable */
268*08f787a3SHao Wu #define NPCM_DMA_INTR_ENAB_RUE BIT(7)
269*08f787a3SHao Wu /* Receive Interrupt Enable */
270*08f787a3SHao Wu #define NPCM_DMA_INTR_ENAB_RIE BIT(6)
271*08f787a3SHao Wu /* Transmit Underflow Enable */
272*08f787a3SHao Wu #define NPCM_DMA_INTR_ENAB_UNE BIT(5)
273*08f787a3SHao Wu /* Receive Overflow Enable */
274*08f787a3SHao Wu #define NPCM_DMA_INTR_ENAB_OVE BIT(4)
275*08f787a3SHao Wu /* Transmit Jabber Timeout Enable */
276*08f787a3SHao Wu #define NPCM_DMA_INTR_ENAB_TJE BIT(3)
277*08f787a3SHao Wu /* Transmit Buffer Unavailable Enable */
278*08f787a3SHao Wu #define NPCM_DMA_INTR_ENAB_TUE BIT(2)
279*08f787a3SHao Wu /* Transmit Process Stopped Enable */
280*08f787a3SHao Wu #define NPCM_DMA_INTR_ENAB_TSE BIT(1)
281*08f787a3SHao Wu /* Transmit Interrupt Enable */
282*08f787a3SHao Wu #define NPCM_DMA_INTR_ENAB_TIE BIT(0)
283*08f787a3SHao Wu 
284*08f787a3SHao Wu /* Normal Interrupt Summary Enable */
285*08f787a3SHao Wu #define NPCM_DMA_INTR_ENAB_NIE BIT(16)
286*08f787a3SHao Wu /* Interrupts enabled by NIE Enable */
287*08f787a3SHao Wu #define NPCM_DMA_INTR_ENAB_NIE_BITS (NPCM_DMA_INTR_ENAB_TIE | \
288*08f787a3SHao Wu                                      NPCM_DMA_INTR_ENAB_TUE | \
289*08f787a3SHao Wu                                      NPCM_DMA_INTR_ENAB_RIE | \
290*08f787a3SHao Wu                                      NPCM_DMA_INTR_ENAB_ERE)
291*08f787a3SHao Wu /* Abnormal Interrupt Summary Enable */
292*08f787a3SHao Wu #define NPCM_DMA_INTR_ENAB_AIE BIT(15)
293*08f787a3SHao Wu /* Interrupts enabled by AIE Enable */
294*08f787a3SHao Wu #define NPCM_DMA_INTR_ENAB_AIE_BITS (NPCM_DMA_INTR_ENAB_TSE | \
295*08f787a3SHao Wu                                      NPCM_DMA_INTR_ENAB_TJE | \
296*08f787a3SHao Wu                                      NPCM_DMA_INTR_ENAB_OVE | \
297*08f787a3SHao Wu                                      NPCM_DMA_INTR_ENAB_UNE | \
298*08f787a3SHao Wu                                      NPCM_DMA_INTR_ENAB_RUE | \
299*08f787a3SHao Wu                                      NPCM_DMA_INTR_ENAB_RSE | \
300*08f787a3SHao Wu                                      NPCM_DMA_INTR_ENAB_RWE | \
301*08f787a3SHao Wu                                      NPCM_DMA_INTR_ENAB_ETE | \
302*08f787a3SHao Wu                                      NPCM_DMA_INTR_ENAB_FBE)
303*08f787a3SHao Wu 
304*08f787a3SHao Wu /* Flushing Disabled */
305*08f787a3SHao Wu #define NPCM_DMA_CONTROL_FLUSH_MASK BIT(24)
306*08f787a3SHao Wu /* Start/stop Transmit */
307*08f787a3SHao Wu #define NPCM_DMA_CONTROL_START_STOP_TX BIT(13)
308*08f787a3SHao Wu /* Start/stop Receive */
309*08f787a3SHao Wu #define NPCM_DMA_CONTROL_START_STOP_RX BIT(1)
310*08f787a3SHao Wu /* Next receive descriptor start address */
311*08f787a3SHao Wu #define NPCM_DMA_HOST_RX_DESC_MASK(word) ((uint32_t) (word) & ~3u)
312*08f787a3SHao Wu /* Next transmit descriptor start address */
313*08f787a3SHao Wu #define NPCM_DMA_HOST_TX_DESC_MASK(word) ((uint32_t) (word) & ~3u)
314*08f787a3SHao Wu 
315*08f787a3SHao Wu /* Receive enable */
316*08f787a3SHao Wu #define NPCM_GMAC_MAC_CONFIG_RX_EN BIT(2)
317*08f787a3SHao Wu /* Transmit enable */
318*08f787a3SHao Wu #define NPCM_GMAC_MAC_CONFIG_TX_EN BIT(3)
319*08f787a3SHao Wu 
320*08f787a3SHao Wu /* Frame Receive All */
321*08f787a3SHao Wu #define NPCM_GMAC_FRAME_FILTER_REC_ALL_MASK BIT(31)
322*08f787a3SHao Wu /* Frame HPF Filter*/
323*08f787a3SHao Wu #define NPCM_GMAC_FRAME_FILTER_HPF_MASK BIT(10)
324*08f787a3SHao Wu /* Frame SAF Filter*/
325*08f787a3SHao Wu #define NPCM_GMAC_FRAME_FILTER_SAF_MASK BIT(9)
326*08f787a3SHao Wu /* Frame SAIF Filter*/
327*08f787a3SHao Wu #define NPCM_GMAC_FRAME_FILTER_SAIF_MASK BIT(8)
328*08f787a3SHao Wu /* Frame PCF Filter*/
329*08f787a3SHao Wu #define NPCM_GMAC_FRAME_FILTER_PCF_MASK BIT(word) extract32((word), 6, 2)
330*08f787a3SHao Wu /* Frame DBF Filter*/
331*08f787a3SHao Wu #define NPCM_GMAC_FRAME_FILTER_DBF_MASK BIT(5)
332*08f787a3SHao Wu /* Frame PM Filter*/
333*08f787a3SHao Wu #define NPCM_GMAC_FRAME_FILTER_PM_MASK BIT(4)
334*08f787a3SHao Wu /* Frame DAIF Filter*/
335*08f787a3SHao Wu #define NPCM_GMAC_FRAME_FILTER_DAIF_MASK BIT(3)
336*08f787a3SHao Wu /* Frame HMC Filter*/
337*08f787a3SHao Wu #define NPCM_GMAC_FRAME_FILTER_HMC_MASK BIT(2)
338*08f787a3SHao Wu /* Frame HUC Filter*/
339*08f787a3SHao Wu #define NPCM_GMAC_FRAME_FILTER_HUC_MASK BIT(1)
340*08f787a3SHao Wu /* Frame PR Filter*/
341*08f787a3SHao Wu #define NPCM_GMAC_FRAME_FILTER_PR_MASK BIT(0)
342*08f787a3SHao Wu 
343*08f787a3SHao Wu #endif /* NPCM_GMAC_H */
344