Skip to content

Commit 2c89e41

Browse files
Stanley Chumartinkpetersen
authored andcommitted
scsi: ufs: ufs-mediatek: Fix HCI version in some platforms
Some MediaTek SoC platforms with UFSHCI version below 3.0 have incorrect UFSHCI versions showed in register map. Fix the version by referring to UniPro version which is always correct. Link: https://lore.kernel.org/r/20210531062642.12642-1-stanley.chu@mediatek.com Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 79c932c commit 2c89e41

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

drivers/scsi/ufs/ufs-mediatek.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,11 +603,23 @@ static void ufs_mtk_get_controller_version(struct ufs_hba *hba)
603603

604604
ret = ufshcd_dme_get(hba, UIC_ARG_MIB(PA_LOCALVERINFO), &ver);
605605
if (!ret) {
606-
if (ver >= UFS_UNIPRO_VER_1_8)
606+
if (ver >= UFS_UNIPRO_VER_1_8) {
607607
host->hw_ver.major = 3;
608+
/*
609+
* Fix HCI version for some platforms with
610+
* incorrect version
611+
*/
612+
if (hba->ufs_version < ufshci_version(3, 0))
613+
hba->ufs_version = ufshci_version(3, 0);
614+
}
608615
}
609616
}
610617

618+
static u32 ufs_mtk_get_ufs_hci_version(struct ufs_hba *hba)
619+
{
620+
return hba->ufs_version;
621+
}
622+
611623
/**
612624
* ufs_mtk_init - find other essential mmio bases
613625
* @hba: host controller instance
@@ -1048,6 +1060,7 @@ static void ufs_mtk_event_notify(struct ufs_hba *hba,
10481060
static const struct ufs_hba_variant_ops ufs_hba_mtk_vops = {
10491061
.name = "mediatek.ufshci",
10501062
.init = ufs_mtk_init,
1063+
.get_ufs_hci_version = ufs_mtk_get_ufs_hci_version,
10511064
.setup_clocks = ufs_mtk_setup_clocks,
10521065
.hce_enable_notify = ufs_mtk_hce_enable_notify,
10531066
.link_startup_notify = ufs_mtk_link_startup_notify,

0 commit comments

Comments
 (0)