Skip to contentSkip to conversation

spi: cadence-qspi: Fix QSPI write issues

PATCH New Chee Hong Ang 2 participants 3 messages Aug 5, 2020 – Aug 27, 2020 SPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: cadence-qspi: Fix QSPI write issues

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 f9675f7..5696eb3 100644
@@ -648,6 +648,10 @@ 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:
@@ -763,6 +767,11 @@ 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
2.2.0
#1 lore raw

PATCH 1/1 spi: cadence-qspi: Fix QSPI write issues

Quoted 23 lines

-----Original Message-----
From: Ang, Chee Hong <[email protected]>
Sent: Wednesday, August 5, 2020 5:33 PM
To: u-boot at lists.denx.de
Cc: Phil Edworthy <[email protected]>; Vignesh R <[email protected]>; Tom Rini <[email protected]>; See, Chin Liang <[email protected]>; Tan, Ley Foon <[email protected]>; Ang, Chee Hong <[email protected]>; Chee, Tien Fong <[email protected]>; Lim, Elly Siew Chin <[email protected]>
Subject: [PATCH v1] spi: cadence-qspi: Fix QSPI write issues

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 5 lines
---
 drivers/spi/cadence_qspi_apb.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Regards
Ley Foon

#2 lore raw

PATCH 1/1 spi: cadence-qspi: Fix QSPI write issues

Quoted 42 lines

-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Tan, Ley Foon
Sent: Wednesday, August 5, 2020 6:00 PM
To: Ang, Chee Hong <[email protected]>; u-boot at lists.denx.de
Cc: Phil Edworthy <[email protected]>; Vignesh R <[email protected]>; Tom Rini <[email protected]>; See, Chin Liang <[email protected]>; Chee, Tien Fong <[email protected]>; Lim, Elly Siew Chin <[email protected]>
Subject: RE: [PATCH v1] spi: cadence-qspi: Fix QSPI write issues

Quoted 12 lines

-----Original Message-----
From: Ang, Chee Hong <[email protected]>
Sent: Wednesday, August 5, 2020 5:33 PM
To: u-boot at lists.denx.de
Cc: Phil Edworthy <[email protected]>; Vignesh R <[email protected]>; Tom Rini <[email protected]>; See, Chin Liang <[email protected]>; Tan, Ley Foon <[email protected]>; Ang, Chee Hong <[email protected]>; Chee, Tien Fong <[email protected]>; Lim, Elly Siew Chin <[email protected]>
Subject: [PATCH v1] spi: cadence-qspi: Fix QSPI write issues

Quoted 4 lines

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.

Quoted 10 lines

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(+)
Quoted 4 lines

Regards
Ley Foon

+ Jagan, SPI maintainer.

Jagan, can you help integrate this patch?

Regards
Ley Foon