diff options
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/ata.c | 2 | ||||
-rw-r--r-- | firmware/drivers/ata_mmc.c | 19 |
2 files changed, 18 insertions, 3 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 21d97aa939..af6955b2b0 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c @@ -1174,4 +1174,4 @@ int ata_init(void) return 0; } -#endif /* #ifndef HAVE_MMC */
\ No newline at end of file +#endif /* #ifndef HAVE_MMC */ diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c index a3669573e0..7ce1547085 100644 --- a/firmware/drivers/ata_mmc.c +++ b/firmware/drivers/ata_mmc.c @@ -29,6 +29,7 @@ #include "power.h" #include "string.h" #include "hwcompat.h" +#include "adc.h" /* use file for an MMC-based system, FIXME in makefile */ #ifdef HAVE_MMC @@ -257,9 +258,23 @@ int ata_init(void) led(false); - /* ToDo: Port setup */ - // PAIOR |= 0x1680; + /* Port setup */ + PADR |= 0x1600; /* set all the selects high (=inactive) */ + PAIOR |= 0x1600; /* make outputs for them */ + PAIOR &= ~0x0008; /* input for card detect */ + /* serial setup */ + PBCR1 &= ~0x0CF0; /* use PB10, PB11, PB13 */ + PBCR1 |= 0x08A0; /* as RxD1, TxD1, SCK1 */ + + if(adc_read(ADC_MMC_SWITCH) < 0x200) + { /* MMC inserted */ + PADR |= 0x0200; + } + else + { /* no MMC, use internal memory */ + PADR |= 0x0400; + } sleeping = false; ata_enable(true); |