mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Peter Wang (王信友)" <peter.wang@mediatek.com>
To: "avri.altman@wdc.com" <avri.altman@wdc.com>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>
Cc: "beanhuo@micron.com" <beanhuo@micron.com>,
	"bvanassche@acm.org" <bvanassche@acm.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH v6 2/3] scsi: ufs: Maximum RTT supported by the host driver
Date: Tue, 28 May 2024 10:02:24 +0000	[thread overview]
Message-ID: <81e11b3d3e55aed0b3b9e83fcd05852858bfcbf1.camel@mediatek.com> (raw)
In-Reply-To: <20240526081636.2064-3-avri.altman@wdc.com>

On Sun, 2024-05-26 at 11:16 +0300, Avri Altman wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  Allow platform vendors to take precedence having their own max rtt
> support.  This makes sense because the host controller's nortt
> characteristic may vary among vendors.
> 
> while at it, set this value for Mediatek, as requested by Peter -
> 
https://lore.kernel.org/all/0a57d6bab739d6a10584f2baba115d00dfc9c94c.camel@mediatek.com/
> 
> Signed-off-by: Avri Altman <avri.altman@wdc.com>
> ---
>  drivers/ufs/core/ufshcd.c       | 6 +++++-
>  drivers/ufs/host/ufs-mediatek.c | 1 +
>  drivers/ufs/host/ufs-mediatek.h | 3 +++
>  include/ufs/ufshcd.h            | 2 ++
>  4 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 7df8bcacbe7e..b62023a6c306 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -8144,7 +8144,11 @@ static void ufshcd_set_rtt(struct ufs_hba
> *hba)
>  	if (dev_rtt != DEFAULT_MAX_NUM_RTT)
>  		return;
>  
> -	rtt = min_t(int, dev_info->rtt_cap, hba->nortt);
> +	if (hba->vops && hba->vops->max_num_rtt)
> +		rtt = hba->vops->max_num_rtt;
> +	else
> +		rtt = min_t(int, dev_info->rtt_cap, hba->nortt);
> +
>  	if (rtt == dev_rtt)
>  		return;
>  
> diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-
> mediatek.c
> index c4f997196c57..c7a0ab9b1f59 100644
> --- a/drivers/ufs/host/ufs-mediatek.c
> +++ b/drivers/ufs/host/ufs-mediatek.c
> @@ -1785,6 +1785,7 @@ static int ufs_mtk_config_esi(struct ufs_hba
> *hba)
>   */
>  static const struct ufs_hba_variant_ops ufs_hba_mtk_vops = {
>  	.name                = "mediatek.ufshci",
> +	.max_num_rtt         = MTK_MAX_NUM_RTT,
>  	.init                = ufs_mtk_init,
>  	.get_ufs_hci_version = ufs_mtk_get_ufs_hci_version,
>  	.setup_clocks        = ufs_mtk_setup_clocks,
> diff --git a/drivers/ufs/host/ufs-mediatek.h b/drivers/ufs/host/ufs-
> mediatek.h
> index 3ff17e95afab..05d76a6bd772 100644
> --- a/drivers/ufs/host/ufs-mediatek.h
> +++ b/drivers/ufs/host/ufs-mediatek.h
> @@ -189,4 +189,7 @@ struct ufs_mtk_host {
>  /* MTK delay of autosuspend: 500 ms */
>  #define MTK_RPM_AUTOSUSPEND_DELAY_MS 500
>  
> +/* MTK RTT support number */
> +#define MTK_MAX_NUM_RTT 2
> +
>  #endif /* !_UFS_MEDIATEK_H */
> diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
> index d74bd2d67b06..ef04ec8aad69 100644
> --- a/include/ufs/ufshcd.h
> +++ b/include/ufs/ufshcd.h
> @@ -295,6 +295,7 @@ struct ufs_pwr_mode_info {
>  /**
>   * struct ufs_hba_variant_ops - variant specific callbacks
>   * @name: variant name
> + * @max_num_rtt: maximum RTT supported by the host
>   * @init: called when the driver is initialized
>   * @exit: called to cleanup everything done in init
>   * @get_ufs_hci_version: called to get UFS HCI version
> @@ -332,6 +333,7 @@ struct ufs_pwr_mode_info {
>   */
>  struct ufs_hba_variant_ops {
>  	const char *name;
> +	int	max_num_rtt;
>  	int	(*init)(struct ufs_hba *);
>  	void    (*exit)(struct ufs_hba *);
>  	u32	(*get_ufs_hci_version)(struct ufs_hba *);
> -- 
> 2.34.1

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


  reply	other threads:[~2024-05-28 10:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-26  8:16 [PATCH v6 0/3] scsi: ufs: Allow RTT negotiation Avri Altman
2024-05-26  8:16 ` [PATCH v6 1/3] " Avri Altman
2024-05-29 20:03   ` Bart Van Assche
2024-05-29 21:15     ` Avri Altman
2024-05-26  8:16 ` [PATCH v6 2/3] scsi: ufs: Maximum RTT supported by the host driver Avri Altman
2024-05-28 10:02   ` Peter Wang (王信友) [this message]
2024-05-29 20:12   ` Bart Van Assche
2024-05-29 21:07     ` Avri Altman
2024-05-26  8:16 ` [PATCH v6 3/3] scsi: ufs: sysfs: Make max_number_of_rtt read-write Avri Altman
2024-05-29 20:02   ` Bart Van Assche
2024-05-29 21:12     ` Avri Altman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=81e11b3d3e55aed0b3b9e83fcd05852858bfcbf1.camel@mediatek.com \
    --to=peter.wang@mediatek.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®