* [PATCH 1/2] dt-bindings: phy: mediatek,xsphy: add optional repeater phys property
2026-08-26 12:38 [PATCH 0/2] phy: mediatek: xsphy: add eUSB2 repeater support for USB2 ports Julien Massot
@ 2026-08-26 12:38 ` Julien Massot
2026-08-26 16:02 ` Conor Dooley
2026-08-26 12:38 ` [PATCH 2/2] phy: mediatek: xsphy: add optional repeater support for USB2 ports Julien Massot
1 sibling, 1 reply; 4+ messages in thread
From: Julien Massot @ 2026-08-26 12:38 UTC (permalink / raw)
To: kernel, Chunfeng Yun, Vinod Koul, Neil Armstrong, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: linux-arm-kernel, linux-mediatek, linux-phy, devicetree,
linux-kernel, Julien Massot
USB2 PHY ports may be connected to an external eUSB2 repeater chip.
Add an optional phys property to the port sub-node to allow referencing
it, following the same pattern used by the Synopsys eUSB2 PHY binding.
Signed-off-by: Julien Massot <julien.massot@collabora.com>
---
Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml b/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml
index edeb32a97978..e779e21a725b 100644
--- a/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml
+++ b/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml
@@ -109,6 +109,11 @@ patternProperties:
- PHY_TYPE_USB2
- PHY_TYPE_USB3
+ phys:
+ description:
+ eUSB2 repeater PHY connected between this port and the USB connector.
+ maxItems: 1
+
# The following optional vendor properties are only for debug or HQA test
mediatek,eye-src:
description:
--
2.55.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] phy: mediatek: xsphy: add optional repeater support for USB2 ports
2026-08-26 12:38 [PATCH 0/2] phy: mediatek: xsphy: add eUSB2 repeater support for USB2 ports Julien Massot
2026-08-26 12:38 ` [PATCH 1/2] dt-bindings: phy: mediatek,xsphy: add optional repeater phys property Julien Massot
@ 2026-08-26 12:38 ` Julien Massot
1 sibling, 0 replies; 4+ messages in thread
From: Julien Massot @ 2026-08-26 12:38 UTC (permalink / raw)
To: kernel, Chunfeng Yun, Vinod Koul, Neil Armstrong, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: linux-arm-kernel, linux-mediatek, linux-phy, devicetree,
linux-kernel, Julien Massot
USB2 PHY port sub-nodes may carry an optional phys property referencing
an external eUSB2 repeater.
Fetch the repeater during probe using devm_of_phy_optional_get(),
initialize and exit it alongside the USB2 PHY, and propagate USB mode
changes to it.
This follows the same pattern used by the Synopsys eUSB2 PHY driver.
Signed-off-by: Julien Massot <julien.massot@collabora.com>
---
drivers/phy/mediatek/phy-mtk-xsphy.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/drivers/phy/mediatek/phy-mtk-xsphy.c b/drivers/phy/mediatek/phy-mtk-xsphy.c
index cc1d66954212..7bc3d6794d7b 100644
--- a/drivers/phy/mediatek/phy-mtk-xsphy.c
+++ b/drivers/phy/mediatek/phy-mtk-xsphy.c
@@ -94,6 +94,7 @@ struct xsphy_instance {
struct phy *phy;
void __iomem *port_base;
struct clk *ref_clk; /* reference clock of anolog phy */
+ struct phy *repeater;
u32 index;
u32 type;
struct regmap *type_sw;
@@ -391,6 +392,11 @@ static int mtk_phy_init(struct phy *phy)
switch (inst->type) {
case PHY_TYPE_USB2:
+ ret = phy_init(inst->repeater);
+ if (ret) {
+ clk_disable_unprepare(inst->ref_clk);
+ return ret;
+ }
u2_phy_instance_init(xsphy, inst);
u2_phy_props_set(xsphy, inst);
break;
@@ -438,7 +444,11 @@ static int mtk_phy_exit(struct phy *phy)
{
struct xsphy_instance *inst = phy_get_drvdata(phy);
+ if (inst->type == PHY_TYPE_USB2)
+ phy_exit(inst->repeater);
+
clk_disable_unprepare(inst->ref_clk);
+
return 0;
}
@@ -446,9 +456,16 @@ static int mtk_phy_set_mode(struct phy *phy, enum phy_mode mode, int submode)
{
struct xsphy_instance *inst = phy_get_drvdata(phy);
struct mtk_xsphy *xsphy = dev_get_drvdata(phy->dev.parent);
+ int ret;
- if (inst->type == PHY_TYPE_USB2)
- u2_phy_instance_set_mode(xsphy, inst, mode);
+ if (inst->type != PHY_TYPE_USB2)
+ return 0;
+
+ ret = phy_set_mode_ext(inst->repeater, mode, submode);
+ if (ret)
+ return ret;
+
+ u2_phy_instance_set_mode(xsphy, inst, mode);
return 0;
}
@@ -590,6 +607,11 @@ static int mtk_xsphy_probe(struct platform_device *pdev)
retval = phy_type_syscon_get(inst, child_np);
if (retval)
return retval;
+
+ inst->repeater = devm_of_phy_optional_get(dev, child_np, NULL);
+ if (IS_ERR(inst->repeater))
+ return dev_err_probe(dev, PTR_ERR(inst->repeater),
+ "failed to get repeater\n");
}
provider = devm_of_phy_provider_register(dev, mtk_phy_xlate);
--
2.55.0
^ permalink raw reply related [flat|nested] 4+ messages in thread