setup.c 32 KB

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