Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754210AbcK1H43 (ORCPT ); Mon, 28 Nov 2016 02:56:29 -0500 Received: from mail-he1eur01on0062.outbound.protection.outlook.com ([104.47.0.62]:57696 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753849AbcK1H4V (ORCPT ); Mon, 28 Nov 2016 02:56:21 -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 v2] fsl/usb: Workarourd for USB erratum-A005697 Thread-Topic: [PATCH v2] fsl/usb: Workarourd for USB erratum-A005697 Thread-Index: AQHSRs2gXD+2/7OzEUi53r13/5o7sqDpz3WAgAQjDHA= Date: Mon, 28 Nov 2016 06:25:10 +0000 Message-ID: References: <1480044248-6365-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: [199.59.230.102] x-microsoft-exchange-diagnostics: 1;DB5PR0401MB1925;7:z26JdU2Y8Z6VlRXWojfhUFqxRBcNKEa+enBEKPUMrYRax+dP2kf7G7qAML61miKOQvIOsvo12z8r1V6B1X0lKvA7eEL3S4Ux4nYxmz/oXm8LLtU6jc6bSMudxoHSuOCfkVdwCmWlrPfggyahfYXdRzH03Nx7U7b2JBIklsQMG6hqEd66pinaXBGR2j5dXl5kDLZHL5eLOjmb9SRITD/b7uXjYbFrcs/5zrHG58Mhe8Jgfuq/oCrY8Fe6GnRlr8LTUzdG3t8Ipei1DV8JcjjRbh+Bgb3IDzVAoS8qnZgZLCzieTkdd6/M4jDWbpDm1vL/XI4t6FH1+Fko1n45aWeypsX7Y4wJcf6t1NtnX4SvQZA= x-forefront-antispam-report: SFV:SKI;SCL:-1SFV:NSPM;SFS:(10009020)(6009001)(7916002)(24454002)(199003)(13464003)(189002)(377454003)(6506003)(229853002)(110136003)(39450400002)(74316002)(77096006)(39380400001)(39410400001)(8676002)(7696004)(38730400001)(106116001)(7846002)(39400400001)(105586002)(2906002)(305945005)(106356001)(3660700001)(3280700002)(86362001)(2171001)(122556002)(6916009)(7736002)(97736004)(189998001)(2950100002)(4326007)(66066001)(5660300001)(3846002)(54356999)(76176999)(76576001)(8936002)(50986999)(2900100001)(81166006)(81156014)(33656002)(101416001)(9686002)(68736007)(102836003)(551934003)(6116002)(92566002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB5PR0401MB1925;H:DB5PR0401MB1813.eurprd04.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; x-ms-office365-filtering-correlation-id: 566f6941-809d-4daf-d761-08d417574e42 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:DB5PR0401MB1925; 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)(6040361)(6045199)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6061324)(6041248)(6046074)(20161123562025)(20161123560025)(20161123555025)(20161123564025);SRVR:DB5PR0401MB1925;BCL:0;PCL:0;RULEID:;SRVR:DB5PR0401MB1925; x-forefront-prvs: 01401330D1 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: 28 Nov 2016 06:25:10.6868 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR0401MB1925 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 uAS7uYm6022688 Content-Length: 2770 Lines: 81 Thanks a lot, Alan, I will send the v3 with your suggestion. Best Regards Jerry Huang -----Original Message----- From: Alan Stern [mailto:stern@rowland.harvard.edu] Sent: Friday, November 25, 2016 11:14 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 v2] fsl/usb: Workarourd for USB erratum-A005697 On Fri, 25 Nov 2016, Changming Huang wrote: > The EHCI specification states the following in the SUSP bit description: > In the Suspend state, the port is senstive to resume detection. > Note that the bit status does not change untile the port is suspended > and that there may be a delay in susupending 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 > --- > Change in v2: > - move sleep out of spin-lock and add more comment for this workaround This patch is incomplete. > --- a/drivers/usb/host/ehci-hub.c > +++ b/drivers/usb/host/ehci-hub.c > @@ -310,6 +310,13 @@ 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 Fore Port Resume bit (Not-EHCI compatible). > + */ The proper style for multi-line comments is: /* * Wait for ... * ... */ Also, "Force" is misspelled. > + 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 The patch does not change the code around line 1190 in the original file: /* After above check the port must be connected. * Set appropriate bit thus could put phy into low power * mode if we have tdi_phy_lpm feature */ temp &= ~PORT_WKCONN_E; temp |= PORT_WKDISC_E | PORT_WKOC_E; ehci_writel(ehci, temp | PORT_SUSPEND, status_reg); This code sets the PORT_SUSPEND bit but does not have a 10-ms delay. You need to add a delay here. Alan Stern