spi: spi_qsd: Disable packing for unaliged non DMA mode transfers
SPI core has a characterstic that it always sends data in FIFO word size when we compress the data and fill the FIFO. This helps to improve the overall througput but sometimes for the data transfers which is not aligned to FIFO Word [i.e 4] it pads extra bytes and sends out which can mislead spi slave device. Do not enable packing if it's a FIFO mode transfer and data size is not aligned to FIFO word size. Change-Id: I28f4e3e38db4b882f229c00aa54aabdc72d2c139 Signed-off-by: Mukesh Kumar Savaliya <msavaliy@codeaurora.org>
This commit is contained in:
parent
d0aa676fad
commit
cbea40b0e1
1 changed files with 9 additions and 5 deletions
|
@ -1257,11 +1257,15 @@ static void msm_spi_set_qup_io_modes(struct msm_spi *dd)
|
|||
spi_iom &= ~(SPI_IO_M_INPUT_MODE | SPI_IO_M_OUTPUT_MODE);
|
||||
spi_iom = (spi_iom | (dd->tx_mode << OUTPUT_MODE_SHIFT));
|
||||
spi_iom = (spi_iom | (dd->rx_mode << INPUT_MODE_SHIFT));
|
||||
/* Always enable packing for all % 8 bits_per_word */
|
||||
if (dd->cur_transfer->bits_per_word &&
|
||||
((dd->cur_transfer->bits_per_word == 8) ||
|
||||
(dd->cur_transfer->bits_per_word == 16) ||
|
||||
(dd->cur_transfer->bits_per_word == 32))) {
|
||||
|
||||
/* Always enable packing for the BAM mode and for non BAM mode only
|
||||
* if bpw is % 8 and transfer length is % 4 Bytes.
|
||||
*/
|
||||
if (dd->tx_mode == SPI_BAM_MODE ||
|
||||
((dd->cur_msg_len % SPI_MAX_BYTES_PER_WORD == 0) &&
|
||||
(dd->cur_transfer->bits_per_word) &&
|
||||
(dd->cur_transfer->bits_per_word <= 32) &&
|
||||
(dd->cur_transfer->bits_per_word % 8 == 0))) {
|
||||
spi_iom |= SPI_IO_M_PACK_EN | SPI_IO_M_UNPACK_EN;
|
||||
dd->pack_words = true;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue