summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-07-08 11:05:27 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-07-11 22:17:13 -0400
commit54629073aeb563cc70cc518a83bb9e5462b80531 (patch)
treea7fe28323b889927b0a295439a5dfe64129e1ea6
parent7249fabe63b6106225c11c401fdc17cd4b03ad5e (diff)
downloadrockbox-54629073aeb563cc70cc518a83bb9e5462b80531.tar.gz
rockbox-54629073aeb563cc70cc518a83bb9e5462b80531.tar.bz2
rockbox-54629073aeb563cc70cc518a83bb9e5462b80531.zip
ATA: Make sure "hard disk" supports power management
The FC-1307 CF->SD converter that is the basis of a lot of ATA->CF devices (including several iflash iFlash models) claims to not support ATA power management commands. Rockbox unconditionally issues those commands as support is mandated by the ATA spec. This patch checks the capability bit, and if it's not supported, does not attempt to put the ATA subsystem to sleep. It is not clear if the problems lie with the SLEEP commands or the wakeup process, but who knows where else the FC1307 violates the ATA specs, and reliability is much more important than power savings. Change-Id: I8b539c579d0449a8a3cfa63cdd1387db990fe820
-rw-r--r--firmware/drivers/ata.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 2116855233..39c305c3df 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -801,6 +801,11 @@ bool ata_disk_is_active(void)
void ata_sleepnow(void)
{
+ /* Don't enter sleep if the device doesn't support
+ power management. */
+ if (!(identify_info[82] & (1 << 3)))
+ return;
+
if (ata_state >= ATA_SPINUP) {
mutex_lock(&ata_mtx);
if (ata_state == ATA_ON) {