From: Can Guo Date: Fri, 1 May 2026 13:16:40 +0000 (-0700) Subject: scsi: ufs: core: Add a quirk for extended TX EQTR Adapt L0L1L2L3 length X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8933fa6695aaea6559d3469581139a4c1f427369;p=thirdparty%2Flinux.git scsi: ufs: core: Add a quirk for extended TX EQTR Adapt L0L1L2L3 length Add a quirk to support TX Equalization Training (EQTR) using Adapt L0L1L2L3 length which is larger than what is allowed by M-PHY spec ver 6.0. Signed-off-by: Can Guo Reviewed-by: Bean Huo Reviewed-by: Bart Van Assche Reviewed-by: Peter Wang Reviewed-by: Ziqi Chen Link: https://patch.msgid.link/20260501131641.826258-2-can.guo@oss.qualcomm.com Signed-off-by: Martin K. Petersen --- diff --git a/drivers/ufs/core/ufs-txeq.c b/drivers/ufs/core/ufs-txeq.c index 4b264adfdf49..aa64f2bf4f1e 100644 --- a/drivers/ufs/core/ufs-txeq.c +++ b/drivers/ufs/core/ufs-txeq.c @@ -885,7 +885,9 @@ static int ufshcd_setup_tx_eqtr_adapt_length(struct ufs_hba *hba, if (adapt_l0l1l2l3_cap_local > ADAPT_L0L1L2L3_LENGTH_MAX) { dev_err(hba->dev, "local RX_HS_G%u_ADAPT_INITIAL_L0L1L2L3_CAP (0x%x) exceeds MAX\n", gear, adapt_l0l1l2l3_cap_local); - return -EINVAL; + + if (!(hba->quirks & UFSHCD_QUIRK_EXTENDED_TX_EQTR_ADAPT_LENGTH_L0L1L2L3)) + return -EINVAL; } ret = ufshcd_dme_get(hba, UIC_ARG_MIB(PA_PEERRXHSG6ADAPTINITIALL0L1L2L3), @@ -896,7 +898,9 @@ static int ufshcd_setup_tx_eqtr_adapt_length(struct ufs_hba *hba, if (adapt_l0l1l2l3_cap_peer > ADAPT_L0L1L2L3_LENGTH_MAX) { dev_err(hba->dev, "peer RX_HS_G%u_ADAPT_INITIAL_L0L1L2L3_CAP (0x%x) exceeds MAX\n", gear, adapt_l0l1l2l3_cap_peer); - return -EINVAL; + + if (!(hba->quirks & UFSHCD_QUIRK_EXTENDED_TX_EQTR_ADAPT_LENGTH_L0L1L2L3)) + return -EINVAL; } t_adapt_l0l1l2l3_local = adapt_cap_to_t_adapt_l0l1l2l3(adapt_l0l1l2l3_cap_local); diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index f48d6416e299..3eaae082329c 100644 --- a/include/ufs/ufshcd.h +++ b/include/ufs/ufshcd.h @@ -806,6 +806,13 @@ enum ufshcd_quirks { * delay after enabling VCC to ensure it's stable. */ UFSHCD_QUIRK_VCC_ON_DELAY = 1 << 27, + + /* + * This quirk indicates that Host supports TX Equalization Training + * (EQTR) using Adapt L0L1L2L3 length which is larger than what is + * allowed by M-PHY spec ver 6.0. + */ + UFSHCD_QUIRK_EXTENDED_TX_EQTR_ADAPT_LENGTH_L0L1L2L3 = 1 << 28, }; enum ufshcd_caps {