Skip to content

Commit 2c73fb1

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: ufs: core: Improve ufshcd_mcq_sq_cleanup()
From the UFSHCI specification: "CleanUp Command Return Code (RTC): host controller sets this return code to provide more details of the cleanup process. It is valid only when CUS is 1." Hence, do not read RTC if the CUS bitfield is zero. Cc: Bao D. Nguyen <quic_nguyenb@quicinc.com> Fixes: 8d72903 ("scsi: ufs: mcq: Add supporting functions for MCQ abort") Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20241022193130.2733293-7-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 2a36646 commit 2c73fb1

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

drivers/ufs/core/ufs-mcq.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -572,14 +572,18 @@ int ufshcd_mcq_sq_cleanup(struct ufs_hba *hba, int task_tag)
572572
/* SQRTCy.ICU = 1 */
573573
writel(SQ_ICU, opr_sqd_base + REG_SQRTC);
574574

575-
/* Poll SQRTSy.CUS = 1. Return result from SQRTSy.RTC */
575+
/* Wait until SQRTSy.CUS = 1. Report SQRTSy.RTC. */
576576
reg = opr_sqd_base + REG_SQRTS;
577577
err = read_poll_timeout(readl, val, val & SQ_CUS, 20,
578578
MCQ_POLL_US, false, reg);
579579
if (err)
580-
dev_err(hba->dev, "%s: failed. hwq=%d, tag=%d err=%ld\n",
581-
__func__, id, task_tag,
582-
FIELD_GET(SQ_ICU_ERR_CODE_MASK, readl(reg)));
580+
dev_err(hba->dev, "%s: failed. hwq=%d, tag=%d err=%d\n",
581+
__func__, id, task_tag, err);
582+
else
583+
dev_info(hba->dev,
584+
"%s, hwq %d: cleanup return code (RTC) %ld\n",
585+
__func__, id,
586+
FIELD_GET(SQ_ICU_ERR_CODE_MASK, readl(reg)));
583587

584588
if (ufshcd_mcq_sq_start(hba, hwq))
585589
err = -ETIMEDOUT;

0 commit comments

Comments
 (0)