From: Quanyang Wang <quanyang.w...@windriver.com>

For some scenarios, the wrong transfer_len is written to genfifoentry.
Take 10 bytes data reading operation for instance, 8 bytes will be read
from the flash by using DMA mode and 2 bytes left in IO mode. Thus we need
to create an 8-byte size transfer genfifoentry in zynqmp_qspi_fillgenfifo
and 2-byte size transfer genfifoentry in zynqmp_process_dma_irq. But in
zynqmp_qspi_read_op, because zynqmp_qspi_fillgenfifo is running before
zynqmp_qspi_setuprxdma, xqspi->mode is wrong and the transfer_len in
zynqmp_qspi_fillgenfifo will be wrongly assigned to be 10. This results
that data corruption in the reading operation.

Running zynqmp_qspi_setuprxdma before zynqmp_qspi_fillgenfifo can
fix this error.

Signed-off-by: Quanyang Wang <quanyang.w...@windriver.com>
---
 drivers/spi/spi-zynqmp-gqspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c
index b66144c15153..83467812d89f 100644
--- a/drivers/spi/spi-zynqmp-gqspi.c
+++ b/drivers/spi/spi-zynqmp-gqspi.c
@@ -826,8 +826,8 @@ static void zynqmp_qspi_write_op(struct zynqmp_qspi *xqspi, 
u8 tx_nbits,
 static void zynqmp_qspi_read_op(struct zynqmp_qspi *xqspi, u8 rx_nbits,
                                u32 genfifoentry)
 {
-       zynqmp_qspi_fillgenfifo(xqspi, rx_nbits, genfifoentry);
        zynqmp_qspi_setuprxdma(xqspi);
+       zynqmp_qspi_fillgenfifo(xqspi, rx_nbits, genfifoentry);
 }
 
 /**
-- 
2.17.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#9190): 
https://lists.yoctoproject.org/g/linux-yocto/message/9190
Mute This Topic: https://lists.yoctoproject.org/mt/78526818/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to