1 /* $NetBSD: if_xireg.h,v 1.4 2003/11/02 11:14:22 wiz Exp $ */
2 /* OpenBSD: if_xereg.h,v 1.1 1999/05/18 19:18:21 niklas Exp */
3
4 /*
5 * Copyright (c) 1999 Niklas Hallqvist, Brandon Creighton, Job de Haas
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by Niklas Hallqvist,
19 * Brandon Creighton and Job de Haas.
20 * 4. The name of the author may not be used to endorse or promote products
21 * derived from this software without specific prior written permission
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35 #define PCMCIA_CCR_ECOR
36
37 /* Additional Card Configuration Registers (CCR) on Dingo */
38
39 #define PCMCIA_CCR_DCOR0 0x20
40 #define PCMCIA_CCR_DCOR0_MRST_SFRST 0x80
41 #define PCMCIA_CCR_DCOR0_MRST_SFPWDN 0x40
42 #define PCMCIA_CCR_DCOR0_LED3_SFRST 0x20
43 #define PCMCIA_CCR_DCOR0_LED3_SFPWDN 0x10
44 #define PCMCIA_CCR_DCOR0_BUS 0x08
45 #define PCMCIA_CCR_DCOR0_DECODE 0x04
46 #define PCMCIA_CCR_DCOR0_SFINT 0x01
47 #define PCMCIA_CCR_DCOR1 0x22
48 #define PCMCIA_CCR_DCOR1_SFCSR_WAIT 0xC0
49 #define PCMCIA_CCR_DCOR1_SHADOW_SFIOB 0x20
50 #define PCMCIA_CCR_DCOR1_SHADOW_SFCSR 0x10
51 #define PCMCIA_CCR_DCOR1_FORCE_LEVIREQ 0x08
52 #define PCMCIA_CCR_DCOR1_D6 0x04
53 #define PCMCIA_CCR_DCOR1_SF_STSCHG 0x02
54 #define PCMCIA_CCR_DCOR1_SF_IREQ 0x01
55 #define PCMCIA_CCR_DCOR2 0x24
56 #define PCMCIA_CCR_DCOR2_SHADOW_SFCOR 0x10
57 #define PCMCIA_CCR_DCOR2_SMEM_BASE 0x0F
58 #define PCMCIA_CCR_DCOR3 0x26
59 #define PCMCIA_CCR_DCOR4 0x28
60 #define PCMCIA_CCR_SFCOR 0x40
61 #define PCMCIA_CCR_SFCOR_SRESET 0x80
62 #define PCMCIA_CCR_SFCOR_LEVIREQ 0x40
63 #define PCMCIA_CCR_SFCOR_IRQ_STSCHG 0x20
64 #define PCMCIA_CCR_SFCOR_CFINDEX 0x18
65 #define PCMCIA_CCR_SFCOR_IREQ_ENABLE 0x04
66 #define PCMCIA_CCR_SFCOR_ADDR_DECODE 0x02
67 #define PCMCIA_CCR_SFCOR_FUNC_ENABLE 0x01
68 #define PCMCIA_CCR_SFCSR 0x42
69 #define PCMCIA_CCR_SFCSR_IOIS8 0x20
70 #define PCMCIA_CCR_SFCSR_AUDIO 0x08
71 #define PCMCIA_CCR_SFCSR_PWRDWN 0x04
72 #define PCMCIA_CCR_SFCSR_INTR 0x02
73 #define PCMCIA_CCR_SFCSR_INTRACK 0x01
74 #define PCMCIA_CCR_SFIOBASE0 0x4A
75 #define PCMCIA_CCR_SFIOBASE1 0x4C
76 #define PCMCIA_CCR_SFILR 0x52
77
78 #define PCMCIA_CCR_SIZE_DINGO 0x54
79
80 #define XI_IOSIZE 16
81
82 /* All pages */
83 #define CR 0x0 /* W - Command register */
84 #define ESR 0x0 /* R - Ethernet status register */
85 #define PR 0x1 /* RW - Page register select */
86 #define EDP 0x2 /* RW - Ethernet data port, 4 registers */
87 #define ISR0 0x6 /* R - Ethernet interrupt status register */
88 #define GIR 0x7 /* RW - Global interrupt register - dingo only */
89 #define PTR 0xd /* R - Packets Transmitted register */
90
91 /* Page 0 */
92 #define TSO0 0x8 /* R - Transmit space open, 3 registers */
93 #define TSO1 0x9
94 #define TSO2 0xa
95 #define DO0 0xc /* W - Data offset, 2 registers */
96 #define DO1 0xd
97 #define RSR 0xc /* R - Rx status register */
98 #define TPR 0xd /* R - Tx packets register */
99 #define RBC0 0xe /* R - Rx byte count, 2 registers */
100 #define RBC1 0xf
101
102 /* Page 1 */
103 #define IMR0 0xc /* RW - Interrupt mask, 2 registers */
104 #define IMR1 0xd
105 #define ECR 0xe /* RW - Ethernet config register */
106
107 /* Page 2 */
108 #define RBS0 0x8 /* RW - Receive buffer start, 2 registers */
109 #define RBS1 0x9
110 #define LED 0xa /* RW - LED control register */
111 #define LED3 0xb /* RW - LED3 control register */
112 #define MSR 0xc /* RW - Misc. setup register */
113 #define GP2 0xd /* RW - General purpose register 2 */
114
115 /* Page 3 */
116 #define TPT0 0xa /* RW - Tx packet threshold, 2 registers */
117 #define TPT1 0xb
118
119 /* Page 4 */
120 #define GP0 0x8 /* RW - General purpose register 0 */
121 #define GP1 0x9 /* RW - General purpose register 1 */
122 #define BV 0xa /* R - Bonding version register */
123 #define EES 0xb /* RW - EEPROM control register */
124
125 /* Page 5 */
126 #define RHSA0 0xa /* RX host start address */
127
128 /* Page 6 */
129
130 /* Page 7 */
131
132 /* Page 8 */
133
134 /* Page 16 */
135
136 /* Page 0x40 */
137 #define CMD0 0x8 /* W - Receive status register */
138 #define RXST0 0x9 /* RW - Receive status register */
139 #define TXST0 0xb /* RW - Transmit status, 2 registers */
140 #define TXST1 0xc
141 #define RX0MSK 0xd /* RW - Receive status mask register */
142 #define TX0MSK 0xe /* RW - Transmit status mask, 2 registers */
143 #define TX1MSK 0xf /* RW - Dingo does not define this register */
144
145 /* Page 0x42 */
146 #define SWC0 0x8 /* RW - Software configuration, 2 registers */
147 #define SWC1 0x9
148
149 /* Page 0x50-0x57 */
150 #define IA 0x8 /* RW - Individual address */
151
152 /* CR register bits */
153 #define TX_PKT 0x01 /* Transmit packet. */
154 #define SOFT_RESET 0x02 /* Software reset. */
155 #define ENABLE_INT 0x04 /* Enable interrupt. */
156 #define FORCE_INT 0x08 /* Force interrupt. */
157 #define CLR_TX_FIFO 0x10 /* Clear transmit FIFO. */
158 #define CLR_RX_OVERRUN 0x20 /* Clear receive overrun. */
159 #define RESTART_TX 0x40 /* Restart transmit process. */
160
161 /* ESR register bits */
162 #define FULL_PKT_RCV 0x01 /* Full packet received. */
163 #define PKT_REJECTED 0x04 /* A packet was rejected. */
164 #define TX_PKT_PEND 0x08 /* TX Packet Pending. */
165 #define INCOR_POLARITY 0x10 /* XXX from linux driver, but not used there */
166 #define MEDIA_SELECT 0x20 /* set if TP, clear if AUI */
167
168 /* DO register bits */
169 #define DO_OFF_MASK 0x1fff /* Mask for offset value. */
170 #define DO_CHG_OFFSET 0x2000 /* Change offset command. */
171 #define DO_SHM_MODE 0x4000 /* Shared memory mode. */
172 #define DO_SKIP_RX_PKT 0x8000 /* Skip Rx packet. */
173
174 /* RBC register bits */
175 #define RBC_COUNT_MASK 0x1fff /* Mask for byte count. */
176 #define RBC_RX_FULL 0x2000 /* Receive full packet. */
177 #define RBC_RX_PARTIAL 0x4000 /* Receive partial packet. */
178 #define RBC_RX_PKT_REJ 0x8000 /* Receive packet rejected. */
179
180 /* ISR0(/IMR0) register bits */
181 #define ISR_TX_OFLOW 0x01 /* Transmit buffer overflow. */
182 #define ISR_PKT_TX 0x02 /* Packet transmitted. */
183 #define ISR_MAC_INT 0x04 /* MAC interrupt. */
184 #define ISR_RX_EARLY 0x10 /* Receive early packet. */
185 #define ISR_RX_FULL 0x20 /* Receive full packet. */
186 #define ISR_RX_PKT_REJ 0x40 /* Receive packet rejected. */
187 #define ISR_FORCED_INT 0x80 /* Forced interrupt. */
188
189 /* ECR register bits */
190 #define ECR_EARLY_TX 0x01 /* Early transmit mode. */
191 #define ECR_EARLY_RX 0x02 /* Early receive mode. */
192 #define ECR_FULL_DUPLEX 0x04 /* Full duplex select. */
193 #define ECR_LNK_PLS_DIS 0x20 /* Link pulse disable. */
194 #define ECR_SW_COMPAT 0x80 /* Software compatibility switch. */
195
196 /* GP0 register bits */
197 #define GP1_WR 0x01 /* GP1 pin output value. */
198 #define GP2_WR 0x02 /* GP2 pin output value. */
199 #define GP1_OUT 0x04 /* GP1 pin output select. */
200 #define GP2_OUT 0x08 /* GP2 pin output select. */
201 #define GP1_RD 0x10 /* GP1 pin input value. */
202 #define GP2_RD 0x20 /* GP2 pin input value. */
203
204 /* GP1 register bits */
205 #define POWER_UP 0x01 /* When 0, power down analogue part of chip. */
206
207 /* LED register bits */
208 #define LED0_SHIFT 0 /* LED0 Output shift & mask */
209 #define LED0_MASK 0x7
210 #define LED1_SHIFT 3 /* LED1 Output shift & mask */
211 #define LED1_MASK 0x38
212 #define LED0_RX_ENA 0x40 /* LED0 - receive enable */
213 #define LED1_RX_ENA 0x80 /* LED1 - receive enable */
214
215 /* LED3 register bits */
216 #define LED3_SHIFT 0 /* LED0 output shift & mask */
217 #define LED3_MASK 0x7
218 #define LED3_RX_ENA 0x40 /* LED0 - receive enable */
219
220 /* LED output values */
221 #define LED_DISABLE 0 /* LED disabled */
222 #define LED_COLL_ACT 1 /* Collision activity */
223 #define LED_COLL_INACT 2 /* (NOT) Collision activity */
224 #define LED_10MB_LINK 3 /* 10 Mb link detected */
225 #define LED_100MB_LINK 4 /* 100 Mb link detected */
226 #define LED_LINK 5 /* 10 Mb or 100 Mb link detected */
227 #define LED_AUTO 6 /* Automatic assertion */
228 #define LED_TX_ACT 7 /* Transmit activity */
229
230 /* MSR register bits */
231 #define SRAM_128K_EXT 0x01 /* 128K SRAM extension */
232 #define RBS_BIT16 0x02 /* RBS bit 16 */
233 #define SELECT_MII 0x08 /* Select MII */
234 #define HASH_TBL_ENA 0x20 /* Hash table enable */
235
236 /* GP2 register bits */
237 #define GP3_WR 0x01 /* GP3 pin output value. */
238 #define GP4_WR 0x02 /* GP4 pin output value. */
239 #define GP3_OUT 0x04 /* GP3 pin output select. */
240 #define GP4_OUT 0x08 /* GP4 pin output select. */
241 #define GP3_RD 0x10 /* GP3 pin input value. */
242 #define GP4_RD 0x20 /* GP4 pin input value. */
243
244 /* RSR register bits */
245 #define RSR_NOTMCAST 0x01 /* clear when multicast packet */
246 #define RSR_BCAST 0x02 /* set when broadcast packet */
247 #define RSR_TOO_LONG 0x04 /* set if packet is longer than 1518 octets */
248 #define RSR_ALIGNERR 0x10 /* incorrect CRC and last octet not complete */
249 #define RSR_CRCERR 0x20 /* incorrect CRC and last octet complete */
250 #define RSR_RX_OK 0x80 /* packet received okay */
251
252 /* CMD0 register bits */
253 #define ONLINE 0x04 /* Online */
254 #define OFFLINE 0x08 /* Online */
255 #define ENABLE_RX 0x20 /* Enable reciever */
256 #define DISABLE_RX 0x80 /* Disable receiver */
257
258 /* RX0Msk register bits */
259 #define PKT_TOO_LONG 0x02 /* Packet too long mask. */
260 #define CRC_ERR 0x08 /* CRC error mask. */
261 #define RX_OVERRUN 0x10 /* Receive overrun mask. */
262 #define RX_ABORT 0x40 /* Receive abort mask. */
263 #define RX_OK 0x80 /* Receive OK mask. */
264
265 /* TX0Msk register bits */
266 #define CARRIER_LOST 0x01 /* Carrier sense lost. */
267 #define EXCESSIVE_COLL 0x02 /* Excessive collisions mask. */
268 #define TX_UNDERRUN 0x08 /* Transmit underrun mask. */
269 #define LATE_COLLISION 0x10 /* Late collision mask. */
270 #define SQE 0x20 /* Signal quality error mask.. */
271 #define TX_ABORT 0x40 /* Transmit abort mask. */
272 #define TX_OK 0x80 /* Transmit OK mask. */
273
274 /* SWC1 register bits */
275 #define SWC1_IND_ADDR 0x01 /* Individual address enable. */
276 #define SWC1_MCAST_PROM 0x02 /* Multicast promiscuous enable. */
277 #define SWC1_PROMISC 0x04 /* Promiscuous mode enable. */
278 #define SWC1_BCAST_DIS 0x08 /* Broadcast disable. */
279 #define SWC1_MEDIA_SEL 0x40 /* Media select (Mohawk). */
280 #define SWC1_AUTO_MEDIA 0x80 /* Automatic media select (Mohawk). */
281
282 /* Misc. defines. */
283
284 #define PAGE(sc, page) \
285 bus_space_write_1((sc->sc_bst), (sc->sc_bsh), (sc->sc_offset) + PR, (page))
286
287 /*
288 * GP3 is connected to the MDC pin of the NS DP83840A PHY, GP4 is
289 * connected to the MDIO pin. These are utility macros to enhance
290 * readability of the code.
291 */
292 #define MDC_LOW GP3_OUT
293 #define MDC_HIGH (GP3_OUT | GP3_WR)
294 #define MDIO_LOW GP4_OUT
295 #define MDIO_HIGH (GP4_OUT | GP4_WR)
296 #define MDIO GP4_RD
297
298 /* Values found in MANFID. */
299 #define XIMEDIA_ETHER 0x01
300 #define XIMEDIA_TOKEN 0x02
301 #define XIMEDIA_ARC 0x04
302 #define XIMEDIA_WIRELESS 0x08
303 #define XIMEDIA_MODEM 0x10
304 #define XIMEDIA_GSM 0x20
305
306 #define XIPROD_IDMASK 0x0f
307 #define XIPROD_POCKET 0x10
308 #define XIPROD_EXTERNAL 0x20
309 #define XIPROD_CREDITCARD 0x40
310 #define XIPROD_CARDBUS 0x80
Cache object: abf8e2780a18ed3e291d59648e487953
|