* [PATCH v5 0/1] scsi: ufs: Add hibernation callbacks
@ 2023-02-02 16:10 Anjana Hari
2023-02-02 16:10 ` [PATCH v5 1/1] " Anjana Hari
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Anjana Hari @ 2023-02-02 16:10 UTC (permalink / raw)
To: agross, andersson, jejb, martin.petersen
Cc: alim.akhtar, avri.altman, bvanassche, konrad.dybcio, linux-scsi,
linux-kernel, quic_narepall, quic_nitirawa, quic_rampraka,
Anjana Hari
v5:
-Removed extra hba->restore member introduced in previous
patch, moved the concerned code to ufshcd_system_restore.
v4:
-Addressed comments from Bart, removed runtime pm related
code.
-Address kernel bot compilation issues.
v3:
-Address compilation issues
v2:
- Addressed Bart's comments
- Moved core and host related changes to single patch
- Note to Bart: Regrading the comment to pass "restore" as an
argument instead of adding a new member to ufs_hba structure, adding
new function argument in core file (ufshcd.c) is forcing us to make
changes to other vendor files to fix the compilation errors. Hence
we have retained our original change. Please let us know your inputs
on this.
Initial version:
- Adds hibernation callbacks - freeze, restore and thaw,
required for suspend to disk feature.
Anjana Hari (1):
scsi: ufs: Add hibernation callbacks
drivers/ufs/core/ufshcd.c | 51 +++++++++++++++++++++++++++++++++++++
drivers/ufs/host/ufs-qcom.c | 8 +++++-
include/ufs/ufshcd.h | 4 +++
3 files changed, 62 insertions(+), 1 deletion(-)
--
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v5 1/1] scsi: ufs: Add hibernation callbacks
2023-02-02 16:10 [PATCH v5 0/1] scsi: ufs: Add hibernation callbacks Anjana Hari
@ 2023-02-02 16:10 ` Anjana Hari
2023-02-02 17:58 ` Bart Van Assche
2023-02-08 23:52 ` [PATCH v5 0/1] " Martin K. Petersen
2023-02-14 16:57 ` Martin K. Petersen
2 siblings, 1 reply; 5+ messages in thread
From: Anjana Hari @ 2023-02-02 16:10 UTC (permalink / raw)
To: agross, andersson, jejb, martin.petersen
Cc: alim.akhtar, avri.altman, bvanassche, konrad.dybcio, linux-scsi,
linux-kernel, quic_narepall, quic_nitirawa, quic_rampraka,
Anjana Hari
Adds freeze, thaw and restore callbacks for hibernate and restore
functionality.
Signed-off-by: Anjana Hari <quic_ahari@quicinc.com>
---
drivers/ufs/core/ufshcd.c | 51 +++++++++++++++++++++++++++++++++++++
drivers/ufs/host/ufs-qcom.c | 8 +++++-
include/ufs/ufshcd.h | 4 +++
3 files changed, 62 insertions(+), 1 deletion(-)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index ec732e4bbbf4..cabe0b4c0138 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -9825,6 +9825,7 @@ static int ufshcd_resume(struct ufs_hba *hba)
/* enable the host irq as host controller would be active soon */
ufshcd_enable_irq(hba);
+
goto out;
disable_vreg:
@@ -9988,6 +9989,56 @@ void ufshcd_remove(struct ufs_hba *hba)
}
EXPORT_SYMBOL_GPL(ufshcd_remove);
+#ifdef CONFIG_PM_SLEEP
+int ufshcd_system_freeze(struct device *dev)
+{
+
+ return ufshcd_system_suspend(dev);
+
+}
+EXPORT_SYMBOL_GPL(ufshcd_system_freeze);
+
+int ufshcd_system_restore(struct device *dev)
+{
+
+ struct ufs_hba *hba = dev_get_drvdata(dev);
+ int ret;
+
+ ret = ufshcd_system_resume(dev);
+ if (ret)
+ return ret;
+
+ /* Configure UTRL and UTMRL base address registers */
+ ufshcd_writel(hba, lower_32_bits(hba->utrdl_dma_addr),
+ REG_UTP_TRANSFER_REQ_LIST_BASE_L);
+ ufshcd_writel(hba, upper_32_bits(hba->utrdl_dma_addr),
+ REG_UTP_TRANSFER_REQ_LIST_BASE_H);
+ ufshcd_writel(hba, lower_32_bits(hba->utmrdl_dma_addr),
+ REG_UTP_TASK_REQ_LIST_BASE_L);
+ ufshcd_writel(hba, upper_32_bits(hba->utmrdl_dma_addr),
+ REG_UTP_TASK_REQ_LIST_BASE_H);
+ /*
+ * Make sure that UTRL and UTMRL base address registers
+ * are updated with the latest queue addresses. Only after
+ * updating these addresses, we can queue the new commands.
+ */
+ mb();
+
+ /* Resuming from hibernate, assume that link was OFF */
+ ufshcd_set_link_off(hba);
+
+ return 0;
+
+}
+EXPORT_SYMBOL_GPL(ufshcd_system_restore);
+
+int ufshcd_system_thaw(struct device *dev)
+{
+ return ufshcd_system_resume(dev);
+}
+EXPORT_SYMBOL_GPL(ufshcd_system_thaw);
+#endif /* CONFIG_PM_SLEEP */
+
/**
* ufshcd_dealloc_host - deallocate Host Bus Adapter (HBA)
* @hba: pointer to Host Bus Adapter (HBA)
diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
index 681da3ea7154..a5243acc1bc8 100644
--- a/drivers/ufs/host/ufs-qcom.c
+++ b/drivers/ufs/host/ufs-qcom.c
@@ -1714,10 +1714,16 @@ MODULE_DEVICE_TABLE(acpi, ufs_qcom_acpi_match);
#endif
static const struct dev_pm_ops ufs_qcom_pm_ops = {
- SET_SYSTEM_SLEEP_PM_OPS(ufshcd_system_suspend, ufshcd_system_resume)
SET_RUNTIME_PM_OPS(ufshcd_runtime_suspend, ufshcd_runtime_resume, NULL)
.prepare = ufshcd_suspend_prepare,
.complete = ufshcd_resume_complete,
+#ifdef CONFIG_PM_SLEEP
+ .suspend = ufshcd_system_suspend,
+ .resume = ufshcd_system_resume,
+ .freeze = ufshcd_system_freeze,
+ .restore = ufshcd_system_restore,
+ .thaw = ufshcd_system_thaw,
+#endif
};
static struct platform_driver ufs_qcom_pltform = {
diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
index 6d26ff0cc07e..431c3afb2ce0 100644
--- a/include/ufs/ufshcd.h
+++ b/include/ufs/ufshcd.h
@@ -1278,8 +1278,12 @@ extern int ufshcd_runtime_resume(struct device *dev);
#ifdef CONFIG_PM_SLEEP
extern int ufshcd_system_suspend(struct device *dev);
extern int ufshcd_system_resume(struct device *dev);
+extern int ufshcd_system_freeze(struct device *dev);
+extern int ufshcd_system_thaw(struct device *dev);
+extern int ufshcd_system_restore(struct device *dev);
#endif
extern int ufshcd_shutdown(struct ufs_hba *hba);
+
extern int ufshcd_dme_configure_adapt(struct ufs_hba *hba,
int agreed_gear,
int adapt_val);
--
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v5 1/1] scsi: ufs: Add hibernation callbacks
2023-02-02 16:10 ` [PATCH v5 1/1] " Anjana Hari
@ 2023-02-02 17:58 ` Bart Van Assche
0 siblings, 0 replies; 5+ messages in thread
From: Bart Van Assche @ 2023-02-02 17:58 UTC (permalink / raw)
To: Anjana Hari, agross, andersson, jejb, martin.petersen
Cc: alim.akhtar, avri.altman, konrad.dybcio, linux-scsi,
linux-kernel, quic_narepall, quic_nitirawa, quic_rampraka
On 2/2/23 08:10, Anjana Hari wrote:
> Adds freeze, thaw and restore callbacks for hibernate and restore
> functionality.
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v5 0/1] scsi: ufs: Add hibernation callbacks
2023-02-02 16:10 [PATCH v5 0/1] scsi: ufs: Add hibernation callbacks Anjana Hari
2023-02-02 16:10 ` [PATCH v5 1/1] " Anjana Hari
@ 2023-02-08 23:52 ` Martin K. Petersen
2023-02-14 16:57 ` Martin K. Petersen
2 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2023-02-08 23:52 UTC (permalink / raw)
To: Anjana Hari
Cc: agross, andersson, jejb, martin.petersen, alim.akhtar,
avri.altman, bvanassche, konrad.dybcio, linux-scsi, linux-kernel,
quic_narepall, quic_nitirawa, quic_rampraka
Anjana,
> - Adds hibernation callbacks - freeze, restore and thaw, required for
> suspend to disk feature.
Applied to 6.3/scsi-staging, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v5 0/1] scsi: ufs: Add hibernation callbacks
2023-02-02 16:10 [PATCH v5 0/1] scsi: ufs: Add hibernation callbacks Anjana Hari
2023-02-02 16:10 ` [PATCH v5 1/1] " Anjana Hari
2023-02-08 23:52 ` [PATCH v5 0/1] " Martin K. Petersen
@ 2023-02-14 16:57 ` Martin K. Petersen
2 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2023-02-14 16:57 UTC (permalink / raw)
To: agross, andersson, jejb, Anjana Hari
Cc: Martin K . Petersen, alim.akhtar, avri.altman, bvanassche,
konrad.dybcio, linux-scsi, linux-kernel, quic_narepall,
quic_nitirawa, quic_rampraka
On Thu, 02 Feb 2023 21:40:44 +0530, Anjana Hari wrote:
> v5:
> -Removed extra hba->restore member introduced in previous
> patch, moved the concerned code to ufshcd_system_restore.
>
> v4:
> -Addressed comments from Bart, removed runtime pm related
> code.
> -Address kernel bot compilation issues.
>
> [...]
Applied to 6.3/scsi-queue, thanks!
[1/1] scsi: ufs: Add hibernation callbacks
https://git.kernel.org/mkp/scsi/c/88441a8d355d
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-02-14 16:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-02 16:10 [PATCH v5 0/1] scsi: ufs: Add hibernation callbacks Anjana Hari
2023-02-02 16:10 ` [PATCH v5 1/1] " Anjana Hari
2023-02-02 17:58 ` Bart Van Assche
2023-02-08 23:52 ` [PATCH v5 0/1] " Martin K. Petersen
2023-02-14 16:57 ` 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®