diff options
author | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2010-12-16 13:49:09 -0500 |
---|---|---|
committer | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2011-03-13 21:23:38 -0400 |
commit | 5233630fcdd6f7d415dcbed264031439cab73f9d (patch) | |
tree | f877073953835d8989c83ab8473cf2100b64dd84 | |
parent | 20b67cf51fa606442bb343afad0ee1a393a6afb3 (diff) |
xhci: Change xhci_find_slot_id_by_port() API.
xhci_find_slot_id_by_port() tries to map the port index to the slot ID for
the USB device. In the future, there will be two xHCI roothubs, and their
port indices will overlap. Therefore, xhci_find_slot_id_by_port() will
need to use information in the roothub's usb_hcd structure to map the port
index and roothub speed to the right slot ID.
Add a new parameter to xhci_find_slot_id_by_port(), in order to pass in
the roothub's usb_hcd structure.
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
-rw-r--r-- | drivers/usb/host/xhci-hub.c | 16 | ||||
-rw-r--r-- | drivers/usb/host/xhci-ring.c | 3 | ||||
-rw-r--r-- | drivers/usb/host/xhci.h | 3 |
3 files changed, 14 insertions, 8 deletions
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 4944ba135f9a..4c3788c128df 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
@@ -135,7 +135,8 @@ u32 xhci_port_state_to_neutral(u32 state) | |||
135 | /* | 135 | /* |
136 | * find slot id based on port number. | 136 | * find slot id based on port number. |
137 | */ | 137 | */ |
138 | int xhci_find_slot_id_by_port(struct xhci_hcd *xhci, u16 port) | 138 | int xhci_find_slot_id_by_port(struct usb_hcd *hcd, struct xhci_hcd *xhci, |
139 | u16 port) | ||
139 | { | 140 | { |
140 | int slot_id; | 141 | int slot_id; |
141 | int i; | 142 | int i; |
@@ -349,7 +350,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
349 | 350 | ||
350 | xhci_dbg(xhci, "set port %d resume\n", | 351 | xhci_dbg(xhci, "set port %d resume\n", |
351 | wIndex + 1); | 352 | wIndex + 1); |
352 | slot_id = xhci_find_slot_id_by_port(xhci, | 353 | slot_id = xhci_find_slot_id_by_port(hcd, xhci, |
353 | wIndex + 1); | 354 | wIndex + 1); |
354 | if (!slot_id) { | 355 | if (!slot_id) { |
355 | xhci_dbg(xhci, "slot_id is zero\n"); | 356 | xhci_dbg(xhci, "slot_id is zero\n"); |
@@ -404,7 +405,8 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
404 | goto error; | 405 | goto error; |
405 | } | 406 | } |
406 | 407 | ||
407 | slot_id = xhci_find_slot_id_by_port(xhci, wIndex + 1); | 408 | slot_id = xhci_find_slot_id_by_port(hcd, xhci, |
409 | wIndex + 1); | ||
408 | if (!slot_id) { | 410 | if (!slot_id) { |
409 | xhci_warn(xhci, "slot_id is zero\n"); | 411 | xhci_warn(xhci, "slot_id is zero\n"); |
410 | goto error; | 412 | goto error; |
@@ -498,7 +500,8 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
498 | bus_state->port_c_suspend |= 1 << wIndex; | 500 | bus_state->port_c_suspend |= 1 << wIndex; |
499 | } | 501 | } |
500 | 502 | ||
501 | slot_id = xhci_find_slot_id_by_port(xhci, wIndex + 1); | 503 | slot_id = xhci_find_slot_id_by_port(hcd, xhci, |
504 | wIndex + 1); | ||
502 | if (!slot_id) { | 505 | if (!slot_id) { |
503 | xhci_dbg(xhci, "slot_id is zero\n"); | 506 | xhci_dbg(xhci, "slot_id is zero\n"); |
504 | goto error; | 507 | goto error; |
@@ -632,7 +635,7 @@ int xhci_bus_suspend(struct usb_hcd *hcd) | |||
632 | 635 | ||
633 | if ((t1 & PORT_PE) && !(t1 & PORT_PLS_MASK)) { | 636 | if ((t1 & PORT_PE) && !(t1 & PORT_PLS_MASK)) { |
634 | xhci_dbg(xhci, "port %d not suspended\n", port_index); | 637 | xhci_dbg(xhci, "port %d not suspended\n", port_index); |
635 | slot_id = xhci_find_slot_id_by_port(xhci, | 638 | slot_id = xhci_find_slot_id_by_port(hcd, xhci, |
636 | port_index + 1); | 639 | port_index + 1); |
637 | if (slot_id) { | 640 | if (slot_id) { |
638 | spin_unlock_irqrestore(&xhci->lock, flags); | 641 | spin_unlock_irqrestore(&xhci->lock, flags); |
@@ -748,7 +751,8 @@ int xhci_bus_resume(struct usb_hcd *hcd) | |||
748 | temp |= PORT_LINK_STROBE | XDEV_U0; | 751 | temp |= PORT_LINK_STROBE | XDEV_U0; |
749 | xhci_writel(xhci, temp, port_array[port_index]); | 752 | xhci_writel(xhci, temp, port_array[port_index]); |
750 | } | 753 | } |
751 | slot_id = xhci_find_slot_id_by_port(xhci, port_index + 1); | 754 | slot_id = xhci_find_slot_id_by_port(hcd, |
755 | xhci, port_index + 1); | ||
752 | if (slot_id) | 756 | if (slot_id) |
753 | xhci_ring_device(xhci, slot_id); | 757 | xhci_ring_device(xhci, slot_id); |
754 | } else | 758 | } else |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 7cea2483e593..7fe9aebd3922 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -1213,7 +1213,8 @@ static void handle_port_status(struct xhci_hcd *xhci, | |||
1213 | temp &= ~PORT_PLS_MASK; | 1213 | temp &= ~PORT_PLS_MASK; |
1214 | temp |= PORT_LINK_STROBE | XDEV_U0; | 1214 | temp |= PORT_LINK_STROBE | XDEV_U0; |
1215 | xhci_writel(xhci, temp, port_array[faked_port_index]); | 1215 | xhci_writel(xhci, temp, port_array[faked_port_index]); |
1216 | slot_id = xhci_find_slot_id_by_port(xhci, port_id); | 1216 | slot_id = xhci_find_slot_id_by_port(hcd, xhci, |
1217 | faked_port_index); | ||
1217 | if (!slot_id) { | 1218 | if (!slot_id) { |
1218 | xhci_dbg(xhci, "slot_id is zero\n"); | 1219 | xhci_dbg(xhci, "slot_id is zero\n"); |
1219 | goto cleanup; | 1220 | goto cleanup; |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index c15470eb121a..443d6333f280 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -1533,7 +1533,8 @@ int xhci_bus_resume(struct usb_hcd *hcd); | |||
1533 | #endif /* CONFIG_PM */ | 1533 | #endif /* CONFIG_PM */ |
1534 | 1534 | ||
1535 | u32 xhci_port_state_to_neutral(u32 state); | 1535 | u32 xhci_port_state_to_neutral(u32 state); |
1536 | int xhci_find_slot_id_by_port(struct xhci_hcd *xhci, u16 port); | 1536 | int xhci_find_slot_id_by_port(struct usb_hcd *hcd, struct xhci_hcd *xhci, |
1537 | u16 port); | ||
1537 | void xhci_ring_device(struct xhci_hcd *xhci, int slot_id); | 1538 | void xhci_ring_device(struct xhci_hcd *xhci, int slot_id); |
1538 | 1539 | ||
1539 | /* xHCI contexts */ | 1540 | /* xHCI contexts */ |