diff options
author | Mihail Zenkov <mihail.zenkov@gmail.com> | 2016-02-26 16:29:54 +0000 |
---|---|---|
committer | Gerrit Rockbox <gerrit@rockbox.org> | 2016-03-18 21:13:36 +0100 |
commit | 219e116fdfa06fb496a8c049c709ced672df44c8 (patch) | |
tree | 666d6c0cd9aacdba65b18dc63fe89f24ab4378a5 /firmware/target/arm | |
parent | a24abd2a4769b9217a584c46a0c23e26e1efe467 (diff) | |
download | rockbox-219e116fdfa06fb496a8c049c709ced672df44c8.tar.gz rockbox-219e116fdfa06fb496a8c049c709ced672df44c8.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
Diffstat (limited to 'firmware/target/arm')
-rw-r--r-- | firmware/target/arm/as3525/sd-as3525v2.c | 19 |
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: | |||
867 | 867 | ||
868 | MCI_BYTCNT = transfer * SD_BLOCK_SIZE; | 868 | MCI_BYTCNT = transfer * SD_BLOCK_SIZE; |
869 | 869 | ||
870 | ret = sd_wait_for_tran_state(drive); | ||
871 | if (ret < 0) | ||
872 | { | ||
873 | ret -= 25; | ||
874 | goto sd_transfer_error; | ||
875 | } | ||
876 | |||
877 | int arg = start; | 870 | int arg = start; |
878 | if(!(card_info[drive].ocr & (1<<30))) /* not SDHC */ | 871 | if(!(card_info[drive].ocr & (1<<30))) /* not SDHC */ |
879 | arg *= SD_BLOCK_SIZE; | 872 | arg *= SD_BLOCK_SIZE; |
@@ -907,6 +900,18 @@ sd_transfer_retry_with_reinit: | |||
907 | goto sd_transfer_error; | 900 | goto sd_transfer_error; |
908 | } | 901 | } |
909 | 902 | ||
903 | ret = sd_wait_for_tran_state(drive); | ||
904 | if (ret < 0) | ||
905 | { | ||
906 | ret -= 25; | ||
907 | goto sd_transfer_error; | ||
908 | } | ||
909 | |||
910 | /* According to datasheet DMA channel should be automatically disabled | ||
911 | * when transfer completes. But it not true for DMA_PERI_SD. | ||
912 | * Disable DMA channel manually to prevent problems with DMA. */ | ||
913 | dma_disable_channel(1); | ||
914 | |||
910 | if(!retry) | 915 | if(!retry) |
911 | { | 916 | { |
912 | if(!write && !aligned) | 917 | if(!write && !aligned) |