[PATCH v1 4/6] net: mv88e61xx: Directly access the switch chip
Lukasz Majewski
lukma at denx.de
Thu Jun 1 12:00:03 CEST 2023
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 at denx.de>
Reviewed-by: Ramon Fried <rfried.dev at gmail.com>
---
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
More information about the U-Boot
mailing list