Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2724034imj; Mon, 11 Feb 2019 07:32:28 -0800 (PST) X-Google-Smtp-Source: AHgI3IYgawrpoa5WXCDCYdvFTGa6odNRn9A4tGV/bqN9AjPlFz6oCyPcMvBeRouDtvbA4piP4Bf0 X-Received: by 2002:a63:eb02:: with SMTP id t2mr34324421pgh.57.1549899148418; Mon, 11 Feb 2019 07:32:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549899148; cv=none; d=google.com; s=arc-20160816; b=WafqG/MzjWHLpVopojgWKvLnDNSnme1jU1Ei45rJY5HA8hAkYglLfQICOWJyTV1Nk/ rX0i/X05s/G+xV0tAYeu67g/hQEUXrLk2dwgrCbnXUhLPz2441RYzsc5Ui7bhOFgT0pD HO3iYytOzHGdD8K1MovkPvmYeP/RPfnbhDrbcKO8uqeVXgAyc6G1vqrVJ7sMex23N4ZB D2h4O1KifKH+RO5MGQbLC2En1pZzBr01BNUtLWRrzHT/dyeNYJTbTtQt2hT8JJNvTARn fxnHfM+1TEL0Q24mFXYWYcdnkgr14UThlXRJQRyr2C0ahU/F4P5jgTLLfm3T/PQSkAxk mokA== 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=c0vWBMAqN6MyIEIvy7YABw6SC6oFTP8Fl0xBuYsL0eM=; b=FcnJ0WfFkhPBSMMhOwKB8IUtNOgKd4A0K6IFVNGShOgSWQm7K0XJ2svQ9lA6EcGqR7 /cW2X9FaiX2P075RftVyrxy+c4YN0tor5pla0POSrL6BQ72nLIgyXcIsOzFfXITXjFuL 2spBPvRUatyojzKcPGXfVjzIh2pgmJ6pVzGXEZQW875bkjBmo2sE0u5tlGa+RkVvhX2C khE7IybHIwthuAa0c42J6bcXeUp3XtpvyRmAbh/WsfiCFhY+LzLv6wtZNoGiTYFVnSY/ z6HG6ymAW4l52RksMOEi+ZWdooREQq81bFJT90z97tJqvZmUiaD+SOv1RxQ1gUQKzoMi 28Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sL0yD0JW; 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 e40si9357766plb.234.2019.02.11.07.32.11; Mon, 11 Feb 2019 07:32:28 -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=sL0yD0JW; 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 S2389536AbfBKPaB (ORCPT + 99 others); Mon, 11 Feb 2019 10:30:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:44248 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389253AbfBKO4z (ORCPT ); Mon, 11 Feb 2019 09:56:55 -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 D0E76222A1; Mon, 11 Feb 2019 14:56:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897014; bh=usmsxEwHND3VTQqYdDSIJzHse3Q3MqF6x6QAR4ohg3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sL0yD0JWjYeqEmcpHoA2hBldoDFCUNkF1+vEV5hLC1S7lQF0UDECeHLBGy3SbQ39+ 8rrjx9EpmHLc+dv8WDpjumLDbIXLdHt9iVaWDVYYzmpqgCFt4AT2b3e2fLGeg7/bV0 S2jG5V7oWSS3tAvHSYUvj4WTqs8c1GDbsDM6ZBJM= 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.14 063/205] usb: hub: delay hub autosuspend if USB3 port is still link training Date: Mon, 11 Feb 2019 15:17:41 +0100 Message-Id: <20190211141832.917450762@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@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.14-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 a073cb5be013..4a4e666a8e09 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1110,6 +1110,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