From nobody Thu Oct 2 10:53:01 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 09AA72EAB61; Wed, 17 Sep 2025 14:10:19 +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=1758118221; cv=none; b=uqXtPMiUUPFF35shHJFNT5YGt+Sxk3+21bfGXWYYFuk7cJBawBbjegacwnjoF7t3JvZYGyRFomcKKi20NhZvfn8Wcg0bQSdbpTW2/trtmXbvOZieaLpXJfMk5SaBQuWYPUgL9H9TdzMXOkPv7Ibtr6IJuoFC8v1BzyWPAnh1rQ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758118221; c=relaxed/simple; bh=RDwQVEI2JEcFxqNQXhzD3P747ZK6ijW0oZ10/EpoiiY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ffzlTNpAodUNqV22dKhIrk18ug2QNEMsmT0g26kVoaEL6BXitHULrrvEhFEo8RyMP0FOHW2yU6+RfRsobxVQS9R3JDJZn4JLhs9xzXPaBqsTLRdS9QRss1XbaQN7/uer44luK0cg3ov6fsw7e3bIh1tijql0FC4a0hO4dONWm5Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=qualcomm.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=gl1abHEt; 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=qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="gl1abHEt" 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 58H8Xe7o027278; Wed, 17 Sep 2025 14:10:02 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= D84G9Ja/8bUnpt3WKsXjeE+aNpUyizA/nJyKRQt1WoE=; b=gl1abHEtyfd0R0vj PSpTPNxQlY+RqFIbZ0crILz2FwJx9UeOFBLT5529/rZO0xnw5DGO7Nmz4mKqA8HG CgCl0wTHvige6iCcOUmo4rbqmcVj+r3Vsi4dMqKpLcH9x1yfZdJrUGi+Op5fKIyQ 13sCv1L2cxu3YjNBdFgpHd+vRNo6ZWZT3M/1dpRXxdwcHI7oFyQh1ahjoxuKQA1k glJHRX/ev3lovliaMAEm6SMOojOclrOmySNGvf4/9x6ryrnjoZ9XoPGATzsuRxd8 rIMcPHiP3/F7wkoX/W8Uqzp999EPl4BJw8gSZAYhsWPyRP4pXDomVwj/YG8Q6umR 618lkg== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 497fxwjn3v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Sep 2025 14:10:01 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA05.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 58HEA0X7032339 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Sep 2025 14:10:00 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; Wed, 17 Sep 2025 07:09:56 -0700 From: Ram Kumar Dwivedi To: , , , , , , , , CC: , , , , Krzysztof Kozlowski Subject: [PATCH V6 1/4] ufs: dt-bindings: Document gear and rate limit properties Date: Wed, 17 Sep 2025 19:39:30 +0530 Message-ID: <20250917140933.2042689-2-quic_rdwivedi@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250917140933.2042689-1-quic_rdwivedi@quicinc.com> References: <20250917140933.2042689-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: nasanex01a.na.qualcomm.com (10.52.223.231) 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: AW1haW4tMjUwOTE2MDIwMiBTYWx0ZWRfX5b9yG6+gUiXw UT+gfLEj5QuOZMXND/UQaqooZtN7a8Vn2tYs3mo71YchF9q+SupzQoST5t1m8h4hKihc6Pfu0C4 ik7UZCAc1OHxfSlMMVzVgfFG+KpM4nD11ZTxqGo0OCMIzPpIP2dHZFTngcZAZ6LvHrdkfWDxkgW 5wTvP3tq/fSYmlef7mbC2jh8LHq/zze4eu0EHHqebKQ0Fgt4uOgOomiFDFTCVIemlMhizT11MA8 T6umOQevIFPE8D0XghbR1Pqn5xAgKWmcCPPiE/LgfnlmQoPdeIqrtCFyO+FUqpH9ktQl9B60o0e NFA4RP3sUTlR7c4jfbVElyRsa6QruWat/dk4vbLny+4zPTHymlGT/L1a95UvxHDgDCptsm022NI PTclFdhp X-Proofpoint-GUID: TEoo1fIM5AZW2B_75ybZ9R0y8TeJfUro X-Authority-Analysis: v=2.4 cv=ROezH5i+ c=1 sm=1 tr=0 ts=68cac139 cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=yJojWOMRYYMA:10 a=KKAkSRfTAAAA:8 a=COk6AnOGAAAA:8 a=ch6uAJVby9jpsUUvIWoA:9 a=cvBusfyB2V15izCimMoJ:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-ORIG-GUID: TEoo1fIM5AZW2B_75ybZ9R0y8TeJfUro X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-17_01,2025-09-17_02,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 suspectscore=0 bulkscore=0 spamscore=0 phishscore=0 malwarescore=0 clxscore=1015 impostorscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2509160202 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. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Ram Kumar Dwivedi Reviewed-by: Alim Akhtar --- .../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..9f04f34d8c5a 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: 6 + default: 6 + description: + Restricts the maximum HS gear used in both TX and RX directions. + + limit-gear-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 Thu Oct 2 10:53:01 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 6292C2ECE9C; Wed, 17 Sep 2025 14:10:42 +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=1758118244; cv=none; b=lfo2h6cPj1cu2ZGsQSgmEAwcBhXUJrie+Bv0hcwI5fVhGWB/K91k0uT1ELEotMFVeANiDSy9uihL+fkuvyA1EnbOtl/4H8JB23n6jxGEsDNHpOJOi9/4bGUfhFR8paqajqttFTipymt6r3uHxbor7sAIqOd6HdJuB/MwcFvNi2c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758118244; c=relaxed/simple; bh=uyjOGa1ULkbUr9hoCBFAT6SlKfZysW7rApa04khvzNM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=K+ZdK4anQVbfB3lQW/tLzvybxmFgg86txIC9+8D1O0ZYrU7yZfzBv+Fpcp0CHJVcgYKOv3Dg7XHXadslggTODdaixOjzns+gEVVd01aUke18CcFX2Ul+hbzK+el/2F6c5TL1qmNHzgXpVXb0gmRFPmLuVb59LniEb4ZFruw8vfM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=qualcomm.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=I2TuB/RC; 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=qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="I2TuB/RC" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 58H8Xap0018272; Wed, 17 Sep 2025 14:10:05 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= qDdbPHJQSUBBke62x7P5h4J7gGETxD6GhuWCYpeHdww=; b=I2TuB/RCljVsKX/L cuSB6gRykStguGsj4/5XtJ7vmNk5iTAYZA0rWdnsxJ8ZsZT8tjFaUs2q3tveXeiF j0BRUR60OX6vMvFtjbacpJAJzGvf9kU3n+do+hs1kA40ygTVadK0ntmOLZPnRio9 7dEnUi7sVlLG+FQ7fditJ38UP3Gm0k39a0VhRll57efmZmPZOlKAc55YCA2hwfs6 1iWYVYla2VpuWs5iBAwOGEPgeWckIO4iranwze3Bq0M3DK1umuDjJMs1qbhZp1BT wOAhYtkYO0SbIaS2Nu03rqj/uLIlbwK/K5xwBLJSqNmU0XCFSTwoLtHfzmZ4rWOo C5bIJg== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 497fxwaky7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Sep 2025 14:10:05 +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 58HEA44C015403 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Sep 2025 14:10:04 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; Wed, 17 Sep 2025 07:10:01 -0700 From: Ram Kumar Dwivedi To: , , , , , , , , CC: , , , Subject: [PATCH V6 2/4] ufs: ufs-qcom: Remove redundant re-assignment to hs_rate Date: Wed, 17 Sep 2025 19:39:31 +0530 Message-ID: <20250917140933.2042689-3-quic_rdwivedi@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250917140933.2042689-1-quic_rdwivedi@quicinc.com> References: <20250917140933.2042689-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: nasanex01a.na.qualcomm.com (10.52.223.231) 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=HbIUTjE8 c=1 sm=1 tr=0 ts=68cac13d cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=yJojWOMRYYMA:10 a=hD80L64hAAAA:8 a=COk6AnOGAAAA:8 a=BKJdvgQya1QnqZ38-EkA:9 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTE2MDIwMiBTYWx0ZWRfXxH6+j6Gs7fvX 4vuphBlIfKrOEX5/CWH7GNSruC0LBuyt9KbQknVmbnDhv0t6u/0H3fKCJxnI/Cni223g53YPe6L Gnrv6wi6HsAoW7B/c09jiRt4rj4Rh/sUyc7P4iKMsjdgYUsISwOauJNIKS6OendcqDYiOiGHunT Us1w971Iq/o5D9xvKNSQTDXdvwJKO3L3g3oTi0GABRFedrIkgrb1uqwUOpLw8SSXlI7RjWtBAE7 sndRr1rVVj/r0YEp18O1gvsY9P/Z5qtLeFEDDHw/eWSOlsMaaKWG8vkEhtiJyJwlK4FPhhwbegQ paP3iaSf39Yln42T6LqHmgaTd2tjka91Eig9753ufzfyljrACy0xnn3wGl2MQ2y5G4DtrpiiAhY enfsub/+ X-Proofpoint-GUID: IysEXEQbMrnIbznxQJnBLQpIgrBeV9-c X-Proofpoint-ORIG-GUID: IysEXEQbMrnIbznxQJnBLQpIgrBeV9-c X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-17_01,2025-09-17_02,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 impostorscore=0 bulkscore=0 suspectscore=0 clxscore=1015 adultscore=0 priorityscore=1501 phishscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2509160202 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. Reviewed-by: Alim Akhtar 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 Thu Oct 2 10:53:01 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 47BE52EBDC0; Wed, 17 Sep 2025 14:10:31 +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=1758118233; cv=none; b=CuYdzRldm1zUxe+Ouw/QDU5nw05DyzhQR5pSwujdjx3rMaBu9amlk00HyPFn6Qu7LYFS3/yg0ii9+hWO85XFWAhOLeS11RZcoUGY3ipRCufI2pgJLifOpqukN1VYFuyr3nFdvJImWrFr+FSbaqQc4SXnG8WbFipUhvF5RMUTw0U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758118233; c=relaxed/simple; bh=nrqbmK5pgjYW0e7sO92z/DPY0TbK/i1tfGzvxJMkzAM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=A/84LWH+q2sPQZHJG/nGfPn8OTsU1D0KglSfMXzszVrleYc1PGY+tmiYuXIqvC1AFitsyY8Fx7a+ur7cf6Bhr9K6viKvRKNCZHjLiDs0AX6QiPCMPq4kZSOg2XrkcpMEVoIAXGCCdP5THlLRIvE1MrbjXXBskPrikvQqYm2NCyg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=qualcomm.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=Pw8Nl3hD; 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=qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Pw8Nl3hD" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 58H8XZBl021414; Wed, 17 Sep 2025 14:10:10 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= 9L3Jbohsc3DdbDD1ToAmIYfceavXAAc6aods46Kh6Uc=; b=Pw8Nl3hDHp94g/EI kvS0kntleugPUZoUDF3vagjxgVUXrCa7GpBIiQDJsqU93UE2q0dgpf8hLdAuP4xc +S0VovGn4Z4MaIMdQ9VucBjVyCT5q8DT3lWbFcg7vTWDufOKlvwQeSAskcwpAm7b c3FuMomFC78hkxD1qJrOfxjBB1Z08mqE+FASdWzC/9rGnA9Wx74DBQLHf9VklXiW deJwv51D5BMYrtST1zkWaPLhPgQcFF2949ZxzOGRIbnlqZ70Kypkm0xIh/V1P6qU jIfeVZ1CP08BZarjlRr22zDEidlbrXYOGYOuwAT7IZvTBo6qnYzNYxtlUUiGy2SN 0guTSA== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 497fy5am56-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Sep 2025 14:10:10 +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 58HEA97n015445 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Sep 2025 14:10:09 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; Wed, 17 Sep 2025 07:10:05 -0700 From: Ram Kumar Dwivedi To: , , , , , , , , CC: , , , , Nitin Rawat Subject: [PATCH V6 3/4] ufs: pltfrm: Add DT support to limit HS gear and gear rate Date: Wed, 17 Sep 2025 19:39:32 +0530 Message-ID: <20250917140933.2042689-4-quic_rdwivedi@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250917140933.2042689-1-quic_rdwivedi@quicinc.com> References: <20250917140933.2042689-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: nasanex01a.na.qualcomm.com (10.52.223.231) 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: CJSuSDJ9DZBcPR3LShX-w6_9aNJqD8yr X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTE2MDIwMiBTYWx0ZWRfXxlvTCmEY3VuJ WY81xuA0kZjIyOYvhzz2iixOlmFVw0yBU+Ai/yAWmy8+Q53kExNbWnaQS1YOLmb5Ks22DbrJjXj Pg7wdXVKX7di36JVuDxBpAcaeTlM7HoqxIo2JAGr7kqVKUZ50Az3sYSe8e4oRcPG2mG6ilhqh4D 2o26hLojfu68klO9fjyVGmKvFl+TJ76ldI2Grl3RBrPmpU19W9WeU53vBd9Xq395sxT/YT6upps aFXGW+NRKz3fmFPi3loUYeUT3E0mPY+NGeaFpHePIC6Jn7fqHO5oXg6FbNKSg72J7FF7k08rVHP 2vvXudsKBJ6raeCEq0znGmUe78QVH680/JxiLW/GVY6MgmsOthkPSU0nvI//Fvi6YEz4Fd6uSyb YJ6oNwVu X-Authority-Analysis: v=2.4 cv=Y+f4sgeN c=1 sm=1 tr=0 ts=68cac142 cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=yJojWOMRYYMA:10 a=COk6AnOGAAAA:8 a=RJ6MAAfX04OqBZDSgvwA:9 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-ORIG-GUID: CJSuSDJ9DZBcPR3LShX-w6_9aNJqD8yr X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-17_01,2025-09-17_02,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 impostorscore=0 phishscore=0 adultscore=0 malwarescore=0 bulkscore=0 spamscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2509160202 Content-Type: text/plain; charset="utf-8" Introduce parsing of 'limit-hs-gear' and 'limit-gear-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 Reviewed-by: Alim Akhtar --- drivers/ufs/host/ufshcd-pltfrm.c | 33 ++++++++++++++++++++++++++++++++ drivers/ufs/host/ufshcd-pltfrm.h | 1 + 2 files changed, 34 insertions(+) diff --git a/drivers/ufs/host/ufshcd-pltfrm.c b/drivers/ufs/host/ufshcd-plt= frm.c index ffe5d1d2b215..c2dafb583cf5 100644 --- a/drivers/ufs/host/ufshcd-pltfrm.c +++ b/drivers/ufs/host/ufshcd-pltfrm.c @@ -430,6 +430,39 @@ int ufshcd_negotiate_pwr_params(const struct ufs_host_= params *host_params, } EXPORT_SYMBOL_GPL(ufshcd_negotiate_pwr_params); =20 +/** + * ufshcd_parse_gear_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-gear-rate": Specifies the max High-Speed rate. + */ +void ufshcd_parse_gear_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 (!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-gear-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 rate: %s\n", hs_rate); + } +} +EXPORT_SYMBOL_GPL(ufshcd_parse_gear_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..0a18a8aed94d 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_gear_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 Thu Oct 2 10:53:01 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 B4C3B29A31D; Wed, 17 Sep 2025 14:10:29 +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=1758118231; cv=none; b=c6CCSpFPtDivZimkhTVNhYvaPaaMDo81zy8EaRvrcYoa68fSXSfB1asZjeTCgE0OYX2kZFrJV148awhdUmljbE5/dN44lkyggOddIOqfhfoIi0YmQyKB+WktmCWcS3h/dnDluwWs2ceID41VneNbzmJVDThSAsqi/Ren8jH9sFA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758118231; c=relaxed/simple; bh=yFg+eTIntZUDGldEoDu02M/gxQ4qJAQSZAJMECaPtOs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fY/cehY1m+LXkJ35jUPC0pvCDpaC9YRTWdMuP9uYwpZ3/sQ7MOfxccjkSCbVdFFE3LlnkUrOALT4mt9DiLOnXJRuEOs11ZuIKat++HTz819z9zcFmXGkRMUJREvN+MITTrmYdJFwIxso72Z8pmIYKnUvcSvY1m6TxNlbq0s7HII= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=qualcomm.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=E+O5ywZM; 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=qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="E+O5ywZM" 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 58H8XYXw029878; Wed, 17 Sep 2025 14:10:14 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= KJ8+PbB3YJXI8m3SkqDg29QSmukxFeqEoZmLP20R2j8=; b=E+O5ywZMbV3jmhAM l/6U6f75bXUuCbu5jhct3+XWzJisBZsiAM6wmfTS799LqUmNGHWnAGK9n8QLUupH p7cEzNy/R4jzkG5+AuQYjdpQdW8q+xdt2cTmsYhGbuUzhXH+fiPCj6JCipOD54Kb XEXgnC1FQyAyNtV7yQkGd35kLgQpSkkgYhJoI46ojh9jqCnE4lrAMjpp9bLk3qW8 gSmS5VDSCa1iYvvWXGdUNw8WhWP+xikohFw9uCq8WRIg8IxO1QLQI/7RR+sXmuSB kwmeBCBa+bge9L9ZA8zvoTl9uEtXKLJxz6gnb6WM+2GBprIhD/5FDAhHyOWoi5Ea mHxK9g== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 497fxxjncm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Sep 2025 14:10:14 +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 58HEADIK015496 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Sep 2025 14:10:13 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; Wed, 17 Sep 2025 07:10:09 -0700 From: Ram Kumar Dwivedi To: , , , , , , , , CC: , , , Subject: [PATCH V6 4/4] ufs: ufs-qcom: Add support for limiting HS gear and rate Date: Wed, 17 Sep 2025 19:39:33 +0530 Message-ID: <20250917140933.2042689-5-quic_rdwivedi@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250917140933.2042689-1-quic_rdwivedi@quicinc.com> References: <20250917140933.2042689-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: nasanex01a.na.qualcomm.com (10.52.223.231) 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: AW1haW4tMjUwOTE2MDIwMiBTYWx0ZWRfX/PeNdcujnx9n +2bzm0kKn6CmLWJphrVtbRsUEWYzB+SQw+wa38tNFuuQNsiskLeaf2Do0yVsbalqkaDeMv2BRHh MmHpljGjC8CeVRhE73Cq8pQ0FqXY3T5Qnm4SWAYnJ5OBIrfoB1lOpAP7hxC+EbAfMZId9Lh7cmC vR58W90UBbAEZ77xwRvr7D4wWZtdeODF+VO1I3SP5Y1OJ5oMHCoPtCgirut/GktUO/WSkPHevOy rQJzHGOS+AKgBPZFOIehS6wilsRSu4rEO9XD5OxvsvpVlo2+scV0HDetc5Nn6gEEfb6hKSOel3y A43aNrUsHd/ss3/xqFMh68vCYR9b3iZGrxRrMLccQBTDzeLYv8Y4hxEwZS4l4D7BtPT6pNTOoDK lw+aJlYo X-Authority-Analysis: v=2.4 cv=MMFgmNZl c=1 sm=1 tr=0 ts=68cac146 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-ORIG-GUID: kATyhHd7kG3T2Fdpc5AnEQV3rrsUZ4jR X-Proofpoint-GUID: kATyhHd7kG3T2Fdpc5AnEQV3rrsUZ4jR X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-09-17_01,2025-09-17_02,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 clxscore=1015 suspectscore=0 bulkscore=0 spamscore=0 malwarescore=0 phishscore=0 impostorscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2509160202 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 Reviewed-by: Alim Akhtar --- 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..b5d7904597d9 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_gear_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_gear_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_gear_limits(hba); =20 err =3D ufs_qcom_ice_init(host); if (err) --=20 2.50.1