aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/xhci-mem.c
diff options
context:
space:
mode:
authorSarah Sharp <sarah.a.sharp@linux.intel.com>2009-04-27 22:53:42 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-06-16 00:44:48 -0400
commita74588f94655263b96dacbbf14aac0958d8b7409 (patch)
tree0c4a53d0e6aa00fe9226c9c915f22da9171043ad /drivers/usb/host/xhci-mem.c
parent0ebbab37422315a5d0cb29792271085bafdf38c0 (diff)
USB: xhci: Device context array allocation.
Instead of keeping a "frame list" like older host controllers, the xHCI host controller keeps internal representations of the USB devices, with a transfer ring per endpoint. The host controller queues Transfer Request Blocks (TRBs) to the endpoint ring, and then "rings the doorbell" for that device. The host controller processes the transfer, places a transfer completion event on the event ring, and interrupts the system. The device context base address array must be allocated by the xHCI host controller driver, along with the device contexts it points to. Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/xhci-mem.c')
-rw-r--r--drivers/usb/host/xhci-mem.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 7cf15ca854be..be5a05b2021c 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -220,6 +220,12 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
220 dma_pool_destroy(xhci->segment_pool); 220 dma_pool_destroy(xhci->segment_pool);
221 xhci->segment_pool = NULL; 221 xhci->segment_pool = NULL;
222 xhci_dbg(xhci, "Freed segment pool\n"); 222 xhci_dbg(xhci, "Freed segment pool\n");
223 xhci_writel(xhci, 0, &xhci->op_regs->dcbaa_ptr[1]);
224 xhci_writel(xhci, 0, &xhci->op_regs->dcbaa_ptr[0]);
225 if (xhci->dcbaa)
226 pci_free_consistent(pdev, sizeof(*xhci->dcbaa),
227 xhci->dcbaa, xhci->dcbaa->dma);
228 xhci->dcbaa = NULL;
223 xhci->page_size = 0; 229 xhci->page_size = 0;
224 xhci->page_shift = 0; 230 xhci->page_shift = 0;
225} 231}
@@ -263,6 +269,21 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
263 xhci_writel(xhci, val, &xhci->op_regs->config_reg); 269 xhci_writel(xhci, val, &xhci->op_regs->config_reg);
264 270
265 /* 271 /*
272 * Section 5.4.8 - doorbell array must be
273 * "physically contiguous and 64-byte (cache line) aligned".
274 */
275 xhci->dcbaa = pci_alloc_consistent(to_pci_dev(dev),
276 sizeof(*xhci->dcbaa), &dma);
277 if (!xhci->dcbaa)
278 goto fail;
279 memset(xhci->dcbaa, 0, sizeof *(xhci->dcbaa));
280 xhci->dcbaa->dma = dma;
281 xhci_dbg(xhci, "// Setting device context base array address to 0x%x\n",
282 xhci->dcbaa->dma);
283 xhci_writel(xhci, (u32) 0, &xhci->op_regs->dcbaa_ptr[1]);
284 xhci_writel(xhci, dma, &xhci->op_regs->dcbaa_ptr[0]);
285
286 /*
266 * Initialize the ring segment pool. The ring must be a contiguous 287 * Initialize the ring segment pool. The ring must be a contiguous
267 * structure comprised of TRBs. The TRBs must be 16 byte aligned, 288 * structure comprised of TRBs. The TRBs must be 16 byte aligned,
268 * however, the command ring segment needs 64-byte aligned segments, 289 * however, the command ring segment needs 64-byte aligned segments,