Skip to content

Commit aa9d5d0

Browse files
powen-kao-mtkmartinkpetersen
authored andcommitted
scsi: ufs: core: Add host quirk UFSHCD_QUIRK_MCQ_BROKEN_RTC
Some hosts do not implement SQ Run Time Command (SQRTC) register, thus we need this quirk to skip the related flow. Signed-off-by: Po-Wen Kao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent c4ad4f2 commit aa9d5d0

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

drivers/ufs/core/ufs-mcq.c

+12
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,9 @@ static int ufshcd_mcq_sq_stop(struct ufs_hba *hba, struct ufs_hw_queue *hwq)
451451
u32 id = hwq->id, val;
452452
int err;
453453

454+
if (hba->quirks & UFSHCD_QUIRK_MCQ_BROKEN_RTC)
455+
return -ETIMEDOUT;
456+
454457
writel(SQ_STOP, mcq_opr_base(hba, OPR_SQD, id) + REG_SQRTC);
455458
reg = mcq_opr_base(hba, OPR_SQD, id) + REG_SQRTS;
456459
err = read_poll_timeout(readl, val, val & SQ_STS, 20,
@@ -467,6 +470,9 @@ static int ufshcd_mcq_sq_start(struct ufs_hba *hba, struct ufs_hw_queue *hwq)
467470
u32 id = hwq->id, val;
468471
int err;
469472

473+
if (hba->quirks & UFSHCD_QUIRK_MCQ_BROKEN_RTC)
474+
return -ETIMEDOUT;
475+
470476
writel(SQ_START, mcq_opr_base(hba, OPR_SQD, id) + REG_SQRTC);
471477
reg = mcq_opr_base(hba, OPR_SQD, id) + REG_SQRTS;
472478
err = read_poll_timeout(readl, val, !(val & SQ_STS), 20,
@@ -494,6 +500,9 @@ int ufshcd_mcq_sq_cleanup(struct ufs_hba *hba, int task_tag)
494500
u32 nexus, id, val;
495501
int err;
496502

503+
if (hba->quirks & UFSHCD_QUIRK_MCQ_BROKEN_RTC)
504+
return -ETIMEDOUT;
505+
497506
if (task_tag != hba->nutrs - UFSHCD_NUM_RESERVED) {
498507
if (!cmd)
499508
return -EINVAL;
@@ -576,6 +585,9 @@ static bool ufshcd_mcq_sqe_search(struct ufs_hba *hba,
576585
u64 addr, match;
577586
u32 sq_head_slot;
578587

588+
if (hba->quirks & UFSHCD_QUIRK_MCQ_BROKEN_RTC)
589+
return true;
590+
579591
mutex_lock(&hwq->sq_mutex);
580592

581593
ufshcd_mcq_sq_stop(hba, hwq);

include/ufs/ufshcd.h

+6
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,12 @@ enum ufshcd_quirks {
617617
* Enable this quirk will disable CQES and use per queue interrupt.
618618
*/
619619
UFSHCD_QUIRK_MCQ_BROKEN_INTR = 1 << 20,
620+
621+
/*
622+
* Some host does not implement SQ Run Time Command (SQRTC) register
623+
* thus need this quirk to skip related flow.
624+
*/
625+
UFSHCD_QUIRK_MCQ_BROKEN_RTC = 1 << 21,
620626
};
621627

622628
enum ufshcd_caps {

0 commit comments

Comments
 (0)