• Vladimir Oltean's avatar
    net: dsa: sja1105: Fix broken fixed-link interfaces on user ports · af7cd036
    Vladimir Oltean authored
    PHYLIB and PHYLINK handle fixed-link interfaces differently. PHYLIB
    wraps them in a software PHY ("pseudo fixed link") phydev construct such
    that .adjust_link driver callbacks see an unified API. Whereas PHYLINK
    simply creates a phylink_link_state structure and passes it to
    .mac_config.
    
    At the time the driver was introduced, DSA was using PHYLIB for the
    CPU/cascade ports (the ones with no net devices) and PHYLINK for
    everything else.
    
    As explained below:
    
    commit aab9c406
    Author: Florian Fainelli <f.fainelli@gmail.com>
    Date:   Thu May 10 13:17:36 2018 -0700
    
      net: dsa: Plug in PHYLINK support
    
      Drivers that utilize fixed links for user-facing ports (e.g: bcm_sf2)
      will need to implement phylink_mac_ops from now on to preserve
      functionality, since PHYLINK *does not* create a phy_device instance
      for fixed links.
    
    In the above patch, DSA guards the .phylink_mac_config callback against
    a NULL phydev pointer.  Therefore, .adjust_link is not called in case of
    a fixed-link user port.
    
    This patch fixes the situation by converting the driver from using
    .adjust_link to .phylink_mac_config.  This can be done now in a unified
    fashion for both slave and CPU/cascade ports because DSA now uses
    PHYLINK for all ports.
    Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
    Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
    Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    af7cd036
sja1105_main.c 47.9 KB