[Blackfin] arch: fix building with mtd uclinux by putting the mtd_phys option into...
[cascardo/linux.git] / arch / blackfin / kernel / setup.c
index 2f156bf..8229b10 100644 (file)
@@ -1,30 +1,11 @@
 /*
- * File:         arch/blackfin/kernel/setup.c
- * Based on:
- * Author:
+ * arch/blackfin/kernel/setup.c
  *
- * Created:
- * Description:
+ * Copyright 2004-2006 Analog Devices Inc.
  *
- * Modified:
- *               Copyright 2004-2006 Analog Devices Inc.
+ * Enter bugs at http://blackfin.uclinux.org/
  *
- * Bugs:         Enter bugs at http://blackfin.uclinux.org/
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see the file COPYING, or write
- * to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ * Licensed under the GPL-2 or later.
  */
 
 #include <linux/delay.h>
@@ -48,6 +29,8 @@
 #include <asm/fixed_code.h>
 #include <asm/early_printk.h>
 
+static DEFINE_PER_CPU(struct cpu, cpu_devices);
+
 u16 _bfin_swrst;
 
 unsigned long memory_start, memory_end, physical_mem_end;
@@ -424,8 +407,12 @@ static __init void parse_cmdline_early(char *cmdline_p)
  */
 static __init void  memory_setup(void)
 {
+#ifdef CONFIG_MTD_UCLINUX
+       unsigned long mtd_phys = 0;
+#endif
+
        _rambase = (unsigned long)_stext;
-       _ramstart = (unsigned long)__bss_stop;
+       _ramstart = (unsigned long)_end;
 
        if (DMA_UNCACHED_REGION > (_ramend - _ramstart)) {
                console_init();
@@ -487,7 +474,7 @@ static __init void  memory_setup(void)
        }
 
        /* Relocate MTD image to the top of memory after the uncached memory area */
-       dma_memcpy((char *)memory_end, __bss_stop, mtd_size);
+       dma_memcpy((char *)memory_end, _end, mtd_size);
 
        memory_mtd_start = memory_end;
        _ebss = memory_mtd_start;       /* define _ebss for compatible */
@@ -526,13 +513,13 @@ static __init void  memory_setup(void)
        printk(KERN_INFO "Board Memory: %ldMB\n", physical_mem_end >> 20);
        printk(KERN_INFO "Kernel Managed Memory: %ldMB\n", _ramend >> 20);
 
-       printk( KERN_INFO "Memory map:\n"
+       printk(KERN_INFO "Memory map:\n"
                KERN_INFO "  text      = 0x%p-0x%p\n"
                KERN_INFO "  rodata    = 0x%p-0x%p\n"
+               KERN_INFO "  bss       = 0x%p-0x%p\n"
                KERN_INFO "  data      = 0x%p-0x%p\n"
                KERN_INFO "    stack   = 0x%p-0x%p\n"
                KERN_INFO "  init      = 0x%p-0x%p\n"
-               KERN_INFO "  bss       = 0x%p-0x%p\n"
                KERN_INFO "  available = 0x%p-0x%p\n"
 #ifdef CONFIG_MTD_UCLINUX
                KERN_INFO "  rootfs    = 0x%p-0x%p\n"
@@ -542,12 +529,12 @@ static __init void  memory_setup(void)
 #endif
                , _stext, _etext,
                __start_rodata, __end_rodata,
+               __bss_start, __bss_stop,
                _sdata, _edata,
                (void *)&init_thread_union,
                (void *)((int)(&init_thread_union) + 0x2000),
-              __init_begin, __init_end,
-              __bss_start, __bss_stop,
-              (void *)_ramstart, (void *)memory_end
+               __init_begin, __init_end,
+               (void *)_ramstart, (void *)memory_end
 #ifdef CONFIG_MTD_UCLINUX
                , (void *)memory_mtd_start, (void *)(memory_mtd_start + mtd_size)
 #endif
@@ -624,9 +611,6 @@ static __init void setup_bootmem_allocator(void)
 void __init setup_arch(char **cmdline_p)
 {
        unsigned long l1_length, sclk, cclk;
-#ifdef CONFIG_MTD_UCLINUX
-       unsigned long mtd_phys = 0;
-#endif
 
 #ifdef CONFIG_DUMMY_CONSOLE
        conswitchp = &dummy_con;
@@ -695,7 +679,7 @@ void __init setup_arch(char **cmdline_p)
        else if (_bfin_swrst & RESET_SOFTWARE)
                printk(KERN_NOTICE "Reset caused by Software reset\n");
 
-       printk(KERN_INFO "Blackfin support (C) 2004-2007 Analog Devices, Inc.\n");
+       printk(KERN_INFO "Blackfin support (C) 2004-2008 Analog Devices, Inc.\n");
        if (bfin_compiled_revid() == 0xffff)
                printk(KERN_INFO "Compiled for ADSP-%s Rev any\n", CPU);
        else if (bfin_compiled_revid() == -1)
@@ -763,15 +747,15 @@ void __init setup_arch(char **cmdline_p)
 
 static int __init topology_init(void)
 {
-#if defined (CONFIG_BF561)
-       static struct cpu cpu[2];
-       register_cpu(&cpu[0], 0);
-       register_cpu(&cpu[1], 1);
+       int cpu;
+
+       for_each_possible_cpu(cpu) {
+               struct cpu *c = &per_cpu(cpu_devices, cpu);
+
+               register_cpu(c, cpu);
+       }
+
        return 0;
-#else
-       static struct cpu cpu[1];
-       return register_cpu(cpu, 0);
-#endif
 }
 
 subsys_initcall(topology_init);