All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] spi: cadence-qspi: Fix QSPI write issues
@ 2020-08-05  9:32 Chee Hong Ang
  2020-08-05 10:00 ` Tan, Ley Foon
  0 siblings, 1 reply; 3+ messages in thread
From: Chee Hong Ang @ 2020-08-05  9:32 UTC (permalink / raw)
  To: u-boot

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 | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/spi/cadence_qspi_apb.c b/drivers/spi/cadence_qspi_apb.c
index f9675f7..5696eb3 100644
--- a/drivers/spi/cadence_qspi_apb.c
+++ b/drivers/spi/cadence_qspi_apb.c
@@ -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:
-- 
2.2.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v1] spi: cadence-qspi: Fix QSPI write issues
  2020-08-05  9:32 [PATCH v1] spi: cadence-qspi: Fix QSPI write issues Chee Hong Ang
@ 2020-08-05 10:00 ` Tan, Ley Foon
  2020-08-27  6:09   ` Tan, Ley Foon
  0 siblings, 1 reply; 3+ messages in thread
From: Tan, Ley Foon @ 2020-08-05 10:00 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: Ang, Chee Hong <chee.hong.ang@intel.com>
> Sent: Wednesday, August 5, 2020 5:33 PM
> To: u-boot at lists.denx.de
> Cc: Phil Edworthy <PHIL.EDWORTHY@renesas.com>; Vignesh R
> <vigneshr@ti.com>; Tom Rini <trini@konsulko.com>; See, Chin Liang
> <chin.liang.see@intel.com>; Tan, Ley Foon <ley.foon.tan@intel.com>; Ang,
> Chee Hong <chee.hong.ang@intel.com>; Chee, Tien Fong
> <tien.fong.chee@intel.com>; Lim, Elly Siew Chin
> <elly.siew.chin.lim@intel.com>
> 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.
> 
> Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
> ---
>  drivers/spi/cadence_qspi_apb.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 

Reviewed-by: Ley Foon Tan <ley.foon.tan@intel.com>

Regards
Ley Foon

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v1] spi: cadence-qspi: Fix QSPI write issues
  2020-08-05 10:00 ` Tan, Ley Foon
@ 2020-08-27  6:09   ` Tan, Ley Foon
  0 siblings, 0 replies; 3+ messages in thread
From: Tan, Ley Foon @ 2020-08-27  6:09 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: U-Boot <u-boot-bounces@lists.denx.de> On Behalf Of Tan, Ley Foon
> Sent: Wednesday, August 5, 2020 6:00 PM
> To: Ang, Chee Hong <chee.hong.ang@intel.com>; u-boot at lists.denx.de
> Cc: Phil Edworthy <PHIL.EDWORTHY@renesas.com>; Vignesh R
> <vigneshr@ti.com>; Tom Rini <trini@konsulko.com>; See, Chin Liang
> <chin.liang.see@intel.com>; Chee, Tien Fong <tien.fong.chee@intel.com>;
> Lim, Elly Siew Chin <elly.siew.chin.lim@intel.com>
> Subject: RE: [PATCH v1] spi: cadence-qspi: Fix QSPI write issues
> 
> 
> 
> > -----Original Message-----
> > From: Ang, Chee Hong <chee.hong.ang@intel.com>
> > Sent: Wednesday, August 5, 2020 5:33 PM
> > To: u-boot at lists.denx.de
> > Cc: Phil Edworthy <PHIL.EDWORTHY@renesas.com>; Vignesh R
> > <vigneshr@ti.com>; Tom Rini <trini@konsulko.com>; See, Chin Liang
> > <chin.liang.see@intel.com>; Tan, Ley Foon <ley.foon.tan@intel.com>;
> > Ang, Chee Hong <chee.hong.ang@intel.com>; Chee, Tien Fong
> > <tien.fong.chee@intel.com>; Lim, Elly Siew Chin
> > <elly.siew.chin.lim@intel.com>
> > 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.
> >
> > Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
> > ---
> >  drivers/spi/cadence_qspi_apb.c | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> >
> 
> Reviewed-by: Ley Foon Tan <ley.foon.tan@intel.com>
> 
> Regards
> Ley Foon

+ Jagan, SPI maintainer.

Jagan, can you help integrate this patch?

Regards
Ley Foon

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-27  6:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-05  9:32 [PATCH v1] spi: cadence-qspi: Fix QSPI write issues Chee Hong Ang
2020-08-05 10:00 ` Tan, Ley Foon
2020-08-27  6:09   ` Tan, Ley Foon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.