From patchwork Sat Apr 10 01:20:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2h1bmZlbmcgWXVuICjkupHmmKXls7Ap?= X-Patchwork-Id: 12195283 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=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=ham 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 49E1CC433ED for ; Sat, 10 Apr 2021 01:30:55 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A7E6F610D1 for ; Sat, 10 Apr 2021 01:30:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A7E6F610D1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=A/dUqNVtG5tL7g/B7idA5ErFEL5uIcfehDvuaMWQX5s=; b=U6tDpb1vx3DGE176nI38cLa/Oc vudMqVIU+2NYGM9H/AA0MvmZjaQT3mSdOJdadUatmz/PmZAwbBCiYjD9oX8jC08o2qkJpOjaVJXB7 FcAlq4a6+YqOP9Y7FgsB9W7o30zjeIo5Elnv84lpW9PF085yidhkpfmIaUx8vmhQf6XME7bNX/TTa iKgo2JARUeC9XeS9GN/xx1tYbCzh9tFxCEG8iK9Hcc5VDRq9A0AP73thl8IrZtc2JTpBrdTczrucP T78VZiqyyThpVZ/JZ+Yu/3H9DBDowiUWF59W/SdAxD0AB51E+u3rHzkS9jqQgGlZYS6060+EaSYCl s+MDDzHQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lV2OT-001srr-HG; Sat, 10 Apr 2021 01:26:37 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lV2JK-001sfK-AF; Sat, 10 Apr 2021 01:22:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-ID:Content-Description:In-Reply-To:References; bh=eSV9W+d2HonQq+QA+as9ZChPqmr9dfCnLH6HIUPh0Xw=; b=3CzVEbR3wsZgCgGKEuMh5L+CJF 5OLyKV5ZxuUz+YeXOmiCdT4zg6HisKi27+O56vJUHh7GyOYu144xV3VttWOejuicn/m36F5S0F4I9 ZyfsucRnph2xr/5Pz8au2IE3X6rzAcxUL5/sg25Fvy//NYloRC9ndcgPQVJ3OVV0UyOyTSIHrSVYi S8x8/H5SDh1ES2cscEuhzvak7yFcEjfUwCxjTA1e4ZzrRNeUqt2DIMMrBxAxxMBFYwJUtaIez9mtc F05oeRYeymUEUmwBPK+PwV2t6WJ9DkHh6QLF3HhSlT+EeIko8ZRrf5mk2PD0zmdxb4YPu5axS9qpH MLC4XtTg==; Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lV2JF-004tXK-06; Sat, 10 Apr 2021 01:21:15 +0000 X-UUID: 43da90498b6d484b9bced8be62dc2da9-20210409 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=eSV9W+d2HonQq+QA+as9ZChPqmr9dfCnLH6HIUPh0Xw=; b=PUseswUG6+OTQcZkAfwYQoesy6+itdjeZ9k9eN+tEkUFVwZwzG9wIEFFXoL9n74aAHhXnzGdhXkVbdFXp4dw2zkrs8gabMfKEn0cRByP5+fE/bxcpB2HkbfU9/jEHw/lHbI706L6Kok1dLwbtSq3VoGBfT8+zqzF2Jrw6zE4H2E=; X-UUID: 43da90498b6d484b9bced8be62dc2da9-20210409 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 339507578; Fri, 09 Apr 2021 18:21:08 -0700 Received: from MTKMBS06N1.mediatek.inc (172.21.101.129) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 9 Apr 2021 18:21:07 -0700 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs06n1.mediatek.inc (172.21.101.129) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 10 Apr 2021 09:21:06 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sat, 10 Apr 2021 09:21:05 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman , Alan Stern CC: Matthias Brugger , Chunfeng Yun , Nishad Kamdar , , , , , Eddie Hung Subject: [PATCH v2] usb: core: reduce power-on-good delay time of root hub Date: Sat, 10 Apr 2021 09:20:45 +0800 Message-ID: <1618017645-12259-1-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210409_182114_477780_2EFECE76 X-CRM114-Status: GOOD ( 12.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Return the exactly delay time given by root hub descriptor, this helps to reduce resume time etc. Due to the root hub descriptor is usually provided by the host controller driver, if there is compatibility for a root hub, we can fix it easily without affect other root hub Acked-by: Alan Stern Signed-off-by: Chunfeng Yun --- v2: remove RFC tag, and add acked-by Alan --- drivers/usb/core/hub.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h index 73f4482d833a..22ea1f4f2d66 100644 --- a/drivers/usb/core/hub.h +++ b/drivers/usb/core/hub.h @@ -148,8 +148,10 @@ static inline unsigned hub_power_on_good_delay(struct usb_hub *hub) { unsigned delay = hub->descriptor->bPwrOn2PwrGood * 2; - /* Wait at least 100 msec for power to become stable */ - return max(delay, 100U); + if (!hub->hdev->parent) /* root hub */ + return delay; + else /* Wait at least 100 msec for power to become stable */ + return max(delay, 100U); } static inline int hub_port_debounce_be_connected(struct usb_hub *hub,