From 2cf1a895603e538de0276033db8334f51758e881 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Wed, 17 Nov 2004 20:14:43 +0000 Subject: Ondio: adjustments for models with mask bit 2 == 0 (different MMC clock select circuitry) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5421 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/ata_mmc.c | 10 ++++++---- firmware/export/hwcompat.h | 1 + firmware/usb.c | 4 ++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c index f927a1bdeb..897f59b8be 100644 --- a/firmware/drivers/ata_mmc.c +++ b/firmware/drivers/ata_mmc.c @@ -141,10 +141,12 @@ static void mmc_tick(void); void mmc_select_clock(int card_no) { - if (card_no == 0) /* internal */ - or_b(0x10, &PADRH); /* set clock gate PA12 CHECKME: mask? */ - else /* external */ - and_b(~0x10, &PADRH); /* clear clock gate PA12 CHECKME: mask?*/ + /* set clock gate for external card / reset for internal card if the + * MMC clock polarity bit is 0, vice versa if it is 1 */ + if ((card_no != 0) ^ (read_hw_mask() & MMC_CLOCK_POLARITY)) + or_b(0x10, &PADRH); /* set clock gate PA12 */ + else + and_b(~0x10, &PADRH); /* clear clock gate PA12 */ } static int select_card(int card_no) diff --git a/firmware/export/hwcompat.h b/firmware/export/hwcompat.h index 66f29f8b16..01e26df6e0 100644 --- a/firmware/export/hwcompat.h +++ b/firmware/export/hwcompat.h @@ -27,6 +27,7 @@ #define USB_ACTIVE_HIGH 0x0100 #define PR_ACTIVE_HIGH 0x0100 #define LCD_CONTRAST_BIAS 0x0200 +#define MMC_CLOCK_POLARITY 0x0400 #define TUNER_MODEL 0x0800 int read_rom_version(void); diff --git a/firmware/usb.c b/firmware/usb.c index 181b1ead1a..e27c003154 100644 --- a/firmware/usb.c +++ b/firmware/usb.c @@ -89,11 +89,15 @@ static void usb_enable(bool on) #ifdef HAVE_MMC mmc_select_clock(mmc_detect() ? 1 : 0); #endif + if (!(read_hw_mask() & MMC_CLOCK_POLARITY)) + and_b(~0x20, &PBDRH); /* old circuit needs SCK1 = low while on USB */ or_b(0x20, &PADRL); /* enable USB */ and_b(~0x08, &PADRL); /* assert card detect */ } else { + if (!(read_hw_mask() & MMC_CLOCK_POLARITY)) + or_b(0x20, &PBDRH); /* reset SCK1 = high for old circuit */ and_b(~0x20, &PADRL); /* disable USB */ or_b(0x08, &PADRL); /* deassert card detect */ } -- cgit v1.2.3