aboutsummaryrefslogtreecommitdiff
path: root/src/hw
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2014-09-10 10:02:20 -0400
committerKevin O'Connor <kevin@koconnor.net>2014-09-10 13:33:52 -0400
commit5ac31b82a5e66f2f3e5c0b9e770635d090330853 (patch)
tree33a40329d61fd9d052e0ba0e28ee44a1bee2e374 /src/hw
parent7fb82b7891f3e57be1320fcddb62519b8451e261 (diff)
downloadseabios-5ac31b82a5e66f2f3e5c0b9e770635d090330853.zip
seabios-5ac31b82a5e66f2f3e5c0b9e770635d090330853.tar.gz
seabios-5ac31b82a5e66f2f3e5c0b9e770635d090330853.tar.bz2
ehci: Move port power up from ehci_hub_detect() to check_ehci_ports().
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>
Diffstat (limited to 'src/hw')
-rw-r--r--src/hw/usb-ehci.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/hw/usb-ehci.c b/src/hw/usb-ehci.c
index 76c76e0..4e4cc72 100644
--- a/src/hw/usb-ehci.c
+++ b/src/hw/usb-ehci.c
@@ -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;