diff mbox series

scsi: ufs: Adjust logic in common ADAPT helper

Message ID 20201121044810.507288-1-bjorn.andersson@linaro.org (mailing list archive)
State Accepted
Commit 66df79ccbc2f617a2bbaa7108a2b50a6869de5d4
Headers show
Series scsi: ufs: Adjust logic in common ADAPT helper | expand

Commit Message

Bjorn Andersson Nov. 21, 2020, 4:48 a.m. UTC
The introduction of ufshcd_dme_configure_adapt() refactored out
duplication from the Mediatek and Qualcomm drivers.

Both these implementations had the logic of:
    gear_tx == UFS_HS_G4 => PA_INITIAL_ADAPT
    gear_tx != UFS_HS_G4 => PA_NO_ADAPT

but now both implementations pass PA_INITIAL_ADAPT as "adapt_val" and if
gear_tx is not UFS_HS_G4 that is replaced with PA_INITIAL_ADAPT. In
other words, it's PA_INITIAL_ADAPT in both above cases.

The result is that e.g. Qualcomm SM8150 has no longer functional UFS, so
adjust the logic to match the previous implementation.

Fixes: fc85a74e28fe ("scsi: ufs: Refactor ADAPT configuration function")
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
 drivers/scsi/ufs/ufshcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stanley Chu Nov. 21, 2020, 4:23 p.m. UTC | #1
On Fri, 2020-11-20 at 20:48 -0800, Bjorn Andersson wrote:
> The introduction of ufshcd_dme_configure_adapt() refactored out
> duplication from the Mediatek and Qualcomm drivers.
> 
> Both these implementations had the logic of:
>     gear_tx == UFS_HS_G4 => PA_INITIAL_ADAPT
>     gear_tx != UFS_HS_G4 => PA_NO_ADAPT
> 
> but now both implementations pass PA_INITIAL_ADAPT as "adapt_val" and if
> gear_tx is not UFS_HS_G4 that is replaced with PA_INITIAL_ADAPT. In
> other words, it's PA_INITIAL_ADAPT in both above cases.
> 
> The result is that e.g. Qualcomm SM8150 has no longer functional UFS, so
> adjust the logic to match the previous implementation.
> 
> Fixes: fc85a74e28fe ("scsi: ufs: Refactor ADAPT configuration function")
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Thanks for the fix.

Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Can Guo Nov. 23, 2020, 1:25 a.m. UTC | #2
On 2020-11-21 12:48, Bjorn Andersson wrote:
> The introduction of ufshcd_dme_configure_adapt() refactored out
> duplication from the Mediatek and Qualcomm drivers.
> 
> Both these implementations had the logic of:
>     gear_tx == UFS_HS_G4 => PA_INITIAL_ADAPT
>     gear_tx != UFS_HS_G4 => PA_NO_ADAPT
> 
> but now both implementations pass PA_INITIAL_ADAPT as "adapt_val" and 
> if
> gear_tx is not UFS_HS_G4 that is replaced with PA_INITIAL_ADAPT. In
> other words, it's PA_INITIAL_ADAPT in both above cases.
> 
> The result is that e.g. Qualcomm SM8150 has no longer functional UFS, 
> so
> adjust the logic to match the previous implementation.
> 
> Fixes: fc85a74e28fe ("scsi: ufs: Refactor ADAPT configuration 
> function")
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Reviewed-by: Can Guo <cang@codeaurora.org>

> ---
>  drivers/scsi/ufs/ufshcd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 52e077aa3efe..13281c74cb4f 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -3618,7 +3618,7 @@ int ufshcd_dme_configure_adapt(struct ufs_hba 
> *hba,
>  	int ret;
> 
>  	if (agreed_gear != UFS_HS_G4)
> -		adapt_val = PA_INITIAL_ADAPT;
> +		adapt_val = PA_NO_ADAPT;
> 
>  	ret = ufshcd_dme_set(hba,
>  			     UIC_ARG_MIB(PA_TXHSADAPTTYPE),
Martin K. Petersen Nov. 24, 2020, 3:08 a.m. UTC | #3
Bjorn,

> The introduction of ufshcd_dme_configure_adapt() refactored out
> duplication from the Mediatek and Qualcomm drivers.

Applied to 5.11/scsi-staging, thanks!
Martin K. Petersen Dec. 1, 2020, 5:04 a.m. UTC | #4
On Fri, 20 Nov 2020 20:48:10 -0800, Bjorn Andersson wrote:

> The introduction of ufshcd_dme_configure_adapt() refactored out
> duplication from the Mediatek and Qualcomm drivers.
> 
> Both these implementations had the logic of:
>     gear_tx == UFS_HS_G4 => PA_INITIAL_ADAPT
>     gear_tx != UFS_HS_G4 => PA_NO_ADAPT
> 
> [...]

Applied to 5.11/scsi-queue, thanks!

[1/1] scsi: ufs: Adjust logic in common ADAPT helper
      https://git.kernel.org/mkp/scsi/c/66df79ccbc2f
patchwork-bot+linux-arm-msm@kernel.org Dec. 29, 2020, 8:15 p.m. UTC | #5
Hello:

This patch was applied to qcom/linux.git (refs/heads/for-next):

On Fri, 20 Nov 2020 20:48:10 -0800 you wrote:
> The introduction of ufshcd_dme_configure_adapt() refactored out
> duplication from the Mediatek and Qualcomm drivers.
> 
> Both these implementations had the logic of:
>     gear_tx == UFS_HS_G4 => PA_INITIAL_ADAPT
>     gear_tx != UFS_HS_G4 => PA_NO_ADAPT
> 
> [...]

Here is the summary with links:
  - scsi: ufs: Adjust logic in common ADAPT helper
    https://git.kernel.org/qcom/c/66df79ccbc2f

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 52e077aa3efe..13281c74cb4f 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -3618,7 +3618,7 @@  int ufshcd_dme_configure_adapt(struct ufs_hba *hba,
 	int ret;
 
 	if (agreed_gear != UFS_HS_G4)
-		adapt_val = PA_INITIAL_ADAPT;
+		adapt_val = PA_NO_ADAPT;
 
 	ret = ufshcd_dme_set(hba,
 			     UIC_ARG_MIB(PA_TXHSADAPTTYPE),