2 * File: arch/blackfin/kernel/setup.c
10 * Copyright 2004-2006 Analog Devices Inc.
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
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.
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.
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
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>
36 #include <linux/console.h>
37 #include <linux/tty.h>
39 #include <linux/ext2_fs.h>
40 #include <linux/cramfs_fs.h>
41 #include <linux/romfs_fs.h>
43 #include <asm/cacheflush.h>
44 #include <asm/blackfin.h>
45 #include <asm/cplbinit.h>
47 unsigned long memory_start
, memory_end
, physical_mem_end
;
48 unsigned long reserved_mem_dcache_on
;
49 unsigned long reserved_mem_icache_on
;
50 EXPORT_SYMBOL(memory_start
);
51 EXPORT_SYMBOL(memory_end
);
52 EXPORT_SYMBOL(physical_mem_end
);
53 EXPORT_SYMBOL(_ramend
);
55 #ifdef CONFIG_MTD_UCLINUX
56 unsigned long memory_mtd_end
, memory_mtd_start
, mtd_size
;
58 EXPORT_SYMBOL(memory_mtd_end
);
59 EXPORT_SYMBOL(memory_mtd_start
);
60 EXPORT_SYMBOL(mtd_size
);
63 char command_line
[COMMAND_LINE_SIZE
];
65 #if defined(CONFIG_BLKFIN_DCACHE) || defined(CONFIG_BLKFIN_CACHE)
66 static void generate_cpl_tables(void);
69 void __init
bf53x_cache_init(void)
71 #if defined(CONFIG_BLKFIN_DCACHE) || defined(CONFIG_BLKFIN_CACHE)
72 generate_cpl_tables();
75 #ifdef CONFIG_BLKFIN_CACHE
77 printk(KERN_INFO
"Instruction Cache Enabled\n");
80 #ifdef CONFIG_BLKFIN_DCACHE
82 printk(KERN_INFO
"Data Cache Enabled"
83 # if defined CONFIG_BLKFIN_WB
85 # elif defined CONFIG_BLKFIN_WT
92 void bf53x_relocate_l1_mem(void)
94 unsigned long l1_code_length
;
95 unsigned long l1_data_a_length
;
96 unsigned long l1_data_b_length
;
98 l1_code_length
= _etext_l1
- _stext_l1
;
99 if (l1_code_length
> L1_CODE_LENGTH
)
100 l1_code_length
= L1_CODE_LENGTH
;
101 /* cannot complain as printk is not available as yet.
102 * But we can continue booting and complain later!
105 /* Copy _stext_l1 to _etext_l1 to L1 instruction SRAM */
106 dma_memcpy(_stext_l1
, _l1_lma_start
, l1_code_length
);
108 l1_data_a_length
= _ebss_l1
- _sdata_l1
;
109 if (l1_data_a_length
> L1_DATA_A_LENGTH
)
110 l1_data_a_length
= L1_DATA_A_LENGTH
;
112 /* Copy _sdata_l1 to _ebss_l1 to L1 data bank A SRAM */
113 dma_memcpy(_sdata_l1
, _l1_lma_start
+ l1_code_length
, l1_data_a_length
);
115 l1_data_b_length
= _ebss_b_l1
- _sdata_b_l1
;
116 if (l1_data_b_length
> L1_DATA_B_LENGTH
)
117 l1_data_b_length
= L1_DATA_B_LENGTH
;
119 /* Copy _sdata_b_l1 to _ebss_b_l1 to L1 data bank B SRAM */
120 dma_memcpy(_sdata_b_l1
, _l1_lma_start
+ l1_code_length
+
121 l1_data_a_length
, l1_data_b_length
);
126 * Initial parsing of the command line. Currently, we support:
127 * - Controlling the linux memory size: mem=xxx[KMG]
128 * - Controlling the physical memory size: max_mem=xxx[KMG][$][#]
129 * $ -> reserved memory is dcacheable
130 * # -> reserved memory is icacheable
132 static __init
void parse_cmdline_early(char *cmdline_p
)
134 char c
= ' ', *to
= cmdline_p
;
135 unsigned int memsize
;
139 if (!memcmp(to
, "mem=", 4)) {
141 memsize
= memparse(to
, &to
);
145 } else if (!memcmp(to
, "max_mem=", 8)) {
147 memsize
= memparse(to
, &to
);
149 physical_mem_end
= memsize
;
153 reserved_mem_dcache_on
=
157 reserved_mem_icache_on
=
170 void __init
setup_arch(char **cmdline_p
)
173 unsigned long l1_length
, sclk
, cclk
;
174 #ifdef CONFIG_MTD_UCLINUX
175 unsigned long mtd_phys
= 0;
181 #if !defined(CONFIG_BFIN_KERNEL_CLOCK) && defined(ANOMALY_05000273)
183 panic("ANOMALY 05000273, SCLK can not be same as CCLK");
186 #if defined(ANOMALY_05000266)
187 bfin_read_IMDMA_D0_IRQ_STATUS();
188 bfin_read_IMDMA_D1_IRQ_STATUS();
191 #ifdef DEBUG_SERIAL_EARLY_INIT
192 bfin_console_init(); /* early console registration */
193 /* this give a chance to get printk() working before crash. */
196 #if defined(CONFIG_CHR_DEV_FLASH) || defined(CONFIG_BLK_DEV_FLASH)
197 /* we need to initialize the Flashrom device here since we might
198 * do things with flash early on in the boot
203 #if defined(CONFIG_CMDLINE_BOOL)
204 memset(command_line
, 0, sizeof(command_line
));
205 strncpy(&command_line
[0], CONFIG_CMDLINE
, sizeof(command_line
));
206 command_line
[sizeof(command_line
) - 1] = 0;
209 /* Keep a copy of command line */
210 *cmdline_p
= &command_line
[0];
211 memcpy(boot_command_line
, command_line
, COMMAND_LINE_SIZE
);
212 boot_command_line
[COMMAND_LINE_SIZE
- 1] = 0;
214 /* setup memory defaults from the user config */
215 physical_mem_end
= 0;
216 _ramend
= CONFIG_MEM_SIZE
* 1024 * 1024;
218 parse_cmdline_early(&command_line
[0]);
220 if (physical_mem_end
== 0)
221 physical_mem_end
= _ramend
;
223 /* by now the stack is part of the init task */
224 memory_end
= _ramend
- DMA_UNCACHED_REGION
;
226 _ramstart
= (unsigned long)__bss_stop
;
227 memory_start
= PAGE_ALIGN(_ramstart
);
229 #if defined(CONFIG_MTD_UCLINUX)
230 /* generic memory mapped MTD driver */
231 memory_mtd_end
= memory_end
;
233 mtd_phys
= _ramstart
;
234 mtd_size
= PAGE_ALIGN(*((unsigned long *)(mtd_phys
+ 8)));
236 # if defined(CONFIG_EXT2_FS) || defined(CONFIG_EXT3_FS)
237 if (*((unsigned short *)(mtd_phys
+ 0x438)) == EXT2_SUPER_MAGIC
)
239 PAGE_ALIGN(*((unsigned long *)(mtd_phys
+ 0x404)) << 10);
242 # if defined(CONFIG_CRAMFS)
243 if (*((unsigned long *)(mtd_phys
)) == CRAMFS_MAGIC
)
244 mtd_size
= PAGE_ALIGN(*((unsigned long *)(mtd_phys
+ 0x4)));
247 # if defined(CONFIG_ROMFS_FS)
248 if (((unsigned long *)mtd_phys
)[0] == ROMSB_WORD0
249 && ((unsigned long *)mtd_phys
)[1] == ROMSB_WORD1
)
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
257 # if (defined(CONFIG_DEBUG_HUNT_FOR_ZERO))
258 if (memory_end
>= 56 * 1024 * 1024)
259 memory_end
= 56 * 1024 * 1024;
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 */
267 memory_end
-= mtd_size
;
271 panic("Don't boot kernel without rootfs attached.\n");
274 /* Relocate MTD image to the top of memory after the uncached memory area */
275 dma_memcpy((char *)memory_end
, __bss_stop
, mtd_size
);
277 memory_mtd_start
= memory_end
;
278 _ebss
= memory_mtd_start
; /* define _ebss for compatible */
279 #endif /* CONFIG_MTD_UCLINUX */
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
286 #if (defined(CONFIG_DEBUG_HUNT_FOR_ZERO))
287 if (memory_end
>= 56 * 1024 * 1024)
288 memory_end
= 56 * 1024 * 1024;
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 */
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*/
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;
306 printk(KERN_INFO
"Blackfin support (C) 2004-2007 Analog Devices, Inc.\n");
307 printk(KERN_INFO
"Compiled for ADSP-%s Rev 0.%d\n", CPU
, bfin_compiled_revid());
308 if (bfin_revid() != bfin_compiled_revid())
309 printk(KERN_ERR
"Warning: Compiled for Rev %d, but running on Rev %d\n",
310 bfin_compiled_revid(), bfin_revid());
311 if (bfin_revid() < SUPPORTED_REVID
)
312 printk(KERN_ERR
"Warning: Unsupported Chip Revision ADSP-%s Rev 0.%d detected\n",
314 printk(KERN_INFO
"Blackfin Linux support by http://blackfin.uclinux.org/\n");
316 printk(KERN_INFO
"Processor Speed: %lu MHz core clock and %lu Mhz System Clock\n",
317 cclk
/ 1000000, sclk
/ 1000000);
319 #if defined(ANOMALY_05000273)
320 if ((cclk
>> 1) <= sclk
)
321 printk("\n\n\nANOMALY_05000273: CCLK must be >= 2*SCLK !!!\n\n\n");
324 printk(KERN_INFO
"Board Memory: %ldMB\n", physical_mem_end
>> 20);
325 printk(KERN_INFO
"Kernel Managed Memory: %ldMB\n", _ramend
>> 20);
327 printk(KERN_INFO
"Memory map:\n"
328 KERN_INFO
" text = 0x%p-0x%p\n"
329 KERN_INFO
" init = 0x%p-0x%p\n"
330 KERN_INFO
" data = 0x%p-0x%p\n"
331 KERN_INFO
" stack = 0x%p-0x%p\n"
332 KERN_INFO
" bss = 0x%p-0x%p\n"
333 KERN_INFO
" available = 0x%p-0x%p\n"
334 #ifdef CONFIG_MTD_UCLINUX
335 KERN_INFO
" rootfs = 0x%p-0x%p\n"
337 #if DMA_UNCACHED_REGION > 0
338 KERN_INFO
" DMA Zone = 0x%p-0x%p\n"
341 __init_begin
, __init_end
,
343 (void*)&init_thread_union
, (void*)((int)(&init_thread_union
) + 0x2000),
344 __bss_start
, __bss_stop
,
345 (void*)_ramstart
, (void*)memory_end
346 #ifdef CONFIG_MTD_UCLINUX
347 , (void*)memory_mtd_start
, (void*)(memory_mtd_start
+ mtd_size
)
349 #if DMA_UNCACHED_REGION > 0
350 , (void*)(_ramend
- DMA_UNCACHED_REGION
), (void*)(_ramend
)
355 * give all the memory to the bootmap allocator, tell it to put the
356 * boot mem_map at the start of memory
358 bootmap_size
= init_bootmem_node(NODE_DATA(0), memory_start
>> PAGE_SHIFT
, /* map goes here */
359 PAGE_OFFSET
>> PAGE_SHIFT
,
360 memory_end
>> PAGE_SHIFT
);
362 * free the usable memory, we have to make sure we do not free
363 * the bootmem bitmap so we then reserve it after freeing it :-)
365 free_bootmem(memory_start
, memory_end
- memory_start
);
367 reserve_bootmem(memory_start
, bootmap_size
);
369 * get kmalloc into gear
373 /* check the size of the l1 area */
374 l1_length
= _etext_l1
- _stext_l1
;
375 if (l1_length
> L1_CODE_LENGTH
)
376 panic("L1 memory overflow\n");
378 l1_length
= _ebss_l1
- _sdata_l1
;
379 if (l1_length
> L1_DATA_A_LENGTH
)
380 panic("L1 memory overflow\n");
384 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
385 # if defined(CONFIG_BFIN_SHARED_FLASH_ENET) && defined(CONFIG_BFIN533_STAMP)
386 /* setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC */
387 bfin_write_FIO_DIR(bfin_read_FIO_DIR() | (1 << CONFIG_ENET_FLASH_PIN
));
388 bfin_write_FIO_FLAG_S(1 << CONFIG_ENET_FLASH_PIN
);
391 # if defined (CONFIG_BFIN561_EZKIT)
392 bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 12));
394 # endif /* defined (CONFIG_BFIN561_EZKIT) */
397 printk(KERN_INFO
"Hardware Trace Enabled\n");
398 bfin_write_TBUFCTL(0x03);
401 #if defined(CONFIG_BF561)
402 static struct cpu cpu
[2];
404 static struct cpu cpu
[1];
406 static int __init
topology_init(void)
408 #if defined (CONFIG_BF561)
409 register_cpu(&cpu
[0], 0);
410 register_cpu(&cpu
[1], 1);
413 return register_cpu(cpu
, 0);
417 subsys_initcall(topology_init
);
419 #if defined(CONFIG_BLKFIN_DCACHE) || defined(CONFIG_BLKFIN_CACHE)
420 u16
lock_kernel_check(u32 start
, u32 end
)
422 if ((start
<= (u32
) _stext
&& end
>= (u32
) _end
)
423 || (start
>= (u32
) _stext
&& end
<= (u32
) _end
))
428 static unsigned short __init
429 fill_cplbtab(struct cplb_tab
*table
,
430 unsigned long start
, unsigned long end
,
431 unsigned long block_size
, unsigned long cplb_data
)
435 switch (block_size
) {
451 cplb_data
= (cplb_data
& ~(3 << 16)) | (i
<< 16);
453 while ((start
< end
) && (table
->pos
< table
->size
)) {
455 table
->tab
[table
->pos
++] = start
;
457 if (lock_kernel_check(start
, start
+ block_size
) == IN_KERNEL
)
458 table
->tab
[table
->pos
++] =
459 cplb_data
| CPLB_LOCK
| CPLB_DIRTY
;
461 table
->tab
[table
->pos
++] = cplb_data
;
468 static unsigned short __init
469 close_cplbtab(struct cplb_tab
*table
)
472 while (table
->pos
< table
->size
) {
474 table
->tab
[table
->pos
++] = 0;
475 table
->tab
[table
->pos
++] = 0; /* !CPLB_VALID */
480 static void __init
generate_cpl_tables(void)
484 u32 a_start
, a_end
, as
, ae
, as_1m
;
486 struct cplb_tab
*t_i
= NULL
;
487 struct cplb_tab
*t_d
= NULL
;
490 cplb
.init_i
.size
= MAX_CPLBS
;
491 cplb
.init_d
.size
= MAX_CPLBS
;
492 cplb
.switch_i
.size
= MAX_SWITCH_I_CPLBS
;
493 cplb
.switch_d
.size
= MAX_SWITCH_D_CPLBS
;
497 cplb
.switch_i
.pos
= 0;
498 cplb
.switch_d
.pos
= 0;
500 cplb
.init_i
.tab
= icplb_table
;
501 cplb
.init_d
.tab
= dcplb_table
;
502 cplb
.switch_i
.tab
= ipdt_table
;
503 cplb
.switch_d
.tab
= dpdt_table
;
505 cplb_data
[SDRAM_KERN
].end
= memory_end
;
507 #ifdef CONFIG_MTD_UCLINUX
508 cplb_data
[SDRAM_RAM_MTD
].start
= memory_mtd_start
;
509 cplb_data
[SDRAM_RAM_MTD
].end
= memory_mtd_start
+ mtd_size
;
510 cplb_data
[SDRAM_RAM_MTD
].valid
= mtd_size
> 0;
511 # if defined(CONFIG_ROMFS_FS)
512 cplb_data
[SDRAM_RAM_MTD
].attr
|= I_CPLB
;
515 * The ROMFS_FS size is often not multiple of 1MB.
516 * This can cause multiple CPLB sets covering the same memory area.
517 * This will then cause multiple CPLB hit exceptions.
518 * Workaround: We ensure a contiguous memory area by extending the kernel
519 * memory section over the mtd section.
520 * For ROMFS_FS memory must be covered with ICPLBs anyways.
521 * So there is no difference between kernel and mtd memory setup.
524 cplb_data
[SDRAM_KERN
].end
= memory_mtd_start
+ mtd_size
;;
525 cplb_data
[SDRAM_RAM_MTD
].valid
= 0;
529 cplb_data
[SDRAM_RAM_MTD
].valid
= 0;
532 cplb_data
[SDRAM_DMAZ
].start
= _ramend
- DMA_UNCACHED_REGION
;
533 cplb_data
[SDRAM_DMAZ
].end
= _ramend
;
535 cplb_data
[RES_MEM
].start
= _ramend
;
536 cplb_data
[RES_MEM
].end
= physical_mem_end
;
538 if (reserved_mem_dcache_on
)
539 cplb_data
[RES_MEM
].d_conf
= SDRAM_DGENERIC
;
541 cplb_data
[RES_MEM
].d_conf
= SDRAM_DNON_CHBL
;
543 if (reserved_mem_icache_on
)
544 cplb_data
[RES_MEM
].i_conf
= SDRAM_IGENERIC
;
546 cplb_data
[RES_MEM
].i_conf
= SDRAM_INON_CHBL
;
548 for (i
= ZERO_P
; i
<= L2_MEM
; i
++) {
550 if (cplb_data
[i
].valid
) {
552 as_1m
= cplb_data
[i
].start
% SIZE_1M
;
554 /* We need to make sure all sections are properly 1M aligned
555 * However between Kernel Memory and the Kernel mtd section, depending on the
556 * rootfs size, there can be overlapping memory areas.
559 if (as_1m
&& i
!=L1I_MEM
&& i
!=L1D_MEM
) {
560 #ifdef CONFIG_MTD_UCLINUX
561 if (i
== SDRAM_RAM_MTD
) {
562 if ((cplb_data
[SDRAM_KERN
].end
+ 1) > cplb_data
[SDRAM_RAM_MTD
].start
)
563 cplb_data
[SDRAM_RAM_MTD
].start
= (cplb_data
[i
].start
& (-2*SIZE_1M
)) + SIZE_1M
;
565 cplb_data
[SDRAM_RAM_MTD
].start
= (cplb_data
[i
].start
& (-2*SIZE_1M
));
568 printk(KERN_WARNING
"Unaligned Start of %s at 0x%X\n",
569 cplb_data
[i
].name
, cplb_data
[i
].start
);
572 as
= cplb_data
[i
].start
% SIZE_4M
;
573 ae
= cplb_data
[i
].end
% SIZE_4M
;
576 a_start
= cplb_data
[i
].start
+ (SIZE_4M
- (as
));
578 a_start
= cplb_data
[i
].start
;
580 a_end
= cplb_data
[i
].end
- ae
;
582 for (j
= INITIAL_T
; j
<= SWITCH_T
; j
++) {
586 if (cplb_data
[i
].attr
& INITIAL_T
) {
594 if (cplb_data
[i
].attr
& SWITCH_T
) {
595 t_i
= &cplb
.switch_i
;
596 t_d
= &cplb
.switch_d
;
607 if (cplb_data
[i
].attr
& I_CPLB
) {
609 if (cplb_data
[i
].psize
) {
614 cplb_data
[i
].i_conf
);
617 #if (defined(CONFIG_BLKFIN_CACHE) && defined(ANOMALY_05000263))
618 if (i
== SDRAM_KERN
) {
623 cplb_data
[i
].i_conf
);
631 cplb_data
[i
].i_conf
);
636 cplb_data
[i
].i_conf
);
637 fill_cplbtab(t_i
, a_end
,
640 cplb_data
[i
].i_conf
);
645 if (cplb_data
[i
].attr
& D_CPLB
) {
647 if (cplb_data
[i
].psize
) {
652 cplb_data
[i
].d_conf
);
658 cplb_data
[i
].d_conf
);
659 fill_cplbtab(t_d
, a_start
,
661 cplb_data
[i
].d_conf
);
662 fill_cplbtab(t_d
, a_end
,
665 cplb_data
[i
].d_conf
);
678 close_cplbtab(&cplb
.init_i
);
679 close_cplbtab(&cplb
.init_d
);
681 cplb
.init_i
.tab
[cplb
.init_i
.pos
] = -1;
682 cplb
.init_d
.tab
[cplb
.init_d
.pos
] = -1;
683 cplb
.switch_i
.tab
[cplb
.switch_i
.pos
] = -1;
684 cplb
.switch_d
.tab
[cplb
.switch_d
.pos
] = -1;
690 static inline u_long
get_vco(void)
695 msel
= (bfin_read_PLL_CTL() >> 9) & 0x3F;
699 vco
= CONFIG_CLKIN_HZ
;
700 vco
>>= (1 & bfin_read_PLL_CTL()); /* DF bit */
705 /*Get the Core clock*/
706 u_long
get_cclk(void)
709 if (bfin_read_PLL_STAT() & 0x1)
710 return CONFIG_CLKIN_HZ
;
712 ssel
= bfin_read_PLL_DIV();
713 csel
= ((ssel
>> 4) & 0x03);
715 if (ssel
&& ssel
< (1 << csel
)) /* SCLK > CCLK */
716 return get_vco() / ssel
;
717 return get_vco() >> csel
;
720 EXPORT_SYMBOL(get_cclk
);
722 /* Get the System clock */
723 u_long
get_sclk(void)
727 if (bfin_read_PLL_STAT() & 0x1)
728 return CONFIG_CLKIN_HZ
;
730 ssel
= (bfin_read_PLL_DIV() & 0xf);
732 printk(KERN_WARNING
"Invalid System Clock\n");
736 return get_vco() / ssel
;
739 EXPORT_SYMBOL(get_sclk
);
742 * Get CPU information for use by the procfs.
744 static int show_cpuinfo(struct seq_file
*m
, void *v
)
746 char *cpu
, *mmu
, *fpu
, *name
;
749 u_long cclk
= 0, sclk
= 0;
750 u_int dcache_size
= 0, dsup_banks
= 0;
755 revid
= bfin_revid();
756 name
= bfin_board_name
;
761 seq_printf(m
, "CPU:\t\tADSP-%s Rev. 0.%d\n"
764 "Core Clock:\t%9lu Hz\n"
765 "System Clock:\t%9lu Hz\n"
766 "BogoMips:\t%lu.%02lu\n"
767 "Calibration:\t%lu loops\n",
768 cpu
, revid
, mmu
, fpu
,
771 (loops_per_jiffy
* HZ
) / 500000,
772 ((loops_per_jiffy
* HZ
) / 5000) % 100,
773 (loops_per_jiffy
* HZ
));
774 seq_printf(m
, "Board Name:\t%s\n", name
);
775 seq_printf(m
, "Board Memory:\t%ld MB\n", physical_mem_end
>> 20);
776 seq_printf(m
, "Kernel Memory:\t%ld MB\n", (unsigned long)_ramend
>> 20);
777 if (bfin_read_IMEM_CONTROL() & (ENICPLB
| IMC
))
778 seq_printf(m
, "I-CACHE:\tON\n");
780 seq_printf(m
, "I-CACHE:\tOFF\n");
781 if ((bfin_read_DMEM_CONTROL()) & (ENDCPLB
| DMC_ENABLE
))
782 seq_printf(m
, "D-CACHE:\tON"
783 #if defined CONFIG_BLKFIN_WB
785 #elif defined CONFIG_BLKFIN_WT
790 seq_printf(m
, "D-CACHE:\tOFF\n");
793 switch(bfin_read_DMEM_CONTROL() & (1 << DMC0_P
| 1 << DMC1_P
)) {
795 seq_printf(m
, "DBANK-A:\tCACHE\n" "DBANK-B:\tSRAM\n");
800 seq_printf(m
, "DBANK-A:\tCACHE\n" "DBANK-B:\tCACHE\n");
805 seq_printf(m
, "DBANK-A:\tSRAM\n" "DBANK-B:\tSRAM\n");
814 seq_printf(m
, "I-CACHE Size:\t%dKB\n", BLKFIN_ICACHESIZE
/ 1024);
815 seq_printf(m
, "D-CACHE Size:\t%dKB\n", dcache_size
);
816 seq_printf(m
, "I-CACHE Setup:\t%d Sub-banks/%d Ways, %d Lines/Way\n",
817 BLKFIN_ISUBBANKS
, BLKFIN_IWAYS
, BLKFIN_ILINES
);
819 "D-CACHE Setup:\t%d Super-banks/%d Sub-banks/%d Ways, %d Lines/Way\n",
820 dsup_banks
, BLKFIN_DSUBBANKS
, BLKFIN_DWAYS
,
822 #ifdef CONFIG_BLKFIN_CACHE_LOCK
823 switch (read_iloc()) {
825 seq_printf(m
, "Way0 Locked-Down\n");
828 seq_printf(m
, "Way1 Locked-Down\n");
831 seq_printf(m
, "Way0,Way1 Locked-Down\n");
834 seq_printf(m
, "Way2 Locked-Down\n");
837 seq_printf(m
, "Way0,Way2 Locked-Down\n");
840 seq_printf(m
, "Way1,Way2 Locked-Down\n");
843 seq_printf(m
, "Way0,Way1 & Way2 Locked-Down\n");
846 seq_printf(m
, "Way3 Locked-Down\n");
849 seq_printf(m
, "Way0,Way3 Locked-Down\n");
852 seq_printf(m
, "Way1,Way3 Locked-Down\n");
855 seq_printf(m
, "Way 0,Way1,Way3 Locked-Down\n");
858 seq_printf(m
, "Way3,Way2 Locked-Down\n");
861 seq_printf(m
, "Way3,Way2,Way0 Locked-Down\n");
864 seq_printf(m
, "Way3,Way2,Way1 Locked-Down\n");
867 seq_printf(m
, "All Ways are locked\n");
870 seq_printf(m
, "No Ways are locked\n");
876 static void *c_start(struct seq_file
*m
, loff_t
*pos
)
878 return *pos
< NR_CPUS
? ((void *)0x12345678) : NULL
;
881 static void *c_next(struct seq_file
*m
, void *v
, loff_t
*pos
)
884 return c_start(m
, pos
);
887 static void c_stop(struct seq_file
*m
, void *v
)
891 struct seq_operations cpuinfo_op
= {
895 .show
= show_cpuinfo
,
898 void cmdline_init(unsigned long r0
)
901 strncpy(command_line
, (char *)r0
, COMMAND_LINE_SIZE
);