import of upstream 2.4.34.4 from kernel.org
[linux-2.4.git] / arch / arm / mach-footbridge / cats-pci.c
1 /*
2  * linux/arch/arm/mach-footbridge/cats-pci.c
3  *
4  * PCI bios-type initialisation for PCI machines
5  *
6  * Bits taken from various places.
7  */
8 #include <linux/kernel.h>
9 #include <linux/pci.h>
10 #include <linux/init.h>
11
12 #include <asm/irq.h>
13 #include <asm/mach/pci.h>
14 #include <asm/hardware/dec21285.h>
15
16 /* cats host-specific stuff */
17 static int irqmap_cats[] __initdata = { IRQ_PCI, IRQ_IN0, IRQ_IN1, IRQ_IN3 };
18
19 static int __init cats_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
20 {
21         if (dev->irq >= 128)
22                 return dev->irq & 0x1f;
23
24         if (dev->irq >= 1 && dev->irq <= 4)
25                 return irqmap_cats[dev->irq - 1];
26
27         if (dev->irq != 0)
28                 printk("PCI: device %02x:%02x has unknown irq line %x\n",
29                        dev->bus->number, dev->devfn, dev->irq);
30
31         return -1;
32 }
33
34 struct hw_pci cats_pci __initdata = {
35         .setup_resources        = dc21285_setup_resources,
36         .init                   = dc21285_init,
37         .mem_offset             = DC21285_PCI_MEM,
38         .swizzle                = no_swizzle,
39         .map_irq                = cats_map_irq,
40 };