public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] phy: adin: add readext and writeext support for mdio cmd
@ 2023-07-11 21:59 Nate Drude
  2023-07-11 23:11 ` Marek Vasut
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Nate Drude @ 2023-07-11 21:59 UTC (permalink / raw)
  To: Joe Hershberger, Ramon Fried, Michal Simek, Marek Vasut,
	Nate Drude, u-boot
  Cc: Eran Matityahu

The adin phy has extended registers that can be accessed using
adin_ext_read and adin_ext_write. These registers can be read directly
using the mdio command using readext and writext. For example:

     => mdio rx ethernet@428a0000 0xff23
     Reading from bus ethernet@428a0000
     PHY at address 0:
     65315 - 0xe01

Signed-off-by: Nate Drude <nate.d@variscite.com>
---
  drivers/net/phy/adin.c | 14 ++++++++++++++
  1 file changed, 14 insertions(+)

diff --git a/drivers/net/phy/adin.c b/drivers/net/phy/adin.c
index fb9f1e4c70d..d29210adffc 100644
--- a/drivers/net/phy/adin.c
+++ b/drivers/net/phy/adin.c
@@ -155,6 +155,18 @@ static int adin_ext_write(struct phy_device 
*phydev, const u32 regnum, const u16
  	return phy_write(phydev, MDIO_DEVAD_NONE, ADIN1300_EXT_REG_DATA, val);
  }

+static int adin_extread(struct phy_device *phydev, int addr, int devaddr,
+			       int regnum)
+{
+	return adin_ext_read(phydev, regnum);
+}
+
+static int adin_extwrite(struct phy_device *phydev, int addr,
+				int devaddr, int regnum, u16 val)
+{
+	return adin_ext_write(phydev, regnum, val);
+}
+
  static int adin_config_clk_out(struct phy_device *phydev)
  {
  	ofnode node = phy_get_ofnode(phydev);
@@ -260,4 +272,6 @@ U_BOOT_PHY_DRIVER(ADIN1300) = {
  	.config = adin1300_config,
  	.startup = genphy_startup,
  	.shutdown = genphy_shutdown,
+	.readext = adin_extread,
+	.writeext = adin_extwrite,
  };
-- 
2.40.1

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

end of thread, other threads:[~2023-07-27 20:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-11 21:59 [PATCH] phy: adin: add readext and writeext support for mdio cmd Nate Drude
2023-07-11 23:11 ` Marek Vasut
2023-07-12 20:48 ` [PATCH 1/2] phy: mxl-8611x: add driver for MaxLinear mxl-8611x PHYs Nate Drude
2023-07-12 20:50   ` [PATCH 2/2] dt-bindings: add device tree bindings for mxl-8611x PHY Nate Drude
2023-07-12 22:16     ` Marek Vasut
2023-07-13  0:12       ` Nate Drude
2023-07-13  0:22         ` Marek Vasut
2023-07-12 23:58     ` Nate Drude
2023-07-12 22:15   ` [PATCH 1/2] phy: mxl-8611x: add driver for MaxLinear mxl-8611x PHYs Marek Vasut
2023-07-13  0:14     ` Nate Drude
2023-07-27 20:46 ` [PATCH] phy: adin: add readext and writeext support for mdio cmd Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox