From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A5F2C4724C for ; Fri, 1 May 2020 13:38:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 207582495A for ; Fri, 1 May 2020 13:38:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588340285; bh=utsCfuWAYLZpKVlPrFWY0Hxq69c7Gb7mBIKGNiK+O94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=S6Zq9krwToYFSTN99DflWT392IjmDJDHjlnx7mbEZ98FPNu/YA06XzRo4SzDwjv17 Wn8Ev2SMsV53oqQ3gLoXMMG3JKcy7QSZ/IxQpk0jDKURcDDatIvhuvWZEYJXuSAE3w 7OSAaT1rdt99b7sMZBCUcWtM5VLGgkTuhAy4ecMs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731022AbgEANiE (ORCPT ); Fri, 1 May 2020 09:38:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:37332 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731000AbgEANh6 (ORCPT ); Fri, 1 May 2020 09:37:58 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 0B96C2495E; Fri, 1 May 2020 13:37:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588340277; bh=utsCfuWAYLZpKVlPrFWY0Hxq69c7Gb7mBIKGNiK+O94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SG0XHYdwFuRZ27L1TgovFIqDWYkZqPs7Wjpif1nXYtDc9TKllBqc1zGaGAY4IKAud RXFe8JBTqLRO5UOGj+ub3K/U2QpJqbtunUvF2xpo3+ASn9hNV2YgjivAeuWVEyq+IY zlc69TuE2tSfIpEApl5TmLkeJnCc3vvcX9ydA/xY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thinh Nguyen , Felipe Balbi Subject: [PATCH 5.4 05/83] usb: dwc3: gadget: Do link recovery for SS and SSP Date: Fri, 1 May 2020 15:22:44 +0200 Message-Id: <20200501131525.450506908@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200501131524.004332640@linuxfoundation.org> References: <20200501131524.004332640@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thinh Nguyen commit d0550cd20e52558ecf6847a0f96ebd5d944c17e4 upstream. The controller always supports link recovery for device in SS and SSP. Remove the speed limit check. Also, when the device is in RESUME or RESET state, it means the controller received the resume/reset request. The driver must send the link recovery to acknowledge the request. They are valid states for the driver to send link recovery. Fixes: 72246da40f37 ("usb: Introduce DesignWare USB3 DRD Driver") Fixes: ee5cd41c9117 ("usb: dwc3: Update speed checks for SuperSpeedPlus") Signed-off-by: Thinh Nguyen Signed-off-by: Felipe Balbi Signed-off-by: Greg Kroah-Hartman --- drivers/usb/dwc3/gadget.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1725,7 +1725,6 @@ static int __dwc3_gadget_wakeup(struct d u32 reg; u8 link_state; - u8 speed; /* * According to the Databook Remote wakeup request should @@ -1735,16 +1734,13 @@ static int __dwc3_gadget_wakeup(struct d */ reg = dwc3_readl(dwc->regs, DWC3_DSTS); - speed = reg & DWC3_DSTS_CONNECTSPD; - if ((speed == DWC3_DSTS_SUPERSPEED) || - (speed == DWC3_DSTS_SUPERSPEED_PLUS)) - return 0; - link_state = DWC3_DSTS_USBLNKST(reg); switch (link_state) { + case DWC3_LINK_STATE_RESET: case DWC3_LINK_STATE_RX_DET: /* in HS, means Early Suspend */ case DWC3_LINK_STATE_U3: /* in HS, means SUSPEND */ + case DWC3_LINK_STATE_RESUME: break; default: return -EINVAL;