If Rockbox never turns off ATA power, don't compile code for turning it back on. Note that ATA power may still need to be turned on when starting, so that code in ata_init() always remains.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31079 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Boris Gjenero 2011-11-27 17:40:57 +00:00
parent 2154cbf706
commit e5a7388fc7

View file

@ -161,7 +161,9 @@ static bool ata_led_on = false;
#endif #endif
static bool spinup = false; static bool spinup = false;
static bool sleeping = true; static bool sleeping = true;
#ifdef HAVE_ATA_POWER_OFF
static bool poweroff = false; static bool poweroff = false;
#endif
static long sleep_timeout = 5*HZ; static long sleep_timeout = 5*HZ;
#ifdef HAVE_LBA48 #ifdef HAVE_LBA48
static bool lba48 = false; /* set for 48 bit addressing */ static bool lba48 = false; /* set for 48 bit addressing */
@ -195,7 +197,9 @@ static int phys_sector_mult = 1;
static int dma_mode = 0; static int dma_mode = 0;
#endif #endif
#ifdef HAVE_ATA_POWER_OFF
static int ata_power_on(void); static int ata_power_on(void);
#endif
static int perform_soft_reset(void); static int perform_soft_reset(void);
static int set_multiple_mode(int sectors); static int set_multiple_mode(int sectors);
static int set_features(void); static int set_features(void);
@ -367,13 +371,16 @@ static int ata_transfer_sectors(unsigned long start,
if ( sleeping ) { if ( sleeping ) {
sleeping = false; /* set this now since it'll be on */ sleeping = false; /* set this now since it'll be on */
spinup = true; spinup = true;
#ifdef HAVE_ATA_POWER_OFF
if (poweroff) { if (poweroff) {
if (ata_power_on()) { if (ata_power_on()) {
ret = -2; ret = -2;
goto error; goto error;
} }
} }
else { else
#endif
{
if (perform_soft_reset()) { if (perform_soft_reset()) {
ret = -2; ret = -2;
goto error; goto error;
@ -462,7 +469,9 @@ static int ata_transfer_sectors(unsigned long start,
if (spinup) { if (spinup) {
spinup_time = current_tick - spinup_start; spinup_time = current_tick - spinup_start;
spinup = false; spinup = false;
#ifdef HAVE_ATA_POWER_OFF
poweroff = false; poweroff = false;
#endif
} }
} }
else else
@ -491,7 +500,9 @@ static int ata_transfer_sectors(unsigned long start,
if (spinup) { if (spinup) {
spinup_time = current_tick - spinup_start; spinup_time = current_tick - spinup_start;
spinup = false; spinup = false;
#ifdef HAVE_ATA_POWER_OFF
poweroff = false; poweroff = false;
#endif
} }
/* read the status register exactly once per loop */ /* read the status register exactly once per loop */
@ -934,11 +945,14 @@ static void ata_thread(void)
ata_led(true); ata_led(true);
sleeping = false; /* set this now since it'll be on */ sleeping = false; /* set this now since it'll be on */
#ifdef HAVE_ATA_POWER_OFF
if (poweroff) { if (poweroff) {
ata_power_on(); ata_power_on();
poweroff = false; poweroff = false;
} }
else { else
#endif
{
perform_soft_reset(); perform_soft_reset();
} }
@ -980,7 +994,11 @@ static void ata_thread(void)
} }
/* Hardware reset protocol as specified in chapter 9.1, ATA spec draft v5 */ /* Hardware reset protocol as specified in chapter 9.1, ATA spec draft v5 */
#ifdef HAVE_ATA_POWER_OFF
static int ata_hard_reset(void) static int ata_hard_reset(void)
#else
static int STORAGE_INIT_ATTR ata_hard_reset(void)
#endif
{ {
int ret; int ret;
@ -1056,6 +1074,7 @@ int ata_soft_reset(void)
return ret; return ret;
} }
#ifdef HAVE_ATA_POWER_OFF
static int ata_power_on(void) static int ata_power_on(void)
{ {
int rc; int rc;
@ -1085,6 +1104,7 @@ static int ata_power_on(void)
return 0; return 0;
} }
#endif
static int STORAGE_INIT_ATTR master_slave_detect(void) static int STORAGE_INIT_ATTR master_slave_detect(void)
{ {