Skip to contentSkip to conversation

dt-bindings: net: Document Motorcomm YT8824 PHY package

PATCH Superseded Kyle Switch 1 participant 4 messages Dec 1

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

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