summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2004-11-17 20:14:43 +0000
committerJens Arnold <amiconn@rockbox.org>2004-11-17 20:14:43 +0000
commit2cf1a895603e538de0276033db8334f51758e881 (patch)
tree273b9200161f378ab06fd3da4618d712a4838efd
parent6554417a0d3ccb1ef8a32031588a32c084fd6297 (diff)
downloadrockbox-2cf1a895603e538de0276033db8334f51758e881.zip
rockbox-2cf1a895603e538de0276033db8334f51758e881.tar.gz
rockbox-2cf1a895603e538de0276033db8334f51758e881.tar.bz2
rockbox-2cf1a895603e538de0276033db8334f51758e881.tar.xz
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
-rw-r--r--firmware/drivers/ata_mmc.c10
-rw-r--r--firmware/export/hwcompat.h1
-rw-r--r--firmware/usb.c4
3 files changed, 11 insertions, 4 deletions
diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c
index f927a1b..897f59b 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 66f29f8..01e26df 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 181b1ea..e27c003 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 */
}