31a8ca3ea86f084ace0a10fe91db146ddf611980
[openwrt/staging/svanheule.git] /
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Thu, 27 Oct 2022 23:39:52 +0200
3 Subject: [PATCH] net: ethernet: mtk_eth_soc: compile out netsys v2 code
4 on mt7621
5
6 Avoid some branches in the hot path on low-end devices with limited CPU power,
7 and reduce code size
8
9 Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 ---
11
12 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
13 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
14 @@ -921,7 +921,13 @@ enum mkt_eth_capabilities {
15 #define MTK_MUX_GMAC12_TO_GEPHY_SGMII \
16 (MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII | MTK_MUX)
17
18 -#define MTK_HAS_CAPS(caps, _x) (((caps) & (_x)) == (_x))
19 +#ifdef CONFIG_SOC_MT7621
20 +#define MTK_CAP_MASK MTK_NETSYS_V2
21 +#else
22 +#define MTK_CAP_MASK 0
23 +#endif
24 +
25 +#define MTK_HAS_CAPS(caps, _x) (((caps) & (_x) & ~(MTK_CAP_MASK)) == (_x))
26
27 #define MT7621_CAPS (MTK_GMAC1_RGMII | MTK_GMAC1_TRGMII | \
28 MTK_GMAC2_RGMII | MTK_SHARED_INT | \