[U-Boot,v1,2/2] bfin: discard invalid data and clear RXS in bf5xx spi driver

Message ID 1362381609-23716-2-git-send-email-sonic.adi@gmail.com
State Accepted
Delegated to: Sonic Zhang
Headers show

Commit Message

Sonic Zhang March 4, 2013, 7:20 a.m.
From: Scott Jiang <scott.jiang.linux@gmail.com>

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 <scott.jiang.linux@gmail.com>
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
 drivers/spi/bfin_spi.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)


diff --git a/drivers/spi/bfin_spi.c b/drivers/spi/bfin_spi.c
index fff384a..1845e4f 100644
--- a/drivers/spi/bfin_spi.c
+++ b/drivers/spi/bfin_spi.c
@@ -250,6 +250,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);