if_cs.c (179621) | if_cs.c (180388) |
---|---|
1/*- 2 * Copyright (c) 1997,1998 Maxim Bolotin and Oleg Sharoiko. 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 --- 13 unchanged lines hidden (view full) --- 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * 27 */ 28 29#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1997,1998 Maxim Bolotin and Oleg Sharoiko. 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 --- 13 unchanged lines hidden (view full) --- 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * 27 */ 28 29#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/sys/dev/cs/if_cs.c 179621 2008-06-06 17:27:19Z imp $"); | 30__FBSDID("$FreeBSD: head/sys/dev/cs/if_cs.c 180388 2008-07-09 16:47:55Z imp $"); |
31 32/* 33 * 34 * Device driver for Crystal Semiconductor CS8920 based ethernet 35 * adapters. By Maxim Bolotin and Oleg Sharoiko, 27-April-1997 36 */ 37 38/* --- 158 unchanged lines hidden (view full) --- 197{ 198 unsigned int self_control = HCB1_ENBL; 199 200 if (((sc->adapter_cnf & A_CNF_DC_DC_POLARITY)!=0) ^ on_not_off) 201 self_control |= HCB1; 202 else 203 self_control &= ~HCB1; 204 cs_writereg(sc, PP_SelfCTL, self_control); | 31 32/* 33 * 34 * Device driver for Crystal Semiconductor CS8920 based ethernet 35 * adapters. By Maxim Bolotin and Oleg Sharoiko, 27-April-1997 36 */ 37 38/* --- 158 unchanged lines hidden (view full) --- 197{ 198 unsigned int self_control = HCB1_ENBL; 199 200 if (((sc->adapter_cnf & A_CNF_DC_DC_POLARITY)!=0) ^ on_not_off) 201 self_control |= HCB1; 202 else 203 self_control &= ~HCB1; 204 cs_writereg(sc, PP_SelfCTL, self_control); |
205 DELAY(500000); | 205 DELAY(500000); /* Bad! */ |
206} 207 208 209static int 210cs_duplex_auto(struct cs_softc *sc) 211{ 212 int i, error=0; 213 --- 113 unchanged lines hidden (view full) --- 327 */ 328 if((cs_readreg(sc, PP_SelfST) & EEPROM_PRESENT) == 0) { 329 device_printf(dev, "No EEPROM, assuming defaults.\n"); 330 } else if (get_eeprom_data(sc,START_EEPROM_DATA,CHKSUM_LEN, eeprom_buff)<0) { 331 device_printf(dev, "EEPROM read failed, assuming defaults.\n"); 332 } else if (get_eeprom_cksum(START_EEPROM_DATA,CHKSUM_LEN, eeprom_buff)<0) { 333 device_printf(dev, "EEPROM cheksum bad, assuming defaults.\n"); 334 } else { | 206} 207 208 209static int 210cs_duplex_auto(struct cs_softc *sc) 211{ 212 int i, error=0; 213 --- 113 unchanged lines hidden (view full) --- 327 */ 328 if((cs_readreg(sc, PP_SelfST) & EEPROM_PRESENT) == 0) { 329 device_printf(dev, "No EEPROM, assuming defaults.\n"); 330 } else if (get_eeprom_data(sc,START_EEPROM_DATA,CHKSUM_LEN, eeprom_buff)<0) { 331 device_printf(dev, "EEPROM read failed, assuming defaults.\n"); 332 } else if (get_eeprom_cksum(START_EEPROM_DATA,CHKSUM_LEN, eeprom_buff)<0) { 333 device_printf(dev, "EEPROM cheksum bad, assuming defaults.\n"); 334 } else { |
335 sc->auto_neg_cnf = eeprom_buff[AUTO_NEG_CNF_OFFSET/2]; 336 sc->adapter_cnf = eeprom_buff[ADAPTER_CNF_OFFSET/2]; 337 sc->isa_config = eeprom_buff[ISA_CNF_OFFSET/2]; | 335 sc->auto_neg_cnf = eeprom_buff[AUTO_NEG_CNF_OFFSET]; 336 sc->adapter_cnf = eeprom_buff[ADAPTER_CNF_OFFSET]; 337 sc->isa_config = eeprom_buff[ISA_CNF_OFFSET]; |
338 for (i=0; i<ETHER_ADDR_LEN/2; i++) { 339 sc->enaddr[i*2] = eeprom_buff[i]; 340 sc->enaddr[i*2+1] = eeprom_buff[i] >> 8; 341 } 342 /* 343 * If no interrupt specified, use what the 344 * board tells us. 345 */ --- 875 unchanged lines hidden (view full) --- 1221 if (media & IFM_FDX) 1222 cs_duplex_full(sc); 1223 else if (media & IFM_HDX) 1224 cs_duplex_half(sc); 1225 else 1226 error = cs_duplex_auto(sc); 1227 break; 1228 case IFM_10_2: | 338 for (i=0; i<ETHER_ADDR_LEN/2; i++) { 339 sc->enaddr[i*2] = eeprom_buff[i]; 340 sc->enaddr[i*2+1] = eeprom_buff[i] >> 8; 341 } 342 /* 343 * If no interrupt specified, use what the 344 * board tells us. 345 */ --- 875 unchanged lines hidden (view full) --- 1221 if (media & IFM_FDX) 1222 cs_duplex_full(sc); 1223 else if (media & IFM_HDX) 1224 cs_duplex_half(sc); 1225 else 1226 error = cs_duplex_auto(sc); 1227 break; 1228 case IFM_10_2: |
1229 error = enable_bnc(sc); | 1229 enable_bnc(sc); |
1230 break; 1231 case IFM_10_5: | 1230 break; 1231 case IFM_10_5: |
1232 error = enable_aui(sc); | 1232 enable_aui(sc); |
1233 break; 1234 } 1235 1236 /* 1237 * Turn the transmitter & receiver back on 1238 */ 1239 cs_writereg(sc, PP_LineCTL, cs_readreg(sc, PP_LineCTL) | 1240 SERIAL_RX_ON | SERIAL_TX_ON); 1241 1242 return (error); 1243} | 1233 break; 1234 } 1235 1236 /* 1237 * Turn the transmitter & receiver back on 1238 */ 1239 cs_writereg(sc, PP_LineCTL, cs_readreg(sc, PP_LineCTL) | 1240 SERIAL_RX_ON | SERIAL_TX_ON); 1241 1242 return (error); 1243} |