[PATCH RFC v2 18/35] spi: nxp-fspi: Consume dummy cycles directly

From: Miquel Raynal

Date: Fri Nov 27 2026 - 09:28:14 EST


The controller programs the dummy phase in clock cycles in the LUT, but
the driver converts the legacy dummy byte count itself. Advertise the
dummy_cycles capability and use op->dummy.ncycles directly.

Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
---
drivers/spi/spi-nxp-fspi.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
index 66cb58f95fdb..e6fdded67a00 100644
--- a/drivers/spi/spi-nxp-fspi.c
+++ b/drivers/spi/spi-nxp-fspi.c
@@ -543,7 +543,7 @@ static bool nxp_fspi_supports_op(struct spi_mem *mem,
if (op->addr.nbytes)
ret |= nxp_fspi_check_buswidth(f, op->addr.buswidth);

- if (op->dummy.nbytes)
+ if (op->dummy.ncycles)
ret |= nxp_fspi_check_buswidth(f, op->dummy.buswidth);

if (op->data.nbytes)
@@ -567,8 +567,7 @@ static bool nxp_fspi_supports_op(struct spi_mem *mem,
return false;

/* Max 64 dummy clock cycles supported */
- if (op->dummy.buswidth &&
- (op->dummy.nbytes * 8 / op->dummy.buswidth > 64))
+ if (op->dummy.ncycles > 64)
return false;

/* Max data length, check controller limits and alignment */
@@ -652,16 +651,15 @@ static void nxp_fspi_prepare_lut(struct nxp_fspi *f,
lutidx++;
}

- /* dummy bytes, if needed */
- if (op->dummy.nbytes) {
+ /* dummy cycles, if needed */
+ if (op->dummy.ncycles) {
lutval[lutidx / 2] |= LUT_DEF(lutidx, op->dummy.dtr ? LUT_DUMMY_DDR : LUT_DUMMY,
/*
* Due to FlexSPI controller limitation number of PAD for dummy
* buswidth needs to be programmed as equal to data buswidth.
*/
LUT_PAD(op->data.buswidth),
- op->dummy.nbytes * 8 /
- op->dummy.buswidth);
+ op->dummy.ncycles);
lutidx++;
}

@@ -1372,11 +1370,13 @@ static const struct spi_controller_mem_caps nxp_fspi_mem_caps = {
.dtr = true,
.swap16 = false,
.per_op_freq = true,
+ .dummy_cycles = true,
};

static const struct spi_controller_mem_caps nxp_fspi_mem_caps_disable_dtr = {
.dtr = false,
.per_op_freq = true,
+ .dummy_cycles = true,
};

static void nxp_fspi_cleanup(void *data)

--
2.56.0