2 * arch/arm/mach-iop3xx/iq80321-pci.c
4 * PCI support for the Intel IQ80321 reference board
6 * Author: Rory Bolt <rorybolt@pacbell.net>
7 * Copyright (C) 2002 Rory Bolt
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
13 #include <linux/kernel.h>
14 #include <linux/pci.h>
15 #include <linux/init.h>
17 #include <asm/hardware.h>
19 #include <asm/mach/pci.h>
20 #include <asm/mach-types.h>
23 * The following macro is used to lookup irqs in a standard table
24 * format for those systems that do not already have PCI
25 * interrupts properly routed. We assume 1 <= pin <= 4
27 #define PCI_IRQ_TABLE_LOOKUP(minid,maxid) \
29 unsigned int _idsel = idsel - minid; \
30 if (_idsel <= maxid) \
31 _ctl_ = pci_irq_table[_idsel][pin-1]; \
34 #define INTA IRQ_IQ80321_INTA
35 #define INTB IRQ_IQ80321_INTB
36 #define INTC IRQ_IQ80321_INTC
37 #define INTD IRQ_IQ80321_INTD
39 #define INTE IRQ_IQ80321_I82544
41 typedef u8 irq_table[4];
43 static irq_table pci_irq_table[] = {
45 * PCI IDSEL/INTPIN->INTLINE
48 {INTE, INTE, INTE, INTE}, /* Gig-E */
49 {INTD, INTC, INTD, INTA}, /* Unused */
50 {INTC, INTD, INTA, INTB}, /* PCI-X Slot */
53 static inline int __init
54 iq80321_map_irq(struct pci_dev *dev, u8 idsel, u8 pin)
56 BUG_ON(pin < 1 || pin > 4);
58 return PCI_IRQ_TABLE_LOOKUP(2, 3);
61 static int iq80321_setup(int nr, struct pci_sys_data *sys)
65 sys->map_irq = iq80321_map_irq;
71 return iop321_setup(nr, sys);
74 static void iq80321_preinit(void)
79 static struct hw_pci iq80321_pci __initdata = {
80 .swizzle = pci_std_swizzle,
82 .setup = iq80321_setup,
83 .scan = iop321_scan_bus,
84 .preinit = iq80321_preinit,
87 static int __init iq80321_pci_init(void)
89 if (machine_is_iq80321())
90 pci_common_init(&iq80321_pci);
94 subsys_initcall(iq80321_pci_init);