summaryrefslogtreecommitdiffstats
path: root/sys/pci/if_sis.c
diff options
context:
space:
mode:
authormbr <mbr@FreeBSD.org>2003-01-10 08:16:03 +0000
committermbr <mbr@FreeBSD.org>2003-01-10 08:16:03 +0000
commit8072add6cd64deb4e077636a4cbad94573f11b6e (patch)
tree1357173551b0b12d24d5c5f92e445cf865c847ac /sys/pci/if_sis.c
parent75f683db0e133f819fda95934108547a6f70a340 (diff)
downloadFreeBSD-src-8072add6cd64deb4e077636a4cbad94573f11b6e.zip
FreeBSD-src-8072add6cd64deb4e077636a4cbad94573f11b6e.tar.gz
Make newer integrated SiS900 cards working.
Allow to read EEPROM from LAN. It is shared between a 1394 controller and the NIC and each time we access it, we need to set SIS_EECMD_REQ. Idea from: linux driver source Reviewed by: luoqi Obtained from: linux driver source (idea)
Diffstat (limited to 'sys/pci/if_sis.c')
-rw-r--r--sys/pci/if_sis.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/sys/pci/if_sis.c b/sys/pci/if_sis.c
index bd8e885..0f8e392 100644
--- a/sys/pci/if_sis.c
+++ b/sys/pci/if_sis.c
@@ -993,8 +993,9 @@ sis_attach(dev)
u_int32_t command;
struct sis_softc *sc;
struct ifnet *ifp;
- int unit, error = 0, rid;
+ int unit, error = 0, rid, waittime = 0;
+ waittime = 0;
sc = device_get_softc(dev);
unit = device_get_unit(dev);
bzero(sc, sizeof(struct sis_softc));
@@ -1159,7 +1160,31 @@ sis_attach(dev)
else if (sc->sis_rev == SIS_REV_635 ||
sc->sis_rev == SIS_REV_630ET)
sis_read_mac(sc, dev, (caddr_t)&eaddr);
- else
+ else if (sc->sis_rev == SIS_REV_96x) {
+ /* Allow to read EEPROM from LAN. It is shared
+ * between a 1394 controller and the NIC and each
+ * time we access it, we need to set SIS_EECMD_REQ.
+ */
+ SIO_SET(SIS_EECMD_REQ);
+ for (waittime = 0; waittime < SIS_TIMEOUT;
+ waittime++) {
+ /* Force EEPROM to idle state. */
+ sis_eeprom_idle(sc);
+ if (CSR_READ_4(sc, SIS_EECTL) & SIS_EECMD_GNT) {
+ sis_read_eeprom(sc, (caddr_t)&eaddr,
+ SIS_EE_NODEADDR, 3, 0);
+ break;
+ }
+ DELAY(1);
+ }
+ /*
+ * Set SIS_EECTL_CLK to high, so a other master
+ * can operate on the i2c bus.
+ */
+ SIO_SET(SIS_EECTL_CLK);
+ /* Refuse EEPROM access by LAN */
+ SIO_SET(SIS_EECMD_DONE);
+ } else
#endif
sis_read_eeprom(sc, (caddr_t)&eaddr,
SIS_EE_NODEADDR, 3, 0);
OpenPOWER on IntegriCloud