• Sean Anderson's avatar
    net: phylink: Add helpers for c22 registers without MDIO · 291dcae3
    Sean Anderson authored
    Some devices expose memory-mapped c22-compliant PHYs. Because these
    devices do not have an MDIO bus, we cannot use the existing helpers.
    Refactor the existing helpers to allow supplying the values for c22
    registers directly, instead of using MDIO to access them. Only get_state
    and set_advertisement are converted, since they contain the most complex
    logic. Because set_advertisement is never actually used outside
    phylink_mii_c22_pcs_config, move the MDIO-writing part into that
    function. Because some modes do not need the advertisement register set
    at all, we use -EINVAL for this purpose.
    
    Additionally, a new function phylink_pcs_enable_an is provided to
    determine whether to enable autonegotiation.
    Signed-off-by: default avatarSean Anderson <sean.anderson@seco.com>
    Reviewed-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    291dcae3
phylink.c 84.8 KB