1
0
Fork 0
forked from len0rd/rockbox

sd-as3525v1: do not disable peripheral clocks in sd_enable()

(forward port of r26481 + cosmetics)
This lead to freezes under various conditons (bug report: FS#11267)

Battery life is almost not (if at all) affected:
- between 4 and 8 minutes less runtime for fuzev1
- 9 minutes less runtime for c200v2 (2 minutes difference on a 2 hours run)

Additional verifications of the runtime (including on other models) wouldn't hurt

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26512 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Rafaël Carré 2010-06-03 13:55:42 +00:00
parent 30804e5a3f
commit bf3e50b89b

View file

@ -876,15 +876,12 @@ void sd_enable(bool on)
if (sd_enabled == on) if (sd_enabled == on)
return; /* nothing to do */ return; /* nothing to do */
sd_enabled = on;
if(on) if(on)
{ {
/* Enable both NAF_CLOCK & IDE clk for internal SD */ #if defined(HAVE_BUTTON_LIGHT) && defined(HAVE_MULTIDRIVE)
CGU_PERI |= CGU_NAF_CLOCK_ENABLE;
CGU_IDE |= (1<<6); /* enable non AHB interface*/
#ifdef HAVE_MULTIDRIVE
/* Enable MCI clk for uSD */
CGU_PERI |= CGU_MCI_CLOCK_ENABLE;
#ifdef HAVE_BUTTON_LIGHT
/* buttonlight AMSes need a bit of special handling for the buttonlight /* buttonlight AMSes need a bit of special handling for the buttonlight
* here due to the dual mapping of GPIOD and XPD */ * here due to the dual mapping of GPIOD and XPD */
CCU_IO |= (1<<2); /* XPD is SD-MCI interface (b3:2 = 01) */ CCU_IO |= (1<<2); /* XPD is SD-MCI interface (b3:2 = 01) */
@ -892,9 +889,7 @@ void sd_enable(bool on)
GPIOD_DIR &= ~(1<<7); GPIOD_DIR &= ~(1<<7);
else else
_buttonlight_off(); _buttonlight_off();
#endif /* HAVE_BUTTON_LIGHT */ #endif
#endif /* HAVE_MULTIDRIVE */
sd_enabled = true;
#if defined(HAVE_HOTSWAP) && defined (HAVE_ADJUSTABLE_CPU_VOLTAGE) #if defined(HAVE_HOTSWAP) && defined (HAVE_ADJUSTABLE_CPU_VOLTAGE)
if(card_detect_target()) /* If SD card present Boost cpu for voltage */ if(card_detect_target()) /* If SD card present Boost cpu for voltage */
@ -914,21 +909,11 @@ void sd_enable(bool on)
} }
#endif /* defined(HAVE_HOTSWAP) && defined (HAVE_ADJUSTABLE_CPU_VOLTAGE) */ #endif /* defined(HAVE_HOTSWAP) && defined (HAVE_ADJUSTABLE_CPU_VOLTAGE) */
sd_enabled = false; #if defined(HAVE_BUTTON_LIGHT) && defined(HAVE_MULTIDRIVE)
#ifdef HAVE_MULTIDRIVE
#ifdef HAVE_BUTTON_LIGHT
CCU_IO &= ~(1<<2); /* XPD is general purpose IO (b3:2 = 00) */ CCU_IO &= ~(1<<2); /* XPD is general purpose IO (b3:2 = 00) */
if (buttonlight_is_on) if (buttonlight_is_on)
_buttonlight_on(); _buttonlight_on();
#endif /* HAVE_BUTTON_LIGHT */ #endif
/* Disable MCI clk for uSD */
CGU_PERI &= ~CGU_MCI_CLOCK_ENABLE;
#endif /* HAVE_MULTIDRIVE */
/* Disable both NAF_CLOCK & IDE clk for internal SD */
CGU_PERI &= ~CGU_NAF_CLOCK_ENABLE;
CGU_IDE &= ~(1<<6); /* disable non AHB interface*/
} }
} }