summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2013-03-09 17:57:01 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2013-03-09 17:57:01 +0000
commitaf792f904058bddf1a5791d4a2c1ca41696d17ca (patch)
tree47448e06d215db15e278558a0aabf0d16ec83e02 /sys
parent20a6d22688ccc1edfb1b85ce09417dbafc39ebbf (diff)
Always use the internal PHY on Apple variants, from FreeBSD. This unbreaks
gem(4) on some PowerMac G5. tested by kirby@, ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/gem.c9
-rw-r--r--sys/dev/ic/gemvar.h6
2 files changed, 11 insertions, 4 deletions
diff --git a/sys/dev/ic/gem.c b/sys/dev/ic/gem.c
index e365f105987..084c1c2d29a 100644
--- a/sys/dev/ic/gem.c
+++ b/sys/dev/ic/gem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gem.c,v 1.98 2012/12/01 10:04:58 brad Exp $ */
+/* $OpenBSD: gem.c,v 1.99 2013/03/09 17:57:00 mpi Exp $ */
/* $NetBSD: gem.c,v 1.1 2001/09/16 00:11:43 eeh Exp $ */
/*
@@ -275,11 +275,14 @@ gem_config(struct gem_softc *sc)
MII_OFFSET_ANY, mii_flags);
}
- /*
+ /*
* Fall back on an internal PHY if no external PHY was found.
+ * Note that with Apple (K2) GMACs GEM_MIF_CONFIG_MDI0 can't be
+ * trusted when the firmware has powered down the chip
*/
child = LIST_FIRST(&mii->mii_phys);
- if (child == NULL && sc->sc_mif_config & GEM_MIF_CONFIG_MDI0) {
+ if (child == NULL &&
+ (sc->sc_mif_config & GEM_MIF_CONFIG_MDI0 || GEM_IS_APPLE(sc))) {
sc->sc_mif_config &= ~GEM_MIF_CONFIG_PHY_SEL;
bus_space_write_4(sc->sc_bustag, sc->sc_h1,
GEM_MIF_CONFIG, sc->sc_mif_config);
diff --git a/sys/dev/ic/gemvar.h b/sys/dev/ic/gemvar.h
index 9a084aaeef8..05ed2b3711f 100644
--- a/sys/dev/ic/gemvar.h
+++ b/sys/dev/ic/gemvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: gemvar.h,v 1.26 2010/09/20 07:40:41 deraadt Exp $ */
+/* $OpenBSD: gemvar.h,v 1.27 2013/03/09 17:57:00 mpi Exp $ */
/* $NetBSD: gemvar.h,v 1.1 2001/09/16 00:11:43 eeh Exp $ */
/*
@@ -151,6 +151,10 @@ struct gem_softc {
#define GEM_APPLE_GMAC 3 /* Apple GMAC */
#define GEM_APPLE_K2_GMAC 4 /* Apple K2 GMAC */
+#define GEM_IS_APPLE(sc) \
+ ((sc)->sc_variant == GEM_APPLE_GMAC || \
+ (sc)->sc_variant == GEM_APPLE_K2_GMAC)
+
u_int sc_flags; /* */
#define GEM_GIGABIT 0x0001 /* has a gigabit PHY */