forked from len0rd/rockbox
Now uses CMD_STANDBY again. CMD_SLEEP used more power than CMD_STANDBY for some reason
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1507 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
af6ceba2a3
commit
9d589401c1
1 changed files with 12 additions and 8 deletions
|
|
@ -26,6 +26,7 @@
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "panic.h"
|
#include "panic.h"
|
||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
|
#include "power.h"
|
||||||
|
|
||||||
#define SECTOR_SIZE 512
|
#define SECTOR_SIZE 512
|
||||||
#define ATA_DATA (*((volatile unsigned short*)0x06104100))
|
#define ATA_DATA (*((volatile unsigned short*)0x06104100))
|
||||||
|
|
@ -290,16 +291,15 @@ static int ata_perform_sleep(void)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ATA_SELECT = ata_device;
|
#ifdef ATA_POWER_OFF
|
||||||
#ifdef DEBUG
|
ide_power_enable(false);
|
||||||
ATA_COMMAND = CMD_STANDBY;
|
|
||||||
#else
|
#else
|
||||||
ATA_COMMAND = CMD_SLEEP;
|
ATA_SELECT = ata_device;
|
||||||
#endif
|
ATA_COMMAND = CMD_STANDBY;
|
||||||
|
|
||||||
if (!wait_for_rdy())
|
if (!wait_for_rdy())
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
#endif
|
||||||
sleeping = true;
|
sleeping = true;
|
||||||
sleep_timer = 0;
|
sleep_timer = 0;
|
||||||
mutex_unlock(&ata_mtx);
|
mutex_unlock(&ata_mtx);
|
||||||
|
|
@ -372,14 +372,18 @@ int ata_soft_reset(void)
|
||||||
int retry_count;
|
int retry_count;
|
||||||
|
|
||||||
mutex_lock(&ata_mtx);
|
mutex_lock(&ata_mtx);
|
||||||
|
|
||||||
|
#ifdef ATA_POWER_OFF
|
||||||
|
ide_power_enable(true);
|
||||||
|
sleep(HZ);
|
||||||
|
#else
|
||||||
ATA_SELECT = SELECT_LBA | ata_device;
|
ATA_SELECT = SELECT_LBA | ata_device;
|
||||||
ATA_CONTROL = CONTROL_nIEN|CONTROL_SRST;
|
ATA_CONTROL = CONTROL_nIEN|CONTROL_SRST;
|
||||||
sleep(HZ/20000); /* >= 5us */
|
sleep(HZ/20000); /* >= 5us */
|
||||||
|
|
||||||
ATA_CONTROL = CONTROL_nIEN;
|
ATA_CONTROL = CONTROL_nIEN;
|
||||||
sleep(HZ/400); /* >2ms */
|
sleep(HZ/400); /* >2ms */
|
||||||
|
#endif
|
||||||
/* This little sucker can take up to 30 seconds */
|
/* This little sucker can take up to 30 seconds */
|
||||||
retry_count = 8;
|
retry_count = 8;
|
||||||
do
|
do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue