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