Received: by 2002:ab2:2441:0:b0:1f3:1f8c:d0c6 with SMTP id k1csp57289lqe; Wed, 3 Apr 2024 22:16:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXko/5+KeWGoc9N5lRN6ZGJ5K2tkLxAtMRxqcTVc9dK049X6QOhyZu6cx2yheBH0hhvwM3JjsVEkN3Luw9aZN8Hsjkar1eb4luonHBqWw== X-Google-Smtp-Source: AGHT+IGsriOm7DBfJSIpsPni3xE2NXVrFcwnYO8vYBBXWL8+0bjR7SEbBMK32BEd82afnjliaw0v X-Received: by 2002:a2e:b011:0:b0:2d5:bfe4:4ebe with SMTP id y17-20020a2eb011000000b002d5bfe44ebemr1095112ljk.30.1712207788091; Wed, 03 Apr 2024 22:16:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712207788; cv=pass; d=google.com; s=arc-20160816; b=AuwuQY1uV1FA3EYQkA1DfsuSaSwzaio0u5LP87VK+66PAH5HWKmV6CoIrplfJkGJ13 xkt5Vz2eDZhSmcBOudTk/iX+aVAkjlIghLlKnnx3sw+CTVC/J7vbOYjbqDQHGKX2vZVQ 8Sy7Y5/XmCWxMSTmyG3ojvC232O762SNkkjRPJIM4B5OuOLI2PyehsWK3VsgTnOdewDt Wu29YoDKivCdSVdn++RJSMDYF4OL1GL/An6tSZLm7QGvKuybCo1mwoACa4DV6NVFArSN RACROzQ5DpKYVTY2XrUgYeQkGlUQ2IbQ0ib74MT5Gm2NycEflqbusjqj3q+ZLjgqV9Y/ +NGA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=PTV5+DQ7ryKEZGv3mJS+ywNkymvYkqTD/TtVct3tAaE=; fh=rCVsw0ADKhTADdWslfxGcKb2/OuP7S3j40Ot+ZbMR4o=; b=sS/JOLjYgfiQC5kwN8SKHXSqunTnSOFRfTeS/4Qr2isMpF4MhRWdccwe4wlaeAWwQ0 XJsl3T0SDEsQ9tZHKac+lYOGqTSyxODzf3xQ3FOqQz1roQ6R+t/RWMO59bbmtMU8/hNM h/rTAuwBsXrNuNu5FhySXBc1JhTcsTCOz3pR1Mj6Q+FKVW/Cm/1Wi1ZlkzoNHPD1ezIV Da+5QsxGmh8xbcYKcEvNF09or6UruPTtsO3bUbPUz52cegCkfS4t0h7NyvgGmMrNgcRf eayHmXqMtc1upf9//Njzysf3K37jvPHjcWSDZBvg1ik1PUUyujuJZM+oo2f2uDScSekh uVTA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="GJ/1OzUe"; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-130909-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130909-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id kx26-20020a170907775a00b00a47534ea956si7642929ejc.573.2024.04.03.22.16.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 22:16:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130909-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="GJ/1OzUe"; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-130909-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130909-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C534B1F232DE for ; Thu, 4 Apr 2024 05:16:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3DD226A01E; Thu, 4 Apr 2024 05:13:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="GJ/1OzUe" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D563C5F850; Thu, 4 Apr 2024 05:13:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712207631; cv=none; b=VLdWKn1gVC6j+o+yLbnxyTt5loUh3MFIk0fJGrZ4fRuqiEd9Jks0+CVSIf5LtSBDIjn7CJOjCyTWnxTL3CgdbljSHSB2coci6j+EA09olJkvInIdulSiYou01fMAoRDkqkK7I7/9odUz4p+QYui6KKfvdniB7IPVkzGOyJowSQo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712207631; c=relaxed/simple; bh=NNdTGMeI3BKJSbRWKcY6O6EwK/hyTYU9C4WsrkgvkGY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JO2IsOnZ2g0OP5AwVZ5pugknuF/iFft5tUoAt1w36/JPtz1UgwHwasyY9pTDFeDBytAjAffXvGH91tK0Yoi3NbTM+H1hUGbMs4vej3NcuMfUh0cfp/+UyC1juGuHH6gJHycR2DwcOkWRYfyCWYXpkl3NWQls9Zosn8w4NnJ7S5I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=GJ/1OzUe; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 4343TYdm002201; Thu, 4 Apr 2024 05:13:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= qcppdkim1; bh=PTV5+DQ7ryKEZGv3mJS+ywNkymvYkqTD/TtVct3tAaE=; b=GJ /1OzUekMKEh/2Gu0+P87kTi0b9MnRKU8bfx3VZA04suul5eo+vlytD1V2pXqH2Dh LUsYZ7asGFynkUkeTl4izshcr4QyxjIBnMo+4NCa34icvha/yVYgc6uNXONwMqP8 tl/wtQyT/iWsGbYgLOJcSiJEaVPIpnQ8/G2CUqV+n9OAsWL8fmshk+49NP8KkTU7 yBgNTrd+NiiSK31GuNIjCdxMZ2rIXpRgreEeagsjPpflfLu5oDu4aEJKK348AEq8 jJm5DB9FEGcPKmWR3oOdfeBqgY3lqDW6d75dGVxe5bwBqKYFURYRPs8PZhFyejed MBuxFldUIdZw0rUvAm7w== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3x9eph8m7d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 04 Apr 2024 05:13:43 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 4345DgoJ029906 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 4 Apr 2024 05:13:42 GMT Received: from hu-kriskura-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 3 Apr 2024 22:13:37 -0700 From: Krishna Kurapati To: Krzysztof Kozlowski , Rob Herring , Bjorn Andersson , Wesley Cheng , Konrad Dybcio , "Greg Kroah-Hartman" , Conor Dooley , Thinh Nguyen , Felipe Balbi , Johan Hovold CC: , , , , , , Krishna Kurapati , Johan Hovold Subject: [PATCH v19 9/9] usb: dwc3: qcom: Add multiport suspend/resume support for wrapper Date: Thu, 4 Apr 2024 10:42:29 +0530 Message-ID: <20240404051229.3082902-10-quic_kriskura@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240404051229.3082902-1-quic_kriskura@quicinc.com> References: <20240404051229.3082902-1-quic_kriskura@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 1whCxnVWxOIMQxqRRqslASzewWp4a4LW X-Proofpoint-ORIG-GUID: 1whCxnVWxOIMQxqRRqslASzewWp4a4LW X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-04_01,2024-04-03_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 spamscore=0 priorityscore=1501 mlxlogscore=999 adultscore=0 clxscore=1015 lowpriorityscore=0 phishscore=0 malwarescore=0 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2404040033 Power event IRQ is used for wakeup in cases: a) where the controller is super speed capable and missing an ss_phy interrupt. b) where the GIC is not capable of detecting DP/DM hs phy irq's. Power event IRQ stat register indicates whether high speed phy entered and exited L2 successfully during suspend and resume. Indicate the same for all ports of multiport. Signed-off-by: Krishna Kurapati Reviewed-by: Johan Hovold --- drivers/usb/dwc3/dwc3-qcom.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c index 12182e0f8f45..d3e6d5d5e8bf 100644 --- a/drivers/usb/dwc3/dwc3-qcom.c +++ b/drivers/usb/dwc3/dwc3-qcom.c @@ -52,6 +52,13 @@ #define APPS_USB_AVG_BW 0 #define APPS_USB_PEAK_BW MBps_to_icc(40) +static const u32 pwr_evnt_irq_stat_reg[DWC3_MAX_PORTS] = { + 0x58, + 0x1dc, + 0x228, + 0x238, +}; + struct dwc3_qcom_port { int qusb2_phy_irq; int dp_hs_phy_irq; @@ -421,9 +428,11 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *qcom, bool wakeup) if (qcom->is_suspended) return 0; - val = readl(qcom->qscratch_base + PWR_EVNT_IRQ_STAT_REG); - if (!(val & PWR_EVNT_LPM_IN_L2_MASK)) - dev_err(qcom->dev, "HS-PHY not in L2\n"); + for (i = 0; i < qcom->num_ports; i++) { + val = readl(qcom->qscratch_base + pwr_evnt_irq_stat_reg[i]); + if (!(val & PWR_EVNT_LPM_IN_L2_MASK)) + dev_err(qcom->dev, "port-%d HS-PHY not in L2\n", i + 1); + } for (i = qcom->num_clocks - 1; i >= 0; i--) clk_disable_unprepare(qcom->clks[i]); @@ -472,8 +481,11 @@ static int dwc3_qcom_resume(struct dwc3_qcom *qcom, bool wakeup) dev_warn(qcom->dev, "failed to enable interconnect: %d\n", ret); /* Clear existing events from PHY related to L2 in/out */ - dwc3_qcom_setbits(qcom->qscratch_base, PWR_EVNT_IRQ_STAT_REG, - PWR_EVNT_LPM_IN_L2_MASK | PWR_EVNT_LPM_OUT_L2_MASK); + for (i = 0; i < qcom->num_ports; i++) { + dwc3_qcom_setbits(qcom->qscratch_base, + pwr_evnt_irq_stat_reg[i], + PWR_EVNT_LPM_IN_L2_MASK | PWR_EVNT_LPM_OUT_L2_MASK); + } qcom->is_suspended = false; -- 2.34.1