[PATCH 2/2] spi: dw: Add supports_op function to reject unsupported transfer modes

Anirudh Srinivasan via U-Boot <[email protected]> Mon, 03 Aug 2026 14:00:35 -0500
Newsgroups gmane.comp.boot-loaders.u-boot
Message-ID <[email protected]>
The designware spi driver doesn't support dual/quad/octal modes, but
the driver still tries using these modes when it sees a capable flash
chip in the devicetree. Add a supports_op function to this driver to
prevent this from happening and force single lane operation.

Signed-off-by: Anirudh Srinivasan <[email protected]>
---
 drivers/spi/designware_spi.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/spi/designware_spi.c b/drivers/spi/designware_spi.c
index 0df9a4f5abd..2f6dbeb1d94 100644
--- a/drivers/spi/designware_spi.c
+++ b/drivers/spi/designware_spi.c
@@ -694,8 +694,22 @@ static int dw_spi_adjust_op_size(struct spi_slave *slave, struct spi_mem_op *op)
 	return 0;
 }
 
+/*
+ * This driver only supports 1-1-1 transfers. Reject all other modes.
+ */
+static bool dw_spi_supports_op(struct spi_slave *slave,
+			       const struct spi_mem_op *op)
+{
+	if (op->cmd.buswidth > 1 || op->addr.buswidth > 1 ||
+	    op->dummy.buswidth > 1 || op->data.buswidth > 1)
+		return false;
+
+	return spi_mem_default_supports_op(slave, op);
+}
+
 static const struct spi_controller_mem_ops dw_spi_mem_ops = {
 	.exec_op = dw_spi_exec_op,
+	.supports_op = dw_spi_supports_op,
 	.adjust_op_size = dw_spi_adjust_op_size,
 };
 

-- 
2.43.0