From 7de8bd03c37af6120cf5bba9bf1adb492ed56868 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 7 Aug 2021 07:24:01 -0600 Subject: treewide: fdt: Move fdt_get_config_... to ofnode_conf_read... The current API is outdated as it requires a devicetree pointer. Move these functions to use the ofnode API and update this globally. Add some tests while we are here. Correct the call in exynos_dsim_config_parse_dt() which is obviously wrong. Signed-off-by: Simon Glass --- include/dm/ofnode.h | 37 +++++++++++++++++++++++++++++++++++++ include/fdtdec.h | 33 --------------------------------- 2 files changed, 37 insertions(+), 33 deletions(-) (limited to 'include') diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index 4e1a8447e6..6a714d0c7b 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -1117,4 +1117,41 @@ int ofnode_write_string(ofnode node, const char *propname, const char *value); */ int ofnode_set_enabled(ofnode node, bool value); +/** + * ofnode_conf_read_bool() - Read a boolean value from the U-Boot config + * + * This reads a property from the /config node of the devicetree. + * + * See doc/config.txt for bindings + * + * @prop_name property name to look up + * @return true, if it exists, false if not + */ +bool ofnode_conf_read_bool(const char *prop_name); + +/** + * ofnode_conf_read_int() - Read an integer value from the U-Boot config + * + * This reads a property from the /config node of the devicetree. + * + * See doc/config.txt for bindings + * + * @prop_name: property name to look up + * @default_val: default value to return if the property is not found + * @return integer value, if found, or @default_val if not + */ +int ofnode_conf_read_int(const char *prop_name, int default_val); + +/** + * ofnode_conf_read_str() - Read a string value from the U-Boot config + * + * This reads a property from the /config node of the devicetree. + * + * See doc/config.txt for bindings + * + * @prop_name: property name to look up + * @return string value, if found, or NULL if not + */ +const char *ofnode_conf_read_str(const char *prop_name); + #endif diff --git a/include/fdtdec.h b/include/fdtdec.h index 8ac20c9a64..23efbe710c 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -746,39 +746,6 @@ int fdtdec_get_bool(const void *blob, int node, const char *prop_name); */ int fdtdec_get_child_count(const void *blob, int node); -/** - * Look in the FDT for a config item with the given name and return its value - * as a 32-bit integer. The property must have at least 4 bytes of data. The - * value of the first cell is returned. - * - * @param blob FDT blob to use - * @param prop_name Node property name - * @param default_val default value to return if the property is not found - * @return integer value, if found, or default_val if not - */ -int fdtdec_get_config_int(const void *blob, const char *prop_name, - int default_val); - -/** - * Look in the FDT for a config item with the given name - * and return whether it exists. - * - * @param blob FDT blob - * @param prop_name property name to look up - * @return 1, if it exists, or 0 if not - */ -int fdtdec_get_config_bool(const void *blob, const char *prop_name); - -/** - * Look in the FDT for a config item with the given name and return its value - * as a string. - * - * @param blob FDT blob - * @param prop_name property name to look up - * @returns property string, NULL on error. - */ -char *fdtdec_get_config_string(const void *blob, const char *prop_name); - /* * Look up a property in a node and return its contents in a byte * array of given length. The property must have at least enough data for -- cgit v1.2.3