From patchwork Fri Apr 9 02:39:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunfeng Yun X-Patchwork-Id: 12192841 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.7 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, URIBL_BLOCKED,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 07ADAC433ED for ; Fri, 9 Apr 2021 02:41:27 +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 77F70610F7 for ; Fri, 9 Apr 2021 02:41:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 77F70610F7 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=iF2evfvplH297F1GeKJMRMAUce1w9vkNcA6abqd3dds=; b=A6TjfWSKrH6Uy554voblsFrJJp 54Ygr/MsBcD82I1F8lI8Ke3EecEYhLfVHO42wvxB+tFN1dM5ya/vjbePcCQik/tKuYDo9CRL8bi8P EMAj/uXz1btx/Tcl0zLPyUPqvM0EXHucYOzbWfkDSijF4xO73xlkK2UdlDFPVEZmVN6bDa+nVYegI o6dMDMOd0ZCfLJflloxjRPk/sT0OUagcMFYynq6fQUVnsMxcoRhh8T6YPQvjA+hSRbaOhH0zFn4jn XdSLEgLkl7RqbVW4/pIxfDG3ieYXndMrWJjm/8Fjn7Z2L9AqKMBFd0R8+f5YU5ZQc3S+SrNU8FaLq xje60nbQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lUh3U-009jpS-BH; Fri, 09 Apr 2021 02:39:32 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lUh3L-009jn8-BN; Fri, 09 Apr 2021 02:39:26 +0000 X-UUID: de9ea9df03ba498ba503f880c33af9cd-20210408 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=fWLKYaa/BIrdzkg0Wx6g87Kz2erul6CiTtn27H7R8qw=; b=E9LFORheffiq/1CFbNctqhpLuf50b47rBreKPre3TEH+IqQwcHqKG707fLRATiMfAFA7meiJe47xQJ9ImcSF1t0+MgGz2V3D3CCa6uUVvDeqqOiq5zJNRn5IfUAFbL0gYlQFRnXD5NXhn2Zi8uGigtDhC3uV6P/gKtq3xZ6FKMc=; X-UUID: de9ea9df03ba498ba503f880c33af9cd-20210408 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 899141276; Thu, 08 Apr 2021 19:39:12 -0700 Received: from MTKMBS06N2.mediatek.inc (172.21.101.130) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 8 Apr 2021 19:39:11 -0700 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs06n2.mediatek.inc (172.21.101.130) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 9 Apr 2021 10:39:09 +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; Fri, 9 Apr 2021 10:39:08 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman , Alan Stern CC: Matthias Brugger , Chunfeng Yun , Nishad Kamdar , , , , , Eddie Hung Subject: [RFC PATCH] usb: core: reduce power-on-good delay time of root hub Date: Fri, 9 Apr 2021 10:39:07 +0800 Message-ID: <1617935947-24045-1-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty MIME-Version: 1.0 X-TM-SNTS-SMTP: E08103E15D8BA582B180E4E4D7CBAA8F1514BC09414DEEB178647A498EF9A0E32000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210409_033924_620254_387AEA3D X-CRM114-Status: GOOD ( 11.36 ) 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 Signed-off-by: Chunfeng Yun Acked-by: Alan Stern --- 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,