commented early_printk patch because of rejects.
[linux-flexiantxendom0-3.2.10.git] / arch / mips / sgi-ip32 / ip32-setup.c
1 /*
2  * IP32 basic setup
3  *
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
6  * for more details.
7  *
8  * Copyright (C) 2000 Harald Koerfgen
9  */
10 #include <linux/config.h>
11 #include <linux/sched.h>
12 #include <linux/interrupt.h>
13 #include <linux/mc146818rtc.h>
14 #include <linux/param.h>
15 #include <linux/init.h>
16
17 #include <asm/time.h>
18 #include <asm/mipsregs.h>
19 #include <asm/bootinfo.h>
20 #include <asm/mmu_context.h>
21 #include <asm/ip32/crime.h>
22 #include <asm/ip32/mace.h>
23 #include <asm/ip32/ip32_ints.h>
24 #include <asm/sgialib.h>
25 #include <asm/traps.h>
26
27 extern struct rtc_ops ip32_rtc_ops;
28 extern u32 cc_interval;
29
30 #ifdef CONFIG_SGI_O2MACE_ETH
31
32 /*
33  * This is taken care of in here 'cause they say using Arc later on is
34  * problematic
35  */
36 extern char o2meth_eaddr[8];
37 static inline unsigned char str2hexnum(unsigned char c)
38 {
39         if (c >= '0' && c <= '9')
40                 return c - '0';
41         if (c >= 'a' && c <= 'f')
42                 return c - 'a' + 10;
43         return 0; /* foo */
44 }
45
46 static inline void str2eaddr(unsigned char *ea, unsigned char *str)
47 {
48         int i;
49
50         for (i = 0; i < 6; i++) {
51                 unsigned char num;
52
53                 if(*str == ':')
54                         str++;
55                 num = str2hexnum(*str++) << 4;
56                 num |= (str2hexnum(*str++));
57                 ea[i] = num;
58         }
59 }
60 #endif
61
62 extern void ip32_time_init(void);
63 extern void ip32_be_init(void);                                                
64 extern void __init ip32_timer_setup (struct irqaction *irq);                   
65 extern void __init crime_init (void);                                          
66
67
68 void __init ip32_setup(void)
69 {
70 #ifdef CONFIG_SERIAL_CONSOLE
71         char *ctype;
72 #endif
73         TLBMISS_HANDLER_SETUP ();
74
75         mips_io_port_base = UNCACHEDADDR(MACEPCI_HI_IO);;
76
77 #ifdef CONFIG_SERIAL_CONSOLE
78         ctype = ArcGetEnvironmentVariable("console");
79         if (*ctype == 'd') {
80                 if (ctype[1] == '2')
81                         console_setup ("ttyS1");
82                 else
83                         console_setup ("ttyS0");
84         }
85 #endif
86 #ifdef CONFIG_SGI_O2MACE_ETH
87         {
88                 char *mac=ArcGetEnvironmentVariable("eaddr");
89                 str2eaddr(o2meth_eaddr, mac);
90         }
91 #endif
92
93 #ifdef CONFIG_VT
94         conswitchp = &dummy_con;
95 #endif
96
97         rtc_ops = &ip32_rtc_ops;
98         board_be_init = ip32_be_init;
99         board_time_init = ip32_time_init;
100         board_timer_setup = ip32_timer_setup;
101
102         crime_init();
103 }