usbdebug: Change debug port scanning

On AMD platforms, setting of USBDEBUG_DEFAULT_PORT=0 tries to scan
all physical ports one after other in incrementing order. To avoid
possible problems with other USB devices, one can select the port
number here and bypass the scan.

Intel platforms can communicate with usbdebug dongle on one
physical port only, and this option makes no difference there.

Change-Id: I45be6cc3aa91b74650eda2d444c9fcad39d58897
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/3872
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@google.com>
This commit is contained in:
Kyösti Mälkki
2013-08-12 20:40:37 +03:00
parent f7381f8cd1
commit 2410010018
12 changed files with 24 additions and 51 deletions

View File

@@ -421,8 +421,13 @@ static int usbdebug_init_(unsigned ehci_bar, unsigned offset, struct ehci_debug_
HC_LENGTH(read32((unsigned long)&ehci_caps->hc_capbase)));
ehci_debug = (struct ehci_dbg_port *)(ehci_bar + offset);
info->ehci_debug = (void *)0;
memset(&info->ep_pipe, 0, sizeof (info->ep_pipe));
if (CONFIG_USBDEBUG_DEFAULT_PORT > 0)
set_debug_port(CONFIG_USBDEBUG_DEFAULT_PORT);
else
set_debug_port(1);
try_next_time:
port_map_tried = 0;
@@ -630,6 +635,7 @@ err:
//return ret;
next_debug_port:
#if CONFIG_USBDEBUG_DEFAULT_PORT==0
port_map_tried |= (1 << (debug_port - 1));
new_debug_port = ((debug_port-1 + 1) % n_ports) + 1;
if (port_map_tried != ((1 << n_ports) - 1)) {
@@ -637,10 +643,15 @@ next_debug_port:
goto try_next_port;
}
if (--playtimes) {
//set_debug_port(new_debug_port);
set_debug_port(debug_port);
set_debug_port(new_debug_port);
goto try_next_time;
}
#else
if (0)
goto try_next_port;
if (--playtimes)
goto try_next_time;
#endif
return -10;
}
@@ -774,7 +785,7 @@ int usbdebug_init(void)
struct ehci_debug_info *dbg_info = dbgp_ehci_info();
#if defined(__PRE_RAM__) || !CONFIG_EARLY_CONSOLE
enable_usbdebug(CONFIG_USBDEBUG_DEFAULT_PORT);
enable_usbdebug(0);
#endif
return usbdebug_init_(CONFIG_EHCI_BAR, CONFIG_EHCI_DEBUG_OFFSET, dbg_info);
}