1
2
3
4
5
6
7
8
9
10
11
12
13#include <linux/init.h>
14#include <linux/mm.h>
15#include <linux/bootmem.h>
16#include <asm/pgtable.h>
17#include <linux/seq_file.h>
18#include <linux/screen_info.h>
19#include <linux/utsname.h>
20#include <linux/pfn.h>
21#include <linux/cpu.h>
22#include <linux/of.h>
23#include <linux/of_fdt.h>
24#include <linux/of_platform.h>
25#include <asm/setup.h>
26#include <arch/system.h>
27
28
29
30
31struct screen_info screen_info;
32
33extern int root_mountflags;
34extern char _etext, _edata, _end;
35
36char __initdata cris_command_line[COMMAND_LINE_SIZE] = { 0, };
37
38extern const unsigned long text_start, edata;
39extern unsigned long dram_start, dram_end;
40
41extern unsigned long romfs_start, romfs_length, romfs_in_flash;
42
43static struct cpu cpu_devices[NR_CPUS];
44
45extern void show_etrax_copyright(void);
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63void __init setup_arch(char **cmdline_p)
64{
65 extern void init_etrax_debug(void);
66 unsigned long bootmap_size;
67 unsigned long start_pfn, max_pfn;
68 unsigned long memory_start;
69
70#ifdef CONFIG_OF
71 early_init_dt_scan(__dtb_start);
72#endif
73
74
75
76 init_etrax_debug();
77
78
79
80 high_memory = &dram_end;
81
82 if(romfs_in_flash || !romfs_length) {
83
84
85
86 memory_start = (unsigned long) &_end;
87 } else {
88
89 printk("ROM fs in RAM, size %lu bytes\n", romfs_length);
90 memory_start = romfs_start + romfs_length;
91 }
92
93
94
95 init_mm.start_code = (unsigned long) &text_start;
96 init_mm.end_code = (unsigned long) &_etext;
97 init_mm.end_data = (unsigned long) &_edata;
98 init_mm.brk = (unsigned long) &_end;
99
100
101
102
103
104
105
106
107
108
109
110 start_pfn = PFN_UP(memory_start);
111 max_pfn = PFN_DOWN((unsigned long)high_memory);
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129 max_low_pfn = max_pfn;
130 min_low_pfn = PAGE_OFFSET >> PAGE_SHIFT;
131
132 bootmap_size = init_bootmem_node(NODE_DATA(0), start_pfn,
133 min_low_pfn,
134 max_low_pfn);
135
136
137
138 free_bootmem(PFN_PHYS(start_pfn), PFN_PHYS(max_pfn - start_pfn));
139
140
141
142
143
144
145
146
147
148
149 reserve_bootmem(PFN_PHYS(start_pfn), bootmap_size, BOOTMEM_DEFAULT);
150
151 unflatten_and_copy_device_tree();
152
153
154
155 paging_init();
156
157 *cmdline_p = cris_command_line;
158
159#ifdef CONFIG_ETRAX_CMDLINE
160 if (!strcmp(cris_command_line, "")) {
161 strlcpy(cris_command_line, CONFIG_ETRAX_CMDLINE, COMMAND_LINE_SIZE);
162 cris_command_line[COMMAND_LINE_SIZE - 1] = '\0';
163 }
164#endif
165
166
167 memcpy(boot_command_line, cris_command_line, COMMAND_LINE_SIZE);
168 boot_command_line[COMMAND_LINE_SIZE - 1] = '\0';
169
170
171 show_etrax_copyright();
172
173
174 strcpy(init_utsname()->machine, cris_machine_name);
175}
176
177#ifdef CONFIG_PROC_FS
178static void *c_start(struct seq_file *m, loff_t *pos)
179{
180 return *pos < nr_cpu_ids ? (void *)(int)(*pos + 1) : NULL;
181}
182
183static void *c_next(struct seq_file *m, void *v, loff_t *pos)
184{
185 ++*pos;
186 return c_start(m, pos);
187}
188
189static void c_stop(struct seq_file *m, void *v)
190{
191}
192
193extern int show_cpuinfo(struct seq_file *m, void *v);
194
195const struct seq_operations cpuinfo_op = {
196 .start = c_start,
197 .next = c_next,
198 .stop = c_stop,
199 .show = show_cpuinfo,
200};
201#endif
202
203static int __init topology_init(void)
204{
205 int i;
206
207 for_each_possible_cpu(i) {
208 return register_cpu(&cpu_devices[i], i);
209 }
210
211 return 0;
212}
213
214subsys_initcall(topology_init);
215
216static int __init cris_of_init(void)
217{
218 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
219 return 0;
220}
221core_initcall(cris_of_init);
222