[PATCH RFC v2 20/35] spi: nxp-xspi: Consume dummy cycles directly

Bough Chen haibo.chen at oss.nxp.com
Mon Nov 30 03:37:25 PST 2026


On Fri, Nov 27, 2026 at 03:22:42PM +0100, Miquel Raynal wrote:
> The controller programs the dummy phase in clock cycles, but the driver
> converts the legacy dummy byte count into cycles. Advertise the
> dummy_cycles capability and use op->dummy.ncycles directly.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>

Tested on imx943-evk board, no issue find.

Reviewed-and-Tested-by: Haibo Chen <haibo.chen at nxp.com>

Regards
Haibo Chen
> ---
>  drivers/spi/spi-nxp-xspi.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/spi/spi-nxp-xspi.c b/drivers/spi/spi-nxp-xspi.c
> index 38c8d6269aad..8b836662a5da 100644
> --- a/drivers/spi/spi-nxp-xspi.c
> +++ b/drivers/spi/spi-nxp-xspi.c
> @@ -392,7 +392,7 @@ static bool nxp_xspi_supports_op(struct spi_mem *mem,
>  	if (op->addr.nbytes)
>  		ret |= nxp_xspi_check_buswidth(xspi, op->addr.buswidth);
>  
> -	if (op->dummy.nbytes)
> +	if (op->dummy.ncycles)
>  		ret |= nxp_xspi_check_buswidth(xspi, op->dummy.buswidth);
>  
>  	if (op->data.nbytes)
> @@ -408,8 +408,7 @@ static bool nxp_xspi_supports_op(struct spi_mem *mem,
>  		return false;
>  
>  	/* Max 32 dummy clock cycles supported */
> -	if (op->dummy.buswidth &&
> -	    (op->dummy.nbytes * 8 / op->dummy.buswidth > 64))
> +	if (op->dummy.ncycles > 64)
>  		return false;
>  
>  	if (needs_ip_only(xspi) && op->data.dir == SPI_MEM_DATA_IN &&
> @@ -453,12 +452,10 @@ static void nxp_xspi_prepare_lut(struct nxp_xspi *xspi,
>  	}
>  
>  	/* Dummy bytes, if needed */
> -	if (op->dummy.nbytes) {
> +	if (op->dummy.ncycles) {
>  		lutval[lutidx / 2] |= LUT_DEF(lutidx, LUT_DUMMY,
>  					      LUT_PAD(op->data.buswidth),
> -					      op->dummy.nbytes * 8 /
> -						/* need distinguish ddr mode */
> -					      op->dummy.buswidth / (op->dummy.dtr ? 2 : 1));
> +					      op->dummy.ncycles);
>  		lutidx++;
>  	}
>  
> @@ -1307,6 +1304,7 @@ static const struct spi_controller_mem_caps nxp_xspi_mem_caps = {
>  	.dtr = true,
>  	.per_op_freq = true,
>  	.swap16 = true,
> +	.dummy_cycles = true,
>  };
>  
>  static void nxp_xspi_cleanup(void *data)
> 
> -- 
> 2.56.0
> 



More information about the linux-arm-kernel mailing list