]> xenbits.xensource.com Git - seabios.git/commitdiff
ehci: Move port power up from ehci_hub_detect() to check_ehci_ports().
authorKevin O'Connor <kevin@koconnor.net>
Wed, 10 Sep 2014 14:02:20 +0000 (10:02 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Wed, 10 Sep 2014 17:33:52 +0000 (13:33 -0400)
Don't perform port power up in the detect code.  Instead do it prior
to calling usb_enumerate().  This makes the code more similar to the
ohci and xhci drivers.  It can also reduce the total boot time when
threads are disabled.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
src/hw/usb-ehci.c

index 76c76e0ba9f1913483bfdd467117d484487ad2a6..4e4cc72982b8c12a5d9ee1250f921804774ef3f7 100644 (file)
@@ -50,18 +50,6 @@ ehci_hub_detect(struct usbhub_s *hub, u32 port)
     u32 *portreg = &cntl->regs->portsc[port];
     u32 portsc = readl(portreg);
 
-    // Power up port.
-    if (!(portsc & PORT_POWER)) {
-        portsc |= PORT_POWER;
-        writel(portreg, portsc);
-        msleep(EHCI_TIME_POSTPOWER);
-    } else {
-        // Port is already powered up, but we don't know how long it
-        // has been powered up, so wait the 20ms.
-        msleep(EHCI_TIME_POSTPOWER);
-    }
-    portsc = readl(portreg);
-
     if (!(portsc & PORT_CONNECT))
         // No device present
         goto doneearly;
@@ -135,7 +123,18 @@ static struct usbhub_op_s ehci_HubOp = {
 static int
 check_ehci_ports(struct usb_ehci_s *cntl)
 {
-    ASSERT32FLAT();
+    // Power up ports.
+    int i;
+    for (i=0; i<cntl->checkports; i++) {
+        u32 *portreg = &cntl->regs->portsc[i];
+        u32 portsc = readl(portreg);
+        if (!(portsc & PORT_POWER)) {
+            portsc |= PORT_POWER;
+            writel(portreg, portsc);
+        }
+    }
+    msleep(EHCI_TIME_POSTPOWER);
+
     struct usbhub_s hub;
     memset(&hub, 0, sizeof(hub));
     hub.cntl = &cntl->usb;