diff options
author | Stephen Warren | 2016-04-06 12:49:19 -0600 |
---|---|---|
committer | Simon Glass | 2016-04-15 08:14:37 -0600 |
commit | 43c4d44e3330fd21679c0790fa2176075d0e69bf (patch) | |
tree | 11028f81b83c1e7128ef8a1465e3ecf0bfadd5fa /drivers/core/device.c | |
parent | 690d8a92c1f74115f954202023443d6869bac738 (diff) |
fdt: implement dev_get_addr_name()
This function parses the reg property based on an index found in the
reg-names property. This is required for bindings that are written
using reg-names rather than hard-coding indices in reg.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core/device.c')
-rw-r--r-- | drivers/core/device.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/core/device.c b/drivers/core/device.c index 9d0c1009e93..269087a084c 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -652,6 +652,22 @@ fdt_addr_t dev_get_addr_index(struct udevice *dev, int index) #endif } +fdt_addr_t dev_get_addr_name(struct udevice *dev, const char *name) +{ +#if CONFIG_IS_ENABLED(OF_CONTROL) + int index; + + index = fdt_find_string(gd->fdt_blob, dev->parent->of_offset, + "reg-names", name); + if (index < 0) + return index; + + return dev_get_addr_index(dev, index); +#else + return FDT_ADDR_T_NONE; +#endif +} + fdt_addr_t dev_get_addr(struct udevice *dev) { return dev_get_addr_index(dev, 0); |