]> git.sur5r.net Git - u-boot/blobdiff - board/freescale/qemu-ppce500/qemu-ppce500.c
libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>
[u-boot] / board / freescale / qemu-ppce500 / qemu-ppce500.c
index 3dbb0cf43b8a00b0bdcc18a77489336b98a99511..2353f3ff1fe3f230969e659b6e90e64ceb68d564 100644 (file)
@@ -11,7 +11,7 @@
 #include <asm/mmu.h>
 #include <asm/fsl_pci.h>
 #include <asm/io.h>
-#include <libfdt.h>
+#include <linux/libfdt.h>
 #include <fdt_support.h>
 #include <netdev.h>
 #include <fdtdec.h>
@@ -50,13 +50,19 @@ uint64_t get_phys_ccsrbar_addr_early(void)
 {
        void *fdt = get_fdt_virt();
        uint64_t r;
+       int size, node;
+       u32 naddr;
+       const fdt32_t *prop;
 
        /*
         * To be able to read the FDT we need to create a temporary TLB
         * map for it.
         */
        map_fdt_as(10);
-       r = fdt_get_base_address(fdt, fdt_path_offset(fdt, "/soc"));
+       node = fdt_path_offset(fdt, "/soc");
+       naddr = fdt_address_cells(fdt, node);
+       prop = fdt_getprop(fdt, node, "ranges", &size);
+       r = fdt_translate_address(fdt, node, prop + naddr);
        disable_tlb(10);
 
        return r;
@@ -81,7 +87,7 @@ static int pci_map_region(void *fdt, int pci_node, int range_id,
        ulong map_addr;
        int r;
 
-       r = fdt_read_range(fdt, pci_node, 0, NULL, &addr, &size);
+       r = fdt_read_range(fdt, pci_node, range_id, NULL, &addr, &size);
        if (r)
                return r;
 
@@ -205,10 +211,10 @@ int last_stage_init(void)
        /* -kernel boot */
        prop = fdt_getprop(fdt, chosen, "qemu,boot-kernel", &len);
        if (prop && (len >= 8))
-               setenv_hex("qemu_kernel_addr", *prop);
+               env_set_hex("qemu_kernel_addr", *prop);
 
        /* Give the user a variable for the host fdt */
-       setenv_hex("fdt_addr_r", (ulong)fdt);
+       env_set_hex("fdt_addr_r", (ulong)fdt);
 
        return 0;
 }
@@ -235,9 +241,11 @@ int board_eth_init(bd_t *bis)
 }
 
 #if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
 {
        FT_FSL_PCI_SETUP;
+
+       return 0;
 }
 #endif
 
@@ -346,3 +354,23 @@ ulong get_bus_freq (ulong dummy)
        get_sys_info(&sys_info);
        return sys_info.freq_systembus;
 }
+
+/*
+ * Return the number of cores on this SOC.
+ */
+int cpu_numcores(void)
+{
+       /*
+        * The QEMU u-boot target only needs to drive the first core,
+        * spinning and device tree nodes get driven by QEMU itself
+        */
+       return 1;
+}
+
+/*
+ * Return a 32-bit mask indicating which cores are present on this SOC.
+ */
+u32 cpu_mask(void)
+{
+       return (1 << cpu_numcores()) - 1;
+}