setup.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. /*
  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. #include <linux/delay.h>
  30. #include <linux/console.h>
  31. #include <linux/bootmem.h>
  32. #include <linux/seq_file.h>
  33. #include <linux/cpu.h>
  34. #include <linux/module.h>
  35. #include <linux/tty.h>
  36. #include <linux/ext2_fs.h>
  37. #include <linux/cramfs_fs.h>
  38. #include <linux/romfs_fs.h>
  39. #include <asm/cplb.h>
  40. #include <asm/cacheflush.h>
  41. #include <asm/blackfin.h>
  42. #include <asm/cplbinit.h>
  43. #include <asm/fixed_code.h>
  44. u16 _bfin_swrst;
  45. unsigned long memory_start, memory_end, physical_mem_end;
  46. unsigned long reserved_mem_dcache_on;
  47. unsigned long reserved_mem_icache_on;
  48. EXPORT_SYMBOL(memory_start);
  49. EXPORT_SYMBOL(memory_end);
  50. EXPORT_SYMBOL(physical_mem_end);
  51. EXPORT_SYMBOL(_ramend);
  52. #ifdef CONFIG_MTD_UCLINUX
  53. unsigned long memory_mtd_end, memory_mtd_start, mtd_size;
  54. unsigned long _ebss;
  55. EXPORT_SYMBOL(memory_mtd_end);
  56. EXPORT_SYMBOL(memory_mtd_start);
  57. EXPORT_SYMBOL(mtd_size);
  58. #endif
  59. char __initdata command_line[COMMAND_LINE_SIZE];
  60. void __init bf53x_cache_init(void)
  61. {
  62. #if defined(CONFIG_BFIN_DCACHE) || defined(CONFIG_BFIN_ICACHE)
  63. generate_cpl_tables();
  64. #endif
  65. #ifdef CONFIG_BFIN_ICACHE
  66. bfin_icache_init();
  67. printk(KERN_INFO "Instruction Cache Enabled\n");
  68. #endif
  69. #ifdef CONFIG_BFIN_DCACHE
  70. bfin_dcache_init();
  71. printk(KERN_INFO "Data Cache Enabled"
  72. # if defined CONFIG_BFIN_WB
  73. " (write-back)"
  74. # elif defined CONFIG_BFIN_WT
  75. " (write-through)"
  76. # endif
  77. "\n");
  78. #endif
  79. }
  80. void __init bf53x_relocate_l1_mem(void)
  81. {
  82. unsigned long l1_code_length;
  83. unsigned long l1_data_a_length;
  84. unsigned long l1_data_b_length;
  85. l1_code_length = _etext_l1 - _stext_l1;
  86. if (l1_code_length > L1_CODE_LENGTH)
  87. l1_code_length = L1_CODE_LENGTH;
  88. /* cannot complain as printk is not available as yet.
  89. * But we can continue booting and complain later!
  90. */
  91. /* Copy _stext_l1 to _etext_l1 to L1 instruction SRAM */
  92. dma_memcpy(_stext_l1, _l1_lma_start, l1_code_length);
  93. l1_data_a_length = _ebss_l1 - _sdata_l1;
  94. if (l1_data_a_length > L1_DATA_A_LENGTH)
  95. l1_data_a_length = L1_DATA_A_LENGTH;
  96. /* Copy _sdata_l1 to _ebss_l1 to L1 data bank A SRAM */
  97. dma_memcpy(_sdata_l1, _l1_lma_start + l1_code_length, l1_data_a_length);
  98. l1_data_b_length = _ebss_b_l1 - _sdata_b_l1;
  99. if (l1_data_b_length > L1_DATA_B_LENGTH)
  100. l1_data_b_length = L1_DATA_B_LENGTH;
  101. /* Copy _sdata_b_l1 to _ebss_b_l1 to L1 data bank B SRAM */
  102. dma_memcpy(_sdata_b_l1, _l1_lma_start + l1_code_length +
  103. l1_data_a_length, l1_data_b_length);
  104. }
  105. /*
  106. * Initial parsing of the command line. Currently, we support:
  107. * - Controlling the linux memory size: mem=xxx[KMG]
  108. * - Controlling the physical memory size: max_mem=xxx[KMG][$][#]
  109. * $ -> reserved memory is dcacheable
  110. * # -> reserved memory is icacheable
  111. */
  112. static __init void parse_cmdline_early(char *cmdline_p)
  113. {
  114. char c = ' ', *to = cmdline_p;
  115. unsigned int memsize;
  116. for (;;) {
  117. if (c == ' ') {
  118. if (!memcmp(to, "mem=", 4)) {
  119. to += 4;
  120. memsize = memparse(to, &to);
  121. if (memsize)
  122. _ramend = memsize;
  123. } else if (!memcmp(to, "max_mem=", 8)) {
  124. to += 8;
  125. memsize = memparse(to, &to);
  126. if (memsize) {
  127. physical_mem_end = memsize;
  128. if (*to != ' ') {
  129. if (*to == '$'
  130. || *(to + 1) == '$')
  131. reserved_mem_dcache_on =
  132. 1;
  133. if (*to == '#'
  134. || *(to + 1) == '#')
  135. reserved_mem_icache_on =
  136. 1;
  137. }
  138. }
  139. }
  140. }
  141. c = *(to++);
  142. if (!c)
  143. break;
  144. }
  145. }
  146. void __init setup_arch(char **cmdline_p)
  147. {
  148. int bootmap_size;
  149. unsigned long l1_length, sclk, cclk;
  150. #ifdef CONFIG_MTD_UCLINUX
  151. unsigned long mtd_phys = 0;
  152. #endif
  153. #ifdef CONFIG_DUMMY_CONSOLE
  154. conswitchp = &dummy_con;
  155. #endif
  156. cclk = get_cclk();
  157. sclk = get_sclk();
  158. #if !defined(CONFIG_BFIN_KERNEL_CLOCK)
  159. if (ANOMALY_05000273 && cclk == sclk)
  160. panic("ANOMALY 05000273, SCLK can not be same as CCLK");
  161. #endif
  162. #ifdef BF561_FAMILY
  163. if (ANOMALY_05000266) {
  164. bfin_read_IMDMA_D0_IRQ_STATUS();
  165. bfin_read_IMDMA_D1_IRQ_STATUS();
  166. }
  167. #endif
  168. printk(KERN_INFO "Hardware Trace ");
  169. if (bfin_read_TBUFCTL() & 0x1 )
  170. printk("Active ");
  171. else
  172. printk("Off ");
  173. if (bfin_read_TBUFCTL() & 0x2)
  174. printk("and Enabled\n");
  175. else
  176. printk("and Disabled\n");
  177. #if defined(CONFIG_CHR_DEV_FLASH) || defined(CONFIG_BLK_DEV_FLASH)
  178. /* we need to initialize the Flashrom device here since we might
  179. * do things with flash early on in the boot
  180. */
  181. flash_probe();
  182. #endif
  183. #if defined(CONFIG_CMDLINE_BOOL)
  184. strncpy(&command_line[0], CONFIG_CMDLINE, sizeof(command_line));
  185. command_line[sizeof(command_line) - 1] = 0;
  186. #endif
  187. /* Keep a copy of command line */
  188. *cmdline_p = &command_line[0];
  189. memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
  190. boot_command_line[COMMAND_LINE_SIZE - 1] = '\0';
  191. /* setup memory defaults from the user config */
  192. physical_mem_end = 0;
  193. _ramend = CONFIG_MEM_SIZE * 1024 * 1024;
  194. parse_cmdline_early(&command_line[0]);
  195. if (physical_mem_end == 0)
  196. physical_mem_end = _ramend;
  197. /* by now the stack is part of the init task */
  198. memory_end = _ramend - DMA_UNCACHED_REGION;
  199. _ramstart = (unsigned long)__bss_stop;
  200. memory_start = PAGE_ALIGN(_ramstart);
  201. #if defined(CONFIG_MTD_UCLINUX)
  202. /* generic memory mapped MTD driver */
  203. memory_mtd_end = memory_end;
  204. mtd_phys = _ramstart;
  205. mtd_size = PAGE_ALIGN(*((unsigned long *)(mtd_phys + 8)));
  206. # if defined(CONFIG_EXT2_FS) || defined(CONFIG_EXT3_FS)
  207. if (*((unsigned short *)(mtd_phys + 0x438)) == EXT2_SUPER_MAGIC)
  208. mtd_size =
  209. PAGE_ALIGN(*((unsigned long *)(mtd_phys + 0x404)) << 10);
  210. # endif
  211. # if defined(CONFIG_CRAMFS)
  212. if (*((unsigned long *)(mtd_phys)) == CRAMFS_MAGIC)
  213. mtd_size = PAGE_ALIGN(*((unsigned long *)(mtd_phys + 0x4)));
  214. # endif
  215. # if defined(CONFIG_ROMFS_FS)
  216. if (((unsigned long *)mtd_phys)[0] == ROMSB_WORD0
  217. && ((unsigned long *)mtd_phys)[1] == ROMSB_WORD1)
  218. mtd_size =
  219. PAGE_ALIGN(be32_to_cpu(((unsigned long *)mtd_phys)[2]));
  220. # if (defined(CONFIG_BFIN_ICACHE) && ANOMALY_05000263)
  221. /* Due to a Hardware Anomaly we need to limit the size of usable
  222. * instruction memory to max 60MB, 56 if HUNT_FOR_ZERO is on
  223. * 05000263 - Hardware loop corrupted when taking an ICPLB exception
  224. */
  225. # if (defined(CONFIG_DEBUG_HUNT_FOR_ZERO))
  226. if (memory_end >= 56 * 1024 * 1024)
  227. memory_end = 56 * 1024 * 1024;
  228. # else
  229. if (memory_end >= 60 * 1024 * 1024)
  230. memory_end = 60 * 1024 * 1024;
  231. # endif /* CONFIG_DEBUG_HUNT_FOR_ZERO */
  232. # endif /* ANOMALY_05000263 */
  233. # endif /* CONFIG_ROMFS_FS */
  234. memory_end -= mtd_size;
  235. if (mtd_size == 0) {
  236. console_init();
  237. panic("Don't boot kernel without rootfs attached.\n");
  238. }
  239. /* Relocate MTD image to the top of memory after the uncached memory area */
  240. dma_memcpy((char *)memory_end, __bss_stop, mtd_size);
  241. memory_mtd_start = memory_end;
  242. _ebss = memory_mtd_start; /* define _ebss for compatible */
  243. #endif /* CONFIG_MTD_UCLINUX */
  244. #if (defined(CONFIG_BFIN_ICACHE) && ANOMALY_05000263)
  245. /* Due to a Hardware Anomaly we need to limit the size of usable
  246. * instruction memory to max 60MB, 56 if HUNT_FOR_ZERO is on
  247. * 05000263 - Hardware loop corrupted when taking an ICPLB exception
  248. */
  249. #if (defined(CONFIG_DEBUG_HUNT_FOR_ZERO))
  250. if (memory_end >= 56 * 1024 * 1024)
  251. memory_end = 56 * 1024 * 1024;
  252. #else
  253. if (memory_end >= 60 * 1024 * 1024)
  254. memory_end = 60 * 1024 * 1024;
  255. #endif /* CONFIG_DEBUG_HUNT_FOR_ZERO */
  256. printk(KERN_NOTICE "Warning: limiting memory to %liMB due to hardware anomaly 05000263\n", memory_end >> 20);
  257. #endif /* ANOMALY_05000263 */
  258. #if !defined(CONFIG_MTD_UCLINUX)
  259. memory_end -= SIZE_4K; /*In case there is no valid CPLB behind memory_end make sure we don't get to close*/
  260. #endif
  261. init_mm.start_code = (unsigned long)_stext;
  262. init_mm.end_code = (unsigned long)_etext;
  263. init_mm.end_data = (unsigned long)_edata;
  264. init_mm.brk = (unsigned long)0;
  265. init_leds();
  266. printk(KERN_INFO "Blackfin support (C) 2004-2007 Analog Devices, Inc.\n");
  267. if (bfin_compiled_revid() == 0xffff)
  268. printk(KERN_INFO "Compiled for ADSP-%s Rev any\n", CPU);
  269. else if (bfin_compiled_revid() == -1)
  270. printk(KERN_INFO "Compiled for ADSP-%s Rev none\n", CPU);
  271. else
  272. printk(KERN_INFO "Compiled for ADSP-%s Rev 0.%d\n", CPU, bfin_compiled_revid());
  273. if (bfin_revid() != bfin_compiled_revid()) {
  274. if (bfin_compiled_revid() == -1)
  275. printk(KERN_ERR "Warning: Compiled for Rev none, but running on Rev %d\n",
  276. bfin_revid());
  277. else if (bfin_compiled_revid() != 0xffff)
  278. printk(KERN_ERR "Warning: Compiled for Rev %d, but running on Rev %d\n",
  279. bfin_compiled_revid(), bfin_revid());
  280. }
  281. if (bfin_revid() < SUPPORTED_REVID)
  282. printk(KERN_ERR "Warning: Unsupported Chip Revision ADSP-%s Rev 0.%d detected\n",
  283. CPU, bfin_revid());
  284. printk(KERN_INFO "Blackfin Linux support by http://blackfin.uclinux.org/\n");
  285. printk(KERN_INFO "Processor Speed: %lu MHz core clock and %lu Mhz System Clock\n",
  286. cclk / 1000000, sclk / 1000000);
  287. if (ANOMALY_05000273 && (cclk >> 1) <= sclk)
  288. printk("\n\n\nANOMALY_05000273: CCLK must be >= 2*SCLK !!!\n\n\n");
  289. printk(KERN_INFO "Board Memory: %ldMB\n", physical_mem_end >> 20);
  290. printk(KERN_INFO "Kernel Managed Memory: %ldMB\n", _ramend >> 20);
  291. printk(KERN_INFO "Memory map:\n"
  292. KERN_INFO " text = 0x%p-0x%p\n"
  293. KERN_INFO " rodata = 0x%p-0x%p\n"
  294. KERN_INFO " data = 0x%p-0x%p\n"
  295. KERN_INFO " stack = 0x%p-0x%p\n"
  296. KERN_INFO " init = 0x%p-0x%p\n"
  297. KERN_INFO " bss = 0x%p-0x%p\n"
  298. KERN_INFO " available = 0x%p-0x%p\n"
  299. #ifdef CONFIG_MTD_UCLINUX
  300. KERN_INFO " rootfs = 0x%p-0x%p\n"
  301. #endif
  302. #if DMA_UNCACHED_REGION > 0
  303. KERN_INFO " DMA Zone = 0x%p-0x%p\n"
  304. #endif
  305. , _stext, _etext,
  306. __start_rodata, __end_rodata,
  307. _sdata, _edata,
  308. (void *)&init_thread_union, (void *)((int)(&init_thread_union) + 0x2000),
  309. __init_begin, __init_end,
  310. __bss_start, __bss_stop,
  311. (void *)_ramstart, (void *)memory_end
  312. #ifdef CONFIG_MTD_UCLINUX
  313. , (void *)memory_mtd_start, (void *)(memory_mtd_start + mtd_size)
  314. #endif
  315. #if DMA_UNCACHED_REGION > 0
  316. , (void *)(_ramend - DMA_UNCACHED_REGION), (void *)(_ramend)
  317. #endif
  318. );
  319. /*
  320. * give all the memory to the bootmap allocator, tell it to put the
  321. * boot mem_map at the start of memory
  322. */
  323. bootmap_size = init_bootmem_node(NODE_DATA(0), memory_start >> PAGE_SHIFT, /* map goes here */
  324. PAGE_OFFSET >> PAGE_SHIFT,
  325. memory_end >> PAGE_SHIFT);
  326. /*
  327. * free the usable memory, we have to make sure we do not free
  328. * the bootmem bitmap so we then reserve it after freeing it :-)
  329. */
  330. free_bootmem(memory_start, memory_end - memory_start);
  331. reserve_bootmem(memory_start, bootmap_size);
  332. /*
  333. * get kmalloc into gear
  334. */
  335. paging_init();
  336. /* check the size of the l1 area */
  337. l1_length = _etext_l1 - _stext_l1;
  338. if (l1_length > L1_CODE_LENGTH)
  339. panic("L1 code memory overflow\n");
  340. l1_length = _ebss_l1 - _sdata_l1;
  341. if (l1_length > L1_DATA_A_LENGTH)
  342. panic("L1 data memory overflow\n");
  343. _bfin_swrst = bfin_read_SWRST();
  344. /* Copy atomic sequences to their fixed location, and sanity check that
  345. these locations are the ones that we advertise to userspace. */
  346. memcpy((void *)FIXED_CODE_START, &fixed_code_start,
  347. FIXED_CODE_END - FIXED_CODE_START);
  348. BUG_ON((char *)&sigreturn_stub - (char *)&fixed_code_start
  349. != SIGRETURN_STUB - FIXED_CODE_START);
  350. BUG_ON((char *)&atomic_xchg32 - (char *)&fixed_code_start
  351. != ATOMIC_XCHG32 - FIXED_CODE_START);
  352. BUG_ON((char *)&atomic_cas32 - (char *)&fixed_code_start
  353. != ATOMIC_CAS32 - FIXED_CODE_START);
  354. BUG_ON((char *)&atomic_add32 - (char *)&fixed_code_start
  355. != ATOMIC_ADD32 - FIXED_CODE_START);
  356. BUG_ON((char *)&atomic_sub32 - (char *)&fixed_code_start
  357. != ATOMIC_SUB32 - FIXED_CODE_START);
  358. BUG_ON((char *)&atomic_ior32 - (char *)&fixed_code_start
  359. != ATOMIC_IOR32 - FIXED_CODE_START);
  360. BUG_ON((char *)&atomic_and32 - (char *)&fixed_code_start
  361. != ATOMIC_AND32 - FIXED_CODE_START);
  362. BUG_ON((char *)&atomic_xor32 - (char *)&fixed_code_start
  363. != ATOMIC_XOR32 - FIXED_CODE_START);
  364. init_exception_vectors();
  365. bf53x_cache_init();
  366. }
  367. static int __init topology_init(void)
  368. {
  369. #if defined (CONFIG_BF561)
  370. static struct cpu cpu[2];
  371. register_cpu(&cpu[0], 0);
  372. register_cpu(&cpu[1], 1);
  373. return 0;
  374. #else
  375. static struct cpu cpu[1];
  376. return register_cpu(cpu, 0);
  377. #endif
  378. }
  379. subsys_initcall(topology_init);
  380. static u_long get_vco(void)
  381. {
  382. u_long msel;
  383. u_long vco;
  384. msel = (bfin_read_PLL_CTL() >> 9) & 0x3F;
  385. if (0 == msel)
  386. msel = 64;
  387. vco = CONFIG_CLKIN_HZ;
  388. vco >>= (1 & bfin_read_PLL_CTL()); /* DF bit */
  389. vco = msel * vco;
  390. return vco;
  391. }
  392. /*Get the Core clock*/
  393. u_long get_cclk(void)
  394. {
  395. u_long csel, ssel;
  396. if (bfin_read_PLL_STAT() & 0x1)
  397. return CONFIG_CLKIN_HZ;
  398. ssel = bfin_read_PLL_DIV();
  399. csel = ((ssel >> 4) & 0x03);
  400. ssel &= 0xf;
  401. if (ssel && ssel < (1 << csel)) /* SCLK > CCLK */
  402. return get_vco() / ssel;
  403. return get_vco() >> csel;
  404. }
  405. EXPORT_SYMBOL(get_cclk);
  406. /* Get the System clock */
  407. u_long get_sclk(void)
  408. {
  409. u_long ssel;
  410. if (bfin_read_PLL_STAT() & 0x1)
  411. return CONFIG_CLKIN_HZ;
  412. ssel = (bfin_read_PLL_DIV() & 0xf);
  413. if (0 == ssel) {
  414. printk(KERN_WARNING "Invalid System Clock\n");
  415. ssel = 1;
  416. }
  417. return get_vco() / ssel;
  418. }
  419. EXPORT_SYMBOL(get_sclk);
  420. /*
  421. * Get CPU information for use by the procfs.
  422. */
  423. static int show_cpuinfo(struct seq_file *m, void *v)
  424. {
  425. char *cpu, *mmu, *fpu, *name;
  426. uint32_t revid;
  427. u_long cclk = 0, sclk = 0;
  428. u_int dcache_size = 0, dsup_banks = 0;
  429. cpu = CPU;
  430. mmu = "none";
  431. fpu = "none";
  432. revid = bfin_revid();
  433. name = bfin_board_name;
  434. cclk = get_cclk();
  435. sclk = get_sclk();
  436. seq_printf(m, "CPU:\t\tADSP-%s Rev. 0.%d\n"
  437. "MMU:\t\t%s\n"
  438. "FPU:\t\t%s\n"
  439. "Core Clock:\t%9lu Hz\n"
  440. "System Clock:\t%9lu Hz\n"
  441. "BogoMips:\t%lu.%02lu\n"
  442. "Calibration:\t%lu loops\n",
  443. cpu, revid, mmu, fpu,
  444. cclk,
  445. sclk,
  446. (loops_per_jiffy * HZ) / 500000,
  447. ((loops_per_jiffy * HZ) / 5000) % 100,
  448. (loops_per_jiffy * HZ));
  449. seq_printf(m, "Board Name:\t%s\n", name);
  450. seq_printf(m, "Board Memory:\t%ld MB\n", physical_mem_end >> 20);
  451. seq_printf(m, "Kernel Memory:\t%ld MB\n", (unsigned long)_ramend >> 20);
  452. if (bfin_read_IMEM_CONTROL() & (ENICPLB | IMC))
  453. seq_printf(m, "I-CACHE:\tON\n");
  454. else
  455. seq_printf(m, "I-CACHE:\tOFF\n");
  456. if ((bfin_read_DMEM_CONTROL()) & (ENDCPLB | DMC_ENABLE))
  457. seq_printf(m, "D-CACHE:\tON"
  458. #if defined CONFIG_BFIN_WB
  459. " (write-back)"
  460. #elif defined CONFIG_BFIN_WT
  461. " (write-through)"
  462. #endif
  463. "\n");
  464. else
  465. seq_printf(m, "D-CACHE:\tOFF\n");
  466. switch (bfin_read_DMEM_CONTROL() & (1 << DMC0_P | 1 << DMC1_P)) {
  467. case ACACHE_BSRAM:
  468. seq_printf(m, "DBANK-A:\tCACHE\n" "DBANK-B:\tSRAM\n");
  469. dcache_size = 16;
  470. dsup_banks = 1;
  471. break;
  472. case ACACHE_BCACHE:
  473. seq_printf(m, "DBANK-A:\tCACHE\n" "DBANK-B:\tCACHE\n");
  474. dcache_size = 32;
  475. dsup_banks = 2;
  476. break;
  477. case ASRAM_BSRAM:
  478. seq_printf(m, "DBANK-A:\tSRAM\n" "DBANK-B:\tSRAM\n");
  479. dcache_size = 0;
  480. dsup_banks = 0;
  481. break;
  482. default:
  483. break;
  484. }
  485. seq_printf(m, "I-CACHE Size:\t%dKB\n", BFIN_ICACHESIZE / 1024);
  486. seq_printf(m, "D-CACHE Size:\t%dKB\n", dcache_size);
  487. seq_printf(m, "I-CACHE Setup:\t%d Sub-banks/%d Ways, %d Lines/Way\n",
  488. BFIN_ISUBBANKS, BFIN_IWAYS, BFIN_ILINES);
  489. seq_printf(m,
  490. "D-CACHE Setup:\t%d Super-banks/%d Sub-banks/%d Ways, %d Lines/Way\n",
  491. dsup_banks, BFIN_DSUBBANKS, BFIN_DWAYS,
  492. BFIN_DLINES);
  493. #ifdef CONFIG_BFIN_ICACHE_LOCK
  494. switch (read_iloc()) {
  495. case WAY0_L:
  496. seq_printf(m, "Way0 Locked-Down\n");
  497. break;
  498. case WAY1_L:
  499. seq_printf(m, "Way1 Locked-Down\n");
  500. break;
  501. case WAY01_L:
  502. seq_printf(m, "Way0,Way1 Locked-Down\n");
  503. break;
  504. case WAY2_L:
  505. seq_printf(m, "Way2 Locked-Down\n");
  506. break;
  507. case WAY02_L:
  508. seq_printf(m, "Way0,Way2 Locked-Down\n");
  509. break;
  510. case WAY12_L:
  511. seq_printf(m, "Way1,Way2 Locked-Down\n");
  512. break;
  513. case WAY012_L:
  514. seq_printf(m, "Way0,Way1 & Way2 Locked-Down\n");
  515. break;
  516. case WAY3_L:
  517. seq_printf(m, "Way3 Locked-Down\n");
  518. break;
  519. case WAY03_L:
  520. seq_printf(m, "Way0,Way3 Locked-Down\n");
  521. break;
  522. case WAY13_L:
  523. seq_printf(m, "Way1,Way3 Locked-Down\n");
  524. break;
  525. case WAY013_L:
  526. seq_printf(m, "Way 0,Way1,Way3 Locked-Down\n");
  527. break;
  528. case WAY32_L:
  529. seq_printf(m, "Way3,Way2 Locked-Down\n");
  530. break;
  531. case WAY320_L:
  532. seq_printf(m, "Way3,Way2,Way0 Locked-Down\n");
  533. break;
  534. case WAY321_L:
  535. seq_printf(m, "Way3,Way2,Way1 Locked-Down\n");
  536. break;
  537. case WAYALL_L:
  538. seq_printf(m, "All Ways are locked\n");
  539. break;
  540. default:
  541. seq_printf(m, "No Ways are locked\n");
  542. }
  543. #endif
  544. return 0;
  545. }
  546. static void *c_start(struct seq_file *m, loff_t *pos)
  547. {
  548. return *pos < NR_CPUS ? ((void *)0x12345678) : NULL;
  549. }
  550. static void *c_next(struct seq_file *m, void *v, loff_t *pos)
  551. {
  552. ++*pos;
  553. return c_start(m, pos);
  554. }
  555. static void c_stop(struct seq_file *m, void *v)
  556. {
  557. }
  558. struct seq_operations cpuinfo_op = {
  559. .start = c_start,
  560. .next = c_next,
  561. .stop = c_stop,
  562. .show = show_cpuinfo,
  563. };
  564. void __init cmdline_init(const char *r0)
  565. {
  566. if (r0)
  567. strncpy(command_line, r0, COMMAND_LINE_SIZE);
  568. }