Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.

My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
diff --git a/firmware/target/arm/as3525/sd-as3525v2.c b/firmware/target/arm/as3525/sd-as3525v2.c
index d42f7b4..e3c59b4 100644
--- a/firmware/target/arm/as3525/sd-as3525v2.c
+++ b/firmware/target/arm/as3525/sd-as3525v2.c
@@ -824,9 +824,6 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start,
         if(!(card_info[drive].ocr & (1<<30))) /* not SDHC */
             arg *= SD_BLOCK_SIZE;

-        if(!send_cmd(drive, cmd, arg, MCI_NO_RESP, NULL))
-            panicf("%s multiple blocks failed", write ? "write" : "read");
-
         if(write)
             dma_enable_channel(0, dma_buf, MCI_FIFO, DMA_PERI_SD,
                 DMAC_FLOWCTRL_PERI_MEM_TO_PERI, true, false, 0, DMA_S8, NULL);
@@ -834,6 +831,10 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start,
             dma_enable_channel(0, MCI_FIFO, dma_buf, DMA_PERI_SD,
                 DMAC_FLOWCTRL_PERI_PERI_TO_MEM, false, true, 0, DMA_S8, NULL);

+        unsigned long dummy;
+        if(!send_cmd(drive, cmd, arg, MCI_RESP, &dummy))
+            panicf("%s multiple blocks failed", write ? "write" : "read");
+
         wakeup_wait(&transfer_completion_signal, TIMEOUT_BLOCK);

         MCI_MASK &= ~(MCI_DATA_ERROR | MCI_INT_DTO);
@@ -904,14 +905,7 @@ int sd_write_sectors(IF_MD2(int drive,) unsigned long start, int count,
     (void) buf;
     return -1;
 #else
-    //return sd_transfer_sectors(IF_MD2(drive,) start, count, (void*)buf, true);
-#ifdef HAVE_MULTIDRIVE
-    (void)drive;
-#endif
-    (void)start;
-    (void)count;
-    (void)buf;
-    return -1; /* not working, seems to cause FIFO overruns */
+    return sd_transfer_sectors(IF_MD2(drive,) start, count, (void*)buf, true);
 #endif /* defined(BOOTLOADER) */
 }