59 lines
1.6 KiB
Diff
59 lines
1.6 KiB
Diff
|
From a2886a79d2bcd95591d9fb805dc8e50feb195d97 Mon Sep 17 00:00:00 2001
|
||
|
From: Ondrej Jirman <megi@xff.cz>
|
||
|
Date: Sun, 30 Apr 2023 18:54:51 +0200
|
||
|
Subject: [PATCH 360/464] usb: dwc3: Track the power state of usb3_generic_phy
|
||
|
|
||
|
We will need to manage power state of this phy inisde set_mode work,
|
||
|
without any ability to perform recovery if power on fails, so we'll
|
||
|
need to track result of power on separately, to be able to balance
|
||
|
the phy on/off calls.
|
||
|
|
||
|
Signed-off-by: Ondrej Jirman <megi@xff.cz>
|
||
|
|
||
|
# Conflicts:
|
||
|
# drivers/usb/dwc3/core.c
|
||
|
---
|
||
|
drivers/usb/dwc3/core.c | 6 +++++-
|
||
|
drivers/usb/dwc3/core.h | 1 +
|
||
|
2 files changed, 6 insertions(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
|
||
|
index 9c6bf054f15d..b46ba0dfadf8 100644
|
||
|
--- a/drivers/usb/dwc3/core.c
|
||
|
+++ b/drivers/usb/dwc3/core.c
|
||
|
@@ -781,6 +781,7 @@ static int dwc3_phy_power_on(struct dwc3 *dwc)
|
||
|
if (ret < 0)
|
||
|
goto err_power_off_usb2_phy;
|
||
|
|
||
|
+ dwc->usb3_phy_powered = true;
|
||
|
return 0;
|
||
|
|
||
|
err_power_off_usb2_phy:
|
||
|
@@ -794,7 +795,10 @@ static int dwc3_phy_power_on(struct dwc3 *dwc)
|
||
|
|
||
|
static void dwc3_phy_power_off(struct dwc3 *dwc)
|
||
|
{
|
||
|
- phy_power_off(dwc->usb3_generic_phy);
|
||
|
+ if (dwc->usb3_phy_powered)
|
||
|
+ phy_power_off(dwc->usb3_generic_phy);
|
||
|
+ dwc->usb3_phy_powered = false;
|
||
|
+
|
||
|
phy_power_off(dwc->usb2_generic_phy);
|
||
|
|
||
|
usb_phy_set_suspend(dwc->usb3_phy, 1);
|
||
|
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
|
||
|
index a69ac67d89fe..e8e83024c19f 100644
|
||
|
--- a/drivers/usb/dwc3/core.h
|
||
|
+++ b/drivers/usb/dwc3/core.h
|
||
|
@@ -1164,6 +1164,7 @@ struct dwc3 {
|
||
|
|
||
|
struct phy *usb2_generic_phy;
|
||
|
struct phy *usb3_generic_phy;
|
||
|
+ bool usb3_phy_powered;
|
||
|
|
||
|
bool phys_ready;
|
||
|
|
||
|
--
|
||
|
2.34.1
|
||
|
|