scsi: ufs-mediatek: Fix HCI version in some platforms
PATCH 1/1 scsi: ufs-mediatek: Fix HCI version in some platforms
Some MediaTek platforms have incorrect UFSHCI versions showed in register map. Fix the version by referring to UniPro version which is always correct.
--- drivers/scsi/ufs/ufs-mediatek.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/scsi/ufs/ufs-mediatek.c +11 -0
@@ -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,
Signature · 1 line
2.18.0
Hi Stanley,
Quoted 12 lines
-----Original Message-----
From: Stanley Chu <[email protected]>
Sent: 31 May 2021 10:48
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Stanley Chu <[email protected]>
Subject: [PATCH v1] scsi: ufs-mediatek: Fix HCI version in some platforms
Quoted 2 lines
Some MediaTek platforms have incorrect UFSHCI versions showed in register map. Fix the version by referring to UniPro version which is always
correct.
Quoted 1 line
A bit of extra details will help here, like say HCI version below 3.0 is broken on some MediaTek SoC etc.
That will also help to understand if this was a deviation from HCI spec.
Quoted 2 lines
Signed-off-by Stanley Chu <[email protected]>---
With the updated commit message, feel free to add
Review
Quoted 4 lines
drivers/scsi/ufs/ufs-mediatek.c | 11 +++++++++++ 1 file changed, 11 insertions(+)(quoted diff) +0
-0
b/drivers/scsi/ufs/ufs-mediatek.c
Quoted 29 lines
index
9912e208c2a1..3d3605fd05b2100644drivers/scsi/ufs/ufs-mediatek.c +9
-1@@ -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
Hi Alim,
Quoted 14 lines · Alim Akhtar
Hi Stanley,
Quoted 12 lines
-----Original Message-----
From: Stanley Chu <[email protected]>
Sent: 31 May 2021 10:48
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Stanley Chu <[email protected]>
Subject: [PATCH v1] scsi: ufs-mediatek: Fix HCI version in some platforms
Quoted 7 lines
Quoted 2 lines
Some MediaTek platforms have incorrect UFSHCI versions showed in register map. Fix the version by referring to UniPro version which is always
correct.
Quoted 1 line
A bit of extra details will help here, like say HCI version below 3.0 is broken on some MediaTek SoC etc.
That will also help to understand if this was a deviation from HCI spec.
Thanks for the review.
I would fix it in next version.
Quoted 43 lines
Quoted 3 lines
Signed-off-by Stanley Chu <[email protected]>---
With the updated commit message, feel free to add
Reviewed-by Alim Akhtar <[email protected]>Review
Quoted 4 lines
drivers/scsi/ufs/ufs-mediatek.c | 11 +++++++++++ 1 file changed, 11 insertions(+)(quoted diff) +0
-0
b/drivers/scsi/ufs/ufs-mediatek.cQuoted 29 lines
index
9912e208c2a1..3d3605fd05b2100644drivers/scsi/ufs/ufs-mediatek.c +9
-1@@ -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