diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 9b092e1402..9e67ea4cce 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c @@ -186,8 +186,6 @@ int ata_read_sectors(unsigned long start, return -1; } } - sleeping = false; - poweroff = false; spinup = true; } @@ -226,16 +224,18 @@ int ata_read_sectors(unsigned long start, goto retry; } - if (spinup) { - ata_spinup_time = current_tick - last_disk_activity; - spinup = false; - } - if ( ATA_ALT_STATUS & (STATUS_ERR | STATUS_DF) ) { ret = -5; goto retry; } + if (spinup) { + ata_spinup_time = current_tick - last_disk_activity; + spinup = false; + sleeping = false; + poweroff = false; + } + /* if destination address is odd, use byte copying, otherwise use word copying */ @@ -314,8 +314,6 @@ int ata_write_sectors(unsigned long start, return -1; } } - sleeping = false; - poweroff = false; spinup = true; } @@ -349,6 +347,8 @@ int ata_write_sectors(unsigned long start, if (spinup) { ata_spinup_time = current_tick - last_disk_activity; spinup = false; + sleeping = false; + poweroff = false; } for (j=0; j