blob: c494495af40d21a82aa61f2425f959be5c8cf0bb [file] [log] [blame]
Bryan Wu1394f032007-05-06 14:50:22 -07001/*
Mike Frysinger550d5532008-02-02 15:55:37 +08002 * arch/blackfin/kernel/setup.c
Bryan Wu1394f032007-05-06 14:50:22 -07003 *
Mike Frysinger550d5532008-02-02 15:55:37 +08004 * Copyright 2004-2006 Analog Devices Inc.
Bryan Wu1394f032007-05-06 14:50:22 -07005 *
Mike Frysinger550d5532008-02-02 15:55:37 +08006 * Enter bugs at http://blackfin.uclinux.org/
Bryan Wu1394f032007-05-06 14:50:22 -07007 *
Mike Frysinger550d5532008-02-02 15:55:37 +08008 * Licensed under the GPL-2 or later.
Bryan Wu1394f032007-05-06 14:50:22 -07009 */
10
11#include <linux/delay.h>
12#include <linux/console.h>
13#include <linux/bootmem.h>
14#include <linux/seq_file.h>
15#include <linux/cpu.h>
16#include <linux/module.h>
Bryan Wu1394f032007-05-06 14:50:22 -070017#include <linux/tty.h>
Yi Li856783b2008-02-09 02:26:01 +080018#include <linux/pfn.h>
Bryan Wu1394f032007-05-06 14:50:22 -070019
20#include <linux/ext2_fs.h>
21#include <linux/cramfs_fs.h>
22#include <linux/romfs_fs.h>
23
Robin Getz3bebca22007-10-10 23:55:26 +080024#include <asm/cplb.h>
Bryan Wu1394f032007-05-06 14:50:22 -070025#include <asm/cacheflush.h>
26#include <asm/blackfin.h>
27#include <asm/cplbinit.h>
Mike Frysinger1754a5d2007-11-23 11:28:11 +080028#include <asm/div64.h>
Bernd Schmidt7adfb582007-06-21 11:34:16 +080029#include <asm/fixed_code.h>
Robin Getzce3afa12007-10-09 17:28:36 +080030#include <asm/early_printk.h>
Bryan Wu1394f032007-05-06 14:50:22 -070031
Michael Hennerich6cda2e92008-02-02 15:10:51 +080032static DEFINE_PER_CPU(struct cpu, cpu_devices);
33
Mike Frysingera9c59c22007-05-21 18:09:32 +080034u16 _bfin_swrst;
Mike Frysingerd45118b2008-02-25 12:24:44 +080035EXPORT_SYMBOL(_bfin_swrst);
Mike Frysingera9c59c22007-05-21 18:09:32 +080036
Bryan Wu1394f032007-05-06 14:50:22 -070037unsigned long memory_start, memory_end, physical_mem_end;
Mike Frysinger3132b582008-04-24 05:12:09 +080038unsigned long _rambase, _ramstart, _ramend;
Bryan Wu1394f032007-05-06 14:50:22 -070039unsigned long reserved_mem_dcache_on;
40unsigned long reserved_mem_icache_on;
41EXPORT_SYMBOL(memory_start);
42EXPORT_SYMBOL(memory_end);
43EXPORT_SYMBOL(physical_mem_end);
44EXPORT_SYMBOL(_ramend);
45
46#ifdef CONFIG_MTD_UCLINUX
47unsigned long memory_mtd_end, memory_mtd_start, mtd_size;
48unsigned long _ebss;
49EXPORT_SYMBOL(memory_mtd_end);
50EXPORT_SYMBOL(memory_mtd_start);
51EXPORT_SYMBOL(mtd_size);
52#endif
53
Mike Frysinger5e10b4a2007-06-11 16:44:09 +080054char __initdata command_line[COMMAND_LINE_SIZE];
Bryan Wu1394f032007-05-06 14:50:22 -070055
Yi Li856783b2008-02-09 02:26:01 +080056/* boot memmap, for parsing "memmap=" */
57#define BFIN_MEMMAP_MAX 128 /* number of entries in bfin_memmap */
58#define BFIN_MEMMAP_RAM 1
59#define BFIN_MEMMAP_RESERVED 2
60struct bfin_memmap {
61 int nr_map;
62 struct bfin_memmap_entry {
63 unsigned long long addr; /* start of memory segment */
64 unsigned long long size;
65 unsigned long type;
66 } map[BFIN_MEMMAP_MAX];
67} bfin_memmap __initdata;
68
69/* for memmap sanitization */
70struct change_member {
71 struct bfin_memmap_entry *pentry; /* pointer to original entry */
72 unsigned long long addr; /* address for this change point */
73};
74static struct change_member change_point_list[2*BFIN_MEMMAP_MAX] __initdata;
75static struct change_member *change_point[2*BFIN_MEMMAP_MAX] __initdata;
76static struct bfin_memmap_entry *overlap_list[BFIN_MEMMAP_MAX] __initdata;
77static struct bfin_memmap_entry new_map[BFIN_MEMMAP_MAX] __initdata;
78
Bryan Wu1394f032007-05-06 14:50:22 -070079void __init bf53x_cache_init(void)
80{
Robin Getz3bebca22007-10-10 23:55:26 +080081#if defined(CONFIG_BFIN_DCACHE) || defined(CONFIG_BFIN_ICACHE)
Bryan Wu1394f032007-05-06 14:50:22 -070082 generate_cpl_tables();
83#endif
84
Robin Getz3bebca22007-10-10 23:55:26 +080085#ifdef CONFIG_BFIN_ICACHE
Bryan Wu1394f032007-05-06 14:50:22 -070086 bfin_icache_init();
87 printk(KERN_INFO "Instruction Cache Enabled\n");
88#endif
89
Robin Getz3bebca22007-10-10 23:55:26 +080090#ifdef CONFIG_BFIN_DCACHE
Bryan Wu1394f032007-05-06 14:50:22 -070091 bfin_dcache_init();
92 printk(KERN_INFO "Data Cache Enabled"
Robin Getz3bebca22007-10-10 23:55:26 +080093# if defined CONFIG_BFIN_WB
Bryan Wu1394f032007-05-06 14:50:22 -070094 " (write-back)"
Robin Getz3bebca22007-10-10 23:55:26 +080095# elif defined CONFIG_BFIN_WT
Bryan Wu1394f032007-05-06 14:50:22 -070096 " (write-through)"
97# endif
98 "\n");
99#endif
100}
101
Mike Frysinger52a07812007-06-11 15:31:30 +0800102void __init bf53x_relocate_l1_mem(void)
Bryan Wu1394f032007-05-06 14:50:22 -0700103{
104 unsigned long l1_code_length;
105 unsigned long l1_data_a_length;
106 unsigned long l1_data_b_length;
107
108 l1_code_length = _etext_l1 - _stext_l1;
109 if (l1_code_length > L1_CODE_LENGTH)
Sonic Zhangb85b82d2008-04-24 06:13:37 +0800110 panic("L1 Instruction SRAM Overflow\n");
Bryan Wu1394f032007-05-06 14:50:22 -0700111 /* cannot complain as printk is not available as yet.
112 * But we can continue booting and complain later!
113 */
114
115 /* Copy _stext_l1 to _etext_l1 to L1 instruction SRAM */
116 dma_memcpy(_stext_l1, _l1_lma_start, l1_code_length);
117
118 l1_data_a_length = _ebss_l1 - _sdata_l1;
119 if (l1_data_a_length > L1_DATA_A_LENGTH)
Sonic Zhangb85b82d2008-04-24 06:13:37 +0800120 panic("L1 Data SRAM Bank A Overflow\n");
Bryan Wu1394f032007-05-06 14:50:22 -0700121
122 /* Copy _sdata_l1 to _ebss_l1 to L1 data bank A SRAM */
123 dma_memcpy(_sdata_l1, _l1_lma_start + l1_code_length, l1_data_a_length);
124
125 l1_data_b_length = _ebss_b_l1 - _sdata_b_l1;
126 if (l1_data_b_length > L1_DATA_B_LENGTH)
Sonic Zhangb85b82d2008-04-24 06:13:37 +0800127 panic("L1 Data SRAM Bank B Overflow\n");
Bryan Wu1394f032007-05-06 14:50:22 -0700128
129 /* Copy _sdata_b_l1 to _ebss_b_l1 to L1 data bank B SRAM */
130 dma_memcpy(_sdata_b_l1, _l1_lma_start + l1_code_length +
131 l1_data_a_length, l1_data_b_length);
132
133}
134
Yi Li856783b2008-02-09 02:26:01 +0800135/* add_memory_region to memmap */
136static void __init add_memory_region(unsigned long long start,
137 unsigned long long size, int type)
138{
139 int i;
140
141 i = bfin_memmap.nr_map;
142
143 if (i == BFIN_MEMMAP_MAX) {
144 printk(KERN_ERR "Ooops! Too many entries in the memory map!\n");
145 return;
146 }
147
148 bfin_memmap.map[i].addr = start;
149 bfin_memmap.map[i].size = size;
150 bfin_memmap.map[i].type = type;
151 bfin_memmap.nr_map++;
152}
153
154/*
155 * Sanitize the boot memmap, removing overlaps.
156 */
157static int __init sanitize_memmap(struct bfin_memmap_entry *map, int *pnr_map)
158{
159 struct change_member *change_tmp;
160 unsigned long current_type, last_type;
161 unsigned long long last_addr;
162 int chgidx, still_changing;
163 int overlap_entries;
164 int new_entry;
165 int old_nr, new_nr, chg_nr;
166 int i;
167
168 /*
169 Visually we're performing the following (1,2,3,4 = memory types)
170
171 Sample memory map (w/overlaps):
172 ____22__________________
173 ______________________4_
174 ____1111________________
175 _44_____________________
176 11111111________________
177 ____________________33__
178 ___________44___________
179 __________33333_________
180 ______________22________
181 ___________________2222_
182 _________111111111______
183 _____________________11_
184 _________________4______
185
186 Sanitized equivalent (no overlap):
187 1_______________________
188 _44_____________________
189 ___1____________________
190 ____22__________________
191 ______11________________
192 _________1______________
193 __________3_____________
194 ___________44___________
195 _____________33_________
196 _______________2________
197 ________________1_______
198 _________________4______
199 ___________________2____
200 ____________________33__
201 ______________________4_
202 */
203 /* if there's only one memory region, don't bother */
204 if (*pnr_map < 2)
205 return -1;
206
207 old_nr = *pnr_map;
208
209 /* bail out if we find any unreasonable addresses in memmap */
210 for (i = 0; i < old_nr; i++)
211 if (map[i].addr + map[i].size < map[i].addr)
212 return -1;
213
214 /* create pointers for initial change-point information (for sorting) */
215 for (i = 0; i < 2*old_nr; i++)
216 change_point[i] = &change_point_list[i];
217
218 /* record all known change-points (starting and ending addresses),
219 omitting those that are for empty memory regions */
220 chgidx = 0;
221 for (i = 0; i < old_nr; i++) {
222 if (map[i].size != 0) {
223 change_point[chgidx]->addr = map[i].addr;
224 change_point[chgidx++]->pentry = &map[i];
225 change_point[chgidx]->addr = map[i].addr + map[i].size;
226 change_point[chgidx++]->pentry = &map[i];
227 }
228 }
229 chg_nr = chgidx; /* true number of change-points */
230
231 /* sort change-point list by memory addresses (low -> high) */
232 still_changing = 1;
233 while (still_changing) {
234 still_changing = 0;
235 for (i = 1; i < chg_nr; i++) {
236 /* if <current_addr> > <last_addr>, swap */
237 /* or, if current=<start_addr> & last=<end_addr>, swap */
238 if ((change_point[i]->addr < change_point[i-1]->addr) ||
239 ((change_point[i]->addr == change_point[i-1]->addr) &&
240 (change_point[i]->addr == change_point[i]->pentry->addr) &&
241 (change_point[i-1]->addr != change_point[i-1]->pentry->addr))
242 ) {
243 change_tmp = change_point[i];
244 change_point[i] = change_point[i-1];
245 change_point[i-1] = change_tmp;
246 still_changing = 1;
247 }
248 }
249 }
250
251 /* create a new memmap, removing overlaps */
252 overlap_entries = 0; /* number of entries in the overlap table */
253 new_entry = 0; /* index for creating new memmap entries */
254 last_type = 0; /* start with undefined memory type */
255 last_addr = 0; /* start with 0 as last starting address */
256 /* loop through change-points, determining affect on the new memmap */
257 for (chgidx = 0; chgidx < chg_nr; chgidx++) {
258 /* keep track of all overlapping memmap entries */
259 if (change_point[chgidx]->addr == change_point[chgidx]->pentry->addr) {
260 /* add map entry to overlap list (> 1 entry implies an overlap) */
261 overlap_list[overlap_entries++] = change_point[chgidx]->pentry;
262 } else {
263 /* remove entry from list (order independent, so swap with last) */
264 for (i = 0; i < overlap_entries; i++) {
265 if (overlap_list[i] == change_point[chgidx]->pentry)
266 overlap_list[i] = overlap_list[overlap_entries-1];
267 }
268 overlap_entries--;
269 }
270 /* if there are overlapping entries, decide which "type" to use */
271 /* (larger value takes precedence -- 1=usable, 2,3,4,4+=unusable) */
272 current_type = 0;
273 for (i = 0; i < overlap_entries; i++)
274 if (overlap_list[i]->type > current_type)
275 current_type = overlap_list[i]->type;
276 /* continue building up new memmap based on this information */
277 if (current_type != last_type) {
278 if (last_type != 0) {
279 new_map[new_entry].size =
280 change_point[chgidx]->addr - last_addr;
281 /* move forward only if the new size was non-zero */
282 if (new_map[new_entry].size != 0)
283 if (++new_entry >= BFIN_MEMMAP_MAX)
284 break; /* no more space left for new entries */
285 }
286 if (current_type != 0) {
287 new_map[new_entry].addr = change_point[chgidx]->addr;
288 new_map[new_entry].type = current_type;
289 last_addr = change_point[chgidx]->addr;
290 }
291 last_type = current_type;
292 }
293 }
294 new_nr = new_entry; /* retain count for new entries */
295
296 /* copy new mapping into original location */
297 memcpy(map, new_map, new_nr*sizeof(struct bfin_memmap_entry));
298 *pnr_map = new_nr;
299
300 return 0;
301}
302
303static void __init print_memory_map(char *who)
304{
305 int i;
306
307 for (i = 0; i < bfin_memmap.nr_map; i++) {
308 printk(KERN_DEBUG " %s: %016Lx - %016Lx ", who,
309 bfin_memmap.map[i].addr,
310 bfin_memmap.map[i].addr + bfin_memmap.map[i].size);
311 switch (bfin_memmap.map[i].type) {
312 case BFIN_MEMMAP_RAM:
313 printk("(usable)\n");
314 break;
315 case BFIN_MEMMAP_RESERVED:
316 printk("(reserved)\n");
317 break;
318 default: printk("type %lu\n", bfin_memmap.map[i].type);
319 break;
320 }
321 }
322}
323
324static __init int parse_memmap(char *arg)
325{
326 unsigned long long start_at, mem_size;
327
328 if (!arg)
329 return -EINVAL;
330
331 mem_size = memparse(arg, &arg);
332 if (*arg == '@') {
333 start_at = memparse(arg+1, &arg);
334 add_memory_region(start_at, mem_size, BFIN_MEMMAP_RAM);
335 } else if (*arg == '$') {
336 start_at = memparse(arg+1, &arg);
337 add_memory_region(start_at, mem_size, BFIN_MEMMAP_RESERVED);
338 }
339
340 return 0;
341}
342
Bryan Wu1394f032007-05-06 14:50:22 -0700343/*
344 * Initial parsing of the command line. Currently, we support:
345 * - Controlling the linux memory size: mem=xxx[KMG]
346 * - Controlling the physical memory size: max_mem=xxx[KMG][$][#]
347 * $ -> reserved memory is dcacheable
348 * # -> reserved memory is icacheable
Yi Li856783b2008-02-09 02:26:01 +0800349 * - "memmap=XXX[KkmM][@][$]XXX[KkmM]" defines a memory region
350 * @ from <start> to <start>+<mem>, type RAM
351 * $ from <start> to <start>+<mem>, type RESERVED
352 *
Bryan Wu1394f032007-05-06 14:50:22 -0700353 */
354static __init void parse_cmdline_early(char *cmdline_p)
355{
356 char c = ' ', *to = cmdline_p;
357 unsigned int memsize;
358 for (;;) {
359 if (c == ' ') {
Bryan Wu1394f032007-05-06 14:50:22 -0700360 if (!memcmp(to, "mem=", 4)) {
361 to += 4;
362 memsize = memparse(to, &to);
363 if (memsize)
364 _ramend = memsize;
365
366 } else if (!memcmp(to, "max_mem=", 8)) {
367 to += 8;
368 memsize = memparse(to, &to);
369 if (memsize) {
370 physical_mem_end = memsize;
371 if (*to != ' ') {
372 if (*to == '$'
373 || *(to + 1) == '$')
374 reserved_mem_dcache_on =
375 1;
376 if (*to == '#'
377 || *(to + 1) == '#')
378 reserved_mem_icache_on =
379 1;
380 }
381 }
Robin Getzce3afa12007-10-09 17:28:36 +0800382 } else if (!memcmp(to, "earlyprintk=", 12)) {
383 to += 12;
384 setup_early_printk(to);
Yi Li856783b2008-02-09 02:26:01 +0800385 } else if (!memcmp(to, "memmap=", 7)) {
386 to += 7;
387 parse_memmap(to);
Bryan Wu1394f032007-05-06 14:50:22 -0700388 }
Bryan Wu1394f032007-05-06 14:50:22 -0700389 }
390 c = *(to++);
391 if (!c)
392 break;
393 }
394}
395
Yi Li856783b2008-02-09 02:26:01 +0800396/*
397 * Setup memory defaults from user config.
398 * The physical memory layout looks like:
399 *
400 * [_rambase, _ramstart]: kernel image
401 * [memory_start, memory_end]: dynamic memory managed by kernel
402 * [memory_end, _ramend]: reserved memory
403 * [meory_mtd_start(memory_end),
404 * memory_mtd_start + mtd_size]: rootfs (if any)
405 * [_ramend - DMA_UNCACHED_REGION,
406 * _ramend]: uncached DMA region
407 * [_ramend, physical_mem_end]: memory not managed by kernel
408 *
409 */
410static __init void memory_setup(void)
Bryan Wu1394f032007-05-06 14:50:22 -0700411{
Mike Frysingerc0eab3b2008-02-02 15:36:11 +0800412#ifdef CONFIG_MTD_UCLINUX
413 unsigned long mtd_phys = 0;
414#endif
415
Yi Li856783b2008-02-09 02:26:01 +0800416 _rambase = (unsigned long)_stext;
Mike Frysingerb7627ac2008-02-02 15:53:17 +0800417 _ramstart = (unsigned long)_end;
Bryan Wu1394f032007-05-06 14:50:22 -0700418
Yi Li856783b2008-02-09 02:26:01 +0800419 if (DMA_UNCACHED_REGION > (_ramend - _ramstart)) {
420 console_init();
421 panic("DMA region exceeds memory limit: %lu.\n",
422 _ramend - _ramstart);
Mike Frysinger1aafd902007-07-25 11:19:14 +0800423 }
Bryan Wu1394f032007-05-06 14:50:22 -0700424 memory_end = _ramend - DMA_UNCACHED_REGION;
425
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800426#ifdef CONFIG_MPU
427 /* Round up to multiple of 4MB. */
428 memory_start = (_ramstart + 0x3fffff) & ~0x3fffff;
429#else
Bryan Wu1394f032007-05-06 14:50:22 -0700430 memory_start = PAGE_ALIGN(_ramstart);
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800431#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700432
433#if defined(CONFIG_MTD_UCLINUX)
434 /* generic memory mapped MTD driver */
435 memory_mtd_end = memory_end;
436
437 mtd_phys = _ramstart;
438 mtd_size = PAGE_ALIGN(*((unsigned long *)(mtd_phys + 8)));
439
440# if defined(CONFIG_EXT2_FS) || defined(CONFIG_EXT3_FS)
441 if (*((unsigned short *)(mtd_phys + 0x438)) == EXT2_SUPER_MAGIC)
442 mtd_size =
443 PAGE_ALIGN(*((unsigned long *)(mtd_phys + 0x404)) << 10);
444# endif
445
446# if defined(CONFIG_CRAMFS)
447 if (*((unsigned long *)(mtd_phys)) == CRAMFS_MAGIC)
448 mtd_size = PAGE_ALIGN(*((unsigned long *)(mtd_phys + 0x4)));
449# endif
450
451# if defined(CONFIG_ROMFS_FS)
452 if (((unsigned long *)mtd_phys)[0] == ROMSB_WORD0
453 && ((unsigned long *)mtd_phys)[1] == ROMSB_WORD1)
454 mtd_size =
455 PAGE_ALIGN(be32_to_cpu(((unsigned long *)mtd_phys)[2]));
Robin Getz3bebca22007-10-10 23:55:26 +0800456# if (defined(CONFIG_BFIN_ICACHE) && ANOMALY_05000263)
Bryan Wu1394f032007-05-06 14:50:22 -0700457 /* Due to a Hardware Anomaly we need to limit the size of usable
458 * instruction memory to max 60MB, 56 if HUNT_FOR_ZERO is on
459 * 05000263 - Hardware loop corrupted when taking an ICPLB exception
460 */
461# if (defined(CONFIG_DEBUG_HUNT_FOR_ZERO))
462 if (memory_end >= 56 * 1024 * 1024)
463 memory_end = 56 * 1024 * 1024;
464# else
465 if (memory_end >= 60 * 1024 * 1024)
466 memory_end = 60 * 1024 * 1024;
467# endif /* CONFIG_DEBUG_HUNT_FOR_ZERO */
468# endif /* ANOMALY_05000263 */
469# endif /* CONFIG_ROMFS_FS */
470
471 memory_end -= mtd_size;
472
473 if (mtd_size == 0) {
474 console_init();
475 panic("Don't boot kernel without rootfs attached.\n");
476 }
477
478 /* Relocate MTD image to the top of memory after the uncached memory area */
Mike Frysingerb7627ac2008-02-02 15:53:17 +0800479 dma_memcpy((char *)memory_end, _end, mtd_size);
Bryan Wu1394f032007-05-06 14:50:22 -0700480
481 memory_mtd_start = memory_end;
482 _ebss = memory_mtd_start; /* define _ebss for compatible */
483#endif /* CONFIG_MTD_UCLINUX */
484
Robin Getz3bebca22007-10-10 23:55:26 +0800485#if (defined(CONFIG_BFIN_ICACHE) && ANOMALY_05000263)
Bryan Wu1394f032007-05-06 14:50:22 -0700486 /* Due to a Hardware Anomaly we need to limit the size of usable
487 * instruction memory to max 60MB, 56 if HUNT_FOR_ZERO is on
488 * 05000263 - Hardware loop corrupted when taking an ICPLB exception
489 */
490#if (defined(CONFIG_DEBUG_HUNT_FOR_ZERO))
491 if (memory_end >= 56 * 1024 * 1024)
492 memory_end = 56 * 1024 * 1024;
493#else
494 if (memory_end >= 60 * 1024 * 1024)
495 memory_end = 60 * 1024 * 1024;
496#endif /* CONFIG_DEBUG_HUNT_FOR_ZERO */
497 printk(KERN_NOTICE "Warning: limiting memory to %liMB due to hardware anomaly 05000263\n", memory_end >> 20);
498#endif /* ANOMALY_05000263 */
499
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800500#ifdef CONFIG_MPU
501 page_mask_nelts = ((_ramend >> PAGE_SHIFT) + 31) / 32;
502 page_mask_order = get_order(3 * page_mask_nelts * sizeof(long));
503#endif
504
Bryan Wu1394f032007-05-06 14:50:22 -0700505#if !defined(CONFIG_MTD_UCLINUX)
Yi Li856783b2008-02-09 02:26:01 +0800506 /*In case there is no valid CPLB behind memory_end make sure we don't get to close*/
507 memory_end -= SIZE_4K;
Bryan Wu1394f032007-05-06 14:50:22 -0700508#endif
Yi Li856783b2008-02-09 02:26:01 +0800509
Bryan Wu1394f032007-05-06 14:50:22 -0700510 init_mm.start_code = (unsigned long)_stext;
511 init_mm.end_code = (unsigned long)_etext;
512 init_mm.end_data = (unsigned long)_edata;
513 init_mm.brk = (unsigned long)0;
514
Yi Li856783b2008-02-09 02:26:01 +0800515 printk(KERN_INFO "Board Memory: %ldMB\n", physical_mem_end >> 20);
516 printk(KERN_INFO "Kernel Managed Memory: %ldMB\n", _ramend >> 20);
517
Mike Frysingerb7627ac2008-02-02 15:53:17 +0800518 printk(KERN_INFO "Memory map:\n"
Mike Frysinger8929ecf82008-02-22 16:35:20 +0800519 KERN_INFO " fixedcode = 0x%p-0x%p\n"
Yi Li856783b2008-02-09 02:26:01 +0800520 KERN_INFO " text = 0x%p-0x%p\n"
521 KERN_INFO " rodata = 0x%p-0x%p\n"
Mike Frysingerb7627ac2008-02-02 15:53:17 +0800522 KERN_INFO " bss = 0x%p-0x%p\n"
Yi Li856783b2008-02-09 02:26:01 +0800523 KERN_INFO " data = 0x%p-0x%p\n"
524 KERN_INFO " stack = 0x%p-0x%p\n"
525 KERN_INFO " init = 0x%p-0x%p\n"
Yi Li856783b2008-02-09 02:26:01 +0800526 KERN_INFO " available = 0x%p-0x%p\n"
527#ifdef CONFIG_MTD_UCLINUX
528 KERN_INFO " rootfs = 0x%p-0x%p\n"
529#endif
530#if DMA_UNCACHED_REGION > 0
531 KERN_INFO " DMA Zone = 0x%p-0x%p\n"
532#endif
Mike Frysinger8929ecf82008-02-22 16:35:20 +0800533 , (void *)FIXED_CODE_START, (void *)FIXED_CODE_END,
534 _stext, _etext,
Yi Li856783b2008-02-09 02:26:01 +0800535 __start_rodata, __end_rodata,
Mike Frysingerb7627ac2008-02-02 15:53:17 +0800536 __bss_start, __bss_stop,
Yi Li856783b2008-02-09 02:26:01 +0800537 _sdata, _edata,
538 (void *)&init_thread_union,
539 (void *)((int)(&init_thread_union) + 0x2000),
Mike Frysingerb7627ac2008-02-02 15:53:17 +0800540 __init_begin, __init_end,
541 (void *)_ramstart, (void *)memory_end
Yi Li856783b2008-02-09 02:26:01 +0800542#ifdef CONFIG_MTD_UCLINUX
543 , (void *)memory_mtd_start, (void *)(memory_mtd_start + mtd_size)
544#endif
545#if DMA_UNCACHED_REGION > 0
546 , (void *)(_ramend - DMA_UNCACHED_REGION), (void *)(_ramend)
547#endif
548 );
549}
550
Yi Li2e8d7962008-03-26 07:08:12 +0800551/*
552 * Find the lowest, highest page frame number we have available
553 */
554void __init find_min_max_pfn(void)
555{
556 int i;
557
558 max_pfn = 0;
559 min_low_pfn = memory_end;
560
561 for (i = 0; i < bfin_memmap.nr_map; i++) {
562 unsigned long start, end;
563 /* RAM? */
564 if (bfin_memmap.map[i].type != BFIN_MEMMAP_RAM)
565 continue;
566 start = PFN_UP(bfin_memmap.map[i].addr);
567 end = PFN_DOWN(bfin_memmap.map[i].addr +
568 bfin_memmap.map[i].size);
569 if (start >= end)
570 continue;
571 if (end > max_pfn)
572 max_pfn = end;
573 if (start < min_low_pfn)
574 min_low_pfn = start;
575 }
576}
577
Yi Li856783b2008-02-09 02:26:01 +0800578static __init void setup_bootmem_allocator(void)
579{
580 int bootmap_size;
581 int i;
Yi Li2e8d7962008-03-26 07:08:12 +0800582 unsigned long start_pfn, end_pfn;
Yi Li856783b2008-02-09 02:26:01 +0800583 unsigned long curr_pfn, last_pfn, size;
584
585 /* mark memory between memory_start and memory_end usable */
586 add_memory_region(memory_start,
587 memory_end - memory_start, BFIN_MEMMAP_RAM);
588 /* sanity check for overlap */
589 sanitize_memmap(bfin_memmap.map, &bfin_memmap.nr_map);
590 print_memory_map("boot memmap");
591
Yi Li2e8d7962008-03-26 07:08:12 +0800592 /* intialize globals in linux/bootmem.h */
593 find_min_max_pfn();
594 /* pfn of the last usable page frame */
595 if (max_pfn > memory_end >> PAGE_SHIFT)
596 max_pfn = memory_end >> PAGE_SHIFT;
597 /* pfn of last page frame directly mapped by kernel */
598 max_low_pfn = max_pfn;
599 /* pfn of the first usable page frame after kernel image*/
600 if (min_low_pfn < memory_start >> PAGE_SHIFT)
601 min_low_pfn = memory_start >> PAGE_SHIFT;
602
603 start_pfn = PAGE_OFFSET >> PAGE_SHIFT;
604 end_pfn = memory_end >> PAGE_SHIFT;
Yi Li856783b2008-02-09 02:26:01 +0800605
606 /*
607 * give all the memory to the bootmap allocator, tell it to put the
608 * boot mem_map at the start of memory.
609 */
610 bootmap_size = init_bootmem_node(NODE_DATA(0),
611 memory_start >> PAGE_SHIFT, /* map goes here */
Yi Li2e8d7962008-03-26 07:08:12 +0800612 start_pfn, end_pfn);
Yi Li856783b2008-02-09 02:26:01 +0800613
614 /* register the memmap regions with the bootmem allocator */
615 for (i = 0; i < bfin_memmap.nr_map; i++) {
616 /*
617 * Reserve usable memory
618 */
619 if (bfin_memmap.map[i].type != BFIN_MEMMAP_RAM)
620 continue;
621 /*
622 * We are rounding up the start address of usable memory:
623 */
624 curr_pfn = PFN_UP(bfin_memmap.map[i].addr);
Yi Li2e8d7962008-03-26 07:08:12 +0800625 if (curr_pfn >= end_pfn)
Yi Li856783b2008-02-09 02:26:01 +0800626 continue;
627 /*
628 * ... and at the end of the usable range downwards:
629 */
630 last_pfn = PFN_DOWN(bfin_memmap.map[i].addr +
631 bfin_memmap.map[i].size);
632
Yi Li2e8d7962008-03-26 07:08:12 +0800633 if (last_pfn > end_pfn)
634 last_pfn = end_pfn;
Yi Li856783b2008-02-09 02:26:01 +0800635
636 /*
637 * .. finally, did all the rounding and playing
638 * around just make the area go away?
639 */
640 if (last_pfn <= curr_pfn)
641 continue;
642
643 size = last_pfn - curr_pfn;
644 free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(size));
645 }
646
647 /* reserve memory before memory_start, including bootmap */
648 reserve_bootmem(PAGE_OFFSET,
649 memory_start + bootmap_size + PAGE_SIZE - 1 - PAGE_OFFSET,
650 BOOTMEM_DEFAULT);
651}
652
653void __init setup_arch(char **cmdline_p)
654{
655 unsigned long l1_length, sclk, cclk;
Yi Li856783b2008-02-09 02:26:01 +0800656
657#ifdef CONFIG_DUMMY_CONSOLE
658 conswitchp = &dummy_con;
659#endif
660
661#if defined(CONFIG_CMDLINE_BOOL)
662 strncpy(&command_line[0], CONFIG_CMDLINE, sizeof(command_line));
663 command_line[sizeof(command_line) - 1] = 0;
664#endif
665
666 /* Keep a copy of command line */
667 *cmdline_p = &command_line[0];
668 memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
669 boot_command_line[COMMAND_LINE_SIZE - 1] = '\0';
670
671 /* setup memory defaults from the user config */
672 physical_mem_end = 0;
673 _ramend = CONFIG_MEM_SIZE * 1024 * 1024;
674
675 memset(&bfin_memmap, 0, sizeof(bfin_memmap));
676
677 parse_cmdline_early(&command_line[0]);
678
679 if (physical_mem_end == 0)
680 physical_mem_end = _ramend;
681
682 memory_setup();
683
684 cclk = get_cclk();
685 sclk = get_sclk();
686
687#if !defined(CONFIG_BFIN_KERNEL_CLOCK)
688 if (ANOMALY_05000273 && cclk == sclk)
689 panic("ANOMALY 05000273, SCLK can not be same as CCLK");
690#endif
691
692#ifdef BF561_FAMILY
693 if (ANOMALY_05000266) {
694 bfin_read_IMDMA_D0_IRQ_STATUS();
695 bfin_read_IMDMA_D1_IRQ_STATUS();
696 }
697#endif
698 printk(KERN_INFO "Hardware Trace ");
699 if (bfin_read_TBUFCTL() & 0x1)
700 printk("Active ");
701 else
702 printk("Off ");
703 if (bfin_read_TBUFCTL() & 0x2)
704 printk("and Enabled\n");
705 else
706 printk("and Disabled\n");
707
708#if defined(CONFIG_CHR_DEV_FLASH) || defined(CONFIG_BLK_DEV_FLASH)
709 /* we need to initialize the Flashrom device here since we might
710 * do things with flash early on in the boot
711 */
712 flash_probe();
713#endif
714
Robin Getz7728ec32007-10-29 18:12:15 +0800715 _bfin_swrst = bfin_read_SWRST();
716
717 if (_bfin_swrst & RESET_DOUBLE)
718 printk(KERN_INFO "Recovering from Double Fault event\n");
719 else if (_bfin_swrst & RESET_WDOG)
720 printk(KERN_INFO "Recovering from Watchdog event\n");
721 else if (_bfin_swrst & RESET_SOFTWARE)
722 printk(KERN_NOTICE "Reset caused by Software reset\n");
723
Mike Frysinger550d5532008-02-02 15:55:37 +0800724 printk(KERN_INFO "Blackfin support (C) 2004-2008 Analog Devices, Inc.\n");
Jie Zhangde3025f2007-06-25 18:04:12 +0800725 if (bfin_compiled_revid() == 0xffff)
726 printk(KERN_INFO "Compiled for ADSP-%s Rev any\n", CPU);
727 else if (bfin_compiled_revid() == -1)
728 printk(KERN_INFO "Compiled for ADSP-%s Rev none\n", CPU);
729 else
730 printk(KERN_INFO "Compiled for ADSP-%s Rev 0.%d\n", CPU, bfin_compiled_revid());
731 if (bfin_revid() != bfin_compiled_revid()) {
732 if (bfin_compiled_revid() == -1)
733 printk(KERN_ERR "Warning: Compiled for Rev none, but running on Rev %d\n",
734 bfin_revid());
735 else if (bfin_compiled_revid() != 0xffff)
736 printk(KERN_ERR "Warning: Compiled for Rev %d, but running on Rev %d\n",
737 bfin_compiled_revid(), bfin_revid());
738 }
Bryan Wu1394f032007-05-06 14:50:22 -0700739 if (bfin_revid() < SUPPORTED_REVID)
740 printk(KERN_ERR "Warning: Unsupported Chip Revision ADSP-%s Rev 0.%d detected\n",
741 CPU, bfin_revid());
742 printk(KERN_INFO "Blackfin Linux support by http://blackfin.uclinux.org/\n");
743
Mike Frysingerb5c0e2e2007-09-12 17:31:59 +0800744 printk(KERN_INFO "Processor Speed: %lu MHz core clock and %lu MHz System Clock\n",
Bryan Wu1394f032007-05-06 14:50:22 -0700745 cclk / 1000000, sclk / 1000000);
746
Mike Frysinger1aafd902007-07-25 11:19:14 +0800747 if (ANOMALY_05000273 && (cclk >> 1) <= sclk)
Bryan Wu1394f032007-05-06 14:50:22 -0700748 printk("\n\n\nANOMALY_05000273: CCLK must be >= 2*SCLK !!!\n\n\n");
Bryan Wu1394f032007-05-06 14:50:22 -0700749
Yi Li856783b2008-02-09 02:26:01 +0800750 setup_bootmem_allocator();
Bryan Wu1394f032007-05-06 14:50:22 -0700751
Bryan Wu1394f032007-05-06 14:50:22 -0700752 paging_init();
753
754 /* check the size of the l1 area */
755 l1_length = _etext_l1 - _stext_l1;
756 if (l1_length > L1_CODE_LENGTH)
Michael Hennerich34e0fc82007-07-12 16:17:18 +0800757 panic("L1 code memory overflow\n");
Bryan Wu1394f032007-05-06 14:50:22 -0700758
759 l1_length = _ebss_l1 - _sdata_l1;
760 if (l1_length > L1_DATA_A_LENGTH)
Michael Hennerich34e0fc82007-07-12 16:17:18 +0800761 panic("L1 data memory overflow\n");
Bryan Wu1394f032007-05-06 14:50:22 -0700762
Bernd Schmidt7adfb582007-06-21 11:34:16 +0800763 /* Copy atomic sequences to their fixed location, and sanity check that
764 these locations are the ones that we advertise to userspace. */
765 memcpy((void *)FIXED_CODE_START, &fixed_code_start,
766 FIXED_CODE_END - FIXED_CODE_START);
767 BUG_ON((char *)&sigreturn_stub - (char *)&fixed_code_start
768 != SIGRETURN_STUB - FIXED_CODE_START);
769 BUG_ON((char *)&atomic_xchg32 - (char *)&fixed_code_start
770 != ATOMIC_XCHG32 - FIXED_CODE_START);
771 BUG_ON((char *)&atomic_cas32 - (char *)&fixed_code_start
772 != ATOMIC_CAS32 - FIXED_CODE_START);
773 BUG_ON((char *)&atomic_add32 - (char *)&fixed_code_start
774 != ATOMIC_ADD32 - FIXED_CODE_START);
775 BUG_ON((char *)&atomic_sub32 - (char *)&fixed_code_start
776 != ATOMIC_SUB32 - FIXED_CODE_START);
777 BUG_ON((char *)&atomic_ior32 - (char *)&fixed_code_start
778 != ATOMIC_IOR32 - FIXED_CODE_START);
779 BUG_ON((char *)&atomic_and32 - (char *)&fixed_code_start
780 != ATOMIC_AND32 - FIXED_CODE_START);
781 BUG_ON((char *)&atomic_xor32 - (char *)&fixed_code_start
782 != ATOMIC_XOR32 - FIXED_CODE_START);
Robin Getz9f336a52007-10-29 18:23:28 +0800783 BUG_ON((char *)&safe_user_instruction - (char *)&fixed_code_start
784 != SAFE_USER_INSTRUCTION - FIXED_CODE_START);
Bernd Schmidt29440a22007-07-12 16:25:29 +0800785
Bernd Schmidt8be80ed2007-07-25 14:44:49 +0800786 init_exception_vectors();
Bernd Schmidt29440a22007-07-12 16:25:29 +0800787 bf53x_cache_init();
Bryan Wu1394f032007-05-06 14:50:22 -0700788}
789
Bryan Wu1394f032007-05-06 14:50:22 -0700790static int __init topology_init(void)
791{
Michael Hennerich6cda2e92008-02-02 15:10:51 +0800792 int cpu;
793
794 for_each_possible_cpu(cpu) {
795 struct cpu *c = &per_cpu(cpu_devices, cpu);
796
797 register_cpu(c, cpu);
798 }
799
Bryan Wu1394f032007-05-06 14:50:22 -0700800 return 0;
Bryan Wu1394f032007-05-06 14:50:22 -0700801}
802
803subsys_initcall(topology_init);
804
Mike Frysinger52a07812007-06-11 15:31:30 +0800805static u_long get_vco(void)
Bryan Wu1394f032007-05-06 14:50:22 -0700806{
807 u_long msel;
808 u_long vco;
809
810 msel = (bfin_read_PLL_CTL() >> 9) & 0x3F;
811 if (0 == msel)
812 msel = 64;
813
814 vco = CONFIG_CLKIN_HZ;
815 vco >>= (1 & bfin_read_PLL_CTL()); /* DF bit */
816 vco = msel * vco;
817 return vco;
818}
819
Mike Frysinger2f6cf7b2007-10-21 22:59:49 +0800820/* Get the Core clock */
Bryan Wu1394f032007-05-06 14:50:22 -0700821u_long get_cclk(void)
822{
823 u_long csel, ssel;
824 if (bfin_read_PLL_STAT() & 0x1)
825 return CONFIG_CLKIN_HZ;
826
827 ssel = bfin_read_PLL_DIV();
828 csel = ((ssel >> 4) & 0x03);
829 ssel &= 0xf;
830 if (ssel && ssel < (1 << csel)) /* SCLK > CCLK */
831 return get_vco() / ssel;
832 return get_vco() >> csel;
833}
Bryan Wu1394f032007-05-06 14:50:22 -0700834EXPORT_SYMBOL(get_cclk);
835
836/* Get the System clock */
837u_long get_sclk(void)
838{
839 u_long ssel;
840
841 if (bfin_read_PLL_STAT() & 0x1)
842 return CONFIG_CLKIN_HZ;
843
844 ssel = (bfin_read_PLL_DIV() & 0xf);
845 if (0 == ssel) {
846 printk(KERN_WARNING "Invalid System Clock\n");
847 ssel = 1;
848 }
849
850 return get_vco() / ssel;
851}
Bryan Wu1394f032007-05-06 14:50:22 -0700852EXPORT_SYMBOL(get_sclk);
853
Mike Frysinger2f6cf7b2007-10-21 22:59:49 +0800854unsigned long sclk_to_usecs(unsigned long sclk)
855{
Mike Frysinger1754a5d2007-11-23 11:28:11 +0800856 u64 tmp = USEC_PER_SEC * (u64)sclk;
857 do_div(tmp, get_sclk());
858 return tmp;
Mike Frysinger2f6cf7b2007-10-21 22:59:49 +0800859}
860EXPORT_SYMBOL(sclk_to_usecs);
861
862unsigned long usecs_to_sclk(unsigned long usecs)
863{
Mike Frysinger1754a5d2007-11-23 11:28:11 +0800864 u64 tmp = get_sclk() * (u64)usecs;
865 do_div(tmp, USEC_PER_SEC);
866 return tmp;
Mike Frysinger2f6cf7b2007-10-21 22:59:49 +0800867}
868EXPORT_SYMBOL(usecs_to_sclk);
869
Bryan Wu1394f032007-05-06 14:50:22 -0700870/*
871 * Get CPU information for use by the procfs.
872 */
873static int show_cpuinfo(struct seq_file *m, void *v)
874{
Mike Frysinger066954a2007-10-21 22:36:06 +0800875 char *cpu, *mmu, *fpu, *vendor, *cache;
Bryan Wu1394f032007-05-06 14:50:22 -0700876 uint32_t revid;
877
878 u_long cclk = 0, sclk = 0;
879 u_int dcache_size = 0, dsup_banks = 0;
880
881 cpu = CPU;
882 mmu = "none";
883 fpu = "none";
884 revid = bfin_revid();
Bryan Wu1394f032007-05-06 14:50:22 -0700885
886 cclk = get_cclk();
887 sclk = get_sclk();
888
Robin Getz73b0c0b2007-10-21 17:03:31 +0800889 switch (bfin_read_CHIPID() & CHIPID_MANUFACTURE) {
Mike Frysinger066954a2007-10-21 22:36:06 +0800890 case 0xca:
891 vendor = "Analog Devices";
Robin Getz73b0c0b2007-10-21 17:03:31 +0800892 break;
893 default:
Mike Frysinger066954a2007-10-21 22:36:06 +0800894 vendor = "unknown";
895 break;
Robin Getz73b0c0b2007-10-21 17:03:31 +0800896 }
Bryan Wu1394f032007-05-06 14:50:22 -0700897
Robin Getz73b0c0b2007-10-21 17:03:31 +0800898 seq_printf(m, "processor\t: %d\n"
899 "vendor_id\t: %s\n"
900 "cpu family\t: 0x%x\n"
Robin Getz253bcf42008-04-24 05:57:13 +0800901 "model name\t: ADSP-%s %lu(MHz CCLK) %lu(MHz SCLK) (%s)\n"
Robin Getz73b0c0b2007-10-21 17:03:31 +0800902 "stepping\t: %d\n",
903 0,
904 vendor,
905 (bfin_read_CHIPID() & CHIPID_FAMILY),
906 cpu, cclk/1000000, sclk/1000000,
Robin Getz253bcf42008-04-24 05:57:13 +0800907#ifdef CONFIG_MPU
908 "mpu on",
909#else
910 "mpu off",
911#endif
Robin Getz73b0c0b2007-10-21 17:03:31 +0800912 revid);
Bryan Wu1394f032007-05-06 14:50:22 -0700913
Robin Getz73b0c0b2007-10-21 17:03:31 +0800914 seq_printf(m, "cpu MHz\t\t: %lu.%03lu/%lu.%03lu\n",
915 cclk/1000000, cclk%1000000,
916 sclk/1000000, sclk%1000000);
917 seq_printf(m, "bogomips\t: %lu.%02lu\n"
918 "Calibration\t: %lu loops\n",
919 (loops_per_jiffy * HZ) / 500000,
920 ((loops_per_jiffy * HZ) / 5000) % 100,
921 (loops_per_jiffy * HZ));
922
923 /* Check Cache configutation */
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800924 switch (bfin_read_DMEM_CONTROL() & (1 << DMC0_P | 1 << DMC1_P)) {
925 case ACACHE_BSRAM:
Mike Frysinger066954a2007-10-21 22:36:06 +0800926 cache = "dbank-A/B\t: cache/sram";
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800927 dcache_size = 16;
928 dsup_banks = 1;
929 break;
930 case ACACHE_BCACHE:
Mike Frysinger066954a2007-10-21 22:36:06 +0800931 cache = "dbank-A/B\t: cache/cache";
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800932 dcache_size = 32;
933 dsup_banks = 2;
934 break;
935 case ASRAM_BSRAM:
Mike Frysinger066954a2007-10-21 22:36:06 +0800936 cache = "dbank-A/B\t: sram/sram";
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800937 dcache_size = 0;
938 dsup_banks = 0;
939 break;
940 default:
Mike Frysinger066954a2007-10-21 22:36:06 +0800941 cache = "unknown";
Robin Getz73b0c0b2007-10-21 17:03:31 +0800942 dcache_size = 0;
943 dsup_banks = 0;
Bryan Wu1394f032007-05-06 14:50:22 -0700944 break;
945 }
946
Robin Getz73b0c0b2007-10-21 17:03:31 +0800947 /* Is it turned on? */
948 if (!((bfin_read_DMEM_CONTROL()) & (ENDCPLB | DMC_ENABLE)))
949 dcache_size = 0;
Bryan Wu1394f032007-05-06 14:50:22 -0700950
Robin Getz73b0c0b2007-10-21 17:03:31 +0800951 seq_printf(m, "cache size\t: %d KB(L1 icache) "
952 "%d KB(L1 dcache-%s) %d KB(L2 cache)\n",
953 BFIN_ICACHESIZE / 1024, dcache_size,
954#if defined CONFIG_BFIN_WB
955 "wb"
956#elif defined CONFIG_BFIN_WT
957 "wt"
958#endif
Mike Frysingerda27abb2007-10-22 10:55:35 +0800959 "", 0);
Robin Getz73b0c0b2007-10-21 17:03:31 +0800960
961 seq_printf(m, "%s\n", cache);
962
963 seq_printf(m, "icache setup\t: %d Sub-banks/%d Ways, %d Lines/Way\n",
Robin Getz3bebca22007-10-10 23:55:26 +0800964 BFIN_ISUBBANKS, BFIN_IWAYS, BFIN_ILINES);
Bryan Wu1394f032007-05-06 14:50:22 -0700965 seq_printf(m,
Robin Getz73b0c0b2007-10-21 17:03:31 +0800966 "dcache setup\t: %d Super-banks/%d Sub-banks/%d Ways, %d Lines/Way\n",
Robin Getz3bebca22007-10-10 23:55:26 +0800967 dsup_banks, BFIN_DSUBBANKS, BFIN_DWAYS,
968 BFIN_DLINES);
969#ifdef CONFIG_BFIN_ICACHE_LOCK
Bryan Wu1394f032007-05-06 14:50:22 -0700970 switch (read_iloc()) {
971 case WAY0_L:
972 seq_printf(m, "Way0 Locked-Down\n");
973 break;
974 case WAY1_L:
975 seq_printf(m, "Way1 Locked-Down\n");
976 break;
977 case WAY01_L:
978 seq_printf(m, "Way0,Way1 Locked-Down\n");
979 break;
980 case WAY2_L:
981 seq_printf(m, "Way2 Locked-Down\n");
982 break;
983 case WAY02_L:
984 seq_printf(m, "Way0,Way2 Locked-Down\n");
985 break;
986 case WAY12_L:
987 seq_printf(m, "Way1,Way2 Locked-Down\n");
988 break;
989 case WAY012_L:
990 seq_printf(m, "Way0,Way1 & Way2 Locked-Down\n");
991 break;
992 case WAY3_L:
993 seq_printf(m, "Way3 Locked-Down\n");
994 break;
995 case WAY03_L:
996 seq_printf(m, "Way0,Way3 Locked-Down\n");
997 break;
998 case WAY13_L:
999 seq_printf(m, "Way1,Way3 Locked-Down\n");
1000 break;
1001 case WAY013_L:
1002 seq_printf(m, "Way 0,Way1,Way3 Locked-Down\n");
1003 break;
1004 case WAY32_L:
1005 seq_printf(m, "Way3,Way2 Locked-Down\n");
1006 break;
1007 case WAY320_L:
1008 seq_printf(m, "Way3,Way2,Way0 Locked-Down\n");
1009 break;
1010 case WAY321_L:
1011 seq_printf(m, "Way3,Way2,Way1 Locked-Down\n");
1012 break;
1013 case WAYALL_L:
1014 seq_printf(m, "All Ways are locked\n");
1015 break;
1016 default:
1017 seq_printf(m, "No Ways are locked\n");
1018 }
1019#endif
Mike Frysinger066954a2007-10-21 22:36:06 +08001020 seq_printf(m, "board name\t: %s\n", bfin_board_name);
Robin Getz73b0c0b2007-10-21 17:03:31 +08001021 seq_printf(m, "board memory\t: %ld kB (0x%p -> 0x%p)\n",
1022 physical_mem_end >> 10, (void *)0, (void *)physical_mem_end);
1023 seq_printf(m, "kernel memory\t: %d kB (0x%p -> 0x%p)\n",
1024 ((int)memory_end - (int)_stext) >> 10,
1025 _stext,
1026 (void *)memory_end);
1027
Bryan Wu1394f032007-05-06 14:50:22 -07001028 return 0;
1029}
1030
1031static void *c_start(struct seq_file *m, loff_t *pos)
1032{
1033 return *pos < NR_CPUS ? ((void *)0x12345678) : NULL;
1034}
1035
1036static void *c_next(struct seq_file *m, void *v, loff_t *pos)
1037{
1038 ++*pos;
1039 return c_start(m, pos);
1040}
1041
1042static void c_stop(struct seq_file *m, void *v)
1043{
1044}
1045
Jan Engelhardt03a44822008-02-08 04:21:19 -08001046const struct seq_operations cpuinfo_op = {
Bryan Wu1394f032007-05-06 14:50:22 -07001047 .start = c_start,
1048 .next = c_next,
1049 .stop = c_stop,
1050 .show = show_cpuinfo,
1051};
1052
Mike Frysinger5e10b4a2007-06-11 16:44:09 +08001053void __init cmdline_init(const char *r0)
Bryan Wu1394f032007-05-06 14:50:22 -07001054{
1055 if (r0)
Mike Frysinger52a07812007-06-11 15:31:30 +08001056 strncpy(command_line, r0, COMMAND_LINE_SIZE);
Bryan Wu1394f032007-05-06 14:50:22 -07001057}