On 22.01.2018 01:29, Simon Glass wrote:
Hi Simon,

On 18 January 2018 at 01:15, Simon Goldschmidt
<sgoldschm...@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 <sgoldschm...@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
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to