dm: core: Allow access to the device's driver_id data

When the device is created from a device tree node, it matches a compatible
string. Allow access to that string and the associated data.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
Acked-by: Heiko Schocher <hs@denx.de>
This commit is contained in:
Simon Glass
2014-11-11 10:46:18 -07:00
parent c1a6f371ae
commit 2ef249b442
3 changed files with 30 additions and 6 deletions

View File

@@ -47,6 +47,7 @@ struct driver_info;
* @name: Name of device, typically the FDT node name
* @platdata: Configuration data for this device
* @of_offset: Device tree node offset for this device (- for none)
* @of_id: Pointer to the udevice_id structure which created the device
* @parent: Parent of this device, or NULL for the top level device
* @priv: Private data for this device
* @uclass: Pointer to uclass for this device
@@ -65,6 +66,7 @@ struct udevice {
const char *name;
void *platdata;
int of_offset;
const struct udevice_id *of_id;
struct udevice *parent;
void *priv;
struct uclass *uclass;
@@ -205,6 +207,15 @@ void *dev_get_parentdata(struct udevice *dev);
*/
void *dev_get_priv(struct udevice *dev);
/**
* dev_get_of_data() - get the device tree data used to bind a device
*
* When a device is bound using a device tree node, it matches a
* particular compatible string as in struct udevice_id. This function
* returns the associated data value for that compatible string
*/
ulong dev_get_of_data(struct udevice *dev);
/**
* device_get_child() - Get the child of a device by index
*