mirror of
https://github.com/linux-sunxi/u-boot-sunxi.git
synced 2024-02-12 11:16:03 +08:00
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>
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user