The Marvell PPv2 implementation of the Phylink mac_config helper
disables and enables the port, as the link mode can trigger
reconfiguration of the serdes lanes. This patch helps not disabling the
port every time mac_config is called but only when needed, which is an
improvement as the Phylink state machine does call the function every
second.

Signed-off-by: Antoine Tenart <antoine.ten...@bootlin.com>
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c 
b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 8faa842dc17c..d5a103dd1610 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -4670,9 +4670,10 @@ static void mvpp2_mac_config(struct net_device *dev, 
unsigned int mode,
                return;
        }
 
-       /* Make sure the port is disabled when reconfiguring the mode */
-       mvpp2_port_disable(port);
        if (change_interface) {
+               /* Make sure the port is disabled when reconfiguring the mode */
+               mvpp2_port_disable(port);
+
                mvpp22_gop_mask_irq(port);
 
                if (port->priv->hw_version == MVPP22) {
@@ -4682,6 +4683,8 @@ static void mvpp2_mac_config(struct net_device *dev, 
unsigned int mode,
                        phy_power_off(port->comphy);
                        mvpp22_mode_reconfigure(port);
                }
+
+               mvpp2_port_enable(port);
        }
 
        /* mac (re)configuration */
@@ -4697,8 +4700,6 @@ static void mvpp2_mac_config(struct net_device *dev, 
unsigned int mode,
 
        if (change_interface)
                mvpp22_gop_unmask_irq(port);
-
-       mvpp2_port_enable(port);
 }
 
 static void mvpp2_mac_link_up(struct net_device *dev, unsigned int mode,
-- 
2.20.1

Reply via email to