All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: ufs: core: Fix mcq mac configuration
@ 2024-02-20  9:56 Rohit Ner
  2024-02-20 20:44 ` Bart Van Assche
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Rohit Ner @ 2024-02-20  9:56 UTC (permalink / raw)
  To: Can Guo, Bean Huo, Bart Van Assche, Martin K. Petersen
  Cc: Avri Altman, Bao D. Nguyen, linux-scsi, linux-kernel, Rohit Ner

As per JEDEC Standard No. 223E Section 5.9.2,
the max # active commands value programmed by the host sw
in MCQConfig.MAC should be one less than the actual value.

Signed-off-by: Rohit Ner <rohitner@google.com>
---
 drivers/ufs/core/ufs-mcq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
index 0787456c2b89..c873fd823942 100644
--- a/drivers/ufs/core/ufs-mcq.c
+++ b/drivers/ufs/core/ufs-mcq.c
@@ -94,7 +94,7 @@ void ufshcd_mcq_config_mac(struct ufs_hba *hba, u32 max_active_cmds)
 
 	val = ufshcd_readl(hba, REG_UFS_MCQ_CFG);
 	val &= ~MCQ_CFG_MAC_MASK;
-	val |= FIELD_PREP(MCQ_CFG_MAC_MASK, max_active_cmds);
+	val |= FIELD_PREP(MCQ_CFG_MAC_MASK, max_active_cmds - 1);
 	ufshcd_writel(hba, val, REG_UFS_MCQ_CFG);
 }
 EXPORT_SYMBOL_GPL(ufshcd_mcq_config_mac);
-- 
2.44.0.rc0.258.g7320e95886-goog


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] scsi: ufs: core: Fix mcq mac configuration
  2024-02-20  9:56 [PATCH] scsi: ufs: core: Fix mcq mac configuration Rohit Ner
@ 2024-02-20 20:44 ` Bart Van Assche
  2024-02-21  8:50 ` Peter Wang (王信友)
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Bart Van Assche @ 2024-02-20 20:44 UTC (permalink / raw)
  To: Rohit Ner, Can Guo, Bean Huo, Martin K. Petersen
  Cc: Avri Altman, Bao D. Nguyen, linux-scsi, linux-kernel, Can Guo

On 2/20/24 01:56, Rohit Ner wrote:
> As per JEDEC Standard No. 223E Section 5.9.2,
> the max # active commands value programmed by the host sw
> in MCQConfig.MAC should be one less than the actual value.
> 
> Signed-off-by: Rohit Ner <rohitner@google.com>
> ---
>   drivers/ufs/core/ufs-mcq.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
> index 0787456c2b89..c873fd823942 100644
> --- a/drivers/ufs/core/ufs-mcq.c
> +++ b/drivers/ufs/core/ufs-mcq.c
> @@ -94,7 +94,7 @@ void ufshcd_mcq_config_mac(struct ufs_hba *hba, u32 max_active_cmds)
>   
>   	val = ufshcd_readl(hba, REG_UFS_MCQ_CFG);
>   	val &= ~MCQ_CFG_MAC_MASK;
> -	val |= FIELD_PREP(MCQ_CFG_MAC_MASK, max_active_cmds);
> +	val |= FIELD_PREP(MCQ_CFG_MAC_MASK, max_active_cmds - 1);
>   	ufshcd_writel(hba, val, REG_UFS_MCQ_CFG);
>   }
>   EXPORT_SYMBOL_GPL(ufshcd_mcq_config_mac);

I'd like to hear the feedback from the UFS controller vendors about this patch
since the UFSHCI specification of the MaxActiveCommand controller field is
ambiguous. While the example shows that 32 should be configured as 1Fh, this is
not documented in any other way.

Thanks,

Bart.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] scsi: ufs: core: Fix mcq mac configuration
  2024-02-20  9:56 [PATCH] scsi: ufs: core: Fix mcq mac configuration Rohit Ner
  2024-02-20 20:44 ` Bart Van Assche
@ 2024-02-21  8:50 ` Peter Wang (王信友)
  2024-02-21  9:07 ` Can Guo
  2024-03-10 21:12 ` Martin K. Petersen
  3 siblings, 0 replies; 5+ messages in thread
From: Peter Wang (王信友) @ 2024-02-21  8:50 UTC (permalink / raw)
  To: quic_cang@quicinc.com, beanhuo@micron.com, rohitner@google.com,
	bvanassche@acm.org, martin.petersen@oracle.com
  Cc: linux-scsi@vger.kernel.org, avri.altman@wdc.com,
	linux-kernel@vger.kernel.org, quic_nguyenb@quicinc.com,
	CC Chou (周志杰),
	Ed Tsai (蔡宗軒),
	Chun-Hung Wu (巫駿宏)

On Tue, 2024-02-20 at 01:56 -0800, Rohit Ner wrote:
> As per JEDEC Standard No. 223E Section 5.9.2,
> the max # active commands value programmed by the host sw
> in MCQConfig.MAC should be one less than the actual value.
> 
> Signed-off-by: Rohit Ner <rohitner@google.com>
> ---
>  drivers/ufs/core/ufs-mcq.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
> index 0787456c2b89..c873fd823942 100644
> --- a/drivers/ufs/core/ufs-mcq.c
> +++ b/drivers/ufs/core/ufs-mcq.c
> @@ -94,7 +94,7 @@ void ufshcd_mcq_config_mac(struct ufs_hba *hba, u32
> max_active_cmds)
>  
>  	val = ufshcd_readl(hba, REG_UFS_MCQ_CFG);
>  	val &= ~MCQ_CFG_MAC_MASK;
> -	val |= FIELD_PREP(MCQ_CFG_MAC_MASK, max_active_cmds);
> +	val |= FIELD_PREP(MCQ_CFG_MAC_MASK, max_active_cmds - 1);
>  	ufshcd_writel(hba, val, REG_UFS_MCQ_CFG);
>  }
>  EXPORT_SYMBOL_GPL(ufshcd_mcq_config_mac);


Meidatek host controller MAC_SUPP_MAC setting is 64, which 
should config to 0x3F.


Reviewed-by: Peter Wang <peter.wang@mediatek.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] scsi: ufs: core: Fix mcq mac configuration
  2024-02-20  9:56 [PATCH] scsi: ufs: core: Fix mcq mac configuration Rohit Ner
  2024-02-20 20:44 ` Bart Van Assche
  2024-02-21  8:50 ` Peter Wang (王信友)
@ 2024-02-21  9:07 ` Can Guo
  2024-03-10 21:12 ` Martin K. Petersen
  3 siblings, 0 replies; 5+ messages in thread
From: Can Guo @ 2024-02-21  9:07 UTC (permalink / raw)
  To: Rohit Ner, Bean Huo, Bart Van Assche, Martin K. Petersen
  Cc: Avri Altman, Bao D. Nguyen, linux-scsi, linux-kernel



On 2/20/2024 5:56 PM, Rohit Ner wrote:
> As per JEDEC Standard No. 223E Section 5.9.2,
> the max # active commands value programmed by the host sw
> in MCQConfig.MAC should be one less than the actual value.
> 
> Signed-off-by: Rohit Ner <rohitner@google.com>
> ---
>   drivers/ufs/core/ufs-mcq.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
> index 0787456c2b89..c873fd823942 100644
> --- a/drivers/ufs/core/ufs-mcq.c
> +++ b/drivers/ufs/core/ufs-mcq.c
> @@ -94,7 +94,7 @@ void ufshcd_mcq_config_mac(struct ufs_hba *hba, u32 max_active_cmds)
>   
>   	val = ufshcd_readl(hba, REG_UFS_MCQ_CFG);
>   	val &= ~MCQ_CFG_MAC_MASK;
> -	val |= FIELD_PREP(MCQ_CFG_MAC_MASK, max_active_cmds);
> +	val |= FIELD_PREP(MCQ_CFG_MAC_MASK, max_active_cmds - 1);
>   	ufshcd_writel(hba, val, REG_UFS_MCQ_CFG);
>   }
>   EXPORT_SYMBOL_GPL(ufshcd_mcq_config_mac);

Reviewed-by: Can Guo <quic_cang@quicinc.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] scsi: ufs: core: Fix mcq mac configuration
  2024-02-20  9:56 [PATCH] scsi: ufs: core: Fix mcq mac configuration Rohit Ner
                   ` (2 preceding siblings ...)
  2024-02-21  9:07 ` Can Guo
@ 2024-03-10 21:12 ` Martin K. Petersen
  3 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2024-03-10 21:12 UTC (permalink / raw)
  To: Rohit Ner
  Cc: Can Guo, Bean Huo, Bart Van Assche, Martin K. Petersen,
	Avri Altman, Bao D. Nguyen, linux-scsi, linux-kernel


Rohit,

> As per JEDEC Standard No. 223E Section 5.9.2, the max # active
> commands value programmed by the host sw in MCQConfig.MAC should be
> one less than the actual value.

Applied to 6.9/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-10 21:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-20  9:56 [PATCH] scsi: ufs: core: Fix mcq mac configuration Rohit Ner
2024-02-20 20:44 ` Bart Van Assche
2024-02-21  8:50 ` Peter Wang (王信友)
2024-02-21  9:07 ` Can Guo
2024-03-10 21:12 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.