mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
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
This commit is contained in:
parent
ab1b67f37b
commit
19b2964d78
4 changed files with 29 additions and 42 deletions
|
|
@ -62,8 +62,6 @@
|
||||||
#define MCI_NAND *((volatile unsigned long *)(NAND_FLASH_BASE + 0x04))
|
#define MCI_NAND *((volatile unsigned long *)(NAND_FLASH_BASE + 0x04))
|
||||||
#define MCI_SD *((volatile unsigned long *)(SD_MCI_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)
|
#if defined(SANSA_FUZE) || defined(SANSA_E200V2) || defined(SANSA_C200V2)
|
||||||
#define DEBUG_DBOP
|
#define DEBUG_DBOP
|
||||||
#include "dbop-as3525.h"
|
#include "dbop-as3525.h"
|
||||||
|
|
@ -253,13 +251,6 @@ static int calc_freq(int clk)
|
||||||
bool dbg_hw_info(void)
|
bool dbg_hw_info(void)
|
||||||
{
|
{
|
||||||
int line;
|
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_clear_display();
|
||||||
lcd_setfont(FONT_SYSFIXED);
|
lcd_setfont(FONT_SYSFIXED);
|
||||||
|
|
||||||
|
|
@ -334,25 +325,17 @@ bool dbg_hw_info(void)
|
||||||
lcd_putsf(0, line++, "I2SO: %s %3dMHz", (CGU_AUDIO & (1<<11)) ?
|
lcd_putsf(0, line++, "I2SO: %s %3dMHz", (CGU_AUDIO & (1<<11)) ?
|
||||||
"on " : "off", calc_freq(CLK_I2SO)/1000000);
|
"on " : "off", calc_freq(CLK_I2SO)/1000000);
|
||||||
#if CONFIG_CPU == AS3525
|
#if CONFIG_CPU == AS3525
|
||||||
/* If disabled, enable SD cards so we can read the registers */
|
struct ams_sd_debug_info dbg;
|
||||||
if(sd_enabled == false)
|
ams_sd_get_debug_info(&dbg);
|
||||||
{
|
|
||||||
sd_enable(true);
|
|
||||||
last_nand = MCI_NAND;
|
|
||||||
#ifdef HAVE_MULTIDRIVE
|
|
||||||
last_sd = MCI_SD;
|
|
||||||
#endif
|
|
||||||
sd_enable(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
lcd_putsf(0, line++, "SD :%3dMHz %3dMHz",
|
lcd_putsf(0, line++, "SD :%3dMHz %3dMHz",
|
||||||
((AS3525_IDE_FREQ/ 1000000) /
|
((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);
|
calc_freq(CLK_SD_MCLK_NAND)/1000000);
|
||||||
#ifdef HAVE_MULTIDRIVE
|
#ifdef HAVE_MULTIDRIVE
|
||||||
lcd_putsf(0, line++, "uSD :%3dMHz %3dMHz",
|
lcd_putsf(0, line++, "uSD :%3dMHz %3dMHz",
|
||||||
((AS3525_PCLK_FREQ/ 1000000) /
|
((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);
|
calc_freq(CLK_SD_MCLK_MSD)/1000000);
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_CPU == AS3525 */
|
#endif /* CONFIG_CPU == AS3525 */
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,6 @@ static long last_disk_activity = -1;
|
||||||
static long next_yield = 0;
|
static long next_yield = 0;
|
||||||
|
|
||||||
static struct mutex sd_mtx;
|
static struct mutex sd_mtx;
|
||||||
bool sd_enabled = false;
|
|
||||||
|
|
||||||
#if defined(HAVE_MULTIDRIVE)
|
#if defined(HAVE_MULTIDRIVE)
|
||||||
static bool hs_card = false;
|
static bool hs_card = false;
|
||||||
|
|
@ -154,6 +153,7 @@ static void enable_controller(bool on)
|
||||||
#if defined(HAVE_HOTSWAP) && defined (HAVE_ADJUSTABLE_CPU_VOLTAGE)
|
#if defined(HAVE_HOTSWAP) && defined (HAVE_ADJUSTABLE_CPU_VOLTAGE)
|
||||||
static bool cpu_boosted = false;
|
static bool cpu_boosted = false;
|
||||||
#endif
|
#endif
|
||||||
|
static bool sd_enabled = true; /* force action on first call in sd_init() */
|
||||||
|
|
||||||
if (sd_enabled == on)
|
if (sd_enabled == on)
|
||||||
return; /* nothing to do */
|
return; /* nothing to do */
|
||||||
|
|
@ -540,9 +540,7 @@ int sd_init(void)
|
||||||
/* init mutex */
|
/* init mutex */
|
||||||
mutex_init(&sd_mtx);
|
mutex_init(&sd_mtx);
|
||||||
|
|
||||||
sd_enabled = true; /* force action on next call */
|
|
||||||
enable_controller(false);
|
enable_controller(false);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -905,13 +903,6 @@ long sd_last_disk_activity(void)
|
||||||
return last_disk_activity;
|
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)
|
tCardInfo *card_get_info_target(int card_no)
|
||||||
{
|
{
|
||||||
return &card_info[card_no];
|
return &card_info[card_no];
|
||||||
|
|
@ -925,6 +916,21 @@ int sd_num_drives(int first_drive)
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_STORAGE_MULTI */
|
#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 sd_event(long id, intptr_t data)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
|
||||||
|
|
@ -323,9 +323,6 @@ static int sd_first_drive = 0;
|
||||||
/* for compatibility */
|
/* for compatibility */
|
||||||
static long last_disk_activity = -1;
|
static long last_disk_activity = -1;
|
||||||
static struct mutex sd_mtx SHAREDBSS_ATTR;
|
static struct mutex sd_mtx SHAREDBSS_ATTR;
|
||||||
#ifndef BOOTLOADER
|
|
||||||
bool sd_enabled = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static struct semaphore transfer_completion_signal;
|
static struct semaphore transfer_completion_signal;
|
||||||
static struct semaphore command_completion_signal;
|
static struct semaphore command_completion_signal;
|
||||||
|
|
@ -675,7 +672,6 @@ int sd_init(void)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
#ifndef BOOTLOADER
|
#ifndef BOOTLOADER
|
||||||
sd_enabled = true;
|
|
||||||
enable_controller(false);
|
enable_controller(false);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -879,13 +875,6 @@ long sd_last_disk_activity(void)
|
||||||
{
|
{
|
||||||
return last_disk_activity;
|
return last_disk_activity;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sd_enable(bool on)
|
|
||||||
{
|
|
||||||
mutex_lock(&sd_mtx);
|
|
||||||
enable_controller(on);
|
|
||||||
mutex_unlock(&sd_mtx);
|
|
||||||
}
|
|
||||||
#endif /* BOOTLOADER */
|
#endif /* BOOTLOADER */
|
||||||
|
|
||||||
tCardInfo *card_get_info_target(int card_no)
|
tCardInfo *card_get_info_target(int card_no)
|
||||||
|
|
|
||||||
|
|
@ -89,4 +89,13 @@ static inline void cpu_boost_unlock(void)
|
||||||
}
|
}
|
||||||
#endif /* HAVE_ADJUSTABLE_CPU_FREQ */
|
#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 */
|
#endif /* SYSTEM_TARGET_H */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue