* [PATCH v2 0/3] mtd/spi-mem: Enable DQS support
@ 2026-08-07 14:46 Miquel Raynal
2026-08-07 14:46 ` [PATCH v2 1/3] spi: spi-mem: Flag DQS capability Miquel Raynal
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Miquel Raynal @ 2026-08-07 14:46 UTC (permalink / raw)
To: Mark Brown, Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, praneeth, u-kumar1, p-mantena, a-dutta, s-k6,
linux-spi, linux-kernel, linux-mtd, Miquel Raynal
For his PHY tuning series on the Cadence QSPI controller embedded in TI
SoCs, Santhosh initially needed to access the availability of the DQS
(data strobe) signal. This is a chip dependent capability, which may
sometimes be enabled.
Create a SPI memory flag for it, let the SPI NAND core set this flag
when it knows about the capability, and expect manufacturer drivers to
enable it for octal needs when the chips are compatible.
This is an alternative at needing a DT property. Please note that there
are a few blind spots:
- the line may not be wired (this would be surprising, but can be
flagged this time by a DT property)
- manufacturer drivers must enable the feature if it is
available (especially for high speed DTR modes)
- this implementation is proposed for SPI NANDs only, if this proposal
is accepted the same approach may be taken in SPI NOR.
Here is the original thread which lead to this series:
https://lore.kernel.org/linux-spi/87v7gbdwdh.fsf@bootlin.com/T/#ma79fc364d7b882a48dbdf47203dde75df4bb0ec4
This series was compile tested only at this stage. As DDR tuning does
not yet work on my board, I cannot make sure this change has a real
impact.
Mark, as agreed, you can take the spi-mem patch through spi for this
cycle, and I will pick up the remaining spi-nand patches after the merge
window.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
Changes in v2:
- Dropped the RFC prefix.
- Rebased on top of v7.2-rc1.
- Dropped the spi patch for now, just allowing to use DQS on a few
Winbond SPI NANDs (can be improved later).
- Link to v1: https://lore.kernel.org/r/20260205-winbond-nand-next-phy-tuning-v1-0-5e7d3976f0f1@bootlin.com
---
Miquel Raynal (3):
spi: spi-mem: Flag DQS capability
mtd: spi-nand: Set the DQS spi-mem capability if available
mtd: spi-nand: winbond: Enable the DQS pin on W35N**JW series
drivers/mtd/nand/spi/core.c | 4 ++++
drivers/mtd/nand/spi/winbond.c | 8 ++++----
drivers/spi/spi-mem.c | 32 ++++++++++++++++++++++++++++++++
include/linux/mtd/spinand.h | 1 +
include/linux/spi/spi-mem.h | 4 ++++
5 files changed, 45 insertions(+), 4 deletions(-)
---
base-commit: 6f787fd9f19e4e1bc80d3eee1a394eb65defdff7
change-id: 20260205-winbond-nand-next-phy-tuning-aabefc018032
Best regards,
--
Miquel Raynal <miquel.raynal@bootlin.com>
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/3] spi: spi-mem: Flag DQS capability
2026-08-07 14:46 [PATCH v2 0/3] mtd/spi-mem: Enable DQS support Miquel Raynal
@ 2026-08-07 14:46 ` Miquel Raynal
2026-08-07 14:46 ` [PATCH v2 2/3] mtd: spi-nand: Set the DQS spi-mem capability if available Miquel Raynal
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Miquel Raynal @ 2026-08-07 14:46 UTC (permalink / raw)
To: Mark Brown, Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, praneeth, u-kumar1, p-mantena, a-dutta, s-k6,
linux-spi, linux-kernel, linux-mtd, Miquel Raynal
DQS is a typical SPI memory signal used to help with reading the data on
the bus at high speeds (especially in DTR mode) by avoiding clock
skews. The chip generates a clock signal synchronized with its data
output fronts, also called data strobe.
SPI NOR and SPI NAND cores must set this flag in order to indicate to
other layers that DQS is available.
Create a getter and a setter to reach this capability.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Mark Brown <broonie@kernel.org>
---
drivers/spi/spi-mem.c | 32 ++++++++++++++++++++++++++++++++
include/linux/spi/spi-mem.h | 4 ++++
2 files changed, 36 insertions(+)
diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
index 1816d9d2712a..cb5ec486f494 100644
--- a/drivers/spi/spi-mem.c
+++ b/drivers/spi/spi-mem.c
@@ -541,6 +541,38 @@ const char *spi_mem_get_name(struct spi_mem *mem)
}
EXPORT_SYMBOL_GPL(spi_mem_get_name);
+/**
+ * spi_mem_set_dqs() - Mark DQS as being available
+ * @mem: the SPI memory
+ *
+ * When reading at high frequencies (> 100MHz), especially when DTR is enabled,
+ * transfer speed is limited due to clock skews. In particular, the controller
+ * does not know the board propagation delay nor the memory chip internal delay
+ * (clock in to data out) and thus cannot optimize its sampling points.
+ * Mitigating this limitation is possible with the addition of a data strobe
+ * signal, commonly named DQS.
+ *
+ * Set the DQS boolean if the feature is available and configured at the chip
+ * level. Controllers may query this value.
+ */
+void spi_mem_set_dqs(struct spi_mem *mem)
+{
+ mem->dqs = true;
+}
+EXPORT_SYMBOL_GPL(spi_mem_set_dqs);
+
+/**
+ * spi_mem_has_dqs() - Query whether the DQS is available or not
+ * @mem: the SPI memory
+ *
+ * Return: a boolean indicating whether the DQS signal is available or not.
+ */
+bool spi_mem_has_dqs(struct spi_mem *mem)
+{
+ return mem->dqs;
+}
+EXPORT_SYMBOL_GPL(spi_mem_has_dqs);
+
/**
* spi_mem_adjust_op_size() - Adjust the data size of a SPI mem operation to
* match controller limitations
diff --git a/include/linux/spi/spi-mem.h b/include/linux/spi/spi-mem.h
index c4e7ebafdf0e..89d3f0218cc9 100644
--- a/include/linux/spi/spi-mem.h
+++ b/include/linux/spi/spi-mem.h
@@ -275,6 +275,7 @@ struct spi_mem_dirmap_desc {
* @spi: the underlying SPI device
* @drvpriv: spi_mem_driver private data
* @name: name of the SPI memory device
+ * @dqs: extra data trobe pin available for high frequency read operations
*
* Extra information that describe the SPI memory device and may be needed by
* the controller to properly handle this device should be placed here.
@@ -286,6 +287,7 @@ struct spi_mem {
struct spi_device *spi;
void *drvpriv;
const char *name;
+ bool dqs;
};
/**
@@ -463,6 +465,8 @@ bool spi_mem_default_supports_op(struct spi_mem *mem,
}
#endif /* CONFIG_SPI_MEM */
+void spi_mem_set_dqs(struct spi_mem *mem);
+bool spi_mem_has_dqs(struct spi_mem *mem);
int spi_mem_adjust_op_size(struct spi_mem *mem, struct spi_mem_op *op);
void spi_mem_adjust_op_freq(struct spi_mem *mem, struct spi_mem_op *op);
u64 spi_mem_calc_op_duration(struct spi_mem *mem, struct spi_mem_op *op);
--
2.54.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/3] mtd: spi-nand: Set the DQS spi-mem capability if available
2026-08-07 14:46 [PATCH v2 0/3] mtd/spi-mem: Enable DQS support Miquel Raynal
2026-08-07 14:46 ` [PATCH v2 1/3] spi: spi-mem: Flag DQS capability Miquel Raynal
@ 2026-08-07 14:46 ` Miquel Raynal
2026-08-07 14:46 ` [PATCH v2 3/3] mtd: spi-nand: winbond: Enable the DQS pin on W35N**JW series Miquel Raynal
2026-08-07 16:14 ` [PATCH v2 0/3] mtd/spi-mem: Enable DQS support Mark Brown
3 siblings, 0 replies; 6+ messages in thread
From: Miquel Raynal @ 2026-08-07 14:46 UTC (permalink / raw)
To: Mark Brown, Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, praneeth, u-kumar1, p-mantena, a-dutta, s-k6,
linux-spi, linux-kernel, linux-mtd, Miquel Raynal
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 72a630b266f8..6ffd0f1b9c26 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -2057,6 +2057,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 ec6efcfeef83..fe05b477afef 100644
--- a/include/linux/mtd/spinand.h
+++ b/include/linux/mtd/spinand.h
@@ -490,6 +490,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.54.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 3/3] mtd: spi-nand: winbond: Enable the DQS pin on W35N**JW series
2026-08-07 14:46 [PATCH v2 0/3] mtd/spi-mem: Enable DQS support Miquel Raynal
2026-08-07 14:46 ` [PATCH v2 1/3] spi: spi-mem: Flag DQS capability Miquel Raynal
2026-08-07 14:46 ` [PATCH v2 2/3] mtd: spi-nand: Set the DQS spi-mem capability if available Miquel Raynal
@ 2026-08-07 14:46 ` Miquel Raynal
2026-08-07 16:14 ` [PATCH v2 0/3] mtd/spi-mem: Enable DQS support Mark Brown
3 siblings, 0 replies; 6+ messages in thread
From: Miquel Raynal @ 2026-08-07 14:46 UTC (permalink / raw)
To: Mark Brown, Richard Weinberger, Vignesh Raghavendra
Cc: Thomas Petazzoni, praneeth, u-kumar1, p-mantena, a-dutta, s-k6,
linux-spi, linux-kernel, linux-mtd, Miquel Raynal
These chips have a DQS pin, enable it by default in DTR mode because
there is apparently no issue in setting it for lower frequencies, and
the extra power consumption seems very low compared to the current drawn
by the NAND array itself while operating.
This setting will be required for high speed I/O transfers (with PHY
tuning).
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
drivers/mtd/nand/spi/winbond.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c
index 9b78c1e6cbc9..8209b214e594 100644
--- a/drivers/mtd/nand/spi/winbond.c
+++ b/drivers/mtd/nand/spi/winbond.c
@@ -607,7 +607,7 @@ static int w35n0xjw_vcr_cfg(struct spinand_device *spinand,
else if (!single && !dtr)
io_mode = W35N01JW_VCR_IO_MODE_OCTAL_SDR;
else if (!single && dtr)
- io_mode = W35N01JW_VCR_IO_MODE_OCTAL_DDR;
+ io_mode = W35N01JW_VCR_IO_MODE_OCTAL_DDR_DS;
else
return -EINVAL;
@@ -689,7 +689,7 @@ static const struct spinand_info winbond_spinand_table[] = {
&write_cache_octal_variants,
&update_cache_octal_variants,
&cont_read_cache_octal_variants),
- 0,
+ SPINAND_HAS_DQS,
SPINAND_INFO_VENDOR_OPS(&winbond_w35_ops),
SPINAND_ECCINFO(&w35n01jw_ooblayout, w25w35nxxjw_ecc_get_status),
SPINAND_CONFIGURE_CHIP(w35n0xjw_vcr_cfg),
@@ -744,7 +744,7 @@ static const struct spinand_info winbond_spinand_table[] = {
&write_cache_octal_variants,
&update_cache_octal_variants,
&cont_read_cache_octal_variants),
- SPINAND_ODTR_PACKED_PAGE_READ,
+ SPINAND_ODTR_PACKED_PAGE_READ | SPINAND_HAS_DQS,
SPINAND_INFO_VENDOR_OPS(&winbond_w35_ops),
SPINAND_ECCINFO(&w35n01jw_ooblayout, w25w35nxxjw_ecc_get_status),
SPINAND_CONFIGURE_CHIP(w35n0xjw_vcr_cfg),
@@ -776,7 +776,7 @@ static const struct spinand_info winbond_spinand_table[] = {
&write_cache_octal_variants,
&update_cache_octal_variants,
&cont_read_cache_octal_variants),
- SPINAND_ODTR_PACKED_PAGE_READ,
+ SPINAND_ODTR_PACKED_PAGE_READ | SPINAND_HAS_DQS,
SPINAND_INFO_VENDOR_OPS(&winbond_w35_ops),
SPINAND_ECCINFO(&w35n01jw_ooblayout, w25w35nxxjw_ecc_get_status),
SPINAND_CONFIGURE_CHIP(w35n0xjw_vcr_cfg),
--
2.54.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/3] mtd/spi-mem: Enable DQS support
2026-08-07 14:46 [PATCH v2 0/3] mtd/spi-mem: Enable DQS support Miquel Raynal
` (2 preceding siblings ...)
2026-08-07 14:46 ` [PATCH v2 3/3] mtd: spi-nand: winbond: Enable the DQS pin on W35N**JW series Miquel Raynal
@ 2026-08-07 16:14 ` Mark Brown
2026-08-10 14:43 ` Miquel Raynal
3 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2026-08-07 16:14 UTC (permalink / raw)
To: Miquel Raynal
Cc: Richard Weinberger, Vignesh Raghavendra, Thomas Petazzoni,
praneeth, u-kumar1, p-mantena, a-dutta, s-k6, linux-spi,
linux-kernel, linux-mtd
[-- Attachment #1.1: Type: text/plain, Size: 345 bytes --]
On Fri, Aug 07, 2026 at 04:46:46PM +0200, Miquel Raynal wrote:
> Mark, as agreed, you can take the spi-mem patch through spi for this
> cycle, and I will pick up the remaining spi-nand patches after the merge
> window.
As I said on the previous version can you please send something that can
be applied? The MTD patches are failing to apply.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 144 bytes --]
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/3] mtd/spi-mem: Enable DQS support
2026-08-07 16:14 ` [PATCH v2 0/3] mtd/spi-mem: Enable DQS support Mark Brown
@ 2026-08-10 14:43 ` Miquel Raynal
0 siblings, 0 replies; 6+ messages in thread
From: Miquel Raynal @ 2026-08-10 14:43 UTC (permalink / raw)
To: Mark Brown
Cc: Richard Weinberger, Vignesh Raghavendra, Thomas Petazzoni,
praneeth, u-kumar1, p-mantena, a-dutta, s-k6, linux-spi,
linux-kernel, linux-mtd
Hi,
>> Mark, as agreed, you can take the spi-mem patch through spi for this
>> cycle, and I will pick up the remaining spi-nand patches after the merge
>> window.
>
> As I said on the previous version can you please send something that can
> be applied? The MTD patches are failing to apply.
I though you had issues with the spi-mem patch. This version still
depends on Santhosh's work. I will send an update.
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-08-10 14:43 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-07 14:46 [PATCH v2 0/3] mtd/spi-mem: Enable DQS support Miquel Raynal
2026-08-07 14:46 ` [PATCH v2 1/3] spi: spi-mem: Flag DQS capability Miquel Raynal
2026-08-07 14:46 ` [PATCH v2 2/3] mtd: spi-nand: Set the DQS spi-mem capability if available Miquel Raynal
2026-08-07 14:46 ` [PATCH v2 3/3] mtd: spi-nand: winbond: Enable the DQS pin on W35N**JW series Miquel Raynal
2026-08-07 16:14 ` [PATCH v2 0/3] mtd/spi-mem: Enable DQS support Mark Brown
2026-08-10 14:43 ` Miquel Raynal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox