lkml.org 
[lkml]   [2019]   [Dec]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] spi: dw: use "smp_mb()" to avoid sending spi data error
Date
this patch will add memory barrier to ensure this "struct dw_spi *dws"
to complete data setting before enabling this SPI hardware interrupt.
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>
---
drivers/spi/spi-dw.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c
index a92aa5c..d0d77a2 100644
--- a/drivers/spi/spi-dw.c
+++ b/drivers/spi/spi-dw.c
@@ -288,6 +288,8 @@ static int dw_spi_transfer_one(struct spi_controller *master,
dws->rx_end = dws->rx + transfer->len;
dws->len = transfer->len;

+ smp_mb();
+
spi_enable_chip(dws, 0);

/* Handle per transfer options for bpw and speed */
--
2.7.4
\
 
 \ /
  Last update: 2019-12-26 10:23    [W:0.058 / U:10.480 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site