[PATCH 09/12] spi: mtk-nor: Validate the dummy buswidth

Miquel Raynal miquel.raynal at bootlin.com
Thu Nov 26 11:10:28 PST 2026


The driver only supports the dummy phase on the address bus; the
read mode is selected from the address buswidth. Reject operations where
the dummy buswidth differs from the address buswidth.

Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>
---
 drivers/spi/spi-mtk-nor.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/spi/spi-mtk-nor.c b/drivers/spi/spi-mtk-nor.c
index 6b6e55d68048..350b47fab7e6 100644
--- a/drivers/spi/spi-mtk-nor.c
+++ b/drivers/spi/spi-mtk-nor.c
@@ -317,6 +317,9 @@ static bool mtk_nor_supports_op(struct spi_mem *mem,
 	if (op->cmd.buswidth != 1)
 		return false;
 
+	if (op->dummy.nbytes && op->dummy.buswidth != op->addr.buswidth)
+		return false;
+
 	if ((op->addr.nbytes == 3) || (op->addr.nbytes == 4)) {
 		switch (op->data.dir) {
 		case SPI_MEM_DATA_IN:

-- 
2.56.0




More information about the linux-riscv mailing list