diff options
author | Simon Glass <sjg@chromium.org> | 2014-07-23 06:55:14 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2014-07-23 14:07:25 +0100 |
commit | f4cdead24a1a0c39c29c04e107c2f98ba61c5da8 (patch) | |
tree | cbabf26d3f1df2d80529543f5a4bcfeeef4a34f3 /include/dm | |
parent | b7d665705ebb29f06616b7f365ab8732e9779bf6 (diff) |
dm: Allow a device to be found by its FDT offset
Each device that was bound from a device tree has an node that caused it to
be bound. Add functions that find and return a device based on a device tree
offset.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/dm')
-rw-r--r-- | include/dm/uclass.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/dm/uclass.h b/include/dm/uclass.h index 48ae2420df4..0b5ade6d68c 100644 --- a/include/dm/uclass.h +++ b/include/dm/uclass.h @@ -122,6 +122,22 @@ int uclass_get_device(enum uclass_id id, int index, struct udevice **devp); int uclass_get_device_by_seq(enum uclass_id id, int seq, struct udevice **devp); /** + * uclass_get_device_by_of_offset() - Get a uclass device by device tree node + * + * This searches the devices in the uclass for one attached to the given + * device tree node. + * + * The device is probed to activate it ready for use. + * + * @id: ID to look up + * @node: Device tree offset to search for (if -ve then -ENODEV is returned) + * @devp: Returns pointer to device (there is only one for each node) + * @return 0 if OK, -ve on error + */ +int uclass_get_device_by_of_offset(enum uclass_id id, int node, + struct udevice **devp); + +/** * uclass_first_device() - Get the first device in a uclass * * @id: Uclass ID to look up |