From cef1bd92e369ea35a0cfe20d54358d7952b2273f Mon Sep 17 00:00:00 2001 From: hgchu Date: Fri, 12 Jan 2018 16:46:20 +0900 Subject: [PATCH] [COMMON] ufs: add two cases for UFSHCD_QUIRK_GET_GENERRCODE_DIRECT Change-Id: Ie2c3d9ff0499572f7e56357b4097c7040615b550 Signed-off-by: hgchu --- drivers/scsi/ufs/ufshcd.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index f312c34b3a03..40402ac5dfb8 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -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", -- 2.20.1