diff options
Diffstat (limited to 'arch/sh/drivers/pci/fixups-sh03.c')
-rw-r--r-- | arch/sh/drivers/pci/fixups-sh03.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/arch/sh/drivers/pci/fixups-sh03.c b/arch/sh/drivers/pci/fixups-sh03.c new file mode 100644 index 000000000000..57ac26c2171f --- /dev/null +++ b/arch/sh/drivers/pci/fixups-sh03.c | |||
@@ -0,0 +1,61 @@ | |||
1 | #include <linux/kernel.h> | ||
2 | #include <linux/init.h> | ||
3 | #include <linux/types.h> | ||
4 | #include <linux/pci.h> | ||
5 | |||
6 | /* | ||
7 | * IRQ functions | ||
8 | */ | ||
9 | |||
10 | int __init pcibios_map_platform_irq(u8 slot, u8 pin, struct pci_dev *dev) | ||
11 | { | ||
12 | int irq; | ||
13 | |||
14 | if (dev->bus->number == 0) { | ||
15 | switch (slot) { | ||
16 | case 4: return 5; /* eth0 */ | ||
17 | case 8: return 5; /* eth1 */ | ||
18 | case 6: return 2; /* PCI bridge */ | ||
19 | default: | ||
20 | printk("PCI: Bad IRQ mapping request for slot %d\n", slot); | ||
21 | return 2; | ||
22 | } | ||
23 | } else { | ||
24 | switch (pin) { | ||
25 | case 0: irq = 2; break; | ||
26 | case 1: irq = 2; break; | ||
27 | case 2: irq = 2; break; | ||
28 | case 3: irq = 2; break; | ||
29 | case 4: irq = 2; break; | ||
30 | default: irq = -1; break; | ||
31 | } | ||
32 | } | ||
33 | return irq; | ||
34 | } | ||
35 | |||
36 | static u8 __init sh03_no_swizzle(struct pci_dev *dev, u8 *pin) | ||
37 | { | ||
38 | /* no swizzling */ | ||
39 | return PCI_SLOT(dev->devfn); | ||
40 | } | ||
41 | |||
42 | static int sh03_pci_lookup_irq(struct pci_dev *dev, u8 slot, u8 pin) | ||
43 | { | ||
44 | int irq = -1; | ||
45 | |||
46 | /* now lookup the actual IRQ on a platform specific basis (pci-'platform'.c) */ | ||
47 | irq = pcibios_map_platform_irq(slot, pin, dev); | ||
48 | if( irq < 0 ) { | ||
49 | pr_debug("PCI: Error mapping IRQ on device %s\n", pci_name(dev)); | ||
50 | return irq; | ||
51 | } | ||
52 | |||
53 | pr_debug("Setting IRQ for slot %s to %d\n", pci_name(dev), irq); | ||
54 | |||
55 | return irq; | ||
56 | } | ||
57 | |||
58 | void __init pcibios_fixup_irqs(void) | ||
59 | { | ||
60 | pci_fixup_irqs(sh03_no_swizzle, sh03_pci_lookup_irq); | ||
61 | } | ||