diff mbox series

phy: adin: add readext and writeext support for mdio cmd

Message ID 05c50729-f70d-6cb0-bf8b-95008e6cce50@variscite.com
State Accepted
Delegated to: Ramon Fried
Headers show
Series phy: adin: add readext and writeext support for mdio cmd | expand

Commit Message

Nate Drude July 11, 2023, 9:59 p.m. UTC
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(+)

  	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,
  };

Comments

Marek Vasut July 11, 2023, 11:11 p.m. UTC | #1
On 7/11/23 23:59, Nate Drude wrote:
> 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>

Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Tom Rini July 27, 2023, 8:46 p.m. UTC | #2
On Tue, Jul 11, 2023 at 04:59:15PM -0500, Nate Drude wrote:

> 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>
> Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

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