it works now, but we don't know why... *sigh* :(
authorBernhard Urban <lewurm@gmx.net>
Fri, 18 Sep 2009 23:14:27 +0000 (01:14 +0200)
committerBernhard Urban <lewurm@gmx.net>
Fri, 18 Sep 2009 23:21:29 +0000 (01:21 +0200)
usb/core/core.h
usb/host/ohci.c

index 50d8d2a0194838afe448b4860ca6f2c5114e770a..d48dea700eef83551b88c339b3447195103b8b88 100644 (file)
@@ -42,8 +42,7 @@
 #include "../../bootmii_ppc.h"
 inline static void wait_ms(int ms)
 {
-       int i=0;
-       for(;i<ms;i++)
+       while(ms--)
                udelay(1000);
 }
 
index 5a0d8a73ec12fb88ebeb3e9011c670a20409d86f..feddfa320fd2ea7ad50e87ab4dc5ef1f0583d959 100644 (file)
@@ -359,12 +359,15 @@ void hcdi_init()
        write32(OHCI0_HC_CONTROL, OHCI_CONTROL_INIT | OHCI_USB_OPER);
 
        /* wake on ConnectStatusChange, matching external hubs */
-       set32(OHCI0_HC_RH_STATUS, RH_HS_DRWE);
+       write32(OHCI0_HC_RH_STATUS, /*RH_HS_DRWE |*/ RH_HS_LPSC);
 
        /* Choose the interrupts we care about now, others later on demand */
        write32(OHCI0_HC_INT_STATUS, ~0);
        write32(OHCI0_HC_INT_ENABLE, OHCI_INTR_INIT);
 
+       //wtf?
+       wait_ms ((read32(OHCI0_HC_RH_DESCRIPTOR_A) >> 23) & 0x1fe);
+
        configure_ports((u8)1);
        irq_restore(cookie);
 
@@ -388,21 +391,23 @@ static void setup_port(u32 reg, u8 from_init)
 {
        u32 port = read32(reg);
        if((port & RH_PS_CCS) && ((port & RH_PS_CSC) || from_init)) {
+               write32(reg, RH_PS_CCS);
                write32(reg, RH_PS_CSC);
 
-               wait_ms(100);
+               wait_ms(200);
 
                /* clear CSC flag, set PES and start port reset (PRS) */
                write32(reg, RH_PS_PES);
+               wait_ms(200);
+               while(!(read32(reg) & RH_PS_PES)) {
+                       printf("fu\n");
+               }
                port = read32(reg);
+               wait_ms(200);
                write32(reg, RH_PS_PRS);
 
                /* spin until port reset is complete */
-               port = read32(reg);
-               while(!(port & RH_PS_PRSC)) {
-                       udelay(1);
-                       port = read32(reg);
-               }
+               while((read32(reg) & RH_PS_PRS));
                printf("loop done\n");
 
                (void) usb_add_device();