From a38b6efbc1ab1b3ebd1c8a1d11050a7889dcc16f Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 4 Sep 2020 12:31:17 +0200 Subject: [PATCH 01/11] mediatek: enable kernel PCIe ASPM support, refresh kernel config Improves performance on PCIe devices Signed-off-by: Felix Fietkau --- target/linux/mediatek/mt7622/config-5.4 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/target/linux/mediatek/mt7622/config-5.4 b/target/linux/mediatek/mt7622/config-5.4 index 71c5a9588f..e037736055 100755 --- a/target/linux/mediatek/mt7622/config-5.4 +++ b/target/linux/mediatek/mt7622/config-5.4 @@ -228,6 +228,7 @@ CONFIG_DCACHE_WORD_ACCESS=y CONFIG_DEBUG_MISC=y CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y +CONFIG_DIMLIB=y CONFIG_DMADEVICES=y CONFIG_DMATEST=y CONFIG_DMA_DIRECT_REMAP=y @@ -345,7 +346,6 @@ CONFIG_HAVE_SYSCALL_TRACEPOINTS=y CONFIG_HAVE_UID16=y CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y CONFIG_HOLES_IN_ZONE=y -# CONFIG_HW_NAT is not set CONFIG_HZ=250 CONFIG_HZ_250=y CONFIG_ICPLUS_PHY=y @@ -391,7 +391,6 @@ CONFIG_MAGIC_SYSRQ=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MEDIATEK_MT6577_AUXADC=y -# CONFIG_MEDIATEK_NETSYS_V2 is not set CONFIG_MEDIATEK_WATCHDOG=y CONFIG_MEDIA_SUPPORT=y CONFIG_MEMFD_CREATE=y @@ -436,6 +435,7 @@ CONFIG_NET_DSA=y CONFIG_NET_DSA_MT7530=y CONFIG_NET_DSA_TAG_MTK=y CONFIG_NET_FLOW_LIMIT=y +CONFIG_NET_MEDIATEK_OFFLOAD=y CONFIG_NET_MEDIATEK_SOC=y CONFIG_NET_SWITCHDEV=y CONFIG_NET_VENDOR_MEDIATEK=y @@ -459,8 +459,17 @@ CONFIG_OLD_SIGSUSPEND3=y CONFIG_PADATA=y CONFIG_PARTITION_PERCPU=y CONFIG_PCI=y +CONFIG_PCIEAER=y +CONFIG_PCIEASPM=y +# CONFIG_PCIEASPM_DEBUG is not set +# CONFIG_PCIEASPM_DEFAULT is not set +CONFIG_PCIEASPM_PERFORMANCE=y +# CONFIG_PCIEASPM_POWERSAVE is not set +# CONFIG_PCIEASPM_POWER_SUPERSAVE is not set +CONFIG_PCIEPORTBUS=y # CONFIG_PCIE_AL is not set CONFIG_PCIE_MEDIATEK=y +CONFIG_PCIE_PME=y CONFIG_PCI_DEBUG=y CONFIG_PCI_DOMAINS=y CONFIG_PCI_DOMAINS_GENERIC=y From acf17334966c0e405011ca898068a3170eba658f Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 26 Aug 2020 12:30:12 +0200 Subject: [PATCH 02/11] mac80211: add preliminary support for enabling 802.11ax in config No advanced features are configurable yet, just basic enabling of HE modes Signed-off-by: Felix Fietkau --- .../files/lib/netifd/wireless/mac80211.sh | 49 ++++++++++++++----- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index 823c68170a..17095b7205 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -121,8 +121,8 @@ mac80211_hostapd_setup_base() { ieee80211n=1 ht_capab= case "$htmode" in - VHT20|HT20) ;; - HT40*|VHT40|VHT80|VHT160) + VHT20|HT20|HE20) ;; + HT40*|VHT40|VHT80|VHT160|HE40|HE80|HE160) case "$hwmode" in a) case "$(( ($channel / 4) % 2 ))" in @@ -192,19 +192,21 @@ mac80211_hostapd_setup_base() { # 802.11ac enable_ac=0 + vht_oper_chwidth=0 + vht_center_seg0= + idx="$channel" case "$htmode" in - VHT20) enable_ac=1;; - VHT40) + VHT20|HE20) enable_ac=1;; + VHT40|HE40) case "$(( ($channel / 4) % 2 ))" in 1) idx=$(($channel + 2));; 0) idx=$(($channel - 2));; esac enable_ac=1 - append base_cfg "vht_oper_chwidth=0" "$N" - append base_cfg "vht_oper_centr_freq_seg0_idx=$idx" "$N" + vht_center_seg0=$idx ;; - VHT80) + VHT80|HE80) case "$(( ($channel / 4) % 4 ))" in 1) idx=$(($channel + 6));; 2) idx=$(($channel + 2));; @@ -212,19 +214,20 @@ mac80211_hostapd_setup_base() { 0) idx=$(($channel - 6));; esac enable_ac=1 - append base_cfg "vht_oper_chwidth=1" "$N" - append base_cfg "vht_oper_centr_freq_seg0_idx=$idx" "$N" + vht_oper_chwidth=1 + vht_center_seg0=$idx ;; - VHT160) + VHT160|HE160) case "$channel" in 36|40|44|48|52|56|60|64) idx=50;; 100|104|108|112|116|120|124|128) idx=114;; esac enable_ac=1 - append base_cfg "vht_oper_chwidth=2" "$N" - append base_cfg "vht_oper_centr_freq_seg0_idx=$idx" "$N" + vht_oper_chwidth=2 + vht_center_seg0=$idx ;; esac + [ "$hwmode" = "a" ] || enable_ac=0 if [ "$enable_ac" != "0" ]; then json_get_vars \ @@ -253,6 +256,9 @@ mac80211_hostapd_setup_base() { vht_cap="$(($vht_cap | $cap))" done + append base_cfg "vht_oper_chwidth=$vht_oper_chwidth" "$N" + append base_cfg "vht_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N" + cap_rx_stbc=$((($vht_cap >> 8) & 7)) [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc" vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))" @@ -323,6 +329,25 @@ mac80211_hostapd_setup_base() { [ -n "$vht_capab" ] && append base_cfg "vht_capab=$vht_capab" "$N" fi + # 802.11ax + enable_ax=0 + case "$htmode" in + HE*) enable_ax=1 ;; + esac + + if [ "$enable_ax" != "0" ]; then + append base_cfg "ieee80211ax=1" "$N" + [ "$hwmode" = "a" ] && { + append base_cfg "he_oper_chwidth=$vht_oper_chwidth" "$N" + append base_cfg "he_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N" + } + append base_cfg "he_default_pe_duration=4" "$N" + append base_cfg "he_rts_threshold=1023" "$N" + append base_cfg "he_su_beamformer=1" "$N" + append base_cfg "he_su_beamformee=1" "$N" + append base_cfg "he_mu_beamformer=1023" "$N" + fi + hostapd_prepare_device_config "$hostapd_conf_file" nl80211 cat >> "$hostapd_conf_file" < Date: Tue, 25 Aug 2020 10:18:52 +0200 Subject: [PATCH 03/11] mediatek: disable packet steering by default mt76 now spreads the load over multiple CPUs more smoothly, processing ethernet packets should be faster running on one core Signed-off-by: Felix Fietkau --- target/linux/mediatek/base-files/etc/uci-defaults/99-net-ps | 5 ----- 1 file changed, 5 deletions(-) delete mode 100755 target/linux/mediatek/base-files/etc/uci-defaults/99-net-ps diff --git a/target/linux/mediatek/base-files/etc/uci-defaults/99-net-ps b/target/linux/mediatek/base-files/etc/uci-defaults/99-net-ps deleted file mode 100755 index 15e9ef32a3..0000000000 --- a/target/linux/mediatek/base-files/etc/uci-defaults/99-net-ps +++ /dev/null @@ -1,5 +0,0 @@ -uci -q get network.globals.packet_steering >/dev/null || { - uci set network.globals='globals' - uci set network.globals.packet_steering=1 - uci commit network -} From 7081b1704e978414cf8e9ea10bf77be9787aa338 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 4 Sep 2020 18:30:07 +0200 Subject: [PATCH 04/11] mediatek/ramips: add patch to avoid unnecessary rearming of interrupts Signed-off-by: Felix Fietkau --- ...mtk_eth_soc-avoid-rearming-interrupt-if.pa | 35 +++++++++++++++++++ .../mediatek/patches-5.4/0999-hnat.patch | 10 +++--- .../1000-eth-gdm-config-backport.patch | 10 +++--- 3 files changed, 45 insertions(+), 10 deletions(-) create mode 100644 target/linux/generic/pending-5.4/770-11-net-ethernet-mtk_eth_soc-avoid-rearming-interrupt-if.pa diff --git a/target/linux/generic/pending-5.4/770-11-net-ethernet-mtk_eth_soc-avoid-rearming-interrupt-if.pa b/target/linux/generic/pending-5.4/770-11-net-ethernet-mtk_eth_soc-avoid-rearming-interrupt-if.pa new file mode 100644 index 0000000000..c8d17aefa8 --- /dev/null +++ b/target/linux/generic/pending-5.4/770-11-net-ethernet-mtk_eth_soc-avoid-rearming-interrupt-if.pa @@ -0,0 +1,35 @@ +From: Felix Fietkau +Date: Fri, 4 Sep 2020 18:14:05 +0200 +Subject: [PATCH] net: ethernet: mtk_eth_soc: avoid rearming interrupt if + napi_complete returns false + +Reduces unnecessary interrupts + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -1512,8 +1512,8 @@ static int mtk_napi_tx(struct napi_struc + if (status & MTK_TX_DONE_INT) + return budget; + +- napi_complete(napi); +- mtk_tx_irq_enable(eth, MTK_TX_DONE_INT); ++ if (napi_complete(napi)) ++ mtk_tx_irq_enable(eth, MTK_TX_DONE_INT); + + return tx_done; + } +@@ -1546,8 +1546,9 @@ poll_again: + remain_budget -= rx_done; + goto poll_again; + } +- napi_complete(napi); +- mtk_rx_irq_enable(eth, MTK_RX_DONE_INT); ++ ++ if (napi_complete(napi)) ++ mtk_rx_irq_enable(eth, MTK_RX_DONE_INT); + + return rx_done + budget - remain_budget; + } diff --git a/target/linux/mediatek/patches-5.4/0999-hnat.patch b/target/linux/mediatek/patches-5.4/0999-hnat.patch index 30294e02a1..cd0ad54c7e 100644 --- a/target/linux/mediatek/patches-5.4/0999-hnat.patch +++ b/target/linux/mediatek/patches-5.4/0999-hnat.patch @@ -166,7 +166,7 @@ skip_rx: ring->data[idx] = new_data; -@@ -2250,6 +2260,9 @@ static int mtk_open(struct net_device *d +@@ -2251,6 +2261,9 @@ static int mtk_open(struct net_device *d mtk_tx_irq_enable(eth, MTK_TX_DONE_INT); mtk_rx_irq_enable(eth, MTK_RX_DONE_INT); refcount_set(ð->dma_refcnt, 1); @@ -176,7 +176,7 @@ } else refcount_inc(ð->dma_refcnt); -@@ -2311,6 +2324,9 @@ static int mtk_stop(struct net_device *d +@@ -2312,6 +2325,9 @@ static int mtk_stop(struct net_device *d mtk_dma_free(eth); @@ -186,7 +186,7 @@ return 0; } -@@ -2824,6 +2840,27 @@ static int mtk_set_rxnfc(struct net_devi +@@ -2825,6 +2841,27 @@ static int mtk_set_rxnfc(struct net_devi return ret; } @@ -214,7 +214,7 @@ static const struct ethtool_ops mtk_ethtool_ops = { .get_link_ksettings = mtk_get_link_ksettings, .set_link_ksettings = mtk_set_link_ksettings, -@@ -2855,6 +2892,9 @@ static const struct net_device_ops mtk_n +@@ -2856,6 +2893,9 @@ static const struct net_device_ops mtk_n #ifdef CONFIG_NET_POLL_CONTROLLER .ndo_poll_controller = mtk_poll_controller, #endif @@ -224,7 +224,7 @@ }; static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) -@@ -3197,6 +3237,7 @@ static const struct mtk_soc_data mt7622_ +@@ -3198,6 +3238,7 @@ static const struct mtk_soc_data mt7622_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7622_CLKS_BITMAP, .required_pctl = false, diff --git a/target/linux/mediatek/patches-5.4/1000-eth-gdm-config-backport.patch b/target/linux/mediatek/patches-5.4/1000-eth-gdm-config-backport.patch index a9b1424f95..38addd36ed 100644 --- a/target/linux/mediatek/patches-5.4/1000-eth-gdm-config-backport.patch +++ b/target/linux/mediatek/patches-5.4/1000-eth-gdm-config-backport.patch @@ -1,6 +1,6 @@ --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -2235,6 +2235,31 @@ static int mtk_start_dma(struct mtk_eth +@@ -2236,6 +2236,31 @@ static int mtk_start_dma(struct mtk_eth return 0; } @@ -32,7 +32,7 @@ static int mtk_open(struct net_device *dev) { struct mtk_mac *mac = netdev_priv(dev); -@@ -2255,6 +2280,8 @@ static int mtk_open(struct net_device *d +@@ -2256,6 +2281,8 @@ static int mtk_open(struct net_device *d if (err) return err; @@ -41,7 +41,7 @@ napi_enable(ð->tx_napi); napi_enable(ð->rx_napi); mtk_tx_irq_enable(eth, MTK_TX_DONE_INT); -@@ -2310,6 +2337,8 @@ static int mtk_stop(struct net_device *d +@@ -2311,6 +2338,8 @@ static int mtk_stop(struct net_device *d if (!refcount_dec_and_test(ð->dma_refcnt)) return 0; @@ -50,7 +50,7 @@ mtk_tx_irq_disable(eth, MTK_TX_DONE_INT); mtk_rx_irq_disable(eth, MTK_RX_DONE_INT); napi_disable(ð->tx_napi); -@@ -2493,8 +2522,6 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -2494,8 +2523,6 @@ static int mtk_hw_init(struct mtk_eth *e /* disable delay and normal interrupt */ mtk_tx_irq_disable(eth, ~0); mtk_rx_irq_disable(eth, ~0); @@ -59,7 +59,7 @@ /* FE int grouping */ mtk_w32(eth, MTK_TX_DONE_INT, MTK_PDMA_INT_GRP1); -@@ -2503,19 +2530,6 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -2504,19 +2531,6 @@ static int mtk_hw_init(struct mtk_eth *e mtk_w32(eth, MTK_RX_DONE_INT, MTK_QDMA_INT_GRP2); mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP); From 44fe9e6f84ee25e04391e467a177e57c783d1975 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 4 Sep 2020 19:41:33 +0200 Subject: [PATCH 05/11] mediatek: fix an irq handling issue Signed-off-by: Felix Fietkau --- ...diatek-fix-clearing-interrupt-status.patch | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 target/linux/mediatek/patches-5.4/1010-pcie-mediatek-fix-clearing-interrupt-status.patch diff --git a/target/linux/mediatek/patches-5.4/1010-pcie-mediatek-fix-clearing-interrupt-status.patch b/target/linux/mediatek/patches-5.4/1010-pcie-mediatek-fix-clearing-interrupt-status.patch new file mode 100644 index 0000000000..d3ef78dc72 --- /dev/null +++ b/target/linux/mediatek/patches-5.4/1010-pcie-mediatek-fix-clearing-interrupt-status.patch @@ -0,0 +1,24 @@ +From: Felix Fietkau +Date: Fri, 4 Sep 2020 18:33:27 +0200 +Subject: [PATCH] pcie-mediatek: fix clearing interrupt status + +Clearing the status needs to happen after running the handler, otherwise +we will get an extra spurious interrupt after the cause has been cleared + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/pci/controller/pcie-mediatek.c ++++ b/drivers/pci/controller/pcie-mediatek.c +@@ -616,10 +616,10 @@ static void mtk_pcie_intr_handler(struct + if (status & INTX_MASK) { + for_each_set_bit_from(bit, &status, PCI_NUM_INTX + INTX_SHIFT) { + /* Clear the INTx */ +- writel(1 << bit, port->base + PCIE_INT_STATUS); + virq = irq_find_mapping(port->irq_domain, + bit - INTX_SHIFT); + generic_handle_irq(virq); ++ writel(1 << bit, port->base + PCIE_INT_STATUS); + } + } + From 920d975cab67dff2f7720c4af24fe7e03ff9019a Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 4 Sep 2020 19:41:46 +0200 Subject: [PATCH 06/11] mediatek: enable coherent DMA for ethernet and PCI Improves performance by eliminating the need for extra cache flushes Signed-off-by: Felix Fietkau --- ..._eth_soc-add-support-for-coherent-DM.patch | 83 ++++++++++++++ ...ediatek-add-support-for-coherent-DMA.patch | 108 ++++++++++++++++++ 2 files changed, 191 insertions(+) create mode 100644 target/linux/mediatek/patches-5.4/1011-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch create mode 100644 target/linux/mediatek/patches-5.4/1012-pci-pcie-mediatek-add-support-for-coherent-DMA.patch diff --git a/target/linux/mediatek/patches-5.4/1011-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch b/target/linux/mediatek/patches-5.4/1011-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch new file mode 100644 index 0000000000..1c2e08aca2 --- /dev/null +++ b/target/linux/mediatek/patches-5.4/1011-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch @@ -0,0 +1,83 @@ +From: Felix Fietkau +Date: Fri, 4 Sep 2020 18:36:06 +0200 +Subject: [PATCH] net: ethernet: mtk_eth_soc: add support for coherent DMA + +It improves performance by eliminating the need for a cache flush on rx and tx + +Signed-off-by: Felix Fietkau +--- + +--- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi +@@ -357,7 +357,7 @@ + }; + + cci_control2: slave-if@5000 { +- compatible = "arm,cci-400-ctrl-if"; ++ compatible = "arm,cci-400-ctrl-if", "syscon"; + interface-type = "ace"; + reg = <0x5000 0x1000>; + }; +@@ -965,6 +965,8 @@ + power-domains = <&scpsys MT7622_POWER_DOMAIN_ETHSYS>; + mediatek,ethsys = <ðsys>; + mediatek,sgmiisys = <&sgmiisys>; ++ mediatek,cci-control = <&cci_control2>; ++ dma-coherent; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -9,6 +9,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -2472,6 +2473,12 @@ static int mtk_hw_init(struct mtk_eth *e + if (ret) + goto err_disable_pm; + ++ if (of_dma_is_coherent(eth->dev->of_node)) { ++ u32 mask = ETHSYS_DMA_AG_MAP_PDMA | ETHSYS_DMA_AG_MAP_QDMA; ++ ++ regmap_update_bits(eth->ethsys, ETHSYS_DMA_AG_MAP, mask, mask); ++ } ++ + if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) { + ret = device_reset(eth->dev); + if (ret) { +@@ -3074,6 +3081,16 @@ static int mtk_probe(struct platform_dev + } + } + ++ if (of_dma_is_coherent(pdev->dev.of_node)) { ++ struct regmap *cci; ++ ++ cci = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, ++ "mediatek,cci-control"); ++ /* enable CPU/bus coherency */ ++ if (!IS_ERR(cci)) ++ regmap_write(cci, 0, 3); ++ } ++ + if (MTK_HAS_CAPS(eth->soc->caps, MTK_SGMII)) { + eth->sgmii = devm_kzalloc(eth->dev, sizeof(*eth->sgmii), + GFP_KERNEL); +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -425,6 +425,11 @@ + #define RSTCTRL_FE BIT(6) + #define RSTCTRL_PPE BIT(31) + ++/* ethernet dma channel agent map */ ++#define ETHSYS_DMA_AG_MAP 0x408 ++#define ETHSYS_DMA_AG_MAP_PDMA BIT(0) ++#define ETHSYS_DMA_AG_MAP_QDMA BIT(1) ++ + /* SGMII subsystem config registers */ + /* Register to auto-negotiation restart */ + #define SGMSYS_PCS_CONTROL_1 0x0 diff --git a/target/linux/mediatek/patches-5.4/1012-pci-pcie-mediatek-add-support-for-coherent-DMA.patch b/target/linux/mediatek/patches-5.4/1012-pci-pcie-mediatek-add-support-for-coherent-DMA.patch new file mode 100644 index 0000000000..5f55fe0c03 --- /dev/null +++ b/target/linux/mediatek/patches-5.4/1012-pci-pcie-mediatek-add-support-for-coherent-DMA.patch @@ -0,0 +1,108 @@ +From: Felix Fietkau +Date: Fri, 4 Sep 2020 18:42:42 +0200 +Subject: [PATCH] pci: pcie-mediatek: add support for coherent DMA + +It improves performance by eliminating the need for a cache flush for DMA on +attached devices + +Signed-off-by: Felix Fietkau +--- + +--- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi +@@ -801,6 +801,8 @@ + reg = <0 0x1a143000 0 0x1000>; + reg-names = "port0"; + mediatek,pcie-cfg = <&pciecfg>; ++ mediatek,hifsys = <&hifsys>; ++ mediatek,cci-control = <&cci_control2>; + #address-cells = <3>; + #size-cells = <2>; + interrupts = ; +@@ -818,6 +820,7 @@ + bus-range = <0x00 0xff>; + ranges = <0x82000000 0 0x20000000 0x0 0x20000000 0 0x8000000>; + status = "disabled"; ++ dma-coherent; + + slot0: pcie@0,0 { + reg = <0x0000 0 0 0 0>; +@@ -844,6 +847,8 @@ + reg = <0 0x1a145000 0 0x1000>; + reg-names = "port1"; + mediatek,pcie-cfg = <&pciecfg>; ++ mediatek,hifsys = <&hifsys>; ++ mediatek,cci-control = <&cci_control2>; + #address-cells = <3>; + #size-cells = <2>; + interrupts = ; +@@ -862,6 +867,7 @@ + bus-range = <0x00 0xff>; + ranges = <0x82000000 0 0x28000000 0x0 0x28000000 0 0x8000000>; + status = "disabled"; ++ dma-coherent; + + slot1: pcie@1,0 { + reg = <0x0800 0 0 0 0>; +@@ -921,6 +927,11 @@ + }; + }; + ++ hifsys: syscon@1af00000 { ++ compatible = "mediatek,mt7622-hifsys", "syscon"; ++ reg = <0 0x1af00000 0 0x70>; ++ }; ++ + ethsys: syscon@1b000000 { + compatible = "mediatek,mt7622-ethsys", + "syscon"; +--- a/drivers/pci/controller/pcie-mediatek.c ++++ b/drivers/pci/controller/pcie-mediatek.c +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -139,6 +140,11 @@ + #define PCIE_LINK_STATUS_V2 0x804 + #define PCIE_PORT_LINKUP_V2 BIT(10) + ++/* DMA channel mapping */ ++#define HIFSYS_DMA_AG_MAP 0x008 ++#define HIFSYS_DMA_AG_MAP_PCIE0 BIT(0) ++#define HIFSYS_DMA_AG_MAP_PCIE1 BIT(1) ++ + struct mtk_pcie_port; + + /** +@@ -1068,6 +1074,27 @@ static int mtk_pcie_setup(struct mtk_pci + } + } + ++ if (of_dma_is_coherent(node)) { ++ struct regmap *con; ++ u32 mask; ++ ++ con = syscon_regmap_lookup_by_phandle(node, ++ "mediatek,cci-control"); ++ /* enable CPU/bus coherency */ ++ if (!IS_ERR(con)) ++ regmap_write(con, 0, 3); ++ ++ con = syscon_regmap_lookup_by_phandle(node, ++ "mediatek,hifsys"); ++ if (IS_ERR(con)) { ++ dev_err(dev, "missing hifsys node\n"); ++ return PTR_ERR(con); ++ } ++ ++ mask = HIFSYS_DMA_AG_MAP_PCIE0 | HIFSYS_DMA_AG_MAP_PCIE1; ++ regmap_update_bits(con, HIFSYS_DMA_AG_MAP, mask, mask); ++ } ++ + for_each_available_child_of_node(node, child) { + int slot; + From 7716a4309207addc5f359a4b5ab22f0104996028 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 5 Sep 2020 11:19:11 +0200 Subject: [PATCH 07/11] build: fix extreme build system slowdown caused by SOURCE_DATE_EPOCH changes Adding inline shell invocations in per-target variables causes them to be executed over and over again, which causes a significant slowdown. Fix this by evaluating it only once per package directory Signed-off-by: Felix Fietkau --- include/package-ipkg.mk | 4 ++-- include/package.mk | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk index 0b7a561edc..62cda5b936 100644 --- a/include/package-ipkg.mk +++ b/include/package-ipkg.mk @@ -181,7 +181,7 @@ $$(call addfield,Depends,$$(Package/$(1)/DEPENDS) )$$(call addfield,LicenseFiles,$(LICENSE_FILES) )$$(call addfield,Section,$(SECTION) )$$(call addfield,Require-User,$(USERID) -)$$(call addfield,SourceDateEpoch,$(shell $(TOPDIR)/scripts/get_source_date_epoch.sh $(SOURCE)) +)$$(call addfield,SourceDateEpoch,$(PKG_SOURCE_DATE_EPOCH) )$(if $(PKG_CPE_ID),CPE-ID: $(PKG_CPE_ID) )$(if $(filter hold,$(PKG_FLAGS)),Status: unknown hold not-installed )$(if $(filter essential,$(PKG_FLAGS)),Essential: yes @@ -193,7 +193,7 @@ $(_endef) $$(IPKG_$(1)) : export CONTROL=$$(Package/$(1)/CONTROL) $$(IPKG_$(1)) : export DESCRIPTION=$$(Package/$(1)/description) $$(IPKG_$(1)) : export PATH=$$(TARGET_PATH_PKG) - $$(IPKG_$(1)) : export PKG_SOURCE_DATE_EPOCH=$(shell $(TOPDIR)/scripts/get_source_date_epoch.sh $(SOURCE)) + $$(IPKG_$(1)) : export PKG_SOURCE_DATE_EPOCH:=$(PKG_SOURCE_DATE_EPOCH) $(PKG_INFO_DIR)/$(1).provides $$(IPKG_$(1)): $(STAMP_BUILT) $(INCLUDE_DIR)/package-ipkg.mk @rm -rf $$(IDIR_$(1)); \ $$(call remove_ipkg_files,$(1),$$(call opkg_package_files,$(call gen_ipkg_wildcard,$(1)))) diff --git a/include/package.mk b/include/package.mk index a93d6b78f3..50bd838180 100644 --- a/include/package.mk +++ b/include/package.mk @@ -19,6 +19,8 @@ PKG_IREMAP ?= 1 MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j)) +PKG_SOURCE_DATE_EPOCH:=$(if $(DUMP),,$(shell $(TOPDIR)/scripts/get_source_date_epoch.sh $(CURDIR))) + ifeq ($(strip $(PKG_BUILD_PARALLEL)),0) PKG_JOBS?=-j1 else From 7f676b5ed6a2bcd6786a0fcb6a6db3ddfeedf795 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sat, 5 Sep 2020 12:58:07 +0200 Subject: [PATCH 08/11] firewall: bump to latest HEAD 8c2f9fa fw3: zones: limit zone names to 11 bytes 78d52a2 options: fix parsing of boolean attributes Signed-off-by: David Bauer --- package/network/config/firewall/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/config/firewall/Makefile b/package/network/config/firewall/Makefile index 105d4a0451..bda9267130 100644 --- a/package/network/config/firewall/Makefile +++ b/package/network/config/firewall/Makefile @@ -13,9 +13,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firewall3.git -PKG_SOURCE_DATE:=2020-07-25 -PKG_SOURCE_VERSION:=e9b90dfac2225927c035f6a76277b850c282dc9a -PKG_MIRROR_HASH:=917f662d48a766f86ee61a83e13a61688d6eca3647dd4aca1973b1fa1ea64fec +PKG_SOURCE_DATE:=2020-09-05 +PKG_SOURCE_VERSION:=8c2f9fad9ca644af911e0d4113a890c3c84aa738 +PKG_MIRROR_HASH:=424a7906ed8957de3e85046248608dec7146078946161a517f8a5af9f536bad1 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC From 04e0e4167e1a66bc3b744634d65fb52d4a6954fe Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Sat, 5 Sep 2020 19:12:28 +0200 Subject: [PATCH 09/11] ppp: update to latest git HEAD af30be0 Fix setting prefix for IPv6 link-local addresss 0314df4 Disable asking password again when prompt program returns 128 Signed-off-by: Hans Dedecker --- package/network/services/ppp/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/services/ppp/Makefile b/package/network/services/ppp/Makefile index de73fdbe00..73e690f54e 100644 --- a/package/network/services/ppp/Makefile +++ b/package/network/services/ppp/Makefile @@ -13,9 +13,9 @@ PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/paulusmack/ppp -PKG_SOURCE_DATE:=2020-08-07 -PKG_SOURCE_VERSION:=045169401601639b9163e1df00f868a0a49131ce -PKG_MIRROR_HASH:=0ceb3e649d191c1fe225be580135aa181d9d3ba3689503691c4c9469ddac64a3 +PKG_SOURCE_DATE:=2020-09-04 +PKG_SOURCE_VERSION:=fc0a76c87a123e65b4922008257f5878251f9323 +PKG_MIRROR_HASH:=c3ad8dc7922f628b4b33405e60b4add4d7c8b76ca6086a1782774c96da9eecba PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-4-Clause PKG_CPE_ID:=cpe:/a:samba:ppp From a487e67cbc12025345f4af55f60af54f1d087005 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sun, 30 Aug 2020 04:42:54 +0200 Subject: [PATCH 10/11] base-files: support label-property-less in get_dt_leds The LED's "label" property has been deprecated in upstream by: |commit c5d18dd6b64e09dd6984bda9bdd55160af537a8c |Author: Jacek Anaszewski |Date: Sun Jun 9 20:19:04 2019 +0200 | | dt-bindings: leds: Add properties for LED name construction | | Introduce dedicated properties for conveying information about | LED function and color. Mark old "label" property as deprecated. | | Additionally function-enumerator property is being provided | for the cases when neither function nor color can be used | for LED differentiation. in order to be somewhat prepared, this patch adds a fallback as a last resort to make the current led code work by falling back to the node-name as the "label". Signed-off-by: Christian Lamparter --- package/base-files/Makefile | 2 +- package/base-files/files/lib/functions/leds.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 7eb3ac1868..2419849a44 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk include $(INCLUDE_DIR)/feeds.mk PKG_NAME:=base-files -PKG_RELEASE:=227 +PKG_RELEASE:=228 PKG_FLAGS:=nonshared PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/ diff --git a/package/base-files/files/lib/functions/leds.sh b/package/base-files/files/lib/functions/leds.sh index 43b2fe02ed..14baeb37b4 100644 --- a/package/base-files/files/lib/functions/leds.sh +++ b/package/base-files/files/lib/functions/leds.sh @@ -18,7 +18,8 @@ get_dt_led() { [ -n "$ledpath" ] && \ label=$(cat "$ledpath/label" 2>/dev/null) || \ - label=$(cat "$ledpath/chan-name" 2>/dev/null) + label=$(cat "$ledpath/chan-name" 2>/dev/null) || \ + label=$(basename "$ledpath") echo "$label" } From 252197f014932c03cea7c080d8ab90e0a963a281 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Thu, 3 Sep 2020 21:24:16 +0200 Subject: [PATCH 11/11] apm821xx: provide legacy interrupts for PCIe in DT Devices with PCIe-Switches like the WNDR4700, MR24 and WNDAP660 need to have the interrupts property specified in the device-tree for the legacy pci interrupt signaling method to work. If the proper interrupt value is not specified, the default INTA IRQ 12 is taken for all devices. This is especially bad, if the device is setup to use INTC, because these interrupts will not be serviced. Russell Senior reported his experience on the MR24: "The symptom is client devices can't see the beacons. Wifi ifaces appear, can scan and hear other networks, but clients can't see the MR24's SSIDs." (The interrupts-property on the WNDAP620 was optional since it uses INTA by default. Likewise the MX60W is in the same category) Reported-by: Russell Senior Signed-off-by: Christian Lamparter --- target/linux/apm821xx/dts/meraki-mr24.dts | 2 ++ target/linux/apm821xx/dts/meraki-mx60.dts | 1 + target/linux/apm821xx/dts/netgear-wndap620.dts | 1 + target/linux/apm821xx/dts/netgear-wndap660.dts | 2 ++ target/linux/apm821xx/dts/netgear-wndr4700.dts | 3 +++ 5 files changed, 9 insertions(+) diff --git a/target/linux/apm821xx/dts/meraki-mr24.dts b/target/linux/apm821xx/dts/meraki-mr24.dts index 37032fb865..660cf8f789 100644 --- a/target/linux/apm821xx/dts/meraki-mr24.dts +++ b/target/linux/apm821xx/dts/meraki-mr24.dts @@ -212,6 +212,7 @@ /* Atheros AR9380 2.4GHz */ compatible = "pci168c,0030"; reg = <0x00430000 0 0 0 0>; + interrupts = <3>; /* INTC 4.1.1 */ }; }; @@ -226,6 +227,7 @@ /* Atheros AR9380 5GHz */ compatible = "pci168c,0030"; reg = <0x00440000 0 0 0 0>; + interrupts = <4>; /* INTD 4.1.1 */ }; }; }; diff --git a/target/linux/apm821xx/dts/meraki-mx60.dts b/target/linux/apm821xx/dts/meraki-mx60.dts index 6773028191..9bddbdd25d 100644 --- a/target/linux/apm821xx/dts/meraki-mx60.dts +++ b/target/linux/apm821xx/dts/meraki-mx60.dts @@ -189,6 +189,7 @@ /* Atheros AR9380 2.4/5GHz */ compatible = "pci168c,0030"; reg = <0x00410000 0 0 0 0>; + interrupts = <1>; /* INTA */ }; }; }; diff --git a/target/linux/apm821xx/dts/netgear-wndap620.dts b/target/linux/apm821xx/dts/netgear-wndap620.dts index e92c5638cb..d72aef4def 100644 --- a/target/linux/apm821xx/dts/netgear-wndap620.dts +++ b/target/linux/apm821xx/dts/netgear-wndap620.dts @@ -38,6 +38,7 @@ /* Atheros AR9380 5GHz */ compatible = "pci168c,0030"; reg = <0x00410000 0 0 0 0>; + interrupts = <1>; /* INTA */ }; }; }; diff --git a/target/linux/apm821xx/dts/netgear-wndap660.dts b/target/linux/apm821xx/dts/netgear-wndap660.dts index c15970b6b2..e9f45abe0e 100644 --- a/target/linux/apm821xx/dts/netgear-wndap660.dts +++ b/target/linux/apm821xx/dts/netgear-wndap660.dts @@ -65,6 +65,7 @@ /* Atheros AR9380 2.4/5GHz */ compatible = "pci168c,0030"; reg = <0x00430000 0 0 0 0>; + interrupts = <3>; /* INTC */ }; }; @@ -79,6 +80,7 @@ /* Atheros AR9380 2.4/5GHz */ compatible = "pci168c,0030"; reg = <0x00440000 0 0 0 0>; + interrupts = <4>; /* INTD */ }; }; }; diff --git a/target/linux/apm821xx/dts/netgear-wndr4700.dts b/target/linux/apm821xx/dts/netgear-wndr4700.dts index f711eb7782..0a1b2f4f32 100644 --- a/target/linux/apm821xx/dts/netgear-wndr4700.dts +++ b/target/linux/apm821xx/dts/netgear-wndr4700.dts @@ -454,6 +454,7 @@ /* Atheros AR9380 5GHz */ compatible = "pci168c,0030"; reg = <0x00430000 0 0 0 0>; + interrupts = <3>; /* INTC */ qca,no-eeprom; /* wifi CAL & MAC is stored in nvram */ @@ -476,6 +477,7 @@ /* Atheros AR9381 2.4GHz */ compatible = "pci168c,0033"; reg = <0x00440000 0 0 0 0>; + interrupts = <4>; /* INTD */ qca,no-eeprom; /* wifi CAL & MAC is stored in nvram */ }; @@ -492,6 +494,7 @@ /* Renesas uPD720202 */ compatible = "pci1912,0015"; reg = <0x00450000 0 0 0 0>; + interrupts = <1>; /* INTA */ #address-cells = <1>; #size-cells = <0>;