blob: 0de8aa748dd856a544879388e76216d884c5082b [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Lennert Buytenhek3f7e5812006-09-18 23:10:26 +01002 * arch/arm/mach-iop33x/iq80332-pci.c
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 *
4 * PCI support for the Intel IQ80332 reference board
5 *
6 * Author: Dave Jiang <dave.jiang@intel.com>
7 * Copyright (C) 2004 Intel Corp.
8 *
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.
12 */
13#include <linux/kernel.h>
14#include <linux/pci.h>
15#include <linux/init.h>
Tim Schmielau4e57b682005-10-30 15:03:48 -080016#include <linux/string.h>
17#include <linux/slab.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018
19#include <asm/hardware.h>
20#include <asm/irq.h>
21#include <asm/mach/pci.h>
22#include <asm/mach-types.h>
23
24/*
25 * The following macro is used to lookup irqs in a standard table
26 * format for those systems that do not already have PCI
27 * interrupts properly routed. We assume 1 <= pin <= 4
28 */
29#define PCI_IRQ_TABLE_LOOKUP(minid,maxid) \
30({ int _ctl_ = -1; \
31 unsigned int _idsel = idsel - minid; \
32 if (_idsel <= maxid) \
33 _ctl_ = pci_irq_table[_idsel][pin-1]; \
34 _ctl_; })
35
36#define INTA IRQ_IQ80332_INTA
37#define INTB IRQ_IQ80332_INTB
38#define INTC IRQ_IQ80332_INTC
39#define INTD IRQ_IQ80332_INTD
40
41//#define INTE IRQ_IQ80332_I82544
42
43static inline int __init
44iq80332_map_irq(struct pci_dev *dev, u8 idsel, u8 pin)
45{
46 static int pci_irq_table[][8] = {
47 /*
48 * PCI IDSEL/INTPIN->INTLINE
49 * A B C D
50 */
51 {-1, -1, -1, -1},
52 {-1, -1, -1, -1},
53 {-1, -1, -1, -1},
54 {INTA, INTB, INTC, INTD}, /* PCI-X Slot */
55 {-1, -1, -1, -1},
56 {INTC, INTC, INTC, INTC}, /* GigE */
57 {-1, -1, -1, -1},
58 {-1, -1, -1, -1},
59 };
60
61 BUG_ON(pin < 1 || pin > 4);
62
63 return PCI_IRQ_TABLE_LOOKUP(1, 7);
64}
65
Linus Torvalds1da177e2005-04-16 15:20:36 -070066static struct hw_pci iq80332_pci __initdata = {
67 .swizzle = pci_std_swizzle,
68 .nr_controllers = 1,
Lennert Buytenhek7e9740b2006-09-18 23:17:36 +010069 .setup = iop3xx_pci_setup,
70 .scan = iop3xx_pci_scan_bus,
71 .preinit = iop3xx_pci_preinit,
Linus Torvalds1da177e2005-04-16 15:20:36 -070072 .map_irq = iq80332_map_irq
73};
74
75static int __init iq80332_pci_init(void)
76{
77 if (machine_is_iq80332())
78 pci_common_init(&iq80332_pci);
79 return 0;
80}
81
82subsys_initcall(iq80332_pci_init);
83
84
85
86