diff options
Diffstat (limited to 'arch/mips/mips-boards/generic/init.c')
-rw-r--r-- | arch/mips/mips-boards/generic/init.c | 91 |
1 files changed, 70 insertions, 21 deletions
diff --git a/arch/mips/mips-boards/generic/init.c b/arch/mips/mips-boards/generic/init.c index 311155d1d3ed..eab5a705e989 100644 --- a/arch/mips/mips-boards/generic/init.c +++ b/arch/mips/mips-boards/generic/init.c | |||
@@ -1,6 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * Carsten Langgaard, carstenl@mips.com | 2 | * Copyright (C) 1999, 2000, 2004, 2005 MIPS Technologies, Inc. |
3 | * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved. | 3 | * All rights reserved. |
4 | * Authors: Carsten Langgaard <carstenl@mips.com> | ||
5 | * Maciej W. Rozycki <macro@mips.com> | ||
4 | * | 6 | * |
5 | * This program is free software; you can distribute it and/or modify it | 7 | * This program is free software; you can distribute it and/or modify it |
6 | * under the terms of the GNU General Public License (Version 2) as | 8 | * under the terms of the GNU General Public License (Version 2) as |
@@ -22,18 +24,19 @@ | |||
22 | #include <linux/string.h> | 24 | #include <linux/string.h> |
23 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
24 | 26 | ||
25 | #include <asm/io.h> | ||
26 | #include <asm/bootinfo.h> | 27 | #include <asm/bootinfo.h> |
28 | #include <asm/gt64120.h> | ||
29 | #include <asm/io.h> | ||
30 | #include <asm/system.h> | ||
31 | #include <asm/cacheflush.h> | ||
32 | #include <asm/traps.h> | ||
33 | |||
27 | #include <asm/mips-boards/prom.h> | 34 | #include <asm/mips-boards/prom.h> |
28 | #include <asm/mips-boards/generic.h> | 35 | #include <asm/mips-boards/generic.h> |
29 | #ifdef CONFIG_MIPS_GT64120 | ||
30 | #include <asm/gt64120.h> | ||
31 | #endif | ||
32 | #include <asm/mips-boards/msc01_pci.h> | ||
33 | #include <asm/mips-boards/bonito64.h> | 36 | #include <asm/mips-boards/bonito64.h> |
34 | #ifdef CONFIG_MIPS_MALTA | 37 | #include <asm/mips-boards/msc01_pci.h> |
38 | |||
35 | #include <asm/mips-boards/malta.h> | 39 | #include <asm/mips-boards/malta.h> |
36 | #endif | ||
37 | 40 | ||
38 | #ifdef CONFIG_KGDB | 41 | #ifdef CONFIG_KGDB |
39 | extern int rs_kgdb_hook(int, int); | 42 | extern int rs_kgdb_hook(int, int); |
@@ -223,8 +226,34 @@ void __init kgdb_config (void) | |||
223 | } | 226 | } |
224 | #endif | 227 | #endif |
225 | 228 | ||
229 | void __init mips_nmi_setup (void) | ||
230 | { | ||
231 | void *base; | ||
232 | extern char except_vec_nmi; | ||
233 | |||
234 | base = cpu_has_veic ? | ||
235 | (void *)(CAC_BASE + 0xa80) : | ||
236 | (void *)(CAC_BASE + 0x380); | ||
237 | memcpy(base, &except_vec_nmi, 0x80); | ||
238 | flush_icache_range((unsigned long)base, (unsigned long)base + 0x80); | ||
239 | } | ||
240 | |||
241 | void __init mips_ejtag_setup (void) | ||
242 | { | ||
243 | void *base; | ||
244 | extern char except_vec_ejtag_debug; | ||
245 | |||
246 | base = cpu_has_veic ? | ||
247 | (void *)(CAC_BASE + 0xa00) : | ||
248 | (void *)(CAC_BASE + 0x300); | ||
249 | memcpy(base, &except_vec_ejtag_debug, 0x80); | ||
250 | flush_icache_range((unsigned long)base, (unsigned long)base + 0x80); | ||
251 | } | ||
252 | |||
226 | void __init prom_init(void) | 253 | void __init prom_init(void) |
227 | { | 254 | { |
255 | u32 start, map, mask, data; | ||
256 | |||
228 | prom_argc = fw_arg0; | 257 | prom_argc = fw_arg0; |
229 | _prom_argv = (int *) fw_arg1; | 258 | _prom_argv = (int *) fw_arg1; |
230 | _prom_envp = (int *) fw_arg2; | 259 | _prom_envp = (int *) fw_arg2; |
@@ -266,12 +295,15 @@ void __init prom_init(void) | |||
266 | #else | 295 | #else |
267 | GT_WRITE(GT_PCI0_CMD_OFS, 0); | 296 | GT_WRITE(GT_PCI0_CMD_OFS, 0); |
268 | #endif | 297 | #endif |
298 | /* Fix up PCI I/O mapping if necessary (for Atlas). */ | ||
299 | start = GT_READ(GT_PCI0IOLD_OFS); | ||
300 | map = GT_READ(GT_PCI0IOREMAP_OFS); | ||
301 | if ((start & map) != 0) { | ||
302 | map &= ~start; | ||
303 | GT_WRITE(GT_PCI0IOREMAP_OFS, map); | ||
304 | } | ||
269 | 305 | ||
270 | #ifdef CONFIG_MIPS_MALTA | ||
271 | set_io_port_base(MALTA_GT_PORT_BASE); | 306 | set_io_port_base(MALTA_GT_PORT_BASE); |
272 | #else | ||
273 | set_io_port_base((unsigned long)ioremap(0, 0x20000000)); | ||
274 | #endif | ||
275 | break; | 307 | break; |
276 | 308 | ||
277 | case MIPS_REVISION_CORID_CORE_EMUL_BON: | 309 | case MIPS_REVISION_CORID_CORE_EMUL_BON: |
@@ -300,18 +332,21 @@ void __init prom_init(void) | |||
300 | BONITO_BONGENCFG_BYTESWAP; | 332 | BONITO_BONGENCFG_BYTESWAP; |
301 | #endif | 333 | #endif |
302 | 334 | ||
303 | #ifdef CONFIG_MIPS_MALTA | ||
304 | set_io_port_base(MALTA_BONITO_PORT_BASE); | 335 | set_io_port_base(MALTA_BONITO_PORT_BASE); |
305 | #else | ||
306 | set_io_port_base((unsigned long)ioremap(0, 0x20000000)); | ||
307 | #endif | ||
308 | break; | 336 | break; |
309 | 337 | ||
310 | case MIPS_REVISION_CORID_CORE_MSC: | 338 | case MIPS_REVISION_CORID_CORE_MSC: |
311 | case MIPS_REVISION_CORID_CORE_FPGA2: | 339 | case MIPS_REVISION_CORID_CORE_FPGA2: |
340 | case MIPS_REVISION_CORID_CORE_FPGA3: | ||
312 | case MIPS_REVISION_CORID_CORE_EMUL_MSC: | 341 | case MIPS_REVISION_CORID_CORE_EMUL_MSC: |
313 | _pcictrl_msc = (unsigned long)ioremap(MIPS_MSC01_PCI_REG_BASE, 0x2000); | 342 | _pcictrl_msc = (unsigned long)ioremap(MIPS_MSC01_PCI_REG_BASE, 0x2000); |
314 | 343 | ||
344 | mb(); | ||
345 | MSC_READ(MSC01_PCI_CFG, data); | ||
346 | MSC_WRITE(MSC01_PCI_CFG, data & ~MSC01_PCI_CFG_EN_BIT); | ||
347 | wmb(); | ||
348 | |||
349 | /* Fix up lane swapping. */ | ||
315 | #ifdef CONFIG_CPU_LITTLE_ENDIAN | 350 | #ifdef CONFIG_CPU_LITTLE_ENDIAN |
316 | MSC_WRITE(MSC01_PCI_SWAP, MSC01_PCI_SWAP_NOSWAP); | 351 | MSC_WRITE(MSC01_PCI_SWAP, MSC01_PCI_SWAP_NOSWAP); |
317 | #else | 352 | #else |
@@ -320,12 +355,23 @@ void __init prom_init(void) | |||
320 | MSC01_PCI_SWAP_BYTESWAP << MSC01_PCI_SWAP_MEM_SHF | | 355 | MSC01_PCI_SWAP_BYTESWAP << MSC01_PCI_SWAP_MEM_SHF | |
321 | MSC01_PCI_SWAP_BYTESWAP << MSC01_PCI_SWAP_BAR0_SHF); | 356 | MSC01_PCI_SWAP_BYTESWAP << MSC01_PCI_SWAP_BAR0_SHF); |
322 | #endif | 357 | #endif |
358 | /* Fix up target memory mapping. */ | ||
359 | MSC_READ(MSC01_PCI_BAR0, mask); | ||
360 | MSC_WRITE(MSC01_PCI_P2SCMSKL, mask & MSC01_PCI_BAR0_SIZE_MSK); | ||
361 | |||
362 | /* Don't handle target retries indefinitely. */ | ||
363 | if ((data & MSC01_PCI_CFG_MAXRTRY_MSK) == | ||
364 | MSC01_PCI_CFG_MAXRTRY_MSK) | ||
365 | data = (data & ~(MSC01_PCI_CFG_MAXRTRY_MSK << | ||
366 | MSC01_PCI_CFG_MAXRTRY_SHF)) | | ||
367 | ((MSC01_PCI_CFG_MAXRTRY_MSK - 1) << | ||
368 | MSC01_PCI_CFG_MAXRTRY_SHF); | ||
369 | |||
370 | wmb(); | ||
371 | MSC_WRITE(MSC01_PCI_CFG, data); | ||
372 | mb(); | ||
323 | 373 | ||
324 | #ifdef CONFIG_MIPS_MALTA | ||
325 | set_io_port_base(MALTA_MSC_PORT_BASE); | 374 | set_io_port_base(MALTA_MSC_PORT_BASE); |
326 | #else | ||
327 | set_io_port_base((unsigned long)ioremap(0, 0x20000000)); | ||
328 | #endif | ||
329 | break; | 375 | break; |
330 | 376 | ||
331 | default: | 377 | default: |
@@ -334,6 +380,9 @@ void __init prom_init(void) | |||
334 | while(1); /* We die here... */ | 380 | while(1); /* We die here... */ |
335 | } | 381 | } |
336 | #endif | 382 | #endif |
383 | board_nmi_handler_setup = mips_nmi_setup; | ||
384 | board_ejtag_handler_setup = mips_ejtag_setup; | ||
385 | |||
337 | prom_printf("\nLINUX started...\n"); | 386 | prom_printf("\nLINUX started...\n"); |
338 | prom_init_cmdline(); | 387 | prom_init_cmdline(); |
339 | prom_meminit(); | 388 | prom_meminit(); |