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/mips/galileo-boards |
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/mips/galileo-boards')
-rw-r--r-- | arch/mips/galileo-boards/ev96100/Makefile | 9 | ||||
-rw-r--r-- | arch/mips/galileo-boards/ev96100/init.c | 173 | ||||
-rw-r--r-- | arch/mips/galileo-boards/ev96100/int-handler.S | 33 | ||||
-rw-r--r-- | arch/mips/galileo-boards/ev96100/irq.c | 66 | ||||
-rw-r--r-- | arch/mips/galileo-boards/ev96100/puts.c | 138 | ||||
-rw-r--r-- | arch/mips/galileo-boards/ev96100/reset.c | 70 | ||||
-rw-r--r-- | arch/mips/galileo-boards/ev96100/setup.c | 162 | ||||
-rw-r--r-- | arch/mips/galileo-boards/ev96100/time.c | 89 |
8 files changed, 740 insertions, 0 deletions
diff --git a/arch/mips/galileo-boards/ev96100/Makefile b/arch/mips/galileo-boards/ev96100/Makefile new file mode 100644 index 000000000000..58c02f9db69d --- /dev/null +++ b/arch/mips/galileo-boards/ev96100/Makefile | |||
@@ -0,0 +1,9 @@ | |||
1 | # | ||
2 | # Copyright 2000 MontaVista Software Inc. | ||
3 | # Author: MontaVista Software, Inc. | ||
4 | # ppopov@mvista.com or source@mvista.com | ||
5 | # | ||
6 | # Makefile for the Galileo EV96100 board. | ||
7 | # | ||
8 | |||
9 | obj-y += init.o irq.o puts.o reset.o time.o int-handler.o setup.o | ||
diff --git a/arch/mips/galileo-boards/ev96100/init.c b/arch/mips/galileo-boards/ev96100/init.c new file mode 100644 index 000000000000..a01fe9b36f2c --- /dev/null +++ b/arch/mips/galileo-boards/ev96100/init.c | |||
@@ -0,0 +1,173 @@ | |||
1 | /* | ||
2 | * Copyright 2000 MontaVista Software Inc. | ||
3 | * Author: MontaVista Software, Inc. | ||
4 | * ppopov@mvista.com or source@mvista.com | ||
5 | * | ||
6 | * This file was derived from Carsten Langgaard's | ||
7 | * arch/mips/mips-boards/generic/generic.c | ||
8 | * | ||
9 | * Carsten Langgaard, carstenl@mips.com | ||
10 | * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved. | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify it | ||
13 | * under the terms of the GNU General Public License as published by the | ||
14 | * Free Software Foundation; either version 2 of the License, or (at your | ||
15 | * option) any later version. | ||
16 | * | ||
17 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
20 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
23 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
24 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
27 | * | ||
28 | * You should have received a copy of the GNU General Public License along | ||
29 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
30 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
31 | */ | ||
32 | #include <linux/init.h> | ||
33 | #include <linux/mm.h> | ||
34 | #include <linux/sched.h> | ||
35 | #include <linux/bootmem.h> | ||
36 | #include <linux/string.h> | ||
37 | #include <linux/kernel.h> | ||
38 | |||
39 | #include <asm/addrspace.h> | ||
40 | #include <asm/bootinfo.h> | ||
41 | #include <asm/gt64120.h> | ||
42 | |||
43 | |||
44 | /* Environment variable */ | ||
45 | |||
46 | typedef struct { | ||
47 | char *name; | ||
48 | char *val; | ||
49 | } t_env_var; | ||
50 | |||
51 | int prom_argc; | ||
52 | char **prom_argv, **prom_envp; | ||
53 | |||
54 | int init_debug = 0; | ||
55 | |||
56 | char * __init prom_getcmdline(void) | ||
57 | { | ||
58 | return &(arcs_cmdline[0]); | ||
59 | } | ||
60 | |||
61 | unsigned long __init prom_free_prom_memory(void) | ||
62 | { | ||
63 | return 0; | ||
64 | } | ||
65 | |||
66 | void __init prom_init_cmdline(void) | ||
67 | { | ||
68 | char *cp; | ||
69 | int actr; | ||
70 | |||
71 | actr = 1; /* Always ignore argv[0] */ | ||
72 | |||
73 | cp = &(arcs_cmdline[0]); | ||
74 | while(actr < prom_argc) { | ||
75 | strcpy(cp, prom_argv[actr]); | ||
76 | cp += strlen(prom_argv[actr]); | ||
77 | *cp++ = ' '; | ||
78 | actr++; | ||
79 | } | ||
80 | if (cp != &(arcs_cmdline[0])) /* get rid of trailing space */ | ||
81 | --cp; | ||
82 | *cp = '\0'; | ||
83 | } | ||
84 | |||
85 | char *prom_getenv(char *envname) | ||
86 | { | ||
87 | /* | ||
88 | * Return a pointer to the given environment variable. | ||
89 | */ | ||
90 | |||
91 | t_env_var *env = (t_env_var *) prom_envp; | ||
92 | int i; | ||
93 | |||
94 | i = strlen(envname); | ||
95 | |||
96 | while (env->name) { | ||
97 | if (strncmp(envname, env->name, i) == 0) { | ||
98 | return (env->val); | ||
99 | } | ||
100 | env++; | ||
101 | } | ||
102 | return (NULL); | ||
103 | } | ||
104 | |||
105 | static inline unsigned char str2hexnum(unsigned char c) | ||
106 | { | ||
107 | if (c >= '0' && c <= '9') | ||
108 | return c - '0'; | ||
109 | if (c >= 'a' && c <= 'f') | ||
110 | return c - 'a' + 10; | ||
111 | return 0; /* foo */ | ||
112 | } | ||
113 | |||
114 | static inline void str2eaddr(unsigned char *ea, unsigned char *str) | ||
115 | { | ||
116 | int i; | ||
117 | |||
118 | for (i = 0; i < 6; i++) { | ||
119 | unsigned char num; | ||
120 | |||
121 | if ((*str == '.') || (*str == ':')) | ||
122 | str++; | ||
123 | num = str2hexnum(*str++) << 4; | ||
124 | num |= (str2hexnum(*str++)); | ||
125 | ea[i] = num; | ||
126 | } | ||
127 | } | ||
128 | |||
129 | int get_ethernet_addr(char *ethernet_addr) | ||
130 | { | ||
131 | char *ethaddr_str; | ||
132 | |||
133 | ethaddr_str = prom_getenv("ethaddr"); | ||
134 | if (!ethaddr_str) { | ||
135 | printk("ethaddr not set in boot prom\n"); | ||
136 | return -1; | ||
137 | } | ||
138 | str2eaddr(ethernet_addr, ethaddr_str); | ||
139 | |||
140 | if (init_debug > 1) { | ||
141 | int i; | ||
142 | printk("get_ethernet_addr: "); | ||
143 | for (i = 0; i < 5; i++) | ||
144 | printk("%02x:", | ||
145 | (unsigned char) *(ethernet_addr + i)); | ||
146 | printk("%02x\n", *(ethernet_addr + i)); | ||
147 | } | ||
148 | |||
149 | return 0; | ||
150 | } | ||
151 | |||
152 | const char *get_system_type(void) | ||
153 | { | ||
154 | return "Galileo EV96100"; | ||
155 | } | ||
156 | |||
157 | void __init prom_init(void) | ||
158 | { | ||
159 | volatile unsigned char *uart; | ||
160 | char ppbuf[8]; | ||
161 | |||
162 | prom_argc = fw_arg0; | ||
163 | prom_argv = (char **) fw_arg1; | ||
164 | prom_envp = (char **) fw_arg2; | ||
165 | |||
166 | mips_machgroup = MACH_GROUP_GALILEO; | ||
167 | mips_machtype = MACH_EV96100; | ||
168 | |||
169 | prom_init_cmdline(); | ||
170 | |||
171 | /* 32 MB upgradable */ | ||
172 | add_memory_region(0, 32 << 20, BOOT_MEM_RAM); | ||
173 | } | ||
diff --git a/arch/mips/galileo-boards/ev96100/int-handler.S b/arch/mips/galileo-boards/ev96100/int-handler.S new file mode 100644 index 000000000000..ff4d10a38859 --- /dev/null +++ b/arch/mips/galileo-boards/ev96100/int-handler.S | |||
@@ -0,0 +1,33 @@ | |||
1 | #include <asm/asm.h> | ||
2 | #include <asm/mipsregs.h> | ||
3 | #include <asm/regdef.h> | ||
4 | #include <asm/stackframe.h> | ||
5 | |||
6 | .set noat | ||
7 | .align 5 | ||
8 | |||
9 | NESTED(ev96100IRQ, PT_SIZE, sp) | ||
10 | SAVE_ALL | ||
11 | CLI # Important: mark KERNEL mode ! | ||
12 | |||
13 | mfc0 t0, CP0_CAUSE # get pending interrupts | ||
14 | mfc0 t1, CP0_STATUS # get enabled interrupts | ||
15 | and t0, t1 # isolate allowed ones | ||
16 | |||
17 | # FIX ME add R7000 extensions | ||
18 | andi t0,0xff00 # isolate pending bits | ||
19 | andi a0, t0, CAUSEF_IP7 | ||
20 | beq a0, zero, 1f | ||
21 | move a0, sp | ||
22 | jal mips_timer_interrupt | ||
23 | j ret_from_irq | ||
24 | |||
25 | 1: beqz t0, 3f # spurious interrupt | ||
26 | |||
27 | move a0, t0 | ||
28 | move a1, sp | ||
29 | jal ev96100_cpu_irq | ||
30 | j ret_from_irq | ||
31 | |||
32 | 3: j spurious_interrupt | ||
33 | END(ev96100IRQ) | ||
diff --git a/arch/mips/galileo-boards/ev96100/irq.c b/arch/mips/galileo-boards/ev96100/irq.c new file mode 100644 index 000000000000..97bf094da4fe --- /dev/null +++ b/arch/mips/galileo-boards/ev96100/irq.c | |||
@@ -0,0 +1,66 @@ | |||
1 | /* | ||
2 | * Copyright 2000 MontaVista Software Inc. | ||
3 | * Author: MontaVista Software, Inc. | ||
4 | * ppopov@mvista.com or source@mvista.com | ||
5 | * | ||
6 | * This file was derived from Carsten Langgaard's | ||
7 | * arch/mips/mips-boards/atlas/atlas_int.c. | ||
8 | * | ||
9 | * Carsten Langgaard, carstenl@mips.com | ||
10 | * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved. | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify it | ||
13 | * under the terms of the GNU General Public License as published by the | ||
14 | * Free Software Foundation; either version 2 of the License, or (at your | ||
15 | * option) any later version. | ||
16 | * | ||
17 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
20 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
23 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
24 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
27 | * | ||
28 | * You should have received a copy of the GNU General Public License along | ||
29 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
30 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
31 | */ | ||
32 | #include <linux/errno.h> | ||
33 | #include <linux/init.h> | ||
34 | #include <linux/kernel_stat.h> | ||
35 | #include <linux/irq.h> | ||
36 | #include <linux/module.h> | ||
37 | #include <linux/signal.h> | ||
38 | #include <linux/sched.h> | ||
39 | #include <linux/types.h> | ||
40 | #include <linux/interrupt.h> | ||
41 | #include <asm/irq_cpu.h> | ||
42 | |||
43 | extern asmlinkage void ev96100IRQ(void); | ||
44 | |||
45 | static inline unsigned int ffz8(unsigned int word) | ||
46 | { | ||
47 | unsigned long k; | ||
48 | |||
49 | k = 7; | ||
50 | if (word & 0x0fUL) { k -= 4; word <<= 4; } | ||
51 | if (word & 0x30UL) { k -= 2; word <<= 2; } | ||
52 | if (word & 0x40UL) { k -= 1; } | ||
53 | |||
54 | return k; | ||
55 | } | ||
56 | |||
57 | asmlinkage void ev96100_cpu_irq(unsigned int pendin) | ||
58 | { | ||
59 | do_IRQ(ffz8(pending >> 8), regs); | ||
60 | } | ||
61 | |||
62 | void __init arch_init_irq(void) | ||
63 | { | ||
64 | set_except_vector(0, ev96100IRQ); | ||
65 | mips_cpu_irq_init(0); | ||
66 | } | ||
diff --git a/arch/mips/galileo-boards/ev96100/puts.c b/arch/mips/galileo-boards/ev96100/puts.c new file mode 100644 index 000000000000..49dc6d137b9c --- /dev/null +++ b/arch/mips/galileo-boards/ev96100/puts.c | |||
@@ -0,0 +1,138 @@ | |||
1 | |||
2 | /* | ||
3 | * Debug routines which directly access the uart. | ||
4 | */ | ||
5 | |||
6 | #include <linux/types.h> | ||
7 | #include <asm/gt64120.h> | ||
8 | |||
9 | |||
10 | //#define SERIAL_BASE EV96100_UART0_REGS_BASE | ||
11 | #define SERIAL_BASE 0xBD000020 | ||
12 | #define NS16550_BASE SERIAL_BASE | ||
13 | |||
14 | #define SERA_CMD 0x0D | ||
15 | #define SERA_DATA 0x08 | ||
16 | //#define SERB_CMD 0x05 | ||
17 | #define SERB_CMD 20 | ||
18 | #define SERB_DATA 0x00 | ||
19 | #define TX_BUSY 0x20 | ||
20 | |||
21 | #define TIMEOUT 0xffff | ||
22 | #undef SLOW_DOWN | ||
23 | |||
24 | static const char digits[16] = "0123456789abcdef"; | ||
25 | static volatile unsigned char *const com1 = (unsigned char *) SERIAL_BASE; | ||
26 | |||
27 | |||
28 | #ifdef SLOW_DOWN | ||
29 | static inline void slow_down() | ||
30 | { | ||
31 | int k; | ||
32 | for (k = 0; k < 10000; k++); | ||
33 | } | ||
34 | #else | ||
35 | #define slow_down() | ||
36 | #endif | ||
37 | |||
38 | void putch(const unsigned char c) | ||
39 | { | ||
40 | unsigned char ch; | ||
41 | int i = 0; | ||
42 | |||
43 | do { | ||
44 | ch = com1[SERB_CMD]; | ||
45 | slow_down(); | ||
46 | i++; | ||
47 | if (i > TIMEOUT) { | ||
48 | break; | ||
49 | } | ||
50 | } while (0 == (ch & TX_BUSY)); | ||
51 | com1[SERB_DATA] = c; | ||
52 | } | ||
53 | |||
54 | void putchar(const unsigned char c) | ||
55 | { | ||
56 | unsigned char ch; | ||
57 | int i = 0; | ||
58 | |||
59 | do { | ||
60 | ch = com1[SERB_CMD]; | ||
61 | slow_down(); | ||
62 | i++; | ||
63 | if (i > TIMEOUT) { | ||
64 | break; | ||
65 | } | ||
66 | } while (0 == (ch & TX_BUSY)); | ||
67 | com1[SERB_DATA] = c; | ||
68 | } | ||
69 | |||
70 | void puts(unsigned char *cp) | ||
71 | { | ||
72 | unsigned char ch; | ||
73 | int i = 0; | ||
74 | |||
75 | while (*cp) { | ||
76 | do { | ||
77 | ch = com1[SERB_CMD]; | ||
78 | slow_down(); | ||
79 | i++; | ||
80 | if (i > TIMEOUT) { | ||
81 | break; | ||
82 | } | ||
83 | } while (0 == (ch & TX_BUSY)); | ||
84 | com1[SERB_DATA] = *cp++; | ||
85 | } | ||
86 | putch('\r'); | ||
87 | putch('\n'); | ||
88 | } | ||
89 | |||
90 | void fputs(unsigned char *cp) | ||
91 | { | ||
92 | unsigned char ch; | ||
93 | int i = 0; | ||
94 | |||
95 | while (*cp) { | ||
96 | |||
97 | do { | ||
98 | ch = com1[SERB_CMD]; | ||
99 | slow_down(); | ||
100 | i++; | ||
101 | if (i > TIMEOUT) { | ||
102 | break; | ||
103 | } | ||
104 | } while (0 == (ch & TX_BUSY)); | ||
105 | com1[SERB_DATA] = *cp++; | ||
106 | } | ||
107 | } | ||
108 | |||
109 | |||
110 | void put64(uint64_t ul) | ||
111 | { | ||
112 | int cnt; | ||
113 | unsigned ch; | ||
114 | |||
115 | cnt = 16; /* 16 nibbles in a 64 bit long */ | ||
116 | putch('0'); | ||
117 | putch('x'); | ||
118 | do { | ||
119 | cnt--; | ||
120 | ch = (unsigned char) (ul >> cnt * 4) & 0x0F; | ||
121 | putch(digits[ch]); | ||
122 | } while (cnt > 0); | ||
123 | } | ||
124 | |||
125 | void put32(unsigned u) | ||
126 | { | ||
127 | int cnt; | ||
128 | unsigned ch; | ||
129 | |||
130 | cnt = 8; /* 8 nibbles in a 32 bit long */ | ||
131 | putch('0'); | ||
132 | putch('x'); | ||
133 | do { | ||
134 | cnt--; | ||
135 | ch = (unsigned char) (u >> cnt * 4) & 0x0F; | ||
136 | putch(digits[ch]); | ||
137 | } while (cnt > 0); | ||
138 | } | ||
diff --git a/arch/mips/galileo-boards/ev96100/reset.c b/arch/mips/galileo-boards/ev96100/reset.c new file mode 100644 index 000000000000..5ef9b7f896e6 --- /dev/null +++ b/arch/mips/galileo-boards/ev96100/reset.c | |||
@@ -0,0 +1,70 @@ | |||
1 | /* | ||
2 | * BRIEF MODULE DESCRIPTION | ||
3 | * Galileo EV96100 reset routines. | ||
4 | * | ||
5 | * Copyright 2000 MontaVista Software Inc. | ||
6 | * Author: MontaVista Software, Inc. | ||
7 | * ppopov@mvista.com or source@mvista.com | ||
8 | * | ||
9 | * This file was derived from Carsten Langgaard's | ||
10 | * arch/mips/mips-boards/generic/reset.c | ||
11 | * | ||
12 | * Carsten Langgaard, carstenl@mips.com | ||
13 | * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved. | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify it | ||
16 | * under the terms of the GNU General Public License as published by the | ||
17 | * Free Software Foundation; either version 2 of the License, or (at your | ||
18 | * option) any later version. | ||
19 | * | ||
20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
22 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
23 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
24 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
25 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
26 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
27 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
29 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
30 | * | ||
31 | * You should have received a copy of the GNU General Public License along | ||
32 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
33 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
34 | */ | ||
35 | #include <linux/sched.h> | ||
36 | #include <linux/mm.h> | ||
37 | #include <asm/io.h> | ||
38 | #include <asm/pgtable.h> | ||
39 | #include <asm/processor.h> | ||
40 | #include <asm/reboot.h> | ||
41 | #include <asm/system.h> | ||
42 | #include <asm/gt64120.h> | ||
43 | |||
44 | static void mips_machine_restart(char *command); | ||
45 | static void mips_machine_halt(void); | ||
46 | |||
47 | static void mips_machine_restart(char *command) | ||
48 | { | ||
49 | set_c0_status(ST0_BEV | ST0_ERL); | ||
50 | change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED); | ||
51 | flush_cache_all(); | ||
52 | write_c0_wired(0); | ||
53 | __asm__ __volatile__("jr\t%0"::"r"(0xbfc00000)); | ||
54 | while (1); | ||
55 | } | ||
56 | |||
57 | static void mips_machine_halt(void) | ||
58 | { | ||
59 | printk(KERN_NOTICE "You can safely turn off the power\n"); | ||
60 | while (1) | ||
61 | __asm__(".set\tmips3\n\t" | ||
62 | "wait\n\t" | ||
63 | ".set\tmips0"); | ||
64 | } | ||
65 | |||
66 | void mips_reboot_setup(void) | ||
67 | { | ||
68 | _machine_restart = mips_machine_restart; | ||
69 | _machine_halt = mips_machine_halt; | ||
70 | } | ||
diff --git a/arch/mips/galileo-boards/ev96100/setup.c b/arch/mips/galileo-boards/ev96100/setup.c new file mode 100644 index 000000000000..28bd908c6d55 --- /dev/null +++ b/arch/mips/galileo-boards/ev96100/setup.c | |||
@@ -0,0 +1,162 @@ | |||
1 | /* | ||
2 | * BRIEF MODULE DESCRIPTION | ||
3 | * Galileo EV96100 setup. | ||
4 | * | ||
5 | * Copyright 2000 MontaVista Software Inc. | ||
6 | * Author: MontaVista Software, Inc. | ||
7 | * ppopov@mvista.com or source@mvista.com | ||
8 | * | ||
9 | * This file was derived from Carsten Langgaard's | ||
10 | * arch/mips/mips-boards/atlas/atlas_setup.c. | ||
11 | * | ||
12 | * Carsten Langgaard, carstenl@mips.com | ||
13 | * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved. | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify it | ||
16 | * under the terms of the GNU General Public License as published by the | ||
17 | * Free Software Foundation; either version 2 of the License, or (at your | ||
18 | * option) any later version. | ||
19 | * | ||
20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
22 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
23 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
24 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
25 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
26 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
27 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
29 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
30 | * | ||
31 | * You should have received a copy of the GNU General Public License along | ||
32 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
33 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
34 | */ | ||
35 | #include <linux/config.h> | ||
36 | #include <linux/init.h> | ||
37 | #include <linux/sched.h> | ||
38 | #include <linux/ioport.h> | ||
39 | #include <linux/string.h> | ||
40 | #include <linux/ctype.h> | ||
41 | #include <linux/pci.h> | ||
42 | |||
43 | #include <asm/cpu.h> | ||
44 | #include <asm/bootinfo.h> | ||
45 | #include <asm/mipsregs.h> | ||
46 | #include <asm/irq.h> | ||
47 | #include <asm/delay.h> | ||
48 | #include <asm/gt64120.h> | ||
49 | #include <asm/galileo-boards/ev96100int.h> | ||
50 | |||
51 | |||
52 | extern char *__init prom_getcmdline(void); | ||
53 | |||
54 | extern void mips_reboot_setup(void); | ||
55 | |||
56 | unsigned char mac_0_1[12]; | ||
57 | |||
58 | static void __init ev96100_setup(void) | ||
59 | { | ||
60 | unsigned int config = read_c0_config(); | ||
61 | unsigned int status = read_c0_status(); | ||
62 | unsigned int info = read_c0_info(); | ||
63 | u32 tmp; | ||
64 | |||
65 | char *argptr; | ||
66 | |||
67 | clear_c0_status(ST0_FR); | ||
68 | |||
69 | if (config & 0x8) | ||
70 | printk("Secondary cache is enabled\n"); | ||
71 | else | ||
72 | printk("Secondary cache is disabled\n"); | ||
73 | |||
74 | if (status & (1 << 27)) | ||
75 | printk("User-mode cache ops enabled\n"); | ||
76 | else | ||
77 | printk("User-mode cache ops disabled\n"); | ||
78 | |||
79 | printk("CP0 info reg: %x\n", (unsigned) info); | ||
80 | if (info & (1 << 28)) | ||
81 | printk("burst mode Scache RAMS\n"); | ||
82 | else | ||
83 | printk("pipelined Scache RAMS\n"); | ||
84 | |||
85 | if (info & 0x1) | ||
86 | printk("Atomic Enable is set\n"); | ||
87 | |||
88 | argptr = prom_getcmdline(); | ||
89 | #ifdef CONFIG_SERIAL_CONSOLE | ||
90 | if (strstr(argptr, "console=") == NULL) { | ||
91 | argptr = prom_getcmdline(); | ||
92 | strcat(argptr, " console=ttyS0,115200"); | ||
93 | } | ||
94 | #endif | ||
95 | |||
96 | mips_reboot_setup(); | ||
97 | |||
98 | set_io_port_base(KSEG1); | ||
99 | ioport_resource.start = GT_PCI_IO_BASE; | ||
100 | ioport_resource.end = GT_PCI_IO_BASE + 0x01ffffff; | ||
101 | |||
102 | #ifdef CONFIG_BLK_DEV_INITRD | ||
103 | ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0); | ||
104 | #endif | ||
105 | |||
106 | |||
107 | /* | ||
108 | * Setup GT controller master bit so we can do config cycles | ||
109 | */ | ||
110 | |||
111 | /* Clear cause register bits */ | ||
112 | GT_WRITE(GT_INTRCAUSE_OFS, ~(GT_INTRCAUSE_MASABORT0_BIT | | ||
113 | GT_INTRCAUSE_TARABORT0_BIT)); | ||
114 | /* Setup address */ | ||
115 | GT_WRITE(GT_PCI0_CFGADDR_OFS, | ||
116 | (0 << GT_PCI0_CFGADDR_BUSNUM_SHF) | | ||
117 | (0 << GT_PCI0_CFGADDR_FUNCTNUM_SHF) | | ||
118 | ((PCI_COMMAND / 4) << GT_PCI0_CFGADDR_REGNUM_SHF) | | ||
119 | GT_PCI0_CFGADDR_CONFIGEN_BIT); | ||
120 | |||
121 | udelay(2); | ||
122 | tmp = GT_READ(GT_PCI0_CFGDATA_OFS); | ||
123 | |||
124 | tmp |= (PCI_COMMAND_IO | PCI_COMMAND_MEMORY | | ||
125 | PCI_COMMAND_MASTER | PCI_COMMAND_SERR); | ||
126 | GT_WRITE(GT_PCI0_CFGADDR_OFS, | ||
127 | (0 << GT_PCI0_CFGADDR_BUSNUM_SHF) | | ||
128 | (0 << GT_PCI0_CFGADDR_FUNCTNUM_SHF) | | ||
129 | ((PCI_COMMAND / 4) << GT_PCI0_CFGADDR_REGNUM_SHF) | | ||
130 | GT_PCI0_CFGADDR_CONFIGEN_BIT); | ||
131 | udelay(2); | ||
132 | GT_WRITE(GT_PCI0_CFGDATA_OFS, tmp); | ||
133 | |||
134 | /* Setup address */ | ||
135 | GT_WRITE(GT_PCI0_CFGADDR_OFS, | ||
136 | (0 << GT_PCI0_CFGADDR_BUSNUM_SHF) | | ||
137 | (0 << GT_PCI0_CFGADDR_FUNCTNUM_SHF) | | ||
138 | ((PCI_COMMAND / 4) << GT_PCI0_CFGADDR_REGNUM_SHF) | | ||
139 | GT_PCI0_CFGADDR_CONFIGEN_BIT); | ||
140 | |||
141 | udelay(2); | ||
142 | tmp = GT_READ(GT_PCI0_CFGDATA_OFS); | ||
143 | } | ||
144 | |||
145 | early_initcall(ev96100_setup); | ||
146 | |||
147 | unsigned short get_gt_devid(void) | ||
148 | { | ||
149 | u32 gt_devid; | ||
150 | |||
151 | /* Figure out if this is a gt96100 or gt96100A */ | ||
152 | GT_WRITE(GT_PCI0_CFGADDR_OFS, | ||
153 | (0 << GT_PCI0_CFGADDR_BUSNUM_SHF) | | ||
154 | (0 << GT_PCI0_CFGADDR_FUNCTNUM_SHF) | | ||
155 | ((PCI_VENDOR_ID / 4) << GT_PCI0_CFGADDR_REGNUM_SHF) | | ||
156 | GT_PCI0_CFGADDR_CONFIGEN_BIT); | ||
157 | |||
158 | udelay(4); | ||
159 | gt_devid = GT_READ(GT_PCI0_CFGDATA_OFS); | ||
160 | |||
161 | return gt_devid >> 16; | ||
162 | } | ||
diff --git a/arch/mips/galileo-boards/ev96100/time.c b/arch/mips/galileo-boards/ev96100/time.c new file mode 100644 index 000000000000..bff5b1c174e4 --- /dev/null +++ b/arch/mips/galileo-boards/ev96100/time.c | |||
@@ -0,0 +1,89 @@ | |||
1 | /* | ||
2 | * BRIEF MODULE DESCRIPTION | ||
3 | * Galileo EV96100 rtc routines. | ||
4 | * | ||
5 | * Copyright 2000 MontaVista Software Inc. | ||
6 | * Author: MontaVista Software, Inc. | ||
7 | * ppopov@mvista.com or source@mvista.com | ||
8 | * | ||
9 | * This file was derived from Carsten Langgaard's | ||
10 | * arch/mips/mips-boards/atlas/atlas_rtc.c. | ||
11 | * | ||
12 | * Carsten Langgaard, carstenl@mips.com | ||
13 | * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved. | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify it | ||
16 | * under the terms of the GNU General Public License as published by the | ||
17 | * Free Software Foundation; either version 2 of the License, or (at your | ||
18 | * option) any later version. | ||
19 | * | ||
20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
22 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
23 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
24 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
25 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
26 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
27 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
29 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
30 | * | ||
31 | * You should have received a copy of the GNU General Public License along | ||
32 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
33 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
34 | */ | ||
35 | #include <linux/config.h> | ||
36 | #include <linux/init.h> | ||
37 | #include <linux/kernel_stat.h> | ||
38 | #include <linux/module.h> | ||
39 | #include <linux/sched.h> | ||
40 | #include <linux/spinlock.h> | ||
41 | #include <linux/timex.h> | ||
42 | |||
43 | #include <asm/mipsregs.h> | ||
44 | #include <asm/ptrace.h> | ||
45 | #include <asm/time.h> | ||
46 | |||
47 | |||
48 | #define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5) | ||
49 | |||
50 | extern volatile unsigned long wall_jiffies; | ||
51 | unsigned long missed_heart_beats = 0; | ||
52 | |||
53 | static unsigned long r4k_offset; /* Amount to increment compare reg each time */ | ||
54 | static unsigned long r4k_cur; /* What counter should be at next timer irq */ | ||
55 | |||
56 | static inline void ack_r4ktimer(unsigned long newval) | ||
57 | { | ||
58 | write_c0_compare(newval); | ||
59 | } | ||
60 | |||
61 | /* | ||
62 | * There are a lot of conceptually broken versions of the MIPS timer interrupt | ||
63 | * handler floating around. This one is rather different, but the algorithm | ||
64 | * is probably more robust. | ||
65 | */ | ||
66 | void mips_timer_interrupt(struct pt_regs *regs) | ||
67 | { | ||
68 | int irq = 7; /* FIX ME */ | ||
69 | |||
70 | if (r4k_offset == 0) { | ||
71 | goto null; | ||
72 | } | ||
73 | |||
74 | do { | ||
75 | kstat_this_cpu.irqs[irq]++; | ||
76 | do_timer(regs); | ||
77 | #ifndef CONFIG_SMP | ||
78 | update_process_times(user_mode(regs)); | ||
79 | #endif | ||
80 | r4k_cur += r4k_offset; | ||
81 | ack_r4ktimer(r4k_cur); | ||
82 | |||
83 | } while (((unsigned long)read_c0_count() | ||
84 | - r4k_cur) < 0x7fffffff); | ||
85 | return; | ||
86 | |||
87 | null: | ||
88 | ack_r4ktimer(0); | ||
89 | } | ||