summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-03-19 13:26:43 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-03-19 13:26:43 +0000
commit8bda0e10975b476a77a17777a733b783a4d718b4 (patch)
tree690333268d2c9cf6e9b21680f04658a3a899ceaf
parentaac5ca92b6fb4ca165ced08feac0d4e2341c2f60 (diff)
downloadrockbox-8bda0e10975b476a77a17777a733b783a4d718b4.zip
rockbox-8bda0e10975b476a77a17777a733b783a4d718b4.tar.gz
rockbox-8bda0e10975b476a77a17777a733b783a4d718b4.tar.bz2
rockbox-8bda0e10975b476a77a17777a733b783a4d718b4.tar.xz
A hip shot trying to make the Red LED Death situation a little better
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4409 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/ata.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 7641be7..d12dfbe 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -117,7 +117,7 @@ static int set_features(void);
static int wait_for_bsy(void) __attribute__ ((section (".icode")));
static int wait_for_bsy(void)
{
- int timeout = current_tick + HZ*10;
+ int timeout = current_tick + HZ*30;
while (TIME_BEFORE(current_tick, timeout) && (ATA_STATUS & STATUS_BSY)) {
last_disk_activity = current_tick;
yield();
@@ -375,6 +375,15 @@ int ata_read_sectors(unsigned long start,
int status;
if (!wait_for_start_of_transfer()) {
+ /* We have timed out waiting for RDY and/or DRQ, possibly
+ because the hard drive is shaking and has problems reading
+ the data. We have two options:
+ 1) Wait some more
+ 2) Perform a soft reset and try again.
+
+ We choose alternative 2.
+ */
+ ata_soft_reset();
ret = -4;
goto retry;
}
@@ -409,6 +418,7 @@ int ata_read_sectors(unsigned long start,
-- ATA specification
*/
if ( status & (STATUS_BSY | STATUS_ERR | STATUS_DF) ) {
+ ata_soft_reset();
ret = -5;
goto retry;
}
@@ -420,6 +430,7 @@ int ata_read_sectors(unsigned long start,
}
if(!ret && !wait_for_end_of_transfer()) {
+ ata_soft_reset();
ret = -3;
goto retry;
}