From f4cdead24a1a0c39c29c04e107c2f98ba61c5da8 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 23 Jul 2014 06:55:14 -0600 Subject: 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 --- include/dm/uclass.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include/dm') diff --git a/include/dm/uclass.h b/include/dm/uclass.h index 48ae242..0b5ade6 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 -- cgit v1.1