Skip to content

Commit 2537577

Browse files
ptr324martinkpetersen
authored andcommitted
scsi: ufs: core: Change MCQ interrupt enable flow
Move the MCQ interrupt enable process to ufshcd_mcq_make_queues_operational() to ensure that interrupts are set correctly when making queues operational, similar to ufshcd_make_hba_operational(). This change addresses the issue where ufshcd_mcq_make_queues_operational() was not fully operational due to missing interrupt enablement. This change only affects host drivers that call ufshcd_mcq_make_queues_operational(), i.e. ufs-mediatek. Signed-off-by: Peter Wang <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 0ac3c90 commit 2537577

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

drivers/ufs/core/ufs-mcq.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
#define MCQ_ENTRY_SIZE_IN_DWORD 8
3030
#define CQE_UCD_BA GENMASK_ULL(63, 7)
3131

32+
#define UFSHCD_ENABLE_MCQ_INTRS (UTP_TASK_REQ_COMPL |\
33+
UFSHCD_ERROR_MASK |\
34+
MCQ_CQ_EVENT_STATUS)
35+
3236
/* Max mcq register polling time in microseconds */
3337
#define MCQ_POLL_US 500000
3438

@@ -355,9 +359,16 @@ EXPORT_SYMBOL_GPL(ufshcd_mcq_poll_cqe_lock);
355359
void ufshcd_mcq_make_queues_operational(struct ufs_hba *hba)
356360
{
357361
struct ufs_hw_queue *hwq;
362+
u32 intrs;
358363
u16 qsize;
359364
int i;
360365

366+
/* Enable required interrupts */
367+
intrs = UFSHCD_ENABLE_MCQ_INTRS;
368+
if (hba->quirks & UFSHCD_QUIRK_MCQ_BROKEN_INTR)
369+
intrs &= ~MCQ_CQ_EVENT_STATUS;
370+
ufshcd_enable_intr(hba, intrs);
371+
361372
for (i = 0; i < hba->nr_hw_queues; i++) {
362373
hwq = &hba->uhq[i];
363374
hwq->id = i;

drivers/ufs/core/ufshcd.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@
4545
UTP_TASK_REQ_COMPL |\
4646
UFSHCD_ERROR_MASK)
4747

48-
#define UFSHCD_ENABLE_MCQ_INTRS (UTP_TASK_REQ_COMPL |\
49-
UFSHCD_ERROR_MASK |\
50-
MCQ_CQ_EVENT_STATUS)
51-
52-
5348
/* UIC command timeout, unit: ms */
5449
enum {
5550
UIC_CMD_TIMEOUT_DEFAULT = 500,
@@ -372,7 +367,7 @@ EXPORT_SYMBOL_GPL(ufshcd_disable_irq);
372367
* @hba: per adapter instance
373368
* @intrs: interrupt bits
374369
*/
375-
static void ufshcd_enable_intr(struct ufs_hba *hba, u32 intrs)
370+
void ufshcd_enable_intr(struct ufs_hba *hba, u32 intrs)
376371
{
377372
u32 old_val = ufshcd_readl(hba, REG_INTERRUPT_ENABLE);
378373
u32 new_val = old_val | intrs;
@@ -8909,16 +8904,11 @@ static int ufshcd_alloc_mcq(struct ufs_hba *hba)
89098904
static void ufshcd_config_mcq(struct ufs_hba *hba)
89108905
{
89118906
int ret;
8912-
u32 intrs;
89138907

89148908
ret = ufshcd_mcq_vops_config_esi(hba);
89158909
hba->mcq_esi_enabled = !ret;
89168910
dev_info(hba->dev, "ESI %sconfigured\n", ret ? "is not " : "");
89178911

8918-
intrs = UFSHCD_ENABLE_MCQ_INTRS;
8919-
if (hba->quirks & UFSHCD_QUIRK_MCQ_BROKEN_INTR)
8920-
intrs &= ~MCQ_CQ_EVENT_STATUS;
8921-
ufshcd_enable_intr(hba, intrs);
89228912
ufshcd_mcq_make_queues_operational(hba);
89238913
ufshcd_mcq_config_mac(hba, hba->nutrs);
89248914

include/ufs/ufshcd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,6 +1292,7 @@ static inline void ufshcd_rmwl(struct ufs_hba *hba, u32 mask, u32 val, u32 reg)
12921292

12931293
void ufshcd_enable_irq(struct ufs_hba *hba);
12941294
void ufshcd_disable_irq(struct ufs_hba *hba);
1295+
void ufshcd_enable_intr(struct ufs_hba *hba, u32 intrs);
12951296
int ufshcd_alloc_host(struct device *, struct ufs_hba **);
12961297
int ufshcd_hba_enable(struct ufs_hba *hba);
12971298
int ufshcd_init(struct ufs_hba *, void __iomem *, unsigned int);

0 commit comments

Comments
 (0)