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)
This commit is contained in:
mbr 2003-01-10 08:16:03 +00:00
parent 75f683db0e
commit 8072add6cd
2 changed files with 36 additions and 2 deletions

View File

@ -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);

View File

@ -129,6 +129,14 @@
#define SIS_EECMD_READ 0x180
#define SIS_EECMD_ERASE 0x1c0
/*
* EEPROM Commands for SiS96x
* chipsets.
*/
#define SIS_EECMD_REQ 0x00000400
#define SIS_EECMD_DONE 0x00000200
#define SIS_EECMD_GNT 0x00000100
#define SIS_EE_NODEADDR 0x8
#define NS_EE_NODEADDR 0x6
@ -392,6 +400,7 @@ struct sis_ring_data {
#define SIS_REV_630EA1 0x0083
#define SIS_REV_630ET 0x0084
#define SIS_REV_635 0x0090
#define SIS_REV_96x 0x0091
/*
* NatSemi vendor ID