diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2016-10-27 21:25:58 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-10-28 19:39:23 +0100 |
commit | 54731265966db742dda09008bd9bbe12ae11e93e (patch) | |
tree | 360a948ee4d59e6665b82cc607a74d450dd38bdb /drivers/spi/spi-fsl-lib.h | |
parent | e9e128a69af2b5fd2a4e01a59cc7e479ce9b8813 (diff) |
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>
Diffstat (limited to 'drivers/spi/spi-fsl-lib.h')
-rw-r--r-- | drivers/spi/spi-fsl-lib.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/spi/spi-fsl-lib.h b/drivers/spi/spi-fsl-lib.h index 2925c8089fd9..24d8bc84a111 100644 --- a/drivers/spi/spi-fsl-lib.h +++ b/drivers/spi/spi-fsl-lib.h @@ -30,7 +30,9 @@ struct mpc8xxx_spi { void *rx; #if IS_ENABLED(CONFIG_SPI_FSL_ESPI) int len; + unsigned int tx_len; u8 *local_buf; + spinlock_t lock; #endif int subblock; |