if_ep_pccard.c (121588) | if_ep_pccard.c (121904) |
---|---|
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 --- 14 unchanged lines hidden (view full) --- 23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 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 | 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 --- 14 unchanged lines hidden (view full) --- 23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 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 121588 2003-10-26 22:28:20Z 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> | 31/* 32 * Pccard support for 3C589 by: 33 * HAMADA Naoki 34 * nao@tom-yam.or.jp 35 */ 36 37#include <sys/cdefs.h> |
41__FBSDID("$FreeBSD: head/sys/dev/ep/if_ep_pccard.c 121588 2003-10-26 22:28:20Z imp $"); | 38__FBSDID("$FreeBSD: head/sys/dev/ep/if_ep_pccard.c 121904 2003-11-02 20:13:39Z 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 --- 64 unchanged lines hidden (view full) --- 114 "product ID unknown! (id 0x%x)\n", epb->prod_id); 115 ep_free(dev); 116 return (ENXIO); 117 } 118 } 119 device_set_desc(dev, desc); 120 121 /* | 39 40#include <sys/param.h> 41#include <sys/systm.h> 42#include <sys/kernel.h> 43#include <sys/socket.h> 44#include <sys/module.h> 45#include <sys/bus.h> 46 --- 64 unchanged lines hidden (view full) --- 111 "product ID unknown! (id 0x%x)\n", epb->prod_id); 112 ep_free(dev); 113 return (ENXIO); 114 } 115 } 116 device_set_desc(dev, desc); 117 118 /* |
122 * For some reason the 3c574 needs this. | 119 * Newer cards supported by this device need to have their 120 * MAC address set. |
123 */ 124 error = ep_get_macaddr(sc, (u_char *)&sc->arpcom.ac_enaddr); 125 126 ep_free(dev); 127 return (0); 128} 129 130static const char * 131ep_pccard_identify(u_short id) 132{ 133 /* Determine device type and associated MII capabilities */ 134 switch (id) { | 121 */ 122 error = ep_get_macaddr(sc, (u_char *)&sc->arpcom.ac_enaddr); 123 124 ep_free(dev); 125 return (0); 126} 127 128static const char * 129ep_pccard_identify(u_short id) 130{ 131 /* Determine device type and associated MII capabilities */ 132 switch (id) { |
135 case 0x6055: /* 3C556 */ | 133 case 0x6055: /* 3C556 */ |
136 return ("3Com 3C556"); 137 case 0x4057: /* 3C574 */ 138 return ("3Com 3C574"); 139 case 0x4b57: /* 3C574B */ 140 return ("3Com 3C574B, Megahertz 3CCFE574BT or " 141 "Fast Etherlink 3C574-TX"); 142 case 0x2b57: /* 3CXSH572BT */ 143 return ("3Com OfficeConnect 572BT"); 144 case 0x9058: /* 3C589 */ 145 return ("3Com Etherlink III 3C589"); 146 case 0x2056: /* 3C562/3C563 */ 147 return ("3Com 3C562D/3C563D"); 148 case 0x0010: /* 3C1 */ 149 return ("3Com Megahertz C1"); | 134 return ("3Com 3C556"); 135 case 0x4057: /* 3C574 */ 136 return ("3Com 3C574"); 137 case 0x4b57: /* 3C574B */ 138 return ("3Com 3C574B, Megahertz 3CCFE574BT or " 139 "Fast Etherlink 3C574-TX"); 140 case 0x2b57: /* 3CXSH572BT */ 141 return ("3Com OfficeConnect 572BT"); 142 case 0x9058: /* 3C589 */ 143 return ("3Com Etherlink III 3C589"); 144 case 0x2056: /* 3C562/3C563 */ 145 return ("3Com 3C562D/3C563D"); 146 case 0x0010: /* 3C1 */ 147 return ("3Com Megahertz C1"); |
148 case 0x0035: 149 return ("3Com 3CCEM556"); |
|
150 default: | 150 default: |
151 printf("Unknown ID: 0x%x\n", id); |
|
151 return (NULL); 152 } 153} 154 155static int 156ep_pccard_card_attach(struct ep_board * epb) 157{ 158 /* Determine device type and associated MII capabilities */ 159 switch (epb->prod_id) { 160 case 0x6055: /* 3C556 */ 161 case 0x2b57: /* 3C572BT */ 162 case 0x4057: /* 3C574 */ 163 case 0x4b57: /* 3C574B */ 164 epb->mii_trans = 1; 165 return (1); 166 case 0x2056: /* 3C562D/3C563D */ 167 case 0x9058: /* 3C589 */ 168 case 0x0010: /* 3C1 */ | 152 return (NULL); 153 } 154} 155 156static int 157ep_pccard_card_attach(struct ep_board * epb) 158{ 159 /* Determine device type and associated MII capabilities */ 160 switch (epb->prod_id) { 161 case 0x6055: /* 3C556 */ 162 case 0x2b57: /* 3C572BT */ 163 case 0x4057: /* 3C574 */ 164 case 0x4b57: /* 3C574B */ 165 epb->mii_trans = 1; 166 return (1); 167 case 0x2056: /* 3C562D/3C563D */ 168 case 0x9058: /* 3C589 */ 169 case 0x0010: /* 3C1 */ |
170 case 0x0035: /* 3C[XC]EM556 */ |
|
169 epb->mii_trans = 0; 170 return (1); 171 default: 172 return (0); 173 } 174} 175 176static int --- 26 unchanged lines hidden (view full) --- 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 CSR_WRITE_2(sc, EP_W0_ADDRESS_CFG, result & 0xc000); | 171 epb->mii_trans = 0; 172 return (1); 173 default: 174 return (0); 175 } 176} 177 178static int --- 26 unchanged lines hidden (view full) --- 205 goto bad; 206 } 207 } 208 error = get_e(sc, EEPROM_ADDR_CFG, &result); 209 210 /* ROM size = 0, ROM base = 0 */ 211 /* For now, ignore AUTO SELECT feature of 3C589B and later. */ 212 CSR_WRITE_2(sc, EP_W0_ADDRESS_CFG, result & 0xc000); |
211 /* Fake IRQ must be 3 */ | 213 214 /* 215 * Fake IRQ must be 3 for 3C589 and 3C589B. 3C589D and newer 216 * ignore this value. 3C589C is unknown, as are the other 217 * cards supported by this driver, but it appears to never hurt 218 * and always helps. 219 */ |
212 SET_IRQ(sc, 3); 213 CSR_WRITE_2(sc, EP_W0_PRODUCT_ID, sc->epb.prod_id); 214 215 if (sc->epb.mii_trans) { 216 /* 217 * turn on the MII transciever 218 */ 219 GO_WINDOW(sc, 3); --- 74 unchanged lines hidden --- | 220 SET_IRQ(sc, 3); 221 CSR_WRITE_2(sc, EP_W0_PRODUCT_ID, sc->epb.prod_id); 222 223 if (sc->epb.mii_trans) { 224 /* 225 * turn on the MII transciever 226 */ 227 GO_WINDOW(sc, 3); --- 74 unchanged lines hidden --- |