summaryrefslogtreecommitdiff
path: root/sys/dev/mii/eephy.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2007-10-05 10:26:28 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2007-10-05 10:26:28 +0000
commit706b4bb70cc85785c5170ff71fda17f776be00fb (patch)
treefe6b3bb664f594bf51ab5ca6e91815ac0e2294df /sys/dev/mii/eephy.c
parent547b905d9397e87f997709212f125f2cc69553fc (diff)
Disable fiber/copper auto-selection on the 88E1111 if it is in RGMII mode, to
work around the fact that the onboard PHYs attached to nfe(4) on the Sun X4100 M2 have fiber/copper auto-selection enabled even though the interfaces are clearly copper-only. Fixes PR system/5587. ok jsg@, claudio@
Diffstat (limited to 'sys/dev/mii/eephy.c')
-rw-r--r--sys/dev/mii/eephy.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/sys/dev/mii/eephy.c b/sys/dev/mii/eephy.c
index 0095694b69c..4dbd4026943 100644
--- a/sys/dev/mii/eephy.c
+++ b/sys/dev/mii/eephy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: eephy.c,v 1.40 2007/02/11 21:29:24 kettenis Exp $ */
+/* $OpenBSD: eephy.c,v 1.41 2007/10/05 10:26:27 kettenis Exp $ */
/*
* Principal Author: Parag Patel
* Copyright (c) 2001
@@ -148,6 +148,26 @@ eephyattach(struct device *parent, struct device *self, void *aux)
/* XXX No loopback support yet, although the hardware can do it. */
sc->mii_flags |= MIIF_NOLOOP;
+ /* Switch to copper-only mode if necessary. */
+ if (sc->mii_model == MII_MODEL_MARVELL_E1111 &&
+ (sc->mii_flags & MIIF_HAVEFIBER) == 0) {
+ /*
+ * The onboard 88E1111 PHYs on the Sun X4100 M2 come
+ * up with fiber/copper auto-selection enabled, even
+ * though the machine only has copper ports. This
+ * makes the chip autoselect to 1000baseX, and makes
+ * it impossible to select any other media. So
+ * disable fiber/copper autoselection.
+ */
+ reg = PHY_READ(sc, E1000_ESSR);
+ if ((reg & E1000_ESSR_HWCFG_MODE) == E1000_ESSR_GMII_COPPER) {
+ reg |= E1000_ESSR_DIS_FC;
+ PHY_WRITE(sc, E1000_ESSR, reg);
+
+ PHY_RESET(sc);
+ }
+ }
+
/* Switch to fiber-only mode if necessary. */
if (sc->mii_model == MII_MODEL_MARVELL_E1112 &&
sc->mii_flags & MIIF_HAVEFIBER) {