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: Mike Holden <rockbox_at_mikeholden.uklinux.net>
Date: Fri, 2 May 2003 15:29:56 +0100 (BST)

I'll have a look at this. I assume that USE_SLEEP will not be defined?

One other point I just noticed, slightly related! Should we in fact be
calling ata_soft_reset() rather than perform_soft_reset(), since that
performs the mutex locking as well as the reset?

Björn Stenberg said:
> 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


-- 
Mike Holden
Received on 2003-05-02

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