sd-as3525v2: prevent DTO error and DMA problems

We should check sd_wait_for_tran_state() after transfering to prevent data
timeout error. Also we should disable DMA channel manually.

Should be used with g#1270, without it freezes still can occur on data
transfering.

Change-Id: If8c6e5547ab14d66237bccf65f83affc7a346e5e
This commit is contained in:
Mihail Zenkov 2016-02-26 16:29:54 +00:00 committed by Gerrit Rockbox
parent a24abd2a47
commit 219e116fdf

View file

@ -867,13 +867,6 @@ sd_transfer_retry_with_reinit:
MCI_BYTCNT = transfer * SD_BLOCK_SIZE;
ret = sd_wait_for_tran_state(drive);
if (ret < 0)
{
ret -= 25;
goto sd_transfer_error;
}
int arg = start;
if(!(card_info[drive].ocr & (1<<30))) /* not SDHC */
arg *= SD_BLOCK_SIZE;
@ -907,6 +900,18 @@ sd_transfer_retry_with_reinit:
goto sd_transfer_error;
}
ret = sd_wait_for_tran_state(drive);
if (ret < 0)
{
ret -= 25;
goto sd_transfer_error;
}
/* According to datasheet DMA channel should be automatically disabled
* when transfer completes. But it not true for DMA_PERI_SD.
* Disable DMA channel manually to prevent problems with DMA. */
dma_disable_channel(1);
if(!retry)
{
if(!write && !aligned)