u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Jit Loon Lim <jit.loon.lim@intel.com>
To: u-boot@lists.denx.de
Cc: Jagan Teki <jagan@amarulasolutions.com>,
	Vignesh R <vigneshr@ti.com>, Marek <marex@denx.de>,
	Simon <simon.k.r.goldschmidt@gmail.com>,
	Tien Fong <tien.fong.chee@intel.com>,
	Kok Kiang <kok.kiang.hea@intel.com>,
	Siew Chin <elly.siew.chin.lim@intel.com>,
	Sin Hui <sin.hui.kho@intel.com>, Raaj <raaj.lokanathan@intel.com>,
	Dinesh <dinesh.maniyam@intel.com>,
	Boon Khai <boon.khai.ng@intel.com>,
	Alif <alif.zakuan.yuslaimi@intel.com>,
	Teik Heng <teik.heng.chong@intel.com>,
	Hazim <muhammad.hazim.izzat.zamri@intel.com>,
	Jit Loon Lim <jit.loon.lim@intel.com>,
	Chee Hong Ang <chee.hong.ang@intel.com>
Subject: [PATCH 016/347] FogBugz #516535: Fix QSPI write issues
Date: Tue, 30 Aug 2022 14:20:09 +0800	[thread overview]
Message-ID: <20220830062009.24408-1-jit.loon.lim@intel.com> (raw)

From: Chee Hong Ang <chee.hong.ang@intel.com>

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.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
---
 drivers/spi/cadence_qspi_apb.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/spi/cadence_qspi_apb.c b/drivers/spi/cadence_qspi_apb.c
index 2cdf4c9c9f..5e03495f45 100644
--- a/drivers/spi/cadence_qspi_apb.c
+++ b/drivers/spi/cadence_qspi_apb.c
@@ -858,13 +858,9 @@ cadence_qspi_apb_indirect_read_execute(struct cadence_spi_plat *plat,
 	writel(CQSPI_REG_INDIRECTRD_DONE,
 	       plat->regbase + CQSPI_REG_INDIRECTRD);
 
-	/* Check indirect done status */
-	ret = wait_for_bit_le32(plat->regbase + CQSPI_REG_INDIRECTRD,
-				CQSPI_REG_INDIRECTRD_DONE, 0, 10, 0);
-	if (ret) {
-		printf("Indirect read clear completion error (%i)\n", ret);
-		goto failrd;
-	}
+	/* Wait til QSPI is idle */
+	if (!cadence_qspi_wait_idle(plat->regbase))
+		return -EIO;
 
 	return 0;
 
@@ -1031,6 +1027,11 @@ cadence_qspi_apb_indirect_write_execute(struct cadence_spi_plat *plat,
 
 	if (bounce_buf)
 		free(bounce_buf);
+
+	/* Wait til QSPI is idle */
+	if (!cadence_qspi_wait_idle(plat->regbase))
+		return -EIO;
+
 	return 0;
 
 failwr:
-- 
2.25.1


             reply	other threads:[~2022-08-30 11:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-30  6:20 Jit Loon Lim [this message]
2022-10-23  5:33 ` [PATCH 016/347] FogBugz #516535: Fix QSPI write issues Jagan Teki
2022-10-25  6:08 ` Vignesh Raghavendra
  -- strict thread matches above, loose matches on Subject: below --
2022-08-02 13:54 Jit Loon Lim
2022-08-09  2:57 ` Chee, Tien Fong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220830062009.24408-1-jit.loon.lim@intel.com \
    --to=jit.loon.lim@intel.com \
    --cc=alif.zakuan.yuslaimi@intel.com \
    --cc=boon.khai.ng@intel.com \
    --cc=chee.hong.ang@intel.com \
    --cc=dinesh.maniyam@intel.com \
    --cc=elly.siew.chin.lim@intel.com \
    --cc=jagan@amarulasolutions.com \
    --cc=kok.kiang.hea@intel.com \
    --cc=marex@denx.de \
    --cc=muhammad.hazim.izzat.zamri@intel.com \
    --cc=raaj.lokanathan@intel.com \
    --cc=simon.k.r.goldschmidt@gmail.com \
    --cc=sin.hui.kho@intel.com \
    --cc=teik.heng.chong@intel.com \
    --cc=tien.fong.chee@intel.com \
    --cc=u-boot@lists.denx.de \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).