]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/image-fdt.c
Merge remote-tracking branch 'u-boot-samsung/master'
[karo-tx-uboot.git] / common / image-fdt.c
index 203404afb46219c6390956aa4de83f6f5d5b7d6f..9fc7481fd80d190a015814b626091dd8a65bdcce 100644 (file)
@@ -6,23 +6,7 @@
  * (C) Copyright 2000-2006
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -45,6 +29,7 @@ static void fdt_error(const char *msg)
        puts(" - must RESET the board to recover.\n");
 }
 
+#if defined(CONFIG_IMAGE_FORMAT_LEGACY)
 static const image_header_t *image_get_fdt(ulong fdt_addr)
 {
        const image_header_t *fdt_hdr = map_sysmem(fdt_addr, 0);
@@ -71,12 +56,13 @@ static const image_header_t *image_get_fdt(ulong fdt_addr)
                fdt_error("uImage is compressed");
                return NULL;
        }
-       if (fdt_check_header((char *)image_get_data(fdt_hdr)) != 0) {
+       if (fdt_check_header((void *)image_get_data(fdt_hdr)) != 0) {
                fdt_error("uImage data is not a fdt");
                return NULL;
        }
        return fdt_hdr;
 }
+#endif
 
 /**
  * boot_fdt_add_mem_rsv_regions - Mark the memreserve sections as unusable
@@ -236,11 +222,13 @@ error:
 int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
                bootm_headers_t *images, char **of_flat_tree, ulong *of_size)
 {
+#if defined(CONFIG_IMAGE_FORMAT_LEGACY)
        const image_header_t *fdt_hdr;
+       ulong           load, load_end;
+       ulong           image_start, image_data, image_end;
+#endif
        ulong           fdt_addr;
        char            *fdt_blob = NULL;
-       ulong           image_start, image_data, image_end;
-       ulong           load, load_end;
        void            *buf;
 #if defined(CONFIG_FIT)
        const char      *fit_uname_config = images->fit_uname_cfg;
@@ -314,6 +302,7 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
                 */
                buf = map_sysmem(fdt_addr, 0);
                switch (genimg_get_format(buf)) {
+#if defined(CONFIG_IMAGE_FORMAT_LEGACY)
                case IMAGE_FORMAT_LEGACY:
                        /* verify fdt_addr points to a valid image header */
                        printf("## Flattened Device Tree from Legacy Image at %08lx\n",
@@ -353,6 +342,7 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
 
                        fdt_addr = load;
                        break;
+#endif
                case IMAGE_FORMAT_FIT:
                        /*
                         * This case will catch both: new uImage format
@@ -365,7 +355,6 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
                                ulong load, len;
 
                                fdt_noffset = fit_image_load(images,
-                                       FIT_FDT_PROP,
                                        fdt_addr, &fit_uname_fdt,
                                        &fit_uname_config,
                                        arch, IH_TYPE_FLATDT,
@@ -473,13 +462,13 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
        ulong *initrd_end = &images->initrd_end;
        int ret;
 
-       if (fdt_chosen(blob, 1) < 0) {
+       if (fdt_chosen(blob) < 0) {
                puts("ERROR: /chosen node create failed");
                puts(" - must RESET the board to recover.\n");
                return -1;
        }
        arch_fixup_memory_node(blob);
-       if (IMAAGE_OF_BOARD_SETUP)
+       if (IMAGE_OF_BOARD_SETUP)
                ft_board_setup(blob, gd->bd);
        fdt_fixup_ethernet(blob);
 
@@ -499,9 +488,14 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
        /* Create a new LMB reservation */
        lmb_reserve(lmb, (ulong)blob, of_size);
 
-       fdt_initrd(blob, *initrd_start, *initrd_end, 1);
+       fdt_initrd(blob, *initrd_start, *initrd_end);
        if (!ft_verify_fdt(blob))
                return -1;
 
+#ifdef CONFIG_SOC_K2HK
+       if (IMAGE_OF_BOARD_SETUP)
+               ft_board_setup_ex(blob, gd->bd);
+#endif
+
        return 0;
 }