From df4bd0697d2925266df6af52c1247bf60a854db4 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Thu, 8 May 2008 08:03:08 +0000 Subject: 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 --- firmware/target/arm/imx31/gigabeat-s/power-imx31.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'firmware/target/arm/imx31/gigabeat-s/power-imx31.c') 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) -- cgit v1.2.3