adapted setup_port to old, clean state
authortheStack <sebastian.falbesoner@gmail.com>
Fri, 18 Sep 2009 23:52:48 +0000 (01:52 +0200)
committertheStack <sebastian.falbesoner@gmail.com>
Fri, 18 Sep 2009 23:52:48 +0000 (01:52 +0200)
but with our evil return; hack :)

usb/host/ohci.c

index 183f8c03a462d13a593c2dbfd63bf8b9599c8299..ce23376819570408e34841d74ce2d6e87bda0d52 100644 (file)
@@ -391,32 +391,21 @@ 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(200);
+               wait_ms(150);
 
                /* 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");
-                       //write32(reg, RH_PS_PES);
-                       /*
-                       printf("OHCI0_HC_RH_DESCRIPTOR_A:\t0x%08X\n", read32(OHCI0_HC_RH_DESCRIPTOR_A));
-                       printf("OHCI0_HC_RH_DESCRIPTOR_B:\t0x%08X\n", read32(OHCI0_HC_RH_DESCRIPTOR_B));
-                       printf("OHCI0_HC_RH_STATUS:\t\t0x%08X\n", read32(OHCI0_HC_RH_STATUS));
-                       printf("OHCI0_HC_RH_PORT_STATUS_1:\t0x%08X\n", read32(OHCI0_HC_RH_PORT_STATUS_1));
-                       printf("OHCI0_HC_RH_PORT_STATUS_2:\t0x%08X\n", read32(OHCI0_HC_RH_PORT_STATUS_2));
-                       */
                        return;
                }
-               port = read32(reg);
-               wait_ms(200);
+
                write32(reg, RH_PS_PRS);
 
                /* spin until port reset is complete */
-               while((read32(reg) & RH_PS_PRS));
+               while(!(read32(reg) & RH_PS_PRSC)); // hint: it may stuck here
                printf("loop done\n");
 
                (void) usb_add_device();