Re: [PATCH V1 2/2] scsi: ufs: qcom: Enable QUnipro Internal Clock Gating

From: Nitin Rawat
Date: Fri Jul 04 2025 - 00:28:07 EST




On 7/3/2025 12:13 PM, Avri Altman wrote:
+/**
+ * ufshcd_dme_rmw - get modify set a dme attribute
+ * @hba - per adapter instance
+ * @mask - mask to apply on read value
+ * @val - actual value to write
+ * @attr - dme attribute
+ */
+static inline int ufshcd_dme_rmw(struct ufs_hba *hba, u32 mask,
+ u32 val, u32 attr) {
+ u32 cfg = 0;
+ int err = 0;
+
+ err = ufshcd_dme_get(hba, UIC_ARG_MIB(attr), &cfg);
+ if (err)
+ goto out;
+
+ cfg &= ~mask;
+ cfg |= (val & mask);
+
+ err = ufshcd_dme_set(hba, UIC_ARG_MIB(attr), cfg);
+
+out:
+ return err;
+}
Might be useful to share this with other vendors as well. Maybe in ufshcd-priv.h ?
Sure Avri, I'll move this to ufshcd-priv.h


Thanks,
Avri