Skip to content

Commit

Permalink
net: phy: realtek: add helper RTL822X_VND2_C22_REG
Browse files Browse the repository at this point in the history
C22 register space is mapped to 0xa400 in MMD VEND2 register space.
Add a helper to access mapped C22 registers.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/6344277b-c5c7-449b-ac89-d5425306ca76@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Heiner Kallweit authored and Jakub Kicinski committed Feb 18, 2025
1 parent 2e864f1 commit 8af2136
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/net/phy/realtek/realtek_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@
/* RTL822X_VND2_XXXXX registers are only accessible when phydev->is_c45
* is set, they cannot be accessed by C45-over-C22.
*/
#define RTL822X_VND2_GBCR 0xa412

#define RTL822X_VND2_GANLPAR 0xa414
#define RTL822X_VND2_C22_REG(reg) (0xa400 + 2 * (reg))

#define RTL8366RB_POWER_SAVE 0x15
#define RTL8366RB_POWER_SAVE_ON BIT(12)
Expand Down Expand Up @@ -1015,7 +1013,8 @@ static int rtl822x_c45_config_aneg(struct phy_device *phydev)
val = linkmode_adv_to_mii_ctrl1000_t(phydev->advertising);

/* Vendor register as C45 has no standardized support for 1000BaseT */
ret = phy_modify_mmd_changed(phydev, MDIO_MMD_VEND2, RTL822X_VND2_GBCR,
ret = phy_modify_mmd_changed(phydev, MDIO_MMD_VEND2,
RTL822X_VND2_C22_REG(MII_CTRL1000),
ADVERTISE_1000FULL, val);
if (ret < 0)
return ret;
Expand All @@ -1032,7 +1031,7 @@ static int rtl822x_c45_read_status(struct phy_device *phydev)
/* Vendor register as C45 has no standardized support for 1000BaseT */
if (phydev->autoneg == AUTONEG_ENABLE && genphy_c45_aneg_done(phydev)) {
val = phy_read_mmd(phydev, MDIO_MMD_VEND2,
RTL822X_VND2_GANLPAR);
RTL822X_VND2_C22_REG(MII_STAT1000));
if (val < 0)
return val;
} else {
Expand Down

0 comments on commit 8af2136

Please sign in to comment.