Commit 6ebe414b authored by Arınç ÜNAL's avatar Arınç ÜNAL Committed by Paolo Abeni

net: dsa: mt7530: remove .mac_port_config for MT7988 and make it optional

For the switch on the MT7988 SoC, the mac_port_config member for ID_MT7988
in mt753x_table is not needed as the interfaces of all MACs are already
handled on mt7988_mac_port_get_caps().

Therefore, remove the mac_port_config member from ID_MT7988 in
mt753x_table. Before calling priv->info->mac_port_config(), if there's no
mac_port_config member in mt753x_table, exit mt753x_mac_config()
successfully.

Remove calling priv->info->mac_port_config() from the sanity check as the
sanity check requires a pointer to a mac_port_config function to be
non-NULL. This will fail for MT7988 as mac_port_config won't be a member of
its info table.
Co-developed-by: default avatarDaniel Golle <daniel@makrotopia.org>
Signed-off-by: default avatarDaniel Golle <daniel@makrotopia.org>
Signed-off-by: default avatarArınç ÜNAL <arinc.unal@arinc9.com>
Reviewed-by: default avatarVladimir Oltean <olteanv@gmail.com>
Reviewed-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 6702d60d
...@@ -2655,17 +2655,6 @@ static bool mt753x_is_mac_port(u32 port) ...@@ -2655,17 +2655,6 @@ static bool mt753x_is_mac_port(u32 port)
return (port == 5 || port == 6); return (port == 5 || port == 6);
} }
static int
mt7988_mac_config(struct dsa_switch *ds, int port, unsigned int mode,
phy_interface_t interface)
{
if (dsa_is_cpu_port(ds, port) &&
interface == PHY_INTERFACE_MODE_INTERNAL)
return 0;
return -EINVAL;
}
static int static int
mt7531_mac_config(struct dsa_switch *ds, int port, unsigned int mode, mt7531_mac_config(struct dsa_switch *ds, int port, unsigned int mode,
phy_interface_t interface) phy_interface_t interface)
...@@ -2706,6 +2695,9 @@ mt753x_mac_config(struct dsa_switch *ds, int port, unsigned int mode, ...@@ -2706,6 +2695,9 @@ mt753x_mac_config(struct dsa_switch *ds, int port, unsigned int mode,
{ {
struct mt7530_priv *priv = ds->priv; struct mt7530_priv *priv = ds->priv;
if (!priv->info->mac_port_config)
return 0;
return priv->info->mac_port_config(ds, port, mode, state->interface); return priv->info->mac_port_config(ds, port, mode, state->interface);
} }
...@@ -3169,7 +3161,6 @@ const struct mt753x_info mt753x_table[] = { ...@@ -3169,7 +3161,6 @@ const struct mt753x_info mt753x_table[] = {
.phy_write_c45 = mt7531_ind_c45_phy_write, .phy_write_c45 = mt7531_ind_c45_phy_write,
.cpu_port_config = mt7988_cpu_port_config, .cpu_port_config = mt7988_cpu_port_config,
.mac_port_get_caps = mt7988_mac_port_get_caps, .mac_port_get_caps = mt7988_mac_port_get_caps,
.mac_port_config = mt7988_mac_config,
}, },
}; };
EXPORT_SYMBOL_GPL(mt753x_table); EXPORT_SYMBOL_GPL(mt753x_table);
...@@ -3197,8 +3188,7 @@ mt7530_probe_common(struct mt7530_priv *priv) ...@@ -3197,8 +3188,7 @@ mt7530_probe_common(struct mt7530_priv *priv)
* properly. * properly.
*/ */
if (!priv->info->sw_setup || !priv->info->phy_read_c22 || if (!priv->info->sw_setup || !priv->info->phy_read_c22 ||
!priv->info->phy_write_c22 || !priv->info->mac_port_get_caps || !priv->info->phy_write_c22 || !priv->info->mac_port_get_caps)
!priv->info->mac_port_config)
return -EINVAL; return -EINVAL;
priv->id = priv->info->id; priv->id = priv->info->id;
......
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