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
This commit is contained in:
Solomon Peachy 2020-07-08 11:05:27 -04:00
parent 7249fabe63
commit 54629073ae
1 changed files with 5 additions and 0 deletions

View File

@ -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) {