import of upstream 2.4.34.4 from kernel.org
[linux-2.4.git] / arch / arm / mach-footbridge / ebsa285-pci.c
1 /*
2  * linux/arch/arm/mach-footbridge/ebsa285-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 static int irqmap_ebsa285[] __initdata = { IRQ_IN3, IRQ_IN1, IRQ_IN0, IRQ_PCI };
17
18 static u8 __init ebsa285_swizzle(struct pci_dev *dev, u8 *pin)
19 {
20         return PCI_SLOT(dev->devfn);
21 }
22
23 static int __init ebsa285_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
24 {
25         if (dev->vendor == PCI_VENDOR_ID_CONTAQ &&
26             dev->device == PCI_DEVICE_ID_CONTAQ_82C693)
27                 switch (PCI_FUNC(dev->devfn)) {
28                         case 1: return 14;
29                         case 2: return 15;
30                         case 3: return 12;
31                 }
32
33         return irqmap_ebsa285[(slot + pin) & 3];
34 }
35
36 struct hw_pci ebsa285_pci __initdata = {
37         .setup_resources        = dc21285_setup_resources,
38         .init                   = dc21285_init,
39         .mem_offset             = DC21285_PCI_MEM,
40         .swizzle                = ebsa285_swizzle,
41         .map_irq                = ebsa285_map_irq,
42 };