summaryrefslogtreecommitdiffstats
path: root/firmware/target/coldfire
diff options
context:
space:
mode:
authorMarcin Bukat <marcin.bukat@gmail.com>2010-06-11 11:41:29 +0000
committerMarcin Bukat <marcin.bukat@gmail.com>2010-06-11 11:41:29 +0000
commit2f7bd4d9938644a75afc5c13cf1ce3c702eb77ac (patch)
tree3bb3f35115cc6e4be58ad1753a54e23e7dba94d6 /firmware/target/coldfire
parentb45a2d433b81cd0087a75dec17190e0587734f1b (diff)
downloadrockbox-2f7bd4d9938644a75afc5c13cf1ce3c702eb77ac.tar.gz
rockbox-2f7bd4d9938644a75afc5c13cf1ce3c702eb77ac.tar.bz2
rockbox-2f7bd4d9938644a75afc5c13cf1ce3c702eb77ac.zip
HD200 - power_init() rework based on latest power consumption measurements
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26767 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/coldfire')
-rw-r--r--firmware/target/coldfire/mpio/hd200/power-hd200.c65
1 files changed, 41 insertions, 24 deletions
diff --git a/firmware/target/coldfire/mpio/hd200/power-hd200.c b/firmware/target/coldfire/mpio/hd200/power-hd200.c
index dd8576b9e4..4fc28e1436 100644
--- a/firmware/target/coldfire/mpio/hd200/power-hd200.c
+++ b/firmware/target/coldfire/mpio/hd200/power-hd200.c
@@ -30,15 +30,10 @@
#if CONFIG_TUNER
bool tuner_power(bool status)
{
- (void)status;
if (status)
- {
and_l(~(1<<17), &GPIO1_OUT);
- }
else
- {
or_l((1<<17), &GPIO1_OUT);
- }
return status;
}
@@ -46,20 +41,39 @@ bool tuner_power(bool status)
void power_init(void)
{
- /* GPIO53 has to be high - low resets device */
- /* GPIO49 is FM related */
- or_l((1<<21)|(1<<17), &GPIO1_OUT);
- or_l((1<<21)|(1<<17), &GPIO1_ENABLE);
- or_l((1<<21)|(1<<17)|(1<<14), &GPIO1_FUNCTION);
+ /* GPIO53 has to be high - low resets device
+ * it is setup in crt0.S
+ */
- and_l(~(1<<15), &GPIO_OUT);
- or_l((1<<15),&GPIO_ENABLE);
- or_l((1<<15),&GPIO_FUNCTION);
+ /* GPIO50 is ATA power (default OFF) */
+ or_l((1<<18), &GPIO1_OUT);
+ or_l((1<<18), &GPIO1_ENABLE);
+ or_l((1<<18), &GPIO1_FUNCTION);
+ /* GPIO49 is FM power (default OFF) */
+ or_l((1<<17), &GPIO1_OUT);
+ or_l((1<<17), &GPIO1_ENABLE);
+ or_l((1<<17), &GPIO1_FUNCTION);
+
+ /* GPIO46 is wall charger detect (input) */
+ and_l(~(1<<14), &GPIO1_ENABLE);
+ or_l((1<<14), &GPIO1_FUNCTION);
+
+ /* GPIO31 needs to be low */
+ and_l(~(1<<31), &GPIO_OUT);
+ or_l((1<<31),&GPIO_ENABLE);
+ or_l((1<<31),&GPIO_FUNCTION);
+
+ /* turn off charger by default*/
or_l((1<<23), &GPIO_OUT);
and_l(~(1<<23), &GPIO_ENABLE);
or_l((1<<23), &GPIO_FUNCTION);
+ /* high current charge mode */
+ or_l((1<<15), &GPIO_OUT);
+ or_l((1<<15),&GPIO_ENABLE);
+ or_l((1<<15),&GPIO_FUNCTION);
+
#ifndef BOOTLOADER
/* The boot loader controls the power */
ide_power_enable(true);
@@ -71,8 +85,16 @@ unsigned int power_input_status(void)
unsigned int status = POWER_INPUT_NONE;
/* GPIO46 is AC plug detect (low = AC plugged) */
if (!(GPIO1_READ & (1<<14)))
- status |= POWER_INPUT_MAIN_CHARGER;
-
+ {
+ status |= POWER_INPUT_MAIN_CHARGER;
+ /* tristate GPIO23 to start charging cycle */
+ and_l(~(1<<23), &GPIO_ENABLE);
+ }
+ else
+ {
+ /* drive GPIO23 high to enter LTC1733 shutdown mode */
+ or_l((1<<23), &GPIO_ENABLE);
+ }
return status;
}
@@ -87,20 +109,15 @@ bool charging_state(void)
void ide_power_enable(bool on)
{
- (void)on;
- if (on)
- and_l(~(1<<31),&GPIO_OUT);
+ if (on)
+ and_l(~(1<<18),&GPIO1_OUT);
else
- or_l((1<<31),&GPIO_OUT);
-
- or_l((1<<31),&GPIO_ENABLE);
- or_l((1<<31),&GPIO_FUNCTION);
-
+ or_l((1<<18),&GPIO1_OUT);
}
bool ide_powered(void)
{
- return true;
+ return (GPIO1_OUT & (1<<18))?false:true;
}
void power_off(void)