From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from fldsmtpe03.verizon.com ([140.108.26.142]:59238 "EHLO fldsmtpe03.verizon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932288AbdDDTe5 (ORCPT ); Tue, 4 Apr 2017 15:34:57 -0400 From: alexander.levin@verizon.com To: "gregkh@linuxfoundation.org" CC: "stable@vger.kernel.org" Subject: [PATCH for 4.9 61/98] usb: dwc3: host: pass quirk-broken-port-ped property for known broken revisions Date: Tue, 4 Apr 2017 19:32:25 +0000 Message-ID: <20170404193158.19041-62-alexander.levin@verizon.com> References: <20170404193158.19041-1-alexander.levin@verizon.com> In-Reply-To: <20170404193158.19041-1-alexander.levin@verizon.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Felipe Balbi [ Upstream commit e42a5dbb8a3d14f5a35bffa3bf7dcb87883f767a ] dwc3 revisions <=3D3.00a have a limitation where Port Disable command doesn't work. Set the quirk-broken-port-ped property for such controllers so XHCI core can do the necessary workaround. [rogerq@ti.com] Updated code from platform data to device property. Signed-off-by: Roger Quadros Signed-off-by: Felipe Balbi Signed-off-by: Sasha Levin --- drivers/usb/dwc3/host.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c index f6533c6..626d87d 100644 --- a/drivers/usb/dwc3/host.c +++ b/drivers/usb/dwc3/host.c @@ -21,11 +21,12 @@ =20 int dwc3_host_init(struct dwc3 *dwc) { - struct property_entry props[2]; + struct property_entry props[3]; struct platform_device *xhci; int ret, irq; struct resource *res; struct platform_device *dwc3_pdev =3D to_platform_device(dwc->dev); + int prop_idx =3D 0; =20 irq =3D platform_get_irq_byname(dwc3_pdev, "host"); if (irq =3D=3D -EPROBE_DEFER) @@ -89,8 +90,22 @@ int dwc3_host_init(struct dwc3 *dwc) =20 memset(props, 0, sizeof(struct property_entry) * ARRAY_SIZE(props)); =20 - if (dwc->usb3_lpm_capable) { - props[0].name =3D "usb3-lpm-capable"; + if (dwc->usb3_lpm_capable) + props[prop_idx++].name =3D "usb3-lpm-capable"; + + /** + * WORKAROUND: dwc3 revisions <=3D3.00a have a limitation + * where Port Disable command doesn't work. + * + * The suggested workaround is that we avoid Port Disable + * completely. + * + * This following flag tells XHCI to do just that. + */ + if (dwc->revision <=3D DWC3_REVISION_300A) + props[prop_idx++].name =3D "quirk-broken-port-ped"; + + if (prop_idx) { ret =3D platform_device_add_properties(xhci, props); if (ret) { dev_err(dwc->dev, "failed to add properties to xHCI\n"); --=20 2.9.3