1
0
Fork 0
forked from len0rd/rockbox

Sansa AMS: Check if SD controllers are already enabled before attempting to enable in order to read the registers.

If the controllers were already enabled there was a chance we could try to read the MCI_CLOCK registers while the cards were buffering and then disable the controllers prematurely.

I guess funman knows and sees all!!  Thanks funman.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23811 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jack Halpin 2009-12-01 21:23:11 +00:00
parent 5bd4ec0c87
commit c67ce499f3
2 changed files with 10 additions and 6 deletions

View file

@ -118,7 +118,7 @@ static const char sd_thread_name[] = "ata/sd";
static struct mutex sd_mtx;
static struct event_queue sd_queue;
#ifndef BOOTLOADER
static bool sd_enabled = false;
bool sd_enabled = false;
#endif
static struct wakeup transfer_completion_signal;

View file

@ -61,6 +61,7 @@
#define MCI_NAND *((volatile unsigned long *)(NAND_FLASH_BASE + 0x04))
#define MCI_SD *((volatile unsigned long *)(SD_MCI_BASE + 0x04))
extern bool sd_enabled;
/* FIXME: target tree is including ./debug-target.h rather than the one in
* sansa-fuze/, even though deps contains the correct one
@ -291,13 +292,16 @@ bool __dbg_hw_info(void)
lcd_putsf(0, line++, "I2SO: %s %3dMHz", (CGU_AUDIO & (1<<11)) ?
"on " : "off", calc_freq(CLK_I2SO)/1000000);
/* Enable SD cards to read the registers */
sd_enable(true);
last_nand = MCI_NAND;
/* 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;
last_sd = MCI_SD;
#endif
sd_enable(false);
sd_enable(false);
}
lcd_putsf(0, line++, "SD :%3dMHz %3dMHz",
((AS3525_PCLK_FREQ/ 1000000) /