#define ufs_mtk_device_reset_ctrl(high, res) \
        ufs_mtk_smc(UFS_MTK_SIP_DEVICE_RESET, high, res)
 
+#define ufs_mtk_unipro_powerdown(hba, powerdown) \
+       ufshcd_dme_set(hba, \
+                      UIC_ARG_MIB_SEL(VS_UNIPROPOWERDOWNCONTROL, 0), \
+                      powerdown)
+
 static void ufs_mtk_cfg_unipro_cg(struct ufs_hba *hba, bool enable)
 {
        u32 tmp;
        int ret;
        u32 tmp;
 
+       ufs_mtk_unipro_powerdown(hba, 0);
+
        /* disable deep stall */
        ret = ufshcd_dme_get(hba, UIC_ARG_MIB(VS_SAVEPOWERCONTROL), &tmp);
        if (ret)
        if (err)
                return err;
 
-       err = ufshcd_dme_set(hba,
-                            UIC_ARG_MIB_SEL(VS_UNIPROPOWERDOWNCONTROL, 0),
-                            0);
+       err = ufs_mtk_unipro_powerdown(hba, 0);
        if (err)
                return err;
 
 {
        int err;
 
-       err = ufshcd_dme_set(hba,
-                            UIC_ARG_MIB_SEL(VS_UNIPROPOWERDOWNCONTROL, 0),
-                            1);
+       err = ufs_mtk_unipro_powerdown(hba, 1);
        if (err) {
                /* Resume UniPro state for following error recovery */
-               ufshcd_dme_set(hba,
-                              UIC_ARG_MIB_SEL(VS_UNIPROPOWERDOWNCONTROL, 0),
-                              0);
+               ufs_mtk_unipro_powerdown(hba, 0);
                return err;
        }