aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/kernel/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/blackfin/kernel/setup.c')
-rw-r--r--arch/blackfin/kernel/setup.c583
1 files changed, 440 insertions, 143 deletions
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 289ea9d7fcdb..8229b1090eb9 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -1,30 +1,11 @@
1/* 1/*
2 * File: arch/blackfin/kernel/setup.c 2 * arch/blackfin/kernel/setup.c
3 * Based on:
4 * Author:
5 * 3 *
6 * Created: 4 * Copyright 2004-2006 Analog Devices Inc.
7 * Description:
8 * 5 *
9 * Modified: 6 * Enter bugs at http://blackfin.uclinux.org/
10 * Copyright 2004-2006 Analog Devices Inc.
11 * 7 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/ 8 * Licensed under the GPL-2 or later.
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */ 9 */
29 10
30#include <linux/delay.h> 11#include <linux/delay.h>
@@ -34,6 +15,7 @@
34#include <linux/cpu.h> 15#include <linux/cpu.h>
35#include <linux/module.h> 16#include <linux/module.h>
36#include <linux/tty.h> 17#include <linux/tty.h>
18#include <linux/pfn.h>
37 19
38#include <linux/ext2_fs.h> 20#include <linux/ext2_fs.h>
39#include <linux/cramfs_fs.h> 21#include <linux/cramfs_fs.h>
@@ -47,6 +29,8 @@
47#include <asm/fixed_code.h> 29#include <asm/fixed_code.h>
48#include <asm/early_printk.h> 30#include <asm/early_printk.h>
49 31
32static DEFINE_PER_CPU(struct cpu, cpu_devices);
33
50u16 _bfin_swrst; 34u16 _bfin_swrst;
51 35
52unsigned long memory_start, memory_end, physical_mem_end; 36unsigned long memory_start, memory_end, physical_mem_end;
@@ -67,6 +51,29 @@ EXPORT_SYMBOL(mtd_size);
67 51
68char __initdata command_line[COMMAND_LINE_SIZE]; 52char __initdata command_line[COMMAND_LINE_SIZE];
69 53
54/* boot memmap, for parsing "memmap=" */
55#define BFIN_MEMMAP_MAX 128 /* number of entries in bfin_memmap */
56#define BFIN_MEMMAP_RAM 1
57#define BFIN_MEMMAP_RESERVED 2
58struct bfin_memmap {
59 int nr_map;
60 struct bfin_memmap_entry {
61 unsigned long long addr; /* start of memory segment */
62 unsigned long long size;
63 unsigned long type;
64 } map[BFIN_MEMMAP_MAX];
65} bfin_memmap __initdata;
66
67/* for memmap sanitization */
68struct change_member {
69 struct bfin_memmap_entry *pentry; /* pointer to original entry */
70 unsigned long long addr; /* address for this change point */
71};
72static struct change_member change_point_list[2*BFIN_MEMMAP_MAX] __initdata;
73static struct change_member *change_point[2*BFIN_MEMMAP_MAX] __initdata;
74static struct bfin_memmap_entry *overlap_list[BFIN_MEMMAP_MAX] __initdata;
75static struct bfin_memmap_entry new_map[BFIN_MEMMAP_MAX] __initdata;
76
70void __init bf53x_cache_init(void) 77void __init bf53x_cache_init(void)
71{ 78{
72#if defined(CONFIG_BFIN_DCACHE) || defined(CONFIG_BFIN_ICACHE) 79#if defined(CONFIG_BFIN_DCACHE) || defined(CONFIG_BFIN_ICACHE)
@@ -123,12 +130,224 @@ void __init bf53x_relocate_l1_mem(void)
123 130
124} 131}
125 132
133/* add_memory_region to memmap */
134static void __init add_memory_region(unsigned long long start,
135 unsigned long long size, int type)
136{
137 int i;
138
139 i = bfin_memmap.nr_map;
140
141 if (i == BFIN_MEMMAP_MAX) {
142 printk(KERN_ERR "Ooops! Too many entries in the memory map!\n");
143 return;
144 }
145
146 bfin_memmap.map[i].addr = start;
147 bfin_memmap.map[i].size = size;
148 bfin_memmap.map[i].type = type;
149 bfin_memmap.nr_map++;
150}
151
152/*
153 * Sanitize the boot memmap, removing overlaps.
154 */
155static int __init sanitize_memmap(struct bfin_memmap_entry *map, int *pnr_map)
156{
157 struct change_member *change_tmp;
158 unsigned long current_type, last_type;
159 unsigned long long last_addr;
160 int chgidx, still_changing;
161 int overlap_entries;
162 int new_entry;
163 int old_nr, new_nr, chg_nr;
164 int i;
165
166 /*
167 Visually we're performing the following (1,2,3,4 = memory types)
168
169 Sample memory map (w/overlaps):
170 ____22__________________
171 ______________________4_
172 ____1111________________
173 _44_____________________
174 11111111________________
175 ____________________33__
176 ___________44___________
177 __________33333_________
178 ______________22________
179 ___________________2222_
180 _________111111111______
181 _____________________11_
182 _________________4______
183
184 Sanitized equivalent (no overlap):
185 1_______________________
186 _44_____________________
187 ___1____________________
188 ____22__________________
189 ______11________________
190 _________1______________
191 __________3_____________
192 ___________44___________
193 _____________33_________
194 _______________2________
195 ________________1_______
196 _________________4______
197 ___________________2____
198 ____________________33__
199 ______________________4_
200 */
201 /* if there's only one memory region, don't bother */
202 if (*pnr_map < 2)
203 return -1;
204
205 old_nr = *pnr_map;
206
207 /* bail out if we find any unreasonable addresses in memmap */
208 for (i = 0; i < old_nr; i++)
209 if (map[i].addr + map[i].size < map[i].addr)
210 return -1;
211
212 /* create pointers for initial change-point information (for sorting) */
213 for (i = 0; i < 2*old_nr; i++)
214 change_point[i] = &change_point_list[i];
215
216 /* record all known change-points (starting and ending addresses),
217 omitting those that are for empty memory regions */
218 chgidx = 0;
219 for (i = 0; i < old_nr; i++) {
220 if (map[i].size != 0) {
221 change_point[chgidx]->addr = map[i].addr;
222 change_point[chgidx++]->pentry = &map[i];
223 change_point[chgidx]->addr = map[i].addr + map[i].size;
224 change_point[chgidx++]->pentry = &map[i];
225 }
226 }
227 chg_nr = chgidx; /* true number of change-points */
228
229 /* sort change-point list by memory addresses (low -> high) */
230 still_changing = 1;
231 while (still_changing) {
232 still_changing = 0;
233 for (i = 1; i < chg_nr; i++) {
234 /* if <current_addr> > <last_addr>, swap */
235 /* or, if current=<start_addr> & last=<end_addr>, swap */
236 if ((change_point[i]->addr < change_point[i-1]->addr) ||
237 ((change_point[i]->addr == change_point[i-1]->addr) &&
238 (change_point[i]->addr == change_point[i]->pentry->addr) &&
239 (change_point[i-1]->addr != change_point[i-1]->pentry->addr))
240 ) {
241 change_tmp = change_point[i];
242 change_point[i] = change_point[i-1];
243 change_point[i-1] = change_tmp;
244 still_changing = 1;
245 }
246 }
247 }
248
249 /* create a new memmap, removing overlaps */
250 overlap_entries = 0; /* number of entries in the overlap table */
251 new_entry = 0; /* index for creating new memmap entries */
252 last_type = 0; /* start with undefined memory type */
253 last_addr = 0; /* start with 0 as last starting address */
254 /* loop through change-points, determining affect on the new memmap */
255 for (chgidx = 0; chgidx < chg_nr; chgidx++) {
256 /* keep track of all overlapping memmap entries */
257 if (change_point[chgidx]->addr == change_point[chgidx]->pentry->addr) {
258 /* add map entry to overlap list (> 1 entry implies an overlap) */
259 overlap_list[overlap_entries++] = change_point[chgidx]->pentry;
260 } else {
261 /* remove entry from list (order independent, so swap with last) */
262 for (i = 0; i < overlap_entries; i++) {
263 if (overlap_list[i] == change_point[chgidx]->pentry)
264 overlap_list[i] = overlap_list[overlap_entries-1];
265 }
266 overlap_entries--;
267 }
268 /* if there are overlapping entries, decide which "type" to use */
269 /* (larger value takes precedence -- 1=usable, 2,3,4,4+=unusable) */
270 current_type = 0;
271 for (i = 0; i < overlap_entries; i++)
272 if (overlap_list[i]->type > current_type)
273 current_type = overlap_list[i]->type;
274 /* continue building up new memmap based on this information */
275 if (current_type != last_type) {
276 if (last_type != 0) {
277 new_map[new_entry].size =
278 change_point[chgidx]->addr - last_addr;
279 /* move forward only if the new size was non-zero */
280 if (new_map[new_entry].size != 0)
281 if (++new_entry >= BFIN_MEMMAP_MAX)
282 break; /* no more space left for new entries */
283 }
284 if (current_type != 0) {
285 new_map[new_entry].addr = change_point[chgidx]->addr;
286 new_map[new_entry].type = current_type;
287 last_addr = change_point[chgidx]->addr;
288 }
289 last_type = current_type;
290 }
291 }
292 new_nr = new_entry; /* retain count for new entries */
293
294 /* copy new mapping into original location */
295 memcpy(map, new_map, new_nr*sizeof(struct bfin_memmap_entry));
296 *pnr_map = new_nr;
297
298 return 0;
299}
300
301static void __init print_memory_map(char *who)
302{
303 int i;
304
305 for (i = 0; i < bfin_memmap.nr_map; i++) {
306 printk(KERN_DEBUG " %s: %016Lx - %016Lx ", who,
307 bfin_memmap.map[i].addr,
308 bfin_memmap.map[i].addr + bfin_memmap.map[i].size);
309 switch (bfin_memmap.map[i].type) {
310 case BFIN_MEMMAP_RAM:
311 printk("(usable)\n");
312 break;
313 case BFIN_MEMMAP_RESERVED:
314 printk("(reserved)\n");
315 break;
316 default: printk("type %lu\n", bfin_memmap.map[i].type);
317 break;
318 }
319 }
320}
321
322static __init int parse_memmap(char *arg)
323{
324 unsigned long long start_at, mem_size;
325
326 if (!arg)
327 return -EINVAL;
328
329 mem_size = memparse(arg, &arg);
330 if (*arg == '@') {
331 start_at = memparse(arg+1, &arg);
332 add_memory_region(start_at, mem_size, BFIN_MEMMAP_RAM);
333 } else if (*arg == '$') {
334 start_at = memparse(arg+1, &arg);
335 add_memory_region(start_at, mem_size, BFIN_MEMMAP_RESERVED);
336 }
337
338 return 0;
339}
340
126/* 341/*
127 * Initial parsing of the command line. Currently, we support: 342 * Initial parsing of the command line. Currently, we support:
128 * - Controlling the linux memory size: mem=xxx[KMG] 343 * - Controlling the linux memory size: mem=xxx[KMG]
129 * - Controlling the physical memory size: max_mem=xxx[KMG][$][#] 344 * - Controlling the physical memory size: max_mem=xxx[KMG][$][#]
130 * $ -> reserved memory is dcacheable 345 * $ -> reserved memory is dcacheable
131 * # -> reserved memory is icacheable 346 * # -> reserved memory is icacheable
347 * - "memmap=XXX[KkmM][@][$]XXX[KkmM]" defines a memory region
348 * @ from <start> to <start>+<mem>, type RAM
349 * $ from <start> to <start>+<mem>, type RESERVED
350 *
132 */ 351 */
133static __init void parse_cmdline_early(char *cmdline_p) 352static __init void parse_cmdline_early(char *cmdline_p)
134{ 353{
@@ -136,7 +355,6 @@ static __init void parse_cmdline_early(char *cmdline_p)
136 unsigned int memsize; 355 unsigned int memsize;
137 for (;;) { 356 for (;;) {
138 if (c == ' ') { 357 if (c == ' ') {
139
140 if (!memcmp(to, "mem=", 4)) { 358 if (!memcmp(to, "mem=", 4)) {
141 to += 4; 359 to += 4;
142 memsize = memparse(to, &to); 360 memsize = memparse(to, &to);
@@ -162,6 +380,9 @@ static __init void parse_cmdline_early(char *cmdline_p)
162 } else if (!memcmp(to, "earlyprintk=", 12)) { 380 } else if (!memcmp(to, "earlyprintk=", 12)) {
163 to += 12; 381 to += 12;
164 setup_early_printk(to); 382 setup_early_printk(to);
383 } else if (!memcmp(to, "memmap=", 7)) {
384 to += 7;
385 parse_memmap(to);
165 } 386 }
166 } 387 }
167 c = *(to++); 388 c = *(to++);
@@ -170,75 +391,36 @@ static __init void parse_cmdline_early(char *cmdline_p)
170 } 391 }
171} 392}
172 393
173void __init setup_arch(char **cmdline_p) 394/*
395 * Setup memory defaults from user config.
396 * The physical memory layout looks like:
397 *
398 * [_rambase, _ramstart]: kernel image
399 * [memory_start, memory_end]: dynamic memory managed by kernel
400 * [memory_end, _ramend]: reserved memory
401 * [meory_mtd_start(memory_end),
402 * memory_mtd_start + mtd_size]: rootfs (if any)
403 * [_ramend - DMA_UNCACHED_REGION,
404 * _ramend]: uncached DMA region
405 * [_ramend, physical_mem_end]: memory not managed by kernel
406 *
407 */
408static __init void memory_setup(void)
174{ 409{
175 int bootmap_size;
176 unsigned long l1_length, sclk, cclk;
177#ifdef CONFIG_MTD_UCLINUX 410#ifdef CONFIG_MTD_UCLINUX
178 unsigned long mtd_phys = 0; 411 unsigned long mtd_phys = 0;
179#endif 412#endif
180 413
181#ifdef CONFIG_DUMMY_CONSOLE 414 _rambase = (unsigned long)_stext;
182 conswitchp = &dummy_con; 415 _ramstart = (unsigned long)_end;
183#endif
184
185#if defined(CONFIG_CMDLINE_BOOL)
186 strncpy(&command_line[0], CONFIG_CMDLINE, sizeof(command_line));
187 command_line[sizeof(command_line) - 1] = 0;
188#endif
189
190 /* Keep a copy of command line */
191 *cmdline_p = &command_line[0];
192 memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
193 boot_command_line[COMMAND_LINE_SIZE - 1] = '\0';
194
195 /* setup memory defaults from the user config */
196 physical_mem_end = 0;
197 _ramend = CONFIG_MEM_SIZE * 1024 * 1024;
198
199 parse_cmdline_early(&command_line[0]);
200
201 cclk = get_cclk();
202 sclk = get_sclk();
203
204#if !defined(CONFIG_BFIN_KERNEL_CLOCK)
205 if (ANOMALY_05000273 && cclk == sclk)
206 panic("ANOMALY 05000273, SCLK can not be same as CCLK");
207#endif
208 416
209#ifdef BF561_FAMILY 417 if (DMA_UNCACHED_REGION > (_ramend - _ramstart)) {
210 if (ANOMALY_05000266) { 418 console_init();
211 bfin_read_IMDMA_D0_IRQ_STATUS(); 419 panic("DMA region exceeds memory limit: %lu.\n",
212 bfin_read_IMDMA_D1_IRQ_STATUS(); 420 _ramend - _ramstart);
213 } 421 }
214#endif
215
216 printk(KERN_INFO "Hardware Trace ");
217 if (bfin_read_TBUFCTL() & 0x1 )
218 printk("Active ");
219 else
220 printk("Off ");
221 if (bfin_read_TBUFCTL() & 0x2)
222 printk("and Enabled\n");
223 else
224 printk("and Disabled\n");
225
226
227#if defined(CONFIG_CHR_DEV_FLASH) || defined(CONFIG_BLK_DEV_FLASH)
228 /* we need to initialize the Flashrom device here since we might
229 * do things with flash early on in the boot
230 */
231 flash_probe();
232#endif
233
234 if (physical_mem_end == 0)
235 physical_mem_end = _ramend;
236
237 /* by now the stack is part of the init task */
238 memory_end = _ramend - DMA_UNCACHED_REGION; 422 memory_end = _ramend - DMA_UNCACHED_REGION;
239 423
240 _ramstart = (unsigned long)__bss_stop;
241 _rambase = (unsigned long)_stext;
242#ifdef CONFIG_MPU 424#ifdef CONFIG_MPU
243 /* Round up to multiple of 4MB. */ 425 /* Round up to multiple of 4MB. */
244 memory_start = (_ramstart + 0x3fffff) & ~0x3fffff; 426 memory_start = (_ramstart + 0x3fffff) & ~0x3fffff;
@@ -292,7 +474,7 @@ void __init setup_arch(char **cmdline_p)
292 } 474 }
293 475
294 /* Relocate MTD image to the top of memory after the uncached memory area */ 476 /* Relocate MTD image to the top of memory after the uncached memory area */
295 dma_memcpy((char *)memory_end, __bss_stop, mtd_size); 477 dma_memcpy((char *)memory_end, _end, mtd_size);
296 478
297 memory_mtd_start = memory_end; 479 memory_mtd_start = memory_end;
298 _ebss = memory_mtd_start; /* define _ebss for compatible */ 480 _ebss = memory_mtd_start; /* define _ebss for compatible */
@@ -319,13 +501,175 @@ void __init setup_arch(char **cmdline_p)
319#endif 501#endif
320 502
321#if !defined(CONFIG_MTD_UCLINUX) 503#if !defined(CONFIG_MTD_UCLINUX)
322 memory_end -= SIZE_4K; /*In case there is no valid CPLB behind memory_end make sure we don't get to close*/ 504 /*In case there is no valid CPLB behind memory_end make sure we don't get to close*/
505 memory_end -= SIZE_4K;
323#endif 506#endif
507
324 init_mm.start_code = (unsigned long)_stext; 508 init_mm.start_code = (unsigned long)_stext;
325 init_mm.end_code = (unsigned long)_etext; 509 init_mm.end_code = (unsigned long)_etext;
326 init_mm.end_data = (unsigned long)_edata; 510 init_mm.end_data = (unsigned long)_edata;
327 init_mm.brk = (unsigned long)0; 511 init_mm.brk = (unsigned long)0;
328 512
513 printk(KERN_INFO "Board Memory: %ldMB\n", physical_mem_end >> 20);
514 printk(KERN_INFO "Kernel Managed Memory: %ldMB\n", _ramend >> 20);
515
516 printk(KERN_INFO "Memory map:\n"
517 KERN_INFO " text = 0x%p-0x%p\n"
518 KERN_INFO " rodata = 0x%p-0x%p\n"
519 KERN_INFO " bss = 0x%p-0x%p\n"
520 KERN_INFO " data = 0x%p-0x%p\n"
521 KERN_INFO " stack = 0x%p-0x%p\n"
522 KERN_INFO " init = 0x%p-0x%p\n"
523 KERN_INFO " available = 0x%p-0x%p\n"
524#ifdef CONFIG_MTD_UCLINUX
525 KERN_INFO " rootfs = 0x%p-0x%p\n"
526#endif
527#if DMA_UNCACHED_REGION > 0
528 KERN_INFO " DMA Zone = 0x%p-0x%p\n"
529#endif
530 , _stext, _etext,
531 __start_rodata, __end_rodata,
532 __bss_start, __bss_stop,
533 _sdata, _edata,
534 (void *)&init_thread_union,
535 (void *)((int)(&init_thread_union) + 0x2000),
536 __init_begin, __init_end,
537 (void *)_ramstart, (void *)memory_end
538#ifdef CONFIG_MTD_UCLINUX
539 , (void *)memory_mtd_start, (void *)(memory_mtd_start + mtd_size)
540#endif
541#if DMA_UNCACHED_REGION > 0
542 , (void *)(_ramend - DMA_UNCACHED_REGION), (void *)(_ramend)
543#endif
544 );
545}
546
547static __init void setup_bootmem_allocator(void)
548{
549 int bootmap_size;
550 int i;
551 unsigned long min_pfn, max_pfn;
552 unsigned long curr_pfn, last_pfn, size;
553
554 /* mark memory between memory_start and memory_end usable */
555 add_memory_region(memory_start,
556 memory_end - memory_start, BFIN_MEMMAP_RAM);
557 /* sanity check for overlap */
558 sanitize_memmap(bfin_memmap.map, &bfin_memmap.nr_map);
559 print_memory_map("boot memmap");
560
561 min_pfn = PAGE_OFFSET >> PAGE_SHIFT;
562 max_pfn = memory_end >> PAGE_SHIFT;
563
564 /*
565 * give all the memory to the bootmap allocator, tell it to put the
566 * boot mem_map at the start of memory.
567 */
568 bootmap_size = init_bootmem_node(NODE_DATA(0),
569 memory_start >> PAGE_SHIFT, /* map goes here */
570 min_pfn, max_pfn);
571
572 /* register the memmap regions with the bootmem allocator */
573 for (i = 0; i < bfin_memmap.nr_map; i++) {
574 /*
575 * Reserve usable memory
576 */
577 if (bfin_memmap.map[i].type != BFIN_MEMMAP_RAM)
578 continue;
579 /*
580 * We are rounding up the start address of usable memory:
581 */
582 curr_pfn = PFN_UP(bfin_memmap.map[i].addr);
583 if (curr_pfn >= max_pfn)
584 continue;
585 /*
586 * ... and at the end of the usable range downwards:
587 */
588 last_pfn = PFN_DOWN(bfin_memmap.map[i].addr +
589 bfin_memmap.map[i].size);
590
591 if (last_pfn > max_pfn)
592 last_pfn = max_pfn;
593
594 /*
595 * .. finally, did all the rounding and playing
596 * around just make the area go away?
597 */
598 if (last_pfn <= curr_pfn)
599 continue;
600
601 size = last_pfn - curr_pfn;
602 free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(size));
603 }
604
605 /* reserve memory before memory_start, including bootmap */
606 reserve_bootmem(PAGE_OFFSET,
607 memory_start + bootmap_size + PAGE_SIZE - 1 - PAGE_OFFSET,
608 BOOTMEM_DEFAULT);
609}
610
611void __init setup_arch(char **cmdline_p)
612{
613 unsigned long l1_length, sclk, cclk;
614
615#ifdef CONFIG_DUMMY_CONSOLE
616 conswitchp = &dummy_con;
617#endif
618
619#if defined(CONFIG_CMDLINE_BOOL)
620 strncpy(&command_line[0], CONFIG_CMDLINE, sizeof(command_line));
621 command_line[sizeof(command_line) - 1] = 0;
622#endif
623
624 /* Keep a copy of command line */
625 *cmdline_p = &command_line[0];
626 memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
627 boot_command_line[COMMAND_LINE_SIZE - 1] = '\0';
628
629 /* setup memory defaults from the user config */
630 physical_mem_end = 0;
631 _ramend = CONFIG_MEM_SIZE * 1024 * 1024;
632
633 memset(&bfin_memmap, 0, sizeof(bfin_memmap));
634
635 parse_cmdline_early(&command_line[0]);
636
637 if (physical_mem_end == 0)
638 physical_mem_end = _ramend;
639
640 memory_setup();
641
642 cclk = get_cclk();
643 sclk = get_sclk();
644
645#if !defined(CONFIG_BFIN_KERNEL_CLOCK)
646 if (ANOMALY_05000273 && cclk == sclk)
647 panic("ANOMALY 05000273, SCLK can not be same as CCLK");
648#endif
649
650#ifdef BF561_FAMILY
651 if (ANOMALY_05000266) {
652 bfin_read_IMDMA_D0_IRQ_STATUS();
653 bfin_read_IMDMA_D1_IRQ_STATUS();
654 }
655#endif
656 printk(KERN_INFO "Hardware Trace ");
657 if (bfin_read_TBUFCTL() & 0x1)
658 printk("Active ");
659 else
660 printk("Off ");
661 if (bfin_read_TBUFCTL() & 0x2)
662 printk("and Enabled\n");
663 else
664 printk("and Disabled\n");
665
666#if defined(CONFIG_CHR_DEV_FLASH) || defined(CONFIG_BLK_DEV_FLASH)
667 /* we need to initialize the Flashrom device here since we might
668 * do things with flash early on in the boot
669 */
670 flash_probe();
671#endif
672
329 _bfin_swrst = bfin_read_SWRST(); 673 _bfin_swrst = bfin_read_SWRST();
330 674
331 if (_bfin_swrst & RESET_DOUBLE) 675 if (_bfin_swrst & RESET_DOUBLE)
@@ -335,7 +679,7 @@ void __init setup_arch(char **cmdline_p)
335 else if (_bfin_swrst & RESET_SOFTWARE) 679 else if (_bfin_swrst & RESET_SOFTWARE)
336 printk(KERN_NOTICE "Reset caused by Software reset\n"); 680 printk(KERN_NOTICE "Reset caused by Software reset\n");
337 681
338 printk(KERN_INFO "Blackfin support (C) 2004-2007 Analog Devices, Inc.\n"); 682 printk(KERN_INFO "Blackfin support (C) 2004-2008 Analog Devices, Inc.\n");
339 if (bfin_compiled_revid() == 0xffff) 683 if (bfin_compiled_revid() == 0xffff)
340 printk(KERN_INFO "Compiled for ADSP-%s Rev any\n", CPU); 684 printk(KERN_INFO "Compiled for ADSP-%s Rev any\n", CPU);
341 else if (bfin_compiled_revid() == -1) 685 else if (bfin_compiled_revid() == -1)
@@ -361,55 +705,8 @@ void __init setup_arch(char **cmdline_p)
361 if (ANOMALY_05000273 && (cclk >> 1) <= sclk) 705 if (ANOMALY_05000273 && (cclk >> 1) <= sclk)
362 printk("\n\n\nANOMALY_05000273: CCLK must be >= 2*SCLK !!!\n\n\n"); 706 printk("\n\n\nANOMALY_05000273: CCLK must be >= 2*SCLK !!!\n\n\n");
363 707
364 printk(KERN_INFO "Board Memory: %ldMB\n", physical_mem_end >> 20); 708 setup_bootmem_allocator();
365 printk(KERN_INFO "Kernel Managed Memory: %ldMB\n", _ramend >> 20);
366
367 printk(KERN_INFO "Memory map:\n"
368 KERN_INFO " text = 0x%p-0x%p\n"
369 KERN_INFO " rodata = 0x%p-0x%p\n"
370 KERN_INFO " data = 0x%p-0x%p\n"
371 KERN_INFO " stack = 0x%p-0x%p\n"
372 KERN_INFO " init = 0x%p-0x%p\n"
373 KERN_INFO " bss = 0x%p-0x%p\n"
374 KERN_INFO " available = 0x%p-0x%p\n"
375#ifdef CONFIG_MTD_UCLINUX
376 KERN_INFO " rootfs = 0x%p-0x%p\n"
377#endif
378#if DMA_UNCACHED_REGION > 0
379 KERN_INFO " DMA Zone = 0x%p-0x%p\n"
380#endif
381 , _stext, _etext,
382 __start_rodata, __end_rodata,
383 _sdata, _edata,
384 (void *)&init_thread_union, (void *)((int)(&init_thread_union) + 0x2000),
385 __init_begin, __init_end,
386 __bss_start, __bss_stop,
387 (void *)_ramstart, (void *)memory_end
388#ifdef CONFIG_MTD_UCLINUX
389 , (void *)memory_mtd_start, (void *)(memory_mtd_start + mtd_size)
390#endif
391#if DMA_UNCACHED_REGION > 0
392 , (void *)(_ramend - DMA_UNCACHED_REGION), (void *)(_ramend)
393#endif
394 );
395 709
396 /*
397 * give all the memory to the bootmap allocator, tell it to put the
398 * boot mem_map at the start of memory
399 */
400 bootmap_size = init_bootmem_node(NODE_DATA(0), memory_start >> PAGE_SHIFT, /* map goes here */
401 PAGE_OFFSET >> PAGE_SHIFT,
402 memory_end >> PAGE_SHIFT);
403 /*
404 * free the usable memory, we have to make sure we do not free
405 * the bootmem bitmap so we then reserve it after freeing it :-)
406 */
407 free_bootmem(memory_start, memory_end - memory_start);
408
409 reserve_bootmem(memory_start, bootmap_size, BOOTMEM_DEFAULT);
410 /*
411 * get kmalloc into gear
412 */
413 paging_init(); 710 paging_init();
414 711
415 /* check the size of the l1 area */ 712 /* check the size of the l1 area */
@@ -450,15 +747,15 @@ void __init setup_arch(char **cmdline_p)
450 747
451static int __init topology_init(void) 748static int __init topology_init(void)
452{ 749{
453#if defined (CONFIG_BF561) 750 int cpu;
454 static struct cpu cpu[2]; 751
455 register_cpu(&cpu[0], 0); 752 for_each_possible_cpu(cpu) {
456 register_cpu(&cpu[1], 1); 753 struct cpu *c = &per_cpu(cpu_devices, cpu);
754
755 register_cpu(c, cpu);
756 }
757
457 return 0; 758 return 0;
458#else
459 static struct cpu cpu[1];
460 return register_cpu(cpu, 0);
461#endif
462} 759}
463 760
464subsys_initcall(topology_init); 761subsys_initcall(topology_init);