0a33ab0093406c4bb4abe2003baebf3b8fd2806a
[openwrt/staging/svanheule.git] /
1 From db81ca153814475d7e07365d46a4d1134bd122e2 Mon Sep 17 00:00:00 2001
2 From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
3 Date: Tue, 16 Nov 2021 10:06:48 +0000
4 Subject: [PATCH] net: mtk_eth_soc: remove interface checks in mtk_validate()
5
6 As phylink checks the interface mode against the supported_interfaces
7 bitmap, we no longer need to validate the interface mode, nor handle
8 PHY_INTERFACE_MODE_NA in the validation function. Remove these to
9 simplify the implementation.
10
11 Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
12 Signed-off-by: David S. Miller <davem@davemloft.net>
13 ---
14 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 34 ---------------------
15 1 file changed, 34 deletions(-)
16
17 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
18 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
19 @@ -568,24 +568,8 @@ static void mtk_validate(struct phylink_
20 unsigned long *supported,
21 struct phylink_link_state *state)
22 {
23 - struct mtk_mac *mac = container_of(config, struct mtk_mac,
24 - phylink_config);
25 __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
26
27 - if (state->interface != PHY_INTERFACE_MODE_NA &&
28 - state->interface != PHY_INTERFACE_MODE_MII &&
29 - state->interface != PHY_INTERFACE_MODE_GMII &&
30 - !(MTK_HAS_CAPS(mac->hw->soc->caps, MTK_RGMII) &&
31 - phy_interface_mode_is_rgmii(state->interface)) &&
32 - !(MTK_HAS_CAPS(mac->hw->soc->caps, MTK_TRGMII) &&
33 - !mac->id && state->interface == PHY_INTERFACE_MODE_TRGMII) &&
34 - !(MTK_HAS_CAPS(mac->hw->soc->caps, MTK_SGMII) &&
35 - (state->interface == PHY_INTERFACE_MODE_SGMII ||
36 - phy_interface_mode_is_8023z(state->interface)))) {
37 - linkmode_zero(supported);
38 - return;
39 - }
40 -
41 phylink_set_port_modes(mask);
42 phylink_set(mask, Autoneg);
43
44 @@ -612,7 +596,6 @@ static void mtk_validate(struct phylink_
45 case PHY_INTERFACE_MODE_MII:
46 case PHY_INTERFACE_MODE_RMII:
47 case PHY_INTERFACE_MODE_REVMII:
48 - case PHY_INTERFACE_MODE_NA:
49 default:
50 phylink_set(mask, 10baseT_Half);
51 phylink_set(mask, 10baseT_Full);
52 @@ -621,23 +604,6 @@ static void mtk_validate(struct phylink_
53 break;
54 }
55
56 - if (state->interface == PHY_INTERFACE_MODE_NA) {
57 - if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_SGMII)) {
58 - phylink_set(mask, 1000baseT_Full);
59 - phylink_set(mask, 1000baseX_Full);
60 - phylink_set(mask, 2500baseX_Full);
61 - }
62 - if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_RGMII)) {
63 - phylink_set(mask, 1000baseT_Full);
64 - phylink_set(mask, 1000baseT_Half);
65 - phylink_set(mask, 1000baseX_Full);
66 - }
67 - if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_GEPHY)) {
68 - phylink_set(mask, 1000baseT_Full);
69 - phylink_set(mask, 1000baseT_Half);
70 - }
71 - }
72 -
73 phylink_set(mask, Pause);
74 phylink_set(mask, Asym_Pause);
75