diff options
author | Jens Arnold <amiconn@rockbox.org> | 2004-11-20 14:17:43 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2004-11-20 14:17:43 +0000 |
commit | 7ebb5d915e3a39003aa2b88d78c450afe0ef8281 (patch) | |
tree | 713461d9c316168bb7c1d5e08482fdfe8c3e6515 /firmware/drivers | |
parent | bdba1d00c07011e97ebee4d36e0f0b49fd8a17d1 (diff) | |
download | rockbox-7ebb5d915e3a39003aa2b88d78c450afe0ef8281.tar.gz rockbox-7ebb5d915e3a39003aa2b88d78c450afe0ef8281.zip |
Moved player ATA power handling to the correct functions
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5449 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/ata.c | 9 | ||||
-rw-r--r-- | firmware/drivers/power.c | 33 |
2 files changed, 33 insertions, 9 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 40d3da2f98..60b6a87488 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c | |||
@@ -1131,15 +1131,6 @@ int ata_init(void) | |||
1131 | or_b(0x02, &PAIORH); /* output for ATA reset */ | 1131 | or_b(0x02, &PAIORH); /* output for ATA reset */ |
1132 | or_b(0x02, &PADRH); /* release ATA reset */ | 1132 | or_b(0x02, &PADRH); /* release ATA reset */ |
1133 | PACR2 &= 0xBFFF; /* GPIO function for PA7 (IDE enable) */ | 1133 | PACR2 &= 0xBFFF; /* GPIO function for PA7 (IDE enable) */ |
1134 | |||
1135 | #ifdef HAVE_LCD_CHARCELLS | ||
1136 | if (read_rom_version() > 451) /* new player: power on the HD */ | ||
1137 | { | ||
1138 | PBCR2 &= ~0x0300; /* Set PB4 (IDE power) to GPIO */ | ||
1139 | or_b(0x10, &PBDRL); /* ... high */ | ||
1140 | or_b(0x10, &PBIORL); /* ... and output */ | ||
1141 | } | ||
1142 | #endif | ||
1143 | #elif defined HAVE_SCF5249 | 1134 | #elif defined HAVE_SCF5249 |
1144 | #endif | 1135 | #endif |
1145 | 1136 | ||
diff --git a/firmware/drivers/power.c b/firmware/drivers/power.c index 3a69b37953..0ef79c8561 100644 --- a/firmware/drivers/power.c +++ b/firmware/drivers/power.c | |||
@@ -117,15 +117,31 @@ void ide_power_enable(bool on) | |||
117 | #ifdef NEEDS_ATA_POWER_ON | 117 | #ifdef NEEDS_ATA_POWER_ON |
118 | if(on) | 118 | if(on) |
119 | { | 119 | { |
120 | #ifdef ATA_POWER_PLAYERSTYLE | ||
121 | if (read_rom_version() > 451) /* new players only */ | ||
122 | { | ||
123 | or_b(0x10, &PBDRL); | ||
124 | touched = true; | ||
125 | } | ||
126 | #else | ||
120 | or_b(0x20, &PADRL); | 127 | or_b(0x20, &PADRL); |
121 | touched = true; | 128 | touched = true; |
129 | #endif | ||
122 | } | 130 | } |
123 | #endif | 131 | #endif |
124 | #ifdef HAVE_ATA_POWER_OFF | 132 | #ifdef HAVE_ATA_POWER_OFF |
125 | if(!on) | 133 | if(!on) |
126 | { | 134 | { |
135 | #ifdef ATA_POWER_PLAYERSTYLE | ||
136 | if (read_rom_version() > 451) /* new players only */ | ||
137 | { | ||
138 | and_b(~0x10, &PBDRL); | ||
139 | touched = true; | ||
140 | } | ||
141 | #else | ||
127 | and_b(~0x20, &PADRL); | 142 | and_b(~0x20, &PADRL); |
128 | touched = true; | 143 | touched = true; |
144 | #endif | ||
129 | } | 145 | } |
130 | #endif | 146 | #endif |
131 | 147 | ||
@@ -133,8 +149,13 @@ void ide_power_enable(bool on) | |||
133 | of other bits on same port, while input and floating high */ | 149 | of other bits on same port, while input and floating high */ |
134 | if (touched) | 150 | if (touched) |
135 | { | 151 | { |
152 | #ifdef ATA_POWER_PLAYERSTYLE | ||
153 | or_b(0x10, &PBIORL); /* PB4 is an output */ | ||
154 | PBCR2 &= ~0x0300; /* GPIO for PB4 */ | ||
155 | #else | ||
136 | or_b(0x20, &PAIORL); /* PA5 is an output */ | 156 | or_b(0x20, &PAIORL); /* PA5 is an output */ |
137 | PACR2 &= 0xFBFF; /* GPIO for PA5 */ | 157 | PACR2 &= 0xFBFF; /* GPIO for PA5 */ |
158 | #endif | ||
138 | } | 159 | } |
139 | } | 160 | } |
140 | #endif /* !HAVE_MMC */ | 161 | #endif /* !HAVE_MMC */ |
@@ -143,10 +164,22 @@ void ide_power_enable(bool on) | |||
143 | bool ide_powered(void) | 164 | bool ide_powered(void) |
144 | { | 165 | { |
145 | #if defined(NEEDS_ATA_POWER_ON) || defined(HAVE_ATA_POWER_OFF) | 166 | #if defined(NEEDS_ATA_POWER_ON) || defined(HAVE_ATA_POWER_OFF) |
167 | #ifdef ATA_POWER_PLAYERSTYLE | ||
168 | if (read_rom_version() > 451) /* new players only */ | ||
169 | { | ||
170 | if ((PBCR2 & 0x0300) || !(PBIOR & 0x0010)) /* not configured for output */ | ||
171 | return false; /* would be floating low, disk off */ | ||
172 | else | ||
173 | return (PBDR & 0x0010) != 0; | ||
174 | } | ||
175 | else | ||
176 | return true; /* old player: always on */ | ||
177 | #else | ||
146 | if ((PACR2 & 0x0400) || !(PAIOR & 0x0020)) /* not configured for output */ | 178 | if ((PACR2 & 0x0400) || !(PAIOR & 0x0020)) /* not configured for output */ |
147 | return true; /* would be floating high, disk on */ | 179 | return true; /* would be floating high, disk on */ |
148 | else | 180 | else |
149 | return (PADR & 0x0020) != 0; | 181 | return (PADR & 0x0020) != 0; |
182 | #endif /* ATA_POWER_PLAYERSTYLE */ | ||
150 | #else | 183 | #else |
151 | return true; /* pretend always powered if not controlable */ | 184 | return true; /* pretend always powered if not controlable */ |
152 | #endif | 185 | #endif |