diff options
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/ata.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index ec99bf799e..b4151d0352 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c | |||
@@ -503,6 +503,33 @@ static int ata_perform_sleep(void) | |||
503 | return ret; | 503 | return ret; |
504 | } | 504 | } |
505 | 505 | ||
506 | int ata_standby(int time) | ||
507 | { | ||
508 | int ret = 0; | ||
509 | |||
510 | mutex_lock(&ata_mtx); | ||
511 | |||
512 | ATA_SELECT = ata_device; | ||
513 | |||
514 | if(!wait_for_rdy()) { | ||
515 | DEBUGF("ata_standby() - not RDY\n"); | ||
516 | mutex_unlock(&ata_mtx); | ||
517 | return -1; | ||
518 | } | ||
519 | |||
520 | ATA_NSECTOR = ((time + 5) / 5) & 0xff; /* Round up to nearest 5 secs */ | ||
521 | ATA_COMMAND = CMD_STANDBY; | ||
522 | |||
523 | if (!wait_for_rdy()) | ||
524 | { | ||
525 | DEBUGF("ata_standby() - CMD failed\n"); | ||
526 | ret = -2; | ||
527 | } | ||
528 | |||
529 | mutex_unlock(&ata_mtx); | ||
530 | return ret; | ||
531 | } | ||
532 | |||
506 | int ata_sleep(void) | 533 | int ata_sleep(void) |
507 | { | 534 | { |
508 | queue_post(&ata_queue, Q_SLEEP, NULL); | 535 | queue_post(&ata_queue, Q_SLEEP, NULL); |