From c67ce499f362ba1e421652f8c01745610817160f Mon Sep 17 00:00:00 2001 From: Jack Halpin Date: Tue, 1 Dec 2009 21:23:11 +0000 Subject: 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 --- firmware/target/arm/as3525/ata_sd_as3525.c | 2 +- firmware/target/arm/as3525/debug-as3525.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'firmware/target') diff --git a/firmware/target/arm/as3525/ata_sd_as3525.c b/firmware/target/arm/as3525/ata_sd_as3525.c index bbf47a0960..c792946044 100644 --- a/firmware/target/arm/as3525/ata_sd_as3525.c +++ b/firmware/target/arm/as3525/ata_sd_as3525.c @@ -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; diff --git a/firmware/target/arm/as3525/debug-as3525.c b/firmware/target/arm/as3525/debug-as3525.c index 0ed51e5898..2606f68e82 100644 --- a/firmware/target/arm/as3525/debug-as3525.c +++ b/firmware/target/arm/as3525/debug-as3525.c @@ -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) / -- cgit v1.2.3