From 017b0d7b716e8e1e1fc7ae5adec7a65c38b43e96 Mon Sep 17 00:00:00 2001 From: Thom Johansen Date: Wed, 25 Oct 2006 17:31:29 +0000 Subject: [PATCH] A better workaround due to ATA sleep bugs in the Ipod Nano. battery_bench and plugins like it should now work also on Nano. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11344 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/ata.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index f57088504b..3874745711 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c @@ -1412,20 +1412,13 @@ void ata_poweroff(bool enable) bool ata_disk_is_active(void) { -#ifdef IPOD_NANO - return false; -#else return !sleeping; -#endif } static int ata_perform_sleep(void) { int ret = 0; - /* ATA sleep is currently broken on Nano, and will hang all subsequent - accesses, so disable until we find a cure. */ -#ifndef IPOD_NANO mutex_lock(&ata_mtx); SET_REG(ATA_SELECT, ata_device); @@ -1446,7 +1439,6 @@ static int ata_perform_sleep(void) sleeping = true; mutex_unlock(&ata_mtx); -#endif return ret; } @@ -1569,6 +1561,12 @@ int ata_hard_reset(void) static int perform_soft_reset(void) { +/* If this code is allowed to run on a Nano, the next reads from the flash will + * time out, so we disable it. It shouldn't be necessary anyway, since the + * ATA -> Flash interface automatically sleeps almost immediately after the + * last command. + */ +#ifndef IPOD_NANO int ret; int retry_count; @@ -1590,6 +1588,9 @@ static int perform_soft_reset(void) ret = ret?0:-1; return ret; +#else + return 0; /* Always report success */ +#endif } int ata_soft_reset(void)