[PATCH v1] scsi: ufs-mediatek: Fix HCI version in some platforms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some MediaTek platforms have incorrect UFSHCI versions showed
in register map. Fix the version by referring to UniPro version
which is always correct.

Signed-off-by: Stanley Chu <stanley.chu@xxxxxxxxxxxx>
---
 drivers/scsi/ufs/ufs-mediatek.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
index 9912e208c2a1..3d3605fd05b2 100644
--- a/drivers/scsi/ufs/ufs-mediatek.c
+++ b/drivers/scsi/ufs/ufs-mediatek.c
@@ -606,6 +606,16 @@ static void ufs_mtk_get_controller_version(struct ufs_hba *hba)
 		if (ver >= UFS_UNIPRO_VER_1_8)
 			host->hw_ver.major = 3;
 	}
+
+	/* Fix HCI version for some platforms with incorrect version */
+	if (hba->ufs_version < ufshci_version(3, 0) &&
+	    host->hw_ver.major == 3)
+		hba->ufs_version = ufshci_version(3, 0);
+}
+
+static u32 ufs_mtk_get_ufs_hci_version(struct ufs_hba *hba)
+{
+	return hba->ufs_version;
 }
 
 /**
@@ -1042,6 +1052,7 @@ static void ufs_mtk_event_notify(struct ufs_hba *hba,
 static const struct ufs_hba_variant_ops ufs_hba_mtk_vops = {
 	.name                = "mediatek.ufshci",
 	.init                = ufs_mtk_init,
+	.get_ufs_hci_version = ufs_mtk_get_ufs_hci_version,
 	.setup_clocks        = ufs_mtk_setup_clocks,
 	.hce_enable_notify   = ufs_mtk_hce_enable_notify,
 	.link_startup_notify = ufs_mtk_link_startup_notify,
-- 
2.18.0




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux