summaryrefslogtreecommitdiff
path: root/firmware/target/arm/as3525/sd-as3525v2.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/as3525/sd-as3525v2.c')
-rw-r--r--firmware/target/arm/as3525/sd-as3525v2.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/firmware/target/arm/as3525/sd-as3525v2.c b/firmware/target/arm/as3525/sd-as3525v2.c
index 7410b19550..74925a3aab 100644
--- a/firmware/target/arm/as3525/sd-as3525v2.c
+++ b/firmware/target/arm/as3525/sd-as3525v2.c
@@ -376,11 +376,8 @@ static inline bool card_detect_target(void)
376#if defined(HAVE_MULTIDRIVE) 376#if defined(HAVE_MULTIDRIVE)
377#if defined(SANSA_FUZEV2) 377#if defined(SANSA_FUZEV2)
378 return GPIOA_PIN(2); 378 return GPIOA_PIN(2);
379#elif defined(SANSA_CLIPPLUS) 379#elif defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP)
380 return !(GPIOA_PIN(2)); 380 return !(GPIOA_PIN(2));
381#elif defined(SANSA_CLIPZIP)
382 /* TODO for ClipZip: determine polarity of uSD detect */
383 return false;
384#else 381#else
385#error "microSD pin not defined for your target" 382#error "microSD pin not defined for your target"
386#endif 383#endif
@@ -398,14 +395,14 @@ static bool send_cmd(const int drive, const int cmd, const int arg, const int fl
398 !send_cmd(drive, SD_APP_CMD, card_info[drive].rca, MCI_RESP, response)) 395 !send_cmd(drive, SD_APP_CMD, card_info[drive].rca, MCI_RESP, response))
399 return false; 396 return false;
400 397
401#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) 398#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP)
402 if (amsv2_variant == 1) 399 if (amsv2_variant == 1)
403 GPIOB_PIN(5) = (drive == INTERNAL_AS3525) ? 1 << 5 : 0; 400 GPIOB_PIN(5) = (drive == INTERNAL_AS3525) ? 1 << 5 : 0;
404#endif 401#endif
405 402
406 MCI_ARGUMENT = arg; 403 MCI_ARGUMENT = arg;
407 404
408#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) 405#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP)
409 if (amsv2_variant == 1) 406 if (amsv2_variant == 1)
410 card_no = 1 << 16; 407 card_no = 1 << 16;
411 else 408 else
@@ -565,7 +562,7 @@ static int sd_init_card(const int drive)
565 return -17; 562 return -17;
566 563
567 /* Now that card is widebus make controller aware */ 564 /* Now that card is widebus make controller aware */
568#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) 565#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP)
569 if (amsv2_variant == 1) 566 if (amsv2_variant == 1)
570 MCI_CTYPE |= 1<<1; 567 MCI_CTYPE |= 1<<1;
571 else 568 else
@@ -575,7 +572,7 @@ static int sd_init_card(const int drive)
575#endif /* ! BOOTLOADER */ 572#endif /* ! BOOTLOADER */
576 573
577 /* Set low power mode */ 574 /* Set low power mode */
578#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) 575#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP)
579 if (amsv2_variant == 1) 576 if (amsv2_variant == 1)
580 MCI_CLKENA |= 1<<(1 + 16); 577 MCI_CLKENA |= 1<<(1 + 16);
581 else 578 else
@@ -673,7 +670,7 @@ static void init_controller(void)
673 int card_mask = (1 << hcon_numcards) - 1; 670 int card_mask = (1 << hcon_numcards) - 1;
674 int pwr_mask; 671 int pwr_mask;
675 672
676#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) 673#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP)
677 if (amsv2_variant == 1) 674 if (amsv2_variant == 1)
678 pwr_mask = 1 << 1; 675 pwr_mask = 1 << 1;
679 else 676 else
@@ -738,7 +735,7 @@ int sd_init(void)
738 semaphore_init(&transfer_completion_signal, 1, 0); 735 semaphore_init(&transfer_completion_signal, 1, 0);
739 semaphore_init(&command_completion_signal, 1, 0); 736 semaphore_init(&command_completion_signal, 1, 0);
740 737
741#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) 738#if defined(SANSA_FUZEV2) || defined(SANSA_CLIPPLUS) || defined(SANSA_CLIPZIP)
742 if (amsv2_variant == 1) 739 if (amsv2_variant == 1)
743 GPIOB_DIR |= 1 << 5; 740 GPIOB_DIR |= 1 << 5;
744#endif 741#endif