Commit 305a357d authored by Asutosh Das's avatar Asutosh Das Committed by Martin K. Petersen

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: default avatarCan Guo <quic_cang@quicinc.com>
Signed-off-by: default avatarCan Guo <quic_cang@quicinc.com>
Signed-off-by: default avatarAsutosh Das <quic_asutoshd@quicinc.com>
Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
Reviewed-by: default avatarManivannan Sadhasivam <mani@kernel.org>
Reviewed-by: default avatarStanley Chu <stanley.chu@mediatek.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 6e1d850a
...@@ -92,6 +92,28 @@ ...@@ -92,6 +92,28 @@
/* Polling time to wait for fDeviceInit */ /* Polling time to wait for fDeviceInit */
#define FDEVICEINIT_COMPL_TIMEOUT 1500 /* millisecs */ #define FDEVICEINIT_COMPL_TIMEOUT 1500 /* millisecs */
/* UFSHC 4.0 compliant HC support this mode, refer param_set_mcq_mode() */
static bool use_mcq_mode = true;
static int param_set_mcq_mode(const char *val, const struct kernel_param *kp)
{
int ret;
ret = param_set_bool(val, kp);
if (ret)
return ret;
return 0;
}
static const struct kernel_param_ops mcq_mode_ops = {
.set = param_set_mcq_mode,
.get = param_get_bool,
};
module_param_cb(use_mcq_mode, &mcq_mode_ops, &use_mcq_mode, 0644);
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");
#define ufshcd_toggle_vreg(_dev, _vreg, _on) \ #define ufshcd_toggle_vreg(_dev, _vreg, _on) \
({ \ ({ \
int _ret; \ int _ret; \
...@@ -2261,6 +2283,10 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba) ...@@ -2261,6 +2283,10 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba)
if (err) if (err)
dev_err(hba->dev, "crypto setup failed\n"); dev_err(hba->dev, "crypto setup failed\n");
hba->mcq_sup = FIELD_GET(MASK_MCQ_SUPPORT, hba->capabilities);
if (!hba->mcq_sup)
return err;
hba->mcq_capabilities = ufshcd_readl(hba, REG_MCQCAP); hba->mcq_capabilities = ufshcd_readl(hba, REG_MCQCAP);
hba->ext_iid_sup = FIELD_GET(MASK_EXT_IID_SUPPORT, hba->ext_iid_sup = FIELD_GET(MASK_EXT_IID_SUPPORT,
hba->mcq_capabilities); hba->mcq_capabilities);
......
...@@ -843,6 +843,7 @@ struct ufs_hba_monitor { ...@@ -843,6 +843,7 @@ struct ufs_hba_monitor {
* @complete_put: whether or not to call ufshcd_rpm_put() from inside * @complete_put: whether or not to call ufshcd_rpm_put() from inside
* ufshcd_resume_complete() * ufshcd_resume_complete()
* @ext_iid_sup: is EXT_IID is supported by UFSHC * @ext_iid_sup: is EXT_IID is supported by UFSHC
* @mcq_sup: is mcq supported by UFSHC
*/ */
struct ufs_hba { struct ufs_hba {
void __iomem *mmio_base; void __iomem *mmio_base;
...@@ -995,6 +996,7 @@ struct ufs_hba { ...@@ -995,6 +996,7 @@ struct ufs_hba {
u32 luns_avail; u32 luns_avail;
bool complete_put; bool complete_put;
bool ext_iid_sup; bool ext_iid_sup;
bool mcq_sup;
}; };
#ifdef CONFIG_SCSI_UFS_VARIABLE_SG_ENTRY_SIZE #ifdef CONFIG_SCSI_UFS_VARIABLE_SG_ENTRY_SIZE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment