Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3706334imu; Mon, 28 Jan 2019 09:21:32 -0800 (PST) X-Google-Smtp-Source: ALg8bN7jOIlEhsDgbOLjVSlBE6Y3jwfg7yTTo1nE4z8SLEWMbNAmE0tkP0H8ByDhe5jUpvLsmV1t X-Received: by 2002:a63:2d82:: with SMTP id t124mr20472035pgt.260.1548696092027; Mon, 28 Jan 2019 09:21:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548696091; cv=none; d=google.com; s=arc-20160816; b=vCwQllP1pYUcIiWC5wxpCdam0SnKAPwnTRNI8K6EZON10FiY8Op/RUtKtiC4VHUa6j wLIEbzKoBI7RUpBNvAe8Zu7nvqH+ovGsgeXUmM60KqDbZmZn/C0W8ikK1vLutuuGVaiG jvxFAgDKn8ywkyF8AQHX5FNADuZOnthYRQifivVEAUZ7qqo9UNgbcsAvyPBpe4HdbI0e PyZQ8iqW1pDNxzBdQPuKcsoYg+ChsJjYuDwotYCuMSTJJK7RJ17I/Xxmddc3dpOBRoj4 fW9eXjJI0kCEgMfR1SqEZtRmknUuXT64nFUkxrYRbv5FIc9AarYOBZeJopKYvYSxApLm dSjw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yHqMFTyONCov3algkNtwDMriIjWlpCBuWUVBOwm7dxk=; b=C/7U1Bpf+50pbXjzAbZ37Y7FVvPqJ82kOiywg9A+8FabIbNe/MfA6Ti4x2F6OCJJlY qobWQiofvkPv02FajG+EuJa4O6WZBkKhAIoAuZ6ODWsQp335SHcolYz+ilSGqxi0248O 6ljdpe8GeDskPqAmdbXzKe+ClI7AW8ON5KJneh4M4AQg6M8HrpkEbu1ZpYuViWU+fTd7 j+/WDD7ZCc2qWbIErI2NE/XzVdkSP3nyuqVlluZvZMHsu1+o9ChsOmtJpL9imIwKlv2W 7rjQ3qAfjbmdP84vP4hJJZIY1p0B0Zl0GLJrCFmcEHs5Gl2Rgk3pGa7P4ZQRz+dmUrOv rVwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SLHq6iuW; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o27si33042741pgl.53.2019.01.28.09.21.16; Mon, 28 Jan 2019 09:21:31 -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=SLHq6iuW; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731469AbfA1RUa (ORCPT + 99 others); Mon, 28 Jan 2019 12:20:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:50124 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727723AbfA1QEb (ORCPT ); Mon, 28 Jan 2019 11:04:31 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9488320989; Mon, 28 Jan 2019 16:04:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691470; bh=2NUA2kmq9l4iwo7NSsriWFiWGXC1i1i3UqRyWgSlP2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SLHq6iuWeG6tWX4bPLnPVlOpYtrv2LpQFB/pe1mQQdQTKXlZmdAJdMWzudKXjfWgL EuMUhJXPVdqDQ3V0kiUnKr5CnR2IVcNw0hh6FXDT4C5vEObhcWyL20xbjrgbp7CzwN KXE7ceI7ybQFmU4PC+dQj5NYYV6UfjRQvHiDvmps= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mathias Nyman , Greg Kroah-Hartman , Sasha Levin , linux-usb@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 104/258] usb: hub: delay hub autosuspend if USB3 port is still link training Date: Mon, 28 Jan 2019 10:56:50 -0500 Message-Id: <20190128155924.51521-104-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mathias Nyman [ 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 cc62707c0251..3adff4da2ee1 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1111,6 +1111,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