4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
8 * Copyright (C) 2000 Harald Koerfgen
9 * Copyright (C) 2002, 2003, 2005 Ilya A. Volynets
10 * Copyright (C) 2006 Ralf Baechle <ralf@linux-mips.org>
12 #include <linux/console.h>
13 #include <linux/init.h>
14 #include <linux/interrupt.h>
15 #include <linux/param.h>
16 #include <linux/sched.h>
18 #include <asm/bootinfo.h>
19 #include <asm/mipsregs.h>
20 #include <asm/mmu_context.h>
21 #include <asm/sgialib.h>
23 #include <asm/traps.h>
25 #include <asm/ip32/crime.h>
26 #include <asm/ip32/mace.h>
27 #include <asm/ip32/ip32_ints.h>
29 #include "ip32-common.h"
31 #ifdef CONFIG_SGI_O2MACE_ETH
33 * This is taken care of in here 'cause they say using Arc later on is
36 extern char o2meth_eaddr
[8];
37 static inline unsigned char str2hexnum(unsigned char c
)
39 if (c
>= '0' && c
<= '9')
41 if (c
>= 'a' && c
<= 'f')
46 static inline void str2eaddr(unsigned char *ea
, unsigned char *str
)
50 for (i
= 0; i
< 6; i
++) {
55 num
= str2hexnum(*str
++) << 4;
56 num
|= (str2hexnum(*str
++));
62 /* An arbitrary time; this can be decreased if reliability looks good */
65 void __init
plat_time_init(void)
67 printk(KERN_INFO
"Calibrating system timer... ");
70 while (crime
->timer
< CRIME_MASTER_FREQ
* WAIT_MS
/ 1000) ;
71 mips_hpt_frequency
= read_c0_count() * 1000 / WAIT_MS
;
72 printk("%d MHz CPU detected\n", mips_hpt_frequency
* 2 / 1000000);
75 void __init
plat_mem_setup(void)
77 board_be_init
= ip32_be_init
;
79 #ifdef CONFIG_SGI_O2MACE_ETH
81 char *mac
= ArcGetEnvironmentVariable("eaddr");
82 str2eaddr(o2meth_eaddr
, mac
);
86 #if defined(CONFIG_SERIAL_CORE_CONSOLE)
88 char* con
= ArcGetEnvironmentVariable("console");
89 if (con
&& *con
== 'd') {
90 static char options
[8] __initdata
;
91 char *baud
= ArcGetEnvironmentVariable("dbaud");
93 strcpy(options
, baud
);
94 add_preferred_console("ttyS", *(con
+ 1) == '2' ? 1 : 0,
95 baud
? options
: NULL
);