Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
[deliverable/linux.git] / arch / m68knommu / kernel / setup.c
1 /*
2 * linux/arch/m68knommu/kernel/setup.c
3 *
4 * Copyright (C) 1999-2007 Greg Ungerer (gerg@snapgear.com)
5 * Copyright (C) 1998,1999 D. Jeff Dionne <jeff@uClinux.org>
6 * Copyleft ()) 2000 James D. Schettine {james@telos-systems.com}
7 * Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com>
8 * Copyright (C) 1995 Hamish Macdonald
9 * Copyright (C) 2000 Lineo Inc. (www.lineo.com)
10 * Copyright (C) 2001 Lineo, Inc. <www.lineo.com>
11 *
12 * 68VZ328 Fixes/support Evan Stawnyczy <e@lineo.ca>
13 */
14
15 /*
16 * This file handles the architecture-dependent parts of system setup
17 */
18
19 #include <linux/kernel.h>
20 #include <linux/sched.h>
21 #include <linux/delay.h>
22 #include <linux/interrupt.h>
23 #include <linux/fb.h>
24 #include <linux/module.h>
25 #include <linux/console.h>
26 #include <linux/errno.h>
27 #include <linux/string.h>
28 #include <linux/bootmem.h>
29 #include <linux/seq_file.h>
30 #include <linux/init.h>
31
32 #include <asm/setup.h>
33 #include <asm/irq.h>
34 #include <asm/machdep.h>
35 #include <asm/pgtable.h>
36
37 unsigned long memory_start;
38 unsigned long memory_end;
39
40 EXPORT_SYMBOL(memory_start);
41 EXPORT_SYMBOL(memory_end);
42
43 char __initdata command_line[COMMAND_LINE_SIZE];
44
45 void (*mach_trap_init)(void);
46
47 /* machine dependent timer functions */
48 void (*mach_sched_init)(irq_handler_t handler);
49 void (*mach_tick)(void);
50 void (*mach_gettod)(int*, int*, int*, int*, int*, int*);
51 int (*mach_set_clock_mmss)(unsigned long);
52 unsigned long (*mach_gettimeoffset)(void);
53
54 /* machine dependent reboot functions */
55 void (*mach_reset)(void);
56 void (*mach_halt)(void);
57 void (*mach_power_off)(void);
58
59
60 #ifdef CONFIG_M68000
61 #define CPU "MC68000"
62 #endif
63 #ifdef CONFIG_M68328
64 #define CPU "MC68328"
65 #endif
66 #ifdef CONFIG_M68EZ328
67 #define CPU "MC68EZ328"
68 #endif
69 #ifdef CONFIG_M68VZ328
70 #define CPU "MC68VZ328"
71 #endif
72 #ifdef CONFIG_M68332
73 #define CPU "MC68332"
74 #endif
75 #ifdef CONFIG_M68360
76 #define CPU "MC68360"
77 #endif
78 #if defined(CONFIG_M5206)
79 #define CPU "COLDFIRE(m5206)"
80 #endif
81 #if defined(CONFIG_M5206e)
82 #define CPU "COLDFIRE(m5206e)"
83 #endif
84 #if defined(CONFIG_M520x)
85 #define CPU "COLDFIRE(m520x)"
86 #endif
87 #if defined(CONFIG_M523x)
88 #define CPU "COLDFIRE(m523x)"
89 #endif
90 #if defined(CONFIG_M5249)
91 #define CPU "COLDFIRE(m5249)"
92 #endif
93 #if defined(CONFIG_M5271)
94 #define CPU "COLDFIRE(m5270/5271)"
95 #endif
96 #if defined(CONFIG_M5272)
97 #define CPU "COLDFIRE(m5272)"
98 #endif
99 #if defined(CONFIG_M5275)
100 #define CPU "COLDFIRE(m5274/5275)"
101 #endif
102 #if defined(CONFIG_M528x)
103 #define CPU "COLDFIRE(m5280/5282)"
104 #endif
105 #if defined(CONFIG_M5307)
106 #define CPU "COLDFIRE(m5307)"
107 #endif
108 #if defined(CONFIG_M532x)
109 #define CPU "COLDFIRE(m532x)"
110 #endif
111 #if defined(CONFIG_M5407)
112 #define CPU "COLDFIRE(m5407)"
113 #endif
114 #ifndef CPU
115 #define CPU "UNKNOWN"
116 #endif
117
118 extern int _stext, _etext, _sdata, _edata, _sbss, _ebss, _end;
119 extern int _ramstart, _ramend;
120
121 void setup_arch(char **cmdline_p)
122 {
123 int bootmap_size;
124
125 memory_start = PAGE_ALIGN(_ramstart);
126 memory_end = _ramend;
127
128 init_mm.start_code = (unsigned long) &_stext;
129 init_mm.end_code = (unsigned long) &_etext;
130 init_mm.end_data = (unsigned long) &_edata;
131 init_mm.brk = (unsigned long) 0;
132
133 config_BSP(&command_line[0], sizeof(command_line));
134
135 printk(KERN_INFO "\x0F\r\n\nuClinux/" CPU "\n");
136
137 #ifdef CONFIG_UCDIMM
138 printk(KERN_INFO "uCdimm by Lineo, Inc. <www.lineo.com>\n");
139 #endif
140 #ifdef CONFIG_M68VZ328
141 printk(KERN_INFO "M68VZ328 support by Evan Stawnyczy <e@lineo.ca>\n");
142 #endif
143 #ifdef CONFIG_COLDFIRE
144 printk(KERN_INFO "COLDFIRE port done by Greg Ungerer, gerg@snapgear.com\n");
145 #ifdef CONFIG_M5307
146 printk(KERN_INFO "Modified for M5307 by Dave Miller, dmiller@intellistor.com\n");
147 #endif
148 #ifdef CONFIG_ELITE
149 printk(KERN_INFO "Modified for M5206eLITE by Rob Scott, rscott@mtrob.fdns.net\n");
150 #endif
151 #ifdef CONFIG_TELOS
152 printk(KERN_INFO "Modified for Omnia ToolVox by James D. Schettine, james@telos-systems.com\n");
153 #endif
154 #endif
155 printk(KERN_INFO "Flat model support (C) 1998,1999 Kenneth Albanowski, D. Jeff Dionne\n");
156
157 #if defined( CONFIG_PILOT ) && defined( CONFIG_M68328 )
158 printk(KERN_INFO "TRG SuperPilot FLASH card support <info@trgnet.com>\n");
159 #endif
160
161 #if defined( CONFIG_PILOT ) && defined( CONFIG_M68EZ328 )
162 printk(KERN_INFO "PalmV support by Lineo Inc. <jeff@uclinux.com>\n");
163 #endif
164
165 #ifdef CONFIG_M68EZ328ADS
166 printk(KERN_INFO "M68EZ328ADS board support (C) 1999 Vladimir Gurevich <vgurevic@cisco.com>\n");
167 #endif
168
169 #ifdef CONFIG_ALMA_ANS
170 printk(KERN_INFO "Alma Electronics board support (C) 1999 Vladimir Gurevich <vgurevic@cisco.com>\n");
171 #endif
172 #if defined (CONFIG_M68360)
173 printk(KERN_INFO "QUICC port done by SED Systems <hamilton@sedsystems.ca>,\n");
174 printk(KERN_INFO "based on 2.0.38 port by Lineo Inc. <mleslie@lineo.com>.\n");
175 #endif
176 #ifdef CONFIG_DRAGEN2
177 printk(KERN_INFO "DragonEngine II board support by Georges Menie\n");
178 #endif
179 #ifdef CONFIG_M5235EVB
180 printk(KERN_INFO "Motorola M5235EVB support (C)2005 Syn-tech Systems, Inc. (Jate Sujjavanich)");
181 #endif
182
183 #ifdef DEBUG
184 printk(KERN_DEBUG "KERNEL -> TEXT=0x%06x-0x%06x DATA=0x%06x-0x%06x "
185 "BSS=0x%06x-0x%06x\n", (int) &_stext, (int) &_etext,
186 (int) &_sdata, (int) &_edata,
187 (int) &_sbss, (int) &_ebss);
188 printk(KERN_DEBUG "KERNEL -> ROMFS=0x%06x-0x%06x MEM=0x%06x-0x%06x "
189 "STACK=0x%06x-0x%06x\n",
190 (int) &_ebss, (int) memory_start,
191 (int) memory_start, (int) memory_end,
192 (int) memory_end, (int) _ramend);
193 #endif
194
195 /* Keep a copy of command line */
196 *cmdline_p = &command_line[0];
197 memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
198 boot_command_line[COMMAND_LINE_SIZE-1] = 0;
199
200 #ifdef DEBUG
201 if (strlen(*cmdline_p))
202 printk(KERN_DEBUG "Command line: '%s'\n", *cmdline_p);
203 #endif
204
205 #if defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_DUMMY_CONSOLE)
206 conswitchp = &dummy_con;
207 #endif
208
209 /*
210 * Give all the memory to the bootmap allocator, tell it to put the
211 * boot mem_map at the start of memory.
212 */
213 bootmap_size = init_bootmem_node(
214 NODE_DATA(0),
215 memory_start >> PAGE_SHIFT, /* map goes here */
216 PAGE_OFFSET >> PAGE_SHIFT, /* 0 on coldfire */
217 memory_end >> PAGE_SHIFT);
218 /*
219 * Free the usable memory, we have to make sure we do not free
220 * the bootmem bitmap so we then reserve it after freeing it :-)
221 */
222 free_bootmem(memory_start, memory_end - memory_start);
223 reserve_bootmem(memory_start, bootmap_size);
224
225 /*
226 * Get kmalloc into gear.
227 */
228 paging_init();
229 }
230
231 /*
232 * Get CPU information for use by the procfs.
233 */
234 static int show_cpuinfo(struct seq_file *m, void *v)
235 {
236 char *cpu, *mmu, *fpu;
237 u_long clockfreq;
238
239 cpu = CPU;
240 mmu = "none";
241 fpu = "none";
242
243 #ifdef CONFIG_COLDFIRE
244 clockfreq = (loops_per_jiffy * HZ) * 3;
245 #else
246 clockfreq = (loops_per_jiffy * HZ) * 16;
247 #endif
248
249 seq_printf(m, "CPU:\t\t%s\n"
250 "MMU:\t\t%s\n"
251 "FPU:\t\t%s\n"
252 "Clocking:\t%lu.%1luMHz\n"
253 "BogoMips:\t%lu.%02lu\n"
254 "Calibration:\t%lu loops\n",
255 cpu, mmu, fpu,
256 clockfreq / 1000000,
257 (clockfreq / 100000) % 10,
258 (loops_per_jiffy * HZ) / 500000,
259 ((loops_per_jiffy * HZ) / 5000) % 100,
260 (loops_per_jiffy * HZ));
261
262 return 0;
263 }
264
265 static void *c_start(struct seq_file *m, loff_t *pos)
266 {
267 return *pos < NR_CPUS ? ((void *) 0x12345678) : NULL;
268 }
269
270 static void *c_next(struct seq_file *m, void *v, loff_t *pos)
271 {
272 ++*pos;
273 return c_start(m, pos);
274 }
275
276 static void c_stop(struct seq_file *m, void *v)
277 {
278 }
279
280 struct seq_operations cpuinfo_op = {
281 .start = c_start,
282 .next = c_next,
283 .stop = c_stop,
284 .show = show_cpuinfo,
285 };
286
287 void arch_gettod(int *year, int *mon, int *day, int *hour,
288 int *min, int *sec)
289 {
290 if (mach_gettod)
291 mach_gettod(year, mon, day, hour, min, sec);
292 else
293 *year = *mon = *day = *hour = *min = *sec = 0;
294 }
295
This page took 0.170273 seconds and 6 git commands to generate.