aereg.h revision 1.1 1 1.1 gdamore /* $NetBSD: aereg.h,v 1.1 2006/03/21 08:15:19 gdamore Exp $ */
2 1.1 gdamore
3 1.1 gdamore /*-
4 1.1 gdamore * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
5 1.1 gdamore * All rights reserved.
6 1.1 gdamore *
7 1.1 gdamore * This code is derived from software contributed to The NetBSD Foundation
8 1.1 gdamore * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 1.1 gdamore * NASA Ames Research Center.
10 1.1 gdamore *
11 1.1 gdamore * Redistribution and use in source and binary forms, with or without
12 1.1 gdamore * modification, are permitted provided that the following conditions
13 1.1 gdamore * are met:
14 1.1 gdamore * 1. Redistributions of source code must retain the above copyright
15 1.1 gdamore * notice, this list of conditions and the following disclaimer.
16 1.1 gdamore * 2. Redistributions in binary form must reproduce the above copyright
17 1.1 gdamore * notice, this list of conditions and the following disclaimer in the
18 1.1 gdamore * documentation and/or other materials provided with the distribution.
19 1.1 gdamore * 3. All advertising materials mentioning features or use of this software
20 1.1 gdamore * must display the following acknowledgement:
21 1.1 gdamore * This product includes software developed by the NetBSD
22 1.1 gdamore * Foundation, Inc. and its contributors.
23 1.1 gdamore * 4. Neither the name of The NetBSD Foundation nor the names of its
24 1.1 gdamore * contributors may be used to endorse or promote products derived
25 1.1 gdamore * from this software without specific prior written permission.
26 1.1 gdamore *
27 1.1 gdamore * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
28 1.1 gdamore * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
29 1.1 gdamore * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 1.1 gdamore * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
31 1.1 gdamore * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 1.1 gdamore * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 1.1 gdamore * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 1.1 gdamore * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 1.1 gdamore * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 1.1 gdamore * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 1.1 gdamore * POSSIBILITY OF SUCH DAMAGE.
38 1.1 gdamore */
39 1.1 gdamore
40 1.1 gdamore #ifndef _MIPS_ATHEROS_DEV_AEREG_H_
41 1.1 gdamore #define _MIPS_ATHEROS_DEV_AEREG_H_
42 1.1 gdamore
43 1.1 gdamore /*
44 1.1 gdamore * This device is much like a standard Tulip Ethernet chip, but it is
45 1.1 gdamore * an on-chip core on the AR5312 processors. It differs in having two
46 1.1 gdamore * register windows, and the details of some of the contents of those
47 1.1 gdamore * registers. It has about 80% in common to a typical tulip.
48 1.1 gdamore */
49 1.1 gdamore
50 1.1 gdamore /*
51 1.1 gdamore * Buffer descriptor. Must be 4-byte aligned.
52 1.1 gdamore *
53 1.1 gdamore * Note for receive descriptors, the byte count fields must
54 1.1 gdamore * be a multiple of 4.
55 1.1 gdamore */
56 1.1 gdamore struct ae_desc {
57 1.1 gdamore volatile u_int32_t ad_status; /* Status */
58 1.1 gdamore volatile u_int32_t ad_ctl; /* Control and Byte Counts */
59 1.1 gdamore volatile u_int32_t ad_bufaddr1; /* Buffer Address 1 */
60 1.1 gdamore volatile u_int32_t ad_bufaddr2; /* Buffer Address 2 */
61 1.1 gdamore };
62 1.1 gdamore
63 1.1 gdamore /*
64 1.1 gdamore * Descriptor Status bits common to transmit and receive.
65 1.1 gdamore */
66 1.1 gdamore #define ADSTAT_OWN 0x80000000 /* Tulip owns descriptor */
67 1.1 gdamore #define ADSTAT_ES 0x00008000 /* Error Summary */
68 1.1 gdamore
69 1.1 gdamore /*
70 1.1 gdamore * Descriptor Status bits for Receive Descriptor.
71 1.1 gdamore */
72 1.1 gdamore #define ADSTAT_Rx_FF 0x40000000 /* Filtering Fail */
73 1.1 gdamore #define ADSTAT_Rx_FL 0x3fff0000 /* Frame Length including CRC */
74 1.1 gdamore #define ADSTAT_Rx_DE 0x00004000 /* Descriptor Error */
75 1.1 gdamore #define ADSTAT_Rx_LE 0x00001000 /* Length Error */
76 1.1 gdamore #define ADSTAT_Rx_RF 0x00000800 /* Runt Frame */
77 1.1 gdamore #define ADSTAT_Rx_MF 0x00000400 /* Multicast Frame */
78 1.1 gdamore #define ADSTAT_Rx_FS 0x00000200 /* First Descriptor */
79 1.1 gdamore #define ADSTAT_Rx_LS 0x00000100 /* Last Descriptor */
80 1.1 gdamore #define ADSTAT_Rx_TL 0x00000080 /* Frame Too Long */
81 1.1 gdamore #define ADSTAT_Rx_CS 0x00000040 /* Collision Seen */
82 1.1 gdamore #define ADSTAT_Rx_RT 0x00000020 /* Frame Type */
83 1.1 gdamore #define ADSTAT_Rx_RW 0x00000010 /* Receive Watchdog */
84 1.1 gdamore #define ADSTAT_Rx_RE 0x00000008 /* Report on MII Error */
85 1.1 gdamore #define ADSTAT_Rx_DB 0x00000004 /* Dribbling Bit */
86 1.1 gdamore #define ADSTAT_Rx_CE 0x00000002 /* CRC Error */
87 1.1 gdamore #define ADSTAT_Rx_ZER 0x00000001 /* Zero (always 0) */
88 1.1 gdamore
89 1.1 gdamore #define ADSTAT_Rx_LENGTH(x) (((x) & ADSTAT_Rx_FL) >> 16)
90 1.1 gdamore
91 1.1 gdamore /*
92 1.1 gdamore * Descriptor Status bits for Transmit Descriptor.
93 1.1 gdamore */
94 1.1 gdamore #define ADSTAT_Tx_TO 0x00004000 /* Transmit Jabber Timeout */
95 1.1 gdamore #define ADSTAT_Tx_LO 0x00000800 /* Loss of Carrier */
96 1.1 gdamore #define ADSTAT_Tx_NC 0x00000400 /* No Carrier */
97 1.1 gdamore #define ADSTAT_Tx_LC 0x00000200 /* Late Collision */
98 1.1 gdamore #define ADSTAT_Tx_EC 0x00000100 /* Excessive Collisions */
99 1.1 gdamore #define ADSTAT_Tx_HF 0x00000080 /* Heartbeat Fail */
100 1.1 gdamore #define ADSTAT_Tx_CC 0x00000078 /* Collision Count */
101 1.1 gdamore #define ADSTAT_Tx_ED 0x00000004 /* Excessive Deferral */
102 1.1 gdamore #define ADSTAT_Tx_UF 0x00000002 /* Underflow Error */
103 1.1 gdamore #define ADSTAT_Tx_DE 0x00000001 /* Deferred */
104 1.1 gdamore
105 1.1 gdamore #define ADSTAT_Tx_COLLISIONS(x) (((x) & ADSTAT_Tx_CC) >> 3)
106 1.1 gdamore
107 1.1 gdamore /*
108 1.1 gdamore * Descriptor Control bits common to transmit and receive.
109 1.1 gdamore */
110 1.1 gdamore #define ADCTL_SIZE1 0x000007ff /* Size of buffer 1 */
111 1.1 gdamore #define ADCTL_SIZE1_SHIFT 0
112 1.1 gdamore
113 1.1 gdamore #define ADCTL_SIZE2 0x003ff800 /* Size of buffer 2 */
114 1.1 gdamore #define ADCTL_SIZE2_SHIFT 11
115 1.1 gdamore
116 1.1 gdamore #define ADCTL_ER 0x02000000 /* End of Ring */
117 1.1 gdamore #define ADCTL_CH 0x01000000 /* Second Address Chained */
118 1.1 gdamore
119 1.1 gdamore /*
120 1.1 gdamore * Descriptor Control bits for Transmit Descriptor.
121 1.1 gdamore */
122 1.1 gdamore #define ADCTL_Tx_IC 0x80000000 /* Interrupt on Completion */
123 1.1 gdamore #define ADCTL_Tx_LS 0x40000000 /* Last Segment */
124 1.1 gdamore #define ADCTL_Tx_FS 0x20000000 /* First Segment */
125 1.1 gdamore #define ADCTL_Tx_AC 0x04000000 /* Add CRC Disable */
126 1.1 gdamore #define ADCTL_Tx_DPD 0x00800000 /* Disabled Padding */
127 1.1 gdamore
128 1.1 gdamore /*
129 1.1 gdamore * Control registers.
130 1.1 gdamore */
131 1.1 gdamore
132 1.1 gdamore /* tese are registers only found on this part */
133 1.1 gdamore #define CSR_MACCTL 0x0000 /* mac control */
134 1.1 gdamore #define CSR_MACHI 0x0004
135 1.1 gdamore #define CSR_MACLO 0x0008
136 1.1 gdamore #define CSR_HTHI 0x000C /* multicast table high */
137 1.1 gdamore #define CSR_HTLO 0x0010 /* multicast table low */
138 1.1 gdamore #define CSR_MIIADDR 0x0014 /* mii address */
139 1.1 gdamore #define CSR_MIIDATA 0x0018 /* mii data */
140 1.1 gdamore #define CSR_FLOWC 0x001C /* flow control */
141 1.1 gdamore #define CSR_VL1 0x0020 /* vlan 1 tag */
142 1.1 gdamore
143 1.1 gdamore /* these are more or less normal Tulip registers */
144 1.1 gdamore #define CSR_BUSMODE 0x1000 /* bus mode */
145 1.1 gdamore #define CSR_TXPOLL 0x1004 /* tx poll demand */
146 1.1 gdamore #define CSR_RXPOLL 0x1008 /* rx poll demand */
147 1.1 gdamore #define CSR_RXLIST 0x100C /* rx base descriptor address */
148 1.1 gdamore #define CSR_TXLIST 0x1010 /* tx base descriptor address */
149 1.1 gdamore #define CSR_STATUS 0x1014 /* (interrupt) status */
150 1.1 gdamore #define CSR_OPMODE 0x1018 /* operation mode */
151 1.1 gdamore #define CSR_INTEN 0x101C /* interrupt enable */
152 1.1 gdamore #define CSR_MISSED 0x1020 /* missed frame counter */
153 1.1 gdamore #define CSR_HTBA 0x1050 /* host tx buffer address (ro) */
154 1.1 gdamore #define CSR_HRBA 0x1054 /* host rx buffer address (ro) */
155 1.1 gdamore
156 1.1 gdamore /* CSR_MACCTL - Mac Control */
157 1.1 gdamore #define MACCTL_RE 0x00000004 /* rx enable */
158 1.1 gdamore #define MACCTL_TE 0x00000008 /* tx enable */
159 1.1 gdamore #define MACCTL_DC 0x00000020 /* deferral check */
160 1.1 gdamore #define MACCTL_PSTR 0x00000100 /* automatic pad strip */
161 1.1 gdamore #define MACCTL_DTRY 0x00000400 /* disable retry */
162 1.1 gdamore #define MACCTL_DBF 0x00000800 /* disable broadcast frames */
163 1.1 gdamore #define MACCTL_LCC 0x00001000 /* late collision control */
164 1.1 gdamore #define MACCTL_HASH 0x00002000 /* hash filtering enable */
165 1.1 gdamore #define MACCTL_HO 0x00008000 /* disable perfect filtering */
166 1.1 gdamore #define MACCTL_PB 0x00010000 /* pass bad frames */
167 1.1 gdamore #define MACCTL_IF 0x00020000 /* inverse filtering */
168 1.1 gdamore #define MACCTL_PR 0x00040000 /* promiscuous mode */
169 1.1 gdamore #define MACCTL_PM 0x00080000 /* pass all multicast */
170 1.1 gdamore #define MACCTL_FDX 0x00100000 /* full duplex mode */
171 1.1 gdamore #define MACCTL_LOOP 0x00600000 /* loopback mask */
172 1.1 gdamore #define MACCTL_LOOP_INT 0x00200000 /* internal loopback */
173 1.1 gdamore #define MACCTL_LOOP_EXT 0x00400000 /* external loopback */
174 1.1 gdamore #define MACCTL_LOOP_NONE 0x00000000
175 1.1 gdamore #define MACCTL_DRO 0x00800000 /* disable receive own */
176 1.1 gdamore #define MACCTL_PS 0x08000000 /* port select, 0 = mii */
177 1.1 gdamore #define MACCTL_HBD 0x10000000 /* heartbeat disable */
178 1.1 gdamore #define MACCTL_BLE 0x40000000 /* mac big endian */
179 1.1 gdamore #define MACCTL_RA 0x80000000 /* receive all packets */
180 1.1 gdamore
181 1.1 gdamore /* CSR_MIIADDR - MII Addess */
182 1.1 gdamore #define MIIADDR_BUSY 0x00000001 /* mii busy */
183 1.1 gdamore #define MIIADDR_WRITE 0x00000002 /* mii write */
184 1.1 gdamore #define MIIADDR_REG_MASK 0x000007C0 /* mii register */
185 1.1 gdamore #define MIIADDR_REG_SHIFT 6
186 1.1 gdamore #define MIIADDR_PHY_MASK 0x0000F800 /* mii phy */
187 1.1 gdamore #define MIIADDR_PHY_SHIFT 11
188 1.1 gdamore
189 1.1 gdamore #define MIIADDR_GETREG(x) (((x) & MIIADDR_REG) >> 6)
190 1.1 gdamore #define MIIADDR_PUTREG(x) (((x) << 6) & MIIADR_REG)
191 1.1 gdamore #define MIIADDR_GETPHY(x) (((x) & MIIADDR_PHY) >> 11)
192 1.1 gdamore #define MIIADDR_PUTPHY(x) (((x) << 6) & MIIADR_PHY)
193 1.1 gdamore
194 1.1 gdamore /* CSR_FLOWC - Flow Control */
195 1.1 gdamore #define FLOWC_FCB 0x00000001 /* flow control busy */
196 1.1 gdamore #define FLOWC_FCE 0x00000002 /* flow control enable */
197 1.1 gdamore #define FLOWC_PCF 0x00000004 /* pass control frames */
198 1.1 gdamore #define FLOWC_PT 0xffff0000 /* pause time */
199 1.1 gdamore
200 1.1 gdamore /* CSR_BUSMODE - Bus Mode */
201 1.1 gdamore #define BUSMODE_SWR 0x00000001 /* software reset */
202 1.1 gdamore #define BUSMODE_BAR 0x00000002 /* bus arbitration */
203 1.1 gdamore #define BUSMODE_DSL 0x0000007c /* descriptor skip length */
204 1.1 gdamore #define BUSMODE_BLE 0x00000080 /* data buf endian */
205 1.1 gdamore /* programmable burst length */
206 1.1 gdamore #define BUSMODE_PBL_DEFAULT 0x00000000 /* default value */
207 1.1 gdamore #define BUSMODE_PBL_1LW 0x00000100 /* 1 longword */
208 1.1 gdamore #define BUSMODE_PBL_2LW 0x00000200 /* 2 longwords */
209 1.1 gdamore #define BUSMODE_PBL_4LW 0x00000400 /* 4 longwords */
210 1.1 gdamore #define BUSMODE_PBL_8LW 0x00000800 /* 8 longwords */
211 1.1 gdamore #define BUSMODE_PBL_16LW 0x00001000 /* 16 longwords */
212 1.1 gdamore #define BUSMODE_PBL_32LW 0x00002000 /* 32 longwords */
213 1.1 gdamore #define BUSMODE_DBO 0x00100000 /* descriptor endian */
214 1.1 gdamore #define BUSMODE_ALIGN_16B 0x01000000 /* force oddhw rx buf align */
215 1.1 gdamore
216 1.1 gdamore /* CSR_TXPOLL - Transmit Poll Demand */
217 1.1 gdamore #define TXPOLL_TPD 0x00000001 /* transmit poll demand */
218 1.1 gdamore
219 1.1 gdamore
220 1.1 gdamore /* CSR_RXPOLL - Receive Poll Demand */
221 1.1 gdamore #define RXPOLL_RPD 0x00000001 /* receive poll demand */
222 1.1 gdamore
223 1.1 gdamore /* CSR_STATUS - Status */
224 1.1 gdamore #define STATUS_TI 0x00000001 /* transmit interrupt */
225 1.1 gdamore #define STATUS_TPS 0x00000002 /* transmit process stopped */
226 1.1 gdamore #define STATUS_TU 0x00000004 /* transmit buffer unavail */
227 1.1 gdamore #define STATUS_TJT 0x00000008 /* transmit jabber timeout */
228 1.1 gdamore #define STATUS_UNF 0x00000020 /* transmit underflow */
229 1.1 gdamore #define STATUS_RI 0x00000040 /* receive interrupt */
230 1.1 gdamore #define STATUS_RU 0x00000080 /* receive buffer unavail */
231 1.1 gdamore #define STATUS_RPS 0x00000100 /* receive process stopped */
232 1.1 gdamore #define STATUS_ETI 0x00000400 /* early transmit interrupt */
233 1.1 gdamore #define STATUS_SE 0x00002000 /* system error */
234 1.1 gdamore #define STATUS_ER 0x00004000 /* early receive (21041) */
235 1.1 gdamore #define STATUS_AIS 0x00008000 /* abnormal intr summary */
236 1.1 gdamore #define STATUS_NIS 0x00010000 /* normal interrupt summary */
237 1.1 gdamore #define STATUS_RS 0x000e0000 /* receive process state */
238 1.1 gdamore #define STATUS_RS_STOPPED 0x00000000 /* Stopped */
239 1.1 gdamore #define STATUS_RS_FETCH 0x00020000 /* Running - fetch receive
240 1.1 gdamore descriptor */
241 1.1 gdamore #define STATUS_RS_CHECK 0x00040000 /* Running - check for end
242 1.1 gdamore of receive */
243 1.1 gdamore #define STATUS_RS_WAIT 0x00060000 /* Running - wait for packet */
244 1.1 gdamore #define STATUS_RS_SUSPENDED 0x00080000 /* Suspended */
245 1.1 gdamore #define STATUS_RS_CLOSE 0x000a0000 /* Running - close receive
246 1.1 gdamore descriptor */
247 1.1 gdamore #define STATUS_RS_FLUSH 0x000c0000 /* Running - flush current
248 1.1 gdamore frame from FIFO */
249 1.1 gdamore #define STATUS_RS_QUEUE 0x000e0000 /* Running - queue current
250 1.1 gdamore frame from FIFO into
251 1.1 gdamore buffer */
252 1.1 gdamore #define STATUS_TS 0x00700000 /* transmit process state */
253 1.1 gdamore #define STATUS_TS_STOPPED 0x00000000 /* Stopped */
254 1.1 gdamore #define STATUS_TS_FETCH 0x00100000 /* Running - fetch transmit
255 1.1 gdamore descriptor */
256 1.1 gdamore #define STATUS_TS_WAIT 0x00200000 /* Running - wait for end
257 1.1 gdamore of transmission */
258 1.1 gdamore #define STATUS_TS_READING 0x00300000 /* Running - read buffer from
259 1.1 gdamore memory and queue into
260 1.1 gdamore FIFO */
261 1.1 gdamore #define STATUS_TS_SUSPENDED 0x00600000 /* Suspended */
262 1.1 gdamore #define STATUS_TS_CLOSE 0x00700000 /* Running - close transmit
263 1.1 gdamore descriptor */
264 1.1 gdamore #define STATUS_TX_ABORT 0x00800000 /* Transmit bus abort */
265 1.1 gdamore #define STATUS_RX_ABORT 0x01000000 /* Transmit bus abort */
266 1.1 gdamore
267 1.1 gdamore /* CSR_OPMODE - Operation Mode */
268 1.1 gdamore #define OPMODE_SR 0x00000002 /* start receive */
269 1.1 gdamore #define OPMODE_OSF 0x00000004 /* operate on second frame */
270 1.1 gdamore #define OPMODE_ST 0x00002000 /* start transmitter */
271 1.1 gdamore #define OPMODE_TR 0x0000c000 /* threshold control */
272 1.1 gdamore #define OPMODE_TR_32 0x00000000 /* 32 words */
273 1.1 gdamore #define OPMODE_TR_64 0x00004000 /* 64 words */
274 1.1 gdamore #define OPMODE_TR_128 0x00008000 /* 128 words */
275 1.1 gdamore #define OPMODE_TR_256 0x0000c000 /* 256 words */
276 1.1 gdamore #define OPMODE_SF 0x00200000 /* store and forward mode */
277 1.1 gdamore
278 1.1 gdamore /* CSR_INTEN - Interrupt Enable */
279 1.1 gdamore /* See bits for CSR_STATUS -- Status */
280 1.1 gdamore
281 1.1 gdamore
282 1.1 gdamore /* CSR_MISSED - Missed Frames */
283 1.1 gdamore #define MISSED_MFC 0xffff0000 /* missed packet count */
284 1.1 gdamore #define MISSED_FOC 0x0000ffff /* fifo overflow counter */
285 1.1 gdamore
286 1.1 gdamore #define MISSED_GETMFC(x) ((x) & MISSED_MFC)
287 1.1 gdamore #define MISSED_GETFOC(x) (((x) & MISSED_FOC) >> 16)
288 1.1 gdamore
289 1.1 gdamore #endif /* _MIPS_ATHEROS_DEV_AEREG_H_ */
290