summaryrefslogtreecommitdiff
path: root/firmware/target/arm/as3525/sd-as3525.c
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2010-06-03 13:55:42 +0000
committerRafaël Carré <rafael.carre@gmail.com>2010-06-03 13:55:42 +0000
commitbf3e50b89bccab5c64f23c1e54d3bbeb0994f7b2 (patch)
treefac6d046ef94da7894cce213a62e2de080f2f4c3 /firmware/target/arm/as3525/sd-as3525.c
parent30804e5a3f6ab53cff56f11b44c077b5044e0b51 (diff)
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
Diffstat (limited to 'firmware/target/arm/as3525/sd-as3525.c')
-rw-r--r--firmware/target/arm/as3525/sd-as3525.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/firmware/target/arm/as3525/sd-as3525.c b/firmware/target/arm/as3525/sd-as3525.c
index 1f935a426e..ec6065630b 100644
--- a/firmware/target/arm/as3525/sd-as3525.c
+++ b/firmware/target/arm/as3525/sd-as3525.c
@@ -876,15 +876,12 @@ void sd_enable(bool on)
if (sd_enabled == on)
return; /* nothing to do */
+
+ sd_enabled = on;
+
if(on)
{
- /* Enable both NAF_CLOCK & IDE clk for internal SD */
- 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
+#if defined(HAVE_BUTTON_LIGHT) && defined(HAVE_MULTIDRIVE)
/* buttonlight AMSes need a bit of special handling for the buttonlight
* here due to the dual mapping of GPIOD and XPD */
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);
else
_buttonlight_off();
-#endif /* HAVE_BUTTON_LIGHT */
-#endif /* HAVE_MULTIDRIVE */
- sd_enabled = true;
+#endif
#if defined(HAVE_HOTSWAP) && defined (HAVE_ADJUSTABLE_CPU_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) */
- sd_enabled = false;
-
-#ifdef HAVE_MULTIDRIVE
-#ifdef HAVE_BUTTON_LIGHT
+#if defined(HAVE_BUTTON_LIGHT) && defined(HAVE_MULTIDRIVE)
CCU_IO &= ~(1<<2); /* XPD is general purpose IO (b3:2 = 00) */
if (buttonlight_is_on)
_buttonlight_on();
-#endif /* HAVE_BUTTON_LIGHT */
- /* 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*/
+#endif
}
}