diff options
author | Abhilash Kesavan <a.kesavan@samsung.com> | 2012-10-25 16:30:58 +0000 |
---|---|---|
committer | Gerald Van Baren <gvb@unssw.com> | 2012-11-12 23:00:34 -0500 |
commit | 09258f1e8b12acc4a2a02b60d942660798038fba (patch) | |
tree | 8dbbdd3551ac7fa56022cc1337032385a42800af /include | |
parent | 59852d03867108217fe88e3bfc3e1e9cedfe63c5 (diff) | |
download | u-boot-imx-09258f1e8b12acc4a2a02b60d942660798038fba.zip u-boot-imx-09258f1e8b12acc4a2a02b60d942660798038fba.tar.gz u-boot-imx-09258f1e8b12acc4a2a02b60d942660798038fba.tar.bz2 |
fdt: Add function to get config int from device tree
Add a function to look up a configuration item such as machine id
and return its value.
Note: The code has been taken as is from the Chromium u-boot development
tree and needs Simon Glass' sign-off.
Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/fdtdec.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/fdtdec.h b/include/fdtdec.h index 0b14075..d880fe8 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -354,6 +354,19 @@ int fdtdec_decode_gpio(const void *blob, int node, const char *prop_name, */ int fdtdec_setup_gpio(struct fdt_gpio_state *gpio); +/** + * 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 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 |