Re: [spi-devel-general] [PATCH] spi/spi_s3c64xx: Warn if PIOtransfers time out

From: Jassi Brar
Date: Mon Aug 23 2010 - 20:06:46 EST


On Tue, Aug 24, 2010 at 1:40 AM, Mark Brown
<broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
> ---
> Â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@xxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/