Merge tag 'for-linus' of git://linux-c6x.org/git/projects/linux-c6x-upstreaming
[sfrench/cifs-2.6.git] / arch / c6x / kernel / setup.c
index 786e36e2f61de91c8f446cc941cff895cdb91578..e9d6824ae94d51201a9aea3c4200318a206bff2d 100644 (file)
@@ -11,7 +11,6 @@
 #include <linux/dma-mapping.h>
 #include <linux/memblock.h>
 #include <linux/seq_file.h>
-#include <linux/bootmem.h>
 #include <linux/clkdev.h>
 #include <linux/initrd.h>
 #include <linux/kernel.h>
@@ -96,7 +95,7 @@ static void __init get_cpuinfo(void)
        unsigned long core_khz;
        u64 tmp;
        struct cpuinfo_c6x *p;
-       struct device_node *node, *np;
+       struct device_node *node;
 
        p = &per_cpu(cpu_data, smp_processor_id());
 
@@ -190,13 +189,8 @@ static void __init get_cpuinfo(void)
 
        p->core_id = get_coreid();
 
-       node = of_find_node_by_name(NULL, "cpus");
-       if (node) {
-               for_each_child_of_node(node, np)
-                       if (!strcmp("cpu", np->name))
-                               ++c6x_num_cores;
-               of_node_put(node);
-       }
+       for_each_of_cpu_node(node)
+               ++c6x_num_cores;
 
        node = of_find_node_by_name(NULL, "soc");
        if (node) {
@@ -270,7 +264,7 @@ int __init c6x_add_memory(phys_addr_t start, unsigned long size)
 notrace void __init machine_init(unsigned long dt_ptr)
 {
        void *dtb = __va(dt_ptr);
-       void *fdt = _fdt_start;
+       void *fdt = __dtb_start;
 
        /* interrupts must be masked */
        set_creg(IER, 2);
@@ -296,7 +290,6 @@ notrace void __init machine_init(unsigned long dt_ptr)
 
 void __init setup_arch(char **cmdline_p)
 {
-       int bootmap_size;
        struct memblock_region *reg;
 
        printk(KERN_INFO "Initializing kernel\n");
@@ -353,17 +346,7 @@ void __init setup_arch(char **cmdline_p)
        init_mm.end_data   = memory_start;
        init_mm.brk        = memory_start;
 
-       /*
-        * Give all the memory to the bootmap allocator,  tell it to put the
-        * boot mem_map at the start of memory
-        */
-       bootmap_size = init_bootmem_node(NODE_DATA(0),
-                                        memory_start >> PAGE_SHIFT,
-                                        PAGE_OFFSET >> PAGE_SHIFT,
-                                        memory_end >> PAGE_SHIFT);
-       memblock_reserve(memory_start, bootmap_size);
-
-       unflatten_device_tree();
+       unflatten_and_copy_device_tree();
 
        c6x_cache_init();
 
@@ -397,22 +380,9 @@ void __init setup_arch(char **cmdline_p)
        /* Initialize the coherent memory allocator */
        coherent_mem_init(dma_start, dma_size);
 
-       /*
-        * Free all memory as a starting point.
-        */
-       free_bootmem(PAGE_OFFSET, memory_end - PAGE_OFFSET);
-
-       /*
-        * Then reserve memory which is already being used.
-        */
-       for_each_memblock(reserved, reg) {
-               pr_debug("reserved - 0x%08x-0x%08x\n",
-                        (u32) reg->base, (u32) reg->size);
-               reserve_bootmem(reg->base, reg->size, BOOTMEM_DEFAULT);
-       }
-
        max_low_pfn = PFN_DOWN(memory_end);
        min_low_pfn = PFN_UP(memory_start);
+       max_pfn = max_low_pfn;
        max_mapnr = max_low_pfn - min_low_pfn;
 
        /* Get kmalloc into gear */