net: ethernet: oa_tc6: Use the read_mms/write_mms functions for C45

Accessing PHY MMD devices requires control transactions to registers in
a memory map other than 0. Replace the current formatting of the
register addresses with the oa_tc6_{read,write}_register_mms()
functions. While we're here, introduce the mms variable to store the
memory map returned by oa_tc6_get_phy_c45_mms() instead of ret, in order
to improve the code readability.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Ciprian Regus <ciprian.regus@analog.com>
Link: https://patch.msgid.link/20260708-adin1140-driver-v5-8-4aca7b51a58b@analog.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
Ciprian Regus
2026-07-08 01:33:36 +03:00
committed by Paolo Abeni
parent 6ad2501794
commit 92ec8d69dd

View File

@@ -499,13 +499,14 @@ int oa_tc6_mdiobus_read_c45(struct mii_bus *bus, int addr, int devnum,
{
struct oa_tc6 *tc6 = bus->priv;
u32 regval;
int mms;
int ret;
ret = oa_tc6_get_phy_c45_mms(devnum);
if (ret < 0)
return ret;
mms = oa_tc6_get_phy_c45_mms(devnum);
if (mms < 0)
return mms;
ret = oa_tc6_read_register(tc6, (ret << 16) | regnum, &regval);
ret = oa_tc6_read_register_mms(tc6, mms, regnum, &regval);
if (ret)
return ret;
@@ -517,13 +518,13 @@ int oa_tc6_mdiobus_write_c45(struct mii_bus *bus, int addr, int devnum,
int regnum, u16 val)
{
struct oa_tc6 *tc6 = bus->priv;
int ret;
int mms;
ret = oa_tc6_get_phy_c45_mms(devnum);
if (ret < 0)
return ret;
mms = oa_tc6_get_phy_c45_mms(devnum);
if (mms < 0)
return mms;
return oa_tc6_write_register(tc6, (ret << 16) | regnum, val);
return oa_tc6_write_register_mms(tc6, mms, regnum, val);
}
EXPORT_SYMBOL_GPL(oa_tc6_mdiobus_write_c45);