commit "dm: spi: Avoid setting the speed with every transfer"

Simon Glass sjg at chromium.org
Sat Dec 28 03:27:23 CET 2019


Hi Rasmus,

On Sat, 14 Dec 2019 at 16:27, Rasmus Villemoes
<rasmus.villemoes at prevas.dk> wrote:
>
> Hi
>
> I'm wondering how commit 60e2809a84 (dm: spi: Avoid setting the speed
> with every transfer) works. AFAIU, the currently selected speed is a
> property of the SPI master, so suppose we have two slaves, A which has
> max_hz = 10MHz and B which has max_hz = 20MHz. Now suppose we do
> transfers to A, then B, then A again. The third time we still compute
> speed = 10MHz, but since that matches what we cached in slave->speed, we
> don't call spi_set_speed_mode(), hence we proceed to do the xfer with a
> too large speed?
>
> I'm probably missing something obvious here since the commit is more
> than 4 years old.

I think you are right.

Possible we could store the 'current' bus speed in dm_spi_bus and
check that against what the slave wants?

Regards,
Simon


More information about the U-Boot mailing list