Devicetree
 help / color / mirror / Atom feed
* [PATCH 0/2] phy: mediatek: xsphy: add eUSB2 repeater support for USB2 ports
@ 2026-08-26 12:38 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 ` [PATCH 2/2] phy: mediatek: xsphy: add optional repeater support for USB2 ports Julien Massot
  0 siblings, 2 replies; 5+ 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

Some USB2 PHY ports are connected to an external eUSB2 repeater chip
that sits between the PHY and the USB connector. To support such
configurations, this series adds an optional phys property to the
MediaTek xsphy port sub-node and integrates the repeater into the USB2
PHY init, exit and mode handling.

The binding follows the same pattern as the Synopsys eUSB2 PHY, which
already uses a phys property at the sub-node level to reference an
external repeater. The driver change similarly manages the repeater PHY
alongside the MediaTek USB2 PHY.

Signed-off-by: Julien Massot <julien.massot@collabora.com>
---
Julien Massot (2):
      dt-bindings: phy: mediatek,xsphy: add optional repeater phys property
      phy: mediatek: xsphy: add optional repeater support for USB2 ports

 .../devicetree/bindings/phy/mediatek,xsphy.yaml    |  5 +++++
 drivers/phy/mediatek/phy-mtk-xsphy.c               | 26 ++++++++++++++++++++--
 2 files changed, 29 insertions(+), 2 deletions(-)
---
base-commit: 917df6be58562d024374b4076e6e7618876a0c4a
change-id: 20260826-mtk-usb2-repeater-usb2-7d5bad6afce8

Best regards,
-- 
Julien Massot <julien.massot@collabora.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [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; 5+ 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] 5+ 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
  2026-08-26 12:49   ` sashiko-bot
  1 sibling, 1 reply; 5+ 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] 5+ messages in thread

* Re: [PATCH 2/2] phy: mediatek: xsphy: add optional repeater support for USB2 ports
  2026-08-26 12:38 ` [PATCH 2/2] phy: mediatek: xsphy: add optional repeater support for USB2 ports Julien Massot
@ 2026-08-26 12:49   ` sashiko-bot
  0 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-08-26 12:49 UTC (permalink / raw)
  To: Julien Massot
  Cc: conor+dt, neil.armstrong, olteanv, robh, devicetree, linux-phy,
	vkoul

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Missing PHY operation delegation for `.power_on` and `.power_off`.
--

commit 8dbeea901dbdb1f9b33b21bd4a5f16b9ad7a5a78
Author: Julien Massot <julien.massot@collabora.com>

    phy: mediatek: xsphy: add optional repeater support for USB2 ports
    
    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.

> diff --git a/drivers/phy/mediatek/phy-mtk-xsphy.c b/drivers/phy/mediatek/phy-mtk-xsphy.c
> index cc1d66954212a..7bc3d6794d7b9 100644
> --- a/drivers/phy/mediatek/phy-mtk-xsphy.c
> +++ b/drivers/phy/mediatek/phy-mtk-xsphy.c

[ ... ]

> @@ -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;
>  }

[Severity: Medium]
If an external repeater PHY relies on the PHY framework's phy_power_on()
(e.g., to enable core-managed regulators, resume runtime PM, or invoke its
own .power_on callback), will it silently remain unpowered and inactive
because mtk_phy_power_on() does not call phy_power_on(inst->repeater)?

For example, mtk_phy_power_on() currently only powers the internal instance:

static int mtk_phy_power_on(struct phy *phy)
{
	...
	if (inst->type == PHY_TYPE_USB2) {
		u2_phy_instance_power_on(xsphy, inst);
		u2_phy_slew_rate_calibrate(xsphy, inst);
	}
	...
}

Similarly, could the missing call to phy_power_off(inst->repeater) in
mtk_phy_power_off() cause imbalanced power tracking or resource leaks in
the repeater PHY?

static int mtk_phy_power_off(struct phy *phy)
{
	...
	if (inst->type == PHY_TYPE_USB2)
		u2_phy_instance_power_off(xsphy, inst);
	...
}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260826-mtk-usb2-repeater-usb2-v1-0-e8e48e2fd6d8@collabora.com?part=2

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] dt-bindings: phy: mediatek,xsphy: add optional repeater phys property
  2026-08-26 12:38 ` [PATCH 1/2] dt-bindings: phy: mediatek,xsphy: add optional repeater phys property Julien Massot
@ 2026-08-26 16:02   ` Conor Dooley
  0 siblings, 0 replies; 5+ messages in thread
From: Conor Dooley @ 2026-08-26 16:02 UTC (permalink / raw)
  To: Julien Massot
  Cc: kernel, Chunfeng Yun, Vinod Koul, Neil Armstrong, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
	AngeloGioacchino Del Regno, linux-arm-kernel, linux-mediatek,
	linux-phy, devicetree, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 75 bytes --]

Acked-by: Conor Dooley <conor.dooley@microchip.com>
pw-bot: not-applicable

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-08-26 16:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 16:02   ` Conor Dooley
2026-08-26 12:38 ` [PATCH 2/2] phy: mediatek: xsphy: add optional repeater support for USB2 ports Julien Massot
2026-08-26 12:49   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox