Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1993753imm; Thu, 24 May 2018 04:11:22 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrxQNfH83iC+X7VQFuUhqVefHvuFnkilKcsRymPd+EVLGl8szP30yMi80yKI+O1mLBWCCZx X-Received: by 2002:a62:4c53:: with SMTP id z80-v6mr6840437pfa.181.1527160282605; Thu, 24 May 2018 04:11:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527160282; cv=none; d=google.com; s=arc-20160816; b=Z1Q7zddrd3c9VyycNJN854KUWakQG5YfRFSTAWzlw6pv7ybvAUcsmQMHqKA5KaIWt6 /upHdxVJ0b/XT8JeMOKfFJm9d4URFTFxnOshlamE68uWAwr1BdfwULpIy4mq3jyzRDQ/ qggIP48I96SMJaAVhSS0sjQJe+VA0UsHYDpGZqfEuddM4OJsf8Za6iCVlvGAbXImjgDM S4clLvbTZjfFWNf2a727FWDzeL5IkxMm7WqEQ4Ry6A96qs2ojtloFMMCMTRjyQdKoQV6 WHLF+OOQKRjSnmdnlPWtnfqxS8TuWJI2DlPb0IHjMsrLHPypP0SQxQ7JbBYyFH6y+Dby Wbyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=nV+FYAuRN6N4olWyHeuHwKcVTdZKylrJQOgyqDB/R+g=; b=SPvwED0fXcYBd2VKycvM0a1I17WDBV9I/iTLJ19or6p6p3XWMyBxfDqfX/TYyPSaX9 ecGGDeYd4nNUGbSh2FE6BHF94S97TDLF3hm6B96Jvdu/IdyLg57iwqJ9i+WrptHCFCL7 PbV1ugU08astUAvXphEAJaO00ZUMX2s7iuy+Me0Jeb2oNxzFbIhccXMtWshHiQjRLV3c dCaphgSA82X7fejbA2hMonDw90HkIb0SzweenhfmM8oJcZHkxSmsDcU86jUvdcfSYdxF lKCC57YtKkIt4OnJnZAQYCcGOzYs/bQ4cTK9xdxLoCnC5CepaEjj+REFvWhoTou6SrpU M9ZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1AJoRn0w; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k2-v6si20963129plt.374.2018.05.24.04.11.08; Thu, 24 May 2018 04:11:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1AJoRn0w; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968173AbeEXJy3 (ORCPT + 99 others); Thu, 24 May 2018 05:54:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:34412 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966154AbeEXJyV (ORCPT ); Thu, 24 May 2018 05:54:21 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1943620892; Thu, 24 May 2018 09:54:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155660; bh=WFNL8iDMXN0YZBapSafHQvpXKZ7tK/0XcYu79q1e3Hk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1AJoRn0wzdMwvo6NK9GNRZ3CbwqKf7EFGqGqLoJcTO1MqSTsLfHyU4EGr57tnwf0c Coi/akuFjGohcn+5sKNKaiYu3RTtwfKrOkB+GR2xIga+m7PMYCFesZCCqR5GgqaaCp 8yAqKCDOXNS7VPdtlS5buZg5H20rphbPKTUzw54E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thinh Nguyen , Felipe Balbi , Sasha Levin Subject: [PATCH 4.14 069/165] usb: dwc3: Add SoftReset PHY synchonization delay Date: Thu, 24 May 2018 11:37:55 +0200 Message-Id: <20180524093624.811696897@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093621.979359379@linuxfoundation.org> References: <20180524093621.979359379@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thinh Nguyen [ Upstream commit fab3833338779e1e668bd58d1f76d601657304b8 ] >From DWC_usb31 programming guide section 1.3.2, once DWC3_DCTL_CSFTRST bit is cleared, we must wait at least 50ms before accessing the PHY domain (synchronization delay). Signed-off-by: Thinh Nguyen Signed-off-by: Felipe Balbi Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/usb/dwc3/core.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -243,7 +243,7 @@ static int dwc3_core_soft_reset(struct d do { reg = dwc3_readl(dwc->regs, DWC3_DCTL); if (!(reg & DWC3_DCTL_CSFTRST)) - return 0; + goto done; udelay(1); } while (--retries); @@ -252,6 +252,17 @@ static int dwc3_core_soft_reset(struct d phy_exit(dwc->usb2_generic_phy); return -ETIMEDOUT; + +done: + /* + * For DWC_usb31 controller, once DWC3_DCTL_CSFTRST bit is cleared, + * we must wait at least 50ms before accessing the PHY domain + * (synchronization delay). DWC_usb31 programming guide section 1.3.2. + */ + if (dwc3_is_usb31(dwc)) + msleep(50); + + return 0; } /*