atheros PCMCIA card not longer working with kernel >= 2.6.13-rc3

Dominik Brodowski linux at dominikbrodowski.net
Sat Jul 30 13:39:02 EDT 2005


Hi,

On Sat, Jul 30, 2005 at 06:30:45PM +0100, Andrew de Quincey wrote:
> f3000000-f3ffffff : /pci at f2000000
>   f3000000-f31fffff : PCI CardBus #11
>     f3000000-f300ffff : 0001:11:00.0
>       f3000000-f300ffff : ath

vs.

> f3000000-f3ffffff : /pci at f2000000
>   00000000-00000000 : PCI CardBus #11

That's bad. Could you send the complete dmesg output of
2.6.13-rc4 to the list, please? Preferrably with the attached patch applied
first (it won't fix the problem, but will make debugging a bit easier for
me).

Thanks,
	Dominik


Share code between setup-bus.c and yenta_socket.c: use the write-out code
of resources to the bridge also in yenta_socket.c, as it provides useful
debug output. In addition, it fixes the bug that the CPU-centric resource
view might need to be transferred to the PCI-centric view: setup-bus.c does
that, while yenta-socket.c did not.

Signed-off-by: Dominik Brodowski <linux at dominikbrodowski.net>
---

 drivers/pci/setup-bus.c       |    4 ++--
 drivers/pcmcia/yenta_socket.c |   38 ++++++++++++++++++--------------------
 include/linux/pci.h           |    1 +
 3 files changed, 21 insertions(+), 22 deletions(-)

Index: 2.6.13-rc2-git3/drivers/pci/setup-bus.c
===================================================================
--- 2.6.13-rc2-git3.orig/drivers/pci/setup-bus.c
+++ 2.6.13-rc2-git3/drivers/pci/setup-bus.c
@@ -83,8 +83,7 @@ pbus_assign_resources_sorted(struct pci_
 	}
 }
 
-static void __devinit
-pci_setup_cardbus(struct pci_bus *bus)
+void pci_setup_cardbus(struct pci_bus *bus)
 {
 	struct pci_dev *bridge = bus->self;
 	struct pci_bus_region region;
@@ -136,6 +135,7 @@ pci_setup_cardbus(struct pci_bus *bus)
 					region.end);
 	}
 }
+EXPORT_SYMBOL(pci_setup_cardbus);
 
 /* Initialize bridges with base/limit values we have collected.
    PCI-to-PCI Bridge Architecture Specification rev. 1.1 (1998)
Index: 2.6.13-rc2-git3/drivers/pcmcia/yenta_socket.c
===================================================================
--- 2.6.13-rc2-git3.orig/drivers/pcmcia/yenta_socket.c
+++ 2.6.13-rc2-git3/drivers/pcmcia/yenta_socket.c
@@ -603,7 +603,7 @@ static int yenta_search_res(struct yenta
 	return 0;
 }
 
-static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type, int addr_start, int addr_end)
+static int yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type, int addr_start, int addr_end)
 {
 	struct pci_bus *bus;
 	struct resource *root, *res;
@@ -613,7 +613,7 @@ static void yenta_allocate_res(struct ye
 	res = socket->dev->resource + PCI_BRIDGE_RESOURCES + nr;
 	/* Already allocated? */
 	if (res->parent)
-		return;
+		return 0;
 
 	/* The granularity of the memory limit is 4kB, on IO it's 4 bytes */
 	mask = ~0xfff;
@@ -631,7 +631,7 @@ static void yenta_allocate_res(struct ye
 		res->end = end;
 		root = pci_find_parent_resource(socket->dev, res);
 		if (root && (request_resource(root, res) == 0))
-			return;
+			return 0;
 		printk(KERN_INFO "yenta %s: Preassigned resource %d busy or not available, reconfiguring...\n",
 				pci_name(socket->dev), nr);
 	}
@@ -639,32 +639,27 @@ static void yenta_allocate_res(struct ye
 	if (type & IORESOURCE_IO) {
 		if ((yenta_search_res(socket, res, BRIDGE_IO_MAX)) ||
 		    (yenta_search_res(socket, res, BRIDGE_IO_ACC)) ||
-		    (yenta_search_res(socket, res, BRIDGE_IO_MIN))) {
-			config_writel(socket, addr_start, res->start);
-			config_writel(socket, addr_end, res->end);
-		}
+		    (yenta_search_res(socket, res, BRIDGE_IO_MIN)))
+			return 1;
 	} else {
 		if (type & IORESOURCE_PREFETCH) {
 			if ((yenta_search_res(socket, res, BRIDGE_MEM_MAX)) ||
 			    (yenta_search_res(socket, res, BRIDGE_MEM_ACC)) ||
-			    (yenta_search_res(socket, res, BRIDGE_MEM_MIN))) {
-				config_writel(socket, addr_start, res->start);
-				config_writel(socket, addr_end, res->end);
-			}
+			    (yenta_search_res(socket, res, BRIDGE_MEM_MIN)))
+				return 1;
 			/* Approximating prefetchable by non-prefetchable */
 			res->flags = IORESOURCE_MEM;
 		}
 		if ((yenta_search_res(socket, res, BRIDGE_MEM_MAX)) ||
 		    (yenta_search_res(socket, res, BRIDGE_MEM_ACC)) ||
-		    (yenta_search_res(socket, res, BRIDGE_MEM_MIN))) {
-			config_writel(socket, addr_start, res->start);
-			config_writel(socket, addr_end, res->end);
-		}
+		    (yenta_search_res(socket, res, BRIDGE_MEM_MIN)))
+			return 1;
 	}
 
 	printk(KERN_INFO "yenta %s: no resource of type %x available, trying to continue...\n",
 	       pci_name(socket->dev), type);
 	res->start = res->end = res->flags = 0;
+	return 0;
 }
 
 /*
@@ -672,14 +667,17 @@ static void yenta_allocate_res(struct ye
  */
 static void yenta_allocate_resources(struct yenta_socket *socket)
 {
-	yenta_allocate_res(socket, 0, IORESOURCE_IO,
+	int program = 0;
+	program += yenta_allocate_res(socket, 0, IORESOURCE_IO,
 			   PCI_CB_IO_BASE_0, PCI_CB_IO_LIMIT_0);
-	yenta_allocate_res(socket, 1, IORESOURCE_IO,
+	program += yenta_allocate_res(socket, 1, IORESOURCE_IO,
 			   PCI_CB_IO_BASE_1, PCI_CB_IO_LIMIT_1);
-	yenta_allocate_res(socket, 2, IORESOURCE_MEM|IORESOURCE_PREFETCH,
+	program += yenta_allocate_res(socket, 2, IORESOURCE_MEM|IORESOURCE_PREFETCH,
 			   PCI_CB_MEMORY_BASE_0, PCI_CB_MEMORY_LIMIT_0);
-	yenta_allocate_res(socket, 3, IORESOURCE_MEM,
+	program += yenta_allocate_res(socket, 3, IORESOURCE_MEM,
 			   PCI_CB_MEMORY_BASE_1, PCI_CB_MEMORY_LIMIT_1);
+	if (program)
+		pci_setup_cardbus(socket->dev->subordinate);
 }
 
 
@@ -694,7 +692,7 @@ static void yenta_free_resources(struct 
 		res = socket->dev->resource + PCI_BRIDGE_RESOURCES + i;
 		if (res->start != 0 && res->end != 0)
 			release_resource(res);
-		res->start = res->end = 0;
+		res->start = res->end = res->flags = 0;
 	}
 }
 
Index: 2.6.13-rc2-git3/include/linux/pci.h
===================================================================
--- 2.6.13-rc2-git3.orig/include/linux/pci.h
+++ 2.6.13-rc2-git3/include/linux/pci.h
@@ -757,6 +757,7 @@ extern struct pci_dev *pci_dev_get(struc
 extern void pci_dev_put(struct pci_dev *dev);
 extern void pci_remove_bus(struct pci_bus *b);
 extern void pci_remove_bus_device(struct pci_dev *dev);
+void pci_setup_cardbus(struct pci_bus *bus);
 
 /* Generic PCI functions exported to card drivers */
 



More information about the linux-pcmcia mailing list