]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit - drivers/spi/spi-fsl-espi.c
spi: fsl-espi: fix and improve writing to TX FIFO
authorHeiner Kallweit <hkallweit1@gmail.com>
Thu, 27 Oct 2016 19:25:58 +0000 (21:25 +0200)
committerMark Brown <broonie@kernel.org>
Fri, 28 Oct 2016 18:39:23 +0000 (19:39 +0100)
commit54731265966db742dda09008bd9bbe12ae11e93e
tree360a948ee4d59e6665b82cc607a74d450dd38bdb
parente9e128a69af2b5fd2a4e01a59cc7e479ce9b8813
spi: fsl-espi: fix and improve writing to TX FIFO

This change addresses two issues:
- If the TX FIFO is full the ISR polls until there's free space again.
  An ISR should never wait for something.
- Currently the number of bytes to transfer is rounded up to the next
  multiple of 4. For most transfers therefore few bytes remain in the
  TX FIFO after end of transfer.
  This would cause the next transfer to fail and as a workaround the
  ESPI block is disabled / re-enabled in fsl_espi_change_mode.
  This seems to clear the FIFO's (although it's not mentioned in the
  spec).

With this change the TX FIFO is filled as much as possible initially
and whenever the ISR is called. Also the exact number of bytes is
transferred.
The spinlock protects against a potential race if the first interrupt
occurs whilst the TX FIFO is still being initially filled.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-fsl-espi.c
drivers/spi/spi-fsl-lib.h