[U-Boot] [PATCH] dm: spi: prevent setting a speed of 0 Hz
Simon Goldschmidt
sgoldschmidt at de.pepperl-fuchs.com
Mon Jan 22 13:06:51 UTC 2018
On 22.01.2018 01:29, Simon Glass wrote:
> 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?
This seems like a good idea, but I'm not sure it fixes my
'divide-by-zero' bug because that bug also triggered if theĀ subnode of
my spi controller was missing the compatible field for 'spi-flash'. I'd
have to check that.
Regards,
Simon
More information about the U-Boot
mailing list