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