Hi

On Thu, Jan 18, 2018 at 9:27 AM, Simon Goldschmidt
<sgoldschm...@de.pepperl-fuchs.com> wrote:
> On 18.01.2018 09:23, Michael Nazzareno Trimarchi wrote:
>>
>> Hi
>>
>> On Thu, Jan 18, 2018 at 9:15 AM, 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(+)
>>>
>>> diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
>>> index e06a603ab1..41ecef77db 100644
>>> --- a/drivers/spi/spi-uclass.c
>>> +++ b/drivers/spi/spi-uclass.c
>>> @@ -325,6 +325,8 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed,
>>> int mode,
>>>          if (!speed) {
>>>                  speed = plat->max_hz;
>>>                  mode = plat->mode;
>>> +               if (!speed)
>>> +                       speed = 100000;
>>
>> You should add a warming message
>
>
> Hmm, I just copied what 'dm_spi_claim_bus' does some hundred lines above in
> the same file. Why should one code path warn when the other doesn't?

I just check this page but if you have some missing definition in
device tree maybe make sense to
make it visible

Michael

>
> Simon
>
>>
>> Michael
>>
>>>          }
>>>          ret = spi_set_speed_mode(bus, speed, mode);
>>>          if (ret)
>>> --
>>> 2.11.0
>
> <snip>
>



-- 
| Michael Nazzareno Trimarchi                     Amarula Solutions BV |
| COO  -  Founder                                      Cruquiuskade 47 |
| +31(0)851119172                                 Amsterdam 1018 AM NL |
|                  [`as] http://www.amarulasolutions.com               |
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to