From patchwork Thu Apr 27 19:01:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wesley Cheng X-Patchwork-Id: 88367 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp475948vqo; Thu, 27 Apr 2023 12:09:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4fbY9ukVWrU46dXoCZFVHL/mny7nIu4GRv3YYj5Z1tEEufUgHbVRefNj54kiDlImZyXer5 X-Received: by 2002:a17:902:ce85:b0:1a9:baa4:8675 with SMTP id f5-20020a170902ce8500b001a9baa48675mr2735878plg.1.1682622553186; Thu, 27 Apr 2023 12:09:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682622553; cv=none; d=google.com; s=arc-20160816; b=hq0qam+XnSInm8ULUhmbETfLNHB/K81elP+iS+bHSfXhWYlTjXLlSECxmjBoOOd/ky 4UsaZmp+Vb13B9vgPyLyugWDMBkpW5s9mx7kZXX64NjHokeBtXUOFnDq+fYIIM/7lhXD GUEHrEUkPKkEXE54Pk1ALiK2XalH5s0aXnayyo2R4nh/LlGcxej1+NCp5kUCWcFYbfbA a3c3afCqy7nlONSOYrZCuKeq3uugAdUBDxDhcgdZZ5T2YTu8JDBKGvSlNAbV29gap5TG Kus7ayAkTST34qzpBQ+xKVmOFd6PuE+H9UptrSI+VHc2gfgwJB33LkVUzsPHLeo8gJV7 xU/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=MWYCRorc+5qFturYuAgDFOqaOMvMNx+CZjv4+Nmgt+U=; b=QiNf97u6V95Y53Kdijni5T8llAoicoJI/P3+o8hqR+XyXsq2cFUNnCPvGIRBynZTvp 1q9XshKy/tbDJicuhJjpLKcp/E82GnwTSSiMpSOsHRSh9Np5STPJMyIUju6ai7HdxlEk qBxAip9rrWh9hMjYFdd/nOff7M967DOKcXdgv5KbIjQF+xi9rfduGALPGcM/pRuhPKU7 fOfcrAQ5S68JKVO3vusF8+XrFD2BSQkOOyYKohHmWPDz1Hcj9lNWzSyM2LRo3gYPEtL3 85h0V7Lz8rEMDI/xeuDaJAvUhan51gANJ6t3mcpUm1/tRuU8huv/qvGZ/kRShamJ/Dsi JUJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=XtJdvhgF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg13-20020a17090326cd00b001a69195f80csi18689496plb.350.2023.04.27.12.08.36; Thu, 27 Apr 2023 12:09:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=XtJdvhgF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244549AbjD0TCR (ORCPT + 99 others); Thu, 27 Apr 2023 15:02:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244173AbjD0TCO (ORCPT ); Thu, 27 Apr 2023 15:02:14 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5250540F8; Thu, 27 Apr 2023 12:02:13 -0700 (PDT) Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33RGRYXP004680; Thu, 27 Apr 2023 19:01:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=qcppdkim1; bh=MWYCRorc+5qFturYuAgDFOqaOMvMNx+CZjv4+Nmgt+U=; b=XtJdvhgF0XiYweHNOUzKehmkI/W0gSPMUq0I+bW386xPf2qkIOFUIx8mPh+dzuG8WGiv mHOK8BTHqKVFSbZ8Nosceze4f4aFRLXInCVtPkKLx1lnWqlTDg81ip0nS9I1ZGOnw7Nf W5E2ELX1OBCkQ6wn4Dayi6XgF/ztqQjgotIG+3P7Vnx+jqB714y8Zj85qZ27iwh/1WDS 4S+U4yIQbUmdPWHaWoUmqs3qP7pbJwqcrjNMrTHPZAMl7RhzQySoTIZdPpCkL4aAsfDE pRSGuFmpe1c6lyPBcN+tC1zVoESMen8KAUpuUwdC1IwN0O9vkkXWIoym/z2nphMhazU4 uQ== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3q7kux9ta7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Apr 2023 19:01:57 +0000 Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 33RJ1uBe015101 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Apr 2023 19:01:56 GMT Received: from hu-wcheng-lv.qualcomm.com (10.49.16.6) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Thu, 27 Apr 2023 12:01:56 -0700 From: Wesley Cheng To: , CC: , , Wesley Cheng Subject: [PATCH] usb: host: xhci: Avoid XHCI resume delay if SSUSB device is not present Date: Thu, 27 Apr 2023 12:01:45 -0700 Message-ID: <20230427190145.4623-1-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01c.na.qualcomm.com (10.47.97.35) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: KCXQsZmCbDjIOibSInAAH4zMwvegzaf8 X-Proofpoint-GUID: KCXQsZmCbDjIOibSInAAH4zMwvegzaf8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-27_09,2023-04-27_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 malwarescore=0 clxscore=1015 suspectscore=0 priorityscore=1501 spamscore=0 impostorscore=0 mlxlogscore=649 phishscore=0 mlxscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304270166 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764357626321387749?= X-GMAIL-MSGID: =?utf-8?q?1764357626321387749?= There is a 120ms delay implemented for allowing the XHCI host controller to detect a U3 wakeup pulse. The intention is to wait for the device to retry the wakeup event if the USB3 PORTSC doesn't reflect the RESUME link status by the time it is checked. As per the USB3 specification: tU3WakeupRetryDelay ("Table 7-12. LTSSM State Transition Timeouts") This would allow the XHCI resume sequence to determine if the root hub needs to be also resumed. However, in case there is no device connected, or if there is only a HSUSB device connected, this delay would still affect the overall resume timing. Since this delay is solely for detecting U3 wake events (USB3 specific) then ignore this delay for the disconnected case and the HSUSB connected only case. Signed-off-by: Wesley Cheng --- drivers/usb/host/xhci.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 78790dc13c5f..7a86cd683502 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -834,7 +834,8 @@ static bool xhci_pending_portevent(struct xhci_hcd *xhci) while (port_index--) { portsc = readl(ports[port_index]->addr); if (portsc & PORT_CHANGE_MASK || - (portsc & PORT_PLS_MASK) == XDEV_RESUME) + (portsc & PORT_PLS_MASK) == XDEV_RESUME || + !(portsc & PORT_CONNECT)) return true; } return false; @@ -1114,6 +1115,9 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) * Resume roothubs only if there are pending events. * USB 3 devices resend U3 LFPS wake after a 100ms delay if * the first wake signalling failed, give it that chance. + * Avoid this check if there are no devices connected to + * the SS root hub (i.e. HS device connected or no device + * connected) */ pending_portevent = xhci_pending_portevent(xhci); if (!pending_portevent) {