scsi: ufs: ufs-mediatek: Fix flag of unipro low-power mode
Forcibly leave UniPro low-power mode if UIC commands failed. This makes hba_enable_delay_us as correct (default) value for re-enabling the host. At the same time, change type of parameter "lpm" in function ufs_mtk_unipro_set_pm() to "bool". Link: https://lore.kernel.org/r/20200908064507.30774-4-stanley.chu@mediatek.com Signed-off-by: Stanley Chu <stanley.chu@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
a3e40b80dc
commit
9a9ddb8a3a
|
@ -419,7 +419,7 @@ static int ufs_mtk_pwr_change_notify(struct ufs_hba *hba,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int ufs_mtk_unipro_set_pm(struct ufs_hba *hba, u32 lpm)
|
||||
static int ufs_mtk_unipro_set_pm(struct ufs_hba *hba, bool lpm)
|
||||
{
|
||||
int ret;
|
||||
struct ufs_mtk_host *host = ufshcd_get_variant(hba);
|
||||
|
@ -427,8 +427,14 @@ static int ufs_mtk_unipro_set_pm(struct ufs_hba *hba, u32 lpm)
|
|||
ret = ufshcd_dme_set(hba,
|
||||
UIC_ARG_MIB_SEL(VS_UNIPROPOWERDOWNCONTROL, 0),
|
||||
lpm);
|
||||
if (!ret)
|
||||
if (!ret || !lpm) {
|
||||
/*
|
||||
* Forcibly set as non-LPM mode if UIC commands is failed
|
||||
* to use default hba_enable_delay_us value for re-enabling
|
||||
* the host.
|
||||
*/
|
||||
host->unipro_lpm = lpm;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -438,7 +444,9 @@ static int ufs_mtk_pre_link(struct ufs_hba *hba)
|
|||
int ret;
|
||||
u32 tmp;
|
||||
|
||||
ufs_mtk_unipro_set_pm(hba, 0);
|
||||
ret = ufs_mtk_unipro_set_pm(hba, false);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* Setting PA_Local_TX_LCC_Enable to 0 before link startup
|
||||
|
@ -546,7 +554,7 @@ static int ufs_mtk_link_set_hpm(struct ufs_hba *hba)
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
err = ufs_mtk_unipro_set_pm(hba, 0);
|
||||
err = ufs_mtk_unipro_set_pm(hba, false);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
@ -567,10 +575,10 @@ static int ufs_mtk_link_set_lpm(struct ufs_hba *hba)
|
|||
{
|
||||
int err;
|
||||
|
||||
err = ufs_mtk_unipro_set_pm(hba, 1);
|
||||
err = ufs_mtk_unipro_set_pm(hba, true);
|
||||
if (err) {
|
||||
/* Resume UniPro state for following error recovery */
|
||||
ufs_mtk_unipro_set_pm(hba, 0);
|
||||
ufs_mtk_unipro_set_pm(hba, false);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue