Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic The EEPROM registers/bits are different on the Co...
details: https://anonhg.NetBSD.org/src/rev/e98f8e567c35
branches: trunk
changeset: 512985:e98f8e567c35
user: thorpej <thorpej%NetBSD.org@localhost>
date: Fri Jul 20 05:44:48 2001 +0000
description:
The EEPROM registers/bits are different on the Corkscrew (3c515). Adjust
for this.
diffstat:
sys/dev/ic/elink3.c | 38 ++++++++++++++++++++++++++++++--------
1 files changed, 30 insertions(+), 8 deletions(-)
diffs (87 lines):
diff -r 1e1b3c1d5196 -r e98f8e567c35 sys/dev/ic/elink3.c
--- a/sys/dev/ic/elink3.c Fri Jul 20 05:43:11 2001 +0000
+++ b/sys/dev/ic/elink3.c Fri Jul 20 05:44:48 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: elink3.c,v 1.95 2001/07/07 16:13:47 thorpej Exp $ */
+/* $NetBSD: elink3.c,v 1.96 2001/07/20 05:44:48 thorpej Exp $ */
/*-
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -1896,27 +1896,38 @@
{
bus_space_tag_t iot = sc->sc_iot;
bus_space_handle_t ioh = sc->sc_ioh;
+ bus_addr_t eecmd;
int i = 100, j;
+ uint16_t busybit;
if (sc->bustype == ELINK_BUS_PCMCIA) {
delay(1000);
return 0;
}
+ if (sc->ep_chipset == ELINK_CHIPSET_CORKSCREW) {
+ eecmd = CORK_ASIC_EEPROM_COMMAND;
+ busybit = CORK_EEPROM_BUSY;
+ } else {
+ eecmd = ELINK_W0_EEPROM_COMMAND;
+ busybit = EEPROM_BUSY;
+ }
+
j = 0; /* bad GCC flow analysis */
while (i--) {
- j = bus_space_read_2(iot, ioh, ELINK_W0_EEPROM_COMMAND);
- if (j & EEPROM_BUSY)
+ j = bus_space_read_2(iot, ioh, eecmd);
+ if (j & busybit)
delay(100);
else
break;
}
- if (!i) {
+ if (i == 0) {
printf("\n%s: eeprom failed to come ready\n",
sc->sc_dev.dv_xname);
return (1);
}
- if (j & EEPROM_TST_MODE) {
+ if (sc->ep_chipset != ELINK_CHIPSET_CORKSCREW &&
+ (j & EEPROM_TST_MODE) != 0) {
/* XXX PnP mode? */
printf("\n%s: erase pencil mark!\n", sc->sc_dev.dv_xname);
return (1);
@@ -1929,8 +1940,17 @@
struct ep_softc *sc;
u_int16_t offset;
{
+ bus_addr_t eecmd, eedata;
u_int16_t readcmd;
+ if (sc->ep_chipset == ELINK_CHIPSET_CORKSCREW) {
+ eecmd = CORK_ASIC_EEPROM_COMMAND;
+ eedata = CORK_ASIC_EEPROM_DATA;
+ } else {
+ eecmd = ELINK_W0_EEPROM_COMMAND;
+ eedata = ELINK_W0_EEPROM_DATA;
+ }
+
/*
* RoadRunner has a larger EEPROM, so a different read command
* is required.
@@ -1942,11 +1962,13 @@
if (epbusyeeprom(sc))
return (0); /* XXX why is eeprom busy? */
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, ELINK_W0_EEPROM_COMMAND,
- readcmd | offset);
+
+ bus_space_write_2(sc->sc_iot, sc->sc_ioh, eecmd, readcmd | offset);
+
if (epbusyeeprom(sc))
return (0); /* XXX why is eeprom busy? */
- return (bus_space_read_2(sc->sc_iot, sc->sc_ioh, ELINK_W0_EEPROM_DATA));
+
+ return (bus_space_read_2(sc->sc_iot, sc->sc_ioh, eedata));
}
void
Home |
Main Index |
Thread Index |
Old Index