* [PATCH v15 00/11] phy: rockchip: usbdp: Clean up the mess (part 2)
@ 2026-09-15 15:06 Sebastian Reichel
2026-09-15 15:06 ` [PATCH v15 01/11] phy: rockchip: usbdp: Drop DP HPD handling Sebastian Reichel
` (11 more replies)
0 siblings, 12 replies; 24+ messages in thread
From: Sebastian Reichel @ 2026-09-15 15:06 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Heiko Stuebner,
Zhang Yubing, Frank Wang
Cc: linux-phy, linux-arm-kernel, linux-rockchip, linux-kernel, kernel,
Sebastian Reichel, Igor Paunovic, Sashiko
This series is the second part of a major overhaul of the Rockchip USBDP
driver. The goal of the bigger series is:
* USB-C DP AltMode support
* Fixing sporadic SErrors happening when connector is hot-plugged
* Fixing USB3 support when connector orientation changes after
hotplug
* Fixing USBDP PHY not starting up properly initially or after a few
replugs
To fix all of these the whole set is needed. As reviewers preferred to
get this in multiple series I've split it up. Technically its exactly
the same as the previous big series. Reordering/regrouping the patches
is not possible without basically starting from scratch. This second
batch contains a bunch of smaller fixes and cleanups as well as one of
the bigger problems listed above: It fixed the sporadic SErrors on
connector replug. Unfortuantely this also seems to increase the chance
of running into the PHY startup problem, which is fixed by the last
part.
This series depends on part 1 being applied.
Changes in v15:
- Link to v14: https://patch.msgid.link/20260813-rockchip-usbdp-cleanup-v14-0-b5ad9c68fa11@collabora.com
- rebased to v7.3-rc1
- group the next 11 patches into part 2, remaining patches will be send
in separate series depending on this one
- patches from this part are unchanged compared to v14
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
Sebastian Reichel (11):
phy: rockchip: usbdp: Drop DP HPD handling
phy: rockchip: usbdp: Rename mode_change to phy_needs_reinit
phy: rockchip: usbdp: Re-init the PHY on orientation change
phy: rockchip: usbdp: Factor out lane_mux_sel setup
phy: rockchip: usbdp: Properly handle TYPEC_STATE_SAFE and TYPEC_STATE_USB
phy: rockchip: usbdp: Use guard functions for mutex
phy: rockchip: usbdp: Hold mutex in DP PHY configure
phy: rockchip: usbdp: Add some extra debug messages
phy: rockchip: usbdp: Avoid xHCI SErrors
phy: rockchip: usbdp: Handle rk_udphy_reset_deassert errors
phy: rockchip: usbdp: Only enable USB3 when not in high-speed mode
drivers/phy/rockchip/phy-rockchip-usbdp.c | 290 ++++++++++++++----------------
1 file changed, 132 insertions(+), 158 deletions(-)
---
base-commit: e5e04726cdd043e309677071ab1b65a4b18f422b
change-id: 20260914-rockchip-usbdp-cleanup-part2-07f5b1ac0a14
prerequisite-change-id: 20260203-rockchip-usbdp-cleanup-5b59dfb561a3:v15
prerequisite-patch-id: 27d601f203e30baebffc3486a1b787a2d280f5f7
prerequisite-patch-id: b42efbccabb13cd37252ea9bbc3873141bd5b8f8
prerequisite-patch-id: 8b416e19148a0b90c71778ff4fcc032b52ed49ce
prerequisite-patch-id: 04b986df824850902431339cdf43787d8036ac5c
prerequisite-patch-id: c0a6f7da1f986c76248c6271b0c04d8dab21e5cb
prerequisite-patch-id: 12bf844fd4a355c1860812522fdb16a1ff4232ea
prerequisite-patch-id: d71d6a6a232b59804f0775ba5c87d71bfdbbea61
prerequisite-patch-id: 301c705f92061ccb1a1923ec5d3bdc1fdceca24d
prerequisite-patch-id: 978560cb9620a16f57e14c424e8efa4ad7178747
prerequisite-patch-id: a6562299bf87dc57d4b14a8079d2b1e3fe407702
prerequisite-patch-id: 1b90e6acf41e9093636c3fe8791f46492b583520
prerequisite-patch-id: 60f32afe1f50ed33d48041b41e7ec8a5841d0ebd
prerequisite-patch-id: 8a9a01d462e581e6539bc9fd07b13e0f32933126
prerequisite-patch-id: fbcfbe4a42de5c488052e865bfd146260be738fb
prerequisite-patch-id: 7f3c3811dee1e11e0386ff2d8b4080f07bd68e88
prerequisite-patch-id: 831ca526a0099f3f7292f2060df9888bdf3055b4
Best regards,
--
Sebastian Reichel <sebastian.reichel@collabora.com>
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH v15 01/11] phy: rockchip: usbdp: Drop DP HPD handling
2026-09-15 15:06 [PATCH v15 00/11] phy: rockchip: usbdp: Clean up the mess (part 2) Sebastian Reichel
@ 2026-09-15 15:06 ` Sebastian Reichel
2026-09-26 5:06 ` Manivannan Sadhasivam
2026-09-15 15:06 ` [PATCH v15 02/11] phy: rockchip: usbdp: Rename mode_change to phy_needs_reinit Sebastian Reichel
` (10 subsequent siblings)
11 siblings, 1 reply; 24+ messages in thread
From: Sebastian Reichel @ 2026-09-15 15:06 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Heiko Stuebner,
Zhang Yubing, Frank Wang
Cc: linux-phy, linux-arm-kernel, linux-rockchip, linux-kernel, kernel,
Sebastian Reichel, Igor Paunovic
Drop the HPD handling logic from the USBDP PHY. The registers involved
require the display controller power domain being enabled and thus the
HPD signal should be handled by the displayport controller itself.
Apart from that the HPD handling as it is done here is incorrect and
misses hotplug events happening after the USB-C connector (e.g. when
a USB-C to HDMI adapter is involved and the HDMI cable is replugged).
Proper USB-C DP HPD support requires some restructuring of the DP
controller driver, which will happen independent of this patch. The
mainline kernel does not yet support USB-C DP AltMode on RK3588 and
RK3576, so it is fine to drop this code without adding the counterpart
in the DRM in an atomic change.
Tested-by: Igor Paunovic <royalnet026@gmail.com> # Orange Pi 5 Plus
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
drivers/phy/rockchip/phy-rockchip-usbdp.c | 85 ++++---------------------------
1 file changed, 9 insertions(+), 76 deletions(-)
diff --git a/drivers/phy/rockchip/phy-rockchip-usbdp.c b/drivers/phy/rockchip/phy-rockchip-usbdp.c
index fa8324879a97..03a276c08fa8 100644
--- a/drivers/phy/rockchip/phy-rockchip-usbdp.c
+++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c
@@ -127,7 +127,6 @@ struct rk_udphy_grf_cfg {
struct rk_udphy_vogrf_cfg {
/* vo-grf */
- struct rk_udphy_grf_reg hpd_trigger;
u32 dp_lane_reg;
};
@@ -185,14 +184,11 @@ struct rk_udphy {
u32 dp_lane_sel[4];
u32 dp_aux_dout_sel;
u32 dp_aux_din_sel;
- bool dp_sink_hpd_sel;
- bool dp_sink_hpd_cfg;
unsigned int link_rate;
unsigned int lanes;
u8 bw;
int id;
- bool dp_in_use;
int dp_lanes;
/* PHY const config */
@@ -576,19 +572,6 @@ static void rk_udphy_dp_lane_enable(struct rk_udphy *udphy, int dp_lanes)
CMN_DP_CMN_RSTN, FIELD_PREP(CMN_DP_CMN_RSTN, 0x0));
}
-static void rk_udphy_dp_hpd_event_trigger(struct rk_udphy *udphy, bool hpd)
-{
- const struct rk_udphy_cfg *cfg = udphy->cfgs;
-
- udphy->dp_sink_hpd_sel = true;
- udphy->dp_sink_hpd_cfg = hpd;
-
- if (!udphy->dp_in_use)
- return;
-
- rk_udphy_grfreg_write(udphy->vogrf, &cfg->vogrfcfg[udphy->id].hpd_trigger, hpd);
-}
-
static void rk_udphy_mode_set(struct rk_udphy *udphy, u8 mode)
{
if (udphy->mode == mode)
@@ -999,29 +982,6 @@ static void rk_udphy_power_off(struct rk_udphy *udphy, u8 mode)
rk_udphy_disable(udphy);
}
-static int rk_udphy_dp_phy_init(struct phy *phy)
-{
- struct rk_udphy *udphy = phy_get_drvdata(phy);
-
- mutex_lock(&udphy->mutex);
-
- udphy->dp_in_use = true;
-
- mutex_unlock(&udphy->mutex);
-
- return 0;
-}
-
-static int rk_udphy_dp_phy_exit(struct phy *phy)
-{
- struct rk_udphy *udphy = phy_get_drvdata(phy);
-
- mutex_lock(&udphy->mutex);
- udphy->dp_in_use = false;
- mutex_unlock(&udphy->mutex);
- return 0;
-}
-
static int rk_udphy_dp_phy_power_on(struct phy *phy)
{
struct rk_udphy *udphy = phy_get_drvdata(phy);
@@ -1253,8 +1213,6 @@ static int rk_udphy_dp_phy_configure(struct phy *phy,
}
static const struct phy_ops rk_udphy_dp_phy_ops = {
- .init = rk_udphy_dp_phy_init,
- .exit = rk_udphy_dp_phy_exit,
.power_on = rk_udphy_dp_phy_power_on,
.power_off = rk_udphy_dp_phy_power_off,
.configure = rk_udphy_dp_phy_configure,
@@ -1308,6 +1266,14 @@ static int rk_udphy_typec_mux_set(struct typec_mux_dev *mux,
struct rk_udphy *udphy = typec_mux_get_drvdata(mux);
u8 mode;
+ /*
+ * Ignore mux events not involving DP AltMode, because
+ * the mode field is being reused, e.g. state->mode == 4
+ * could be either TYPEC_MODE_USB4 or TYPEC_DP_STATE_C.
+ */
+ if (!state->alt || state->alt->svid != USB_TYPEC_DP_SID)
+ return 0;
+
mutex_lock(&udphy->mutex);
switch (state->mode) {
@@ -1339,22 +1305,7 @@ static int rk_udphy_typec_mux_set(struct typec_mux_dev *mux,
break;
}
- if (state->alt && state->alt->svid == USB_TYPEC_DP_SID) {
- struct typec_displayport_data *data = state->data;
-
- if (!data) {
- rk_udphy_dp_hpd_event_trigger(udphy, false);
- } else if (data->status & DP_STATUS_IRQ_HPD) {
- rk_udphy_dp_hpd_event_trigger(udphy, false);
- usleep_range(750, 800);
- rk_udphy_dp_hpd_event_trigger(udphy, true);
- } else if (data->status & DP_STATUS_HPD_STATE) {
- rk_udphy_mode_set(udphy, mode);
- rk_udphy_dp_hpd_event_trigger(udphy, true);
- } else {
- rk_udphy_dp_hpd_event_trigger(udphy, false);
- }
- }
+ rk_udphy_mode_set(udphy, mode);
mutex_unlock(&udphy->mutex);
return 0;
@@ -1509,20 +1460,6 @@ static int rk_udphy_probe(struct platform_device *pdev)
return 0;
}
-static int __maybe_unused rk_udphy_resume(struct device *dev)
-{
- struct rk_udphy *udphy = dev_get_drvdata(dev);
-
- if (udphy->dp_sink_hpd_sel)
- rk_udphy_dp_hpd_event_trigger(udphy, udphy->dp_sink_hpd_cfg);
-
- return 0;
-}
-
-static const struct dev_pm_ops rk_udphy_pm_ops = {
- SET_LATE_SYSTEM_SLEEP_PM_OPS(NULL, rk_udphy_resume)
-};
-
static const char * const rk_udphy_rst_list[] = {
"init", "cmn", "lane", "pcs_apb", "pma_apb"
};
@@ -1546,7 +1483,6 @@ static const struct rk_udphy_cfg rk3576_udphy_cfgs = {
},
.vogrfcfg = {
{
- .hpd_trigger = RK_UDPHY_GEN_GRF_REG(0x0000, 11, 10, 1, 3),
.dp_lane_reg = 0x0000,
},
},
@@ -1587,11 +1523,9 @@ static const struct rk_udphy_cfg rk3588_udphy_cfgs = {
},
.vogrfcfg = {
{
- .hpd_trigger = RK_UDPHY_GEN_GRF_REG(0x0000, 11, 10, 1, 3),
.dp_lane_reg = 0x0000,
},
{
- .hpd_trigger = RK_UDPHY_GEN_GRF_REG(0x0008, 11, 10, 1, 3),
.dp_lane_reg = 0x0008,
},
},
@@ -1627,7 +1561,6 @@ static struct platform_driver rk_udphy_driver = {
.driver = {
.name = "rockchip-usbdp-phy",
.of_match_table = rk_udphy_dt_match,
- .pm = &rk_udphy_pm_ops,
},
};
module_platform_driver(rk_udphy_driver);
--
2.53.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v15 02/11] phy: rockchip: usbdp: Rename mode_change to phy_needs_reinit
2026-09-15 15:06 [PATCH v15 00/11] phy: rockchip: usbdp: Clean up the mess (part 2) Sebastian Reichel
2026-09-15 15:06 ` [PATCH v15 01/11] phy: rockchip: usbdp: Drop DP HPD handling Sebastian Reichel
@ 2026-09-15 15:06 ` Sebastian Reichel
2026-09-26 5:07 ` Manivannan Sadhasivam
2026-09-15 15:06 ` [PATCH v15 03/11] phy: rockchip: usbdp: Re-init the PHY on orientation change Sebastian Reichel
` (9 subsequent siblings)
11 siblings, 1 reply; 24+ messages in thread
From: Sebastian Reichel @ 2026-09-15 15:06 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Heiko Stuebner,
Zhang Yubing, Frank Wang
Cc: linux-phy, linux-arm-kernel, linux-rockchip, linux-kernel, kernel,
Sebastian Reichel, Igor Paunovic
Right now the mode_change property is set whenever the mode changes
between USB-only, DP-only and USB-DP. It is needed, because on any
mode change the PHY needs to be re-initialized. Apparently at least
DP also requires a re-init when the cable orientation is changed,
which is currently not being done (except when the orientation switch
also involves a mode change). Prepare for this by renaming mode_change
to phy_needs_reinit.
Tested-by: Igor Paunovic <royalnet026@gmail.com> # Orange Pi 5 Plus
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
drivers/phy/rockchip/phy-rockchip-usbdp.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/phy/rockchip/phy-rockchip-usbdp.c b/drivers/phy/rockchip/phy-rockchip-usbdp.c
index 03a276c08fa8..9767fba23660 100644
--- a/drivers/phy/rockchip/phy-rockchip-usbdp.c
+++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c
@@ -170,7 +170,7 @@ struct rk_udphy {
/* PHY status management */
bool flip;
- bool mode_change;
+ bool phy_needs_reinit;
u8 mode;
u8 status;
@@ -577,7 +577,7 @@ static void rk_udphy_mode_set(struct rk_udphy *udphy, u8 mode)
if (udphy->mode == mode)
return;
- udphy->mode_change = true;
+ udphy->phy_needs_reinit = true;
udphy->mode = mode;
}
@@ -950,15 +950,15 @@ static int rk_udphy_power_on(struct rk_udphy *udphy, u8 mode)
if (udphy->mode & UDPHY_MODE_USB)
rk_udphy_u3_port_disable(udphy, false);
- udphy->mode_change = false;
- } else if (udphy->mode_change) {
+ udphy->phy_needs_reinit = false;
+ } else if (udphy->phy_needs_reinit) {
if (udphy->mode == UDPHY_MODE_DP)
rk_udphy_u3_port_disable(udphy, true);
ret = rk_udphy_init(udphy);
if (ret)
return ret;
- udphy->mode_change = false;
+ udphy->phy_needs_reinit = false;
}
udphy->status |= mode;
--
2.53.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v15 03/11] phy: rockchip: usbdp: Re-init the PHY on orientation change
2026-09-15 15:06 [PATCH v15 00/11] phy: rockchip: usbdp: Clean up the mess (part 2) Sebastian Reichel
2026-09-15 15:06 ` [PATCH v15 01/11] phy: rockchip: usbdp: Drop DP HPD handling Sebastian Reichel
2026-09-15 15:06 ` [PATCH v15 02/11] phy: rockchip: usbdp: Rename mode_change to phy_needs_reinit Sebastian Reichel
@ 2026-09-15 15:06 ` Sebastian Reichel
2026-09-26 5:08 ` Manivannan Sadhasivam
2026-09-15 15:06 ` [PATCH v15 04/11] phy: rockchip: usbdp: Factor out lane_mux_sel setup Sebastian Reichel
` (8 subsequent siblings)
11 siblings, 1 reply; 24+ messages in thread
From: Sebastian Reichel @ 2026-09-15 15:06 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Heiko Stuebner,
Zhang Yubing, Frank Wang
Cc: linux-phy, linux-arm-kernel, linux-rockchip, linux-kernel, kernel,
Sebastian Reichel, Igor Paunovic
Changing the cable orientation reconfigures the lane muxing, which
requires re-initializing the PHY. Without this DP functionality
breaks, if the cable is re-plugged with swapped orientation.
Tested-by: Igor Paunovic <royalnet026@gmail.com> # Orange Pi 5 Plus
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
drivers/phy/rockchip/phy-rockchip-usbdp.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/phy/rockchip/phy-rockchip-usbdp.c b/drivers/phy/rockchip/phy-rockchip-usbdp.c
index 9767fba23660..9a4ead585151 100644
--- a/drivers/phy/rockchip/phy-rockchip-usbdp.c
+++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c
@@ -619,6 +619,7 @@ static int rk_udphy_orien_sw_set(struct typec_switch_dev *sw,
enum typec_orientation orien)
{
struct rk_udphy *udphy = typec_switch_get_drvdata(sw);
+ bool flipped = orien == TYPEC_ORIENTATION_REVERSE;
mutex_lock(&udphy->mutex);
@@ -630,7 +631,10 @@ static int rk_udphy_orien_sw_set(struct typec_switch_dev *sw,
goto unlock_ret;
}
- udphy->flip = orien == TYPEC_ORIENTATION_REVERSE;
+ if (udphy->flip != flipped)
+ udphy->phy_needs_reinit = true;
+
+ udphy->flip = flipped;
rk_udphy_set_typec_default_mapping(udphy);
rk_udphy_usb_bvalid_enable(udphy, true);
--
2.53.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v15 04/11] phy: rockchip: usbdp: Factor out lane_mux_sel setup
2026-09-15 15:06 [PATCH v15 00/11] phy: rockchip: usbdp: Clean up the mess (part 2) Sebastian Reichel
` (2 preceding siblings ...)
2026-09-15 15:06 ` [PATCH v15 03/11] phy: rockchip: usbdp: Re-init the PHY on orientation change Sebastian Reichel
@ 2026-09-15 15:06 ` Sebastian Reichel
2026-09-26 5:10 ` Manivannan Sadhasivam
2026-09-15 15:06 ` [PATCH v15 05/11] phy: rockchip: usbdp: Properly handle TYPEC_STATE_SAFE and TYPEC_STATE_USB Sebastian Reichel
` (7 subsequent siblings)
11 siblings, 1 reply; 24+ messages in thread
From: Sebastian Reichel @ 2026-09-15 15:06 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Heiko Stuebner,
Zhang Yubing, Frank Wang
Cc: linux-phy, linux-arm-kernel, linux-rockchip, linux-kernel, kernel,
Sebastian Reichel, Igor Paunovic
Avoid describing the USB+DP lane_mux_sel logic twice by introducing
a helper function to reduce code duplication.
Tested-by: Igor Paunovic <royalnet026@gmail.com> # Orange Pi 5 Plus
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
drivers/phy/rockchip/phy-rockchip-usbdp.c | 81 +++++++++++++++----------------
1 file changed, 40 insertions(+), 41 deletions(-)
diff --git a/drivers/phy/rockchip/phy-rockchip-usbdp.c b/drivers/phy/rockchip/phy-rockchip-usbdp.c
index 9a4ead585151..4a073301067f 100644
--- a/drivers/phy/rockchip/phy-rockchip-usbdp.c
+++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c
@@ -581,6 +581,42 @@ static void rk_udphy_mode_set(struct rk_udphy *udphy, u8 mode)
udphy->mode = mode;
}
+static void rk_udphy_set_typec_state(struct rk_udphy *udphy, unsigned long state)
+{
+ u8 mode;
+
+ switch (state) {
+ case TYPEC_DP_STATE_C:
+ case TYPEC_DP_STATE_E:
+ udphy->lane_mux_sel[0] = PHY_LANE_MUX_DP;
+ udphy->lane_mux_sel[1] = PHY_LANE_MUX_DP;
+ udphy->lane_mux_sel[2] = PHY_LANE_MUX_DP;
+ udphy->lane_mux_sel[3] = PHY_LANE_MUX_DP;
+ mode = UDPHY_MODE_DP;
+ udphy->dp_lanes = 4;
+ break;
+
+ case TYPEC_DP_STATE_D:
+ default:
+ if (udphy->flip) {
+ udphy->lane_mux_sel[0] = PHY_LANE_MUX_DP;
+ udphy->lane_mux_sel[1] = PHY_LANE_MUX_DP;
+ udphy->lane_mux_sel[2] = PHY_LANE_MUX_USB;
+ udphy->lane_mux_sel[3] = PHY_LANE_MUX_USB;
+ } else {
+ udphy->lane_mux_sel[0] = PHY_LANE_MUX_USB;
+ udphy->lane_mux_sel[1] = PHY_LANE_MUX_USB;
+ udphy->lane_mux_sel[2] = PHY_LANE_MUX_DP;
+ udphy->lane_mux_sel[3] = PHY_LANE_MUX_DP;
+ }
+ mode = UDPHY_MODE_DP_USB;
+ udphy->dp_lanes = 2;
+ break;
+ }
+
+ rk_udphy_mode_set(udphy, mode);
+}
+
static void rk_udphy_set_typec_default_mapping(struct rk_udphy *udphy)
{
if (udphy->flip) {
@@ -588,10 +624,6 @@ static void rk_udphy_set_typec_default_mapping(struct rk_udphy *udphy)
udphy->dp_lane_sel[1] = 1;
udphy->dp_lane_sel[2] = 3;
udphy->dp_lane_sel[3] = 2;
- udphy->lane_mux_sel[0] = PHY_LANE_MUX_DP;
- udphy->lane_mux_sel[1] = PHY_LANE_MUX_DP;
- udphy->lane_mux_sel[2] = PHY_LANE_MUX_USB;
- udphy->lane_mux_sel[3] = PHY_LANE_MUX_USB;
udphy->dp_aux_dout_sel = PHY_AUX_DP_DATA_POL_INVERT;
udphy->dp_aux_din_sel = PHY_AUX_DP_DATA_POL_INVERT;
gpiod_set_value_cansleep(udphy->sbu1_dc_gpio, 1);
@@ -601,18 +633,14 @@ static void rk_udphy_set_typec_default_mapping(struct rk_udphy *udphy)
udphy->dp_lane_sel[1] = 3;
udphy->dp_lane_sel[2] = 1;
udphy->dp_lane_sel[3] = 0;
- udphy->lane_mux_sel[0] = PHY_LANE_MUX_USB;
- udphy->lane_mux_sel[1] = PHY_LANE_MUX_USB;
- udphy->lane_mux_sel[2] = PHY_LANE_MUX_DP;
- udphy->lane_mux_sel[3] = PHY_LANE_MUX_DP;
udphy->dp_aux_dout_sel = PHY_AUX_DP_DATA_POL_NORMAL;
udphy->dp_aux_din_sel = PHY_AUX_DP_DATA_POL_NORMAL;
gpiod_set_value_cansleep(udphy->sbu1_dc_gpio, 0);
gpiod_set_value_cansleep(udphy->sbu2_dc_gpio, 1);
}
- rk_udphy_mode_set(udphy, UDPHY_MODE_DP_USB);
- udphy->dp_lanes = 2;
+ /* default to USB3 + DP as 4 lane USB is not supported */
+ rk_udphy_set_typec_state(udphy, TYPEC_DP_STATE_D);
}
static int rk_udphy_orien_sw_set(struct typec_switch_dev *sw,
@@ -1268,7 +1296,6 @@ static int rk_udphy_typec_mux_set(struct typec_mux_dev *mux,
struct typec_mux_state *state)
{
struct rk_udphy *udphy = typec_mux_get_drvdata(mux);
- u8 mode;
/*
* Ignore mux events not involving DP AltMode, because
@@ -1280,38 +1307,10 @@ static int rk_udphy_typec_mux_set(struct typec_mux_dev *mux,
mutex_lock(&udphy->mutex);
- switch (state->mode) {
- case TYPEC_DP_STATE_C:
- case TYPEC_DP_STATE_E:
- udphy->lane_mux_sel[0] = PHY_LANE_MUX_DP;
- udphy->lane_mux_sel[1] = PHY_LANE_MUX_DP;
- udphy->lane_mux_sel[2] = PHY_LANE_MUX_DP;
- udphy->lane_mux_sel[3] = PHY_LANE_MUX_DP;
- mode = UDPHY_MODE_DP;
- udphy->dp_lanes = 4;
- break;
-
- case TYPEC_DP_STATE_D:
- default:
- if (udphy->flip) {
- udphy->lane_mux_sel[0] = PHY_LANE_MUX_DP;
- udphy->lane_mux_sel[1] = PHY_LANE_MUX_DP;
- udphy->lane_mux_sel[2] = PHY_LANE_MUX_USB;
- udphy->lane_mux_sel[3] = PHY_LANE_MUX_USB;
- } else {
- udphy->lane_mux_sel[0] = PHY_LANE_MUX_USB;
- udphy->lane_mux_sel[1] = PHY_LANE_MUX_USB;
- udphy->lane_mux_sel[2] = PHY_LANE_MUX_DP;
- udphy->lane_mux_sel[3] = PHY_LANE_MUX_DP;
- }
- mode = UDPHY_MODE_DP_USB;
- udphy->dp_lanes = 2;
- break;
- }
-
- rk_udphy_mode_set(udphy, mode);
+ rk_udphy_set_typec_state(udphy, state->mode);
mutex_unlock(&udphy->mutex);
+
return 0;
}
--
2.53.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v15 05/11] phy: rockchip: usbdp: Properly handle TYPEC_STATE_SAFE and TYPEC_STATE_USB
2026-09-15 15:06 [PATCH v15 00/11] phy: rockchip: usbdp: Clean up the mess (part 2) Sebastian Reichel
` (3 preceding siblings ...)
2026-09-15 15:06 ` [PATCH v15 04/11] phy: rockchip: usbdp: Factor out lane_mux_sel setup Sebastian Reichel
@ 2026-09-15 15:06 ` Sebastian Reichel
2026-09-26 5:11 ` Manivannan Sadhasivam
2026-09-15 15:06 ` [PATCH v15 06/11] phy: rockchip: usbdp: Use guard functions for mutex Sebastian Reichel
` (6 subsequent siblings)
11 siblings, 1 reply; 24+ messages in thread
From: Sebastian Reichel @ 2026-09-15 15:06 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Heiko Stuebner,
Zhang Yubing, Frank Wang
Cc: linux-phy, linux-arm-kernel, linux-rockchip, linux-kernel, kernel,
Sebastian Reichel, Sashiko, Igor Paunovic
Handle TYPEC_STATE_SAFE and TYPEC_STATE_USB Type-C state events,
so that the muxing is properly updated when exiting DP AltMode.
Fixes: 2f70bbddeb45 ("phy: rockchip: add usbdp combo phy driver")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/message/20260619155020.CC7361F000E9%40smtp.kernel.org
Tested-by: Igor Paunovic <royalnet026@gmail.com> # Orange Pi 5 Plus
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
drivers/phy/rockchip/phy-rockchip-usbdp.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/drivers/phy/rockchip/phy-rockchip-usbdp.c b/drivers/phy/rockchip/phy-rockchip-usbdp.c
index 4a073301067f..9ba571f7b9bf 100644
--- a/drivers/phy/rockchip/phy-rockchip-usbdp.c
+++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c
@@ -1292,17 +1292,26 @@ static const struct phy_ops rk_udphy_usb3_phy_ops = {
.owner = THIS_MODULE,
};
+static bool rk_udphy_is_supported_mode(struct typec_mux_state *state)
+{
+ /* Handle Safe State and USB State */
+ if (state->mode < TYPEC_STATE_MODAL)
+ return true;
+
+ /* Handle DP AltMode */
+ if (state->alt && state->alt->svid == USB_TYPEC_DP_SID)
+ return true;
+
+ return false;
+}
+
static int rk_udphy_typec_mux_set(struct typec_mux_dev *mux,
struct typec_mux_state *state)
{
struct rk_udphy *udphy = typec_mux_get_drvdata(mux);
- /*
- * Ignore mux events not involving DP AltMode, because
- * the mode field is being reused, e.g. state->mode == 4
- * could be either TYPEC_MODE_USB4 or TYPEC_DP_STATE_C.
- */
- if (!state->alt || state->alt->svid != USB_TYPEC_DP_SID)
+ /* Ignore mux events not involving USB or DP */
+ if (!rk_udphy_is_supported_mode(state))
return 0;
mutex_lock(&udphy->mutex);
--
2.53.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v15 06/11] phy: rockchip: usbdp: Use guard functions for mutex
2026-09-15 15:06 [PATCH v15 00/11] phy: rockchip: usbdp: Clean up the mess (part 2) Sebastian Reichel
` (4 preceding siblings ...)
2026-09-15 15:06 ` [PATCH v15 05/11] phy: rockchip: usbdp: Properly handle TYPEC_STATE_SAFE and TYPEC_STATE_USB Sebastian Reichel
@ 2026-09-15 15:06 ` Sebastian Reichel
2026-09-26 5:13 ` Manivannan Sadhasivam
2026-09-15 15:06 ` [PATCH v15 07/11] phy: rockchip: usbdp: Hold mutex in DP PHY configure Sebastian Reichel
` (5 subsequent siblings)
11 siblings, 1 reply; 24+ messages in thread
From: Sebastian Reichel @ 2026-09-15 15:06 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Heiko Stuebner,
Zhang Yubing, Frank Wang
Cc: linux-phy, linux-arm-kernel, linux-rockchip, linux-kernel, kernel,
Sebastian Reichel, Igor Paunovic
Convert the driver to use guard functions for mutex handling as
a small cleanup. There is a small functional change in the DP PHY
power up function, which no longer sleeps if the internal powerup
code returns an error. This is not a problem as the sleep is only
relevant for successful power-up.
Tested-by: Igor Paunovic <royalnet026@gmail.com> # Orange Pi 5 Plus
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
drivers/phy/rockchip/phy-rockchip-usbdp.c | 54 +++++++++++++------------------
1 file changed, 23 insertions(+), 31 deletions(-)
diff --git a/drivers/phy/rockchip/phy-rockchip-usbdp.c b/drivers/phy/rockchip/phy-rockchip-usbdp.c
index 9ba571f7b9bf..9864024b9c0a 100644
--- a/drivers/phy/rockchip/phy-rockchip-usbdp.c
+++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c
@@ -10,6 +10,7 @@
#include <dt-bindings/phy/phy.h>
#include <linux/bitfield.h>
#include <linux/bits.h>
+#include <linux/cleanup.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
@@ -649,14 +650,15 @@ static int rk_udphy_orien_sw_set(struct typec_switch_dev *sw,
struct rk_udphy *udphy = typec_switch_get_drvdata(sw);
bool flipped = orien == TYPEC_ORIENTATION_REVERSE;
- mutex_lock(&udphy->mutex);
+ guard(mutex)(&udphy->mutex);
if (orien == TYPEC_ORIENTATION_NONE) {
gpiod_set_value_cansleep(udphy->sbu1_dc_gpio, 0);
gpiod_set_value_cansleep(udphy->sbu2_dc_gpio, 0);
/* unattached */
rk_udphy_usb_bvalid_enable(udphy, false);
- goto unlock_ret;
+
+ return 0;
}
if (udphy->flip != flipped)
@@ -666,8 +668,6 @@ static int rk_udphy_orien_sw_set(struct typec_switch_dev *sw,
rk_udphy_set_typec_default_mapping(udphy);
rk_udphy_usb_bvalid_enable(udphy, true);
-unlock_ret:
- mutex_unlock(&udphy->mutex);
return 0;
}
@@ -1019,26 +1019,25 @@ static int rk_udphy_dp_phy_power_on(struct phy *phy)
struct rk_udphy *udphy = phy_get_drvdata(phy);
int ret;
- mutex_lock(&udphy->mutex);
+ scoped_guard(mutex, &udphy->mutex) {
+ phy_set_bus_width(phy, udphy->dp_lanes);
- phy_set_bus_width(phy, udphy->dp_lanes);
-
- ret = rk_udphy_power_on(udphy, UDPHY_MODE_DP);
- if (ret)
- goto unlock;
+ ret = rk_udphy_power_on(udphy, UDPHY_MODE_DP);
+ if (ret)
+ return ret;
- rk_udphy_dp_lane_enable(udphy, udphy->dp_lanes);
+ rk_udphy_dp_lane_enable(udphy, udphy->dp_lanes);
- rk_udphy_dp_lane_select(udphy);
+ rk_udphy_dp_lane_select(udphy);
+ }
-unlock:
- mutex_unlock(&udphy->mutex);
/*
* If data send by aux channel too fast after phy power on,
* the aux may be not ready which will cause aux error. Adding
* delay to avoid this issue.
*/
usleep_range(10000, 11000);
+
return ret;
}
@@ -1046,10 +1045,10 @@ static int rk_udphy_dp_phy_power_off(struct phy *phy)
{
struct rk_udphy *udphy = phy_get_drvdata(phy);
- mutex_lock(&udphy->mutex);
+ guard(mutex)(&udphy->mutex);
+
rk_udphy_dp_lane_enable(udphy, 0);
rk_udphy_power_off(udphy, UDPHY_MODE_DP);
- mutex_unlock(&udphy->mutex);
return 0;
}
@@ -1254,35 +1253,30 @@ static const struct phy_ops rk_udphy_dp_phy_ops = {
static int rk_udphy_usb3_phy_init(struct phy *phy)
{
struct rk_udphy *udphy = phy_get_drvdata(phy);
- int ret = 0;
- mutex_lock(&udphy->mutex);
+ guard(mutex)(&udphy->mutex);
+
/* DP only or high-speed, disable U3 port */
if (!(udphy->mode & UDPHY_MODE_USB) || udphy->hs) {
rk_udphy_u3_port_disable(udphy, true);
- goto unlock;
+ return 0;
}
- ret = rk_udphy_power_on(udphy, UDPHY_MODE_USB);
-
-unlock:
- mutex_unlock(&udphy->mutex);
- return ret;
+ return rk_udphy_power_on(udphy, UDPHY_MODE_USB);
}
static int rk_udphy_usb3_phy_exit(struct phy *phy)
{
struct rk_udphy *udphy = phy_get_drvdata(phy);
- mutex_lock(&udphy->mutex);
+ guard(mutex)(&udphy->mutex);
+
/* DP only or high-speed */
if (!(udphy->mode & UDPHY_MODE_USB) || udphy->hs)
- goto unlock;
+ return 0;
rk_udphy_power_off(udphy, UDPHY_MODE_USB);
-unlock:
- mutex_unlock(&udphy->mutex);
return 0;
}
@@ -1314,12 +1308,10 @@ static int rk_udphy_typec_mux_set(struct typec_mux_dev *mux,
if (!rk_udphy_is_supported_mode(state))
return 0;
- mutex_lock(&udphy->mutex);
+ guard(mutex)(&udphy->mutex);
rk_udphy_set_typec_state(udphy, state->mode);
- mutex_unlock(&udphy->mutex);
-
return 0;
}
--
2.53.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v15 07/11] phy: rockchip: usbdp: Hold mutex in DP PHY configure
2026-09-15 15:06 [PATCH v15 00/11] phy: rockchip: usbdp: Clean up the mess (part 2) Sebastian Reichel
` (5 preceding siblings ...)
2026-09-15 15:06 ` [PATCH v15 06/11] phy: rockchip: usbdp: Use guard functions for mutex Sebastian Reichel
@ 2026-09-15 15:06 ` Sebastian Reichel
2026-09-26 5:16 ` Manivannan Sadhasivam
2026-09-15 15:06 ` [PATCH v15 08/11] phy: rockchip: usbdp: Add some extra debug messages Sebastian Reichel
` (4 subsequent siblings)
11 siblings, 1 reply; 24+ messages in thread
From: Sebastian Reichel @ 2026-09-15 15:06 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Heiko Stuebner,
Zhang Yubing, Frank Wang
Cc: linux-phy, linux-arm-kernel, linux-rockchip, linux-kernel, kernel,
Sebastian Reichel, Sashiko, Igor Paunovic
rk_udphy_dp_phy_configure() accesses some variables from the struct
rk_udphy, which are updated independently from the USB-C framework.
The USB-C mux/orientation switch functions already hold a mutex to
ensure mutual exclusive access to the struct rk_udphy states, so
simply hold the same one in the DP PHY configuration function.
Reproducing problems due to this on real hardware would be really hard,
but could be possible when quickly re-connecting the USB-C connector.
Fixes: 2f70bbddeb45 ("phy: rockchip: add usbdp combo phy driver")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/linux-phy/20260612164627.23D391F000E9@smtp.kernel.org/
Tested-by: Igor Paunovic <royalnet026@gmail.com> # Orange Pi 5 Plus
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
drivers/phy/rockchip/phy-rockchip-usbdp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/phy/rockchip/phy-rockchip-usbdp.c b/drivers/phy/rockchip/phy-rockchip-usbdp.c
index 9864024b9c0a..2888a0a97088 100644
--- a/drivers/phy/rockchip/phy-rockchip-usbdp.c
+++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c
@@ -1153,6 +1153,8 @@ static int rk_udphy_dp_phy_configure(struct phy *phy,
u32 i, val, lane;
int ret;
+ guard(mutex)(&udphy->mutex);
+
if (dp->set_rate) {
ret = rk_udphy_dp_phy_verify_link_rate(udphy, dp);
if (ret)
--
2.53.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v15 08/11] phy: rockchip: usbdp: Add some extra debug messages
2026-09-15 15:06 [PATCH v15 00/11] phy: rockchip: usbdp: Clean up the mess (part 2) Sebastian Reichel
` (6 preceding siblings ...)
2026-09-15 15:06 ` [PATCH v15 07/11] phy: rockchip: usbdp: Hold mutex in DP PHY configure Sebastian Reichel
@ 2026-09-15 15:06 ` Sebastian Reichel
2026-09-26 5:16 ` Manivannan Sadhasivam
2026-09-15 15:06 ` [PATCH v15 09/11] phy: rockchip: usbdp: Avoid xHCI SErrors Sebastian Reichel
` (3 subsequent siblings)
11 siblings, 1 reply; 24+ messages in thread
From: Sebastian Reichel @ 2026-09-15 15:06 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Heiko Stuebner,
Zhang Yubing, Frank Wang
Cc: linux-phy, linux-arm-kernel, linux-rockchip, linux-kernel, kernel,
Sebastian Reichel, Igor Paunovic
It's useful to log PHY reinit to ease debugging issues around
USB-C hotplugging.
Tested-by: Igor Paunovic <royalnet026@gmail.com> # Orange Pi 5 Plus
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
drivers/phy/rockchip/phy-rockchip-usbdp.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/drivers/phy/rockchip/phy-rockchip-usbdp.c b/drivers/phy/rockchip/phy-rockchip-usbdp.c
index 2888a0a97088..23cfb9bbd334 100644
--- a/drivers/phy/rockchip/phy-rockchip-usbdp.c
+++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c
@@ -23,6 +23,7 @@
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/reset.h>
+#include <linux/string_choices.h>
#include <linux/usb/ch9.h>
#include <linux/usb/typec_dp.h>
#include <linux/usb/typec_mux.h>
@@ -461,6 +462,8 @@ static int rk_udphy_reset_deassert(struct rk_udphy *udphy, char *name)
return reset_control_deassert(list[idx].rstc);
}
+ dev_err(udphy->dev, "failed to de-assert missing reset line: %s\n", name);
+
return -EINVAL;
}
@@ -487,6 +490,8 @@ static void rk_udphy_u3_port_disable(struct rk_udphy *udphy, u8 disable)
const struct rk_udphy_cfg *cfg = udphy->cfgs;
const struct rk_udphy_grf_reg *preg;
+ dev_dbg(udphy->dev, "USB3 port %s\n", str_on_off(!disable));
+
preg = udphy->id ? &cfg->grfcfg.usb3otg1_cfg : &cfg->grfcfg.usb3otg0_cfg;
rk_udphy_grfreg_write(udphy->usbgrf, preg, disable);
}
@@ -661,8 +666,10 @@ static int rk_udphy_orien_sw_set(struct typec_switch_dev *sw,
return 0;
}
- if (udphy->flip != flipped)
+ if (udphy->flip != flipped) {
+ dev_dbg(udphy->dev, "cable orientation changed, PHY re-init required.\n");
udphy->phy_needs_reinit = true;
+ }
udphy->flip = flipped;
rk_udphy_set_typec_default_mapping(udphy);
@@ -780,6 +787,11 @@ static int rk_udphy_init(struct rk_udphy *udphy)
const struct rk_udphy_cfg *cfg = udphy->cfgs;
int ret;
+ dev_dbg(udphy->dev, "reinit PHY with USB3=%s and DP=%s (%u lanes) flipped=%s\n",
+ str_on_off(udphy->mode & UDPHY_MODE_USB),
+ str_on_off(udphy->mode & UDPHY_MODE_DP),
+ udphy->dp_lanes, str_yes_no(udphy->flip));
+
rk_udphy_reset_assert_all(udphy);
usleep_range(10000, 11000);
@@ -850,6 +862,8 @@ static int rk_udphy_setup(struct rk_udphy *udphy)
{
int ret;
+ dev_dbg(udphy->dev, "enable PHY\n");
+
ret = clk_bulk_prepare_enable(udphy->num_clks, udphy->clks);
if (ret) {
dev_err(udphy->dev, "failed to enable clk\n");
@@ -868,6 +882,7 @@ static int rk_udphy_setup(struct rk_udphy *udphy)
static void rk_udphy_disable(struct rk_udphy *udphy)
{
+ dev_dbg(udphy->dev, "disable PHY\n");
clk_bulk_disable_unprepare(udphy->num_clks, udphy->clks);
rk_udphy_reset_assert_all(udphy);
}
@@ -1307,8 +1322,12 @@ static int rk_udphy_typec_mux_set(struct typec_mux_dev *mux,
struct rk_udphy *udphy = typec_mux_get_drvdata(mux);
/* Ignore mux events not involving USB or DP */
- if (!rk_udphy_is_supported_mode(state))
+ if (!rk_udphy_is_supported_mode(state)) {
+ dev_dbg(udphy->dev, "ignore mux event with mode=%lu\n", state->mode);
return 0;
+ }
+
+ dev_dbg(udphy->dev, "new mode: %lu\n", state->mode);
guard(mutex)(&udphy->mutex);
--
2.53.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v15 09/11] phy: rockchip: usbdp: Avoid xHCI SErrors
2026-09-15 15:06 [PATCH v15 00/11] phy: rockchip: usbdp: Clean up the mess (part 2) Sebastian Reichel
` (7 preceding siblings ...)
2026-09-15 15:06 ` [PATCH v15 08/11] phy: rockchip: usbdp: Add some extra debug messages Sebastian Reichel
@ 2026-09-15 15:06 ` Sebastian Reichel
2026-09-26 5:22 ` Manivannan Sadhasivam
2026-09-15 15:06 ` [PATCH v15 10/11] phy: rockchip: usbdp: Handle rk_udphy_reset_deassert errors Sebastian Reichel
` (2 subsequent siblings)
11 siblings, 1 reply; 24+ messages in thread
From: Sebastian Reichel @ 2026-09-15 15:06 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Heiko Stuebner,
Zhang Yubing, Frank Wang
Cc: linux-phy, linux-arm-kernel, linux-rockchip, linux-kernel, kernel,
Sebastian Reichel, Igor Paunovic
The USBDP PHY provides the PIPE clock to the USB3 controller, which
means the PHY must be fully running when anything tries to access
the xHCI registers.
When switching between USB3-only, USB3 + DP and DP-only mode, the
PHY must be re-initialized resulting in a short period of the PHY
being disabled. If the DWC3 driver decides to access the xHCI at
this point the system will fail with an SError.
This patch avoids the problems by disabling the USB3 port before
re-initializing it. This does a couple of things:
- forces phystatus to 0 from GRF (not from PHY)
- switches PIPE clock source from PHY to UTMI (safe fallback clock)
- num_u3_port=0
The last part will be ignored, as DWC3 already probed, but the
clock re-routing will avoid the SError. There is a small delay
afterwards to make sure the mux happened. The datasheet gives
no hints how long it takes, so delay time is a guess.
Fixes: 2f70bbddeb45 ("phy: rockchip: add usbdp combo phy driver")
Tested-by: Igor Paunovic <royalnet026@gmail.com> # Orange Pi 5 Plus
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
drivers/phy/rockchip/phy-rockchip-usbdp.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/phy/rockchip/phy-rockchip-usbdp.c b/drivers/phy/rockchip/phy-rockchip-usbdp.c
index 23cfb9bbd334..4116b4b18882 100644
--- a/drivers/phy/rockchip/phy-rockchip-usbdp.c
+++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c
@@ -999,12 +999,15 @@ static int rk_udphy_power_on(struct rk_udphy *udphy, u8 mode)
rk_udphy_u3_port_disable(udphy, false);
udphy->phy_needs_reinit = false;
} else if (udphy->phy_needs_reinit) {
- if (udphy->mode == UDPHY_MODE_DP)
- rk_udphy_u3_port_disable(udphy, true);
+ rk_udphy_u3_port_disable(udphy, true);
+ udelay(10);
ret = rk_udphy_init(udphy);
if (ret)
return ret;
+
+ if (!udphy->hs && udphy->mode & UDPHY_MODE_USB)
+ rk_udphy_u3_port_disable(udphy, false);
udphy->phy_needs_reinit = false;
}
--
2.53.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v15 10/11] phy: rockchip: usbdp: Handle rk_udphy_reset_deassert errors
2026-09-15 15:06 [PATCH v15 00/11] phy: rockchip: usbdp: Clean up the mess (part 2) Sebastian Reichel
` (8 preceding siblings ...)
2026-09-15 15:06 ` [PATCH v15 09/11] phy: rockchip: usbdp: Avoid xHCI SErrors Sebastian Reichel
@ 2026-09-15 15:06 ` Sebastian Reichel
2026-09-26 5:23 ` Manivannan Sadhasivam
2026-09-15 15:06 ` [PATCH v15 11/11] phy: rockchip: usbdp: Only enable USB3 when not in high-speed mode Sebastian Reichel
2026-10-03 9:36 ` [PATCH v15 00/11] phy: rockchip: usbdp: Clean up the mess (part 2) Vinod Koul
11 siblings, 1 reply; 24+ messages in thread
From: Sebastian Reichel @ 2026-09-15 15:06 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Heiko Stuebner,
Zhang Yubing, Frank Wang
Cc: linux-phy, linux-arm-kernel, linux-rockchip, linux-kernel, kernel,
Sebastian Reichel, Sashiko, Igor Paunovic
Handle rk_udphy_reset_deassert returning errors to avoid theoretical
(Rockchip reset controller driver does not return errors) SError.
Fixes: 2f70bbddeb45 ("phy: rockchip: add usbdp combo phy driver")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/message/20260626211151.2332F1F000E9%40smtp.kernel.org
Tested-by: Igor Paunovic <royalnet026@gmail.com> # Orange Pi 5 Plus
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
drivers/phy/rockchip/phy-rockchip-usbdp.c | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/drivers/phy/rockchip/phy-rockchip-usbdp.c b/drivers/phy/rockchip/phy-rockchip-usbdp.c
index 4116b4b18882..9eb8e40f6afb 100644
--- a/drivers/phy/rockchip/phy-rockchip-usbdp.c
+++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c
@@ -802,8 +802,12 @@ static int rk_udphy_init(struct rk_udphy *udphy)
/* Step 1: power on pma and deassert apb rstn */
rk_udphy_grfreg_write(udphy->udphygrf, &cfg->grfcfg.low_pwrn, true);
- rk_udphy_reset_deassert(udphy, "pma_apb");
- rk_udphy_reset_deassert(udphy, "pcs_apb");
+ ret = rk_udphy_reset_deassert(udphy, "pma_apb");
+ if (ret)
+ goto assert_resets;
+ ret = rk_udphy_reset_deassert(udphy, "pcs_apb");
+ if (ret)
+ goto assert_resets;
/* Step 2: set init sequence and phy refclk */
ret = regmap_multi_reg_write(udphy->pma_regmap, rk_udphy_init_sequence,
@@ -829,8 +833,11 @@ static int rk_udphy_init(struct rk_udphy *udphy)
FIELD_PREP(CMN_DP_LANE_EN_ALL, 0));
/* Step 4: deassert init rstn and wait for 200ns from datasheet */
- if (udphy->mode & UDPHY_MODE_USB)
- rk_udphy_reset_deassert(udphy, "init");
+ if (udphy->mode & UDPHY_MODE_USB) {
+ ret = rk_udphy_reset_deassert(udphy, "init");
+ if (ret)
+ goto assert_resets;
+ }
if (udphy->mode & UDPHY_MODE_DP) {
regmap_update_bits(udphy->pma_regmap, CMN_DP_RSTN_OFFSET,
@@ -842,8 +849,14 @@ static int rk_udphy_init(struct rk_udphy *udphy)
/* Step 5: deassert cmn/lane rstn */
if (udphy->mode & UDPHY_MODE_USB) {
- rk_udphy_reset_deassert(udphy, "cmn");
- rk_udphy_reset_deassert(udphy, "lane");
+ ret = rk_udphy_reset_deassert(udphy, "cmn");
+ if (ret)
+ goto assert_resets;
+
+ ret = rk_udphy_reset_deassert(udphy, "lane");
+ if (ret)
+ goto assert_resets;
+
}
/* Step 6: wait for lock done of pll */
--
2.53.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v15 11/11] phy: rockchip: usbdp: Only enable USB3 when not in high-speed mode
2026-09-15 15:06 [PATCH v15 00/11] phy: rockchip: usbdp: Clean up the mess (part 2) Sebastian Reichel
` (9 preceding siblings ...)
2026-09-15 15:06 ` [PATCH v15 10/11] phy: rockchip: usbdp: Handle rk_udphy_reset_deassert errors Sebastian Reichel
@ 2026-09-15 15:06 ` Sebastian Reichel
2026-09-26 5:25 ` Manivannan Sadhasivam
2026-10-03 9:36 ` [PATCH v15 00/11] phy: rockchip: usbdp: Clean up the mess (part 2) Vinod Koul
11 siblings, 1 reply; 24+ messages in thread
From: Sebastian Reichel @ 2026-09-15 15:06 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Heiko Stuebner,
Zhang Yubing, Frank Wang
Cc: linux-phy, linux-arm-kernel, linux-rockchip, linux-kernel, kernel,
Sebastian Reichel, Sashiko, Igor Paunovic
Ensure that USB3 mode is not accidently enabled during PHY re-init
for systems that are configured as high-speed only via DT.
Fixes: 2f70bbddeb45 ("phy: rockchip: add usbdp combo phy driver")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/message/20260626212424.C215E1F000E9%40smtp.kernel.org
Tested-by: Igor Paunovic <royalnet026@gmail.com> # Orange Pi 5 Plus
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
drivers/phy/rockchip/phy-rockchip-usbdp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/phy/rockchip/phy-rockchip-usbdp.c b/drivers/phy/rockchip/phy-rockchip-usbdp.c
index 9eb8e40f6afb..e748acdd2d31 100644
--- a/drivers/phy/rockchip/phy-rockchip-usbdp.c
+++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c
@@ -1008,7 +1008,7 @@ static int rk_udphy_power_on(struct rk_udphy *udphy, u8 mode)
if (ret)
return ret;
- if (udphy->mode & UDPHY_MODE_USB)
+ if (!udphy->hs && udphy->mode & UDPHY_MODE_USB)
rk_udphy_u3_port_disable(udphy, false);
udphy->phy_needs_reinit = false;
} else if (udphy->phy_needs_reinit) {
--
2.53.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH v15 01/11] phy: rockchip: usbdp: Drop DP HPD handling
2026-09-15 15:06 ` [PATCH v15 01/11] phy: rockchip: usbdp: Drop DP HPD handling Sebastian Reichel
@ 2026-09-26 5:06 ` Manivannan Sadhasivam
0 siblings, 0 replies; 24+ messages in thread
From: Manivannan Sadhasivam @ 2026-09-26 5:06 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Vinod Koul, Neil Armstrong, Heiko Stuebner, Zhang Yubing,
Frank Wang, linux-phy, linux-arm-kernel, linux-rockchip,
linux-kernel, kernel, Igor Paunovic
On Tue, Sep 15, 2026 at 05:06:04PM +0200, Sebastian Reichel wrote:
> Drop the HPD handling logic from the USBDP PHY. The registers involved
> require the display controller power domain being enabled and thus the
> HPD signal should be handled by the displayport controller itself.
> Apart from that the HPD handling as it is done here is incorrect and
> misses hotplug events happening after the USB-C connector (e.g. when
> a USB-C to HDMI adapter is involved and the HDMI cable is replugged).
>
> Proper USB-C DP HPD support requires some restructuring of the DP
> controller driver, which will happen independent of this patch. The
> mainline kernel does not yet support USB-C DP AltMode on RK3588 and
> RK3576, so it is fine to drop this code without adding the counterpart
> in the DRM in an atomic change.
>
> Tested-by: Igor Paunovic <royalnet026@gmail.com> # Orange Pi 5 Plus
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
- Mani
--
மணிவண்ணன் சதாசிவம்
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v15 02/11] phy: rockchip: usbdp: Rename mode_change to phy_needs_reinit
2026-09-15 15:06 ` [PATCH v15 02/11] phy: rockchip: usbdp: Rename mode_change to phy_needs_reinit Sebastian Reichel
@ 2026-09-26 5:07 ` Manivannan Sadhasivam
0 siblings, 0 replies; 24+ messages in thread
From: Manivannan Sadhasivam @ 2026-09-26 5:07 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Vinod Koul, Neil Armstrong, Heiko Stuebner, Zhang Yubing,
Frank Wang, linux-phy, linux-arm-kernel, linux-rockchip,
linux-kernel, kernel, Igor Paunovic
On Tue, Sep 15, 2026 at 05:06:05PM +0200, Sebastian Reichel wrote:
> Right now the mode_change property is set whenever the mode changes
> between USB-only, DP-only and USB-DP. It is needed, because on any
> mode change the PHY needs to be re-initialized. Apparently at least
> DP also requires a re-init when the cable orientation is changed,
> which is currently not being done (except when the orientation switch
> also involves a mode change). Prepare for this by renaming mode_change
> to phy_needs_reinit.
>
> Tested-by: Igor Paunovic <royalnet026@gmail.com> # Orange Pi 5 Plus
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
- Mani
--
மணிவண்ணன் சதாசிவம்
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v15 03/11] phy: rockchip: usbdp: Re-init the PHY on orientation change
2026-09-15 15:06 ` [PATCH v15 03/11] phy: rockchip: usbdp: Re-init the PHY on orientation change Sebastian Reichel
@ 2026-09-26 5:08 ` Manivannan Sadhasivam
0 siblings, 0 replies; 24+ messages in thread
From: Manivannan Sadhasivam @ 2026-09-26 5:08 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Vinod Koul, Neil Armstrong, Heiko Stuebner, Zhang Yubing,
Frank Wang, linux-phy, linux-arm-kernel, linux-rockchip,
linux-kernel, kernel, Igor Paunovic
On Tue, Sep 15, 2026 at 05:06:06PM +0200, Sebastian Reichel wrote:
> Changing the cable orientation reconfigures the lane muxing, which
> requires re-initializing the PHY. Without this DP functionality
> breaks, if the cable is re-plugged with swapped orientation.
>
> Tested-by: Igor Paunovic <royalnet026@gmail.com> # Orange Pi 5 Plus
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
- Mani
--
மணிவண்ணன் சதாசிவம்
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v15 04/11] phy: rockchip: usbdp: Factor out lane_mux_sel setup
2026-09-15 15:06 ` [PATCH v15 04/11] phy: rockchip: usbdp: Factor out lane_mux_sel setup Sebastian Reichel
@ 2026-09-26 5:10 ` Manivannan Sadhasivam
0 siblings, 0 replies; 24+ messages in thread
From: Manivannan Sadhasivam @ 2026-09-26 5:10 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Vinod Koul, Neil Armstrong, Heiko Stuebner, Zhang Yubing,
Frank Wang, linux-phy, linux-arm-kernel, linux-rockchip,
linux-kernel, kernel, Igor Paunovic
On Tue, Sep 15, 2026 at 05:06:07PM +0200, Sebastian Reichel wrote:
> Avoid describing the USB+DP lane_mux_sel logic twice by introducing
> a helper function to reduce code duplication.
>
> Tested-by: Igor Paunovic <royalnet026@gmail.com> # Orange Pi 5 Plus
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
- Mani
--
மணிவண்ணன் சதாசிவம்
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v15 05/11] phy: rockchip: usbdp: Properly handle TYPEC_STATE_SAFE and TYPEC_STATE_USB
2026-09-15 15:06 ` [PATCH v15 05/11] phy: rockchip: usbdp: Properly handle TYPEC_STATE_SAFE and TYPEC_STATE_USB Sebastian Reichel
@ 2026-09-26 5:11 ` Manivannan Sadhasivam
0 siblings, 0 replies; 24+ messages in thread
From: Manivannan Sadhasivam @ 2026-09-26 5:11 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Vinod Koul, Neil Armstrong, Heiko Stuebner, Zhang Yubing,
Frank Wang, linux-phy, linux-arm-kernel, linux-rockchip,
linux-kernel, kernel, Sashiko, Igor Paunovic
On Tue, Sep 15, 2026 at 05:06:08PM +0200, Sebastian Reichel wrote:
> Handle TYPEC_STATE_SAFE and TYPEC_STATE_USB Type-C state events,
> so that the muxing is properly updated when exiting DP AltMode.
>
> Fixes: 2f70bbddeb45 ("phy: rockchip: add usbdp combo phy driver")
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Closes: https://sashiko.dev/#/message/20260619155020.CC7361F000E9%40smtp.kernel.org
> Tested-by: Igor Paunovic <royalnet026@gmail.com> # Orange Pi 5 Plus
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
- Mani
--
மணிவண்ணன் சதாசிவம்
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v15 06/11] phy: rockchip: usbdp: Use guard functions for mutex
2026-09-15 15:06 ` [PATCH v15 06/11] phy: rockchip: usbdp: Use guard functions for mutex Sebastian Reichel
@ 2026-09-26 5:13 ` Manivannan Sadhasivam
0 siblings, 0 replies; 24+ messages in thread
From: Manivannan Sadhasivam @ 2026-09-26 5:13 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Vinod Koul, Neil Armstrong, Heiko Stuebner, Zhang Yubing,
Frank Wang, linux-phy, linux-arm-kernel, linux-rockchip,
linux-kernel, kernel, Igor Paunovic
On Tue, Sep 15, 2026 at 05:06:09PM +0200, Sebastian Reichel wrote:
> Convert the driver to use guard functions for mutex handling as
> a small cleanup. There is a small functional change in the DP PHY
> power up function, which no longer sleeps if the internal powerup
> code returns an error. This is not a problem as the sleep is only
> relevant for successful power-up.
>
> Tested-by: Igor Paunovic <royalnet026@gmail.com> # Orange Pi 5 Plus
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
- Mani
--
மணிவண்ணன் சதாசிவம்
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v15 07/11] phy: rockchip: usbdp: Hold mutex in DP PHY configure
2026-09-15 15:06 ` [PATCH v15 07/11] phy: rockchip: usbdp: Hold mutex in DP PHY configure Sebastian Reichel
@ 2026-09-26 5:16 ` Manivannan Sadhasivam
0 siblings, 0 replies; 24+ messages in thread
From: Manivannan Sadhasivam @ 2026-09-26 5:16 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Vinod Koul, Neil Armstrong, Heiko Stuebner, Zhang Yubing,
Frank Wang, linux-phy, linux-arm-kernel, linux-rockchip,
linux-kernel, kernel, Sashiko, Igor Paunovic
On Tue, Sep 15, 2026 at 05:06:10PM +0200, Sebastian Reichel wrote:
> rk_udphy_dp_phy_configure() accesses some variables from the struct
> rk_udphy, which are updated independently from the USB-C framework.
>
> The USB-C mux/orientation switch functions already hold a mutex to
> ensure mutual exclusive access to the struct rk_udphy states, so
> simply hold the same one in the DP PHY configuration function.
>
> Reproducing problems due to this on real hardware would be really hard,
> but could be possible when quickly re-connecting the USB-C connector.
>
> Fixes: 2f70bbddeb45 ("phy: rockchip: add usbdp combo phy driver")
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Closes: https://lore.kernel.org/linux-phy/20260612164627.23D391F000E9@smtp.kernel.org/
> Tested-by: Igor Paunovic <royalnet026@gmail.com> # Orange Pi 5 Plus
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
- Mani
--
மணிவண்ணன் சதாசிவம்
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v15 08/11] phy: rockchip: usbdp: Add some extra debug messages
2026-09-15 15:06 ` [PATCH v15 08/11] phy: rockchip: usbdp: Add some extra debug messages Sebastian Reichel
@ 2026-09-26 5:16 ` Manivannan Sadhasivam
0 siblings, 0 replies; 24+ messages in thread
From: Manivannan Sadhasivam @ 2026-09-26 5:16 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Vinod Koul, Neil Armstrong, Heiko Stuebner, Zhang Yubing,
Frank Wang, linux-phy, linux-arm-kernel, linux-rockchip,
linux-kernel, kernel, Igor Paunovic
On Tue, Sep 15, 2026 at 05:06:11PM +0200, Sebastian Reichel wrote:
> It's useful to log PHY reinit to ease debugging issues around
> USB-C hotplugging.
>
> Tested-by: Igor Paunovic <royalnet026@gmail.com> # Orange Pi 5 Plus
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
- Mani
--
மணிவண்ணன் சதாசிவம்
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v15 09/11] phy: rockchip: usbdp: Avoid xHCI SErrors
2026-09-15 15:06 ` [PATCH v15 09/11] phy: rockchip: usbdp: Avoid xHCI SErrors Sebastian Reichel
@ 2026-09-26 5:22 ` Manivannan Sadhasivam
0 siblings, 0 replies; 24+ messages in thread
From: Manivannan Sadhasivam @ 2026-09-26 5:22 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Vinod Koul, Neil Armstrong, Heiko Stuebner, Zhang Yubing,
Frank Wang, linux-phy, linux-arm-kernel, linux-rockchip,
linux-kernel, kernel, Igor Paunovic
On Tue, Sep 15, 2026 at 05:06:12PM +0200, Sebastian Reichel wrote:
> The USBDP PHY provides the PIPE clock to the USB3 controller, which
> means the PHY must be fully running when anything tries to access
> the xHCI registers.
>
> When switching between USB3-only, USB3 + DP and DP-only mode, the
> PHY must be re-initialized resulting in a short period of the PHY
> being disabled. If the DWC3 driver decides to access the xHCI at
> this point the system will fail with an SError.
>
> This patch avoids the problems by disabling the USB3 port before
> re-initializing it. This does a couple of things:
>
> - forces phystatus to 0 from GRF (not from PHY)
> - switches PIPE clock source from PHY to UTMI (safe fallback clock)
> - num_u3_port=0
>
> The last part will be ignored, as DWC3 already probed, but the
> clock re-routing will avoid the SError. There is a small delay
> afterwards to make sure the mux happened. The datasheet gives
> no hints how long it takes, so delay time is a guess.
>
> Fixes: 2f70bbddeb45 ("phy: rockchip: add usbdp combo phy driver")
> Tested-by: Igor Paunovic <royalnet026@gmail.com> # Orange Pi 5 Plus
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
- Mani
--
மணிவண்ணன் சதாசிவம்
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v15 10/11] phy: rockchip: usbdp: Handle rk_udphy_reset_deassert errors
2026-09-15 15:06 ` [PATCH v15 10/11] phy: rockchip: usbdp: Handle rk_udphy_reset_deassert errors Sebastian Reichel
@ 2026-09-26 5:23 ` Manivannan Sadhasivam
0 siblings, 0 replies; 24+ messages in thread
From: Manivannan Sadhasivam @ 2026-09-26 5:23 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Vinod Koul, Neil Armstrong, Heiko Stuebner, Zhang Yubing,
Frank Wang, linux-phy, linux-arm-kernel, linux-rockchip,
linux-kernel, kernel, Sashiko, Igor Paunovic
On Tue, Sep 15, 2026 at 05:06:13PM +0200, Sebastian Reichel wrote:
> Handle rk_udphy_reset_deassert returning errors to avoid theoretical
> (Rockchip reset controller driver does not return errors) SError.
>
> Fixes: 2f70bbddeb45 ("phy: rockchip: add usbdp combo phy driver")
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Closes: https://sashiko.dev/#/message/20260626211151.2332F1F000E9%40smtp.kernel.org
> Tested-by: Igor Paunovic <royalnet026@gmail.com> # Orange Pi 5 Plus
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
- Mani
--
மணிவண்ணன் சதாசிவம்
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v15 11/11] phy: rockchip: usbdp: Only enable USB3 when not in high-speed mode
2026-09-15 15:06 ` [PATCH v15 11/11] phy: rockchip: usbdp: Only enable USB3 when not in high-speed mode Sebastian Reichel
@ 2026-09-26 5:25 ` Manivannan Sadhasivam
0 siblings, 0 replies; 24+ messages in thread
From: Manivannan Sadhasivam @ 2026-09-26 5:25 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Vinod Koul, Neil Armstrong, Heiko Stuebner, Zhang Yubing,
Frank Wang, linux-phy, linux-arm-kernel, linux-rockchip,
linux-kernel, kernel, Sashiko, Igor Paunovic
On Tue, Sep 15, 2026 at 05:06:14PM +0200, Sebastian Reichel wrote:
> Ensure that USB3 mode is not accidently enabled during PHY re-init
> for systems that are configured as high-speed only via DT.
>
> Fixes: 2f70bbddeb45 ("phy: rockchip: add usbdp combo phy driver")
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Closes: https://sashiko.dev/#/message/20260626212424.C215E1F000E9%40smtp.kernel.org
> Tested-by: Igor Paunovic <royalnet026@gmail.com> # Orange Pi 5 Plus
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
- Mani
--
மணிவண்ணன் சதாசிவம்
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v15 00/11] phy: rockchip: usbdp: Clean up the mess (part 2)
2026-09-15 15:06 [PATCH v15 00/11] phy: rockchip: usbdp: Clean up the mess (part 2) Sebastian Reichel
` (10 preceding siblings ...)
2026-09-15 15:06 ` [PATCH v15 11/11] phy: rockchip: usbdp: Only enable USB3 when not in high-speed mode Sebastian Reichel
@ 2026-10-03 9:36 ` Vinod Koul
11 siblings, 0 replies; 24+ messages in thread
From: Vinod Koul @ 2026-10-03 9:36 UTC (permalink / raw)
To: Neil Armstrong, Manivannan Sadhasivam, Heiko Stuebner,
Zhang Yubing, Frank Wang, Sebastian Reichel
Cc: linux-phy, linux-arm-kernel, linux-rockchip, linux-kernel, kernel,
Igor Paunovic, Sashiko
On Tue, 15 Sep 2026 17:06:03 +0200, Sebastian Reichel wrote:
> This series is the second part of a major overhaul of the Rockchip USBDP
> driver. The goal of the bigger series is:
>
> * USB-C DP AltMode support
> * Fixing sporadic SErrors happening when connector is hot-plugged
> * Fixing USB3 support when connector orientation changes after
> hotplug
> * Fixing USBDP PHY not starting up properly initially or after a few
> replugs
>
> [...]
Applied, thanks!
[01/11] phy: rockchip: usbdp: Drop DP HPD handling
commit: 4fd2c13cbb11f5483a43cc789cb8de1c3bd23238
[02/11] phy: rockchip: usbdp: Rename mode_change to phy_needs_reinit
commit: fbce9cc28cadb24026a6c061819d42e50d3bfea0
[03/11] phy: rockchip: usbdp: Re-init the PHY on orientation change
commit: 4d8349799c4be92750c0d73c9dfac09003233146
[04/11] phy: rockchip: usbdp: Factor out lane_mux_sel setup
commit: cc492941f8e3523648fb1393e3e61a7602a0260d
[05/11] phy: rockchip: usbdp: Properly handle TYPEC_STATE_SAFE and TYPEC_STATE_USB
commit: b1ca8de219ae6e4d9eec22acfbe4357d8addd94c
[06/11] phy: rockchip: usbdp: Use guard functions for mutex
commit: f8e38359fde88381c3a7b1134dfd3a406a0e611d
[07/11] phy: rockchip: usbdp: Hold mutex in DP PHY configure
commit: 619233ce6b2329529c9f0ff9682d6e22d160ebd6
[08/11] phy: rockchip: usbdp: Add some extra debug messages
commit: 89eb5e8aec232ff494a0261f7fada6390bb3f1be
[09/11] phy: rockchip: usbdp: Avoid xHCI SErrors
commit: cf3aa34e6f0798544c26ad93a6c3c2231ab09738
[10/11] phy: rockchip: usbdp: Handle rk_udphy_reset_deassert errors
commit: 35101e2f49c04bf1cfc69b8a0d3f85c742369ccc
[11/11] phy: rockchip: usbdp: Only enable USB3 when not in high-speed mode
commit: fbbf6c85b08008bf68ef49931175edeaa36ba82f
Best regards,
--
~Vinod
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2026-10-03 9:36 UTC | newest]
Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-15 15:06 [PATCH v15 00/11] phy: rockchip: usbdp: Clean up the mess (part 2) Sebastian Reichel
2026-09-15 15:06 ` [PATCH v15 01/11] phy: rockchip: usbdp: Drop DP HPD handling Sebastian Reichel
2026-09-26 5:06 ` Manivannan Sadhasivam
2026-09-15 15:06 ` [PATCH v15 02/11] phy: rockchip: usbdp: Rename mode_change to phy_needs_reinit Sebastian Reichel
2026-09-26 5:07 ` Manivannan Sadhasivam
2026-09-15 15:06 ` [PATCH v15 03/11] phy: rockchip: usbdp: Re-init the PHY on orientation change Sebastian Reichel
2026-09-26 5:08 ` Manivannan Sadhasivam
2026-09-15 15:06 ` [PATCH v15 04/11] phy: rockchip: usbdp: Factor out lane_mux_sel setup Sebastian Reichel
2026-09-26 5:10 ` Manivannan Sadhasivam
2026-09-15 15:06 ` [PATCH v15 05/11] phy: rockchip: usbdp: Properly handle TYPEC_STATE_SAFE and TYPEC_STATE_USB Sebastian Reichel
2026-09-26 5:11 ` Manivannan Sadhasivam
2026-09-15 15:06 ` [PATCH v15 06/11] phy: rockchip: usbdp: Use guard functions for mutex Sebastian Reichel
2026-09-26 5:13 ` Manivannan Sadhasivam
2026-09-15 15:06 ` [PATCH v15 07/11] phy: rockchip: usbdp: Hold mutex in DP PHY configure Sebastian Reichel
2026-09-26 5:16 ` Manivannan Sadhasivam
2026-09-15 15:06 ` [PATCH v15 08/11] phy: rockchip: usbdp: Add some extra debug messages Sebastian Reichel
2026-09-26 5:16 ` Manivannan Sadhasivam
2026-09-15 15:06 ` [PATCH v15 09/11] phy: rockchip: usbdp: Avoid xHCI SErrors Sebastian Reichel
2026-09-26 5:22 ` Manivannan Sadhasivam
2026-09-15 15:06 ` [PATCH v15 10/11] phy: rockchip: usbdp: Handle rk_udphy_reset_deassert errors Sebastian Reichel
2026-09-26 5:23 ` Manivannan Sadhasivam
2026-09-15 15:06 ` [PATCH v15 11/11] phy: rockchip: usbdp: Only enable USB3 when not in high-speed mode Sebastian Reichel
2026-09-26 5:25 ` Manivannan Sadhasivam
2026-10-03 9:36 ` [PATCH v15 00/11] phy: rockchip: usbdp: Clean up the mess (part 2) Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox