Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2763338imj; Mon, 11 Feb 2019 08:07:13 -0800 (PST) X-Google-Smtp-Source: AHgI3IaEaaOzbMBTQIfqyWTN0zGTWl1FFcm3O1Kl0agA84TkjFoqtTRZROvnZ03l74SpKk7JoqdT X-Received: by 2002:a63:1e17:: with SMTP id e23mr20347245pge.130.1549901233523; Mon, 11 Feb 2019 08:07:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549901233; cv=none; d=google.com; s=arc-20160816; b=unMsFdKgHHyt8F6vIFZ/CNZ16w8MebOZVVszuB+RzjFAsla0v+PoVb0ZiQXVErY1cF 7LkkR+J6s+Gd92XfUJHdNQDX/fYOsN4XZN460eSsXzAPnVwjL8nOQIPRWDJweB4NjYas SqhFckLbXFbrOAZcCumclJyVHZtLJvLh26T1k+y/DEY2t/ISYc7/q65LVsRYLWF1dn0s 14XDl8PVQaZnbR9j087pjvSDJ3PnB4FbNelUOPwdbtDIiELDDbSAcoSBgfc6WO9zEBPG uJX2FnAtYXpBCKQ958alELeD9JFl0c5H792JhZ6CugCanLM1QBvFxW4qXl+mia/G5pgs 9s6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rzR8jVBlb2REJ0DwgUU3fDIRoq4T4jFUCv5wj6qYpQc=; b=mgJgCgSACcB4CHptmmy2rw+lMW/S9uXM/VhVvybibyuLjeN4VvXFpqOvam+0wmagNE jg0ZMkOsEQcDp4OPuad7gJnUgTc5mQBmjEylMRlFO+oMW6subBjt8RVsEcVYzxA751wg nbTYvZ9JGWM2rNyF2KaqiGXMNUDVb0spPV+LT+nVv09w8tP7tQF7K/xCbjWCV3p2W+wv w1ehZWbGxa50wXraBy2srQ7TLIsHU8z3ftJ24S3kTWbeepDx2O1u4EY9/eGLyQ+w72C9 B7ghBVo3HJ1rxngy2S9n/ASuS89yoJY9W6PzdNKidt4k5Ys8hZZtt+6eFxOnLV7qq8OG dVFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IrIqrRS4; 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 6si2577405pfk.243.2019.02.11.08.06.54; Mon, 11 Feb 2019 08:07:13 -0800 (PST) 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=IrIqrRS4; 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 S1729736AbfBKO1d (ORCPT + 99 others); Mon, 11 Feb 2019 09:27:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:33320 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729718AbfBKO1b (ORCPT ); Mon, 11 Feb 2019 09:27:31 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 540A320821; Mon, 11 Feb 2019 14:27:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895250; bh=lX+pqsNYJf0VlS5WT0545Q+RKspOI5ifikq2ZEsrI3s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IrIqrRS4zjtGy9B2fhkPjdhaoDRQe+W00jGGZue6e2te3bXfkSBTzn8EjwA7iR342 +P/A7vRixqyWkNd5oLP1Z9iMiRjLeGn8b9YCMxvPoOQyjWyqoM2gbBeBFC6wheqMM+ 5ZnP0hKjHaKX7Hopijw8kexK5+spI4j6SctVSsi0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathias Nyman , Alan Stern , Sasha Levin Subject: [PATCH 4.20 113/352] usb: hub: delay hub autosuspend if USB3 port is still link training Date: Mon, 11 Feb 2019 15:15:40 +0100 Message-Id: <20190211141853.016181458@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit e86108940e541febf35813402ff29fa6f4a9ac0b ] When initializing a hub we want to give a USB3 port in link training the same debounce delay time before autosuspening the hub as already trained, connected enabled ports. USB3 ports won't reach the enabled state with "current connect status" and "connect status change" bits set until the USB3 link training finishes. Catching the port in link training (polling) and adding the debounce delay prevents unnecessary failed attempts to autosuspend the hub. Signed-off-by: Mathias Nyman Acked-by: Alan Stern Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/core/hub.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index f76b2e0aba9d..1d1e61e980f3 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1112,6 +1112,16 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) USB_PORT_FEAT_ENABLE); } + /* + * Add debounce if USB3 link is in polling/link training state. + * Link will automatically transition to Enabled state after + * link training completes. + */ + if (hub_is_superspeed(hdev) && + ((portstatus & USB_PORT_STAT_LINK_STATE) == + USB_SS_PORT_LS_POLLING)) + need_debounce_delay = true; + /* Clear status-change flags; we'll debounce later */ if (portchange & USB_PORT_STAT_C_CONNECTION) { need_debounce_delay = true; -- 2.19.1