summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2016-05-11 15:26:24 -0600
committerSimon Glass <sjg@chromium.org>2016-05-26 20:48:31 -0600
commitdaac3bfee57247013cb8373683e9babb191abd75 (patch)
treeffcbb2f6cd176d906e2cfbc667a7873402ac850e /include
parent6523dbf7cce8d8c903346f756e0e41e46ce6d6b9 (diff)
downloadu-boot-daac3bfee57247013cb8373683e9babb191abd75.tar.gz
dm: allow setting driver_data before/during bind
This will allow a driver's bind function to use the driver data. One example is the Tegra186 GPIO driver, which instantiates child devices for each of its GPIO ports, yet supports two different HW instances each with a different set of ports, and identified by the udevice_id .data field. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/dm/device-internal.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/dm/device-internal.h b/include/dm/device-internal.h
index b348ad5231..0bf8707493 100644
--- a/include/dm/device-internal.h
+++ b/include/dm/device-internal.h
@@ -39,6 +39,30 @@ int device_bind(struct udevice *parent, const struct driver *drv,
struct udevice **devp);
/**
+ * device_bind_with_driver_data() - Create a device and bind it to a driver
+ *
+ * Called to set up a new device attached to a driver, in the case where the
+ * driver was matched to the device by means of a match table that provides
+ * driver_data.
+ *
+ * Once bound a device exists but is not yet active until device_probe() is
+ * called.
+ *
+ * @parent: Pointer to device's parent, under which this driver will exist
+ * @drv: Device's driver
+ * @name: Name of device (e.g. device tree node name)
+ * @driver_data: The driver_data field from the driver's match table.
+ * @of_offset: Offset of device tree node for this device. This is -1 for
+ * devices which don't use device tree.
+ * @devp: if non-NULL, returns a pointer to the bound device
+ * @return 0 if OK, -ve on error
+ */
+int device_bind_with_driver_data(struct udevice *parent,
+ const struct driver *drv, const char *name,
+ ulong driver_data, int of_offset,
+ struct udevice **devp);
+
+/**
* device_bind_by_name: Create a device and bind it to a driver
*
* This is a helper function used to bind devices which do not use device