From 4c165a4d5e76e5c111ac21c9d9506ea6d87705c9 Mon Sep 17 00:00:00 2001 From: Ashwini Ghuge Date: Wed, 20 Jun 2012 14:14:28 +0530 Subject: spi: tegra: Max tx words limited to max buff size When computing required words for a transfer, limit this to max possible size on given sub transfer Change-Id: Ia1a9290ae389e36ecb5a8d03be2982885a544a33 Signed-off-by: Ashwini Ghuge Reviewed-on: http://git-master/r/109462 Reviewed-by: Simone Willett Tested-by: Simone Willett --- drivers/spi/spi-tegra.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-tegra.c b/drivers/spi/spi-tegra.c index 33e2004101b7..0af220c863c2 100644 --- a/drivers/spi/spi-tegra.c +++ b/drivers/spi/spi-tegra.c @@ -346,12 +346,12 @@ static unsigned spi_tegra_calculate_curr_xfer_param( if (tspi->is_packed) { max_len = min(remain_len, tspi->max_buf_size); tspi->curr_dma_words = max_len/tspi->bytes_per_word; - total_fifo_words = remain_len/4; + total_fifo_words = max_len/4; } else { max_word = (remain_len - 1) / tspi->bytes_per_word + 1; max_word = min(max_word, tspi->max_buf_size/4); tspi->curr_dma_words = max_word; - total_fifo_words = remain_len/tspi->bytes_per_word; + total_fifo_words = max_word; } return total_fifo_words; } -- cgit v1.2.3