summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorNaresh Kumar Ravulapalli <[email protected]>2025-03-07 01:38:26 -0800
committerTom Rini <[email protected]>2025-04-29 15:28:54 -0600
commitc0ed43c2a934dadc4066e3a1e62e4db43b2fbc20 (patch)
treecafc86d13c02f3069315a1fa22c56ffc22d713a0 /drivers
parent93f4888d71a40486edab664a9bf8390188c78c99 (diff)
drivers: spi: Fix data loss issue in QSPI
QSPI driver performs chip select operation before every read/write access. During this operation, driver needs to enable and disable the QSPI controller. This may cause data loss if there is inadvertent halting of any ongoing read/write operation. To avoid this scenario, waiting for the QSPI status to be idle before next read/write operation is implemented. Signed-off-by: Naresh Kumar Ravulapalli <[email protected]> Reviewed-by: Tien Fong Chee <[email protected]>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/spi/cadence_qspi_apb.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/spi/cadence_qspi_apb.c b/drivers/spi/cadence_qspi_apb.c
index f2f69cf9f12..b579699d2eb 100644
--- a/drivers/spi/cadence_qspi_apb.c
+++ b/drivers/spi/cadence_qspi_apb.c
@@ -747,6 +747,10 @@ cadence_qspi_apb_indirect_read_execute(struct cadence_spi_priv *priv,
goto failrd;
}
+ /* Wait til QSPI is idle */
+ if (!cadence_qspi_wait_idle(priv->regbase))
+ return -EIO;
+
return 0;
failrd:
@@ -914,6 +918,11 @@ cadence_qspi_apb_indirect_write_execute(struct cadence_spi_priv *priv,
if (bounce_buf)
free(bounce_buf);
+
+ /* Wait til QSPI is idle */
+ if (!cadence_qspi_wait_idle(priv->regbase))
+ return -EIO;
+
return 0;
failwr: