Skip to content

Commit 652ffad

Browse files
Eddie Jamesbroonie
authored andcommitted
spi: fsi: Batch TX operations
Batch sequential write transfers up to the max TX size (40 bytes). This controller must specify a max transfer size of only 8 bytes for RX operations. Signed-off-by: Eddie James <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 26a756f commit 652ffad

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/spi/spi-fsi.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,19 @@ static int fsi_spi_transfer_one_message(struct spi_controller *ctlr,
479479

480480
shift = SPI_FSI_SEQUENCE_SHIFT_IN(next->len);
481481
fsi_spi_sequence_add(&seq, shift);
482+
} else if (next->tx_buf) {
483+
if ((next->len + transfer->len) > (SPI_FSI_MAX_TX_SIZE + 8)) {
484+
rc = -EINVAL;
485+
goto error;
486+
}
487+
488+
len = next->len;
489+
while (len > 8) {
490+
fsi_spi_sequence_add(&seq,
491+
SPI_FSI_SEQUENCE_SHIFT_OUT(8));
492+
len -= 8;
493+
}
494+
fsi_spi_sequence_add(&seq, SPI_FSI_SEQUENCE_SHIFT_OUT(len));
482495
} else {
483496
next = NULL;
484497
}

0 commit comments

Comments
 (0)