1 From 3c1d788a62dc648d1846049b66119ebb69dedd52 Mon Sep 17 00:00:00 2001
2 From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
3 Date: Mon, 11 Apr 2022 10:46:17 +0100
4 Subject: [PATCH 05/13] net: dsa: mt7530: only indicate linkmodes that can be
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
10 Now that mt7530 is not using the basex helper, it becomes unnecessary to
11 indicate support for both 1000baseX and 2500baseX when one of the 803.3z
12 PHY interface modes is being selected. Ensure that the driver indicates
13 only those linkmodes that can actually be supported by the PHY interface
16 Tested-by: Marek BehĂșn <kabel@kernel.org>
17 Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
18 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
20 drivers/net/dsa/mt7530.c | 12 ++++++++----
21 drivers/net/dsa/mt7530.h | 1 +
22 2 files changed, 9 insertions(+), 4 deletions(-)
24 --- a/drivers/net/dsa/mt7530.c
25 +++ b/drivers/net/dsa/mt7530.c
26 @@ -2540,12 +2540,13 @@ static int mt7531_rgmii_setup(struct mt7
29 static void mt7531_sgmii_validate(struct mt7530_priv *priv, int port,
30 + phy_interface_t interface,
31 unsigned long *supported)
33 /* Port5 supports ethier RGMII or SGMII.
34 * Port6 supports SGMII only.
37 + if (port == 6 && interface == PHY_INTERFACE_MODE_2500BASEX) {
38 phylink_set(supported, 2500baseX_Full);
39 phylink_set(supported, 2500baseT_Full);
41 @@ -2918,16 +2919,18 @@ static void mt753x_phylink_get_caps(stru
44 mt7530_mac_port_validate(struct dsa_switch *ds, int port,
45 + phy_interface_t interface,
46 unsigned long *supported)
50 static void mt7531_mac_port_validate(struct dsa_switch *ds, int port,
51 + phy_interface_t interface,
52 unsigned long *supported)
54 struct mt7530_priv *priv = ds->priv;
56 - mt7531_sgmii_validate(priv, port, supported);
57 + mt7531_sgmii_validate(priv, port, interface, supported);
61 @@ -2950,12 +2953,13 @@ mt753x_phylink_validate(struct dsa_switc
64 /* This switch only supports 1G full-duplex. */
65 - if (state->interface != PHY_INTERFACE_MODE_MII) {
66 + if (state->interface != PHY_INTERFACE_MODE_MII &&
67 + state->interface != PHY_INTERFACE_MODE_2500BASEX) {
68 phylink_set(mask, 1000baseT_Full);
69 phylink_set(mask, 1000baseX_Full);
72 - priv->info->mac_port_validate(ds, port, mask);
73 + priv->info->mac_port_validate(ds, port, state->interface, mask);
75 phylink_set(mask, Pause);
76 phylink_set(mask, Asym_Pause);
77 --- a/drivers/net/dsa/mt7530.h
78 +++ b/drivers/net/dsa/mt7530.h
79 @@ -772,6 +772,7 @@ struct mt753x_info {
80 void (*mac_port_get_caps)(struct dsa_switch *ds, int port,
81 struct phylink_config *config);
82 void (*mac_port_validate)(struct dsa_switch *ds, int port,
83 + phy_interface_t interface,
84 unsigned long *supported);
85 int (*mac_port_get_state)(struct dsa_switch *ds, int port,
86 struct phylink_link_state *state);