summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/drivers/ata_mmc.c21
-rw-r--r--firmware/usb.c9
2 files changed, 17 insertions, 13 deletions
diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c
index 7ce1547085..a29795789d 100644
--- a/firmware/drivers/ata_mmc.c
+++ b/firmware/drivers/ata_mmc.c
@@ -242,7 +242,17 @@ int ata_soft_reset(void)
242 242
243void ata_enable(bool on) 243void ata_enable(bool on)
244{ 244{
245 (void)on; 245 PBCR1 &= ~0x0C00; /* use PB13 as GPIO, if not modified below */
246 if (on)
247 {
248 /* serial setup */
249 PBCR1 |= 0x0800; /* as SCK1 */
250 }
251 else
252 {
253 PBDR |= 0x2000; /* drive PB13 high */
254 PBIOR |= 0x2000; /* output PB13 */
255 }
246} 256}
247 257
248unsigned short* ata_get_identify(void) 258unsigned short* ata_get_identify(void)
@@ -261,19 +271,14 @@ int ata_init(void)
261 /* Port setup */ 271 /* Port setup */
262 PADR |= 0x1600; /* set all the selects high (=inactive) */ 272 PADR |= 0x1600; /* set all the selects high (=inactive) */
263 PAIOR |= 0x1600; /* make outputs for them */ 273 PAIOR |= 0x1600; /* make outputs for them */
264 PAIOR &= ~0x0008; /* input for card detect */
265
266 /* serial setup */
267 PBCR1 &= ~0x0CF0; /* use PB10, PB11, PB13 */
268 PBCR1 |= 0x08A0; /* as RxD1, TxD1, SCK1 */
269 274
270 if(adc_read(ADC_MMC_SWITCH) < 0x200) 275 if(adc_read(ADC_MMC_SWITCH) < 0x200)
271 { /* MMC inserted */ 276 { /* MMC inserted */
272 PADR |= 0x0200; 277 PADR &= ~0x1000; /* clear PA12 */
273 } 278 }
274 else 279 else
275 { /* no MMC, use internal memory */ 280 { /* no MMC, use internal memory */
276 PADR |= 0x0400; 281 PADR |= 0x1000; /* set PA12 */
277 } 282 }
278 283
279 sleeping = false; 284 sleeping = false;
diff --git a/firmware/usb.c b/firmware/usb.c
index 6b226bd43b..2adf28a52b 100644
--- a/firmware/usb.c
+++ b/firmware/usb.c
@@ -72,11 +72,6 @@ static bool usb_monitor_enabled;
72 72
73static void usb_enable(bool on) 73static void usb_enable(bool on)
74{ 74{
75#ifdef HAVE_LCD_BITMAP
76 if(read_hw_mask() & USB_ACTIVE_HIGH)
77 on = !on;
78#endif
79
80#ifdef USB_ENABLE_ONDIOSTYLE 75#ifdef USB_ENABLE_ONDIOSTYLE
81 if(on) 76 if(on)
82 { 77 {
@@ -88,6 +83,10 @@ static void usb_enable(bool on)
88 } 83 }
89 or_b(0x20, &PAIORL); /* output for USB enable */ 84 or_b(0x20, &PAIORL); /* output for USB enable */
90#else /* standard HD Jukebox */ 85#else /* standard HD Jukebox */
86#ifdef HAVE_LCD_BITMAP
87 if(read_hw_mask() & USB_ACTIVE_HIGH)
88 on = !on;
89#endif
91 if(on) 90 if(on)
92 { 91 {
93 and_b(~0x04, &PADRH); /* enable USB */ 92 and_b(~0x04, &PADRH); /* enable USB */