102 lines
3.2 KiB
Diff
102 lines
3.2 KiB
Diff
From git@z Thu Jan 1 00:00:00 1970
|
|
Subject: [PATCH v13 24/35] phy: rockchip: usbdp: Add some extra debug
|
|
messages
|
|
From: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
Date: Tue, 14 Jul 2026 21:26:25 +0200
|
|
Message-Id: <20260714-rockchip-usbdp-cleanup-v13-24-6cb3e769d4c5@collabora.com>
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset="utf-8"
|
|
Content-Transfer-Encoding: 7bit
|
|
|
|
It's useful to log PHY reinit to ease debugging issues around
|
|
USB-C hotplugging.
|
|
|
|
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
---
|
|
drivers/phy/rockchip/phy-rockchip-usbdp.c | 23 +++++++++++++++++++++--
|
|
1 file changed, 21 insertions(+), 2 deletions(-)
|
|
|
|
--- a/drivers/phy/rockchip/phy-rockchip-usbdp.c
|
|
+++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c
|
|
@@ -24,6 +24,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>
|
|
@@ -462,6 +463,8 @@ static int rk_udphy_reset_deassert(struc
|
|
return reset_control_deassert(list[idx].rstc);
|
|
}
|
|
|
|
+ dev_err(udphy->dev, "failed to de-assert missing reset line: %s\n", name);
|
|
+
|
|
return -EINVAL;
|
|
}
|
|
|
|
@@ -488,6 +491,8 @@ static void rk_udphy_u3_port_disable(str
|
|
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);
|
|
}
|
|
@@ -662,8 +667,10 @@ static int rk_udphy_orien_sw_set(struct
|
|
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);
|
|
@@ -781,6 +788,11 @@ static int rk_udphy_init(struct rk_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);
|
|
|
|
@@ -851,6 +863,8 @@ static int rk_udphy_setup(struct rk_udph
|
|
{
|
|
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");
|
|
@@ -869,6 +883,7 @@ static int rk_udphy_setup(struct rk_udph
|
|
|
|
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);
|
|
}
|
|
@@ -1308,8 +1323,12 @@ static int rk_udphy_typec_mux_set(struct
|
|
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);
|
|
|