All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot]  [PATCH] spi: zynq_spi: Fix infinite looping while xfer
@ 2016-06-23 13:58 Lad, Prabhakar
  2016-07-19  8:17 ` Lad, Prabhakar
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Lad, Prabhakar @ 2016-06-23 13:58 UTC (permalink / raw)
  To: u-boot

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) {
             buf = readl(&regs->rxdr);
             if (rx_buf)
                 *rx_buf++ = buf;
-- 
2.1.4

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

* [U-Boot] [PATCH] spi: zynq_spi: Fix infinite looping while xfer
  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-23 16:19 ` Jagan Teki
  2 siblings, 0 replies; 8+ messages in thread
From: Lad, Prabhakar @ 2016-07-19  8:17 UTC (permalink / raw)
  To: u-boot

On Thu, Jun 23, 2016 at 2:58 PM, 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
>
Gentle ping..

Cheers,
--Prabhakar Lad

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

* [U-Boot] [PATCH] spi: zynq_spi: Fix infinite looping while xfer
  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-23 16:19 ` Jagan Teki
  2 siblings, 1 reply; 8+ messages in thread
From: Jagan Teki @ 2016-07-21  6:58 UTC (permalink / raw)
  To: u-boot

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

Does these number during 'sspi' or during data transfer? why rx_len is
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) {
>              buf = readl(&regs->rxdr);
>              if (rx_buf)
>                  *rx_buf++ = buf;

-- 
Jagan.

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

* [U-Boot] [PATCH] spi: zynq_spi: Fix infinite looping while xfer
  2016-07-21  6:58 ` Jagan Teki
@ 2016-07-21  8:24   ` Lad, Prabhakar
  2016-07-21 17:14     ` Jagan Teki
  0 siblings, 1 reply; 8+ messages in thread
From: Lad, Prabhakar @ 2016-07-21  8:24 UTC (permalink / raw)
  To: u-boot

On Thu, Jul 21, 2016 at 7:58 AM, Jagan Teki <jagannadh.teki@gmail.com> wrote:
> 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
>
> Does these number during 'sspi' or during data transfer? why rx_len is
> 4294967295?
>
As mentioned in the commit, if you run the command 'sspi 1:1.0 8 ff'
It just keeps busy looping.

Cheers,
--Prabhakar Lad

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

* [U-Boot] [PATCH] spi: zynq_spi: Fix infinite looping while xfer
  2016-07-21  8:24   ` Lad, Prabhakar
@ 2016-07-21 17:14     ` Jagan Teki
  0 siblings, 0 replies; 8+ messages in thread
From: Jagan Teki @ 2016-07-21 17:14 UTC (permalink / raw)
  To: u-boot

On 21 July 2016 at 13:54, Lad, Prabhakar <prabhakar.csengg@gmail.com> wrote:
> On Thu, Jul 21, 2016 at 7:58 AM, Jagan Teki <jagannadh.teki@gmail.com> wrote:
>> 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
>>
>> Does these number during 'sspi' or during data transfer? why rx_len is
>> 4294967295?
>>
> As mentioned in the commit, if you run the command 'sspi 1:1.0 8 ff'
> It just keeps busy looping.

OK, will update commit message as for rx

-- 
Jagan.

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

* [U-Boot] [PATCH] spi: zynq_spi: Fix infinite looping while xfer
  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-23 16:19 ` Jagan Teki
  2016-07-23 19:19   ` Lad, Prabhakar
  2 siblings, 1 reply; 8+ messages in thread
From: Jagan Teki @ 2016-07-23 16:19 UTC (permalink / raw)
  To: u-boot

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.

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

* [U-Boot] [PATCH] spi: zynq_spi: Fix infinite looping while xfer
  2016-07-23 16:19 ` Jagan Teki
@ 2016-07-23 19:19   ` Lad, Prabhakar
  2016-07-27  6:38     ` Jagan Teki
  0 siblings, 1 reply; 8+ messages in thread
From: Lad, Prabhakar @ 2016-07-23 19:19 UTC (permalink / raw)
  To: u-boot

On Sat, Jul 23, 2016 at 5:19 PM, Jagan Teki <jagannadh.teki@gmail.com> wrote:
>
> 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.
>
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

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

* [U-Boot] [PATCH] spi: zynq_spi: Fix infinite looping while xfer
  2016-07-23 19:19   ` Lad, Prabhakar
@ 2016-07-27  6:38     ` Jagan Teki
  0 siblings, 0 replies; 8+ messages in thread
From: Jagan Teki @ 2016-07-27  6:38 UTC (permalink / raw)
  To: u-boot

Please resend the patch, patchwork mbox download shows different.

On 24 July 2016 at 00:49, Lad, Prabhakar <prabhakar.csengg@gmail.com> wrote:
> On Sat, Jul 23, 2016 at 5:19 PM, Jagan Teki <jagannadh.teki@gmail.com> wrote:
>>
>> 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

-- 
Jagan.

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

end of thread, other threads:[~2016-07-27  6:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2016-07-23 19:19   ` Lad, Prabhakar
2016-07-27  6:38     ` 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.