diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-19 22:07:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-19 22:07:12 -0400 |
commit | 25f42b6af09e34c3f92107b36b5aa6edc2fdba2f (patch) | |
tree | e0977d906193eadeafebc442775491b844be79d5 /arch/mips/basler/excite/excite_prom.c | |
parent | 4c84a39c8adba6bf2f829b217e78bfd61478191a (diff) | |
parent | 1723b4a34af85447684c9696af83929d2c1e8e6b (diff) |
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
* 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus: (51 commits)
[MIPS] Make timer interrupt frequency configurable from kconfig.
[MIPS] Correct HAL2 Kconfig description
[MIPS] Fix R4K cache macro names
[MIPS] Add Missing R4K Cache Macros to IP27 & IP32
[MIPS] Support for the RM9000-based Basler eXcite smart camera platform.
[MIPS] Support for the R5500-based NEC EMMA2RH Mark-eins board
[MIPS] Support SNI RM200C SNI in big endian mode and R5000 processors.
[MIPS] SN: include asm/sn/types.h for nasid_t.
[MIPS] Random fixes for sb1250
[MIPS] Fix bcm1480 compile
[MIPS] Remove support for NEC DDB5476.
[MIPS] Remove support for NEC DDB5074.
[MIPS] Cleanup memory managment initialization.
[MIPS] SN: Declare bridge_pci_ops.
[MIPS] Remove unused function alloc_pci_controller.
[MIPS] IP27: Extract pci_ops into separate file.
[MIPS] IP27: Use symbolic constants instead of magic numbers.
[MIPS] vr41xx: remove unnecessay items from vr41xx/Kconfig.
[MIPS] IP27: Cleanup N/M mode configuration.
[MIPS] IP27: Throw away old unused hacks.
...
Diffstat (limited to 'arch/mips/basler/excite/excite_prom.c')
-rw-r--r-- | arch/mips/basler/excite/excite_prom.c | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/arch/mips/basler/excite/excite_prom.c b/arch/mips/basler/excite/excite_prom.c new file mode 100644 index 000000000000..84724b270753 --- /dev/null +++ b/arch/mips/basler/excite/excite_prom.c | |||
@@ -0,0 +1,148 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004, 2005 by Thomas Koeller (thomas.koeller@baslerweb.com) | ||
3 | * Based on the PMC-Sierra Yosemite board support by Ralf Baechle and | ||
4 | * Manish Lachwani. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #include <linux/config.h> | ||
22 | #include <linux/init.h> | ||
23 | #include <linux/sched.h> | ||
24 | #include <linux/mm.h> | ||
25 | #include <linux/delay.h> | ||
26 | #include <linux/smp.h> | ||
27 | #include <linux/module.h> | ||
28 | #include <asm/io.h> | ||
29 | #include <asm/pgtable.h> | ||
30 | #include <asm/processor.h> | ||
31 | #include <asm/reboot.h> | ||
32 | #include <asm/system.h> | ||
33 | #include <asm/bootinfo.h> | ||
34 | #include <asm/string.h> | ||
35 | |||
36 | #include <excite.h> | ||
37 | |||
38 | /* This struct is used by Redboot to pass arguments to the kernel */ | ||
39 | typedef struct | ||
40 | { | ||
41 | char *name; | ||
42 | char *val; | ||
43 | } t_env_var; | ||
44 | |||
45 | struct parmblock { | ||
46 | t_env_var memsize; | ||
47 | t_env_var modetty0; | ||
48 | t_env_var ethaddr; | ||
49 | t_env_var env_end; | ||
50 | char *argv[2]; | ||
51 | char text[0]; | ||
52 | }; | ||
53 | |||
54 | static unsigned int prom_argc; | ||
55 | static const char ** prom_argv; | ||
56 | static const t_env_var * prom_env; | ||
57 | |||
58 | static void prom_halt(void) __attribute__((noreturn)); | ||
59 | static void prom_exit(void) __attribute__((noreturn)); | ||
60 | |||
61 | |||
62 | |||
63 | const char *get_system_type(void) | ||
64 | { | ||
65 | return "Basler eXcite"; | ||
66 | } | ||
67 | |||
68 | /* | ||
69 | * Halt the system | ||
70 | */ | ||
71 | static void prom_halt(void) | ||
72 | { | ||
73 | printk(KERN_NOTICE "\n** System halted.\n"); | ||
74 | while (1) | ||
75 | asm volatile ( | ||
76 | "\t.set\tmips3\n" | ||
77 | "\twait\n" | ||
78 | "\t.set\tmips0\n" | ||
79 | ); | ||
80 | } | ||
81 | |||
82 | /* | ||
83 | * Reset the CPU and re-enter Redboot | ||
84 | */ | ||
85 | static void prom_exit(void) | ||
86 | { | ||
87 | unsigned int i; | ||
88 | volatile unsigned char * const flg = | ||
89 | (volatile unsigned char *) (EXCITE_ADDR_FPGA + EXCITE_FPGA_DPR); | ||
90 | |||
91 | /* Clear the watchdog reset flag, set the reboot flag */ | ||
92 | *flg &= ~0x01; | ||
93 | *flg |= 0x80; | ||
94 | |||
95 | for (i = 0; i < 10; i++) { | ||
96 | *(volatile unsigned char *) (EXCITE_ADDR_FPGA + EXCITE_FPGA_SYSCTL) = 0x02; | ||
97 | iob(); | ||
98 | mdelay(1000); | ||
99 | } | ||
100 | |||
101 | printk(KERN_NOTICE "Reset failed\n"); | ||
102 | prom_halt(); | ||
103 | } | ||
104 | |||
105 | static const char __init *prom_getenv(char *name) | ||
106 | { | ||
107 | const t_env_var * p; | ||
108 | for (p = prom_env; p->name != NULL; p++) | ||
109 | if(strcmp(name, p->name) == 0) | ||
110 | break; | ||
111 | return p->val; | ||
112 | } | ||
113 | |||
114 | /* | ||
115 | * Init routine which accepts the variables from Redboot | ||
116 | */ | ||
117 | void __init prom_init(void) | ||
118 | { | ||
119 | const struct parmblock * const pb = (struct parmblock *) fw_arg2; | ||
120 | |||
121 | prom_argc = fw_arg0; | ||
122 | prom_argv = (const char **) fw_arg1; | ||
123 | prom_env = &pb->memsize; | ||
124 | |||
125 | /* Callbacks for halt, restart */ | ||
126 | _machine_restart = (void (*)(char *)) prom_exit; | ||
127 | _machine_halt = prom_halt; | ||
128 | |||
129 | #ifdef CONFIG_32BIT | ||
130 | /* copy command line */ | ||
131 | strcpy(arcs_cmdline, prom_argv[1]); | ||
132 | memsize = simple_strtol(prom_getenv("memsize"), NULL, 16); | ||
133 | strcpy(modetty, prom_getenv("modetty0")); | ||
134 | #endif /* CONFIG_32BIT */ | ||
135 | |||
136 | #ifdef CONFIG_64BIT | ||
137 | # error 64 bit support not implemented | ||
138 | #endif /* CONFIG_64BIT */ | ||
139 | |||
140 | mips_machgroup = MACH_GROUP_TITAN; | ||
141 | mips_machtype = MACH_TITAN_EXCITE; | ||
142 | } | ||
143 | |||
144 | /* This is called from free_initmem(), so we need to provide it */ | ||
145 | void __init prom_free_prom_memory(void) | ||
146 | { | ||
147 | /* Nothing to do */ | ||
148 | } | ||