From nobody Fri Oct 3 10:13:19 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 1472122FAFD; Tue, 2 Sep 2025 16:49:32 +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=1756831774; cv=none; b=GuJcq3y4ILCWtUOijtPz4ERlmEBDUsY8IccjfkJFjffahMSNZKaNmLjYW5R7i7Ih7VdBJTvGdvXYolzoqGfBcTBIeFlcHDdpGUUldRrnyWJkuWtCcCLjHeOb6tTloOnd6EecEQyJednvUdsJNBLCOPf4Cl1PczbTSIJBX13BZS0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756831774; c=relaxed/simple; bh=AizIutXkM8wP3NY9keRnNbAuJdvdp4wHMR0Lv6gurUM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OKm6ut82f5x7E9HbBQ5+PzYGZMh6tFnTA5xj/NDZQc1Vc2vn+FPksAN6rMWUckH1ym5ufvuK2kcd7ICMnpjTOoqWuu+k3/sf/yHzq6PAxHZWyB3ScehZUFg6YTSxVQaObzQ88/Mkk0qnfzwAcMDnXbfVyjM/3xusgqIupTeg1ic= 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=MhP3sRmJ; 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="MhP3sRmJ" 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 582EqBWO023436; Tue, 2 Sep 2025 16:49:19 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= +GkLmec44QHBef0TwY6dmVfw+h38KJl50H379H9EgwA=; b=MhP3sRmJ0ohLGW05 EKRqQCYAWafhEYEHV2JdtOEwRQFEXfhDp00qXYiS51K5Tvoy+lv8SWA9koOnyQ8g D76j6TGh21lWJYk+XNQcF+Smvd4CPLj+nyMrGBISc8HM0lk9dXfpZ58tavRc5FGp k/Vf4wmyBzU/25BpgKqWRABg9vPTWmIqjtQDS+D9iX76nUyCrm7A2X4ntHTNEbts GXgYgUFGa2xFOBer8Du2wZCQeDQquBjvKGO1RrzZ8XW0RKVlhuhh5k8JHyM0PgR3 MsTS+XHTTUtjUilFspmRZReDT4eUTBGxwwAp0HVip2SEqMHB5C+1FxHWfNdeE3Sb Jg4btg== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 48upnp8rtu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Sep 2025 16:49:19 +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 582GnIJu031584 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 2 Sep 2025 16:49:18 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; Tue, 2 Sep 2025 09:49:14 -0700 From: Ram Kumar Dwivedi To: , , , , , , , , CC: , , , Subject: [PATCH V5 1/4] ufs: dt-bindings: Document gear and rate limit properties Date: Tue, 2 Sep 2025 22:18:57 +0530 Message-ID: <20250902164900.21685-2-quic_rdwivedi@quicinc.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250902164900.21685-1-quic_rdwivedi@quicinc.com> References: <20250902164900.21685-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: oE1zU7fGiJTNalUzN5MsbyzTa7UtP8Xs X-Authority-Analysis: v=2.4 cv=Jt/xrN4C c=1 sm=1 tr=0 ts=68b7200f 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: oE1zU7fGiJTNalUzN5MsbyzTa7UtP8Xs X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwODMwMDAwMSBTYWx0ZWRfX6BEhM16vobSR sZvB02NXsoe9nwxVaGxb/IMzvFP5abc1WyGeu0MMF8//xZc/ao2lLtAaEdxov4/77keB50iO7aG oyEoefsDfyMKki17ZZxNXRNIGGPLO4TAG/uJZPDZcQF4DNLUUIXup2T2vco3WdTR7Jm9dKGZIu5 xQzXsjxnqgjZBUqlQUCNiJyt8JQi+ON6pviC0xn0futCj183djQT+JFoze92ERoqYbRiQXXTe6R 31CfnpK4yzgiH1NcEbPz05Eg1kZYCBf3tqWWwTbQ8KhXps1FF6azOI/4t04uQYSJSCqQX6QcFRW JIDr0/rHj2eR/qt4+XY/EgUT7/e53cot2rtWKdRHmTLGH7rU0w8tPEwfj8SYM7WO/HLrdEvlh6s HpqbdCpI 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-02_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 Reviewed-by: Krzysztof Kozlowski --- .../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..8ffed71c5f6a 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-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 10:13:19 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 D06CC341AC3; Tue, 2 Sep 2025 16:49:35 +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=1756831777; cv=none; b=G4Q+MHpTDFhRCTIPdsVZdRtAmRoqbaDqlZy1WCEZYsbLGt6xn6m94MvLtvxM6Ru4DBb2ZBR3Yu+HlFhEqSz485aJEx/d97K4yKf1H3nralkZLzFGwHHZwDxCvkWfPxVlq8i1q1JtJK+cuNPyhm0onwQbmIQt9VduJJxcKQxpWyI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756831777; c=relaxed/simple; bh=VGe+vvHN4XGRtfDrOLNuXGHb6FekmEO4tinbTA7LH/U=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qeNh/CNEJ1z2aFP7ZJYmQ00f+dGwXVMRA6K7nx1sSICTKf87X4RxHnqqKxM5OsX5bXKBv12tgA235+0LKitYVw0i4Y8+0uyrKwBhzh+YrHV717wN2+PYLB7N6UdX/r0rIzMbVCYio0+y4JdJho7kG73bTCH6dc5ldL0ur9xTus0= 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=YUSDfCzi; 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="YUSDfCzi" 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 582EqZQ2001977; Tue, 2 Sep 2025 16:49:23 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=YUSDfCzitjKZGBGN nrkrwqFVOFHpJoVq2z/gItH41at5RUfv5G7005DwKXQ8bv0PGBOe7tZMq9Zig6ew DuupGfZKSMpWtu1rvAveQeFnTEse+F/mcdiDxV0s899w+lmb1c6swHW/TFhWqHFu l1KMfhZReMZS1PMERLYpdwaxLV4UzrGHH5WpSqb0oYPM72cH42rVVfsRU3Xi1nJW YDqnrofQC0bNg8Tt27aTZQX31zr5PkxaXMzig6COppZLu2Pp6od9C4eRsS/XcXMn bronfDLc8vZzPwehsDEnalbmjMYbL1uQ6943r0oiphwIoH7oJqlNsD+8Xby/+eJa 3tklDg== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 48w8wy4esr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Sep 2025 16:49:23 +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 582GnMtH032013 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 2 Sep 2025 16:49:22 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; Tue, 2 Sep 2025 09:49:18 -0700 From: Ram Kumar Dwivedi To: , , , , , , , , CC: , , , Subject: [PATCH V5 2/4] ufs: ufs-qcom: Remove redundant re-assignment to hs_rate Date: Tue, 2 Sep 2025 22:18:58 +0530 Message-ID: <20250902164900.21685-3-quic_rdwivedi@quicinc.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250902164900.21685-1-quic_rdwivedi@quicinc.com> References: <20250902164900.21685-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=Ycq95xRf c=1 sm=1 tr=0 ts=68b72013 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-GUID: -gUEXRyKOu1fuuAvbhOryeLasVetxpTr X-Proofpoint-ORIG-GUID: -gUEXRyKOu1fuuAvbhOryeLasVetxpTr X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTAxMDEwMSBTYWx0ZWRfXyCGlmh1TA+Zc DM1q5PfJ3occrwX5OU+34Jh1wGzZqLc7oXJf+VvaUlMaGlMZjnSYpibYpW8nuTbhfZ0E+yabWVD seHdT+rySNcXwn/j7ohn9Pc+UCstiwuU4T/OswvStBENovg0S7n8ebYAIcRXZg2u2nmzTpmAe4Y zDZGcOcQZyUzHokOgg6IdadnQUfeIQNth2q91JO4xFv9cjK820gFOAX3Fz96yHeiStrTeBOryGU hMatkqTh/4uPK+Q1qZva5oJMRqwBmEPQLzAQx3sSGEBhRLWu4AYPti1jDI0iQgAgCFef1SyEe+H U+MXTYOc3sXbuMVA2vP0TxkN1vmu/eZFmBShbiVsx8+u2okCYf7GE7gsGr1XjcSs0pkLbkof3FN Gx8GswM2 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-02_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" 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 Reviewed-by: Alim Akhtar =20 --- 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 10:13:19 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 04A9A3431FC; Tue, 2 Sep 2025 16:49:39 +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=1756831781; cv=none; b=Rpdb3nSJytLBVmDyzwY/f4er2vWNv366bTXf8n4OpHK0eN2MwmX0p7hTe3AeQEfXZjqFWtpPkomeKoMXX3WcluBhr6zxrUQVwMdX37g5veBppsWaXs8acwBv51slooTGdLzJ4OIOFTcmFjCG2WFM1vzX4mwDDGFWOE4J3D4+ajo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756831781; c=relaxed/simple; bh=++cCQ7ZCSCvafoVGJUq0su+FFdgV+qtROJ9NSGV2MEM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dv3Epm2o2vMwajxWgB/tg/Yj6snbW4mWDGaDzWVu+Co7FrZYKnMlJBNWiM0u3g1oR3wun40p6qZw9E2mSFBEE4ClXCce3f2pFGJEUhox0CcZFG2WyxpBNFajpgwMWJbTua31pXaakGOSJisu4i8SFi10c+j4uK1C6GTLcKCfoTs= 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=a5rzwA0B; 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="a5rzwA0B" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 582EqL8V010204; Tue, 2 Sep 2025 16:49:27 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= AnKOYd4gZ7hpL17xCy5rLxUqnBvLnx2PMUdLuRRdaBc=; b=a5rzwA0Bo10CMWNU JU//LF1HlRwJfEJb+4gXfhg+vPF8nOabRhaBSzgJ/rrr4JrVrMMJ5JJr8COnb7OU j7LZv+82SIrXdVEjh6+WGHsWbEATF9BqWQPlVPBgVhXRs4EJzMA5rMG3p0AsKush Vreb552O3kYcfXeZmOX4XLzb94xPMBr0cilqUXAcprRAnfEx4WA1U1vLYnDa1Qyg bCkgmE+N60ArmuNEC8XvcE+d1iyU7IOQ7ArMrjwFno0RgMA79e/SLHoUac9Z+PPW 2wMJLhc9/acfN4s6Y6jqKxazZp9gKMnTx6NQFH1jv1RfCxda+5f04nL3RsFS+6Kl 66DCGQ== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 48uq0egr3c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Sep 2025 16:49:27 +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 582GnRcw032069 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 2 Sep 2025 16:49:27 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; Tue, 2 Sep 2025 09:49:22 -0700 From: Ram Kumar Dwivedi To: , , , , , , , , CC: , , , , Nitin Rawat Subject: [PATCH V5 3/4] ufs: pltfrm: Allow limiting HS gear and rate via DT Date: Tue, 2 Sep 2025 22:18:59 +0530 Message-ID: <20250902164900.21685-4-quic_rdwivedi@quicinc.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250902164900.21685-1-quic_rdwivedi@quicinc.com> References: <20250902164900.21685-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: vz6g-ACgSsTlRYQCb0zHSyll3aISYTnz X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwODMwMDAwNCBTYWx0ZWRfX0TEf30yWDGvt i1tUgwDDI6D8dhZWGKOh3mT9N0sK5cFQr9/FNO8LIrxf79uC7yhviKIGnQqPaDnFvgCvueTU3q1 hRjSsYT1IW5wyB4e/oLnMdfvopfq1lWyT00S3JOcN1BZBwKQ7s/fB4BjSOnGModGQ+/02KH108B Oo04zIiKorpvAoCnVH+UXcz4AwhrqtteWt5eItjZUBBk1KEoQQs6DNm+B3fhaZPQjlqKcY3SdD5 ltw0YReNqUA2OCFepQ+URKX/l2NtyeIguKJdKoCziYx3Re8suam0Pgaaagc6vos+70tHjUuQTac 8gEWcWYGSApMum/U7xhySdLbmtnXx+NBbYKhNpPH3QcLq/oHafze2XHoj+BVt0+sNHPwND8w0Gc p7lp/tMR X-Proofpoint-ORIG-GUID: vz6g-ACgSsTlRYQCb0zHSyll3aISYTnz X-Authority-Analysis: v=2.4 cv=ea09f6EH c=1 sm=1 tr=0 ts=68b72017 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-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-02_06,2025-08-28_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 clxscore=1015 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 priorityscore=1501 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2508300004 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..4df6885f0dc0 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: %s\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 10:13:19 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 55E98341AC3; Tue, 2 Sep 2025 16:49: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=1756831783; cv=none; b=d8ReG1NqgMN7GdXk57BznjHn5TilnyjcpRcDXpmuIBjOvSRqogt2DedKqlEBB6U/2wPck205/+Ha5B/N1WWDrrVEtDl+EkLe6Mzf0QBQBKWwDLFfCfqouYCR9jUUFYnNkzZJZY88Dr79PxxGerzAMgho9KKWXkT5LcFPuYvLKro= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756831783; c=relaxed/simple; bh=8eYUMhvn+IIZ06qLAmibbHFTwdcu3kwbiOXeFVmY048=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eD2d3p4kHIdz9WFuq/cPeDdv4o6j1FaCRnHQcHbxLE4g0jrxyvPKHx0gm8TZ+fCtQys24WrORcxQK8Bi/8WWow7T5KVtXrovLCZJDNfRXVAzjMRvMDRXjaWJgv4JqenfXv4Cip9OTfyp6u3iTPM4GoGiJcOw5gtdRXSFHIvqtuA= 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=DfeMDtpV; 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="DfeMDtpV" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 582EqL8W010204; Tue, 2 Sep 2025 16:49:32 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=DfeMDtpVSUFRp9zu qgXixTrV0VFWOEeXcgxSKH1RGoU3Px248dVW8Gko8uZ0bVsY2/ydqEP2i2QAAPhy 0WnxGpHR0CXDJNPITjaElXf7Y+VA/L0+GWvRXIbHotka3PUi583wA0VEr7EA5FBY eXGPnO2hKwO8iZYv8J8Lni9wvHWYbo7TvMa/J6ie7jD40Scu/uXaRrR40jR1VoQo Cd7PjienDiyVhOFNXsxu90q9jkpxapYF9l2UcQ10KgUyBMn3DbOiGARNjkTPuPaW 7WWi3SGhuY5Q4IgbYAP3s5kCfNae3CNz0prG9PfhDUDGOCdF55t2T+8g1/rEK7Dq vQlBjQ== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 48uq0egr3g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Sep 2025 16:49:31 +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 582GnVuQ032096 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 2 Sep 2025 16:49:31 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; Tue, 2 Sep 2025 09:49:27 -0700 From: Ram Kumar Dwivedi To: , , , , , , , , CC: , , , Subject: [PATCH V5 4/4] ufs: ufs-qcom: Add support for limiting HS gear and rate Date: Tue, 2 Sep 2025 22:19:00 +0530 Message-ID: <20250902164900.21685-5-quic_rdwivedi@quicinc.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250902164900.21685-1-quic_rdwivedi@quicinc.com> References: <20250902164900.21685-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: YGYlXGqB2wY8gHXkpBgiPvRrWZ0IGWod X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwODMwMDAwNCBTYWx0ZWRfXxkfu/TYRFi9t FaD4AZiIYoS4Az7NA4NavaxW4b3x1u32hMD/xXCJJS7pxPhoRm7RH8WC3N85A21vCBIi6LYR9rq DQ3qI+9RQjw+hp4zpu7xbwxffeyi9qEoCKAz0V64X4OW+mW6h8yKv7M+jJNX4W14yZQVKYeSUcG zgWpdSFB0og+AG95uncrhz0liZGs83kcjni/fkD7Jfdye+AF5BHwR7Kc3kiv2AcFlvtWosa139G 5gnXlEBR/8UsZvtTPU5Nsa5yfa8sFQht3K8tXMT7vSERiNR8GBBYFzOvMrnty2U/c9PFrwy5SbE yFx5o03qXftKXSRyGK9tf0B1+0viXUozk6lnF05uAe1yX6vSHBEop+Eeo7eFW8YJ05vgvFl9FGQ pWJAiO36 X-Proofpoint-ORIG-GUID: YGYlXGqB2wY8gHXkpBgiPvRrWZ0IGWod X-Authority-Analysis: v=2.4 cv=ea09f6EH c=1 sm=1 tr=0 ts=68b7201b 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-02_06,2025-08-28_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 clxscore=1015 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 priorityscore=1501 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2508300004 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