diff options
author | Simon Glass <sjg@chromium.org> | 2015-01-25 08:27:11 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-01-29 17:09:56 -0700 |
commit | 440714eeb8938e9710d1b2bba17c6c0af7c2cf69 (patch) | |
tree | 970f831c02eaf88b70f479d2677b63e0e98daf52 /drivers | |
parent | 83c7e434c9dd3ca81f8b763e23c1881b973bcf2f (diff) | |
download | u-boot-imx-440714eeb8938e9710d1b2bba17c6c0af7c2cf69.zip u-boot-imx-440714eeb8938e9710d1b2bba17c6c0af7c2cf69.tar.gz u-boot-imx-440714eeb8938e9710d1b2bba17c6c0af7c2cf69.tar.bz2 |
dm: spi: Set up the spi_slave device pointer in child_pre_probe()
At present we use struct spi_slave as our device pointer in a lot of places
to avoid changing the old SPI API. At some point this will go away.
But for now, it is better if the SPI uclass sets up this pointer, rather
than relying on passing it into the device when it is probed. We can use the
new uclass child_pre_probe() method to do this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/spi/spi-uclass.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c index e5dfb30..2c134eb 100644 --- a/drivers/spi/spi-uclass.c +++ b/drivers/spi/spi-uclass.c @@ -108,6 +108,15 @@ int spi_post_probe(struct udevice *dev) return 0; } +int spi_child_pre_probe(struct udevice *dev) +{ + struct spi_slave *slave = dev_get_parentdata(dev); + + slave->dev = dev; + + return 0; +} + int spi_chip_select(struct udevice *dev) { struct spi_slave *slave = dev_get_parentdata(dev); @@ -347,6 +356,7 @@ UCLASS_DRIVER(spi) = { .flags = DM_UC_FLAG_SEQ_ALIAS, .post_bind = spi_post_bind, .post_probe = spi_post_probe, + .child_pre_probe = spi_child_pre_probe, .per_device_auto_alloc_size = sizeof(struct dm_spi_bus), .per_child_auto_alloc_size = sizeof(struct spi_slave), }; |