Skip to content

Commit 86a678a

Browse files
ptr324martinkpetersen
authored andcommitted
scsi: ufs: host: mediatek: Fine-tune clock scaling
Disable clock scaling for UFS versions below 4.0. Clock scaling is unnecessary for these versions, and this change ensures that the feature is only enabled for compatible UFS versions. Signed-off-by: Peter Wang <peter.wang@mediatek.com> Link: https://lore.kernel.org/r/20250811131423.3444014-5-peter.wang@mediatek.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent f91c6c7 commit 86a678a

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

drivers/ufs/host/ufs-mediatek.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "ufs-mediatek-sip.h"
3030

3131
static int ufs_mtk_config_mcq(struct ufs_hba *hba, bool irq);
32+
static void _ufs_mtk_clk_scale(struct ufs_hba *hba, bool scale_up);
3233

3334
#define CREATE_TRACE_POINTS
3435
#include "ufs-mediatek-trace.h"
@@ -1144,6 +1145,17 @@ static void ufs_mtk_fix_ahit(struct ufs_hba *hba)
11441145
ufs_mtk_setup_clk_gating(hba);
11451146
}
11461147

1148+
static void ufs_mtk_fix_clock_scaling(struct ufs_hba *hba)
1149+
{
1150+
/* UFS version is below 4.0, clock scaling is not necessary */
1151+
if ((hba->dev_info.wspecversion < 0x0400) &&
1152+
ufs_mtk_is_clk_scale_ready(hba)) {
1153+
hba->caps &= ~UFSHCD_CAP_CLK_SCALING;
1154+
1155+
_ufs_mtk_clk_scale(hba, false);
1156+
}
1157+
}
1158+
11471159
static void ufs_mtk_init_mcq_irq(struct ufs_hba *hba)
11481160
{
11491161
struct ufs_mtk_host *host = ufshcd_get_variant(hba);
@@ -1774,6 +1786,7 @@ static void ufs_mtk_fixup_dev_quirks(struct ufs_hba *hba)
17741786
ufs_mtk_vreg_fix_vcc(hba);
17751787
ufs_mtk_vreg_fix_vccqx(hba);
17761788
ufs_mtk_fix_ahit(hba);
1789+
ufs_mtk_fix_clock_scaling(hba);
17771790
}
17781791

17791792
static void ufs_mtk_event_notify(struct ufs_hba *hba,

0 commit comments

Comments
 (0)