Skip to content

Commit 305a357

Browse files
Asutosh Dasmartinkpetersen
authored andcommitted
scsi: ufs: core: Introduce multi-circular queue capability
Add support to check for MCQ capability in the UFSHC. Add a module parameter to disable MCQ if needed. Co-developed-by: Can Guo <[email protected]> Signed-off-by: Can Guo <[email protected]> Signed-off-by: Asutosh Das <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 6e1d850 commit 305a357

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,28 @@
9292
/* Polling time to wait for fDeviceInit */
9393
#define FDEVICEINIT_COMPL_TIMEOUT 1500 /* millisecs */
9494

95+
/* UFSHC 4.0 compliant HC support this mode, refer param_set_mcq_mode() */
96+
static bool use_mcq_mode = true;
97+
98+
static int param_set_mcq_mode(const char *val, const struct kernel_param *kp)
99+
{
100+
int ret;
101+
102+
ret = param_set_bool(val, kp);
103+
if (ret)
104+
return ret;
105+
106+
return 0;
107+
}
108+
109+
static const struct kernel_param_ops mcq_mode_ops = {
110+
.set = param_set_mcq_mode,
111+
.get = param_get_bool,
112+
};
113+
114+
module_param_cb(use_mcq_mode, &mcq_mode_ops, &use_mcq_mode, 0644);
115+
MODULE_PARM_DESC(use_mcq_mode, "Control MCQ mode for controllers starting from UFSHCI 4.0. 1 - enable MCQ, 0 - disable MCQ. MCQ is enabled by default");
116+
95117
#define ufshcd_toggle_vreg(_dev, _vreg, _on) \
96118
({ \
97119
int _ret; \
@@ -2261,6 +2283,10 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba)
22612283
if (err)
22622284
dev_err(hba->dev, "crypto setup failed\n");
22632285

2286+
hba->mcq_sup = FIELD_GET(MASK_MCQ_SUPPORT, hba->capabilities);
2287+
if (!hba->mcq_sup)
2288+
return err;
2289+
22642290
hba->mcq_capabilities = ufshcd_readl(hba, REG_MCQCAP);
22652291
hba->ext_iid_sup = FIELD_GET(MASK_EXT_IID_SUPPORT,
22662292
hba->mcq_capabilities);

include/ufs/ufshcd.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,7 @@ struct ufs_hba_monitor {
843843
* @complete_put: whether or not to call ufshcd_rpm_put() from inside
844844
* ufshcd_resume_complete()
845845
* @ext_iid_sup: is EXT_IID is supported by UFSHC
846+
* @mcq_sup: is mcq supported by UFSHC
846847
*/
847848
struct ufs_hba {
848849
void __iomem *mmio_base;
@@ -995,6 +996,7 @@ struct ufs_hba {
995996
u32 luns_avail;
996997
bool complete_put;
997998
bool ext_iid_sup;
999+
bool mcq_sup;
9981000
};
9991001

10001002
#ifdef CONFIG_SCSI_UFS_VARIABLE_SG_ENTRY_SIZE

0 commit comments

Comments
 (0)