From: "Alim Akhtar" <alim.akhtar@samsung.com>
To: "'Ram Kumar Dwivedi'" <quic_rdwivedi@quicinc.com>,
<avri.altman@wdc.com>, <bvanassche@acm.org>, <robh@kernel.org>,
<krzk+dt@kernel.org>, <conor+dt@kernel.org>, <mani@kernel.org>,
<James.Bottomley@HansenPartnership.com>,
<martin.petersen@oracle.com>
Cc: <linux-scsi@vger.kernel.org>, <devicetree@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>,
"'Nitin Rawat'" <quic_nitirawa@quicinc.com>
Subject: RE: [PATCH V5 3/4] ufs: pltfrm: Allow limiting HS gear and rate via DT
Date: Wed, 3 Sep 2025 09:58:16 +0530 [thread overview]
Message-ID: <3a9001dc1c8b$2d303c40$8790b4c0$@samsung.com> (raw)
In-Reply-To: <20250902164900.21685-4-quic_rdwivedi@quicinc.com>
> -----Original Message-----
> From: Ram Kumar Dwivedi <quic_rdwivedi@quicinc.com>
> Sent: Tuesday, September 2, 2025 10:19 PM
> To: alim.akhtar@samsung.com; avri.altman@wdc.com;
> bvanassche@acm.org; robh@kernel.org; krzk+dt@kernel.org;
> conor+dt@kernel.org; mani@kernel.org;
> James.Bottomley@HansenPartnership.com; martin.petersen@oracle.com
> Cc: linux-scsi@vger.kernel.org; devicetree@vger.kernel.org; linux-
> kernel@vger.kernel.org; linux-arm-msm@vger.kernel.org; Nitin Rawat
> <quic_nitirawa@quicinc.com>
> Subject: [PATCH V5 3/4] ufs: pltfrm: Allow limiting HS gear and rate via
DT
>
> 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 <quic_nitirawa@quicinc.com>
> Signed-off-by: Nitin Rawat <quic_nitirawa@quicinc.com>
> Signed-off-by: Ram Kumar Dwivedi <quic_rdwivedi@quicinc.com>
> ---
> 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-
> pltfrm.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);
>
> +/**
> + * 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
May be s/ufshcd_parse_limits/ ufshcd_parse_gear_limits()
"Limits" is very generic and also not aligning with the property names.
Also suggest to change limit-rate to limit-gear-rate.
> +*host_params) {
> + struct device_node *np = hba->dev->of_node;
> + u32 hs_gear;
> + const char *hs_rate;
> +
> + if (!np)
> + return;
Probably a overkill here, please check if this will ever hit?
> +
> + if (!of_property_read_u32(np, "limit-hs-gear", &hs_gear)) {
> + host_params->hs_tx_gear = hs_gear;
> + host_params->hs_rx_gear = hs_gear;
> + }
> +
> + if (!of_property_read_string(np, "limit-rate", &hs_rate)) {
> + if (!strcmp(hs_rate, "rate-a"))
> + host_params->hs_rate = PA_HS_MODE_A;
> + else if (!strcmp(hs_rate, "rate-b"))
> + host_params->hs_rate = 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 = (struct ufs_host_params){ diff --git
> a/drivers/ufs/host/ufshcd-pltfrm.h b/drivers/ufs/host/ufshcd-pltfrm.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_params *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);
> --
> 2.50.1
next prev parent reply other threads:[~2025-09-03 4:28 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20250902164927epcas5p459352c28c0d5c5a4c04bd88345a049f0@epcas5p4.samsung.com>
2025-09-02 16:48 ` [PATCH V5 0/4] Add DT-based gear and rate limiting support Ram Kumar Dwivedi
2025-09-02 16:48 ` [PATCH V5 1/4] ufs: dt-bindings: Document gear and rate limit properties Ram Kumar Dwivedi
2025-09-03 6:44 ` Krzysztof Kozlowski
2025-09-09 14:58 ` Ram Kumar Dwivedi
2025-09-12 15:44 ` Ram Kumar Dwivedi
2025-09-17 14:09 ` Ram Kumar Dwivedi
2025-09-02 16:48 ` [PATCH V5 2/4] ufs: ufs-qcom: Remove redundant re-assignment to hs_rate Ram Kumar Dwivedi
2025-09-03 4:53 ` Alim Akhtar
2025-09-17 14:29 ` Ram Kumar Dwivedi
2025-09-02 16:48 ` [PATCH V5 3/4] ufs: pltfrm: Allow limiting HS gear and rate via DT Ram Kumar Dwivedi
2025-09-03 4:28 ` Alim Akhtar [this message]
2025-09-17 14:14 ` Ram Kumar Dwivedi
2025-09-02 16:49 ` [PATCH V5 4/4] ufs: ufs-qcom: Add support for limiting HS gear and rate Ram Kumar Dwivedi
2025-09-03 4:48 ` [PATCH V5 0/4] Add DT-based gear and rate limiting support Alim Akhtar
2025-09-17 14:19 ` Ram Kumar Dwivedi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='3a9001dc1c8b$2d303c40$8790b4c0$@samsung.com' \
--to=alim.akhtar@samsung.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=avri.altman@wdc.com \
--cc=bvanassche@acm.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mani@kernel.org \
--cc=martin.petersen@oracle.com \
--cc=quic_nitirawa@quicinc.com \
--cc=quic_rdwivedi@quicinc.com \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox