net: pcs: xpcs: add CL37 1000BASE-X AN support
authorOng Boon Leong <boon.leong.ong@intel.com>
Wed, 15 Jun 2022 08:39:06 +0000 (16:39 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 17 Jun 2022 09:55:35 +0000 (10:55 +0100)
commitb47aec885bcd672ebca2108a8b7e9ce3e3982775
treed70aeb53e3777395265ad5de6a9a3447ea0c7425
parentc82386310d957260948828b4236acc5bda819352
net: pcs: xpcs: add CL37 1000BASE-X AN support

For CL37 1000BASE-X AN, DW xPCS does not support C22 method but offers
C45 vendor-specific MII MMD for programming.

We also add the ability to disable Autoneg (through ethtool for certain
network switch that supports 1000BASE-X (1000Mbps and Full-Duplex) but
not Autoneg capability.

v4: Fixes to comment from Russell King. Thanks!
    https://patchwork.kernel.org/comment/24894239/
    Make xpcs_modify_changed() as private, change to use
    mdiodev_modify_changed() for cleaner code.

v3: Fixes to issues spotted by Russell King. Thanks!
    https://patchwork.kernel.org/comment/24890210/
    Use phylink_mii_c22_pcs_decode_state(), remove unnecessary
    interrupt clearing and skip speed & duplex setting if AN
    is enabled.

v2: Fixes to issues spotted by Russell King in v1. Thanks!
    https://patchwork.kernel.org/comment/24826650/
    Use phylink_mii_c22_pcs_encode_advertisement() and implement
    C45 MII ADV handling since IP only support C45 access.

Tested-by: Emilio Riva <emilio.riva@ericsson.com>
Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/pcs/pcs-xpcs.c
drivers/net/pcs/pcs-xpcs.h
include/linux/pcs/pcs-xpcs.h