mirror of
https://xff.cz/git/u-boot/
synced 2025-09-02 01:02:19 +02:00
dm: core: Support finding a device by phandle
It is common for one node to reference another via a phandle. Add support for obtaining an attached device by this method. As an example, a node may have a 'power-supply' property which references a regulator, allowing the driver to turn on its power. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -176,6 +176,23 @@ int uclass_get_device_by_seq(enum uclass_id id, int seq, struct udevice **devp);
|
||||
int uclass_get_device_by_of_offset(enum uclass_id id, int node,
|
||||
struct udevice **devp);
|
||||
|
||||
/**
|
||||
* uclass_get_device_by_phandle() - Get a uclass device by phandle
|
||||
*
|
||||
* This searches the devices in the uclass for one with the given phandle.
|
||||
*
|
||||
* The device is probed to activate it ready for use.
|
||||
*
|
||||
* @id: uclass ID to look up
|
||||
* @parent: Parent device containing the phandle pointer
|
||||
* @name: Name of property in the parent device node
|
||||
* @devp: Returns pointer to device (there is only one for each node)
|
||||
* @return 0 if OK, -ENOENT if there is no @name present in the node, other
|
||||
* -ve on error
|
||||
*/
|
||||
int uclass_get_device_by_phandle(enum uclass_id id, struct udevice *parent,
|
||||
const char *name, struct udevice **devp);
|
||||
|
||||
/**
|
||||
* uclass_first_device() - Get the first device in a uclass
|
||||
*
|
||||
|
Reference in New Issue
Block a user