[PATCH RFC v2 22/35] spi: nxp-xspi: Reject mixed DTR modes
From: Miquel Raynal
Date: Fri Nov 27 2026 - 09:28:49 EST
The controller only supports operations where all phases use the same
DTR mode. The mode selection in nxp_xspi_select_mem() assumes either an
all-DTR or an all-SDR operation; mixed DTR operations would be
misconfigured.
Reject mixed DTR operations from ->supports_op().
Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
---
drivers/spi/spi-nxp-xspi.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/spi/spi-nxp-xspi.c b/drivers/spi/spi-nxp-xspi.c
index ccd00c744d18..f2a847b5fd27 100644
--- a/drivers/spi/spi-nxp-xspi.c
+++ b/drivers/spi/spi-nxp-xspi.c
@@ -385,8 +385,18 @@ static bool nxp_xspi_supports_op(struct spi_mem *mem,
const struct spi_mem_op *op)
{
struct nxp_xspi *xspi = spi_controller_get_devdata(mem->spi->controller);
+ bool all_true, all_false;
int ret;
+ all_true = op->cmd.dtr &&
+ (!op->addr.nbytes || op->addr.dtr) &&
+ (!op->data.nbytes || op->data.dtr);
+
+ all_false = !op->cmd.dtr && !op->addr.dtr && !op->data.dtr;
+
+ if (!all_true && !all_false)
+ return false;
+
ret = nxp_xspi_check_buswidth(xspi, op->cmd.buswidth);
if (op->addr.nbytes)
--
2.56.0