summaryrefslogtreecommitdiff
path: root/firmware/target/arm/as3525/ata_sd_as3525.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/as3525/ata_sd_as3525.c')
-rw-r--r--firmware/target/arm/as3525/ata_sd_as3525.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/firmware/target/arm/as3525/ata_sd_as3525.c b/firmware/target/arm/as3525/ata_sd_as3525.c
index a6265b37f4..ac4a264172 100644
--- a/firmware/target/arm/as3525/ata_sd_as3525.c
+++ b/firmware/target/arm/as3525/ata_sd_as3525.c
@@ -38,6 +38,9 @@
38#include "pl081.h" /* DMA controller */ 38#include "pl081.h" /* DMA controller */
39#include "dma-target.h" /* DMA request lines */ 39#include "dma-target.h" /* DMA request lines */
40#include "clock-target.h" 40#include "clock-target.h"
41#ifdef HAVE_BUTTON_LIGHT
42#include "backlight-target.h"
43#endif
41#include "stdbool.h" 44#include "stdbool.h"
42#include "ata_idle_notify.h" 45#include "ata_idle_notify.h"
43#include "sd.h" 46#include "sd.h"
@@ -822,6 +825,11 @@ long sd_last_disk_activity(void)
822 825
823void sd_enable(bool on) 826void sd_enable(bool on)
824{ 827{
828 /* buttonlight AMSes need a bit of special handling for the buttonlight here,
829 * due to the dual mapping of GPIOD and XPD */
830#ifdef HAVE_BUTTON_LIGHT
831 extern int buttonlight_is_on;
832#endif
825 if (sd_enabled == on) 833 if (sd_enabled == on)
826 return; /* nothing to do */ 834 return; /* nothing to do */
827 if(on) 835 if(on)
@@ -829,10 +837,13 @@ void sd_enable(bool on)
829 CGU_PERI |= CGU_NAF_CLOCK_ENABLE; 837 CGU_PERI |= CGU_NAF_CLOCK_ENABLE;
830#ifdef HAVE_MULTIVOLUME 838#ifdef HAVE_MULTIVOLUME
831 CGU_PERI |= CGU_MCI_CLOCK_ENABLE; 839 CGU_PERI |= CGU_MCI_CLOCK_ENABLE;
832 /* Needed for buttonlight and MicroSD to work at the same time */ 840#ifdef HAVE_BUTTON_LIGHT
833 /* Turn ROD control on, as the OF does */
834 SD_MCI_POWER |= (1<<7);
835 CCU_IO |= (1<<2); 841 CCU_IO |= (1<<2);
842 if (buttonlight_is_on)
843 GPIOD_DIR &= ~(1<<7);
844 else
845 _buttonlight_off();
846#endif
836#endif 847#endif
837 CGU_IDE |= (1<<7) /* AHB interface enable */ | 848 CGU_IDE |= (1<<7) /* AHB interface enable */ |
838 (1<<6) /* interface enable */; 849 (1<<6) /* interface enable */;
@@ -842,11 +853,12 @@ void sd_enable(bool on)
842 { 853 {
843 CGU_PERI &= ~CGU_NAF_CLOCK_ENABLE; 854 CGU_PERI &= ~CGU_NAF_CLOCK_ENABLE;
844#ifdef HAVE_MULTIVOLUME 855#ifdef HAVE_MULTIVOLUME
845 CGU_PERI &= ~CGU_MCI_CLOCK_ENABLE; 856#ifdef HAVE_BUTTON_LIGHT
846 /* Needed for buttonlight and MicroSD to work at the same time */
847 /* Turn ROD control off, as the OF does */
848 SD_MCI_POWER &= ~(1<<7);
849 CCU_IO &= ~(1<<2); 857 CCU_IO &= ~(1<<2);
858 if (buttonlight_is_on)
859 _buttonlight_on();
860#endif
861 CGU_PERI &= ~CGU_MCI_CLOCK_ENABLE;
850#endif 862#endif
851 CGU_IDE &= ~((1<<7)|(1<<6)); 863 CGU_IDE &= ~((1<<7)|(1<<6));
852 sd_enabled = false; 864 sd_enabled = false;