Skip to content

Commit 8af2136

Browse files
hkallweitkuba-moo
authored andcommitted
net: phy: realtek: add helper RTL822X_VND2_C22_REG
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 <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 2e864f1 commit 8af2136

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

drivers/net/phy/realtek/realtek_main.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@
7979
/* RTL822X_VND2_XXXXX registers are only accessible when phydev->is_c45
8080
* is set, they cannot be accessed by C45-over-C22.
8181
*/
82-
#define RTL822X_VND2_GBCR 0xa412
83-
84-
#define RTL822X_VND2_GANLPAR 0xa414
82+
#define RTL822X_VND2_C22_REG(reg) (0xa400 + 2 * (reg))
8583

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

10171015
/* Vendor register as C45 has no standardized support for 1000BaseT */
1018-
ret = phy_modify_mmd_changed(phydev, MDIO_MMD_VEND2, RTL822X_VND2_GBCR,
1016+
ret = phy_modify_mmd_changed(phydev, MDIO_MMD_VEND2,
1017+
RTL822X_VND2_C22_REG(MII_CTRL1000),
10191018
ADVERTISE_1000FULL, val);
10201019
if (ret < 0)
10211020
return ret;
@@ -1032,7 +1031,7 @@ static int rtl822x_c45_read_status(struct phy_device *phydev)
10321031
/* Vendor register as C45 has no standardized support for 1000BaseT */
10331032
if (phydev->autoneg == AUTONEG_ENABLE && genphy_c45_aneg_done(phydev)) {
10341033
val = phy_read_mmd(phydev, MDIO_MMD_VEND2,
1035-
RTL822X_VND2_GANLPAR);
1034+
RTL822X_VND2_C22_REG(MII_STAT1000));
10361035
if (val < 0)
10371036
return val;
10381037
} else {

0 commit comments

Comments
 (0)