2021-09-14 14:56:11

by Amelie Delaunay

[permalink] [raw]
Subject: [PATCH 0/3] phy: stm32: add phy tuning support

This series brings phy tuning to stm32-usbphyc with a new optional
device tree property st,phy-tuning, the elements of which
(st,phy-tuning node properties) are also optional.
A prior patch add resume routine, which is used to restore UTMI
switch and phy tuning configuration, as they can be reset if
deep low power state is achieved.

Amelie Delaunay (3):
phy: stm32: restore utmi switch on resume
dt-bindings: phy: phy-stm32-usbphyc: add st,phy-tuning optional
property
phy: stm32: add phy tuning support

.../bindings/phy/phy-stm32-usbphyc.yaml | 68 ++++++
drivers/phy/st/phy-stm32-usbphyc.c | 208 ++++++++++++++++++
2 files changed, 276 insertions(+)

--
2.25.1


2021-09-14 14:58:10

by Amelie Delaunay

[permalink] [raw]
Subject: [PATCH 1/3] phy: stm32: restore utmi switch on resume

UTMI switch value can be lost during suspend/resume, depending on the power
state reached.
This patch adds resume function to usbphyc, to reconfigure utmi switch
after suspend.

Signed-off-by: Amelie Delaunay <[email protected]>
---
drivers/phy/st/phy-stm32-usbphyc.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/drivers/phy/st/phy-stm32-usbphyc.c b/drivers/phy/st/phy-stm32-usbphyc.c
index 937a14fa7448..083593aea53a 100644
--- a/drivers/phy/st/phy-stm32-usbphyc.c
+++ b/drivers/phy/st/phy-stm32-usbphyc.c
@@ -598,6 +598,18 @@ static int stm32_usbphyc_remove(struct platform_device *pdev)
return 0;
}

+static int __maybe_unused stm32_usbphyc_resume(struct device *dev)
+{
+ struct stm32_usbphyc *usbphyc = dev_get_drvdata(dev);
+
+ if (usbphyc->switch_setup >= 0)
+ stm32_usbphyc_switch_setup(usbphyc, usbphyc->switch_setup);
+
+ return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(stm32_usbphyc_pm_ops, NULL, stm32_usbphyc_resume);
+
static const struct of_device_id stm32_usbphyc_of_match[] = {
{ .compatible = "st,stm32mp1-usbphyc", },
{ },
@@ -610,6 +622,7 @@ static struct platform_driver stm32_usbphyc_driver = {
.driver = {
.of_match_table = stm32_usbphyc_of_match,
.name = "stm32-usbphyc",
+ .pm = &stm32_usbphyc_pm_ops,
}
};
module_platform_driver(stm32_usbphyc_driver);
--
2.25.1