diff options
author | Simon Glass <sjg@chromium.org> | 2015-03-05 12:25:22 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-04-16 19:27:42 -0600 |
commit | 02c07b3741f1b825934b1a6eb8f23530532dc426 (patch) | |
tree | db9511b8172e15dc4f0ad4a44a0cc05474851cc0 /include | |
parent | 02eeb1bbb1749903b157140de5dedebf7e44edcf (diff) | |
download | u-boot-02c07b3741f1b825934b1a6eb8f23530532dc426.tar.gz |
dm: core: Add a uclass pre_probe() method for devices
Some uclasses want to set up a device before it is probed. Add a method
for this.
An example is with PCI, where a PCI uclass wants to set up its private
data for later use. This allows the device's uclass() method to make calls
whcih use that data (for example, read PCI memory regions from device
tree, set up bus numbers).
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/dm/test.h | 1 | ||||
-rw-r--r-- | include/dm/uclass-internal.h | 7 | ||||
-rw-r--r-- | include/dm/uclass.h | 2 |
3 files changed, 7 insertions, 3 deletions
diff --git a/include/dm/test.h b/include/dm/test.h index 707c69e07f..b310e5f3ff 100644 --- a/include/dm/test.h +++ b/include/dm/test.h @@ -44,6 +44,7 @@ enum { /* For uclass */ DM_TEST_OP_POST_BIND, DM_TEST_OP_PRE_UNBIND, + DM_TEST_OP_PRE_PROBE, DM_TEST_OP_POST_PROBE, DM_TEST_OP_PRE_REMOVE, DM_TEST_OP_INIT, diff --git a/include/dm/uclass-internal.h b/include/dm/uclass-internal.h index f2f254a825..ae2a93d7d4 100644 --- a/include/dm/uclass-internal.h +++ b/include/dm/uclass-internal.h @@ -44,15 +44,16 @@ int uclass_bind_device(struct udevice *dev); int uclass_unbind_device(struct udevice *dev); /** - * uclass_pre_probe_child() - Deal with a child that is about to be probed + * uclass_pre_probe_device() - Deal with a device that is about to be probed * * Perform any pre-processing that is needed by the uclass before it can be - * probed. + * probed. This includes the uclass' pre-probe() method and the parent + * uclass' child_pre_probe() method. * * @dev: Pointer to the device * #return 0 on success, -ve on error */ -int uclass_pre_probe_child(struct udevice *dev); +int uclass_pre_probe_device(struct udevice *dev); /** * uclass_post_probe_device() - Deal with a device that has just been probed diff --git a/include/dm/uclass.h b/include/dm/uclass.h index d6c40c60dd..d57d804259 100644 --- a/include/dm/uclass.h +++ b/include/dm/uclass.h @@ -53,6 +53,7 @@ struct udevice; * @id: ID number of this uclass * @post_bind: Called after a new device is bound to this uclass * @pre_unbind: Called before a device is unbound from this uclass + * @pre_probe: Called before a new device is probed * @post_probe: Called after a new device is probed * @pre_remove: Called before a device is removed * @child_post_bind: Called after a child is bound to a device in this uclass @@ -80,6 +81,7 @@ struct uclass_driver { enum uclass_id id; int (*post_bind)(struct udevice *dev); int (*pre_unbind)(struct udevice *dev); + int (*pre_probe)(struct udevice *dev); int (*post_probe)(struct udevice *dev); int (*pre_remove)(struct udevice *dev); int (*child_post_bind)(struct udevice *dev); |