devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 2/2] net: phy: adin: add support for inverting the link status output signal
@ 2023-05-30  5:36 Atsushi Nemoto
  2023-05-31  6:37 ` Horatiu Vultur
  0 siblings, 1 reply; 3+ messages in thread
From: Atsushi Nemoto @ 2023-05-30  5:36 UTC (permalink / raw)
  To: netdev, devicetree; +Cc: Michael Hennerich, Alexandru Tachici

The ADIN1200/ADIN1300 supports inverting the link status output signal
on the LINK_ST pin.

Add support for selecting this feature via device-tree properties.

Signed-off-by: Atsushi Nemoto <atsushi.nemoto@sord.co.jp>
---
 drivers/net/phy/adin.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/phy/adin.c b/drivers/net/phy/adin.c
index 134637584a83..331f9574328f 100644
--- a/drivers/net/phy/adin.c
+++ b/drivers/net/phy/adin.c
@@ -140,6 +140,9 @@
 #define ADIN1300_RMII_20_BITS			0x0004
 #define ADIN1300_RMII_24_BITS			0x0005
 
+#define ADIN1300_GE_LNK_STAT_INV_REG		0xff3c
+#define   ADIN1300_GE_LNK_STAT_INV_EN		BIT(0)
+
 /**
  * struct adin_cfg_reg_map - map a config value to aregister value
  * @cfg:	value in device configuration
@@ -495,6 +498,15 @@ static int adin_config_init(struct phy_device *phydev)
 	if (rc < 0)
 		return rc;
 
+	if (device_property_read_bool(&phydev->mdio.dev,
+				      "adi,link-stat-inv")) {
+		rc = phy_set_bits_mmd(phydev, MDIO_MMD_VEND1,
+				      ADIN1300_GE_LNK_STAT_INV_REG,
+				      ADIN1300_GE_LNK_STAT_INV_EN);
+		if (rc < 0)
+			return rc;
+	}
+
 	phydev_dbg(phydev, "PHY is using mode '%s'\n",
 		   phy_modes(phydev->interface));
 
-- 
2.30.2



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

end of thread, other threads:[~2023-05-31 14:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-30  5:36 [PATCH net-next 2/2] net: phy: adin: add support for inverting the link status output signal Atsushi Nemoto
2023-05-31  6:37 ` Horatiu Vultur
2023-05-31 14:52   ` Atsushi Nemoto

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).