Skip to content

Commit cd06b71

Browse files
Mani-Sadhasivammartinkpetersen
authored andcommitted
scsi: ufs: core: Add a quirk for handling broken LSDBS field in controller capabilities register
'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 <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent f03e94f commit cd06b71

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2426,7 +2426,11 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba)
24262426
* 0h: legacy single doorbell support is available
24272427
* 1h: indicate that legacy single doorbell support has been removed
24282428
*/
2429-
hba->lsdb_sup = !FIELD_GET(MASK_LSDB_SUPPORT, hba->capabilities);
2429+
if (!(hba->quirks & UFSHCD_QUIRK_BROKEN_LSDBS_CAP))
2430+
hba->lsdb_sup = !FIELD_GET(MASK_LSDB_SUPPORT, hba->capabilities);
2431+
else
2432+
hba->lsdb_sup = true;
2433+
24302434
if (!hba->mcq_sup)
24312435
return 0;
24322436

include/ufs/ufshcd.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,14 @@ enum ufshcd_quirks {
676676
* the standard best practice for managing keys).
677677
*/
678678
UFSHCD_QUIRK_KEYS_IN_PRDT = 1 << 24,
679+
680+
/*
681+
* This quirk indicates that the controller reports the value 1 (not
682+
* supported) in the Legacy Single DoorBell Support (LSDBS) bit of the
683+
* Controller Capabilities register although it supports the legacy
684+
* single doorbell mode.
685+
*/
686+
UFSHCD_QUIRK_BROKEN_LSDBS_CAP = 1 << 25,
679687
};
680688

681689
enum ufshcd_caps {

0 commit comments

Comments
 (0)