Skip to contentSkip to conversation

spi: cadence_qspi_apb: fix QSPI write issues

PATCH New Ooi 2 participants 3 messages Nov 21, 2019 – Dec 2, 2019 SPI

lore
Share & tools
lore

Ooi

#0 lore raw

PATCH 1/1 spi: cadence_qspi_apb: fix QSPI write issues

From: Chee Hong Ang <[email protected]>

QSPI driver perform chip select on every flash read/write access. The driver need to disable/enable the QSPI controller while performing chip select. This may cause some data lost especially the QSPI controller is configured to run at slower speed as it may take longer time to access the flash device. This patch prevent the driver from disable/enable the QSPI controller too soon and inadvertently halting any ongoing flash read/write access by ensuring the QSPI controller is always in idle mode after each read/write access.

---
 drivers/spi/cadence_qspi_apb.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/spi/cadence_qspi_apb.c +9 -0
index 55a7501..ab14a5f 100644
@@ -676,6 +676,10 @@ int cadence_qspi_apb_indirect_read_execute(struct cadence_spi_platdata *plat,
 	writel(CQSPI_REG_INDIRECTRD_DONE,
 	       plat->regbase + CQSPI_REG_INDIRECTRD);
 
+	/* Wait til QSPI is idle */
+	if (!cadence_qspi_wait_idle(plat->regbase))
+		return -EIO;
+
 	return 0;
 
 failrd:
@@ -782,6 +786,11 @@ int cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat,
 	       plat->regbase + CQSPI_REG_INDIRECTWR);
 	if (bounce_buf)
 		free(bounce_buf);
+
+	/* Wait til QSPI is idle */
+	if (!cadence_qspi_wait_idle(plat->regbase))
+		return -EIO;
+
 	return 0;
 
 failwr:
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 spi: cadence_qspi_apb: fix QSPI write issues

Quoted 22 lines

-----Original Message-----
From: Ooi, Joyce <[email protected]>
Sent: Thursday, November 21, 2019 10:42 PM
To: Jagan Teki <[email protected]>
Cc: Tan, Ley Foon <[email protected]>; Ang, Chee Hong <[email protected]>; Ooi, Joyce <[email protected]>; u- boot at lists.denx.de
Subject: [PATCH] spi: cadence_qspi_apb: fix QSPI write issues

From: Chee Hong Ang <[email protected]>

QSPI driver perform chip select on every flash read/write access. The driver need to disable/enable the QSPI controller while performing chip select. This may cause some data lost especially the QSPI controller is configured to run at slower speed as it may take longer time to access the flash device. This patch prevent the driver from disable/enable the QSPI controller too soon and inadvertently halting any ongoing flash read/write access by ensuring the QSPI controller is always in idle mode after each read/write access.

Quoted 2 lines
Quoted 36 lines
---
 drivers/spi/cadence_qspi_apb.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/spi/cadence_qspi_apb.c +4 -0
index 55a7501..ab14a5f 100644
@@ -676,6 +676,10 @@ int
 cadence_qspi_apb_indirect_read_execute(struct cadence_spi_platdata *plat,
 	writel(CQSPI_REG_INDIRECTRD_DONE,
 	       plat->regbase + CQSPI_REG_INDIRECTRD);
 
+	/* Wait til QSPI is idle */
+	if (!cadence_qspi_wait_idle(plat->regbase))
+		return -EIO;
+
 	return 0;
 

failrd:

drivers/spi/cadence_qspi_apb.c +0 -0
@@ -782,6 +786,11 @@ int

cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat,

drivers/spi/cadence_qspi_apb.c +5 -1
 	       plat->regbase + CQSPI_REG_INDIRECTWR);
 	if (bounce_buf)
 		free(bounce_buf);
+
+	/* Wait til QSPI is idle */
+	if (!cadence_qspi_wait_idle(plat->regbase))
+		return -EIO;
+
 	return 0;
 
 failwr:
--

1.9.1

#2 lore raw

PATCH 1/1 spi: cadence_qspi_apb: fix QSPI write issues

Am 22.11.2019 um 03:03 schrieb Tan, Ley Foon:

Quoted 22 lines
Quoted 22 lines

-----Original Message-----
From: Ooi, Joyce <[email protected]>
Sent: Thursday, November 21, 2019 10:42 PM
To: Jagan Teki <[email protected]>
Cc: Tan, Ley Foon <[email protected]>; Ang, Chee Hong <[email protected]>; Ooi, Joyce <[email protected]>; u- boot at lists.denx.de
Subject: [PATCH] spi: cadence_qspi_apb: fix QSPI write issues

From: Chee Hong Ang <[email protected]>

QSPI driver perform chip select on every flash read/write access. The driver need to disable/enable the QSPI controller while performing chip select. This may cause some data lost especially the QSPI controller is configured to run at slower speed as it may take longer time to access the flash device. This patch prevent the driver from disable/enable the QSPI controller too soon and inadvertently halting any ongoing flash read/write access by ensuring the QSPI controller is always in idle mode after each read/write access.

Quoted 4 lines
Quoted 2 lines
Quoted 43 lines
Quoted 36 lines
---
  drivers/spi/cadence_qspi_apb.c | 9 +++++++++
  1 file changed, 9 insertions(+)
drivers/spi/cadence_qspi_apb.c +4 -0
index 55a7501..ab14a5f 100644
@@ -676,6 +676,10 @@ int
 cadence_qspi_apb_indirect_read_execute(struct cadence_spi_platdata *plat,
  	writel(CQSPI_REG_INDIRECTRD_DONE,
  	       plat->regbase + CQSPI_REG_INDIRECTRD);
 
+	/* Wait til QSPI is idle */
+	if (!cadence_qspi_wait_idle(plat->regbase))
+		return -EIO;
+
  	return 0;
 

failrd:

drivers/spi/cadence_qspi_apb.c +0 -0
@@ -782,6 +786,11 @@ int

cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat,
plat->regbase + CQSPI_REG_INDIRECTWR);
if (bounce_buf)
free(bounce_buf);

drivers/spi/cadence_qspi_apb.c +5 -1
+
+	/* Wait til QSPI is idle */
+	if (!cadence_qspi_wait_idle(plat->regbase))
+		return -EIO;
+
  	return 0;
 
  failwr:
--
Quoted 1 line

1.9.1

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot