summaryrefslogtreecommitdiff
path: root/sys/dev/mii
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
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')
-rw-r--r--sys/dev/mii/eephy.c22
-rw-r--r--sys/dev/mii/eephyreg.h5
2 files changed, 25 insertions, 2 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) {
diff --git a/sys/dev/mii/eephyreg.h b/sys/dev/mii/eephyreg.h
index b5f31730869..76af83b2c23 100644
--- a/sys/dev/mii/eephyreg.h
+++ b/sys/dev/mii/eephyreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: eephyreg.h,v 1.5 2006/11/28 18:29:29 brad Exp $ */
+/* $OpenBSD: eephyreg.h,v 1.6 2007/10/05 10:26:27 kettenis Exp $ */
/*
* Principal Author: Parag Patel
* Copyright (c) 2001
@@ -313,8 +313,11 @@
/* The following register is found only on the 88E1011 Alaska PHY */
#define E1000_ESSR 0x1B /* Extended PHY specific sts */
+#define E1000_ESSR_DIS_FC 0x8000
#define E1000_ESSR_FIBER_LINK 0x2000
+#define E1000_ESSR_HWCFG_MODE 0x000f
#define E1000_ESSR_GMII_COPPER 0x000f
#define E1000_ESSR_GMII_FIBER 0x0007
#define E1000_ESSR_TBI_COPPER 0x000d
#define E1000_ESSR_TBI_FIBER 0x0005
+#define E1000_ESSR_RGMII_COPPER 0x000b