Skip to contentSkip to conversation

Fix issues for small sized data reads

PATCH Applied Venkatesh Yadav Abbarapu 2 participants 4 messages Sep 15, 2023 – Sep 21, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover Fix issues for small sized data reads

Change flush cache to invalidate cache and also fix cache related issues are seen with small sized data reads. Due to this, proper data is not read. Also some times sf probe fails randomly.

Ashok Reddy Soma (1):
spi: zynqmp_qspi: Change flush cache to invalidate cache

Venkatesh Yadav Abbarapu (1):
spi: zynqmp_qspi: Workaround for small data cache issue

 drivers/spi/zynqmp_gqspi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/2 spi: zynqmp_qspi: Change flush cache to invalidate cache

From: Ashok Reddy Soma <[email protected]>

Before DMA read, ideally cache should be invalidated, so that data from memory will be updated to cache after DMA is completed. But flush_dcache_range is being used which is incorrect. Change flush_dcache_range to invalidate_dcache_range.

---
 drivers/spi/zynqmp_gqspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/zynqmp_gqspi.c +1 -1
index c4aee279aa..a506d15227 100644
@@ -690,7 +690,7 @@ static int zynqmp_qspi_start_dma(struct zynqmp_qspi_priv *priv,
 		writel(GQSPI_DMA_DST_I_STS_MASK, &dma_regs->dmaier);
 		addr = (unsigned long)buf;
 		size = roundup(priv->len, GQSPI_DMA_ALIGN);
-		flush_dcache_range(addr, addr + size);
+		invalidate_dcache_range(addr, addr + size);
 
 		while (priv->len) {
 			zynqmp_qspi_calc_exp(priv, &gen_fifo_cmd);
Signature · 1 line
2.17.1
#2 lore raw

PATCH v2 2/2 spi: zynqmp_qspi: Workaround for small data cache issue

In reply to Venkatesh Yadav Abbarapu

Cache related issues are seen with small sized data reads.
Due to this, proper data is not read. Also some times sf probe fails randomly. To workaround this issue, invalidate dcache after read DMA is triggered.

---
 drivers/spi/zynqmp_gqspi.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/spi/zynqmp_gqspi.c +2 -0
index a506d15227..ec59ef5804 100644
@@ -707,6 +707,8 @@ static int zynqmp_qspi_start_dma(struct zynqmp_qspi_priv *priv,
 			return -ETIMEDOUT;
 		}
 
+		invalidate_dcache_range(addr, addr + size);
+
 		writel(GQSPI_DMA_DST_I_STS_DONE, &dma_regs->dmaisr);
 
 		debug("buf:0x%lx, rxbuf:0x%lx, *buf:0x%x len: 0x%x\n",
Signature · 1 line
2.17.1
maintainer Applied
#3 lore raw
In reply to Venkatesh Yadav Abbarapu
Quoted 5 lines · Venkatesh Yadav Abbarapu

Change flush cache to invalidate cache and also fix cache related issues are seen with small sized data reads. Due to this, proper data is not read. Also some times sf probe fails randomly.

Quoted 9 lines

Ashok Reddy Soma (1):
spi: zynqmp_qspi: Change flush cache to invalidate cache

Venkatesh Yadav Abbarapu (1):
spi: zynqmp_qspi: Workaround for small data cache issue

  drivers/spi/zynqmp_gqspi.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

Applied.
M