diff mbox series

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

Message ID 20250417124645.24456-3-quic_nitirawa@quicinc.com
State New
Headers show
Series Add support to disable UFS LPM | expand

Commit Message

Nitin Rawat April 17, 2025, 12:46 p.m. UTC
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(+)

--
2.48.1

Comments

Mukesh Kumar Savaliya April 18, 2025, 4:43 a.m. UTC | #1
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
> 
>
diff mbox series

Patch

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;
 };

 /**