mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
The old method carried along with board-pbp-add-dp-alt-mode.patch only makes typec work in one(normal) orientation. This patch introduces a proper extcon driver and makes the workaround cleaner, so orientation switch is working. Improvements: - type-c DP on rk3399 works with both orientations - type-c USB 3.0 on rk3399 works with both orientations, with minor issues, see below Caveats: - Powered USB-C hubs may be not recognized, and can be worked around by loading a gadget driver, or manually toggling the mode once for each connection. - Some dual-role devices(phone, tablet) may be not recognized. Affected boards: - TinkerBoard 2/2S - Pinebook Pro - NanoPC T4 - Orange Pi 4 - Orange Pi 4 LTS Tested on tinkerboard 2s. This patch contains other minor fixes for tinker2's device tree, including adding a missing fan node, adding color labels to leds. The 2 patches adding dp support for nanopc t4 and pinebook pro are also updated accordingly. The device trees of Orange Pi 4 / 4 LTS are also updated to match the new implementation.
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
|
|
@@ -931,6 +931,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:
|
|
@@ -951,8 +952,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
|
|
@@ -1224,6 +1224,8 @@ struct dwc3 {
|
|
u8 num_usb2_ports;
|
|
u8 num_usb3_ports;
|
|
|
|
+ bool usb3_phy_powered;
|
|
+
|
|
bool phys_ready;
|
|
|
|
struct ulpi *ulpi;
|
|
--
|
|
Armbian
|
|
|