blob: 5985f198902113d6ce971e975983fa09019db051 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/arch/m68knommu/kernel/setup.c
3 *
Greg Ungerer2f75d102007-07-15 23:38:33 -07004 * Copyright (C) 1999-2007 Greg Ungerer (gerg@snapgear.com)
5 * Copyright (C) 1998,1999 D. Jeff Dionne <jeff@uClinux.org>
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 * Copyleft ()) 2000 James D. Schettine {james@telos-systems.com}
7 * Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com>
8 * Copyright (C) 1995 Hamish Macdonald
Greg Ungerere6070a12005-09-02 10:42:52 +10009 * Copyright (C) 2000 Lineo Inc. (www.lineo.com)
Linus Torvalds1da177e2005-04-16 15:20:36 -070010 * 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
Linus Torvalds1da177e2005-04-16 15:20:36 -070019#include <linux/kernel.h>
20#include <linux/sched.h>
21#include <linux/delay.h>
22#include <linux/interrupt.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#include <linux/fb.h>
Greg Ungerere6070a12005-09-02 10:42:52 +100024#include <linux/module.h>
Andrea Righi27ac7922008-07-23 21:28:13 -070025#include <linux/mm.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070026#include <linux/console.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070027#include <linux/errno.h>
28#include <linux/string.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070029#include <linux/bootmem.h>
30#include <linux/seq_file.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#include <linux/init.h>
32
33#include <asm/setup.h>
34#include <asm/irq.h>
35#include <asm/machdep.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070036#include <asm/pgtable.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070037
Linus Torvalds1da177e2005-04-16 15:20:36 -070038unsigned long memory_start;
39unsigned long memory_end;
40
Greg Ungerere6070a12005-09-02 10:42:52 +100041EXPORT_SYMBOL(memory_start);
42EXPORT_SYMBOL(memory_end);
43
Alon Bar-Levf2a09e12007-02-12 00:54:14 -080044char __initdata command_line[COMMAND_LINE_SIZE];
Linus Torvalds1da177e2005-04-16 15:20:36 -070045
Linus Torvalds1da177e2005-04-16 15:20:36 -070046/* machine dependent timer functions */
Greg Ungerer2f75d102007-07-15 23:38:33 -070047void (*mach_gettod)(int*, int*, int*, int*, int*, int*);
48int (*mach_set_clock_mmss)(unsigned long);
Greg Ungerer2f75d102007-07-15 23:38:33 -070049
50/* machine dependent reboot functions */
51void (*mach_reset)(void);
52void (*mach_halt)(void);
53void (*mach_power_off)(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
55
56#ifdef CONFIG_M68000
57 #define CPU "MC68000"
58#endif
59#ifdef CONFIG_M68328
60 #define CPU "MC68328"
61#endif
62#ifdef CONFIG_M68EZ328
63 #define CPU "MC68EZ328"
64#endif
65#ifdef CONFIG_M68VZ328
66 #define CPU "MC68VZ328"
67#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070068#ifdef CONFIG_M68360
69 #define CPU "MC68360"
70#endif
71#if defined(CONFIG_M5206)
72 #define CPU "COLDFIRE(m5206)"
73#endif
74#if defined(CONFIG_M5206e)
75 #define CPU "COLDFIRE(m5206e)"
76#endif
Greg Ungerer54b03d12005-11-07 14:09:50 +100077#if defined(CONFIG_M520x)
78 #define CPU "COLDFIRE(m520x)"
79#endif
Greg Ungerere6070a12005-09-02 10:42:52 +100080#if defined(CONFIG_M523x)
81 #define CPU "COLDFIRE(m523x)"
82#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070083#if defined(CONFIG_M5249)
84 #define CPU "COLDFIRE(m5249)"
85#endif
Greg Ungerere6070a12005-09-02 10:42:52 +100086#if defined(CONFIG_M5271)
87 #define CPU "COLDFIRE(m5270/5271)"
Linus Torvalds1da177e2005-04-16 15:20:36 -070088#endif
89#if defined(CONFIG_M5272)
90 #define CPU "COLDFIRE(m5272)"
91#endif
Greg Ungerere6070a12005-09-02 10:42:52 +100092#if defined(CONFIG_M5275)
93 #define CPU "COLDFIRE(m5274/5275)"
94#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070095#if defined(CONFIG_M528x)
96 #define CPU "COLDFIRE(m5280/5282)"
97#endif
98#if defined(CONFIG_M5307)
99 #define CPU "COLDFIRE(m5307)"
100#endif
Greg Ungerer7877d012006-06-26 10:33:10 +1000101#if defined(CONFIG_M532x)
102 #define CPU "COLDFIRE(m532x)"
103#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104#if defined(CONFIG_M5407)
105 #define CPU "COLDFIRE(m5407)"
106#endif
107#ifndef CPU
Greg Ungerer54b03d12005-11-07 14:09:50 +1000108 #define CPU "UNKNOWN"
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109#endif
110
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111extern int _stext, _etext, _sdata, _edata, _sbss, _ebss, _end;
112extern int _ramstart, _ramend;
113
Greg Ungerer1d2842e2007-10-24 12:03:41 +1000114void __init setup_arch(char **cmdline_p)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115{
116 int bootmap_size;
117
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118 memory_start = PAGE_ALIGN(_ramstart);
Greg Ungerer2f75d102007-07-15 23:38:33 -0700119 memory_end = _ramend;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120
121 init_mm.start_code = (unsigned long) &_stext;
122 init_mm.end_code = (unsigned long) &_etext;
123 init_mm.end_data = (unsigned long) &_edata;
Greg Ungerere6070a12005-09-02 10:42:52 +1000124 init_mm.brk = (unsigned long) 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125
126 config_BSP(&command_line[0], sizeof(command_line));
127
Greg Ungererbc724502007-07-25 22:07:20 +1000128#if defined(CONFIG_BOOTPARAM)
129 strncpy(&command_line[0], CONFIG_BOOTPARAM_STRING, sizeof(command_line));
130 command_line[sizeof(command_line) - 1] = 0;
131#endif
132
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133 printk(KERN_INFO "\x0F\r\n\nuClinux/" CPU "\n");
134
135#ifdef CONFIG_UCDIMM
136 printk(KERN_INFO "uCdimm by Lineo, Inc. <www.lineo.com>\n");
137#endif
138#ifdef CONFIG_M68VZ328
139 printk(KERN_INFO "M68VZ328 support by Evan Stawnyczy <e@lineo.ca>\n");
140#endif
141#ifdef CONFIG_COLDFIRE
142 printk(KERN_INFO "COLDFIRE port done by Greg Ungerer, gerg@snapgear.com\n");
143#ifdef CONFIG_M5307
144 printk(KERN_INFO "Modified for M5307 by Dave Miller, dmiller@intellistor.com\n");
145#endif
146#ifdef CONFIG_ELITE
147 printk(KERN_INFO "Modified for M5206eLITE by Rob Scott, rscott@mtrob.fdns.net\n");
Greg Ungerere6070a12005-09-02 10:42:52 +1000148#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149#endif
150 printk(KERN_INFO "Flat model support (C) 1998,1999 Kenneth Albanowski, D. Jeff Dionne\n");
151
152#if defined( CONFIG_PILOT ) && defined( CONFIG_M68328 )
153 printk(KERN_INFO "TRG SuperPilot FLASH card support <info@trgnet.com>\n");
154#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155#if defined( CONFIG_PILOT ) && defined( CONFIG_M68EZ328 )
156 printk(KERN_INFO "PalmV support by Lineo Inc. <jeff@uclinux.com>\n");
157#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700158#if defined (CONFIG_M68360)
159 printk(KERN_INFO "QUICC port done by SED Systems <hamilton@sedsystems.ca>,\n");
160 printk(KERN_INFO "based on 2.0.38 port by Lineo Inc. <mleslie@lineo.com>.\n");
161#endif
162#ifdef CONFIG_DRAGEN2
163 printk(KERN_INFO "DragonEngine II board support by Georges Menie\n");
164#endif
Greg Ungerere6070a12005-09-02 10:42:52 +1000165#ifdef CONFIG_M5235EVB
Sebastian Siewior008150f2008-05-01 12:16:33 +1000166 printk(KERN_INFO "Motorola M5235EVB support (C)2005 Syn-tech Systems, Inc. (Jate Sujjavanich)\n");
Greg Ungerere6070a12005-09-02 10:42:52 +1000167#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168
169#ifdef DEBUG
170 printk(KERN_DEBUG "KERNEL -> TEXT=0x%06x-0x%06x DATA=0x%06x-0x%06x "
171 "BSS=0x%06x-0x%06x\n", (int) &_stext, (int) &_etext,
172 (int) &_sdata, (int) &_edata,
173 (int) &_sbss, (int) &_ebss);
Greg Ungerer775ecf82007-10-23 14:37:54 +1000174 printk(KERN_DEBUG "MEMORY -> ROMFS=0x%06x-0x%06x MEM=0x%06x-0x%06x\n ",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175 (int) &_ebss, (int) memory_start,
Greg Ungerer775ecf82007-10-23 14:37:54 +1000176 (int) memory_start, (int) memory_end);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700177#endif
178
179 /* Keep a copy of command line */
180 *cmdline_p = &command_line[0];
Alon Bar-Levf2a09e12007-02-12 00:54:14 -0800181 memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
182 boot_command_line[COMMAND_LINE_SIZE-1] = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183
184#ifdef DEBUG
Greg Ungerere6070a12005-09-02 10:42:52 +1000185 if (strlen(*cmdline_p))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700186 printk(KERN_DEBUG "Command line: '%s'\n", *cmdline_p);
187#endif
188
189#if defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_DUMMY_CONSOLE)
190 conswitchp = &dummy_con;
191#endif
192
193 /*
194 * Give all the memory to the bootmap allocator, tell it to put the
195 * boot mem_map at the start of memory.
196 */
197 bootmap_size = init_bootmem_node(
198 NODE_DATA(0),
199 memory_start >> PAGE_SHIFT, /* map goes here */
200 PAGE_OFFSET >> PAGE_SHIFT, /* 0 on coldfire */
201 memory_end >> PAGE_SHIFT);
202 /*
203 * Free the usable memory, we have to make sure we do not free
204 * the bootmem bitmap so we then reserve it after freeing it :-)
205 */
206 free_bootmem(memory_start, memory_end - memory_start);
Bernhard Walle72a7fe32008-02-07 00:15:17 -0800207 reserve_bootmem(memory_start, bootmap_size, BOOTMEM_DEFAULT);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208
209 /*
210 * Get kmalloc into gear.
211 */
212 paging_init();
213}
214
Linus Torvalds1da177e2005-04-16 15:20:36 -0700215/*
216 * Get CPU information for use by the procfs.
217 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700218static int show_cpuinfo(struct seq_file *m, void *v)
219{
Greg Ungerer22982a52007-07-20 00:31:47 -0700220 char *cpu, *mmu, *fpu;
221 u_long clockfreq;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222
Greg Ungerer22982a52007-07-20 00:31:47 -0700223 cpu = CPU;
224 mmu = "none";
225 fpu = "none";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700226
227#ifdef CONFIG_COLDFIRE
Greg Ungerer22982a52007-07-20 00:31:47 -0700228 clockfreq = (loops_per_jiffy * HZ) * 3;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229#else
Greg Ungerer22982a52007-07-20 00:31:47 -0700230 clockfreq = (loops_per_jiffy * HZ) * 16;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700231#endif
232
Greg Ungerer22982a52007-07-20 00:31:47 -0700233 seq_printf(m, "CPU:\t\t%s\n"
234 "MMU:\t\t%s\n"
235 "FPU:\t\t%s\n"
236 "Clocking:\t%lu.%1luMHz\n"
237 "BogoMips:\t%lu.%02lu\n"
238 "Calibration:\t%lu loops\n",
239 cpu, mmu, fpu,
240 clockfreq / 1000000,
241 (clockfreq / 100000) % 10,
242 (loops_per_jiffy * HZ) / 500000,
243 ((loops_per_jiffy * HZ) / 5000) % 100,
244 (loops_per_jiffy * HZ));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700245
246 return 0;
247}
248
249static void *c_start(struct seq_file *m, loff_t *pos)
250{
251 return *pos < NR_CPUS ? ((void *) 0x12345678) : NULL;
252}
253
254static void *c_next(struct seq_file *m, void *v, loff_t *pos)
255{
256 ++*pos;
257 return c_start(m, pos);
258}
259
260static void c_stop(struct seq_file *m, void *v)
261{
262}
263
Jan Engelhardt03a44822008-02-08 04:21:19 -0800264const struct seq_operations cpuinfo_op = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700265 .start = c_start,
266 .next = c_next,
267 .stop = c_stop,
268 .show = show_cpuinfo,
269};
270