Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp132932pxj; Fri, 7 May 2021 05:29:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJvGNLecorVl7OkytVBoXUlYAZAjVs5Pp68WM3wq2l6dHcFa2iM9mukykoDwqtHD2+BBuV X-Received: by 2002:a17:907:1b02:: with SMTP id mp2mr9663874ejc.196.1620390571468; Fri, 07 May 2021 05:29:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620390571; cv=none; d=google.com; s=arc-20160816; b=xTwGvtyYbUY3jX/Te17Ups/80f/lAf5JezHELc2viqtNraex+Uu7T6PmvA8h9/sJdt 195uZHNdx0uMBQfMhJXygvPAIyqC2dPJChSfG23OkioSMMYBUxWDNr4Yn4tlkCPBU4tQ O43Aed9T4auaijY+b7hrG0QSuR7+lTB0Iau2hErUNNPc6UaT+VzJ2K34VXE7A9wS2GgO vNZDNCfYf9u9ztKO+rEYSzPciFxZVDzSgPyCVoukZMI3fFUC6Lo/6qikovqt46vaGmTR 11vHTPjpMc8ZY7yMUNs0fnSkFfAfNHUooymMxSVnAhdTrvqh7S/HOt2XVRIQ0ko1Dom2 Rj3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=CZlR97WtD5O/v9EZGqclhjQpvhyWRMdOp4m3MMphZ9g=; b=aqGV4E6HnPFZg0xL+8xsoSZDU9cXbwEsNbTAho4NqhN6sn/y7BovMG2M0tJpQEbgTI WZueqdy46wxpzd+uRpUxySDKN6ljz3AwcgZwT9aRD3Fasq4v7zkXU1bQt4PLCPH/EdmY asTmFaZUPtwH4GnEh7hOP/X0kB9jQouUNqT4oymjOkfXQZhQF7vqXr1MhN4ZGM6W151H QmKUOvs/0KCFF2A3Ogv1g/oNl1bW1YJIytNFz4TxwDdzCFiwQ64dXlC7+xl55x1kR4tl mYZy0nJBbVdRU2B7IumY8RlbMY0zhjVs9QCN1M8C8HD9aW17qVX6d5SZI2QXYz6Y88UF DDrQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l13si5016071ejk.483.2021.05.07.05.29.07; Fri, 07 May 2021 05:29:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236724AbhEGJer (ORCPT + 99 others); Fri, 7 May 2021 05:34:47 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:39436 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236292AbhEGJeo (ORCPT ); Fri, 7 May 2021 05:34:44 -0400 Received: from 61-220-137-37.hinet-ip.hinet.net ([61.220.137.37] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lewrd-0002Vw-VH; Fri, 07 May 2021 09:33:42 +0000 From: chris.chiu@canonical.com To: stern@rowland.harvard.edu, gregkh@linuxfoundation.org, m.v.b@runbox.com, hadess@hadess.net Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Chris Chiu Subject: [PATCH 1/2] USB: reset-resume the device when PORT_SUSPEND is set but timeout Date: Fri, 7 May 2021 17:33:28 +0800 Message-Id: <20210507093329.895-2-chris.chiu@canonical.com> X-Mailer: git-send-email 2.21.1 (Apple Git-122.3) In-Reply-To: <20210507093329.895-1-chris.chiu@canonical.com> References: <20210507093329.895-1-chris.chiu@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chris Chiu On the Realtek hub of Dell Dock WD19, the port which has wakeup enabled descendants will sometimes timeout when setting PORT_SUSPEND feature. After checking the PORT_SUSPEND bit in wPortStatus, it is already set. However, the hub will fail to activate because the PORT_SUSPEND feature of that port is not cleared during resume. All devices connecting via the port are lost after resume. This commit force reset-resume the device connected to the timeout but suspended port so that the hub will have chance to clear the PORT_SUSPEND feature during resume. Signed-off-by: Chris Chiu --- drivers/usb/core/hub.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index b2bc4b7c4289..18603949a8de 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -3385,6 +3385,21 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg) status = 0; } if (status) { + if (status == -ETIMEDOUT) { + u16 portstatus, portchange; + + status = hub_port_status(hub, port1, &portstatus, + &portchange); + + dev_dbg(&port_dev->dev, + "suspend timeout, status %04x\n", portstatus); + + if (status == 0 && port_is_suspended(hub, portstatus)) { + udev->reset_resume = 1; + goto err_wakeup; + } + } + dev_dbg(&port_dev->dev, "can't suspend, status %d\n", status); /* Try to enable USB3 LTM again */ -- 2.20.1