From patchwork Wed Dec 9 06:52:13 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Herrenschmidt X-Patchwork-Id: 65896 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nB96qQlQ007483 for ; Wed, 9 Dec 2009 06:52:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756715AbZLIGwS (ORCPT ); Wed, 9 Dec 2009 01:52:18 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756693AbZLIGwS (ORCPT ); Wed, 9 Dec 2009 01:52:18 -0500 Received: from gate.crashing.org ([63.228.1.57]:57065 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756066AbZLIGwR (ORCPT ); Wed, 9 Dec 2009 01:52:17 -0500 Received: from [IPv6:::1] (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id nB96qE8p010235; Wed, 9 Dec 2009 00:52:15 -0600 Subject: [PATCH] cardbus: Add a fixup hook and fix powerpc From: Benjamin Herrenschmidt To: linux-pci@vger.kernel.org Cc: Jesse Barnes , "linux-kernel@vger.kernel.org" , linuxppc-dev , blofeldus@yahoo.com, Olof Johansson Date: Wed, 09 Dec 2009 17:52:13 +1100 Message-ID: <1260341533.16132.20.camel@pasglop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Index: linux-work/drivers/pcmcia/cardbus.c =================================================================== --- linux-work.orig/drivers/pcmcia/cardbus.c 2009-12-09 17:16:10.000000000 +1100 +++ linux-work/drivers/pcmcia/cardbus.c 2009-12-09 17:34:58.000000000 +1100 @@ -214,7 +214,7 @@ int __ref cb_alloc(struct pcmcia_socket unsigned int max, pass; s->functions = pci_scan_slot(bus, PCI_DEVFN(0, 0)); -// pcibios_fixup_bus(bus); + pci_fixup_cardbus(bus); max = bus->secondary; for (pass = 0; pass < 2; pass++) Index: linux-work/include/linux/pci.h =================================================================== --- linux-work.orig/include/linux/pci.h 2009-12-09 17:16:10.000000000 +1100 +++ linux-work/include/linux/pci.h 2009-12-09 17:34:47.000000000 +1100 @@ -564,6 +564,9 @@ void pcibios_align_resource(void *, stru resource_size_t); void pcibios_update_irq(struct pci_dev *, int irq); +/* Weak but can be overriden by arch */ +void pci_fixup_cardbus(struct pci_bus *); + /* Generic PCI functions used internally */ extern struct pci_bus *pci_find_bus(int domain, int busnr); Index: linux-work/arch/powerpc/kernel/pci-common.c =================================================================== --- linux-work.orig/arch/powerpc/kernel/pci-common.c 2009-12-09 17:16:10.000000000 +1100 +++ linux-work/arch/powerpc/kernel/pci-common.c 2009-12-09 17:35:19.000000000 +1100 @@ -1107,6 +1107,12 @@ void __devinit pcibios_setup_bus_devices list_for_each_entry(dev, &bus->devices, bus_list) { struct dev_archdata *sd = &dev->dev.archdata; + /* Cardbus can call us to add new devices to a bus, so ignore + * those who are already fully discovered + */ + if (dev->is_added) + continue; + /* Setup OF node pointer in archdata */ sd->of_node = pci_device_to_OF_node(dev); @@ -1147,6 +1153,13 @@ void __devinit pcibios_fixup_bus(struct } EXPORT_SYMBOL(pcibios_fixup_bus); +void __devinit pci_fixup_cardbus(struct pci_bus *bus) +{ + /* Now fixup devices on that bus */ + pcibios_setup_bus_devices(bus); +} + + static int skip_isa_ioresource_align(struct pci_dev *dev) { if ((ppc_pci_flags & PPC_PCI_CAN_SKIP_ISA_ALIGN) && Index: linux-work/drivers/pci/pci.c =================================================================== --- linux-work.orig/drivers/pci/pci.c 2009-12-09 17:33:24.000000000 +1100 +++ linux-work/drivers/pci/pci.c 2009-12-09 17:34:16.000000000 +1100 @@ -2723,6 +2723,11 @@ int __attribute__ ((weak)) pci_ext_cfg_a return 1; } +void __weak pci_fixup_cardbus(struct pci_bus *bus) +{ +} +EXPORT_SYMBOL(pci_fixup_cardbus); + static int __init pci_setup(char *str) { while (str) {