diff options
author | Barry Wardell <rockbox@barrywardell.net> | 2007-04-23 23:26:23 +0000 |
---|---|---|
committer | Barry Wardell <rockbox@barrywardell.net> | 2007-04-23 23:26:23 +0000 |
commit | 7027c6a0f8ed85c176e77ceb019a282b6b3d69ac (patch) | |
tree | 872ff2cca2dc1ed957ca5508e86575bae54a171d /firmware/target/arm/sandisk/sansa-e200/ata-e200.c | |
parent | 27b4a64f9b215bde49e2a50aba51698fd56dbd85 (diff) |
FS#7036: Power saving improvements for Sansa. Shutdown LCD controller when backlight is off and shutdown ATA controller when the disk isn't being accessed. Frequency scaling is not enabled yet as it was apparently causing some problems.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13250 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/sandisk/sansa-e200/ata-e200.c')
-rw-r--r-- | firmware/target/arm/sandisk/sansa-e200/ata-e200.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/firmware/target/arm/sandisk/sansa-e200/ata-e200.c b/firmware/target/arm/sandisk/sansa-e200/ata-e200.c index 3d6cb23d9c..b66984bec4 100644 --- a/firmware/target/arm/sandisk/sansa-e200/ata-e200.c +++ b/firmware/target/arm/sandisk/sansa-e200/ata-e200.c @@ -22,6 +22,7 @@ #include "system.h" #include <string.h> #include "thread.h" +#include "pp5024.h" #define NOINLINE_ATTR __attribute__((noinline)) /* don't inline the loops */ @@ -359,9 +360,9 @@ void sd_init_device(void) GPIOD_ENABLE |= (0x1f); GPIOD_OUTPUT_EN |= (0x1f); GPIOD_OUTPUT_VAL |= (0x1f); - DEV_EN |= (1 << 14); /* Enable controller */ - DEV_RS |= (1 << 14); /* Reset controller */ - DEV_RS &=~(1 << 14); /* Clear Reset */ + DEV_EN |= DEV_ATA; /* Enable controller */ + DEV_RS |= DEV_ATA; /* Reset controller */ + DEV_RS &=~DEV_ATA; /* Clear Reset */ outl(0, 0x6000b000); outl(0, 0x6000a000); /* Init DMA controller? */ @@ -478,6 +479,7 @@ int ata_read_sectors(IF_MV2(int drive,) last_disk_activity = current_tick; spinup_start = current_tick; + ata_enable(true); ata_led(true); timeout = current_tick + READ_TIMEOUT; @@ -528,6 +530,7 @@ int ata_read_sectors(IF_MV2(int drive,) break; } ata_led(false); + ata_enable(false); mutex_unlock(&sd_mtx); @@ -551,6 +554,7 @@ int ata_write_sectors(IF_MV2(int drive,) tSDCardInfo *card = &card_info[current_card]; mutex_lock(&sd_mtx); + ata_enable(true); ata_led(true); if(current_card == 0) { @@ -603,8 +607,10 @@ retry: sd_read_response(&response, 1); sd_wait_for_state(card, TRAN); - mutex_unlock(&sd_mtx); ata_led(false); + ata_enable(false); + mutex_unlock(&sd_mtx); + return ret; } @@ -667,7 +673,14 @@ int ata_soft_reset(void) void ata_enable(bool on) { - (void)on; + if(on) + { + DEV_EN |= DEV_ATA; /* Enable controller */ + } + else + { + DEV_EN &= ~DEV_ATA; /* Disable controller */ + } } unsigned short* ata_get_identify(void) |