blob: d6f0200316febaa7f8f1fb76c09c0b96e91b0ad1 [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>
Linus Torvalds1da177e2005-04-16 15:20:36 -070025#include <linux/console.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070026#include <linux/errno.h>
27#include <linux/string.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070028#include <linux/bootmem.h>
29#include <linux/seq_file.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070030#include <linux/init.h>
31
32#include <asm/setup.h>
33#include <asm/irq.h>
34#include <asm/machdep.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070035#include <asm/pgtable.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070036
Linus Torvalds1da177e2005-04-16 15:20:36 -070037unsigned long memory_start;
38unsigned long memory_end;
39
Greg Ungerere6070a12005-09-02 10:42:52 +100040EXPORT_SYMBOL(memory_start);
41EXPORT_SYMBOL(memory_end);
42
Alon Bar-Levf2a09e12007-02-12 00:54:14 -080043char __initdata command_line[COMMAND_LINE_SIZE];
Linus Torvalds1da177e2005-04-16 15:20:36 -070044
Linus Torvalds1da177e2005-04-16 15:20:36 -070045/* machine dependent timer functions */
Greg Ungerer2f75d102007-07-15 23:38:33 -070046void (*mach_gettod)(int*, int*, int*, int*, int*, int*);
47int (*mach_set_clock_mmss)(unsigned long);
Greg Ungerer2f75d102007-07-15 23:38:33 -070048
49/* machine dependent reboot functions */
50void (*mach_reset)(void);
51void (*mach_halt)(void);
52void (*mach_power_off)(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070053
54
55#ifdef CONFIG_M68000
56 #define CPU "MC68000"
57#endif
58#ifdef CONFIG_M68328
59 #define CPU "MC68328"
60#endif
61#ifdef CONFIG_M68EZ328
62 #define CPU "MC68EZ328"
63#endif
64#ifdef CONFIG_M68VZ328
65 #define CPU "MC68VZ328"
66#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070067#ifdef CONFIG_M68360
68 #define CPU "MC68360"
69#endif
70#if defined(CONFIG_M5206)
71 #define CPU "COLDFIRE(m5206)"
72#endif
73#if defined(CONFIG_M5206e)
74 #define CPU "COLDFIRE(m5206e)"
75#endif
Greg Ungerer54b03d12005-11-07 14:09:50 +100076#if defined(CONFIG_M520x)
77 #define CPU "COLDFIRE(m520x)"
78#endif
Greg Ungerere6070a12005-09-02 10:42:52 +100079#if defined(CONFIG_M523x)
80 #define CPU "COLDFIRE(m523x)"
81#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070082#if defined(CONFIG_M5249)
83 #define CPU "COLDFIRE(m5249)"
84#endif
Greg Ungerere6070a12005-09-02 10:42:52 +100085#if defined(CONFIG_M5271)
86 #define CPU "COLDFIRE(m5270/5271)"
Linus Torvalds1da177e2005-04-16 15:20:36 -070087#endif
88#if defined(CONFIG_M5272)
89 #define CPU "COLDFIRE(m5272)"
90#endif
Greg Ungerere6070a12005-09-02 10:42:52 +100091#if defined(CONFIG_M5275)
92 #define CPU "COLDFIRE(m5274/5275)"
93#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070094#if defined(CONFIG_M528x)
95 #define CPU "COLDFIRE(m5280/5282)"
96#endif
97#if defined(CONFIG_M5307)
98 #define CPU "COLDFIRE(m5307)"
99#endif
Greg Ungerer7877d012006-06-26 10:33:10 +1000100#if defined(CONFIG_M532x)
101 #define CPU "COLDFIRE(m532x)"
102#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103#if defined(CONFIG_M5407)
104 #define CPU "COLDFIRE(m5407)"
105#endif
106#ifndef CPU
Greg Ungerer54b03d12005-11-07 14:09:50 +1000107 #define CPU "UNKNOWN"
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108#endif
109
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110extern int _stext, _etext, _sdata, _edata, _sbss, _ebss, _end;
111extern int _ramstart, _ramend;
112
Greg Ungerer1d2842e2007-10-24 12:03:41 +1000113void __init setup_arch(char **cmdline_p)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114{
115 int bootmap_size;
116
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117 memory_start = PAGE_ALIGN(_ramstart);
Greg Ungerer2f75d102007-07-15 23:38:33 -0700118 memory_end = _ramend;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119
120 init_mm.start_code = (unsigned long) &_stext;
121 init_mm.end_code = (unsigned long) &_etext;
122 init_mm.end_data = (unsigned long) &_edata;
Greg Ungerere6070a12005-09-02 10:42:52 +1000123 init_mm.brk = (unsigned long) 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124
125 config_BSP(&command_line[0], sizeof(command_line));
126
Greg Ungererbc724502007-07-25 22:07:20 +1000127#if defined(CONFIG_BOOTPARAM)
128 strncpy(&command_line[0], CONFIG_BOOTPARAM_STRING, sizeof(command_line));
129 command_line[sizeof(command_line) - 1] = 0;
130#endif
131
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132 printk(KERN_INFO "\x0F\r\n\nuClinux/" CPU "\n");
133
134#ifdef CONFIG_UCDIMM
135 printk(KERN_INFO "uCdimm by Lineo, Inc. <www.lineo.com>\n");
136#endif
137#ifdef CONFIG_M68VZ328
138 printk(KERN_INFO "M68VZ328 support by Evan Stawnyczy <e@lineo.ca>\n");
139#endif
140#ifdef CONFIG_COLDFIRE
141 printk(KERN_INFO "COLDFIRE port done by Greg Ungerer, gerg@snapgear.com\n");
142#ifdef CONFIG_M5307
143 printk(KERN_INFO "Modified for M5307 by Dave Miller, dmiller@intellistor.com\n");
144#endif
145#ifdef CONFIG_ELITE
146 printk(KERN_INFO "Modified for M5206eLITE by Rob Scott, rscott@mtrob.fdns.net\n");
Greg Ungerere6070a12005-09-02 10:42:52 +1000147#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148#endif
149 printk(KERN_INFO "Flat model support (C) 1998,1999 Kenneth Albanowski, D. Jeff Dionne\n");
150
151#if defined( CONFIG_PILOT ) && defined( CONFIG_M68328 )
152 printk(KERN_INFO "TRG SuperPilot FLASH card support <info@trgnet.com>\n");
153#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154#if defined( CONFIG_PILOT ) && defined( CONFIG_M68EZ328 )
155 printk(KERN_INFO "PalmV support by Lineo Inc. <jeff@uclinux.com>\n");
156#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157#if defined (CONFIG_M68360)
158 printk(KERN_INFO "QUICC port done by SED Systems <hamilton@sedsystems.ca>,\n");
159 printk(KERN_INFO "based on 2.0.38 port by Lineo Inc. <mleslie@lineo.com>.\n");
160#endif
161#ifdef CONFIG_DRAGEN2
162 printk(KERN_INFO "DragonEngine II board support by Georges Menie\n");
163#endif
Greg Ungerere6070a12005-09-02 10:42:52 +1000164#ifdef CONFIG_M5235EVB
165 printk(KERN_INFO "Motorola M5235EVB support (C)2005 Syn-tech Systems, Inc. (Jate Sujjavanich)");
166#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167
168#ifdef DEBUG
169 printk(KERN_DEBUG "KERNEL -> TEXT=0x%06x-0x%06x DATA=0x%06x-0x%06x "
170 "BSS=0x%06x-0x%06x\n", (int) &_stext, (int) &_etext,
171 (int) &_sdata, (int) &_edata,
172 (int) &_sbss, (int) &_ebss);
Greg Ungerer775ecf82007-10-23 14:37:54 +1000173 printk(KERN_DEBUG "MEMORY -> ROMFS=0x%06x-0x%06x MEM=0x%06x-0x%06x\n ",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700174 (int) &_ebss, (int) memory_start,
Greg Ungerer775ecf82007-10-23 14:37:54 +1000175 (int) memory_start, (int) memory_end);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700176#endif
177
178 /* Keep a copy of command line */
179 *cmdline_p = &command_line[0];
Alon Bar-Levf2a09e12007-02-12 00:54:14 -0800180 memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
181 boot_command_line[COMMAND_LINE_SIZE-1] = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182
183#ifdef DEBUG
Greg Ungerere6070a12005-09-02 10:42:52 +1000184 if (strlen(*cmdline_p))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185 printk(KERN_DEBUG "Command line: '%s'\n", *cmdline_p);
186#endif
187
188#if defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_DUMMY_CONSOLE)
189 conswitchp = &dummy_con;
190#endif
191
192 /*
193 * Give all the memory to the bootmap allocator, tell it to put the
194 * boot mem_map at the start of memory.
195 */
196 bootmap_size = init_bootmem_node(
197 NODE_DATA(0),
198 memory_start >> PAGE_SHIFT, /* map goes here */
199 PAGE_OFFSET >> PAGE_SHIFT, /* 0 on coldfire */
200 memory_end >> PAGE_SHIFT);
201 /*
202 * Free the usable memory, we have to make sure we do not free
203 * the bootmem bitmap so we then reserve it after freeing it :-)
204 */
205 free_bootmem(memory_start, memory_end - memory_start);
Bernhard Walle72a7fe32008-02-07 00:15:17 -0800206 reserve_bootmem(memory_start, bootmap_size, BOOTMEM_DEFAULT);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700207
208 /*
209 * Get kmalloc into gear.
210 */
211 paging_init();
212}
213
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214/*
215 * Get CPU information for use by the procfs.
216 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700217static int show_cpuinfo(struct seq_file *m, void *v)
218{
Greg Ungerer22982a52007-07-20 00:31:47 -0700219 char *cpu, *mmu, *fpu;
220 u_long clockfreq;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221
Greg Ungerer22982a52007-07-20 00:31:47 -0700222 cpu = CPU;
223 mmu = "none";
224 fpu = "none";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700225
226#ifdef CONFIG_COLDFIRE
Greg Ungerer22982a52007-07-20 00:31:47 -0700227 clockfreq = (loops_per_jiffy * HZ) * 3;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700228#else
Greg Ungerer22982a52007-07-20 00:31:47 -0700229 clockfreq = (loops_per_jiffy * HZ) * 16;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700230#endif
231
Greg Ungerer22982a52007-07-20 00:31:47 -0700232 seq_printf(m, "CPU:\t\t%s\n"
233 "MMU:\t\t%s\n"
234 "FPU:\t\t%s\n"
235 "Clocking:\t%lu.%1luMHz\n"
236 "BogoMips:\t%lu.%02lu\n"
237 "Calibration:\t%lu loops\n",
238 cpu, mmu, fpu,
239 clockfreq / 1000000,
240 (clockfreq / 100000) % 10,
241 (loops_per_jiffy * HZ) / 500000,
242 ((loops_per_jiffy * HZ) / 5000) % 100,
243 (loops_per_jiffy * HZ));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244
245 return 0;
246}
247
248static void *c_start(struct seq_file *m, loff_t *pos)
249{
250 return *pos < NR_CPUS ? ((void *) 0x12345678) : NULL;
251}
252
253static void *c_next(struct seq_file *m, void *v, loff_t *pos)
254{
255 ++*pos;
256 return c_start(m, pos);
257}
258
259static void c_stop(struct seq_file *m, void *v)
260{
261}
262
Jan Engelhardt03a44822008-02-08 04:21:19 -0800263const struct seq_operations cpuinfo_op = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700264 .start = c_start,
265 .next = c_next,
266 .stop = c_stop,
267 .show = show_cpuinfo,
268};
269