public inbox for linux-mediatek@lists.infradead.org
 help / color / mirror / Atom feed
From: "Chun-Hung Wu (巫駿宏)" <Chun-hung.Wu@mediatek.com>
To: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"avri.altman@wdc.com" <avri.altman@wdc.com>,
	"alim.akhtar@samsung.com" <alim.akhtar@samsung.com>,
	"Peter Wang (王信友)" <peter.wang@mediatek.com>,
	"jejb@linux.ibm.com" <jejb@linux.ibm.com>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>
Cc: "linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"Jiajie Hao (郝加节)" <jiajie.hao@mediatek.com>,
	"CC Chou (周志杰)" <cc.chou@mediatek.com>,
	"Eddie Huang (黃智傑)" <eddie.huang@mediatek.com>,
	"Alice Chao (趙珮均)" <Alice.Chao@mediatek.com>,
	wsd_upstream <wsd_upstream@mediatek.com>,
	"Lin Gui (桂林)" <Lin.Gui@mediatek.com>,
	"Tun-yu Yu (游敦聿)" <Tun-yu.Yu@mediatek.com>,
	"chu.stanley@gmail.com" <chu.stanley@gmail.com>,
	"Chaotian Jing (井朝天)" <Chaotian.Jing@mediatek.com>,
	"Powen Kao (高伯文)" <Powen.Kao@mediatek.com>,
	"Naomi Chu (朱詠田)" <Naomi.Chu@mediatek.com>,
	"Qilin Tan (谭麒麟)" <Qilin.Tan@mediatek.com>
Subject: Re: [PATCH v1 3/3] ufs: host: mediatek: disable mcq irq when clock off
Date: Mon, 25 Dec 2023 07:22:45 +0000	[thread overview]
Message-ID: <a47d054db56e9aef48a24c6467901cb4743506d9.camel@mediatek.com> (raw)
In-Reply-To: <20231221110416.16176-4-peter.wang@mediatek.com>

On Thu, 2023-12-21 at 19:04 +0800, peter.wang@mediatek.com wrote:
> From: Peter Wang <peter.wang@mediatek.com>
> 
> Disable mcq irq when clock off, this is same as legacy mode.
> 
> Signed-off-by: Peter Wang <peter.wang@mediatek.com>
> ---
>  drivers/ufs/host/ufs-mediatek.c | 41
> +++++++++++++++++++++++++++++++++
>  drivers/ufs/host/ufs-mediatek.h |  1 +
>  2 files changed, 42 insertions(+)
> 
> diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-
> mediatek.c
> index eb1934126c87..51f05038408a 100644
> --- a/drivers/ufs/host/ufs-mediatek.c
> +++ b/drivers/ufs/host/ufs-mediatek.c
> @@ -660,6 +660,45 @@ static void ufs_mtk_pwr_ctrl(struct ufs_hba
> *hba, bool on)
>  	}
>  }
>  
> +static void ufs_mtk_mcq_disable_irq(struct ufs_hba *hba)
> +{
> +	struct ufs_mtk_host *host = ufshcd_get_variant(hba);
> +	u32 irq, i;
> +
> +	if (!is_mcq_enabled(hba))
> +		return;
> +
> +	if (host->mcq_nr_intr == 0)
> +		return;
> +
> +	for (i = 0; i < host->mcq_nr_intr; i++) {
> +		irq = host->mcq_intr_info[i].irq;
> +		disable_irq(irq);
> +	}
> +	host->is_mcq_intr_enabled = false;
> +}
> +
> +static void ufs_mtk_mcq_enable_irq(struct ufs_hba *hba)
> +{
> +	struct ufs_mtk_host *host = ufshcd_get_variant(hba);
> +	u32 irq, i;
> +
> +	if (!is_mcq_enabled(hba))
> +		return;
> +
> +	if (host->mcq_nr_intr == 0)
> +		return;
> +
> +	if (host->is_mcq_intr_enabled == true)
> +		return;
> +
> +	for (i = 0; i < host->mcq_nr_intr; i++) {
> +		irq = host->mcq_intr_info[i].irq;
> +		enable_irq(irq);
> +	}
> +	host->is_mcq_intr_enabled = true;
> +}
> +
>  /**
>   * ufs_mtk_setup_clocks - enables/disable clocks
>   * @hba: host controller instance
> @@ -703,8 +742,10 @@ static int ufs_mtk_setup_clocks(struct ufs_hba
> *hba, bool on,
>  
>  		if (clk_pwr_off)
>  			ufs_mtk_pwr_ctrl(hba, false);
> +		ufs_mtk_mcq_disable_irq(hba);
>  	} else if (on && status == POST_CHANGE) {
>  		ufs_mtk_pwr_ctrl(hba, true);
> +		ufs_mtk_mcq_enable_irq(hba);
>  	}
>  
>  	return ret;
> diff --git a/drivers/ufs/host/ufs-mediatek.h b/drivers/ufs/host/ufs-
> mediatek.h
> index f76e80d91729..922f1e51a60c 100644
> --- a/drivers/ufs/host/ufs-mediatek.h
> +++ b/drivers/ufs/host/ufs-mediatek.h
> @@ -186,6 +186,7 @@ struct ufs_mtk_host {
>  	u32 ip_ver;
>  
>  	bool mcq_set_intr;
> +	bool is_mcq_intr_enabled;
>  	int mcq_nr_intr;
>  	struct ufs_mtk_mcq_intr_info mcq_intr_info[UFSHCD_MAX_Q_NR];
>  };

Reviewed-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>

Chun-Hung

  reply	other threads:[~2023-12-25  7:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-21 11:04 [PATCH v1 0/3] ufs: host: mediatek: Provide fixes in MediaTek platforms peter.wang
2023-12-21 11:04 ` [PATCH v1 1/3] ufs: host: mediatek: check link status after exit hibern8 peter.wang
2023-12-25  7:20   ` Chun-Hung Wu (巫駿宏)
2023-12-21 11:04 ` [PATCH v1 2/3] ufs: host: mediatek: fix mcq mode tm cmd timeout peter.wang
2023-12-25  7:20   ` Chun-Hung Wu (巫駿宏)
2023-12-21 11:04 ` [PATCH v1 3/3] ufs: host: mediatek: disable mcq irq when clock off peter.wang
2023-12-25  7:22   ` Chun-Hung Wu (巫駿宏) [this message]
2024-01-24  2:06 ` [PATCH v1 0/3] ufs: host: mediatek: Provide fixes in MediaTek platforms Martin K. Petersen
2024-01-30  2:27 ` Martin K. Petersen

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=a47d054db56e9aef48a24c6467901cb4743506d9.camel@mediatek.com \
    --to=chun-hung.wu@mediatek.com \
    --cc=Alice.Chao@mediatek.com \
    --cc=Chaotian.Jing@mediatek.com \
    --cc=Lin.Gui@mediatek.com \
    --cc=Naomi.Chu@mediatek.com \
    --cc=Powen.Kao@mediatek.com \
    --cc=Qilin.Tan@mediatek.com \
    --cc=Tun-yu.Yu@mediatek.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=cc.chou@mediatek.com \
    --cc=chu.stanley@gmail.com \
    --cc=eddie.huang@mediatek.com \
    --cc=jejb@linux.ibm.com \
    --cc=jiajie.hao@mediatek.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=peter.wang@mediatek.com \
    --cc=wsd_upstream@mediatek.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