summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/as3525/sd-as3525.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2017-10-30 16:29:51 -0400
committerWilliam Wilgus <me.theuser@yahoo.com>2018-07-04 15:20:47 +0200
commit19b2964d78b2ad6624a0e7cddd0ac6a49082cca4 (patch)
tree54f00fe62f23ca6fc387b6f8702cf6737f795032 /firmware/target/arm/as3525/sd-as3525.c
parentab1b67f37b4d415ba096aed3bc5d9700e0a7923f (diff)
downloadrockbox-19b2964d78b2ad6624a0e7cddd0ac6a49082cca4.tar.gz
rockbox-19b2964d78b2ad6624a0e7cddd0ac6a49082cca4.zip
AMS v1/v2: Remove sd_enabled as an externally-visible variable.
Also removes the sd_enable() function call. It was only used in the debug screen on AMSv1 and not used at all on AMS v2. For v1,obtain debug info in a struture passed to a dedicated debug info function so that enabling and disabling the controller isn't racy. Change-Id: I7c44693bc2df5a1f16168b05b3abfe622f9584ce
Diffstat (limited to 'firmware/target/arm/as3525/sd-as3525.c')
-rw-r--r--firmware/target/arm/as3525/sd-as3525.c26
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;
static long next_yield = 0;
static struct mutex sd_mtx;
-bool sd_enabled = false;
#if defined(HAVE_MULTIDRIVE)
static bool hs_card = false;
@@ -154,6 +153,7 @@ static void enable_controller(bool on)
#if defined(HAVE_HOTSWAP) && defined (HAVE_ADJUSTABLE_CPU_VOLTAGE)
static bool cpu_boosted = false;
#endif
+ static bool sd_enabled = true; /* force action on first call in sd_init() */
if (sd_enabled == on)
return; /* nothing to do */
@@ -540,9 +540,7 @@ int sd_init(void)
/* init mutex */
mutex_init(&sd_mtx);
- sd_enabled = true; /* force action on next call */
enable_controller(false);
-
return 0;
}
@@ -905,13 +903,6 @@ long sd_last_disk_activity(void)
return last_disk_activity;
}
-void sd_enable(bool on)
-{
- mutex_lock(&sd_mtx);
- enable_controller(on);
- mutex_unlock(&sd_mtx);
-}
-
tCardInfo *card_get_info_target(int card_no)
{
return &card_info[card_no];
@@ -925,6 +916,21 @@ int sd_num_drives(int first_drive)
}
#endif /* CONFIG_STORAGE_MULTI */
+void ams_sd_get_debug_info(struct ams_sd_debug_info *info)
+{
+ #define MCI_NAND *((volatile unsigned long *)(NAND_FLASH_BASE + 0x04))
+ #define MCI_SD *((volatile unsigned long *)(SD_MCI_BASE + 0x04))
+
+ mutex_lock(&sd_mtx);
+ enable_controller(true); /* must be on to read regs */
+ info->mci_nand = MCI_NAND;
+#ifdef HAVE_MULTIDRIVE
+ info->mci_sd = MCI_SD;
+#endif
+ enable_controller(false);
+ mutex_unlock(&sd_mtx);
+}
+
int sd_event(long id, intptr_t data)
{
int rc = 0;