]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - lib/fdtdec.c
nvme: Add show routine to print detailed information
[people/ms/u-boot.git] / lib / fdtdec.c
index 94372cc6cd5a08023c46a2fb21ff46e2c2420847..d2dbd0f122ea1b358306586ea3613ae263dc0c3c 100644 (file)
@@ -4,6 +4,7 @@
  */
 
 #ifndef USE_HOSTCC
+#include <boot_fit.h>
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
@@ -12,6 +13,7 @@
 #include <fdt_support.h>
 #include <fdtdec.h>
 #include <asm/sections.h>
+#include <dm/of_extra.h>
 #include <linux/ctype.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -32,12 +34,6 @@ static const char * const compat_names[COMPAT_COUNT] = {
        COMPAT(NVIDIA_TEGRA20_EMC, "nvidia,tegra20-emc"),
        COMPAT(NVIDIA_TEGRA20_EMC_TABLE, "nvidia,tegra20-emc-table"),
        COMPAT(NVIDIA_TEGRA20_NAND, "nvidia,tegra20-nand"),
-       COMPAT(NVIDIA_TEGRA124_PMC, "nvidia,tegra124-pmc"),
-       COMPAT(NVIDIA_TEGRA186_SDMMC, "nvidia,tegra186-sdhci"),
-       COMPAT(NVIDIA_TEGRA210_SDMMC, "nvidia,tegra210-sdhci"),
-       COMPAT(NVIDIA_TEGRA124_SDMMC, "nvidia,tegra124-sdhci"),
-       COMPAT(NVIDIA_TEGRA30_SDMMC, "nvidia,tegra30-sdhci"),
-       COMPAT(NVIDIA_TEGRA20_SDMMC, "nvidia,tegra20-sdhci"),
        COMPAT(NVIDIA_TEGRA124_XUSB_PADCTL, "nvidia,tegra124-xusb-padctl"),
        COMPAT(NVIDIA_TEGRA210_XUSB_PADCTL, "nvidia,tegra210-xusb-padctl"),
        COMPAT(SMSC_LAN9215, "smsc,lan9215"),
@@ -940,38 +936,6 @@ int fdtdec_decode_region(const void *blob, int node, const char *prop_name,
        return 0;
 }
 
-/**
- * Read a flash entry from the fdt
- *
- * @param blob         FDT blob
- * @param node         Offset of node to read
- * @param name         Name of node being read
- * @param entry                Place to put offset and size of this node
- * @return 0 if ok, -ve on error
- */
-int fdtdec_read_fmap_entry(const void *blob, int node, const char *name,
-                          struct fmap_entry *entry)
-{
-       const char *prop;
-       u32 reg[2];
-
-       if (fdtdec_get_int_array(blob, node, "reg", reg, 2)) {
-               debug("Node '%s' has bad/missing 'reg' property\n", name);
-               return -FDT_ERR_NOTFOUND;
-       }
-       entry->offset = reg[0];
-       entry->length = reg[1];
-       entry->used = fdtdec_get_int(blob, node, "used", entry->length);
-       prop = fdt_getprop(blob, node, "compress", NULL);
-       entry->compress_algo = prop && !strcmp(prop, "lzo") ?
-               FMAP_COMPRESS_LZO : FMAP_COMPRESS_NONE;
-       prop = fdt_getprop(blob, node, "hash", &entry->hash_size);
-       entry->hash_algo = prop ? FMAP_HASH_SHA256 : FMAP_HASH_NONE;
-       entry->hash = (uint8_t *)prop;
-
-       return 0;
-}
-
 u64 fdtdec_get_number(const fdt32_t *ptr, unsigned int cells)
 {
        u64 number = 0;
@@ -1200,7 +1164,8 @@ int fdtdec_setup_memory_size(void)
        }
 
        gd->ram_size = (phys_size_t)(res.end - res.start + 1);
-       debug("%s: Initial DRAM size %llx\n", __func__, (u64)gd->ram_size);
+       debug("%s: Initial DRAM size %llx\n", __func__,
+             (unsigned long long)gd->ram_size);
 
        return 0;
 }
@@ -1251,10 +1216,22 @@ int fdtdec_setup(void)
                gd->fdt_blob = (ulong *)&_image_binary_end;
        else
                gd->fdt_blob = (ulong *)&__bss_end;
+
+#  elif defined CONFIG_FIT_EMBED
+       gd->fdt_blob = locate_dtb_in_fit(&_end);
+
+       if (gd->fdt_blob == NULL || gd->fdt_blob <= ((void *)&_end)) {
+               puts("Failed to find proper dtb in embedded FIT Image\n");
+               return -1;
+       }
+
 #  else
        /* FDT is at end of image */
        gd->fdt_blob = (ulong *)&_end;
 #  endif
+# elif defined(CONFIG_OF_BOARD)
+       /* Allow the board to override the fdt address. */
+       gd->fdt_blob = board_fdt_blob_setup();
 # elif defined(CONFIG_OF_HOSTFILE)
        if (sandbox_read_fdt_from_file()) {
                puts("Failed to read control FDT\n");