From nobody Sat Oct 4 01:47:31 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 5138C2F5321; Thu, 21 Aug 2025 10:16:47 +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=1755771409; cv=none; b=XhPWSCYtOP8BBfjWc/z5zcO9M7s9N+IuClGVPUK+JOoYjQS4NEwCw20Byuz9oM/rmkB795rCXVXW+e8+4YiOorGatia7qAFlkufxMlGBN+un/+2BDs4HCVTgWPOPUZUZEPFMvCh9PzYHGHS7n39GoiE1nlKFoAgdiNIv66jzhF4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755771409; c=relaxed/simple; bh=qGdffQAYDy9Zpli6nIsjxsdzWi2FjO9LzS7NsecWZ2s=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qGBvwGgLprKphATFvIN9W/wLF3TQ7QwVivIcDQ+TwM6/aWJn1xywiA3QlG2JXWznmtTRQvM6C6ZQhkm0T33EcjBsMD+gAv+vtfOx5I85RP4HCF44aL+gMMWTwMeT7Ia+SyUd2HxmM7J7TqDiFtwZEZp76UVP+zqCnsZ1W7PUiok= 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=KslYxRKF; 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="KslYxRKF" 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 57L9b7Xk012751; Thu, 21 Aug 2025 10:16:36 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= EJsgyT6vX12WTbaENXwAw3xS/mnFPEHbGVUHjVavjL0=; b=KslYxRKF1ba1wwWY Ht18+BM7dSENHKms6xj9/bNDWu/TbFeLLii7FGq7l55fUwb236hmsZmQJIc13R1Y gt7o7lAaMHryXg5OcGz5R6JFNC8xP5GmsErunoRK1ab3HP7+wVzXuA8R+9krMl8r M0Vq01NlNzZ5MAj94PpGzHQIK5LxjivkB6awMO6iWZhAZMs+uV/mA1phC7bFMav3 yKiM3rZp7LmtDdbkvKNJWSjPdlCBQcTqkpMgd4DvxlzOg4CgmmZiZc6u3Dzl13Hb m1EJt5c7amfClu0gyQ1IrRnBEx76lNJBgJGzLWA8U23nWDIK1D4+xmDDQ51vLmCc fP4J0Q== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 48ngt8au8e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Aug 2025 10:16:35 +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 57LAGYb0019000 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Aug 2025 10:16:34 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.10; Thu, 21 Aug 2025 03:16:29 -0700 From: Ram Kumar Dwivedi To: , , , , , , , , , , , CC: , , , Subject: [PATCH V2 1/4] ufs: dt-bindings: Document gear and rate limit properties Date: Thu, 21 Aug 2025 15:46:06 +0530 Message-ID: <20250821101609.20235-2-quic_rdwivedi@quicinc.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250821101609.20235-1-quic_rdwivedi@quicinc.com> References: <20250821101609.20235-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: AW1haW4tMjUwODIwMDEzNCBTYWx0ZWRfX3I4bgCzF7P4p P0ESeOmhG6PULMFNHfXj9WIUVlulmTgp5Dx13PuEXPsXld7wLwSnB7lYxbx1D5c1fVVEEqL7XdF VC5AAfiTGiqHtZCIpwmK7GTIQCZflZUgtfn5N9CVv044ZScm2V6cEaRr421WheCwRhVbQnuD3uP DOg1dB5CM2M1HINmw40fWL0eVgRehZTSD7DyoxtjUdGjLVTngs2hoD6TFjCOdbf939jqjJc1hQF Lpx90OnGdy8XrtNrah2d8Uc2MOygdAfpTbjX8NANrNINJ9dCQo7F+gJpUjHHuNJUZzw0PDc78QQ P7QkVwGPCPkYPm55Al/42ERjn6zYvH/szGr8O3u+c3/kqWgho24e8Cg8vLNg/zBzAjIp89zLcWb TjLABGtk0Tifn5SOAE/bvgPvgWy49g== X-Authority-Analysis: v=2.4 cv=c/fygR9l c=1 sm=1 tr=0 ts=68a6f203 cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=2OwXVqhp2XgA:10 a=COk6AnOGAAAA:8 a=Umu3u8L3Ayb6iz0Wi2cA:9 a=TjNXssC_j7lpFel5tvFf:22 a=cPQSjfK2_nFv0Q5t_7PE:22 X-Proofpoint-GUID: FMqCkDbGLT7rzz4OHU_kS7ofYTS6aPQ6 X-Proofpoint-ORIG-GUID: FMqCkDbGLT7rzz4OHU_kS7ofYTS6aPQ6 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-08-21_02,2025-08-20_03,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 adultscore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 impostorscore=0 clxscore=1015 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2508110000 definitions=main-2508200134 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..baa978389ec7 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 + description: + Restricts the maximum HS gear used in both TX and RX directions, + typically for hardware or power constraints in automotive use cases. + + limit-rate: + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [1, 2] + description: + Restricts the UFS controller to Rate A (1) or Rate B (2) for both + TX and RX directions, often required in automotive environments due + to hardware limitations. + dependencies: freq-table-hz: [ clocks ] operating-points-v2: [ clocks, clock-names ] --=20 2.50.1 From nobody Sat Oct 4 01:47:31 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 2E5DB2F8BD0; Thu, 21 Aug 2025 10:16:50 +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=1755771412; cv=none; b=NqDYz8xAIY9hLjXpl025cUn8dEcWaEqd+fswrKnZwI0SMHZzCoCn1EqDMqIEodCSCMKH4ELspZwGVw6QNUrqoC0lTNi3F/JV9k3Y5tijV5tyk/keBgsAx7E0fSv8yXkqQTL7DaJBcW+OIPE/i1X5/ZoNGHMkRrMe2QyomgVS1UQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755771412; c=relaxed/simple; bh=VGe+vvHN4XGRtfDrOLNuXGHb6FekmEO4tinbTA7LH/U=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WGCXWkipTUQOZq6ga/sh5A5G3jYM3y54wNSVmYvXsLHl1eIs9z6RRtQbhXuXDB4RegvrclNKkLP1mYxWMfqXQnfd/JHrAJlTHjB9ZU+/7xvgajoVIUwd8TFKdUJPrBF8fOCnKu+tzCIOhXTdBphXOwLhwdePe2HeqE7CW7fjDPo= 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=R4f5fj+h; 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="R4f5fj+h" 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 57L9b87k012775; Thu, 21 Aug 2025 10:16:41 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=R4f5fj+hBODKQEcG GMdWGYWKw+wKsPsxKQTAn528IphzTsOcy2Z7RrSDBYFtOrM2i/NYU8gOydBc0TVs pKR7mPumFbxLWctL5+lr/HKmywRMQRzZlonF878LIYWAEVQYeCR8/uHQoC7kwwmo eq5DFN+3EqwU42C6ODGZLRJ4m/DtyLmrx+3hJRVvNwHqDSeTdOK79MqxmgDk5f0n e/rTBm78khFqaoFeZREM/kziKL7VsZSEwoGOHb64pY28DT/6Skog56whPREncyc5 K+BeNL96tVDhBLKTPrcEz+SKJd0rYLIBlYMqlhyysoZv7a6FWdi9a61PXMpb/qZX /94DTw== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 48ngt8au8m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Aug 2025 10:16:41 +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 57LAGdei000534 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Aug 2025 10:16:40 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.10; Thu, 21 Aug 2025 03:16:34 -0700 From: Ram Kumar Dwivedi To: , , , , , , , , , , , CC: , , , Subject: [PATCH V2 2/4] ufs: ufs-qcom: Remove redundant re-assignment to hs_rate Date: Thu, 21 Aug 2025 15:46:07 +0530 Message-ID: <20250821101609.20235-3-quic_rdwivedi@quicinc.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250821101609.20235-1-quic_rdwivedi@quicinc.com> References: <20250821101609.20235-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: AW1haW4tMjUwODIwMDEzNCBTYWx0ZWRfX8j5ZJ0QXnTbz q83fJbFi3f9tNFyyZdB8fimZ1UJzgPS+i7BKSKV3Vb4wG+0TlY11ReJHWH1qLteuxpoEaI8iDcW OPs7qicDOrkA3TGSlCTiFA5btVauQGnul3tSuyoWKPB8ajJeABZ1Lfc6wr2nZP7ZvCaMSnMkiEu fawGBIqcvaYRo8N/AeQBR5pf2OJVoGYDuuUy9bon1j/Jx/UzjWH4xooA+8UwZbPu3M5ZgLfmtTY ghhn0ENfVUcEXILAohinEekLQT+Do3EDjP6dBwfXje1VZeMOVObNpBVcjUyQTi/lURIDRVQQTAK a9fCdMpdEn0+jUNdqvmofmWrDsIKjEk4CwEin//daf5K3eQFIKO84ywwfTAxq6l5ZrvVkdyMvu2 82blZdiiZ4j4SsNPbueE06FkVn8gkQ== X-Authority-Analysis: v=2.4 cv=c/fygR9l c=1 sm=1 tr=0 ts=68a6f209 cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=2OwXVqhp2XgA:10 a=COk6AnOGAAAA:8 a=BKJdvgQya1QnqZ38-EkA:9 a=TjNXssC_j7lpFel5tvFf:22 a=cPQSjfK2_nFv0Q5t_7PE:22 X-Proofpoint-GUID: UbTWA_uCbkjn86eglmAvI-Kd--kwl5O_ X-Proofpoint-ORIG-GUID: UbTWA_uCbkjn86eglmAvI-Kd--kwl5O_ 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-08-21_02,2025-08-20_03,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 adultscore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 impostorscore=0 clxscore=1015 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2508110000 definitions=main-2508200134 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 Sat Oct 4 01:47:31 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 8FF672FABE3; Thu, 21 Aug 2025 10:16:56 +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=1755771418; cv=none; b=kL4HgO+DMNaXE0WevusRyljsVY3CQ0MdYWYO0XQVhgCJOrQZSVfkDUDEFulXWQAjpJcofovvRMB/fbOHiIbtX+/o0KIe6cnJQVGwZ0FE66E4PSvzCgSQCB1AYNKaP8TSOEEvNNgfA1QmBqQ0p/PHFlhiyraxxhEB4TiL4nIg0Qk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755771418; c=relaxed/simple; bh=pm7rDd7h1+T5q5dVLa2839IPqvyBtCLAYQLM0ZoMepA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Zhw8wuFZjR1QUJqdDFjN7Lrnfj6smr66BlSIR/F0zWhYdgrhjSILc5QY5kWSOwyObE/z5ddn5ogWaZiKTVvLSZ12+cDTPw9rPf/+I8jilOdhQUNinO5ik4fOIhrE7f4TUL7H2aWy3+51jIibcMGfQRsrWbfGI6kBAKUn02iH5pw= 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=ag+ZRgqz; 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="ag+ZRgqz" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 57L9bILS013281; Thu, 21 Aug 2025 10:16:46 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= ZQVCuwtBy1hMTF9eQCCTaLJvqnj9Mqm5glMb7xR1KNc=; b=ag+ZRgqzx9drEVI6 PP6ihY+1BrJV2ZNL8tWmz56SZv59GqFH+8fHBQfKkW4vMQ/rpFCwuCLpMmUeK1tC MuoAMZH9Z7mWjIqZ0Mm+vcHpWe0zr/8J74rRRRWBDBntTXNIXVo3IAo2uCeN8ts5 4hysZXSDdnBgm6sFkpFt8wObZiBEIE6AqmwE+/325OlyihwwKR5EvA2YnDkGPl2H 1wlsrOp9kNC00QuT1wQuqvqce1/vn2GmDo6bqHvavPZdvu0tW60u+eiIoHn4ZGsA NzpnKV2YM9uXE3/N6LKkHEdRXuTN4PXt+ZyZ/2xllSJ/vhZsW8pESpGz6rxIRxKo 6dxAfw== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 48n52dmyma-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Aug 2025 10:16:46 +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 57LAGjqb000618 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Aug 2025 10:16:45 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.10; Thu, 21 Aug 2025 03:16:40 -0700 From: Ram Kumar Dwivedi To: , , , , , , , , , , , CC: , , , Subject: [PATCH V2 3/4] ufs: pltfrm: Allow limiting HS gear and rate via DT Date: Thu, 21 Aug 2025 15:46:08 +0530 Message-ID: <20250821101609.20235-4-quic_rdwivedi@quicinc.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250821101609.20235-1-quic_rdwivedi@quicinc.com> References: <20250821101609.20235-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: AW1haW4tMjUwODIwMDAxMyBTYWx0ZWRfX+kPVn+sV33n1 2GVqEzIY1C8tvQdhAgwU7jh2TzHcAV7S8cxj10FSwRQZ+UFgdI6hbY3UbEzhlUB9n+PFanWUm0W 5c7zGvML0gR78THCDrlzZoTs9A443swIEbfZS1FgQaa6NomcZU/LSblJdTyztUMjLmbBO4D2xCI J+5aatasJuXNAoZc6w6JwBQ91ULna4JLzjQAvwC5rTeg0WTFqhnxru/rcoX77cecEhwQWazf+Lt 7Zd7JG9BwECiznsszisVbYbpBn1C0RRocXuvoET5o6sPAAvRyEzA/qdiTJ0oOEb6kcREA7unC9B rDsOK3ReRFs0d+m+c0mSILGnHD0kBwH4DQ2ABVYpTxsWdRhYJip7D2OiEtbNvGiizfmMW/deKM1 cPXGEZjJo8PPZJaBPjAoeFYfT1xzlg== X-Proofpoint-ORIG-GUID: Qvzi-R-rr5OAxKN424DsrjTHiKTwKQC- X-Proofpoint-GUID: Qvzi-R-rr5OAxKN424DsrjTHiKTwKQC- X-Authority-Analysis: v=2.4 cv=SoXJKPO0 c=1 sm=1 tr=0 ts=68a6f20e cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=2OwXVqhp2XgA:10 a=COk6AnOGAAAA:8 a=eseaCGvrkytYtZHUcXsA:9 a=TjNXssC_j7lpFel5tvFf:22 a=cPQSjfK2_nFv0Q5t_7PE: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-08-21_02,2025-08-20_03,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 spamscore=0 adultscore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 suspectscore=0 malwarescore=0 phishscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2508110000 definitions=main-2508200013 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. Signed-off-by: Ram Kumar Dwivedi --- drivers/ufs/host/ufshcd-pltfrm.c | 29 +++++++++++++++++++++++++++++ drivers/ufs/host/ufshcd-pltfrm.h | 1 + 2 files changed, 30 insertions(+) diff --git a/drivers/ufs/host/ufshcd-pltfrm.c b/drivers/ufs/host/ufshcd-plt= frm.c index ffe5d1d2b215..d9be6c86f044 100644 --- a/drivers/ufs/host/ufshcd-pltfrm.c +++ b/drivers/ufs/host/ufshcd-pltfrm.c @@ -430,6 +430,35 @@ 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, 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_u32(np, "limit-rate", &hs_rate)) + host_params->hs_rate =3D 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 Sat Oct 4 01:47:31 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 142D12F5483; Thu, 21 Aug 2025 10:17:01 +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=1755771423; cv=none; b=rbkiKJ8WlkoBG4zpy5FPVtmMVt1ymEYu9/0BHl+4ntlLA4nEN7xdbPkzPxcwwDWyvmdjZ0l8hKBVw+D+bbrmpi0Fsis2JYoxWmFl0l3a8vIWAnAU/C+CEfCPW4QEzvFMgSx2w8mZl9L0ogxOlLUxK1E826fVYJsGQQFPBD0RwXs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755771423; c=relaxed/simple; bh=8eYUMhvn+IIZ06qLAmibbHFTwdcu3kwbiOXeFVmY048=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gGz0kv+eNsS6h50j9mwIZ7WDQDmD7w5nBA2L9O1z8Z14woArrplraLR+3utJVFzb+L5heVvxlXDRRIS2z+WEw5jrNHqTPOh0nZp2t4/J63uImv4AHOm10VOtS9ovWmusyt3Z+WvyG93WrHnRyUi2firECnVY7tvc1iWerxG6i7w= 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=YOPq8Kme; 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="YOPq8Kme" 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 57L9b7Cq014677; Thu, 21 Aug 2025 10:16:51 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=YOPq8KmeKbND9hhH oF9I18OI4S19RvHgUVmw1Ktrv9wmLPi/o9ZzvYXPiU4rIVjPWgB7dbCY7PVpuOv6 0WWLRDkfWMBhuS5hKigncR/cE8qWxIZJ0vId7rtx0mdBQwZeEvBCm6Sw3+v0yAa+ dex3D+ZB+CcVo15GjLUttJ8oQXetBoF24ipBFBI9kTfryfcDc1uf/wqJEne7XqyF Vb7n11jiOuHw471KtqbciEX6ObqhF+SzV9+pBUYWR+EjWRqvGP9Zg71NnjHTqHhk DTRy4kDnP0TZ47hnkmVnkjpuOcbUeawOuoHlgnBJ3+SqAMzij6uSH609V3pH4HKR UIikjg== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 48n528w071-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Aug 2025 10:16:51 +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 57LAGo1Q000671 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Aug 2025 10:16:50 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.10; Thu, 21 Aug 2025 03:16:45 -0700 From: Ram Kumar Dwivedi To: , , , , , , , , , , , CC: , , , Subject: [PATCH V2 4/4] ufs: ufs-qcom: Add support for limiting HS gear and rate Date: Thu, 21 Aug 2025 15:46:09 +0530 Message-ID: <20250821101609.20235-5-quic_rdwivedi@quicinc.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250821101609.20235-1-quic_rdwivedi@quicinc.com> References: <20250821101609.20235-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=fpOFpF4f c=1 sm=1 tr=0 ts=68a6f213 cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=2OwXVqhp2XgA:10 a=COk6AnOGAAAA:8 a=YZsCTDY-3J_n_fZr9xEA:9 a=TjNXssC_j7lpFel5tvFf:22 a=cPQSjfK2_nFv0Q5t_7PE:22 X-Proofpoint-GUID: 4ggwesiU1qExUjFQI9lifa8hdmnVIr7o X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwODIwMDAxMyBTYWx0ZWRfXy3npf0/BvzIz ajqUPr3GV8wORQb/8LWCg/YhK4Xt4D8UhRvCMqUua/BxzGNG5U6U5IcHHqhPx9Rrn1FQaUO5jyJ +65Yn2KDL9oLuLWjKS/TmiCv3QM2CpXnubBa04k5GD62yC1xGHd9dsgP55344ZZk2lwsBiY8wGM wtWAVPvN3KdqbXvEJkwlrOCT17xahWMm21AJ7xidhmkMbkV4F7AvamS43vIEfg57D2ZLpZsiJCy POjJr4gt3VJdlUjufDjEBZL3IxP3NfAzitRrqJfvxPRQysP2P/YwoJ20I5xpaq4mJeJnY1Nrzep oozkIKMxfy1JOZyy35ePE7D3ioAdByWa2/ze/yDWQDIHOML5jb1Hd9FANr+dR4Wr3a8Z51hB8Ja /qlEQYfJq9m/WkbYynt7v2GiuE2ARw== X-Proofpoint-ORIG-GUID: 4ggwesiU1qExUjFQI9lifa8hdmnVIr7o 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-08-21_02,2025-08-20_03,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 spamscore=0 clxscore=1015 adultscore=0 suspectscore=0 bulkscore=0 phishscore=0 impostorscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2508110000 definitions=main-2508200013 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