diff mbox series

spi: fsi: Batch TX operations

Message ID 20250131200158.732898-1-eajames@linux.ibm.com (mailing list archive)
State Accepted
Commit 652ffad172d089acb1a20e5fde1b66e687832b06
Headers show
Series spi: fsi: Batch TX operations | expand

Commit Message

Eddie James Jan. 31, 2025, 8:01 p.m. UTC
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 <eajames@linux.ibm.com>
---
 drivers/spi/spi-fsi.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Mark Brown Feb. 5, 2025, 12:44 p.m. UTC | #1
On Fri, 31 Jan 2025 14:01:58 -0600, Eddie James wrote:
> 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.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: fsi: Batch TX operations
      commit: 652ffad172d089acb1a20e5fde1b66e687832b06

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/drivers/spi/spi-fsi.c b/drivers/spi/spi-fsi.c
index fc9e33be1e0e7..e01c63d23b64d 100644
--- a/drivers/spi/spi-fsi.c
+++ b/drivers/spi/spi-fsi.c
@@ -479,6 +479,19 @@  static int fsi_spi_transfer_one_message(struct spi_controller *ctlr,
 
 				shift = SPI_FSI_SEQUENCE_SHIFT_IN(next->len);
 				fsi_spi_sequence_add(&seq, shift);
+			} else if (next->tx_buf) {
+				if ((next->len + transfer->len) > (SPI_FSI_MAX_TX_SIZE + 8)) {
+					rc = -EINVAL;
+					goto error;
+				}
+
+				len = next->len;
+				while (len > 8) {
+					fsi_spi_sequence_add(&seq,
+							     SPI_FSI_SEQUENCE_SHIFT_OUT(8));
+					len -= 8;
+				}
+				fsi_spi_sequence_add(&seq, SPI_FSI_SEQUENCE_SHIFT_OUT(len));
 			} else {
 				next = NULL;
 			}