diff options
author | Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> | 2007-07-30 09:40:35 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2007-07-31 16:35:34 -0400 |
commit | ff32b062ea6d16a1c53d57da0ac9419c9d015534 (patch) | |
tree | c206f1e32f6b10149924fc48d359574b90410cb3 /arch/mips/pci | |
parent | 796756bab6fd09111159b76288169e18fa13d3e8 (diff) |
[MIPS] DDB5477: Remove support
Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/pci')
-rw-r--r-- | arch/mips/pci/Makefile | 1 | ||||
-rw-r--r-- | arch/mips/pci/fixup-ddb5477.c | 78 | ||||
-rw-r--r-- | arch/mips/pci/ops-ddb5477.c | 278 | ||||
-rw-r--r-- | arch/mips/pci/pci-ddb5477.c | 207 |
4 files changed, 0 insertions, 564 deletions
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile index 8be9f2b9db26..4ee6800e67e6 100644 --- a/arch/mips/pci/Makefile +++ b/arch/mips/pci/Makefile | |||
@@ -19,7 +19,6 @@ obj-$(CONFIG_MARKEINS) += ops-emma2rh.o pci-emma2rh.o fixup-emma2rh.o | |||
19 | # These are still pretty much in the old state, watch, go blind. | 19 | # These are still pretty much in the old state, watch, go blind. |
20 | # | 20 | # |
21 | obj-$(CONFIG_BASLER_EXCITE) += ops-titan.o pci-excite.o fixup-excite.o | 21 | obj-$(CONFIG_BASLER_EXCITE) += ops-titan.o pci-excite.o fixup-excite.o |
22 | obj-$(CONFIG_DDB5477) += fixup-ddb5477.o pci-ddb5477.o ops-ddb5477.o | ||
23 | obj-$(CONFIG_MIPS_ATLAS) += fixup-atlas.o | 22 | obj-$(CONFIG_MIPS_ATLAS) += fixup-atlas.o |
24 | obj-$(CONFIG_MIPS_COBALT) += fixup-cobalt.o | 23 | obj-$(CONFIG_MIPS_COBALT) += fixup-cobalt.o |
25 | obj-$(CONFIG_SOC_AU1500) += fixup-au1000.o ops-au1000.o | 24 | obj-$(CONFIG_SOC_AU1500) += fixup-au1000.o ops-au1000.o |
diff --git a/arch/mips/pci/fixup-ddb5477.c b/arch/mips/pci/fixup-ddb5477.c deleted file mode 100644 index 2f1444e60654..000000000000 --- a/arch/mips/pci/fixup-ddb5477.c +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | /* | ||
2 | * | ||
3 | * BRIEF MODULE DESCRIPTION | ||
4 | * Board specific pci fixups. | ||
5 | * | ||
6 | * Copyright 2001, 2002, 2003 MontaVista Software Inc. | ||
7 | * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the | ||
11 | * Free Software Foundation; either version 2 of the License, or (at your | ||
12 | * option) any later version. | ||
13 | * | ||
14 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
15 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
16 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
17 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
20 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
24 | * | ||
25 | * You should have received a copy of the GNU General Public License along | ||
26 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
27 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
28 | */ | ||
29 | |||
30 | #include <linux/types.h> | ||
31 | #include <linux/pci.h> | ||
32 | #include <linux/kernel.h> | ||
33 | #include <linux/init.h> | ||
34 | |||
35 | static void ddb5477_fixup(struct pci_dev *dev) | ||
36 | { | ||
37 | u8 old; | ||
38 | |||
39 | printk(KERN_NOTICE "Enabling ALI M1533/35 PS2 keyboard/mouse.\n"); | ||
40 | pci_read_config_byte(dev, 0x41, &old); | ||
41 | pci_write_config_byte(dev, 0x41, old | 0xd0); | ||
42 | } | ||
43 | |||
44 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, | ||
45 | ddb5477_fixup); | ||
46 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1535, | ||
47 | ddb5477_fixup); | ||
48 | |||
49 | /* | ||
50 | * Fixup baseboard AMD chip so that tx does not underflow. | ||
51 | * bcr_18 |= 0x0800 | ||
52 | * This sets NOUFLO bit which makes tx not start until whole pkt | ||
53 | * is fetched to the chip. | ||
54 | */ | ||
55 | #define PCNET32_WIO_RDP 0x10 | ||
56 | #define PCNET32_WIO_RAP 0x12 | ||
57 | #define PCNET32_WIO_RESET 0x14 | ||
58 | #define PCNET32_WIO_BDP 0x16 | ||
59 | |||
60 | static void ddb5477_amd_lance_fixup(struct pci_dev *dev) | ||
61 | { | ||
62 | unsigned long ioaddr; | ||
63 | u16 temp; | ||
64 | |||
65 | ioaddr = pci_resource_start(dev, 0); | ||
66 | |||
67 | inw(ioaddr + PCNET32_WIO_RESET); /* reset chip */ | ||
68 | |||
69 | /* bcr_18 |= 0x0800 */ | ||
70 | outw(18, ioaddr + PCNET32_WIO_RAP); | ||
71 | temp = inw(ioaddr + PCNET32_WIO_BDP); | ||
72 | temp |= 0x0800; | ||
73 | outw(18, ioaddr + PCNET32_WIO_RAP); | ||
74 | outw(temp, ioaddr + PCNET32_WIO_BDP); | ||
75 | } | ||
76 | |||
77 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_LANCE, | ||
78 | ddb5477_amd_lance_fixup); | ||
diff --git a/arch/mips/pci/ops-ddb5477.c b/arch/mips/pci/ops-ddb5477.c deleted file mode 100644 index 8e57d4c5d90f..000000000000 --- a/arch/mips/pci/ops-ddb5477.c +++ /dev/null | |||
@@ -1,278 +0,0 @@ | |||
1 | /*********************************************************************** | ||
2 | * Copyright 2001 MontaVista Software Inc. | ||
3 | * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net | ||
4 | * | ||
5 | * arch/mips/ddb5xxx/ddb5477/pci_ops.c | ||
6 | * Define the pci_ops for DB5477. | ||
7 | * | ||
8 | * Much of the code is derived from the original DDB5074 port by | ||
9 | * Geert Uytterhoeven <geert@sonycom.com> | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify it | ||
12 | * under the terms of the GNU General Public License as published by the | ||
13 | * Free Software Foundation; either version 2 of the License, or (at your | ||
14 | * option) any later version. | ||
15 | *********************************************************************** | ||
16 | */ | ||
17 | |||
18 | /* | ||
19 | * DDB5477 has two PCI channels, external PCI and IOPIC (internal) | ||
20 | * Therefore we provide two sets of pci_ops. | ||
21 | */ | ||
22 | #include <linux/pci.h> | ||
23 | #include <linux/kernel.h> | ||
24 | #include <linux/types.h> | ||
25 | |||
26 | #include <asm/addrspace.h> | ||
27 | #include <asm/debug.h> | ||
28 | |||
29 | #include <asm/ddb5xxx/ddb5xxx.h> | ||
30 | |||
31 | /* | ||
32 | * config_swap structure records what set of pdar/pmr are used | ||
33 | * to access pci config space. It also provides a place hold the | ||
34 | * original values for future restoring. | ||
35 | */ | ||
36 | struct pci_config_swap { | ||
37 | u32 pdar; | ||
38 | u32 pmr; | ||
39 | u32 config_base; | ||
40 | u32 config_size; | ||
41 | u32 pdar_backup; | ||
42 | u32 pmr_backup; | ||
43 | }; | ||
44 | |||
45 | /* | ||
46 | * On DDB5477, we have two sets of swap registers, for ext PCI and IOPCI. | ||
47 | */ | ||
48 | struct pci_config_swap ext_pci_swap = { | ||
49 | DDB_PCIW0, | ||
50 | DDB_PCIINIT00, | ||
51 | DDB_PCI0_CONFIG_BASE, | ||
52 | DDB_PCI0_CONFIG_SIZE | ||
53 | }; | ||
54 | struct pci_config_swap io_pci_swap = { | ||
55 | DDB_IOPCIW0, | ||
56 | DDB_PCIINIT01, | ||
57 | DDB_PCI1_CONFIG_BASE, | ||
58 | DDB_PCI1_CONFIG_SIZE | ||
59 | }; | ||
60 | |||
61 | |||
62 | /* | ||
63 | * access config space | ||
64 | */ | ||
65 | static inline u32 ddb_access_config_base(struct pci_config_swap *swap, u32 bus, /* 0 means top level bus */ | ||
66 | u32 slot_num) | ||
67 | { | ||
68 | u32 pci_addr = 0; | ||
69 | u32 pciinit_offset = 0; | ||
70 | u32 virt_addr; | ||
71 | u32 option; | ||
72 | |||
73 | /* minimum pdar (window) size is 2MB */ | ||
74 | db_assert(swap->config_size >= (2 << 20)); | ||
75 | |||
76 | db_assert(slot_num < (1 << 5)); | ||
77 | db_assert(bus < (1 << 8)); | ||
78 | |||
79 | /* backup registers */ | ||
80 | swap->pdar_backup = ddb_in32(swap->pdar); | ||
81 | swap->pmr_backup = ddb_in32(swap->pmr); | ||
82 | |||
83 | /* set the pdar (pci window) register */ | ||
84 | ddb_set_pdar(swap->pdar, swap->config_base, swap->config_size, 32, /* 32 bit wide */ | ||
85 | 0, /* not on local memory bus */ | ||
86 | 0); /* not visible from PCI bus (N/A) */ | ||
87 | |||
88 | /* | ||
89 | * calcuate the absolute pci config addr; | ||
90 | * according to the spec, we start scanning from adr:11 (0x800) | ||
91 | */ | ||
92 | if (bus == 0) { | ||
93 | /* type 0 config */ | ||
94 | pci_addr = 0x800 << slot_num; | ||
95 | } else { | ||
96 | /* type 1 config */ | ||
97 | pci_addr = (bus << 16) | (slot_num << 11); | ||
98 | } | ||
99 | |||
100 | /* | ||
101 | * if pci_addr is less than pci config window size, we set | ||
102 | * pciinit_offset to 0 and adjust the virt_address. | ||
103 | * Otherwise we will try to adjust pciinit_offset. | ||
104 | */ | ||
105 | if (pci_addr < swap->config_size) { | ||
106 | virt_addr = KSEG1ADDR(swap->config_base + pci_addr); | ||
107 | pciinit_offset = 0; | ||
108 | } else { | ||
109 | db_assert((pci_addr & (swap->config_size - 1)) == 0); | ||
110 | virt_addr = KSEG1ADDR(swap->config_base); | ||
111 | pciinit_offset = pci_addr; | ||
112 | } | ||
113 | |||
114 | /* set the pmr register */ | ||
115 | option = DDB_PCI_ACCESS_32; | ||
116 | if (bus != 0) | ||
117 | option |= DDB_PCI_CFGTYPE1; | ||
118 | ddb_set_pmr(swap->pmr, DDB_PCICMD_CFG, pciinit_offset, option); | ||
119 | |||
120 | return virt_addr; | ||
121 | } | ||
122 | |||
123 | static inline void ddb_close_config_base(struct pci_config_swap *swap) | ||
124 | { | ||
125 | ddb_out32(swap->pdar, swap->pdar_backup); | ||
126 | ddb_out32(swap->pmr, swap->pmr_backup); | ||
127 | } | ||
128 | |||
129 | static int read_config_dword(struct pci_config_swap *swap, | ||
130 | struct pci_bus *bus, u32 devfn, u32 where, | ||
131 | u32 * val) | ||
132 | { | ||
133 | u32 bus_num, slot_num, func_num; | ||
134 | u32 base; | ||
135 | |||
136 | db_assert((where & 3) == 0); | ||
137 | db_assert(where < (1 << 8)); | ||
138 | |||
139 | /* check if the bus is top-level */ | ||
140 | if (bus->parent != NULL) { | ||
141 | bus_num = bus->number; | ||
142 | db_assert(bus_num != 0); | ||
143 | } else { | ||
144 | bus_num = 0; | ||
145 | } | ||
146 | |||
147 | slot_num = PCI_SLOT(devfn); | ||
148 | func_num = PCI_FUNC(devfn); | ||
149 | base = ddb_access_config_base(swap, bus_num, slot_num); | ||
150 | *val = *(volatile u32 *) (base + (func_num << 8) + where); | ||
151 | ddb_close_config_base(swap); | ||
152 | return PCIBIOS_SUCCESSFUL; | ||
153 | } | ||
154 | |||
155 | static int read_config_word(struct pci_config_swap *swap, | ||
156 | struct pci_bus *bus, u32 devfn, u32 where, | ||
157 | u16 * val) | ||
158 | { | ||
159 | int status; | ||
160 | u32 result; | ||
161 | |||
162 | db_assert((where & 1) == 0); | ||
163 | |||
164 | status = read_config_dword(swap, bus, devfn, where & ~3, &result); | ||
165 | if (where & 2) | ||
166 | result >>= 16; | ||
167 | *val = result & 0xffff; | ||
168 | return status; | ||
169 | } | ||
170 | |||
171 | static int read_config_byte(struct pci_config_swap *swap, | ||
172 | struct pci_bus *bus, u32 devfn, u32 where, | ||
173 | u8 * val) | ||
174 | { | ||
175 | int status; | ||
176 | u32 result; | ||
177 | |||
178 | status = read_config_dword(swap, bus, devfn, where & ~3, &result); | ||
179 | if (where & 1) | ||
180 | result >>= 8; | ||
181 | if (where & 2) | ||
182 | result >>= 16; | ||
183 | *val = result & 0xff; | ||
184 | |||
185 | return status; | ||
186 | } | ||
187 | |||
188 | static int write_config_dword(struct pci_config_swap *swap, | ||
189 | struct pci_bus *bus, u32 devfn, u32 where, | ||
190 | u32 val) | ||
191 | { | ||
192 | u32 bus_num, slot_num, func_num; | ||
193 | u32 base; | ||
194 | |||
195 | db_assert((where & 3) == 0); | ||
196 | db_assert(where < (1 << 8)); | ||
197 | |||
198 | /* check if the bus is top-level */ | ||
199 | if (bus->parent != NULL) { | ||
200 | bus_num = bus->number; | ||
201 | db_assert(bus_num != 0); | ||
202 | } else { | ||
203 | bus_num = 0; | ||
204 | } | ||
205 | |||
206 | slot_num = PCI_SLOT(devfn); | ||
207 | func_num = PCI_FUNC(devfn); | ||
208 | base = ddb_access_config_base(swap, bus_num, slot_num); | ||
209 | *(volatile u32 *) (base + (func_num << 8) + where) = val; | ||
210 | ddb_close_config_base(swap); | ||
211 | return PCIBIOS_SUCCESSFUL; | ||
212 | } | ||
213 | |||
214 | static int write_config_word(struct pci_config_swap *swap, | ||
215 | struct pci_bus *bus, u32 devfn, u32 where, u16 val) | ||
216 | { | ||
217 | int status, shift = 0; | ||
218 | u32 result; | ||
219 | |||
220 | db_assert((where & 1) == 0); | ||
221 | |||
222 | status = read_config_dword(swap, bus, devfn, where & ~3, &result); | ||
223 | if (status != PCIBIOS_SUCCESSFUL) | ||
224 | return status; | ||
225 | |||
226 | if (where & 2) | ||
227 | shift += 16; | ||
228 | result &= ~(0xffff << shift); | ||
229 | result |= val << shift; | ||
230 | return write_config_dword(swap, bus, devfn, where & ~3, result); | ||
231 | } | ||
232 | |||
233 | static int write_config_byte(struct pci_config_swap *swap, | ||
234 | struct pci_bus *bus, u32 devfn, u32 where, u8 val) | ||
235 | { | ||
236 | int status, shift = 0; | ||
237 | u32 result; | ||
238 | |||
239 | status = read_config_dword(swap, bus, devfn, where & ~3, &result); | ||
240 | if (status != PCIBIOS_SUCCESSFUL) | ||
241 | return status; | ||
242 | |||
243 | if (where & 2) | ||
244 | shift += 16; | ||
245 | if (where & 1) | ||
246 | shift += 8; | ||
247 | result &= ~(0xff << shift); | ||
248 | result |= val << shift; | ||
249 | return write_config_dword(swap, bus, devfn, where & ~3, result); | ||
250 | } | ||
251 | |||
252 | #define MAKE_PCI_OPS(prefix, rw, pciswap, star) \ | ||
253 | static int prefix##_##rw##_config(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 star val) \ | ||
254 | { \ | ||
255 | if (size == 1) \ | ||
256 | return rw##_config_byte(pciswap, bus, devfn, where, (u8 star)val); \ | ||
257 | else if (size == 2) \ | ||
258 | return rw##_config_word(pciswap, bus, devfn, where, (u16 star)val); \ | ||
259 | /* Size must be 4 */ \ | ||
260 | return rw##_config_dword(pciswap, bus, devfn, where, val); \ | ||
261 | } | ||
262 | |||
263 | MAKE_PCI_OPS(extpci, read, &ext_pci_swap, *) | ||
264 | MAKE_PCI_OPS(extpci, write, &ext_pci_swap,) | ||
265 | |||
266 | MAKE_PCI_OPS(iopci, read, &io_pci_swap, *) | ||
267 | MAKE_PCI_OPS(iopci, write, &io_pci_swap,) | ||
268 | |||
269 | struct pci_ops ddb5477_ext_pci_ops = { | ||
270 | .read = extpci_read_config, | ||
271 | .write = extpci_write_config | ||
272 | }; | ||
273 | |||
274 | |||
275 | struct pci_ops ddb5477_io_pci_ops = { | ||
276 | .read = iopci_read_config, | ||
277 | .write = iopci_write_config | ||
278 | }; | ||
diff --git a/arch/mips/pci/pci-ddb5477.c b/arch/mips/pci/pci-ddb5477.c deleted file mode 100644 index 7363e1877842..000000000000 --- a/arch/mips/pci/pci-ddb5477.c +++ /dev/null | |||
@@ -1,207 +0,0 @@ | |||
1 | /* | ||
2 | * PCI code for DDB5477. | ||
3 | * | ||
4 | * Copyright (C) 2001 MontaVista Software Inc. | ||
5 | * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net | ||
6 | * | ||
7 | * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org) | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the | ||
11 | * Free Software Foundation; either version 2 of the License, or (at your | ||
12 | * option) any later version. | ||
13 | */ | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/types.h> | ||
17 | #include <linux/pci.h> | ||
18 | |||
19 | #include <asm/bootinfo.h> | ||
20 | #include <asm/debug.h> | ||
21 | |||
22 | #include <asm/ddb5xxx/ddb5xxx.h> | ||
23 | |||
24 | static struct resource extpci_io_resource = { | ||
25 | .start = DDB_PCI0_IO_BASE - DDB_PCI_IO_BASE + 0x4000, | ||
26 | .end = DDB_PCI0_IO_BASE - DDB_PCI_IO_BASE + DDB_PCI0_IO_SIZE - 1, | ||
27 | .name = "ext pci IO space", | ||
28 | .flags = IORESOURCE_IO | ||
29 | }; | ||
30 | |||
31 | static struct resource extpci_mem_resource = { | ||
32 | .start = DDB_PCI0_MEM_BASE + 0x100000, | ||
33 | .end = DDB_PCI0_MEM_BASE + DDB_PCI0_MEM_SIZE - 1, | ||
34 | .name = "ext pci memory space", | ||
35 | .flags = IORESOURCE_MEM | ||
36 | }; | ||
37 | |||
38 | static struct resource iopci_io_resource = { | ||
39 | .start = DDB_PCI1_IO_BASE - DDB_PCI_IO_BASE, | ||
40 | .end = DDB_PCI1_IO_BASE - DDB_PCI_IO_BASE + DDB_PCI1_IO_SIZE - 1, | ||
41 | .name = "io pci IO space", | ||
42 | .flags = IORESOURCE_IO | ||
43 | }; | ||
44 | |||
45 | static struct resource iopci_mem_resource = { | ||
46 | .start = DDB_PCI1_MEM_BASE, | ||
47 | .end = DDB_PCI1_MEM_BASE + DDB_PCI1_MEM_SIZE - 1, | ||
48 | .name = "ext pci memory space", | ||
49 | .flags = IORESOURCE_MEM | ||
50 | }; | ||
51 | |||
52 | extern struct pci_ops ddb5477_ext_pci_ops; | ||
53 | extern struct pci_ops ddb5477_io_pci_ops; | ||
54 | |||
55 | struct pci_controller ddb5477_ext_controller = { | ||
56 | .pci_ops = &ddb5477_ext_pci_ops, | ||
57 | .io_resource = &extpci_io_resource, | ||
58 | .mem_resource = &extpci_mem_resource | ||
59 | }; | ||
60 | |||
61 | struct pci_controller ddb5477_io_controller = { | ||
62 | .pci_ops = &ddb5477_io_pci_ops, | ||
63 | .io_resource = &iopci_io_resource, | ||
64 | .mem_resource = &iopci_mem_resource | ||
65 | }; | ||
66 | |||
67 | |||
68 | |||
69 | /* | ||
70 | * we fix up irqs based on the slot number. | ||
71 | * The first entry is at AD:11. | ||
72 | * Fortunately this works because, although we have two pci buses, | ||
73 | * they all have different slot numbers (except for rockhopper slot 20 | ||
74 | * which is handled below). | ||
75 | * | ||
76 | */ | ||
77 | |||
78 | /* | ||
79 | * irq mapping : device -> pci int # -> vrc4377 irq# , | ||
80 | * ddb5477 board manual page 4 and vrc5477 manual page 46 | ||
81 | */ | ||
82 | |||
83 | /* | ||
84 | * based on ddb5477 manual page 11 | ||
85 | */ | ||
86 | #define MAX_SLOT_NUM 21 | ||
87 | static unsigned char irq_map[MAX_SLOT_NUM] = { | ||
88 | /* SLOT: 0, AD:11 */ 0xff, | ||
89 | /* SLOT: 1, AD:12 */ 0xff, | ||
90 | /* SLOT: 2, AD:13 */ 0xff, | ||
91 | /* SLOT: 3, AD:14 */ 0xff, | ||
92 | /* SLOT: 4, AD:15 */ VRC5477_IRQ_INTA, /* onboard tulip */ | ||
93 | /* SLOT: 5, AD:16 */ VRC5477_IRQ_INTB, /* slot 1 */ | ||
94 | /* SLOT: 6, AD:17 */ VRC5477_IRQ_INTC, /* slot 2 */ | ||
95 | /* SLOT: 7, AD:18 */ VRC5477_IRQ_INTD, /* slot 3 */ | ||
96 | /* SLOT: 8, AD:19 */ VRC5477_IRQ_INTE, /* slot 4 */ | ||
97 | /* SLOT: 9, AD:20 */ 0xff, | ||
98 | /* SLOT: 10, AD:21 */ 0xff, | ||
99 | /* SLOT: 11, AD:22 */ 0xff, | ||
100 | /* SLOT: 12, AD:23 */ 0xff, | ||
101 | /* SLOT: 13, AD:24 */ 0xff, | ||
102 | /* SLOT: 14, AD:25 */ 0xff, | ||
103 | /* SLOT: 15, AD:26 */ 0xff, | ||
104 | /* SLOT: 16, AD:27 */ 0xff, | ||
105 | /* SLOT: 17, AD:28 */ 0xff, | ||
106 | /* SLOT: 18, AD:29 */ VRC5477_IRQ_IOPCI_INTC, /* vrc5477 ac97 */ | ||
107 | /* SLOT: 19, AD:30 */ VRC5477_IRQ_IOPCI_INTB, /* vrc5477 usb peri */ | ||
108 | /* SLOT: 20, AD:31 */ VRC5477_IRQ_IOPCI_INTA, /* vrc5477 usb host */ | ||
109 | }; | ||
110 | static unsigned char rockhopperII_irq_map[MAX_SLOT_NUM] = { | ||
111 | /* SLOT: 0, AD:11 */ 0xff, | ||
112 | /* SLOT: 1, AD:12 */ VRC5477_IRQ_INTB, /* onboard AMD PCNET */ | ||
113 | /* SLOT: 2, AD:13 */ 0xff, | ||
114 | /* SLOT: 3, AD:14 */ 0xff, | ||
115 | /* SLOT: 4, AD:15 */ 14, /* M5229 ide ISA irq */ | ||
116 | /* SLOT: 5, AD:16 */ VRC5477_IRQ_INTD, /* slot 3 */ | ||
117 | /* SLOT: 6, AD:17 */ VRC5477_IRQ_INTA, /* slot 4 */ | ||
118 | /* SLOT: 7, AD:18 */ VRC5477_IRQ_INTD, /* slot 5 */ | ||
119 | /* SLOT: 8, AD:19 */ 0, /* M5457 modem nop */ | ||
120 | /* SLOT: 9, AD:20 */ VRC5477_IRQ_INTA, /* slot 2 */ | ||
121 | /* SLOT: 10, AD:21 */ 0xff, | ||
122 | /* SLOT: 11, AD:22 */ 0xff, | ||
123 | /* SLOT: 12, AD:23 */ 0xff, | ||
124 | /* SLOT: 13, AD:24 */ 0xff, | ||
125 | /* SLOT: 14, AD:25 */ 0xff, | ||
126 | /* SLOT: 15, AD:26 */ 0xff, | ||
127 | /* SLOT: 16, AD:27 */ 0xff, | ||
128 | /* SLOT: 17, AD:28 */ 0, /* M7101 PMU nop */ | ||
129 | /* SLOT: 18, AD:29 */ VRC5477_IRQ_IOPCI_INTC, /* vrc5477 ac97 */ | ||
130 | /* SLOT: 19, AD:30 */ VRC5477_IRQ_IOPCI_INTB, /* vrc5477 usb peri */ | ||
131 | /* SLOT: 20, AD:31 */ VRC5477_IRQ_IOPCI_INTA, /* vrc5477 usb host */ | ||
132 | }; | ||
133 | |||
134 | int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | ||
135 | { | ||
136 | int slot_num; | ||
137 | unsigned char *slot_irq_map; | ||
138 | unsigned char irq; | ||
139 | |||
140 | /* | ||
141 | * We ignore the swizzled slot and pin values. The original | ||
142 | * pci_fixup_irq() codes largely base irq number on the dev slot | ||
143 | * numbers because except for one case they are unique even | ||
144 | * though there are multiple pci buses. | ||
145 | */ | ||
146 | |||
147 | if (mips_machtype == MACH_NEC_ROCKHOPPERII) | ||
148 | slot_irq_map = rockhopperII_irq_map; | ||
149 | else | ||
150 | slot_irq_map = irq_map; | ||
151 | |||
152 | slot_num = PCI_SLOT(dev->devfn); | ||
153 | irq = slot_irq_map[slot_num]; | ||
154 | |||
155 | db_assert(slot_num < MAX_SLOT_NUM); | ||
156 | |||
157 | db_assert(irq != 0xff); | ||
158 | |||
159 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); | ||
160 | |||
161 | if (mips_machtype == MACH_NEC_ROCKHOPPERII) { | ||
162 | /* hack to distinquish overlapping slot 20s, one | ||
163 | * on bus 0 (ALI USB on the M1535 on the backplane), | ||
164 | * and one on bus 2 (NEC USB controller on the CPU board) | ||
165 | * Make the M1535 USB - ISA IRQ number 9. | ||
166 | */ | ||
167 | if (slot_num == 20 && dev->bus->number == 0) { | ||
168 | pci_write_config_byte(dev, | ||
169 | PCI_INTERRUPT_LINE, | ||
170 | 9); | ||
171 | irq = 9; | ||
172 | } | ||
173 | |||
174 | } | ||
175 | |||
176 | return irq; | ||
177 | } | ||
178 | |||
179 | /* Do platform specific device initialization at pci_enable_device() time */ | ||
180 | int pcibios_plat_dev_init(struct pci_dev *dev) | ||
181 | { | ||
182 | return 0; | ||
183 | } | ||
184 | |||
185 | void ddb_pci_reset_bus(void) | ||
186 | { | ||
187 | u32 temp; | ||
188 | |||
189 | /* | ||
190 | * I am not sure about the "official" procedure, the following | ||
191 | * steps work as far as I know: | ||
192 | * We first set PCI cold reset bit (bit 31) in PCICTRL-H. | ||
193 | * Then we clear the PCI warm reset bit (bit 30) to 0 in PCICTRL-H. | ||
194 | * The same is true for both PCI channels. | ||
195 | */ | ||
196 | temp = ddb_in32(DDB_PCICTL0_H); | ||
197 | temp |= 0x80000000; | ||
198 | ddb_out32(DDB_PCICTL0_H, temp); | ||
199 | temp &= ~0xc0000000; | ||
200 | ddb_out32(DDB_PCICTL0_H, temp); | ||
201 | |||
202 | temp = ddb_in32(DDB_PCICTL1_H); | ||
203 | temp |= 0x80000000; | ||
204 | ddb_out32(DDB_PCICTL1_H, temp); | ||
205 | temp &= ~0xc0000000; | ||
206 | ddb_out32(DDB_PCICTL1_H, temp); | ||
207 | } | ||