diff options
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/ata_mmc.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c index a29795789d..e88931698c 100644 --- a/firmware/drivers/ata_mmc.c +++ b/firmware/drivers/ata_mmc.c | |||
@@ -242,16 +242,17 @@ int ata_soft_reset(void) | |||
242 | 242 | ||
243 | void ata_enable(bool on) | 243 | void ata_enable(bool on) |
244 | { | 244 | { |
245 | PBCR1 &= ~0x0C00; /* use PB13 as GPIO, if not modified below */ | 245 | PBCR1 &= ~0x0CC0; /* PB13 and TxD1 become GPIOs, if not modified below */ |
246 | if (on) | 246 | if (on) |
247 | { | 247 | { |
248 | /* serial setup */ | 248 | /* serial setup */ |
249 | PBCR1 |= 0x0800; /* as SCK1 */ | 249 | PBCR1 |= 0x0880; /* as SCK1, TxD1 */ |
250 | } | 250 | } |
251 | else | 251 | else |
252 | { | 252 | { |
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 | } | 256 | } |
256 | } | 257 | } |
257 | 258 | ||
@@ -275,10 +276,12 @@ int ata_init(void) | |||
275 | if(adc_read(ADC_MMC_SWITCH) < 0x200) | 276 | if(adc_read(ADC_MMC_SWITCH) < 0x200) |
276 | { /* MMC inserted */ | 277 | { /* MMC inserted */ |
277 | PADR &= ~0x1000; /* clear PA12 */ | 278 | PADR &= ~0x1000; /* clear PA12 */ |
279 | PADR |= 0x0400; /* chip select internal flash */ | ||
278 | } | 280 | } |
279 | else | 281 | else |
280 | { /* no MMC, use internal memory */ | 282 | { /* no MMC, use internal memory */ |
281 | PADR |= 0x1000; /* set PA12 */ | 283 | PADR |= 0x1000; /* set PA12 */ |
284 | PADR |= 0x0200; /* chip select external flash */ | ||
282 | } | 285 | } |
283 | 286 | ||
284 | sleeping = false; | 287 | sleeping = false; |