setup.c (265b89db1058124ddbf0091ba3f8c020e3a5ae9d) setup.c (860e546c19d88c21819c7f0861c505debd2d6eed)
1/*
2 * linux/arch/mips/txx9/generic/setup.c
3 *
4 * Based on linux/arch/mips/txx9/rbtx4938/setup.c,
5 * and RBTX49xx patch from CELF patch archive.
6 *
7 * 2003-2005 (c) MontaVista Software, Inc.
8 * (C) Copyright TOSHIBA CORPORATION 2000-2001, 2004-2007

--- 105 unchanged lines hidden (view full) ---

114
115int irq_to_gpio(unsigned irq)
116{
117 return -EINVAL;
118}
119EXPORT_SYMBOL(irq_to_gpio);
120#endif
121
1/*
2 * linux/arch/mips/txx9/generic/setup.c
3 *
4 * Based on linux/arch/mips/txx9/rbtx4938/setup.c,
5 * and RBTX49xx patch from CELF patch archive.
6 *
7 * 2003-2005 (c) MontaVista Software, Inc.
8 * (C) Copyright TOSHIBA CORPORATION 2000-2001, 2004-2007

--- 105 unchanged lines hidden (view full) ---

114
115int irq_to_gpio(unsigned irq)
116{
117 return -EINVAL;
118}
119EXPORT_SYMBOL(irq_to_gpio);
120#endif
121
122extern struct txx9_board_vec jmr3927_vec;
123extern struct txx9_board_vec rbtx4927_vec;
124extern struct txx9_board_vec rbtx4937_vec;
125extern struct txx9_board_vec rbtx4938_vec;
122#define BOARD_VEC(board) extern struct txx9_board_vec board;
123#include <asm/txx9/boards.h>
124#undef BOARD_VEC
126
127struct txx9_board_vec *txx9_board_vec __initdata;
128static char txx9_system_type[32];
129
125
126struct txx9_board_vec *txx9_board_vec __initdata;
127static char txx9_system_type[32];
128
129static struct txx9_board_vec *board_vecs[] __initdata = {
130#define BOARD_VEC(board) &board,
131#include <asm/txx9/boards.h>
132#undef BOARD_VEC
133};
134
135static struct txx9_board_vec *__init find_board_byname(const char *name)
136{
137 int i;
138
139 /* search board_vecs table */
140 for (i = 0; i < ARRAY_SIZE(board_vecs); i++) {
141 if (strstr(board_vecs[i]->system, name))
142 return board_vecs[i];
143 }
144 return NULL;
145}
146
130static void __init prom_init_cmdline(void)
131{
132 int argc = (int)fw_arg0;
133 int *argv32 = (int *)fw_arg1;
134 int i; /* Always ignore the "-c" at argv[0] */
135 char builtin[CL_SIZE];
136
137 /* ignore all built-in args if any f/w args given */

--- 26 unchanged lines hidden (view full) ---

164 /* append saved builtin args */
165 if (builtin[0]) {
166 if (arcs_cmdline[0])
167 strcat(arcs_cmdline, " ");
168 strcat(arcs_cmdline, builtin);
169 }
170}
171
147static void __init prom_init_cmdline(void)
148{
149 int argc = (int)fw_arg0;
150 int *argv32 = (int *)fw_arg1;
151 int i; /* Always ignore the "-c" at argv[0] */
152 char builtin[CL_SIZE];
153
154 /* ignore all built-in args if any f/w args given */

--- 26 unchanged lines hidden (view full) ---

181 /* append saved builtin args */
182 if (builtin[0]) {
183 if (arcs_cmdline[0])
184 strcat(arcs_cmdline, " ");
185 strcat(arcs_cmdline, builtin);
186 }
187}
188
172void __init prom_init(void)
189static void __init preprocess_cmdline(void)
173{
190{
174 prom_init_cmdline();
191 char cmdline[CL_SIZE];
192 char *s;
193
194 strcpy(cmdline, arcs_cmdline);
195 s = cmdline;
196 arcs_cmdline[0] = '\0';
197 while (s && *s) {
198 char *str = strsep(&s, " ");
199 if (strncmp(str, "board=", 6) == 0) {
200 txx9_board_vec = find_board_byname(str + 6);
201 continue;
202 } else if (strncmp(str, "masterclk=", 10) == 0) {
203 unsigned long val;
204 if (strict_strtoul(str + 10, 10, &val) == 0)
205 txx9_master_clock = val;
206 continue;
207 }
208 if (arcs_cmdline[0])
209 strcat(arcs_cmdline, " ");
210 strcat(arcs_cmdline, str);
211 }
212}
213
214static void __init select_board(void)
215{
216 const char *envstr;
217
218 /* first, determine by "board=" argument in preprocess_cmdline() */
219 if (txx9_board_vec)
220 return;
221 /* next, determine by "board" envvar */
222 envstr = prom_getenv("board");
223 if (envstr) {
224 txx9_board_vec = find_board_byname(envstr);
225 if (txx9_board_vec)
226 return;
227 }
228
229 /* select "default" board */
175#ifdef CONFIG_CPU_TX39XX
176 txx9_board_vec = &jmr3927_vec;
177#endif
178#ifdef CONFIG_CPU_TX49XX
179 switch (TX4938_REV_PCODE()) {
180#ifdef CONFIG_TOSHIBA_RBTX4927
181 case 0x4927:
182 txx9_board_vec = &rbtx4927_vec;

--- 4 unchanged lines hidden (view full) ---

187#endif
188#ifdef CONFIG_TOSHIBA_RBTX4938
189 case 0x4938:
190 txx9_board_vec = &rbtx4938_vec;
191 break;
192#endif
193 }
194#endif
230#ifdef CONFIG_CPU_TX39XX
231 txx9_board_vec = &jmr3927_vec;
232#endif
233#ifdef CONFIG_CPU_TX49XX
234 switch (TX4938_REV_PCODE()) {
235#ifdef CONFIG_TOSHIBA_RBTX4927
236 case 0x4927:
237 txx9_board_vec = &rbtx4927_vec;

--- 4 unchanged lines hidden (view full) ---

242#endif
243#ifdef CONFIG_TOSHIBA_RBTX4938
244 case 0x4938:
245 txx9_board_vec = &rbtx4938_vec;
246 break;
247#endif
248 }
249#endif
250}
195
251
252void __init prom_init(void)
253{
254 prom_init_cmdline();
255 preprocess_cmdline();
256 select_board();
257
196 strcpy(txx9_system_type, txx9_board_vec->system);
197
198 txx9_board_vec->prom_init();
199}
200
201void __init prom_free_prom_memory(void)
202{
203}

--- 206 unchanged lines hidden ---
258 strcpy(txx9_system_type, txx9_board_vec->system);
259
260 txx9_board_vec->prom_init();
261}
262
263void __init prom_free_prom_memory(void)
264{
265}

--- 206 unchanged lines hidden ---