diff options
| author | Simon Glass <sjg@chromium.org> | 2013-03-19 04:58:51 +0000 | 
|---|---|---|
| committer | Simon Glass <sjg@chromium.org> | 2013-03-19 08:45:36 -0700 | 
| commit | 4397a2a80baefadc7454c70282c14d2af16ffe30 (patch) | |
| tree | c7c7382e91c3cc808ce9f381ed73b4f765469f1f /include/fdtdec.h | |
| parent | 0ce033d2582129243aca10d3072a221386bbba44 (diff) | |
| download | olio-uboot-2014.01-4397a2a80baefadc7454c70282c14d2af16ffe30.tar.xz olio-uboot-2014.01-4397a2a80baefadc7454c70282c14d2af16ffe30.zip | |
fdt: Add fdtdec_get_addr_size() to read reg properties
It is common to have a "reg = <address size>" property in the FDT.
Add a function to handle this, similar to the existing
fdtdec_get_addr();
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/fdtdec.h')
| -rw-r--r-- | include/fdtdec.h | 15 | 
1 files changed, 15 insertions, 0 deletions
| diff --git a/include/fdtdec.h b/include/fdtdec.h index 21894835d..5ca84a0c7 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -38,11 +38,13 @@   */  #ifdef CONFIG_PHYS_64BIT  typedef u64 fdt_addr_t; +typedef u64 fdt_size_t;  #define FDT_ADDR_T_NONE (-1ULL)  #define fdt_addr_to_cpu(reg) be64_to_cpu(reg)  #define fdt_size_to_cpu(reg) be64_to_cpu(reg)  #else  typedef u32 fdt_addr_t; +typedef u32 fdt_size_t;  #define FDT_ADDR_T_NONE (-1U)  #define fdt_addr_to_cpu(reg) be32_to_cpu(reg)  #define fdt_size_to_cpu(reg) be32_to_cpu(reg) @@ -200,6 +202,19 @@ fdt_addr_t fdtdec_get_addr(const void *blob, int node,  		const char *prop_name);  /** + * Look up an address property in a node and return it as an address. + * The property must hold one address with a length. This is only tested + * on 32-bit machines. + * + * @param blob	FDT blob + * @param node	node to examine + * @param prop_name	name of property to find + * @return address, if found, or FDT_ADDR_T_NONE if not + */ +fdt_addr_t fdtdec_get_addr_size(const void *blob, int node, +		const char *prop_name, fdt_size_t *sizep); + +/**   * Look up a 32-bit integer property in a node and return it. The property   * must have at least 4 bytes of data. The value of the first cell is   * returned. |