]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
vexpress64: remove board late init, use smhload
authorLinus Walleij <linus.walleij@linaro.org>
Mon, 23 Mar 2015 10:06:12 +0000 (11:06 +0100)
committerTom Rini <trini@konsulko.com>
Sat, 28 Mar 2015 16:07:45 +0000 (12:07 -0400)
This removes the kludgy late board init from the FVP simulator
version of Versatile Express 64bit (ARMv8), and replace it with
a default boot command using the new smhload command to load
the files using semihosting. Tested on the Foundation Model.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
board/armltd/vexpress64/vexpress64.c
include/configs/vexpress_aemv8a.h

index de6286435d97096e064c6220546046ff31c6b77c..876cb678eb03e6d469db1b1adb63de5f68831caf 100644 (file)
@@ -11,7 +11,6 @@
 #include <netdev.h>
 #include <asm/io.h>
 #include <linux/compiler.h>
-#include <asm/semihosting.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -33,101 +32,6 @@ void reset_cpu(ulong addr)
 {
 }
 
-#ifdef CONFIG_BOARD_LATE_INIT
-int board_late_init(void)
-{
-#ifdef CONFIG_SEMIHOSTING
-       /*
-        * Please refer to doc/README.semihosting for a more complete
-        * description.
-        *
-        * We require that the board include file defines these env variables:
-        * - kernel_name
-        * - kernel_addr_r
-        * - initrd_name
-        * - initrd_addr_r
-        * - fdt_name
-        * - fdt_addr_r
-        *
-        * For the "fdt chosen" startup macro, this code will then define:
-        * - initrd_end (based on initrd_addr_r plus actual initrd_size)
-        *
-        * We will then load the kernel, initrd, and fdt into the specified
-        * locations in memory in a similar way that the ATF fastmodel code
-        * uses semihosting calls to load other boot stages and u-boot itself.
-        */
-
-       /* Env variable strings */
-       char *kernel_name = getenv("kernel_name");
-       char *kernel_addr_str = getenv("kernel_addr_r");
-       char *initrd_name = getenv("initrd_name");
-       char *initrd_addr_str = getenv("initrd_addr_r");
-       char *fdt_name = getenv("fdt_name");
-       char *fdt_addr_str = getenv("fdt_addr_r");
-       char initrd_end_str[64];
-
-       /* Actual addresses converted from env variables */
-       void *kernel_addr_r;
-       void *initrd_addr_r;
-       void *fdt_addr_r;
-
-       /* Actual initrd base and size */
-       unsigned long initrd_base;
-       unsigned long initrd_size;
-
-       /* Space available */
-       int avail;
-
-       /* Make sure the environment variables needed are set */
-       if (!(kernel_addr_str && initrd_addr_str && fdt_addr_str)) {
-               printf("%s: Define {kernel/initrd/fdt}_addr_r\n", __func__);
-               return -1;
-       }
-       if (!(kernel_name && initrd_name && fdt_name)) {
-               printf("%s: Define {kernel/initrd/fdt}_name\n", __func__);
-               return -1;
-       }
-
-       /* Get exact initrd_size */
-       initrd_size = smh_len(initrd_name);
-       if (initrd_size == -1) {
-               printf("%s: Can't get file size for \'%s\'\n", __func__,
-                      initrd_name);
-               return -1;
-       }
-
-       /* Set initrd_end */
-       initrd_base = simple_strtoul(initrd_addr_str, NULL, 16);
-       initrd_addr_r = (void *)initrd_base;
-       sprintf(initrd_end_str, "0x%lx", initrd_base + initrd_size - 1);
-       setenv("initrd_end", initrd_end_str);
-
-       /* Load kernel to memory */
-       fdt_addr_r = (void *)simple_strtoul(fdt_addr_str, NULL, 16);
-       kernel_addr_r = (void *)simple_strtoul(kernel_addr_str, NULL, 16);
-
-       /*
-        * The kernel must be lower in memory than fdt and loading the
-        * kernel must not trample the fdt or vice versa.
-        */
-       avail = fdt_addr_r - kernel_addr_r;
-       if (avail < 0) {
-               printf("%s: fdt must be after kernel\n", __func__);
-               return -1;
-       }
-       smh_load(kernel_name, kernel_addr_r, avail, 1);
-
-       /* Load fdt to memory */
-       smh_load(fdt_name, fdt_addr_r, 0x20000, 1);
-
-       /* Load initrd to memory */
-       smh_load(initrd_name, initrd_addr_r, initrd_size, 1);
-
-#endif                         /* CONFIG_SEMIHOSTING */
-       return 0;
-}
-#endif                         /* CONFIG_BOARD_LATE_INIT */
-
 /*
  * Board specific ethernet initialization routine.
  */
index 810eef12deb107740463733f99b344c2edbc3480..57924610c022e794d7de4a7d1a815dceb7fcf44e 100644 (file)
@@ -15,7 +15,6 @@
 #ifndef CONFIG_SEMIHOSTING
 #error CONFIG_TARGET_VEXPRESS64_BASE_FVP requires CONFIG_SEMIHOSTING
 #endif
-#define CONFIG_BOARD_LATE_INIT
 #define CONFIG_ARMV8_SWITCH_TO_EL1
 #endif
 
 /* Initial environment variables */
 #ifdef CONFIG_TARGET_VEXPRESS64_BASE_FVP
 #define CONFIG_EXTRA_ENV_SETTINGS      \
-                               "kernel_name=uImage\0"  \
-                               "kernel_addr_r=0x80000000\0"    \
+                               "kernel_name=uImage\0"          \
+                               "kernel_addr=0x80000000\0"      \
                                "initrd_name=ramdisk.img\0"     \
-                               "initrd_addr_r=0x88000000\0"    \
-                               "fdt_name=devtree.dtb\0"                \
-                               "fdt_addr_r=0x83000000\0"               \
+                               "initrd_addr=0x88000000\0"      \
+                               "fdt_name=devtree.dtb\0"        \
+                               "fdt_addr=0x83000000\0"         \
                                "fdt_high=0xffffffffffffffff\0" \
                                "initrd_high=0xffffffffffffffff\0"
 
                                "0x1c090000 debug user_debug=31 "\
                                "loglevel=9"
 
-#define CONFIG_BOOTCOMMAND     "fdt addr $fdt_addr_r; fdt resize; " \
-                               "fdt chosen $initrd_addr_r $initrd_end; " \
-                               "bootm $kernel_addr_r - $fdt_addr_r"
+#define CONFIG_BOOTCOMMAND     "smhload ${kernel_name} ${kernel_addr}; " \
+                               "smhload ${fdt_name} $fdt_addr; " \
+                               "smhload ${initrd_name} $initrd_addr initrd_end; " \
+                               "fdt addr $fdt_addr; fdt resize; " \
+                               "fdt chosen $initrd_addr $initrd_end; " \
+                               "bootm $kernel_addr - $fdt_addr"
 
 #define CONFIG_BOOTDELAY               1