From 8a18938b39bf5ce85548f103e502161a1443e044 Mon Sep 17 00:00:00 2001 From: Sarah Sharp Date: Tue, 8 May 2012 07:32:03 -0700 Subject: [PATCH] --- yaml --- r: 303996 b: refs/heads/master c: dbc33303e457bc9d9179d628951e6b7c7a3f6056 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/usb/host/xhci-mem.c | 12 ++++++++++++ trunk/drivers/usb/host/xhci.h | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index bf8b5ae2d848..e8b2c598d147 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4b2665418c81c87e7a46df690a443b3d5ac5b088 +refs/heads/master: dbc33303e457bc9d9179d628951e6b7c7a3f6056 diff --git a/trunk/drivers/usb/host/xhci-mem.c b/trunk/drivers/usb/host/xhci-mem.c index 497ed7723e44..ec4338eec826 100644 --- a/trunk/drivers/usb/host/xhci-mem.c +++ b/trunk/drivers/usb/host/xhci-mem.c @@ -1815,6 +1815,8 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) xhci->event_ring = NULL; xhci_dbg(xhci, "Freed event ring\n"); + if (xhci->lpm_command) + xhci_free_command(xhci, xhci->lpm_command); xhci->cmd_ring_reserved_trbs = 0; if (xhci->cmd_ring) xhci_ring_free(xhci, xhci->cmd_ring); @@ -2377,6 +2379,16 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) xhci_write_64(xhci, val_64, &xhci->op_regs->cmd_ring); xhci_dbg_cmd_ptrs(xhci); + xhci->lpm_command = xhci_alloc_command(xhci, true, true, flags); + if (!xhci->lpm_command) + goto fail; + + /* Reserve one command ring TRB for disabling LPM. + * Since the USB core grabs the shared usb_bus bandwidth mutex before + * disabling LPM, we only need to reserve one TRB for all devices. + */ + xhci->cmd_ring_reserved_trbs++; + val = xhci_readl(xhci, &xhci->cap_regs->db_off); val &= DBOFF_MASK; xhci_dbg(xhci, "// Doorbell array is located at offset 0x%x" diff --git a/trunk/drivers/usb/host/xhci.h b/trunk/drivers/usb/host/xhci.h index 59248449b254..f5cb7417f231 100644 --- a/trunk/drivers/usb/host/xhci.h +++ b/trunk/drivers/usb/host/xhci.h @@ -1426,6 +1426,8 @@ struct xhci_hcd { /* slot enabling and address device helpers */ struct completion addr_dev; int slot_id; + /* For USB 3.0 LPM enable/disable. */ + struct xhci_command *lpm_command; /* Internal mirror of the HW's dcbaa */ struct xhci_virt_device *devs[MAX_HC_SLOTS]; /* For keeping track of bandwidth domains per roothub. */