diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/mii/brgphy.c | 20 | ||||
-rw-r--r-- | sys/dev/mii/ciphy.c | 20 | ||||
-rw-r--r-- | sys/dev/mii/ipgphy.c | 23 | ||||
-rw-r--r-- | sys/dev/mii/rgephy.c | 18 |
4 files changed, 17 insertions, 64 deletions
diff --git a/sys/dev/mii/brgphy.c b/sys/dev/mii/brgphy.c index 0023bb98bb1..0e9ddb5576e 100644 --- a/sys/dev/mii/brgphy.c +++ b/sys/dev/mii/brgphy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: brgphy.c,v 1.67 2006/12/22 14:11:03 kettenis Exp $ */ +/* $OpenBSD: brgphy.c,v 1.68 2006/12/30 23:04:39 kettenis Exp $ */ /* * Copyright (c) 2000 @@ -256,21 +256,9 @@ setit: if (sc->mii_model != MII_MODEL_xxBROADCOM_BCM5701) break; - /* - * When setting the link manually, one side must - * be the master and the other the slave. However - * ifmedia doesn't give us a good way to specify - * this, so we fake it by using one of the LINK - * flags. If LINK0 is set, we program the PHY to - * be a master, otherwise it's a slave. - */ - if ((mii->mii_ifp->if_flags & IFF_LINK0)) { - PHY_WRITE(sc, BRGPHY_MII_1000CTL, - gig|BRGPHY_1000CTL_MSE|BRGPHY_1000CTL_MSC); - } else { - PHY_WRITE(sc, BRGPHY_MII_1000CTL, - gig|BRGPHY_1000CTL_MSE); - } + if (mii->mii_media.ifm_media & IFM_ETH_MASTER) + gig |= BRGPHY_1000CTL_MSE|BRGPHY_1000CTL_MSC; + PHY_WRITE(sc, BRGPHY_MII_1000CTL, gig); break; default: return (EINVAL); diff --git a/sys/dev/mii/ciphy.c b/sys/dev/mii/ciphy.c index 224b4aa80f0..bb5b0b499cd 100644 --- a/sys/dev/mii/ciphy.c +++ b/sys/dev/mii/ciphy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ciphy.c,v 1.16 2006/12/27 19:11:08 kettenis Exp $ */ +/* $OpenBSD: ciphy.c,v 1.17 2006/12/30 23:04:39 kettenis Exp $ */ /* $FreeBSD: ciphy.c,v 1.1 2004/09/10 20:57:45 wpaul Exp $ */ /* * Copyright (c) 2004 @@ -207,21 +207,9 @@ setit: PHY_WRITE(sc, CIPHY_MII_BMCR, speed|CIPHY_BMCR_AUTOEN|CIPHY_BMCR_STARTNEG); - /* - * When setting the link manually, one side must - * be the master and the other the slave. However - * ifmedia doesn't give us a good way to specify - * this, so we fake it by using one of the LINK - * flags. If LINK0 is set, we program the PHY to - * be a master, otherwise it's a slave. - */ - if ((mii->mii_ifp->if_flags & IFF_LINK0)) { - PHY_WRITE(sc, CIPHY_MII_1000CTL, - gig|CIPHY_1000CTL_MSE|CIPHY_1000CTL_MSC); - } else { - PHY_WRITE(sc, CIPHY_MII_1000CTL, - gig|CIPHY_1000CTL_MSE); - } + if (mii->mii_media.ifm_media & IFM_ETH_MASTER) + gig |= CIPHY_1000CTL_MSE|CIPHY_1000CTL_MSC; + PHY_WRITE(sc, CIPHY_MII_1000CTL, gig); break; case IFM_NONE: PHY_WRITE(sc, MII_BMCR, BMCR_ISO|BMCR_PDOWN); diff --git a/sys/dev/mii/ipgphy.c b/sys/dev/mii/ipgphy.c index 519ef03dc11..d2586750e21 100644 --- a/sys/dev/mii/ipgphy.c +++ b/sys/dev/mii/ipgphy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipgphy.c,v 1.5 2006/12/30 20:59:44 kettenis Exp $ */ +/* $OpenBSD: ipgphy.c,v 1.6 2006/12/30 23:04:39 kettenis Exp $ */ /*- * Copyright (c) 2006, Pyun YongHyeon <yongari@FreeBSD.org> @@ -217,23 +217,10 @@ ipgphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) PHY_WRITE(sc, IPGPHY_MII_1000CR, gig); PHY_WRITE(sc, IPGPHY_MII_BMCR, speed); - /* - * When setting the link manually, one side must - * be the master and the other the slave. However - * ifmedia doesn't give us a good way to specify - * this, so we fake it by using one of the LINK - * flags. If LINK0 is set, we program the PHY to - * be a master, otherwise it's a slave. - */ - if ((mii->mii_ifp->if_flags & IFF_LINK0)) - PHY_WRITE(sc, IPGPHY_MII_1000CR, gig | - IPGPHY_1000CR_MASTER | - IPGPHY_1000CR_MMASTER | - IPGPHY_1000CR_MANUAL); - else - PHY_WRITE(sc, IPGPHY_MII_1000CR, gig | - IPGPHY_1000CR_MASTER | - IPGPHY_1000CR_MANUAL); + if (mii->mii_media.ifm_media & IFM_ETH_MASTER) + gig |= IPGPHY_1000CR_MASTER | IPGPHY_1000CR_MANUAL; + + PHY_WRITE(sc, IPGPHY_MII_1000CR, gig); done: break; diff --git a/sys/dev/mii/rgephy.c b/sys/dev/mii/rgephy.c index dce49fdb088..d1f0e1c81f2 100644 --- a/sys/dev/mii/rgephy.c +++ b/sys/dev/mii/rgephy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rgephy.c,v 1.21 2006/12/30 09:38:28 kettenis Exp $ */ +/* $OpenBSD: rgephy.c,v 1.22 2006/12/30 23:04:39 kettenis Exp $ */ /* * Copyright (c) 2003 * Bill Paul <wpaul@windriver.com>. All rights reserved. @@ -209,19 +209,9 @@ setit: ~(RGEPHY_ANAR_TX_FD | RGEPHY_ANAR_10_FD); } - /* - * When setting the link manually, one side must - * be the master and the other the slave. However - * ifmedia doesn't give us a good way to specify - * this, so we fake it by using one of the LINK - * flags. If LINK0 is set, we program the PHY to - * be a master, otherwise it's a slave. - */ - if (IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T) { - gig |= RGEPHY_1000CTL_MSE; - if (mii->mii_ifp->if_flags & IFF_LINK0) - gig |= RGEPHY_1000CTL_MSC; - } + if (IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T && + mii->mii_media.ifm_media & IFM_ETH_MASTER) + gig |= RGEPHY_1000CTL_MSE|RGEPHY_1000CTL_MSC; PHY_WRITE(sc, RGEPHY_MII_1000CTL, gig); PHY_WRITE(sc, RGEPHY_MII_BMCR, speed | |