Subject: kern/7832: nsphy uses incorrect sense of PCR_FLINK100
To: None <gnats-bugs@gnats.netbsd.org>
From: None <dave@dtsp.co.nz>
List: netbsd-bugs
Date: 06/22/1999 06:22:43
>Number:         7832
>Category:       kern
>Synopsis:       nsphy uses incorrect sense of PCR_FLINK100
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 22 06:05:00 1999
>Last-Modified:
>Originator:     Dave Sainty
>Organization:
Dynamic Technology Services and Products Ltd (NZ)
>Release:        sup 19990623
>Environment:
>Description:
	src/sys/dev/mii/nsphy.c explicitly clears the PCR_FLINK100 bit in the
	PCR register of the PHY.  However, the National semiconductor
	datasheet (in pdf form on their website) states that this bit will be
	set after a chip reset, and in fact the bit indicates normal operation
	when set, and forces good link when it is clear.

	Unfortunately, only the DP83840A datasheets are online.  It appears
	that the DP83840 datasheets were there but have been removed.  The
	nsphy code mentions both interchangeably.  It is "possible" the
	interpretation of this bit has changed, in which case the code should
	autodetect the DP83840A Vs DP83840 (via silicon revision register
	probably).

	Does anyone have datasheets for the original DP83840 still?  I'd very
	much like to see them.
	
	Additionally, the Linux eepro100 driver calls the undocumented 0x100
	bit "congestion control", enabled when set.  It sets 0x400, but
	doesn't say what it means (perhaps they were documented for the
	original DP83840?).

>How-To-Repeat:
	To come clean, I don't actually have any DP83840A cards, only DP83840.
	But as my cards are tulip based, this code isn't even touched for my
	cards.  So the only way to repeat that I know is by inspection.
	Perhaps someone with a suitably equipped network card could say.

>Fix:

--- nsphy.c.orig        Wed May 19 04:08:12 1999
+++ nsphy.c     Wed Jun 23 00:19:30 1999
@@ -212,11 +212,10 @@
                reg |= PCR_CIMDIS;
 
                /*
-                * Make sure "force link good" is not set.  It's only
-                * intended for debugging, but sometimes it's set
-                * after a reset.
+                * Make sure "force link good" is set to normal mode.
+                * It's only intended for debugging.
                 */
-               reg &= ~PCR_FLINK100;
+               reg |= PCR_FLINK100;
 
 #if 0
                /*
>Audit-Trail:
>Unformatted:
System: NetBSD tequila.dave.dtsp.co.nz 1.4D NetBSD 1.4D (TEQUILA) #17: Mon Jun 21 02:27:29 NZST 1999 dave@tequila.dave.dtsp.co.nz:/vol/tequila/userC/NetBSD-current/src/sys/arch/i386/compile/TEQUILA i386