summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/ata.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 0fbc418c2f..5cff8af19e 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -523,16 +523,20 @@ static void ata_thread(void)
523 } 523 }
524} 524}
525 525
526/* Hardware reset protocol as specified in chapter 9.1, ATA spec draft v5 */
526int ata_hard_reset(void) 527int ata_hard_reset(void)
527{ 528{
528 int ret; 529 int ret;
529 530
530 PADR &= ~0x0200; 531 /* state HRR0 */
532 PADR &= ~0x0200; /* assert _RESET */
533 sleep(1); /* > 25us */
531 534
532 sleep(2); 535 /* state HRR1 */
533 536 PADR |= 0x0200; /* negate _RESET */
534 PADR |= 0x0200; 537 sleep(1); /* > 2ms */
535 538
539 /* state HRR2 */
536 ret = wait_for_bsy(); 540 ret = wait_for_bsy();
537 541
538 /* Massage the return code so it is 0 on success and -1 on failure */ 542 /* Massage the return code so it is 0 on success and -1 on failure */