Check whether the NAND is capable of generating a DQS signal and set the
flag accordingly.
Not wiring the DQS signal on a DQS capable chip that will be used at
frequency requiring this signal may be considered a hardware bug, so
let's assume this line will be routed "in most cases". If/when we get
issues with this assumption, a DT property describing the lacking line
in the routing can be created.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
drivers/mtd/nand/spi/core.c | 4 ++++
include/linux/mtd/spinand.h | 1 +
2 files changed, 5 insertions(+)
diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index 95df4dd5330d..67270e49c179 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -1974,6 +1974,10 @@ static int spinand_probe(struct spi_mem *mem)
read_op = *spinand->op_templates->read_cache;
write_op = *spinand->op_templates->write_cache;
+ /* Assume manufacturer drivers will enable the DQS pin if it is available */
+ if (spinand->flags & SPINAND_HAS_DQS)
+ spi_mem_set_dqs(mem);
+
ret = spi_mem_execute_tuning(mem, &read_op, &write_op);
if (ret && ret != -EOPNOTSUPP) {
dev_warn(&mem->spi->dev, "Failed to execute PHY tuning: %d\n",
diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h
index 58abd306ebe3..72babba69c7a 100644
--- a/include/linux/mtd/spinand.h
+++ b/include/linux/mtd/spinand.h
@@ -483,6 +483,7 @@ struct spinand_ecc_info {
#define SPINAND_HAS_PROG_PLANE_SELECT_BIT BIT(2)
#define SPINAND_HAS_READ_PLANE_SELECT_BIT BIT(3)
#define SPINAND_NO_RAW_ACCESS BIT(4)
+#define SPINAND_HAS_DQS BIT(5)
/**
* struct spinand_ondie_ecc_conf - private SPI-NAND on-die ECC engine structure
--
2.51.1