Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp3261486lqp; Tue, 26 Mar 2024 04:36:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUz15EQapHlYJZOD5ALf1KyRXLpnM1dskFGjQ/QARR2RUWXkL/tVgCLraE9Bb2RxXUPvVbmXymOgJqa2xHAd/EEd7XFcUZOZ15IjftBGA== X-Google-Smtp-Source: AGHT+IELGZPbSBvkXSR5VV3gjx0rw+3emq/d1ZTRtb31lkwcyk/tSvWeWDx4mmyVSq3wKBMTiCv+ X-Received: by 2002:a05:6512:3991:b0:513:e374:c444 with SMTP id j17-20020a056512399100b00513e374c444mr1029506lfu.33.1711453003967; Tue, 26 Mar 2024 04:36:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711453003; cv=pass; d=google.com; s=arc-20160816; b=kS6eq4aGWhH3FLn9oQpAS/LnMzoCCPFLUiQfGf73obI+ToblRpw8MSMQGyDflb47W9 //EHSdynbS8vuCk+FiifCCC2xybWzrM1zTHDsvn2CRDq8vFmKmKIKBVqQE2Df6zROvQc H0pNELjCvXWOFB4Enb032v636zMMxPDdeGa8qxqGpz8ZqxVEwieq+O3Pz5QF8YD1DbAc 9GeS9vxWpa7hO2godLgLaJXy1rjUysPlm4PVVbCfLsrlrenpih9XVcpdZvI5Oa5pj7WQ BJYGTwaHuGO1HQpUuUJ9/ItQwmCCxvfsvUis9YswFhW1BlaeDOouLZC+6XdFDf/etlDr yS6w== 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=CFLgKO4Vn/NXnZRsdQHaPyPACUUnZ9fC3NwWfWLPE67Oc7eT7moj6Obl4vGFgjGAJh 8GqQIh/Y/iSH7I+TgsYhUIfEu0NfYixmmq9iaqqNrvtzZEo27XYp6I0uEMGW6pDaP6Qi Xs35RbxRI/j9vxzL2oF5wDTyfT1LHpQh1PbVzknaPHUvURQ/f8R0g7jSPE8NU6D7N46C +uE9oUGCPIFeDKyuDv5G6g2Kt3HatHsQMLf5nIwoD5DyNWR0JwowVsGysGBpJUGMHaxC lwWSQjtveiPcqHYLC0/vbXs4rRU2Lyc+TZfctkeIvFJADtTR9Pi8V84L7o+RGIPvChbJ Fg1w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=hi6hUhiY; 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-118898-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118898-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. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id fe10-20020a056402390a00b00568cd5a2975si3595187edb.155.2024.03.26.04.36.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 04:36:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-118898-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=hi6hUhiY; 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-118898-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118898-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 834B01F655CA for ; Tue, 26 Mar 2024 11:36:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F17537F7D7; Tue, 26 Mar 2024 11:34:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="hi6hUhiY" 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 9CA387641A; Tue, 26 Mar 2024 11:34:13 +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=1711452855; cv=none; b=nwkzSwUTC80WtVW7n77CsRLHerVsjrxf7/pCzMbdy0i2jJhK5DxsTgFfnepWuWmbyh/Ln4dkQGWZ2r4neH047gOd3gUgSMxtzQc6stP/AV3kqRTuA/myWkOMJF2aDnvfSybys7YrZGD23JsL64YbX5rmXGVX/fTwy7Jy4QK/XzY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711452855; c=relaxed/simple; bh=NNdTGMeI3BKJSbRWKcY6O6EwK/hyTYU9C4WsrkgvkGY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lMAbcM70H4whI4V+nfn6lKmhHvX/9TO4oeTujBaJuqEUKfvkulz5Sy78lwPEW8zZmpenGw2ecaU41RoEJJTPZyJLpr6DnV3bjVk3jGEBy9w7m7sYu5zUKu7KTtaHTYlHHvvSS8qTm+tzDJzxdVJcwpiD4e0sS1or/bJNez6pI3U= 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=hi6hUhiY; 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 (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42Q1sm9G004230; Tue, 26 Mar 2024 11:34:08 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=hi 6hUhiY63nSSAqn9nX+4iVjBVX78+t/JjWYht0TioHPDiytuukiqtjrS5uKNanbsS iQRXPcJAwAPBXhZWo7koLSFc51tV4IDrzNlFghK1Shy6LdzPBNK3JcLrXk1YSp7f 5zDMRwbjDs5qMYyrpcYbeuyPAoqkZ5v7WxCJ4MXs5hg2yPbFuq00I87kHqKPLzOz dCDNscX+AZ5v6ORp1LSr5F3a4P3I8f+Hv4bJk+MIQCKM/QhVqFDjkNQcgYcuoSlE DR3N2kbhBa0mVMmywqygjeJN1+SVNaTO36ShDUiEz3DP5Ee6QuZbV4aXbQywQ8mA zE+AnN20/+ft+eh2cu6g== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3x3memsfyw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 26 Mar 2024 11:34:08 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 42QBY7Gm018362 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 26 Mar 2024 11:34:07 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.1118.40; Tue, 26 Mar 2024 04:34:01 -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 v18 9/9] usb: dwc3: qcom: Add multiport suspend/resume support for wrapper Date: Tue, 26 Mar 2024 17:02:53 +0530 Message-ID: <20240326113253.3010447-10-quic_kriskura@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240326113253.3010447-1-quic_kriskura@quicinc.com> References: <20240326113253.3010447-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: nasanex01a.na.qualcomm.com (10.52.223.231) 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: Fl6hUoqf-_Q8FuE5o-xDpMGxvchdj8Zq X-Proofpoint-ORIG-GUID: Fl6hUoqf-_Q8FuE5o-xDpMGxvchdj8Zq 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-03-26_05,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 mlxlogscore=999 priorityscore=1501 impostorscore=0 lowpriorityscore=0 spamscore=0 bulkscore=0 suspectscore=0 clxscore=1015 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403210001 definitions=main-2403260079 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