From owner-freebsd-net@FreeBSD.ORG Thu Jan 24 15:09:13 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 54B291D5 for ; Thu, 24 Jan 2013 15:09:13 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id C7D9AE03 for ; Thu, 24 Jan 2013 15:09:12 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.5/8.14.5/ALCHEMY.FRANKEN.DE) with ESMTP id r0OF94d2029512; Thu, 24 Jan 2013 16:09:04 +0100 (CET) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.5/8.14.5/Submit) id r0OF94Ls029511; Thu, 24 Jan 2013 16:09:04 +0100 (CET) (envelope-from marius) Date: Thu, 24 Jan 2013 16:09:04 +0100 From: Marius Strobl To: Paul Keusemann Subject: Re: Cas driver fails to load first time after boot. Message-ID: <20130124150904.GA27559@alchemy.franken.de> References: <50FEFAB8.1070006@visi.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="5vNYLRcllDrimb99" Content-Disposition: inline In-Reply-To: <50FEFAB8.1070006@visi.com> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-net@freebsd.org X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Jan 2013 15:09:13 -0000 --5vNYLRcllDrimb99 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jan 22, 2013 at 02:46:48PM -0600, Paul Keusemann wrote: > Hi, > > I've got a Dell R200 which I'm trying to build into a gateway with a Sun > QGE (501-6738-10). The cas driver fails to load the first time I try to > load it but succeeds the second time. Is this a problem with the card, > the driver, my karma? Wrong phase of the moon, apparently :) The MII setup of these chips is a bit tricky and I'm not sure whether I've hit all code paths during development of the driver. I certainly didn't test with a 501-6738, these have been reported as working before, though. It also doesn't make much sense that attaching the devices succeeds on the second attempt. Could you please use a if_cas.ko built with the attached patch and report the debug output for one of the interfaces in both the working and the non-working case? Marius --5vNYLRcllDrimb99 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="if_cas.c.diff" Index: if_cas.c =================================================================== --- if_cas.c (revision 245046) +++ if_cas.c (working copy) @@ -332,6 +332,8 @@ cas_attach(struct cas_softc *sc) */ error = ENXIO; v = CAS_READ_4(sc, CAS_MIF_CONF); +device_printf(sc->sc_dev, "MIF=0x%x PCFG=0x%x\n", v, +CAS_READ_4(sc, CAS_SATURN_PCFG)); if ((v & CAS_MIF_CONF_MDI1) != 0) { v |= CAS_MIF_CONF_PHY_SELECT; CAS_WRITE_4(sc, CAS_MIF_CONF, v); @@ -347,6 +349,8 @@ cas_attach(struct cas_softc *sc) error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, cas_mediachange, cas_mediastatus, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, MIIF_DOPAUSE); +if (error == 0) +device_printf(sc->sc_dev, "external PHY\n"); } /* * Fall back on an internal PHY if no external PHY was found. @@ -367,6 +371,8 @@ cas_attach(struct cas_softc *sc) error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, cas_mediachange, cas_mediastatus, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, MIIF_DOPAUSE); +if (error == 0) +device_printf(sc->sc_dev, "internal PHY\n"); } } else { /* --5vNYLRcllDrimb99--