Subject: Re: kern/16346: pcn driver panics on startup in IBM PC/325
To: NetBSD Networking Technical Discussion List <tech-net@NetBSD.ORG>
From: Allen Briggs <briggs@wasabisystems.com>
List: tech-net
Date: 09/09/2003 22:47:53
On Mon, Sep 01, 2003 at 03:32:31PM -0400, Greg A. Woods wrote:
> 	Driver code should wait 500us following a software reset before
> 	allowing further serial MII operations with the DP83840A.

This change also helps the DP83815 deal with auto-negotiation.
When repeatedly unplugging and replugging the cable, the DP83815
can get stuck in weird state where it won't actually recover link
without an 'ifconfig sip0 down ; ifconfig sip0 up'.

Putting delay(500) in mii_phy_reset() seems to prevent this behavior.

I don't know if this is a quirk of these PHYs or not.  It might make
sense that it is, but I'm also wondering if it's something that might
be seen elsewhere.  It would be easy enough to special-case these
PHY drivers' reset routine, but if this change could help others, too,
I'd hate to have it fixed in some places, but not everywhere.

> diff -c -c -r1.33 mii_physubr.c
> *** mii_physubr.c	12 May 2002 21:39:46 -0000	1.33
> --- mii_physubr.c	1 Sep 2003 19:10:35 -0000
> ***************
> *** 308,313 ****
> --- 308,316 ----
>   		reg = BMCR_RESET | BMCR_ISO;
>   	PHY_WRITE(sc, MII_BMCR, reg);
>   
> + 	/* wait 1000us before doing any further serial operations */
> + 	delay(1000);
> + 
>   	/* Wait 100ms for it to complete. */
>   	for (i = 0; i < 100; i++) {
>   		reg = PHY_READ(sc, MII_BMCR); 

My change was delay(500), and it was enough for sip(4) in this case.
I have a pcn(4) (on the same kind of system--IBM/325) with the same
problem as the PR, but it's also in production and I'm not rebooting
it unless I have to.

-allen

-- 
 Allen Briggs                     briggs@wasabisystems.com
 Wasabi Systems, Inc.             http://www.wasabisystems.com/