Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Oct 2005 14:15:58 +0200
From:      "Rehsack Jens \(ext\)" <jens.rehsack.ext@siemensvdo.com>
To:        "Vitaly Cherny" <vitaly.cherny@gmail.com>, <freebsd-mobile@freebsd.org>
Subject:   RE: Texas Instruments cardbus bridge issue (PCI ID 104c:8031)
Message-ID:  <CE3682EF98A64140B2BF376C39461E0A02FE12@krbdf7ma.ww011.siemens.net>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
From: owner-freebsd-mobile@freebsd.org
[mailto:owner-freebsd-mobile@freebsd.org] On Behalf Of Vitaly Cherny
Sent: Thursday, October 27, 2005 4:45 AM
To: freebsd-mobile@freebsd.org
Subject: Texas Instruments cardbus bridge issue (PCI ID 104c:8031)

> HI everyone,

Hi Vitaly,

> I've tested the slot with a couple of different cards, and my results
were:
> 
> No Cardbus device worked at all, though cbb0 detected insert/remove
> events. Setting sysctl hw.cbb.debug=1 shows 3V power switched on, then
> off. I tested this with a D-Link G650 family 802.11b/g card using an
> Atheros chipset (PCI ID of 168c:0013 for a 5212 chipset I believe) and
> a Netgear ethernet card.

Sounds well known ;-)

> I've searched quite extensively through forums and past mailing-list
> messages but couldn't find anything that looked like problem I have
> experienced.

You may search deeper :-)
But my research didn't produce a solution, so best chance you have
is found some people which would feel with you :D

> Status is 0x30000920
> cbb0: card inserted: event=0x00000000, state=30000920
> cbb0: cbb_power: 3V
> cbb0: cbb_power: 0V
> Status is 0x30000126
> Status is 0x30000920
> cbb0: card inserted: event=0x00000000, state=30000920
> cbb0: cbb_power: 3V
> cbb0: cbb_power: 0V

Maybe you apply the attached patch and reply with the "enhanced" debug
messages.

And make sure to have

hw.cbb.debug=1
hw.cardbus.debug=1
hw.cardbus.cis_debug=1
hw.pccard.debug=1
hw.pccard.cis_debug=1

Maybe some guy with a little more experience than me may give you a
workaround
until a patch is existing.

Best regards,
Jens

[-- Attachment #2 --]
Index: sys/dev/pccbb/pccbb.c
===================================================================
diff -u sys/dev/pccbb/pccbb.c.orig sys/dev/pccbb/pccbb.c
--- sys/dev/pccbb/pccbb.c.orig	Wed Oct 19 17:39:27 2005
+++ sys/dev/pccbb/pccbb.c	Wed Oct 19 18:13:47 2005
@@ -865,19 +865,24 @@
 cbb_cardbus_reset(device_t brdev)
 {
 	struct cbb_softc *sc = device_get_softc(brdev);
-	int delay_us;
+	int delay_us, err;
 
+	device_printf( brdev, "cbb_cardbus_reset entered ...\n" );
 	delay_us = sc->chipset == CB_RF5C47X ? 400*1000 : 20*1000;
+	device_printf( brdev, "will wail %dus\n", delay_us );
 
 	PCI_MASK_CONFIG(brdev, CBBR_BRIDGECTRL, |CBBM_BRIDGECTRL_RESET, 2);
 
 	DELAY(delay_us);
 
 	/* If a card exists, unreset it! */
-	if (CBB_CARD_PRESENT(cbb_get(sc, CBB_SOCKET_STATE))) {
+	if ( err = CBB_CARD_PRESENT(cbb_get(sc, CBB_SOCKET_STATE))) {
+		device_printf( brdev, "card present\n" );
 		PCI_MASK_CONFIG(brdev, CBBR_BRIDGECTRL,
 		    &~CBBM_BRIDGECTRL_RESET, 2);
 		DELAY(delay_us);
+	} else {
+		device_printf( brdev, "no card present (err = %d)\n", err );
 	}
 }
 
@@ -887,12 +892,20 @@
 	struct cbb_softc *sc = device_get_softc(brdev);
 	int err;
 
+	device_printf( brdev, "cbb_cardbus_power_enable_socket ...\n" );
 	if (!CBB_CARD_PRESENT(cbb_get(sc, CBB_SOCKET_STATE)))
+	{
+		device_printf( brdev, "CBB_CARD_PRESENT failed\n" );
 		return (ENODEV);
+	}
 
 	err = cbb_do_power(brdev);
 	if (err)
+	{
+		device_printf( brdev, "cbb_do_power failed with %d\n", err );
 		return (err);
+	}
+
 	cbb_cardbus_reset(brdev);
 	return (0);
 }
@@ -900,6 +913,7 @@
 static void
 cbb_cardbus_power_disable_socket(device_t brdev, device_t child)
 {
+	device_printf( brdev, "cbb_cardbus_power_disable_socket ...\n" );
 	cbb_power(brdev, CARD_OFF);
 	cbb_cardbus_reset(brdev);
 }
Index: sys/dev/cardbus/cardbus.c
===================================================================
diff -u sys/dev/cardbus/cardbus.c.orig sys/dev/cardbus/cardbus.c
--- sys/dev/cardbus/cardbus.c.orig	Wed Oct 19 18:25:19 2005
+++ sys/dev/cardbus/cardbus.c	Wed Oct 19 18:43:11 2005
@@ -434,7 +434,9 @@
 	device_t brdev = device_get_parent(cbdev);
 	device_t child;
 	int cardattached = 0;
-	int bus, slot, func;
+	int bus, slot, func, err;
+
+	device_printf( cbdev, "cardbus_attach_card, scan %d slots\n", CARDBUS_SLOTMAX+1 );
 
 	cardbus_detach_card(cbdev); /* detach existing cards */
 	POWER_ENABLE_SOCKET(brdev, cbdev);
@@ -449,7 +451,10 @@
 			    pci_read_device(brdev, bus, slot, func,
 				sizeof(struct cardbus_devinfo));
 			if (dinfo == NULL)
+			{
+				device_printf( brdev, "pci_read_device failed\n" );
 				continue;
+			}
 			if (dinfo->pci.cfg.mfdev)
 				cardbusfunchigh = CARDBUS_FUNCMAX;
 
@@ -472,9 +477,11 @@
 			cardbus_pickup_maps(cbdev, child);
 			cardbus_alloc_resources(cbdev, child);
 			pci_print_verbose(&dinfo->pci);
-			if (device_probe_and_attach(child) != 0)
+			if ((err=device_probe_and_attach(child)) != 0)
+			{
+				device_printf( child, "device_probe_and_attach failed: %d\n", err );
 				cardbus_release_all_resources(cbdev, dinfo);
-			else
+			} else
 				cardattached++;
 		}
 	}
@@ -493,6 +500,7 @@
 	int tmp;
 	int err = 0;
 
+	device_printf( cbdev, "cardbus_detach_card\n" );
 	device_get_children(cbdev, &devlist, &numdevs);
 
 	if (numdevs == 0) {
Index: sys/dev/pci/pci.c
===================================================================
diff -u sys/dev/pci/pci.c.orig sys/dev/pci/pci.c
--- sys/dev/pci/pci.c.orig	Wed Oct 19 18:44:26 2005
+++ sys/dev/pci/pci.c	Wed Oct 19 18:48:14 2005
@@ -362,7 +362,10 @@
 	if (REG(PCIR_DEVVENDOR, 4) != -1) {
 		devlist_entry = malloc(size, M_DEVBUF, M_WAITOK | M_ZERO);
 		if (devlist_entry == NULL)
+		{
+			device_printf( pcib, "cannot alloc %lu memory for devlist_entry\n", size );
 			return (NULL);
+		}
 
 		cfg = &devlist_entry->cfg;
 		
@@ -414,6 +417,8 @@
 
 		pci_numdevs++;
 		pci_generation++;
+	} else {
+		device_printf( pcib, "pci_read_device: REG(PCIR_DEVVENDOR, 4) == -1\n" );
 	}
 	return (devlist_entry);
 #undef REG

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CE3682EF98A64140B2BF376C39461E0A02FE12>