mediatek: fix PWM fan on BPi-R4
[openwrt/openwrt.git] / target / linux / generic / pending-6.6 / 732-00-net-ethernet-mtk_eth_soc-compile-out-netsys-v2-code-.patch
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 @@ -1326,6 +1326,22 @@ struct mtk_mac {
15 /* the struct describing the SoC. these are declared in the soc_xyz.c files */
16 extern const struct of_device_id of_mtk_match[];
17
18 +#ifdef CONFIG_SOC_MT7621
19 +static inline bool mtk_is_netsys_v1(struct mtk_eth *eth)
20 +{
21 + return true;
22 +}
23 +
24 +static inline bool mtk_is_netsys_v2_or_greater(struct mtk_eth *eth)
25 +{
26 + return false;
27 +}
28 +
29 +static inline bool mtk_is_netsys_v3_or_greater(struct mtk_eth *eth)
30 +{
31 + return false;
32 +}
33 +#else
34 static inline bool mtk_is_netsys_v1(struct mtk_eth *eth)
35 {
36 return eth->soc->version == 1;
37 @@ -1340,6 +1356,7 @@ static inline bool mtk_is_netsys_v3_or_g
38 {
39 return eth->soc->version > 2;
40 }
41 +#endif
42
43 static inline struct mtk_foe_entry *
44 mtk_foe_get_entry(struct mtk_ppe *ppe, u16 hash)