From nobody Fri Oct 3 11:28:14 2025 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 3A6242D5922; Mon, 1 Sep 2025 15:58:34 +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=1756742316; cv=none; b=N7u3RCEAwzVG1q8jYo5yN0aNSP8ldHC9PDgQKPPpYJoC+a47/jaUlUW9MeIGs1xMFTIIAfoEUnXkGEX+ACBmMP8kK+lE076pPMT1AVyUtq6+7A5eIOLNN45prehMcKKjCYZRlITRAj28G6ktFg5zZWvoFARFLojaX/R/kZ/5d8c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756742316; c=relaxed/simple; bh=SGqjlb/QEUrMxL9e5oJam4MnZEbfkfWhNjJ7HhvkO4A=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eAMgnEtapVxJDTLcR1IrYtE6HuAhFRyTVGOVCfD161pKwDEgemPrksIPH5Pt5LHgcLfqLKd592ExbccuQULnf0uCgovwy43ZpguSKHqRsUysOoqo93AqMapn8jAv157Ee2cly/Aw1RXX4jZqpnZ5kS4OyH9RndenJVhK7Ys+IzU= 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=h19sd/AI; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="h19sd/AI" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 581B47Wi007309; Mon, 1 Sep 2025 15:58:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= WiIau0k39yONCrFdBTuRaepfgRM/f9Ux3i+6YIDfxss=; b=h19sd/AIB8ev9kOs /6vTlq2DJ5bOeugeM85e7kCpXETEOF85Euw25Ufsw/gc1OSlykxM6W0EWzs/ShUG Pj51lu110Q6Sh+9aCgPksjxUUPQmozlt8CCD5RZSA0Qigx2nvZ4B3wgoLst8THqP nFFoR8hoth5lk7xG+OP+CwEjCVoal1kvRhBD84ML5QDxRLN6/+tNeDQkNFyS48NY Y5TPpLS4V/UJfIiabGw6ji1UHRPm6LduFcPmCDqg0UxRNF/pL5/qkruV0CjWgYrK tA80ZSJRgEe4iX0LyWpPB8lzieN4fx0UhX46JIeJHXrKTfGY/aCApVbA6YlI3ZEs lC4rqg== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 48upnp5dgn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 01 Sep 2025 15:58:20 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 581FwJRQ003039 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 1 Sep 2025 15:58:19 GMT Received: from hu-rdwivedi-hyd.qualcomm.com (10.80.80.8) 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.1748.24; Mon, 1 Sep 2025 08:58:15 -0700 From: Ram Kumar Dwivedi To: , , , , , , , , CC: , , , Subject: [PATCH V4 1/4] ufs: dt-bindings: Document gear and rate limit properties Date: Mon, 1 Sep 2025 21:27:57 +0530 Message-ID: <20250901155801.26988-2-quic_rdwivedi@quicinc.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250901155801.26988-1-quic_rdwivedi@quicinc.com> References: <20250901155801.26988-1-quic_rdwivedi@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: quoted-printable X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) 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-GUID: -AheyndoPJBy7vLY7HNCKYY_7JEFu1qI X-Authority-Analysis: v=2.4 cv=Jt/xrN4C c=1 sm=1 tr=0 ts=68b5c29c cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=yJojWOMRYYMA:10 a=COk6AnOGAAAA:8 a=Umu3u8L3Ayb6iz0Wi2cA:9 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-ORIG-GUID: -AheyndoPJBy7vLY7HNCKYY_7JEFu1qI X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwODMwMDAwMSBTYWx0ZWRfX4XQyZqZ1GigQ CbOA/KUvLcoB6rhdIF2DTcApJw/I2lqzrO+rZyvZn+jOvXhS+ufUm3XvUyI8E0oY0fkAZWmQel0 rztHS80kKTEy1HARHKUQlS6RP3/xSW9f2KlZsboAMyugZjKS/oyZyyaSYkvk1Z02I0j4TLsyRMx Uode4R+V8e3foHjENiUhoWcKsRBpjujpwLgzlCKbTO9rf2rGFjGpEY7tNypVo1fj5IU8d5JH9XX YkvMpf1gy+UnHkLPrB54BB94KzrI8vWlpSp0+UcwXqAHwb+yUyNKkEtT1wcP7+BxKxdFWIPy7Qy f92MnL95Tb9GSXAxMyx0XPQCDb4Ue+hev+ByfmBsLpJ8HGqIO5+6u7b92JwMddU5jnAV6GnilfU PtqFbllQ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-01_06,2025-08-28_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 priorityscore=1501 clxscore=1015 bulkscore=0 impostorscore=0 spamscore=0 phishscore=0 suspectscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2508300001 Content-Type: text/plain; charset="utf-8" Add optional "limit-hs-gear" and "limit-rate" properties to the UFS controller common binding. These properties allow limiting the maximum HS gear and rate. This is useful in cases where the customer board may have signal integrity, clock configuration or layout issues that prevent reliable operation at higher gears. Such limitations are especially critical in those platforms, where stability is prioritized over peak performance. Signed-off-by: Ram Kumar Dwivedi --- .../devicetree/bindings/ufs/ufs-common.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Documentation/devicetree/bindings/ufs/ufs-common.yaml b/Docume= ntation/devicetree/bindings/ufs/ufs-common.yaml index 31fe7f30ff5b..b4c99fee552f 100644 --- a/Documentation/devicetree/bindings/ufs/ufs-common.yaml +++ b/Documentation/devicetree/bindings/ufs/ufs-common.yaml @@ -89,6 +89,22 @@ properties: =20 msi-parent: true =20 + limit-hs-gear: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 1 + maximum: 5 + default: 5 + description: + Restricts the maximum HS gear used in both TX and RX directions. + + limit-rate: + $ref: /schemas/types.yaml#/definitions/string + enum: [Rate-A, Rate-B] + default: Rate-B + description: + Restricts the UFS controller to Rate A or Rate B for both TX and + RX directions. + dependencies: freq-table-hz: [ clocks ] operating-points-v2: [ clocks, clock-names ] --=20 2.50.1 From nobody Fri Oct 3 11:28:14 2025 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 7D09C2E6CAD; Mon, 1 Sep 2025 15:58:37 +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=1756742319; cv=none; b=YX/x21hqAcuJyr/rfPEPMfq/SvcHVJZTU1rT2aCfDz6ulYgUoOrTpBznznJe31G10U7T5uujpXhRe6FZH/zJWe/m2SBXbMlDubxdQhdoCyvJElcaWEYjDB+d+fPkgNVEFSlrrP2+IaMo9BniB28BZJU6Es5Xu4g3f5hosGSDxa8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756742319; c=relaxed/simple; bh=VGe+vvHN4XGRtfDrOLNuXGHb6FekmEO4tinbTA7LH/U=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dOUQq9vYJb9tg8sC7p8O2Vfq88XerZaL0+NHd5pPHinma+d2bEe8ExbCtvEgJs21lDZu2qRCDMCLujjwqtA0itzd5gUKE7On7fIBTgwAQxpN6tPUOCjWS3tRo/9X3OqS1VD8K1lgXT6fe8DPDEayvAXLxoLlCTG4E5qC/jh4E7k= 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=jhICrvS/; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="jhICrvS/" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 581B4BoD008805; Mon, 1 Sep 2025 15:58:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= /vG0Q4oPAdzsXOD/nYH3G6RUz404W2bmE7gYiyBnGQY=; b=jhICrvS/oH9MuZ3W oI3ODTyzOKmJjY6isC8ByABgOuYzuNNpXRXvjEva/IIO608mzWxUkNdD0Xhr6BoY oTDGbJlt0yWhBpGtvGFYKEaTh+gSZLqsok2q00Am5wYTPNHZvgHF6FDwu2DzGpEL XAPpmKN2zUiFASfD0EOKPGxklTOK1m89OqYEHmyCDFsa7EgdU6O2+EnQ7jORP5Yu J+vc7qS8Ss7ZhMdkw7eOHMSL4mMOr6QoYgcqX0aJ1Z5vhWltAW/qKOOIAlwnazPC 6QHZeJfZW7hxAip8GEKfv0s//jUXaATe7X7NUXVDVdCctqgznmWxngdoFiY2AEWj G4Qqug== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 48uscuw9p4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 01 Sep 2025 15:58:24 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 581FwNj5013289 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 1 Sep 2025 15:58:23 GMT Received: from hu-rdwivedi-hyd.qualcomm.com (10.80.80.8) 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.1748.24; Mon, 1 Sep 2025 08:58:19 -0700 From: Ram Kumar Dwivedi To: , , , , , , , , CC: , , , Subject: [PATCH V4 2/4] ufs: ufs-qcom: Remove redundant re-assignment to hs_rate Date: Mon, 1 Sep 2025 21:27:58 +0530 Message-ID: <20250901155801.26988-3-quic_rdwivedi@quicinc.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250901155801.26988-1-quic_rdwivedi@quicinc.com> References: <20250901155801.26988-1-quic_rdwivedi@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: quoted-printable X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) 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-Spam-Details-Enc: AW1haW4tMjUwODMwMDAzMSBTYWx0ZWRfX7q1UVSrGwbUH 5g3ch/OwP6V+w0AQmw/JNbQo5eGNxEXBviDk7tuPlpexVfAPyFW5eApg+trEeaOAcAnVMzPk32N 4iGlKIIl21JYhurNsh1Mp/awBqF3rBfAE9hvuslR9pTzbP1VeBmgdch4yGlL952giqpGvGpFpe8 5vic8y7pXxoNh9XYqUAwrJkQ+3K0RTiJVGwMyqgY7m8kemdMkIKd3n4yanjEqY88hzwMKda+Gxp rKj1msQuv99ztOmS9fmUWuXuNBrVwmff2Fjz547hy/QA3nvTp6ltWl3BbpTxbgaALmWdK5rwRRD x6DUm0u+aew28hv9Zwe/OyrOY9PjvxnSOsXexRd+3D+BdWo90AVFODMq7q83j/gXhyVfjjY4Gd7 SpWDu4DZ X-Authority-Analysis: v=2.4 cv=A8xsP7WG c=1 sm=1 tr=0 ts=68b5c2a0 cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=yJojWOMRYYMA:10 a=COk6AnOGAAAA:8 a=BKJdvgQya1QnqZ38-EkA:9 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-ORIG-GUID: lPNfNt_Et5w7IrSY0lnDH1yeEhhTR16- X-Proofpoint-GUID: lPNfNt_Et5w7IrSY0lnDH1yeEhhTR16- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-01_06,2025-08-28_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 impostorscore=0 bulkscore=0 clxscore=1015 suspectscore=0 malwarescore=0 priorityscore=1501 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2508300031 Content-Type: text/plain; charset="utf-8" Remove the redundant else block that assigns PA_HS_MODE_B to hs_rate, as it is already assigned in ufshcd_init_host_params(). This avoids unnecessary reassignment and prevents overwriting hs_rate when it is explicitly set to a different value. Signed-off-by: Ram Kumar Dwivedi --- drivers/ufs/host/ufs-qcom.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 9574fdc2bb0f..1a93351fb70e 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -494,12 +494,8 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *= hba) * If the HS-G5 PHY gear is used, update host_params->hs_rate to Rate-A, * so that the subsequent power mode change shall stick to Rate-A. */ - if (host->hw_ver.major =3D=3D 0x5) { - if (host->phy_gear =3D=3D UFS_HS_G5) - host_params->hs_rate =3D PA_HS_MODE_A; - else - host_params->hs_rate =3D PA_HS_MODE_B; - } + if (host->hw_ver.major =3D=3D 0x5 && host->phy_gear =3D=3D UFS_HS_G5) + host_params->hs_rate =3D PA_HS_MODE_A; =20 mode =3D host_params->hs_rate =3D=3D PA_HS_MODE_B ? PHY_MODE_UFS_HS_B : P= HY_MODE_UFS_HS_A; =20 --=20 2.50.1 From nobody Fri Oct 3 11:28:15 2025 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 B0FDC2E6CAD; Mon, 1 Sep 2025 15:58:42 +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=1756742324; cv=none; b=K8WkN2MX0bg1J5c4hd3SaajE2uNjFn/y4a/tt74AiPZx8rkuMVd/SyiRGFvKe3Sebx13A997S6pkgNs2qSDrOzgwpFnN9QeoZza6eLvAfkL0M/xm0a1bERSy+tdCVr2ROFP05w6PSLNLoZ5YKWYQYBy7mkNwma0+lbXRmDDzTuo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756742324; c=relaxed/simple; bh=3OdJp/OWdH3e6+1e6ZGf0PH9HmjVvKxRsJXul26bRWI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=g3i8TIc3tbY6MGs8ebnVtAzEuelTc3cGH3+2x6+j6DK1v+VLwGknTia5/kbR3z19J5ZVx5+dw5fL2QffK+NIMiTxIYSOKt1H1TRlilUKTMXTVBgvPbb2FCmuRr78oFIBW8wkkVU2WKF08qtN+SaYLP1xDMhp64o4DZTqjDt+Ko4= 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=CN22WcWo; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="CN22WcWo" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 581B42lu011342; Mon, 1 Sep 2025 15:58:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 7rgD8AWQ/4GZdPewcpEta5t2EVVG4Hzw8nikLbJlnEI=; b=CN22WcWooHPAX5FA gaGPqjxaNmer2AXBBjk4hLtoYapyFmqgyRZCY3gLxJhml50jokEik5xFe/b4/U/U v09eng5afLuKIP5Le4NzljFAgm2Ku9sKB7xBUdY3iR7oZmLBZHQdMdwzOG9NFAkx uUrwFEXlNVBFc337crkt875hfiLU9luTBZZ8hsYzbSLOpSK44J1XxIjtTCElICvT JnTj7Dl/JGOQ/KCzISbOZ3RI5YsC4yMwxpPxY/GlCyFBnGrXwyuc296rczZB+NpT 0ZMLkexWRZuyAfet6+74rOf1b8NpQY1ChezZmJMAziI2t7dKOpqpjVHxMSs0p5KP 6inoug== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 48w8wy129m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 01 Sep 2025 15:58:29 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 581FwSPH013331 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 1 Sep 2025 15:58:28 GMT Received: from hu-rdwivedi-hyd.qualcomm.com (10.80.80.8) 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.1748.24; Mon, 1 Sep 2025 08:58:24 -0700 From: Ram Kumar Dwivedi To: , , , , , , , , CC: , , , , Nitin Rawat Subject: [PATCH V4 3/4] ufs: pltfrm: Allow limiting HS gear and rate via DT Date: Mon, 1 Sep 2025 21:27:59 +0530 Message-ID: <20250901155801.26988-4-quic_rdwivedi@quicinc.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250901155801.26988-1-quic_rdwivedi@quicinc.com> References: <20250901155801.26988-1-quic_rdwivedi@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: quoted-printable X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) 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-Authority-Analysis: v=2.4 cv=Ycq95xRf c=1 sm=1 tr=0 ts=68b5c2a5 cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=yJojWOMRYYMA:10 a=COk6AnOGAAAA:8 a=4SmWkoQrYTlKMa40LuYA:9 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: IEON68wP28JXhI-qGaLYPqB0MNSK9KHd X-Proofpoint-ORIG-GUID: IEON68wP28JXhI-qGaLYPqB0MNSK9KHd X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTAxMDEwMSBTYWx0ZWRfXxdixDjON3yhQ Uh/0U5K+wugZsFuLj0W1FEu9zHvh18FjYLG6Hdsn5Hxvos8Q4mm7qjlUKBIRF1hwk+AtHU7X7aM 13trOY4FGE1JvniwNLGsI9I0bLq1r3aLlWs0N3xyg6VL4ZUU5ANMhFrxr3qHZdXZ8oV8ftlmiB8 czovHoC1DCrOEVmmtepPERWgHgG04uv6MW8k8yv4PDAXPSbglW/BRIQ0V0llJ0KTMQoe2RWkTrf u7F1L9/MU5OtPPHueV72xsrjcwWSMPw2DGtsbA+sDXiT1YqacV4EALnHchxb9a8r1xwq8Tlgp32 RGnSVOcHP04eZ7kOk8vX51/tE3DcelMLgIU8gFrFoSN8M6GvXOiC9xG8E5Hi/sAESINxp/aNgr6 vIJ9OUj3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-01_06,2025-08-28_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 adultscore=0 phishscore=0 malwarescore=0 bulkscore=0 suspectscore=0 impostorscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2509010101 Content-Type: text/plain; charset="utf-8" Add support for parsing 'limit-hs-gear' and 'limit-rate' device tree properties to restrict high-speed gear and rate during initialization. This is useful in cases where the customer board may have signal integrity, clock configuration or layout issues that prevent reliable operation at higher gears. Such limitations are especially critical in those platforms, where stability is prioritized over peak performance. Co-developed-by: Nitin Rawat Signed-off-by: Nitin Rawat Signed-off-by: Ram Kumar Dwivedi --- drivers/ufs/host/ufshcd-pltfrm.c | 36 ++++++++++++++++++++++++++++++++ drivers/ufs/host/ufshcd-pltfrm.h | 1 + 2 files changed, 37 insertions(+) diff --git a/drivers/ufs/host/ufshcd-pltfrm.c b/drivers/ufs/host/ufshcd-plt= frm.c index ffe5d1d2b215..a3cfb1935bbc 100644 --- a/drivers/ufs/host/ufshcd-pltfrm.c +++ b/drivers/ufs/host/ufshcd-pltfrm.c @@ -430,6 +430,42 @@ int ufshcd_negotiate_pwr_params(const struct ufs_host_= params *host_params, } EXPORT_SYMBOL_GPL(ufshcd_negotiate_pwr_params); =20 +/** + * ufshcd_parse_limits - Parse DT-based gear and rate limits for UFS + * @hba: Pointer to UFS host bus adapter instance + * @host_params: Pointer to UFS host parameters structure to be updated + * + * This function reads optional device tree properties to apply + * platform-specific constraints. + * + * "limit-hs-gear": Specifies the max HS gear. + * "limit-rate": Specifies the max High-Speed rate. + */ +void ufshcd_parse_limits(struct ufs_hba *hba, struct ufs_host_params *host= _params) +{ + struct device_node *np =3D hba->dev->of_node; + u32 hs_gear; + const char *hs_rate; + + if (!np) + return; + + if (!of_property_read_u32(np, "limit-hs-gear", &hs_gear)) { + host_params->hs_tx_gear =3D hs_gear; + host_params->hs_rx_gear =3D hs_gear; + } + + if (!of_property_read_string(np, "limit-rate", &hs_rate)) { + if (!strcmp(hs_rate, "Rate-A")) + host_params->hs_rate =3D PA_HS_MODE_A; + else if (!strcmp(hs_rate, "Rate-B")) + host_params->hs_rate =3D PA_HS_MODE_B; + else + dev_warn(hba->dev, "Invalid limit-rate value\n", hs_rate); + } +} +EXPORT_SYMBOL_GPL(ufshcd_parse_limits); + void ufshcd_init_host_params(struct ufs_host_params *host_params) { *host_params =3D (struct ufs_host_params){ diff --git a/drivers/ufs/host/ufshcd-pltfrm.h b/drivers/ufs/host/ufshcd-plt= frm.h index 3017f8e8f93c..1617f2541273 100644 --- a/drivers/ufs/host/ufshcd-pltfrm.h +++ b/drivers/ufs/host/ufshcd-pltfrm.h @@ -29,6 +29,7 @@ int ufshcd_negotiate_pwr_params(const struct ufs_host_par= ams *host_params, const struct ufs_pa_layer_attr *dev_max, struct ufs_pa_layer_attr *agreed_pwr); void ufshcd_init_host_params(struct ufs_host_params *host_params); +void ufshcd_parse_limits(struct ufs_hba *hba, struct ufs_host_params *host= _params); int ufshcd_pltfrm_init(struct platform_device *pdev, const struct ufs_hba_variant_ops *vops); void ufshcd_pltfrm_remove(struct platform_device *pdev); --=20 2.50.1 From nobody Fri Oct 3 11:28:15 2025 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 753C72E6CDB; Mon, 1 Sep 2025 15:58:41 +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=1756742322; cv=none; b=DKQ36cFAxPeKMWwMHtOWuOho0WEDbXwe4Jev0mpszvqY/FV+OmMmCQfV4HJa+8k1kfrFFN25LvDC6QMnuRAwZTM2wBF80uiqdGLIWDSNoRnqhwq+HSfHwPbpICOS0xWRvx19n2TV2ECHsayYkNZHw8CwrKxKdABP3Y+ogCTVsjk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756742322; c=relaxed/simple; bh=8eYUMhvn+IIZ06qLAmibbHFTwdcu3kwbiOXeFVmY048=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Bjp7g773JvoT4lzuCNWRCXCGmSP5T0eYkftcTHa10v8N1Z0Pf1xRA3jCk69x9JZ9SqlaEuowmV0dZzZCnFSu8zV8giiVJxWpR0iz7cFzwIXoqGghUZMRl/C36HyslyCSI7JtZGdueTJJ2v47MQRWsuQhfP7r2t3UdwqTbTJRbIc= 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=b2NHKBAp; arc=none smtp.client-ip=205.220.168.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="b2NHKBAp" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 581B43gn025100; Mon, 1 Sep 2025 15:58:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= t7EPwV5hN2UKWWwQJXTqQgiIfLRoD8LnWdqlkMnK+d0=; b=b2NHKBApERx1tTAH 9ioxDlKA9HBOfWdinsWhFpgdcofvPd8CeqKLGZiXkUAdoBxeeRVYdYZ3t+zxLz37 6f0r3ELL45xIpwsd/+zjQusFwjUsvF4KDNFdNa3/6exRHUpGXk4PlA2R6/5yck8X zlnD09kb9JjG0tct7wahcZq/IGzRUeTRzRRJg1eWNL9yceWYLz2X9qD6gVb+7o4Q rorNuHxiXjOZ/ty9yfiQ8exibV9c2P27c56mgIz1vpDwX/LB4eylru+Yk0VxWjrC MV6AYOkxs/qR2POk5Btc9e14KFOBLFreux8gMIJRxhzq+nbDAsCGJGgF/HN1TrqE zI49GA== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 48ut2fd64w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 01 Sep 2025 15:58:33 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 581FwWME003196 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 1 Sep 2025 15:58:32 GMT Received: from hu-rdwivedi-hyd.qualcomm.com (10.80.80.8) 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.1748.24; Mon, 1 Sep 2025 08:58:28 -0700 From: Ram Kumar Dwivedi To: , , , , , , , , CC: , , , Subject: [PATCH V4 4/4] ufs: ufs-qcom: Add support for limiting HS gear and rate Date: Mon, 1 Sep 2025 21:28:00 +0530 Message-ID: <20250901155801.26988-5-quic_rdwivedi@quicinc.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250901155801.26988-1-quic_rdwivedi@quicinc.com> References: <20250901155801.26988-1-quic_rdwivedi@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: quoted-printable X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) 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-Spam-Details-Enc: AW1haW4tMjUwODMwMDAzOCBTYWx0ZWRfXzaz8PEMi4tT+ Ti/49o/9+ujqOzr/jM8EzgfOB6riKKVY1KH0FUpU8HPzjpuVnX5qV3I5Bs1GXDcPp5ovi8IaTAg cPUbBGHHHBppys5VknoFfeDUwZ3ziMvpy+xfPTsOyuNU4Ik2wzJArj0Bmx/keGunCHBwPPCvICs +YMdguOrzjpMG+Ylf15ie55s1WBQwNj8ZXWFs1F0jN7bRh9t1LQD/2Hi8ghiHbJZmN2NLXJ+tKB uDCs4mFxY6Dmc4XL5SV+W0mJSQrMaHZzFXtm1N6Tx9I5TVXEkR89Or5ZUBelETW2SRdOiti7V7C Ne4hxdxVw1cdCwAXRVKn4xQl7n8VX1XRfVuJoyRNpgds14ON8BivMhAKyXjEcgClzfhot0yXHRF iuTKwznU X-Proofpoint-ORIG-GUID: 9HRUwHyaRdWszOK_7j2PawCTeMNOsE5m X-Proofpoint-GUID: 9HRUwHyaRdWszOK_7j2PawCTeMNOsE5m X-Authority-Analysis: v=2.4 cv=U7iSDfru c=1 sm=1 tr=0 ts=68b5c2a9 cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=yJojWOMRYYMA:10 a=COk6AnOGAAAA:8 a=YZsCTDY-3J_n_fZr9xEA:9 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-01_06,2025-08-28_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 phishscore=0 clxscore=1015 impostorscore=0 suspectscore=0 malwarescore=0 priorityscore=1501 adultscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2508300038 Content-Type: text/plain; charset="utf-8" Add support to limit Tx/Rx gear and rate during UFS initialization based on DT property. Also update the phy_gear to ensure PHY calibrations align with the required gear and rate. Signed-off-by: Ram Kumar Dwivedi --- drivers/ufs/host/ufs-qcom.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 1a93351fb70e..53c64d5fb95d 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -1092,6 +1092,18 @@ static void ufs_qcom_set_phy_gear(struct ufs_qcom_ho= st *host) } } =20 +static void ufs_qcom_parse_limits(struct ufs_hba *hba) +{ + struct ufs_qcom_host *host =3D ufshcd_get_variant(hba); + struct ufs_host_params *host_params =3D &host->host_params; + u32 hs_gear_old =3D host_params->hs_tx_gear; + + ufshcd_parse_limits(hba, host_params); + if (host_params->hs_tx_gear !=3D hs_gear_old) { + host->phy_gear =3D host_params->hs_tx_gear; + } +} + static void ufs_qcom_set_host_params(struct ufs_hba *hba) { struct ufs_qcom_host *host =3D ufshcd_get_variant(hba); @@ -1333,6 +1345,7 @@ static int ufs_qcom_init(struct ufs_hba *hba) ufs_qcom_advertise_quirks(hba); ufs_qcom_set_host_params(hba); ufs_qcom_set_phy_gear(host); + ufs_qcom_parse_limits(hba); =20 err =3D ufs_qcom_ice_init(host); if (err) --=20 2.50.1