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: 13225696 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B3CDC77B73 for ; Thu, 27 Apr 2023 19:02:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244525AbjD0TCQ (ORCPT ); Thu, 27 Apr 2023 15:02:16 -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 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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) {