setup.c 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  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. printk(KERN_INFO "\x0F\r\n\nuClinux/" CPU "\n");
  119. #ifdef CONFIG_UCDIMM
  120. printk(KERN_INFO "uCdimm by Lineo, Inc. <www.lineo.com>\n");
  121. #endif
  122. #ifdef CONFIG_M68VZ328
  123. printk(KERN_INFO "M68VZ328 support by Evan Stawnyczy <e@lineo.ca>\n");
  124. #endif
  125. #ifdef CONFIG_COLDFIRE
  126. printk(KERN_INFO "COLDFIRE port done by Greg Ungerer, gerg@snapgear.com\n");
  127. #ifdef CONFIG_M5307
  128. printk(KERN_INFO "Modified for M5307 by Dave Miller, dmiller@intellistor.com\n");
  129. #endif
  130. #ifdef CONFIG_ELITE
  131. printk(KERN_INFO "Modified for M5206eLITE by Rob Scott, rscott@mtrob.fdns.net\n");
  132. #endif
  133. #ifdef CONFIG_TELOS
  134. printk(KERN_INFO "Modified for Omnia ToolVox by James D. Schettine, james@telos-systems.com\n");
  135. #endif
  136. #endif
  137. printk(KERN_INFO "Flat model support (C) 1998,1999 Kenneth Albanowski, D. Jeff Dionne\n");
  138. #if defined( CONFIG_PILOT ) && defined( CONFIG_M68328 )
  139. printk(KERN_INFO "TRG SuperPilot FLASH card support <info@trgnet.com>\n");
  140. #endif
  141. #if defined( CONFIG_PILOT ) && defined( CONFIG_M68EZ328 )
  142. printk(KERN_INFO "PalmV support by Lineo Inc. <jeff@uclinux.com>\n");
  143. #endif
  144. #ifdef CONFIG_M68EZ328ADS
  145. printk(KERN_INFO "M68EZ328ADS board support (C) 1999 Vladimir Gurevich <vgurevic@cisco.com>\n");
  146. #endif
  147. #ifdef CONFIG_ALMA_ANS
  148. printk(KERN_INFO "Alma Electronics board support (C) 1999 Vladimir Gurevich <vgurevic@cisco.com>\n");
  149. #endif
  150. #if defined (CONFIG_M68360)
  151. printk(KERN_INFO "QUICC port done by SED Systems <hamilton@sedsystems.ca>,\n");
  152. printk(KERN_INFO "based on 2.0.38 port by Lineo Inc. <mleslie@lineo.com>.\n");
  153. #endif
  154. #ifdef CONFIG_DRAGEN2
  155. printk(KERN_INFO "DragonEngine II board support by Georges Menie\n");
  156. #endif
  157. #ifdef CONFIG_M5235EVB
  158. printk(KERN_INFO "Motorola M5235EVB support (C)2005 Syn-tech Systems, Inc. (Jate Sujjavanich)");
  159. #endif
  160. #ifdef DEBUG
  161. printk(KERN_DEBUG "KERNEL -> TEXT=0x%06x-0x%06x DATA=0x%06x-0x%06x "
  162. "BSS=0x%06x-0x%06x\n", (int) &_stext, (int) &_etext,
  163. (int) &_sdata, (int) &_edata,
  164. (int) &_sbss, (int) &_ebss);
  165. printk(KERN_DEBUG "KERNEL -> ROMFS=0x%06x-0x%06x MEM=0x%06x-0x%06x "
  166. "STACK=0x%06x-0x%06x\n",
  167. (int) &_ebss, (int) memory_start,
  168. (int) memory_start, (int) memory_end,
  169. (int) memory_end, (int) _ramend);
  170. #endif
  171. /* Keep a copy of command line */
  172. *cmdline_p = &command_line[0];
  173. memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
  174. boot_command_line[COMMAND_LINE_SIZE-1] = 0;
  175. #ifdef DEBUG
  176. if (strlen(*cmdline_p))
  177. printk(KERN_DEBUG "Command line: '%s'\n", *cmdline_p);
  178. #endif
  179. #if defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_DUMMY_CONSOLE)
  180. conswitchp = &dummy_con;
  181. #endif
  182. /*
  183. * Give all the memory to the bootmap allocator, tell it to put the
  184. * boot mem_map at the start of memory.
  185. */
  186. bootmap_size = init_bootmem_node(
  187. NODE_DATA(0),
  188. memory_start >> PAGE_SHIFT, /* map goes here */
  189. PAGE_OFFSET >> PAGE_SHIFT, /* 0 on coldfire */
  190. memory_end >> PAGE_SHIFT);
  191. /*
  192. * Free the usable memory, we have to make sure we do not free
  193. * the bootmem bitmap so we then reserve it after freeing it :-)
  194. */
  195. free_bootmem(memory_start, memory_end - memory_start);
  196. reserve_bootmem(memory_start, bootmap_size);
  197. /*
  198. * Get kmalloc into gear.
  199. */
  200. paging_init();
  201. }
  202. /*
  203. * Get CPU information for use by the procfs.
  204. */
  205. static int show_cpuinfo(struct seq_file *m, void *v)
  206. {
  207. char *cpu, *mmu, *fpu;
  208. u_long clockfreq;
  209. cpu = CPU;
  210. mmu = "none";
  211. fpu = "none";
  212. #ifdef CONFIG_COLDFIRE
  213. clockfreq = (loops_per_jiffy*HZ)*3;
  214. #else
  215. clockfreq = (loops_per_jiffy*HZ)*16;
  216. #endif
  217. seq_printf(m, "CPU:\t\t%s\n"
  218. "MMU:\t\t%s\n"
  219. "FPU:\t\t%s\n"
  220. "Clocking:\t%lu.%1luMHz\n"
  221. "BogoMips:\t%lu.%02lu\n"
  222. "Calibration:\t%lu loops\n",
  223. cpu, mmu, fpu,
  224. clockfreq/1000000,(clockfreq/100000)%10,
  225. (loops_per_jiffy*HZ)/500000,((loops_per_jiffy*HZ)/5000)%100,
  226. (loops_per_jiffy*HZ));
  227. return 0;
  228. }
  229. static void *c_start(struct seq_file *m, loff_t *pos)
  230. {
  231. return *pos < NR_CPUS ? ((void *) 0x12345678) : NULL;
  232. }
  233. static void *c_next(struct seq_file *m, void *v, loff_t *pos)
  234. {
  235. ++*pos;
  236. return c_start(m, pos);
  237. }
  238. static void c_stop(struct seq_file *m, void *v)
  239. {
  240. }
  241. struct seq_operations cpuinfo_op = {
  242. .start = c_start,
  243. .next = c_next,
  244. .stop = c_stop,
  245. .show = show_cpuinfo,
  246. };
  247. void arch_gettod(int *year, int *mon, int *day, int *hour,
  248. int *min, int *sec)
  249. {
  250. if (mach_gettod)
  251. mach_gettod(year, mon, day, hour, min, sec);
  252. else
  253. *year = *mon = *day = *hour = *min = *sec = 0;
  254. }