devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] net: phy: adin: enable configuration of the LP Termination Register
@ 2025-12-16 15:48 Osose Itua
  2025-12-16 15:50 ` [PATCH 2/2] dt-bindings: net: adi,adin: document LP termination property Osose Itua
  2025-12-16 17:02 ` [External] : [PATCH 1/2] net: phy: adin: enable configuration of the LP Termination Register ALOK TIWARI
  0 siblings, 2 replies; 3+ messages in thread
From: Osose Itua @ 2025-12-16 15:48 UTC (permalink / raw)
  To: netdev
  Cc: devicetree, linux-kernel, Michael Hennerich,
	Jérôme Oufella

From 9c68d9082a9c0550891f24c5902c1f0de15de949 Mon Sep 17 00:00:00 2001
From: Osose Itua <osose.itua@savoirfairelinux.com>
Date: Fri, 14 Nov 2025 17:00:14 -0500
Subject: [PATCH 1/2] net: phy: adin: enable configuration of the LP
 Termination Register

The ADIN1200/ADIN1300 provide a control bit that selects between normal
receive termination and the lowest common mode impedance for 100BASE-TX
operation. This behavior is controlled through the Low Power Termination
register (B_100_ZPTM_EN_DIMRX).

Bit 0 of this register enables normal termination when set (this is the
default), and selects the lowest common mode impedance when cleared.

Signed-off-by: Osose Itua <osose.itua@savoirfairelinux.com>
---
 drivers/net/phy/adin.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/drivers/net/phy/adin.c b/drivers/net/phy/adin.c
index 7fa713ca8d45..2969480a7be3 100644
--- a/drivers/net/phy/adin.c
+++ b/drivers/net/phy/adin.c
@@ -89,6 +89,9 @@
 #define ADIN1300_CLOCK_STOP_REG			0x9400
 #define ADIN1300_LPI_WAKE_ERR_CNT_REG		0xa000
 
+#define ADIN1300_B_100_ZPTM_DIMRX		0xB685
+#define ADIN1300_B_100_ZPTM_EN_DIMRX		BIT(0)
+
 #define ADIN1300_CDIAG_RUN			0xba1b
 #define   ADIN1300_CDIAG_RUN_EN			BIT(0)
 
@@ -522,6 +525,31 @@ static int adin_config_clk_out(struct phy_device *phydev)
 			      ADIN1300_GE_CLK_CFG_MASK, sel);
 }
 
+static int adin_config_zptm100(struct phy_device *phydev)
+{
+	struct device *dev = &phydev->mdio.dev;
+	u8 reg;
+	int rc;
+
+	if (!(device_property_read_bool(dev, "adi,low-cmode-impedance")))
+		return 0;
+
+	/* set to 0 to configure for lowest common-mode impedance */
+	rc = phy_write_mmd(phydev, MDIO_MMD_VEND1, ADIN1300_B_100_ZPTM_DIMRX, 0x0);
+	if (rc < 0)
+		return rc;
+
+	reg = phy_read_mmd(phydev, MDIO_MMD_VEND1, ADIN1300_B_100_ZPTM_DIMRX);
+	if (reg < 0)
+		return reg;
+
+	if (reg != 0x0)
+		phydev_err(phydev,
+			   "Lowest common-mode impedance configuration failed\n");
+
+	return 0;
+}
+
 static int adin_config_init(struct phy_device *phydev)
 {
 	int rc;
@@ -548,6 +576,10 @@ static int adin_config_init(struct phy_device *phydev)
 	if (rc < 0)
 		return rc;
 
+	rc = adin_config_zptm100(phydev);
+	if (rc < 0)
+		return rc;
+
 	phydev_dbg(phydev, "PHY is using mode '%s'\n",
 		   phy_modes(phydev->interface));
 

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

* Re: [PATCH 2/2] dt-bindings: net: adi,adin: document LP termination property
  2025-12-16 15:48 [PATCH 1/2] net: phy: adin: enable configuration of the LP Termination Register Osose Itua
@ 2025-12-16 15:50 ` Osose Itua
  2025-12-16 17:02 ` [External] : [PATCH 1/2] net: phy: adin: enable configuration of the LP Termination Register ALOK TIWARI
  1 sibling, 0 replies; 3+ messages in thread
From: Osose Itua @ 2025-12-16 15:50 UTC (permalink / raw)
  To: netdev; +Cc: devicetree, linux-kernel, Michael Hennerich, Jérome Oufella

From 4b4409504fd41c81c7150ae1d88bc0ca755e6ace Mon Sep 17 00:00:00 2001
From: Osose Itua <osose.itua@savoirfairelinux.com>
Date: Mon, 15 Dec 2025 17:59:38 -0500
Subject: [PATCH 2/2] dt-bindings: net: adi,adin: document LP termination
 property

Add "adi,low-cmode-impedance" boolean property which, when present,
configures the PHY for the lowest common-mode impedance on the receive
pair for 100BASE-TX operation.

Signed-off-by: Osose Itua <osose.itua@savoirfairelinux.com>
---
 Documentation/devicetree/bindings/net/adi,adin.yaml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/adi,adin.yaml b/Documentation/devicetree/bindings/net/adi,adin.yaml
index c425a9f1886d..d3c8c5cc4bb1 100644
--- a/Documentation/devicetree/bindings/net/adi,adin.yaml
+++ b/Documentation/devicetree/bindings/net/adi,adin.yaml
@@ -52,6 +52,12 @@ properties:
     description: Enable 25MHz reference clock output on CLK25_REF pin.
     type: boolean
 
+  adi,low-cmode-impedance:
+    description: |
+      Ability to configure for the lowest common-mode impedance on the
+      receive pair for 100BASE-TX.
+    type: boolean
+
 unevaluatedProperties: false
 
 examples:


----- Message original -----
De: "Osose Itua" <osose.itua@savoirfairelinux.com>
À: "netdev" <netdev@vger.kernel.org>
Cc: "devicetree" <devicetree@vger.kernel.org>, "linux-kernel" <linux-kernel@vger.kernel.org>, "Michael Hennerich" <michael.hennerich@analog.com>, "Jérome Oufella" <jerome.oufella@savoirfairelinux.com>
Envoyé: Mardi 16 Décembre 2025 10:48:39
Objet: [PATCH 1/2] net: phy: adin: enable configuration of the LP  Termination Register

From 9c68d9082a9c0550891f24c5902c1f0de15de949 Mon Sep 17 00:00:00 2001
From: Osose Itua <osose.itua@savoirfairelinux.com>
Date: Fri, 14 Nov 2025 17:00:14 -0500
Subject: [PATCH 1/2] net: phy: adin: enable configuration of the LP
 Termination Register

The ADIN1200/ADIN1300 provide a control bit that selects between normal
receive termination and the lowest common mode impedance for 100BASE-TX
operation. This behavior is controlled through the Low Power Termination
register (B_100_ZPTM_EN_DIMRX).

Bit 0 of this register enables normal termination when set (this is the
default), and selects the lowest common mode impedance when cleared.

Signed-off-by: Osose Itua <osose.itua@savoirfairelinux.com>
---
 drivers/net/phy/adin.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/drivers/net/phy/adin.c b/drivers/net/phy/adin.c
index 7fa713ca8d45..2969480a7be3 100644
--- a/drivers/net/phy/adin.c
+++ b/drivers/net/phy/adin.c
@@ -89,6 +89,9 @@
 #define ADIN1300_CLOCK_STOP_REG			0x9400
 #define ADIN1300_LPI_WAKE_ERR_CNT_REG		0xa000
 
+#define ADIN1300_B_100_ZPTM_DIMRX		0xB685
+#define ADIN1300_B_100_ZPTM_EN_DIMRX		BIT(0)
+
 #define ADIN1300_CDIAG_RUN			0xba1b
 #define   ADIN1300_CDIAG_RUN_EN			BIT(0)
 
@@ -522,6 +525,31 @@ static int adin_config_clk_out(struct phy_device *phydev)
 			      ADIN1300_GE_CLK_CFG_MASK, sel);
 }
 
+static int adin_config_zptm100(struct phy_device *phydev)
+{
+	struct device *dev = &phydev->mdio.dev;
+	u8 reg;
+	int rc;
+
+	if (!(device_property_read_bool(dev, "adi,low-cmode-impedance")))
+		return 0;
+
+	/* set to 0 to configure for lowest common-mode impedance */
+	rc = phy_write_mmd(phydev, MDIO_MMD_VEND1, ADIN1300_B_100_ZPTM_DIMRX, 0x0);
+	if (rc < 0)
+		return rc;
+
+	reg = phy_read_mmd(phydev, MDIO_MMD_VEND1, ADIN1300_B_100_ZPTM_DIMRX);
+	if (reg < 0)
+		return reg;
+
+	if (reg != 0x0)
+		phydev_err(phydev,
+			   "Lowest common-mode impedance configuration failed\n");
+
+	return 0;
+}
+
 static int adin_config_init(struct phy_device *phydev)
 {
 	int rc;
@@ -548,6 +576,10 @@ static int adin_config_init(struct phy_device *phydev)
 	if (rc < 0)
 		return rc;
 
+	rc = adin_config_zptm100(phydev);
+	if (rc < 0)
+		return rc;
+
 	phydev_dbg(phydev, "PHY is using mode '%s'\n",
 		   phy_modes(phydev->interface));

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

* Re: [External] : [PATCH 1/2] net: phy: adin: enable configuration of the LP Termination Register
  2025-12-16 15:48 [PATCH 1/2] net: phy: adin: enable configuration of the LP Termination Register Osose Itua
  2025-12-16 15:50 ` [PATCH 2/2] dt-bindings: net: adi,adin: document LP termination property Osose Itua
@ 2025-12-16 17:02 ` ALOK TIWARI
  1 sibling, 0 replies; 3+ messages in thread
From: ALOK TIWARI @ 2025-12-16 17:02 UTC (permalink / raw)
  To: Osose Itua, netdev
  Cc: devicetree, linux-kernel, Michael Hennerich,
	Jérôme Oufella



On 12/16/2025 9:18 PM, Osose Itua wrote:
>  From 9c68d9082a9c0550891f24c5902c1f0de15de949 Mon Sep 17 00:00:00 2001
> From: Osose Itua <osose.itua@savoirfairelinux.com>
> Date: Fri, 14 Nov 2025 17:00:14 -0500
> Subject: [PATCH 1/2] net: phy: adin: enable configuration of the LP
>   Termination Register

Double space between LP Termination.

> 
> The ADIN1200/ADIN1300 provide a control bit that selects between normal
> receive termination and the lowest common mode impedance for 100BASE-TX
> operation. This behavior is controlled through the Low Power Termination
> register (B_100_ZPTM_EN_DIMRX).
> 
> Bit 0 of this register enables normal termination when set (this is the
> default), and selects the lowest common mode impedance when cleared.
> 
> Signed-off-by: Osose Itua <osose.itua@savoirfairelinux.com>
> ---
>   drivers/net/phy/adin.c | 32 ++++++++++++++++++++++++++++++++
>   1 file changed, 32 insertions(+)
> 
> diff --git a/drivers/net/phy/adin.c b/drivers/net/phy/adin.c
> index 7fa713ca8d45..2969480a7be3 100644
> --- a/drivers/net/phy/adin.c
> +++ b/drivers/net/phy/adin.c
> @@ -89,6 +89,9 @@
>   #define ADIN1300_CLOCK_STOP_REG			0x9400
>   #define ADIN1300_LPI_WAKE_ERR_CNT_REG		0xa000
>   
> +#define ADIN1300_B_100_ZPTM_DIMRX		0xB685
> +#define ADIN1300_B_100_ZPTM_EN_DIMRX		BIT(0)
> +
>   #define ADIN1300_CDIAG_RUN			0xba1b
>   #define   ADIN1300_CDIAG_RUN_EN			BIT(0)
>   
> @@ -522,6 +525,31 @@ static int adin_config_clk_out(struct phy_device *phydev)
>   			      ADIN1300_GE_CLK_CFG_MASK, sel);
>   }
>   
> +static int adin_config_zptm100(struct phy_device *phydev)
> +{
> +	struct device *dev = &phydev->mdio.dev;
> +	u8 reg;
> +	int rc;
> +
> +	if (!(device_property_read_bool(dev, "adi,low-cmode-impedance")))
> +		return 0;
> +
> +	/* set to 0 to configure for lowest common-mode impedance */
> +	rc = phy_write_mmd(phydev, MDIO_MMD_VEND1, ADIN1300_B_100_ZPTM_DIMRX, 0x0);
> +	if (rc < 0)
> +		return rc;
> +
> +	reg = phy_read_mmd(phydev, MDIO_MMD_VEND1, ADIN1300_B_100_ZPTM_DIMRX);

phy_read_mmd return int, but u8 reg
reg < 0 will never be true

> +	if (reg < 0)
> +		return reg;
> +
> +	if (reg != 0x0)
> +		phydev_err(phydev,
> +			   "Lowest common-mode impedance configuration failed\n");
> +
> +	return 0;
> +}
> +
>   static int adin_config_init(struct phy_device *phydev)
>   {
>   	int rc;
> @@ -548,6 +576,10 @@ static int adin_config_init(struct phy_device *phydev)
>   	if (rc < 0)
>   		return rc;
>   
> +	rc = adin_config_zptm100(phydev);
> +	if (rc < 0)
> +		return rc;
> +
>   	phydev_dbg(phydev, "PHY is using mode '%s'\n",
>   		   phy_modes(phydev->interface));
>   
> 


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

end of thread, other threads:[~2025-12-16 17:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-16 15:48 [PATCH 1/2] net: phy: adin: enable configuration of the LP Termination Register Osose Itua
2025-12-16 15:50 ` [PATCH 2/2] dt-bindings: net: adi,adin: document LP termination property Osose Itua
2025-12-16 17:02 ` [External] : [PATCH 1/2] net: phy: adin: enable configuration of the LP Termination Register ALOK TIWARI

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).