]> Git Repo - u-boot.git/commitdiff
spi: zynq_spi: Fix infinite looping while xfer
authorLad, Prabhakar <[email protected]>
Sat, 30 Jul 2016 21:28:24 +0000 (22:28 +0100)
committerJagan Teki <[email protected]>
Wed, 21 Sep 2016 19:28:26 +0000 (00:58 +0530)
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 <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Siva Durga Prasad Paladugu <[email protected]>
Reviewed-by: Jagan Teki <[email protected]>
drivers/spi/zynq_spi.c

index 09ae1be7e9875ed4d6acd2d7d0eae810561fefdb..dd3de2792d462ed32f91b3246a0f83e61c89f8bd 100644 (file)
@@ -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;
This page took 0.034159 seconds and 4 git commands to generate.