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

Michael

>         }
>         ret = spi_set_speed_mode(bus, speed, mode);
>         if (ret)
> --
> 2.11.0
>
>
> Pepperl+Fuchs GmbH, Mannheim
> Geschaeftsfuehrer/Managing Directors: Dr.-Ing. Gunther Kegel (Vors./CEO), 
> Werner Guthier, Mehmet Hatiboglu
> Vorsitzender des Aufsichtsrats/Chairman of the supervisory board: Claus 
> Michael
> Registergericht/Register Court: AG Mannheim HRB 4713
>
> Wichtiger Hinweis:
> Diese E-Mail einschliesslich ihrer Anhaenge enthaelt vertrauliche und 
> rechtlich geschuetzte Informationen, die nur fuer den Adressaten bestimmt 
> sind.
> Sollten Sie nicht der bezeichnete Adressat sein, so teilen Sie dies bitte dem 
> Absender umgehend mit und loeschen Sie diese Nachricht und ihre Anhaenge. Die 
> unbefugte Weitergabe, das Anfertigen von Kopien und jede Veraenderung der 
> E-Mail ist untersagt. Der Absender haftet nicht fuer Inhalte von veraenderten 
> E-Mails.
>
>
> Important Information:
> This e-mail message including its attachments contains confidential and 
> legally protected information solely intended for the addressee. If you are 
> not the intended addressee of this message, please contact the addresser 
> immediately and delete this message including its attachments. The 
> unauthorized dissemination, copying and change of this e-mail are strictly 
> forbidden. The addresser shall not be liable for the content of such changed 
> e-mails.
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot



-- 
| 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