Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
[sfrench/cifs-2.6.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 /* machine dependent timer functions */
46 void (*mach_sched_init)(irq_handler_t handler);
47 void (*mach_tick)(void);
48 void (*mach_gettod)(int*, int*, int*, int*, int*, int*);
49 int (*mach_set_clock_mmss)(unsigned long);
50 unsigned long (*mach_gettimeoffset)(void);
51
52 /* machine dependent reboot functions */
53 void (*mach_reset)(void);
54 void (*mach_halt)(void);
55 void (*mach_power_off)(void);
56
57
58 #ifdef CONFIG_M68000
59         #define CPU "MC68000"
60 #endif
61 #ifdef CONFIG_M68328
62         #define CPU "MC68328"
63 #endif
64 #ifdef CONFIG_M68EZ328
65         #define CPU "MC68EZ328"
66 #endif
67 #ifdef CONFIG_M68VZ328
68         #define CPU "MC68VZ328"
69 #endif
70 #ifdef CONFIG_M68332
71         #define CPU "MC68332"
72 #endif
73 #ifdef CONFIG_M68360
74         #define CPU "MC68360"
75 #endif
76 #if defined(CONFIG_M5206)
77         #define CPU "COLDFIRE(m5206)"
78 #endif
79 #if defined(CONFIG_M5206e)
80         #define CPU "COLDFIRE(m5206e)"
81 #endif
82 #if defined(CONFIG_M520x)
83         #define CPU "COLDFIRE(m520x)"
84 #endif
85 #if defined(CONFIG_M523x)
86         #define CPU "COLDFIRE(m523x)"
87 #endif
88 #if defined(CONFIG_M5249)
89         #define CPU "COLDFIRE(m5249)"
90 #endif
91 #if defined(CONFIG_M5271)
92         #define CPU "COLDFIRE(m5270/5271)"
93 #endif
94 #if defined(CONFIG_M5272)
95         #define CPU "COLDFIRE(m5272)"
96 #endif
97 #if defined(CONFIG_M5275)
98         #define CPU "COLDFIRE(m5274/5275)"
99 #endif
100 #if defined(CONFIG_M528x)
101         #define CPU "COLDFIRE(m5280/5282)"
102 #endif
103 #if defined(CONFIG_M5307)
104         #define CPU "COLDFIRE(m5307)"
105 #endif
106 #if defined(CONFIG_M532x)
107         #define CPU "COLDFIRE(m532x)"
108 #endif
109 #if defined(CONFIG_M5407)
110         #define CPU "COLDFIRE(m5407)"
111 #endif
112 #ifndef CPU
113         #define CPU "UNKNOWN"
114 #endif
115
116 extern int _stext, _etext, _sdata, _edata, _sbss, _ebss, _end;
117 extern int _ramstart, _ramend;
118
119 void setup_arch(char **cmdline_p)
120 {
121         int bootmap_size;
122
123         memory_start = PAGE_ALIGN(_ramstart);
124         memory_end = _ramend;
125
126         init_mm.start_code = (unsigned long) &_stext;
127         init_mm.end_code = (unsigned long) &_etext;
128         init_mm.end_data = (unsigned long) &_edata;
129         init_mm.brk = (unsigned long) 0;
130
131         config_BSP(&command_line[0], sizeof(command_line));
132
133 #if defined(CONFIG_BOOTPARAM)
134         strncpy(&command_line[0], CONFIG_BOOTPARAM_STRING, sizeof(command_line));
135         command_line[sizeof(command_line) - 1] = 0;
136 #endif
137
138         printk(KERN_INFO "\x0F\r\n\nuClinux/" CPU "\n");
139
140 #ifdef CONFIG_UCDIMM
141         printk(KERN_INFO "uCdimm by Lineo, Inc. <www.lineo.com>\n");
142 #endif
143 #ifdef CONFIG_M68VZ328
144         printk(KERN_INFO "M68VZ328 support by Evan Stawnyczy <e@lineo.ca>\n");
145 #endif
146 #ifdef CONFIG_COLDFIRE
147         printk(KERN_INFO "COLDFIRE port done by Greg Ungerer, gerg@snapgear.com\n");
148 #ifdef CONFIG_M5307
149         printk(KERN_INFO "Modified for M5307 by Dave Miller, dmiller@intellistor.com\n");
150 #endif
151 #ifdef CONFIG_ELITE
152         printk(KERN_INFO "Modified for M5206eLITE by Rob Scott, rscott@mtrob.fdns.net\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 #if defined( CONFIG_PILOT ) && defined( CONFIG_M68EZ328 )
161         printk(KERN_INFO "PalmV support by Lineo Inc. <jeff@uclinux.com>\n");
162 #endif
163 #if defined (CONFIG_M68360)
164         printk(KERN_INFO "QUICC port done by SED Systems <hamilton@sedsystems.ca>,\n");
165         printk(KERN_INFO "based on 2.0.38 port by Lineo Inc. <mleslie@lineo.com>.\n");
166 #endif
167 #ifdef CONFIG_DRAGEN2
168         printk(KERN_INFO "DragonEngine II board support by Georges Menie\n");
169 #endif
170 #ifdef CONFIG_M5235EVB
171         printk(KERN_INFO "Motorola M5235EVB support (C)2005 Syn-tech Systems, Inc. (Jate Sujjavanich)");
172 #endif
173
174 #ifdef DEBUG
175         printk(KERN_DEBUG "KERNEL -> TEXT=0x%06x-0x%06x DATA=0x%06x-0x%06x "
176                 "BSS=0x%06x-0x%06x\n", (int) &_stext, (int) &_etext,
177                 (int) &_sdata, (int) &_edata,
178                 (int) &_sbss, (int) &_ebss);
179         printk(KERN_DEBUG "MEMORY -> ROMFS=0x%06x-0x%06x MEM=0x%06x-0x%06x\n ",
180                 (int) &_ebss, (int) memory_start,
181                 (int) memory_start, (int) memory_end);
182 #endif
183
184         /* Keep a copy of command line */
185         *cmdline_p = &command_line[0];
186         memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
187         boot_command_line[COMMAND_LINE_SIZE-1] = 0;
188
189 #ifdef DEBUG
190         if (strlen(*cmdline_p))
191                 printk(KERN_DEBUG "Command line: '%s'\n", *cmdline_p);
192 #endif
193
194 #if defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_DUMMY_CONSOLE)
195         conswitchp = &dummy_con;
196 #endif
197
198         /*
199          * Give all the memory to the bootmap allocator, tell it to put the
200          * boot mem_map at the start of memory.
201          */
202         bootmap_size = init_bootmem_node(
203                         NODE_DATA(0),
204                         memory_start >> PAGE_SHIFT, /* map goes here */
205                         PAGE_OFFSET >> PAGE_SHIFT,      /* 0 on coldfire */
206                         memory_end >> PAGE_SHIFT);
207         /*
208          * Free the usable memory, we have to make sure we do not free
209          * the bootmem bitmap so we then reserve it after freeing it :-)
210          */
211         free_bootmem(memory_start, memory_end - memory_start);
212         reserve_bootmem(memory_start, bootmap_size);
213
214         /*
215          * Get kmalloc into gear.
216          */
217         paging_init();
218 }
219
220 /*
221  *      Get CPU information for use by the procfs.
222  */
223 static int show_cpuinfo(struct seq_file *m, void *v)
224 {
225         char *cpu, *mmu, *fpu;
226         u_long clockfreq;
227
228         cpu = CPU;
229         mmu = "none";
230         fpu = "none";
231
232 #ifdef CONFIG_COLDFIRE
233         clockfreq = (loops_per_jiffy * HZ) * 3;
234 #else
235         clockfreq = (loops_per_jiffy * HZ) * 16;
236 #endif
237
238         seq_printf(m, "CPU:\t\t%s\n"
239                       "MMU:\t\t%s\n"
240                       "FPU:\t\t%s\n"
241                       "Clocking:\t%lu.%1luMHz\n"
242                       "BogoMips:\t%lu.%02lu\n"
243                       "Calibration:\t%lu loops\n",
244                       cpu, mmu, fpu,
245                       clockfreq / 1000000,
246                       (clockfreq / 100000) % 10,
247                       (loops_per_jiffy * HZ) / 500000,
248                       ((loops_per_jiffy * HZ) / 5000) % 100,
249                       (loops_per_jiffy * HZ));
250
251         return 0;
252 }
253
254 static void *c_start(struct seq_file *m, loff_t *pos)
255 {
256         return *pos < NR_CPUS ? ((void *) 0x12345678) : NULL;
257 }
258
259 static void *c_next(struct seq_file *m, void *v, loff_t *pos)
260 {
261         ++*pos;
262         return c_start(m, pos);
263 }
264
265 static void c_stop(struct seq_file *m, void *v)
266 {
267 }
268
269 struct seq_operations cpuinfo_op = {
270         .start  = c_start,
271         .next   = c_next,
272         .stop   = c_stop,
273         .show   = show_cpuinfo,
274 };
275