mirror of https://github.com/armbian/build.git
58 lines
1.6 KiB
Diff
58 lines
1.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Ondrej Jirman <megi@xff.cz>
|
|
Date: Sun, 30 Apr 2023 18:54:51 +0200
|
|
Subject: 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>
|
|
---
|
|
drivers/usb/dwc3/core.c | 7 +++++--
|
|
drivers/usb/dwc3/core.h | 2 ++
|
|
2 files changed, 7 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
|
|
index 111111111111..222222222222 100644
|
|
--- a/drivers/usb/dwc3/core.c
|
|
+++ b/drivers/usb/dwc3/core.c
|
|
@@ -933,6 +933,7 @@ static int dwc3_phy_power_on(struct dwc3 *dwc)
|
|
goto err_power_off_usb3_phy;
|
|
}
|
|
|
|
+ dwc->usb3_phy_powered = true;
|
|
return 0;
|
|
|
|
err_power_off_usb3_phy:
|
|
@@ -953,8 +954,10 @@ static void dwc3_phy_power_off(struct dwc3 *dwc)
|
|
{
|
|
int i;
|
|
|
|
- for (i = 0; i < dwc->num_usb3_ports; i++)
|
|
- phy_power_off(dwc->usb3_generic_phy[i]);
|
|
+ if (dwc->usb3_phy_powered)
|
|
+ for (i = 0; i < dwc->num_usb3_ports; i++)
|
|
+ phy_power_off(dwc->usb3_generic_phy[i]);
|
|
+ dwc->usb3_phy_powered = false;
|
|
|
|
for (i = 0; i < dwc->num_usb2_ports; i++)
|
|
phy_power_off(dwc->usb2_generic_phy[i]);
|
|
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
|
|
index 111111111111..222222222222 100644
|
|
--- a/drivers/usb/dwc3/core.h
|
|
+++ b/drivers/usb/dwc3/core.h
|
|
@@ -1238,6 +1238,8 @@ struct dwc3 {
|
|
u8 num_usb2_ports;
|
|
u8 num_usb3_ports;
|
|
|
|
+ bool usb3_phy_powered;
|
|
+
|
|
bool phys_ready;
|
|
|
|
struct ulpi *ulpi;
|
|
--
|
|
Armbian
|
|
|