]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
scsi: ufs: core: Add a quirk for handling broken LSDBS field in controller capabiliti...
authorManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Fri, 16 Aug 2024 06:25:10 +0000 (11:55 +0530)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sat, 17 Aug 2024 01:09:17 +0000 (21:09 -0400)
'Legacy Queue & Single Doorbell Support (LSDBS)' field in the controller
capabilities register is supposed to report whether the legacy single
doorbell mode is supported in the controller or not. But some controllers
report '1' in this field which corresponds to 'LSDB not supported', but
they indeed support LSDB. So let's add a quirk to handle those controllers.

If the quirk is enabled by the controller driver, then LSDBS register field
will be ignored and legacy single doorbell mode is assumed to be enabled
always.

Tested-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20240816-ufs-bug-fix-v3-1-e6fe0e18e2a3@linaro.org
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/ufs/core/ufshcd.c
include/ufs/ufshcd.h

index 0b3d0c8e0ddaed063e085bc869ccb8d39e67a3a5..a6f818cdef0e7752169cffe46e454113351b0eb2 100644 (file)
@@ -2426,7 +2426,11 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba)
         * 0h: legacy single doorbell support is available
         * 1h: indicate that legacy single doorbell support has been removed
         */
-       hba->lsdb_sup = !FIELD_GET(MASK_LSDB_SUPPORT, hba->capabilities);
+       if (!(hba->quirks & UFSHCD_QUIRK_BROKEN_LSDBS_CAP))
+               hba->lsdb_sup = !FIELD_GET(MASK_LSDB_SUPPORT, hba->capabilities);
+       else
+               hba->lsdb_sup = true;
+
        if (!hba->mcq_sup)
                return 0;
 
index cac0cdb9a916c733f6dd8f6622b3c57bccd3abe3..0fd2aebac72862e789a54e12803a45077d86cdd7 100644 (file)
@@ -676,6 +676,14 @@ enum ufshcd_quirks {
         * the standard best practice for managing keys).
         */
        UFSHCD_QUIRK_KEYS_IN_PRDT                       = 1 << 24,
+
+       /*
+        * This quirk indicates that the controller reports the value 1 (not
+        * supported) in the Legacy Single DoorBell Support (LSDBS) bit of the
+        * Controller Capabilities register although it supports the legacy
+        * single doorbell mode.
+        */
+       UFSHCD_QUIRK_BROKEN_LSDBS_CAP                   = 1 << 25,
 };
 
 enum ufshcd_caps {