summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-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 f927a1bdeb..897f59b8be 100644
--- a/firmware/drivers/ata_mmc.c
+++ b/firmware/drivers/ata_mmc.c
@@ -141,10 +141,12 @@ static void mmc_tick(void);
141 141
142void mmc_select_clock(int card_no) 142void mmc_select_clock(int card_no)
143{ 143{
144 if (card_no == 0) /* internal */ 144 /* set clock gate for external card / reset for internal card if the
145 or_b(0x10, &PADRH); /* set clock gate PA12 CHECKME: mask? */ 145 * MMC clock polarity bit is 0, vice versa if it is 1 */
146 else /* external */ 146 if ((card_no != 0) ^ (read_hw_mask() & MMC_CLOCK_POLARITY))
147 and_b(~0x10, &PADRH); /* clear clock gate PA12 CHECKME: mask?*/ 147 or_b(0x10, &PADRH); /* set clock gate PA12 */
148 else
149 and_b(~0x10, &PADRH); /* clear clock gate PA12 */
148} 150}
149 151
150static int select_card(int card_no) 152static 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 @@
27#define USB_ACTIVE_HIGH 0x0100 27#define USB_ACTIVE_HIGH 0x0100
28#define PR_ACTIVE_HIGH 0x0100 28#define PR_ACTIVE_HIGH 0x0100
29#define LCD_CONTRAST_BIAS 0x0200 29#define LCD_CONTRAST_BIAS 0x0200
30#define MMC_CLOCK_POLARITY 0x0400
30#define TUNER_MODEL 0x0800 31#define TUNER_MODEL 0x0800
31 32
32int read_rom_version(void); 33int 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)
89#ifdef HAVE_MMC 89#ifdef HAVE_MMC
90 mmc_select_clock(mmc_detect() ? 1 : 0); 90 mmc_select_clock(mmc_detect() ? 1 : 0);
91#endif 91#endif
92 if (!(read_hw_mask() & MMC_CLOCK_POLARITY))
93 and_b(~0x20, &PBDRH); /* old circuit needs SCK1 = low while on USB */
92 or_b(0x20, &PADRL); /* enable USB */ 94 or_b(0x20, &PADRL); /* enable USB */
93 and_b(~0x08, &PADRL); /* assert card detect */ 95 and_b(~0x08, &PADRL); /* assert card detect */
94 } 96 }
95 else 97 else
96 { 98 {
99 if (!(read_hw_mask() & MMC_CLOCK_POLARITY))
100 or_b(0x20, &PBDRH); /* reset SCK1 = high for old circuit */
97 and_b(~0x20, &PADRL); /* disable USB */ 101 and_b(~0x20, &PADRL); /* disable USB */
98 or_b(0x08, &PADRL); /* deassert card detect */ 102 or_b(0x08, &PADRL); /* deassert card detect */
99 } 103 }