summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2007-11-03 23:57:24 +0000
committerJens Arnold <amiconn@rockbox.org>2007-11-03 23:57:24 +0000
commit015f6286a8db3fb79d155cf33698ededf219d32e (patch)
tree2d6bce1fa42719e947ac8034012a8fe0e7627e20 /firmware
parent33acc662569ab01e0770b85a6b32c57ed340c351 (diff)
downloadrockbox-015f6286a8db3fb79d155cf33698ededf219d32e.zip
rockbox-015f6286a8db3fb79d155cf33698ededf219d32e.tar.gz
rockbox-015f6286a8db3fb79d155cf33698ededf219d32e.tar.bz2
rockbox-015f6286a8db3fb79d155cf33698ededf219d32e.tar.xz
Finally: HDD power control for all PP502x iPods (4th gen Grayscale, Color, Minis, Video). * Wait a short time after powering on the HDD on all disk based targets, as that seems like a good idea. Shorten the excessive wait on initial power on.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15444 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/ata.c3
-rw-r--r--firmware/export/config-ipod4g.h3
-rw-r--r--firmware/export/config-ipodcolor.h3
-rw-r--r--firmware/export/config-ipodmini.h3
-rw-r--r--firmware/export/config-ipodmini2g.h3
-rw-r--r--firmware/export/config-ipodvideo.h3
-rw-r--r--firmware/target/arm/ipod/power-ipod.c26
-rw-r--r--firmware/target/arm/iriver/h10/power-h10.c5
8 files changed, 39 insertions, 10 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index f63b795..67aab8a 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -949,6 +949,7 @@ static int ata_power_on(void)
int rc;
ide_power_enable(true);
+ sleep(HZ/50); /* allow voltage to build up */
if( ata_hard_reset() )
return -1;
@@ -1145,7 +1146,7 @@ int ata_init(void)
if (!ide_powered()) /* somebody has switched it off */
{
ide_power_enable(true);
- sleep(HZ); /* allow voltage to build up */
+ sleep(HZ/50); /* allow voltage to build up */
}
/* first try, hard reset at cold start only */
diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h
index d75650b..7d58992 100644
--- a/firmware/export/config-ipod4g.h
+++ b/firmware/export/config-ipod4g.h
@@ -104,6 +104,9 @@
/* Define this if you want to use the PP5020 i2c interface */
#define CONFIG_I2C I2C_PP5020
+/* We're able to shut off power to the HDD */
+#define HAVE_ATA_POWER_OFF
+
/* define this if the hardware can be powered off while charging */
//#define HAVE_POWEROFF_WHILE_CHARGING
diff --git a/firmware/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h
index 8a4c19e..a585090 100644
--- a/firmware/export/config-ipodcolor.h
+++ b/firmware/export/config-ipodcolor.h
@@ -93,6 +93,9 @@
/* Define this if you want to use the PP5020 i2c interface */
#define CONFIG_I2C I2C_PP5020
+/* We're able to shut off power to the HDD */
+#define HAVE_ATA_POWER_OFF
+
/* define this if the hardware can be powered off while charging */
//#define HAVE_POWEROFF_WHILE_CHARGING
diff --git a/firmware/export/config-ipodmini.h b/firmware/export/config-ipodmini.h
index 3b24737..5cab176 100644
--- a/firmware/export/config-ipodmini.h
+++ b/firmware/export/config-ipodmini.h
@@ -101,6 +101,9 @@
/* Define this if you want to use the PP5020 i2c interface */
#define CONFIG_I2C I2C_PP5020
+/* We're able to shut off power to the HDD */
+#define HAVE_ATA_POWER_OFF
+
/* define this if the hardware can be powered off while charging */
//#define HAVE_POWEROFF_WHILE_CHARGING
diff --git a/firmware/export/config-ipodmini2g.h b/firmware/export/config-ipodmini2g.h
index 34e5f5a..77299dd 100644
--- a/firmware/export/config-ipodmini2g.h
+++ b/firmware/export/config-ipodmini2g.h
@@ -101,6 +101,9 @@
/* Define this if you want to use the PP5020 i2c interface */
#define CONFIG_I2C I2C_PP5020
+/* We're able to shut off power to the HDD */
+#define HAVE_ATA_POWER_OFF
+
/* define this if the hardware can be powered off while charging */
//#define HAVE_POWEROFF_WHILE_CHARGING
diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h
index 71cb8ab..9ba4792 100644
--- a/firmware/export/config-ipodvideo.h
+++ b/firmware/export/config-ipodvideo.h
@@ -103,6 +103,9 @@
/* Define this if you want to use the PP5020 i2c interface */
#define CONFIG_I2C I2C_PP5020
+/* We're able to shut off power to the HDD */
+#define HAVE_ATA_POWER_OFF
+
/* define this if the hardware can be powered off while charging */
//#define HAVE_POWEROFF_WHILE_CHARGING
diff --git a/firmware/target/arm/ipod/power-ipod.c b/firmware/target/arm/ipod/power-ipod.c
index 37ef418..ae663d1 100644
--- a/firmware/target/arm/ipod/power-ipod.c
+++ b/firmware/target/arm/ipod/power-ipod.c
@@ -63,9 +63,19 @@ void ide_power_enable(bool on)
GPIOC_OUTPUT_VAL &= ~0x40;
else
GPIOC_OUTPUT_VAL |= 0x40;
-#else
- /* We do nothing on other iPods yet */
- (void)on;
+#elif defined(IPOD_4G) || defined(IPOD_COLOR) \
+ || defined(IPOD_MINI) || defined(IPOD_MINI2G)
+ if (on)
+ GPIO_CLEAR_BITWISE(GPIOJ_OUTPUT_VAL, 0x04);
+ else
+ GPIO_SET_BITWISE(GPIOJ_OUTPUT_VAL, 0x04);
+#elif defined(IPOD_VIDEO)
+ if (on)
+ GPO32_VAL &= ~0x40000000;
+ else
+ GPO32_VAL |= 0x40000000;
+#else /* Nano */
+ (void)on; /* Do nothing. */
#endif
}
@@ -73,9 +83,13 @@ bool ide_powered(void)
{
#if defined(IPOD_1G2G) || defined(IPOD_3G)
return !(GPIOC_OUTPUT_VAL & 0x40);
-#else
- /* pretend we are always powered - we don't turn it off on the ipod */
- return true;
+#elif defined(IPOD_4G) || defined(IPOD_COLOR) \
+ || defined(IPOD_MINI) || defined(IPOD_MINI2G)
+ return !(GPIOJ_OUTPUT_VAL & 0x04);
+#elif defined(IPOD_VIDEO)
+ return !(GPO32_VAL & 0x40000000);
+#else /* Nano */
+ return true; /* Pretend we are always powered */
#endif
}
diff --git a/firmware/target/arm/iriver/h10/power-h10.c b/firmware/target/arm/iriver/h10/power-h10.c
index 9cbdb50..7f3fb40 100644
--- a/firmware/target/arm/iriver/h10/power-h10.c
+++ b/firmware/target/arm/iriver/h10/power-h10.c
@@ -60,10 +60,9 @@ bool charger_inserted(void)
void ide_power_enable(bool on)
{
if(on){
- GPIOF_OUTPUT_VAL &=~ 0x1;
- sleep(1);
+ GPIO_CLEAR_BITWISE(GPIOF_OUTPUT_VAL, 0x01);
} else {
- GPIOF_OUTPUT_VAL |= 0x1;
+ GPIO_SET_BITWISE(GPIOF_OUTPUT_VAL, 0x01);
}
}