All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jagan Teki <jagannadh.teki@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] spi: zynq_spi: Fix infinite looping while xfer
Date: Sat, 23 Jul 2016 21:49:09 +0530	[thread overview]
Message-ID: <CAD6G_RR3PrzJ3S3HNCE7fKeAoak-NW8J1ffijfRg2VgXMa5SxA@mail.gmail.com> (raw)
In-Reply-To: <CA+V-a8tnQptxBNak50HHD_24-2+N-N_=+LwnQp6gepW68tvpFQ@mail.gmail.com>

On 23 June 2016 at 19:28, Lad, Prabhakar <prabhakar.csengg@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@racelogic.co.uk>
> Cc: Michal Simek <michal.simek@xilinx.com>
> Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
> Cc: Jagan Teki <jteki@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(&regs->isr);
> -        while (status & ZYNQ_SPI_IXR_RXNEMPTY_MASK) {
> +        while ((status & ZYNQ_SPI_IXR_RXNEMPTY_MASK) && rx_len) {

Do post-decrement directly on while.

thanks!
-- 
Jagan.

  parent reply	other threads:[~2016-07-23 16:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-23 13:58 [U-Boot] [PATCH] spi: zynq_spi: Fix infinite looping while xfer Lad, Prabhakar
2016-07-19  8:17 ` Lad, Prabhakar
2016-07-21  6:58 ` Jagan Teki
2016-07-21  8:24   ` Lad, Prabhakar
2016-07-21 17:14     ` Jagan Teki
2016-07-23 16:19 ` Jagan Teki [this message]
2016-07-23 19:19   ` Lad, Prabhakar
2016-07-27  6:38     ` Jagan Teki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAD6G_RR3PrzJ3S3HNCE7fKeAoak-NW8J1ffijfRg2VgXMa5SxA@mail.gmail.com \
    --to=jagannadh.teki@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.