All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] spi: zynq_spi: Fix infinite looping while xfer
@ 2016-07-30 21:28 Lad Prabhakar
  2016-07-31 11:35 ` Jagan Teki
  0 siblings, 1 reply; 2+ messages in thread
From: Lad Prabhakar @ 2016-07-30 21:28 UTC (permalink / raw)
  To: u-boot

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

During spi transfer, for example:
sspi 1:1.0 8 ff

the rx_len values will  be:
rx_len = 0
rx_len = 4294967295

This caused a busy looping during xfer, this patch fixes it
by adding a check while reading the rx fifo

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Cc: Jagan Teki <jteki@openedev.com>
---
 Changes for v2: None
 
 drivers/spi/zynq_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/zynq_spi.c b/drivers/spi/zynq_spi.c
index 09ae1be..dd3de27 100644
--- a/drivers/spi/zynq_spi.c
+++ b/drivers/spi/zynq_spi.c
@@ -230,7 +230,7 @@ static int zynq_spi_xfer(struct udevice *dev, unsigned int bitlen,
 
 		/* Read the data from RX FIFO */
 		status = readl(&regs->isr);
-		while (status & ZYNQ_SPI_IXR_RXNEMPTY_MASK) {
+		while ((status & ZYNQ_SPI_IXR_RXNEMPTY_MASK) && rx_len) {
 			buf = readl(&regs->rxdr);
 			if (rx_buf)
 				*rx_buf++ = buf;
-- 
1.9.1

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

* [U-Boot] [PATCH v2] spi: zynq_spi: Fix infinite looping while xfer
  2016-07-30 21:28 [U-Boot] [PATCH v2] spi: zynq_spi: Fix infinite looping while xfer Lad Prabhakar
@ 2016-07-31 11:35 ` Jagan Teki
  0 siblings, 0 replies; 2+ messages in thread
From: Jagan Teki @ 2016-07-31 11:35 UTC (permalink / raw)
  To: u-boot

On 31 July 2016 at 02:58, Lad Prabhakar <prabhakar.csengg@gmail.com> wrote:
> From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
>
> During spi transfer, for example:
> sspi 1:1.0 8 ff
>
> the rx_len values will  be:
> rx_len = 0
> rx_len = 4294967295
>
> This caused a busy looping during xfer, this patch fixes it
> by adding a check while reading the rx fifo
>
> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
> Cc: Michal Simek <michal.simek@xilinx.com>
> Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
> Cc: Jagan Teki <jteki@openedev.com>

Applied to u-boot-spi/master

-- 
Jagan.

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

end of thread, other threads:[~2016-07-31 11:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-30 21:28 [U-Boot] [PATCH v2] spi: zynq_spi: Fix infinite looping while xfer Lad Prabhakar
2016-07-31 11:35 ` Jagan Teki

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.