summaryrefslogtreecommitdiff
path: root/certs
diff options
context:
space:
mode:
authorLukas Wunner <lukas@wunner.de>2018-11-08 08:06:10 +0100
committerMark Brown <broonie@kernel.org>2018-11-28 15:58:15 +0000
commit3bd7f6589f67f05a7901bdc2810631814d89e462 (patch)
tree3934558161ed5b637c988e6a56290b1b63ee0f0f /certs
parentacf0f856959937952b9758381d5b5bcb65a52cfd (diff)
spi: bcm2835: Overcome sglist entry length limitation
When in DMA mode, the BCM2835 SPI controller requires that the FIFO is accessed in 4 byte chunks. This rule is not fulfilled if a transfer consists of multiple sglist entries, one per page, and the first entry starts in the middle of a page with an offset not a multiple of 4. The driver currently falls back to programmed I/O for such transfers, incurring a significant performance penalty. Overcome this hardware limitation by transferring the first few bytes of a transfer without DMA such that the remainder of the first sglist entry becomes a multiple of 4. Specifics are provided in kerneldoc comments. An alternative approach would have been to split transfers in the ->prepare_message hook, but this may necessitate two transfers per page, defeating the goal of clustering multiple pages together in a single transfer for efficiency. E.g. if the first TX sglist entry's length is 23 and the first RX's is 40, the first transfer would send and receive 23 bytes, the second 40 - 23 = 17 bytes, the third 4096 - 17 = 4079 bytes, the fourth 4096 - 4079 = 17 bytes and so on. In other words, O(n) transfers are necessary (n = number of sglist entries), whereas the algorithm implemented herein only requires O(1) additional work. Signed-off-by: Lukas Wunner <lukas@wunner.de> Cc: Mathias Duckeck <m.duckeck@kunbus.de> Cc: Frank Pavlic <f.pavlic@kunbus.de> Cc: Martin Sperl <kernel@martin.sperl.org> Cc: Noralf Trønnes <noralf@tronnes.org> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'certs')
0 files changed, 0 insertions, 0 deletions