aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/drivers/pci/pci.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2006-09-27 03:43:28 -0400
committerPaul Mundt <lethal@linux-sh.org>2006-09-27 03:43:28 -0400
commit959f85f8a3223c116bbe95dd8a9b207790b5d4d3 (patch)
treee7da9ccf292f860bfa0ff9cc8b2682cd1d6bad4d /arch/sh/drivers/pci/pci.c
parente108b2ca2349f510ce7d7f910eda89f71d710d84 (diff)
sh: Consolidated SH7751/SH7780 PCI support.
This cleans up quite a lot of the PCI mess that we currently have, and attempts to consolidate the duplication in the SH7780 and SH7751 PCI controllers. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/drivers/pci/pci.c')
-rw-r--r--arch/sh/drivers/pci/pci.c40
1 files changed, 33 insertions, 7 deletions
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index 285dffd12bd8..7377a8a8e161 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -21,6 +21,26 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <asm/io.h> 22#include <asm/io.h>
23 23
24static inline u8 bridge_swizzle(u8 pin, u8 slot)
25{
26 return (((pin - 1) + slot) % 4) + 1;
27}
28
29static u8 __init simple_swizzle(struct pci_dev *dev, u8 *pinp)
30{
31 u8 pin = *pinp;
32
33 while (dev->bus->parent) {
34 pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn));
35 /* Move up the chain of bridges. */
36 dev = dev->bus->self;
37 }
38 *pinp = pin;
39
40 /* The slot is the slot of the last bridge. */
41 return PCI_SLOT(dev->devfn);
42}
43
24static int __init pcibios_init(void) 44static int __init pcibios_init(void)
25{ 45{
26 struct pci_channel *p; 46 struct pci_channel *p;
@@ -36,19 +56,26 @@ static int __init pcibios_init(void)
36 56
37 /* scan the buses */ 57 /* scan the buses */
38 busno = 0; 58 busno = 0;
39 for (p= board_pci_channels; p->pci_ops != NULL; p++) { 59 for (p = board_pci_channels; p->pci_ops != NULL; p++) {
40 bus = pci_scan_bus(busno, p->pci_ops, p); 60 bus = pci_scan_bus(busno, p->pci_ops, p);
41 busno = bus->subordinate+1; 61 busno = bus->subordinate + 1;
42 } 62 }
43 63
44 /* board-specific fixups */ 64 pci_fixup_irqs(simple_swizzle, pcibios_map_platform_irq);
45 pcibios_fixup_irqs();
46 65
47 return 0; 66 return 0;
48} 67}
49
50subsys_initcall(pcibios_init); 68subsys_initcall(pcibios_init);
51 69
70/*
71 * Called after each bus is probed, but before its children
72 * are examined.
73 */
74void __init pcibios_fixup_bus(struct pci_bus *bus)
75{
76 pci_read_bridge_bases(bus);
77}
78
52void 79void
53pcibios_update_resource(struct pci_dev *dev, struct resource *root, 80pcibios_update_resource(struct pci_dev *dev, struct resource *root,
54 struct resource *res, int resource) 81 struct resource *res, int resource)
@@ -192,11 +219,10 @@ void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
192 219
193 return NULL; 220 return NULL;
194} 221}
222EXPORT_SYMBOL(pci_iomap);
195 223
196void pci_iounmap(struct pci_dev *dev, void __iomem *addr) 224void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
197{ 225{
198 iounmap(addr); 226 iounmap(addr);
199} 227}
200
201EXPORT_SYMBOL(pci_iomap);
202EXPORT_SYMBOL(pci_iounmap); 228EXPORT_SYMBOL(pci_iounmap);