aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/mti-sead3/sead3-init.c
diff options
context:
space:
mode:
authorSteven J. Hill <sjhill@mips.com>2012-05-30 17:02:49 -0400
committerSteven J. Hill <sjhill@mips.com>2012-09-13 16:43:46 -0400
commit3070033a16edcc21688d5ea8967c89522f833862 (patch)
tree48d1a4601dd4750d103bc0b02ff2494d75220321 /arch/mips/mti-sead3/sead3-init.c
parent006a851b10a395955c153a145ad8241494d43688 (diff)
MIPS: Add core files for MIPS SEAD-3 development platform.
More information about the SEAD-3 platform can be found at <http://www.mips.com/products/development-kits/mips-sead-3/> on MTI's site. Currently, the M14K family of cores is what the SEAD-3 is utilised with. Signed-off-by: Douglas Leung <douglas@mips.com> Signed-off-by: Chris Dearman <chris@mips.com> Signed-off-by: Steven J. Hill <sjhill@mips.com>
Diffstat (limited to 'arch/mips/mti-sead3/sead3-init.c')
-rw-r--r--arch/mips/mti-sead3/sead3-init.c91
1 files changed, 91 insertions, 0 deletions
diff --git a/arch/mips/mti-sead3/sead3-init.c b/arch/mips/mti-sead3/sead3-init.c
new file mode 100644
index 000000000000..a958cad6fff6
--- /dev/null
+++ b/arch/mips/mti-sead3/sead3-init.c
@@ -0,0 +1,91 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
7 */
8#include <linux/init.h>
9#include <linux/io.h>
10
11#include <asm/bootinfo.h>
12#include <asm/cacheflush.h>
13#include <asm/traps.h>
14#include <asm/mips-boards/generic.h>
15#include <asm/mips-boards/prom.h>
16
17extern void prom_init_early_console(char port);
18
19extern char except_vec_nmi;
20extern char except_vec_ejtag_debug;
21
22int prom_argc;
23int *_prom_argv, *_prom_envp;
24
25#define prom_envp(index) ((char *)(long)_prom_envp[(index)])
26
27char *prom_getenv(char *envname)
28{
29 /*
30 * Return a pointer to the given environment variable.
31 * In 64-bit mode: we're using 64-bit pointers, but all pointers
32 * in the PROM structures are only 32-bit, so we need some
33 * workarounds, if we are running in 64-bit mode.
34 */
35 int i, index = 0;
36
37 i = strlen(envname);
38
39 while (prom_envp(index)) {
40 if (strncmp(envname, prom_envp(index), i) == 0)
41 return prom_envp(index+1);
42 index += 2;
43 }
44
45 return NULL;
46}
47
48static void __init mips_nmi_setup(void)
49{
50 void *base;
51
52 base = cpu_has_veic ?
53 (void *)(CAC_BASE + 0xa80) :
54 (void *)(CAC_BASE + 0x380);
55 memcpy(base, &except_vec_nmi, 0x80);
56 flush_icache_range((unsigned long)base, (unsigned long)base + 0x80);
57}
58
59static void __init mips_ejtag_setup(void)
60{
61 void *base;
62
63 base = cpu_has_veic ?
64 (void *)(CAC_BASE + 0xa00) :
65 (void *)(CAC_BASE + 0x300);
66 memcpy(base, &except_vec_ejtag_debug, 0x80);
67 flush_icache_range((unsigned long)base, (unsigned long)base + 0x80);
68}
69
70void __init prom_init(void)
71{
72 prom_argc = fw_arg0;
73 _prom_argv = (int *) fw_arg1;
74 _prom_envp = (int *) fw_arg2;
75
76 board_nmi_handler_setup = mips_nmi_setup;
77 board_ejtag_handler_setup = mips_ejtag_setup;
78
79 prom_init_cmdline();
80 prom_meminit();
81#ifdef CONFIG_EARLY_PRINTK
82 if ((strstr(prom_getcmdline(), "console=ttyS0")) != NULL)
83 prom_init_early_console(0);
84 else if ((strstr(prom_getcmdline(), "console=ttyS1")) != NULL)
85 prom_init_early_console(1);
86#endif
87#ifdef CONFIG_SERIAL_8250_CONSOLE
88 if ((strstr(prom_getcmdline(), "console=")) == NULL)
89 strcat(prom_getcmdline(), " console=ttyS0,38400n8r");
90#endif
91}