From 2ef249b4420818d7ea31a031f48825e5f38ed3ac Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 11 Nov 2014 10:46:18 -0700 Subject: 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 Reviewed-by: Tom Rini Acked-by: Heiko Schocher --- include/dm/device.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/dm') diff --git a/include/dm/device.h b/include/dm/device.h index 9ce95a834e..287504cb27 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -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 * -- cgit v1.2.3