summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/ata_mmc.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c
index 7ce1547085..a29795789d 100644
--- a/firmware/drivers/ata_mmc.c
+++ b/firmware/drivers/ata_mmc.c
@@ -242,7 +242,17 @@ int ata_soft_reset(void)
242 242
243void ata_enable(bool on) 243void ata_enable(bool on)
244{ 244{
245 (void)on; 245 PBCR1 &= ~0x0C00; /* use PB13 as GPIO, if not modified below */
246 if (on)
247 {
248 /* serial setup */
249 PBCR1 |= 0x0800; /* as SCK1 */
250 }
251 else
252 {
253 PBDR |= 0x2000; /* drive PB13 high */
254 PBIOR |= 0x2000; /* output PB13 */
255 }
246} 256}
247 257
248unsigned short* ata_get_identify(void) 258unsigned short* ata_get_identify(void)
@@ -261,19 +271,14 @@ int ata_init(void)
261 /* Port setup */ 271 /* Port setup */
262 PADR |= 0x1600; /* set all the selects high (=inactive) */ 272 PADR |= 0x1600; /* set all the selects high (=inactive) */
263 PAIOR |= 0x1600; /* make outputs for them */ 273 PAIOR |= 0x1600; /* make outputs for them */
264 PAIOR &= ~0x0008; /* input for card detect */
265
266 /* serial setup */
267 PBCR1 &= ~0x0CF0; /* use PB10, PB11, PB13 */
268 PBCR1 |= 0x08A0; /* as RxD1, TxD1, SCK1 */
269 274
270 if(adc_read(ADC_MMC_SWITCH) < 0x200) 275 if(adc_read(ADC_MMC_SWITCH) < 0x200)
271 { /* MMC inserted */ 276 { /* MMC inserted */
272 PADR |= 0x0200; 277 PADR &= ~0x1000; /* clear PA12 */
273 } 278 }
274 else 279 else
275 { /* no MMC, use internal memory */ 280 { /* no MMC, use internal memory */
276 PADR |= 0x0400; 281 PADR |= 0x1000; /* set PA12 */
277 } 282 }
278 283
279 sleeping = false; 284 sleeping = false;