net: ks8851: Clean up chip ID readout
[oweals/u-boot.git] / common / board_f.c
index 26309c44d233e43cb7d9ee65d9ea8afc5dfe356d..01194eaa0e4d3cf9ba20c00aee0cd24ef69b0a20 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <common.h>
 #include <bloblist.h>
+#include <bootstage.h>
 #include <clock_legacy.h>
 #include <console.h>
 #include <cpu.h>
@@ -25,6 +26,7 @@
 #include <init.h>
 #include <initcall.h>
 #include <lcd.h>
+#include <log.h>
 #include <malloc.h>
 #include <mapmem.h>
 #include <os.h>
@@ -40,6 +42,7 @@
 #include <trace.h>
 #include <video.h>
 #include <watchdog.h>
+#include <asm/cache.h>
 #ifdef CONFIG_MACH_TYPE
 #include <asm/mach-types.h>
 #endif
@@ -183,11 +186,11 @@ static int print_cpuinfo(void)
        char desc[512];
        int ret;
 
-       ret = uclass_first_device_err(UCLASS_CPU, &dev);
-       if (ret) {
-               debug("%s: Could not get CPU device (err = %d)\n",
-                     __func__, ret);
-               return ret;
+       dev = cpu_get_current_dev();
+       if (!dev) {
+               debug("%s: Could not get CPU device\n",
+                     __func__);
+               return -ENODEV;
        }
 
        ret = cpu_get_desc(dev, desc, sizeof(desc));
@@ -309,7 +312,7 @@ __weak int mach_cpu_init(void)
 /* Get the top of usable RAM */
 __weak ulong board_get_usable_ram_top(ulong total_size)
 {
-#ifdef CONFIG_SYS_SDRAM_BASE
+#if defined(CONFIG_SYS_SDRAM_BASE) && CONFIG_SYS_SDRAM_BASE > 0
        /*
         * Detect whether we have so much RAM that it goes past the end of our
         * 32-bit address space. If so, clip the usable RAM so it doesn't.
@@ -385,6 +388,11 @@ static int reserve_round_4k(void)
        return 0;
 }
 
+__weak int arch_reserve_mmu(void)
+{
+       return 0;
+}
+
 static int reserve_video(void)
 {
 #ifdef CONFIG_DM_VIDEO
@@ -817,9 +825,9 @@ static int initf_dm(void)
 #if defined(CONFIG_DM) && CONFIG_VAL(SYS_MALLOC_F_LEN)
        int ret;
 
-       bootstage_start(BOOTSTATE_ID_ACCUM_DM_F, "dm_f");
+       bootstage_start(BOOTSTAGE_ID_ACCUM_DM_F, "dm_f");
        ret = dm_init_and_scan(true);
-       bootstage_accum(BOOTSTATE_ID_ACCUM_DM_F);
+       bootstage_accum(BOOTSTAGE_ID_ACCUM_DM_F);
        if (ret)
                return ret;
 #endif
@@ -951,9 +959,7 @@ static const init_fnc_t init_sequence_f[] = {
        reserve_pram,
 #endif
        reserve_round_4k,
-#ifdef CONFIG_ARM
-       reserve_mmu,
-#endif
+       arch_reserve_mmu,
        reserve_video,
        reserve_trace,
        reserve_uboot,