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>
This commit is contained in:
Simon Glass 2014-07-23 06:55:14 -06:00
parent b7d665705e
commit f4cdead24a
4 changed files with 83 additions and 1 deletions

View file

@ -121,6 +121,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
*