ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / arch / arm / mach-ftvpci / pci.c
1 /*
2  *  linux/arch/arm/kernel/ftv-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/mach-types.h>
15
16 /*
17  * Owing to a PCB cockup, issue A backplanes are wired thus:
18  *
19  * Slot 1    2    3    4    5   Bridge   S1    S2    S3    S4
20  * IRQ  D    C    B    A    A            C     B     A     D
21  *      A    D    C    B    B            D     C     B     A
22  *      B    A    D    C    C            A     D     C     B
23  *      C    B    A    D    D            B     A     D     C
24  *
25  * ID A31  A30  A29  A28  A27   A26      DEV4  DEV5  DEV6  DEV7
26  *
27  * Actually, this isn't too bad, because with the processor card
28  * in slot 5 on the primary bus, the IRQs rotate on both sides
29  * as you'd expect.
30  */
31
32 static int irqmap_ftv[] __initdata = { IRQ_PCI_D, IRQ_PCI_C, IRQ_PCI_B, IRQ_PCI_A };
33
34 static int __init ftv_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
35 {
36         if (slot > 0x10)
37                 slot--;
38         return irqmap_ftv[(slot - pin) & 3];
39 }
40
41 static u8 __init ftv_swizzle(struct pci_dev *dev, u8 *pin)
42 {
43         return PCI_SLOT(dev->devfn);
44 }
45
46 /* ftv host-specific stuff */
47 static struct hw_pci ftv_pci __initdata = {
48         .init           = plx90x0_init,
49         .swizzle        = ftv_swizzle,
50         .map_irq        = ftv_map_irq,
51 };
52
53 static int __init ftv_pci_init(void)
54 {
55         if (machine_is_ftvpci())
56                 pci_common_init(&ftv_pci);
57         return 0;
58 }
59
60 subsys_initcall(ftv_pci_init);