summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2002-11-20 22:06:46 +0000
committerJason Wright <jason@cvs.openbsd.org>2002-11-20 22:06:46 +0000
commit36ade96f5a34c3655fb21de23e591d45f374efdb (patch)
tree5d43f443413b12ec2c025d83243ca32548e2eab4 /sys/dev
parent134e2b16dfd08551d8c981fe5d38aa35a3573ff1 (diff)
If both phys are available, prefer the external one.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/hme.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/sys/dev/ic/hme.c b/sys/dev/ic/hme.c
index 8a3c2aab5db..39539b7e9f7 100644
--- a/sys/dev/ic/hme.c
+++ b/sys/dev/ic/hme.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hme.c,v 1.21 2002/11/14 17:20:52 jason Exp $ */
+/* $OpenBSD: hme.c,v 1.22 2002/11/20 22:06:45 jason Exp $ */
/* $NetBSD: hme.c,v 1.21 2001/07/07 15:59:37 thorpej Exp $ */
/*-
@@ -872,6 +872,11 @@ hme_mifinit(sc)
v = bus_space_read_4(t, mif, HME_MIFI_CFG);
v &= ~HME_MIF_CFG_BBMODE;
bus_space_write_4(t, mif, HME_MIFI_CFG, v);
+
+ if (v & HME_MIF_CFG_MDI1)
+ sc->sc_tcvr = HME_PHYAD_EXTERNAL;
+ else if (v & HME_MIF_CFG_MDI0)
+ sc->sc_tcvr = HME_PHYAD_INTERNAL;
}
/*
@@ -882,12 +887,15 @@ hme_mii_readreg(self, phy, reg)
struct device *self;
int phy, reg;
{
- struct hme_softc *sc = (void *)self;
+ struct hme_softc *sc = (struct hme_softc *)self;
bus_space_tag_t t = sc->sc_bustag;
bus_space_handle_t mif = sc->sc_mif;
int n;
u_int32_t v;
+ if (sc->sc_tcvr != phy)
+ return (0);
+
/* Select the desired PHY in the MIF configuration register */
v = bus_space_read_4(t, mif, HME_MIFI_CFG);
/* Clear PHY select bit */
@@ -927,6 +935,9 @@ hme_mii_writereg(self, phy, reg, val)
int n;
u_int32_t v;
+ if (sc->sc_tcvr != phy)
+ return;
+
/* Select the desired PHY in the MIF configuration register */
v = bus_space_read_4(t, mif, HME_MIFI_CFG);
/* Clear PHY select bit */