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

net: dsa: realtek: convert to phylink_generic_validate()

Populate the supported interfaces and MAC capabilities for the Realtek
rtl8365 DSA switch and remove the old validate implementation to allow
DSA to use phylink_generic_validate() for this switch driver.
Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent eace555b
...@@ -952,39 +952,17 @@ static bool rtl8365mb_phy_mode_supported(struct dsa_switch *ds, int port, ...@@ -952,39 +952,17 @@ static bool rtl8365mb_phy_mode_supported(struct dsa_switch *ds, int port,
return false; return false;
} }
static void rtl8365mb_phylink_validate(struct dsa_switch *ds, int port, static void rtl8365mb_phylink_get_caps(struct dsa_switch *ds, int port,
unsigned long *supported, struct phylink_config *config)
struct phylink_link_state *state)
{ {
struct realtek_priv *priv = ds->priv; if (dsa_is_user_port(ds, port))
__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0 }; __set_bit(PHY_INTERFACE_MODE_INTERNAL,
config->supported_interfaces);
/* include/linux/phylink.h says: else if (dsa_is_cpu_port(ds, port))
* When @state->interface is %PHY_INTERFACE_MODE_NA, phylink phy_interface_set_rgmii(config->supported_interfaces);
* expects the MAC driver to return all supported link modes.
*/ config->mac_capabilities = MAC_SYM_PAUSE | MAC_ASYM_PAUSE |
if (state->interface != PHY_INTERFACE_MODE_NA && MAC_10 | MAC_100 | MAC_1000FD;
!rtl8365mb_phy_mode_supported(ds, port, state->interface)) {
dev_err(priv->dev, "phy mode %s is unsupported on port %d\n",
phy_modes(state->interface), port);
linkmode_zero(supported);
return;
}
phylink_set_port_modes(mask);
phylink_set(mask, Autoneg);
phylink_set(mask, Pause);
phylink_set(mask, Asym_Pause);
phylink_set(mask, 10baseT_Half);
phylink_set(mask, 10baseT_Full);
phylink_set(mask, 100baseT_Half);
phylink_set(mask, 100baseT_Full);
phylink_set(mask, 1000baseT_Full);
linkmode_and(supported, supported, mask);
linkmode_and(state->advertising, state->advertising, mask);
} }
static void rtl8365mb_phylink_mac_config(struct dsa_switch *ds, int port, static void rtl8365mb_phylink_mac_config(struct dsa_switch *ds, int port,
...@@ -2020,7 +1998,7 @@ static const struct dsa_switch_ops rtl8365mb_switch_ops_smi = { ...@@ -2020,7 +1998,7 @@ static const struct dsa_switch_ops rtl8365mb_switch_ops_smi = {
.get_tag_protocol = rtl8365mb_get_tag_protocol, .get_tag_protocol = rtl8365mb_get_tag_protocol,
.setup = rtl8365mb_setup, .setup = rtl8365mb_setup,
.teardown = rtl8365mb_teardown, .teardown = rtl8365mb_teardown,
.phylink_validate = rtl8365mb_phylink_validate, .phylink_get_caps = rtl8365mb_phylink_get_caps,
.phylink_mac_config = rtl8365mb_phylink_mac_config, .phylink_mac_config = rtl8365mb_phylink_mac_config,
.phylink_mac_link_down = rtl8365mb_phylink_mac_link_down, .phylink_mac_link_down = rtl8365mb_phylink_mac_link_down,
.phylink_mac_link_up = rtl8365mb_phylink_mac_link_up, .phylink_mac_link_up = rtl8365mb_phylink_mac_link_up,
...@@ -2038,7 +2016,7 @@ static const struct dsa_switch_ops rtl8365mb_switch_ops_mdio = { ...@@ -2038,7 +2016,7 @@ static const struct dsa_switch_ops rtl8365mb_switch_ops_mdio = {
.get_tag_protocol = rtl8365mb_get_tag_protocol, .get_tag_protocol = rtl8365mb_get_tag_protocol,
.setup = rtl8365mb_setup, .setup = rtl8365mb_setup,
.teardown = rtl8365mb_teardown, .teardown = rtl8365mb_teardown,
.phylink_validate = rtl8365mb_phylink_validate, .phylink_get_caps = rtl8365mb_phylink_get_caps,
.phylink_mac_config = rtl8365mb_phylink_mac_config, .phylink_mac_config = rtl8365mb_phylink_mac_config,
.phylink_mac_link_down = rtl8365mb_phylink_mac_link_down, .phylink_mac_link_down = rtl8365mb_phylink_mac_link_down,
.phylink_mac_link_up = rtl8365mb_phylink_mac_link_up, .phylink_mac_link_up = rtl8365mb_phylink_mac_link_up,
......
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