summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorJörg Hohensohn <hohensoh@rockbox.org>2003-12-03 01:03:54 +0000
committerJörg Hohensohn <hohensoh@rockbox.org>2003-12-03 01:03:54 +0000
commit44298163ba2afb0d5506b67e163a655c44506295 (patch)
treeae4192b5028f4c140a9e22ec2147eefac208a1c1 /firmware
parent99c218a2724788d78d42217d9a685f2b2163a31b (diff)
downloadrockbox-44298163ba2afb0d5506b67e163a655c44506295.tar.gz
rockbox-44298163ba2afb0d5506b67e163a655c44506295.zip
No more spinning disk while charging flashed FM+V2 (you need the new bootloader to utilize it). ToDo: remove now false voltage reading from charging screen.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4095 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/ata.c6
-rw-r--r--firmware/drivers/power.c42
-rw-r--r--firmware/export/config-fmrecorder.h3
-rw-r--r--firmware/export/config-recorder.h3
-rw-r--r--firmware/export/config-recorderv2.h3
-rw-r--r--firmware/export/power.h1
6 files changed, 50 insertions, 8 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 3c58d1f27c..3f266f2c0b 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -795,6 +795,12 @@ int ata_init(void)
795 ata_enable(true); 795 ata_enable(true);
796 796
797 if ( !initialized ) { 797 if ( !initialized ) {
798 if (!ide_powered()) /* somebody has switched it off */
799 {
800 ide_power_enable(true);
801 sleep(HZ); /* allow voltage to build up */
802 }
803
798 if (coldstart) 804 if (coldstart)
799 { 805 {
800 /* Reset both master and slave, we don't yet know what's in */ 806 /* Reset both master and slave, we don't yet know what's in */
diff --git a/firmware/drivers/power.c b/firmware/drivers/power.c
index 549624fd92..a701d01658 100644
--- a/firmware/drivers/power.c
+++ b/firmware/drivers/power.c
@@ -36,11 +36,6 @@ void power_init(void)
36 or_b(0x20, &PBIORL); /* Set charging control bit to output */ 36 or_b(0x20, &PBIORL); /* Set charging control bit to output */
37 charger_enable(false); /* Default to charger OFF */ 37 charger_enable(false); /* Default to charger OFF */
38#endif 38#endif
39#ifdef HAVE_ATA_POWER_OFF
40 or_b(0x20, &PADRL); /* leave the disk on */
41 or_b(0x20, &PAIORL);
42 PACR2 &= 0xFBFF;
43#endif
44} 39}
45 40
46bool charger_inserted(void) 41bool charger_inserted(void)
@@ -79,16 +74,47 @@ void charger_enable(bool on)
79 74
80void ide_power_enable(bool on) 75void ide_power_enable(bool on)
81{ 76{
82#ifdef HAVE_ATA_POWER_OFF 77 (void)on;
78 bool touched = false;
79
80#ifdef NEEDS_ATA_POWER_ON
83 if(on) 81 if(on)
82 {
84 or_b(0x20, &PADRL); 83 or_b(0x20, &PADRL);
85 else 84 touched = true;
85 }
86#endif
87#ifdef HAVE_ATA_POWER_OFF
88 if(!on)
89 {
86 and_b(~0x20, &PADRL); 90 and_b(~0x20, &PADRL);
91 touched = true;
92 }
93#endif
94
95/* late port preparation, else problems with read/modify/write
96 of other bits on same port, while input and floating high */
97 if (touched)
98 {
99 or_b(0x20, &PAIORL); /* PA5 is an output */
100 PACR2 &= 0xFBFF; /* GPIO for PA5 */
101 }
102}
103
104
105bool ide_powered(void)
106{
107#if defined(NEEDS_ATA_POWER_ON) || defined(HAVE_ATA_POWER_OFF)
108 if ((PACR2 & 0x0400) || !(PAIOR & 0x0020)) // not configured for output
109 return true; // would be floating high, disk on
110 else
111 return (PADR & 0x0020) != 0;
87#else 112#else
88 on = on; 113 return TRUE; /* pretend always powered if not controlable */
89#endif 114#endif
90} 115}
91 116
117
92void power_off(void) 118void power_off(void)
93{ 119{
94 set_irq_level(15); 120 set_irq_level(15);
diff --git a/firmware/export/config-fmrecorder.h b/firmware/export/config-fmrecorder.h
index 7c5d631875..264f9984aa 100644
--- a/firmware/export/config-fmrecorder.h
+++ b/firmware/export/config-fmrecorder.h
@@ -19,6 +19,9 @@
19/* Define this if you have a LiIon battery */ 19/* Define this if you have a LiIon battery */
20#define HAVE_LIION 20#define HAVE_LIION
21 21
22/* Define this if you need to power on ATA */
23#define NEEDS_ATA_POWER_ON
24
22/* Define this to the CPU frequency */ 25/* Define this to the CPU frequency */
23#define CPU_FREQ 11059200 26#define CPU_FREQ 11059200
24 27
diff --git a/firmware/export/config-recorder.h b/firmware/export/config-recorder.h
index f8326a0ead..85b0c392df 100644
--- a/firmware/export/config-recorder.h
+++ b/firmware/export/config-recorder.h
@@ -19,6 +19,9 @@
19/* Define this if you have ATA power-off control */ 19/* Define this if you have ATA power-off control */
20#define HAVE_ATA_POWER_OFF 20#define HAVE_ATA_POWER_OFF
21 21
22/* Define this if you need to power on ATA */
23#define NEEDS_ATA_POWER_ON
24
22/* Define this to the CPU frequency */ 25/* Define this to the CPU frequency */
23#define CPU_FREQ 11059200 26#define CPU_FREQ 11059200
24 27
diff --git a/firmware/export/config-recorderv2.h b/firmware/export/config-recorderv2.h
index 7c5d631875..264f9984aa 100644
--- a/firmware/export/config-recorderv2.h
+++ b/firmware/export/config-recorderv2.h
@@ -19,6 +19,9 @@
19/* Define this if you have a LiIon battery */ 19/* Define this if you have a LiIon battery */
20#define HAVE_LIION 20#define HAVE_LIION
21 21
22/* Define this if you need to power on ATA */
23#define NEEDS_ATA_POWER_ON
24
22/* Define this to the CPU frequency */ 25/* Define this to the CPU frequency */
23#define CPU_FREQ 11059200 26#define CPU_FREQ 11059200
24 27
diff --git a/firmware/export/power.h b/firmware/export/power.h
index 678260ac58..54d8ca1419 100644
--- a/firmware/export/power.h
+++ b/firmware/export/power.h
@@ -27,6 +27,7 @@ void power_init(void);
27bool charger_inserted(void); 27bool charger_inserted(void);
28void charger_enable(bool on); 28void charger_enable(bool on);
29void ide_power_enable(bool on); 29void ide_power_enable(bool on);
30bool ide_powered(void);
30void power_off(void); 31void power_off(void);
31 32
32#endif 33#endif