[PATCH v1 4/6] net: mv88e61xx: Directly access the switch chip
The mv88e6020 is accessed in a direct way (i.e. with direct read and write to mdio bus). The only necessary indirection is required when accessing its PHY registers. Signed-off-by: Lukasz Majewski Reviewed-by: Ramon Fried --- drivers/net/phy/mv88e61xx.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/net/phy/mv88e61xx.c b/drivers/net/phy/mv88e61xx.c index c19c3dfa8b6d..c9917953f3d7 100644 --- a/drivers/net/phy/mv88e61xx.c +++ b/drivers/net/phy/mv88e61xx.c @@ -261,8 +261,11 @@ static int mv88e61xx_reg_read(struct phy_device *phydev, int dev, int reg) int smi_addr = priv->smi_addr; int res; - /* In single-chip mode, the device can be addressed directly */ - if (smi_addr == 0) + /* +* In single-chip or dual-chip (like mv88e6020) mode, the device can +* be addressed directly. +*/ + if (smi_addr == 0 || priv->direct_access) return mdio_bus->read(mdio_bus, dev, MDIO_DEVAD_NONE, reg); /* Wait for the bus to become free */ @@ -298,11 +301,13 @@ static int mv88e61xx_reg_write(struct phy_device *phydev, int dev, int reg, int smi_addr = priv->smi_addr; int res; - /* In single-chip mode, the device can be addressed directly */ - if (smi_addr == 0) { + /* +* In single-chip or dual-chip (like mv88e6020) mode, the device can +* be addressed directly. +*/ + if (smi_addr == 0 || priv->direct_access) return mdio_bus->write(mdio_bus, dev, MDIO_DEVAD_NONE, reg, val); - } /* Wait for the bus to become free */ res = mv88e61xx_smi_wait(mdio_bus, smi_addr); -- 2.30.2
Re: [PATCH v1 4/6] net: mv88e61xx: Directly access the switch chip
On Wed, Mar 17, 2021 at 4:14 PM Lukasz Majewski wrote: > > The mv88e6020 is accessed in a direct way (i.e. with direct read and > write to mdio bus). The only necessary indirection is required when > accessing its PHY registers. > > Signed-off-by: Lukasz Majewski > --- > > drivers/net/phy/mv88e61xx.c | 15 ++- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/phy/mv88e61xx.c b/drivers/net/phy/mv88e61xx.c > index d8116530700d..3d846b89fd12 100644 > --- a/drivers/net/phy/mv88e61xx.c > +++ b/drivers/net/phy/mv88e61xx.c > @@ -269,8 +269,11 @@ static int mv88e61xx_reg_read(struct phy_device *phydev, > int dev, int reg) > int smi_addr = priv->smi_addr; > int res; > > - /* In single-chip mode, the device can be addressed directly */ > - if (smi_addr == 0) > + /* > +* In single-chip or dual-chip (like mv88e6020) mode, the device can > +* be addressed directly. > +*/ > + if (smi_addr == 0 || priv->direct_access) > return mdio_bus->read(mdio_bus, dev, MDIO_DEVAD_NONE, reg); > > /* Wait for the bus to become free */ > @@ -306,11 +309,13 @@ static int mv88e61xx_reg_write(struct phy_device > *phydev, int dev, int reg, > int smi_addr = priv->smi_addr; > int res; > > - /* In single-chip mode, the device can be addressed directly */ > - if (smi_addr == 0) { > + /* > +* In single-chip or dual-chip (like mv88e6020) mode, the device can > +* be addressed directly. > +*/ > + if (smi_addr == 0 || priv->direct_access) > return mdio_bus->write(mdio_bus, dev, MDIO_DEVAD_NONE, reg, > val); > - } > > /* Wait for the bus to become free */ > res = mv88e61xx_smi_wait(mdio_bus, smi_addr); > -- > 2.20.1 > Reviewed-by: Ramon Fried
[PATCH v1 4/6] net: mv88e61xx: Directly access the switch chip
The mv88e6020 is accessed in a direct way (i.e. with direct read and write to mdio bus). The only necessary indirection is required when accessing its PHY registers. Signed-off-by: Lukasz Majewski --- drivers/net/phy/mv88e61xx.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/net/phy/mv88e61xx.c b/drivers/net/phy/mv88e61xx.c index d8116530700d..3d846b89fd12 100644 --- a/drivers/net/phy/mv88e61xx.c +++ b/drivers/net/phy/mv88e61xx.c @@ -269,8 +269,11 @@ static int mv88e61xx_reg_read(struct phy_device *phydev, int dev, int reg) int smi_addr = priv->smi_addr; int res; - /* In single-chip mode, the device can be addressed directly */ - if (smi_addr == 0) + /* +* In single-chip or dual-chip (like mv88e6020) mode, the device can +* be addressed directly. +*/ + if (smi_addr == 0 || priv->direct_access) return mdio_bus->read(mdio_bus, dev, MDIO_DEVAD_NONE, reg); /* Wait for the bus to become free */ @@ -306,11 +309,13 @@ static int mv88e61xx_reg_write(struct phy_device *phydev, int dev, int reg, int smi_addr = priv->smi_addr; int res; - /* In single-chip mode, the device can be addressed directly */ - if (smi_addr == 0) { + /* +* In single-chip or dual-chip (like mv88e6020) mode, the device can +* be addressed directly. +*/ + if (smi_addr == 0 || priv->direct_access) return mdio_bus->write(mdio_bus, dev, MDIO_DEVAD_NONE, reg, val); - } /* Wait for the bus to become free */ res = mv88e61xx_smi_wait(mdio_bus, smi_addr); -- 2.20.1