fixups-sh03.c (1da177e4c3f41524e886b7f1b8a0c1fc7321cac2) fixups-sh03.c (959f85f8a3223c116bbe95dd8a9b207790b5d4d3)
1#include <linux/kernel.h>
2#include <linux/init.h>
3#include <linux/types.h>
4#include <linux/pci.h>
5
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
10int __init pcibios_map_platform_irq(u8 slot, u8 pin, struct pci_dev *dev)
6int __init pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin)
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:
7{
8 int irq;
9
10 if (dev->bus->number == 0) {
11 switch (slot) {
12 case 4: return 5; /* eth0 */
13 case 8: return 5; /* eth1 */
14 case 6: return 2; /* PCI bridge */
15 default:
20 printk("PCI: Bad IRQ mapping request for slot %d\n", slot);
21 return 2;
16 printk(KERN_ERR "PCI: Bad IRQ mapping request "
17 "for slot %d\n", slot);
18 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}
19 }
20 } else {
21 switch (pin) {
22 case 0: irq = 2; break;
23 case 1: irq = 2; break;
24 case 2: irq = 2; break;
25 case 3: irq = 2; break;
26 case 4: irq = 2; break;
27 default: irq = -1; break;
28 }
29 }
30 return irq;
31}
35
36static u8 __init sh03_no_swizzle(struct pci_dev *dev, u8 *pin)
37{
38 /* no swizzling */
39 return PCI_SLOT(dev->devfn);
40}
41
42static 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
58void __init pcibios_fixup_irqs(void)
59{
60 pci_fixup_irqs(sh03_no_swizzle, sh03_pci_lookup_irq);
61}