]> git.baikalelectronics.ru Git - kernel.git/commit
spi: dw: Refactor IRQ-based SPI transfer procedure
authorBaikal Electronics <support@baikalelectronics.ru>
Wed, 7 Oct 2020 23:54:58 +0000 (02:54 +0300)
committerMark Brown <broonie@kernel.org>
Thu, 8 Oct 2020 22:00:12 +0000 (23:00 +0100)
commit4917e0c5789794551a8ffc9f3b783b91f977d640
treeffd8dfa5fda756cc396cd2f59db9d3a582d2d5ef
parente778454a5c429eb49c5bb14936266a5292274e11
spi: dw: Refactor IRQ-based SPI transfer procedure

Current IRQ-based SPI transfer execution procedure doesn't work well at
the final stage of the execution. If all the Tx data is sent out (written
to the Tx FIFO) but there is some data left to receive, the Tx FIFO Empty
IRQ will constantly happen until all of the requested inbound data is
received. Though for a short period of time, but it will make the system
less responsive. In order to fix that let's refactor the SPI transfer
execution procedure by taking the Rx FIFO Full IRQ into account. We'll read
and write SPI transfer data each time the IRQ happens as before. If all
the outbound data is sent out, we'll disable the Tx FIFO Empty IRQ. If
there is still some data to receive, we'll adjust the Rx FIFO Threshold
level, so the next IRQ would be raised at the moment of all incoming data
being available in the Rx FIFO.

Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Link: https://lore.kernel.org/r/20201007235511.4935-10-Sergey.Semin@baikalelectronics.ru
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-dw-core.c