[PATCH RFC 08/16] spi: fsl-qspi: Consume dummy cycles directly
Bough Chen
haibo.chen at oss.nxp.com
Fri Nov 27 00:56:32 PST 2026
On Wed, Nov 25, 2026 at 05:58:22PM +0000, sashiko-bot at kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [High] spi: fsl-qspi: missing dummy_cycles in fsl_qspi_mem_caps zeroes
> ncycles
> --
>
> commit 96f0741ca2d71f7fc3b26b9f08845776854eb8a4
> Author: Miquel Raynal <miquel.raynal at bootlin.com>
>
> spi: fsl-qspi: Consume dummy cycles directly
>
> This commit converts fsl_qspi_supports_op() and fsl_qspi_prepare_lut() to
> use op->dummy.ncycles directly instead of converting op->dummy.nbytes into
> clock cycles.
>
> > diff --git a/drivers/spi/spi-fsl-qspi.c b/drivers/spi/spi-fsl-qspi.c
> > index d2c2090442f84..a1d6357e3203a 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++;
> > }
>
> [Severity: High]
> Does fsl_qspi_mem_caps also need .dummy_cycles = true?
>
> fsl_qspi_mem_caps only sets .per_op_freq = true. Without .dummy_cycles =
> true, spi_mem_convert_dummy() converts any dummy cycles to op->dummy.nbytes
> and sets op->dummy.ncycles = 0 before invoking the driver callbacks. As a
> result, op->dummy.ncycles is always 0 in fsl_qspi_supports_op() and
> fsl_qspi_prepare_lut(), so dummy validation is skipped and LUT_DUMMY is
> never programmed into the hardware LUT for operations requiring dummy
> cycles.
Correct, need .dummy_cycles = true
Regards
Haibo Chen
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20261125-macronix-upstreaming-spi-mem-cycles-v1-0-fd036402fd37@bootlin.com?part=8
More information about the linux-mtd
mailing list