[COMMON] ufs: add two cases for UFSHCD_QUIRK_GET_GENERRCODE_DIRECT
authorhgchu <hg.chu@samsung.com>
Fri, 12 Jan 2018 07:46:20 +0000 (16:46 +0900)
committerJaeHun Jung <jh0801.jung@samsung.com>
Tue, 8 May 2018 08:20:43 +0000 (17:20 +0900)
Change-Id: Ie2c3d9ff0499572f7e56357b4097c7040615b550
Signed-off-by: hgchu <hg.chu@samsung.com>
drivers/scsi/ufs/ufshcd.c

index f312c34b3a0387c3405ff72498106b25d1590c85..40402ac5dfb863b26635c5601125c0d41e0d173c 100644 (file)
@@ -1963,12 +1963,20 @@ static inline bool ufshcd_ready_for_uic_cmd(struct ufs_hba *hba)
  * This function gets the UPMCRS field of HCS register
  * Returns value of UPMCRS field
  */
-static inline u8 ufshcd_get_upmcrs(struct ufs_hba *hba)
+static inline u8 ufshcd_get_upmcrs(struct ufs_hba *hba, struct uic_command *cmd)
 {
        if (hba->quirks & UFSHCD_QUIRK_GET_GENERRCODE_DIRECT) {
+               if (cmd->command == UIC_CMD_DME_SET &&
+                               cmd->argument1 == UIC_ARG_MIB(PA_PWRMODE))
                        return ufshcd_vops_get_unipro(hba, 3);
+               else if (cmd->command == UIC_CMD_DME_HIBER_ENTER)
+                       return ufshcd_vops_get_unipro(hba, 4);
+               else if (cmd->command == UIC_CMD_DME_HIBER_EXIT)
+                       return ufshcd_vops_get_unipro(hba, 5);
+               else
+                       return (ufshcd_readl(hba, REG_CONTROLLER_STATUS) >> 8) & 0x7;
        } else
-       return (ufshcd_readl(hba, REG_CONTROLLER_STATUS) >> 8) & 0x7;
+               return (ufshcd_readl(hba, REG_CONTROLLER_STATUS) >> 8) & 0x7;
 }
 
 /**
@@ -3805,7 +3813,7 @@ static int ufshcd_uic_pwr_ctrl(struct ufs_hba *hba, struct uic_command *cmd)
                goto out;
        }
 
-       status = ufshcd_get_upmcrs(hba);
+       status = ufshcd_get_upmcrs(hba, cmd);
        if (status != PWR_LOCAL) {
                dev_err(hba->dev,
                        "pwr ctrl cmd 0x%0x failed, host upmcrs:0x%x\n",