summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorPratyush Yadav <p.yadav@ti.com>2021-04-14 23:53:31 +0530
committerPraneeth Bajjuri <praneeth@ti.com>2021-04-14 13:52:44 -0500
commit7d1ee7f194ed02eac90728743628407fe57884ca (patch)
treecd23518553591cd90694f2cc6425296d23010001 /drivers
parent246ca5eae017e855ada6b372661d3bf9a192e8e0 (diff)
spi: cadence-qspi: Do not use DMA for small reads
A very frequent operation is the Read Status Register command that is executed repeatedly after doing an erase or page program. On the Cypress S28HS512T flash this command expects 4 address bytes and so it does not go via the STIG route. The command reads 2 bytes from the flash. Setting up DMA for it is more hassle than it is worth. For small reads like this, the speed gain, if any, will not be worth the extra overhead. So do not use DMA for reads smaller than 16 bytes. This should cover polling operations like SR polling. It also fixes an issue on J721E and J7200 with the Cypress S28HS512T flash where DMA would eventually freeze when writing or erasing because of the constant bombardment of small, frequent reads. Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/spi/cadence_qspi_apb.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/spi/cadence_qspi_apb.c b/drivers/spi/cadence_qspi_apb.c
index 286f223673..e828486e2e 100644
--- a/drivers/spi/cadence_qspi_apb.c
+++ b/drivers/spi/cadence_qspi_apb.c
@@ -997,7 +997,14 @@ cadence_qspi_apb_direct_read_execute(struct cadence_spi_platdata *plat,
u_char *buf = op->data.buf.in;
int ret;
- if (len < 16 || !cadence_qspi_apb_use_phy(plat, op)) {
+ if (len < 16) {
+ memcpy_fromio(buf, plat->ahbbase + from, len);
+ if (!cadence_qspi_wait_idle(plat->regbase))
+ return -EIO;
+ return 0;
+ }
+
+ if (!cadence_qspi_apb_use_phy(plat, op)) {
if (!op->data.dtr || dma_memcpy(buf, plat->ahbbase + from, len) < 0)
memcpy_fromio(buf, plat->ahbbase + from, len);