summaryrefslogtreecommitdiff
path: root/sys/dev/mii
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2008-11-08 03:03:51 +0000
committerBrad Smith <brad@cvs.openbsd.org>2008-11-08 03:03:51 +0000
commit3129d31703c65e585169a720c03ce855777329c6 (patch)
treeb79c4653114a34220d5d6d08233cc589fc083d12 /sys/dev/mii
parentc58662ff4552c2d9bacd9737745805f79d8b1e9d (diff)
Add additional link status checking for for the BCM5906 PHY.
Based on info from the Linux tg3 driver.
Diffstat (limited to 'sys/dev/mii')
-rw-r--r--sys/dev/mii/brgphy.c16
-rw-r--r--sys/dev/mii/brgphyreg.h5
2 files changed, 17 insertions, 4 deletions
diff --git a/sys/dev/mii/brgphy.c b/sys/dev/mii/brgphy.c
index 4a997ab7cf5..18e8f76ea08 100644
--- a/sys/dev/mii/brgphy.c
+++ b/sys/dev/mii/brgphy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: brgphy.c,v 1.83 2008/11/08 01:50:48 brad Exp $ */
+/* $OpenBSD: brgphy.c,v 1.84 2008/11/08 03:03:50 brad Exp $ */
/*
* Copyright (c) 2000
@@ -398,14 +398,17 @@ brgphy_copper_status(struct mii_softc *sc)
mii->mii_media_active |= IFM_LOOP;
if (bmcr & BRGPHY_BMCR_AUTOEN) {
+ int auxsts;
+
if ((bmsr & BRGPHY_BMSR_ACOMP) == 0) {
/* Erg, still trying, I guess... */
mii->mii_media_active |= IFM_NONE;
return;
}
- switch (PHY_READ(sc, BRGPHY_MII_AUXSTS) &
- BRGPHY_AUXSTS_AN_RES) {
+ auxsts = PHY_READ(sc, BRGPHY_MII_AUXSTS);
+
+ switch (auxsts & BRGPHY_AUXSTS_AN_RES) {
case BRGPHY_RES_1000FD:
mii->mii_media_active |= IFM_1000_T | IFM_FDX;
break;
@@ -428,6 +431,13 @@ brgphy_copper_status(struct mii_softc *sc)
mii->mii_media_active |= IFM_10_T | IFM_HDX;
break;
default:
+ if (sc->mii_model == MII_MODEL_BROADCOM2_BCM5906) {
+ mii->mii_media_active |= (auxsts &
+ BRGPHY_RES_100) ? IFM_100_TX : IFM_10_T;
+ mii->mii_media_active |= (auxsts &
+ BRGPHY_RES_FULL) ? IFM_FDX : IFM_HDX;
+ break;
+ }
mii->mii_media_active |= IFM_NONE;
return;
}
diff --git a/sys/dev/mii/brgphyreg.h b/sys/dev/mii/brgphyreg.h
index cd97e5456f5..7537f0a5077 100644
--- a/sys/dev/mii/brgphyreg.h
+++ b/sys/dev/mii/brgphyreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: brgphyreg.h,v 1.12 2008/06/11 22:43:20 brad Exp $ */
+/* $OpenBSD: brgphyreg.h,v 1.13 2008/11/08 03:03:50 brad Exp $ */
/*
* Copyright (c) 2000
@@ -229,6 +229,9 @@
#define BRGPHY_RES_100HD 0x0300 /* 100baseT half duplex */
#define BRGPHY_RES_10FD 0x0200 /* 10baseT full duplex */
#define BRGPHY_RES_10HD 0x0100 /* 10baseT half duplex */
+/* 5906 */
+#define BRGPHY_RES_100 0x0008 /* 100baseT */
+#define BRGPHY_RES_FULL 0x0001 /* full duplex */
#define BRGPHY_MII_ISR 0x1A /* interrupt status */
#define BRGPHY_ISR_PSERR 0x4000 /* Pair swap error */