From f0ce1e2aa4665db0abff4388edd9b9c409541a25 Mon Sep 17 00:00:00 2001 From: Yoshihiro Shimoda Date: Fri, 3 Jun 2022 20:05:19 +0900 Subject: [PATCH] FROMGIT: scsi: ufs: core: Add UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS Add UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS for host controllers which do not support 64-bit addressing. Link: https://lore.kernel.org/r/20220603110524.1997825-3-yoshihiro.shimoda.uh@renesas.com Signed-off-by: Yoshihiro Shimoda Signed-off-by: Martin K. Petersen (cherry picked from commit 6554400d6f66b9494a0c0f07712ab0a9d307eb01 git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next) Bug: 239946304 Signed-off-by: Bart Van Assche Change-Id: Ice709b8bdea6d2343a7753b42a392d3c190164f0 --- drivers/ufs/core/ufshcd.c | 2 ++ include/ufs/ufshcd.h | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index f31c0af1b106..9741e5986624 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -2267,6 +2267,8 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba) int err; hba->capabilities = ufshcd_readl(hba, REG_CONTROLLER_CAPABILITIES); + if (hba->quirks & UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS) + hba->capabilities &= ~MASK_64_ADDRESSING_SUPPORT; /* nutrs and nutmrs are 0 based values */ hba->nutrs = (hba->capabilities & MASK_TRANSFER_REQUESTS_SLOTS) + 1; diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index ccc15cd0b238..e52ebf1e4257 100644 --- a/include/ufs/ufshcd.h +++ b/include/ufs/ufshcd.h @@ -590,6 +590,11 @@ enum ufshcd_quirks { */ UFSHCD_QUIRK_SKIP_PH_CONFIGURATION = 1 << 16, + /* + * This quirk needs to be enabled if the host controller has + * 64-bit addressing supported capability but it doesn't work. + */ + UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS = 1 << 17, /* * This quirk needs to be enabled if the host controller supports inline * encryption, but it needs to initialize the crypto capabilities in a