setup.c 32 KB

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