Subject: kern/36654: cbb0: Bad Vcc status set at cold boot - ThinkPad 570 / TI PCI1450
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <djb_netbsd@charter.net>
List: netbsd-bugs
Date: 07/16/2007 09:00:01
>Number:         36654
>Category:       kern
>Synopsis:       cbb0: Bad Vcc status set at cold boot - ThinkPad 570 / TI PCI1450
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 16 09:00:01 +0000 2007
>Originator:     Dave Barnes
>Release:        4.99.19 (-current about 5/07/07)
>Organization:
>Environment:
NetBSD 4.99.19 on ThinkPad 570
>Description:
Cardbus interface initially comes up with bad Vcc status if a cardbus card is in either slot when laptop is powered up.  See also kern/36652 

To clear this error on the TI PCI1450 must set CVS bit in CB_SOCKET_FORCE to clear the error bits BAD_VCC and DATA_LOST, cause a recheck of voltage sense settings and re-enable power control.


>How-To-Repeat:
Insert cardbus card in either slot before turning on ThinkPad 570.
>Fix:
diffs attached fix this problem as well as addressing kern/36652

*******************************************************************
--- dev/pci/pccbb.c.orig	2007-07-15 20:47:51.000000000 -0500
+++ dev/pci/pccbb.c	2007-07-15 20:33:03.000000000 -0500
@@ -1255,6 +1255,10 @@
 	status = bus_space_read_4(memt, memh, CB_SOCKET_STAT);
 	osock_ctrl = sock_ctrl = bus_space_read_4(memt, memh, CB_SOCKET_CTRL);
 
+	if (status & (CB_SOCKET_STAT_BADVCC | CB_SOCKET_STAT_DATALOST)) {	 /* bad Vcc request or data lost ? */
+		bus_space_write_4(memt, memh, CB_SOCKET_FORCE, CB_SOCKET_FORCE_CVS); /* clear error and force card recheck */  	
+	}
+
 	switch (command & CARDBUS_VCCMASK) {
 	case CARDBUS_VCC_UC:
 		break;
@@ -1367,8 +1371,9 @@
 		sock_ctrl &= ~CB_SOCKET_CTRL_VCCMASK;
 		sock_ctrl &= ~CB_SOCKET_CTRL_VPPMASK;
 		bus_space_write_4(memt, memh, CB_SOCKET_CTRL, sock_ctrl);
-		status &= ~CB_SOCKET_STAT_BADVCC;
-		bus_space_write_4(memt, memh, CB_SOCKET_STAT, status);
+
+		bus_space_write_4(memt, memh, CB_SOCKET_FORCE, CB_SOCKET_FORCE_CVS);  /* clear error bits and force card recheck */
+
 		printf("new status 0x%x\n", bus_space_read_4(memt, memh,
 		    CB_SOCKET_STAT));
 		return 0;

**********************************************************************

--- dev/pci/pccbbreg.h.orig	2007-07-15 20:47:51.000000000 -0500
+++ dev/pci/pccbbreg.h	2007-07-15 20:34:42.000000000 -0500
@@ -226,6 +226,7 @@
 #define CB_SOCKET_STAT_YVSOCK 0x80000000 /* Y.Y V Socket */
 
 /* socket force event register (CB_SOCKET_FORCE) elements */
+#define CB_SOCKET_FORCE_CVS 0x4000 /* bit 14 - force voltage sense check and re-enable socket power control */ 
 #define CB_SOCKET_FORCE_BADVCC 0x0200 /* Bad Vcc Request */