Commit aa9d5d00 authored by Po-Wen Kao's avatar Po-Wen Kao Committed by Martin K. Petersen

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: default avatarPo-Wen Kao <powen.kao@mediatek.com>
Link: https://lore.kernel.org/r/20230612085817.12275-3-powen.kao@mediatek.comReviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
Reviewed-by: default avatarStanley Chu <stanley.chu@mediatek.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent c4ad4f2e
...@@ -451,6 +451,9 @@ static int ufshcd_mcq_sq_stop(struct ufs_hba *hba, struct ufs_hw_queue *hwq) ...@@ -451,6 +451,9 @@ static int ufshcd_mcq_sq_stop(struct ufs_hba *hba, struct ufs_hw_queue *hwq)
u32 id = hwq->id, val; u32 id = hwq->id, val;
int err; int err;
if (hba->quirks & UFSHCD_QUIRK_MCQ_BROKEN_RTC)
return -ETIMEDOUT;
writel(SQ_STOP, mcq_opr_base(hba, OPR_SQD, id) + REG_SQRTC); writel(SQ_STOP, mcq_opr_base(hba, OPR_SQD, id) + REG_SQRTC);
reg = mcq_opr_base(hba, OPR_SQD, id) + REG_SQRTS; reg = mcq_opr_base(hba, OPR_SQD, id) + REG_SQRTS;
err = read_poll_timeout(readl, val, val & SQ_STS, 20, 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) ...@@ -467,6 +470,9 @@ static int ufshcd_mcq_sq_start(struct ufs_hba *hba, struct ufs_hw_queue *hwq)
u32 id = hwq->id, val; u32 id = hwq->id, val;
int err; int err;
if (hba->quirks & UFSHCD_QUIRK_MCQ_BROKEN_RTC)
return -ETIMEDOUT;
writel(SQ_START, mcq_opr_base(hba, OPR_SQD, id) + REG_SQRTC); writel(SQ_START, mcq_opr_base(hba, OPR_SQD, id) + REG_SQRTC);
reg = mcq_opr_base(hba, OPR_SQD, id) + REG_SQRTS; reg = mcq_opr_base(hba, OPR_SQD, id) + REG_SQRTS;
err = read_poll_timeout(readl, val, !(val & SQ_STS), 20, 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) ...@@ -494,6 +500,9 @@ int ufshcd_mcq_sq_cleanup(struct ufs_hba *hba, int task_tag)
u32 nexus, id, val; u32 nexus, id, val;
int err; int err;
if (hba->quirks & UFSHCD_QUIRK_MCQ_BROKEN_RTC)
return -ETIMEDOUT;
if (task_tag != hba->nutrs - UFSHCD_NUM_RESERVED) { if (task_tag != hba->nutrs - UFSHCD_NUM_RESERVED) {
if (!cmd) if (!cmd)
return -EINVAL; return -EINVAL;
...@@ -576,6 +585,9 @@ static bool ufshcd_mcq_sqe_search(struct ufs_hba *hba, ...@@ -576,6 +585,9 @@ static bool ufshcd_mcq_sqe_search(struct ufs_hba *hba,
u64 addr, match; u64 addr, match;
u32 sq_head_slot; u32 sq_head_slot;
if (hba->quirks & UFSHCD_QUIRK_MCQ_BROKEN_RTC)
return true;
mutex_lock(&hwq->sq_mutex); mutex_lock(&hwq->sq_mutex);
ufshcd_mcq_sq_stop(hba, hwq); ufshcd_mcq_sq_stop(hba, hwq);
......
...@@ -617,6 +617,12 @@ enum ufshcd_quirks { ...@@ -617,6 +617,12 @@ enum ufshcd_quirks {
* Enable this quirk will disable CQES and use per queue interrupt. * Enable this quirk will disable CQES and use per queue interrupt.
*/ */
UFSHCD_QUIRK_MCQ_BROKEN_INTR = 1 << 20, UFSHCD_QUIRK_MCQ_BROKEN_INTR = 1 << 20,
/*
* Some host does not implement SQ Run Time Command (SQRTC) register
* thus need this quirk to skip related flow.
*/
UFSHCD_QUIRK_MCQ_BROKEN_RTC = 1 << 21,
}; };
enum ufshcd_caps { enum ufshcd_caps {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment