From de4d2cb86912a0316fbd29d879ef624ccfb19452 Mon Sep 17 00:00:00 2001 From: William Wu Date: Tue, 21 Feb 2017 16:58:22 +0800 Subject: [PATCH] usb: dwc3: add dis_u3_autosuspend_quirk Some xHCI controllers (e.g. Rockchip rk3328 SoC) integrated in DWC3 IP, don't support USB 3.0 autosuspend well, so we need to disable USB 3.0 HUB autosuspend function with a quirk. Change-Id: I72d93837496f875dbcbb16818aa3690017cc1085 Signed-off-by: William Wu --- Documentation/devicetree/bindings/usb/dwc3.txt | 2 ++ drivers/usb/dwc3/core.c | 2 ++ drivers/usb/dwc3/core.h | 2 ++ drivers/usb/dwc3/host.c | 1 + 4 files changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt index 0099e2fbed01..6c376308ac5a 100644 --- a/Documentation/devicetree/bindings/usb/dwc3.txt +++ b/Documentation/devicetree/bindings/usb/dwc3.txt @@ -33,6 +33,8 @@ Optional properties: - snps,tx_de_emphasis_quirk: when set core will set Tx de-emphasis value. - snps,tx_de_emphasis: the value driven to the PHY is controlled by the LTSSM during USB3 Compliance mode. + - snps,dis-u3-autosuspend-quirk: when set USB core driver will disable + USB3 autosuspend function. - snps,dis_u3_susphy_quirk: when set core will disable USB3 suspend phy. - snps,dis_u2_susphy_quirk: when set core will disable USB2 suspend phy. - snps,dis_enblslpm_quirk: when set clears the enblslpm in GUSB2PHYCFG, diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 00eb077e9b51..db5f8e056d29 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -967,6 +967,8 @@ static int dwc3_probe(struct platform_device *pdev) "snps,lfps_filter_quirk"); dwc->rx_detect_poll_quirk = device_property_read_bool(dev, "snps,rx_detect_poll_quirk"); + dwc->dis_u3_autosuspend_quirk = device_property_read_bool(dev, + "snps,dis-u3-autosuspend-quirk"); dwc->dis_u3_susphy_quirk = device_property_read_bool(dev, "snps,dis_u3_susphy_quirk"); dwc->dis_u2_susphy_quirk = device_property_read_bool(dev, diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index d11303373a9b..dff3aed23689 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -804,6 +804,7 @@ struct dwc3_scratchpad_array { * @del_phy_power_chg_quirk: set if we enable delay phy power change quirk * @lfps_filter_quirk: set if we enable LFPS filter quirk * @rx_detect_poll_quirk: set if we enable rx_detect to polling lfps quirk + * @dis_u3_autosuspend_quirk: set if the we disable usb3 autosuspend * @dis_u3_susphy_quirk: set if we disable usb3 suspend phy * @dis_u2_susphy_quirk: set if we disable usb2 suspend phy * @dis_enblslpm_quirk: set if we clear enblslpm in GUSB2PHYCFG, @@ -956,6 +957,7 @@ struct dwc3 { unsigned del_phy_power_chg_quirk:1; unsigned lfps_filter_quirk:1; unsigned rx_detect_poll_quirk:1; + unsigned dis_u3_autosuspend_quirk:1; unsigned dis_u3_susphy_quirk:1; unsigned dis_u2_susphy_quirk:1; unsigned dis_enblslpm_quirk:1; diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c index 971d95163ce6..489ab425e177 100644 --- a/drivers/usb/dwc3/host.c +++ b/drivers/usb/dwc3/host.c @@ -91,6 +91,7 @@ int dwc3_host_init(struct dwc3 *dwc) memset(&pdata, 0, sizeof(pdata)); + pdata.usb3_disable_autosuspend = dwc->dis_u3_autosuspend_quirk; pdata.usb3_lpm_capable = dwc->usb3_lpm_capable; pdata.xhci_slow_suspend = dwc->xhci_slow_suspend_quirk; -- 2.34.1