* [PATCH v3 0/4] scsi: ufs: qcom: Suspend fixes
@ 2024-12-19 16:50 Manivannan Sadhasivam via B4 Relay
2024-12-19 16:50 ` [PATCH v3 1/4] scsi: ufs: qcom: Power off the PHY if it was already powered on in ufs_qcom_power_up_sequence() Manivannan Sadhasivam via B4 Relay
` (5 more replies)
0 siblings, 6 replies; 8+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2024-12-19 16:50 UTC (permalink / raw)
To: Alim Akhtar, Avri Altman, Bart Van Assche, James E.J. Bottomley,
Martin K. Petersen, Abel Vesa, Bjorn Andersson, Neil Armstrong,
Konrad Dybcio
Cc: linux-scsi, linux-kernel, linux-arm-msm, Amit Pundir,
Nitin Rawat, Manivannan Sadhasivam, stable, Ram Kumar Dwivedi
Hi,
This series fixes the several suspend issues on Qcom platforms. Patch 1 fixes
the resume failure with spm_lvl=5 suspend on most of the Qcom platforms. For
this patch, I couldn't figure out the exact commit that caused the issue. So I
used the commit that introduced reinit support as a placeholder.
Patch 4 fixes the suspend issue on SM8550 and SM8650 platforms where UFS
PHY retention is not supported. Hence the default spm_lvl=3 suspend fails. So
this patch configures spm_lvl=5 as the default suspend level to force UFSHC/
device powerdown during suspend. This supersedes the previous series [1] that
tried to fix the issue in clock drivers.
This series is tested on Qcom SM8550 QRD, SM8650 QRD and Qcom RB5 boards.
[1] https://lore.kernel.org/linux-arm-msm/20241107-ufs-clk-fix-v1-0-6032ff22a052@linaro.org
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
Changes in v3:
- Added a patch that honors the runtime/system PM levels set by host drivers.
Otherwise patch 4 doesn't have any effect. This was discovered with SM8650
QRD.
- Collected tags
- Link to v2: https://lore.kernel.org/r/20241213-ufs-qcom-suspend-fix-v2-0-1de6cd2d6146@linaro.org
Changes in v2:
- Changed 'ufs_qcom_drvdata::quirks' type to 'enum ufshcd_quirks'
- Collected tags
- Link to v1: https://lore.kernel.org/r/20241211-ufs-qcom-suspend-fix-v1-0-83ebbde76b1c@linaro.org
---
Manivannan Sadhasivam (4):
scsi: ufs: qcom: Power off the PHY if it was already powered on in ufs_qcom_power_up_sequence()
scsi: ufs: core: Honor runtime/system PM levels if set by host controller drivers
scsi: ufs: qcom: Allow passing platform specific OF data
scsi: ufs: qcom: Power down the controller/device during system suspend for SM8550/SM8650 SoCs
drivers/ufs/core/ufshcd-priv.h | 6 ------
drivers/ufs/core/ufshcd.c | 10 ++++++----
drivers/ufs/host/ufs-qcom.c | 31 +++++++++++++++++++------------
drivers/ufs/host/ufs-qcom.h | 5 +++++
include/ufs/ufshcd.h | 2 --
5 files changed, 30 insertions(+), 24 deletions(-)
---
base-commit: 40384c840ea1944d7c5a392e8975ed088ecf0b37
change-id: 20241211-ufs-qcom-suspend-fix-5618e9c56d93
Best regards,
--
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 1/4] scsi: ufs: qcom: Power off the PHY if it was already powered on in ufs_qcom_power_up_sequence()
2024-12-19 16:50 [PATCH v3 0/4] scsi: ufs: qcom: Suspend fixes Manivannan Sadhasivam via B4 Relay
@ 2024-12-19 16:50 ` Manivannan Sadhasivam via B4 Relay
2024-12-19 16:50 ` [PATCH v3 2/4] scsi: ufs: core: Honor runtime/system PM levels if set by host controller drivers Manivannan Sadhasivam via B4 Relay
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2024-12-19 16:50 UTC (permalink / raw)
To: Alim Akhtar, Avri Altman, Bart Van Assche, James E.J. Bottomley,
Martin K. Petersen, Abel Vesa, Bjorn Andersson, Neil Armstrong,
Konrad Dybcio
Cc: linux-scsi, linux-kernel, linux-arm-msm, Amit Pundir,
Nitin Rawat, Manivannan Sadhasivam, stable, Ram Kumar Dwivedi
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
PHY might already be powered on during ufs_qcom_power_up_sequence() in a
couple of cases:
1. During UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH quirk
2. Resuming from spm_lvl = 5 suspend
In those cases, it is necessary to call phy_power_off() and phy_exit() in
ufs_qcom_power_up_sequence() function to power off the PHY before calling
phy_init() and phy_power_on().
Case (1) is doing it via ufs_qcom_reinit_notify() callback, but case (2) is
not handled. So to satisfy both cases, call phy_power_off() and phy_exit()
if the phy_count is non-zero. And with this change, the reinit_notify()
callback is no longer needed.
This fixes the below UFS resume failure with spm_lvl = 5:
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: ufshcd_host_reset_and_restore: Host init failed -5
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: ufshcd_host_reset_and_restore: Host init failed -5
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: ufshcd_host_reset_and_restore: Host init failed -5
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: ufshcd_host_reset_and_restore: Host init failed -5
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: ufshcd_host_reset_and_restore: Host init 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 returns -5
ufs_device_wlun 0:0:0:49488: PM: failed to resume async: error -5
Cc: stable@vger.kernel.org # 6.3
Fixes: baf5ddac90dc ("scsi: ufs: ufs-qcom: Add support for reinitializing the UFS device")
Reported-by: Ram Kumar Dwivedi <quic_rdwivedi@quicinc.com>
Tested-by: Amit Pundir <amit.pundir@linaro.org> # on SM8550-HDK
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
drivers/ufs/core/ufshcd-priv.h | 6 ------
drivers/ufs/core/ufshcd.c | 1 -
drivers/ufs/host/ufs-qcom.c | 13 +++++--------
include/ufs/ufshcd.h | 2 --
4 files changed, 5 insertions(+), 17 deletions(-)
diff --git a/drivers/ufs/core/ufshcd-priv.h b/drivers/ufs/core/ufshcd-priv.h
index 7aea8fbaeee8..1f413b3aab5d 100644
--- a/drivers/ufs/core/ufshcd-priv.h
+++ b/drivers/ufs/core/ufshcd-priv.h
@@ -236,12 +236,6 @@ static inline void ufshcd_vops_config_scaling_param(struct ufs_hba *hba,
hba->vops->config_scaling_param(hba, p, data);
}
-static inline void ufshcd_vops_reinit_notify(struct ufs_hba *hba)
-{
- if (hba->vops && hba->vops->reinit_notify)
- hba->vops->reinit_notify(hba);
-}
-
static inline int ufshcd_vops_mcq_config_resource(struct ufs_hba *hba)
{
if (hba->vops && hba->vops->mcq_config_resource)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 6a2685333076..7bd0f5482db3 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -8820,7 +8820,6 @@ static int ufshcd_probe_hba(struct ufs_hba *hba, bool init_dev_params)
ufshcd_device_reset(hba);
ufs_put_device_desc(hba);
ufshcd_hba_stop(hba);
- ufshcd_vops_reinit_notify(hba);
ret = ufshcd_hba_enable(hba);
if (ret) {
dev_err(hba->dev, "Host controller enable failed\n");
diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
index 3b592492e152..32b0c74437de 100644
--- a/drivers/ufs/host/ufs-qcom.c
+++ b/drivers/ufs/host/ufs-qcom.c
@@ -368,6 +368,11 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *hba)
if (ret)
return ret;
+ if (phy->power_count) {
+ phy_power_off(phy);
+ phy_exit(phy);
+ }
+
/* phy initialization - calibrate the phy */
ret = phy_init(phy);
if (ret) {
@@ -1579,13 +1584,6 @@ static void ufs_qcom_config_scaling_param(struct ufs_hba *hba,
}
#endif
-static void ufs_qcom_reinit_notify(struct ufs_hba *hba)
-{
- struct ufs_qcom_host *host = ufshcd_get_variant(hba);
-
- phy_power_off(host->generic_phy);
-}
-
/* Resources */
static const struct ufshcd_res_info ufs_res_info[RES_MAX] = {
{.name = "ufs_mem",},
@@ -1825,7 +1823,6 @@ static const struct ufs_hba_variant_ops ufs_hba_qcom_vops = {
.device_reset = ufs_qcom_device_reset,
.config_scaling_param = ufs_qcom_config_scaling_param,
.program_key = ufs_qcom_ice_program_key,
- .reinit_notify = ufs_qcom_reinit_notify,
.mcq_config_resource = ufs_qcom_mcq_config_resource,
.get_hba_mac = ufs_qcom_get_hba_mac,
.op_runtime_config = ufs_qcom_op_runtime_config,
diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
index d7aca9e61684..6e40b8e8009b 100644
--- a/include/ufs/ufshcd.h
+++ b/include/ufs/ufshcd.h
@@ -327,7 +327,6 @@ struct ufs_pwr_mode_info {
* @program_key: program or evict an inline encryption key
* @fill_crypto_prdt: initialize crypto-related fields in the PRDT
* @event_notify: called to notify important events
- * @reinit_notify: called to notify reinit of UFSHCD during max gear switch
* @mcq_config_resource: called to configure MCQ platform resources
* @get_hba_mac: reports maximum number of outstanding commands supported by
* the controller. Should be implemented for UFSHCI 4.0 or later
@@ -379,7 +378,6 @@ struct ufs_hba_variant_ops {
void *prdt, unsigned int num_segments);
void (*event_notify)(struct ufs_hba *hba,
enum ufs_event_type evt, void *data);
- void (*reinit_notify)(struct ufs_hba *);
int (*mcq_config_resource)(struct ufs_hba *hba);
int (*get_hba_mac)(struct ufs_hba *hba);
int (*op_runtime_config)(struct ufs_hba *hba);
--
2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 2/4] scsi: ufs: core: Honor runtime/system PM levels if set by host controller drivers
2024-12-19 16:50 [PATCH v3 0/4] scsi: ufs: qcom: Suspend fixes Manivannan Sadhasivam via B4 Relay
2024-12-19 16:50 ` [PATCH v3 1/4] scsi: ufs: qcom: Power off the PHY if it was already powered on in ufs_qcom_power_up_sequence() Manivannan Sadhasivam via B4 Relay
@ 2024-12-19 16:50 ` Manivannan Sadhasivam via B4 Relay
2024-12-19 17:03 ` Bart Van Assche
2024-12-19 16:50 ` [PATCH v3 3/4] scsi: ufs: qcom: Allow passing platform specific OF data Manivannan Sadhasivam via B4 Relay
` (3 subsequent siblings)
5 siblings, 1 reply; 8+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2024-12-19 16:50 UTC (permalink / raw)
To: Alim Akhtar, Avri Altman, Bart Van Assche, James E.J. Bottomley,
Martin K. Petersen, Abel Vesa, Bjorn Andersson, Neil Armstrong,
Konrad Dybcio
Cc: linux-scsi, linux-kernel, linux-arm-msm, Amit Pundir,
Nitin Rawat, Manivannan Sadhasivam
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Otherwise, the default levels will override the levels set by the host
controller drivers.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
drivers/ufs/core/ufshcd.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 7bd0f5482db3..457add6edb31 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -10551,14 +10551,17 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
}
/*
- * Set the default power management level for runtime and system PM.
+ * Set the default power management level for runtime and system PM if
+ * not set by the host controller drivers.
* Default power saving mode is to keep UFS link in Hibern8 state
* and UFS device in sleep state.
*/
- hba->rpm_lvl = ufs_get_desired_pm_lvl_for_dev_link_state(
+ if (!hba->rpm_lvl)
+ hba->rpm_lvl = ufs_get_desired_pm_lvl_for_dev_link_state(
UFS_SLEEP_PWR_MODE,
UIC_LINK_HIBERN8_STATE);
- hba->spm_lvl = ufs_get_desired_pm_lvl_for_dev_link_state(
+ if (!hba->spm_lvl)
+ hba->spm_lvl = ufs_get_desired_pm_lvl_for_dev_link_state(
UFS_SLEEP_PWR_MODE,
UIC_LINK_HIBERN8_STATE);
--
2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 3/4] scsi: ufs: qcom: Allow passing platform specific OF data
2024-12-19 16:50 [PATCH v3 0/4] scsi: ufs: qcom: Suspend fixes Manivannan Sadhasivam via B4 Relay
2024-12-19 16:50 ` [PATCH v3 1/4] scsi: ufs: qcom: Power off the PHY if it was already powered on in ufs_qcom_power_up_sequence() Manivannan Sadhasivam via B4 Relay
2024-12-19 16:50 ` [PATCH v3 2/4] scsi: ufs: core: Honor runtime/system PM levels if set by host controller drivers Manivannan Sadhasivam via B4 Relay
@ 2024-12-19 16:50 ` Manivannan Sadhasivam via B4 Relay
2024-12-19 16:50 ` [PATCH v3 4/4] scsi: ufs: qcom: Power down the controller/device during system suspend for SM8550/SM8650 SoCs Manivannan Sadhasivam via B4 Relay
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2024-12-19 16:50 UTC (permalink / raw)
To: Alim Akhtar, Avri Altman, Bart Van Assche, James E.J. Bottomley,
Martin K. Petersen, Abel Vesa, Bjorn Andersson, Neil Armstrong,
Konrad Dybcio
Cc: linux-scsi, linux-kernel, linux-arm-msm, Amit Pundir,
Nitin Rawat, Manivannan Sadhasivam
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
In order to allow platform specific flags and configurations, introduce
the platform specific OF data and move the existing quirk
UFSHCD_QUIRK_BROKEN_LSDBS_CAP for SM8550 and SM8650 SoCs.
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Tested-by: Amit Pundir <amit.pundir@linaro.org> # on SM8550-HDK
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
drivers/ufs/host/ufs-qcom.c | 13 +++++++++----
drivers/ufs/host/ufs-qcom.h | 4 ++++
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
index 32b0c74437de..35ae8c8fc301 100644
--- a/drivers/ufs/host/ufs-qcom.c
+++ b/drivers/ufs/host/ufs-qcom.c
@@ -871,6 +871,7 @@ static u32 ufs_qcom_get_ufs_hci_version(struct ufs_hba *hba)
*/
static void ufs_qcom_advertise_quirks(struct ufs_hba *hba)
{
+ const struct ufs_qcom_drvdata *drvdata = of_device_get_match_data(hba->dev);
struct ufs_qcom_host *host = ufshcd_get_variant(hba);
if (host->hw_ver.major == 0x2)
@@ -879,9 +880,8 @@ static void ufs_qcom_advertise_quirks(struct ufs_hba *hba)
if (host->hw_ver.major > 0x3)
hba->quirks |= UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH;
- if (of_device_is_compatible(hba->dev->of_node, "qcom,sm8550-ufshc") ||
- of_device_is_compatible(hba->dev->of_node, "qcom,sm8650-ufshc"))
- hba->quirks |= UFSHCD_QUIRK_BROKEN_LSDBS_CAP;
+ if (drvdata && drvdata->quirks)
+ hba->quirks |= drvdata->quirks;
}
static void ufs_qcom_set_phy_gear(struct ufs_qcom_host *host)
@@ -1864,9 +1864,14 @@ static void ufs_qcom_remove(struct platform_device *pdev)
platform_device_msi_free_irqs_all(hba->dev);
}
+static const struct ufs_qcom_drvdata ufs_qcom_sm8550_drvdata = {
+ .quirks = UFSHCD_QUIRK_BROKEN_LSDBS_CAP,
+};
+
static const struct of_device_id ufs_qcom_of_match[] __maybe_unused = {
{ .compatible = "qcom,ufshc" },
- { .compatible = "qcom,sm8550-ufshc" },
+ { .compatible = "qcom,sm8550-ufshc", .data = &ufs_qcom_sm8550_drvdata },
+ { .compatible = "qcom,sm8650-ufshc", .data = &ufs_qcom_sm8550_drvdata },
{},
};
MODULE_DEVICE_TABLE(of, ufs_qcom_of_match);
diff --git a/drivers/ufs/host/ufs-qcom.h b/drivers/ufs/host/ufs-qcom.h
index b9de170983c9..15f6dad8b27f 100644
--- a/drivers/ufs/host/ufs-qcom.h
+++ b/drivers/ufs/host/ufs-qcom.h
@@ -217,6 +217,10 @@ struct ufs_qcom_host {
bool esi_enabled;
};
+struct ufs_qcom_drvdata {
+ enum ufshcd_quirks quirks;
+};
+
static inline u32
ufs_qcom_get_debug_reg_offset(struct ufs_qcom_host *host, u32 reg)
{
--
2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 4/4] scsi: ufs: qcom: Power down the controller/device during system suspend for SM8550/SM8650 SoCs
2024-12-19 16:50 [PATCH v3 0/4] scsi: ufs: qcom: Suspend fixes Manivannan Sadhasivam via B4 Relay
` (2 preceding siblings ...)
2024-12-19 16:50 ` [PATCH v3 3/4] scsi: ufs: qcom: Allow passing platform specific OF data Manivannan Sadhasivam via B4 Relay
@ 2024-12-19 16:50 ` Manivannan Sadhasivam via B4 Relay
2024-12-26 4:34 ` [PATCH v3 0/4] scsi: ufs: qcom: Suspend fixes Manivannan Sadhasivam
2025-01-02 22:46 ` Martin K. Petersen
5 siblings, 0 replies; 8+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2024-12-19 16:50 UTC (permalink / raw)
To: Alim Akhtar, Avri Altman, Bart Van Assche, James E.J. Bottomley,
Martin K. Petersen, Abel Vesa, Bjorn Andersson, Neil Armstrong,
Konrad Dybcio
Cc: linux-scsi, linux-kernel, linux-arm-msm, Amit Pundir,
Nitin Rawat, Manivannan Sadhasivam, stable
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
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: stable@vger.kernel.org # 6.3
Fixes: 35cf1aaab169 ("arm64: dts: qcom: sm8550: Add UFS host controller and phy nodes")
Fixes: 10e024671295 ("arm64: dts: qcom: sm8650: add interconnect dependent device nodes")
Reported-by: Neil Armstrong <neil.armstrong@linaro.org>
Tested-by: Amit Pundir <amit.pundir@linaro.org> # on SM8550-HDK
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
drivers/ufs/host/ufs-qcom.c | 5 +++++
drivers/ufs/host/ufs-qcom.h | 1 +
2 files changed, 6 insertions(+)
diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
index 35ae8c8fc301..edf62430cabe 100644
--- a/drivers/ufs/host/ufs-qcom.c
+++ b/drivers/ufs/host/ufs-qcom.c
@@ -1069,6 +1069,7 @@ static int ufs_qcom_init(struct ufs_hba *hba)
struct device *dev = hba->dev;
struct ufs_qcom_host *host;
struct ufs_clk_info *clki;
+ const struct ufs_qcom_drvdata *drvdata = of_device_get_match_data(hba->dev);
host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL);
if (!host)
@@ -1148,6 +1149,9 @@ static int ufs_qcom_init(struct ufs_hba *hba)
dev_warn(dev, "%s: failed to configure the testbus %d\n",
__func__, err);
+ if (drvdata && drvdata->no_phy_retention)
+ hba->spm_lvl = UFS_PM_LVL_5;
+
return 0;
out_variant_clear:
@@ -1866,6 +1870,7 @@ static void ufs_qcom_remove(struct platform_device *pdev)
static const struct ufs_qcom_drvdata ufs_qcom_sm8550_drvdata = {
.quirks = UFSHCD_QUIRK_BROKEN_LSDBS_CAP,
+ .no_phy_retention = true,
};
static const struct of_device_id ufs_qcom_of_match[] __maybe_unused = {
diff --git a/drivers/ufs/host/ufs-qcom.h b/drivers/ufs/host/ufs-qcom.h
index 15f6dad8b27f..919f53682beb 100644
--- a/drivers/ufs/host/ufs-qcom.h
+++ b/drivers/ufs/host/ufs-qcom.h
@@ -219,6 +219,7 @@ struct ufs_qcom_host {
struct ufs_qcom_drvdata {
enum ufshcd_quirks quirks;
+ bool no_phy_retention;
};
static inline u32
--
2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 2/4] scsi: ufs: core: Honor runtime/system PM levels if set by host controller drivers
2024-12-19 16:50 ` [PATCH v3 2/4] scsi: ufs: core: Honor runtime/system PM levels if set by host controller drivers Manivannan Sadhasivam via B4 Relay
@ 2024-12-19 17:03 ` Bart Van Assche
0 siblings, 0 replies; 8+ messages in thread
From: Bart Van Assche @ 2024-12-19 17:03 UTC (permalink / raw)
To: manivannan.sadhasivam, Alim Akhtar, Avri Altman,
James E.J. Bottomley, Martin K. Petersen, Abel Vesa,
Bjorn Andersson, Neil Armstrong, Konrad Dybcio
Cc: linux-scsi, linux-kernel, linux-arm-msm, Amit Pundir, Nitin Rawat
On 12/19/24 8:50 AM, Manivannan Sadhasivam via B4 Relay wrote:
> Otherwise, the default levels will override the levels set by the host
> controller drivers.
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 0/4] scsi: ufs: qcom: Suspend fixes
2024-12-19 16:50 [PATCH v3 0/4] scsi: ufs: qcom: Suspend fixes Manivannan Sadhasivam via B4 Relay
` (3 preceding siblings ...)
2024-12-19 16:50 ` [PATCH v3 4/4] scsi: ufs: qcom: Power down the controller/device during system suspend for SM8550/SM8650 SoCs Manivannan Sadhasivam via B4 Relay
@ 2024-12-26 4:34 ` Manivannan Sadhasivam
2025-01-02 22:46 ` Martin K. Petersen
5 siblings, 0 replies; 8+ messages in thread
From: Manivannan Sadhasivam @ 2024-12-26 4:34 UTC (permalink / raw)
To: Martin K. Petersen
Cc: Alim Akhtar, Avri Altman, Bart Van Assche, Abel Vesa,
Bjorn Andersson, Neil Armstrong, Konrad Dybcio, linux-scsi,
linux-kernel, linux-arm-msm, Amit Pundir, Nitin Rawat, stable,
Ram Kumar Dwivedi
On Thu, Dec 19, 2024 at 10:20:40PM +0530, Manivannan Sadhasivam via B4 Relay wrote:
> Hi,
>
> This series fixes the several suspend issues on Qcom platforms. Patch 1 fixes
> the resume failure with spm_lvl=5 suspend on most of the Qcom platforms. For
> this patch, I couldn't figure out the exact commit that caused the issue. So I
> used the commit that introduced reinit support as a placeholder.
>
> Patch 4 fixes the suspend issue on SM8550 and SM8650 platforms where UFS
> PHY retention is not supported. Hence the default spm_lvl=3 suspend fails. So
> this patch configures spm_lvl=5 as the default suspend level to force UFSHC/
> device powerdown during suspend. This supersedes the previous series [1] that
> tried to fix the issue in clock drivers.
>
> This series is tested on Qcom SM8550 QRD, SM8650 QRD and Qcom RB5 boards.
>
> [1] https://lore.kernel.org/linux-arm-msm/20241107-ufs-clk-fix-v1-0-6032ff22a052@linaro.org
>
Martin, can you please pick up this series?
- Mani
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---
> Changes in v3:
> - Added a patch that honors the runtime/system PM levels set by host drivers.
> Otherwise patch 4 doesn't have any effect. This was discovered with SM8650
> QRD.
> - Collected tags
> - Link to v2: https://lore.kernel.org/r/20241213-ufs-qcom-suspend-fix-v2-0-1de6cd2d6146@linaro.org
>
> Changes in v2:
> - Changed 'ufs_qcom_drvdata::quirks' type to 'enum ufshcd_quirks'
> - Collected tags
> - Link to v1: https://lore.kernel.org/r/20241211-ufs-qcom-suspend-fix-v1-0-83ebbde76b1c@linaro.org
>
> ---
> Manivannan Sadhasivam (4):
> scsi: ufs: qcom: Power off the PHY if it was already powered on in ufs_qcom_power_up_sequence()
> scsi: ufs: core: Honor runtime/system PM levels if set by host controller drivers
> scsi: ufs: qcom: Allow passing platform specific OF data
> scsi: ufs: qcom: Power down the controller/device during system suspend for SM8550/SM8650 SoCs
>
> drivers/ufs/core/ufshcd-priv.h | 6 ------
> drivers/ufs/core/ufshcd.c | 10 ++++++----
> drivers/ufs/host/ufs-qcom.c | 31 +++++++++++++++++++------------
> drivers/ufs/host/ufs-qcom.h | 5 +++++
> include/ufs/ufshcd.h | 2 --
> 5 files changed, 30 insertions(+), 24 deletions(-)
> ---
> base-commit: 40384c840ea1944d7c5a392e8975ed088ecf0b37
> change-id: 20241211-ufs-qcom-suspend-fix-5618e9c56d93
>
> Best regards,
> --
> Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
>
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 0/4] scsi: ufs: qcom: Suspend fixes
2024-12-19 16:50 [PATCH v3 0/4] scsi: ufs: qcom: Suspend fixes Manivannan Sadhasivam via B4 Relay
` (4 preceding siblings ...)
2024-12-26 4:34 ` [PATCH v3 0/4] scsi: ufs: qcom: Suspend fixes Manivannan Sadhasivam
@ 2025-01-02 22:46 ` Martin K. Petersen
5 siblings, 0 replies; 8+ messages in thread
From: Martin K. Petersen @ 2025-01-02 22:46 UTC (permalink / raw)
To: Alim Akhtar, Avri Altman, Bart Van Assche, James E.J. Bottomley,
Abel Vesa, Bjorn Andersson, Neil Armstrong, Konrad Dybcio,
Manivannan Sadhasivam
Cc: Martin K . Petersen, linux-scsi, linux-kernel, linux-arm-msm,
Amit Pundir, Nitin Rawat, stable, Ram Kumar Dwivedi
On Thu, 19 Dec 2024 22:20:40 +0530, Manivannan Sadhasivam wrote:
> This series fixes the several suspend issues on Qcom platforms. Patch 1 fixes
> the resume failure with spm_lvl=5 suspend on most of the Qcom platforms. For
> this patch, I couldn't figure out the exact commit that caused the issue. So I
> used the commit that introduced reinit support as a placeholder.
>
> Patch 4 fixes the suspend issue on SM8550 and SM8650 platforms where UFS
> PHY retention is not supported. Hence the default spm_lvl=3 suspend fails. So
> this patch configures spm_lvl=5 as the default suspend level to force UFSHC/
> device powerdown during suspend. This supersedes the previous series [1] that
> tried to fix the issue in clock drivers.
>
> [...]
Applied to 6.13/scsi-fixes, thanks!
[1/4] scsi: ufs: qcom: Power off the PHY if it was already powered on in ufs_qcom_power_up_sequence()
https://git.kernel.org/mkp/scsi/c/7bac65687510
[2/4] scsi: ufs: core: Honor runtime/system PM levels if set by host controller drivers
https://git.kernel.org/mkp/scsi/c/bb9850704c04
[3/4] scsi: ufs: qcom: Allow passing platform specific OF data
https://git.kernel.org/mkp/scsi/c/4f78a56af4c4
[4/4] scsi: ufs: qcom: Power down the controller/device during system suspend for SM8550/SM8650 SoCs
https://git.kernel.org/mkp/scsi/c/3b2f56860b05
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-01-02 22:47 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-19 16:50 [PATCH v3 0/4] scsi: ufs: qcom: Suspend fixes Manivannan Sadhasivam via B4 Relay
2024-12-19 16:50 ` [PATCH v3 1/4] scsi: ufs: qcom: Power off the PHY if it was already powered on in ufs_qcom_power_up_sequence() Manivannan Sadhasivam via B4 Relay
2024-12-19 16:50 ` [PATCH v3 2/4] scsi: ufs: core: Honor runtime/system PM levels if set by host controller drivers Manivannan Sadhasivam via B4 Relay
2024-12-19 17:03 ` Bart Van Assche
2024-12-19 16:50 ` [PATCH v3 3/4] scsi: ufs: qcom: Allow passing platform specific OF data Manivannan Sadhasivam via B4 Relay
2024-12-19 16:50 ` [PATCH v3 4/4] scsi: ufs: qcom: Power down the controller/device during system suspend for SM8550/SM8650 SoCs Manivannan Sadhasivam via B4 Relay
2024-12-26 4:34 ` [PATCH v3 0/4] scsi: ufs: qcom: Suspend fixes Manivannan Sadhasivam
2025-01-02 22:46 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®