dp83932reg.h revision 1.7 1 1.7 martin /* $NetBSD: dp83932reg.h,v 1.7 2008/04/28 20:23:49 martin Exp $ */
2 1.1 thorpej
3 1.1 thorpej /*-
4 1.1 thorpej * Copyright (c) 2001 The NetBSD Foundation, Inc.
5 1.1 thorpej * All rights reserved.
6 1.1 thorpej *
7 1.1 thorpej * This code is derived from software contributed to The NetBSD Foundation
8 1.1 thorpej * by Jason R. Thorpe.
9 1.1 thorpej *
10 1.1 thorpej * Redistribution and use in source and binary forms, with or without
11 1.1 thorpej * modification, are permitted provided that the following conditions
12 1.1 thorpej * are met:
13 1.1 thorpej * 1. Redistributions of source code must retain the above copyright
14 1.1 thorpej * notice, this list of conditions and the following disclaimer.
15 1.1 thorpej * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 thorpej * notice, this list of conditions and the following disclaimer in the
17 1.1 thorpej * documentation and/or other materials provided with the distribution.
18 1.1 thorpej *
19 1.1 thorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 1.1 thorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 1.1 thorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 1.1 thorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 1.1 thorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 1.1 thorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 1.1 thorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 1.1 thorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 1.1 thorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 1.1 thorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 1.1 thorpej * POSSIBILITY OF SUCH DAMAGE.
30 1.1 thorpej */
31 1.1 thorpej
32 1.1 thorpej #ifndef _DEV_IC_DP83932REG_H_
33 1.1 thorpej #define _DEV_IC_DP83932REG_H_
34 1.1 thorpej
35 1.1 thorpej /*
36 1.1 thorpej * Register description for the National Semiconductor DP83932
37 1.1 thorpej * Systems-Oriented Network Interface Controller (SONIC).
38 1.1 thorpej */
39 1.1 thorpej
40 1.1 thorpej /*
41 1.1 thorpej * SONIC Receive Descriptor Area.
42 1.1 thorpej */
43 1.1 thorpej struct sonic_rda16 {
44 1.1 thorpej uint16_t rda_status;
45 1.1 thorpej uint16_t rda_bytecount;
46 1.1 thorpej uint16_t rda_pkt_ptr0;
47 1.1 thorpej uint16_t rda_pkt_ptr1;
48 1.1 thorpej uint16_t rda_seqno;
49 1.1 thorpej uint16_t rda_link;
50 1.1 thorpej uint16_t rda_inuse;
51 1.6 perry } __packed;
52 1.1 thorpej
53 1.1 thorpej struct sonic_rda32 {
54 1.1 thorpej uint32_t rda_status;
55 1.1 thorpej uint32_t rda_bytecount;
56 1.1 thorpej uint32_t rda_pkt_ptr0;
57 1.1 thorpej uint32_t rda_pkt_ptr1;
58 1.1 thorpej uint32_t rda_seqno;
59 1.1 thorpej uint32_t rda_link;
60 1.1 thorpej uint32_t rda_inuse;
61 1.6 perry } __packed;
62 1.1 thorpej
63 1.1 thorpej #define RDA_SEQNO_RBA(x) (((x) >> 8) & 0xff)
64 1.1 thorpej #define RDA_SEQNO_RSN(x) ((x) & 0xff)
65 1.1 thorpej
66 1.1 thorpej #define RDA_LINK_EOL 0x01 /* end-of-list */
67 1.1 thorpej
68 1.1 thorpej /*
69 1.1 thorpej * SONIC Receive Resource Area.
70 1.1 thorpej *
71 1.1 thorpej * Note, in 32-bit mode, Rx buffers must be aligned to 32-bit
72 1.1 thorpej * boundaries, and in 16-bit mode, to 16-bit boundaries.
73 1.1 thorpej *
74 1.1 thorpej * Also note the `word count' is always in units of 16-bit words.
75 1.1 thorpej */
76 1.1 thorpej struct sonic_rra16 {
77 1.1 thorpej uint16_t rra_ptr0;
78 1.1 thorpej uint16_t rra_ptr1;
79 1.1 thorpej uint16_t rra_wc0;
80 1.1 thorpej uint16_t rra_wc1;
81 1.6 perry } __packed;
82 1.1 thorpej
83 1.1 thorpej struct sonic_rra32 {
84 1.1 thorpej uint32_t rra_ptr0;
85 1.1 thorpej uint32_t rra_ptr1;
86 1.1 thorpej uint32_t rra_wc0;
87 1.1 thorpej uint32_t rra_wc1;
88 1.6 perry } __packed;
89 1.1 thorpej
90 1.1 thorpej /*
91 1.1 thorpej * SONIC Transmit Descriptor Area
92 1.1 thorpej *
93 1.1 thorpej * Note the number of fragments defined here is arbitrary.
94 1.1 thorpej */
95 1.2 thorpej #define SONIC_NTXFRAGS 16
96 1.1 thorpej
97 1.1 thorpej struct sonic_frag16 {
98 1.1 thorpej uint16_t frag_ptr0;
99 1.1 thorpej uint16_t frag_ptr1;
100 1.1 thorpej uint16_t frag_size;
101 1.6 perry } __packed;
102 1.1 thorpej
103 1.1 thorpej struct sonic_frag32 {
104 1.1 thorpej uint32_t frag_ptr0;
105 1.1 thorpej uint32_t frag_ptr1;
106 1.1 thorpej uint32_t frag_size;
107 1.6 perry } __packed;
108 1.1 thorpej
109 1.1 thorpej /*
110 1.1 thorpej * Note the frag after the last frag is used to link up to the
111 1.1 thorpej * next descriptor.
112 1.1 thorpej */
113 1.1 thorpej
114 1.1 thorpej struct sonic_tda16 {
115 1.1 thorpej uint16_t tda_status;
116 1.1 thorpej uint16_t tda_pktconfig;
117 1.1 thorpej uint16_t tda_pktsize;
118 1.1 thorpej uint16_t tda_fragcnt;
119 1.1 thorpej struct sonic_frag16 tda_frags[SONIC_NTXFRAGS + 1];
120 1.1 thorpej #if 0
121 1.1 thorpej uint16_t tda_link;
122 1.1 thorpej #endif
123 1.6 perry } __packed;
124 1.1 thorpej
125 1.1 thorpej struct sonic_tda32 {
126 1.1 thorpej uint32_t tda_status;
127 1.1 thorpej uint32_t tda_pktconfig;
128 1.1 thorpej uint32_t tda_pktsize;
129 1.1 thorpej uint32_t tda_fragcnt;
130 1.1 thorpej struct sonic_frag32 tda_frags[SONIC_NTXFRAGS + 1];
131 1.1 thorpej #if 0
132 1.1 thorpej uint32_t tda_link;
133 1.1 thorpej #endif
134 1.6 perry } __packed;
135 1.1 thorpej
136 1.1 thorpej #define TDA_STATUS_NCOL(x) (((x) >> 11) & 0x1f)
137 1.1 thorpej
138 1.1 thorpej #define TDA_LINK_EOL 0x01 /* end-of-list */
139 1.1 thorpej
140 1.1 thorpej /*
141 1.1 thorpej * SONIC CAM Descriptor Area.
142 1.1 thorpej */
143 1.1 thorpej struct sonic_cda16 {
144 1.1 thorpej uint16_t cda_entry;
145 1.1 thorpej uint16_t cda_addr0;
146 1.1 thorpej uint16_t cda_addr1;
147 1.1 thorpej uint16_t cda_addr2;
148 1.6 perry } __packed;
149 1.1 thorpej
150 1.1 thorpej struct sonic_cda32 {
151 1.1 thorpej uint32_t cda_entry;
152 1.1 thorpej uint32_t cda_addr0;
153 1.1 thorpej uint32_t cda_addr1;
154 1.1 thorpej uint32_t cda_addr2;
155 1.6 perry } __packed;
156 1.1 thorpej
157 1.1 thorpej /*
158 1.1 thorpej * SONIC register file.
159 1.1 thorpej *
160 1.1 thorpej * NOTE: We define these as indices, and use a register map to deal
161 1.1 thorpej * with different address strides.
162 1.1 thorpej */
163 1.1 thorpej
164 1.1 thorpej #define SONIC_CR 0x00 /* Command Register */
165 1.1 thorpej #define CR_HTX (1U << 0) /* Halt Transmission */
166 1.1 thorpej #define CR_TXP (1U << 1) /* Transmit Packets */
167 1.1 thorpej #define CR_RXDIS (1U << 2) /* Receiver Disable */
168 1.1 thorpej #define CR_RXEN (1U << 3) /* Receiver Enable */
169 1.1 thorpej #define CR_STP (1U << 4) /* Stop Timer */
170 1.1 thorpej #define CR_ST (1U << 5) /* Start Timer */
171 1.1 thorpej #define CR_RST (1U << 7) /* Software Reset */
172 1.1 thorpej #define CR_RRRA (1U << 8) /* Read RRA */
173 1.1 thorpej #define CR_LCAM (1U << 9) /* Load CAM */
174 1.1 thorpej
175 1.1 thorpej #define SONIC_DCR 0x01 /* Data Configuration Register */
176 1.1 thorpej #define DCR_TFT0 (1U << 0) /* Transmit FIFO Threshold (lo) */
177 1.1 thorpej #define DCR_TFT1 (1U << 1) /* Transmit FIFO Threshold (hi) */
178 1.1 thorpej #define DCR_RFT0 (1U << 2) /* Receive FIFO Threshold (lo) */
179 1.1 thorpej #define DCR_RFT1 (1U << 3) /* Receive FIFO Threshold (hi) */
180 1.1 thorpej #define DCR_BMS (1U << 4) /* Block Mode Select for DMA */
181 1.1 thorpej #define DCR_DW (1U << 5) /* Data Width Select */
182 1.1 thorpej #define DCR_WC0 (1U << 6) /* Wait State Control (lo) */
183 1.1 thorpej #define DCR_WC1 (1U << 7) /* Wait State Control (hi) */
184 1.1 thorpej #define DCR_USR0 (1U << 8) /* User Definable Pin 0 */
185 1.1 thorpej #define DCR_USR1 (1U << 9) /* User Definable Pin 1 */
186 1.1 thorpej #define DCR_SBUS (1U << 10) /* Synchronous Bus Mode */
187 1.1 thorpej #define DCR_PO0 (1U << 11) /* Programmable Output 0 */
188 1.1 thorpej #define DCR_PO1 (1U << 12) /* Programmable Output 1 */
189 1.1 thorpej #define DCR_LBR (1U << 13) /* Latched Bus Retry */
190 1.1 thorpej #define DCR_EXBUS (1U << 15) /* Extended Bus Mode */
191 1.1 thorpej
192 1.1 thorpej #define SONIC_RCR 0x02 /* Receive Control Register */
193 1.1 thorpej #define RCR_PRX (1U << 0) /* Packet Received OK */
194 1.1 thorpej #define RCR_LBK (1U << 1) /* Loopback Packet Received */
195 1.1 thorpej #define RCR_FAER (1U << 2) /* Frame Alignment Error */
196 1.1 thorpej #define RCR_CRCR (1U << 3) /* CRC Error */
197 1.1 thorpej #define RCR_COL (1U << 4) /* Collision Activity */
198 1.1 thorpej #define RCR_CRS (1U << 5) /* Carrier Sense Activity */
199 1.1 thorpej #define RCR_LPKT (1U << 6) /* Last Packet in RBA */
200 1.1 thorpej #define RCR_BC (1U << 7) /* Broadcast Packet Received */
201 1.1 thorpej #define RCR_MC (1U << 8) /* Multicast Packet Received */
202 1.1 thorpej #define RCR_LB0 (1U << 9) /* Loopback Control 0 */
203 1.1 thorpej #define RCR_LB1 (1U << 10) /* Loopback Control 1 */
204 1.1 thorpej #define RCR_AMC (1U << 11) /* Accept All Multicast Packets */
205 1.1 thorpej #define RCR_PRO (1U << 12) /* Physical Promiscuous Packets */
206 1.1 thorpej #define RCR_BRD (1U << 13) /* Accept Broadcast Packets */
207 1.1 thorpej #define RCR_RNT (1U << 14) /* Accept Runt Packets */
208 1.1 thorpej #define RCR_ERR (1U << 15) /* Accept Packets with Errors */
209 1.1 thorpej
210 1.1 thorpej #define SONIC_TCR 0x03 /* Transmit Control Register */
211 1.1 thorpej #define TCR_PTX (1U << 0) /* Packet Transmitted OK */
212 1.1 thorpej #define TCR_BCM (1U << 1) /* Byte Count Mismatch */
213 1.1 thorpej #define TCR_FU (1U << 2) /* FIFO Underrun */
214 1.1 thorpej #define TCR_PMB (1U << 3) /* Packet Monitored Bad */
215 1.1 thorpej #define TCR_OWC (1U << 5) /* Out of Window Collision */
216 1.1 thorpej #define TCR_EXC (1U << 6) /* Excessive Collisions */
217 1.1 thorpej #define TCR_CRSL (1U << 7) /* Carrier Sense Lost */
218 1.1 thorpej #define TCR_NCRS (1U << 8) /* No Carrier Sense */
219 1.1 thorpej #define TCR_DEF (1U << 9) /* Deferred Transmission */
220 1.1 thorpej #define TCR_EXD (1U << 10) /* Excessive Deferral */
221 1.1 thorpej #define TCR_EXDIS (1U << 12) /* Disable Excessive Deferral Timer */
222 1.1 thorpej #define TCR_CRCI (1U << 13) /* CRC Inhibit */
223 1.1 thorpej #define TCR_POWC (1U << 14) /* Programmed Out of Window Col. Tmr */
224 1.1 thorpej #define TCR_PINT (1U << 15) /* Programmable Interrupt */
225 1.1 thorpej
226 1.1 thorpej #define SONIC_IMR 0x04 /* Interrupt Mask Register */
227 1.1 thorpej #define IMR_RFO (1U << 0) /* Rx FIFO Overrun */
228 1.1 thorpej #define IMR_MP (1U << 1) /* Missed Packet Tally */
229 1.1 thorpej #define IMR_FAE (1U << 2) /* Frame Alignment Error Tally */
230 1.1 thorpej #define IMR_CRC (1U << 3) /* CRC Tally */
231 1.1 thorpej #define IMR_RBA (1U << 4) /* RBA Exceeded */
232 1.1 thorpej #define IMR_RBE (1U << 5) /* Rx Buffers Exhausted */
233 1.1 thorpej #define IMR_RDE (1U << 6) /* Rx Descriptors Exhausted */
234 1.1 thorpej #define IMR_TC (1U << 7) /* Timer Complete */
235 1.1 thorpej #define IMR_TXER (1U << 8) /* Transmit Error */
236 1.1 thorpej #define IMR_PTX (1U << 9) /* Transmit OK */
237 1.1 thorpej #define IMR_PRX (1U << 10) /* Packet Received */
238 1.1 thorpej #define IMR_PINT (1U << 11) /* Programmable Interrupt */
239 1.1 thorpej #define IMR_LCD (1U << 12) /* Load CAM Done */
240 1.1 thorpej #define IMR_HBL (1U << 13) /* Heartbeat Lost */
241 1.1 thorpej #define IMR_BR (1U << 14) /* Bus Retry Occurred */
242 1.1 thorpej
243 1.5 tsutsui #define IMR_ALL 0x7fff
244 1.5 tsutsui
245 1.1 thorpej #define SONIC_ISR 0x05 /* Interrupt Status Register */
246 1.1 thorpej /* See IMR bits. */
247 1.1 thorpej
248 1.3 wiz #define SONIC_UTDAR 0x06 /* Upper Tx Descriptor Address Register */
249 1.1 thorpej
250 1.1 thorpej #define SONIC_CTDAR 0x07 /* Current Tx Descriptor Address Register */
251 1.1 thorpej
252 1.1 thorpej #define SONIC_TPS 0x08 /* Transmit Packet Size */
253 1.1 thorpej
254 1.1 thorpej #define SONIC_TFC 0x09 /* Transmit Fragment Count */
255 1.1 thorpej
256 1.1 thorpej #define SONIC_TSA0 0x0a /* Transmit Start Address (lo) */
257 1.1 thorpej
258 1.1 thorpej #define SONIC_TSA1 0x0b /* Transmit Start Address (hi) */
259 1.1 thorpej
260 1.1 thorpej #define SONIC_TFS 0x0c /* Transmit Fragment Size */
261 1.1 thorpej
262 1.1 thorpej #define SONIC_URDAR 0x0d /* Upper Rx Descriptor Address Register */
263 1.1 thorpej
264 1.1 thorpej #define SONIC_CRDAR 0x0e /* Current Rx Descriptor Address Register */
265 1.1 thorpej
266 1.1 thorpej #define SONIC_CRBA0 0x0f /* Current Receive Buffer Address (lo) */
267 1.1 thorpej
268 1.1 thorpej #define SONIC_CRBA1 0x10 /* Current Receive Buffer Address (hi) */
269 1.1 thorpej
270 1.1 thorpej #define SONIC_RBWC0 0x11 /* Remaining Buffer Word Count 0 */
271 1.1 thorpej
272 1.1 thorpej #define SONIC_RBWC1 0x12 /* Remaining Buffer Word Count 1 */
273 1.1 thorpej
274 1.1 thorpej #define SONIC_EOBC 0x13 /* End Of Buffer Word Count */
275 1.1 thorpej
276 1.1 thorpej #define SONIC_URRAR 0x14 /* Upper Rx Resource Address Register */
277 1.1 thorpej
278 1.1 thorpej #define SONIC_RSAR 0x15 /* Resource Start Address Register */
279 1.1 thorpej
280 1.1 thorpej #define SONIC_REAR 0x16 /* Resource End Address Register */
281 1.1 thorpej
282 1.1 thorpej #define SONIC_RRR 0x17 /* Resource Read Register */
283 1.1 thorpej
284 1.1 thorpej #define SONIC_RWR 0x18 /* Resource Write Register */
285 1.1 thorpej
286 1.1 thorpej #define SONIC_TRBA0 0x19 /* Temporary Receive Buffer Address (lo) */
287 1.1 thorpej
288 1.1 thorpej #define SONIC_TRBA1 0x1a /* Temporary Receive Buffer Address (hi) */
289 1.1 thorpej
290 1.1 thorpej #define SONIC_TBWC0 0x1b /* Temporary Buffer Word Count 0 */
291 1.1 thorpej
292 1.1 thorpej #define SONIC_TBWC1 0x1c /* Temporary Buffer Word Count 1 */
293 1.1 thorpej
294 1.1 thorpej #define SONIC_ADDR0 0x1d /* Address Generator 0 */
295 1.1 thorpej
296 1.1 thorpej #define SONIC_ADDR1 0x1e /* Address Generator 1 */
297 1.1 thorpej
298 1.1 thorpej #define SONIC_LLFA 0x1f /* Last Link Field Address */
299 1.1 thorpej
300 1.1 thorpej #define SONIC_TTDA 0x20 /* Temporary Tx Descriptor Address */
301 1.1 thorpej
302 1.1 thorpej #define SONIC_CEP 0x21 /* CAM Entry Pointer */
303 1.1 thorpej
304 1.1 thorpej #define SONIC_CAP2 0x22 /* CAM Address Port 2 */
305 1.1 thorpej
306 1.1 thorpej #define SONIC_CAP1 0x23 /* CAM Address Port 1 */
307 1.1 thorpej
308 1.1 thorpej #define SONIC_CAP0 0x24 /* CAM Address Port 0 */
309 1.1 thorpej
310 1.1 thorpej #define SONIC_CER 0x25 /* CAM Enable Register */
311 1.1 thorpej
312 1.1 thorpej #define SONIC_CDP 0x26 /* CAM Descriptor Pointer */
313 1.1 thorpej
314 1.1 thorpej #define SONIC_CDC 0x27 /* CAM Descriptor Count */
315 1.1 thorpej
316 1.1 thorpej #define SONIC_SRR 0x28 /* Silicon Revision Register */
317 1.1 thorpej
318 1.1 thorpej #define SONIC_WT0 0x29 /* Watchdog Timer 0 */
319 1.1 thorpej
320 1.1 thorpej #define SONIC_WT1 0x2a /* Watchdog Timer 1 */
321 1.1 thorpej
322 1.1 thorpej #define SONIC_RSC 0x2b /* Receive Sequence Counter */
323 1.1 thorpej
324 1.1 thorpej #define SONIC_CRCETC 0x2c /* CRC Error Tally Count */
325 1.1 thorpej
326 1.1 thorpej #define SONIC_FAET 0x2d /* Frame Alignment Error Tally */
327 1.1 thorpej
328 1.1 thorpej #define SONIC_MPT 0x2e /* Missed Packet Tally */
329 1.1 thorpej
330 1.1 thorpej #define SONIC_DCR2 0x3f /* Data Configuration Register 2 */
331 1.1 thorpej #define DCR2_RJCM (1U << 0) /* Reject on CAM Match */
332 1.1 thorpej #define DCR2_PCNM (1U << 1) /* Packet Compress When not Matched */
333 1.1 thorpej #define DCR2_PCM (1U << 2) /* Packet Compress When Matched */
334 1.1 thorpej #define DCR2_PH (1U << 4) /* Program Hold */
335 1.1 thorpej #define DCR2_EXPO0 (1U << 12) /* Extended Programmable Output 0 */
336 1.1 thorpej #define DCR2_EXPO1 (1U << 13) /* Extended Programmable Output 1 */
337 1.1 thorpej #define DCR2_EXPO2 (1U << 14) /* Extended Programmable Output 2 */
338 1.1 thorpej #define DCR2_EXPO3 (1U << 15) /* Extended Programmable Output 3 */
339 1.1 thorpej
340 1.1 thorpej #define SONIC_NREGS 0x40
341 1.1 thorpej
342 1.1 thorpej #endif /* _DEV_IC_DP83932REG_H_ */
343