mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-08 19:11:53 +00:00
dm: core: Add a way to find a device by ofnode
Add a function which looks up a device by its node (either in live tree or flat tree). Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
19c8205e68
commit
40bb637dae
3 changed files with 72 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
|||
#ifndef _DM_UCLASS_H
|
||||
#define _DM_UCLASS_H
|
||||
|
||||
#include <dm/ofnode.h>
|
||||
#include <dm/uclass-id.h>
|
||||
#include <linker_lists.h>
|
||||
#include <linux/list.h>
|
||||
|
@ -185,6 +186,22 @@ 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_ofnode() - 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
|
||||
* @np: Device tree node to search for (if NULL 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_ofnode(enum uclass_id id, ofnode node,
|
||||
struct udevice **devp);
|
||||
|
||||
/**
|
||||
* uclass_get_device_by_phandle() - Get a uclass device by phandle
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue