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=-9.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 51242C169C4 for ; Mon, 11 Feb 2019 15:17:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1A166222A8 for ; Mon, 11 Feb 2019 15:17:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549898243; bh=3lrHqZOb+9X1EkyZMS39gl2bLe7jaaAsKHn2+cT9518=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=dSEPGjWz/ykkhmaeLC7Px2UDzYCeXT397VXJ8KwfvvZ2GeoL5+mATN1S25lAyAdZd VfJLBcWima2/H6ny8XXXY8ob+WfzwCHR7MUX8Nmu7Np+kA7H3iVyHlWkHuTtCZ+wKf vHkW9i2X6bN9SR9Z8ZWNfmQfi/GCwhlef3dUXH4s= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391114AbfBKPGA (ORCPT ); Mon, 11 Feb 2019 10:06:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:55508 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391126AbfBKPGA (ORCPT ); Mon, 11 Feb 2019 10:06:00 -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 3C45E222A7; Mon, 11 Feb 2019 15:05:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897559; bh=3lrHqZOb+9X1EkyZMS39gl2bLe7jaaAsKHn2+cT9518=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gfTUJ13KeNf0+HUw0dcyZFiPU4wJg7AAlJRqizALQS6+9TorkfthQaE0fP18n2+uO bldFr+kulsn+qrJAKGBOOFsRS1mx/ypVLub8W8v+BoZL65O5SUhpR2UN6VtNLw1ryR df1hZoJ7En4jpgb34iY8JSqP5+OBKgwV8JpFUN/U= 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.9 038/137] usb: hub: delay hub autosuspend if USB3 port is still link training Date: Mon, 11 Feb 2019 15:18:39 +0100 Message-Id: <20190211141815.488827334@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141811.964925535@linuxfoundation.org> References: <20190211141811.964925535@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: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 4.9-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 67679f619c3b..7b6919086539 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1108,6 +1108,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