setup.c 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. /*
  2. * linux/arch/m68knommu/kernel/setup.c
  3. *
  4. * Copyright (C) 1999-2007 Greg Ungerer (gerg@snapgear.com)
  5. * Copyright (C) 1998,1999 D. Jeff Dionne <jeff@uClinux.org>
  6. * Copyleft ()) 2000 James D. Schettine {james@telos-systems.com}
  7. * Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com>
  8. * Copyright (C) 1995 Hamish Macdonald
  9. * Copyright (C) 2000 Lineo Inc. (www.lineo.com)
  10. * Copyright (C) 2001 Lineo, Inc. <www.lineo.com>
  11. *
  12. * 68VZ328 Fixes/support Evan Stawnyczy <e@lineo.ca>
  13. */
  14. /*
  15. * This file handles the architecture-dependent parts of system setup
  16. */
  17. #include <linux/kernel.h>
  18. #include <linux/sched.h>
  19. #include <linux/delay.h>
  20. #include <linux/interrupt.h>
  21. #include <linux/fb.h>
  22. #include <linux/module.h>
  23. #include <linux/console.h>
  24. #include <linux/errno.h>
  25. #include <linux/string.h>
  26. #include <linux/bootmem.h>
  27. #include <linux/seq_file.h>
  28. #include <linux/init.h>
  29. #include <asm/setup.h>
  30. #include <asm/irq.h>
  31. #include <asm/machdep.h>
  32. #include <asm/pgtable.h>
  33. unsigned long memory_start;
  34. unsigned long memory_end;
  35. EXPORT_SYMBOL(memory_start);
  36. EXPORT_SYMBOL(memory_end);
  37. char __initdata command_line[COMMAND_LINE_SIZE];
  38. void (*mach_trap_init)(void);
  39. /* machine dependent timer functions */
  40. void (*mach_sched_init)(irq_handler_t handler);
  41. void (*mach_tick)(void);
  42. void (*mach_gettod)(int*, int*, int*, int*, int*, int*);
  43. int (*mach_set_clock_mmss)(unsigned long);
  44. unsigned long (*mach_gettimeoffset)(void);
  45. /* machine dependent reboot functions */
  46. void (*mach_reset)(void);
  47. void (*mach_halt)(void);
  48. void (*mach_power_off)(void);
  49. #ifdef CONFIG_M68000
  50. #define CPU "MC68000"
  51. #endif
  52. #ifdef CONFIG_M68328
  53. #define CPU "MC68328"
  54. #endif
  55. #ifdef CONFIG_M68EZ328
  56. #define CPU "MC68EZ328"
  57. #endif
  58. #ifdef CONFIG_M68VZ328
  59. #define CPU "MC68VZ328"
  60. #endif
  61. #ifdef CONFIG_M68332
  62. #define CPU "MC68332"
  63. #endif
  64. #ifdef CONFIG_M68360
  65. #define CPU "MC68360"
  66. #endif
  67. #if defined(CONFIG_M5206)
  68. #define CPU "COLDFIRE(m5206)"
  69. #endif
  70. #if defined(CONFIG_M5206e)
  71. #define CPU "COLDFIRE(m5206e)"
  72. #endif
  73. #if defined(CONFIG_M520x)
  74. #define CPU "COLDFIRE(m520x)"
  75. #endif
  76. #if defined(CONFIG_M523x)
  77. #define CPU "COLDFIRE(m523x)"
  78. #endif
  79. #if defined(CONFIG_M5249)
  80. #define CPU "COLDFIRE(m5249)"
  81. #endif
  82. #if defined(CONFIG_M5271)
  83. #define CPU "COLDFIRE(m5270/5271)"
  84. #endif
  85. #if defined(CONFIG_M5272)
  86. #define CPU "COLDFIRE(m5272)"
  87. #endif
  88. #if defined(CONFIG_M5275)
  89. #define CPU "COLDFIRE(m5274/5275)"
  90. #endif
  91. #if defined(CONFIG_M528x)
  92. #define CPU "COLDFIRE(m5280/5282)"
  93. #endif
  94. #if defined(CONFIG_M5307)
  95. #define CPU "COLDFIRE(m5307)"
  96. #endif
  97. #if defined(CONFIG_M532x)
  98. #define CPU "COLDFIRE(m532x)"
  99. #endif
  100. #if defined(CONFIG_M5407)
  101. #define CPU "COLDFIRE(m5407)"
  102. #endif
  103. #ifndef CPU
  104. #define CPU "UNKNOWN"
  105. #endif
  106. extern int _stext, _etext, _sdata, _edata, _sbss, _ebss, _end;
  107. extern int _ramstart, _ramend;
  108. void setup_arch(char **cmdline_p)
  109. {
  110. int bootmap_size;
  111. memory_start = PAGE_ALIGN(_ramstart);
  112. memory_end = _ramend;
  113. init_mm.start_code = (unsigned long) &_stext;
  114. init_mm.end_code = (unsigned long) &_etext;
  115. init_mm.end_data = (unsigned long) &_edata;
  116. init_mm.brk = (unsigned long) 0;
  117. config_BSP(&command_line[0], sizeof(command_line));
  118. #if defined(CONFIG_BOOTPARAM)
  119. strncpy(&command_line[0], CONFIG_BOOTPARAM_STRING, sizeof(command_line));
  120. command_line[sizeof(command_line) - 1] = 0;
  121. #endif
  122. printk(KERN_INFO "\x0F\r\n\nuClinux/" CPU "\n");
  123. #ifdef CONFIG_UCDIMM
  124. printk(KERN_INFO "uCdimm by Lineo, Inc. <www.lineo.com>\n");
  125. #endif
  126. #ifdef CONFIG_M68VZ328
  127. printk(KERN_INFO "M68VZ328 support by Evan Stawnyczy <e@lineo.ca>\n");
  128. #endif
  129. #ifdef CONFIG_COLDFIRE
  130. printk(KERN_INFO "COLDFIRE port done by Greg Ungerer, gerg@snapgear.com\n");
  131. #ifdef CONFIG_M5307
  132. printk(KERN_INFO "Modified for M5307 by Dave Miller, dmiller@intellistor.com\n");
  133. #endif
  134. #ifdef CONFIG_ELITE
  135. printk(KERN_INFO "Modified for M5206eLITE by Rob Scott, rscott@mtrob.fdns.net\n");
  136. #endif
  137. #ifdef CONFIG_TELOS
  138. printk(KERN_INFO "Modified for Omnia ToolVox by James D. Schettine, james@telos-systems.com\n");
  139. #endif
  140. #endif
  141. printk(KERN_INFO "Flat model support (C) 1998,1999 Kenneth Albanowski, D. Jeff Dionne\n");
  142. #if defined( CONFIG_PILOT ) && defined( CONFIG_M68328 )
  143. printk(KERN_INFO "TRG SuperPilot FLASH card support <info@trgnet.com>\n");
  144. #endif
  145. #if defined( CONFIG_PILOT ) && defined( CONFIG_M68EZ328 )
  146. printk(KERN_INFO "PalmV support by Lineo Inc. <jeff@uclinux.com>\n");
  147. #endif
  148. #ifdef CONFIG_M68EZ328ADS
  149. printk(KERN_INFO "M68EZ328ADS board support (C) 1999 Vladimir Gurevich <vgurevic@cisco.com>\n");
  150. #endif
  151. #ifdef CONFIG_ALMA_ANS
  152. printk(KERN_INFO "Alma Electronics board support (C) 1999 Vladimir Gurevich <vgurevic@cisco.com>\n");
  153. #endif
  154. #if defined (CONFIG_M68360)
  155. printk(KERN_INFO "QUICC port done by SED Systems <hamilton@sedsystems.ca>,\n");
  156. printk(KERN_INFO "based on 2.0.38 port by Lineo Inc. <mleslie@lineo.com>.\n");
  157. #endif
  158. #ifdef CONFIG_DRAGEN2
  159. printk(KERN_INFO "DragonEngine II board support by Georges Menie\n");
  160. #endif
  161. #ifdef CONFIG_M5235EVB
  162. printk(KERN_INFO "Motorola M5235EVB support (C)2005 Syn-tech Systems, Inc. (Jate Sujjavanich)");
  163. #endif
  164. #ifdef DEBUG
  165. printk(KERN_DEBUG "KERNEL -> TEXT=0x%06x-0x%06x DATA=0x%06x-0x%06x "
  166. "BSS=0x%06x-0x%06x\n", (int) &_stext, (int) &_etext,
  167. (int) &_sdata, (int) &_edata,
  168. (int) &_sbss, (int) &_ebss);
  169. printk(KERN_DEBUG "KERNEL -> ROMFS=0x%06x-0x%06x MEM=0x%06x-0x%06x "
  170. "STACK=0x%06x-0x%06x\n",
  171. (int) &_ebss, (int) memory_start,
  172. (int) memory_start, (int) memory_end,
  173. (int) memory_end, (int) _ramend);
  174. #endif
  175. /* Keep a copy of command line */
  176. *cmdline_p = &command_line[0];
  177. memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
  178. boot_command_line[COMMAND_LINE_SIZE-1] = 0;
  179. #ifdef DEBUG
  180. if (strlen(*cmdline_p))
  181. printk(KERN_DEBUG "Command line: '%s'\n", *cmdline_p);
  182. #endif
  183. #if defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_DUMMY_CONSOLE)
  184. conswitchp = &dummy_con;
  185. #endif
  186. /*
  187. * Give all the memory to the bootmap allocator, tell it to put the
  188. * boot mem_map at the start of memory.
  189. */
  190. bootmap_size = init_bootmem_node(
  191. NODE_DATA(0),
  192. memory_start >> PAGE_SHIFT, /* map goes here */
  193. PAGE_OFFSET >> PAGE_SHIFT, /* 0 on coldfire */
  194. memory_end >> PAGE_SHIFT);
  195. /*
  196. * Free the usable memory, we have to make sure we do not free
  197. * the bootmem bitmap so we then reserve it after freeing it :-)
  198. */
  199. free_bootmem(memory_start, memory_end - memory_start);
  200. reserve_bootmem(memory_start, bootmap_size);
  201. /*
  202. * Get kmalloc into gear.
  203. */
  204. paging_init();
  205. }
  206. /*
  207. * Get CPU information for use by the procfs.
  208. */
  209. static int show_cpuinfo(struct seq_file *m, void *v)
  210. {
  211. char *cpu, *mmu, *fpu;
  212. u_long clockfreq;
  213. cpu = CPU;
  214. mmu = "none";
  215. fpu = "none";
  216. #ifdef CONFIG_COLDFIRE
  217. clockfreq = (loops_per_jiffy * HZ) * 3;
  218. #else
  219. clockfreq = (loops_per_jiffy * HZ) * 16;
  220. #endif
  221. seq_printf(m, "CPU:\t\t%s\n"
  222. "MMU:\t\t%s\n"
  223. "FPU:\t\t%s\n"
  224. "Clocking:\t%lu.%1luMHz\n"
  225. "BogoMips:\t%lu.%02lu\n"
  226. "Calibration:\t%lu loops\n",
  227. cpu, mmu, fpu,
  228. clockfreq / 1000000,
  229. (clockfreq / 100000) % 10,
  230. (loops_per_jiffy * HZ) / 500000,
  231. ((loops_per_jiffy * HZ) / 5000) % 100,
  232. (loops_per_jiffy * HZ));
  233. return 0;
  234. }
  235. static void *c_start(struct seq_file *m, loff_t *pos)
  236. {
  237. return *pos < NR_CPUS ? ((void *) 0x12345678) : NULL;
  238. }
  239. static void *c_next(struct seq_file *m, void *v, loff_t *pos)
  240. {
  241. ++*pos;
  242. return c_start(m, pos);
  243. }
  244. static void c_stop(struct seq_file *m, void *v)
  245. {
  246. }
  247. struct seq_operations cpuinfo_op = {
  248. .start = c_start,
  249. .next = c_next,
  250. .stop = c_stop,
  251. .show = show_cpuinfo,
  252. };
  253. void arch_gettod(int *year, int *mon, int *day, int *hour,
  254. int *min, int *sec)
  255. {
  256. if (mach_gettod)
  257. mach_gettod(year, mon, day, hour, min, sec);
  258. else
  259. *year = *mon = *day = *hour = *min = *sec = 0;
  260. }