Skip to content

Commit

Permalink
spi/spi_s3c64xx: Warn if PIO transfers time out
Browse files Browse the repository at this point in the history
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>
Acked-by: Jassi Brar <jassi.brar@samsung.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
  • Loading branch information
Mark Brown authored and Grant Likely committed Sep 8, 2010
1 parent c3f139b commit be7852a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/spi/spi_s3c64xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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);
Expand Down

0 comments on commit be7852a

Please sign in to comment.