diff options
author | Simon Glass <sjg@chromium.org> | 2014-11-11 10:46:18 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2014-11-22 10:16:45 +0100 |
commit | 2ef249b4420818d7ea31a031f48825e5f38ed3ac (patch) | |
tree | 5f02f7a902dd73e2c7bd0fafe9fa643d0f69c361 /include | |
parent | c1a6f371ae65f1a3709e872e08bed51321e292fc (diff) | |
download | u-boot-2ef249b4420818d7ea31a031f48825e5f38ed3ac.tar.gz u-boot-2ef249b4420818d7ea31a031f48825e5f38ed3ac.tar.xz u-boot-2ef249b4420818d7ea31a031f48825e5f38ed3ac.zip |
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>
Diffstat (limited to 'include')
-rw-r--r-- | include/dm/device.h | 11 |
1 files changed, 11 insertions, 0 deletions
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; @@ -206,6 +208,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 * * Returns the numbered child, 0 being the first. This does not use |