diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index 009de74025..e46d5717aa 100644 --- a/drivers/core/uclass.c +++ b/drivers/core/uclass.c @@ -545,6 +545,12 @@ int uclass_get_device_by_ofnode(enum uclass_id id, ofnode node, } #if CONFIG_IS_ENABLED(OF_REAL) +int uclass_get_device_by_of_path(enum uclass_id id, const char *path, + struct udevice **devp) +{ + return uclass_get_device_by_ofnode(id, ofnode_path(path), devp); +} + int uclass_get_device_by_phandle_id(enum uclass_id id, uint phandle_id, struct udevice **devp) { diff --git a/include/dm/uclass.h b/include/dm/uclass.h index ee15c92063..5c5fb9acac 100644 --- a/include/dm/uclass.h +++ b/include/dm/uclass.h @@ -264,6 +264,23 @@ int uclass_get_device_by_of_offset(enum uclass_id id, int node, int uclass_get_device_by_ofnode(enum uclass_id id, ofnode node, struct udevice **devp); +/** + * uclass_get_device_by_of_path() - Get a uclass device by device tree path + * + * This searches the devices in the uclass for one attached to the + * device tree node corresponding to the given path (which may also be + * an alias). + * + * The device is probed to activate it ready for use. + * + * @id: ID to look up + * @node: Device tree path to search for (if no such path 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_path(enum uclass_id id, const char *path, + struct udevice **devp); + /** * uclass_get_device_by_phandle_id() - Get a uclass device by phandle id *