Re: [PATCH v2 2/3] scsi: ufs: mediatek: allow clock scaling when ufs_fde is absent
From: Peter Wang
Date: Fri Nov 27 2026 - 01:45:10 EST
On Fri, 2026-11-27 at 09:10 +0800, Ilia Snezhkov wrote:
> Hi Peter,
>
> No — this patch does not change whether UFSHCD_CAP_CLK_SCALING is
> enabled.
>
> ufs_mtk_is_clk_scale_ready() only checks ufs_sel, ufs_sel_max_src,
> and
> ufs_sel_min_src, so on any platform (including MT6789) whose DT
> provides those three clocks, UFSHCD_CAP_CLK_SCALING is already
> enabled
> today and devfreq already runs. Platforms that omit
> ufs_sel_{min,max}_src
> still have UFSHCD_CAP_CLK_SCALING cleared as before.
>
> What was broken without this patch is that when a DT provides ufs_sel
> and its min/max sources without ufs_fde, _ufs_mtk_clk_scale()
> returned
> early on `!fde_clki`, so ufs_sel never actually switched parents
> while
> ufshcd still treated the scaling transition as successful and updated
> clki->curr_freq.
>
> With this change, MT6789's already-enabled clock scaling actually
> switches ufs_sel between 26 MHz (tck_26m_mx9) and 192 MHz
> (msdcpll_d2)
> as intended.
>
> Best regards,
> Ilia
Hi Ilia,
Sorry, my question was not clear.
Because MediaTek sets the minimum gear to G4:
hba->clk_scaling.min_gear = UFS_HS_G4;
So if the host does not support UFS 4.0 or above, there
should be no reason to enable clock scaling.
And MT6789 is UFSHCI 2.1, as I remember, so clock scaling
should be disabled and ufs_sel_max_src/ufs_sel_min_src
should not be set. So I am curious why they have been set,
and what behavior would clock scaling change in the power mode?
Thanks
Peter