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 /drivers/core | |
parent | 02eeb1bbb1749903b157140de5dedebf7e44edcf (diff) | |
download | u-boot-imx-02c07b3741f1b825934b1a6eb8f23530532dc426.zip u-boot-imx-02c07b3741f1b825934b1a6eb8f23530532dc426.tar.gz u-boot-imx-02c07b3741f1b825934b1a6eb8f23530532dc426.tar.bz2 |
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 'drivers/core')
-rw-r--r-- | drivers/core/device.c | 2 | ||||
-rw-r--r-- | drivers/core/uclass.c | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/drivers/core/device.c b/drivers/core/device.c index 6bd4b26..7483405 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -227,7 +227,7 @@ int device_probe_child(struct udevice *dev, void *parent_priv) } dev->seq = seq; - ret = uclass_pre_probe_child(dev); + ret = uclass_pre_probe_device(dev); if (ret) goto fail; diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index 289a5d2..98c15e5 100644 --- a/drivers/core/uclass.c +++ b/drivers/core/uclass.c @@ -391,9 +391,17 @@ int uclass_resolve_seq(struct udevice *dev) return seq; } -int uclass_pre_probe_child(struct udevice *dev) +int uclass_pre_probe_device(struct udevice *dev) { struct uclass_driver *uc_drv; + int ret; + + uc_drv = dev->uclass->uc_drv; + if (uc_drv->pre_probe) { + ret = uc_drv->pre_probe(dev); + if (ret) + return ret; + } if (!dev->parent) return 0; |