Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754947AbcK2DNr (ORCPT ); Mon, 28 Nov 2016 22:13:47 -0500 Received: from mail-db5eur01on0076.outbound.protection.outlook.com ([104.47.2.76]:48832 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751758AbcK2DNg (ORCPT ); Mon, 28 Nov 2016 22:13:36 -0500 From: Jerry Huang To: Alan Stern CC: "gregkh@linuxfoundation.org" , Ramneek Mehresh , "julia.lawall@lip6.fr" , Sriram Dash , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH v3] fsl/usb: Workarourd for USB erratum-A005697 Thread-Topic: [PATCH v3] fsl/usb: Workarourd for USB erratum-A005697 Thread-Index: AQHSSVBmlsx/rhiz00Gg6hHYkceTSqDujauAgAC8i8A= Date: Tue, 29 Nov 2016 03:13:32 +0000 Message-ID: References: <1480320310-9511-1-git-send-email-jerry.huang@nxp.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=jerry.huang@nxp.com; x-originating-ip: [192.158.241.86] x-microsoft-exchange-diagnostics: 1;DB5PR0401MB1734;7:UCbnSRy2+vuKM2h3nbCN73NuRxn+ztgC+SMnEXhQdutZ2+lgsf8WTsQKxvh2VcHJodBHmocsRkJah3DelSnqnRBokUZjqBPZUaBo4s7vgZQqAbtxcTvtwDMSdLVY+9dNSnjTQsTq3sWN3cLOui0ewavG84u7/I9pQeRhWGdyN/9SvJyOvfccybONtbBa4fc/xIO2fOf+YjSgnrHTOpAOJDSzlS5P3a5U2/URZCFKJ+thBxlv6G80PMDU5cUaKhpdUsUqK+YvNPkRxFfXaxp87q4G5OjNwsGICakPbUD6b95ogtl1dgtnf0Pg17yShQ+hhPxVIHC8ZqwfiGLM27LFwfNj+eSGCJB6YOLUEGWifFk= x-forefront-antispam-report: SFV:SKI;SCL:-1SFV:NSPM;SFS:(10009020)(6009001)(7916002)(377454003)(189002)(199003)(24454002)(13464003)(3660700001)(39450400002)(92566002)(38730400001)(8936002)(305945005)(68736007)(6916009)(86362001)(229853002)(76576001)(33656002)(4326007)(81156014)(74316002)(9686002)(101416001)(7696004)(2900100001)(110136003)(77096006)(2906002)(7846002)(8676002)(106116001)(105586002)(54356999)(76176999)(551934003)(81166006)(122556002)(39400400001)(6506003)(6116002)(106356001)(50986999)(189998001)(39380400001)(7736002)(97736004)(3280700002)(2950100002)(66066001)(102836003)(5660300001)(3846002)(2171001)(39410400001);DIR:OUT;SFP:1101;SCL:1;SRVR:DB5PR0401MB1734;H:DB5PR0401MB1813.eurprd04.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; x-ms-office365-filtering-correlation-id: 84c5ff0e-f239-4088-1430-08d41805b308 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:DB5PR0401MB1734; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(9452136761055)(185117386973197)(35762410373642); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6060326)(6045199)(6040361)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026)(6061324)(6046074)(6041248)(20161123555025)(20161123564025)(20161123560025)(20161123562025);SRVR:DB5PR0401MB1734;BCL:0;PCL:0;RULEID:;SRVR:DB5PR0401MB1734; x-forefront-prvs: 01415BB535 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2016 03:13:32.2916 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR0401MB1734 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id uAT3Dr56025309 Content-Length: 2691 Lines: 72 Thanks a lot, Alan. That is my fault, will fix it and send one new version. Best Regards Jerry Huang -----Original Message----- From: Alan Stern [mailto:stern@rowland.harvard.edu] Sent: Monday, November 28, 2016 11:58 PM To: Jerry Huang Cc: gregkh@linuxfoundation.org; Ramneek Mehresh ; julia.lawall@lip6.fr; Sriram Dash ; linux-usb@vger.kernel.org; linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] fsl/usb: Workarourd for USB erratum-A005697 On Mon, 28 Nov 2016, Changming Huang wrote: > The EHCI specification states the following in the SUSP bit description: > In the Suspend state, the port is sensitive to resume detection. > Note that the bit status does not change until the port is suspended > and that there may be a delay in suspending a port if there is a > transaction currently in progress on the USB. > > However, in NXP USBDR controller, the PORTSCx[SUSP] bit changes > immediately when the application sets it and not when the port is actually suspended. > > So the application must wait for at least 10 milliseconds after a port > indicates that it is suspended, to make sure this port has entered > suspended state before initiating this port resume using the Force > Port Resume bit. This bit is for NXP controller, not EHCI compatible. > > Signed-off-by: Changming Huang > Signed-off-by: Ramneek Mehresh > --- > Changes in v3: > - add 10ms delay in function ehci_hub_control > - fix typos > Changes in v2: > - move sleep out of spin-lock > - add more comment for this workaround > --- a/drivers/usb/host/ehci-hub.c > +++ b/drivers/usb/host/ehci-hub.c > @@ -310,6 +310,14 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) > } > spin_unlock_irq(&ehci->lock); > > + if (changed && ehci_has_fsl_susp_errata(ehci)) > + /* > + * Wait for at least 10 millisecondes to ensure the controller > + * enter the suspend status before initiating a port resume > + * using the Force Port Resume bit (Not-EHCI compatible). > + */ > + usleep_range(10000, 20000); > + > if ((changed && ehci->has_tdi_phy_lpm) || fs_idle_delay) { > /* > * Wait for HCD to enter low-power mode or for the bus @@ -1200,6 > +1208,9 @@ int ehci_hub_control( > wIndex, (temp1 & HOSTPC_PHCD) ? > "succeeded" : "failed"); > } > + if (ehci_has_fsl_susp_errata(ehci)) > + /* 10ms for HCD enter suspend */ > + usleep_range(10000, 20000); > set_bit(wIndex, &ehci->suspended_ports); > break; Just like before, you have to release the spinlock before sleeping. Look at the code 10 lines above this. Alan Stern