summaryrefslogtreecommitdiff
path: root/firmware/target/arm/imx31/gigabeat-s/power-imx31.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2008-05-08 08:03:08 +0000
committerMichael Sevakis <jethead71@rockbox.org>2008-05-08 08:03:08 +0000
commitdf4bd0697d2925266df6af52c1247bf60a854db4 (patch)
treea8c03adedc5450b8dbaad3f2a4cf1529d7ce5a44 /firmware/target/arm/imx31/gigabeat-s/power-imx31.c
parentf18e4db81b5503c864c41505cf5e8122638c0089 (diff)
Gigabeat S: Add ATA/IDE power management. Fix parameter order of regmod32 as it was intended (had some things mixed up :P).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17409 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/imx31/gigabeat-s/power-imx31.c')
-rw-r--r--firmware/target/arm/imx31/gigabeat-s/power-imx31.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/firmware/target/arm/imx31/gigabeat-s/power-imx31.c b/firmware/target/arm/imx31/gigabeat-s/power-imx31.c
index e51318d16f..3e845d7d93 100644
--- a/firmware/target/arm/imx31/gigabeat-s/power-imx31.c
+++ b/firmware/target/arm/imx31/gigabeat-s/power-imx31.c
@@ -19,6 +19,7 @@
#include "config.h"
#include "system.h"
#include "power.h"
+#include "ata.h"
#include "backlight.h"
#include "backlight-target.h"
#include "avic-imx31.h"
@@ -50,7 +51,21 @@ bool charging_state(void) {
void ide_power_enable(bool on)
{
- (void)on;
+ if (!on)
+ {
+ /* Bus must be isolated before power off */
+ imx31_regmod32(&GPIO2_DR, (1 << 16), (1 << 16));
+ }
+
+ /* HD power switch */
+ imx31_regmod32(&GPIO3_DR, on ? (1 << 5) : 0, (1 << 5));
+
+ if (on)
+ {
+ /* Bus switch may be turned on after powerup */
+ sleep(HZ/10);
+ imx31_regmod32(&GPIO2_DR, 0, (1 << 16));
+ }
}
bool ide_powered(void)