Subject: patch cardbus pccbb.c
To: None <tech-kern@netbsd.org>
From: Xning Lee <xning@soforge.com>
List: tech-kern
Date: 12/05/2005 10:36:01
Problem: My usb 2.0 cardbus, if insert it before boot my laptop pc, 
         then get bad vcc error using NetBSD.
         (if insert it after boot NetBSD, then everything is ok.)

My patch:
=========

--- sys/dev/pci/pccbb.c	14 Sep 2005 21:39:59 +0800	1.125
+++ sys/dev/pci/pccbb.c	05 Dec 2005 09:50:12 +0800	
@@ -916,6 +916,10 @@
 	bus_space_write_1(bmt, bmh, 0x800 + PCIC_INTR,
 	    bus_space_read_1(bmt, bmh, 0x800 + PCIC_INTR) & ~PCIC_INTR_RESET);
 
+        /* Redo card voltage interrogation */
+        if (bus_space_read_4(bmt, bmh, CB_SOCKET_STAT) & CB_SOCKET_STAT_BADVCC)
+                bus_space_write_4(bmt, bmh, CB_SOCKET_FORCE, 0x00004000);
+        
 	/* turn off power */
 	pccbb_power((cardbus_chipset_tag_t)sc, CARDBUS_VCC_0V | CARDBUS_VPP_0V);