Subject: port-i386/18205 and lm driver resets...
To: None <gnats-bugs@netbsd.org>
From: Matthew Orgass <darkstar@city-net.com>
List: port-i386
Date: 10/04/2003 01:11:06
  Currently the lm driver does a reset during probe.  At least for Winbond
chips, this causes thermal calibration settings to be lost, which causes
incorrect temperature reporting in some cases (such as on-die thermal
diode).  Since the code already checks both the on and off case, simply
removing the reset leaves the bios configured values and works fine on my
W83697HF (see patch below).  Is this reset needed for real LM chips?

Matthew Orgass
darkstar@city-net.com

Index: sys/dev/ic/nslm7x.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/nslm7x.c,v
retrieving revision 1.17
diff -u -r1.17 nslm7x.c
--- sys/dev/ic/nslm7x.c	2002/11/15 14:55:41	1.17
+++ sys/dev/ic/nslm7x.c	2003/10/04 04:29:23
@@ -149,17 +149,12 @@
 	u_int8_t cr;
 	int rv;

-	/* Check for some power-on defaults */
-	bus_space_write_1(iot, ioh, LMC_ADDR, LMD_CONFIG);
-
-	/* Perform LM78 reset */
-	bus_space_write_1(iot, ioh, LMC_DATA, 0x80);
+	/* Avoid reset to keep thermal calibration */

-	/* XXX - Why do I have to reselect the register? */
 	bus_space_write_1(iot, ioh, LMC_ADDR, LMD_CONFIG);
 	cr = bus_space_read_1(iot, ioh, LMC_DATA);

-	/* XXX - spec says *only* 0x08! */
+	/* check both on (cr = 0x01) and off (cr = 0x08) */
 	if ((cr == 0x08) || (cr == 0x01))
 		rv = 1;
 	else
Index: share/man/man4/lm.4
===================================================================
RCS file: /cvsroot/src/share/man/man4/lm.4,v
retrieving revision 1.11
diff -u -r1.11 lm.4
--- share/man/man4/lm.4	2001/09/22 01:22:49	1.11
+++ share/man/man4/lm.4	2003/10/04 04:29:29
@@ -94,11 +94,8 @@
 .Em LM79
 .It
 .Tn Winbond
-.Em W83697HF
-(untested)
-.It
-.Tn Winbond
 .Em W83627HF ,
+.Em W83697HF ,
 .Em W83781D
 and
 .Em W83782D