[PATCH V1 2/3] scsi: ufs: pltfrm: Add parsing support for disable LPM property

Nitin Rawat posted 3 patches 8 months ago
There is a newer version of this series
[PATCH V1 2/3] scsi: ufs: pltfrm: Add parsing support for disable LPM property
Posted by Nitin Rawat 8 months ago
There are emulation FPGA platforms or other platforms where UFS low
power mode is either unsupported or power efficiency is not a critical
requirement.

Add support for parsing disable LPM property from device tree . The
disable lpm support in devicetree is added through the "disable-lpm"
property for such platforms.

Disabling LPM ensure stable operation and compatibility with these
environments, where power management features might interfere with
performance or functionality.

Signed-off-by: Nitin Rawat <quic_nitirawa@quicinc.com>
---
 drivers/ufs/host/ufshcd-pltfrm.c | 15 +++++++++++++++
 include/ufs/ufshcd.h             |  1 +
 2 files changed, 16 insertions(+)

diff --git a/drivers/ufs/host/ufshcd-pltfrm.c b/drivers/ufs/host/ufshcd-pltfrm.c
index ffe5d1d2b215..764525d9262b 100644
--- a/drivers/ufs/host/ufshcd-pltfrm.c
+++ b/drivers/ufs/host/ufshcd-pltfrm.c
@@ -210,6 +210,19 @@ static void ufshcd_init_lanes_per_dir(struct ufs_hba *hba)
 	}
 }

+/**
+ * ufshcd_parse_lpm_support - read from DT whether LPM modes should be disabled.
+ * @hba: host controller instance
+ */
+static void ufshcd_parse_lpm_support(struct ufs_hba *hba)
+{
+	struct device *dev = hba->dev;
+
+	hba->disable_lpm = of_property_read_bool(dev->of_node, "disable-lpm");
+	if (hba->disable_lpm)
+		dev_info(hba->dev, "UFS LPM is disabled\n");
+}
+
 /**
  * ufshcd_parse_clock_min_max_freq  - Parse MIN and MAX clocks freq
  * @hba: per adapter instance
@@ -495,6 +508,8 @@ int ufshcd_pltfrm_init(struct platform_device *pdev,

 	ufshcd_init_lanes_per_dir(hba);

+	ufshcd_parse_lpm_support(hba);
+
 	err = ufshcd_parse_operating_points(hba);
 	if (err) {
 		dev_err(dev, "%s: OPP parse failed %d\n", __func__, err);
diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
index e928ed0265ff..5a3daed1f086 100644
--- a/include/ufs/ufshcd.h
+++ b/include/ufs/ufshcd.h
@@ -1143,6 +1143,7 @@ struct ufs_hba {
 	int critical_health_count;
 	atomic_t dev_lvl_exception_count;
 	u64 dev_lvl_exception_id;
+	bool disable_lpm;
 };

 /**
--
2.48.1
Re: [PATCH V1 2/3] scsi: ufs: pltfrm: Add parsing support for disable LPM property
Posted by Mukesh Kumar Savaliya 8 months ago

On 4/17/2025 6:16 PM, Nitin Rawat wrote:
[...]
> +/**
> + * ufshcd_parse_lpm_support - read from DT whether LPM modes should be disabled.
> + * @hba: host controller instance
> + */
> +static void ufshcd_parse_lpm_support(struct ufs_hba *hba)
> +{
> +	struct device *dev = hba->dev;
> +
> +	hba->disable_lpm = of_property_read_bool(dev->of_node, "disable-lpm");
> +	if (hba->disable_lpm)
> +		dev_info(hba->dev, "UFS LPM is disabled\n");
How about keeping as debug ?
> +}
> +
[...]
> --
> 2.48.1
> 
>
Re: [PATCH V1 2/3] scsi: ufs: pltfrm: Add parsing support for disable LPM property
Posted by Rob Herring 7 months, 3 weeks ago
On Fri, Apr 18, 2025 at 10:13:46AM +0530, Mukesh Kumar Savaliya wrote:
> 
> 
> On 4/17/2025 6:16 PM, Nitin Rawat wrote:
> [...]
> > +/**
> > + * ufshcd_parse_lpm_support - read from DT whether LPM modes should be disabled.
> > + * @hba: host controller instance
> > + */
> > +static void ufshcd_parse_lpm_support(struct ufs_hba *hba)
> > +{
> > +	struct device *dev = hba->dev;
> > +
> > +	hba->disable_lpm = of_property_read_bool(dev->of_node, "disable-lpm");
> > +	if (hba->disable_lpm)
> > +		dev_info(hba->dev, "UFS LPM is disabled\n");
> How about keeping as debug ?

Why print it at all. You can just read the DT from userspace.

Rob