1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Jens Arnold 2007-11-03 23:57:24 +00:00
parent 33acc66256
commit 015f6286a8
8 changed files with 39 additions and 10 deletions

View file

@ -949,6 +949,7 @@ static int ata_power_on(void)
int rc; int rc;
ide_power_enable(true); ide_power_enable(true);
sleep(HZ/50); /* allow voltage to build up */
if( ata_hard_reset() ) if( ata_hard_reset() )
return -1; return -1;
@ -1145,7 +1146,7 @@ int ata_init(void)
if (!ide_powered()) /* somebody has switched it off */ if (!ide_powered()) /* somebody has switched it off */
{ {
ide_power_enable(true); 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 */ /* first try, hard reset at cold start only */

View file

@ -104,6 +104,9 @@
/* Define this if you want to use the PP5020 i2c interface */ /* Define this if you want to use the PP5020 i2c interface */
#define CONFIG_I2C I2C_PP5020 #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 this if the hardware can be powered off while charging */
//#define HAVE_POWEROFF_WHILE_CHARGING //#define HAVE_POWEROFF_WHILE_CHARGING

View file

@ -93,6 +93,9 @@
/* Define this if you want to use the PP5020 i2c interface */ /* Define this if you want to use the PP5020 i2c interface */
#define CONFIG_I2C I2C_PP5020 #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 this if the hardware can be powered off while charging */
//#define HAVE_POWEROFF_WHILE_CHARGING //#define HAVE_POWEROFF_WHILE_CHARGING

View file

@ -101,6 +101,9 @@
/* Define this if you want to use the PP5020 i2c interface */ /* Define this if you want to use the PP5020 i2c interface */
#define CONFIG_I2C I2C_PP5020 #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 this if the hardware can be powered off while charging */
//#define HAVE_POWEROFF_WHILE_CHARGING //#define HAVE_POWEROFF_WHILE_CHARGING

View file

@ -101,6 +101,9 @@
/* Define this if you want to use the PP5020 i2c interface */ /* Define this if you want to use the PP5020 i2c interface */
#define CONFIG_I2C I2C_PP5020 #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 this if the hardware can be powered off while charging */
//#define HAVE_POWEROFF_WHILE_CHARGING //#define HAVE_POWEROFF_WHILE_CHARGING

View file

@ -103,6 +103,9 @@
/* Define this if you want to use the PP5020 i2c interface */ /* Define this if you want to use the PP5020 i2c interface */
#define CONFIG_I2C I2C_PP5020 #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 this if the hardware can be powered off while charging */
//#define HAVE_POWEROFF_WHILE_CHARGING //#define HAVE_POWEROFF_WHILE_CHARGING

View file

@ -63,9 +63,19 @@ void ide_power_enable(bool on)
GPIOC_OUTPUT_VAL &= ~0x40; GPIOC_OUTPUT_VAL &= ~0x40;
else else
GPIOC_OUTPUT_VAL |= 0x40; GPIOC_OUTPUT_VAL |= 0x40;
#else #elif defined(IPOD_4G) || defined(IPOD_COLOR) \
/* We do nothing on other iPods yet */ || defined(IPOD_MINI) || defined(IPOD_MINI2G)
(void)on; 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 #endif
} }
@ -73,9 +83,13 @@ bool ide_powered(void)
{ {
#if defined(IPOD_1G2G) || defined(IPOD_3G) #if defined(IPOD_1G2G) || defined(IPOD_3G)
return !(GPIOC_OUTPUT_VAL & 0x40); return !(GPIOC_OUTPUT_VAL & 0x40);
#else #elif defined(IPOD_4G) || defined(IPOD_COLOR) \
/* pretend we are always powered - we don't turn it off on the ipod */ || defined(IPOD_MINI) || defined(IPOD_MINI2G)
return true; return !(GPIOJ_OUTPUT_VAL & 0x04);
#elif defined(IPOD_VIDEO)
return !(GPO32_VAL & 0x40000000);
#else /* Nano */
return true; /* Pretend we are always powered */
#endif #endif
} }

View file

@ -60,10 +60,9 @@ bool charger_inserted(void)
void ide_power_enable(bool on) void ide_power_enable(bool on)
{ {
if(on){ if(on){
GPIOF_OUTPUT_VAL &=~ 0x1; GPIO_CLEAR_BITWISE(GPIOF_OUTPUT_VAL, 0x01);
sleep(1);
} else { } else {
GPIOF_OUTPUT_VAL |= 0x1; GPIO_SET_BITWISE(GPIOF_OUTPUT_VAL, 0x01);
} }
} }