diff options
Diffstat (limited to 'firmware/target/arm/as3525/sd-as3525.c')
-rw-r--r-- | firmware/target/arm/as3525/sd-as3525.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/firmware/target/arm/as3525/sd-as3525.c b/firmware/target/arm/as3525/sd-as3525.c index d6c6654319..494a76a782 100644 --- a/firmware/target/arm/as3525/sd-as3525.c +++ b/firmware/target/arm/as3525/sd-as3525.c | |||
@@ -126,7 +126,6 @@ static long last_disk_activity = -1; | |||
126 | static long next_yield = 0; | 126 | static long next_yield = 0; |
127 | 127 | ||
128 | static struct mutex sd_mtx; | 128 | static struct mutex sd_mtx; |
129 | bool sd_enabled = false; | ||
130 | 129 | ||
131 | #if defined(HAVE_MULTIDRIVE) | 130 | #if defined(HAVE_MULTIDRIVE) |
132 | static bool hs_card = false; | 131 | static bool hs_card = false; |
@@ -154,6 +153,7 @@ static void enable_controller(bool on) | |||
154 | #if defined(HAVE_HOTSWAP) && defined (HAVE_ADJUSTABLE_CPU_VOLTAGE) | 153 | #if defined(HAVE_HOTSWAP) && defined (HAVE_ADJUSTABLE_CPU_VOLTAGE) |
155 | static bool cpu_boosted = false; | 154 | static bool cpu_boosted = false; |
156 | #endif | 155 | #endif |
156 | static bool sd_enabled = true; /* force action on first call in sd_init() */ | ||
157 | 157 | ||
158 | if (sd_enabled == on) | 158 | if (sd_enabled == on) |
159 | return; /* nothing to do */ | 159 | return; /* nothing to do */ |
@@ -540,9 +540,7 @@ int sd_init(void) | |||
540 | /* init mutex */ | 540 | /* init mutex */ |
541 | mutex_init(&sd_mtx); | 541 | mutex_init(&sd_mtx); |
542 | 542 | ||
543 | sd_enabled = true; /* force action on next call */ | ||
544 | enable_controller(false); | 543 | enable_controller(false); |
545 | |||
546 | return 0; | 544 | return 0; |
547 | } | 545 | } |
548 | 546 | ||
@@ -905,13 +903,6 @@ long sd_last_disk_activity(void) | |||
905 | return last_disk_activity; | 903 | return last_disk_activity; |
906 | } | 904 | } |
907 | 905 | ||
908 | void sd_enable(bool on) | ||
909 | { | ||
910 | mutex_lock(&sd_mtx); | ||
911 | enable_controller(on); | ||
912 | mutex_unlock(&sd_mtx); | ||
913 | } | ||
914 | |||
915 | tCardInfo *card_get_info_target(int card_no) | 906 | tCardInfo *card_get_info_target(int card_no) |
916 | { | 907 | { |
917 | return &card_info[card_no]; | 908 | return &card_info[card_no]; |
@@ -925,6 +916,21 @@ int sd_num_drives(int first_drive) | |||
925 | } | 916 | } |
926 | #endif /* CONFIG_STORAGE_MULTI */ | 917 | #endif /* CONFIG_STORAGE_MULTI */ |
927 | 918 | ||
919 | void ams_sd_get_debug_info(struct ams_sd_debug_info *info) | ||
920 | { | ||
921 | #define MCI_NAND *((volatile unsigned long *)(NAND_FLASH_BASE + 0x04)) | ||
922 | #define MCI_SD *((volatile unsigned long *)(SD_MCI_BASE + 0x04)) | ||
923 | |||
924 | mutex_lock(&sd_mtx); | ||
925 | enable_controller(true); /* must be on to read regs */ | ||
926 | info->mci_nand = MCI_NAND; | ||
927 | #ifdef HAVE_MULTIDRIVE | ||
928 | info->mci_sd = MCI_SD; | ||
929 | #endif | ||
930 | enable_controller(false); | ||
931 | mutex_unlock(&sd_mtx); | ||
932 | } | ||
933 | |||
928 | int sd_event(long id, intptr_t data) | 934 | int sd_event(long id, intptr_t data) |
929 | { | 935 | { |
930 | int rc = 0; | 936 | int rc = 0; |