* [PATCH v2 0/3] ufs-qcom: Add specified gear support for multi gear scaling
@ 2026-12-02 8:14 Giri Prasad Goriparthi
2026-12-02 8:14 ` [PATCH v2 1/3] scsi: ufs: " Giri Prasad Goriparthi
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Giri Prasad Goriparthi @ 2026-12-02 8:14 UTC (permalink / raw)
To: Manivannan Sadhasivam, James E.J. Bottomley, Martin K. Petersen,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: Nitin Rawat, linux-arm-msm, linux-scsi, linux-kernel, devicetree,
Giri Prasad Goriparthi, Ziqi Chen, Manivannan Sadhasivam
This patch series adds support for configuring UFS gear speeds on a
per-OPP frequency basis for Qualcomm UFS host controllers, enabling
more flexible multi-gear scaling.
On certain Qualcomm platforms, the UFS clock frequency and gear speed
do not have a strict one-to-one mapping. To handle this, the first patch
introduces a device tree based configuration mechanism using the
"opp-level" property within the OPP table. This allows each supported
operating frequency to be explicitly associated with a specific HS gear
speed. When this property is absent, the driver gracefully falls back to
the existing default frequency-to-gear lookup table.
The second patch applies this configuration to the Hamoa platform,
assigning the appropriate HS gear levels (G1, G3, G5) to the
corresponding OPP frequency entries in the device tree.
The third patch applies this configuration to the Talos platform,
assigning the appropriate HS gear levels (G1, G1, G3) to the
corresponding OPP frequency entries in the device tree.
Changes in V2:
- Retained Reviewed-by tag from Mani on hamoa.dtsi
- Drop __func__ from dev_err() [Mani]
- Fix variable declaration order to preserve Xmas order [Mani]
- Fix opp-level validation to check OPP_LEVEL_UNSET
explicitly [sashiko-bot]
- Add Talos DT opp-level entries
Signed-off-by: Giri Prasad Goriparthi <giri.goriparthi@oss.qualcomm.com>
---
Giri Prasad Goriparthi (3):
scsi: ufs: ufs-qcom: Add specified gear support for multi gear scaling
arm64: dts: qcom: hamoa: Add opp-level for UFS gear speed
arm64: dts: qcom: talos: Add opp-level for UFS gear speed
arch/arm64/boot/dts/qcom/hamoa.dtsi | 3 +++
arch/arm64/boot/dts/qcom/talos.dtsi | 3 +++
drivers/ufs/host/ufs-qcom.c | 24 ++++++++++++++++++++++--
3 files changed, 28 insertions(+), 2 deletions(-)
---
base-commit: d138596e9f822033490b2e577ec2ea64f2aa246c
change-id: 20261201-b4-ufs-qcom-multi-gear-scaling-30e082d0aeb6
Best regards,
--
Giri Prasad Goriparthi <giri.goriparthi@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/3] scsi: ufs: ufs-qcom: Add specified gear support for multi gear scaling
2026-12-02 8:14 [PATCH v2 0/3] ufs-qcom: Add specified gear support for multi gear scaling Giri Prasad Goriparthi
@ 2026-12-02 8:14 ` Giri Prasad Goriparthi
2026-12-02 11:20 ` Konrad Dybcio
2026-12-02 8:14 ` [PATCH v2 2/3] arm64: dts: qcom: hamoa: Add opp-level for UFS gear speed Giri Prasad Goriparthi
2026-12-02 8:15 ` [PATCH v2 3/3] arm64: dts: qcom: talos: " Giri Prasad Goriparthi
2 siblings, 1 reply; 5+ messages in thread
From: Giri Prasad Goriparthi @ 2026-12-02 8:14 UTC (permalink / raw)
To: Manivannan Sadhasivam, James E.J. Bottomley, Martin K. Petersen,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: Nitin Rawat, linux-arm-msm, linux-scsi, linux-kernel, devicetree,
Giri Prasad Goriparthi, Ziqi Chen
The UFS clock frequency and gear speed do not necessarily have a strict
one-to-one correspondence on all platforms. Introduce a device tree
based configuration interface that allows specifying the HS gear
speed for each supported operating frequency via the "opp-level"
property in the OPP table. When this property is not configured, the
driver falls back to the default frequency-to-gear mapping table.
Signed-off-by: Ziqi Chen <ziqi.chen@oss.qualcomm.com>
Signed-off-by: Nitin Rawat <nitin.rawat@oss.qualcomm.com>
Signed-off-by: Giri Prasad Goriparthi <giri.goriparthi@oss.qualcomm.com>
---
drivers/ufs/host/ufs-qcom.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
index 6afb8498b8c2..cc6380ebb145 100644
--- a/drivers/ufs/host/ufs-qcom.c
+++ b/drivers/ufs/host/ufs-qcom.c
@@ -2506,7 +2506,7 @@ static unsigned long ufs_qcom_opp_freq_to_clk_freq(struct ufs_hba *hba,
bool found = false;
opp = dev_pm_opp_find_freq_exact_indexed(hba->dev, freq, 0, true);
- if (IS_ERR(opp)) {
+ if (IS_ERR_OR_NULL(opp)) {
dev_err(hba->dev, "Failed to find OPP for exact frequency %lu\n", freq);
return 0;
}
@@ -2535,12 +2535,32 @@ static unsigned long ufs_qcom_opp_freq_to_clk_freq(struct ufs_hba *hba,
static u32 ufs_qcom_freq_to_gear_speed(struct ufs_hba *hba, unsigned long freq)
{
- u32 gear = UFS_HS_DONT_CHANGE;
unsigned long unipro_freq;
+ struct dev_pm_opp *opp;
+ u32 gear = UFS_HS_DONT_CHANGE;
if (!hba->use_pm_opp)
return gear;
+ opp = dev_pm_opp_find_freq_exact_indexed(hba->dev, freq, 0, true);
+ if (IS_ERR_OR_NULL(opp)) {
+ dev_err(hba->dev, "Failed to find OPP for exact frequency %lu\n", freq);
+ return gear;
+ }
+
+ /* Get HS gear speed from 'opp-level' */
+ gear = dev_pm_opp_get_level(opp);
+ dev_pm_opp_put(opp);
+
+ /*
+ * If opp-level is not configured in DT or the specified gear exceeds
+ * the max supported gear, fall back to the frequency-to-gear table.
+ */
+ if (gear != OPP_LEVEL_UNSET && gear <= hba->max_pwr_info.info.gear_rx)
+ return gear;
+
+ gear = UFS_HS_DONT_CHANGE;
+
unipro_freq = ufs_qcom_opp_freq_to_clk_freq(hba, freq, "core_clk_unipro");
switch (unipro_freq) {
case 403000000:
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 2/3] arm64: dts: qcom: hamoa: Add opp-level for UFS gear speed
2026-12-02 8:14 [PATCH v2 0/3] ufs-qcom: Add specified gear support for multi gear scaling Giri Prasad Goriparthi
2026-12-02 8:14 ` [PATCH v2 1/3] scsi: ufs: " Giri Prasad Goriparthi
@ 2026-12-02 8:14 ` Giri Prasad Goriparthi
2026-12-02 8:15 ` [PATCH v2 3/3] arm64: dts: qcom: talos: " Giri Prasad Goriparthi
2 siblings, 0 replies; 5+ messages in thread
From: Giri Prasad Goriparthi @ 2026-12-02 8:14 UTC (permalink / raw)
To: Manivannan Sadhasivam, James E.J. Bottomley, Martin K. Petersen,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: Nitin Rawat, linux-arm-msm, linux-scsi, linux-kernel, devicetree,
Giri Prasad Goriparthi, Manivannan Sadhasivam
Assign the appropriate UFS HS gear speed levels to each OPP frequency
entry in the device tree, enabling proper per-frequency gear
scaling (G1 at 75MHz, G3 at 150MHz, G5 at 300MHz).
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Signed-off-by: Nitin Rawat <nitin.rawat@oss.qualcomm.com>
Signed-off-by: Giri Prasad Goriparthi <giri.goriparthi@oss.qualcomm.com>
---
arch/arm64/boot/dts/qcom/hamoa.dtsi | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/hamoa.dtsi b/arch/arm64/boot/dts/qcom/hamoa.dtsi
index 443c1a5c212d..71c8a428de51 100644
--- a/arch/arm64/boot/dts/qcom/hamoa.dtsi
+++ b/arch/arm64/boot/dts/qcom/hamoa.dtsi
@@ -3946,6 +3946,7 @@ opp-75000000 {
/bits/ 64 <0>,
/bits/ 64 <0>,
/bits/ 64 <0>;
+ opp-level = <1>; /* HS-G1 */
required-opps = <&rpmhpd_opp_low_svs>;
};
@@ -3958,6 +3959,7 @@ opp-150000000 {
/bits/ 64 <0>,
/bits/ 64 <0>,
/bits/ 64 <0>;
+ opp-level = <3>; /* HS-G3 */
required-opps = <&rpmhpd_opp_svs>;
};
@@ -3970,6 +3972,7 @@ opp-300000000 {
/bits/ 64 <0>,
/bits/ 64 <0>,
/bits/ 64 <0>;
+ opp-level = <5>; /* HS-G5 */
required-opps = <&rpmhpd_opp_nom>;
};
};
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 3/3] arm64: dts: qcom: talos: Add opp-level for UFS gear speed
2026-12-02 8:14 [PATCH v2 0/3] ufs-qcom: Add specified gear support for multi gear scaling Giri Prasad Goriparthi
2026-12-02 8:14 ` [PATCH v2 1/3] scsi: ufs: " Giri Prasad Goriparthi
2026-12-02 8:14 ` [PATCH v2 2/3] arm64: dts: qcom: hamoa: Add opp-level for UFS gear speed Giri Prasad Goriparthi
@ 2026-12-02 8:15 ` Giri Prasad Goriparthi
2 siblings, 0 replies; 5+ messages in thread
From: Giri Prasad Goriparthi @ 2026-12-02 8:15 UTC (permalink / raw)
To: Manivannan Sadhasivam, James E.J. Bottomley, Martin K. Petersen,
Bjorn Andersson, Konrad Dybcio, Abel Vesa, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: Nitin Rawat, linux-arm-msm, linux-scsi, linux-kernel, devicetree,
Giri Prasad Goriparthi
Assign the appropriate UFS HS gear speed levels to each OPP frequency
entry in the device tree, enabling proper per-frequency gear
scaling (G1 at 50MHz, G1 at 100MHz, G3 at 200MHz).
Signed-off-by: Giri Prasad Goriparthi <giri.goriparthi@oss.qualcomm.com>
---
arch/arm64/boot/dts/qcom/talos.dtsi | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/talos.dtsi b/arch/arm64/boot/dts/qcom/talos.dtsi
index 1d74e459f892..b9e21108637d 100644
--- a/arch/arm64/boot/dts/qcom/talos.dtsi
+++ b/arch/arm64/boot/dts/qcom/talos.dtsi
@@ -1498,6 +1498,7 @@ opp-50000000 {
/bits/ 64 <0>,
/bits/ 64 <0>,
/bits/ 64 <75000000>;
+ opp-level = <1>;
required-opps = <&rpmhpd_opp_low_svs>;
};
@@ -1510,6 +1511,7 @@ opp-100000000 {
/bits/ 64 <0>,
/bits/ 64 <0>,
/bits/ 64 <150000000>;
+ opp-level = <1>;
required-opps = <&rpmhpd_opp_svs>;
};
@@ -1522,6 +1524,7 @@ opp-200000000 {
/bits/ 64 <0>,
/bits/ 64 <0>,
/bits/ 64 <300000000>;
+ opp-level = <3>;
required-opps = <&rpmhpd_opp_nom>;
};
};
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/3] scsi: ufs: ufs-qcom: Add specified gear support for multi gear scaling
2026-12-02 8:14 ` [PATCH v2 1/3] scsi: ufs: " Giri Prasad Goriparthi
@ 2026-12-02 11:20 ` Konrad Dybcio
0 siblings, 0 replies; 5+ messages in thread
From: Konrad Dybcio @ 2026-12-02 11:20 UTC (permalink / raw)
To: Giri Prasad Goriparthi, Manivannan Sadhasivam,
James E.J. Bottomley, Martin K. Petersen, Bjorn Andersson,
Konrad Dybcio, Abel Vesa, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: Nitin Rawat, linux-arm-msm, linux-scsi, linux-kernel, devicetree,
Ziqi Chen
On 12/2/26 9:14 AM, Giri Prasad Goriparthi wrote:
> The UFS clock frequency and gear speed do not necessarily have a strict
> one-to-one correspondence on all platforms. Introduce a device tree
> based configuration interface that allows specifying the HS gear
> speed for each supported operating frequency via the "opp-level"
> property in the OPP table. When this property is not configured, the
> driver falls back to the default frequency-to-gear mapping table.
>
> Signed-off-by: Ziqi Chen <ziqi.chen@oss.qualcomm.com>
> Signed-off-by: Nitin Rawat <nitin.rawat@oss.qualcomm.com>
> Signed-off-by: Giri Prasad Goriparthi <giri.goriparthi@oss.qualcomm.com>
> ---
> drivers/ufs/host/ufs-qcom.c | 24 ++++++++++++++++++++++--
> 1 file changed, 22 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
> index 6afb8498b8c2..cc6380ebb145 100644
> --- a/drivers/ufs/host/ufs-qcom.c
> +++ b/drivers/ufs/host/ufs-qcom.c
> @@ -2506,7 +2506,7 @@ static unsigned long ufs_qcom_opp_freq_to_clk_freq(struct ufs_hba *hba,
> bool found = false;
>
> opp = dev_pm_opp_find_freq_exact_indexed(hba->dev, freq, 0, true);
> - if (IS_ERR(opp)) {
> + if (IS_ERR_OR_NULL(opp)) {
> dev_err(hba->dev, "Failed to find OPP for exact frequency %lu\n", freq);
> return 0;
> }
> @@ -2535,12 +2535,32 @@ static unsigned long ufs_qcom_opp_freq_to_clk_freq(struct ufs_hba *hba,
>
> static u32 ufs_qcom_freq_to_gear_speed(struct ufs_hba *hba, unsigned long freq)
> {
> - u32 gear = UFS_HS_DONT_CHANGE;
> unsigned long unipro_freq;
> + struct dev_pm_opp *opp;
> + u32 gear = UFS_HS_DONT_CHANGE;
nite: spurious reshuffling
Konrad
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-12-02 11:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-02 8:14 [PATCH v2 0/3] ufs-qcom: Add specified gear support for multi gear scaling Giri Prasad Goriparthi
2026-12-02 8:14 ` [PATCH v2 1/3] scsi: ufs: " Giri Prasad Goriparthi
2026-12-02 11:20 ` Konrad Dybcio
2026-12-02 8:14 ` [PATCH v2 2/3] arm64: dts: qcom: hamoa: Add opp-level for UFS gear speed Giri Prasad Goriparthi
2026-12-02 8:15 ` [PATCH v2 3/3] arm64: dts: qcom: talos: " Giri Prasad Goriparthi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®