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
41
42
43
44
Index: firmware/target/arm/as3525/ata_sd_as3525.c
===================================================================
--- firmware/target/arm/as3525/ata_sd_as3525.c	(revision 22090)
+++ firmware/target/arm/as3525/ata_sd_as3525.c	(working copy)
@@ -295,6 +295,9 @@
                 &card_info[drive].rca))
         return -6;

+    /* Quit Open Drain Mode & Change bus to pushpull*/
+    MCI_POWER(drive) &= ~MCI_POWER_OPEN_DRAIN;
+
     /* send CSD */
     if(!send_cmd(drive, SD_SEND_CSD, card_info[drive].rca,
                  MCI_RESP|MCI_LONG_RESP|MCI_ARG, temp_reg))
@@ -308,12 +311,25 @@
     if(!send_cmd(drive, SD_SELECT_CARD, card_info[drive].rca, MCI_ARG, NULL))
         return -9;

-    if(!send_cmd(drive, SD_APP_CMD, card_info[drive].rca, MCI_ARG, NULL))
-        return -10;
+    /*  Check card for HS capable and if so switch to HS  */
+    if(card_info[drive].speed >= 125000)
+    {
+//        ret = sd_wait_for_state(INTERNAL_AS3525, SD_TRAN);
+//        if (ret < 0)
+//            return -99;

-    if(!send_cmd(drive, SD_SET_BUS_WIDTH, card_info[drive].rca | 2, MCI_ARG, NULL))
-        return -11;
+        if(!send_cmd(drive, SD_SWITCH_FUNC, 0x80fffff1, MCI_ARG, NULL))
+            return -91;

+    }
+    
+    
+//    if(!send_cmd(drive, SD_APP_CMD, card_info[drive].rca, MCI_ARG, NULL))
+//        return -10;
+
+//    if(!send_cmd(drive, SD_SET_BUS_WIDTH, card_info[drive].rca | 2, MCI_ARG, NULL))
+//        return -11;
+
     if(!send_cmd(drive, SD_SET_BLOCKLEN, card_info[drive].blocksize, MCI_ARG,
                  NULL))
         return -12;