Subject: Re: RICOH something cardbus adapter...
To: Kentaro A. Kurahone <kurahone@sigusr1.org>
From: Ignatios Souvatzis <is@netbsd.org>
List: tech-kern
Date: 02/26/2005 17:39:52
--82I3+IH0IqGh5yIs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi,

On Sat, Feb 26, 2005 at 10:08:56AM +0000, Kentaro A. Kurahone wrote:

I've managed to get it to work by limiting the tsleep() to hz/4, and=20
incrementing sc->pwrcycle if it was the same. Patch at the end.

Index: pccbb.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/sys/dev/pci/pccbb.c,v
retrieving revision 1.116
diff -u -r1.116 pccbb.c
--- pccbb.c	4 Feb 2005 02:10:45 -0000	1.116
+++ pccbb.c	26 Feb 2005 16:40:26 -0000
@@ -1287,7 +1287,8 @@
 	bus_space_handle_t memh =3D sc->sc_base_memh;
 	int on =3D 0, pwrcycle;
=20
-	DPRINTF(("pccbb_power: %s and %s [0x%x]\n",
+#define XPRINTF(x) printf x
+	XPRINTF(("pccbb_power: %s and %s [0x%x]\n",
 	    (command & CARDBUS_VCCMASK) =3D=3D CARDBUS_VCC_UC ? "CARDBUS_VCC_UC" :
 	    (command & CARDBUS_VCCMASK) =3D=3D CARDBUS_VCC_5V ? "CARDBUS_VCC_5V" :
 	    (command & CARDBUS_VCCMASK) =3D=3D CARDBUS_VCC_3V ? "CARDBUS_VCC_3V" :
@@ -1365,8 +1366,14 @@
=20
 		microtime(&before);
 		s =3D splbio();
-		while (pwrcycle =3D=3D sc->sc_pwrcycle)
-			tsleep(&sc->sc_pwrcycle, PWAIT, "pccpwr", 0);
+		while (pwrcycle =3D=3D sc->sc_pwrcycle) {
+			tsleep(&sc->sc_pwrcycle, PWAIT, "pccpwr", hz/4);
+			if (pwrcycle =3D=3D sc->sc_pwrcycle) {
+				printf("%s: assuming to have powerd up\n",
+					sc->sc_dev.dv_xname);
+				++sc->sc_pwrcycle;
+			}
+		}
 		splx(s);
 		microtime(&after);
 		timersub(&after, &before, &diff);
@@ -2521,6 +2528,8 @@
 	/* zero out the address windows */
 	Pcic_write(ph, PCIC_ADDRWIN_ENABLE, 0);
=20
+	(void)sc;
+
 	/* power down the socket to reset it, clear the card reset pin */
 	pccbb_power(sc, CARDBUS_VCC_0V | CARDBUS_VPP_0V);
=20

The power debug messages look ok, when enabled, to my untrained eye:

pccbb_power: CARDBUS_VCC_0V and CARDBUS_VPP_0V [0x44]
pccbb_power: CARDBUS_VCC_3V and CARDBUS_VPP_VCC [0x11]
cbb1: assuming to have powerd up
cbb1: wait took 0.249944s
wi0 at pcmcia1 function 0: <INTERSIL, I-GATE 11M PC Card / PC Card plus, Ve=
rsion 01.02, >
wi0: 802.11 address 00:90:d1:06:04:5f
wi0: using RF:PRISM2 MAC:HFA3841 CARD:HWB3163 rev.A
wi0: Intersil Firmware: Primary (0.3.0), Station (0.7.6)
wi0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
pccbb_power: CARDBUS_VCC_0V and CARDBUS_VPP_0V [0x44]

Regards,
	-is

--82I3+IH0IqGh5yIs
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)

iD8DBQFCIKZXN4tiz3B8hB0RAvS8AJwKvF/pM6vWrHN2QN1YBqX0YaGweQCgmcPE
s5TOg6EzuxlgQy7vigluN24=
=umrT
-----END PGP SIGNATURE-----

--82I3+IH0IqGh5yIs--