* [PATCH 0/2] usb: dwc3: xilinx: add power management ops support
@ 2022-09-12 11:10 Piyush Mehta
2022-09-12 11:10 ` [PATCH 1/2] " Piyush Mehta
2022-09-12 11:10 ` [PATCH 2/2] usb: dwc3: xilinx: fix usb3 non-wakeup source resume failure Piyush Mehta
0 siblings, 2 replies; 3+ messages in thread
From: Piyush Mehta @ 2022-09-12 11:10 UTC (permalink / raw)
To: balbi, gregkh, michal.simek, michal.simek, linux-usb,
linux-arm-kernel, linux-kernel
Cc: git, siva.durga.prasad.paladugu, Piyush Mehta
This patch of the series does the following:
- Added power management ops support,
- Updated phy initialization,
- Added phy re-initialization on resume logic to resolve the usb3
non-wakeup source resume-failure. USB devices are not detected
after the resume on host.
Piyush Mehta (2):
usb: dwc3: xilinx: add power management ops support
usb: dwc3: xilinx: fix usb3 non-wakeup source resume failure
drivers/usb/dwc3/dwc3-xilinx.c | 63 +++++++++++++++++++++++++++-------
1 file changed, 50 insertions(+), 13 deletions(-)
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] usb: dwc3: xilinx: add power management ops support
2022-09-12 11:10 [PATCH 0/2] usb: dwc3: xilinx: add power management ops support Piyush Mehta
@ 2022-09-12 11:10 ` Piyush Mehta
2022-09-12 11:10 ` [PATCH 2/2] usb: dwc3: xilinx: fix usb3 non-wakeup source resume failure Piyush Mehta
1 sibling, 0 replies; 3+ messages in thread
From: Piyush Mehta @ 2022-09-12 11:10 UTC (permalink / raw)
To: balbi, gregkh, michal.simek, michal.simek, linux-usb,
linux-arm-kernel, linux-kernel
Cc: git, siva.durga.prasad.paladugu, Piyush Mehta
Added system sleep and run-time power management ops support for
dwc3-xilinx glue layer and update function name.
Signed-off-by: Piyush Mehta <piyush.mehta@amd.com>
---
drivers/usb/dwc3/dwc3-xilinx.c | 33 +++++++++++++++++++++++++++++----
1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c
index 67b237c7a76a..a0d0280a045e 100644
--- a/drivers/usb/dwc3/dwc3-xilinx.c
+++ b/drivers/usb/dwc3/dwc3-xilinx.c
@@ -322,7 +322,7 @@ static int dwc3_xlnx_remove(struct platform_device *pdev)
return 0;
}
-static int __maybe_unused dwc3_xlnx_suspend_common(struct device *dev)
+static int __maybe_unused dwc3_xlnx_runtime_suspend(struct device *dev)
{
struct dwc3_xlnx *priv_data = dev_get_drvdata(dev);
@@ -331,7 +331,7 @@ static int __maybe_unused dwc3_xlnx_suspend_common(struct device *dev)
return 0;
}
-static int __maybe_unused dwc3_xlnx_resume_common(struct device *dev)
+static int __maybe_unused dwc3_xlnx_runtime_resume(struct device *dev)
{
struct dwc3_xlnx *priv_data = dev_get_drvdata(dev);
@@ -346,8 +346,33 @@ static int __maybe_unused dwc3_xlnx_runtime_idle(struct device *dev)
return 0;
}
-static UNIVERSAL_DEV_PM_OPS(dwc3_xlnx_dev_pm_ops, dwc3_xlnx_suspend_common,
- dwc3_xlnx_resume_common, dwc3_xlnx_runtime_idle);
+static int __maybe_unused dwc3_xlnx_suspend(struct device *dev)
+{
+ struct dwc3_xlnx *priv_data = dev_get_drvdata(dev);
+
+ /* Disable the clocks */
+ clk_bulk_disable(priv_data->num_clocks, priv_data->clks);
+
+ return 0;
+}
+
+static int __maybe_unused dwc3_xlnx_resume(struct device *dev)
+{
+ struct dwc3_xlnx *priv_data = dev_get_drvdata(dev);
+ int ret;
+
+ ret = clk_bulk_enable(priv_data->num_clocks, priv_data->clks);
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
+static const struct dev_pm_ops dwc3_xlnx_dev_pm_ops = {
+ SET_SYSTEM_SLEEP_PM_OPS(dwc3_xlnx_suspend, dwc3_xlnx_resume)
+ SET_RUNTIME_PM_OPS(dwc3_xlnx_runtime_suspend,
+ dwc3_xlnx_runtime_resume, dwc3_xlnx_runtime_idle)
+};
static struct platform_driver dwc3_xlnx_driver = {
.probe = dwc3_xlnx_probe,
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] usb: dwc3: xilinx: fix usb3 non-wakeup source resume failure
2022-09-12 11:10 [PATCH 0/2] usb: dwc3: xilinx: add power management ops support Piyush Mehta
2022-09-12 11:10 ` [PATCH 1/2] " Piyush Mehta
@ 2022-09-12 11:10 ` Piyush Mehta
1 sibling, 0 replies; 3+ messages in thread
From: Piyush Mehta @ 2022-09-12 11:10 UTC (permalink / raw)
To: balbi, gregkh, michal.simek, michal.simek, linux-usb,
linux-arm-kernel, linux-kernel
Cc: git, siva.durga.prasad.paladugu, Piyush Mehta
When USB is in super-speed mode and disabled as a wakeup source,
observed that on the resume path, lanes have not been configured
properly in the phy-zynqmp driver.
As a result, after the resume, USB device detection failed on host.
To resolved the above issue, added phy_init on resume and phy_exit
on suspend path, to configure the GT lanes correctly.
The re-initialization of phy, reset the device and re-enumerate
the USB subsystem.
This use-case is specific to Xilinx ZynqMP SoC.
Signed-off-by: Piyush Mehta <piyush.mehta@amd.com>
---
drivers/usb/dwc3/dwc3-xilinx.c | 30 +++++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c
index a0d0280a045e..8607d4c23283 100644
--- a/drivers/usb/dwc3/dwc3-xilinx.c
+++ b/drivers/usb/dwc3/dwc3-xilinx.c
@@ -47,6 +47,7 @@ struct dwc3_xlnx {
struct device *dev;
void __iomem *regs;
int (*pltfm_init)(struct dwc3_xlnx *data);
+ struct phy *usb3_phy;
};
static void dwc3_xlnx_mask_phy_rst(struct dwc3_xlnx *priv_data, bool mask)
@@ -100,13 +101,12 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
struct device *dev = priv_data->dev;
struct reset_control *crst, *hibrst, *apbrst;
struct gpio_desc *reset_gpio;
- struct phy *usb3_phy;
int ret = 0;
u32 reg;
- usb3_phy = devm_phy_optional_get(dev, "usb3-phy");
- if (IS_ERR(usb3_phy)) {
- ret = PTR_ERR(usb3_phy);
+ priv_data->usb3_phy = devm_phy_optional_get(dev, "usb3-phy");
+ if (IS_ERR(priv_data->usb3_phy)) {
+ ret = PTR_ERR(priv_data->usb3_phy);
dev_err_probe(dev, ret,
"failed to get USB3 PHY\n");
goto err;
@@ -121,7 +121,7 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
* in use but the usb3-phy entry is missing from the device tree.
* Therefore, skip these operations in this case.
*/
- if (!usb3_phy)
+ if (!priv_data->usb3_phy)
goto skip_usb3_phy;
crst = devm_reset_control_get_exclusive(dev, "usb_crst");
@@ -166,9 +166,9 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
goto err;
}
- ret = phy_init(usb3_phy);
+ ret = phy_init(priv_data->usb3_phy);
if (ret < 0) {
- phy_exit(usb3_phy);
+ phy_exit(priv_data->usb3_phy);
goto err;
}
@@ -196,9 +196,9 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
goto err;
}
- ret = phy_power_on(usb3_phy);
+ ret = phy_power_on(priv_data->usb3_phy);
if (ret < 0) {
- phy_exit(usb3_phy);
+ phy_exit(priv_data->usb3_phy);
goto err;
}
@@ -350,6 +350,8 @@ static int __maybe_unused dwc3_xlnx_suspend(struct device *dev)
{
struct dwc3_xlnx *priv_data = dev_get_drvdata(dev);
+ phy_exit(priv_data->usb3_phy);
+
/* Disable the clocks */
clk_bulk_disable(priv_data->num_clocks, priv_data->clks);
@@ -365,6 +367,16 @@ static int __maybe_unused dwc3_xlnx_resume(struct device *dev)
if (ret)
return ret;
+ ret = phy_init(priv_data->usb3_phy);
+ if (ret < 0)
+ return ret;
+
+ ret = phy_power_on(priv_data->usb3_phy);
+ if (ret < 0) {
+ phy_exit(priv_data->usb3_phy);
+ return ret;
+ }
+
return 0;
}
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-12 11:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-12 11:10 [PATCH 0/2] usb: dwc3: xilinx: add power management ops support Piyush Mehta
2022-09-12 11:10 ` [PATCH 1/2] " Piyush Mehta
2022-09-12 11:10 ` [PATCH 2/2] usb: dwc3: xilinx: fix usb3 non-wakeup source resume failure Piyush Mehta
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).