Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2026665imm; Thu, 24 May 2018 04:45:06 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp120RUlu4dGYfflDnR5DAqQ/7s2jRKDbFHtVB/6lVo0GknPS7lOPQm35PEKV8oSSF3DpIG X-Received: by 2002:a17:902:3001:: with SMTP id u1-v6mr7053524plb.376.1527162306446; Thu, 24 May 2018 04:45:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527162306; cv=none; d=google.com; s=arc-20160816; b=HXFOmSsZqbJewID80hPXrjduWEheODVed0eqM+G+IyBSYGh/m1baanyEZftEleENZZ W+kBmLzDvxnxiIHKQuP8zH7oate02URH8JUsLeRqrxqqCzxjbZAlDxbugFOyVkT/nKsg cDivE1WbUlsO261fAVo0BK/BE1Amdwdcbd50jBgW0rIc2GdPajCd+ywg4bt9dqM+jEqK Z16HkPVyeTISYURuJHukVs+KRdWTKgYsxfCMYsDQuCM//cmWRrIBHf+qWtYZ8fpXBpLN PGGCDruXowDnFTe5lA9FpxShmewya/SVk613tm6RKxzg0CdbFP3lIqOU6NrZewO5PiYD WhUQ== 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=gXdlPx+4XiwZ1UiPLugQpb/PEYo0izVrAMclh77DiWU=; b=N6P9l7kCVN46wwf0xDA3QJmwBtg6YEtQm07rVzV5qiCJrJ9IM345oWOufKHD9/9tPI LcNAQkK9/9gKW719OJrOTY91urFdJO2F23d7n5BY46aQnQ9Epkoaz8KLiq4qTKTvwIvW dEDJJOjRFN6eMO6NhPesGK0j449jnhZG+OrzrC8mjNdmQ42hgq8eiiLQcq9QNU6v2T9z 1/E5MUxVGTjWiqHBVIiKTQ30w7Os1dZRdhJMnlAqsxe0e8eQtMAX2nwiNLYNHjWtqwge sYxFCJakZIu0NmWTd1F6jdpKsrD6e2LloTlNSG4u68pthwR2DCjT8qojTWxYRKJrU3qH 22KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Mc6zQ8ei; 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 d65-v6si21559828pfj.243.2018.05.24.04.44.51; Thu, 24 May 2018 04:45:06 -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=Mc6zQ8ei; 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 S969172AbeEXLnC (ORCPT + 99 others); Thu, 24 May 2018 07:43:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:33482 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966483AbeEXJsT (ORCPT ); Thu, 24 May 2018 05:48:19 -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 14664208A2; Thu, 24 May 2018 09:48:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155298; bh=YY3lojLyTau7rkoF1K2tsNj53XpPIURhMMiOEfn8g4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mc6zQ8eifFDKabe1iS6T99hGvVgDwbJ5+XIhj59cLSe/J/Fs4W0Yr5W8pEf+SRNmI iPqmsgt6ob4hvGOow5QurZnZQfRTWVWhh+9HkVjsrQR8GxVv0ildPLk4WY2iaZp/T0 1QSBGMhfxunJDQuDrCs7gqclSd1lWnhohEraGmFo= 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.9 36/96] usb: dwc3: Add SoftReset PHY synchonization delay Date: Thu, 24 May 2018 11:38:19 +0200 Message-Id: <20180524093607.649376350@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093605.602125311@linuxfoundation.org> References: <20180524093605.602125311@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.9-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 @@ -161,7 +161,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); @@ -170,6 +170,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; } /**