summaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-02-17 15:29:35 -0700
committerSimon Glass <sjg@chromium.org>2015-05-05 20:58:18 -0600
commit60e2809a848bccd3a8090d3f2237964670f2780c (patch)
tree0e48144601cecacb6f58b2e32cf516c7281204f5 /drivers/spi
parent172a31bf87bf299130a68320f08aa492c34ea3e0 (diff)
downloadtalos-obmc-uboot-60e2809a848bccd3a8090d3f2237964670f2780c.tar.gz
talos-obmc-uboot-60e2809a848bccd3a8090d3f2237964670f2780c.zip
dm: spi: Avoid setting the speed with every transfer
Only set the speed if it has changed from last time. Since the speed will be 0 when the device is probed it will always be changed on the first transfer after the device is probed. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-uclass.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
index 83fe8e0d69..737ae64052 100644
--- a/drivers/spi/spi-uclass.c
+++ b/drivers/spi/spi-uclass.c
@@ -63,9 +63,12 @@ int spi_claim_bus(struct spi_slave *slave)
}
if (!speed)
speed = 100000;
- ret = spi_set_speed_mode(bus, speed, slave->mode);
- if (ret)
- return ret;
+ if (speed != slave->speed) {
+ ret = spi_set_speed_mode(bus, speed, slave->mode);
+ if (ret)
+ return ret;
+ slave->speed = speed;
+ }
return ops->claim_bus ? ops->claim_bus(dev) : 0;
}
OpenPOWER on IntegriCloud