[PATCH v2 2/3] scsi: ufs: mediatek: allow clock scaling when ufs_fde is absent
From: Ilia Snezhkov via B4 Relay
Date: Wed Nov 25 2026 - 22:10:39 EST
From: Ilia Snezhkov <iasnezhkov@xxxxxxxxx>
ufs_mtk_is_clk_scale_ready() enables UFSHCD_CAP_CLK_SCALING whenever
ufs_sel, ufs_sel_max_src, and ufs_sel_min_src are present, treating the
FDE (AES) clock as optional. However, _ufs_mtk_clk_scale() bails out
early on !fde_clki, so on SoCs without a ufs_fde clock (such as MT6789)
ufshcd believes scaling succeeded and updates clki->curr_freq while the
ufs_sel mux never switches parents.
Only require clki (ufs_sel) in _ufs_mtk_clk_scale(), and gate
clk_fde_scale on fde_clki being non-NULL alongside its min/max parents.
Fixes: 5e5976f5242d ("scsi: ufs: host: mediatek: Support FDE (AES) clock scaling")
Signed-off-by: Ilia Snezhkov <iasnezhkov@xxxxxxxxx>
---
Changes since v1:
- Moved AI coding assistant note below ---.
- Found on hardware and drafted with an AI coding assistant.
drivers/ufs/host/ufs-mediatek.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c
index 38d05ac..09b7993 100644
--- a/drivers/ufs/host/ufs-mediatek.c
+++ b/drivers/ufs/host/ufs-mediatek.c
@@ -2059,7 +2059,7 @@ static void _ufs_mtk_clk_scale(struct ufs_hba *hba, bool scale_up)
if (!hba->clk_scaling.is_initialized)
return;
- if (!clki || !fde_clki)
+ if (!clki)
return;
reg = host->mclk.reg_vcore;
@@ -2067,7 +2067,7 @@ static void _ufs_mtk_clk_scale(struct ufs_hba *hba, bool scale_up)
if (reg && volt != 0)
clk_bind_vcore = true;
- if (mclk->ufs_fde_max_clki && mclk->ufs_fde_min_clki)
+ if (fde_clki && mclk->ufs_fde_max_clki && mclk->ufs_fde_min_clki)
clk_fde_scale = true;
ret = clk_prepare_enable(clki->clk);
--
2.54.0 (Apple Git-157)