setup.c 32 KB

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