Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 3b2f568

Browse files
Mani-Sadhasivammartinkpetersen
authored andcommitted
scsi: ufs: qcom: Power down the controller/device during system suspend for SM8550/SM8650 SoCs
SM8550 and SM8650 SoCs doesn't support UFS PHY retention. So once these SoCs reaches the low power state (CX power collapse) during system suspend, all the PHY hardware state gets lost. This leads to the UFS resume failure: ufshcd-qcom 1d84000.ufs: ufshcd_uic_hibern8_exit: hibern8 exit failed. ret = 5 ufshcd-qcom 1d84000.ufs: __ufshcd_wl_resume: hibern8 exit failed 5 ufs_device_wlun 0:0:0:49488: ufshcd_wl_resume failed: 5 ufs_device_wlun 0:0:0:49488: PM: dpm_run_callback(): scsi_bus_resume+0x0/0x84 returns 5 ufs_device_wlun 0:0:0:49488: PM: failed to resume async: error 5 With the default system suspend level of UFS_PM_LVL_3, the power domain for UFS PHY needs to be kept always ON to retain the state. But this would prevent these SoCs from reaching the CX power collapse state, leading to poor power saving during system suspend. So to fix this issue without affecting the power saving, set 'ufs_qcom_drvdata::no_phy_retention' to true which sets 'hba->spm_lvl' to UFS_PM_LVL_5 to allow both the controller and device (in turn the PHY) to be powered down during system suspend for these SoCs by default. Cc: [email protected] # 6.3 Fixes: 35cf1aa ("arm64: dts: qcom: sm8550: Add UFS host controller and phy nodes") Fixes: 10e0246 ("arm64: dts: qcom: sm8650: add interconnect dependent device nodes") Reported-by: Neil Armstrong <[email protected]> Tested-by: Amit Pundir <[email protected]> # on SM8550-HDK Reviewed-by: Bart Van Assche <[email protected]> Tested-by: Neil Armstrong <[email protected]> # on SM8550-QRD Signed-off-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 4f78a56 commit 3b2f568

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

drivers/ufs/host/ufs-qcom.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,6 +1069,7 @@ static int ufs_qcom_init(struct ufs_hba *hba)
10691069
struct device *dev = hba->dev;
10701070
struct ufs_qcom_host *host;
10711071
struct ufs_clk_info *clki;
1072+
const struct ufs_qcom_drvdata *drvdata = of_device_get_match_data(hba->dev);
10721073

10731074
host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL);
10741075
if (!host)
@@ -1148,6 +1149,9 @@ static int ufs_qcom_init(struct ufs_hba *hba)
11481149
dev_warn(dev, "%s: failed to configure the testbus %d\n",
11491150
__func__, err);
11501151

1152+
if (drvdata && drvdata->no_phy_retention)
1153+
hba->spm_lvl = UFS_PM_LVL_5;
1154+
11511155
return 0;
11521156

11531157
out_variant_clear:
@@ -1867,6 +1871,7 @@ static void ufs_qcom_remove(struct platform_device *pdev)
18671871

18681872
static const struct ufs_qcom_drvdata ufs_qcom_sm8550_drvdata = {
18691873
.quirks = UFSHCD_QUIRK_BROKEN_LSDBS_CAP,
1874+
.no_phy_retention = true,
18701875
};
18711876

18721877
static const struct of_device_id ufs_qcom_of_match[] __maybe_unused = {

drivers/ufs/host/ufs-qcom.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ struct ufs_qcom_host {
219219

220220
struct ufs_qcom_drvdata {
221221
enum ufshcd_quirks quirks;
222+
bool no_phy_retention;
222223
};
223224

224225
static inline u32

0 commit comments

Comments
 (0)