diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/arm/mach-iop3xx/iq80331-pci.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/arm/mach-iop3xx/iq80331-pci.c')
-rw-r--r-- | arch/arm/mach-iop3xx/iq80331-pci.c | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/arch/arm/mach-iop3xx/iq80331-pci.c b/arch/arm/mach-iop3xx/iq80331-pci.c new file mode 100644 index 000000000000..f37a0e26b466 --- /dev/null +++ b/arch/arm/mach-iop3xx/iq80331-pci.c | |||
@@ -0,0 +1,119 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-iop3xx/iq80331-pci.c | ||
3 | * | ||
4 | * PCI support for the Intel IQ80331 reference board | ||
5 | * | ||
6 | * Author: Dave Jiang <dave.jiang@intel.com> | ||
7 | * Copyright (C) 2003, 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> | ||
16 | |||
17 | #include <asm/hardware.h> | ||
18 | #include <asm/irq.h> | ||
19 | #include <asm/mach/pci.h> | ||
20 | #include <asm/mach-types.h> | ||
21 | |||
22 | /* | ||
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 | ||
26 | */ | ||
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_; }) | ||
33 | |||
34 | #define INTA IRQ_IQ80331_INTA | ||
35 | #define INTB IRQ_IQ80331_INTB | ||
36 | #define INTC IRQ_IQ80331_INTC | ||
37 | #define INTD IRQ_IQ80331_INTD | ||
38 | |||
39 | //#define INTE IRQ_IQ80331_I82544 | ||
40 | |||
41 | static inline int __init | ||
42 | iq80331_map_irq(struct pci_dev *dev, u8 idsel, u8 pin) | ||
43 | { | ||
44 | static int pci_irq_table[][4] = { | ||
45 | /* | ||
46 | * PCI IDSEL/INTPIN->INTLINE | ||
47 | * A B C D | ||
48 | */ | ||
49 | {INTB, INTC, INTD, INTA}, /* PCI-X Slot */ | ||
50 | {INTC, INTC, INTC, INTC}, /* GigE */ | ||
51 | }; | ||
52 | |||
53 | BUG_ON(pin < 1 || pin > 4); | ||
54 | |||
55 | return PCI_IRQ_TABLE_LOOKUP(1, 7); | ||
56 | } | ||
57 | |||
58 | static int iq80331_setup(int nr, struct pci_sys_data *sys) | ||
59 | { | ||
60 | struct resource *res; | ||
61 | |||
62 | if(nr != 0) | ||
63 | return 0; | ||
64 | |||
65 | res = kmalloc(sizeof(struct resource) * 2, GFP_KERNEL); | ||
66 | if (!res) | ||
67 | panic("PCI: unable to alloc resources"); | ||
68 | |||
69 | memset(res, 0, sizeof(struct resource) * 2); | ||
70 | |||
71 | res[0].start = IOP331_PCI_LOWER_IO_VA; | ||
72 | res[0].end = IOP331_PCI_UPPER_IO_VA; | ||
73 | res[0].name = "IQ80331 PCI I/O Space"; | ||
74 | res[0].flags = IORESOURCE_IO; | ||
75 | |||
76 | res[1].start = IOP331_PCI_LOWER_MEM_PA; | ||
77 | res[1].end = IOP331_PCI_UPPER_MEM_PA; | ||
78 | res[1].name = "IQ80331 PCI Memory Space"; | ||
79 | res[1].flags = IORESOURCE_MEM; | ||
80 | |||
81 | request_resource(&ioport_resource, &res[0]); | ||
82 | request_resource(&iomem_resource, &res[1]); | ||
83 | |||
84 | sys->mem_offset = IOP331_PCI_MEM_OFFSET; | ||
85 | sys->io_offset = IOP331_PCI_IO_OFFSET; | ||
86 | |||
87 | sys->resource[0] = &res[0]; | ||
88 | sys->resource[1] = &res[1]; | ||
89 | sys->resource[2] = NULL; | ||
90 | |||
91 | return 1; | ||
92 | } | ||
93 | |||
94 | static void iq80331_preinit(void) | ||
95 | { | ||
96 | iop331_init(); | ||
97 | } | ||
98 | |||
99 | static struct hw_pci iq80331_pci __initdata = { | ||
100 | .swizzle = pci_std_swizzle, | ||
101 | .nr_controllers = 1, | ||
102 | .setup = iq80331_setup, | ||
103 | .scan = iop331_scan_bus, | ||
104 | .preinit = iq80331_preinit, | ||
105 | .map_irq = iq80331_map_irq | ||
106 | }; | ||
107 | |||
108 | static int __init iq80331_pci_init(void) | ||
109 | { | ||
110 | if (machine_is_iq80331()) | ||
111 | pci_common_init(&iq80331_pci); | ||
112 | return 0; | ||
113 | } | ||
114 | |||
115 | subsys_initcall(iq80331_pci_init); | ||
116 | |||
117 | |||
118 | |||
119 | |||