[PATCH RFC v2 15/35] spi: fsl-qspi: Consume dummy cycles directly

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


On Fri, Nov 27, 2026 at 03:22:37PM +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>

Test on imx6ull-14x14 evk board with one 4 bit spi-nor with the following params:
So: 
Reviewed-and-Tested-by: Haibo Chen <haibo.chen at nxp.com>


root at imx6ul7d:~# cat /sys/kernel/debug/spi-nor/spi4.0/params
name            n25q256a
id              20 ba 19 10 40 00
size            32.0 MiB
write size      1
page size       256
address nbytes  4
flags           4B_OPCODES | HAS_4BAIT | HAS_LOCK | SOFT_RESET

> ---
>  drivers/spi/spi-fsl-qspi.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/spi/spi-fsl-qspi.c b/drivers/spi/spi-fsl-qspi.c
> index d2c2090442f8..383915b3ed41 100644
> --- a/drivers/spi/spi-fsl-qspi.c
> +++ b/drivers/spi/spi-fsl-qspi.c
> @@ -399,7 +399,7 @@ static bool fsl_qspi_supports_op(struct spi_mem *mem,
>  	if (op->addr.nbytes)
>  		ret |= fsl_qspi_check_buswidth(q, op->addr.buswidth);
>  
> -	if (op->dummy.nbytes)
> +	if (op->dummy.ncycles)
>  		ret |= fsl_qspi_check_buswidth(q, op->dummy.buswidth);
>  
>  	if (op->data.nbytes)
> @@ -413,13 +413,12 @@ static bool fsl_qspi_supports_op(struct spi_mem *mem,
>  	 * to fit into a single LUT entry.
>  	 */
>  	if (op->addr.nbytes +
> -	   (op->dummy.nbytes ? 1:0) +
> +	   (op->dummy.ncycles ? 1:0) +
>  	   (op->data.nbytes ? 1:0) > 6)
>  		return false;
>  
>  	/* Max 64 dummy clock cycles supported */
> -	if (op->dummy.nbytes &&
> -	    (op->dummy.nbytes * 8 / op->dummy.buswidth > 64))
> +	if (op->dummy.ncycles > 64)
>  		return false;
>  
>  	/* Max data length, check controller limits and alignment */
> @@ -460,11 +459,10 @@ static void fsl_qspi_prepare_lut(struct fsl_qspi *q,
>  		lutidx++;
>  	}
>  
> -	if (op->dummy.nbytes) {
> +	if (op->dummy.ncycles) {
>  		lutval[lutidx / 2] |= LUT_DEF(lutidx, LUT_DUMMY,
>  					      LUT_PAD(op->dummy.buswidth),
> -					      op->dummy.nbytes * 8 /
> -					      op->dummy.buswidth);
> +					      op->dummy.ncycles);
>  		lutidx++;
>  	}
>  
> @@ -872,6 +870,7 @@ static const struct spi_controller_mem_ops fsl_qspi_mem_ops = {
>  
>  static const struct spi_controller_mem_caps fsl_qspi_mem_caps = {
>  	.per_op_freq = true,
> +	.dummy_cycles = true,
>  };
>  
>  static void fsl_qspi_disable(void *data)
> 
> -- 
> 2.56.0
> 



More information about the linux-arm-kernel mailing list