summaryrefslogtreecommitdiff
path: root/payloads/libpayload/drivers
diff options
context:
space:
mode:
authorYunzhi Li <lyz@rock-chips.com>2015-09-10 11:42:30 +0800
committerPatrick Georgi <pgeorgi@google.com>2015-09-17 14:18:30 +0000
commit87c9f0eaa90253f45c8114fc542ad3a46caa2647 (patch)
tree57d3c64bf681cbbc36cc6e2280d6b5108986577f /payloads/libpayload/drivers
parenta881000cd1d5df26f512e4ce7a1a1a6161a8b636 (diff)
downloadcoreboot-87c9f0eaa90253f45c8114fc542ad3a46caa2647.tar.xz
libpayload: usb: dwc2: check device connect state before enable channel
If the device has already been disconnected then we shouldn't enable host channel to start any transfer, otherwise this channel goes into an odd state the channel is enabled but can not be disabled by set hcchar.chdis=1. So we need check the device connect status before enable channel. BRANCH=None BUG=chrome-os-partner:44534 TEST=None Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: ae3e690b2cd4a9ea8b5766ac873b0e00bf3a23de Original-Change-Id: Ib3ecf486649ca11b302144f9c00a5e88424e90fa Original-Signed-off-by: Yunzhi Li <lyz@rock-chips.com> Original-Reviewed-on: https://chromium-review.googlesource.com/298402 Original-Reviewed-by: Julius Werner <jwerner@chromium.org> Original-Commit-Queue: Lin Huang <hl@rock-chips.com> Original-Tested-by: Lin Huang <hl@rock-chips.com> Original-(cherry picked from commit ea96f947b5304fdde2e0991d23febaeba209dde1) Original-Reviewed-on: https://chromium-review.googlesource.com/299398 Original-Commit-Ready: David Hendricks <dhendrix@chromium.org> Original-Tested-by: David Hendricks <dhendrix@chromium.org> Original-Reviewed-by: David Hendricks <dhendrix@chromium.org> Change-Id: Idf48ffbc4c2794900e09dec6b2e34e33b21f87b4 Reviewed-on: http://review.coreboot.org/11662 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'payloads/libpayload/drivers')
-rw-r--r--payloads/libpayload/drivers/usb/dwc2.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/payloads/libpayload/drivers/usb/dwc2.c b/payloads/libpayload/drivers/usb/dwc2.c
index 0941eb64d1..c51c0e71f0 100644
--- a/payloads/libpayload/drivers/usb/dwc2.c
+++ b/payloads/libpayload/drivers/usb/dwc2.c
@@ -274,6 +274,9 @@ dwc2_do_xfer(endpoint_t *ep, int size, int pid, ep_dir_t dir,
if (do_copy && (dir == EPDIR_OUT))
memcpy(aligned_buf, data_buf, size);
+ if (dwc2_disconnected(ep->dev->controller))
+ return -HCSTAT_DISCONNECTED;
+
writel(hctsiz.d32, &reg->host.hchn[ch_num].hctsizn);
writel((uint32_t)virt_to_bus(aligned_buf),
&reg->host.hchn[ch_num].hcdman);