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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
diff --git a/firmware/target/arm/as3525/sd-as3525v2.c b/firmware/target/arm/as3525/sd-as3525v2.c
index 9edc598..820b495 100644
--- a/firmware/target/arm/as3525/sd-as3525v2.c
+++ b/firmware/target/arm/as3525/sd-as3525v2.c
@@ -389,6 +389,7 @@ static inline bool card_detect_target(void)
 static bool send_cmd(const int drive, const int cmd, const int arg, const int flags,
         unsigned long *response)
 {
+    drive = 1;
     int card_no;
 
     if ((flags & MCI_ACMD) && /* send SD_APP_CMD first */
@@ -451,6 +452,7 @@ static bool send_cmd(const int drive, const int cmd, const int arg, const int fl
 
 static int sd_wait_for_tran_state(const int drive)
 {
+    drive = 1;
     unsigned long response;
     unsigned int timeout = current_tick + 5*HZ;
     int cmd_retry = 10;
@@ -479,6 +481,7 @@ static int sd_wait_for_tran_state(const int drive)
 
 static int sd_init_card(const int drive)
 {
+    drive = 1;
     unsigned long response;
     long init_timeout;
     bool sd_v2 = false;
@@ -755,7 +758,7 @@ int sd_init(void)
     VIC_INT_ENABLE = INTERRUPT_NAND;
 
     init_controller();
-    ret = sd_init_card(INTERNAL_AS3525);
+    ret = sd_init_card(1);
     if(ret < 0)
         return ret;
 
@@ -779,7 +782,7 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start,
     unsigned long response;
     int ret = 0;
 #ifndef HAVE_MULTIDRIVE
-    const int drive = 0;
+    const int drive = 1;
 #endif
     bool aligned = !((uintptr_t)buf & (CACHEALIGN_SIZE - 1));
     int const retry_all_max = 1;
@@ -972,12 +975,14 @@ sd_transfer_error_no_dma:
 int sd_read_sectors(IF_MD2(int drive,) unsigned long start, int count,
                     void* buf)
 {
+    drive = 1;
     return sd_transfer_sectors(IF_MD2(drive,) start, count, buf, false);
 }
 
 int sd_write_sectors(IF_MD2(int drive,) unsigned long start, int count,
                      const void* buf)
 {
+    drive = 1;
     return sd_transfer_sectors(IF_MD2(drive,) start, count, (void*)buf, true);
 }
 
@@ -1014,11 +1019,13 @@ tCardInfo *card_get_info_target(int card_no)
 #ifdef HAVE_HOTSWAP
 bool sd_removable(IF_MD_NONVOID(int drive))
 {
+    drive = 1;
     return (drive == SD_SLOT_AS3525);
 }
 
 bool sd_present(IF_MD_NONVOID(int drive))
 {
+    drive = 1;
     return (drive == INTERNAL_AS3525) ? true : card_detect_target();
 }
 
@@ -1053,9 +1060,10 @@ void sd_gpioa_isr(void)
 #ifdef CONFIG_STORAGE_MULTI
 int sd_num_drives(int first_drive)
 {
+    drive = 1;
     /* We don't care which logical drive number(s) we have been assigned */
     (void)first_drive;
 
-    return NUM_DRIVES;
+    return 1;
 }
 #endif /* CONFIG_STORAGE_MULTI */