diff options
author | Simon Glass <sjg@chromium.org> | 2016-07-05 23:10:08 (GMT) |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2016-07-27 20:14:37 (GMT) |
commit | cc7f66f70cc2c59fe8ebf9011658447815278894 (patch) | |
tree | 3e37506e9935e3ed54095c93b335d598d7eb0162 /include | |
parent | 5628347f59e1672f381b8113e85e47529770ab47 (diff) | |
download | u-boot-cc7f66f70cc2c59fe8ebf9011658447815278894.tar.xz |
dm: core: Add a function to bind child devices
We currently use dm_scan_fdt_node() to bind devices. It is an internal
function and it requires the caller to know whether we are pre- or post-
relocation.
This requirement has become quite common in drivers, so the current function
is not ideal.
Add a new function with fewer arguments, that does not require internal
headers. This can be used directly as a post_bind() method if needed.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/dm/device.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/dm/device.h b/include/dm/device.h index 705849b..babf8ac 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -612,6 +612,22 @@ static inline bool device_is_on_pci_bus(struct udevice *dev) #define device_foreach_child_safe(pos, next, parent) \ list_for_each_entry_safe(pos, next, &parent->child_head, sibling_node) +/** + * dm_scan_fdt_dev() - Bind child device in a the device tree + * + * This handles device which have sub-nodes in the device tree. It scans all + * sub-nodes and binds drivers for each node where a driver can be found. + * + * If this is called prior to relocation, only pre-relocation devices will be + * bound (those marked with u-boot,dm-pre-reloc in the device tree, or where + * the driver has the DM_FLAG_PRE_RELOC flag set). Otherwise, all devices will + * be bound. + * + * @dev: Device to scan + * @return 0 if OK, -ve on error + */ +int dm_scan_fdt_dev(struct udevice *dev); + /* device resource management */ typedef void (*dr_release_t)(struct udevice *dev, void *res); typedef int (*dr_match_t)(struct udevice *dev, void *res, void *match_data); |