From 7892af0d0c37dc01014739c99e7ab3e902e70e12 Mon Sep 17 00:00:00 2001 From: jdc Date: Thu, 20 Nov 2008 20:56:56 +0000 Subject: [PATCH] Read the chip revision from the Sbus register. --- sys/dev/sbus/if_gem_sbus.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sys/dev/sbus/if_gem_sbus.c b/sys/dev/sbus/if_gem_sbus.c index ca4916084fdf..f85075d20a87 100644 --- a/sys/dev/sbus/if_gem_sbus.c +++ b/sys/dev/sbus/if_gem_sbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_gem_sbus.c,v 1.7 2008/05/06 21:24:40 jdc Exp $ */ +/* $NetBSD: if_gem_sbus.c,v 1.8 2008/11/20 20:56:56 jdc Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_gem_sbus.c,v 1.7 2008/05/06 21:24:40 jdc Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_gem_sbus.c,v 1.8 2008/11/20 20:56:56 jdc Exp $"); #include #include @@ -93,12 +93,6 @@ gemattach_sbus(struct device *parent, struct device *self, void *aux) sc->sc_bustag = sa->sa_bustag; sc->sc_dmatag = sa->sa_dmatag; - sc->sc_chiprev = prom_getpropint(sa->sa_node, "gem-rev", 0); - - printf(": GEM Ethernet controller (%s), version %s (rev 0x%02x)\n", - sa->sa_name, prom_getpropstring(sa->sa_node, "version"), - sc->sc_chiprev); - if (sa->sa_nreg < 2) { printf("%s: only %d register sets\n", device_xname(self), sa->sa_nreg); @@ -134,6 +128,7 @@ gemattach_sbus(struct device *parent, struct device *self, void *aux) if (!strcmp("serdes", prom_getpropstring(sa->sa_node, "shared-pins"))) sc->sc_flags |= GEM_SERDES; sc->sc_variant = GEM_SUN_GEM; + sc->sc_flags &= ~GEM_PCI; /* * SBUS config @@ -142,6 +137,12 @@ gemattach_sbus(struct device *parent, struct device *self, void *aux) delay(100); bus_space_write_4(sa->sa_bustag, sc->sc_h2, GEM_SBUS_CONFIG, GEM_SBUS_CFG_BSIZE128|GEM_SBUS_CFG_PARITY|GEM_SBUS_CFG_BMODE64); + sc->sc_chiprev = bus_space_read_4(sa->sa_bustag, sc->sc_h2, + GEM_SBUS_REVISION); + + printf(": GEM Ethernet controller (%s), version %s (rev 0x%02x)\n", + sa->sa_name, prom_getpropstring(sa->sa_node, "version"), + sc->sc_chiprev); gem_attach(sc, enaddr);