spi: zynq_spi: Fix infinite looping while xfer

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>
Reviewed-by: Jagan Teki <jteki@openedev.com>
This commit is contained in:
Lad, Prabhakar 2016-07-30 22:28:24 +01:00 committed by Jagan Teki
parent 9b1b6d4225
commit d2998286fc

View 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;