net: rswitch: Implement C22 to C45 access

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>
This commit is contained in:
Marek Vasut
2024-12-20 01:48:42 +01:00
parent 8bdc76b2c9
commit 678f7c8f56

View File

@@ -469,6 +469,8 @@ static int rswitch_mii_read_c45(struct mii_dev *miidev, int phyad, int devad, in
/* Access PHY register */ /* Access PHY register */
if (devad != MDIO_DEVAD_NONE) /* Definitelly C45 */ if (devad != MDIO_DEVAD_NONE) /* Definitelly C45 */
val = rswitch_mii_access_c45(etha, true, phyad, devad, regad, 0); 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 else
val = rswitch_mii_access_c22(etha, true, phyad, regad, 0); 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 */ /* Access PHY register */
if (devad != MDIO_DEVAD_NONE) /* Definitelly C45 */ if (devad != MDIO_DEVAD_NONE) /* Definitelly C45 */
rswitch_mii_access_c45(etha, false, phyad, devad, regad, data); 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 else
rswitch_mii_access_c22(etha, false, phyad, regad, data); rswitch_mii_access_c22(etha, false, phyad, regad, data);