Linux 2.6.13-rc4
[linux-2.6/next.git] / arch / sh / drivers / pci / fixups-sh03.c
blob57ac26c2171f7f3c20e05da84fa32e6d20a2215c
1 #include <linux/kernel.h>
2 #include <linux/init.h>
3 #include <linux/types.h>
4 #include <linux/pci.h>
6 /*
7 * IRQ functions
8 */
10 int __init pcibios_map_platform_irq(u8 slot, u8 pin, struct pci_dev *dev)
12 int irq;
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;
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;
33 return irq;
36 static u8 __init sh03_no_swizzle(struct pci_dev *dev, u8 *pin)
38 /* no swizzling */
39 return PCI_SLOT(dev->devfn);
42 static int sh03_pci_lookup_irq(struct pci_dev *dev, u8 slot, u8 pin)
44 int irq = -1;
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;
53 pr_debug("Setting IRQ for slot %s to %d\n", pci_name(dev), irq);
55 return irq;
58 void __init pcibios_fixup_irqs(void)
60 pci_fixup_irqs(sh03_no_swizzle, sh03_pci_lookup_irq);