Re: [RFC PATCH v2 2/2] scsi: ufs-qcom: Add MCQ support

From: Bart Van Assche
Date: Thu Aug 18 2022 - 22:48:41 EST


On 8/11/22 03:33, Can Guo wrote:
+static int ufs_qcom_get_outstanding_cqs(struct ufs_hba *hba,
+ unsigned long *ocqs)
+{
+ return -EINVAL;
+}

Why does the get_outstanding_cqs vop exist since the only implementation of that vop returns EINVAL?

+static int ufs_qcom_config_mcq_rop(struct ufs_hba *hba)
+{
+ struct ufshcd_mcq_rop_info_t *rop;
+ struct ufshcd_res_info_t *mem_res, *sqdao_res;
+ int i;
+
+ mem_res = &hba->res[RES_MEM];
+ sqdao_res = &hba->res[RES_MCQ_SQD];
+
+ if (!mem_res->base || !sqdao_res->base)
+ return -EINVAL;
+
+ for (i = 0; i < ROP_MAX; i++) {
+ rop = &hba->mcq_rop[i];
+ rop->offset = sqdao_res->resource->start -
+ mem_res->resource->start + 0x40 * i;
+ rop->stride = 0x100;
+ rop->base = sqdao_res->base + 0x40 * i;
+ }
+
+ return 0;
+}

Is there anything in the above function that is specific to the Qualcomm controller? If not, please move the above code into ufshcd.c.

+static int ufs_qcom_get_hba_mac(struct ufs_hba *hba)
+{
+ return MAX_SUPP_MAC;
+}

Since there is a register in the UFSHCI 4.0 specification from which the maximum number of outstanding commands can be retrieved, why does the get_hba_mac vop exist?

Thanks,

Bart.