summaryrefslogtreecommitdiff
path: root/firmware/usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/usb.c')
-rw-r--r--firmware/usb.c60
1 files changed, 3 insertions, 57 deletions
diff --git a/firmware/usb.c b/firmware/usb.c
index ce9d1ce69f..f83cb44e17 100644
--- a/firmware/usb.c
+++ b/firmware/usb.c
@@ -175,23 +175,6 @@ void usb_enable(bool on)
175 or_l(0x00000008,&GPIO1_OUT); 175 or_l(0x00000008,&GPIO1_OUT);
176#endif 176#endif
177 } 177 }
178
179#elif defined(USB_IPODSTYLE)
180 /* For the ipod, we can only do one thing with USB mode - reboot
181 into Apple's flash-based disk-mode. This does not return. */
182 if (on)
183 {
184 /* The following code is copied from ipodlinux */
185#if defined(IPOD_COLOR) || defined(IPOD_3G) || \
186 defined(IPOD_4G) || defined(IPOD_MINI)
187 unsigned char* storage_ptr = (unsigned char *)0x40017F00;
188#elif defined(IPOD_NANO) || defined(IPOD_VIDEO) || defined(IPOD_MINI2G)
189 unsigned char* storage_ptr = (unsigned char *)0x4001FF00;
190#endif
191 memcpy(storage_ptr, "diskmode\0\0hotstuff\0\0\1", 21);
192 DEV_RS |= 4; /* Reboot */
193 }
194
195#elif defined(USB_ISP1582) 178#elif defined(USB_ISP1582)
196 /* TODO: Implement USB_ISP1582 */ 179 /* TODO: Implement USB_ISP1582 */
197 (void) on; 180 (void) on;
@@ -496,7 +479,9 @@ void usb_init(void)
496 usb_monitor_enabled = false; 479 usb_monitor_enabled = false;
497 countdown = -1; 480 countdown = -1;
498 481
499#ifdef USB_IRIVERSTYLE 482#ifdef TARGET_TREE
483 usb_init_device();
484#elif defined USB_IRIVERSTYLE
500 or_l(0x00000080, &GPIO1_FUNCTION); /* GPIO39 is the USB detect input */ 485 or_l(0x00000080, &GPIO1_FUNCTION); /* GPIO39 is the USB detect input */
501 486
502#ifdef IRIVER_H300_SERIES 487#ifdef IRIVER_H300_SERIES
@@ -514,45 +499,6 @@ void usb_init(void)
514 or_l(0x01000040, &GPIO_FUNCTION); 499 or_l(0x01000040, &GPIO_FUNCTION);
515#endif 500#endif
516 501
517#elif defined(USB_IPODSTYLE)
518 int r0;
519 outl(inl(0x70000084) | 0x200, 0x70000084);
520
521 outl(inl(0x7000002C) | 0x3000000, 0x7000002C);
522 outl(inl(0x6000600C) | 0x400000, 0x6000600C);
523
524 outl(inl(0x60006004) | 0x400000, 0x60006004); /* reset usb start */
525 outl(inl(0x60006004) & ~0x400000, 0x60006004); /* reset usb end */
526
527 outl(inl(0x70000020) | 0x80000000, 0x70000020);
528 while ((inl(0x70000028) & 0x80) == 0);
529
530 outl(inl(0xc5000184) | 0x100, 0xc5000184);
531 while ((inl(0xc5000184) & 0x100) != 0);
532
533 outl(inl(0xc50001A4) | 0x5F000000, 0xc50001A4);
534 if ((inl(0xc50001A4) & 0x100) == 0) {
535 outl(inl(0xc50001A8) & ~0x3, 0xc50001A8);
536 outl(inl(0xc50001A8) | 0x2, 0xc50001A8);
537 outl(inl(0x70000028) | 0x4000, 0x70000028);
538 outl(inl(0x70000028) | 0x2, 0x70000028);
539 } else {
540 outl(inl(0xc50001A8) | 0x3, 0xc50001A8);
541 outl(inl(0x70000028) &~0x4000, 0x70000028);
542 outl(inl(0x70000028) | 0x2, 0x70000028);
543 }
544 outl(inl(0xc5000140) | 0x2, 0xc5000140);
545 while((inl(0xc5000140) & 0x2) != 0);
546 r0 = inl(0xc5000184);
547
548 /* Note from IPL source (referring to next 5 lines of code:
549 THIS NEEDS TO BE CHANGED ONCE THERE IS KERNEL USB */
550 outl(inl(0x70000020) | 0x80000000, 0x70000020);
551 outl(inl(0x6000600C) | 0x400000, 0x6000600C);
552 while ((inl(0x70000028) & 0x80) == 0);
553 outl(inl(0x70000028) | 0x2, 0x70000028);
554
555 udelay(0x186A0);
556#endif 502#endif
557 503
558 usb_enable(false); 504 usb_enable(false);