[U-Boot] [PATCH] spi: zynq_spi: Fix infinite looping while xfer
Lad, Prabhakar
prabhakar.csengg at gmail.com
Sat Jul 23 21:19:44 CEST 2016
On Sat, Jul 23, 2016 at 5:19 PM, Jagan Teki <jagannadh.teki at gmail.com> wrote:
>
> On 23 June 2016 at 19:28, Lad, Prabhakar <prabhakar.csengg at gmail.com> wrote:
> > 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.Lad at racelogic.co.uk>
> > Cc: Michal Simek <michal.simek at xilinx.com>
> > Cc: Siva Durga Prasad Paladugu <sivadur at xilinx.com>
> > Cc: Jagan Teki <jteki at openedev.com>
> > ---
> > 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(®s->isr);
> > - while (status & ZYNQ_SPI_IXR_RXNEMPTY_MASK) {
> > + while ((status & ZYNQ_SPI_IXR_RXNEMPTY_MASK) && rx_len) {
>
> Do post-decrement directly on while.
>
Its the matter of taste, I usually prefer minimal changes.
Anyway above in the function tx_len isnt done in while
just keeping it consistent.
Cheers,
--Prabhakar Lad
More information about the U-Boot
mailing list