]> git.baikalelectronics.ru Git - kernel.git/commit
net: phylink: Add helpers for c22 registers without MDIO
authorSean Anderson <sean.anderson@seco.com>
Fri, 19 Nov 2021 15:58:09 +0000 (10:58 -0500)
committerDavid S. Miller <davem@davemloft.net>
Mon, 22 Nov 2021 13:15:33 +0000 (13:15 +0000)
commitfb0f6cbd35985452ca74c28245e5bd8e1637cf0b
tree2ca01813920412033f73399836589b5cd417abd9
parentd94117829b0f9666cdb16023cd4231be90bcd2d0
net: phylink: Add helpers for c22 registers without MDIO

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: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phylink.c
include/linux/phylink.h