summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-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 */