blob: 07c1cfdc958e883998830694d13a906b14d29fe2 [file] [log] [blame]
Bryan Wu1394f032007-05-06 14:50:22 -07001/*
2 * File: arch/blackfin/kernel/setup.c
3 * Based on:
4 * Author:
5 *
6 * Created:
7 * Description:
8 *
9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29
30#include <linux/delay.h>
31#include <linux/console.h>
32#include <linux/bootmem.h>
33#include <linux/seq_file.h>
34#include <linux/cpu.h>
35#include <linux/module.h>
Bryan Wu1394f032007-05-06 14:50:22 -070036#include <linux/tty.h>
37
38#include <linux/ext2_fs.h>
39#include <linux/cramfs_fs.h>
40#include <linux/romfs_fs.h>
41
42#include <asm/cacheflush.h>
43#include <asm/blackfin.h>
44#include <asm/cplbinit.h>
Bernd Schmidt7adfb582007-06-21 11:34:16 +080045#include <asm/fixed_code.h>
Bryan Wu1394f032007-05-06 14:50:22 -070046
Mike Frysingera9c59c22007-05-21 18:09:32 +080047u16 _bfin_swrst;
48
Bryan Wu1394f032007-05-06 14:50:22 -070049unsigned long memory_start, memory_end, physical_mem_end;
50unsigned long reserved_mem_dcache_on;
51unsigned long reserved_mem_icache_on;
52EXPORT_SYMBOL(memory_start);
53EXPORT_SYMBOL(memory_end);
54EXPORT_SYMBOL(physical_mem_end);
55EXPORT_SYMBOL(_ramend);
56
57#ifdef CONFIG_MTD_UCLINUX
58unsigned long memory_mtd_end, memory_mtd_start, mtd_size;
59unsigned long _ebss;
60EXPORT_SYMBOL(memory_mtd_end);
61EXPORT_SYMBOL(memory_mtd_start);
62EXPORT_SYMBOL(mtd_size);
63#endif
64
Mike Frysinger5e10b4a2007-06-11 16:44:09 +080065char __initdata command_line[COMMAND_LINE_SIZE];
Bryan Wu1394f032007-05-06 14:50:22 -070066
Bryan Wu1394f032007-05-06 14:50:22 -070067void __init bf53x_cache_init(void)
68{
69#if defined(CONFIG_BLKFIN_DCACHE) || defined(CONFIG_BLKFIN_CACHE)
70 generate_cpl_tables();
71#endif
72
73#ifdef CONFIG_BLKFIN_CACHE
74 bfin_icache_init();
75 printk(KERN_INFO "Instruction Cache Enabled\n");
76#endif
77
78#ifdef CONFIG_BLKFIN_DCACHE
79 bfin_dcache_init();
80 printk(KERN_INFO "Data Cache Enabled"
81# if defined CONFIG_BLKFIN_WB
82 " (write-back)"
83# elif defined CONFIG_BLKFIN_WT
84 " (write-through)"
85# endif
86 "\n");
87#endif
88}
89
Mike Frysinger52a07812007-06-11 15:31:30 +080090void __init bf53x_relocate_l1_mem(void)
Bryan Wu1394f032007-05-06 14:50:22 -070091{
92 unsigned long l1_code_length;
93 unsigned long l1_data_a_length;
94 unsigned long l1_data_b_length;
95
96 l1_code_length = _etext_l1 - _stext_l1;
97 if (l1_code_length > L1_CODE_LENGTH)
98 l1_code_length = L1_CODE_LENGTH;
99 /* cannot complain as printk is not available as yet.
100 * But we can continue booting and complain later!
101 */
102
103 /* Copy _stext_l1 to _etext_l1 to L1 instruction SRAM */
104 dma_memcpy(_stext_l1, _l1_lma_start, l1_code_length);
105
106 l1_data_a_length = _ebss_l1 - _sdata_l1;
107 if (l1_data_a_length > L1_DATA_A_LENGTH)
108 l1_data_a_length = L1_DATA_A_LENGTH;
109
110 /* Copy _sdata_l1 to _ebss_l1 to L1 data bank A SRAM */
111 dma_memcpy(_sdata_l1, _l1_lma_start + l1_code_length, l1_data_a_length);
112
113 l1_data_b_length = _ebss_b_l1 - _sdata_b_l1;
114 if (l1_data_b_length > L1_DATA_B_LENGTH)
115 l1_data_b_length = L1_DATA_B_LENGTH;
116
117 /* Copy _sdata_b_l1 to _ebss_b_l1 to L1 data bank B SRAM */
118 dma_memcpy(_sdata_b_l1, _l1_lma_start + l1_code_length +
119 l1_data_a_length, l1_data_b_length);
120
121}
122
123/*
124 * Initial parsing of the command line. Currently, we support:
125 * - Controlling the linux memory size: mem=xxx[KMG]
126 * - Controlling the physical memory size: max_mem=xxx[KMG][$][#]
127 * $ -> reserved memory is dcacheable
128 * # -> reserved memory is icacheable
129 */
130static __init void parse_cmdline_early(char *cmdline_p)
131{
132 char c = ' ', *to = cmdline_p;
133 unsigned int memsize;
134 for (;;) {
135 if (c == ' ') {
136
137 if (!memcmp(to, "mem=", 4)) {
138 to += 4;
139 memsize = memparse(to, &to);
140 if (memsize)
141 _ramend = memsize;
142
143 } else if (!memcmp(to, "max_mem=", 8)) {
144 to += 8;
145 memsize = memparse(to, &to);
146 if (memsize) {
147 physical_mem_end = memsize;
148 if (*to != ' ') {
149 if (*to == '$'
150 || *(to + 1) == '$')
151 reserved_mem_dcache_on =
152 1;
153 if (*to == '#'
154 || *(to + 1) == '#')
155 reserved_mem_icache_on =
156 1;
157 }
158 }
159 }
160
161 }
162 c = *(to++);
163 if (!c)
164 break;
165 }
166}
167
168void __init setup_arch(char **cmdline_p)
169{
170 int bootmap_size;
171 unsigned long l1_length, sclk, cclk;
172#ifdef CONFIG_MTD_UCLINUX
173 unsigned long mtd_phys = 0;
174#endif
175
Michael Hennerich6e537e92007-05-21 18:09:20 +0800176#ifdef CONFIG_DUMMY_CONSOLE
177 conswitchp = &dummy_con;
178#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700179 cclk = get_cclk();
180 sclk = get_sclk();
181
182#if !defined(CONFIG_BFIN_KERNEL_CLOCK) && defined(ANOMALY_05000273)
183 if (cclk == sclk)
184 panic("ANOMALY 05000273, SCLK can not be same as CCLK");
185#endif
186
187#if defined(ANOMALY_05000266)
188 bfin_read_IMDMA_D0_IRQ_STATUS();
189 bfin_read_IMDMA_D1_IRQ_STATUS();
190#endif
191
192#ifdef DEBUG_SERIAL_EARLY_INIT
193 bfin_console_init(); /* early console registration */
194 /* this give a chance to get printk() working before crash. */
195#endif
196
197#if defined(CONFIG_CHR_DEV_FLASH) || defined(CONFIG_BLK_DEV_FLASH)
198 /* we need to initialize the Flashrom device here since we might
199 * do things with flash early on in the boot
200 */
201 flash_probe();
202#endif
203
204#if defined(CONFIG_CMDLINE_BOOL)
Bryan Wu1394f032007-05-06 14:50:22 -0700205 strncpy(&command_line[0], CONFIG_CMDLINE, sizeof(command_line));
206 command_line[sizeof(command_line) - 1] = 0;
207#endif
208
209 /* Keep a copy of command line */
210 *cmdline_p = &command_line[0];
211 memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
Mike Frysinger5e10b4a2007-06-11 16:44:09 +0800212 boot_command_line[COMMAND_LINE_SIZE - 1] = '\0';
Bryan Wu1394f032007-05-06 14:50:22 -0700213
214 /* setup memory defaults from the user config */
215 physical_mem_end = 0;
216 _ramend = CONFIG_MEM_SIZE * 1024 * 1024;
217
218 parse_cmdline_early(&command_line[0]);
219
220 if (physical_mem_end == 0)
221 physical_mem_end = _ramend;
222
223 /* by now the stack is part of the init task */
224 memory_end = _ramend - DMA_UNCACHED_REGION;
225
226 _ramstart = (unsigned long)__bss_stop;
227 memory_start = PAGE_ALIGN(_ramstart);
228
229#if defined(CONFIG_MTD_UCLINUX)
230 /* generic memory mapped MTD driver */
231 memory_mtd_end = memory_end;
232
233 mtd_phys = _ramstart;
234 mtd_size = PAGE_ALIGN(*((unsigned long *)(mtd_phys + 8)));
235
236# if defined(CONFIG_EXT2_FS) || defined(CONFIG_EXT3_FS)
237 if (*((unsigned short *)(mtd_phys + 0x438)) == EXT2_SUPER_MAGIC)
238 mtd_size =
239 PAGE_ALIGN(*((unsigned long *)(mtd_phys + 0x404)) << 10);
240# endif
241
242# if defined(CONFIG_CRAMFS)
243 if (*((unsigned long *)(mtd_phys)) == CRAMFS_MAGIC)
244 mtd_size = PAGE_ALIGN(*((unsigned long *)(mtd_phys + 0x4)));
245# endif
246
247# if defined(CONFIG_ROMFS_FS)
248 if (((unsigned long *)mtd_phys)[0] == ROMSB_WORD0
249 && ((unsigned long *)mtd_phys)[1] == ROMSB_WORD1)
250 mtd_size =
251 PAGE_ALIGN(be32_to_cpu(((unsigned long *)mtd_phys)[2]));
252# if (defined(CONFIG_BLKFIN_CACHE) && defined(ANOMALY_05000263))
253 /* Due to a Hardware Anomaly we need to limit the size of usable
254 * instruction memory to max 60MB, 56 if HUNT_FOR_ZERO is on
255 * 05000263 - Hardware loop corrupted when taking an ICPLB exception
256 */
257# if (defined(CONFIG_DEBUG_HUNT_FOR_ZERO))
258 if (memory_end >= 56 * 1024 * 1024)
259 memory_end = 56 * 1024 * 1024;
260# else
261 if (memory_end >= 60 * 1024 * 1024)
262 memory_end = 60 * 1024 * 1024;
263# endif /* CONFIG_DEBUG_HUNT_FOR_ZERO */
264# endif /* ANOMALY_05000263 */
265# endif /* CONFIG_ROMFS_FS */
266
267 memory_end -= mtd_size;
268
269 if (mtd_size == 0) {
270 console_init();
271 panic("Don't boot kernel without rootfs attached.\n");
272 }
273
274 /* Relocate MTD image to the top of memory after the uncached memory area */
275 dma_memcpy((char *)memory_end, __bss_stop, mtd_size);
276
277 memory_mtd_start = memory_end;
278 _ebss = memory_mtd_start; /* define _ebss for compatible */
279#endif /* CONFIG_MTD_UCLINUX */
280
281#if (defined(CONFIG_BLKFIN_CACHE) && defined(ANOMALY_05000263))
282 /* Due to a Hardware Anomaly we need to limit the size of usable
283 * instruction memory to max 60MB, 56 if HUNT_FOR_ZERO is on
284 * 05000263 - Hardware loop corrupted when taking an ICPLB exception
285 */
286#if (defined(CONFIG_DEBUG_HUNT_FOR_ZERO))
287 if (memory_end >= 56 * 1024 * 1024)
288 memory_end = 56 * 1024 * 1024;
289#else
290 if (memory_end >= 60 * 1024 * 1024)
291 memory_end = 60 * 1024 * 1024;
292#endif /* CONFIG_DEBUG_HUNT_FOR_ZERO */
293 printk(KERN_NOTICE "Warning: limiting memory to %liMB due to hardware anomaly 05000263\n", memory_end >> 20);
294#endif /* ANOMALY_05000263 */
295
296#if !defined(CONFIG_MTD_UCLINUX)
297 memory_end -= SIZE_4K; /*In case there is no valid CPLB behind memory_end make sure we don't get to close*/
298#endif
299 init_mm.start_code = (unsigned long)_stext;
300 init_mm.end_code = (unsigned long)_etext;
301 init_mm.end_data = (unsigned long)_edata;
302 init_mm.brk = (unsigned long)0;
303
304 init_leds();
305
306 printk(KERN_INFO "Blackfin support (C) 2004-2007 Analog Devices, Inc.\n");
Jie Zhangde3025f2007-06-25 18:04:12 +0800307 if (bfin_compiled_revid() == 0xffff)
308 printk(KERN_INFO "Compiled for ADSP-%s Rev any\n", CPU);
309 else if (bfin_compiled_revid() == -1)
310 printk(KERN_INFO "Compiled for ADSP-%s Rev none\n", CPU);
311 else
312 printk(KERN_INFO "Compiled for ADSP-%s Rev 0.%d\n", CPU, bfin_compiled_revid());
313 if (bfin_revid() != bfin_compiled_revid()) {
314 if (bfin_compiled_revid() == -1)
315 printk(KERN_ERR "Warning: Compiled for Rev none, but running on Rev %d\n",
316 bfin_revid());
317 else if (bfin_compiled_revid() != 0xffff)
318 printk(KERN_ERR "Warning: Compiled for Rev %d, but running on Rev %d\n",
319 bfin_compiled_revid(), bfin_revid());
320 }
Bryan Wu1394f032007-05-06 14:50:22 -0700321 if (bfin_revid() < SUPPORTED_REVID)
322 printk(KERN_ERR "Warning: Unsupported Chip Revision ADSP-%s Rev 0.%d detected\n",
323 CPU, bfin_revid());
324 printk(KERN_INFO "Blackfin Linux support by http://blackfin.uclinux.org/\n");
325
326 printk(KERN_INFO "Processor Speed: %lu MHz core clock and %lu Mhz System Clock\n",
327 cclk / 1000000, sclk / 1000000);
328
329#if defined(ANOMALY_05000273)
330 if ((cclk >> 1) <= sclk)
331 printk("\n\n\nANOMALY_05000273: CCLK must be >= 2*SCLK !!!\n\n\n");
332#endif
333
334 printk(KERN_INFO "Board Memory: %ldMB\n", physical_mem_end >> 20);
335 printk(KERN_INFO "Kernel Managed Memory: %ldMB\n", _ramend >> 20);
336
337 printk(KERN_INFO "Memory map:\n"
338 KERN_INFO " text = 0x%p-0x%p\n"
Robin Getz86b73c82007-06-21 11:34:16 +0800339 KERN_INFO " rodata = 0x%p-0x%p\n"
Bryan Wu1394f032007-05-06 14:50:22 -0700340 KERN_INFO " data = 0x%p-0x%p\n"
Robin Getz86b73c82007-06-21 11:34:16 +0800341 KERN_INFO " stack = 0x%p-0x%p\n"
342 KERN_INFO " init = 0x%p-0x%p\n"
Bryan Wu1394f032007-05-06 14:50:22 -0700343 KERN_INFO " bss = 0x%p-0x%p\n"
344 KERN_INFO " available = 0x%p-0x%p\n"
345#ifdef CONFIG_MTD_UCLINUX
346 KERN_INFO " rootfs = 0x%p-0x%p\n"
347#endif
348#if DMA_UNCACHED_REGION > 0
349 KERN_INFO " DMA Zone = 0x%p-0x%p\n"
350#endif
351 , _stext, _etext,
Robin Getz86b73c82007-06-21 11:34:16 +0800352 __start_rodata, __end_rodata,
Bryan Wu1394f032007-05-06 14:50:22 -0700353 _sdata, _edata,
354 (void*)&init_thread_union, (void*)((int)(&init_thread_union) + 0x2000),
Robin Getz86b73c82007-06-21 11:34:16 +0800355 __init_begin, __init_end,
Bryan Wu1394f032007-05-06 14:50:22 -0700356 __bss_start, __bss_stop,
357 (void*)_ramstart, (void*)memory_end
358#ifdef CONFIG_MTD_UCLINUX
359 , (void*)memory_mtd_start, (void*)(memory_mtd_start + mtd_size)
360#endif
361#if DMA_UNCACHED_REGION > 0
362 , (void*)(_ramend - DMA_UNCACHED_REGION), (void*)(_ramend)
363#endif
364 );
365
366 /*
367 * give all the memory to the bootmap allocator, tell it to put the
368 * boot mem_map at the start of memory
369 */
370 bootmap_size = init_bootmem_node(NODE_DATA(0), memory_start >> PAGE_SHIFT, /* map goes here */
371 PAGE_OFFSET >> PAGE_SHIFT,
372 memory_end >> PAGE_SHIFT);
373 /*
374 * free the usable memory, we have to make sure we do not free
375 * the bootmem bitmap so we then reserve it after freeing it :-)
376 */
377 free_bootmem(memory_start, memory_end - memory_start);
378
379 reserve_bootmem(memory_start, bootmap_size);
380 /*
381 * get kmalloc into gear
382 */
383 paging_init();
384
385 /* check the size of the l1 area */
386 l1_length = _etext_l1 - _stext_l1;
387 if (l1_length > L1_CODE_LENGTH)
388 panic("L1 memory overflow\n");
389
390 l1_length = _ebss_l1 - _sdata_l1;
391 if (l1_length > L1_DATA_A_LENGTH)
392 panic("L1 memory overflow\n");
393
Mike Frysingera9c59c22007-05-21 18:09:32 +0800394#ifdef BF561_FAMILY
395 _bfin_swrst = bfin_read_SICA_SWRST();
396#else
397 _bfin_swrst = bfin_read_SWRST();
398#endif
399
Bryan Wu1394f032007-05-06 14:50:22 -0700400 printk(KERN_INFO "Hardware Trace Enabled\n");
401 bfin_write_TBUFCTL(0x03);
Bernd Schmidt7adfb582007-06-21 11:34:16 +0800402
403 /* Copy atomic sequences to their fixed location, and sanity check that
404 these locations are the ones that we advertise to userspace. */
405 memcpy((void *)FIXED_CODE_START, &fixed_code_start,
406 FIXED_CODE_END - FIXED_CODE_START);
407 BUG_ON((char *)&sigreturn_stub - (char *)&fixed_code_start
408 != SIGRETURN_STUB - FIXED_CODE_START);
409 BUG_ON((char *)&atomic_xchg32 - (char *)&fixed_code_start
410 != ATOMIC_XCHG32 - FIXED_CODE_START);
411 BUG_ON((char *)&atomic_cas32 - (char *)&fixed_code_start
412 != ATOMIC_CAS32 - FIXED_CODE_START);
413 BUG_ON((char *)&atomic_add32 - (char *)&fixed_code_start
414 != ATOMIC_ADD32 - FIXED_CODE_START);
415 BUG_ON((char *)&atomic_sub32 - (char *)&fixed_code_start
416 != ATOMIC_SUB32 - FIXED_CODE_START);
417 BUG_ON((char *)&atomic_ior32 - (char *)&fixed_code_start
418 != ATOMIC_IOR32 - FIXED_CODE_START);
419 BUG_ON((char *)&atomic_and32 - (char *)&fixed_code_start
420 != ATOMIC_AND32 - FIXED_CODE_START);
421 BUG_ON((char *)&atomic_xor32 - (char *)&fixed_code_start
422 != ATOMIC_XOR32 - FIXED_CODE_START);
Bernd Schmidt29440a22007-07-12 16:25:29 +0800423
424 bf53x_cache_init();
Bryan Wu1394f032007-05-06 14:50:22 -0700425}
426
Bryan Wu1394f032007-05-06 14:50:22 -0700427static int __init topology_init(void)
428{
429#if defined (CONFIG_BF561)
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800430 static struct cpu cpu[2];
Bryan Wu1394f032007-05-06 14:50:22 -0700431 register_cpu(&cpu[0], 0);
432 register_cpu(&cpu[1], 1);
433 return 0;
434#else
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800435 static struct cpu cpu[1];
Bryan Wu1394f032007-05-06 14:50:22 -0700436 return register_cpu(cpu, 0);
437#endif
438}
439
440subsys_initcall(topology_init);
441
Mike Frysinger52a07812007-06-11 15:31:30 +0800442static u_long get_vco(void)
Bryan Wu1394f032007-05-06 14:50:22 -0700443{
444 u_long msel;
445 u_long vco;
446
447 msel = (bfin_read_PLL_CTL() >> 9) & 0x3F;
448 if (0 == msel)
449 msel = 64;
450
451 vco = CONFIG_CLKIN_HZ;
452 vco >>= (1 & bfin_read_PLL_CTL()); /* DF bit */
453 vco = msel * vco;
454 return vco;
455}
456
457/*Get the Core clock*/
458u_long get_cclk(void)
459{
460 u_long csel, ssel;
461 if (bfin_read_PLL_STAT() & 0x1)
462 return CONFIG_CLKIN_HZ;
463
464 ssel = bfin_read_PLL_DIV();
465 csel = ((ssel >> 4) & 0x03);
466 ssel &= 0xf;
467 if (ssel && ssel < (1 << csel)) /* SCLK > CCLK */
468 return get_vco() / ssel;
469 return get_vco() >> csel;
470}
471
472EXPORT_SYMBOL(get_cclk);
473
474/* Get the System clock */
475u_long get_sclk(void)
476{
477 u_long ssel;
478
479 if (bfin_read_PLL_STAT() & 0x1)
480 return CONFIG_CLKIN_HZ;
481
482 ssel = (bfin_read_PLL_DIV() & 0xf);
483 if (0 == ssel) {
484 printk(KERN_WARNING "Invalid System Clock\n");
485 ssel = 1;
486 }
487
488 return get_vco() / ssel;
489}
490
491EXPORT_SYMBOL(get_sclk);
492
493/*
494 * Get CPU information for use by the procfs.
495 */
496static int show_cpuinfo(struct seq_file *m, void *v)
497{
498 char *cpu, *mmu, *fpu, *name;
499 uint32_t revid;
500
501 u_long cclk = 0, sclk = 0;
502 u_int dcache_size = 0, dsup_banks = 0;
503
504 cpu = CPU;
505 mmu = "none";
506 fpu = "none";
507 revid = bfin_revid();
508 name = bfin_board_name;
509
510 cclk = get_cclk();
511 sclk = get_sclk();
512
513 seq_printf(m, "CPU:\t\tADSP-%s Rev. 0.%d\n"
514 "MMU:\t\t%s\n"
515 "FPU:\t\t%s\n"
516 "Core Clock:\t%9lu Hz\n"
517 "System Clock:\t%9lu Hz\n"
518 "BogoMips:\t%lu.%02lu\n"
519 "Calibration:\t%lu loops\n",
520 cpu, revid, mmu, fpu,
521 cclk,
522 sclk,
523 (loops_per_jiffy * HZ) / 500000,
524 ((loops_per_jiffy * HZ) / 5000) % 100,
525 (loops_per_jiffy * HZ));
526 seq_printf(m, "Board Name:\t%s\n", name);
527 seq_printf(m, "Board Memory:\t%ld MB\n", physical_mem_end >> 20);
528 seq_printf(m, "Kernel Memory:\t%ld MB\n", (unsigned long)_ramend >> 20);
529 if (bfin_read_IMEM_CONTROL() & (ENICPLB | IMC))
530 seq_printf(m, "I-CACHE:\tON\n");
531 else
532 seq_printf(m, "I-CACHE:\tOFF\n");
533 if ((bfin_read_DMEM_CONTROL()) & (ENDCPLB | DMC_ENABLE))
534 seq_printf(m, "D-CACHE:\tON"
535#if defined CONFIG_BLKFIN_WB
536 " (write-back)"
537#elif defined CONFIG_BLKFIN_WT
538 " (write-through)"
539#endif
540 "\n");
541 else
542 seq_printf(m, "D-CACHE:\tOFF\n");
543
544
545 switch(bfin_read_DMEM_CONTROL() & (1 << DMC0_P | 1 << DMC1_P)) {
546 case ACACHE_BSRAM:
547 seq_printf(m, "DBANK-A:\tCACHE\n" "DBANK-B:\tSRAM\n");
548 dcache_size = 16;
549 dsup_banks = 1;
550 break;
551 case ACACHE_BCACHE:
552 seq_printf(m, "DBANK-A:\tCACHE\n" "DBANK-B:\tCACHE\n");
553 dcache_size = 32;
554 dsup_banks = 2;
555 break;
556 case ASRAM_BSRAM:
557 seq_printf(m, "DBANK-A:\tSRAM\n" "DBANK-B:\tSRAM\n");
558 dcache_size = 0;
559 dsup_banks = 0;
560 break;
561 default:
562 break;
563 }
564
565
566 seq_printf(m, "I-CACHE Size:\t%dKB\n", BLKFIN_ICACHESIZE / 1024);
567 seq_printf(m, "D-CACHE Size:\t%dKB\n", dcache_size);
568 seq_printf(m, "I-CACHE Setup:\t%d Sub-banks/%d Ways, %d Lines/Way\n",
569 BLKFIN_ISUBBANKS, BLKFIN_IWAYS, BLKFIN_ILINES);
570 seq_printf(m,
571 "D-CACHE Setup:\t%d Super-banks/%d Sub-banks/%d Ways, %d Lines/Way\n",
572 dsup_banks, BLKFIN_DSUBBANKS, BLKFIN_DWAYS,
573 BLKFIN_DLINES);
574#ifdef CONFIG_BLKFIN_CACHE_LOCK
575 switch (read_iloc()) {
576 case WAY0_L:
577 seq_printf(m, "Way0 Locked-Down\n");
578 break;
579 case WAY1_L:
580 seq_printf(m, "Way1 Locked-Down\n");
581 break;
582 case WAY01_L:
583 seq_printf(m, "Way0,Way1 Locked-Down\n");
584 break;
585 case WAY2_L:
586 seq_printf(m, "Way2 Locked-Down\n");
587 break;
588 case WAY02_L:
589 seq_printf(m, "Way0,Way2 Locked-Down\n");
590 break;
591 case WAY12_L:
592 seq_printf(m, "Way1,Way2 Locked-Down\n");
593 break;
594 case WAY012_L:
595 seq_printf(m, "Way0,Way1 & Way2 Locked-Down\n");
596 break;
597 case WAY3_L:
598 seq_printf(m, "Way3 Locked-Down\n");
599 break;
600 case WAY03_L:
601 seq_printf(m, "Way0,Way3 Locked-Down\n");
602 break;
603 case WAY13_L:
604 seq_printf(m, "Way1,Way3 Locked-Down\n");
605 break;
606 case WAY013_L:
607 seq_printf(m, "Way 0,Way1,Way3 Locked-Down\n");
608 break;
609 case WAY32_L:
610 seq_printf(m, "Way3,Way2 Locked-Down\n");
611 break;
612 case WAY320_L:
613 seq_printf(m, "Way3,Way2,Way0 Locked-Down\n");
614 break;
615 case WAY321_L:
616 seq_printf(m, "Way3,Way2,Way1 Locked-Down\n");
617 break;
618 case WAYALL_L:
619 seq_printf(m, "All Ways are locked\n");
620 break;
621 default:
622 seq_printf(m, "No Ways are locked\n");
623 }
624#endif
625 return 0;
626}
627
628static void *c_start(struct seq_file *m, loff_t *pos)
629{
630 return *pos < NR_CPUS ? ((void *)0x12345678) : NULL;
631}
632
633static void *c_next(struct seq_file *m, void *v, loff_t *pos)
634{
635 ++*pos;
636 return c_start(m, pos);
637}
638
639static void c_stop(struct seq_file *m, void *v)
640{
641}
642
643struct seq_operations cpuinfo_op = {
644 .start = c_start,
645 .next = c_next,
646 .stop = c_stop,
647 .show = show_cpuinfo,
648};
649
Mike Frysinger5e10b4a2007-06-11 16:44:09 +0800650void __init cmdline_init(const char *r0)
Bryan Wu1394f032007-05-06 14:50:22 -0700651{
652 if (r0)
Mike Frysinger52a07812007-06-11 15:31:30 +0800653 strncpy(command_line, r0, COMMAND_LINE_SIZE);
Bryan Wu1394f032007-05-06 14:50:22 -0700654}