From: Scott Jiang Date: Wed, 7 Dec 2011 19:53:30 +0000 (-0500) Subject: bfin: discard invalid data and clear RXS in bf5xx spi driver X-Git-Tag: v2013.07-rc1~1^2~53^2~9 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d4d4f903773e0e5540baa00157585de25a542ba6;p=oweals%2Fu-boot.git bfin: discard invalid data and clear RXS in bf5xx spi driver There may be dirty data in RDBR, so we should discard invalid data. This operation also clears RXS bit in STAT register. Signed-off-by: Scott Jiang Signed-off-by: Sonic Zhang --- diff --git a/drivers/spi/bfin_spi.c b/drivers/spi/bfin_spi.c index 0fa131b21d..a9a4d92c3e 100644 --- a/drivers/spi/bfin_spi.c +++ b/drivers/spi/bfin_spi.c @@ -248,6 +248,8 @@ void spi_release_bus(struct spi_slave *slave) static int spi_pio_xfer(struct bfin_spi_slave *bss, const u8 *tx, u8 *rx, uint bytes) { + /* discard invalid data and clear RXS */ + read_SPI_RDBR(bss); /* todo: take advantage of hardware fifos */ while (bytes--) { u8 value = (tx ? *tx++ : CONFIG_BFIN_SPI_IDLE_VAL);