summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-08-01 12:00:03 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-08-01 12:00:03 +0000
commit9d589401c1134dc81883e2a957549a24f4dd137b (patch)
tree73a9b4ce58d51553128099e0bedd1c7dae3b5d8b /firmware
parentaf6ceba2a3b857ca03d1db548830e29d478ee788 (diff)
downloadrockbox-9d589401c1134dc81883e2a957549a24f4dd137b.tar.gz
rockbox-9d589401c1134dc81883e2a957549a24f4dd137b.zip
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
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/ata.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 845fb79e80..10efecc342 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -26,6 +26,7 @@
26#include "debug.h" 26#include "debug.h"
27#include "panic.h" 27#include "panic.h"
28#include "usb.h" 28#include "usb.h"
29#include "power.h"
29 30
30#define SECTOR_SIZE 512 31#define SECTOR_SIZE 512
31#define ATA_DATA (*((volatile unsigned short*)0x06104100)) 32#define ATA_DATA (*((volatile unsigned short*)0x06104100))
@@ -290,16 +291,15 @@ static int ata_perform_sleep(void)
290 return -1; 291 return -1;
291 } 292 }
292 293
294#ifdef ATA_POWER_OFF
295 ide_power_enable(false);
296#else
293 ATA_SELECT = ata_device; 297 ATA_SELECT = ata_device;
294#ifdef DEBUG
295 ATA_COMMAND = CMD_STANDBY; 298 ATA_COMMAND = CMD_STANDBY;
296#else
297 ATA_COMMAND = CMD_SLEEP;
298#endif
299 299
300 if (!wait_for_rdy()) 300 if (!wait_for_rdy())
301 ret = -1; 301 ret = -1;
302 302#endif
303 sleeping = true; 303 sleeping = true;
304 sleep_timer = 0; 304 sleep_timer = 0;
305 mutex_unlock(&ata_mtx); 305 mutex_unlock(&ata_mtx);
@@ -372,14 +372,18 @@ int ata_soft_reset(void)
372 int retry_count; 372 int retry_count;
373 373
374 mutex_lock(&ata_mtx); 374 mutex_lock(&ata_mtx);
375 375
376#ifdef ATA_POWER_OFF
377 ide_power_enable(true);
378 sleep(HZ);
379#else
376 ATA_SELECT = SELECT_LBA | ata_device; 380 ATA_SELECT = SELECT_LBA | ata_device;
377 ATA_CONTROL = CONTROL_nIEN|CONTROL_SRST; 381 ATA_CONTROL = CONTROL_nIEN|CONTROL_SRST;
378 sleep(HZ/20000); /* >= 5us */ 382 sleep(HZ/20000); /* >= 5us */
379 383
380 ATA_CONTROL = CONTROL_nIEN; 384 ATA_CONTROL = CONTROL_nIEN;
381 sleep(HZ/400); /* >2ms */ 385 sleep(HZ/400); /* >2ms */
382 386#endif
383 /* This little sucker can take up to 30 seconds */ 387 /* This little sucker can take up to 30 seconds */
384 retry_count = 8; 388 retry_count = 8;
385 do 389 do