aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/xhci-hcd.c
diff options
context:
space:
mode:
authorSarah Sharp <sarah.a.sharp@linux.intel.com>2009-09-04 13:53:11 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-09-23 09:46:39 -0400
commit5270b951b9cd5e50aea55cb52684a171fb10381c (patch)
tree6833c7ac03e9bf9bad56daef92ee69c7a93fe843 /drivers/usb/host/xhci-hcd.c
parent63a0d9abd18cdcf5a985029c266c6bfe0511768f (diff)
USB: xhci: Refactor input device context setup.
Refactor common code to set up the add and drop flags for the input device context setup. This setup is used before a configure endpoint command for the reset endpoint quirk, and will be used for the command to alloc or free streams rings. 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-hcd.c')
-rw-r--r--drivers/usb/host/xhci-hcd.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/drivers/usb/host/xhci-hcd.c b/drivers/usb/host/xhci-hcd.c
index 3ab9090c22dc..9c985d1245f3 100644
--- a/drivers/usb/host/xhci-hcd.c
+++ b/drivers/usb/host/xhci-hcd.c
@@ -1247,12 +1247,27 @@ void xhci_reset_bandwidth(struct usb_hcd *hcd, struct usb_device *udev)
1247 xhci_zero_in_ctx(xhci, virt_dev); 1247 xhci_zero_in_ctx(xhci, virt_dev);
1248} 1248}
1249 1249
1250static void xhci_setup_input_ctx_for_config_ep(struct xhci_hcd *xhci,
1251 unsigned int slot_id, u32 add_flags, u32 drop_flags)
1252{
1253 struct xhci_input_control_ctx *ctrl_ctx;
1254 ctrl_ctx = xhci_get_input_control_ctx(xhci,
1255 xhci->devs[slot_id]->in_ctx);
1256 ctrl_ctx->add_flags = add_flags;
1257 ctrl_ctx->drop_flags = drop_flags;
1258 xhci_slot_copy(xhci, xhci->devs[slot_id]);
1259 ctrl_ctx->add_flags |= SLOT_FLAG;
1260
1261 xhci_dbg(xhci, "Slot ID %d Input Context:\n", slot_id);
1262 xhci_dbg_ctx(xhci, xhci->devs[slot_id]->in_ctx,
1263 xhci_last_valid_endpoint(add_flags));
1264}
1265
1250void xhci_setup_input_ctx_for_quirk(struct xhci_hcd *xhci, 1266void xhci_setup_input_ctx_for_quirk(struct xhci_hcd *xhci,
1251 unsigned int slot_id, unsigned int ep_index, 1267 unsigned int slot_id, unsigned int ep_index,
1252 struct xhci_dequeue_state *deq_state) 1268 struct xhci_dequeue_state *deq_state)
1253{ 1269{
1254 struct xhci_container_ctx *in_ctx; 1270 struct xhci_container_ctx *in_ctx;
1255 struct xhci_input_control_ctx *ctrl_ctx;
1256 struct xhci_ep_ctx *ep_ctx; 1271 struct xhci_ep_ctx *ep_ctx;
1257 u32 added_ctxs; 1272 u32 added_ctxs;
1258 dma_addr_t addr; 1273 dma_addr_t addr;
@@ -1272,15 +1287,9 @@ void xhci_setup_input_ctx_for_quirk(struct xhci_hcd *xhci,
1272 } 1287 }
1273 ep_ctx->deq = addr | deq_state->new_cycle_state; 1288 ep_ctx->deq = addr | deq_state->new_cycle_state;
1274 1289
1275 xhci_slot_copy(xhci, xhci->devs[slot_id]);
1276
1277 ctrl_ctx = xhci_get_input_control_ctx(xhci, in_ctx);
1278 added_ctxs = xhci_get_endpoint_flag_from_index(ep_index); 1290 added_ctxs = xhci_get_endpoint_flag_from_index(ep_index);
1279 ctrl_ctx->add_flags = added_ctxs | SLOT_FLAG; 1291 xhci_setup_input_ctx_for_config_ep(xhci, slot_id,
1280 ctrl_ctx->drop_flags = added_ctxs; 1292 added_ctxs, added_ctxs);
1281
1282 xhci_dbg(xhci, "Slot ID %d Input Context:\n", slot_id);
1283 xhci_dbg_ctx(xhci, in_ctx, ep_index);
1284} 1293}
1285 1294
1286void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, 1295void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci,