[U-Boot] [PATCH] dm: spi: prevent setting a speed of 0 Hz

Simon Glass sjg at chromium.org
Mon Jan 22 00:29:52 UTC 2018


Hi Simon,

On 18 January 2018 at 01:15, Simon Goldschmidt
<sgoldschmidt at de.pepperl-fuchs.com> wrote:
> When the device tree is missing a correct spi slave description below
> the bus, the 'set_speed' callback can be called with 'speed' == 0 Hz.
> At least with cadence qspi, this leads to a division by zero.
>
> Prevent this by initializing speed to 100 kHz in this case, as is
> done in 'dm_spi_claim_bus'.
>
> Signed-off-by: Simon Goldschmidt <sgoldschmidt at de.pepperl-fuchs.com>
> ---
>
>  drivers/spi/spi-uclass.c | 2 ++
>  1 file changed, 2 insertions(+)
>

Another option is to have a sensible default when reading from the DT
fails. See spi_slave_ofdata_to_platdata() - you can add the default
there.

Would that work?

Regards,
Simon


More information about the U-Boot mailing list