]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - common/image-fit.c
common: Fix-up MAC addr in dts by fetching env variable serially
[people/ms/u-boot.git] / common / image-fit.c
index 7f17fd1410ed8a3b37e48f33f7ddf14dd4b54f65..b785d8a36e6a0483f1cbdf30f73a3fec82d12b01 100644 (file)
@@ -806,6 +806,31 @@ int fit_image_get_data_offset(const void *fit, int noffset, int *data_offset)
        return 0;
 }
 
+/**
+ * Get 'data-position' property from a given image node.
+ *
+ * @fit: pointer to the FIT image header
+ * @noffset: component image node offset
+ * @data_position: holds the data-position property
+ *
+ * returns:
+ *     0, on success
+ *     -ENOENT if the property could not be found
+ */
+int fit_image_get_data_position(const void *fit, int noffset,
+                               int *data_position)
+{
+       const fdt32_t *val;
+
+       val = fdt_getprop(fit, noffset, FIT_DATA_POSITION_PROP, NULL);
+       if (!val)
+               return -ENOENT;
+
+       *data_position = fdt32_to_cpu(*val);
+
+       return 0;
+}
+
 /**
  * Get 'data-size' property from a given image node.
  *