summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm
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
parentab1b67f37b4d415ba096aed3bc5d9700e0a7923f (diff)
downloadrockbox-19b2964d78b2ad6624a0e7cddd0ac6a49082cca4.tar.gz
rockbox-19b2964d78b2ad6624a0e7cddd0ac6a49082cca4.tar.bz2
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')
-rw-r--r--firmware/target/arm/as3525/debug-as3525.c25
-rw-r--r--firmware/target/arm/as3525/sd-as3525.c26
-rw-r--r--firmware/target/arm/as3525/sd-as3525v2.c11
-rw-r--r--firmware/target/arm/as3525/system-target.h9
4 files changed, 29 insertions, 42 deletions
diff --git a/firmware/target/arm/as3525/debug-as3525.c b/firmware/target/arm/as3525/debug-as3525.c
index a1e69834dd..24cee12cf4 100644
--- a/firmware/target/arm/as3525/debug-as3525.c
+++ b/firmware/target/arm/as3525/debug-as3525.c
@@ -62,8 +62,6 @@
#define MCI_NAND *((volatile unsigned long *)(NAND_FLASH_BASE + 0x04))
#define MCI_SD *((volatile unsigned long *)(SD_MCI_BASE + 0x04))
-extern bool sd_enabled;
-
#if defined(SANSA_FUZE) || defined(SANSA_E200V2) || defined(SANSA_C200V2)
#define DEBUG_DBOP
#include "dbop-as3525.h"
@@ -253,13 +251,6 @@ static int calc_freq(int clk)
bool dbg_hw_info(void)
{
int line;
-#if CONFIG_CPU == AS3525
- int last_nand = 0;
-#ifdef HAVE_MULTIDRIVE
- int last_sd = 0;
-#endif
-#endif /* CONFIG_CPU == AS3525 */
-
lcd_clear_display();
lcd_setfont(FONT_SYSFIXED);
@@ -334,25 +325,17 @@ bool dbg_hw_info(void)
lcd_putsf(0, line++, "I2SO: %s %3dMHz", (CGU_AUDIO & (1<<11)) ?
"on " : "off", calc_freq(CLK_I2SO)/1000000);
#if CONFIG_CPU == AS3525
- /* If disabled, enable SD cards so we can read the registers */
- if(sd_enabled == false)
- {
- sd_enable(true);
- last_nand = MCI_NAND;
-#ifdef HAVE_MULTIDRIVE
- last_sd = MCI_SD;
-#endif
- sd_enable(false);
- }
+ struct ams_sd_debug_info dbg;
+ ams_sd_get_debug_info(&dbg);
lcd_putsf(0, line++, "SD :%3dMHz %3dMHz",
((AS3525_IDE_FREQ/ 1000000) /
- ((last_nand & MCI_CLOCK_BYPASS)? 1:(((last_nand & 0xff)+1) * 2))),
+ ((dbg.mci_nand & MCI_CLOCK_BYPASS)? 1:(((dbg.mci_nand & 0xff)+1) * 2))),
calc_freq(CLK_SD_MCLK_NAND)/1000000);
#ifdef HAVE_MULTIDRIVE
lcd_putsf(0, line++, "uSD :%3dMHz %3dMHz",
((AS3525_PCLK_FREQ/ 1000000) /
- ((last_sd & MCI_CLOCK_BYPASS) ? 1: (((last_sd & 0xff) + 1) * 2))),
+ ((dbg.mci_sd & MCI_CLOCK_BYPASS) ? 1: (((dbg.mci_sd & 0xff) + 1) * 2))),
calc_freq(CLK_SD_MCLK_MSD)/1000000);
#endif
#endif /* CONFIG_CPU == AS3525 */
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;
diff --git a/firmware/target/arm/as3525/sd-as3525v2.c b/firmware/target/arm/as3525/sd-as3525v2.c
index f78345577c..b512cc2ea4 100644
--- a/firmware/target/arm/as3525/sd-as3525v2.c
+++ b/firmware/target/arm/as3525/sd-as3525v2.c
@@ -323,9 +323,6 @@ static int sd_first_drive = 0;
/* for compatibility */
static long last_disk_activity = -1;
static struct mutex sd_mtx SHAREDBSS_ATTR;
-#ifndef BOOTLOADER
-bool sd_enabled = false;
-#endif
static struct semaphore transfer_completion_signal;
static struct semaphore command_completion_signal;
@@ -675,7 +672,6 @@ int sd_init(void)
return ret;
#ifndef BOOTLOADER
- sd_enabled = true;
enable_controller(false);
#endif
return 0;
@@ -879,13 +875,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);
-}
#endif /* BOOTLOADER */
tCardInfo *card_get_info_target(int card_no)
diff --git a/firmware/target/arm/as3525/system-target.h b/firmware/target/arm/as3525/system-target.h
index 4fbbb46d5d..aca30e52e1 100644
--- a/firmware/target/arm/as3525/system-target.h
+++ b/firmware/target/arm/as3525/system-target.h
@@ -89,4 +89,13 @@ static inline void cpu_boost_unlock(void)
}
#endif /* HAVE_ADJUSTABLE_CPU_FREQ */
+struct ams_sd_debug_info
+{
+ unsigned long mci_nand;
+ unsigned long mci_sd;
+};
+
+void ams_sd_get_debug_info(struct ams_sd_debug_info *info);
+
+
#endif /* SYSTEM_TARGET_H */