From owner-freebsd-hackers Thu Nov 16 12: 0:15 2000 Delivered-To: freebsd-hackers@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 618) id 49A7237B479; Thu, 16 Nov 2000 12:00:07 -0800 (PST) Subject: Re: More detail on Deskpro XL6200 NIC (was: Legacy ethernet cards in FreeBSD) In-Reply-To: <59063B5B4D98D311BC0D0001FA7E4522026D7A07@l04.research.kpn.com> from "Koster, K.J." at "Nov 16, 2000 12:11:56 pm" To: K.J.Koster@kpn.com (Koster K.J.) Date: Thu, 16 Nov 2000 12:00:07 -0800 (PST) Cc: freebsd-hackers@freebsd.org, jkh@freebsd.org X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: <20001116200007.49A7237B479@hub.freebsd.org> From: wpaul@FreeBSD.ORG (Bill Paul) Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Well this sucks. According to the manual, once you select 32-bit mode, the only way to get the chip back to 16-bit mode is a hardware reset. I suppose the quick fix for now is to not let if_pcn switch the chip into 32-bit mode during the probe routine. Please try the patch for if_pcn.c included with this message. It should fix things so if you have both the pcn and lnc drivers in your kernel, the lnc driver will attach properly. I'm cc'ing this to jkh for his approval to have this patch added to the -stable tree in time for 4.2-RELEASE. -Bill *** if_pcn.c.orig Thu Nov 2 16:37:45 2000 --- if_pcn.c Thu Nov 16 11:48:43 2000 *************** *** 110,115 **** --- 110,116 ---- }; static u_int32_t pcn_csr_read __P((struct pcn_softc *, int)); + static u_int16_t pcn_csr_read16 __P((struct pcn_softc *, int)); static void pcn_csr_write __P((struct pcn_softc *, int, int)); static u_int32_t pcn_bcr_read __P((struct pcn_softc *, int)); static void pcn_bcr_write __P((struct pcn_softc *, int, int)); *************** *** 203,208 **** --- 204,217 ---- return(CSR_READ_4(sc, PCN_IO32_RDP)); } + static u_int16_t pcn_csr_read16(sc, reg) + struct pcn_softc *sc; + int reg; + { + CSR_WRITE_2(sc, PCN_IO16_RAP, reg); + return(CSR_READ_2(sc, PCN_IO16_RDP)); + } + static void pcn_csr_write(sc, reg, val) struct pcn_softc *sc; int reg; *************** *** 401,410 **** mtx_init(&sc->pcn_mtx, device_get_nameunit(dev), MTX_DEF); PCN_LOCK(sc); ! pcn_reset(sc); ! chip_id = pcn_csr_read(sc, PCN_CSR_CHIPID1); chip_id <<= 16; ! chip_id |= pcn_csr_read(sc, PCN_CSR_CHIPID0); bus_release_resource(dev, PCN_RES, PCN_RID, sc->pcn_res); PCN_UNLOCK(sc); --- 410,429 ---- mtx_init(&sc->pcn_mtx, device_get_nameunit(dev), MTX_DEF); PCN_LOCK(sc); ! /* ! * Note: we can *NOT* put the chip into ! * 32-bit mode yet. The lnc driver will only ! * work in 16-bit mode, and once the chip ! * goes into 32-bit mode, the only way to ! * get it out again is with a hardware reset. ! * So if pcn_probe() is called before the ! * lnc driver's probe routine, the chip will ! * be locked into 32-bit operation and the lnc ! * driver will be unable to attach to it. ! */ ! chip_id = pcn_csr_read16(sc, PCN_CSR_CHIPID1); chip_id <<= 16; ! chip_id |= pcn_csr_read16(sc, PCN_CSR_CHIPID0); bus_release_resource(dev, PCN_RES, PCN_RID, sc->pcn_res); PCN_UNLOCK(sc); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message