spi: dw-mid: clear BUSY flag fist and test other one
PATCH RESEND v2 1/1 spi: dw-mid: clear BUSY flag fist and test other one
The logic of DMA completion is broken now since test_and_clear_bit() never returns the other bit is set. It means condition are always false and we have spi_finalize_current_transfer() called per each DMA completion which is wrong.
The patch fixes logic by clearing BUSY bit first and then check for the other one.
--- drivers/spi/spi-dw-mid.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/spi/spi-dw-mid.c +4 -2
@@ -108,7 +108,8 @@ static void dw_spi_dma_tx_done(void *arg) {struct dw_spi *dws = arg; -if (test_and_clear_bit (TX_BUSY , &dws->dma_chan_busy) &BIT (RX_BUSY )) +clear_bit (TX_BUSY , &dws->dma_chan_busy); +if (test_bit (RX_BUSY , &dws->dma_chan_busy))return ;dw_spi_xfer_done (dws); }
@@ -156,7 +157,8 @@ static void dw_spi_dma_rx_done(void *arg) {struct dw_spi *dws = arg; -if (test_and_clear_bit (RX_BUSY , &dws->dma_chan_busy) &BIT (TX_BUSY )) +clear_bit (RX_BUSY , &dws->dma_chan_busy); +if (test_bit (TX_BUSY , &dws->dma_chan_busy))return ;dw_spi_xfer_done (dws); }
Signature · 6 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1425645721-18142-1-git-send-email-andriy.shevchenko-VuQAYsv1563Yd54FQh9/[email protected]
Mark Brown
AppliedQuoted 3 lines · Andy Shevchenko
The logic of DMA completion is broken now since
test_and_clear_bit()never returns the other bit is set. It means condition are always false and we havespi_finalize_current_transfer()called per each DMA completion which is wrong.
Applied, thanks. I assume you're also going to resend the other bits if they're still valid?
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 7 lines · Mark Brown
Quoted 3 lines · Andy Shevchenko
The logic of DMA completion is broken now since
test_and_clear_bit()never returns the other bit is set. It means condition are always false and we havespi_finalize_current_transfer()called per each DMA completion which is wrong.Applied, thanks. I assume you're also going to resend the other bits if they're still valid?
Yes, they are.
I will do next working day (On Monday I think ).
Signature · 6 lines
With Best Regards, Andy Shevchenko -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html