diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2008-11-08 06:52:50 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2008-11-08 06:52:50 +0000 |
commit | 542aff126a50426eb06d6beee51cf85be4a37b60 (patch) | |
tree | 521a5e5a1ff95419d525c19723966ed49506d428 /sys/dev/ic/re.c | |
parent | 949cb8965c089708d52299414edf673320b3af2a (diff) |
Reduce the delay's a bit in the miibus read/write routines.
Based on the Linux r8169 driver.
Tested on PCI/CardBus and PCIe adapters.
Diffstat (limited to 'sys/dev/ic/re.c')
-rw-r--r-- | sys/dev/ic/re.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/sys/dev/ic/re.c b/sys/dev/ic/re.c index e444f0efa0e..b6210caea42 100644 --- a/sys/dev/ic/re.c +++ b/sys/dev/ic/re.c @@ -1,4 +1,4 @@ -/* $OpenBSD: re.c,v 1.97 2008/11/07 18:12:22 brad Exp $ */ +/* $OpenBSD: re.c,v 1.98 2008/11/08 06:52:49 brad Exp $ */ /* $FreeBSD: if_re.c,v 1.31 2004/09/04 07:54:05 ru Exp $ */ /* * Copyright (c) 1997, 1998-2003 @@ -342,23 +342,21 @@ re_gmii_readreg(struct device *self, int phy, int reg) return (0); /* Let the rgephy driver read the GMEDIASTAT register */ - if (reg == RL_GMEDIASTAT) { rval = CSR_READ_1(sc, RL_GMEDIASTAT); return (rval); } CSR_WRITE_4(sc, RL_PHYAR, reg << 16); - DELAY(1000); - for (i = 0; i < RL_TIMEOUT; i++) { + for (i = 0; i < RL_PHY_TIMEOUT; i++) { rval = CSR_READ_4(sc, RL_PHYAR); if (rval & RL_PHYAR_BUSY) break; - DELAY(100); + DELAY(25); } - if (i == RL_TIMEOUT) { + if (i == RL_PHY_TIMEOUT) { printf ("%s: PHY read failed\n", sc->sc_dev.dv_xname); return (0); } @@ -375,16 +373,15 @@ re_gmii_writereg(struct device *dev, int phy, int reg, int data) CSR_WRITE_4(sc, RL_PHYAR, (reg << 16) | (data & RL_PHYAR_PHYDATA) | RL_PHYAR_BUSY); - DELAY(1000); - for (i = 0; i < RL_TIMEOUT; i++) { + for (i = 0; i < RL_PHY_TIMEOUT; i++) { rval = CSR_READ_4(sc, RL_PHYAR); if (!(rval & RL_PHYAR_BUSY)) break; - DELAY(100); + DELAY(25); } - if (i == RL_TIMEOUT) + if (i == RL_PHY_TIMEOUT) printf ("%s: PHY write failed\n", sc->sc_dev.dv_xname); } |