From 7f1f1f79024ee22f6c18c592ccd078a50b7f64c8 Mon Sep 17 00:00:00 2001 From: jongmin jeong Date: Mon, 18 Oct 2021 21:42:02 +0900 Subject: [PATCH] BACKPORT: scsi: ufs: Add quirk to handle broken UIC command Samsung ExynosAuto v9 SoC has two types of host controller interface to support the virtualization of UFS Device. One is the physical host (PH) that is the same as conventional UFSHCI, and the other is the virtual host (VH) that supports data transfer function only. In this configuration the virtual host does not support UIC commands. Add a quirk to return 0 when the UIC command send function is called. Link: https://lore.kernel.org/r/20211018124216.153072-2-chanho61.park@samsung.com Cc: Alim Akhtar Cc: James E.J. Bottomley Cc: Martin K. Petersen Cc: Bart Van Assche Reviewed-by: Alim Akhtar Signed-off-by: jongmin jeong Signed-off-by: Chanho Park Signed-off-by: Martin K. Petersen Bug: 206186055 (cherry picked from commit a22bcfdbf10b4182e94ae98a641efa676170feaf) [Chanho: Resolved cherry-pick conflict in drivers/scsi/ufs/ufshcd.h due to below ANDROID keyslot patch. 74e7fc049218 ("ANDROID: scsi: ufs: split up UFSHCD_QUIRK_NO_KEYSLOTS") No code change from original patch] Change-Id: Iff59b08ebf1494542c548678772cfc0230c2f91e --- drivers/scsi/ufs/ufshcd.c | 3 +++ drivers/scsi/ufs/ufshcd.h | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index a59f6808c6d1..6eb1c057a287 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -2329,6 +2329,9 @@ int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd) int ret; unsigned long flags; + if (hba->quirks & UFSHCD_QUIRK_BROKEN_UIC_CMD) + return 0; + ufshcd_hold(hba, false); mutex_lock(&hba->uic_cmd_mutex); ufshcd_add_delay_before_dme_cmd(hba); diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index e8ca865ec316..77572e809b45 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -589,6 +589,12 @@ enum ufshcd_quirks { */ UFSHCD_QUIRK_ALIGN_SG_WITH_PAGE_SIZE = 1 << 14, + /* + * This quirk needs to be enabled if the host controller does not + * support UIC command + */ + UFSHCD_QUIRK_BROKEN_UIC_CMD = 1 << 15, + /* * This quirk needs to be enabled if the host controller supports inline * encryption, but it needs to initialize the crypto capabilities in a