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