diff options
author | yongari <yongari@FreeBSD.org> | 2009-12-14 21:16:02 +0000 |
---|---|---|
committer | yongari <yongari@FreeBSD.org> | 2009-12-14 21:16:02 +0000 |
commit | 2f7dcd74971c46da8afe9f395774c13b1a670f42 (patch) | |
tree | cbbe751798e41a08cea4967c229e13542a37fad5 | |
parent | c5493da5671d78f0bda5ba0cfd9c1572d390b517 (diff) | |
download | FreeBSD-src-2f7dcd74971c46da8afe9f395774c13b1a670f42.zip FreeBSD-src-2f7dcd74971c46da8afe9f395774c13b1a670f42.tar.gz |
We don't have to reload EEPROM in vge_reset(). Because vge_reset()
is called in vge_init_lock(), vge(4) always used to reload EEPROM.
Also add more comment why vge(4) clears VGE_CHIPCFG0_PACPI bit.
While I'm here add missing new line in vge_reset().
-rw-r--r-- | sys/dev/vge/if_vge.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/sys/dev/vge/if_vge.c b/sys/dev/vge/if_vge.c index 4d5050c..53bf03a 100644 --- a/sys/dev/vge/if_vge.c +++ b/sys/dev/vge/if_vge.c @@ -586,27 +586,12 @@ vge_reset(struct vge_softc *sc) } if (i == VGE_TIMEOUT) { - device_printf(sc->vge_dev, "soft reset timed out"); + device_printf(sc->vge_dev, "soft reset timed out\n"); CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_STOP_FORCE); DELAY(2000); } DELAY(5000); - - CSR_SETBIT_1(sc, VGE_EECSR, VGE_EECSR_RELOAD); - - for (i = 0; i < VGE_TIMEOUT; i++) { - DELAY(5); - if ((CSR_READ_1(sc, VGE_EECSR) & VGE_EECSR_RELOAD) == 0) - break; - } - - if (i == VGE_TIMEOUT) { - device_printf(sc->vge_dev, "EEPROM reload timed out\n"); - return; - } - - CSR_CLRBIT_1(sc, VGE_CHIPCFG0, VGE_CHIPCFG0_PACPI); } /* @@ -958,7 +943,7 @@ vge_attach(device_t dev) u_char eaddr[ETHER_ADDR_LEN]; struct vge_softc *sc; struct ifnet *ifp; - int error = 0, cap, msic, rid; + int error = 0, cap, i, msic, rid; sc = device_get_softc(dev); sc->vge_dev = dev; @@ -1012,6 +997,21 @@ vge_attach(device_t dev) /* Reset the adapter. */ vge_reset(sc); + /* Reload EEPROM. */ + CSR_WRITE_1(sc, VGE_EECSR, VGE_EECSR_RELOAD); + for (i = 0; i < VGE_TIMEOUT; i++) { + DELAY(5); + if ((CSR_READ_1(sc, VGE_EECSR) & VGE_EECSR_RELOAD) == 0) + break; + } + if (i == VGE_TIMEOUT) + device_printf(dev, "EEPROM reload timed out\n"); + /* + * Clear PACPI as EEPROM reload will set the bit. Otherwise + * MAC will receive magic packet which in turn confuses + * controller. + */ + CSR_CLRBIT_1(sc, VGE_CHIPCFG0, VGE_CHIPCFG0_PACPI); /* * Get station address from the EEPROM. |