summaryrefslogtreecommitdiffstats
path: root/sys/dev/ed
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2009-04-02 17:15:49 +0000
committerimp <imp@FreeBSD.org>2009-04-02 17:15:49 +0000
commit08539c697dcfc5d69245a5f2088732d8ace63636 (patch)
tree3aba31d378f5dbe45a2a258871a0fdaf4b92e9ae /sys/dev/ed
parentf855ef0e5308d50b798591a0d102872fbd8670f7 (diff)
downloadFreeBSD-src-08539c697dcfc5d69245a5f2088732d8ace63636.zip
FreeBSD-src-08539c697dcfc5d69245a5f2088732d8ace63636.tar.gz
Minor DLINK DL100xx support tweaks:
The DIROUT bit difference between the 19 and 22 is annoying. We can set both bits on both parts without ill effect. Use this trick to simplify the code. The DELAYS in the MII bus bit-bang code for the DL100xx parts aren't needed. Eliminate them.
Diffstat (limited to 'sys/dev/ed')
-rw-r--r--sys/dev/ed/dl100xxreg.h1
-rw-r--r--sys/dev/ed/if_ed_pccard.c17
2 files changed, 3 insertions, 15 deletions
diff --git a/sys/dev/ed/dl100xxreg.h b/sys/dev/ed/dl100xxreg.h
index a4659b0..1fa426c 100644
--- a/sys/dev/ed/dl100xxreg.h
+++ b/sys/dev/ed/dl100xxreg.h
@@ -38,5 +38,6 @@
#define ED_DL100XX_MII_DATAIN 0x10
#define ED_DL100XX_MII_DIROUT_22 0x20
#define ED_DL100XX_MII_DIROUT_19 0x10
+#define ED_DL100XX_MII_DIROUT 0x30
#define ED_DL100XX_MII_DATAOUT 0x40
#define ED_DL100XX_MII_CLK 0x80
diff --git a/sys/dev/ed/if_ed_pccard.c b/sys/dev/ed/if_ed_pccard.c
index 9502250..193543d 100644
--- a/sys/dev/ed/if_ed_pccard.c
+++ b/sys/dev/ed/if_ed_pccard.c
@@ -701,21 +701,14 @@ ed_pccard_dl100xx_mii_writebits(struct ed_softc *sc, u_int val, int nbits)
{
int i;
- if (sc->chip_type == ED_CHIP_TYPE_DL10022)
- DL100XX_MIISET(sc, ED_DL100XX_MII_DIROUT_22);
- else
- DL100XX_MIISET(sc, ED_DL100XX_MII_DIROUT_19);
-
+ DL100XX_MIISET(sc, ED_DL100XX_MII_DIROUT);
for (i = nbits - 1; i >= 0; i--) {
if ((val >> i) & 1)
DL100XX_MIISET(sc, ED_DL100XX_MII_DATAOUT);
else
DL100XX_MIICLR(sc, ED_DL100XX_MII_DATAOUT);
- DELAY(10);
DL100XX_MIISET(sc, ED_DL100XX_MII_CLK);
- DELAY(10);
DL100XX_MIICLR(sc, ED_DL100XX_MII_CLK);
- DELAY(10);
}
}
@@ -725,19 +718,13 @@ ed_pccard_dl100xx_mii_readbits(struct ed_softc *sc, int nbits)
int i;
u_int val = 0;
- if (sc->chip_type == ED_CHIP_TYPE_DL10022)
- DL100XX_MIICLR(sc, ED_DL100XX_MII_DIROUT_22);
- else
- DL100XX_MIICLR(sc, ED_DL100XX_MII_DIROUT_19);
-
+ DL100XX_MIICLR(sc, ED_DL100XX_MII_DIROUT);
for (i = nbits - 1; i >= 0; i--) {
DL100XX_MIISET(sc, ED_DL100XX_MII_CLK);
- DELAY(10);
val <<= 1;
if (ed_asic_inb(sc, ED_DL100XX_MIIBUS) & ED_DL100XX_MII_DATAIN)
val++;
DL100XX_MIICLR(sc, ED_DL100XX_MII_CLK);
- DELAY(10);
}
return val;
}
OpenPOWER on IntegriCloud