[coreboot-gerrit] Patch set updated for coreboot: a7088e6 usbdebug: Reduce bus reset delays
Kyösti Mälkki (kyosti.malkki@gmail.com)
gerrit at coreboot.org
Mon Oct 27 22:59:14 CET 2014
Kyösti Mälkki (kyosti.malkki at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3863
-gerrit
commit a7088e67bf60c3fabb7ad72fef2398700ba510c7
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date: Mon Aug 12 21:35:20 2013 +0300
usbdebug: Reduce bus reset delays
According to EHCI specification, host controller software stops
the USB Reset condition by writing PORT_RESET=0. Software then
poll-waits this bit until controller hardware has completed USB
Reset sequence and read returns with PORT_RESET==0.
Change-Id: I6033c4d904c2af9eb16f5f3c1eb825776648cc1d
Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
src/drivers/usb/ehci_debug.c | 48 ++++++++++++++++++--------------------------
1 file changed, 19 insertions(+), 29 deletions(-)
diff --git a/src/drivers/usb/ehci_debug.c b/src/drivers/usb/ehci_debug.c
index acdb34d..800dc76 100644
--- a/src/drivers/usb/ehci_debug.c
+++ b/src/drivers/usb/ehci_debug.c
@@ -365,7 +365,6 @@ int dbgp_control_msg(struct ehci_dbg_port *ehci_debug, unsigned devnum, int requ
static int ehci_reset_port(struct ehci_regs *ehci_regs, int port)
{
u32 portsc;
- u32 delay_time, delay_ms;
int loop;
/* Reset the usb debug port */
@@ -374,39 +373,30 @@ static int ehci_reset_port(struct ehci_regs *ehci_regs, int port)
portsc |= PORT_RESET;
write32((unsigned long)&ehci_regs->port_status[port - 1], portsc);
- delay_ms = HUB_ROOT_RESET_TIME;
- for (delay_time = 0; delay_time < HUB_RESET_TIMEOUT;
- delay_time += delay_ms) {
- dbgp_mdelay(delay_ms);
+ dbgp_mdelay(HUB_ROOT_RESET_TIME);
+ portsc = read32((unsigned long)&ehci_regs->port_status[port - 1]);
+ write32((unsigned long)&ehci_regs->port_status[port - 1],
+ portsc & ~(PORT_RWC_BITS | PORT_RESET));
+
+ loop = 100;
+ do {
+ dbgp_mdelay(1);
portsc = read32((unsigned long)&ehci_regs->port_status[port - 1]);
- if (portsc & PORT_RESET) {
- /* force reset to complete */
- loop = 2;
- write32((unsigned long)&ehci_regs->port_status[port - 1],
- portsc & ~(PORT_RWC_BITS | PORT_RESET));
- do {
- dbgp_mdelay(delay_ms);
- portsc = read32((unsigned long)&ehci_regs->port_status[port - 1]);
- delay_time += delay_ms;
- } while ((portsc & PORT_RESET) && (--loop > 0));
- if (!loop) {
- printk(BIOS_DEBUG, "ehci_reset_port forced done");
- }
- }
+ } while ((portsc & PORT_RESET) && (--loop > 0));
- /* Device went away? */
- if (!(portsc & PORT_CONNECT))
- return -1; //-ENOTCONN;
+ /* Device went away? */
+ if (!(portsc & PORT_CONNECT))
+ return -1; //-ENOTCONN;
- /* bomb out completely if something weird happened */
- if ((portsc & PORT_CSC))
- return -2; //-EINVAL;
+ /* bomb out completely if something weird happened */
+ if ((portsc & PORT_CSC))
+ return -2; //-EINVAL;
+
+ /* If we've finished resetting, then break out of the loop */
+ if (!(portsc & PORT_RESET) && (portsc & PORT_PE))
+ return 0;
- /* If we've finished resetting, then break out of the loop */
- if (!(portsc & PORT_RESET) && (portsc & PORT_PE))
- return 0;
- }
return -3; //-EBUSY;
}
More information about the coreboot-gerrit
mailing list