]> git.baikalelectronics.ru Git - uboot.git/commit
spi: spi-uclass: Fix spi_claim_bus() speed/mode setup logic
authorOvidiu Panait <ovidiu.panait@windriver.com>
Mon, 14 Dec 2020 17:06:50 +0000 (19:06 +0200)
committerSimon Glass <sjg@chromium.org>
Wed, 23 Dec 2020 03:39:26 +0000 (20:39 -0700)
commit0bd78b3ec80db34af04f50c2a402e0a80366249e
treeddec056c419202cb15154211ac5f3c063dc5bb5a
parente41c13876980b70d65e693d85e59cf350670576a
spi: spi-uclass: Fix spi_claim_bus() speed/mode setup logic

Currently, when different spi slaves claim the bus consecutively using
spi_claim_bus(), spi_set_speed_mode() will only be executed on the first
two calls, leaving the bus in a bad state starting with the third call.

This patch drops spi_slave->speed member and adds caching of bus
speed/mode in dm_spi_bus struct. It also updates spi_claim_bus() to call
spi_set_speed_mode() if either speed or mode is different from what the
bus is currently configured for. Current behavior is to only take into
account the speed, but not the mode, which seems wrong.

Fixes: 60e2809a848 ("dm: spi: Avoid setting the speed with every transfer")
Reviewed-by: Simon Glass <sjg@chromium.org>
Reported-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reported-by: Moshe, Yaniv <yanivmo@amazon.com>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
drivers/mmc/mmc_spi.c
drivers/spi/spi-uclass.c
include/spi.h