summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2003-09-02 22:44:28 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2003-09-02 22:44:28 +0000
commit88f01465f0f59533dde0f4d04acb064481b4faf4 (patch)
tree56e9442a37ae2665ffa021bf5fde35265c5fad7e
parent3bba28bf20ba83497ed9f3bc33d401fbdeecd827 (diff)
Increase autonegotiation wait to 5000ms.
This gives autonegotiation a fair chance to complete. Copper switches can take several seconds to do autonegotiation. Fixes sk need to be poked after reboot and allows sk to use dhcp configuration. Problem and workaround reported by Laurence Tratt. Also minor cleanup: 1) Remove duplicate function prototypes/ 2) Remove unneeded '#include <malloc.c>'. From FreeBSD. 3) Remove some static's. ok deraadt@ nate@ henning@ henric@. Also tested by Laurence Tratt and Damien Couderc.
-rw-r--r--sys/dev/mii/eephy.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/sys/dev/mii/eephy.c b/sys/dev/mii/eephy.c
index d5f1c621e60..0859dd33cee 100644
--- a/sys/dev/mii/eephy.c
+++ b/sys/dev/mii/eephy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: eephy.c,v 1.10 2003/08/01 04:46:13 nate Exp $ */
+/* $OpenBSD: eephy.c,v 1.11 2003/09/02 22:44:27 krw Exp $ */
/*
* Principal Author: Parag Patel
* Copyright (c) 2001
@@ -44,7 +44,6 @@
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/device.h>
-#include <sys/malloc.h>
#include <sys/socket.h>
#include <net/if.h>
@@ -71,11 +70,10 @@ struct cfdriver eephy_cd = {
NULL, "eephy", DV_DULL
};
-int eephy_service(struct mii_softc *, struct mii_data *, int);
-void eephy_status(struct mii_softc *);
-static int eephy_mii_phy_auto(struct mii_softc *, int);
+int eephy_mii_phy_auto(struct mii_softc *, int);
+void eephy_reset(struct mii_softc *);
+
extern void mii_phy_auto_timeout(void *);
-static void eephy_reset(struct mii_softc *);
int
@@ -157,7 +155,7 @@ eephyattach(struct device *parent, struct device *self, void *aux)
#undef ADD
}
-static void
+void
eephy_reset(struct mii_softc *sc)
{
u_int32_t reg;
@@ -417,7 +415,7 @@ eephy_status(struct mii_softc *sc)
}
}
-static int
+int
eephy_mii_phy_auto(struct mii_softc *sc, int waitfor)
{
int bmsr, i;
@@ -438,8 +436,8 @@ eephy_mii_phy_auto(struct mii_softc *sc, int waitfor)
}
if (waitfor) {
- /* Wait 500ms for it to complete. */
- for (i = 0; i < 500; i++) {
+ /* Wait 5 seconds for it to complete. */
+ for (i = 0; i < 5000; i++) {
bmsr = PHY_READ(sc, E1000_SR) | PHY_READ(sc, E1000_SR);
if (bmsr & E1000_SR_AUTO_NEG_COMPLETE) {
@@ -465,7 +463,7 @@ eephy_mii_phy_auto(struct mii_softc *sc, int waitfor)
sc->mii_flags |= MIIF_DOINGAUTO;
sc->mii_ticks = 0;
timeout_set(&sc->mii_phy_timo, mii_phy_auto_timeout, sc);
- timeout_add(&sc->mii_phy_timo, hz >> 1);
+ timeout_add(&sc->mii_phy_timo, 5 * hz);
}
return (EJUSTRETURN);
}