Deleted Added
full compact
if_ep_pccard.c (121206) if_ep_pccard.c (121492)
1/*
2 * Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 15 unchanged lines hidden (view full) ---

24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 15 unchanged lines hidden (view full) ---

24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sys/dev/ep/if_ep_pccard.c 121206 2003-10-18 15:22:43Z imp $");
32__FBSDID("$FreeBSD: head/sys/dev/ep/if_ep_pccard.c 121492 2003-10-25 04:09:49Z imp $");
33
34/*
35 * Pccard support for 3C589 by:
36 * HAMADA Naoki
37 * nao@tom-yam.or.jp
38 */
39
40#include <sys/cdefs.h>
33
34/*
35 * Pccard support for 3C589 by:
36 * HAMADA Naoki
37 * nao@tom-yam.or.jp
38 */
39
40#include <sys/cdefs.h>
41__FBSDID("$FreeBSD: head/sys/dev/ep/if_ep_pccard.c 121206 2003-10-18 15:22:43Z imp $");
41__FBSDID("$FreeBSD: head/sys/dev/ep/if_ep_pccard.c 121492 2003-10-25 04:09:49Z imp $");
42
43#include <sys/param.h>
44#include <sys/systm.h>
45#include <sys/kernel.h>
46#include <sys/socket.h>
47#include <sys/module.h>
48#include <sys/bus.h>
49

--- 152 unchanged lines hidden (view full) ---

202 error = ENXIO;
203 goto bad;
204 }
205 }
206 error = get_e(sc, EEPROM_ADDR_CFG, &result);
207
208 /* ROM size = 0, ROM base = 0 */
209 /* For now, ignore AUTO SELECT feature of 3C589B and later. */
42
43#include <sys/param.h>
44#include <sys/systm.h>
45#include <sys/kernel.h>
46#include <sys/socket.h>
47#include <sys/module.h>
48#include <sys/bus.h>
49

--- 152 unchanged lines hidden (view full) ---

202 error = ENXIO;
203 goto bad;
204 }
205 }
206 error = get_e(sc, EEPROM_ADDR_CFG, &result);
207
208 /* ROM size = 0, ROM base = 0 */
209 /* For now, ignore AUTO SELECT feature of 3C589B and later. */
210 EP_WRITE_2(sc, EP_W0_ADDRESS_CFG, result & 0xc000);
210 CSR_WRITE_2(sc, EP_W0_ADDRESS_CFG, result & 0xc000);
211
212 /* Fake IRQ must be 3 */
211
212 /* Fake IRQ must be 3 */
213 EP_WRITE_2(sc, EP_W0_RESOURCE_CFG, (sc->epb.res_cfg & 0x0fff) | 0x3000);
213 CSR_WRITE_2(sc, EP_W0_RESOURCE_CFG, (sc->epb.res_cfg & 0x0fff) | 0x3000);
214
214
215 EP_WRITE_2(sc, EP_W0_PRODUCT_ID, sc->epb.prod_id);
215 CSR_WRITE_2(sc, EP_W0_PRODUCT_ID, sc->epb.prod_id);
216
217 if (sc->epb.mii_trans) {
218 /*
219 * turn on the MII transciever
220 */
221 GO_WINDOW(3);
216
217 if (sc->epb.mii_trans) {
218 /*
219 * turn on the MII transciever
220 */
221 GO_WINDOW(3);
222 EP_WRITE_2(sc, EP_W3_OPTIONS, 0x8040);
222 CSR_WRITE_2(sc, EP_W3_OPTIONS, 0x8040);
223 DELAY(1000);
223 DELAY(1000);
224 EP_WRITE_2(sc, EP_W3_OPTIONS, 0xc040);
225 EP_WRITE_2(sc, EP_COMMAND, RX_RESET);
226 EP_WRITE_2(sc, EP_COMMAND, TX_RESET);
227 while (EP_READ_2(sc, EP_STATUS) & S_COMMAND_IN_PROGRESS);
224 CSR_WRITE_2(sc, EP_W3_OPTIONS, 0xc040);
225 CSR_WRITE_2(sc, EP_COMMAND, RX_RESET);
226 CSR_WRITE_2(sc, EP_COMMAND, TX_RESET);
227 EP_BUSY_WAIT;
228 DELAY(1000);
228 DELAY(1000);
229 EP_WRITE_2(sc, EP_W3_OPTIONS, 0x8040);
229 CSR_WRITE_2(sc, EP_W3_OPTIONS, 0x8040);
230 } else
231 ep_get_media(sc);
232
233 if ((error = ep_attach(sc))) {
234 device_printf(dev, "ep_attach() failed! (%d)\n", error);
235 goto bad;
236 }
230 } else
231 ep_get_media(sc);
232
233 if ((error = ep_attach(sc))) {
234 device_printf(dev, "ep_attach() failed! (%d)\n", error);
235 goto bad;
236 }
237 if ((error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET, ep_intr,
237 if ((error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE, ep_intr,
238 sc, &sc->ep_intrhand))) {
239 device_printf(dev, "bus_setup_intr() failed! (%d)\n", error);
240 goto bad;
241 }
242 return (0);
243bad:
244 ep_free(dev);
245 return (error);

--- 50 unchanged lines hidden ---
238 sc, &sc->ep_intrhand))) {
239 device_printf(dev, "bus_setup_intr() failed! (%d)\n", error);
240 goto bad;
241 }
242 return (0);
243bad:
244 ep_free(dev);
245 return (error);

--- 50 unchanged lines hidden ---