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.tar.gz
rockbox-015f6286a8db3fb79d155cf33698ededf219d32e.zip
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 f63b795a19..67aab8a9ba 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -949,6 +949,7 @@ static int ata_power_on(void)
949 int rc; 949 int rc;
950 950
951 ide_power_enable(true); 951 ide_power_enable(true);
952 sleep(HZ/50); /* allow voltage to build up */
952 if( ata_hard_reset() ) 953 if( ata_hard_reset() )
953 return -1; 954 return -1;
954 955
@@ -1145,7 +1146,7 @@ int ata_init(void)
1145 if (!ide_powered()) /* somebody has switched it off */ 1146 if (!ide_powered()) /* somebody has switched it off */
1146 { 1147 {
1147 ide_power_enable(true); 1148 ide_power_enable(true);
1148 sleep(HZ); /* allow voltage to build up */ 1149 sleep(HZ/50); /* allow voltage to build up */
1149 } 1150 }
1150 1151
1151 /* first try, hard reset at cold start only */ 1152 /* first try, hard reset at cold start only */
diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h
index d75650ba4f..7d58992ee8 100644
--- a/firmware/export/config-ipod4g.h
+++ b/firmware/export/config-ipod4g.h
@@ -104,6 +104,9 @@
104/* Define this if you want to use the PP5020 i2c interface */ 104/* Define this if you want to use the PP5020 i2c interface */
105#define CONFIG_I2C I2C_PP5020 105#define CONFIG_I2C I2C_PP5020
106 106
107/* We're able to shut off power to the HDD */
108#define HAVE_ATA_POWER_OFF
109
107/* define this if the hardware can be powered off while charging */ 110/* define this if the hardware can be powered off while charging */
108//#define HAVE_POWEROFF_WHILE_CHARGING 111//#define HAVE_POWEROFF_WHILE_CHARGING
109 112
diff --git a/firmware/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h
index 8a4c19eda7..a5850904fa 100644
--- a/firmware/export/config-ipodcolor.h
+++ b/firmware/export/config-ipodcolor.h
@@ -93,6 +93,9 @@
93/* Define this if you want to use the PP5020 i2c interface */ 93/* Define this if you want to use the PP5020 i2c interface */
94#define CONFIG_I2C I2C_PP5020 94#define CONFIG_I2C I2C_PP5020
95 95
96/* We're able to shut off power to the HDD */
97#define HAVE_ATA_POWER_OFF
98
96/* define this if the hardware can be powered off while charging */ 99/* define this if the hardware can be powered off while charging */
97//#define HAVE_POWEROFF_WHILE_CHARGING 100//#define HAVE_POWEROFF_WHILE_CHARGING
98 101
diff --git a/firmware/export/config-ipodmini.h b/firmware/export/config-ipodmini.h
index 3b2473718d..5cab1767e3 100644
--- a/firmware/export/config-ipodmini.h
+++ b/firmware/export/config-ipodmini.h
@@ -101,6 +101,9 @@
101/* Define this if you want to use the PP5020 i2c interface */ 101/* Define this if you want to use the PP5020 i2c interface */
102#define CONFIG_I2C I2C_PP5020 102#define CONFIG_I2C I2C_PP5020
103 103
104/* We're able to shut off power to the HDD */
105#define HAVE_ATA_POWER_OFF
106
104/* define this if the hardware can be powered off while charging */ 107/* define this if the hardware can be powered off while charging */
105//#define HAVE_POWEROFF_WHILE_CHARGING 108//#define HAVE_POWEROFF_WHILE_CHARGING
106 109
diff --git a/firmware/export/config-ipodmini2g.h b/firmware/export/config-ipodmini2g.h
index 34e5f5a46b..77299dda01 100644
--- a/firmware/export/config-ipodmini2g.h
+++ b/firmware/export/config-ipodmini2g.h
@@ -101,6 +101,9 @@
101/* Define this if you want to use the PP5020 i2c interface */ 101/* Define this if you want to use the PP5020 i2c interface */
102#define CONFIG_I2C I2C_PP5020 102#define CONFIG_I2C I2C_PP5020
103 103
104/* We're able to shut off power to the HDD */
105#define HAVE_ATA_POWER_OFF
106
104/* define this if the hardware can be powered off while charging */ 107/* define this if the hardware can be powered off while charging */
105//#define HAVE_POWEROFF_WHILE_CHARGING 108//#define HAVE_POWEROFF_WHILE_CHARGING
106 109
diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h
index 71cb8abf39..9ba479246b 100644
--- a/firmware/export/config-ipodvideo.h
+++ b/firmware/export/config-ipodvideo.h
@@ -103,6 +103,9 @@
103/* Define this if you want to use the PP5020 i2c interface */ 103/* Define this if you want to use the PP5020 i2c interface */
104#define CONFIG_I2C I2C_PP5020 104#define CONFIG_I2C I2C_PP5020
105 105
106/* We're able to shut off power to the HDD */
107#define HAVE_ATA_POWER_OFF
108
106/* define this if the hardware can be powered off while charging */ 109/* define this if the hardware can be powered off while charging */
107//#define HAVE_POWEROFF_WHILE_CHARGING 110//#define HAVE_POWEROFF_WHILE_CHARGING
108 111
diff --git a/firmware/target/arm/ipod/power-ipod.c b/firmware/target/arm/ipod/power-ipod.c
index 37ef418026..ae663d16e5 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)
63 GPIOC_OUTPUT_VAL &= ~0x40; 63 GPIOC_OUTPUT_VAL &= ~0x40;
64 else 64 else
65 GPIOC_OUTPUT_VAL |= 0x40; 65 GPIOC_OUTPUT_VAL |= 0x40;
66#else 66#elif defined(IPOD_4G) || defined(IPOD_COLOR) \
67 /* We do nothing on other iPods yet */ 67 || defined(IPOD_MINI) || defined(IPOD_MINI2G)
68 (void)on; 68 if (on)
69 GPIO_CLEAR_BITWISE(GPIOJ_OUTPUT_VAL, 0x04);
70 else
71 GPIO_SET_BITWISE(GPIOJ_OUTPUT_VAL, 0x04);
72#elif defined(IPOD_VIDEO)
73 if (on)
74 GPO32_VAL &= ~0x40000000;
75 else
76 GPO32_VAL |= 0x40000000;
77#else /* Nano */
78 (void)on; /* Do nothing. */
69#endif 79#endif
70} 80}
71 81
@@ -73,9 +83,13 @@ bool ide_powered(void)
73{ 83{
74#if defined(IPOD_1G2G) || defined(IPOD_3G) 84#if defined(IPOD_1G2G) || defined(IPOD_3G)
75 return !(GPIOC_OUTPUT_VAL & 0x40); 85 return !(GPIOC_OUTPUT_VAL & 0x40);
76#else 86#elif defined(IPOD_4G) || defined(IPOD_COLOR) \
77 /* pretend we are always powered - we don't turn it off on the ipod */ 87 || defined(IPOD_MINI) || defined(IPOD_MINI2G)
78 return true; 88 return !(GPIOJ_OUTPUT_VAL & 0x04);
89#elif defined(IPOD_VIDEO)
90 return !(GPO32_VAL & 0x40000000);
91#else /* Nano */
92 return true; /* Pretend we are always powered */
79#endif 93#endif
80} 94}
81 95
diff --git a/firmware/target/arm/iriver/h10/power-h10.c b/firmware/target/arm/iriver/h10/power-h10.c
index 9cbdb50080..7f3fb40b36 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)
60void ide_power_enable(bool on) 60void ide_power_enable(bool on)
61{ 61{
62 if(on){ 62 if(on){
63 GPIOF_OUTPUT_VAL &=~ 0x1; 63 GPIO_CLEAR_BITWISE(GPIOF_OUTPUT_VAL, 0x01);
64 sleep(1);
65 } else { 64 } else {
66 GPIOF_OUTPUT_VAL |= 0x1; 65 GPIO_SET_BITWISE(GPIOF_OUTPUT_VAL, 0x01);
67 } 66 }
68} 67}
69 68