Skip to contentSkip to conversation

mmc: dw_mmc: Fix switch from DMA to PIO

PATCH In review Seungwon Jeon 3 participants 3 messages Apr 10, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: dw_mmc: Fix switch from DMA to PIO

When dw_mci_pre_dma_transfer returns failure in some reasons, dw_mci_submit_data will prepare to switch the PIO mode from DMA. After switching to PIO mode, DMA(IDMAC in particular) is still enabled. This makes the corruption in handling interrupt and the driver lock-up.

---
 drivers/mmc/host/dw_mmc.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/mmc/host/dw_mmc.c +3 -1
index bf3c9b4..f3b0fcd 100644
@@ -526,8 +526,10 @@ static int dw_mci_submit_data_dma(struct dw_mci *host, struct mmc_data *data)
 		return -ENODEV;
 
 	sg_len = dw_mci_pre_dma_transfer(host, data, 0);
-	if (sg_len < 0)
+	if (sg_len < 0) {
+		host->dma_ops->stop(host);
 		return sg_len;
+	}
 
 	host->using_dma = 1;
 
Signature · 1 line
1.7.0.4
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Seungwon Jeon

When dw_mci_pre_dma_transfer returns failure in some reasons, dw_mci_submit_data will prepare to switch the PIO mode from DMA. After switching to PIO mode, DMA(IDMAC in particular) is still enabled. This makes the corruption in handling interrupt and the driver lock-up.

This looks ok to me.

#2 lore raw

Hi,

Quoted 7 lines · Will Newton
Quoted 6 lines · Seungwon Jeon

When dw_mci_pre_dma_transfer returns failure in some reasons, dw_mci_submit_data will prepare to switch the PIO mode from DMA. After switching to PIO mode, DMA(IDMAC in particular) is still enabled. This makes the corruption in handling interrupt and the driver lock-up.

Quoted 5 lines
Quoted 1 line

This looks ok to me.

Thanks, pushed to mmc-next for 3.4.

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child