summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorPeng Fan <Peng.Fan@freescale.com>2015-02-10 14:46:32 +0800
committerSimon Glass <sjg@chromium.org>2015-02-12 15:17:29 -0700
commitc9cac3f8413c1f67d1e1b7a1770e584584107cd2 (patch)
tree5e9344a29ff68938b6901a7b7a1ca7db53e92617 /drivers
parentbe9891c52d5472156949a3137be5f48355fd3f29 (diff)
downloadu-boot-c9cac3f8413c1f67d1e1b7a1770e584584107cd2.tar.gz
u-boot-c9cac3f8413c1f67d1e1b7a1770e584584107cd2.tar.bz2
u-boot-c9cac3f8413c1f67d1e1b7a1770e584584107cd2.zip
dm: introduce dev_get_addr interface
Abstracting dev_get_addr can improve drivers that want to get device's address. Signed-off-by: Peng Fan <Peng.Fan@freescale.com> Acked-by: Igor Grinberg <grinberg@compulab.co.il> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/core/device.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/core/device.c b/drivers/core/device.c
index b73d3b8961..73c3e07c28 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -449,3 +449,15 @@ enum uclass_id device_get_uclass_id(struct udevice *dev)
{
return dev->uclass->uc_drv->id;
}
+
+#ifdef CONFIG_OF_CONTROL
+fdt_addr_t dev_get_addr(struct udevice *dev)
+{
+ return fdtdec_get_addr(gd->fdt_blob, dev->of_offset, "reg");
+}
+#else
+fdt_addr_t dev_get_addr(struct udevice *dev)
+{
+ return FDT_ADDR_T_NONE;
+}
+#endif