[PATCH v2] spi: spi-mem: ease checks in dtr_supports_op()

Dhruva Gole d-gole at ti.com
Thu Oct 27 17:09:08 CEST 2022


Hi,

A gentle reminder to review the following patch:

spi: spi-mem: ease checks in dtr_supports_op()

https://lore.kernel.org/u-boot/20221025062036.383460-1-d-gole@ti.com/

Kindly merge if it looks okay.

On 25/10/22 11:50, Dhruva Gole wrote:
> Remove the extra conditions that cause some cases to fail prematurely
> like if the data number of bytes is odd. The controller can handle odd
> number of bytes data read in DTR Mode. Don't fail supports op for this
> condition. This change can also be justified by taking a look at the
> equivalent code in the linux kernel (v6.0.3), in drivers/spi/spi-mem.c,
> where such an even number of data bytes check is absent as well.
> The presence of this even byte check causes supports op failure even if
> the controller can indeed work in case of odd bytes data reads in
> DTR (Dual Transfer Rate) mode in xSPI.
> There have not been any sort of major bugs in the absence of this
> particular supports_op check, so it is safe to discard this
> check from here.
>
> Signed-off-by: Dhruva Gole <d-gole at ti.com>
> ---
> v1 of the patch had a relatively shorter commit body that did not
> sufficiently describe and justify this patch. link to v1:
> https://lore.kernel.org/u-boot/20221020083424.86848-1-d-gole@ti.com/
>
> v2 has just updated the commit body while preserving the code changes from
> earlier v1 patch. This tries to address the changes requested from Jagan Teki.
>
>   drivers/spi/spi-mem.c | 4 ----
>   1 file changed, 4 deletions(-)
>
> diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
> index 8e8995fc537f..eecc13bec90d 100644
> --- a/drivers/spi/spi-mem.c
> +++ b/drivers/spi/spi-mem.c
> @@ -181,10 +181,6 @@ bool spi_mem_dtr_supports_op(struct spi_slave *slave,
>   	if (op->dummy.nbytes && op->dummy.buswidth == 8 && op->dummy.nbytes % 2)
>   		return false;
>   
> -	if (op->data.dir != SPI_MEM_NO_DATA &&
> -	    op->dummy.buswidth == 8 && op->data.nbytes % 2)
> -		return false;
> -
>   	return spi_mem_check_buswidth(slave, op);
>   }
>   EXPORT_SYMBOL_GPL(spi_mem_dtr_supports_op);

-- 
Best regards,
Dhruva Gole
Texas Instruments Incorporated



More information about the U-Boot mailing list