Commit 331cf8fc authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'phy-polarity-inversion-via-generic-device-tree-properties'

Vladimir Oltean says:

====================
PHY polarity inversion via generic device tree properties

Using the "rx-polarity" and "tx-polarity" device tree properties
introduced in linux-phy and merged into net-next in
commit 96a2d53f ("Merge tag 'phy_common_properties' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy")
we convert here two existing networking use cases - the EN8811H Ethernet
PHY and the Mediatek LynxI PCS.

Original cover letter:

Polarity inversion (described in patch 4/10) is a feature with at least
4 potential new users waiting for a generic description:
- Horatiu Vultur with the lan966x SerDes
- Daniel Golle with the MaxLinear GSW1xx switches
- Bjørn Mork with the AN8811HB Ethernet PHY
- Me with a custom SJA1105 board, switch which uses the DesignWare XPCS

I became interested in exploring the problem space because I was averse
to the idea of adding vendor-specific device tree properties to describe
a common need.

This set contains an implementation of a generic feature that should
cater to all known needs that were identified during my documentation
phase.

Apart from what is converted here, we also have the following, which I
did not touch:
- "st,px_rx_pol_inv" - its binding is a .txt file and I don't have time
  for such a large detour to convert it to dtschema.
- "st,pcie-tx-pol-inv" and "st,sata-tx-pol-inv" - these are defined in a
  .txt schema but are not implemented in any driver. My verdict would be
  "delete the properties" but again, I would prefer not introducing such
  dependency to this series.
====================

Link: https://patch.msgid.link/20260119091220.1493761-1-vladimir.oltean@nxp.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 9de76f55 8871389d
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ description:

allOf:
  - $ref: ethernet-phy.yaml#
  - $ref: /schemas/phy/phy-common-props.yaml#

properties:
  compatible:
@@ -30,12 +31,18 @@ properties:
    description:
      Reverse rx polarity of the SERDES. This is the receiving
      side of the lines from the MAC towards the EN881H.
      This property is deprecated, for details please refer to
      Documentation/devicetree/bindings/phy/phy-common-props.yaml
    deprecated: true

  airoha,pnswap-tx:
    type: boolean
    description:
      Reverse tx polarity of SERDES. This is the transmitting
      side of the lines from EN8811H towards the MAC.
      This property is deprecated, for details please refer to
      Documentation/devicetree/bindings/phy/phy-common-props.yaml
    deprecated: true

required:
  - reg
@@ -44,6 +51,8 @@ unevaluatedProperties: false

examples:
  - |
    #include <dt-bindings/phy/phy.h>

    mdio {
        #address-cells = <1>;
        #size-cells = <0>;
@@ -51,6 +60,6 @@ examples:
        ethernet-phy@1 {
            compatible = "ethernet-phy-id03a2.a411";
            reg = <1>;
            airoha,pnswap-rx;
            rx-polarity = <PHY_POL_INVERT>;
        };
    };
+6 −1
Original line number Diff line number Diff line
@@ -39,12 +39,17 @@ properties:
    const: 1

  mediatek,pnswap:
    description: Invert polarity of the SGMII data lanes
    description:
      Invert polarity of the SGMII data lanes.
      This property is deprecated, for details please refer to
      Documentation/devicetree/bindings/phy/phy-common-props.yaml.
    type: boolean
    deprecated: true

  pcs:
    type: object
    description: MediaTek LynxI HSGMII PCS
    $ref: /schemas/phy/phy-common-props.yaml#
    properties:
      compatible:
        const: mediatek,mt7988-sgmii
+2 −2
Original line number Diff line number Diff line
@@ -113,8 +113,8 @@ mt7531_create_sgmii(struct mt7530_priv *priv)
			ret = PTR_ERR(regmap);
			break;
		}
		pcs = mtk_pcs_lynxi_create(priv->dev, regmap,
					   MT7531_PHYA_CTRL_SIGNAL3, 0);
		pcs = mtk_pcs_lynxi_create(priv->dev, NULL, regmap,
					   MT7531_PHYA_CTRL_SIGNAL3);
		if (!pcs) {
			ret = -ENXIO;
			break;
+8 −11
Original line number Diff line number Diff line
@@ -4994,7 +4994,6 @@ static int mtk_sgmii_init(struct mtk_eth *eth)
{
	struct device_node *np;
	struct regmap *regmap;
	u32 flags;
	int i;

	for (i = 0; i < MTK_MAX_DEVS; i++) {
@@ -5003,18 +5002,16 @@ static int mtk_sgmii_init(struct mtk_eth *eth)
			break;

		regmap = syscon_node_to_regmap(np);
		flags = 0;
		if (of_property_read_bool(np, "mediatek,pnswap"))
			flags |= MTK_SGMII_FLAG_PN_SWAP;

		if (IS_ERR(regmap)) {
			of_node_put(np);

		if (IS_ERR(regmap))
			return PTR_ERR(regmap);
		}

		eth->sgmii_pcs[i] = mtk_pcs_lynxi_create(eth->dev, regmap,
							 eth->soc->ana_rgc3,
							 flags);
		eth->sgmii_pcs[i] = mtk_pcs_lynxi_create(eth->dev,
							 of_fwnode_handle(np),
							 regmap,
							 eth->soc->ana_rgc3);
		of_node_put(np);
	}

	return 0;
+1 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ config PCS_LYNX

config PCS_MTK_LYNXI
	tristate
	select PHY_COMMON_PROPS
	select REGMAP
	help
	  This module provides helpers to phylink for managing the LynxI PCS
Loading