[PATCH 5/6] spi: spi-uclass: Fix spi_claim_bus() speed/mode setup logic
Simon Glass
sjg at chromium.org
Sat Dec 12 16:39:36 CET 2020
On Sun, 6 Dec 2020 at 14:24, Ovidiu Panait <ovidiu.panait at windriver.com> wrote:
>
> 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")
> Reported-by: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
> Reported-by: Moshe, Yaniv <yanivmo at amazon.com>
> Signed-off-by: Ovidiu Panait <ovidiu.panait at windriver.com>
> ---
>
> drivers/mmc/mmc_spi.c | 1 -
> drivers/spi/spi-uclass.c | 17 ++++++++++++-----
> include/spi.h | 18 ++++++++++++++----
> 3 files changed, 26 insertions(+), 10 deletions(-)
>
Reviewed-by: Simon Glass <sjg at chromium.org>
More information about the U-Boot
mailing list