spi: dw: use "smp_mb()" to avoid sending spi data error
commita81a1935d135de42c4fa34b640d787e0774be35b
authorXinwei Kong <kong.kongxinwei@hisilicon.com>
Fri, 3 Jan 2020 02:52:10 +0000 (3 10:52 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 7 Jun 2020 11:17:55 +0000 (7 13:17 +0200)
tree4a745528db856a51558037874466decd3f2951c4
parentcfad68d10849c910bfe3885e2a17de3ca4707588
spi: dw: use "smp_mb()" to avoid sending spi data error

[ Upstream commit bfda044533b213985bc62bd7ca96f2b984d21b80 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/spi/spi-dw.c