setup.c 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191
  1. /* setup.c: FRV specific setup
  2. *
  3. * Copyright (C) 2003-5 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. * - Derived from arch/m68k/kernel/setup.c
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version
  10. * 2 of the License, or (at your option) any later version.
  11. */
  12. #include <linux/utsrelease.h>
  13. #include <linux/kernel.h>
  14. #include <linux/sched.h>
  15. #include <linux/delay.h>
  16. #include <linux/interrupt.h>
  17. #include <linux/fs.h>
  18. #include <linux/mm.h>
  19. #include <linux/fb.h>
  20. #include <linux/console.h>
  21. #include <linux/genhd.h>
  22. #include <linux/errno.h>
  23. #include <linux/string.h>
  24. #include <linux/major.h>
  25. #include <linux/bootmem.h>
  26. #include <linux/highmem.h>
  27. #include <linux/seq_file.h>
  28. #include <linux/serial.h>
  29. #include <linux/serial_core.h>
  30. #include <linux/serial_reg.h>
  31. #include <asm/setup.h>
  32. #include <asm/irq.h>
  33. #include <asm/sections.h>
  34. #include <asm/pgalloc.h>
  35. #include <asm/busctl-regs.h>
  36. #include <asm/serial-regs.h>
  37. #include <asm/timer-regs.h>
  38. #include <asm/irc-regs.h>
  39. #include <asm/spr-regs.h>
  40. #include <asm/mb-regs.h>
  41. #include <asm/mb93493-regs.h>
  42. #include <asm/gdb-stub.h>
  43. #include <asm/io.h>
  44. #ifdef CONFIG_BLK_DEV_INITRD
  45. #include <linux/blk.h>
  46. #include <asm/pgtable.h>
  47. #endif
  48. #include "local.h"
  49. #ifdef CONFIG_MB93090_MB00
  50. static void __init mb93090_display(void);
  51. #endif
  52. #ifdef CONFIG_MMU
  53. static void __init setup_linux_memory(void);
  54. #else
  55. static void __init setup_uclinux_memory(void);
  56. #endif
  57. #ifdef CONFIG_CONSOLE
  58. extern struct consw *conswitchp;
  59. #endif
  60. #ifdef CONFIG_MB93090_MB00
  61. static char __initdata mb93090_banner[] = "FJ/RH FR-V Linux";
  62. static char __initdata mb93090_version[] = UTS_RELEASE;
  63. int __nongprelbss mb93090_mb00_detected;
  64. #endif
  65. const char __frv_unknown_system[] = "unknown";
  66. const char __frv_mb93091_cb10[] = "mb93091-cb10";
  67. const char __frv_mb93091_cb11[] = "mb93091-cb11";
  68. const char __frv_mb93091_cb30[] = "mb93091-cb30";
  69. const char __frv_mb93091_cb41[] = "mb93091-cb41";
  70. const char __frv_mb93091_cb60[] = "mb93091-cb60";
  71. const char __frv_mb93091_cb70[] = "mb93091-cb70";
  72. const char __frv_mb93091_cb451[] = "mb93091-cb451";
  73. const char __frv_mb93090_mb00[] = "mb93090-mb00";
  74. const char __frv_mb93493[] = "mb93493";
  75. const char __frv_mb93093[] = "mb93093";
  76. static const char *__nongprelbss cpu_series;
  77. static const char *__nongprelbss cpu_core;
  78. static const char *__nongprelbss cpu_silicon;
  79. static const char *__nongprelbss cpu_mmu;
  80. static const char *__nongprelbss cpu_system;
  81. static const char *__nongprelbss cpu_board1;
  82. static const char *__nongprelbss cpu_board2;
  83. static unsigned long __nongprelbss cpu_psr_all;
  84. static unsigned long __nongprelbss cpu_hsr0_all;
  85. unsigned long __nongprelbss pdm_suspend_mode;
  86. unsigned long __nongprelbss rom_length;
  87. unsigned long __nongprelbss memory_start;
  88. unsigned long __nongprelbss memory_end;
  89. unsigned long __nongprelbss dma_coherent_mem_start;
  90. unsigned long __nongprelbss dma_coherent_mem_end;
  91. unsigned long __initdata __sdram_old_base;
  92. unsigned long __initdata num_mappedpages;
  93. struct cpuinfo_frv __nongprelbss boot_cpu_data;
  94. char command_line[COMMAND_LINE_SIZE];
  95. char __initdata redboot_command_line[COMMAND_LINE_SIZE];
  96. #ifdef CONFIG_PM
  97. #define __pminit
  98. #define __pminitdata
  99. #else
  100. #define __pminit __init
  101. #define __pminitdata __initdata
  102. #endif
  103. struct clock_cmode {
  104. uint8_t xbus, sdram, corebus, core, dsu;
  105. };
  106. #define _frac(N,D) ((N)<<4 | (D))
  107. #define _x0_16 _frac(1,6)
  108. #define _x0_25 _frac(1,4)
  109. #define _x0_33 _frac(1,3)
  110. #define _x0_375 _frac(3,8)
  111. #define _x0_5 _frac(1,2)
  112. #define _x0_66 _frac(2,3)
  113. #define _x0_75 _frac(3,4)
  114. #define _x1 _frac(1,1)
  115. #define _x1_5 _frac(3,2)
  116. #define _x2 _frac(2,1)
  117. #define _x3 _frac(3,1)
  118. #define _x4 _frac(4,1)
  119. #define _x4_5 _frac(9,2)
  120. #define _x6 _frac(6,1)
  121. #define _x8 _frac(8,1)
  122. #define _x9 _frac(9,1)
  123. int __nongprelbss clock_p0_current;
  124. int __nongprelbss clock_cm_current;
  125. int __nongprelbss clock_cmode_current;
  126. #ifdef CONFIG_PM
  127. int __nongprelbss clock_cmodes_permitted;
  128. unsigned long __nongprelbss clock_bits_settable;
  129. #endif
  130. static struct clock_cmode __pminitdata undef_clock_cmode = { _x1, _x1, _x1, _x1, _x1 };
  131. static struct clock_cmode __pminitdata clock_cmodes_fr401_fr403[16] = {
  132. [4] = { _x1, _x1, _x2, _x2, _x0_25 },
  133. [5] = { _x1, _x2, _x4, _x4, _x0_5 },
  134. [8] = { _x1, _x1, _x1, _x2, _x0_25 },
  135. [9] = { _x1, _x2, _x2, _x4, _x0_5 },
  136. [11] = { _x1, _x4, _x4, _x8, _x1 },
  137. [12] = { _x1, _x1, _x2, _x4, _x0_5 },
  138. [13] = { _x1, _x2, _x4, _x8, _x1 },
  139. };
  140. static struct clock_cmode __pminitdata clock_cmodes_fr405[16] = {
  141. [0] = { _x1, _x1, _x1, _x1, _x0_5 },
  142. [1] = { _x1, _x1, _x1, _x3, _x0_25 },
  143. [2] = { _x1, _x1, _x2, _x6, _x0_5 },
  144. [3] = { _x1, _x2, _x2, _x6, _x0_5 },
  145. [4] = { _x1, _x1, _x2, _x2, _x0_16 },
  146. [8] = { _x1, _x1, _x1, _x2, _x0_16 },
  147. [9] = { _x1, _x2, _x2, _x4, _x0_33 },
  148. [12] = { _x1, _x1, _x2, _x4, _x0_33 },
  149. [14] = { _x1, _x3, _x3, _x9, _x0_75 },
  150. [15] = { _x1, _x1_5, _x1_5, _x4_5, _x0_375 },
  151. #define CLOCK_CMODES_PERMITTED_FR405 0xd31f
  152. };
  153. static struct clock_cmode __pminitdata clock_cmodes_fr555[16] = {
  154. [0] = { _x1, _x2, _x2, _x4, _x0_33 },
  155. [1] = { _x1, _x3, _x3, _x6, _x0_5 },
  156. [2] = { _x1, _x2, _x4, _x8, _x0_66 },
  157. [3] = { _x1, _x1_5, _x3, _x6, _x0_5 },
  158. [4] = { _x1, _x3, _x3, _x9, _x0_75 },
  159. [5] = { _x1, _x2, _x2, _x6, _x0_5 },
  160. [6] = { _x1, _x1_5, _x1_5, _x4_5, _x0_375 },
  161. };
  162. static const struct clock_cmode __pminitdata *clock_cmodes;
  163. static int __pminitdata clock_doubled;
  164. static struct uart_port __initdata __frv_uart0 = {
  165. .uartclk = 0,
  166. .membase = (char *) UART0_BASE,
  167. .irq = IRQ_CPU_UART0,
  168. .regshift = 3,
  169. .iotype = UPIO_MEM,
  170. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  171. };
  172. static struct uart_port __initdata __frv_uart1 = {
  173. .uartclk = 0,
  174. .membase = (char *) UART1_BASE,
  175. .irq = IRQ_CPU_UART1,
  176. .regshift = 3,
  177. .iotype = UPIO_MEM,
  178. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  179. };
  180. #if 0
  181. static void __init printk_xampr(unsigned long ampr, unsigned long amlr, char i_d, int n)
  182. {
  183. unsigned long phys, virt, cxn, size;
  184. #ifdef CONFIG_MMU
  185. virt = amlr & 0xffffc000;
  186. cxn = amlr & 0x3fff;
  187. #else
  188. virt = ampr & 0xffffc000;
  189. cxn = 0;
  190. #endif
  191. phys = ampr & xAMPRx_PPFN;
  192. size = 1 << (((ampr & xAMPRx_SS) >> 4) + 17);
  193. printk("%cAMPR%d: va %08lx-%08lx [pa %08lx] %c%c%c%c [cxn:%04lx]\n",
  194. i_d, n,
  195. virt, virt + size - 1,
  196. phys,
  197. ampr & xAMPRx_S ? 'S' : '-',
  198. ampr & xAMPRx_C ? 'C' : '-',
  199. ampr & DAMPRx_WP ? 'W' : '-',
  200. ampr & xAMPRx_V ? 'V' : '-',
  201. cxn
  202. );
  203. }
  204. #endif
  205. /*****************************************************************************/
  206. /*
  207. * dump the memory map
  208. */
  209. static void __init dump_memory_map(void)
  210. {
  211. #if 0
  212. /* dump the protection map */
  213. printk_xampr(__get_IAMPR(0), __get_IAMLR(0), 'I', 0);
  214. printk_xampr(__get_IAMPR(1), __get_IAMLR(1), 'I', 1);
  215. printk_xampr(__get_IAMPR(2), __get_IAMLR(2), 'I', 2);
  216. printk_xampr(__get_IAMPR(3), __get_IAMLR(3), 'I', 3);
  217. printk_xampr(__get_IAMPR(4), __get_IAMLR(4), 'I', 4);
  218. printk_xampr(__get_IAMPR(5), __get_IAMLR(5), 'I', 5);
  219. printk_xampr(__get_IAMPR(6), __get_IAMLR(6), 'I', 6);
  220. printk_xampr(__get_IAMPR(7), __get_IAMLR(7), 'I', 7);
  221. printk_xampr(__get_IAMPR(8), __get_IAMLR(8), 'I', 8);
  222. printk_xampr(__get_IAMPR(9), __get_IAMLR(9), 'i', 9);
  223. printk_xampr(__get_IAMPR(10), __get_IAMLR(10), 'I', 10);
  224. printk_xampr(__get_IAMPR(11), __get_IAMLR(11), 'I', 11);
  225. printk_xampr(__get_IAMPR(12), __get_IAMLR(12), 'I', 12);
  226. printk_xampr(__get_IAMPR(13), __get_IAMLR(13), 'I', 13);
  227. printk_xampr(__get_IAMPR(14), __get_IAMLR(14), 'I', 14);
  228. printk_xampr(__get_IAMPR(15), __get_IAMLR(15), 'I', 15);
  229. printk_xampr(__get_DAMPR(0), __get_DAMLR(0), 'D', 0);
  230. printk_xampr(__get_DAMPR(1), __get_DAMLR(1), 'D', 1);
  231. printk_xampr(__get_DAMPR(2), __get_DAMLR(2), 'D', 2);
  232. printk_xampr(__get_DAMPR(3), __get_DAMLR(3), 'D', 3);
  233. printk_xampr(__get_DAMPR(4), __get_DAMLR(4), 'D', 4);
  234. printk_xampr(__get_DAMPR(5), __get_DAMLR(5), 'D', 5);
  235. printk_xampr(__get_DAMPR(6), __get_DAMLR(6), 'D', 6);
  236. printk_xampr(__get_DAMPR(7), __get_DAMLR(7), 'D', 7);
  237. printk_xampr(__get_DAMPR(8), __get_DAMLR(8), 'D', 8);
  238. printk_xampr(__get_DAMPR(9), __get_DAMLR(9), 'D', 9);
  239. printk_xampr(__get_DAMPR(10), __get_DAMLR(10), 'D', 10);
  240. printk_xampr(__get_DAMPR(11), __get_DAMLR(11), 'D', 11);
  241. printk_xampr(__get_DAMPR(12), __get_DAMLR(12), 'D', 12);
  242. printk_xampr(__get_DAMPR(13), __get_DAMLR(13), 'D', 13);
  243. printk_xampr(__get_DAMPR(14), __get_DAMLR(14), 'D', 14);
  244. printk_xampr(__get_DAMPR(15), __get_DAMLR(15), 'D', 15);
  245. #endif
  246. #if 0
  247. /* dump the bus controller registers */
  248. printk("LGCR: %08lx\n", __get_LGCR());
  249. printk("Master: %08lx-%08lx CR=%08lx\n",
  250. __get_LEMBR(), __get_LEMBR() + __get_LEMAM(),
  251. __get_LMAICR());
  252. int loop;
  253. for (loop = 1; loop <= 7; loop++) {
  254. unsigned long lcr = __get_LCR(loop), lsbr = __get_LSBR(loop);
  255. printk("CS#%d: %08lx-%08lx %c%c%c%c%c%c%c%c%c\n",
  256. loop,
  257. lsbr, lsbr + __get_LSAM(loop),
  258. lcr & 0x80000000 ? 'r' : '-',
  259. lcr & 0x40000000 ? 'w' : '-',
  260. lcr & 0x08000000 ? 'b' : '-',
  261. lcr & 0x04000000 ? 'B' : '-',
  262. lcr & 0x02000000 ? 'C' : '-',
  263. lcr & 0x01000000 ? 'D' : '-',
  264. lcr & 0x00800000 ? 'W' : '-',
  265. lcr & 0x00400000 ? 'R' : '-',
  266. (lcr & 0x00030000) == 0x00000000 ? '4' :
  267. (lcr & 0x00030000) == 0x00010000 ? '2' :
  268. (lcr & 0x00030000) == 0x00020000 ? '1' :
  269. '-'
  270. );
  271. }
  272. #endif
  273. #if 0
  274. printk("\n");
  275. #endif
  276. } /* end dump_memory_map() */
  277. /*****************************************************************************/
  278. /*
  279. * attempt to detect a VDK motherboard and DAV daughter board on an MB93091 system
  280. */
  281. #ifdef CONFIG_MB93091_VDK
  282. static void __init detect_mb93091(void)
  283. {
  284. #ifdef CONFIG_MB93090_MB00
  285. /* Detect CB70 without motherboard */
  286. if (!(cpu_system == __frv_mb93091_cb70 && ((*(unsigned short *)0xffc00030) & 0x100))) {
  287. cpu_board1 = __frv_mb93090_mb00;
  288. mb93090_mb00_detected = 1;
  289. }
  290. #endif
  291. #ifdef CONFIG_FUJITSU_MB93493
  292. cpu_board2 = __frv_mb93493;
  293. #endif
  294. } /* end detect_mb93091() */
  295. #endif
  296. /*****************************************************************************/
  297. /*
  298. * determine the CPU type and set appropriate parameters
  299. *
  300. * Family Series CPU Core Silicon Imple Vers
  301. * ----------------------------------------------------------
  302. * FR-V --+-> FR400 --+-> FR401 --+-> MB93401 02 00 [1]
  303. * | | |
  304. * | | +-> MB93401/A 02 01
  305. * | | |
  306. * | | +-> MB93403 02 02
  307. * | |
  308. * | +-> FR405 ----> MB93405 04 00
  309. * |
  310. * +-> FR450 ----> FR451 ----> MB93451 05 00
  311. * |
  312. * +-> FR500 ----> FR501 --+-> MB93501 01 01 [2]
  313. * | |
  314. * | +-> MB93501/A 01 02
  315. * |
  316. * +-> FR550 --+-> FR551 ----> MB93555 03 01
  317. *
  318. * [1] The MB93401 is an obsolete CPU replaced by the MB93401A
  319. * [2] The MB93501 is an obsolete CPU replaced by the MB93501A
  320. *
  321. * Imple is PSR(Processor Status Register)[31:28].
  322. * Vers is PSR(Processor Status Register)[27:24].
  323. *
  324. * A "Silicon" consists of CPU core and some on-chip peripherals.
  325. */
  326. static void __init determine_cpu(void)
  327. {
  328. unsigned long hsr0 = __get_HSR(0);
  329. unsigned long psr = __get_PSR();
  330. /* work out what selectable services the CPU supports */
  331. __set_PSR(psr | PSR_EM | PSR_EF | PSR_CM | PSR_NEM);
  332. cpu_psr_all = __get_PSR();
  333. __set_PSR(psr);
  334. __set_HSR(0, hsr0 | HSR0_GRLE | HSR0_GRHE | HSR0_FRLE | HSR0_FRHE);
  335. cpu_hsr0_all = __get_HSR(0);
  336. __set_HSR(0, hsr0);
  337. /* derive other service specs from the CPU type */
  338. cpu_series = "unknown";
  339. cpu_core = "unknown";
  340. cpu_silicon = "unknown";
  341. cpu_mmu = "Prot";
  342. cpu_system = __frv_unknown_system;
  343. clock_cmodes = NULL;
  344. clock_doubled = 0;
  345. #ifdef CONFIG_PM
  346. clock_bits_settable = CLOCK_BIT_CM_H | CLOCK_BIT_CM_M | CLOCK_BIT_P0;
  347. #endif
  348. switch (PSR_IMPLE(psr)) {
  349. case PSR_IMPLE_FR401:
  350. cpu_series = "fr400";
  351. cpu_core = "fr401";
  352. pdm_suspend_mode = HSR0_PDM_PLL_RUN;
  353. switch (PSR_VERSION(psr)) {
  354. case PSR_VERSION_FR401_MB93401:
  355. cpu_silicon = "mb93401";
  356. cpu_system = __frv_mb93091_cb10;
  357. clock_cmodes = clock_cmodes_fr401_fr403;
  358. clock_doubled = 1;
  359. break;
  360. case PSR_VERSION_FR401_MB93401A:
  361. cpu_silicon = "mb93401/A";
  362. cpu_system = __frv_mb93091_cb11;
  363. clock_cmodes = clock_cmodes_fr401_fr403;
  364. break;
  365. case PSR_VERSION_FR401_MB93403:
  366. cpu_silicon = "mb93403";
  367. #ifndef CONFIG_MB93093_PDK
  368. cpu_system = __frv_mb93091_cb30;
  369. #else
  370. cpu_system = __frv_mb93093;
  371. #endif
  372. clock_cmodes = clock_cmodes_fr401_fr403;
  373. break;
  374. default:
  375. break;
  376. }
  377. break;
  378. case PSR_IMPLE_FR405:
  379. cpu_series = "fr400";
  380. cpu_core = "fr405";
  381. pdm_suspend_mode = HSR0_PDM_PLL_STOP;
  382. switch (PSR_VERSION(psr)) {
  383. case PSR_VERSION_FR405_MB93405:
  384. cpu_silicon = "mb93405";
  385. cpu_system = __frv_mb93091_cb60;
  386. clock_cmodes = clock_cmodes_fr405;
  387. #ifdef CONFIG_PM
  388. clock_bits_settable |= CLOCK_BIT_CMODE;
  389. clock_cmodes_permitted = CLOCK_CMODES_PERMITTED_FR405;
  390. #endif
  391. /* the FPGA on the CB70 has extra registers
  392. * - it has 0x0046 in the VDK_ID FPGA register at 0x1a0, which is
  393. * how we tell the difference between it and a CB60
  394. */
  395. if (*(volatile unsigned short *) 0xffc001a0 == 0x0046)
  396. cpu_system = __frv_mb93091_cb70;
  397. break;
  398. default:
  399. break;
  400. }
  401. break;
  402. case PSR_IMPLE_FR451:
  403. cpu_series = "fr450";
  404. cpu_core = "fr451";
  405. pdm_suspend_mode = HSR0_PDM_PLL_STOP;
  406. #ifdef CONFIG_PM
  407. clock_bits_settable |= CLOCK_BIT_CMODE;
  408. clock_cmodes_permitted = CLOCK_CMODES_PERMITTED_FR405;
  409. #endif
  410. switch (PSR_VERSION(psr)) {
  411. case PSR_VERSION_FR451_MB93451:
  412. cpu_silicon = "mb93451";
  413. cpu_mmu = "Prot, SAT, xSAT, DAT";
  414. cpu_system = __frv_mb93091_cb451;
  415. clock_cmodes = clock_cmodes_fr405;
  416. break;
  417. default:
  418. break;
  419. }
  420. break;
  421. case PSR_IMPLE_FR501:
  422. cpu_series = "fr500";
  423. cpu_core = "fr501";
  424. pdm_suspend_mode = HSR0_PDM_PLL_STOP;
  425. switch (PSR_VERSION(psr)) {
  426. case PSR_VERSION_FR501_MB93501: cpu_silicon = "mb93501"; break;
  427. case PSR_VERSION_FR501_MB93501A: cpu_silicon = "mb93501/A"; break;
  428. default:
  429. break;
  430. }
  431. break;
  432. case PSR_IMPLE_FR551:
  433. cpu_series = "fr550";
  434. cpu_core = "fr551";
  435. pdm_suspend_mode = HSR0_PDM_PLL_RUN;
  436. switch (PSR_VERSION(psr)) {
  437. case PSR_VERSION_FR551_MB93555:
  438. cpu_silicon = "mb93555";
  439. cpu_mmu = "Prot, SAT";
  440. cpu_system = __frv_mb93091_cb41;
  441. clock_cmodes = clock_cmodes_fr555;
  442. clock_doubled = 1;
  443. break;
  444. default:
  445. break;
  446. }
  447. break;
  448. default:
  449. break;
  450. }
  451. printk("- Series:%s CPU:%s Silicon:%s\n",
  452. cpu_series, cpu_core, cpu_silicon);
  453. #ifdef CONFIG_MB93091_VDK
  454. detect_mb93091();
  455. #endif
  456. #if defined(CONFIG_MB93093_PDK) && defined(CONFIG_FUJITSU_MB93493)
  457. cpu_board2 = __frv_mb93493;
  458. #endif
  459. } /* end determine_cpu() */
  460. /*****************************************************************************/
  461. /*
  462. * calculate the bus clock speed
  463. */
  464. void __pminit determine_clocks(int verbose)
  465. {
  466. const struct clock_cmode *mode, *tmode;
  467. unsigned long clkc, psr, quot;
  468. clkc = __get_CLKC();
  469. psr = __get_PSR();
  470. clock_p0_current = !!(clkc & CLKC_P0);
  471. clock_cm_current = clkc & CLKC_CM;
  472. clock_cmode_current = (clkc & CLKC_CMODE) >> CLKC_CMODE_s;
  473. if (verbose)
  474. printk("psr=%08lx hsr0=%08lx clkc=%08lx\n", psr, __get_HSR(0), clkc);
  475. /* the CB70 has some alternative ways of setting the clock speed through switches accessed
  476. * through the FPGA. */
  477. if (cpu_system == __frv_mb93091_cb70) {
  478. unsigned short clkswr = *(volatile unsigned short *) 0xffc00104UL & 0x1fffUL;
  479. if (clkswr & 0x1000)
  480. __clkin_clock_speed_HZ = 60000000UL;
  481. else
  482. __clkin_clock_speed_HZ =
  483. ((clkswr >> 8) & 0xf) * 10000000 +
  484. ((clkswr >> 4) & 0xf) * 1000000 +
  485. ((clkswr ) & 0xf) * 100000;
  486. }
  487. /* the FR451 is currently fixed at 24MHz */
  488. else if (cpu_system == __frv_mb93091_cb451) {
  489. //__clkin_clock_speed_HZ = 24000000UL; // CB451-FPGA
  490. unsigned short clkswr = *(volatile unsigned short *) 0xffc00104UL & 0x1fffUL;
  491. if (clkswr & 0x1000)
  492. __clkin_clock_speed_HZ = 60000000UL;
  493. else
  494. __clkin_clock_speed_HZ =
  495. ((clkswr >> 8) & 0xf) * 10000000 +
  496. ((clkswr >> 4) & 0xf) * 1000000 +
  497. ((clkswr ) & 0xf) * 100000;
  498. }
  499. /* otherwise determine the clockspeed from VDK or other registers */
  500. else {
  501. __clkin_clock_speed_HZ = __get_CLKIN();
  502. }
  503. /* look up the appropriate clock relationships table entry */
  504. mode = &undef_clock_cmode;
  505. if (clock_cmodes) {
  506. tmode = &clock_cmodes[(clkc & CLKC_CMODE) >> CLKC_CMODE_s];
  507. if (tmode->xbus)
  508. mode = tmode;
  509. }
  510. #define CLOCK(SRC,RATIO) ((SRC) * (((RATIO) >> 4) & 0x0f) / ((RATIO) & 0x0f))
  511. if (clock_doubled)
  512. __clkin_clock_speed_HZ <<= 1;
  513. __ext_bus_clock_speed_HZ = CLOCK(__clkin_clock_speed_HZ, mode->xbus);
  514. __sdram_clock_speed_HZ = CLOCK(__clkin_clock_speed_HZ, mode->sdram);
  515. __dsu_clock_speed_HZ = CLOCK(__clkin_clock_speed_HZ, mode->dsu);
  516. switch (clkc & CLKC_CM) {
  517. case 0: /* High */
  518. __core_bus_clock_speed_HZ = CLOCK(__clkin_clock_speed_HZ, mode->corebus);
  519. __core_clock_speed_HZ = CLOCK(__clkin_clock_speed_HZ, mode->core);
  520. break;
  521. case 1: /* Medium */
  522. __core_bus_clock_speed_HZ = CLOCK(__clkin_clock_speed_HZ, mode->sdram);
  523. __core_clock_speed_HZ = CLOCK(__clkin_clock_speed_HZ, mode->sdram);
  524. break;
  525. case 2: /* Low; not supported */
  526. case 3: /* UNDEF */
  527. printk("Unsupported CLKC CM %ld\n", clkc & CLKC_CM);
  528. panic("Bye");
  529. }
  530. __res_bus_clock_speed_HZ = __ext_bus_clock_speed_HZ;
  531. if (clkc & CLKC_P0)
  532. __res_bus_clock_speed_HZ >>= 1;
  533. if (verbose) {
  534. printk("CLKIN: %lu.%3.3luMHz\n",
  535. __clkin_clock_speed_HZ / 1000000,
  536. (__clkin_clock_speed_HZ / 1000) % 1000);
  537. printk("CLKS:"
  538. " ext=%luMHz res=%luMHz sdram=%luMHz cbus=%luMHz core=%luMHz dsu=%luMHz\n",
  539. __ext_bus_clock_speed_HZ / 1000000,
  540. __res_bus_clock_speed_HZ / 1000000,
  541. __sdram_clock_speed_HZ / 1000000,
  542. __core_bus_clock_speed_HZ / 1000000,
  543. __core_clock_speed_HZ / 1000000,
  544. __dsu_clock_speed_HZ / 1000000
  545. );
  546. }
  547. /* calculate the number of __delay() loop iterations per sec (2 insn loop) */
  548. __delay_loops_MHz = __core_clock_speed_HZ / (1000000 * 2);
  549. /* set the serial prescaler */
  550. __serial_clock_speed_HZ = __res_bus_clock_speed_HZ;
  551. quot = 1;
  552. while (__serial_clock_speed_HZ / quot / 16 / 65536 > 3000)
  553. quot += 1;
  554. /* double the divisor if P0 is clear, so that if/when P0 is set, it's still achievable
  555. * - we have to be careful - dividing too much can mean we can't get 115200 baud
  556. */
  557. if (__serial_clock_speed_HZ > 32000000 && !(clkc & CLKC_P0))
  558. quot <<= 1;
  559. __serial_clock_speed_HZ /= quot;
  560. __frv_uart0.uartclk = __serial_clock_speed_HZ;
  561. __frv_uart1.uartclk = __serial_clock_speed_HZ;
  562. if (verbose)
  563. printk(" uart=%luMHz\n", __serial_clock_speed_HZ / 1000000 * quot);
  564. while (!(__get_UART0_LSR() & UART_LSR_TEMT))
  565. continue;
  566. while (!(__get_UART1_LSR() & UART_LSR_TEMT))
  567. continue;
  568. __set_UCPVR(quot);
  569. __set_UCPSR(0);
  570. } /* end determine_clocks() */
  571. /*****************************************************************************/
  572. /*
  573. * reserve some DMA consistent memory
  574. */
  575. #ifdef CONFIG_RESERVE_DMA_COHERENT
  576. static void __init reserve_dma_coherent(void)
  577. {
  578. unsigned long ampr;
  579. /* find the first non-kernel memory tile and steal it */
  580. #define __steal_AMPR(r) \
  581. if (__get_DAMPR(r) & xAMPRx_V) { \
  582. ampr = __get_DAMPR(r); \
  583. __set_DAMPR(r, ampr | xAMPRx_S | xAMPRx_C); \
  584. __set_IAMPR(r, 0); \
  585. goto found; \
  586. }
  587. __steal_AMPR(1);
  588. __steal_AMPR(2);
  589. __steal_AMPR(3);
  590. __steal_AMPR(4);
  591. __steal_AMPR(5);
  592. __steal_AMPR(6);
  593. if (PSR_IMPLE(__get_PSR()) == PSR_IMPLE_FR551) {
  594. __steal_AMPR(7);
  595. __steal_AMPR(8);
  596. __steal_AMPR(9);
  597. __steal_AMPR(10);
  598. __steal_AMPR(11);
  599. __steal_AMPR(12);
  600. __steal_AMPR(13);
  601. __steal_AMPR(14);
  602. }
  603. /* unable to grant any DMA consistent memory */
  604. printk("No DMA consistent memory reserved\n");
  605. return;
  606. found:
  607. dma_coherent_mem_start = ampr & xAMPRx_PPFN;
  608. ampr &= xAMPRx_SS;
  609. ampr >>= 4;
  610. ampr = 1 << (ampr - 3 + 20);
  611. dma_coherent_mem_end = dma_coherent_mem_start + ampr;
  612. printk("DMA consistent memory reserved %lx-%lx\n",
  613. dma_coherent_mem_start, dma_coherent_mem_end);
  614. } /* end reserve_dma_coherent() */
  615. #endif
  616. /*****************************************************************************/
  617. /*
  618. * calibrate the delay loop
  619. */
  620. void __init calibrate_delay(void)
  621. {
  622. loops_per_jiffy = __delay_loops_MHz * (1000000 / HZ);
  623. printk("Calibrating delay loop... %lu.%02lu BogoMIPS\n",
  624. loops_per_jiffy / (500000 / HZ),
  625. (loops_per_jiffy / (5000 / HZ)) % 100);
  626. } /* end calibrate_delay() */
  627. /*****************************************************************************/
  628. /*
  629. * look through the command line for some things we need to know immediately
  630. */
  631. static void __init parse_cmdline_early(char *cmdline)
  632. {
  633. if (!cmdline)
  634. return;
  635. while (*cmdline) {
  636. if (*cmdline == ' ')
  637. cmdline++;
  638. /* "mem=XXX[kKmM]" sets SDRAM size to <mem>, overriding the value we worked
  639. * out from the SDRAM controller mask register
  640. */
  641. if (!memcmp(cmdline, "mem=", 4)) {
  642. unsigned long long mem_size;
  643. mem_size = memparse(cmdline + 4, &cmdline);
  644. memory_end = memory_start + mem_size;
  645. }
  646. while (*cmdline && *cmdline != ' ')
  647. cmdline++;
  648. }
  649. } /* end parse_cmdline_early() */
  650. /*****************************************************************************/
  651. /*
  652. *
  653. */
  654. void __init setup_arch(char **cmdline_p)
  655. {
  656. #ifdef CONFIG_MMU
  657. printk("Linux FR-V port done by Red Hat Inc <dhowells@redhat.com>\n");
  658. #else
  659. printk("uClinux FR-V port done by Red Hat Inc <dhowells@redhat.com>\n");
  660. #endif
  661. memcpy(saved_command_line, redboot_command_line, COMMAND_LINE_SIZE);
  662. determine_cpu();
  663. determine_clocks(1);
  664. /* For printk-directly-beats-on-serial-hardware hack */
  665. console_set_baud(115200);
  666. #ifdef CONFIG_GDBSTUB
  667. gdbstub_set_baud(115200);
  668. #endif
  669. #ifdef CONFIG_RESERVE_DMA_COHERENT
  670. reserve_dma_coherent();
  671. #endif
  672. dump_memory_map();
  673. #ifdef CONFIG_MB93090_MB00
  674. if (mb93090_mb00_detected)
  675. mb93090_display();
  676. #endif
  677. /* register those serial ports that are available */
  678. #ifdef CONFIG_FRV_ONCPU_SERIAL
  679. #ifndef CONFIG_GDBSTUB_UART0
  680. __reg(UART0_BASE + UART_IER * 8) = 0;
  681. early_serial_setup(&__frv_uart0);
  682. #endif
  683. #ifndef CONFIG_GDBSTUB_UART1
  684. __reg(UART1_BASE + UART_IER * 8) = 0;
  685. early_serial_setup(&__frv_uart1);
  686. #endif
  687. #endif
  688. #if defined(CONFIG_CHR_DEV_FLASH) || defined(CONFIG_BLK_DEV_FLASH)
  689. /* we need to initialize the Flashrom device here since we might
  690. * do things with flash early on in the boot
  691. */
  692. flash_probe();
  693. #endif
  694. /* deal with the command line - RedBoot may have passed one to the kernel */
  695. memcpy(command_line, saved_command_line, sizeof(command_line));
  696. *cmdline_p = &command_line[0];
  697. parse_cmdline_early(command_line);
  698. /* set up the memory description
  699. * - by now the stack is part of the init task */
  700. printk("Memory %08lx-%08lx\n", memory_start, memory_end);
  701. BUG_ON(memory_start == memory_end);
  702. init_mm.start_code = (unsigned long) &_stext;
  703. init_mm.end_code = (unsigned long) &_etext;
  704. init_mm.end_data = (unsigned long) &_edata;
  705. #if 0 /* DAVIDM - don't set brk just incase someone decides to use it */
  706. init_mm.brk = (unsigned long) &_end;
  707. #else
  708. init_mm.brk = (unsigned long) 0;
  709. #endif
  710. #ifdef DEBUG
  711. printk("KERNEL -> TEXT=0x%06x-0x%06x DATA=0x%06x-0x%06x BSS=0x%06x-0x%06x\n",
  712. (int) &_stext, (int) &_etext,
  713. (int) &_sdata, (int) &_edata,
  714. (int) &_sbss, (int) &_ebss);
  715. #endif
  716. #ifdef CONFIG_VT
  717. #if defined(CONFIG_VGA_CONSOLE)
  718. conswitchp = &vga_con;
  719. #elif defined(CONFIG_DUMMY_CONSOLE)
  720. conswitchp = &dummy_con;
  721. #endif
  722. #endif
  723. #ifdef CONFIG_BLK_DEV_BLKMEM
  724. ROOT_DEV = MKDEV(BLKMEM_MAJOR,0);
  725. #endif
  726. /*rom_length = (unsigned long)&_flashend - (unsigned long)&_romvec;*/
  727. #ifdef CONFIG_MMU
  728. setup_linux_memory();
  729. #else
  730. setup_uclinux_memory();
  731. #endif
  732. /* get kmalloc into gear */
  733. paging_init();
  734. /* init DMA */
  735. frv_dma_init();
  736. #ifdef DEBUG
  737. printk("Done setup_arch\n");
  738. #endif
  739. /* start the decrement timer running */
  740. // asm volatile("movgs %0,timerd" :: "r"(10000000));
  741. // __set_HSR(0, __get_HSR(0) | HSR0_ETMD);
  742. } /* end setup_arch() */
  743. #if 0
  744. /*****************************************************************************/
  745. /*
  746. *
  747. */
  748. static int __devinit setup_arch_serial(void)
  749. {
  750. /* register those serial ports that are available */
  751. #ifndef CONFIG_GDBSTUB_UART0
  752. early_serial_setup(&__frv_uart0);
  753. #endif
  754. #ifndef CONFIG_GDBSTUB_UART1
  755. early_serial_setup(&__frv_uart1);
  756. #endif
  757. return 0;
  758. } /* end setup_arch_serial() */
  759. late_initcall(setup_arch_serial);
  760. #endif
  761. /*****************************************************************************/
  762. /*
  763. * set up the memory map for normal MMU linux
  764. */
  765. #ifdef CONFIG_MMU
  766. static void __init setup_linux_memory(void)
  767. {
  768. unsigned long bootmap_size, low_top_pfn, kstart, kend, high_mem;
  769. kstart = (unsigned long) &__kernel_image_start - PAGE_OFFSET;
  770. kend = (unsigned long) &__kernel_image_end - PAGE_OFFSET;
  771. kstart = kstart & PAGE_MASK;
  772. kend = (kend + PAGE_SIZE - 1) & PAGE_MASK;
  773. /* give all the memory to the bootmap allocator, tell it to put the
  774. * boot mem_map immediately following the kernel image
  775. */
  776. bootmap_size = init_bootmem_node(NODE_DATA(0),
  777. kend >> PAGE_SHIFT, /* map addr */
  778. memory_start >> PAGE_SHIFT, /* start of RAM */
  779. memory_end >> PAGE_SHIFT /* end of RAM */
  780. );
  781. /* pass the memory that the kernel can immediately use over to the bootmem allocator */
  782. max_mapnr = num_physpages = (memory_end - memory_start) >> PAGE_SHIFT;
  783. low_top_pfn = (KERNEL_LOWMEM_END - KERNEL_LOWMEM_START) >> PAGE_SHIFT;
  784. high_mem = 0;
  785. if (num_physpages > low_top_pfn) {
  786. #ifdef CONFIG_HIGHMEM
  787. high_mem = num_physpages - low_top_pfn;
  788. #else
  789. max_mapnr = num_physpages = low_top_pfn;
  790. #endif
  791. }
  792. else {
  793. low_top_pfn = num_physpages;
  794. }
  795. min_low_pfn = memory_start >> PAGE_SHIFT;
  796. max_low_pfn = low_top_pfn;
  797. max_pfn = memory_end >> PAGE_SHIFT;
  798. num_mappedpages = low_top_pfn;
  799. printk(KERN_NOTICE "%ldMB LOWMEM available.\n", low_top_pfn >> (20 - PAGE_SHIFT));
  800. free_bootmem(memory_start, low_top_pfn << PAGE_SHIFT);
  801. #ifdef CONFIG_HIGHMEM
  802. if (high_mem)
  803. printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", high_mem >> (20 - PAGE_SHIFT));
  804. #endif
  805. /* take back the memory occupied by the kernel image and the bootmem alloc map */
  806. reserve_bootmem(kstart, kend - kstart + bootmap_size);
  807. /* reserve the memory occupied by the initial ramdisk */
  808. #ifdef CONFIG_BLK_DEV_INITRD
  809. if (LOADER_TYPE && INITRD_START) {
  810. if (INITRD_START + INITRD_SIZE <= (low_top_pfn << PAGE_SHIFT)) {
  811. reserve_bootmem(INITRD_START, INITRD_SIZE);
  812. initrd_start = INITRD_START ? INITRD_START + PAGE_OFFSET : 0;
  813. initrd_end = initrd_start + INITRD_SIZE;
  814. }
  815. else {
  816. printk(KERN_ERR
  817. "initrd extends beyond end of memory (0x%08lx > 0x%08lx)\n"
  818. "disabling initrd\n",
  819. INITRD_START + INITRD_SIZE,
  820. low_top_pfn << PAGE_SHIFT);
  821. initrd_start = 0;
  822. }
  823. }
  824. #endif
  825. } /* end setup_linux_memory() */
  826. #endif
  827. /*****************************************************************************/
  828. /*
  829. * set up the memory map for uClinux
  830. */
  831. #ifndef CONFIG_MMU
  832. static void __init setup_uclinux_memory(void)
  833. {
  834. #ifdef CONFIG_PROTECT_KERNEL
  835. unsigned long dampr;
  836. #endif
  837. unsigned long kend;
  838. int bootmap_size;
  839. kend = (unsigned long) &__kernel_image_end;
  840. kend = (kend + PAGE_SIZE - 1) & PAGE_MASK;
  841. /* give all the memory to the bootmap allocator, tell it to put the
  842. * boot mem_map immediately following the kernel image
  843. */
  844. bootmap_size = init_bootmem_node(NODE_DATA(0),
  845. kend >> PAGE_SHIFT, /* map addr */
  846. memory_start >> PAGE_SHIFT, /* start of RAM */
  847. memory_end >> PAGE_SHIFT /* end of RAM */
  848. );
  849. /* free all the usable memory */
  850. free_bootmem(memory_start, memory_end - memory_start);
  851. high_memory = (void *) (memory_end & PAGE_MASK);
  852. max_mapnr = num_physpages = ((unsigned long) high_memory - PAGE_OFFSET) >> PAGE_SHIFT;
  853. min_low_pfn = memory_start >> PAGE_SHIFT;
  854. max_low_pfn = memory_end >> PAGE_SHIFT;
  855. max_pfn = max_low_pfn;
  856. /* now take back the bits the core kernel is occupying */
  857. #ifndef CONFIG_PROTECT_KERNEL
  858. reserve_bootmem(kend, bootmap_size);
  859. reserve_bootmem((unsigned long) &__kernel_image_start,
  860. kend - (unsigned long) &__kernel_image_start);
  861. #else
  862. dampr = __get_DAMPR(0);
  863. dampr &= xAMPRx_SS;
  864. dampr = (dampr >> 4) + 17;
  865. dampr = 1 << dampr;
  866. reserve_bootmem(__get_DAMPR(0) & xAMPRx_PPFN, dampr);
  867. #endif
  868. /* reserve some memory to do uncached DMA through if requested */
  869. #ifdef CONFIG_RESERVE_DMA_COHERENT
  870. if (dma_coherent_mem_start)
  871. reserve_bootmem(dma_coherent_mem_start,
  872. dma_coherent_mem_end - dma_coherent_mem_start);
  873. #endif
  874. } /* end setup_uclinux_memory() */
  875. #endif
  876. /*****************************************************************************/
  877. /*
  878. * get CPU information for use by procfs
  879. */
  880. static int show_cpuinfo(struct seq_file *m, void *v)
  881. {
  882. const char *gr, *fr, *fm, *fp, *cm, *nem, *ble;
  883. #ifdef CONFIG_PM
  884. const char *sep;
  885. #endif
  886. gr = cpu_hsr0_all & HSR0_GRHE ? "gr0-63" : "gr0-31";
  887. fr = cpu_hsr0_all & HSR0_FRHE ? "fr0-63" : "fr0-31";
  888. fm = cpu_psr_all & PSR_EM ? ", Media" : "";
  889. fp = cpu_psr_all & PSR_EF ? ", FPU" : "";
  890. cm = cpu_psr_all & PSR_CM ? ", CCCR" : "";
  891. nem = cpu_psr_all & PSR_NEM ? ", NE" : "";
  892. ble = cpu_psr_all & PSR_BE ? "BE" : "LE";
  893. seq_printf(m,
  894. "CPU-Series:\t%s\n"
  895. "CPU-Core:\t%s, %s, %s%s%s\n"
  896. "CPU:\t\t%s\n"
  897. "MMU:\t\t%s\n"
  898. "FP-Media:\t%s%s%s\n"
  899. "System:\t\t%s",
  900. cpu_series,
  901. cpu_core, gr, ble, cm, nem,
  902. cpu_silicon,
  903. cpu_mmu,
  904. fr, fm, fp,
  905. cpu_system);
  906. if (cpu_board1)
  907. seq_printf(m, ", %s", cpu_board1);
  908. if (cpu_board2)
  909. seq_printf(m, ", %s", cpu_board2);
  910. seq_printf(m, "\n");
  911. #ifdef CONFIG_PM
  912. seq_printf(m, "PM-Controls:");
  913. sep = "\t";
  914. if (clock_bits_settable & CLOCK_BIT_CMODE) {
  915. seq_printf(m, "%scmode=0x%04hx", sep, clock_cmodes_permitted);
  916. sep = ", ";
  917. }
  918. if (clock_bits_settable & CLOCK_BIT_CM) {
  919. seq_printf(m, "%scm=0x%lx", sep, clock_bits_settable & CLOCK_BIT_CM);
  920. sep = ", ";
  921. }
  922. if (clock_bits_settable & CLOCK_BIT_P0) {
  923. seq_printf(m, "%sp0=0x3", sep);
  924. sep = ", ";
  925. }
  926. seq_printf(m, "%ssuspend=0x22\n", sep);
  927. #endif
  928. seq_printf(m,
  929. "PM-Status:\tcmode=%d, cm=%d, p0=%d\n",
  930. clock_cmode_current, clock_cm_current, clock_p0_current);
  931. #define print_clk(TAG, VAR) \
  932. seq_printf(m, "Clock-" TAG ":\t%lu.%2.2lu MHz\n", VAR / 1000000, (VAR / 10000) % 100)
  933. print_clk("In", __clkin_clock_speed_HZ);
  934. print_clk("Core", __core_clock_speed_HZ);
  935. print_clk("SDRAM", __sdram_clock_speed_HZ);
  936. print_clk("CBus", __core_bus_clock_speed_HZ);
  937. print_clk("Res", __res_bus_clock_speed_HZ);
  938. print_clk("Ext", __ext_bus_clock_speed_HZ);
  939. print_clk("DSU", __dsu_clock_speed_HZ);
  940. seq_printf(m,
  941. "BogoMips:\t%lu.%02lu\n",
  942. (loops_per_jiffy * HZ) / 500000, ((loops_per_jiffy * HZ) / 5000) % 100);
  943. return 0;
  944. } /* end show_cpuinfo() */
  945. static void *c_start(struct seq_file *m, loff_t *pos)
  946. {
  947. return *pos < NR_CPUS ? (void *) 0x12345678 : NULL;
  948. }
  949. static void *c_next(struct seq_file *m, void *v, loff_t *pos)
  950. {
  951. ++*pos;
  952. return c_start(m, pos);
  953. }
  954. static void c_stop(struct seq_file *m, void *v)
  955. {
  956. }
  957. struct seq_operations cpuinfo_op = {
  958. .start = c_start,
  959. .next = c_next,
  960. .stop = c_stop,
  961. .show = show_cpuinfo,
  962. };
  963. void arch_gettod(int *year, int *mon, int *day, int *hour,
  964. int *min, int *sec)
  965. {
  966. *year = *mon = *day = *hour = *min = *sec = 0;
  967. }
  968. /*****************************************************************************/
  969. /*
  970. *
  971. */
  972. #ifdef CONFIG_MB93090_MB00
  973. static void __init mb93090_sendlcdcmd(uint32_t cmd)
  974. {
  975. unsigned long base = __addr_LCD();
  976. int loop;
  977. /* request reading of the busy flag */
  978. __set_LCD(base, LCD_CMD_READ_BUSY);
  979. __set_LCD(base, LCD_CMD_READ_BUSY & ~LCD_E);
  980. /* wait for the busy flag to become clear */
  981. for (loop = 10000; loop > 0; loop--)
  982. if (!(__get_LCD(base) & 0x80))
  983. break;
  984. /* send the command */
  985. __set_LCD(base, cmd);
  986. __set_LCD(base, cmd & ~LCD_E);
  987. } /* end mb93090_sendlcdcmd() */
  988. /*****************************************************************************/
  989. /*
  990. * write to the MB93090 LEDs and LCD
  991. */
  992. static void __init mb93090_display(void)
  993. {
  994. const char *p;
  995. __set_LEDS(0);
  996. /* set up the LCD */
  997. mb93090_sendlcdcmd(LCD_CMD_CLEAR);
  998. mb93090_sendlcdcmd(LCD_CMD_FUNCSET(1,1,0));
  999. mb93090_sendlcdcmd(LCD_CMD_ON(0,0));
  1000. mb93090_sendlcdcmd(LCD_CMD_HOME);
  1001. mb93090_sendlcdcmd(LCD_CMD_SET_DD_ADDR(0));
  1002. for (p = mb93090_banner; *p; p++)
  1003. mb93090_sendlcdcmd(LCD_DATA_WRITE(*p));
  1004. mb93090_sendlcdcmd(LCD_CMD_SET_DD_ADDR(64));
  1005. for (p = mb93090_version; *p; p++)
  1006. mb93090_sendlcdcmd(LCD_DATA_WRITE(*p));
  1007. } /* end mb93090_display() */
  1008. #endif // CONFIG_MB93090_MB00