[TG3]: Set minimal hw interrupt mitigation.
[linux-2.6/verdex.git] / arch / arm / mach-iop3xx / iq80332-pci.c
blobb9807aa2aade264b69ec48d5fc482cfdb6d59ae0
1 /*
2 * arch/arm/mach-iop3xx/iq80332-pci.c
4 * PCI support for the Intel IQ80332 reference board
6 * Author: Dave Jiang <dave.jiang@intel.com>
7 * Copyright (C) 2004 Intel Corp.
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>
18 #include <asm/irq.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) \
28 ({ int _ctl_ = -1; \
29 unsigned int _idsel = idsel - minid; \
30 if (_idsel <= maxid) \
31 _ctl_ = pci_irq_table[_idsel][pin-1]; \
32 _ctl_; })
34 #define INTA IRQ_IQ80332_INTA
35 #define INTB IRQ_IQ80332_INTB
36 #define INTC IRQ_IQ80332_INTC
37 #define INTD IRQ_IQ80332_INTD
39 //#define INTE IRQ_IQ80332_I82544
41 static inline int __init
42 iq80332_map_irq(struct pci_dev *dev, u8 idsel, u8 pin)
44 static int pci_irq_table[][8] = {
46 * PCI IDSEL/INTPIN->INTLINE
47 * A B C D
49 {-1, -1, -1, -1},
50 {-1, -1, -1, -1},
51 {-1, -1, -1, -1},
52 {INTA, INTB, INTC, INTD}, /* PCI-X Slot */
53 {-1, -1, -1, -1},
54 {INTC, INTC, INTC, INTC}, /* GigE */
55 {-1, -1, -1, -1},
56 {-1, -1, -1, -1},
59 BUG_ON(pin < 1 || pin > 4);
61 return PCI_IRQ_TABLE_LOOKUP(1, 7);
64 static int iq80332_setup(int nr, struct pci_sys_data *sys)
66 struct resource *res;
68 if(nr != 0)
69 return 0;
71 res = kmalloc(sizeof(struct resource) * 2, GFP_KERNEL);
72 if (!res)
73 panic("PCI: unable to alloc resources");
75 memset(res, 0, sizeof(struct resource) * 2);
77 res[0].start = IOP331_PCI_LOWER_IO_VA;
78 res[0].end = IOP331_PCI_UPPER_IO_VA;
79 res[0].name = "IQ80332 PCI I/O Space";
80 res[0].flags = IORESOURCE_IO;
82 res[1].start = IOP331_PCI_LOWER_MEM_PA;
83 res[1].end = IOP331_PCI_UPPER_MEM_PA;
84 res[1].name = "IQ80332 PCI Memory Space";
85 res[1].flags = IORESOURCE_MEM;
87 request_resource(&ioport_resource, &res[0]);
88 request_resource(&iomem_resource, &res[1]);
90 sys->mem_offset = IOP331_PCI_MEM_OFFSET;
91 sys->io_offset = IOP331_PCI_IO_OFFSET;
93 sys->resource[0] = &res[0];
94 sys->resource[1] = &res[1];
95 sys->resource[2] = NULL;
97 return 1;
100 static void iq80332_preinit(void)
102 iop331_init();
105 static struct hw_pci iq80332_pci __initdata = {
106 .swizzle = pci_std_swizzle,
107 .nr_controllers = 1,
108 .setup = iq80332_setup,
109 .scan = iop331_scan_bus,
110 .preinit = iq80332_preinit,
111 .map_irq = iq80332_map_irq
114 static int __init iq80332_pci_init(void)
116 if (machine_is_iq80332())
117 pci_common_init(&iq80332_pci);
118 return 0;
121 subsys_initcall(iq80332_pci_init);