aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMichal Simek2023-08-31 09:04:27 +0200
committerMichal Simek2023-09-21 13:20:11 +0200
commit44f35e1aca706e7625aa2989911b4bc938681158 (patch)
tree480bb2b88f4bc8ba5daf8208e54574f509a798cf /include
parent771635f6b0f5bc71d85beb7d994b1c66bf36f6ff (diff)
dm: core: ofnode: Add ofnode_read_bootscript_flash()
ofnode_read_bootscript_flash() reads bootscript address from /options/u-boot DT node. bootscr-flash-offset and bootscr-flash-size properties are read and values are filled. When bootscr-flash-size is not defined, bootscr-flash-offset property is unusable that's why cleaned. Both of these properties should be defined to function properly. Also add test to cover this new function. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Michal Simek <michal.simek@amd.com> Link: https://lore.kernel.org/r/08a3e6c09cce13287c69ad370e409e7f1766b406.1693465465.git.michal.simek@amd.com
Diffstat (limited to 'include')
-rw-r--r--include/dm/ofnode.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index c38596acbd0..06ea68e81c5 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -1533,6 +1533,27 @@ const char *ofnode_conf_read_str(const char *prop_name);
*/
int ofnode_read_bootscript_address(u64 *bootscr_address, u64 *bootscr_offset);
+/**
+ * ofnode_read_bootscript_flash() - Read bootscr-flash-offset/size
+ *
+ * @bootscr_flash_offset: pointer to 64bit offset where bootscr-flash-offset
+ * property value is stored
+ * @bootscr_flash_size: pointer to 64bit size where bootscr-flash-size property
+ * value is stored
+ *
+ * This reads a bootscr-flash-offset and bootscr-flash-size properties from
+ * the /options/u-boot/ node of the devicetree. bootscr-flash-offset holds
+ * the offset of the boot script file from start of flash. bootscr-flash-size
+ * holds the boot script size in flash. When bootscr-flash-size is not defined,
+ * bootscr-flash-offset property is cleaned.
+ *
+ * This only works with the control FDT.
+ *
+ * Return: 0 if OK, -EINVAL if property is not found or incorrect.
+ */
+int ofnode_read_bootscript_flash(u64 *bootscr_flash_offset,
+ u64 *bootscr_flash_size);
+
#else /* CONFIG_DM */
static inline bool ofnode_conf_read_bool(const char *prop_name)
{
@@ -1554,6 +1575,12 @@ static inline int ofnode_read_bootscript_address(u64 *bootscr_address, u64 *boot
return -EINVAL;
}
+static inline int ofnode_read_bootscript_flash(u64 *bootscr_flash_offset,
+ u64 *bootscr_flash_size)
+{
+ return -EINVAL;
+}
+
#endif /* CONFIG_DM */
/**