summaryrefslogtreecommitdiff
path: root/drivers/spi
diff options
context:
space:
mode:
authorXinwei Kong <kong.kongxinwei@hisilicon.com>2020-01-03 05:52:10 +0300
committerMark Brown <broonie@kernel.org>2020-01-06 23:49:03 +0300
commitbfda044533b213985bc62bd7ca96f2b984d21b80 (patch)
tree9ac27f2aec9f611e097d5d3b9d42b546a2f558a5 /drivers/spi
parent09b6636cea4f8e419d7cca4155e8695e462535a6 (diff)
downloadlinux-bfda044533b213985bc62bd7ca96f2b984d21b80.tar.xz
spi: dw: use "smp_mb()" to avoid sending spi data error
Because of out-of-order execution about some CPU architecture, In this debug stage we find Completing spi interrupt enable -> prodrucing TXEI interrupt -> running "interrupt_transfer" function will prior to set "dw->rx and dws->rx_end" data, so this patch add memory barrier to enable dw->rx and dw->rx_end to be visible and solve to send SPI data error. eg: it will fix to this following low possibility error in testing environment which using SPI control to connect TPM Modules kernel: tpm tpm0: Operation Timed out kernel: tpm tpm0: tpm_relinquish_locality: : error -1 Signed-off-by: fengsheng <fengsheng5@huawei.com> Signed-off-by: Xinwei Kong <kong.kongxinwei@hisilicon.com> Link: https://lore.kernel.org/r/1578019930-55858-1-git-send-email-kong.kongxinwei@hisilicon.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-dw.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c
index c547ae38ed69..310492e21b33 100644
--- a/drivers/spi/spi-dw.c
+++ b/drivers/spi/spi-dw.c
@@ -297,6 +297,9 @@ static int dw_spi_transfer_one(struct spi_controller *master,
dws->len = transfer->len;
spin_unlock_irqrestore(&dws->buf_lock, flags);
+ /* Ensure dw->rx and dw->rx_end are visible */
+ smp_mb();
+
spi_enable_chip(dws, 0);
/* Handle per transfer options for bpw and speed */