Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1261268 > unrolled thread
| Started by | Lu Baolu <baolu.lu@linux.intel.com> |
|---|---|
| First post | 2015-11-03 09:20 +0100 |
| Last post | 2015-11-03 09:20 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v2 08/12] usb: xhci: dbc: handle endpoint stall Lu Baolu <baolu.lu@linux.intel.com> - 2015-11-03 09:20 +0100
| From | Lu Baolu <baolu.lu@linux.intel.com> |
|---|---|
| Date | 2015-11-03 09:20 +0100 |
| Subject | [PATCH v2 08/12] usb: xhci: dbc: handle endpoint stall |
| Message-ID | <qqEYV-9k-7@gated-at.bofh.it> |
In case of endpoint stall, software is able to detect the situation
by reading DCCTRL.HIT or DCCTRL.HOT bits. DbC follows the normal USB
framework to handle endpoint stall. When software detects endpoint
stall situation, it should wait until endpoint is recovered before
read or write oprations.
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
drivers/usb/early/xhci-dbc.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/drivers/usb/early/xhci-dbc.c b/drivers/usb/early/xhci-dbc.c
index 8a5a51f..aaf655f 100644
--- a/drivers/usb/early/xhci-dbc.c
+++ b/drivers/usb/early/xhci-dbc.c
@@ -1176,6 +1176,37 @@ static int xdbc_wait_until_dbc_configured(void)
return -ETIMEDOUT;
}
+static int xdbc_wait_until_epstall_cleared(bool read)
+{
+ int timeout = 0;
+
+ if (read) {
+ do {
+ if (!(readl(&xdbcp->xdbc_reg->control) & CTRL_HIT)) {
+ xdbcp->in_ep_state = EP_RUNNING;
+
+ return 0;
+ }
+
+ xdbcp->in_ep_state = EP_HALTED;
+ xdbc_udelay(10);
+ } while (timeout++ < XDBC_LOOPS);
+ } else {
+ do {
+ if (!(readl(&xdbcp->xdbc_reg->control) & CTRL_HOT)) {
+ xdbcp->out_ep_state = EP_RUNNING;
+
+ return 0;
+ }
+
+ xdbcp->out_ep_state = EP_HALTED;
+ xdbc_udelay(10);
+ } while (timeout++ < XDBC_LOOPS);
+ }
+
+ return -ETIMEDOUT;
+}
+
static int xdbc_bulk_transfer(void *data, int size, int loops, bool read)
{
u64 addr;
@@ -1195,6 +1226,11 @@ static int xdbc_bulk_transfer(void *data, int size, int loops, bool read)
return -EPERM;
}
+ if (xdbc_wait_until_epstall_cleared(read)) {
+ xdbc_trace("%s: endpoint not ready\n", __func__);
+ return -EPERM;
+ }
+
ring = (read ? &xdbcp->in_ring : &xdbcp->out_ring);
trb = ring->enqueue;
cycle = ring->cycle_state;
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top | Article view | linux.kernel
csiph-web