[PATCH v4 07/11] spi: cadence-quadspi: Decouple the read capture bypass from DQS
From: Miquel Raynal
Date: Fri Nov 20 2026 - 12:15:46 EST
The READCAPTURE bypass bit is not the logical opposite of the DQS bit.
Bypass selects the legacy delay-based read capture while DQS selects the
data strobe based capture. Both are valid in DTR mode: a DTR read without
a DQS line must use the delay-based capture with bypass disabled.
The tuning helpers currently derive bypass from !use_dqs. This happens to
work while use_dqs is always true in DTR mode, but use_dqs will soon
become false for DTR reads when the DQS line is not usable. Bypass would
then be wrongly enabled during tuning, unlike cqspi_phy_pre_config()
which keeps bypass disabled for DTR.
Store whether the read op is DTR and derive bypass from it instead of
from use_dqs. SDR reads keep bypass enabled and DTR reads keep it
disabled, regardless of the DQS setting.
Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
---
drivers/spi/spi-cadence-quadspi.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c
index 72a5101c4a8c..683924a4a274 100644
--- a/drivers/spi/spi-cadence-quadspi.c
+++ b/drivers/spi/spi-cadence-quadspi.c
@@ -84,6 +84,7 @@ struct cqspi_flash_pdata {
u32 tchsh_ns;
u32 tslch_ns;
bool use_dqs;
+ bool dtr;
bool use_tuned_phy;
bool dll_locked;
u8 cs;
@@ -1149,7 +1150,7 @@ static int cqspi_tune_phy_read(struct cqspi_flash_pdata *f_pdata, bool enable)
if (ret)
return ret;
- cqspi_readdata_capture(cqspi, !f_pdata->use_dqs, f_pdata->use_dqs,
+ cqspi_readdata_capture(cqspi, !f_pdata->dtr, f_pdata->use_dqs,
f_pdata->phy_setting.read_delay);
reg = readl(reg_base + CQSPI_REG_CONFIG);
@@ -2137,7 +2138,7 @@ static int cqspi_phy_apply_setting(struct cqspi_flash_pdata *f_pdata,
f_pdata->phy_setting.tx = phy->tx;
f_pdata->phy_setting.read_delay = phy->read_delay;
- cqspi_readdata_capture(cqspi, !f_pdata->use_dqs, f_pdata->use_dqs,
+ cqspi_readdata_capture(cqspi, !f_pdata->dtr, f_pdata->use_dqs,
phy->read_delay);
return 0;
@@ -3534,6 +3535,8 @@ static int cqspi_am654_ospi_execute_tuning(struct spi_mem *mem,
f_pdata->phy_read_op.max_freq = mem->spi->post_config_max_speed_hz;
+ f_pdata->dtr = op_is_dtr;
+
if (op_is_dtr) {
f_pdata->use_dqs = true;
cqspi_phy_pre_config(cqspi, f_pdata, false);
--
2.56.0