diff mbox series

[3/3] net: rswitch: Implement C22 to C45 access

Message ID 20241220005007.169383-3-marek.vasut+renesas@mailbox.org
State Accepted
Commit 678f7c8f560775e0ac33300f54281dfcaa2e525a
Delegated to: Marek Vasut
Headers show
Series [1/3] net: rswitch: Fold MPSM C45 setting into rswitch_mii_access_c45() | expand

Commit Message

Marek Vasut Dec. 20, 2024, 12:48 a.m. UTC
Add support for mapping C22 register access to C45-only PHYs.
This is mainly useful for 'mii info' command, which performs
C22 only access to determine PHY ID and link state and does
not work well with this driver so far.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de
---
 drivers/net/rswitch.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/drivers/net/rswitch.c b/drivers/net/rswitch.c
index df0c3864b59..06be8b64882 100644
--- a/drivers/net/rswitch.c
+++ b/drivers/net/rswitch.c
@@ -469,6 +469,8 @@  static int rswitch_mii_read_c45(struct mii_dev *miidev, int phyad, int devad, in
 	/* Access PHY register */
 	if (devad != MDIO_DEVAD_NONE)	/* Definitelly C45 */
 		val = rswitch_mii_access_c45(etha, true, phyad, devad, regad, 0);
+	else if (etha->phydev->is_c45)	/* C22 access to C45 PHY */
+		val = rswitch_mii_access_c45(etha, true, phyad, 1, regad, 0);
 	else
 		val = rswitch_mii_access_c22(etha, true, phyad, regad, 0);
 
@@ -500,6 +502,8 @@  int rswitch_mii_write_c45(struct mii_dev *miidev, int phyad, int devad, int rega
 	/* Access PHY register */
 	if (devad != MDIO_DEVAD_NONE)	/* Definitelly C45 */
 		rswitch_mii_access_c45(etha, false, phyad, devad, regad, data);
+	else if (etha->phydev->is_c45)	/* C22 access to C45 PHY */
+		rswitch_mii_access_c45(etha, false, phyad, 1, regad, data);
 	else
 		rswitch_mii_access_c22(etha, false, phyad, regad, data);