From owner-freebsd-current Sun Jan 19 15:52:34 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6FCB137B401 for ; Sun, 19 Jan 2003 15:52:31 -0800 (PST) Received: from mta5.snfc21.pbi.net (mta5.snfc21.pbi.net [206.13.28.241]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1DBC543E4A for ; Sun, 19 Jan 2003 15:52:31 -0800 (PST) (envelope-from mbsd@pacbell.net) Received: from atlas ([64.165.199.132]) by mta5.snfc21.pbi.net (iPlanet Messaging Server 5.1 HotFix 1.6 (built Oct 18 2002)) with ESMTP id <0H8Z00LPSJNH16@mta5.snfc21.pbi.net> for current@freebsd.org; Sun, 19 Jan 2003 15:52:30 -0800 (PST) Date: Sun, 19 Jan 2003 15:52:29 -0800 (PST) From: =?ISO-8859-1?Q?Mikko_Ty=F6l=E4j=E4rvi?= Subject: if_sis.c 1.61 breaks support for SiS630 chipset X-X-Sender: mikko@atlas.home To: current@freebsd.org Message-id: <20030119154822.O70415-100000@atlas.home> MIME-version: 1.0 Content-type: TEXT/PLAIN; charset=US-ASCII Content-transfer-encoding: 7BIT Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hello, Version 1.61 of if_sis.c breaks support for SiS630, or at least the one on my laptop. This has been noted before, in I just though I'd add some more details. The device probe fails with: sis0: MII without any PHY! pciconf reports the chip as: sis0@pci0:1:1: class=0x020000 card=0x020114ff chip=0x09001039 rev=0x82 hdr=0x00 vendor = 'Silicon Integrated Systems (SiS)' device = 'SiS900 Fast Ethernet/Home Networking Ctrlr' class = network subclass = ethernet Things start to go bad when sis_mii_readreg() ends up in the ack failure case (around line 622): /* * Now try reading data bits. If the ack failed, we still * need to clock through 16 cycles to keep the PHY(s) in sync. */ if (ack) { for(i = 0; i < 16; i++) { SIO_CLR(SIS_MII_CLK); DELAY(1); SIO_SET(SIS_MII_CLK); DELAY(1); } goto fail; } Conditionally reverting part of sis_miibus_readreg() to r1.60 is sufficient to make things work again: --- if_sis.c.1.62 Sun Jan 19 14:35:57 2003 +++ if_sis.c Sun Jan 19 15:14:54 2003 @@ -735,6 +735,39 @@ sc->sis_rev < SIS_REV_635 && phy != 0) return(0); +#if 1 + /* + * Hack: The new code below does not work with my sis630S. + * Revive working code from r1.60 + */ + + if (sc->sis_type == SIS_TYPE_900 && sc->sis_rev <= SIS_REV_630S) { + int i, val = 0; + + CSR_WRITE_4(sc, SIS_PHYCTL, + (phy << 11) | (reg << 6) | SIS_PHYOP_READ); + SIS_SETBIT(sc, SIS_PHYCTL, SIS_PHYCTL_ACCESS); + + for (i = 0; i < SIS_TIMEOUT; i++) { + if (!(CSR_READ_4(sc, SIS_PHYCTL) & SIS_PHYCTL_ACCESS)) + break; + } + + if (i == SIS_TIMEOUT) { + printf("sis%d: PHY failed to come ready\n", + sc->sis_unit); + return(0); + } + + val = (CSR_READ_4(sc, SIS_PHYCTL) >> 16) & 0xFFFF; + + if (val == 0xFFFF) + return(0); + + return(val); + } +#endif + bzero((char *)&frame, sizeof(frame)); frame.mii_phyaddr = phy; If anyone has theories for a more correct patch, I'll be happy to try them out. $.02, /Mikko To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message