Re: [PATCH 1/3] spi: spi-gpio: actually delay in spidelay()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 25.09.24 16:06, Sascha Hauer wrote:
> spidelay() currently only is a no-op dummy function. Actually delay in
> this function to avoid spi-gpio being faster than specified.
> 
> Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
> ---
>  drivers/spi/gpio_spi.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/spi/gpio_spi.c b/drivers/spi/gpio_spi.c
> index e5664df3fe..a71b4eddab 100644
> --- a/drivers/spi/gpio_spi.c
> +++ b/drivers/spi/gpio_spi.c
> @@ -48,7 +48,10 @@ static inline int getmiso(const struct spi_device *spi)
>  	return !!gpio_get_value(priv->data->miso);
>  }
>  
> -#define spidelay(nsecs) do { } while (0)
> +static inline void spidelay(unsigned int nsecs)
> +{
> +	udelay(max(1U, nsecs / 1000));

Why delay 1us at least? Why not use ndelay?

> +}
>  
>  #include "spi-bitbang-txrx.h"
>  
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux