setup.c 18 KB

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