summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/ata-sd-pp.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/firmware/target/arm/ata-sd-pp.c b/firmware/target/arm/ata-sd-pp.c
index 77d3c3dc31..f963e0ac48 100644
--- a/firmware/target/arm/ata-sd-pp.c
+++ b/firmware/target/arm/ata-sd-pp.c
@@ -180,6 +180,8 @@ static const char sd_thread_name[] = "ata/sd";
180static struct mutex sd_mtx SHAREDBSS_ATTR; 180static struct mutex sd_mtx SHAREDBSS_ATTR;
181static struct event_queue sd_queue; 181static struct event_queue sd_queue;
182 182
183static int sd_first_drive = 0;
184
183/* Posted when card plugged status has changed */ 185/* Posted when card plugged status has changed */
184#define SD_HOTSWAP 1 186#define SD_HOTSWAP 1
185/* Actions taken by sd_thread when card status has changed */ 187/* Actions taken by sd_thread when card status has changed */
@@ -1108,9 +1110,9 @@ static void sd_thread(void)
1108 1110
1109 /* We now have exclusive control of fat cache and ata */ 1111 /* We now have exclusive control of fat cache and ata */
1110 1112
1111 disk_unmount(1); /* release "by force", ensure file 1113 disk_unmount(sd_first_drive+1); /* release "by force", ensure file
1112 descriptors aren't leaked and any busy 1114 descriptors aren't leaked and any busy
1113 ones are invalid if mounting */ 1115 ones are invalid if mounting */
1114 1116
1115 /* Force card init for new card, re-init for re-inserted one or 1117 /* Force card init for new card, re-init for re-inserted one or
1116 * clear if the last attempt to init failed with an error. */ 1118 * clear if the last attempt to init failed with an error. */
@@ -1118,7 +1120,7 @@ static void sd_thread(void)
1118 sd_status[1].retry = 0; 1120 sd_status[1].retry = 0;
1119 1121
1120 if (ev.id == SYS_HOTSWAP_INSERTED) 1122 if (ev.id == SYS_HOTSWAP_INSERTED)
1121 disk_mount(1); 1123 disk_mount(sd_first_drive+1);
1122 1124
1123 queue_broadcast(SYS_FS_CHANGED, 0); 1125 queue_broadcast(SYS_FS_CHANGED, 0);
1124 1126
@@ -1350,8 +1352,8 @@ bool sd_present(IF_MD_NONVOID(int drive))
1350#ifdef CONFIG_STORAGE_MULTI 1352#ifdef CONFIG_STORAGE_MULTI
1351int sd_num_drives(int first_drive) 1353int sd_num_drives(int first_drive)
1352{ 1354{
1353 /* We don't care which logical drive number(s) we have been assigned */ 1355 /* Store which logical drive number(s) we have been assigned */
1354 (void)first_drive; 1356 sd_first_drive = first_drive;
1355 1357
1356#ifdef HAVE_MULTIDRIVE 1358#ifdef HAVE_MULTIDRIVE
1357 return 2; 1359 return 2;