diff options
Diffstat (limited to 'drivers/usb/host/xhci-hub.c')
-rw-r--r-- | drivers/usb/host/xhci-hub.c | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 2732ef660c5c..7b01094d7993 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
@@ -462,6 +462,42 @@ void xhci_test_and_clear_bit(struct xhci_hcd *xhci, __le32 __iomem **port_array, | |||
462 | } | 462 | } |
463 | } | 463 | } |
464 | 464 | ||
465 | /* Updates Link Status for super Speed port */ | ||
466 | static void xhci_hub_report_link_state(u32 *status, u32 status_reg) | ||
467 | { | ||
468 | u32 pls = status_reg & PORT_PLS_MASK; | ||
469 | |||
470 | /* resume state is a xHCI internal state. | ||
471 | * Do not report it to usb core. | ||
472 | */ | ||
473 | if (pls == XDEV_RESUME) | ||
474 | return; | ||
475 | |||
476 | /* When the CAS bit is set then warm reset | ||
477 | * should be performed on port | ||
478 | */ | ||
479 | if (status_reg & PORT_CAS) { | ||
480 | /* The CAS bit can be set while the port is | ||
481 | * in any link state. | ||
482 | * Only roothubs have CAS bit, so we | ||
483 | * pretend to be in compliance mode | ||
484 | * unless we're already in compliance | ||
485 | * or the inactive state. | ||
486 | */ | ||
487 | if (pls != USB_SS_PORT_LS_COMP_MOD && | ||
488 | pls != USB_SS_PORT_LS_SS_INACTIVE) { | ||
489 | pls = USB_SS_PORT_LS_COMP_MOD; | ||
490 | } | ||
491 | /* Return also connection bit - | ||
492 | * hub state machine resets port | ||
493 | * when this bit is set. | ||
494 | */ | ||
495 | pls |= USB_PORT_STAT_CONNECTION; | ||
496 | } | ||
497 | /* update status field */ | ||
498 | *status |= pls; | ||
499 | } | ||
500 | |||
465 | int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | 501 | int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, |
466 | u16 wIndex, char *buf, u16 wLength) | 502 | u16 wIndex, char *buf, u16 wLength) |
467 | { | 503 | { |
@@ -606,13 +642,9 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
606 | else | 642 | else |
607 | status |= USB_PORT_STAT_POWER; | 643 | status |= USB_PORT_STAT_POWER; |
608 | } | 644 | } |
609 | /* Port Link State */ | 645 | /* Update Port Link State for super speed ports*/ |
610 | if (hcd->speed == HCD_USB3) { | 646 | if (hcd->speed == HCD_USB3) { |
611 | /* resume state is a xHCI internal state. | 647 | xhci_hub_report_link_state(&status, temp); |
612 | * Do not report it to usb core. | ||
613 | */ | ||
614 | if ((temp & PORT_PLS_MASK) != XDEV_RESUME) | ||
615 | status |= (temp & PORT_PLS_MASK); | ||
616 | } | 648 | } |
617 | if (bus_state->port_c_suspend & (1 << wIndex)) | 649 | if (bus_state->port_c_suspend & (1 << wIndex)) |
618 | status |= 1 << USB_PORT_FEAT_C_SUSPEND; | 650 | status |= 1 << USB_PORT_FEAT_C_SUSPEND; |