diff options
author | Paul Mundt <lethal@linux-sh.org> | 2006-09-27 03:43:28 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2006-09-27 03:43:28 -0400 |
commit | 959f85f8a3223c116bbe95dd8a9b207790b5d4d3 (patch) | |
tree | e7da9ccf292f860bfa0ff9cc8b2682cd1d6bad4d /arch/sh/drivers/pci/pci.c | |
parent | e108b2ca2349f510ce7d7f910eda89f71d710d84 (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.c | 40 |
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 | ||
24 | static inline u8 bridge_swizzle(u8 pin, u8 slot) | ||
25 | { | ||
26 | return (((pin - 1) + slot) % 4) + 1; | ||
27 | } | ||
28 | |||
29 | static 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 | |||
24 | static int __init pcibios_init(void) | 44 | static 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 | |||
50 | subsys_initcall(pcibios_init); | 68 | subsys_initcall(pcibios_init); |
51 | 69 | ||
70 | /* | ||
71 | * Called after each bus is probed, but before its children | ||
72 | * are examined. | ||
73 | */ | ||
74 | void __init pcibios_fixup_bus(struct pci_bus *bus) | ||
75 | { | ||
76 | pci_read_bridge_bases(bus); | ||
77 | } | ||
78 | |||
52 | void | 79 | void |
53 | pcibios_update_resource(struct pci_dev *dev, struct resource *root, | 80 | pcibios_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 | } |
222 | EXPORT_SYMBOL(pci_iomap); | ||
195 | 223 | ||
196 | void pci_iounmap(struct pci_dev *dev, void __iomem *addr) | 224 | void pci_iounmap(struct pci_dev *dev, void __iomem *addr) |
197 | { | 225 | { |
198 | iounmap(addr); | 226 | iounmap(addr); |
199 | } | 227 | } |
200 | |||
201 | EXPORT_SYMBOL(pci_iomap); | ||
202 | EXPORT_SYMBOL(pci_iounmap); | 228 | EXPORT_SYMBOL(pci_iounmap); |