Skip to contentSkip to conversation

dt-bindings: net: Document Motorcomm YT8824 PHY package

PATCH Superseded Kyle Switch 2 participants 8 messages Dec 1 – Dec 4

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

PATCH v29 1/3 dt-bindings: net: Document Motorcomm YT8824 PHY package

Add Documentation/devicetree/bindings/net/motorcomm,yt8824.yaml describing the Motorcomm YT8824, a PHY package containing four PHYs, built on top of ethernet-phy-package.yaml.

The binding introduces a new vendor property, motorcomm,package-mode, to describe whether the package operates in internal or external mode. This is new DT ABI.

The binding also specifies that the package reg property gives the address of the shared top extended register block, which is different from the usual ethernet-phy-package.yaml convention where reg is the first member PHY's address.

In addition, add a new M: entry for Kyle Switch to the existing MOTORCOMM PHY DRIVER section in MAINTAINERS, and list the new binding in that section's F: entries. Note that this makes Kyle a maintainer of all existing Motorcomm PHY code (drivers/net/phy/motorcomm.c and motorcomm,yt8xxx.yaml), not only the new binding.

---
 .../bindings/net/motorcomm,yt8824.yaml        | 100 ++++++++++++++++++
 MAINTAINERS                                   |   2 +
 2 files changed, 102 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/motorcomm,yt8824.yaml
Documentation/devicetree/bindings/net/motorcomm,yt8824.yaml new file +100 -0
new file mode 100644
index 000000000000..1065e5382670
@@ -0,0 +1,100 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/motorcomm,yt8824.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MotorComm YT8824 Ethernet PHY
+
+maintainers:
+  - Kyle Switch <[email protected]>
+
+description:
+  Motorcomm YT8824 Ethernet PHY is a PHY package of 4 PHYs.
+
+$ref: ethernet-phy-package.yaml#
+
+properties:
+  compatible:
+    enum:
+      - motorcomm,yt8824-package
+
+  motorcomm,package-mode:
+    description: |
+      PHY package can be configured in 2 modes:
+      - internal: YT8824 is embedded in the switch, using
+        an internal interface to the MAC. The member PHYs are
+        fixed at MDIO addresses 4..7 and the shared top
+        extended register block is at address 9.
+      - 10g-qxgmii: YT8824 is a standalone external PHY,
+        connected via 10G QXGMII. The member PHYs start at
+        the base MDIO address and the shared top extended
+        register block is at base + 4.
+    $ref: /schemas/types.yaml#/definitions/string
+    enum: [ internal, 10g-qxgmii ]
+
+  reg:
+    description:
+      The absolute MDIO address of the YT8824 shared top extended
+      register block.
+      For internal mode, this is fixed at 9;
+      For external mode, it is the base MDIO address of the four
+      member PHYs plus 4, where base is typically 0x0.
+      Note that this is NOT the reg of the first member PHY.
+
+required:
+  - compatible
+  - motorcomm,package-mode
+  - reg
+
+allOf:
+  - if:
+      properties:
+        motorcomm,package-mode:
+          const: internal
+    then:
+      properties:
+        reg:
+          const: 9
+  - if:
+      properties:
+        motorcomm,package-mode:
+          const: 10g-qxgmii
+    then:
+      properties:
+        reg:
+          const: 4
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    mdio {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        ethernet-phy-package@9 {
+            #address-cells = <1>;
+            #size-cells = <0>;
+            compatible = "motorcomm,yt8824-package";
+            reg = <9>;
+
+            motorcomm,package-mode = "internal";
+
+            ethernet-phy@4 {
+                reg = <4>;
+            };
+
+            ethernet-phy@5 {
+                reg = <5>;
+            };
+
+            ethernet-phy@6 {
+                reg = <6>;
+            };
+
+            ethernet-phy@7 {
+                reg = <7>;
+            };
+        };
+    };
MAINTAINERS +2 -0
index 9336fa93ce38..bcd50f16f062 100644
@@ -18927,8 +18927,10 @@ F:	drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c
 
 MOTORCOMM PHY DRIVER
 M:	Frank <[email protected]>
+M:	Kyle Switch <[email protected]>
 L:	[email protected]
 S:	Maintained
+F:	Documentation/devicetree/bindings/net/motorcomm,yt8824.yaml
 F:	Documentation/devicetree/bindings/net/motorcomm,yt8xxx.yaml
 F:	drivers/net/phy/motorcomm.c
 
Signature · 1 line
2.25.1
#1 lore raw

PATCH v29 1/3 dt-bindings: net: Document Motorcomm YT8824 PHY package

Add Documentation/devicetree/bindings/net/motorcomm,yt8824.yaml describing the Motorcomm YT8824, a PHY package containing four PHYs, built on top of ethernet-phy-package.yaml.

The binding introduces a new vendor property, motorcomm,package-mode, to describe whether the package operates in internal or external mode. This is new DT ABI.

The binding also specifies that the package reg property gives the address of the shared top extended register block, which is different from the usual ethernet-phy-package.yaml convention where reg is the first member PHY's address.

In addition, add a new M: entry for Kyle Switch to the existing MOTORCOMM PHY DRIVER section in MAINTAINERS, and list the new binding in that section's F: entries. Note that this makes Kyle a maintainer of all existing Motorcomm PHY code (drivers/net/phy/motorcomm.c and motorcomm,yt8xxx.yaml), not only the new binding.

---
 .../bindings/net/motorcomm,yt8824.yaml        | 100 ++++++++++++++++++
 MAINTAINERS                                   |   2 +
 2 files changed, 102 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/motorcomm,yt8824.yaml
Documentation/devicetree/bindings/net/motorcomm,yt8824.yaml new file +100 -0
new file mode 100644
index 000000000000..1065e5382670
@@ -0,0 +1,100 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/motorcomm,yt8824.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MotorComm YT8824 Ethernet PHY
+
+maintainers:
+  - Kyle Switch <[email protected]>
+
+description:
+  Motorcomm YT8824 Ethernet PHY is a PHY package of 4 PHYs.
+
+$ref: ethernet-phy-package.yaml#
+
+properties:
+  compatible:
+    enum:
+      - motorcomm,yt8824-package
+
+  motorcomm,package-mode:
+    description: |
+      PHY package can be configured in 2 modes:
+      - internal: YT8824 is embedded in the switch, using
+        an internal interface to the MAC. The member PHYs are
+        fixed at MDIO addresses 4..7 and the shared top
+        extended register block is at address 9.
+      - 10g-qxgmii: YT8824 is a standalone external PHY,
+        connected via 10G QXGMII. The member PHYs start at
+        the base MDIO address and the shared top extended
+        register block is at base + 4.
+    $ref: /schemas/types.yaml#/definitions/string
+    enum: [ internal, 10g-qxgmii ]
+
+  reg:
+    description:
+      The absolute MDIO address of the YT8824 shared top extended
+      register block.
+      For internal mode, this is fixed at 9;
+      For external mode, it is the base MDIO address of the four
+      member PHYs plus 4, where base is typically 0x0.
+      Note that this is NOT the reg of the first member PHY.
+
+required:
+  - compatible
+  - motorcomm,package-mode
+  - reg
+
+allOf:
+  - if:
+      properties:
+        motorcomm,package-mode:
+          const: internal
+    then:
+      properties:
+        reg:
+          const: 9
+  - if:
+      properties:
+        motorcomm,package-mode:
+          const: 10g-qxgmii
+    then:
+      properties:
+        reg:
+          const: 4
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    mdio {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        ethernet-phy-package@9 {
+            #address-cells = <1>;
+            #size-cells = <0>;
+            compatible = "motorcomm,yt8824-package";
+            reg = <9>;
+
+            motorcomm,package-mode = "internal";
+
+            ethernet-phy@4 {
+                reg = <4>;
+            };
+
+            ethernet-phy@5 {
+                reg = <5>;
+            };
+
+            ethernet-phy@6 {
+                reg = <6>;
+            };
+
+            ethernet-phy@7 {
+                reg = <7>;
+            };
+        };
+    };
MAINTAINERS +2 -0
index 9336fa93ce38..bcd50f16f062 100644
@@ -18927,8 +18927,10 @@ F:	drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c
 
 MOTORCOMM PHY DRIVER
 M:	Frank <[email protected]>
+M:	Kyle Switch <[email protected]>
 L:	[email protected]
 S:	Maintained
+F:	Documentation/devicetree/bindings/net/motorcomm,yt8824.yaml
 F:	Documentation/devicetree/bindings/net/motorcomm,yt8xxx.yaml
 F:	drivers/net/phy/motorcomm.c
 
Signature · 1 line
2.25.1
#2 lore raw

PATCH v29 2/3 net: phy: Add support for Template Control register for PMA

In reply to Kyle Switch

Add support for the 10GBASE-T PMA Template Test Mode register field, which allows selecting one of eight test modes (Normal and TestMode1..TestMode7) used for PHY validation.

---
 drivers/net/phy/phy-c45.c | 20 ++++++++++++++++++++
 include/linux/phy.h       |  1 +
 include/uapi/linux/mdio.h | 12 ++++++++++++
 3 files changed, 33 insertions(+)
drivers/net/phy/phy-c45.c +20 -0
index 828af4c4e9d4..0136727767ac 100644
@@ -1444,6 +1444,26 @@ int genphy_c45_fast_retrain(struct phy_device *phydev, bool enable)
 }
 EXPORT_SYMBOL_GPL(genphy_c45_fast_retrain);
 
+/**
+ * genphy_c45_pma_test_mode - configure the 10GBASE-T PMA test mode register
+ * @phydev: target phy_device struct
+ * @test_mode: test mode to select, one of MDIO_PMA_10GBT_TESTMODE_*
+ *
+ * Set the 10GBASE-T PMA test mode to Normal or one of Test Mode 1..7.
+ *
+ * Return: 0 on success, or a negative error code on failure (e.g. register
+ * read/write error).
+ */
+int genphy_c45_pma_test_mode(struct phy_device *phydev, u16 test_mode)
+{
+	if (test_mode & ~MDIO_PMA_10GBT_TESTMODE_MASK)
+		return -EOPNOTSUPP;
+
+	return phy_modify_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_10GBT_TESTMODE,
+			      MDIO_PMA_10GBT_TESTMODE_MASK, test_mode);
+}
+EXPORT_SYMBOL_GPL(genphy_c45_pma_test_mode);
+
 /**
  * genphy_c45_plca_get_cfg - get PLCA configuration from standard registers
  * @phydev: target phy_device struct
include/linux/phy.h +1 -0
index f1b1ad1dd82f..7b401169ebe1 100644
@@ -2368,6 +2368,7 @@ int genphy_c45_loopback(struct phy_device *phydev, bool enable, int speed);
 int genphy_c45_pma_resume(struct phy_device *phydev);
 int genphy_c45_pma_suspend(struct phy_device *phydev);
 int genphy_c45_fast_retrain(struct phy_device *phydev, bool enable);
+int genphy_c45_pma_test_mode(struct phy_device *phydev, u16 test_mode);
 int genphy_c45_plca_get_cfg(struct phy_device *phydev,
 			    struct phy_plca_cfg *plca_cfg);
 int genphy_c45_plca_set_cfg(struct phy_device *phydev,
include/uapi/linux/mdio.h +12 -0
index 2806f60ed105..40e76bc147be 100644
@@ -63,6 +63,7 @@
 /* Media-dependent registers. */
 #define MDIO_PMA_10GBT_SWAPPOL	130	/* 10GBASE-T pair swap & polarity */
 #define MDIO_PMA_10GBT_TXPWR	131	/* 10GBASE-T TX power control */
+#define MDIO_PMA_10GBT_TESTMODE 132 /* Test mode control */
 #define MDIO_PMA_10GBT_SNR	133	/* 10GBASE-T SNR margin, lane A.
 					 * Lanes B-D are numbered 134-136. */
 #define MDIO_PMA_10GBR_FSRT_CSR	147	/* 10GBASE-R fast retrain status and control */
@@ -320,6 +321,17 @@
 /* PMA 10GBASE-R Fast Retrain status and control register. */
 #define MDIO_PMA_10GBR_FSRT_ENABLE	0x0001	/* Fast retrain enable */
 
+/* PMA 10GBASE-T test mode register */
+#define MDIO_PMA_10GBT_TESTMODE_MASK	0xE000	/* Test mode control */
+#define MDIO_PMA_10GBT_TESTMODE_NORMAL	0x0000	/* Normal */
+#define MDIO_PMA_10GBT_TESTMODE_1	0x2000	/* Test Mode 1 */
+#define MDIO_PMA_10GBT_TESTMODE_2	0x4000	/* Test Mode 2 */
+#define MDIO_PMA_10GBT_TESTMODE_3	0x6000	/* Test Mode 3 */
+#define MDIO_PMA_10GBT_TESTMODE_4	0x8000	/* Test Mode 4 */
+#define MDIO_PMA_10GBT_TESTMODE_5	0xA000	/* Test Mode 5 */
+#define MDIO_PMA_10GBT_TESTMODE_6	0xC000	/* Test Mode 6 */
+#define MDIO_PMA_10GBT_TESTMODE_7	0xE000	/* Test Mode 7 */
+
 /* PCS 10GBASE-R/-T status register 1. */
 #define MDIO_PCS_10GBRT_STAT1_BLKLK	0x0001	/* Block lock attained */
 
Signature · 1 line
2.25.1
#3 lore raw

Re: [PATCH net-next V29 2/3] net: phy: Add support for Template Control register for PMA

Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you…

Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit subject says "Add support for Template Control register for PMA" and the body says "PMA Template Test Mode register…

--

net: phy: Add support for Template Control register for PMA

This commit adds genphy_c45_pma_test_mode(), a helper that programs the test mode field of the 10GBASE-T PMA/PMD register 1.132. It also adds the MDIO_PMA_10GBT_TESTMODE register and field definitions to the uapi mdio.h header, so a caller can select Normal or Test Mode 1..7.

Quoted 5 lines

net: phy: Add support for Template Control register for PMA

Add support for the 10GBASE-T PMA Template Test Mode register field, which allows selecting one of eight test modes (Normal and TestMode1..TestMode7) used for PHY validation.

[Severity: Low]
This isn't a bug, but are "Template Control register" and "Template Test Mode register" the right names here?

The patch handles PMA/PMD register 1.132. IEEE 802.3 Clause 45 calls this the 10GBASE-T (MultiGBASE-T) test mode register.

The patch uses that name too. The kernel-doc for genphy_c45_pma_test_mode() in drivers/net/phy/phy-c45.c says:

* genphy_c45_pma_test_mode - configure the 10GBASE-T PMA test mode register

In include/uapi/linux/mdio.h, the register is defined as:

#define MDIO_PMA_10GBT_TESTMODE 132 /* Test mode control */

The field macros are MDIO_PMA_10GBT_TESTMODE_MASK, _NORMAL and _1.._7. The word "Template" does not appear anywhere in the diff.

Could the subject and body use the standard register name? For example:

net: phy: c45: add helper for 10GBASE-T PMA test mode register

Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201094405.3036391-1-kyle.switch%40motor-comm.com
#4 lore raw

PATCH v29 3/3 net: phy: Add driver for Motorcomm Quad 2.5GbE phy

In reply to Kyle Switch

Add support for Motorcomm YT8824 quad-port 2.5G PHY to the existing motorcomm driver, using the phy_package helpers for the shared top extended register space.

---
 drivers/net/phy/Kconfig     |    4 +-
 drivers/net/phy/motorcomm.c | 2110 ++++++++++++++++++++++++++++++++++-
 2 files changed, 2111 insertions(+), 3 deletions(-)
drivers/net/phy/Kconfig +3 -1
index 30e9d22c8d1a..04593a770e43 100644
@@ -361,10 +361,12 @@ config MICROSEMI_PHY
 
 config MOTORCOMM_PHY
 	tristate "Motorcomm PHYs"
+	select PHY_PACKAGE
 	help
 	  Enables support for Motorcomm network PHYs.
 	  Currently supports YT85xx Gigabit Ethernet PHYs, YT861x PHYs
-	  integrated in YT921x switches, and YT8821 2.5Gbps PHYs.
+	  integrated in YT921x switches, YT8821 2.5Gbps PHYs and YT8824 4 * 2.5G
+	  PHYs.
 
 config NATIONAL_PHY
 	tristate "National Semiconductor PHYs"
drivers/net/phy/motorcomm.c +2108 -2

2,188 lines not on this page · raw message

Signature · 1 line
2.25.1
#5 lore raw

Re: [PATCH net-next V29 3/3] net: phy: Add driver for Motorcomm Quad 2.5GbE phy

Thank you for your contribution! Sashiko AI review found 6 potential issue(s) to consider.

Thank you for your contribution! Sashiko AI review found 6 potential issue(s) to consider.

Critical: 0 · High: 0 · Medium: 2 · Low: 4

If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).

- [Medium] The split between per-port and shared registers in the YT8824 UTP init code contradicts the patch's own documented layout.
- [Medium] The package-wide one-shot flags priv->sds_initialized and priv->utp_shared_initialized[] are cleared only in…
- [Low] The commit message is one sentence for about 2100 added lines.
- [Low] The comment on struct yt8824_shared_priv::utp_shared_initialized describes its elements as 'utp_top_ext_init_done[0]: UTP0/UTP1 shared'…
- [Low] yt8824_sds_isolate_and_softreset_paged() and yt8824_extern_sds_softreset() take the bus-wide mdio_lock in…
- [Low] The external SerDes init sequence in yt8824_extern_config_sds_init_paged() has reset and calibration steps…

--

net: phy: Add driver for Motorcomm Quad 2.5GbE phy

This adds support for the Motorcomm YT8824 quad-port 2.5G PHY to the existing motorcomm driver. Shared top-extended registers are accessed through the phy_package helpers. A package-wide mutex serializes the per-port UTP/SERDES space switching, and a DT property selects one of two package modes (internal and 10G-QXGMII).

Quoted 3 lines

Add support for Motorcomm YT8824 quad-port 2.5G PHY to the existing motorcomm driver, using the phy_package helpers for the shared top extended register space.

[Severity: Low]
This isn't a bug, but the commit message is one sentence for roughly 2100 added lines. Could it describe a few design points that are hard to see from the diff?

A new vendor DT property, motorcomm,package-mode, selects one of two package modes. In the internal (switch-embedded) mode the ports are assumed to be at MDIO addresses 4..7. The other mode is standalone 10G-QXGMII.

The UTP/SERDES register space select bit is package-global. yt8824_read_page() and yt8824_write_page() go through __phy_package_read() and __phy_package_write() at offset 0. A phy_select_page() on one port therefore switches the space for all four ports, which is why the private shared_lock exists.

yt8824_phy_package_probe_once() returns -EINVAL when the package node lacks motorcomm,package-mode. Probing therefore depends on a DT binding that the commit message doesn't mention.

Quoted 4 lines
drivers/net/phy/motorcomm.c +0 -0
index a87e83fdf590c..56f644388b0de 100644

[ ... ]

Quoted 5 lines
drivers/net/phy/motorcomm.c +1 -0
@@ -415,6 +657,34 @@ struct yt8521_priv {
 	u8 reg_page;
 };
 
+struct yt8824_shared_priv {

[ ... ]

drivers/net/phy/motorcomm.c struct yt8521_priv { · line 678

Quoted 9 lines
drivers/net/phy/motorcomm.c +9 -0
+	/*
+	 * UTP top ext register space starts at 0xa000. Adjacent UTP pairs share
+	 * one instance (UTP0/UTP1, UTP2/UTP3), so shared registers are
+	 * configured only once per group; this flag tracks whether the group's
+	 * shared registers have been initialized.
+	 * utp_top_ext_init_done[0]: UTP0/UTP1 shared.
+	 * utp_top_ext_init_done[1]: UTP2/UTP3 shared.
+	 */
+	bool utp_shared_initialized[2];

[Severity: Low]
This isn't a bug, but the comment refers to utp_top_ext_init_done[], which doesn't exist. The field is utp_shared_initialized[].

The UTP0/UTP1 and UTP2/UTP3 mapping is also only right for the external mode. In internal mode yt8824_utp_shared_group() uses base = 4, so the groups are UTP4/UTP5 and UTP6/UTP7.

[ ... ]

Quoted 1 line
drivers/net/phy/motorcomm.c +0 -0
@@ -649,2595 +983,4350 @@ static int ytphy_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol)

[ ... ]

Quoted 2 lines
drivers/net/phy/motorcomm.c +2 -0
+static int yt8824_sds_isolate_and_softreset_paged(struct phy_device *phydev)
+{

[ ... ]

Quoted 4 lines
drivers/net/phy/motorcomm.c +2 -0
+	old_page = phy_select_page(phydev, YT8824_RSSR_SERDES_SPACE);
+	if (old_page < 0)
 		goto err_restore_page;

[ ... ]

drivers/net/phy/motorcomm.c static int ytphy_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol) · line 1118

Quoted 8 lines
drivers/net/phy/motorcomm.c +8 -0
+	/* For operations on the SerDes address space, the lock must be held
+	 * throughout the entire process to prevent other PHY operations from
+	 * mistakenly switching the address space to UTP, since the four PHYs
+	 * share the bit that switches the address space.
+	 */
+	ret = read_poll_timeout(__phy_read, val,
+				(val < 0) || !(val & BMCR_RESET), 50000, 600000,
+				true, phydev, MII_BMCR);

[Severity: Low]
phy_select_page() takes the bus-wide mdio_lock, and it is held until phy_restore_page(). With sleep_before_read set to true and a 50 ms sleep interval, doesn't each call keep the whole MDIO bus locked for at least 50 ms, and up to 600 ms?

yt8824_extern_sds_softreset() has the same poll. These helpers run per port from yt8824_soft_reset(), yt8824_config_init(), yt8824_suspend(), yt8824_resume() and the yt8824_restore_working_status() error path.

In external mode a single phy_init_hw() runs soft_reset, then config_init (extern_sds_softreset plus another soft_reset). That is at least about 150 ms of bus lockout per port, or around 600 ms for the package. Other PHYs or switches on the same bus stall during that time.

yt8521_modify_bmcr_paged() polls every 1 ms and stops as soon as BMCR_RESET clears. Could a shorter sleep interval, or sleep_before_read set to false, be used here?

[ ... ]

Quoted 16 lines
drivers/net/phy/motorcomm.c +15 -0
+/**
+ * yt8824_config_utp_top_ext_init_paged() - config phy8824 shared UTP top ext
+ * @phydev: target phy_device struct
+ *
+ * Programs the UTP top extended register space shared by adjacent UTP
+ * pairs (UTP0/UTP1, UTP2/UTP3): write protection, PLL calibration,
+ * P0/P1 DAC bias, P01 PLL enable, U0/U1 CSR TX resets and odd-preamble
+ * enable. Runs once per shared group, guarded by
+ * priv->utp_shared_initialized[grp].
+ *
+ * Per-UTP private registers live in yt8824_config_utp_init_paged().
+ *
+ * Returns: 0 or negative errno code
+ */
+static int yt8824_config_utp_top_ext_init_paged(struct phy_device *phydev)
 {

[ ... ]

Quoted 2 lines
drivers/net/phy/motorcomm.c +1 -0
+	if (priv->utp_shared_initialized[grp])
 		return 0;

[ ... ]

Quoted 6 lines
drivers/net/phy/motorcomm.c +6 -0
+	/* write protecting */
+	mask = YT8824_WRITE_PROTECT;
+	ctrl = YT8824_WRITE_PROTECT;
+	ret = ytphy_modify_ext_with_lock(phydev,
+					 YT8824_WRITE_PROTECT_CAL_REG,
+					 mask, ctrl);

[ ... ]

Quoted 16 lines
drivers/net/phy/motorcomm.c +16 -0
+/**
+ * yt8824_config_utp_init_paged() - config phy8824 utp init
+ * @phydev: target phy_device struct
+ *
+ * UTP ext register space starts at 0x0 and is private to each UTP.
+ * UTP top ext register space starts at 0xa000 and is shared by
+ * adjacent UTP pairs: UTP0/UTP1 share one address space, and
+ * UTP2/UTP3 share another.
+ *
+ * For shared registers, this function configures them according to the
+ * UTP index so that configuring a common register does not inadvertently
+ * affect the other ports sharing the same address space.
+ *
+ * Returns: 0 or negative errno code
+ */
+static int yt8824_config_utp_init_paged(struct phy_device *phydev)

[ ... ]

drivers/net/phy/motorcomm.c static int ytphy_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol) · line 1474

Quoted 6 lines
drivers/net/phy/motorcomm.c +6 -0
+	/* enable nibble */
+	ctrl = FIELD_PREP(YT8824_U0_U1_ENABLE_ODD_PREAMBLE, 3);
+	mask = YT8824_U0_U1_ENABLE_ODD_PREAMBLE;
+	ret = ytphy_modify_ext_with_lock(phydev,
+					 YT8824_IF_CTRL_REG,
+					 mask, ctrl);

[Severity: Medium]
The kernel-doc of yt8824_config_utp_init_paged() says the ext space from 0x0 is private to each UTP, and the space from 0xa000 is shared by a UTP pair. The code doesn't seem to follow that split.

yt8824_config_utp_top_ext_init_paged() runs only once per pair because of the utp_shared_initialized[grp] check. Its first write goes to YT8824_WRITE_PROTECT_CAL_REG (0x1), which is in the private range. That write goes to the calling port's own MDIO address.

Does the second UTP of each pair ever get YT8824_WRITE_PROTECT set?

yt8824_config_utp_init_paged() runs on every port. It writes the shared YT8824_IF_CTRL_REG (0xa003) with a fixed value covering both U0 and U1. Its kernel-doc says shared registers are configured according to the UTP index, but nothing in the function looks at phydev->mdio.addr or the group.

The kernel-doc of yt8824_config_utp_top_ext_init_paged() also lists odd-preamble enable, but its body never writes 0xa003. It does write YT8824_DAC_CFG_REG (0xa2fa), which the doc doesn't mention.

Should 0x1 be written per port and 0xa003 moved into the once-per-pair function? If the current split is intended, could the comments be corrected instead?

[ ... ]

drivers/net/phy/motorcomm.c static int ytphy_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol) · line 1907

Quoted 12 lines
drivers/net/phy/motorcomm.c +12 -0
+static int yt8824_extern_config_sds_init_paged(struct phy_device *phydev)
+{
+	struct yt8824_shared_priv *priv = phy_package_get_priv(phydev);
+	int old_page = YT8824_RSSR_UTP_SPACE;
+	int val_1, val_2, val_3, tmp;
+	int ctrl = 0;
+	int mask = 0;
+	int ret = -1;
+
+	/* return directly if sds already initialized. */
+	if (priv->sds_initialized)
+		return 0;

[Severity: Medium]
sds_initialized and utp_shared_initialized[] are only cleared in yt8824_phy_package_probe_once(). That runs once for the lifetime of the shared package object.

What happens when config_init runs again after the chip has lost its configuration?

On resume and hibernation restore the path is mdio_bus_phy_resume()->phy_init_hw()->yt8824_config_init().

phy_detach() also asserts the reset line through phy_device_reset(phydev, 1). The next attach calls phy_init_hw() again, while the sibling ports keep the package priv alive.

In those cases this check returns early, so none of these are reapplied:

- the SerDes PLL/efuse trims
- the CDR/AFE/DFE settings
- the calibration restart

yt8824_config_utp_top_ext_init_paged() skips the shared PLL, DAC bias, efuse bypass and U0/U1 TX reset settings the same way.

Would the hardware then run on power-on defaults while config_init still reports success?

[ ... ]

Quoted 4 lines
drivers/net/phy/motorcomm.c +4 -0
+	ctrl = FIELD_PREP(YT8824_CSR_PCS_GLB_RST_BYPASS, 1);
+	ctrl |= FIELD_PREP(YT8824_CSR_SG_MODE_RST_BYPASS, 1);
+	ctrl |= FIELD_PREP(YT8824_CSR_US_GLB_RESET_N, 0);
+	ctrl |= FIELD_PREP(YT8824_CSR_PCS_BEF_TRAINING_DONE_RST_BYPASS, 1);

[ ... ]

Quoted 5 lines
drivers/net/phy/motorcomm.c +5 -0
+	/* restart calibration */
+	ctrl = FIELD_PREP(YT8824_CUR_TX_SEQ, 0x5);
+	ctrl |= FIELD_PREP(YT8824_CUR_RX_SEQ, 0x6);
+	ctrl |= FIELD_PREP(YT8824_CALIB_SEQ_FINISH, 1);
+	ctrl |= FIELD_PREP(YT8824_CALIB_SEQ_SW_RST, 1);

[ ... ]

drivers/net/phy/motorcomm.c static int ytphy_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol) · line 2187

Quoted 8 lines
drivers/net/phy/motorcomm.c +8 -0
+	/* restart to calibration */
+	ret = ytphy_write_ext(phydev, YT8824_RESTART_CAL_CTRL_REG, 0x0040);
+	if (ret < 0)
+		goto err_restore_page;
+
+	ret = ytphy_write_ext(phydev, YT8824_RESTART_CAL_CTRL_REG, 0x0);
+	if (ret < 0)
+		goto err_restore_page;

[Severity: Low]
Can the reset and calibration handling here be confirmed or documented?

The name YT8824_CSR_US_GLB_RESET_N suggests an active-low bit. It is written as 0 and never set back to 1.

YT8824_CALIB_SEQ_SW_RST is left at 1. YT8824_CALIB_SEQ_FINISH sounds like a status bit, but it is written with 1 instead of being polled.

YT8824_RESTART_CAL_CTRL_REG is pulsed 0x40 then 0, and the function returns without waiting for calibration to finish. yt8824_config_init() then calls yt8824_extern_sds_softreset() straight away, which issues BMCR_RESET on the SerDes:

	ret = yt8824_extern_config_sds_init_paged(phydev);
	...
	ret = yt8824_extern_sds_softreset(phydev);

Elsewhere the driver pulses resets explicitly (PLL_DAC_RST 0->1, RESETB_TX 0->1). If these bits mean what their names suggest, could the SerDes be left in global reset or soft calibration reset? Could the channel reset also cut the calibration short?

A comment explaining the sequence, or a completion poll, would help.

Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201094405.3036391-1-kyle.switch%40motor-comm.com
#6 lore raw
In reply to Kyle Switch
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).

- [Medium] In motorcomm,yt8824.yaml, the description of the external (10g-qxgmii) mode says the address can vary, but the schema fixes it.

--

dt-bindings: net: Document Motorcomm YT8824 PHY package

This patch adds a binding for the Motorcomm YT8824 quad PHY package. It builds on ethernet-phy-package.yaml and adds a new motorcomm,package-mode property to choose internal or 10g-qxgmii mode. It also adds a maintainer and an F: entry to the MOTORCOMM PHY DRIVER section in MAINTAINERS.

Quoted 5 lines
Documentation/devicetree/bindings/net/motorcomm,yt8824.yaml new file +0 -0
new file mode 100644
index 0000000000000..1065e5382670f

[ ... ]

Quoted 22 lines
Documentation/devicetree/bindings/net/motorcomm,yt8824.yaml new file +22 -0
+  motorcomm,package-mode:
+    description: |
+      PHY package can be configured in 2 modes:
+      - internal: YT8824 is embedded in the switch, using
+        an internal interface to the MAC. The member PHYs are
+        fixed at MDIO addresses 4..7 and the shared top
+        extended register block is at address 9.
+      - 10g-qxgmii: YT8824 is a standalone external PHY,
+        connected via 10G QXGMII. The member PHYs start at
+        the base MDIO address and the shared top extended
+        register block is at base + 4.
+    $ref: /schemas/types.yaml#/definitions/string
+    enum: [ internal, 10g-qxgmii ]
+
+  reg:
+    description:
+      The absolute MDIO address of the YT8824 shared top extended
+      register block.
+      For internal mode, this is fixed at 9;
+      For external mode, it is the base MDIO address of the four
+      member PHYs plus 4, where base is typically 0x0.
+      Note that this is NOT the reg of the first member PHY.

[ ... ]

Documentation/devicetree/bindings/net/motorcomm,yt8824.yaml line 66

Quoted 8 lines
Documentation/devicetree/bindings/net/motorcomm,yt8824.yaml new file +8 -0
+  - if:
+      properties:
+        motorcomm,package-mode:
+          const: 10g-qxgmii
+    then:
+      properties:
+        reg:
+          const: 4

[Severity: Medium]
Do the text and the schema agree for the 10g-qxgmii case?

The motorcomm,package-mode description says the member PHYs "start at the base MDIO address" and the top block is "at base + 4". The reg description says base is "typically 0x0". Both suggest the base can be something other than 0.

This branch sets reg to const 4, so 0 is the only base that passes the schema. The parent ethernet-phy-package.yaml allows any reg from 0 to 31:

reg:

    minimum: 0
    maximum: 31

So the limit to 4 comes only from this binding.

Suppose an external YT8824 is strapped to a non-zero base, for example PHYs at 8..11 with the top block at 12. Would its DT fail dt_binding_check? It also seems that two external YT8824 packages could never share one MDIO bus in a schema-valid DT.

The driver patch later in this series ("net: phy: Add driver for Motorcomm Quad 2.5GbE phy") makes the same assumption. yt8824_utp_shared_group() in drivers/net/phy/motorcomm.c hard-codes a base of 0 for non-internal mode:

	if (priv->package_mode == PHY_INTERFACE_MODE_INTERNAL)
		base = 4;
	else
		base = 0;

	if (addr < base || addr >= base + YT8824_UTP_SHARED_GROUPS * 2)
		return -EINVAL;

The schema and the driver match each other, but neither matches the binding text. The binding is unchanged at the end of the series.

This is new DT ABI, so which one is intended? If the hardware supports a variable base, could reg be a range, with driver support for that base? If the external base is hard-wired to 0, could the text say so and drop the "base" and "typically 0x0" wording?

Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201094405.3036391-1-kyle.switch%40motor-comm.com
#7 lore raw
Quoted 98 lines · On 12/4/26 11:46, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).

- [Medium] In motorcomm,yt8824.yaml, the description of the external (10g-qxgmii) mode says the address can vary, but the schema fixes it.

--

dt-bindings: net: Document Motorcomm YT8824 PHY package

This patch adds a binding for the Motorcomm YT8824 quad PHY package. It builds on ethernet-phy-package.yaml and adds a new motorcomm,package-mode property to choose internal or 10g-qxgmii mode. It also adds a maintainer and an F: entry to the MOTORCOMM PHY DRIVER section in MAINTAINERS.

Quoted 5 lines
Documentation/devicetree/bindings/net/motorcomm,yt8824.yaml new file +0 -0
new file mode 100644
index 0000000000000..1065e5382670f

[ ... ]

Quoted 22 lines
Documentation/devicetree/bindings/net/motorcomm,yt8824.yaml new file +22 -0
+  motorcomm,package-mode:
+    description: |
+      PHY package can be configured in 2 modes:
+      - internal: YT8824 is embedded in the switch, using
+        an internal interface to the MAC. The member PHYs are
+        fixed at MDIO addresses 4..7 and the shared top
+        extended register block is at address 9.
+      - 10g-qxgmii: YT8824 is a standalone external PHY,
+        connected via 10G QXGMII. The member PHYs start at
+        the base MDIO address and the shared top extended
+        register block is at base + 4.
+    $ref: /schemas/types.yaml#/definitions/string
+    enum: [ internal, 10g-qxgmii ]
+
+  reg:
+    description:
+      The absolute MDIO address of the YT8824 shared top extended
+      register block.
+      For internal mode, this is fixed at 9;
+      For external mode, it is the base MDIO address of the four
+      member PHYs plus 4, where base is typically 0x0.
+      Note that this is NOT the reg of the first member PHY.

[ ... ]

Documentation/devicetree/bindings/net/motorcomm,yt8824.yaml line 66

Quoted 8 lines
Documentation/devicetree/bindings/net/motorcomm,yt8824.yaml new file +8 -0
+  - if:
+      properties:
+        motorcomm,package-mode:
+          const: 10g-qxgmii
+    then:
+      properties:
+        reg:
+          const: 4

[Severity: Medium]
Do the text and the schema agree for the 10g-qxgmii case?

The motorcomm,package-mode description says the member PHYs "start at the base MDIO address" and the top block is "at base + 4". The reg description says base is "typically 0x0". Both suggest the base can be something other than 0.

This branch sets reg to const 4, so 0 is the only base that passes the schema. The parent ethernet-phy-package.yaml allows any reg from 0 to 31:

   reg:
     minimum: 0
     maximum: 31

So the limit to 4 comes only from this binding.

Suppose an external YT8824 is strapped to a non-zero base, for example PHYs at 8..11 with the top block at 12. Would its DT fail dt_binding_check? It also seems that two external YT8824 packages could never share one MDIO bus in a schema-valid DT.

The driver patch later in this series ("net: phy: Add driver for Motorcomm Quad 2.5GbE phy") makes the same assumption. yt8824_utp_shared_group() in drivers/net/phy/motorcomm.c hard-codes a base of 0 for non-internal mode:

	if (priv->package_mode == PHY_INTERFACE_MODE_INTERNAL)
		base = 4;
	else
		base = 0;

	if (addr < base || addr >= base + YT8824_UTP_SHARED_GROUPS * 2)
		return -EINVAL;
Quoted 7 lines

The schema and the driver match each other, but neither matches the binding text. The binding is unchanged at the end of the series.

This is new DT ABI, so which one is intended? If the hardware supports a variable base, could reg be a range, with driver support for that base? If the external base is hard-wired to 0, could the text say so and drop the "base" and "typically 0x0" wording?

okay, will be fixed in next patch.