Commit fe70fb74 authored by Russell King (Oracle)'s avatar Russell King (Oracle) Committed by David S. Miller

net: stmmac/xpcs: convert to pcs_validate()

stmmac explicitly calls the xpcs driver to validate the ethtool
linkmodes. This is no longer necessary as phylink now supports
validation through a PCS method. Convert both drivers to use this
new mechanism.

Tested-by: Wong Vee Khee <vee.khee.wong@linux.intel.com> # Intel EHL
Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d194923d
...@@ -940,7 +940,6 @@ static void stmmac_validate(struct phylink_config *config, ...@@ -940,7 +940,6 @@ static void stmmac_validate(struct phylink_config *config,
unsigned long *supported, unsigned long *supported,
struct phylink_link_state *state) struct phylink_link_state *state)
{ {
struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev));
__ETHTOOL_DECLARE_LINK_MODE_MASK(mac_supported) = { 0, }; __ETHTOOL_DECLARE_LINK_MODE_MASK(mac_supported) = { 0, };
/* This is very similar to phylink_generic_validate() except that /* This is very similar to phylink_generic_validate() except that
...@@ -958,10 +957,6 @@ static void stmmac_validate(struct phylink_config *config, ...@@ -958,10 +957,6 @@ static void stmmac_validate(struct phylink_config *config,
linkmode_and(supported, supported, mac_supported); linkmode_and(supported, supported, mac_supported);
linkmode_and(state->advertising, state->advertising, mac_supported); linkmode_and(state->advertising, state->advertising, mac_supported);
/* If PCS is supported, check which modes it supports. */
if (priv->hw->xpcs)
xpcs_validate(priv->hw->xpcs, supported, state);
} }
static void stmmac_mac_config(struct phylink_config *config, unsigned int mode, static void stmmac_mac_config(struct phylink_config *config, unsigned int mode,
......
...@@ -632,35 +632,29 @@ static void xpcs_resolve_pma(struct dw_xpcs *xpcs, ...@@ -632,35 +632,29 @@ static void xpcs_resolve_pma(struct dw_xpcs *xpcs,
} }
} }
void xpcs_validate(struct dw_xpcs *xpcs, unsigned long *supported, static int xpcs_validate(struct phylink_pcs *pcs, unsigned long *supported,
struct phylink_link_state *state) const struct phylink_link_state *state)
{ {
__ETHTOOL_DECLARE_LINK_MODE_MASK(xpcs_supported); __ETHTOOL_DECLARE_LINK_MODE_MASK(xpcs_supported) = { 0, };
const struct xpcs_compat *compat; const struct xpcs_compat *compat;
struct dw_xpcs *xpcs;
int i; int i;
/* phylink expects us to report all supported modes with xpcs = phylink_pcs_to_xpcs(pcs);
* PHY_INTERFACE_MODE_NA, just don't limit the supported and
* advertising masks and exit.
*/
if (state->interface == PHY_INTERFACE_MODE_NA)
return;
linkmode_zero(xpcs_supported);
compat = xpcs_find_compat(xpcs->id, state->interface); compat = xpcs_find_compat(xpcs->id, state->interface);
/* Populate the supported link modes for this /* Populate the supported link modes for this PHY interface type.
* PHY interface type * FIXME: what about the port modes and autoneg bit? This masks
* all those away.
*/ */
if (compat) if (compat)
for (i = 0; compat->supported[i] != __ETHTOOL_LINK_MODE_MASK_NBITS; i++) for (i = 0; compat->supported[i] != __ETHTOOL_LINK_MODE_MASK_NBITS; i++)
set_bit(compat->supported[i], xpcs_supported); set_bit(compat->supported[i], xpcs_supported);
linkmode_and(supported, supported, xpcs_supported); linkmode_and(supported, supported, xpcs_supported);
linkmode_and(state->advertising, state->advertising, xpcs_supported);
return 0;
} }
EXPORT_SYMBOL_GPL(xpcs_validate);
void xpcs_get_interfaces(struct dw_xpcs *xpcs, unsigned long *interfaces) void xpcs_get_interfaces(struct dw_xpcs *xpcs, unsigned long *interfaces)
{ {
...@@ -1120,6 +1114,7 @@ static const struct xpcs_id xpcs_id_list[] = { ...@@ -1120,6 +1114,7 @@ static const struct xpcs_id xpcs_id_list[] = {
}; };
static const struct phylink_pcs_ops xpcs_phylink_ops = { static const struct phylink_pcs_ops xpcs_phylink_ops = {
.pcs_validate = xpcs_validate,
.pcs_config = xpcs_config, .pcs_config = xpcs_config,
.pcs_get_state = xpcs_get_state, .pcs_get_state = xpcs_get_state,
.pcs_link_up = xpcs_link_up, .pcs_link_up = xpcs_link_up,
......
...@@ -31,8 +31,6 @@ void xpcs_link_up(struct phylink_pcs *pcs, unsigned int mode, ...@@ -31,8 +31,6 @@ void xpcs_link_up(struct phylink_pcs *pcs, unsigned int mode,
phy_interface_t interface, int speed, int duplex); phy_interface_t interface, int speed, int duplex);
int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface, int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface,
unsigned int mode); unsigned int mode);
void xpcs_validate(struct dw_xpcs *xpcs, unsigned long *supported,
struct phylink_link_state *state);
void xpcs_get_interfaces(struct dw_xpcs *xpcs, unsigned long *interfaces); void xpcs_get_interfaces(struct dw_xpcs *xpcs, unsigned long *interfaces);
int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns, int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns,
int enable); int enable);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment