Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1261286
| From | Lu Baolu <baolu.lu@linux.intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 07/12] usb: xhci: dbc: handle dbc-configured exit |
| Date | 2015-11-03 09:30 +0100 |
| Message-ID | <qqF8B-cW-9@gated-at.bofh.it> (permalink) |
| References | <qqEYV-9k-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
DbC might exit configured state in some cases (refer to 7.6.4.4 in
xHCI spec 1.1). Software needs detect and clear this situation by
clearing DCCTRL.DCR and wait until the DbC configured before read
or write oprations.
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
drivers/usb/early/xhci-dbc.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/usb/early/xhci-dbc.c b/drivers/usb/early/xhci-dbc.c
index f51daa4..8a5a51f 100644
--- a/drivers/usb/early/xhci-dbc.c
+++ b/drivers/usb/early/xhci-dbc.c
@@ -1153,6 +1153,29 @@ static int xdbc_wait_until_bulk_done(struct xdbc_trb *trb, int loops)
return -EIO;
}
+static int xdbc_wait_until_dbc_configured(void)
+{
+ int timeout = 0;
+ u32 reg;
+
+ /* Port exits configured state */
+ reg = readl(&xdbcp->xdbc_reg->control);
+ if (!(reg & CTRL_DRC))
+ return 0;
+
+ /* clear run change bit (RW1C) */
+ writel(reg | CTRL_DRC, &xdbcp->xdbc_reg->control);
+
+ do {
+ if (readl(&xdbcp->xdbc_reg->control) & CTRL_DCR)
+ return 0;
+
+ xdbc_udelay(10);
+ } while (timeout++ < XDBC_LOOPS);
+
+ return -ETIMEDOUT;
+}
+
static int xdbc_bulk_transfer(void *data, int size, int loops, bool read)
{
u64 addr;
@@ -1167,6 +1190,11 @@ static int xdbc_bulk_transfer(void *data, int size, int loops, bool read)
return -EINVAL;
}
+ if (xdbc_wait_until_dbc_configured()) {
+ xdbc_trace("%s: hardware 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 linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 00/12] usb: early: add support for early printk through USB3 debug port Lu Baolu <baolu.lu@linux.intel.com> - 2015-11-03 09:20 +0100
[PATCH v2 02/12] x86: fixmap: add permanent fixmap for xhci debug port Lu Baolu <baolu.lu@linux.intel.com> - 2015-11-03 09:20 +0100
[PATCH v2 11/12] usb: serial: usb_debug: add support for dbc debug device Lu Baolu <baolu.lu@linux.intel.com> - 2015-11-03 09:20 +0100
Re: [PATCH v2 11/12] usb: serial: usb_debug: add support for dbc debug device Johan Hovold <johan@kernel.org> - 2015-11-03 15:20 +0100
[PATCH v2 06/12] usb: xhci: dbc: add bulk out and bulk in interfaces Lu Baolu <baolu.lu@linux.intel.com> - 2015-11-03 09:30 +0100
[PATCH v2 07/12] usb: xhci: dbc: handle dbc-configured exit Lu Baolu <baolu.lu@linux.intel.com> - 2015-11-03 09:30 +0100
[PATCH v2 01/12] usb: xhci: add sysfs file for xHCI debug port Lu Baolu <baolu.lu@linux.intel.com> - 2015-11-03 09:30 +0100
[PATCH v2 10/12] usb: xhci: dbc: add handshake between debug target and host Lu Baolu <baolu.lu@linux.intel.com> - 2015-11-03 09:30 +0100
[PATCH v2 05/12] usb: xhci: dbc: add debug buffer Lu Baolu <baolu.lu@linux.intel.com> - 2015-11-03 09:30 +0100
[PATCH v2 03/12] usb: xhci: dbc: probe and setup xhci debug capability Lu Baolu <baolu.lu@linux.intel.com> - 2015-11-03 09:30 +0100
csiph-web