diff options
-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) |