summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2013-08-12 20:40:37 +0300
committerKyösti Mälkki <kyosti.malkki@gmail.com>2013-08-29 18:35:47 +0200
commit24100100181bd770ce0f1181a1770a0808790cde (patch)
treeed9b812999f747902f0294859f98b149848716f9 /src/lib
parentf7381f8cd1cf4307dcccd5728fc11afce3610439 (diff)
downloadcoreboot-24100100181bd770ce0f1181a1770a0808790cde.tar.xz
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>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/usbdebug.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/lib/usbdebug.c b/src/lib/usbdebug.c
index 4a1228f158..c9247881f0 100644
--- a/src/lib/usbdebug.c
+++ b/src/lib/usbdebug.c
@@ -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);
}