Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide
translations



Rockbox mail archive

Subject: Re: Red led dead - this is where it goes wrong!!!

Re: Red led dead - this is where it goes wrong!!!

From: Björn Stenberg <bjorn_at_haxx.se>
Date: Thu, 1 May 2003 22:55:36 +0200

Mike Holden wrote:
> Basically, when we hit this problem, the ATA_ALT_STATUS __always__ returns
> 0x80 (BUSY). [..] This usually happens when called from
> perform_soft_reset() in ata_read_sectors()

Excellent work!

> I have tried changing the perform_soft_reset() call to an
> ata_hard_reset(), but it seems that this doesn't always sort out the disk
> either, so I need to look at an even more severe reset method.

The ATA spec says:

"Transition PM3:PM2:, When hardware reset, software reset, or DEVICE RESET command is received the device shall make a transition to the PM2:Standby mode."

(PM3 is sleep mode, PM2 is standby mode.)

So all of the three should work. If neither hard or soft reset work, you could try the DEVICE RESET command, but I doubt it will work any better.

What is definitely worth trying, however, is to use power mode STANDBY instead of SLEEP. It draws a little bit more power, but does not require a reset to wake up. Silly of me not to try this before. Here's a patch:

===================================================================
RCS file: /cvsroot/rockbox/firmware/drivers/ata.c,v
retrieving revision 1.82
diff -u -b -r1.82 ata.c
--- firmware/drivers/ata.c 28 Apr 2003 12:02:14 -0000 1.82
+++ firmware/drivers/ata.c 1 May 2003 20:44:58 -0000
_at__at_ -185,6 +185,7 _at__at_
                 return -1;
             }
         }
+#ifdef USE_SLEEP
         else {
             if (perform_soft_reset()) {
                 mutex_unlock(&ata_mtx);
_at__at_ -192,6 +193,7 _at__at_
                 return -1;
             }
         }
+#endif
     }
 
     timeout = current_tick + READ_TIMEOUT;
_at__at_ -334,6 +336,7 _at__at_
                 return -1;
             }
         }
+#ifdef USE_SLEEP
         else {
             if (perform_soft_reset()) {
                 mutex_unlock(&ata_mtx);
_at__at_ -341,6 +344,7 _at__at_
                 return -1;
             }
         }
+#endif
     }
     
     ATA_SELECT = ata_device;
_at__at_ -490,7 +494,11 _at__at_
         return -1;
     }
 
+#ifdef USE_SLEEP
     ATA_COMMAND = CMD_SLEEP;
+#else
+ ATA_COMMAND = CMD_STANDBY_IMMEDIATE;
+#endif
 
     if (!wait_for_rdy())
     {

-- 
Björn
Received on 2003-05-01

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy