In the status routine, always use the media selected in the BMCR if
autonegotiation is not enabled. This is more reliable on many PHYs, and requires fewer register reads.
This commit is contained in:
parent
c755434d9d
commit
aabf2a0809
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: icsphy.c,v 1.6 1998/11/05 00:19:32 thorpej Exp $ */
|
||||
/* $NetBSD: icsphy.c,v 1.7 1998/11/05 04:01:32 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -278,18 +278,26 @@ icsphy_status(sc)
|
||||
if (bmcr & BMCR_LOOP)
|
||||
mii->mii_media_active |= IFM_LOOP;
|
||||
|
||||
if ((bmcr & BMCR_AUTOEN) && (qpr & QPR_ACOMP) == 0) {
|
||||
/* Erg, still trying, I guess... */
|
||||
mii->mii_media_active |= IFM_NONE;
|
||||
return;
|
||||
if (bmcr & BMCR_AUTOEN) {
|
||||
if ((qpr & QPR_ACOMP) == 0) {
|
||||
/* Erg, still trying, I guess... */
|
||||
mii->mii_media_active |= IFM_NONE;
|
||||
return;
|
||||
}
|
||||
if (qpr & QPR_SPEED)
|
||||
mii->mii_media_active |= IFM_100_TX;
|
||||
else
|
||||
mii->mii_media_active |= IFM_10_T;
|
||||
if (qpr & QPR_FDX)
|
||||
mii->mii_media_active |= IFM_FDX;
|
||||
} else {
|
||||
if (bmcr & BMCR_S100)
|
||||
mii->mii_media_active |= IFM_100_TX;
|
||||
else
|
||||
mii->mii_media_active |= IFM_10_T;
|
||||
if (bmcr & BMCR_FDX)
|
||||
mii->mii_media_active |= IFM_FDX;
|
||||
}
|
||||
|
||||
if (qpr & QPR_SPEED)
|
||||
mii->mii_media_active |= IFM_100_TX;
|
||||
else
|
||||
mii->mii_media_active |= IFM_10_T;
|
||||
if (qpr & QPR_FDX)
|
||||
mii->mii_media_active |= IFM_FDX;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lxtphy.c,v 1.7 1998/11/05 00:19:32 thorpej Exp $ */
|
||||
/* $NetBSD: lxtphy.c,v 1.8 1998/11/05 04:01:32 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -291,16 +291,24 @@ lxtphy_status(sc)
|
||||
if (bmcr & BMCR_LOOP)
|
||||
mii->mii_media_active |= IFM_LOOP;
|
||||
|
||||
if ((bmcr & BMCR_AUTOEN) && (csr & CSR_ACOMP) == 0) {
|
||||
/* Erg, still trying, I guess... */
|
||||
mii->mii_media_active |= IFM_NONE;
|
||||
return;
|
||||
if (bmcr & BMCR_AUTOEN) {
|
||||
if ((csr & CSR_ACOMP) == 0) {
|
||||
/* Erg, still trying, I guess... */
|
||||
mii->mii_media_active |= IFM_NONE;
|
||||
return;
|
||||
}
|
||||
if (csr & CSR_SPEED)
|
||||
mii->mii_media_active |= IFM_100_TX;
|
||||
else
|
||||
mii->mii_media_active |= IFM_10_T;
|
||||
if (csr & CSR_DUPLEX)
|
||||
mii->mii_media_active |= IFM_FDX;
|
||||
} else {
|
||||
if (bmcr & BMCR_S100)
|
||||
mii->mii_media_active |= IFM_100_TX;
|
||||
else
|
||||
mii->mii_media_active |= IFM_10_T;
|
||||
if (bmcr & BMCR_FDX)
|
||||
mii->mii_media_active |= IFM_FDX;
|
||||
}
|
||||
|
||||
if (csr & CSR_SPEED)
|
||||
mii->mii_media_active |= IFM_100_TX;
|
||||
else
|
||||
mii->mii_media_active |= IFM_10_T;
|
||||
if (csr & CSR_DUPLEX)
|
||||
mii->mii_media_active |= IFM_FDX;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: qsphy.c,v 1.9 1998/11/05 00:19:32 thorpej Exp $ */
|
||||
/* $NetBSD: qsphy.c,v 1.10 1998/11/05 04:01:32 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -272,34 +272,42 @@ qsphy_status(sc)
|
||||
if (bmcr & BMCR_LOOP)
|
||||
mii->mii_media_active |= IFM_LOOP;
|
||||
|
||||
if ((bmcr & BMCR_AUTOEN) && (bmsr & BMSR_ACOMP) == 0) {
|
||||
/* Erg, still trying, I guess... */
|
||||
mii->mii_media_active |= IFM_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
pctl = PHY_READ(sc, MII_QSPHY_PCTL) |
|
||||
PHY_READ(sc, MII_QSPHY_PCTL);
|
||||
switch (pctl & PCTL_OPMASK) {
|
||||
case PCTL_10_T:
|
||||
mii->mii_media_active |= IFM_10_T;
|
||||
break;
|
||||
case PCTL_10_T_FDX:
|
||||
mii->mii_media_active |= IFM_10_T|IFM_FDX;
|
||||
break;
|
||||
case PCTL_100_TX:
|
||||
mii->mii_media_active |= IFM_100_TX;
|
||||
break;
|
||||
case PCTL_100_TX_FDX:
|
||||
mii->mii_media_active |= IFM_100_TX|IFM_FDX;
|
||||
break;
|
||||
case PCTL_100_T4:
|
||||
mii->mii_media_active |= IFM_100_T4;
|
||||
break;
|
||||
default:
|
||||
/* Erg... this shouldn't happen. */
|
||||
mii->mii_media_active |= IFM_NONE;
|
||||
break;
|
||||
if (bmcr & BMCR_AUTOEN) {
|
||||
if ((bmsr & BMSR_ACOMP) == 0) {
|
||||
/* Erg, still trying, I guess... */
|
||||
mii->mii_media_active |= IFM_NONE;
|
||||
return;
|
||||
}
|
||||
pctl = PHY_READ(sc, MII_QSPHY_PCTL) |
|
||||
PHY_READ(sc, MII_QSPHY_PCTL);
|
||||
switch (pctl & PCTL_OPMASK) {
|
||||
case PCTL_10_T:
|
||||
mii->mii_media_active |= IFM_10_T;
|
||||
break;
|
||||
case PCTL_10_T_FDX:
|
||||
mii->mii_media_active |= IFM_10_T|IFM_FDX;
|
||||
break;
|
||||
case PCTL_100_TX:
|
||||
mii->mii_media_active |= IFM_100_TX;
|
||||
break;
|
||||
case PCTL_100_TX_FDX:
|
||||
mii->mii_media_active |= IFM_100_TX|IFM_FDX;
|
||||
break;
|
||||
case PCTL_100_T4:
|
||||
mii->mii_media_active |= IFM_100_T4;
|
||||
break;
|
||||
default:
|
||||
/* Erg... this shouldn't happen. */
|
||||
mii->mii_media_active |= IFM_NONE;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (bmcr & BMCR_S100)
|
||||
mii->mii_media_active |= IFM_100_TX;
|
||||
else
|
||||
mii->mii_media_active |= IFM_10_T;
|
||||
if (bmcr & BMCR_FDX)
|
||||
mii->mii_media_active |= IFM_FDX;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sqphy.c,v 1.6 1998/11/05 00:19:32 thorpej Exp $ */
|
||||
/* $NetBSD: sqphy.c,v 1.7 1998/11/05 04:01:33 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -286,17 +286,25 @@ sqphy_status(sc)
|
||||
if (bmcr & BMCR_LOOP)
|
||||
mii->mii_media_active |= IFM_LOOP;
|
||||
|
||||
if ((bmcr & BMCR_AUTOEN) && (bmsr & BMSR_ACOMP) == 0) {
|
||||
/* Erg, still trying, I guess... */
|
||||
mii->mii_media_active |= IFM_NONE;
|
||||
return;
|
||||
if (bmcr & BMCR_AUTOEN) {
|
||||
if ((bmsr & BMSR_ACOMP) == 0) {
|
||||
/* Erg, still trying, I guess... */
|
||||
mii->mii_media_active |= IFM_NONE;
|
||||
return;
|
||||
}
|
||||
status = PHY_READ(sc, MII_SQPHY_STATUS);
|
||||
if (status & STATUS_SPD_DET)
|
||||
mii->mii_media_active |= IFM_100_TX;
|
||||
else
|
||||
mii->mii_media_active |= IFM_10_T;
|
||||
if (status & STATUS_DPLX_DET)
|
||||
mii->mii_media_active |= IFM_FDX;
|
||||
} else {
|
||||
if (bmcr & BMCR_S100)
|
||||
mii->mii_media_active |= IFM_100_TX;
|
||||
else
|
||||
mii->mii_media_active |= IFM_10_T;
|
||||
if (bmcr & BMCR_FDX)
|
||||
mii->mii_media_active |= IFM_FDX;
|
||||
}
|
||||
|
||||
status = PHY_READ(sc, MII_SQPHY_STATUS);
|
||||
if (status & STATUS_SPD_DET)
|
||||
mii->mii_media_active |= IFM_100_TX;
|
||||
else
|
||||
mii->mii_media_active |= IFM_10_T;
|
||||
if (status & STATUS_DPLX_DET)
|
||||
mii->mii_media_active |= IFM_FDX;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user