From: <peter.wang@mediatek.com>
To: <linux-scsi@vger.kernel.org>, <martin.petersen@oracle.com>
Cc: <wsd_upstream@mediatek.com>, <linux-mediatek@lists.infradead.org>,
<peter.wang@mediatek.com>, <chun-hung.wu@mediatek.com>,
<alice.chao@mediatek.com>, <cc.chou@mediatek.com>,
<chaotian.jing@mediatek.com>, <jiajie.hao@mediatek.com>,
<yi-fan.peng@mediatek.com>, <qilin.tan@mediatek.com>,
<lin.gui@mediatek.com>, <tun-yu.yu@mediatek.com>,
<eddie.huang@mediatek.com>, <naomi.chu@mediatek.com>,
<ed.tsai@mediatek.com>, <bvanassche@acm.org>
Subject: [PATCH v1 06/10] ufs: host: mediatek: Enable interrupts for MCQ mode
Date: Thu, 18 Sep 2025 18:36:16 +0800 [thread overview]
Message-ID: <20250918104000.208856-7-peter.wang@mediatek.com> (raw)
In-Reply-To: <20250918104000.208856-1-peter.wang@mediatek.com>
From: Alice Chao <alice.chao@mediatek.com>
Enable interrupts in MCQ mode before making the host
operational in the UFS Mediatek driver. This ensures proper
handling of task request completions and error conditions.
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Alice Chao <alice.chao@mediatek.com>
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
---
drivers/ufs/core/ufshcd.c | 3 ++-
drivers/ufs/host/ufs-mediatek.c | 2 ++
drivers/ufs/host/ufs-mediatek.h | 3 +++
include/ufs/ufshcd.h | 1 +
4 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 4e0de3a6d9b6..4893838764ae 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -357,7 +357,7 @@ EXPORT_SYMBOL_GPL(ufshcd_disable_irq);
* @hba: per adapter instance
* @intrs: interrupt bits
*/
-static void ufshcd_enable_intr(struct ufs_hba *hba, u32 intrs)
+void ufshcd_enable_intr(struct ufs_hba *hba, u32 intrs)
{
u32 old_val = ufshcd_readl(hba, REG_INTERRUPT_ENABLE);
u32 new_val = old_val | intrs;
@@ -365,6 +365,7 @@ static void ufshcd_enable_intr(struct ufs_hba *hba, u32 intrs)
if (new_val != old_val)
ufshcd_writel(hba, new_val, REG_INTERRUPT_ENABLE);
}
+EXPORT_SYMBOL_GPL(ufshcd_enable_intr);
/**
* ufshcd_disable_intr - disable interrupts
diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c
index 851a4d839631..18ce985970f3 100644
--- a/drivers/ufs/host/ufs-mediatek.c
+++ b/drivers/ufs/host/ufs-mediatek.c
@@ -1683,6 +1683,8 @@ static int ufs_mtk_link_set_hpm(struct ufs_hba *hba)
if (hba->mcq_enabled) {
ufs_mtk_config_mcq(hba, false);
+ /* Enable required interrupts */
+ ufshcd_enable_intr(hba, UFSHCD_ENABLE_MTK_MCQ_INTRS);
ufshcd_mcq_make_queues_operational(hba);
ufshcd_mcq_config_mac(hba, hba->nutrs);
ufshcd_mcq_enable(hba);
diff --git a/drivers/ufs/host/ufs-mediatek.h b/drivers/ufs/host/ufs-mediatek.h
index dfbf78bd8664..73ab67448e87 100644
--- a/drivers/ufs/host/ufs-mediatek.h
+++ b/drivers/ufs/host/ufs-mediatek.h
@@ -14,6 +14,9 @@
#define UFSHCD_MAX_Q_NR 8
#define MTK_MCQ_INVALID_IRQ 0xFFFF
+#define UFSHCD_ENABLE_MTK_MCQ_INTRS \
+ (UTP_TASK_REQ_COMPL | UFSHCD_ERROR_MASK)
+
/* REG_UFS_MMIO_OPT_CTRL_0 160h */
#define EHS_EN BIT(0)
#define PFM_IMPV BIT(1)
diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
index a6ed7aa59533..109cbb36c02d 100644
--- a/include/ufs/ufshcd.h
+++ b/include/ufs/ufshcd.h
@@ -1496,5 +1496,6 @@ int ufshcd_update_ee_control(struct ufs_hba *hba, u16 *mask,
const u16 *other_mask, u16 set, u16 clr);
void ufshcd_force_error_recovery(struct ufs_hba *hba);
void ufshcd_pm_qos_update(struct ufs_hba *hba, bool on);
+void ufshcd_enable_intr(struct ufs_hba *hba, u32 intrs);
#endif /* End of Header */
--
2.45.2
next prev parent reply other threads:[~2025-09-18 10:40 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-18 10:36 [PATCH v1 00/10] Enhance UFS Mediatek Driver peter.wang
2025-09-18 10:36 ` [PATCH v1 01/10] ufs: host: mediatek: Fix runtime suspend error deadlock peter.wang
2025-09-18 18:27 ` Bart Van Assche
2025-09-19 8:11 ` Peter Wang (王信友)
2025-09-19 20:57 ` Bart Van Assche
2025-09-22 8:37 ` Peter Wang (王信友)
2025-09-22 18:27 ` Bart Van Assche
2025-09-23 5:56 ` Peter Wang (王信友)
2025-09-18 10:36 ` [PATCH v1 02/10] ufs: host: mediatek: Correct clock scaling with PM QoS flow peter.wang
2025-09-18 18:30 ` Bart Van Assche
2025-09-19 8:11 ` Peter Wang (王信友)
2025-09-19 21:02 ` Bart Van Assche
2025-09-22 8:39 ` Peter Wang (王信友)
2025-09-22 19:21 ` Bart Van Assche
2025-09-23 5:58 ` Peter Wang (王信友)
2025-09-18 10:36 ` [PATCH v1 03/10] ufs: host: mediatek: Adjust clock scaling for PM flow peter.wang
2025-09-18 10:36 ` [PATCH v1 04/10] ufs: host: mediatek: Handle clock scaling for high gear in " peter.wang
2025-09-18 10:36 ` [PATCH v1 05/10] ufs: host: mediatek: Adjust sync length for FASTAUTO mode peter.wang
2025-09-18 19:28 ` Bart Van Assche
2025-09-19 8:12 ` Peter Wang (王信友)
2025-09-18 10:36 ` peter.wang [this message]
2025-09-18 18:34 ` [PATCH v1 06/10] ufs: host: mediatek: Enable interrupts for MCQ mode Bart Van Assche
2025-09-19 8:14 ` Peter Wang (王信友)
2025-09-19 21:09 ` Bart Van Assche
2025-09-22 8:41 ` Peter Wang (王信友)
2025-09-22 19:26 ` Bart Van Assche
2025-09-23 5:59 ` Peter Wang (王信友)
2025-09-18 10:36 ` [PATCH v1 07/10] ufs: host: mediatek: Fix shutdown/suspend race condition peter.wang
2025-09-18 18:39 ` Bart Van Assche
2025-09-19 8:15 ` Peter Wang (王信友)
2025-09-19 21:10 ` Bart Van Assche
2025-09-18 10:36 ` [PATCH v1 08/10] ufs: host: mediatek: Remove duplicate function peter.wang
2025-09-18 19:29 ` Bart Van Assche
2025-09-18 10:36 ` [PATCH v1 09/10] ufs: host: mediatek: Add support for new platform with MMIO_OTSD_CTR peter.wang
2025-09-18 10:36 ` [PATCH v1 10/10] ufs: host: mediatek: Support new feature for MT6991 peter.wang
2025-09-18 19:32 ` Bart Van Assche
2025-09-19 8:17 ` Peter Wang (王信友)
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=20250918104000.208856-7-peter.wang@mediatek.com \
--to=peter.wang@mediatek.com \
--cc=alice.chao@mediatek.com \
--cc=bvanassche@acm.org \
--cc=cc.chou@mediatek.com \
--cc=chaotian.jing@mediatek.com \
--cc=chun-hung.wu@mediatek.com \
--cc=ed.tsai@mediatek.com \
--cc=eddie.huang@mediatek.com \
--cc=jiajie.hao@mediatek.com \
--cc=lin.gui@mediatek.com \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=naomi.chu@mediatek.com \
--cc=qilin.tan@mediatek.com \
--cc=tun-yu.yu@mediatek.com \
--cc=wsd_upstream@mediatek.com \
--cc=yi-fan.peng@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