Message ID | 20210317141410.32152-5-lukma@denx.de |
---|---|
State | Accepted |
Delegated to: | Ramon Fried |
Headers | show |
Series | Provide support for mv88e6020 Marvell switch | expand |
On Wed, Mar 17, 2021 at 4:14 PM Lukasz Majewski <lukma@denx.de> 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 <lukma@denx.de> > --- > > 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 <rfried.dev@gmail.com>
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);
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 <lukma@denx.de> --- drivers/net/phy/mv88e61xx.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)