• Vladimir Oltean's avatar
    net: pcs: xpcs: there is only one PHY ID · a54a8b71
    Vladimir Oltean authored
    The xpcs driver has an apparently inadequate structure for the actual
    hardware it drives.
    
    These defines and the xpcs_probe() function would suggest that there is
    one PHY ID per supported PHY interface type, and the driver simply
    validates whether the mode it should operate in (the argument of
    xpcs_probe) matches what the hardware is capable of:
    
    	#define SYNOPSYS_XPCS_USXGMII_ID	0x7996ced0
    	#define SYNOPSYS_XPCS_10GKR_ID		0x7996ced0
    	#define SYNOPSYS_XPCS_XLGMII_ID		0x7996ced0
    	#define SYNOPSYS_XPCS_SGMII_ID		0x7996ced0
    	#define SYNOPSYS_XPCS_MASK		0xffffffff
    
    but that is not the case, because upon closer inspection, all the above
    4 PHY ID definitions are in fact equal.
    
    So it is the same XPCS that is compatible with all 4 sets of PHY
    interface types.
    
    This change introduces an array of struct xpcs_compat which is populated
    by the single struct xpcs_id instance. It also eliminates the bogus
    defines for multiple Synopsys XPCS PHY IDs and replaces them with a
    single XPCS_ID, which better reflects the way in which the hardware
    operates.
    
    Because we are touching this area of the code anyway, the new array of
    struct xpcs_compat, as well as the array of xpcs_id, have been moved
    towards the end of the file, since they are variable declarations not
    definitions. If whichever of struct xpcs_compat or struct xpcs_id need
    to gain a function pointer member in the future, it is easier to
    reference functions (no forward declarations needed) if we have the
    const variable declarations at the end of the file.
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    a54a8b71
pcs-xpcs.c 24.2 KB