[PATCH v4 10/11] mtd: spi-nand: Set the DQS spi-mem capability if available
From: Miquel Raynal
Date: Fri Nov 20 2026 - 12:16:03 EST
Check whether the NAND is capable of generating a DQS signal and advertise
the capability through the spi-mem layer. Do it as soon as the chip is
identified and before the SSDR/ODTR operation variants are negotiated, so
that controllers can take the capability into account when they need it.
Whether the DQS line is actually wired is described by the
spi-dqs-not-wired DT property and handled by the spi-mem layer, which
only reports DQS as available when the chip supports it, the line is
wired and the controller can use it.
Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
---
drivers/mtd/nand/spi/core.c | 3 +++
include/linux/mtd/spinand.h | 1 +
2 files changed, 4 insertions(+)
diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index fee4a48b4c7f..6e1b7976d237 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -1797,6 +1797,9 @@ int spinand_match_and_init(struct spinand_device *spinand,
}
}
+ if (spinand->flags & SPINAND_HAS_DQS)
+ spi_mem_set_dqs_pin_available(spinand->spimem);
+
/* I/O variants selection with octo-spi DDR commands (optional) */
ret = spinand_init_odtr_instruction_set(spinand);
diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h
index 87107f0955eb..990d3e9ac3fe 100644
--- a/include/linux/mtd/spinand.h
+++ b/include/linux/mtd/spinand.h
@@ -492,6 +492,7 @@ struct spinand_ecc_info {
#define SPINAND_HAS_READ_PLANE_SELECT_BIT BIT(3)
#define SPINAND_NO_RAW_ACCESS BIT(4)
#define SPINAND_ODTR_PACKED_PAGE_READ BIT(5)
+#define SPINAND_HAS_DQS BIT(6)
/**
* struct spinand_ondie_ecc_conf - private SPI-NAND on-die ECC engine structure
--
2.56.0