scsi: ufs: Add quirk EXTENDED_TX_EQTR_ADAPT_LENGTH_L0L1L2L3
Subsystems (4)
cover scsi: ufs: Add quirk EXTENDED_TX_EQTR_ADAPT_LENGTH_L0L1L2L3
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.
Can Guo (2):
scsi: ufs: core: Add a quirk for extended TX EQTR Adapt L0L1L2L3
length
scsi: ufs: ufs-qcom: Use quirk EXTENDED_TX_EQTR_ADAPT_LENGTH_L0L1L2L3
drivers/ufs/core/ufs-txeq.c | 8 ++++++-- drivers/ufs/host/ufs-qcom.c | 3 +++ include/ufs/ufshcd.h | 7 +++++++ 3 files changed, 16 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/2 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.
--- drivers/ufs/core/ufs-txeq.c | 8 ++++++-- include/ufs/ufshcd.h | 7 +++++++ 2 files changed, 13 insertions(+), 2 deletions(-)
drivers/ufs/core/ufs-txeq.c +6 -2
@@ -740,7 +740,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),
@@ -751,7 +753,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);
include/ufs/ufshcd.h +7 -0
@@ -804,6 +804,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 {
Signature · 1 line
2.34.1
Re: [PATCH 1/2] scsi: ufs: core: Add a quirk for extended TX EQTR Adapt L0L1L2L3 length
Quoted 2 lines · Can Guo
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.
Re: [PATCH 1/2] scsi: ufs: core: Add a quirk for extended TX EQTR Adapt L0L1L2L3 length
In reply to Can GuoQuoted 26 lines · Can Guo
drivers/ufs/core/ufs- renamed from drivers/ufs/core/ufs-txeq.c +0
-0
txeq.c
indexb2dc89124353..fe647450a7a1100644drivers/ufs/core/ufs-txeq.c +0
-0@@ -740,7 +740,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),drivers/ufs/core/ufs-txeq.c +0
-0@@ -751,7 +753,9 @@ static int ufshcd_setup_tx_eqtr_adapt_length(struct ufs_hba *hba,if (
adapt_l0l1l2l3_cap_peer>ADAPT_L0L1L2L3_LENGTH_MAX) {
Quoted 9 lines
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;
Hi Can,
The quirk UFSHCD_QUIRK_EXTENDED_TX_EQTR_ADAPT_LENGTH_L0L1L2L3 is defined as a host quirk, but it appears to be used for the device (peer) in this context. Is this usage wrong or intended?
Thanks
Peter
Re: [PATCH 1/2] scsi: ufs: core: Add a quirk for extended TX EQTR Adapt L0L1L2L3 length
Quoted 40 lines · Peter Wang (王信友)
Quoted 26 lines · Can Guo
drivers/ufs/core/ufs- renamed from drivers/ufs/core/ufs-txeq.c +0
-0
txeq.c
indexb2dc89124353..fe647450a7a1100644drivers/ufs/core/ufs-txeq.c +0
-0@@ -740,7 +740,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),drivers/ufs/core/ufs-txeq.c +0
-0@@ -751,7 +753,9 @@ static int ufshcd_setup_tx_eqtr_adapt_length(struct ufs_hba *hba,if (
adapt_l0l1l2l3_cap_peer>ADAPT_L0L1L2L3_LENGTH_MAX) {Quoted 9 lines
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;Hi Can,
Quoted 3 lines
The quirk
UFSHCD_QUIRK_EXTENDED_TX_EQTR_ADAPT_LENGTH_L0L1L2L3is defined as a host quirk, but it appears to be used for the device (peer) in this context. Is this usage wrong or intended?
Hi Peter,
Thanks for raising this; it is a good question. And I had spent quite some time on this one trying to make it as simple as possible...
Firstly, it is intended. In TX EQTR flow, the host software programs a Adapt Length value to PA_TXADAPTLENGTH_EQTR and initiates TX EQTR procedure. With this quirk enabled, the host software is allowed (by Host HW) to continue TX EQTR even with a value which is above the spec max, so the Host software can attempt an extended (out-of-spec) value.
Then the outcome is naturally determined by the peer device:
1. If the device tolerates the extended value, TX EQTR succeeds.
2. If the device does not, TX EQTR fails as part of normal EQTR behavior.
So the quirk is intentionally host-only.
A separate device quirk could be added, but for this path it would be redundant and would increase maintenance burden (for tracking a list of such devices) without changing the outcome.
I hope I have answered your question and you can understand my considerations.
Thanks,
Can Guo.
Quoted 17 lines
Thanks
Peter************* MEDIATEK Confidentiality Notice ******************** The information contained in this e-mail message (including any attachments) may be confidential, proprietary, privileged, or otherwise exempt from disclosure under applicable laws. It is intended to be conveyed only to the designated recipient(s). Any use, dissemination, distribution, printing, retaining or copying of this e-mail (including its attachments) by unintended recipient(s) is strictly prohibited and may be unlawful. If you are not an intended recipient of this e-mail, or believe that you have received this e-mail in error, please notify the sender immediately (by replying to this e-mail), delete any and all copies of this e-mail (including any attachments) from your system, and do not disclose the content of this e-mail to any other person. Thank you!
Peter Wang (王信友)
Reviewed-byRe: [PATCH 1/2] scsi: ufs: core: Add a quirk for extended TX EQTR Adapt L0L1L2L3 length
Quoted 29 lines · Can Guo
Hi Peter,
Thanks for raising this; it is a good question. And I had spent quite some time
on this one trying to make it as simple as possible...Firstly, it is intended. In TX EQTR flow, the host software programs a Adapt
Length value toPA_TXADAPTLENGTH_EQTRand initiates TX EQTR procedure.
With this quirk enabled, the host software is allowed (by Host HW) to continue
TX EQTR even with a value which is above the spec max, so the Host software
can attempt an extended (out-of-spec) value.Then the outcome is naturally determined by the peer device:
1. If the device tolerates the extended value, TX EQTR succeeds.
2. If the device does not, TX EQTR fails as part of normal EQTR behavior.So the quirk is intentionally host-only.
A separate device quirk could be added, but for this path it would be redundant
and would increase maintenance burden (for tracking a list of such devices) without
changing the outcome.
Quoted 6 lines
I hope I have answered your question and you can understand my considerations.
Thanks,
Can Guo.
Hi Can,
Thank you for the clarification. I have no further questions.
Re: [PATCH 1/2] scsi: ufs: core: Add a quirk for extended TX EQTR Adapt L0L1L2L3 length
In reply to Can GuoQuoted 4 lines · Can Guo
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 <[email protected]>
Quoted 49 lines
--- drivers/ufs/core/ufs-txeq.c | 8 ++++++-- include/ufs/ufshcd.h | 7 +++++++ 2 files changed, 13 insertions(+), 2 deletions(-)drivers/ufs/core/ufs-txeq.c +6
-2@@ -740,7 +740,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),@@ -751,7 +753,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);include/ufs/ufshcd.h +7
-0@@ -804,6 +804,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 {
Re: [PATCH 1/2] scsi: ufs: core: Add a quirk for extended TX EQTR Adapt L0L1L2L3 length
In reply to Can GuoQuoted 4 lines · Can Guo
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 <[email protected]>
looks good to me.
PATCH 2/2 scsi: ufs: ufs-qcom: Use quirk EXTENDED_TX_EQTR_ADAPT_LENGTH_L0L1L2L3
In reply to Can GuoUse UFSHCD_QUIRK_EXTENDED_TX_EQTR_ADAPT_LENGTH_L0L1L2L3 for UFS Hosts HW major version 0x7 & minor version 0x1.
--- drivers/ufs/host/ufs-qcom.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/ufs/host/ufs-qcom.c +3 -0
@@ -1305,6 +1305,9 @@ static void ufs_qcom_advertise_quirks(struct ufs_hba *hba)if (host->hw_ver.major >0x3 ) hba->quirks |=UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH ; +if (host->hw_ver.major ==0x7 && host->hw_ver.minor ==0x1 ) + hba->quirks |=UFSHCD_QUIRK_EXTENDED_TX_EQTR_ADAPT_LENGTH_L0L1L2L3 ; +if (drvdata && drvdata->quirks) hba->quirks |= drvdata->quirks; }
Signature · 1 line
2.34.1
Bart Van Assche
reviewerRe: [PATCH 2/2] scsi: ufs: ufs-qcom: Use quirk EXTENDED_TX_EQTR_ADAPT_LENGTH_L0L1L2L3
drivers/ufs/host/ufs-qcom.c static void ufs_qcom_advertise_quirks(struct ufs_hba *hba) · line 1309
Quoted 2 lines · Can Guo
drivers/ufs/host/ufs-qcom.c +2
-0+if (host->hw_ver.major ==0x7 && host->hw_ver.minor ==0x1 ) + hba->quirks |=UFSHCD_QUIRK_EXTENDED_TX_EQTR_ADAPT_LENGTH_L0L1L2L3 ;
How about future versions of the Qualcomm controller? Will future versions support this feature?
Thanks,
Bart.
Re: [PATCH 2/2] scsi: ufs: ufs-qcom: Use quirk EXTENDED_TX_EQTR_ADAPT_LENGTH_L0L1L2L3
Hi Bart,
Quoted 5 lines · Bart Van Assche
Quoted 3 lines · Can Guo
+ if (
host->hw_ver.major==0x7&&host->hw_ver.minor==0x1) +hba->quirks|=UFSHCD_QUIRK_EXTENDED_TX_EQTR_ADAPT_LENGTH_L0L1L2L3;How about future versions of the Qualcomm controller? Will future versions support this feature?
Minor version 0x2 might need the same Quirk, 0x3 might not. I don't have a real HW/silicon with minor version 0x2 or 0x3 handy yet to verify, this is the best I can do as of today.
Thanks,
Can Guo.
Quoted 4 lines
Thanks,
Bart.
Re: [PATCH 2/2] scsi: ufs: ufs-qcom: Use quirk EXTENDED_TX_EQTR_ADAPT_LENGTH_L0L1L2L3
In reply to Can GuoQuoted 13 lines · Can Guo
Use
UFSHCD_QUIRK_EXTENDED_TX_EQTR_ADAPT_LENGTH_L0L1L2L3for UFS Hosts HW major version0x7& minor version0x1.Signed-off-by Can Guo <[email protected]>--- drivers/ufs/host/ufs-qcom.c | 3 +++ 1 file changed, 3 insertions(+)drivers/ufs/host/ufs-qcom.c +0
-0
drivers/ufs/host/ufs-qcom.c static void ufs_qcom_advertise_quirks(struct ufs_hba *hba) · line 1313
Quoted 9 lines
drivers/ufs/host/ufs-qcom.c +3
-0@@ -1305,6 +1305,9 @@ static void ufs_qcom_advertise_quirks(struct ufs_hba *hba)if (host->hw_ver.major >0x3 ) hba->quirks |=UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH ; +if (host->hw_ver.major ==0x7 && host->hw_ver.minor ==0x1 ) + hba->quirks |=UFSHCD_QUIRK_EXTENDED_TX_EQTR_ADAPT_LENGTH_L0L1L2L3 ; +if (drvdata && drvdata->quirks) hba->quirks |= drvdata->quirks; }
Re: [PATCH 2/2] scsi: ufs: ufs-qcom: Use quirk EXTENDED_TX_EQTR_ADAPT_LENGTH_L0L1L2L3
In reply to Can GuoQuoted 4 lines · Can Guo
Use
UFSHCD_QUIRK_EXTENDED_TX_EQTR_ADAPT_LENGTH_L0L1L2L3for UFS Hosts HW major version0x7& minor version0x1.Signed-off-by Can Guo <[email protected]>
Martin K. Petersen
AppliedCan,
Quoted 2 lines
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.
Applied to 7.2/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen
Martin K. Petersen
AppliedQuoted 10 lines · Can Guo
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.
Can Guo (2):
scsi: ufs: core: Add a quirk for extended TX EQTR Adapt L0L1L2L3
length
scsi: ufs: ufs-qcom: Use quirkEXTENDED_TX_EQTR_ADAPT_LENGTH_L0L1L2L3[...]
Applied to 7.2/scsi-queue, thanks!
[1/2] scsi: ufs: core: Add a quirk for extended TX EQTR Adapt L0L1L2L3 length
https://git.kernel.org/mkp/scsi/c/8933fa6695aa [2/2] scsi: ufs: ufs-qcom: Use quirk EXTENDED_TX_EQTR_ADAPT_LENGTH_L0L1L2L3 https://git.kernel.org/mkp/scsi/c/0f51fd846843
Signature · 1 line
Martin K. Petersen