diff options
-rw-r--r-- | firmware/drivers/ata_mmc.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c index e88931698c..7bff2046ce 100644 --- a/firmware/drivers/ata_mmc.c +++ b/firmware/drivers/ata_mmc.c | |||
@@ -253,6 +253,11 @@ void ata_enable(bool on) | |||
253 | PBDR |= 0x2000; /* drive PB13 high */ | 253 | PBDR |= 0x2000; /* drive PB13 high */ |
254 | PBIOR |= 0x2000; /* output PB13 */ | 254 | PBIOR |= 0x2000; /* output PB13 */ |
255 | PBIOR &= ~0x0800; /* high impedance for TxD1 GPIO */ | 255 | PBIOR &= ~0x0800; /* high impedance for TxD1 GPIO */ |
256 | PADR |= 0x0680; /* set all the selects+reset high (=inactive) */ | ||
257 | |||
258 | PADR &= ~0x0080; /* assert reset */ | ||
259 | sleep(1); | ||
260 | PADR |= 0x0080; /* de-assert reset */ | ||
256 | } | 261 | } |
257 | } | 262 | } |
258 | 263 | ||
@@ -270,18 +275,18 @@ int ata_init(void) | |||
270 | led(false); | 275 | led(false); |
271 | 276 | ||
272 | /* Port setup */ | 277 | /* Port setup */ |
273 | PADR |= 0x1600; /* set all the selects high (=inactive) */ | 278 | PADR |= 0x0680; /* set all the selects + reset high (=inactive) */ |
274 | PAIOR |= 0x1600; /* make outputs for them */ | 279 | PAIOR |= 0x1680; /* make outputs for them and the PA12 clock gate */ |
275 | 280 | ||
276 | if(adc_read(ADC_MMC_SWITCH) < 0x200) | 281 | if(adc_read(ADC_MMC_SWITCH) < 0x200) |
277 | { /* MMC inserted */ | 282 | { /* MMC inserted */ |
278 | PADR &= ~0x1000; /* clear PA12 */ | 283 | PADR &= ~0x1000; /* clear PA12 */ |
279 | PADR |= 0x0400; /* chip select internal flash */ | 284 | PADR &= ~0x0400; /* chip select internal flash */ |
280 | } | 285 | } |
281 | else | 286 | else |
282 | { /* no MMC, use internal memory */ | 287 | { /* no MMC, use internal memory */ |
283 | PADR |= 0x1000; /* set PA12 */ | 288 | PADR |= 0x1000; /* set PA12 */ |
284 | PADR |= 0x0200; /* chip select external flash */ | 289 | PADR &= ~0x0200; /* chip select external flash */ |
285 | } | 290 | } |
286 | 291 | ||
287 | sleeping = false; | 292 | sleeping = false; |