• Marek Behún's avatar
    net: marvell: mvpp2: Fix wrong SerDes reconfiguration order · bb7bbb6e
    Marek Behún authored
    Commit bfe301eb ("net: mvpp2: convert to use
    mac_prepare()/mac_finish()") introduced a bug wherein it leaves the MAC
    RESET register asserted after mac_finish(), due to wrong order of
    function calls.
    
    Before it was:
      .mac_config()
        mvpp22_mode_reconfigure()
          assert reset
        mvpp2_xlg_config()
          deassert reset
    
    Now it is:
      .mac_prepare()
      .mac_config()
        mvpp2_xlg_config()
          deassert reset
      .mac_finish()
        mvpp2_xlg_config()
          assert reset
    
    Obviously this is wrong.
    
    This bug is triggered when phylink tries to change the PHY interface
    mode from a GMAC mode (sgmii, 1000base-x, 2500base-x) to XLG mode
    (10gbase-r, xaui). The XLG mode does not work since reset is left
    asserted. Only after
      ifconfig down && ifconfig up
    is called will the XLG mode work.
    
    Move the call to mvpp22_mode_reconfigure() to .mac_prepare()
    implementation. Since some of the subsequent functions need to know
    whether the interface is being changed, we unfortunately also need to
    pass around the new interface mode before setting port->phy_interface.
    
    Fixes: bfe301eb ("net: mvpp2: convert to use mac_prepare()/mac_finish()")
    Signed-off-by: default avatarMarek Behún <kabel@kernel.org>
    Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    bb7bbb6e
mvpp2_main.c 208 KB