linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi/spi_s3c64xx: Warn if PIO transfers time out
@ 2010-08-23 16:40 Mark Brown
       [not found] ` <1282581656-26137-1-git-send-email-broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2010-08-23 16:40 UTC (permalink / raw)
  To: David Brownell, Grant Likely
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	patches-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Mark Brown

When using PIO we have a timeout for the TX and RX FIFOs to ensure that
the data actually gets transferred. Warn if we hit that timeout - it
should never happen, but this makes sure we'll find out if it does.

Signed-off-by: Mark Brown <broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
---
 drivers/spi/spi_s3c64xx.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/spi/spi_s3c64xx.c b/drivers/spi/spi_s3c64xx.c
index 7e627f7..f72e1c0 100644
--- a/drivers/spi/spi_s3c64xx.c
+++ b/drivers/spi/spi_s3c64xx.c
@@ -200,6 +200,9 @@ static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
 		val = readl(regs + S3C64XX_SPI_STATUS);
 	} while (TX_FIFO_LVL(val, sci) && loops--);
 
+	if (loops == 0)
+		dev_warn(&sdd->pdev->dev, "Timed out flushing TX FIFO\n");
+
 	/* Flush RxFIFO*/
 	loops = msecs_to_loops(1);
 	do {
@@ -210,6 +213,9 @@ static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
 			break;
 	} while (loops--);
 
+	if (loops == 0)
+		dev_warn(&sdd->pdev->dev, "Timed out flushing RX FIFO\n");
+
 	val = readl(regs + S3C64XX_SPI_CH_CFG);
 	val &= ~S3C64XX_SPI_CH_SW_RST;
 	writel(val, regs + S3C64XX_SPI_CH_CFG);
-- 
1.7.1


------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 

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

* Re: [PATCH] spi/spi_s3c64xx: Warn if PIO transfers time out
       [not found] ` <1282581656-26137-1-git-send-email-broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
@ 2010-08-24  0:06   ` Jassi Brar
  2010-09-08 18:23     ` [spi-devel-general] " Grant Likely
  0 siblings, 1 reply; 3+ messages in thread
From: Jassi Brar @ 2010-08-24  0:06 UTC (permalink / raw)
  To: Mark Brown
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	David Brownell,
	patches-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Tue, Aug 24, 2010 at 1:40 AM, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
> When using PIO we have a timeout for the TX and RX FIFOs to ensure that
> the data actually gets transferred. Warn if we hit that timeout - it
> should never happen, but this makes sure we'll find out if it does.
>
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
>  drivers/spi/spi_s3c64xx.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/spi/spi_s3c64xx.c b/drivers/spi/spi_s3c64xx.c
> index 7e627f7..f72e1c0 100644
> --- a/drivers/spi/spi_s3c64xx.c
> +++ b/drivers/spi/spi_s3c64xx.c
> @@ -200,6 +200,9 @@ static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
>                val = readl(regs + S3C64XX_SPI_STATUS);
>        } while (TX_FIFO_LVL(val, sci) && loops--);
>
> +       if (loops == 0)
> +               dev_warn(&sdd->pdev->dev, "Timed out flushing TX FIFO\n");
> +
>        /* Flush RxFIFO*/
>        loops = msecs_to_loops(1);
>        do {
> @@ -210,6 +213,9 @@ static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
>                        break;
>        } while (loops--);
>
> +       if (loops == 0)
> +               dev_warn(&sdd->pdev->dev, "Timed out flushing RX FIFO\n");
> +
>        val = readl(regs + S3C64XX_SPI_CH_CFG);
>        val &= ~S3C64XX_SPI_CH_SW_RST;
>        writel(val, regs + S3C64XX_SPI_CH_CFG);

Ok, though I'll be very surprised to see the FIFO flush failing. We
are not waiting
for data to be transferred, but for SW Reset to make its effect.

Acked-by: Jassi Brar <jassi.brar@samsung.com>

------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

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

* Re: [spi-devel-general] [PATCH] spi/spi_s3c64xx: Warn if PIO transfers time out
  2010-08-24  0:06   ` Jassi Brar
@ 2010-09-08 18:23     ` Grant Likely
  0 siblings, 0 replies; 3+ messages in thread
From: Grant Likely @ 2010-09-08 18:23 UTC (permalink / raw)
  To: Jassi Brar
  Cc: Mark Brown, David Brownell, spi-devel-general, patches,
	linux-kernel

On Tue, Aug 24, 2010 at 09:06:40AM +0900, Jassi Brar wrote:
> On Tue, Aug 24, 2010 at 1:40 AM, Mark Brown
> <broonie@opensource.wolfsonmicro.com> wrote:
> > When using PIO we have a timeout for the TX and RX FIFOs to ensure that
> > the data actually gets transferred. Warn if we hit that timeout - it
> > should never happen, but this makes sure we'll find out if it does.
> >
> > Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> > ---
> >  drivers/spi/spi_s3c64xx.c |    6 ++++++
> >  1 files changed, 6 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/spi/spi_s3c64xx.c b/drivers/spi/spi_s3c64xx.c
> > index 7e627f7..f72e1c0 100644
> > --- a/drivers/spi/spi_s3c64xx.c
> > +++ b/drivers/spi/spi_s3c64xx.c
> > @@ -200,6 +200,9 @@ static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
> >                val = readl(regs + S3C64XX_SPI_STATUS);
> >        } while (TX_FIFO_LVL(val, sci) && loops--);
> >
> > +       if (loops == 0)
> > +               dev_warn(&sdd->pdev->dev, "Timed out flushing TX FIFO\n");
> > +
> >        /* Flush RxFIFO*/
> >        loops = msecs_to_loops(1);
> >        do {
> > @@ -210,6 +213,9 @@ static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
> >                        break;
> >        } while (loops--);
> >
> > +       if (loops == 0)
> > +               dev_warn(&sdd->pdev->dev, "Timed out flushing RX FIFO\n");
> > +
> >        val = readl(regs + S3C64XX_SPI_CH_CFG);
> >        val &= ~S3C64XX_SPI_CH_SW_RST;
> >        writel(val, regs + S3C64XX_SPI_CH_CFG);
> 
> Ok, though I'll be very surprised to see the FIFO flush failing. We
> are not waiting
> for data to be transferred, but for SW Reset to make its effect.
> 
> Acked-by: Jassi Brar <jassi.brar@samsung.com>

Applied, thanks.

g.

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

end of thread, other threads:[~2010-09-08 18:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-23 16:40 [PATCH] spi/spi_s3c64xx: Warn if PIO transfers time out Mark Brown
     [not found] ` <1282581656-26137-1-git-send-email-broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2010-08-24  0:06   ` Jassi Brar
2010-09-08 18:23     ` [spi-devel-general] " Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).