summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/spi/spi-tegra.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/spi/spi-tegra.c b/drivers/spi/spi-tegra.c
index e1741cd20295..38cb8d11562d 100644
--- a/drivers/spi/spi-tegra.c
+++ b/drivers/spi/spi-tegra.c
@@ -407,8 +407,14 @@ static unsigned int spi_tegra_read_rx_fifo_to_client_rxbuf(
tspi->cur_rx_pos += tspi->curr_dma_words * tspi->bytes_per_word;
read_words += tspi->curr_dma_words;
} else {
+ unsigned int rx_mask, bits_per_word;
+
+ bits_per_word = t->bits_per_word ? t->bits_per_word :
+ tspi->cur_spi->bits_per_word;
+ rx_mask = (1 << bits_per_word) -1;
for (count = 0; count < rx_full_count; ++count) {
x = spi_tegra_readl(tspi, SLINK_RX_FIFO);
+ x &= rx_mask;
for (i = 0; (i < tspi->bytes_per_word); ++i)
*rx_buf++ = (x >> (i*8)) & 0xFF;
}
@@ -455,8 +461,14 @@ static void spi_tegra_copy_spi_rxbuf_to_client_rxbuf(
unsigned int count;
unsigned char *rx_buf = t->rx_buf + tspi->cur_rx_pos;
unsigned int x;
+ unsigned int rx_mask, bits_per_word;
+
+ bits_per_word = t->bits_per_word ? t->bits_per_word :
+ tspi->cur_spi->bits_per_word;
+ rx_mask = (1 << bits_per_word) -1;
for (count = 0; count < tspi->curr_dma_words; ++count) {
x = tspi->rx_buf[count];
+ x &= rx_mask;
for (i = 0; (i < tspi->bytes_per_word); ++i)
*rx_buf++ = (x >> (i*8)) & 0xFF;
}