aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2013-06-06 10:33:39 +0300
committerKyösti Mälkki <kyosti.malkki@gmail.com>2013-08-23 05:04:30 +0200
commit6bfe61d5d15d32d307047eeee8493d0e3ffa42ab (patch)
tree6ba2f21ea91c3d882793ac8f7c2e99a288b6accc /src/lib
parentd79914008abbc3eea4738d702ea7f3256e13327a (diff)
usbdebug: Add compatibility quirk for FX2
This quirk is needed with a DIY debug dongle using obsolete CY7C68013 (aka FX2) USB chips. Old revision of chip requires a SET_CONFIGURATION to be sent, while this is not required in EHCI debug port specs. Change-Id: I4926eb19b7e991d6efeef782682756571ad006b9 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/3386 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/usbdebug.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/lib/usbdebug.c b/src/lib/usbdebug.c
index a5d3c37027..53ba4db53c 100644
--- a/src/lib/usbdebug.c
+++ b/src/lib/usbdebug.c
@@ -411,7 +411,7 @@ static int usbdebug_init_(unsigned ehci_bar, unsigned offset, struct ehci_debug_
u32 cmd, ctrl, status, portsc, hcs_params;
u32 debug_port, new_debug_port = 0, n_ports;
u32 devnum;
- int ret, i;
+ int ret, i, configured;
int loop;
int port_map_tried;
int playtimes = 3;
@@ -569,9 +569,22 @@ try_next_port:
dprintk(BIOS_INFO, "EHCI debug interface enabled.\n");
/* Perform a small write to get the even/odd data state in sync */
+ configured = 0;
+small_write:
ret = dbgp_bulk_write(ehci_debug, USB_DEBUG_DEVNUM, dbgp_desc.bDebugOutEndpoint, "USB\r\n",5);
if (ret < 0) {
dprintk(BIOS_INFO, "dbgp_bulk_write failed: %d\n", ret);
+ if (!configured) {
+ /* Send Set Configure request to device. This is required for FX2
+ (CY7C68013) to transfer from USB state Addressed to Configured,
+ only then endpoints other than 0 are enabled. */
+ if (dbgp_control_msg(ehci_debug, USB_DEBUG_DEVNUM,
+ USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE,
+ USB_REQ_SET_CONFIGURATION, 1, 0, NULL, 0) >= 0) {
+ configured = 1;
+ goto small_write;
+ }
+ }
ret = -9;
goto err;
}