xref: /linux/drivers/net/ethernet/tundra/tsi108_eth.h (revision 58e16d792a6a8c6b750f637a4649967fcac853dc)
1*1ccea77eSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
2e75ed60cSJeff Kirsher /*
3e75ed60cSJeff Kirsher  * (C) Copyright 2005 Tundra Semiconductor Corp.
4e75ed60cSJeff Kirsher  * Kong Lai, <kong.lai@tundra.com).
5e75ed60cSJeff Kirsher  *
6e75ed60cSJeff Kirsher  * See file CREDITS for list of people who contributed to this
7e75ed60cSJeff Kirsher  * project.
8e75ed60cSJeff Kirsher  */
9e75ed60cSJeff Kirsher 
10e75ed60cSJeff Kirsher /*
11e75ed60cSJeff Kirsher  * net/tsi108_eth.h - definitions for Tsi108 GIGE network controller.
12e75ed60cSJeff Kirsher  */
13e75ed60cSJeff Kirsher 
14e75ed60cSJeff Kirsher #ifndef __TSI108_ETH_H
15e75ed60cSJeff Kirsher #define __TSI108_ETH_H
16e75ed60cSJeff Kirsher 
17e75ed60cSJeff Kirsher #include <linux/types.h>
18e75ed60cSJeff Kirsher 
19e75ed60cSJeff Kirsher #define TSI_WRITE(offset, val) \
20e75ed60cSJeff Kirsher 	out_be32((data->regs + (offset)), val)
21e75ed60cSJeff Kirsher 
22e75ed60cSJeff Kirsher #define TSI_READ(offset) \
23e75ed60cSJeff Kirsher 	in_be32((data->regs + (offset)))
24e75ed60cSJeff Kirsher 
25e75ed60cSJeff Kirsher #define TSI_WRITE_PHY(offset, val) \
26e75ed60cSJeff Kirsher 	out_be32((data->phyregs + (offset)), val)
27e75ed60cSJeff Kirsher 
28e75ed60cSJeff Kirsher #define TSI_READ_PHY(offset) \
29e75ed60cSJeff Kirsher 	in_be32((data->phyregs + (offset)))
30e75ed60cSJeff Kirsher 
31e75ed60cSJeff Kirsher /*
32e75ed60cSJeff Kirsher  * TSI108 GIGE port registers
33e75ed60cSJeff Kirsher  */
34e75ed60cSJeff Kirsher 
35e75ed60cSJeff Kirsher #define TSI108_ETH_PORT_NUM		2
36e75ed60cSJeff Kirsher #define TSI108_PBM_PORT			2
37e75ed60cSJeff Kirsher #define TSI108_SDRAM_PORT		4
38e75ed60cSJeff Kirsher 
39e75ed60cSJeff Kirsher #define TSI108_MAC_CFG1			(0x000)
40e75ed60cSJeff Kirsher #define TSI108_MAC_CFG1_SOFTRST		(1 << 31)
41e75ed60cSJeff Kirsher #define TSI108_MAC_CFG1_LOOPBACK	(1 << 8)
42e75ed60cSJeff Kirsher #define TSI108_MAC_CFG1_RXEN		(1 << 2)
43e75ed60cSJeff Kirsher #define TSI108_MAC_CFG1_TXEN		(1 << 0)
44e75ed60cSJeff Kirsher 
45e75ed60cSJeff Kirsher #define TSI108_MAC_CFG2			(0x004)
46e75ed60cSJeff Kirsher #define TSI108_MAC_CFG2_DFLT_PREAMBLE	(7 << 12)
47e75ed60cSJeff Kirsher #define TSI108_MAC_CFG2_IFACE_MASK	(3 << 8)
48e75ed60cSJeff Kirsher #define TSI108_MAC_CFG2_NOGIG		(1 << 8)
49e75ed60cSJeff Kirsher #define TSI108_MAC_CFG2_GIG		(2 << 8)
50e75ed60cSJeff Kirsher #define TSI108_MAC_CFG2_PADCRC		(1 << 2)
51e75ed60cSJeff Kirsher #define TSI108_MAC_CFG2_FULLDUPLEX	(1 << 0)
52e75ed60cSJeff Kirsher 
53e75ed60cSJeff Kirsher #define TSI108_MAC_MII_MGMT_CFG		(0x020)
54e75ed60cSJeff Kirsher #define TSI108_MAC_MII_MGMT_CLK		(7 << 0)
55e75ed60cSJeff Kirsher #define TSI108_MAC_MII_MGMT_RST		(1 << 31)
56e75ed60cSJeff Kirsher 
57e75ed60cSJeff Kirsher #define TSI108_MAC_MII_CMD		(0x024)
58e75ed60cSJeff Kirsher #define TSI108_MAC_MII_CMD_READ		(1 << 0)
59e75ed60cSJeff Kirsher 
60e75ed60cSJeff Kirsher #define TSI108_MAC_MII_ADDR		(0x028)
61e75ed60cSJeff Kirsher #define TSI108_MAC_MII_ADDR_REG		0
62e75ed60cSJeff Kirsher #define TSI108_MAC_MII_ADDR_PHY		8
63e75ed60cSJeff Kirsher 
64e75ed60cSJeff Kirsher #define TSI108_MAC_MII_DATAOUT		(0x02c)
65e75ed60cSJeff Kirsher #define TSI108_MAC_MII_DATAIN		(0x030)
66e75ed60cSJeff Kirsher 
67e75ed60cSJeff Kirsher #define TSI108_MAC_MII_IND		(0x034)
68e75ed60cSJeff Kirsher #define TSI108_MAC_MII_IND_NOTVALID	(1 << 2)
69e75ed60cSJeff Kirsher #define TSI108_MAC_MII_IND_SCANNING	(1 << 1)
70e75ed60cSJeff Kirsher #define TSI108_MAC_MII_IND_BUSY		(1 << 0)
71e75ed60cSJeff Kirsher 
72e75ed60cSJeff Kirsher #define TSI108_MAC_IFCTRL		(0x038)
73e75ed60cSJeff Kirsher #define TSI108_MAC_IFCTRL_PHYMODE	(1 << 24)
74e75ed60cSJeff Kirsher 
75e75ed60cSJeff Kirsher #define TSI108_MAC_ADDR1		(0x040)
76e75ed60cSJeff Kirsher #define TSI108_MAC_ADDR2		(0x044)
77e75ed60cSJeff Kirsher 
78e75ed60cSJeff Kirsher #define TSI108_STAT_RXBYTES		(0x06c)
79e75ed60cSJeff Kirsher #define TSI108_STAT_RXBYTES_CARRY	(1 << 24)
80e75ed60cSJeff Kirsher 
81e75ed60cSJeff Kirsher #define TSI108_STAT_RXPKTS		(0x070)
82e75ed60cSJeff Kirsher #define TSI108_STAT_RXPKTS_CARRY	(1 << 18)
83e75ed60cSJeff Kirsher 
84e75ed60cSJeff Kirsher #define TSI108_STAT_RXFCS		(0x074)
85e75ed60cSJeff Kirsher #define TSI108_STAT_RXFCS_CARRY		(1 << 12)
86e75ed60cSJeff Kirsher 
87e75ed60cSJeff Kirsher #define TSI108_STAT_RXMCAST		(0x078)
88e75ed60cSJeff Kirsher #define TSI108_STAT_RXMCAST_CARRY	(1 << 18)
89e75ed60cSJeff Kirsher 
90e75ed60cSJeff Kirsher #define TSI108_STAT_RXALIGN		(0x08c)
91e75ed60cSJeff Kirsher #define TSI108_STAT_RXALIGN_CARRY	(1 << 12)
92e75ed60cSJeff Kirsher 
93e75ed60cSJeff Kirsher #define TSI108_STAT_RXLENGTH		(0x090)
94e75ed60cSJeff Kirsher #define TSI108_STAT_RXLENGTH_CARRY	(1 << 12)
95e75ed60cSJeff Kirsher 
96e75ed60cSJeff Kirsher #define TSI108_STAT_RXRUNT		(0x09c)
97e75ed60cSJeff Kirsher #define TSI108_STAT_RXRUNT_CARRY	(1 << 12)
98e75ed60cSJeff Kirsher 
99e75ed60cSJeff Kirsher #define TSI108_STAT_RXJUMBO		(0x0a0)
100e75ed60cSJeff Kirsher #define TSI108_STAT_RXJUMBO_CARRY	(1 << 12)
101e75ed60cSJeff Kirsher 
102e75ed60cSJeff Kirsher #define TSI108_STAT_RXFRAG		(0x0a4)
103e75ed60cSJeff Kirsher #define TSI108_STAT_RXFRAG_CARRY	(1 << 12)
104e75ed60cSJeff Kirsher 
105e75ed60cSJeff Kirsher #define TSI108_STAT_RXJABBER		(0x0a8)
106e75ed60cSJeff Kirsher #define TSI108_STAT_RXJABBER_CARRY	(1 << 12)
107e75ed60cSJeff Kirsher 
108e75ed60cSJeff Kirsher #define TSI108_STAT_RXDROP		(0x0ac)
109e75ed60cSJeff Kirsher #define TSI108_STAT_RXDROP_CARRY	(1 << 12)
110e75ed60cSJeff Kirsher 
111e75ed60cSJeff Kirsher #define TSI108_STAT_TXBYTES		(0x0b0)
112e75ed60cSJeff Kirsher #define TSI108_STAT_TXBYTES_CARRY	(1 << 24)
113e75ed60cSJeff Kirsher 
114e75ed60cSJeff Kirsher #define TSI108_STAT_TXPKTS		(0x0b4)
115e75ed60cSJeff Kirsher #define TSI108_STAT_TXPKTS_CARRY	(1 << 18)
116e75ed60cSJeff Kirsher 
117e75ed60cSJeff Kirsher #define TSI108_STAT_TXEXDEF		(0x0c8)
118e75ed60cSJeff Kirsher #define TSI108_STAT_TXEXDEF_CARRY	(1 << 12)
119e75ed60cSJeff Kirsher 
120e75ed60cSJeff Kirsher #define TSI108_STAT_TXEXCOL		(0x0d8)
121e75ed60cSJeff Kirsher #define TSI108_STAT_TXEXCOL_CARRY	(1 << 12)
122e75ed60cSJeff Kirsher 
123e75ed60cSJeff Kirsher #define TSI108_STAT_TXTCOL		(0x0dc)
124e75ed60cSJeff Kirsher #define TSI108_STAT_TXTCOL_CARRY	(1 << 13)
125e75ed60cSJeff Kirsher 
126e75ed60cSJeff Kirsher #define TSI108_STAT_TXPAUSEDROP		(0x0e4)
127e75ed60cSJeff Kirsher #define TSI108_STAT_TXPAUSEDROP_CARRY	(1 << 12)
128e75ed60cSJeff Kirsher 
129e75ed60cSJeff Kirsher #define TSI108_STAT_CARRY1		(0x100)
130e75ed60cSJeff Kirsher #define TSI108_STAT_CARRY1_RXBYTES	(1 << 16)
131e75ed60cSJeff Kirsher #define TSI108_STAT_CARRY1_RXPKTS	(1 << 15)
132e75ed60cSJeff Kirsher #define TSI108_STAT_CARRY1_RXFCS	(1 << 14)
133e75ed60cSJeff Kirsher #define TSI108_STAT_CARRY1_RXMCAST	(1 << 13)
134e75ed60cSJeff Kirsher #define TSI108_STAT_CARRY1_RXALIGN	(1 << 8)
135e75ed60cSJeff Kirsher #define TSI108_STAT_CARRY1_RXLENGTH	(1 << 7)
136e75ed60cSJeff Kirsher #define TSI108_STAT_CARRY1_RXRUNT	(1 << 4)
137e75ed60cSJeff Kirsher #define TSI108_STAT_CARRY1_RXJUMBO	(1 << 3)
138e75ed60cSJeff Kirsher #define TSI108_STAT_CARRY1_RXFRAG	(1 << 2)
139e75ed60cSJeff Kirsher #define TSI108_STAT_CARRY1_RXJABBER	(1 << 1)
140e75ed60cSJeff Kirsher #define TSI108_STAT_CARRY1_RXDROP	(1 << 0)
141e75ed60cSJeff Kirsher 
142e75ed60cSJeff Kirsher #define TSI108_STAT_CARRY2		(0x104)
143e75ed60cSJeff Kirsher #define TSI108_STAT_CARRY2_TXBYTES	(1 << 13)
144e75ed60cSJeff Kirsher #define TSI108_STAT_CARRY2_TXPKTS	(1 << 12)
145e75ed60cSJeff Kirsher #define TSI108_STAT_CARRY2_TXEXDEF	(1 << 7)
146e75ed60cSJeff Kirsher #define TSI108_STAT_CARRY2_TXEXCOL	(1 << 3)
147e75ed60cSJeff Kirsher #define TSI108_STAT_CARRY2_TXTCOL	(1 << 2)
148e75ed60cSJeff Kirsher #define TSI108_STAT_CARRY2_TXPAUSE	(1 << 0)
149e75ed60cSJeff Kirsher 
150e75ed60cSJeff Kirsher #define TSI108_STAT_CARRYMASK1		(0x108)
151e75ed60cSJeff Kirsher #define TSI108_STAT_CARRYMASK2		(0x10c)
152e75ed60cSJeff Kirsher 
153e75ed60cSJeff Kirsher #define TSI108_EC_PORTCTRL		(0x200)
154e75ed60cSJeff Kirsher #define TSI108_EC_PORTCTRL_STATRST	(1 << 31)
155e75ed60cSJeff Kirsher #define TSI108_EC_PORTCTRL_STATEN	(1 << 28)
156e75ed60cSJeff Kirsher #define TSI108_EC_PORTCTRL_NOGIG	(1 << 18)
157e75ed60cSJeff Kirsher #define TSI108_EC_PORTCTRL_HALFDUPLEX	(1 << 16)
158e75ed60cSJeff Kirsher 
159e75ed60cSJeff Kirsher #define TSI108_EC_INTSTAT		(0x204)
160e75ed60cSJeff Kirsher #define TSI108_EC_INTMASK		(0x208)
161e75ed60cSJeff Kirsher 
162e75ed60cSJeff Kirsher #define TSI108_INT_ANY			(1 << 31)
163e75ed60cSJeff Kirsher #define TSI108_INT_SFN			(1 << 30)
164e75ed60cSJeff Kirsher #define TSI108_INT_RXIDLE		(1 << 29)
165e75ed60cSJeff Kirsher #define TSI108_INT_RXABORT		(1 << 28)
166e75ed60cSJeff Kirsher #define TSI108_INT_RXERROR		(1 << 27)
167e75ed60cSJeff Kirsher #define TSI108_INT_RXOVERRUN		(1 << 26)
168e75ed60cSJeff Kirsher #define TSI108_INT_RXTHRESH		(1 << 25)
169e75ed60cSJeff Kirsher #define TSI108_INT_RXWAIT		(1 << 24)
170e75ed60cSJeff Kirsher #define TSI108_INT_RXQUEUE0		(1 << 16)
171e75ed60cSJeff Kirsher #define TSI108_INT_STATCARRY		(1 << 15)
172e75ed60cSJeff Kirsher #define TSI108_INT_TXIDLE		(1 << 13)
173e75ed60cSJeff Kirsher #define TSI108_INT_TXABORT		(1 << 12)
174e75ed60cSJeff Kirsher #define TSI108_INT_TXERROR		(1 << 11)
175e75ed60cSJeff Kirsher #define TSI108_INT_TXUNDERRUN		(1 << 10)
176e75ed60cSJeff Kirsher #define TSI108_INT_TXTHRESH		(1 <<  9)
177e75ed60cSJeff Kirsher #define TSI108_INT_TXWAIT		(1 <<  8)
178e75ed60cSJeff Kirsher #define TSI108_INT_TXQUEUE0		(1 <<  0)
179e75ed60cSJeff Kirsher 
180e75ed60cSJeff Kirsher #define TSI108_EC_TXCFG			(0x220)
181e75ed60cSJeff Kirsher #define TSI108_EC_TXCFG_RST		(1 << 31)
182e75ed60cSJeff Kirsher 
183e75ed60cSJeff Kirsher #define TSI108_EC_TXCTRL		(0x224)
184e75ed60cSJeff Kirsher #define TSI108_EC_TXCTRL_IDLEINT	(1 << 31)
185e75ed60cSJeff Kirsher #define TSI108_EC_TXCTRL_ABORT		(1 << 30)
186e75ed60cSJeff Kirsher #define TSI108_EC_TXCTRL_GO		(1 << 15)
187e75ed60cSJeff Kirsher #define TSI108_EC_TXCTRL_QUEUE0		(1 <<  0)
188e75ed60cSJeff Kirsher 
189e75ed60cSJeff Kirsher #define TSI108_EC_TXSTAT		(0x228)
190e75ed60cSJeff Kirsher #define TSI108_EC_TXSTAT_ACTIVE		(1 << 15)
191e75ed60cSJeff Kirsher #define TSI108_EC_TXSTAT_QUEUE0		(1 << 0)
192e75ed60cSJeff Kirsher 
193e75ed60cSJeff Kirsher #define TSI108_EC_TXESTAT		(0x22c)
194e75ed60cSJeff Kirsher #define TSI108_EC_TXESTAT_Q0_ERR	(1 << 24)
195e75ed60cSJeff Kirsher #define TSI108_EC_TXESTAT_Q0_DESCINT	(1 << 16)
196e75ed60cSJeff Kirsher #define TSI108_EC_TXESTAT_Q0_EOF	(1 <<  8)
197e75ed60cSJeff Kirsher #define TSI108_EC_TXESTAT_Q0_EOQ	(1 <<  0)
198e75ed60cSJeff Kirsher 
199e75ed60cSJeff Kirsher #define TSI108_EC_TXERR			(0x278)
200e75ed60cSJeff Kirsher 
201e75ed60cSJeff Kirsher #define TSI108_EC_TXQ_CFG		(0x280)
202e75ed60cSJeff Kirsher #define TSI108_EC_TXQ_CFG_DESC_INT	(1 << 20)
203e75ed60cSJeff Kirsher #define TSI108_EC_TXQ_CFG_EOQ_OWN_INT	(1 << 19)
204e75ed60cSJeff Kirsher #define TSI108_EC_TXQ_CFG_WSWP		(1 << 11)
205e75ed60cSJeff Kirsher #define TSI108_EC_TXQ_CFG_BSWP		(1 << 10)
206e75ed60cSJeff Kirsher #define TSI108_EC_TXQ_CFG_SFNPORT	0
207e75ed60cSJeff Kirsher 
208e75ed60cSJeff Kirsher #define TSI108_EC_TXQ_BUFCFG		(0x284)
209e75ed60cSJeff Kirsher #define TSI108_EC_TXQ_BUFCFG_BURST8	(0 << 8)
210e75ed60cSJeff Kirsher #define TSI108_EC_TXQ_BUFCFG_BURST32	(1 << 8)
211e75ed60cSJeff Kirsher #define TSI108_EC_TXQ_BUFCFG_BURST128	(2 << 8)
212e75ed60cSJeff Kirsher #define TSI108_EC_TXQ_BUFCFG_BURST256	(3 << 8)
213e75ed60cSJeff Kirsher #define TSI108_EC_TXQ_BUFCFG_WSWP	(1 << 11)
214e75ed60cSJeff Kirsher #define TSI108_EC_TXQ_BUFCFG_BSWP	(1 << 10)
215e75ed60cSJeff Kirsher #define TSI108_EC_TXQ_BUFCFG_SFNPORT	0
216e75ed60cSJeff Kirsher 
217e75ed60cSJeff Kirsher #define TSI108_EC_TXQ_PTRLOW		(0x288)
218e75ed60cSJeff Kirsher 
219e75ed60cSJeff Kirsher #define TSI108_EC_TXQ_PTRHIGH		(0x28c)
220e75ed60cSJeff Kirsher #define TSI108_EC_TXQ_PTRHIGH_VALID	(1 << 31)
221e75ed60cSJeff Kirsher 
222e75ed60cSJeff Kirsher #define TSI108_EC_TXTHRESH		(0x230)
223e75ed60cSJeff Kirsher #define TSI108_EC_TXTHRESH_STARTFILL	0
224e75ed60cSJeff Kirsher #define TSI108_EC_TXTHRESH_STOPFILL	16
225e75ed60cSJeff Kirsher 
226e75ed60cSJeff Kirsher #define TSI108_EC_RXCFG			(0x320)
227e75ed60cSJeff Kirsher #define TSI108_EC_RXCFG_RST		(1 << 31)
228e75ed60cSJeff Kirsher 
229e75ed60cSJeff Kirsher #define TSI108_EC_RXSTAT		(0x328)
230e75ed60cSJeff Kirsher #define TSI108_EC_RXSTAT_ACTIVE		(1 << 15)
231e75ed60cSJeff Kirsher #define TSI108_EC_RXSTAT_QUEUE0		(1 << 0)
232e75ed60cSJeff Kirsher 
233e75ed60cSJeff Kirsher #define TSI108_EC_RXESTAT		(0x32c)
234e75ed60cSJeff Kirsher #define TSI108_EC_RXESTAT_Q0_ERR	(1 << 24)
235e75ed60cSJeff Kirsher #define TSI108_EC_RXESTAT_Q0_DESCINT	(1 << 16)
236e75ed60cSJeff Kirsher #define TSI108_EC_RXESTAT_Q0_EOF	(1 <<  8)
237e75ed60cSJeff Kirsher #define TSI108_EC_RXESTAT_Q0_EOQ	(1 <<  0)
238e75ed60cSJeff Kirsher 
239e75ed60cSJeff Kirsher #define TSI108_EC_HASHADDR		(0x360)
240e75ed60cSJeff Kirsher #define TSI108_EC_HASHADDR_AUTOINC	(1 << 31)
241e75ed60cSJeff Kirsher #define TSI108_EC_HASHADDR_DO1STREAD	(1 << 30)
242e75ed60cSJeff Kirsher #define TSI108_EC_HASHADDR_UNICAST	(0 <<  4)
243e75ed60cSJeff Kirsher #define TSI108_EC_HASHADDR_MCAST	(1 <<  4)
244e75ed60cSJeff Kirsher 
245e75ed60cSJeff Kirsher #define TSI108_EC_HASHDATA		(0x364)
246e75ed60cSJeff Kirsher 
247e75ed60cSJeff Kirsher #define TSI108_EC_RXQ_PTRLOW		(0x388)
248e75ed60cSJeff Kirsher 
249e75ed60cSJeff Kirsher #define TSI108_EC_RXQ_PTRHIGH		(0x38c)
250e75ed60cSJeff Kirsher #define TSI108_EC_RXQ_PTRHIGH_VALID	(1 << 31)
251e75ed60cSJeff Kirsher 
252e75ed60cSJeff Kirsher /* Station Enable -- accept packets destined for us */
253e75ed60cSJeff Kirsher #define TSI108_EC_RXCFG_SE		(1 << 13)
254e75ed60cSJeff Kirsher /* Unicast Frame Enable -- for packets not destined for us */
255e75ed60cSJeff Kirsher #define TSI108_EC_RXCFG_UFE		(1 << 12)
256e75ed60cSJeff Kirsher /* Multicast Frame Enable */
257e75ed60cSJeff Kirsher #define TSI108_EC_RXCFG_MFE		(1 << 11)
258e75ed60cSJeff Kirsher /* Broadcast Frame Enable */
259e75ed60cSJeff Kirsher #define TSI108_EC_RXCFG_BFE		(1 << 10)
260e75ed60cSJeff Kirsher #define TSI108_EC_RXCFG_UC_HASH		(1 <<  9)
261e75ed60cSJeff Kirsher #define TSI108_EC_RXCFG_MC_HASH		(1 <<  8)
262e75ed60cSJeff Kirsher 
263e75ed60cSJeff Kirsher #define TSI108_EC_RXQ_CFG		(0x380)
264e75ed60cSJeff Kirsher #define TSI108_EC_RXQ_CFG_DESC_INT	(1 << 20)
265e75ed60cSJeff Kirsher #define TSI108_EC_RXQ_CFG_EOQ_OWN_INT	(1 << 19)
266e75ed60cSJeff Kirsher #define TSI108_EC_RXQ_CFG_WSWP		(1 << 11)
267e75ed60cSJeff Kirsher #define TSI108_EC_RXQ_CFG_BSWP		(1 << 10)
268e75ed60cSJeff Kirsher #define TSI108_EC_RXQ_CFG_SFNPORT	0
269e75ed60cSJeff Kirsher 
270e75ed60cSJeff Kirsher #define TSI108_EC_RXQ_BUFCFG		(0x384)
271e75ed60cSJeff Kirsher #define TSI108_EC_RXQ_BUFCFG_BURST8	(0 << 8)
272e75ed60cSJeff Kirsher #define TSI108_EC_RXQ_BUFCFG_BURST32	(1 << 8)
273e75ed60cSJeff Kirsher #define TSI108_EC_RXQ_BUFCFG_BURST128	(2 << 8)
274e75ed60cSJeff Kirsher #define TSI108_EC_RXQ_BUFCFG_BURST256	(3 << 8)
275e75ed60cSJeff Kirsher #define TSI108_EC_RXQ_BUFCFG_WSWP	(1 << 11)
276e75ed60cSJeff Kirsher #define TSI108_EC_RXQ_BUFCFG_BSWP	(1 << 10)
277e75ed60cSJeff Kirsher #define TSI108_EC_RXQ_BUFCFG_SFNPORT	0
278e75ed60cSJeff Kirsher 
279e75ed60cSJeff Kirsher #define TSI108_EC_RXCTRL		(0x324)
280e75ed60cSJeff Kirsher #define TSI108_EC_RXCTRL_ABORT		(1 << 30)
281e75ed60cSJeff Kirsher #define TSI108_EC_RXCTRL_GO		(1 << 15)
282e75ed60cSJeff Kirsher #define TSI108_EC_RXCTRL_QUEUE0		(1 << 0)
283e75ed60cSJeff Kirsher 
284e75ed60cSJeff Kirsher #define TSI108_EC_RXERR			(0x378)
285e75ed60cSJeff Kirsher 
286e75ed60cSJeff Kirsher #define TSI108_TX_EOF	(1 << 0)	/* End of frame; last fragment of packet */
287e75ed60cSJeff Kirsher #define TSI108_TX_SOF	(1 << 1)	/* Start of frame; first frag. of packet */
288e75ed60cSJeff Kirsher #define TSI108_TX_VLAN	(1 << 2)	/* Per-frame VLAN: enables VLAN override */
289e75ed60cSJeff Kirsher #define TSI108_TX_HUGE	(1 << 3)	/* Huge frame enable */
290e75ed60cSJeff Kirsher #define TSI108_TX_PAD	(1 << 4)	/* Pad the packet if too short */
291e75ed60cSJeff Kirsher #define TSI108_TX_CRC	(1 << 5)	/* Generate CRC for this packet */
292e75ed60cSJeff Kirsher #define TSI108_TX_INT	(1 << 14)	/* Generate an IRQ after frag. processed */
293e75ed60cSJeff Kirsher #define TSI108_TX_RETRY	(0xf << 16)	/* 4 bit field indicating num. of retries */
294e75ed60cSJeff Kirsher #define TSI108_TX_COL	(1 << 20)	/* Set if a collision occurred */
295e75ed60cSJeff Kirsher #define TSI108_TX_LCOL	(1 << 24)	/* Set if a late collision occurred */
296e75ed60cSJeff Kirsher #define TSI108_TX_UNDER	(1 << 25)	/* Set if a FIFO underrun occurred */
297e75ed60cSJeff Kirsher #define TSI108_TX_RLIM	(1 << 26)	/* Set if the retry limit was reached */
298e75ed60cSJeff Kirsher #define TSI108_TX_OK	(1 << 30)	/* Set if the frame TX was successful */
299e75ed60cSJeff Kirsher #define TSI108_TX_OWN	(1 << 31)	/* Set if the device owns the descriptor */
300e75ed60cSJeff Kirsher 
301e75ed60cSJeff Kirsher /* Note: the descriptor layouts assume big-endian byte order. */
302e75ed60cSJeff Kirsher typedef struct {
303e75ed60cSJeff Kirsher 	u32 buf0;
304e75ed60cSJeff Kirsher 	u32 buf1;		/* Base address of buffer */
305e75ed60cSJeff Kirsher 	u32 next0;		/* Address of next descriptor, if any */
306e75ed60cSJeff Kirsher 	u32 next1;
307e75ed60cSJeff Kirsher 	u16 vlan;		/* VLAN, if override enabled for this packet */
308e75ed60cSJeff Kirsher 	u16 len;		/* Length of buffer in bytes */
309e75ed60cSJeff Kirsher 	u32 misc;		/* See TSI108_TX_* above */
310e75ed60cSJeff Kirsher 	u32 reserved0;		/*reserved0 and reserved1 are added to make the desc */
311e75ed60cSJeff Kirsher 	u32 reserved1;		/* 32-byte aligned */
312e75ed60cSJeff Kirsher } __attribute__ ((aligned(32))) tx_desc;
313e75ed60cSJeff Kirsher 
314e75ed60cSJeff Kirsher #define TSI108_RX_EOF	(1 << 0)	/* End of frame; last fragment of packet */
315e75ed60cSJeff Kirsher #define TSI108_RX_SOF	(1 << 1)	/* Start of frame; first frag. of packet */
316e75ed60cSJeff Kirsher #define TSI108_RX_VLAN	(1 << 2)	/* Set on SOF if packet has a VLAN */
317e75ed60cSJeff Kirsher #define TSI108_RX_FTYPE	(1 << 3)	/* Length/Type field is type, not length */
318e75ed60cSJeff Kirsher #define TSI108_RX_RUNT	(1 << 4)/* Packet is less than minimum size */
319e75ed60cSJeff Kirsher #define TSI108_RX_HASH	(1 << 7)/* Hash table match */
320e75ed60cSJeff Kirsher #define TSI108_RX_BAD	(1 << 8)	/* Bad frame */
321e75ed60cSJeff Kirsher #define TSI108_RX_OVER	(1 << 9)	/* FIFO overrun occurred */
322e75ed60cSJeff Kirsher #define TSI108_RX_TRUNC	(1 << 11)	/* Packet truncated due to excess length */
323e75ed60cSJeff Kirsher #define TSI108_RX_CRC	(1 << 12)	/* Packet had a CRC error */
324e75ed60cSJeff Kirsher #define TSI108_RX_INT	(1 << 13)	/* Generate an IRQ after frag. processed */
325e75ed60cSJeff Kirsher #define TSI108_RX_OWN	(1 << 15)	/* Set if the device owns the descriptor */
326e75ed60cSJeff Kirsher 
327e75ed60cSJeff Kirsher #define TSI108_RX_SKB_SIZE 1536		/* The RX skb length */
328e75ed60cSJeff Kirsher 
329e75ed60cSJeff Kirsher typedef struct {
330e75ed60cSJeff Kirsher 	u32 buf0;		/* Base address of buffer */
331e75ed60cSJeff Kirsher 	u32 buf1;		/* Base address of buffer */
332e75ed60cSJeff Kirsher 	u32 next0;		/* Address of next descriptor, if any */
333e75ed60cSJeff Kirsher 	u32 next1;		/* Address of next descriptor, if any */
334e75ed60cSJeff Kirsher 	u16 vlan;		/* VLAN of received packet, first frag only */
335e75ed60cSJeff Kirsher 	u16 len;		/* Length of received fragment in bytes */
336e75ed60cSJeff Kirsher 	u16 blen;		/* Length of buffer in bytes */
337e75ed60cSJeff Kirsher 	u16 misc;		/* See TSI108_RX_* above */
338e75ed60cSJeff Kirsher 	u32 reserved0;		/* reserved0 and reserved1 are added to make the desc */
339e75ed60cSJeff Kirsher 	u32 reserved1;		/* 32-byte aligned */
340e75ed60cSJeff Kirsher } __attribute__ ((aligned(32))) rx_desc;
341e75ed60cSJeff Kirsher 
342e75ed60cSJeff Kirsher #endif				/* __TSI108_ETH_H */
343