]> git.sur5r.net Git - u-boot/blobdiff - arch/nds32/lib/bootm.c
SPDX: Convert all of our single license tags to Linux Kernel style
[u-boot] / arch / nds32 / lib / bootm.c
index 8b0b28fd996f2de6798aadd9294eec32dd8366e7..0cfdc52b465a8637e7d46cbbc3fcd5d078fe307f 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2011 Andes Technology Corporation
  * Shawn Lin, Andes Technology Corporation <nobuhiro@andestech.com>
  * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -11,6 +10,7 @@
 #include <image.h>
 #include <u-boot/zlib.h>
 #include <asm/byteorder.h>
+#include <asm/bootm.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -42,7 +42,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
        void    (*theKernel)(int zero, int arch, uint params);
 
 #ifdef CONFIG_CMDLINE_TAG
-       char *commandline = getenv("bootargs");
+       char *commandline = env_get("bootargs");
 #endif
 
        /*
@@ -56,7 +56,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 
        theKernel = (void (*)(int, int, uint))images->ep;
 
-       s = getenv("machid");
+       s = env_get("machid");
        if (s) {
                machid = simple_strtoul(s, NULL, 16);
                printf("Using machid 0x%x from environment\n", machid);
@@ -67,6 +67,15 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
        debug("## Transferring control to Linux (at address %08lx) ...\n",
               (ulong)theKernel);
 
+       if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len) {
+#ifdef CONFIG_OF_LIBFDT
+               debug("using: FDT\n");
+               if (image_setup_linux(images)) {
+                       printf("FDT creation failed! hanging...");
+                       hang();
+               }
+#endif
+       } else if (BOOTM_ENABLE_TAGS) {
 #if defined(CONFIG_SETUP_MEMORY_TAGS) || \
        defined(CONFIG_CMDLINE_TAG) || \
        defined(CONFIG_INITRD_TAG) || \
@@ -101,16 +110,17 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
                udc_disconnect();
        }
 #endif
-
+       }
        cleanup_before_linux();
-
-       theKernel(0, machid, bd->bi_boot_params);
+       if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len)
+               theKernel(0, machid, (unsigned long)images->ft_addr);
+       else
+               theKernel(0, machid, bd->bi_boot_params);
        /* does not return */
 
        return 1;
 }
 
-
 #if defined(CONFIG_SETUP_MEMORY_TAGS) || \
        defined(CONFIG_CMDLINE_TAG) || \
        defined(CONFIG_INITRD_TAG) || \
@@ -130,7 +140,6 @@ static void setup_start_tag(bd_t *bd)
        params = tag_next(params);
 }
 
-
 #ifdef CONFIG_SETUP_MEMORY_TAGS
 static void setup_memory_tags(bd_t *bd)
 {
@@ -148,7 +157,6 @@ static void setup_memory_tags(bd_t *bd)
 }
 #endif /* CONFIG_SETUP_MEMORY_TAGS */
 
-
 static void setup_commandline_tag(bd_t *bd, char *commandline)
 {
        char *p;
@@ -176,7 +184,6 @@ static void setup_commandline_tag(bd_t *bd, char *commandline)
        params = tag_next(params);
 }
 
-
 #ifdef CONFIG_INITRD_TAG
 static void setup_initrd_tag(bd_t *bd, ulong initrd_start, ulong initrd_end)
 {
@@ -224,7 +231,6 @@ void setup_revision_tag(struct tag **in_params)
 }
 #endif  /* CONFIG_REVISION_TAG */
 
-
 static void setup_end_tag(bd_t *bd)
 {
        params->hdr.tag = ATAG_NONE;