Message ID | 20210317141410.32152-3-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: > > After this change PHY ports are able to pass packets between them (and > also to CPU port). > > The Kconfig variable - CONFIG_MV88E61XX_PHY_PORTS - is used to get the > PHY ports of the switch and generate proper mask. > > Signed-off-by: Lukasz Majewski <lukma@denx.de> > --- > > drivers/net/phy/mv88e61xx.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/phy/mv88e61xx.c b/drivers/net/phy/mv88e61xx.c > index 69a1dd8f1859..14074c0b82fb 100644 > --- a/drivers/net/phy/mv88e61xx.c > +++ b/drivers/net/phy/mv88e61xx.c > @@ -873,14 +873,19 @@ static int mv88e61xx_phy_setup(struct phy_device *phydev, u8 phy) > > static int mv88e61xx_phy_config_port(struct phy_device *phydev, u8 phy) > { > + struct mv88e61xx_phy_priv *priv = phydev->priv; > + u16 port_mask; > int val; > > val = mv88e61xx_port_enable(phydev, phy); > if (val < 0) > return val; > > - val = mv88e61xx_port_set_vlan(phydev, phy, > - 1 << CONFIG_MV88E61XX_CPU_PORT); > + port_mask = PORT_MASK(priv->port_count) & CONFIG_MV88E61XX_PHY_PORTS; > + port_mask &= ~(1 << phy); > + port_mask |= (1 << CONFIG_MV88E61XX_CPU_PORT); > + > + val = mv88e61xx_port_set_vlan(phydev, phy, port_mask); > if (val < 0) > return val; > > -- > 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 69a1dd8f1859..14074c0b82fb 100644 --- a/drivers/net/phy/mv88e61xx.c +++ b/drivers/net/phy/mv88e61xx.c @@ -873,14 +873,19 @@ static int mv88e61xx_phy_setup(struct phy_device *phydev, u8 phy) static int mv88e61xx_phy_config_port(struct phy_device *phydev, u8 phy) { + struct mv88e61xx_phy_priv *priv = phydev->priv; + u16 port_mask; int val; val = mv88e61xx_port_enable(phydev, phy); if (val < 0) return val; - val = mv88e61xx_port_set_vlan(phydev, phy, - 1 << CONFIG_MV88E61XX_CPU_PORT); + port_mask = PORT_MASK(priv->port_count) & CONFIG_MV88E61XX_PHY_PORTS; + port_mask &= ~(1 << phy); + port_mask |= (1 << CONFIG_MV88E61XX_CPU_PORT); + + val = mv88e61xx_port_set_vlan(phydev, phy, port_mask); if (val < 0) return val;
After this change PHY ports are able to pass packets between them (and also to CPU port). The Kconfig variable - CONFIG_MV88E61XX_PHY_PORTS - is used to get the PHY ports of the switch and generate proper mask. Signed-off-by: Lukasz Majewski <lukma@denx.de> --- drivers/net/phy/mv88e61xx.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)