summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2005-09-17 20:09:56 +0000
committerBrad Smith <brad@cvs.openbsd.org>2005-09-17 20:09:56 +0000
commit115cf216f36f0f885e278fa8972f9fc6b434c2ac (patch)
tree8d9635f3cfaed2e9c0a3e91c8003ae7b7c0bc1af /sys
parent3ba1ec9ec892e42040c4d77f00f271b36a19e9c8 (diff)
re-add code which allows setting master/slave flag for links with
manually set speed/duplex.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/mii/brgphy.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/dev/mii/brgphy.c b/sys/dev/mii/brgphy.c
index 9aa2b66f6f6..d226c7defb6 100644
--- a/sys/dev/mii/brgphy.c
+++ b/sys/dev/mii/brgphy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: brgphy.c,v 1.29 2005/09/17 20:05:47 brad Exp $ */
+/* $OpenBSD: brgphy.c,v 1.30 2005/09/17 20:09:55 brad Exp $ */
/*
* Copyright (c) 2000
@@ -239,6 +239,22 @@ 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);
+ }
break;
default:
return (EINVAL);