mirror of
https://github.com/torvalds/linux.git
synced 2026-09-25 21:21:09 -04:00
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 <[email protected]> Signed-off-by: Xinwei Kong <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
This commit is contained in:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user