summaryrefslogtreecommitdiff
path: root/drivers/spi/spi-uclass.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi/spi-uclass.c')
-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 83fe8e0..737ae64 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;
}