serial: max310x: use a batch write op for UART transmit
authorJan Kundrát <jan.kundrat@cesnet.cz>
Wed, 13 Dec 2017 13:20:39 +0000 (14:20 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Dec 2017 08:59:02 +0000 (09:59 +0100)
commitd584b65c0ddf20acb769552f5fb64856d46ace4b
treeb5473c0bcf1752d78fe9a23dd41792b50a5742d5
parentb2497c1a7d864c5723e7abfdb1dffb5a9a0f092f
serial: max310x: use a batch write op for UART transmit

The transmit register supports batched writes. The key is simply to keep
sending additional bytes up to the FIFO size in the same SPI
transaction with the CS pin still being held low.

This duplicates the regmap infrastructure to a certain extent. There are
some provisions for multiple writes in there, but there does not appear
to be any support for those writes which are destined to the *same*
register (and also no standard for SPI bus transfers of these, anyway).

This patch does not solve every case (if the UART xmit circular buffer
wraps around, we're still doing two SPI transactions), but at least
it's not one-byte-per-transaction anymore.

This change does not touch the receive path at this time. Doing that in
the generic case appears to be impossible in the general case, because
the chips' status register contains data about the *current* byte in the
HW's Rx FIFO. We cannot read these two registers in one go,
unfortunately.

Signed-off-by: Jan Kundrát <jan.kundrat@cesnet.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/max310x.c