From: Martin K. Petersen Date: Fri, 21 Feb 2025 03:11:11 +0000 (-0500) Subject: Merge patch series "Support Multi-frequency scale for UFS" X-Git-Tag: v6.15-rc1~164^2~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e72900272b61c11f2fd4020d4f186124d0d171b;p=thirdparty%2Fkernel%2Fstable.git Merge patch series "Support Multi-frequency scale for UFS" Ziqi Chen says: With OPP V2 enabled, devfreq can scale clocks amongst multiple frequency plans. However, the gear speed is only toggled between min and max during clock scaling. Enable multi-level gear scaling by mapping clock frequencies to gear speeds, so that when devfreq scales clock frequencies we can put the UFS link at the appropraite gear speeds accordingly. This series has been tested on below platforms - sm8550 mtp + UFS3.1 SM8650 MTP + UFS3.1 SM8750 MTP + UFS4.0 Tested-by: Neil Armstrong # on SM8550-QRD Tested-by: Neil Armstrong # on SM8550-HDK Tested-by: Neil Armstrong # on SM8650-HDK Link: https://lore.kernel.org/r/20250213080008.2984807-1-quic_ziqichen@quicinc.com Signed-off-by: Martin K. Petersen --- 7e72900272b61c11f2fd4020d4f186124d0d171b diff --cc Documentation/ABI/testing/sysfs-driver-ufs index ab2adea56715d,da8d1437d3f4b..ae0191295d29b --- a/Documentation/ABI/testing/sysfs-driver-ufs +++ b/Documentation/ABI/testing/sysfs-driver-ufs @@@ -1560,14 -1560,35 +1560,47 @@@ Description The Manufacturer ID is defined by JEDEC in JEDEC-JEP106. The file is read only. +What: /sys/bus/platform/drivers/ufshcd/*/critical_health +What: /sys/bus/platform/devices/*.ufs/critical_health +Date: February 2025 +Contact: Avri Altman +Description: Report the number of times a critical health event has been + reported by a UFS device. Further insight into the specific + issue can be gained by reading one of: bPreEOLInfo, + bDeviceLifeTimeEstA, bDeviceLifeTimeEstB, + bWriteBoosterBufferLifeTimeEst, and bRPMBLifeTimeEst. + + The file is read only. ++ + What: /sys/bus/platform/drivers/ufshcd/*/clkscale_enable + What: /sys/bus/platform/devices/*.ufs/clkscale_enable + Date: January 2025 + Contact: Ziqi Chen + Description: + This attribute shows whether the UFS clock scaling is enabled or not. + And it can be used to enable/disable the clock scaling by writing + 1 or 0 to this attribute. + + The attribute is read/write. + + What: /sys/bus/platform/drivers/ufshcd/*/clkgate_enable + What: /sys/bus/platform/devices/*.ufs/clkgate_enable + Date: January 2025 + Contact: Ziqi Chen + Description: + This attribute shows whether the UFS clock gating is enabled or not. + And it can be used to enable/disable the clock gating by writing + 1 or 0 to this attribute. + + The attribute is read/write. + + What: /sys/bus/platform/drivers/ufshcd/*/clkgate_delay_ms + What: /sys/bus/platform/devices/*.ufs/clkgate_delay_ms + Date: January 2025 + Contact: Ziqi Chen + Description: + This attribute shows and sets the number of milliseconds of idle time + before the UFS driver starts to perform clock gating. This can + prevent the UFS from frequently performing clock gating/ungating. + + The attribute is read/write. diff --cc drivers/ufs/host/ufs-qcom.c index dee00f9a12813,9e90d2ea23dea..d03a07402223b --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@@ -15,7 -15,7 +15,8 @@@ #include #include #include +#include + #include #include @@@ -1369,11 -1348,14 +1371,11 @@@ static int ufs_qcom_set_core_clk_ctrl(s return ufs_qcom_set_clk_40ns_cycles(hba, cycles_in_1us); } - static int ufs_qcom_clk_scale_up_pre_change(struct ufs_hba *hba) + static int ufs_qcom_clk_scale_up_pre_change(struct ufs_hba *hba, unsigned long freq) { - struct ufs_qcom_host *host = ufshcd_get_variant(hba); - struct ufs_pa_layer_attr *attr = &host->dev_req_params; int ret; - ret = ufs_qcom_cfg_timers(hba, attr->gear_rx, attr->pwr_rx, - attr->hs_rate, false, true); + ret = ufs_qcom_cfg_timers(hba, true); if (ret) { dev_err(hba->dev, "%s ufs cfg timer failed\n", __func__); return ret;