]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
scsi: ufs: host: mediatek: Fix adapt issue after PA_Init
authorAlice Chao <alice.chao@mediatek.com>
Wed, 3 Sep 2025 02:44:44 +0000 (10:44 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Nov 2025 20:37:18 +0000 (15:37 -0500)
[ Upstream commit d73836cb8535b3078e4d2a57913f301baec58a33 ]

Address the issue where the host does not send adapt to the device after
PA_Init success. Ensure the adapt process is correctly initiated for
devices with IP version MT6899 and above, resolving communication issues
between the host and device.

Signed-off-by: Alice Chao <alice.chao@mediatek.com>
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/ufs/host/ufs-mediatek.c

index 3defb5f135e33f76ddef4d185e780102fb9876ef..c0acbd3f8fc36f0133be7887460f484f4f618072 100644 (file)
@@ -1503,8 +1503,19 @@ static int ufs_mtk_pre_link(struct ufs_hba *hba)
 
        return ret;
 }
+
 static void ufs_mtk_post_link(struct ufs_hba *hba)
 {
+       struct ufs_mtk_host *host = ufshcd_get_variant(hba);
+       u32 tmp;
+
+       /* fix device PA_INIT no adapt */
+       if (host->ip_ver >= IP_VER_MT6899) {
+               ufshcd_dme_get(hba, UIC_ARG_MIB(VS_DEBUGOMC), &tmp);
+               tmp |= 0x100;
+               ufshcd_dme_set(hba, UIC_ARG_MIB(VS_DEBUGOMC), tmp);
+       }
+
        /* enable unipro clock gating feature */
        ufs_mtk_cfg_unipro_cg(hba, true);
 }