]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - lib/fdtdec.c
cros_ec: Add a function for reading a flash map entry
[karo-tx-uboot.git] / lib / fdtdec.c
index 207314fa72fb34f643c0d9424916c9dbfefba4c9..c54d97b893998f97eb71186a5fd84a4a47a414a8 100644 (file)
@@ -32,6 +32,7 @@ static const char * const compat_names[COMPAT_COUNT] = {
        COMPAT(NVIDIA_TEGRA20_NAND, "nvidia,tegra20-nand"),
        COMPAT(NVIDIA_TEGRA20_PWM, "nvidia,tegra20-pwm"),
        COMPAT(NVIDIA_TEGRA20_DC, "nvidia,tegra20-dc"),
+       COMPAT(NVIDIA_TEGRA124_SDMMC, "nvidia,tegra124-sdhci"),
        COMPAT(NVIDIA_TEGRA30_SDMMC, "nvidia,tegra30-sdhci"),
        COMPAT(NVIDIA_TEGRA20_SDMMC, "nvidia,tegra20-sdhci"),
        COMPAT(NVIDIA_TEGRA20_SFLASH, "nvidia,tegra20-sflash"),
@@ -616,3 +617,27 @@ int fdtdec_decode_region(const void *blob, int node,
        debug("%s: size=%zx\n", __func__, *size);
        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)
+{
+       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];
+
+       return 0;
+}