setup.c 7.6 KB

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