[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230612085817.12275-3-powen.kao@mediatek.com>
Date: Mon, 12 Jun 2023 16:58:10 +0800
From: Po-Wen Kao <powen.kao@...iatek.com>
To: <linux-scsi@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-mediatek@...ts.infradead.org>,
Alim Akhtar <alim.akhtar@...sung.com>,
Avri Altman <avri.altman@....com>,
Bart Van Assche <bvanassche@....org>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>
CC: <wsd_upstream@...iatek.com>, <peter.wang@...iatek.com>,
<stanley.chu@...iatek.com>, <powen.kao@...iatek.com>,
<alice.chao@...iatek.com>, <naomi.chu@...iatek.com>,
<chun-hung.wu@...iatek.com>, <cc.chou@...iatek.com>,
<eddie.huang@...iatek.com>
Subject: [PATCH v1 2/4] scsi: ufs: core: Add host quirk UFSHCD_QUIRK_MCQ_BROKEN_RTC
Some host does not implement SQ Run Time Command (SQRTC) register
thus need this quirk to skip related flow.
Signed-off-by: Po-Wen Kao <powen.kao@...iatek.com>
---
drivers/ufs/core/ufs-mcq.c | 12 ++++++++++++
include/ufs/ufshcd.h | 6 ++++++
2 files changed, 18 insertions(+)
diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
index 785fc9762cad..e5be3445c4ab 100644
--- a/drivers/ufs/core/ufs-mcq.c
+++ b/drivers/ufs/core/ufs-mcq.c
@@ -458,6 +458,9 @@ static int ufshcd_mcq_sq_stop(struct ufs_hba *hba, struct ufs_hw_queue *hwq)
u32 id = hwq->id, val;
int err;
+ if (hba->quirks & UFSHCD_QUIRK_MCQ_BROKEN_RTC)
+ return -ETIMEDOUT;
+
writel(SQ_STOP, mcq_opr_base(hba, OPR_SQD, id) + REG_SQRTC);
reg = mcq_opr_base(hba, OPR_SQD, id) + REG_SQRTS;
err = read_poll_timeout(readl, val, val & SQ_STS, 20,
@@ -474,6 +477,9 @@ static int ufshcd_mcq_sq_start(struct ufs_hba *hba, struct ufs_hw_queue *hwq)
u32 id = hwq->id, val;
int err;
+ if (hba->quirks & UFSHCD_QUIRK_MCQ_BROKEN_RTC)
+ return -ETIMEDOUT;
+
writel(SQ_START, mcq_opr_base(hba, OPR_SQD, id) + REG_SQRTC);
reg = mcq_opr_base(hba, OPR_SQD, id) + REG_SQRTS;
err = read_poll_timeout(readl, val, !(val & SQ_STS), 20,
@@ -501,6 +507,9 @@ int ufshcd_mcq_sq_cleanup(struct ufs_hba *hba, int task_tag)
u32 nexus, id, val;
int err;
+ if (hba->quirks & UFSHCD_QUIRK_MCQ_BROKEN_RTC)
+ return -ETIMEDOUT;
+
if (task_tag != hba->nutrs - UFSHCD_NUM_RESERVED) {
if (!cmd)
return -EINVAL;
@@ -583,6 +592,9 @@ static bool ufshcd_mcq_sqe_search(struct ufs_hba *hba,
u64 addr, match;
u32 sq_head_slot;
+ if (hba->quirks & UFSHCD_QUIRK_MCQ_BROKEN_RTC)
+ return true;
+
mutex_lock(&hwq->sq_mutex);
ufshcd_mcq_sq_stop(hba, hwq);
diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
index ea43ceaf881c..86b4aae5aa2c 100644
--- a/include/ufs/ufshcd.h
+++ b/include/ufs/ufshcd.h
@@ -618,6 +618,12 @@ enum ufshcd_quirks {
* Enable this quirk will disable CQES and use per queue interrupt.
*/
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 {
--
2.18.0
Powered by blists - more mailing lists