Date: Tue, 29 Jul 2008 20:20:03 GMT From: John Baldwin <jhb@freebsd.org> To: freebsd-net@FreeBSD.org Subject: Re: kern/112179: [sis] [patch] sis driver for natsemi DP83815D autonegotiate failure Message-ID: <200807292020.m6TKK39c041851@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/112179; it has been noted by GNATS. From: John Baldwin <jhb@freebsd.org> To: bug-followup@freebsd.org, mark@hydrus.org.uk Cc: phk@freebsd.org Subject: Re: kern/112179: [sis] [patch] sis driver for natsemi DP83815D autonegotiate failure Date: Tue, 29 Jul 2008 11:56:38 -0400 How about the patch below. This makes the driver match the behavior of the Linux driver (and also fixes a harmless weirdness phk@ introduced.. I think because he thought SIS_SETBIT was CSR_WRITE_4 rather than a RMW op). Index: if_sis.c =================================================================== --- if_sis.c (revision 180877) +++ if_sis.c (working copy) @@ -1904,14 +1904,15 @@ if (sc->sis_type == SIS_TYPE_83815 && sc->sis_srr <= NS_SRR_15D) { CSR_WRITE_4(sc, NS_PHY_PAGE, 0x0001); CSR_WRITE_4(sc, NS_PHY_CR, 0x189C); - if (sc->sis_srr == NS_SRR_15C) { - /* set val for c2 */ - CSR_WRITE_4(sc, NS_PHY_TDATA, 0x0000); + /* set val for c2 */ + CSR_WRITE_4(sc, NS_PHY_TDATA, 0x0000); + if (sc->sis_srr <= NS_SRR_15C) /* load/kill c2 */ CSR_WRITE_4(sc, NS_PHY_DSPCFG, 0x5040); - /* rais SD off, from 4 to c */ - CSR_WRITE_4(sc, NS_PHY_SDCFG, 0x008C); - } + else + SIS_SETBIT(sc, NS_PHY_DSPCFG, 0x1000); + /* rais SD off, from 4 to c */ + CSR_WRITE_4(sc, NS_PHY_SDCFG, 0x008C); CSR_WRITE_4(sc, NS_PHY_PAGE, 0); } @@ -2011,12 +2012,11 @@ CSR_WRITE_4(sc, NS_PHY_DSPCFG, reg | 0x1000); DELAY(100000); reg = CSR_READ_4(sc, NS_PHY_TDATA) & 0xff; - if ((reg & 0x0080) == 0 || (reg > 0xd8 && reg <= 0xff)) { + if ((reg & 0x0080) == 0 || (reg >= 0xd8 && reg <= 0xff)) { device_printf(sc->sis_dev, "Applying short cable fix (reg=%x)\n", reg); CSR_WRITE_4(sc, NS_PHY_TDATA, 0x00e8); - reg = CSR_READ_4(sc, NS_PHY_DSPCFG); - SIS_SETBIT(sc, NS_PHY_DSPCFG, reg | 0x20); + SIS_SETBIT(sc, NS_PHY_DSPCFG, 0x20); } CSR_WRITE_4(sc, NS_PHY_PAGE, 0); } One other thing the Linux driver does differently than the FreeBSD driver is that it 1) doesn't set 0x1000 in DSPCFG when locking the coeffecient (since it sets it earlier) and 2), it locks the coefficient every time link is established and unlocks it when link is lost. Doing 2) would require pushing some logic down into the phy driver I think. -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807292020.m6TKK39c041851>