]> asedeno.scripts.mit.edu Git - linux.git/commit
staging: mt7621-spi: revised half-duplex message handling
authorNeilBrown <neil@brown.name>
Wed, 6 Jun 2018 22:04:21 +0000 (08:04 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 Jun 2018 07:05:11 +0000 (09:05 +0200)
commitbf732c6bff5b5767a1c2ec6495dccd76d71c05eb
treeddfcdcd757e615ab52b872731c18501a7dd6146d
parenta83834c1c9ba446f694c0bc29bce25687bf06582
staging: mt7621-spi: revised half-duplex message handling

The mt7621 SPI engine has a 32 byte buffer and the driver
currently only allows 32-byte read requests and 36 bytes writes
(there is a 4byte op/addr buffer).

This is an unnecessary limitation.  As the SPI clock is controlled
by the host it is quite acceptable to send a larger message in
multiple smaller transactions.  As long as Chip Select is kept asserted
the whole time, the SPI engine can be run multiple times for
a single SPI message.

This patch factors out the transaction logic and calls for each
transfer in the message.  A write transfer might leave bytes in the
buffer to be combined with a following read transfer, as this is
a common pattern.

With this in place, we can remove the current max_transfer_size limit.

In testing, this increases the read throughput for a NOR flash chip
from 1.4MB/s to 2.3MB/s, a 50% improvement.

Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/mt7621-spi/spi-mt7621.c