summaryrefslogtreecommitdiffstats
path: root/sys/pci/if_sis.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-09-03 07:40:04 +0000
committerphk <phk@FreeBSD.org>2003-09-03 07:40:04 +0000
commitd3c24621a1a99676df4065c385530389d738233a (patch)
tree21e7fc6aed0a6a6fc0ee49c48276ccbe2d98b94f /sys/pci/if_sis.c
parent70be9f6715f9864d78de7f207821e5cadfd12c61 (diff)
downloadFreeBSD-src-d3c24621a1a99676df4065c385530389d738233a.zip
FreeBSD-src-d3c24621a1a99676df4065c385530389d738233a.tar.gz
Examine and record the Silicon Revision Register on NS parts.
We can't update the device description in attach (why not ?), so we device_print() what we find. Conditionalize the short cable fix on this being older than rev 16A. Call device_printf() when we apply short cable fix. Include interrupt hold-off setting for rev 16+ under "#ifdef notyet" The device_printf()'s will go under bootverbose once the various issues have settled a bit.
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 5c78900..c25b4c2 100644
--- a/sys/pci/if_sis.c
+++ b/sys/pci/if_sis.c
@@ -107,7 +107,7 @@ MODULE_DEPEND(sis, miibus, 1, 1, 1);
static struct sis_type sis_devs[] = {
{ SIS_VENDORID, SIS_DEVICEID_900, "SiS 900 10/100BaseTX" },
{ SIS_VENDORID, SIS_DEVICEID_7016, "SiS 7016 10/100BaseTX" },
- { NS_VENDORID, NS_DEVICEID_DP83815, "NatSemi DP83815 10/100BaseTX" },
+ { NS_VENDORID, NS_DEVICEID_DP83815, "NatSemi DP8381[56] 10/100BaseTX" },
{ 0, 0, NULL }
};
@@ -1052,6 +1052,8 @@ sis_attach(dev)
sc = device_get_softc(dev);
unit = device_get_unit(dev);
+ sc->sis_self = dev;
+
mtx_init(&sc->sis_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
MTX_DEF | MTX_RECURSE);
@@ -1131,6 +1133,18 @@ sis_attach(dev)
*/
switch (pci_get_vendor(dev)) {
case NS_VENDORID:
+ sc->sis_srr = CSR_READ_4(sc, NS_SRR);
+
+ /* We can't update the device description, so spew */
+ if (sc->sis_srr == NS_SRR_15C)
+ device_printf(dev, "Silicon Revision: DP83815C\n");
+ else if (sc->sis_srr == NS_SRR_15D)
+ device_printf(dev, "Silicon Revision: DP83815D\n");
+ else if (sc->sis_srr == NS_SRR_16A)
+ device_printf(dev, "Silicon Revision: DP83816A\n");
+ else
+ device_printf(dev, "Silicon Revision %x\n", sc->sis_srr);
+
/*
* Reading the MAC address out of the EEPROM on
* the NatSemi chip takes a bit more work than
@@ -2031,6 +2045,16 @@ sis_init(xsc)
*/
sis_stop(sc);
+#ifdef notyet
+ if (sc->sis_type == SIS_TYPE_83815 && sc->sis_srr >= NS_SRR_16A) {
+ /*
+ * Configure 400usec of interrupt holdoff. This is based
+ * on emperical tests on a Soekris 4801.
+ */
+ CSR_WRITE_4(sc, NS_IHR, 0x100 | 4);
+ }
+#endif
+
mii = device_get_softc(sc->sis_miibus);
/* Set MAC address */
@@ -2146,7 +2170,7 @@ sis_init(xsc)
SIS_CLRBIT(sc, SIS_RX_CFG, SIS_RXCFG_RX_TXPKTS);
}
- if (sc->sis_type == SIS_TYPE_83815 &&
+ if (sc->sis_type == SIS_TYPE_83815 && sc->sis_srr < NS_SRR_16A &&
IFM_SUBTYPE(mii->mii_media_active) == IFM_100_TX) {
uint32_t reg;
@@ -2163,6 +2187,7 @@ sis_init(xsc)
DELAY(100);
reg = CSR_READ_4(sc, NS_PHY_TDATA);
if ((reg & 0x0080) == 0 || (reg & 0xff) >= 0xd8) {
+ device_printf(sc->sis_self, "Applying short cable fix (reg=%x)\n", reg);
CSR_WRITE_4(sc, NS_PHY_TDATA, 0x00e8);
SIS_SETBIT(sc, NS_PHY_DSPCFG, 0x20);
}
OpenPOWER on IntegriCloud