1 |
1625 |
jcastillo |
/*
|
2 |
|
|
* linux/arch/m68knommu/kernel/setup.c
|
3 |
|
|
*
|
4 |
|
|
* Copyleft ()) 2000 James D. Schettine {james@telos-systems.com}
|
5 |
|
|
* Copyright (C) 1999 Greg Ungerer (gerg@moreton.com.au)
|
6 |
|
|
* Copyright (C) 1998,1999 D. Jeff Dionne <jeff@rt-control.com>
|
7 |
|
|
* Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com>
|
8 |
|
|
* Copyright (C) 1995 Hamish Macdonald
|
9 |
|
|
*/
|
10 |
|
|
|
11 |
|
|
/*
|
12 |
|
|
* This file handles the architecture-dependent parts of system setup
|
13 |
|
|
*/
|
14 |
|
|
|
15 |
|
|
#include <linux/config.h>
|
16 |
|
|
#include <linux/kernel.h>
|
17 |
|
|
#include <linux/sched.h>
|
18 |
|
|
#include <linux/delay.h>
|
19 |
|
|
#include <linux/interrupt.h>
|
20 |
|
|
#include <linux/fs.h>
|
21 |
|
|
#include <linux/fb.h>
|
22 |
|
|
#include <linux/console.h>
|
23 |
|
|
#include <linux/genhd.h>
|
24 |
|
|
#include <linux/errno.h>
|
25 |
|
|
#include <linux/string.h>
|
26 |
|
|
#include <linux/major.h>
|
27 |
|
|
|
28 |
|
|
#include <asm/setup.h>
|
29 |
|
|
#include <asm/irq.h>
|
30 |
|
|
#include <asm/machdep.h>
|
31 |
|
|
|
32 |
|
|
#ifdef CONFIG_BLK_DEV_INITRD
|
33 |
|
|
#include <linux/blk.h>
|
34 |
|
|
#include <asm/pgtable.h>
|
35 |
|
|
#endif
|
36 |
|
|
|
37 |
|
|
extern void register_console(void (*proc)(const char *));
|
38 |
|
|
/* conswitchp = &fb_con;*/
|
39 |
|
|
#ifdef CONFIG_CONSOLE
|
40 |
|
|
extern struct consw *conswitchp;
|
41 |
|
|
#ifdef CONFIG_FRAMEBUFFER
|
42 |
|
|
extern struct consw fb_con;
|
43 |
|
|
#endif
|
44 |
|
|
#endif
|
45 |
|
|
|
46 |
|
|
unsigned long rom_length;
|
47 |
|
|
unsigned long memory_start;
|
48 |
|
|
unsigned long memory_end;
|
49 |
|
|
|
50 |
|
|
char command_line[512];
|
51 |
|
|
char saved_command_line[512];
|
52 |
|
|
char console_device[16];
|
53 |
|
|
|
54 |
|
|
char console_default[] = "CONSOLE=/dev/ttyS0";
|
55 |
|
|
|
56 |
|
|
/* setup some dummy routines */
|
57 |
|
|
static void dummy_waitbut(void)
|
58 |
|
|
{
|
59 |
|
|
}
|
60 |
|
|
|
61 |
|
|
void (*mach_sched_init) (void (*handler)(int, void *, struct pt_regs *)) = NULL;
|
62 |
|
|
void (*mach_tick)( void ) = NULL;
|
63 |
|
|
/* machine dependent keyboard functions */
|
64 |
|
|
int (*mach_keyb_init) (void) = NULL;
|
65 |
|
|
int (*mach_kbdrate) (struct kbd_repeat *) = NULL;
|
66 |
|
|
void (*mach_kbd_leds) (unsigned int) = NULL;
|
67 |
|
|
/* machine dependent irq functions */
|
68 |
|
|
void (*mach_init_IRQ) (void) = NULL;
|
69 |
|
|
void (*(*mach_default_handler)[]) (int, void *, struct pt_regs *) = NULL;
|
70 |
|
|
int (*mach_request_irq) (unsigned int, void (*)(int, void *, struct pt_regs *),
|
71 |
|
|
unsigned long, const char *, void *);
|
72 |
|
|
int (*mach_free_irq) (unsigned int, void *);
|
73 |
|
|
void (*mach_enable_irq) (unsigned int) = NULL;
|
74 |
|
|
void (*mach_disable_irq) (unsigned int) = NULL;
|
75 |
|
|
int (*mach_get_irq_list) (char *) = NULL;
|
76 |
|
|
int (*mach_process_int) (int, struct pt_regs *) = NULL;
|
77 |
|
|
void (*mach_trap_init) (void);
|
78 |
|
|
/* machine dependent timer functions */
|
79 |
|
|
unsigned long (*mach_gettimeoffset) (void) = NULL;
|
80 |
|
|
void (*mach_gettod) (int*, int*, int*, int*, int*, int*) = NULL;
|
81 |
|
|
int (*mach_hwclk) (int, struct hwclk_time*) = NULL;
|
82 |
|
|
int (*mach_set_clock_mmss) (unsigned long) = NULL;
|
83 |
|
|
void (*mach_mksound)( unsigned int count, unsigned int ticks ) = NULL;
|
84 |
|
|
void (*mach_reset)( void ) = NULL;
|
85 |
|
|
void (*waitbut)(void) = dummy_waitbut;
|
86 |
|
|
void (*mach_debug_init)(void) = NULL;
|
87 |
|
|
|
88 |
|
|
|
89 |
|
|
#ifdef CONFIG_M68000
|
90 |
|
|
#define CPU "MC68000"
|
91 |
|
|
#endif
|
92 |
|
|
#ifdef CONFIG_M68328
|
93 |
|
|
#define CPU "MC68328"
|
94 |
|
|
#endif
|
95 |
|
|
#ifdef CONFIG_M68EZ328
|
96 |
|
|
#define CPU "MC68EZ328"
|
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_M5307)
|
111 |
|
|
#define CPU "COLDFIRE(m5307)"
|
112 |
|
|
#endif
|
113 |
|
|
#ifndef CPU
|
114 |
|
|
#define CPU "UNKOWN"
|
115 |
|
|
#endif
|
116 |
|
|
|
117 |
|
|
|
118 |
|
|
/*
|
119 |
|
|
* Setup the console. There may be a console defined in
|
120 |
|
|
* the command line arguments, so we look there first. If the
|
121 |
|
|
* command line arguments don't exist then we default to the
|
122 |
|
|
* first serial port. If we are going to use a console then
|
123 |
|
|
* setup its device name and the UART for it.
|
124 |
|
|
*/
|
125 |
|
|
void setup_console(void)
|
126 |
|
|
{
|
127 |
|
|
#ifdef CONFIG_COLDFIRE
|
128 |
|
|
/* This is a great idea.... Until we get support for it across all
|
129 |
|
|
supported m68k platforms, we limit it to ColdFire... DJD */
|
130 |
|
|
char *sp, *cp;
|
131 |
|
|
int i;
|
132 |
|
|
extern void rs_console_init(void);
|
133 |
|
|
extern void rs_console_print(const char *b);
|
134 |
|
|
extern int rs_console_setup(char *arg);
|
135 |
|
|
|
136 |
|
|
/* Quickly check if any command line arguments for CONSOLE. */
|
137 |
|
|
for (sp = NULL, i = 0; (i < sizeof(command_line)-8); i++) {
|
138 |
|
|
if (command_line[i] == 0)
|
139 |
|
|
break;
|
140 |
|
|
if (command_line[i] == 'C') {
|
141 |
|
|
if (!strncmp(&command_line[i], "CONSOLE=", 8)) {
|
142 |
|
|
sp = &command_line[i + 8];
|
143 |
|
|
break;
|
144 |
|
|
}
|
145 |
|
|
}
|
146 |
|
|
}
|
147 |
|
|
|
148 |
|
|
/* If no CONSOLE defined then default one */
|
149 |
|
|
if (sp == NULL) {
|
150 |
|
|
strcpy(command_line, console_default);
|
151 |
|
|
sp = command_line + 8;
|
152 |
|
|
}
|
153 |
|
|
|
154 |
|
|
/* If console specified then copy it into name buffer */
|
155 |
|
|
for (cp = sp, i = 0; (i < (sizeof(console_device) - 1)); i++) {
|
156 |
|
|
if ((*sp == 0) || (*sp == ' ') || (*sp == ','))
|
157 |
|
|
break;
|
158 |
|
|
console_device[i] = *sp++;
|
159 |
|
|
}
|
160 |
|
|
console_device[i] = 0;
|
161 |
|
|
|
162 |
|
|
/* If a serial console then init it */
|
163 |
|
|
if (rs_console_setup(cp)) {
|
164 |
|
|
rs_console_init();
|
165 |
|
|
register_console(rs_console_print);
|
166 |
|
|
}
|
167 |
|
|
#endif /* CONFIG_COLDFIRE */
|
168 |
|
|
}
|
169 |
|
|
|
170 |
|
|
#if defined( CONFIG_TELOS) || defined( CONFIG_UCSIMM ) || (defined( CONFIG_PILOT ) && defined( CONFIG_M68328 ))
|
171 |
|
|
#define CAT_ROMARRAY
|
172 |
|
|
#endif
|
173 |
|
|
|
174 |
|
|
void setup_arch(char **cmdline_p,
|
175 |
|
|
unsigned long * memory_start_p, unsigned long * memory_end_p)
|
176 |
|
|
{
|
177 |
|
|
extern int _stext, _etext;
|
178 |
|
|
extern int _sdata, _edata;
|
179 |
|
|
extern int _sbss, _ebss, _end;
|
180 |
|
|
extern int _ramstart, _ramend;
|
181 |
|
|
|
182 |
|
|
#ifdef CAT_ROMARRAY
|
183 |
|
|
extern int __data_rom_start;
|
184 |
|
|
extern int __data_start;
|
185 |
|
|
int *romarray = (int *)((int) &__data_rom_start +
|
186 |
|
|
(int)&_edata - (int)&__data_start);
|
187 |
|
|
#endif
|
188 |
|
|
|
189 |
|
|
#ifdef CONFIG_COLDFIRE
|
190 |
|
|
memory_start = &_ramstart;
|
191 |
|
|
#else
|
192 |
|
|
memory_start = &_end;
|
193 |
|
|
#endif /* CONFIG_COLDFIRE */
|
194 |
|
|
memory_end = &_ramend - 4096; /* <- stack area */
|
195 |
|
|
|
196 |
|
|
config_BSP(&command_line[0], sizeof(command_line));
|
197 |
|
|
|
198 |
|
|
setup_console();
|
199 |
|
|
printk("\x0F\r\n\nuClinux/" CPU "\n");
|
200 |
|
|
#ifdef CONFIG_COLDFIRE
|
201 |
|
|
printk("COLDFIRE port done by Greg Ungerer, gerg@moreton.com.au\n");
|
202 |
|
|
#ifdef CONFIG_M5307
|
203 |
|
|
printk("Modified for M5307 by Dave Miller, dmiller@intellistor.com\n");
|
204 |
|
|
#endif
|
205 |
|
|
#ifdef CONFIG_ELITE
|
206 |
|
|
printk("Modified for M5206eLITE by Rob Scott, rscott@mtrob.fdns.net\n");
|
207 |
|
|
#endif
|
208 |
|
|
#ifdef CONFIG_TELOS
|
209 |
|
|
printk("Modified for Omnia ToolVox by James D. Schettine, james@telos-systems.com\n");
|
210 |
|
|
#endif
|
211 |
|
|
#endif
|
212 |
|
|
printk("Flat model support (C) 1998,1999 Kenneth Albanowski, D. Jeff Dionne\n");
|
213 |
|
|
|
214 |
|
|
#if defined( CONFIG_PILOT ) && defined( CONFIG_M68328 )
|
215 |
|
|
printk("TRG SuperPilot FLASH card support <info@trgnet.com>\n");
|
216 |
|
|
#endif
|
217 |
|
|
|
218 |
|
|
#if defined( CONFIG_PILOT ) && defined( CONFIG_M68EZ328 )
|
219 |
|
|
printk("PalmV support by Lineo Inc. <jeff@uClinux.com>\n");
|
220 |
|
|
#endif
|
221 |
|
|
|
222 |
|
|
#ifdef CONFIG_M68EZ328ADS
|
223 |
|
|
printk("M68EZ328ADS board support (C) 1999 Vladimir Gurevich <vgurevic@cisco.com>\n");
|
224 |
|
|
#endif
|
225 |
|
|
|
226 |
|
|
#ifdef CONFIG_ALMA_ANS
|
227 |
|
|
printk("Alma Electronics board support (C) 1999 Vladimir Gurevich <vgurevic@cisco.com>\n");
|
228 |
|
|
#endif
|
229 |
|
|
|
230 |
|
|
#ifdef DEBUG
|
231 |
|
|
printk("KERNEL -> TEXT=0x%06x-0x%06x DATA=0x%06x-0x%06x "
|
232 |
|
|
"BSS=0x%06x-0x%06x\n", (int) &_stext, (int) &_etext,
|
233 |
|
|
(int) &_sdata, (int) &_edata,
|
234 |
|
|
(int) &_sbss, (int) &_ebss);
|
235 |
|
|
printk("KERNEL -> ROMFS=0x%06x-0x%06x MEM=0x%06x-0x%06x "
|
236 |
|
|
"STACK=0x%06x-0x%06x\n",
|
237 |
|
|
#ifdef CAT_ROMARRAY
|
238 |
|
|
(int) romarray, ((int) romarray) + romarray[2],
|
239 |
|
|
#else
|
240 |
|
|
(int) &_ebss, (int) memory_start,
|
241 |
|
|
#endif
|
242 |
|
|
(int) memory_start, (int) memory_end,
|
243 |
|
|
(int) memory_end, (int) &_ramend);
|
244 |
|
|
#endif
|
245 |
|
|
|
246 |
|
|
init_task.mm->start_code = (unsigned long) &_stext;
|
247 |
|
|
init_task.mm->end_code = (unsigned long) &_etext;
|
248 |
|
|
init_task.mm->end_data = (unsigned long) &_edata;
|
249 |
|
|
init_task.mm->brk = (unsigned long) &_end;
|
250 |
|
|
|
251 |
|
|
ROOT_DEV = MKDEV(BLKMEM_MAJOR,0);
|
252 |
|
|
|
253 |
|
|
/* Keep a copy of command line */
|
254 |
|
|
*cmdline_p = &command_line[0];
|
255 |
|
|
|
256 |
|
|
memcpy(saved_command_line, command_line, sizeof(saved_command_line));
|
257 |
|
|
saved_command_line[sizeof(saved_command_line)-1] = 0;
|
258 |
|
|
|
259 |
|
|
#ifdef DEBUG
|
260 |
|
|
if (strlen(*cmdline_p))
|
261 |
|
|
printk("Command line: '%s'\n", *cmdline_p);
|
262 |
|
|
else
|
263 |
|
|
printk("No Command line passed\n");
|
264 |
|
|
#endif
|
265 |
|
|
*memory_start_p = memory_start;
|
266 |
|
|
*memory_end_p = memory_end;
|
267 |
|
|
/*rom_length = (unsigned long)&_flashend - (unsigned long)&_romvec;*/
|
268 |
|
|
|
269 |
|
|
#ifdef CONFIG_CONSOLE
|
270 |
|
|
#ifdef CONFIG_FRAMEBUFFER
|
271 |
|
|
conswitchp = &fb_con;
|
272 |
|
|
#else
|
273 |
|
|
conswitchp = 0;
|
274 |
|
|
#endif
|
275 |
|
|
#endif
|
276 |
|
|
|
277 |
|
|
#ifdef DEBUG
|
278 |
|
|
printk("Done setup_arch\n");
|
279 |
|
|
#endif
|
280 |
|
|
|
281 |
|
|
}
|
282 |
|
|
|
283 |
|
|
int get_cpuinfo(char * buffer)
|
284 |
|
|
{
|
285 |
|
|
char *cpu, *mmu, *fpu;
|
286 |
|
|
u_long clockfreq, clockfactor;
|
287 |
|
|
|
288 |
|
|
cpu = CPU;
|
289 |
|
|
mmu = "none";
|
290 |
|
|
fpu = "none";
|
291 |
|
|
#ifdef CONFIG_COLDFIRE
|
292 |
|
|
clockfactor = 3;
|
293 |
|
|
#else
|
294 |
|
|
clockfactor = 16;
|
295 |
|
|
#endif
|
296 |
|
|
|
297 |
|
|
clockfreq = loops_per_sec*clockfactor;
|
298 |
|
|
|
299 |
|
|
return(sprintf(buffer, "CPU:\t\t%s\n"
|
300 |
|
|
"MMU:\t\t%s\n"
|
301 |
|
|
"FPU:\t\t%s\n"
|
302 |
|
|
"Clocking:\t%lu.%1luMHz\n"
|
303 |
|
|
"BogoMips:\t%lu.%02lu\n"
|
304 |
|
|
"Calibration:\t%lu loops\n",
|
305 |
|
|
cpu, mmu, fpu,
|
306 |
|
|
clockfreq/1000000,(clockfreq/100000)%10,
|
307 |
|
|
loops_per_sec/500000,(loops_per_sec/5000)%100,
|
308 |
|
|
loops_per_sec));
|
309 |
|
|
|
310 |
|
|
}
|
311 |
|
|
|
312 |
|
|
void arch_gettod(int *year, int *mon, int *day, int *hour,
|
313 |
|
|
int *min, int *sec)
|
314 |
|
|
{
|
315 |
|
|
if (mach_gettod)
|
316 |
|
|
mach_gettod(year, mon, day, hour, min, sec);
|
317 |
|
|
else
|
318 |
|
|
*year = *mon = *day = *hour = *min = *sec = 0;
|
319 |
|
|
}
|
320 |
|
|
|