From 1b69499a303aeecba46d8b7565d7bdcad9ec6c75 Mon Sep 17 00:00:00 2001 From: William Wu Date: Mon, 4 Nov 2019 11:19:06 +0800 Subject: [PATCH] usb: dwc3: support option to disable usb3 host autosuspend 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: I33d4d2ec86102653bfb043eed12bfb6b5b426823 Signed-off-by: William Wu --- drivers/usb/dwc3/core.c | 2 ++ drivers/usb/dwc3/core.h | 2 ++ drivers/usb/dwc3/host.c | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 2f401d577eb7..8e01b27114d6 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1296,6 +1296,8 @@ static void dwc3_get_properties(struct dwc3 *dwc) "snps,xhci-slow-suspend-quirk"); dwc->xhci_trb_ent_quirk = device_property_read_bool(dev, "snps,xhci-trb-ent-quirk"); + dwc->dis_u3_autosuspend_quirk = device_property_read_bool(dev, + "snps,dis-u3-autosuspend-quirk"); dwc->tx_de_emphasis_quirk = device_property_read_bool(dev, "snps,tx_de_emphasis_quirk"); diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 733fa3640833..1b301a9a529d 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -1029,6 +1029,7 @@ struct dwc3_scratchpad_array { * @xhci_trb_ent_quirk: set if need to enable the Evaluate Next TRB(ENT) flag in the TRB data structure to force xHC to pre-fetch the next TRB of a TD. + * @dis_u3_autosuspend_quirk: set if the we want to disable usb3 autosuspend * @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk * @tx_de_emphasis: Tx de-emphasis value * 0 - -6dB de-emphasis @@ -1219,6 +1220,7 @@ struct dwc3 { unsigned dis_tx_ipgap_linecheck_quirk:1; unsigned xhci_slow_suspend_quirk:1; unsigned xhci_trb_ent_quirk:1; + unsigned dis_u3_autosuspend_quirk:1; unsigned tx_de_emphasis_quirk:1; unsigned tx_de_emphasis:2; diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c index 31b5cf0246f2..1c78576ca79a 100644 --- a/drivers/usb/dwc3/host.c +++ b/drivers/usb/dwc3/host.c @@ -46,7 +46,7 @@ out: int dwc3_host_init(struct dwc3 *dwc) { - struct property_entry props[5]; + struct property_entry props[6]; struct platform_device *xhci; int ret, irq; struct resource *res; @@ -102,6 +102,8 @@ int dwc3_host_init(struct dwc3 *dwc) if (dwc->usb2_lpm_disable) props[prop_idx++].name = "usb2-lpm-disable"; + if (dwc->dis_u3_autosuspend_quirk) + props[prop_idx++].name = "usb3-dis-autosuspend"; /** * WORKAROUND: dwc3 revisions <=3.00a have a limitation * where Port Disable command doesn't work.