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