scsi: ufs: support vops pre suspend for mediatek to disable auto-hibern8
Subsystems (3)
v3 cover scsi: ufs: support vops pre suspend for mediatek to disable auto-hibern8
From: Peter Wang <[email protected]>
Mediatek UFS design need disable auto-hibern8 before suspend. This patch introduce an solution to do pre suspned before SSU (sleep) command.
Peter Wang (2):
scsi: ufs: support vops pre suspend
scsi: ufs: ufs-mediatek: disable auto-hibern8 before suspend
drivers/scsi/ufs/ufs-exynos.c | 6 ++- drivers/scsi/ufs/ufs-hisi.c | 6 ++- drivers/scsi/ufs/ufs-mediatek.c | 68 ++++++++++++++++++++++++++++++++- drivers/scsi/ufs/ufs-mediatek.h | 20 ++++++++++ drivers/scsi/ufs/ufs-qcom.c | 6 ++- drivers/scsi/ufs/ufshcd.c | 9 ++++- drivers/scsi/ufs/ufshcd.h | 8 ++-- 7 files changed, 114 insertions(+), 9 deletions(-)
Signature · 1 line
2.18.0
PATCH v3 1/2 scsi: ufs: support vops pre suspend
From: Peter Wang <[email protected]>
This patch introduce an solution to do pre suspned before SSU (sleep) command.
--- drivers/scsi/ufs/ufshcd.c | 9 +++++++-- drivers/scsi/ufs/ufshcd.h | 8 +++++--- 2 files changed, 12 insertions(+), 5 deletions(-)
drivers/scsi/ufs/ufshcd.c +7 -2
@@ -8897,6 +8897,10 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)flush_work (&hba->eeh_work); + ret =ufshcd_vops_suspend (hba, pm_op,PRE_CHANGE ); +if (ret) + goto enable_scaling; +if (req_dev_pwr_mode != hba->curr_dev_pwr_mode) {if (pm_op !=UFS_RUNTIME_PM )/* ensure that bkops is disabled */
@@ -8924,7 +8928,7 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)* vendor specific host controller register space call them before the * host clocks are ON. */ - ret =ufshcd_vops_suspend (hba, pm_op); + ret =ufshcd_vops_suspend (hba, pm_op,POST_CHANGE );if (ret) goto set_link_active; goto out;
@@ -9052,7 +9056,8 @@ static int __ufshcd_wl_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op) set_old_link_state:ufshcd_link_state_transition (hba, old_link_state,0 ); vendor_suspend: -ufshcd_vops_suspend (hba, pm_op); +ufshcd_vops_suspend (hba, pm_op,PRE_CHANGE ); +ufshcd_vops_suspend (hba, pm_op,POST_CHANGE ); out:if (ret)ufshcd_update_evt_hist (hba,UFS_EVT_WL_RES_ERR , (u32 )ret);
drivers/scsi/ufs/ufshcd.h +5 -3
@@ -344,7 +344,8 @@ struct ufs_hba_variant_ops { enum ufs_notify_change_status);int (*apply_dev_quirks)(struct ufs_hba *hba);void (*fixup_dev_quirks)(struct ufs_hba *hba); -int (*suspend)(struct ufs_hba *,enum ufs_pm_op ); +int (*suspend)(struct ufs_hba *,enum ufs_pm_op , +enum ufs_notify_change_status );int (*resume)(struct ufs_hba *,enum ufs_pm_op );void (*dbg_register_dump)(struct ufs_hba *hba);int (*phy_initialization)(struct ufs_hba *);
@@ -1300,10 +1301,11 @@ static inline void ufshcd_vops_fixup_dev_quirks(struct ufs_hba *hba) hba->vops->fixup_dev_quirks (hba); } -static inline int ufshcd_vops_suspend (struct ufs_hba *hba,enum ufs_pm_op op) +static inline int ufshcd_vops_suspend (struct ufs_hba *hba,enum ufs_pm_op op, +enum ufs_notify_change_status status) {if (hba->vops && hba->vops->suspend) -return hba->vops->suspend (hba, op); +return hba->vops->suspend (hba, op, status);return 0 ; }
Signature · 1 line
2.18.0
PATCH v3 2/2 scsi: ufs: ufs-mediatek: disable auto-hibern8 before suspend
In reply to [email protected]From: Peter Wang <[email protected]>
Mediatek UFS design need disable auto-hibern8 before suspend.
--- drivers/scsi/ufs/ufs-exynos.c | 6 ++- drivers/scsi/ufs/ufs-hisi.c | 6 ++- drivers/scsi/ufs/ufs-mediatek.c | 68 ++++++++++++++++++++++++++++++++- drivers/scsi/ufs/ufs-mediatek.h | 20 ++++++++++ drivers/scsi/ufs/ufs-qcom.c | 6 ++- 5 files changed, 102 insertions(+), 4 deletions(-)
drivers/scsi/ufs/ufs-exynos.c +5 -1
@@ -1176,10 +1176,14 @@ static void exynos_ufs_hibern8_notify(struct ufs_hba *hba, } } -static int exynos_ufs_suspend (struct ufs_hba *hba,enum ufs_pm_op pm_op) +static int exynos_ufs_suspend (struct ufs_hba *hba,enum ufs_pm_op pm_op, +enum ufs_notify_change_status status) {struct exynos_ufs *ufs =ufshcd_get_variant (hba); +if (status ==PRE_CHANGE ) +return 0 ; +if (!ufshcd_is_link_active (hba))phy_power_off (ufs->phy);
drivers/scsi/ufs/ufs-hisi.c +5 -1
@@ -396,10 +396,14 @@ static int ufs_hisi_pwr_change_notify(struct ufs_hba *hba,return ret; } -static int ufs_hisi_suspend (struct ufs_hba *hba,enum ufs_pm_op pm_op) +static int ufs_hisi_suspend (struct ufs_hba *hba,enum ufs_pm_op pm_op, +enum ufs_notify_change_status status) {struct ufs_hisi_host *host =ufshcd_get_variant (hba); +if (status ==PRE_CHANGE ) +return 0 ; +if (pm_op ==UFS_RUNTIME_PM )return 0 ;
drivers/scsi/ufs/ufs-mediatek.c +67 -1
84 lines not on this page · raw message
drivers/scsi/ufs/ufs-mediatek.h +20 -0
@@ -54,6 +54,26 @@ enum { VS_LINK_CFG = 5, }; +/* +* Vendor specific host controller state +*/ +enum { +VS_HCE_RESET =0 , +VS_HCE_BASE =1 , +VS_HCE_OOCPR_WAIT =2 , +VS_HCE_DME_RESET =3 , +VS_HCE_MIDDLE =4 , +VS_HCE_DME_ENABLE =5 , +VS_HCE_DEFAULTS =6 , +VS_HIB_IDLEEN =7 , +VS_HIB_ENTER =8 , +VS_HIB_ENTER_CONF =9 , +VS_HIB_MIDDLE =10 , +VS_HIB_WAITTIMER =11 , +VS_HIB_EXIT_CONF =12 , +VS_HIB_EXIT =13 , +}; +/* * SiP commands */
drivers/scsi/ufs/ufs-qcom.c +5 -1
@@ -589,11 +589,15 @@ static void ufs_qcom_device_reset_ctrl(struct ufs_hba *hba, bool asserted)gpiod_set_value_cansleep (host->device_reset, asserted); } -static int ufs_qcom_suspend (struct ufs_hba *hba,enum ufs_pm_op pm_op) +static int ufs_qcom_suspend (struct ufs_hba *hba,enum ufs_pm_op pm_op, +enum ufs_notify_change_status status) {struct ufs_qcom_host *host =ufshcd_get_variant (hba);struct phy *phy = host->generic_phy; +if (status ==PRE_CHANGE ) +return 0 ; +if (ufs_qcom_is_link_off (hba)) {/* * Disable the tx/rx lane symbol clocks before PHY is
Signature · 1 line
2.18.0
Quoted 7 lines · On 10/5/21 20:09, [email protected] wrote:
Mediatek UFS design need disable auto-hibern8 before suspend. This patch introduce an solution to do pre suspned before SSU (sleep) command.
Peter Wang (2):
scsi: ufs: support vops pre suspend
scsi: ufs: ufs-mediatek: disable auto-hibern8 before suspend
Please always include a changelog when posting a new version of a patch series.
I have the same comment about v3 as for v2: I don't think that this series is bisectable so please combine the two patches into one patch or add "if (status == PRE_CHANGE) return" in ufshcd_vops_suspend() in patch 1/2 and remove this again in patch 2/2.
Thanks,
Bart.
Quoted 13 lines · Bart Van Assche
Quoted 7 lines · On 10/5/21 20:09, [email protected] wrote:
Mediatek UFS design need disable auto-hibern8 before suspend. This patch introduce an solution to do pre suspned before SSU (sleep) command.
Peter Wang (2):
scsi: ufs: support vops pre suspend
scsi: ufs: ufs-mediatek: disable auto-hibern8 before suspendPlease always include a changelog when posting a new version of a patch
series.
Quoted 8 lines
I have the same comment about v3 as for v2: I don't think that this series is bisectable so please combine the two patches into one patch or add "if (status ==
PRE_CHANGE) return" inufshcd_vops_suspend()in patch 1/2 and remove this again in patch 2/2.Thanks,
Bart.
Hi Bart,
OK, will merge to one patch.
Thanks for review.
Peter