summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2005-12-06 10:06:40 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2005-12-06 10:06:40 +0000
commit55e9670c702cbb13895c74a3b0ac32122e5b518f (patch)
tree4e3e0602b67eb3ba5c7c38f42ed8895f08959a57
parentc9016f82e02470ea0f282d676742044ff0851e97 (diff)
downloadrockbox-55e9670c702cbb13895c74a3b0ac32122e5b518f.tar.gz
rockbox-55e9670c702cbb13895c74a3b0ac32122e5b518f.zip
USB support for H300
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8167 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/main.c5
-rw-r--r--firmware/usb.c34
2 files changed, 28 insertions, 11 deletions
diff --git a/apps/main.c b/apps/main.c
index a0cab20dd7..7bde823712 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -235,9 +235,7 @@ void init(void)
235 235
236 adc_init(); 236 adc_init();
237 237
238#ifndef IRIVER_H300_SERIES
239 usb_init(); 238 usb_init();
240#endif
241 239
242 backlight_init(); 240 backlight_init();
243 241
@@ -285,7 +283,6 @@ void init(void)
285 panicf("ata: %d", rc); 283 panicf("ata: %d", rc);
286 } 284 }
287 285
288#ifndef IRIVER_H300_SERIES
289 usb_start_monitoring(); 286 usb_start_monitoring();
290 while (usb_detect()) 287 while (usb_detect())
291 { /* enter USB mode early, before trying to mount */ 288 { /* enter USB mode early, before trying to mount */
@@ -302,7 +299,7 @@ void init(void)
302 break; 299 break;
303#endif 300#endif
304 } 301 }
305#endif 302
306 if (!mounted) 303 if (!mounted)
307 { 304 {
308 rc = disk_mount_all(); 305 rc = disk_mount_all();
diff --git a/firmware/usb.c b/firmware/usb.c
index fd92f852ed..8f9de111e4 100644
--- a/firmware/usb.c
+++ b/firmware/usb.c
@@ -136,13 +136,21 @@ static void usb_enable(bool on)
136 if(on) 136 if(on)
137 { 137 {
138 /* Power on the Cypress chip */ 138 /* Power on the Cypress chip */
139 or_l(0x01000000, &GPIO_OUT); 139#ifdef IRIVER_H100_SERIES
140 or_l(0x01000040, &GPIO_OUT);
141#else
142 and_l(~0x00000008,&GPIO1_OUT);
143#endif
140 sleep(2); 144 sleep(2);
141 } 145 }
142 else 146 else
143 { 147 {
144 /* Power off the Cypress chip */ 148 /* Power off the Cypress chip */
145 and_l(~0x01000000, &GPIO_OUT); 149#ifdef IRIVER_H100_SERIES
150 and_l(~0x01000040, &GPIO_OUT);
151#else
152 or_l(0x00000008,&GPIO1_OUT);
153#endif
146 } 154 }
147 155
148#elif defined(USB_IPODSTYLE) 156#elif defined(USB_IPODSTYLE)
@@ -361,7 +369,7 @@ bool usb_detect(void)
361#endif 369#endif
362#ifdef IRIVER_H300 370#ifdef IRIVER_H300
363 /* TODO: add proper code code for H300 USB style */ 371 /* TODO: add proper code code for H300 USB style */
364 current_status = false; 372 current_status = (GPIO1_READ & 0x80)?true:false;
365#endif 373#endif
366#ifdef USB_IPODSTYLE 374#ifdef USB_IPODSTYLE
367 /* TODO: Implement USB_IPODSTYLE */ 375 /* TODO: Implement USB_IPODSTYLE */
@@ -436,11 +444,23 @@ void usb_init(void)
436 countdown = -1; 444 countdown = -1;
437 445
438#ifdef USB_IRIVERSTYLE 446#ifdef USB_IRIVERSTYLE
439 and_l(~0x01000000, &GPIO_OUT); /* GPIO24 is the Cypress chip power */
440 or_l(0x01000000, &GPIO_ENABLE);
441 or_l(0x01000000, &GPIO_FUNCTION);
442
443 or_l(0x00000080, &GPIO1_FUNCTION); /* GPIO39 is the USB detect input */ 447 or_l(0x00000080, &GPIO1_FUNCTION); /* GPIO39 is the USB detect input */
448
449#ifdef IRIVER_H300_SERIES
450 /* ISD300 3.3V ON */
451 or_l(8,&GPIO1_FUNCTION);
452 or_l(8,&GPIO1_OUT);
453 or_l(8,&GPIO1_ENABLE);
454
455 /* Tristate the SCK/SDA to the ISD300 config EEPROM */
456 and_l(~0x03000000, &GPIO_ENABLE);
457 or_l(0x03000000, &GPIO_FUNCTION);
458#else
459 and_l(~0x01000040, &GPIO_OUT); /* GPIO24 is the Cypress chip power */
460 or_l(0x01000040, &GPIO_ENABLE);
461 or_l(0x01000040, &GPIO_FUNCTION);
462#endif
463
444#endif 464#endif
445 465
446 usb_enable(false); 466 usb_enable(false);