Skip to contentSkip to conversation

clk: en7523: Add support for selecting SCU serdes

PATCH Applied Christian Marangi 5 participants 10 messages Sep 15 – Oct 10

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover clk: en7523: Add support for selecting SCU serdes

This small series is a split from the Airoha AN7581 USB PHY series [1].

[1] https://lore.kernel.org/all/[email protected]/

Changes v2:
- Rebase on top of linux-next
- Add review tag for Documentation patch

Changes v10 (from previous series):
- Rework if condition and reject #phy-cells for
econet,en751221-scu compatible.

Christian Marangi (2):
dt-bindings: clock: airoha: Add PHY binding for Serdes port
clk: en7523: Add support for selecting the Serdes port in SCU

 .../bindings/clock/airoha,en7523-scu.yaml     |  24 +-
 drivers/clk/Kconfig                           |   1 +
 drivers/clk/clk-en7523.c                      | 218 +++++++++++++++++-
 include/dt-bindings/soc/airoha,scu-ssr.h      |  11 +
 4 files changed, 248 insertions(+), 6 deletions(-)
 create mode 100644 include/dt-bindings/soc/airoha,scu-ssr.h
Signature · 1 line
2.53.0
#1 lore raw

PATCH v2 1/2 dt-bindings: clock: airoha: Add PHY binding for Serdes port

Add PHY cell property for Serdes port selection. Currently supported only for Airoha AN7581 SoC, that support up to 4 Serdes port.

The Serdes port can support both PCIe, USB3 or Ethernet mode.

- PCIe1 Serdes can support PCIe or Ethernet mode.
- PCIe2 Serdes can support PCIe or Ethernet mode.
- USB1 Serdes can support USB3 or HSGMII mode.
- USB2 Serdes can support USB3 or PCIe mode.

Add bindings to permit correct reference of the Serdes ports in DT. Values are just symbolic and enumerates the Serdes port with a specific number for precise reference.

The available Serdes port can be selected following the dt-binding header in [2].

[2] <include/dt-bindings/soc/airoha,scu-ssr.h>

---
 .../bindings/clock/airoha,en7523-scu.yaml     | 24 ++++++++++++++++---
 include/dt-bindings/soc/airoha,scu-ssr.h      | 11 +++++++++
 2 files changed, 32 insertions(+), 3 deletions(-)
 create mode 100644 include/dt-bindings/soc/airoha,scu-ssr.h
Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml +21 -3
index eb24a5687639..fc37786ac7ed 100644
@@ -23,6 +23,7 @@ description: |
 
   All these identifiers can be found in:
   [1]: <include/dt-bindings/clock/en7523-clk.h>.
+  [2]: <include/dt-bindings/soc/airoha,scu-ssr.h>.
 
   The clocks are provided inside a system controller node.
 
@@ -50,6 +51,12 @@ properties:
     description: ID of the controller reset line
     const: 1
 
+  '#phy-cells':
+    description:
+      The first cell indicates the serdes phy number, see [2] for the
+      available serdes port.
+    const: 1
+
 required:
   - compatible
   - reg
@@ -65,12 +72,23 @@ allOf:
         reg:
           minItems: 2
 
+        '#phy-cells': false
+
+  - if:
+      properties:
+        compatible:
+          const: econet,en751221-scu
+    then:
+      properties:
+        reg:
+          maxItems: 1
+
+        '#phy-cells': false
+
   - if:
       properties:
         compatible:
-          enum:
-            - airoha,en7581-scu
-            - econet,en751221-scu
+          const: airoha,en7581-scu
     then:
       properties:
         reg:
include/dt-bindings/soc/airoha,scu-ssr.h new file +11 -0
new file mode 100644
index 000000000000..33c64844ada3
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+
+#ifndef __DT_BINDINGS_AIROHA_SCU_SSR_H
+#define __DT_BINDINGS_AIROHA_SCU_SSR_H
+
+#define AIROHA_SCU_SERDES_PCIE1		0
+#define AIROHA_SCU_SERDES_PCIE2		1
+#define AIROHA_SCU_SERDES_USB1		2
+#define AIROHA_SCU_SERDES_USB2		3
+
+#endif /* __DT_BINDINGS_AIROHA_SCU_SSR_H */
Signature · 1 line
2.53.0
#2 lore raw

PATCH v2 2/2 clk: en7523: Add support for selecting the Serdes port in SCU

In reply to Christian Marangi

In the SCU register for clock and reset, there are also some register to select the Serdes port mode. The Airoha AN7581 SoC have 4 different Serdes that can switch between PCIe, USB or Ethernet mode.

Add a simple PHY provider that expose the .set_mode OP to toggle the requested mode for the Serdes port.

---
 drivers/clk/Kconfig      |   1 +
 drivers/clk/clk-en7523.c | 218 ++++++++++++++++++++++++++++++++++++++-
 2 files changed, 216 insertions(+), 3 deletions(-)
drivers/clk/Kconfig +1 -0
index 252f6a1f21b8..e0cc4ebafb5e 100644
@@ -221,6 +221,7 @@ config COMMON_CLK_EN7523
 	bool "Clock driver for Airoha/EcoNet SoC system clocks"
 	depends on OF
 	depends on ARCH_AIROHA || ECONET || COMPILE_TEST
+	select GENERIC_PHY
 	default ARCH_AIROHA
 	help
 	  This driver provides the fixed clocks and gates present on Airoha
drivers/clk/clk-en7523.c +215 -3

293 lines not on this page · raw message

Signature · 1 line
2.53.0
#3 lore raw

Re: [PATCH v2 2/2] clk: en7523: Add support for selecting the Serdes port in SCU

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] clk: en7523: en7581_serdes_phy_set_mode() rejects USB Host PHY modes --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] clk: en7523: en7581_serdes_phy_set_mode() rejects USB Host PHY modes --

commit e4c0888a17c4cf69587dbf3077fe8a5e2ed19ae7
Author: Christian Marangi <[email protected]>

clk: en7523: Add support for selecting the Serdes port in SCU

In the SCU register for clock and reset, there are also some register to select the Serdes port mode. The Airoha AN7581 SoC have 4 different Serdes that can switch between PCIe, USB or Ethernet mode.

Quoted 4 lines
drivers/clk/clk-en7523.c +0 -0
index 5c45aacb6409e..24fdec2e6198c 100644

[ ... ]

Quoted 1 line
drivers/clk/clk-en7523.c +0 -0
@@ -847,12 +878,179 @@ static int en7581_reset_register(struct device *dev, void __iomem *base,

[ ... ]

drivers/clk/clk-en7523.c static int en7581_reset_register(struct device *dev, void __iomem *base, · line 948

Quoted 7 lines
drivers/clk/clk-en7523.c +7 -0
+	case AIROHA_SCU_SERDES_USB1:
+		reg = REG_NP_SCU_SSR3;
+		mask = REG_SSUSB_HSGMII_SEL_MASK;
+
+		if (mode != PHY_MODE_ETHERNET && mode != PHY_MODE_USB_DEVICE &&
+		    mode != PHY_MODE_USB_DEVICE_SS)
+			return -EINVAL;

[Severity: High]
Does this validation check in en7581_serdes_phy_set_mode() in drivers/clk/clk-en7523.c incorrectly reject standard USB Host PHY modes for the USB1 Serdes port?

When a USB controller driver (such as dwc3) is configured in Host mode, it typically calls phy_set_mode() with PHY_MODE_USB_HOST or PHY_MODE_USB_HOST_SS during initialization.

Returning -EINVAL here prevents the PHY multiplexer from switching to USB mode, leaving the Serdes pins disconnected from the USB controller and breaking USB Host functionality.

Should PHY_MODE_USB_HOST and PHY_MODE_USB_HOST_SS also be allowed here?

Quoted 4 lines
drivers/clk/clk-en7523.c +4 -0
+
+		if (mode == PHY_MODE_ETHERNET)
+			sel = REG_SSUSB_HSGMII_SEL_HSGMII;
+		else

drivers/clk/clk-en7523.c static int en7581_reset_register(struct device *dev, void __iomem *base, · line 962

Quoted 10 lines
drivers/clk/clk-en7523.c +10 -0
+			sel = REG_SSUSB_HSGMII_SEL_USB;
+
+		break;
+	case AIROHA_SCU_SERDES_USB2:
+		reg = REG_NP_SCU_SSTR;
+		mask = REG_USB_PCIE_SEL_MASK;
+
+		if (mode != PHY_MODE_PCIE && mode != PHY_MODE_USB_DEVICE &&
+		    mode != PHY_MODE_USB_DEVICE_SS)
+			return -EINVAL;

[Severity: High]
Similarly, does this logic incorrectly reject standard USB Host PHY modes for the USB2 Serdes port?

If a USB controller initializes in Host or OTG mode, it will request PHY_MODE_USB_HOST or PHY_MODE_USB_HOST_SS. Without explicitly allowing these modes, USB Host operations might be completely non-functional on this SoC.

Quoted 7 lines
drivers/clk/clk-en7523.c +7 -0
+
+		if (mode == PHY_MODE_PCIE)
+			sel = REG_USB_PCIE_SEL_PCIE;
+		else
+			sel = REG_USB_PCIE_SEL_USB;
+
+		break;
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Applied
#4 lore raw
In reply to Christian Marangi
Quoted 11 lines · Christian Marangi

clk: en7523: Add support for selecting SCU serdes

This small series is a split from the Airoha AN7581 USB PHY series [1].

[1] https://lore.kernel.org/all/[email protected]/

Changes v2:
- Rebase on top of linux-next
- Add review tag for Documentation patch

[...]

Applied, thanks!

[1/2] dt-bindings: clock: airoha: Add PHY binding for Serdes port

      commit: 11952173d8a180ac05641775f80bd6946327478f
[2/2] clk: en7523: Add support for selecting the Serdes port in SCU
      commit: 4e39820b601221997cb2220edc830f92367cdfc2

Best regards,

Signature · 1 line
Brian Masney <[email protected]>
#5 lore raw

Il giorno lun 21 set 2026 alle ore 17:34 Brian Masney <[email protected]> ha scritto:

Quoted 13 lines · Christian Marangi
Quoted 10 lines

clk: en7523: Add support for selecting SCU serdes

This small series is a split from the Airoha AN7581 USB PHY series [1].

[1] https://lore.kernel.org/all/[email protected]/

Changes v2:
- Rebase on top of linux-next
- Add review tag for Documentation patch

Quoted 9 lines
Quoted 1 line

[...]

Applied, thanks!

[1/2] dt-bindings: clock: airoha: Add PHY binding for Serdes port

      commit: 11952173d8a180ac05641775f80bd6946327478f
[2/2] clk: en7523: Add support for selecting the Serdes port in SCU
      commit: 4e39820b601221997cb2220edc830f92367cdfc2

Hi Brian,

is it possible to have a stable branch/signed tag for phy subsystem? Commit 11952173d8a180ac05641775f80bd6946327478f is needed to permit correct compilation of a airoha usb phy driver.

#6 lore raw
Quoted 25 lines · Christian Marangi (Ansuel)

Il giorno lun 21 set 2026 alle ore 17:34 Brian Masney <[email protected]> ha scritto:

Quoted 13 lines · Christian Marangi
Quoted 10 lines

clk: en7523: Add support for selecting SCU serdes

This small series is a split from the Airoha AN7581 USB PHY series [1].

[1] https://lore.kernel.org/all/[email protected]/

Changes v2:
- Rebase on top of linux-next
- Add review tag for Documentation patch

Quoted 9 lines
Quoted 1 line

[...]

Applied, thanks!

[1/2] dt-bindings: clock: airoha: Add PHY binding for Serdes port

      commit: 11952173d8a180ac05641775f80bd6946327478f
[2/2] clk: en7523: Add support for selecting the Serdes port in SCU
      commit: 4e39820b601221997cb2220edc830f92367cdfc2
Quoted 3 lines

is it possible to have a stable branch/signed tag for phy subsystem? Commit 11952173d8a180ac05641775f80bd6946327478f is needed to permit correct compilation of a airoha usb phy driver.

Yes. I'll have to rebase the clk-next tree but it's no big deal.

I'm at Linux Plumbers right now and I'll send out an immutable tag in a day or two.

Brian

#7 lore raw

Hi Christian and Vinod,

Quoted 26 lines · Brian Masney
Quoted 25 lines · Christian Marangi (Ansuel)

Il giorno lun 21 set 2026 alle ore 17:34 Brian Masney <[email protected]> ha scritto:

Quoted 22 lines · Christian Marangi
Quoted 11 lines

clk: en7523: Add support for selecting SCU serdes

This small series is a split from the Airoha AN7581 USB PHY series [1].

[1] https://lore.kernel.org/all/[email protected]/

Changes v2:
- Rebase on top of linux-next
- Add review tag for Documentation patch

[...]

Applied, thanks!

[1/2] dt-bindings: clock: airoha: Add PHY binding for Serdes port

      commit: 11952173d8a180ac05641775f80bd6946327478f
[2/2] clk: en7523: Add support for selecting the Serdes port in SCU
      commit: 4e39820b601221997cb2220edc830f92367cdfc2
Quoted 8 lines
Quoted 3 lines

is it possible to have a stable branch/signed tag for phy subsystem? Commit 11952173d8a180ac05641775f80bd6946327478f is needed to permit correct compilation of a airoha usb phy driver.

Yes. I'll have to rebase the clk-next tree but it's no big deal.

I'm at Linux Plumbers right now and I'll send out an immutable tag in a day or two.

I looked into creating an immutable branch, however as I mentioned it's going to require rebasing clk-next (actually clk-pile). I'm willing to do that, however I realized after I sent my last email that the laptop I'm working on right now in Europe only has access to my kernel.org account. So I'd have to rebase all of the prior commits and add my korg Signed-off-by since it's going to change the committer on lots of commits from my Red Hat to korg account. I don't want to do that.

Given that we're this close to the merge window, I'd like to avoid any kind of risky operations on the tree this close to assembling a pull for Linus. If I can be convinced this is particularly pressing for v7.4 I'm willing to entertain the request, but I wouldn't be able to do it until Monday when I'm back in the US.

Brian

#8 lore raw

Il giorno ven 9 ott 2026 alle ore 18:33 Brian Masney <[email protected]> ha scritto:

Quoted 47 lines

Hi Christian and Vinod,

Quoted 26 lines · Brian Masney
Quoted 25 lines · Christian Marangi (Ansuel)

Il giorno lun 21 set 2026 alle ore 17:34 Brian Masney <[email protected]> ha scritto:

Quoted 22 lines · Christian Marangi
Quoted 11 lines

clk: en7523: Add support for selecting SCU serdes

This small series is a split from the Airoha AN7581 USB PHY series [1].

[1] https://lore.kernel.org/all/[email protected]/

Changes v2:
- Rebase on top of linux-next
- Add review tag for Documentation patch

[...]

Applied, thanks!

[1/2] dt-bindings: clock: airoha: Add PHY binding for Serdes port

      commit: 11952173d8a180ac05641775f80bd6946327478f
[2/2] clk: en7523: Add support for selecting the Serdes port in SCU
      commit: 4e39820b601221997cb2220edc830f92367cdfc2
Quoted 8 lines
Quoted 3 lines

is it possible to have a stable branch/signed tag for phy subsystem? Commit 11952173d8a180ac05641775f80bd6946327478f is needed to permit correct compilation of a airoha usb phy driver.

Yes. I'll have to rebase the clk-next tree but it's no big deal.

I'm at Linux Plumbers right now and I'll send out an immutable tag in a day or two.

I looked into creating an immutable branch, however as I mentioned it's going to require rebasing clk-next (actually clk-pile). I'm willing to do that, however I realized after I sent my last email that the laptop I'm working on right now in Europe only has access to my kernel.org account. So I'd have to rebase all of the prior commits and add my korg Signed-off-by since it's going to change the committer on lots of commits from my Red Hat to korg account. I don't want to do that.

Quoted 6 lines

Given that we're this close to the merge window, I'd like to avoid any kind of risky operations on the tree this close to assembling a pull for Linus. If I can be convinced this is particularly pressing for v7.4 I'm willing to entertain the request, but I wouldn't be able to do it until Monday when I'm back in the US.

Thanks a lot for the effort. No, no need to hurry on this.

It was ideal to have as it's currently blocking 2 other driver for submission but it's not worth to cause all these rebase and resign.

If minimal changes are possible, it's totally ok to wait for Monday.

If not possible, then rc1 it is.

#9 lore raw
Quoted 18 lines · Christian Marangi (Ansuel)
Quoted 18 lines
Quoted 9 lines
Quoted 4 lines

is it possible to have a stable branch/signed tag for phy subsystem? Commit 11952173d8a180ac05641775f80bd6946327478f is needed to permit correct compilation of a airoha usb phy driver.

Yes. I'll have to rebase the clk-next tree but it's no big deal.

I'm at Linux Plumbers right now and I'll send out an immutable tag in a day or two.

I looked into creating an immutable branch, however as I mentioned it's going to require rebasing clk-next (actually clk-pile). I'm willing to do that, however I realized after I sent my last email that the laptop I'm working on right now in Europe only has access to my kernel.org account. So I'd have to rebase all of the prior commits and add my korg Signed-off-by since it's going to change the committer on lots of commits from my Red Hat to korg account. I don't want to do that.

Quoted 5 lines
Quoted 5 lines

Given that we're this close to the merge window, I'd like to avoid any kind of risky operations on the tree this close to assembling a pull for Linus. If I can be convinced this is particularly pressing for v7.4 I'm willing to entertain the request, but I wouldn't be able to do it until Monday when I'm back in the US.

I would be on same lines. Considering we are _very_ close to merge windows, I would be very hesitant to rebase my tree

Quoted 10 lines
Quoted 1 line

Thanks a lot for the effort. No, no need to hurry on this.

It was ideal to have as it's currently blocking 2 other driver for submission but it's not worth to cause all these rebase and resign.

If minimal changes are possible, it's totally ok to wait for Monday.

If not possible, then rc1 it is.

Yes lets postpone this to rc1.

Also, in future it is strongly recommended that people request folks for immutable tags when patches are picked (ideally mention in cover) so that dependencies are taken care of.

Thanks

Signature · 1 line
~Vinod