setup.c 6.8 KB

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