summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMihail Zenkov <mihail.zenkov@gmail.com>2016-02-26 16:29:54 +0000
committerGerrit Rockbox <gerrit@rockbox.org>2016-03-18 21:13:36 +0100
commit219e116fdfa06fb496a8c049c709ced672df44c8 (patch)
tree666d6c0cd9aacdba65b18dc63fe89f24ab4378a5
parenta24abd2a4769b9217a584c46a0c23e26e1efe467 (diff)
downloadrockbox-219e116.tar.gz
rockbox-219e116.tar.bz2
rockbox-219e116.zip
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
-rw-r--r--firmware/target/arm/as3525/sd-as3525v2.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/firmware/target/arm/as3525/sd-as3525v2.c b/firmware/target/arm/as3525/sd-as3525v2.c
index abe9ceab5f..27664ec52b 100644
--- a/firmware/target/arm/as3525/sd-as3525v2.c
+++ b/firmware/target/arm/as3525/sd-as3525v2.c
@@ -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)