summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/as3525/sd-as3525.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/firmware/target/arm/as3525/sd-as3525.c b/firmware/target/arm/as3525/sd-as3525.c
index 1f935a426e..ec6065630b 100644
--- a/firmware/target/arm/as3525/sd-as3525.c
+++ b/firmware/target/arm/as3525/sd-as3525.c
@@ -876,15 +876,12 @@ void sd_enable(bool on)
876 876
877 if (sd_enabled == on) 877 if (sd_enabled == on)
878 return; /* nothing to do */ 878 return; /* nothing to do */
879
880 sd_enabled = on;
881
879 if(on) 882 if(on)
880 { 883 {
881 /* Enable both NAF_CLOCK & IDE clk for internal SD */ 884#if defined(HAVE_BUTTON_LIGHT) && defined(HAVE_MULTIDRIVE)
882 CGU_PERI |= CGU_NAF_CLOCK_ENABLE;
883 CGU_IDE |= (1<<6); /* enable non AHB interface*/
884#ifdef HAVE_MULTIDRIVE
885 /* Enable MCI clk for uSD */
886 CGU_PERI |= CGU_MCI_CLOCK_ENABLE;
887#ifdef HAVE_BUTTON_LIGHT
888 /* buttonlight AMSes need a bit of special handling for the buttonlight 885 /* buttonlight AMSes need a bit of special handling for the buttonlight
889 * here due to the dual mapping of GPIOD and XPD */ 886 * here due to the dual mapping of GPIOD and XPD */
890 CCU_IO |= (1<<2); /* XPD is SD-MCI interface (b3:2 = 01) */ 887 CCU_IO |= (1<<2); /* XPD is SD-MCI interface (b3:2 = 01) */
@@ -892,9 +889,7 @@ void sd_enable(bool on)
892 GPIOD_DIR &= ~(1<<7); 889 GPIOD_DIR &= ~(1<<7);
893 else 890 else
894 _buttonlight_off(); 891 _buttonlight_off();
895#endif /* HAVE_BUTTON_LIGHT */ 892#endif
896#endif /* HAVE_MULTIDRIVE */
897 sd_enabled = true;
898 893
899#if defined(HAVE_HOTSWAP) && defined (HAVE_ADJUSTABLE_CPU_VOLTAGE) 894#if defined(HAVE_HOTSWAP) && defined (HAVE_ADJUSTABLE_CPU_VOLTAGE)
900 if(card_detect_target()) /* If SD card present Boost cpu for voltage */ 895 if(card_detect_target()) /* If SD card present Boost cpu for voltage */
@@ -914,21 +909,11 @@ void sd_enable(bool on)
914 } 909 }
915#endif /* defined(HAVE_HOTSWAP) && defined (HAVE_ADJUSTABLE_CPU_VOLTAGE) */ 910#endif /* defined(HAVE_HOTSWAP) && defined (HAVE_ADJUSTABLE_CPU_VOLTAGE) */
916 911
917 sd_enabled = false; 912#if defined(HAVE_BUTTON_LIGHT) && defined(HAVE_MULTIDRIVE)
918
919#ifdef HAVE_MULTIDRIVE
920#ifdef HAVE_BUTTON_LIGHT
921 CCU_IO &= ~(1<<2); /* XPD is general purpose IO (b3:2 = 00) */ 913 CCU_IO &= ~(1<<2); /* XPD is general purpose IO (b3:2 = 00) */
922 if (buttonlight_is_on) 914 if (buttonlight_is_on)
923 _buttonlight_on(); 915 _buttonlight_on();
924#endif /* HAVE_BUTTON_LIGHT */ 916#endif
925 /* Disable MCI clk for uSD */
926 CGU_PERI &= ~CGU_MCI_CLOCK_ENABLE;
927#endif /* HAVE_MULTIDRIVE */
928
929 /* Disable both NAF_CLOCK & IDE clk for internal SD */
930 CGU_PERI &= ~CGU_NAF_CLOCK_ENABLE;
931 CGU_IDE &= ~(1<<6); /* disable non AHB interface*/
932 } 917 }
933} 918}
934 919