setup.c 6.8 KB

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