From nobody Fri Apr 3 01:24:21 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 84AC53CF04D for ; Wed, 11 Mar 2026 10:27:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773224836; cv=none; b=f5/AdF0WxdSqyzPrDvFw30htp4nC8fTmQcWqfMd+C2b/WB4e7Ql/cw6lFAy/0C6kwYNxXGdAGyU4GkylbYOKpzSTaqxBRPSmh+2pHE/SzIKrFaUsF3gaRQPN1pJReNjGdC22E0rVQF7xEqfkMiVOB7YHUVlj9FMfYQp6t621nDk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773224836; c=relaxed/simple; bh=p9k1+/wF5h/48gQ8oI4Nz1vPnqke7I1l9Z0Jkky+eGc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MTkwKYHsswdt4TiLjVFtTeH9qtbQVeRuAxlreg4y/KNOcULEIe4CY6cSJl7+Hlp2CVPr7F+Ky0+w38Tfy0q7MzTacfILgxcCyvdx26kxjtgyQvOt08+ZeDuPIw78RdxuaCBbZA8hXaSRqcgiFjafHC0zGKSiRQqTIHfca/k8RtE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=DlcRurO4; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=SwOz0NWM; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="DlcRurO4"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="SwOz0NWM" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62BA5iU7294409 for ; Wed, 11 Mar 2026 10:27:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= n0dWYOeGxguS+2oLFAt3NGnKQOAcHpW8zVfBpqLuOnk=; b=DlcRurO486QsnPGT h78PTY9h5G2h8sKgFQa7VBbU7olOipI4V1IhJ5V8DRvom9fQLrABODFNC1hipbBI QrTQ9XM5v+4Tg50qGo5gCkyZs9A1TD4vDrriMCYFKk88/iJXUjmOjmetjscUzmm4 n3+wfX8Czu1+Q/2yQzeENwoIOUo00bWBPz83ckiHn4oHDP6g6uaQ1yWqaVuCsEft ZZiY1ivYySfRlgiSBPbs3zdHUYXlp16E+slReDOyckU5lsGHgm7jkvwjqvjcBmwN zRUTXPfwtO9ZR4wIBy3miPN0KDQOnW0AymX2j580SWkhIFZNhYg/xvOKpKhm7A6m nvGOXQ== Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cu6bb82nk-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 11 Mar 2026 10:27:13 +0000 (GMT) Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2ae57228f64so103497845ad.0 for ; Wed, 11 Mar 2026 03:27:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773224833; x=1773829633; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=n0dWYOeGxguS+2oLFAt3NGnKQOAcHpW8zVfBpqLuOnk=; b=SwOz0NWMm3B1x6pfB9Ka7kUQdYU1aCp6zK3kHcwYTyNtV38LfcgVn7VxoJR2H29tGU 7Qen9u9Iu+oyTqs3fVM5wgLdk1z16jumbmZeomjKJPzR9Vowylh7tSG3DpDGwHxu1vn/ +Ve23cLaaFWkTv0spLEwF29GxGHXtYJXFuqeB3DKS2JcJhT0/clUruxudrmOb+ffEpZX nulbofuS+Y6LKooGTgMat1sfBQIh7X6r8SKVLudIStoN/fVsykffM56WVQ16ow0IILxY EqFvi6euSxA27rO9iX9iGllLlktfgwL3dZc0Rgqczj8jVDfrrClPd2kxmjZkNA8NM2Mv XAMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773224833; x=1773829633; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=n0dWYOeGxguS+2oLFAt3NGnKQOAcHpW8zVfBpqLuOnk=; b=HYlvyhgNuGnwRlFH4NDR5PKO7jfUDL1nMDpvnVwB64gSOOWFafGzP7DMgvfSUHWISu MVRxkIl+qvP02Lzv+bpVpU6PI3ov4K+EZkxRE9TEXquZMRmBeWDgmvHkrE94qrcQnEB2 5n6iHx7n6ZYTZSYV8aG08FoHO4Hdp817WDx8LwBSy374lC5mZq4+exbRfyq05e3KR0pS RfnBZAI9QPjFoEuz6/yTh+vpVd3vMu+C+Sh1k4IqSAfjhbvHADIWMdgxphW96+ysCBva vDNPe1PAj6b8+yVNE8GBlsy/XyJOiOL7O0Q2AS6IOWeNBXSlNdGeH8bhJU3+tfy1aZS8 zu2A== X-Forwarded-Encrypted: i=1; AJvYcCXbz0M2vnduNw33sK7Dnu74PfeXcN6GN8lxls9jzq4CPuBLz9p/vbUYwbIIhfyMnm1lCVoKvS1vzyxcSPU=@vger.kernel.org X-Gm-Message-State: AOJu0Yw3yz0RBR0xmioytt5DCfDkN0+kE427220aAPLSQYEkmdHTbS84 h0iuqSlKXGIV34Qi0XUMfejPJrEuIAAxRpwLcCISdhahp53kgI3VZ0bOZwNe+7pTjX9b0VX+lJ2 u0ivsmrQgsT+xbE2m6tsuJcO790Df6yPfZkztn++rR2miwpVB1cEJt9Qz4/A19aGumpY= X-Gm-Gg: ATEYQzwru2622Vz4uFua3QIGwQNiKnPenN8zS/6NUqd/8OlNwunTajBmDOGTirMdNL8 CUNcYgkw5ICBqinaMylzQaod2ROErsdvINht9c4UExhOgrSni1Dwcv9M1tAnHhUdyTpPrOWyTYB xledT8IBkzFbnghNFmQo6L+15JcZC37J0zUDToaWPEfk4jha47PaB52KBA7t9p+3C6hvSvfrqFr rTEKkwTfa6/qw4oBd65MmzkWpB708jpIu/AJZ6+aoFlviZIBuDwuJTSe3wRO5tvozqzz23CkTtG hBmriPhgOxhDj5igRcPywq3NzsaXxktQnC3+OvGGhd/iyMGLtoA1b7Dw4TP2nepHADA+BrARzrs OekErWFtq4y5Gr5NiWYfs/g0hcJBwzSKoUufozsFpwgPpJIUZlq88u7kr X-Received: by 2002:a17:903:2b0c:b0:2ae:3b36:23e7 with SMTP id d9443c01a7336-2aeae7cfd6amr22264715ad.16.1773224833105; Wed, 11 Mar 2026 03:27:13 -0700 (PDT) X-Received: by 2002:a17:903:2b0c:b0:2ae:3b36:23e7 with SMTP id d9443c01a7336-2aeae7cfd6amr22264455ad.16.1773224832553; Wed, 11 Mar 2026 03:27:12 -0700 (PDT) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2aeae222872sm19575245ad.18.2026.03.11.03.27.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2026 03:27:12 -0700 (PDT) From: Krishna Chaitanya Chundru Date: Wed, 11 Mar 2026 15:56:49 +0530 Subject: [PATCH v3 4/5] PCI: qcom: Power down PHY via PARF_PHY_CTRL before disabling rails/clocks Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260311-d3cold-v3-4-4d85dc7c2695@oss.qualcomm.com> References: <20260311-d3cold-v3-0-4d85dc7c2695@oss.qualcomm.com> In-Reply-To: <20260311-d3cold-v3-0-4d85dc7c2695@oss.qualcomm.com> To: Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Will Deacon Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, jonathanh@nvidia.com, bjorn.andersson@oss.qualcomm.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773224811; l=4739; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=p9k1+/wF5h/48gQ8oI4Nz1vPnqke7I1l9Z0Jkky+eGc=; b=z1UX2znW0tNQnXQikEHUVz+yoSQwhJ/CfsyzJwxDof3560WJyIXchPHVP9PSe7GbW4/Fkm/sH wyPufFOw5duDoya2OYCwIK8uUeNk7eCIVU28b7Kz+WNeSKoelULm+KV X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: h2lFcbAkjsxoLdttrZ_71pBPz-NRsmIq X-Proofpoint-GUID: h2lFcbAkjsxoLdttrZ_71pBPz-NRsmIq X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzExMDA4NyBTYWx0ZWRfX3Q+DZQELgNAb ZeKKz/zD0h9JpfmpZeZ11KjSip1FOWt1COhszf5g15MF7mf7PSrjSnGh4pojjhCGJMGUq4Lvamd 4GoORW5vKa6NchycCS4RliuK6XlNU4TwnxBfi3aX+GUGbli/FzDUhb+AwYXnDIMgXz8ez2L5J/h eu1ETPZshMnr1Su2E1xfRFpXhZ6kwAfRPy+Bghn0WmO5x0B64+/VmJMm/X5cN93WjdcDCLWa0ku cdf/oijmUWq2CQDqhd84QMi6ObybGIsYDC6p2/8GM2/roY176WwWVoaSrDAaT4hbQG6VGkLHcBs 7/hiDMpxfKzmOAuJM5pdpCoC7hOVNUK7LADuj/+0VP9yeQ6vsXxqD3PjNGkQMneDuREUk/5Gw0w DhRSEyVs4FiXdPvnufDxfR5dMRuKGjBo7C197FGvz9KEt7FiL/r0nsn6wm727JfCLMyehjw+pBc ZBUHgAjf3g+cByWOdZQ== X-Authority-Analysis: v=2.4 cv=CKwnnBrD c=1 sm=1 tr=0 ts=69b14381 cx=c_pps a=IZJwPbhc+fLeJZngyXXI0A==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=EUspDBNiAAAA:8 a=S-wDCh2AgS0RhsWIeBgA:9 a=QEXdDO2ut3YA:10 a=uG9DUKGECoFWVXl0Dc02:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-11_01,2026-03-09_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 priorityscore=1501 phishscore=0 impostorscore=0 spamscore=0 adultscore=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603110087 Some Qcom PCIe controller variants bring the PHY out of test power-down (PHY_TEST_PWR_DOWN) during init. When the link is later transitioned towards D3cold and the driver disables PCIe clocks and/or regulators without explicitly re-asserting PHY_TEST_PWR_DOWN, the PHY can remain partially powered, leading to avoidable power leakage. Update the init-path comments to reflect that PARF_PHY_CTRL is used to power the PHY on. Also, for controller revisions that enable PHY power in init (2.3.2, 2.3.3, 2.7.0 and 2.9.0), explicitly power the PHY down via PARF_PHY_CTRL in the deinit path before disabling clocks/regulators. This ensures the PHY is put into a defined low-power state prior to removing its supplies, preventing leakage when entering D3cold. Signed-off-by: Krishna Chaitanya Chundru --- drivers/pci/controller/dwc/pcie-qcom.c | 32 +++++++++++++++++++++++++++++-= -- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controlle= r/dwc/pcie-qcom.c index b00bf46637a5ff803a845719c5b0b5b82739244b..c14c3eb70f356b6ad8a2ffe48b1= 07327d2babf77 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -513,7 +513,7 @@ static int qcom_pcie_post_init_2_1_0(struct qcom_pcie *= pcie) u32 val; int ret; =20 - /* enable PCIe clocks and resets */ + /* Force PHY out of lowest power state */ val =3D readl(pcie->parf + PARF_PHY_CTRL); val &=3D ~PHY_TEST_PWR_DOWN; writel(val, pcie->parf + PARF_PHY_CTRL); @@ -680,6 +680,12 @@ static int qcom_pcie_get_resources_2_3_2(struct qcom_p= cie *pcie) static void qcom_pcie_deinit_2_3_2(struct qcom_pcie *pcie) { struct qcom_pcie_resources_2_3_2 *res =3D &pcie->res.v2_3_2; + u32 val; + + /* Force PHY to lowest power state*/ + val =3D readl(pcie->parf + PARF_PHY_CTRL); + val |=3D PHY_TEST_PWR_DOWN; + writel(val, pcie->parf + PARF_PHY_CTRL); =20 clk_bulk_disable_unprepare(res->num_clks, res->clks); regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies); @@ -712,7 +718,7 @@ static int qcom_pcie_post_init_2_3_2(struct qcom_pcie *= pcie) { u32 val; =20 - /* enable PCIe clocks and resets */ + /* Force PHY out of lowest power state */ val =3D readl(pcie->parf + PARF_PHY_CTRL); val &=3D ~PHY_TEST_PWR_DOWN; writel(val, pcie->parf + PARF_PHY_CTRL); @@ -844,6 +850,12 @@ static int qcom_pcie_get_resources_2_3_3(struct qcom_p= cie *pcie) static void qcom_pcie_deinit_2_3_3(struct qcom_pcie *pcie) { struct qcom_pcie_resources_2_3_3 *res =3D &pcie->res.v2_3_3; + u32 val; + + /* Force PHY to lowest power state */ + val =3D readl(pcie->parf + PARF_PHY_CTRL); + val |=3D PHY_TEST_PWR_DOWN; + writel(val, pcie->parf + PARF_PHY_CTRL); =20 clk_bulk_disable_unprepare(res->num_clks, res->clks); } @@ -899,6 +911,7 @@ static int qcom_pcie_post_init_2_3_3(struct qcom_pcie *= pcie) u16 offset =3D dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); u32 val; =20 + /* Force PHY out of lowest power state */ val =3D readl(pcie->parf + PARF_PHY_CTRL); val &=3D ~PHY_TEST_PWR_DOWN; writel(val, pcie->parf + PARF_PHY_CTRL); @@ -994,7 +1007,7 @@ static int qcom_pcie_init_2_7_0(struct qcom_pcie *pcie) /* configure PCIe to RC mode */ writel(DEVICE_TYPE_RC, pcie->parf + PARF_DEVICE_TYPE); =20 - /* enable PCIe clocks and resets */ + /* Force PHY out of lowest power state */ val =3D readl(pcie->parf + PARF_PHY_CTRL); val &=3D ~PHY_TEST_PWR_DOWN; writel(val, pcie->parf + PARF_PHY_CTRL); @@ -1065,6 +1078,12 @@ static void qcom_pcie_host_post_init_2_7_0(struct qc= om_pcie *pcie) static void qcom_pcie_deinit_2_7_0(struct qcom_pcie *pcie) { struct qcom_pcie_resources_2_7_0 *res =3D &pcie->res.v2_7_0; + u32 val; + + /* Force PHY to lowest power state */ + val =3D readl(pcie->parf + PARF_PHY_CTRL); + val |=3D PHY_TEST_PWR_DOWN; + writel(val, pcie->parf + PARF_PHY_CTRL); =20 clk_bulk_disable_unprepare(res->num_clks, res->clks); =20 @@ -1169,6 +1188,12 @@ static int qcom_pcie_get_resources_2_9_0(struct qcom= _pcie *pcie) static void qcom_pcie_deinit_2_9_0(struct qcom_pcie *pcie) { struct qcom_pcie_resources_2_9_0 *res =3D &pcie->res.v2_9_0; + u32 val; + + /* Force PHY to lowest power state */ + val =3D readl(pcie->parf + PARF_PHY_CTRL); + val |=3D PHY_TEST_PWR_DOWN; + writel(val, pcie->parf + PARF_PHY_CTRL); =20 clk_bulk_disable_unprepare(res->num_clks, res->clks); } @@ -1209,6 +1234,7 @@ static int qcom_pcie_post_init_2_9_0(struct qcom_pcie= *pcie) u32 val; int i; =20 + /* Force PHY out of lowest power state */ val =3D readl(pcie->parf + PARF_PHY_CTRL); val &=3D ~PHY_TEST_PWR_DOWN; writel(val, pcie->parf + PARF_PHY_CTRL); --=20 2.34.1