From 256c322f850861e25e1aadc8e1c7731bbc554f52 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Wed, 7 Apr 2021 11:45:57 +0200 Subject: [PATCH] ucentral: development update * update base 21.02 revision * update v5.10 support * fix captive portal * cleanup ucentral-* packages * update ucentral-* packages * cleanup profiles * fix worflow Signed-off-by: John Crispin --- .github/workflows/build-dev.yml | 7 +- ...el-image-before-building-modules-pac.patch | 4 +- ...ld-with-CONFIG_STRIP_KERNEL_EXPORTS.patch} | 4 +- ...ar8216-fix-kernel-5.10-compile-error.patch | 41 - ... 0003-kernel-add-linux-5.10-support.patch} | 8313 ++++++++++-- ...pdate-version-switch-for-of_get_phy_.patch | 45 - ...0004-mediatek-update-to-latest-HEAD.patch} | 11141 ++++++++++------ ...-busy-wait-loop-in-mediatek-PPE-code.patch | 36 - ...llow-limiting-rootfs_data-by-settin.patch} | 4 +- ...0-make-UDP-tunneling-user-selectable.patch | 43 - ...iatek-add-support-for-linksys-e8450.patch} | 4 +- ...missing-partitions-doc-syntax-commit.patch | 347 - ...-add-defaults-for-linksys-e8450-ubi.patch} | 4 +- .../0008-kernel-5.10-refresh-patches.patch | 226 - ...-realtek-update-to-latest-owrt-HEAD.patch} | 4 +- .../0009-include-set-kernel-version.mk.patch | 31 + ...kernel-update-kernel-5.10-to-5.10.16.patch | 60 - ...-mt76-update-to-latest-HEAD-revision.patch | 45 + ...nt-bad-block-management-table-suppor.patch | 910 -- ...port-for-configuring-BMT-table-size-.patch | 215 - ...rt-for-enabling-fit-firmware-partiti.patch | 43 - ...5-mediatek-add-linksys-e8450-support.patch | 757 -- ...atek-linksys-e8450-fix-wifi-and-lan4.patch | 42 - ...t-for-building-FIT-image-with-filesy.patch | 754 -- ...-e8450-ubi-add-alternative-UBI-NAND-.patch | 1584 --- config.yml | 2 +- feeds/ucentral/opennds/Makefile | 87 + .../opennds/patches/100-config-reload.patch | 16 + .../files/etc/uci-defaults/zzz-ucentral | 20 - .../files/etc/sysctl.d/20-oom-reboot.conf | 2 + .../etc/uci-defaults/99-ucentral-hostname | 5 + .../etc/uci-defaults/99-ucentral-network | 4 + .../etc/uci-defaults/99-ucentral-opennds | 3 + .../files/etc/uci-defaults/99-ucentral-umdns | 3 + .../files/etc/uci-defaults/99-ucentral-wifi | 10 + .../usr/libexec/ucentral/ucentral_apply.sh | 0 .../usr/libexec/ucentral/ucentral_cmd.sh | 0 .../usr/libexec/ucentral/ucentral_factory.sh | 0 .../usr/libexec/ucentral/ucentral_failsafe.sh | 0 .../libexec/ucentral/ucentral_led_blink.sh | 0 .../usr/libexec/ucentral/ucentral_state.sh | 0 .../libexec/ucentral/ucentral_sysupgrade.sh | 0 .../usr/libexec/ucentral/ucentral_verify.sh | 0 .../files/usr/share/ucentral/crashlog.uc | 0 feeds/ucentral/ucentral-schema/Makefile | 2 +- feeds/ucentral/ucode/Makefile | 2 +- ...x-modules-fix-some-v4.4-dependencies.patch | 17 - ...-files-add-sysctl-to-reboot-upon-OOM.patch | 22 - ...le-vlan-filtering-on-various-targets.patch | 10 +- patches/0025-target-add-pstore-support.patch | 58 +- ...26-hostapd-add-a-pile-of-new-options.patch | 257 + ...27-hostapd-fix-civic-location-option.patch | 26 + .../0028-hostapd-add-eap_server-support.patch | 77 + profiles/{wf188n.yml => cig_wf188.yml} | 0 profiles/{wf194c.yml => cig_wf194c.yml} | 0 profiles/{eap101.yml => edgecore_eap101.yml} | 0 profiles/{eap102.yml => edgecore_eap102.yml} | 0 profiles/edgecore_ecw5211.yml | 15 + profiles/{e8450.yml => linksys_e8450.yml} | 2 +- profiles/{ea8300.yml => linksys_ea8300.yml} | 0 profiles/ucentral-ap.yml | 21 +- 61 files changed, 14866 insertions(+), 10459 deletions(-) rename backports/{0009-build-fix-build-with-CONFIG_STRIP_KERNEL_EXPORTS.patch => 0002-build-fix-build-with-CONFIG_STRIP_KERNEL_EXPORTS.patch} (91%) delete mode 100644 backports/0003-generic-ar8216-fix-kernel-5.10-compile-error.patch rename backports/{0002-kernel-add-linux-5.10-support.patch => 0003-kernel-add-linux-5.10-support.patch} (81%) delete mode 100644 backports/0004-generic-ar8216-update-version-switch-for-of_get_phy_.patch rename backports/{0012-mediatek-add-work-in-progress-linux-5.10-support.patch => 0004-mediatek-update-to-latest-HEAD.patch} (96%) delete mode 100644 backports/0005-kernel-5.10-fix-busy-wait-loop-in-mediatek-PPE-code.patch rename backports/{0018-sysupgrade-nand-allow-limiting-rootfs_data-by-settin.patch => 0005-sysupgrade-nand-allow-limiting-rootfs_data-by-settin.patch} (95%) delete mode 100644 backports/0006-kernel-hack-5.10-make-UDP-tunneling-user-selectable.patch rename backports/{0019-uboot-mediatek-add-support-for-linksys-e8450.patch => 0006-uboot-mediatek-add-support-for-linksys-e8450.patch} (99%) delete mode 100644 backports/0007-kernel-5.10-add-missing-partitions-doc-syntax-commit.patch rename backports/{0020-uboot-envtools-add-defaults-for-linksys-e8450-ubi.patch => 0007-uboot-envtools-add-defaults-for-linksys-e8450-ubi.patch} (90%) delete mode 100644 backports/0008-kernel-5.10-refresh-patches.patch rename backports/{0022-realtek-update-to-latest-owrt-HEAD.patch => 0008-realtek-update-to-latest-owrt-HEAD.patch} (99%) create mode 100644 backports/0009-include-set-kernel-version.mk.patch delete mode 100644 backports/0010-kernel-update-kernel-5.10-to-5.10.16.patch create mode 100644 backports/0010-mt76-update-to-latest-HEAD-revision.patch delete mode 100644 backports/0011-mediatek-implement-bad-block-management-table-suppor.patch delete mode 100644 backports/0013-mediatek-add-support-for-configuring-BMT-table-size-.patch delete mode 100644 backports/0014-kernel-add-support-for-enabling-fit-firmware-partiti.patch delete mode 100644 backports/0015-mediatek-add-linksys-e8450-support.patch delete mode 100644 backports/0016-mediatek-linksys-e8450-fix-wifi-and-lan4.patch delete mode 100644 backports/0017-image-add-support-for-building-FIT-image-with-filesy.patch delete mode 100644 backports/0021-mediatek-linksys-e8450-ubi-add-alternative-UBI-NAND-.patch create mode 100644 feeds/ucentral/opennds/Makefile create mode 100644 feeds/ucentral/opennds/patches/100-config-reload.patch create mode 100644 feeds/ucentral/ucentral-defaults/files/etc/sysctl.d/20-oom-reboot.conf create mode 100755 feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-hostname create mode 100755 feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-network create mode 100755 feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-opennds create mode 100755 feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-umdns create mode 100755 feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-wifi rename feeds/ucentral/{ucentral-client => ucentral-defaults}/files/usr/libexec/ucentral/ucentral_apply.sh (100%) rename feeds/ucentral/{ucentral-client => ucentral-defaults}/files/usr/libexec/ucentral/ucentral_cmd.sh (100%) rename feeds/ucentral/{ucentral-client => ucentral-defaults}/files/usr/libexec/ucentral/ucentral_factory.sh (100%) rename feeds/ucentral/{ucentral-client => ucentral-defaults}/files/usr/libexec/ucentral/ucentral_failsafe.sh (100%) rename feeds/ucentral/{ucentral-client => ucentral-defaults}/files/usr/libexec/ucentral/ucentral_led_blink.sh (100%) rename feeds/ucentral/{ucentral-client => ucentral-defaults}/files/usr/libexec/ucentral/ucentral_state.sh (100%) rename feeds/ucentral/{ucentral-client => ucentral-defaults}/files/usr/libexec/ucentral/ucentral_sysupgrade.sh (100%) rename feeds/ucentral/{ucentral-client => ucentral-defaults}/files/usr/libexec/ucentral/ucentral_verify.sh (100%) rename feeds/ucentral/{ucentral-client => ucentral-defaults}/files/usr/share/ucentral/crashlog.uc (100%) delete mode 100644 patches/0022-base-files-add-sysctl-to-reboot-upon-OOM.patch create mode 100644 patches/0026-hostapd-add-a-pile-of-new-options.patch create mode 100644 patches/0027-hostapd-fix-civic-location-option.patch create mode 100644 patches/0028-hostapd-add-eap_server-support.patch rename profiles/{wf188n.yml => cig_wf188.yml} (100%) rename profiles/{wf194c.yml => cig_wf194c.yml} (100%) rename profiles/{eap101.yml => edgecore_eap101.yml} (100%) rename profiles/{eap102.yml => edgecore_eap102.yml} (100%) create mode 100644 profiles/edgecore_ecw5211.yml rename profiles/{e8450.yml => linksys_e8450.yml} (84%) rename profiles/{ea8300.yml => linksys_ea8300.yml} (100%) diff --git a/.github/workflows/build-dev.yml b/.github/workflows/build-dev.yml index 277c61286..f03534c71 100644 --- a/.github/workflows/build-dev.yml +++ b/.github/workflows/build-dev.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - target: ['e8450', 'ea8300', 'wf194c', 'zyxel_gs1900-10hp', 'edgecore_ecs4100-12ph'] + target: ['cig_wf188', 'cig_wf194c', 'edgecore_eap101', 'edgecore_eap102', 'edgecore_ecs4100-12ph', 'edgecore_ecw5211', 'linksys_e8450', 'linksys_ea8300', 'zyxel_gs1900-10hp'] steps: - uses: actions/checkout@v2 @@ -31,7 +31,8 @@ jobs: run: | BRANCH=$(git rev-parse --abbrev-ref HEAD) LOWERCASE_TARGET=`echo ${{ matrix.target }} | tr '[:upper:]' '[:lower:]'` - TAR_NAME="$LOWERCASE_TARGET-$BRANCH.tar.gz" + HASH=$(git rev-parse --short HEAD) + TAR_NAME="$LOWERCASE_TARGET-$BRANCH-$HASH.tar.gz" ls openwrt/bin/targets/ tar cfz "$TAR_NAME" -C openwrt/bin/targets/ . - curl -u $GH_BUILD_USERNAME:$GH_BUILD_PASSWORD -T "$TAR_NAME" "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/$LOWERCASE_TARGET/uCentral/dev/"$TAR_NAME"" + curl -u $GH_BUILD_USERNAME:$GH_BUILD_PASSWORD -T "$TAR_NAME" "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/uCentral/$LOWERCASE_TARGET/"$TAR_NAME"" diff --git a/backports/0001-build-build-kernel-image-before-building-modules-pac.patch b/backports/0001-build-build-kernel-image-before-building-modules-pac.patch index a0beb0fdc..f33c28e54 100644 --- a/backports/0001-build-build-kernel-image-before-building-modules-pac.patch +++ b/backports/0001-build-build-kernel-image-before-building-modules-pac.patch @@ -1,7 +1,7 @@ -From 9a1f2adebe2245175462a6b2758d78b292072505 Mon Sep 17 00:00:00 2001 +From 98ff38f7b7cd28c035b9c2e36a45af17f85c5244 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 22 Oct 2020 10:29:34 +0200 -Subject: [PATCH 01/22] build: build kernel image before building +Subject: [PATCH 01/37] build: build kernel image before building modules/packages This is needed for linux 5.10, where modules.builtin is generated from diff --git a/backports/0009-build-fix-build-with-CONFIG_STRIP_KERNEL_EXPORTS.patch b/backports/0002-build-fix-build-with-CONFIG_STRIP_KERNEL_EXPORTS.patch similarity index 91% rename from backports/0009-build-fix-build-with-CONFIG_STRIP_KERNEL_EXPORTS.patch rename to backports/0002-build-fix-build-with-CONFIG_STRIP_KERNEL_EXPORTS.patch index 1de1ec9ba..94fb13563 100644 --- a/backports/0009-build-fix-build-with-CONFIG_STRIP_KERNEL_EXPORTS.patch +++ b/backports/0002-build-fix-build-with-CONFIG_STRIP_KERNEL_EXPORTS.patch @@ -1,7 +1,7 @@ -From 6923e03f687b00c0394d34194364b56d04a79d8f Mon Sep 17 00:00:00 2001 +From cf2dbd13b7dd8c8c52fc3378da69ebae454520aa Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 17 Feb 2021 13:49:14 +0100 -Subject: [PATCH 09/22] build: fix build with CONFIG_STRIP_KERNEL_EXPORTS +Subject: [PATCH 02/37] build: fix build with CONFIG_STRIP_KERNEL_EXPORTS Only use symtab.h on the final kernel link diff --git a/backports/0003-generic-ar8216-fix-kernel-5.10-compile-error.patch b/backports/0003-generic-ar8216-fix-kernel-5.10-compile-error.patch deleted file mode 100644 index f9f94bad5..000000000 --- a/backports/0003-generic-ar8216-fix-kernel-5.10-compile-error.patch +++ /dev/null @@ -1,41 +0,0 @@ -From cc135eeb1b77fc084e4154d25e13e42b7a2d9150 Mon Sep 17 00:00:00 2001 -From: David Bauer -Date: Tue, 16 Feb 2021 22:51:18 +0100 -Subject: [PATCH 03/22] generic: ar8216: fix kernel 5.10 compile error - -Signed-off-by: David Bauer ---- - target/linux/generic/files/drivers/net/phy/ar8216.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c -index acfa0ebecd..d48a415d50 100644 ---- a/target/linux/generic/files/drivers/net/phy/ar8216.c -+++ b/target/linux/generic/files/drivers/net/phy/ar8216.c -@@ -891,7 +891,11 @@ ar8216_phy_write(struct ar8xxx_priv *priv, int addr, int regnum, u16 val) - static int - ar8229_hw_init(struct ar8xxx_priv *priv) - { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) -+ phy_interface_t phy_if_mode; -+#else - int phy_if_mode; -+#endif - - if (priv->initialized) - return 0; -@@ -899,7 +903,11 @@ ar8229_hw_init(struct ar8xxx_priv *priv) - ar8xxx_write(priv, AR8216_REG_CTRL, AR8216_CTRL_RESET); - ar8xxx_reg_wait(priv, AR8216_REG_CTRL, AR8216_CTRL_RESET, 0, 1000); - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) -+ of_get_phy_mode(priv->pdev->of_node, &phy_if_mode); -+#else - phy_if_mode = of_get_phy_mode(priv->pdev->of_node); -+#endif - - if (phy_if_mode == PHY_INTERFACE_MODE_GMII) { - ar8xxx_write(priv, AR8229_REG_OPER_MODE0, --- -2.25.1 - diff --git a/backports/0002-kernel-add-linux-5.10-support.patch b/backports/0003-kernel-add-linux-5.10-support.patch similarity index 81% rename from backports/0002-kernel-add-linux-5.10-support.patch rename to backports/0003-kernel-add-linux-5.10-support.patch index cd2be305c..1921b1ff3 100644 --- a/backports/0002-kernel-add-linux-5.10-support.patch +++ b/backports/0003-kernel-add-linux-5.10-support.patch @@ -1,30 +1,71 @@ -From d20b27e642d5e728142eb5180f20f185dcc42872 Mon Sep 17 00:00:00 2001 +From 31e71ca55e6d452994b8d154ab34113ce532d3cd Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 24 Oct 2020 21:14:16 +0200 -Subject: [PATCH 02/22] kernel: add linux 5.10 support +Subject: [PATCH 03/37] kernel: add linux 5.10 support Signed-off-by: Felix Fietkau --- - include/kernel-version.mk | 2 + + include/image-commands.mk | 3 +- + package/base-files/files/lib/upgrade/nand.sh | 102 +- package/kernel/linux/modules/block.mk | 16 +- package/kernel/linux/modules/fs.mk | 6 +- package/kernel/linux/modules/netdevices.mk | 2 +- package/kernel/linux/modules/netfilter.mk | 4 +- package/kernel/linux/modules/usb.mk | 2 +- + scripts/mkits.sh | 45 +- ...dcode-path-to-awk-in-scripts-ld-vers.patch | 30 + .../011-kbuild-export-SUBARCH.patch | 21 + + ...a-neon-optimize-for-non-block-size-m.patch | 272 + + ...a-neon-add-missing-counter-increment.patch | 38 + + ...ut-frequently-used-members-above-cac.patch | 42 + ...ow_offload-handle-netdevice-events-f.patch | 106 + - target/linux/generic/config-5.10 | 6941 +++++++++++++++++ + ...convert-fixed-partitions-to-the-json.patch | 324 + + ...move-partition-binding-to-its-own-fi.patch | 115 + + ...d-add-binding-for-BCM4908-partitions.patch | 92 + + ...art-support-BCM4908-fixed-partitions.patch | 654 ++ + ...rt-limit-parsing-of-deprecated-DT-sy.patch | 69 + + ...rt-make-symbol-bcm4908_partitions_qu.patch | 34 + + ...em-cells-compatible-to-parse-mtd-as-.patch | 38 + + ...ings-nvmem-drop-nodename-restriction.patch | 25 + + ...Document-use-of-nvmem-cells-compatib.patch | 117 + + ...add-binding-for-Linksys-Northstar-pa.patch | 98 + + ...rt-support-Linksys-Northstar-partiti.patch | 156 + + ...pi-poll-functionality-to-__napi_poll.patch | 88 + + ...threaded-able-napi-poll-loop-support.patch | 261 + + ...tribute-to-control-napi-threaded-mod.patch | 177 + + ...ween-napi-kthread-mode-and-busy-poll.patch | 93 + + ...y-switchdev-of-disappearance-of-old-.patch | 126 + + ...r-when-a-non-legacy-FDB-operation-fa.patch | 52 + + ...e-switchdev_notifier_fdb_info-in-dsa.patch | 226 + + ...tchdev-event-implementation-under-th.patch | 85 + + ...ly-in-dsa_slave_switchdev_event-if-w.patch | 42 + + ...or-SWITCHDEV_-FDB-DEL-_ADD_TO_DEVICE.patch | 264 + + ...setup-core-clock-even-in-TRGMII-mode.patch | 84 + + ..._nvram-rename-finding-function-and-i.patch | 80 + + ..._nvram-add-helper-checking-for-NVRAM.patch | 90 + + ...7xx_nvram-extract-code-copying-NVRAM.patch | 80 + + ..._nvram-look-for-NVRAM-with-for-inste.patch | 37 + + ..._nvram-inline-code-checking-NVRAM-si.patch | 70 + + ...rious-flag-to-disable-overcurrent-ch.patch | 88 + + ...-platform-add-spurious_oc-DT-support.patch | 31 + + target/linux/generic/config-5.10 | 7062 +++++++++++++++++ target/linux/generic/config-filter | 6 +- - .../generic/files/drivers/net/phy/ar8216.c | 8 + + .../generic/files/block/partitions/fit.c | 254 + + .../files/drivers/mtd/mtdsplit/Kconfig | 5 + + .../files/drivers/mtd/mtdsplit/Makefile | 1 + + .../drivers/mtd/mtdsplit/mtdsplit_bcm63xx.c | 186 + + .../mtd/mtdsplit/mtdsplit_cfe_bootfs.c | 14 +- + .../files/drivers/mtd/mtdsplit/mtdsplit_fit.c | 6 + + .../generic/files/drivers/net/phy/ar8216.c | 16 + .../generic/hack-5.10/204-module_strip.patch | 196 + - .../210-darwin_scripts_include.patch | 3053 ++++++++ + .../210-darwin_scripts_include.patch | 3053 +++++++ .../211-darwin-uuid-typedef-clash.patch | 22 + .../hack-5.10/212-tools_portability.patch | 110 + .../hack-5.10/214-spidev_h_portability.patch | 24 + .../generic/hack-5.10/220-gc_sections.patch | 120 + .../hack-5.10/221-module_exports.patch | 102 + .../hack-5.10/230-openwrt_lzma_options.patch | 34 + + .../hack-5.10/249-udp-tunnel-selection.patch | 11 + .../hack-5.10/250-netfilter_depends.patch | 27 + .../linux/generic/hack-5.10/251-kconfig.patch | 199 + .../hack-5.10/259-regmap_dynamic.patch | 135 + @@ -34,14 +75,17 @@ Signed-off-by: Felix Fietkau ...cache-use-more-efficient-cache-blast.patch | 64 + .../301-mips_image_cmdline_hack.patch | 38 + .../321-powerpc_crtsavres_prereq.patch | 38 + - .../generic/hack-5.10/531-debloat_lzma.patch | 1037 +++ + .../400-block-fit-partition-parser.patch | 177 + + .../generic/hack-5.10/531-debloat_lzma.patch | 1040 +++ .../640-bridge-only-accept-EAP-locally.patch | 82 + ...lter-connmark-introduce-set-dscpmark.patch | 212 + - .../650-netfilter-add-xt_OFFLOAD-target.patch | 822 ++ + ...-netfilter-add-xt_FLOWOFFLOAD-target.patch | 820 ++ .../hack-5.10/651-wireless_mesh_header.patch | 24 + .../hack-5.10/660-fq_codel_defaults.patch | 27 + .../661-use_fq_codel_by_default.patch | 100 + .../700-swconfig_switch_drivers.patch | 129 + + .../710-net-dsa-mv88e6xxx-default-VID-1.patch | 18 + + ...-dsa-mv88e6xxx-disable-ATU-violation.patch | 12 + .../hack-5.10/773-bgmac-add-srab-switch.patch | 98 + .../hack-5.10/901-debloat_sock_diag.patch | 162 + .../generic/hack-5.10/902-debloat_proc.patch | 408 + @@ -50,7 +94,7 @@ Signed-off-by: Felix Fietkau .../911-kobject_add_broadcast_uevent.patch | 76 + ...include-asm-rwonce.h-for-kernel-code.patch | 29 + ...s-negative-stack-offsets-on-stack-tr.patch | 57 + - .../pending-5.10/110-ehci_hcd_ignore_oc.patch | 79 + + ...CPU_MIPS64-for-remaining-MIPS64-CPUs.patch | 36 + ...e_mem_map-with-ARCH_PFN_OFFSET-calcu.patch | 82 + ...0-add-linux-spidev-compatible-si3210.patch | 18 + ...ame2-and-add-RENAME_WHITEOUT-support.patch | 78 + @@ -93,8 +137,9 @@ Signed-off-by: Felix Fietkau .../480-mtd-set-rootfs-to-be-root-dev.patch | 38 + ...or-rework-broken-flash-reset-support.patch | 180 + ...r-add-support-for-Gigadevice-GD25D05.patch | 22 + + .../483-mtd-spi-nor-add-gd25q512.patch | 12 + ...mtd-device-named-ubi-or-data-on-boot.patch | 97 + - ...to-create-ubiblock-device-for-rootfs.patch | 66 + + ...to-create-ubiblock-device-for-rootfs.patch | 69 + ...ting-ubi0-rootfs-in-init-do_mounts.c.patch | 51 + ...ROOT_DEV-to-ubiblock-rootfs-if-unset.patch | 34 + .../494-mtd-ubi-add-EOF-marker-support.patch | 60 + @@ -102,6 +147,7 @@ Signed-off-by: Felix Fietkau ...-add-bindings-for-mtd-concat-devices.patch | 52 + ...cat-add-dt-driver-for-concat-devices.patch | 216 + ...-mtdconcat-select-readwrite-function.patch | 24 + + ...when-recursively-deleting-partitions.patch | 24 + .../500-fs_cdrom_dependencies.patch | 40 + .../530-jffs2_make_lzma_available.patch | 5180 ++++++++++++ .../pending-5.10/532-jffs2_eofdetect.patch | 65 + @@ -118,31 +164,38 @@ Signed-off-by: Felix Fietkau ...lve-forwarding-path-for-vlan-devices.patch | 80 + ...e-forwarding-path-for-bridge-devices.patch | 62 + ...ble-use-dev_fill_forward_path-to-obt.patch | 191 + - ...ble-use-dev_fill_forward_path-to-obt.patch | 336 + - ...netfilter-flowtable-add-vlan-support.patch | 364 + + ...ble-use-dev_fill_forward_path-to-obt.patch | 344 + + ...netfilter-flowtable-add-vlan-support.patch | 391 + ...ter-flowtable-bridge-and-VLAN-suppor.patch | 107 + ...ve-VLAN-tag-actions-in-forwarding-pa.patch | 207 + - ...-forwarding-path-for-dsa-slave-ports.patch | 62 + - ...ble-add-offload-support-for-xmit-pat.patch | 307 + - ...ter-nft_flow_offload-add-dsa-support.patch | 30 + - ...sa-slave-add-support-for-TC_SETUP_FT.patch | 53 + ...ow_offload-add-bridge-vlan-filtering.patch | 31 + - ...ow_offload-use-direct-xmit-if-hardwa.patch | 51 + - ...ow_offload-fix-bridge-vlan-tag-handl.patch | 22 + - ...owtable-rework-ingress-vlan-matching.patch | 143 + - ...ble-handle-bridge-vlan-filter-offloa.patch | 106 + + ...forwarding-path-for-bridge-pppoe-dev.patch | 100 + + ...-forwarding-path-for-dsa-slave-ports.patch | 60 + + ...etfilter-flowtable-add-pppoe-support.patch | 263 + + ...ter-nft_flow_offload-add-dsa-support.patch | 30 + + ...ble-add-offload-support-for-xmit-pat.patch | 308 + + ...sa-slave-add-support-for-TC_SETUP_FT.patch | 53 + + ...ow_offload-use-direct-xmit-if-hardwa.patch | 108 + + ...w_table-fix-untagging-with-hardware-.patch | 122 + + ...w_offload-add-FLOW_ACTION_PPPOE_PUSH.patch | 26 + + ...ble-support-for-FLOW_ACTION_PPPOE_PU.patch | 31 + .../pending-5.10/655-increase_skb_pad.patch | 20 + ...Add-support-for-MAP-E-FMRs-mesh-mode.patch | 511 ++ ...ng-with-source-address-failed-policy.patch | 263 + ...nes-for-_POLICY_FAILED-until-all-cod.patch | 50 + ...T-skip-GRO-for-foreign-MAC-addresses.patch | 149 + .../681-NET-add-of_get_mac_address_mtd.patch | 135 + - ...dd-support-for-threaded-NAPI-polling.patch | 284 + - ...attribute-for-enabling-threaded-NAPI.patch | 74 + ...detach-callback-to-struct-phy_driver.patch | 38 + ...net-phy-at803x-fix-at8033-sgmii-mode.patch | 51 + ...760-net-dsa-mv88e6xxx-fix-vlan-setup.patch | 27 + ...-net-dsa-mt7530-Support-EEE-features.patch | 121 + + ...hdev-Refactor-br_switchdev_fdb_notif.patch | 77 + + ...hdev-Include-local-flag-in-FDB-notif.patch | 42 + + ...hdev-Send-FDB-notifications-for-host.patch | 96 + + ...local-addresses-in-assisted-CPU-port.patch | 36 + + ...bridge-addresses-in-assisted-CPU-por.patch | 30 + + ...tic-FDB-entries-on-foreign-interface.patch | 56 + + ...equest-assisted-learning-on-CPU-port.patch | 27 + ...net-mtk_eth_soc-use-napi_consume_skb.patch | 72 + ..._eth_soc-significantly-reduce-mdio-b.patch | 26 + ...rnet-mtk_eth_soc-fix-rx-vlan-offload.patch | 31 + @@ -156,19 +209,54 @@ Signed-off-by: Felix Fietkau ..._eth_soc-avoid-rearming-interrupt-if.patch | 35 + ...k_eth_soc-fix-parsing-packets-in-GDM.patch | 67 + ..._eth_soc-set-PPE-flow-hash-as-skb-ha.patch | 41 + - ..._eth_soc-add-support-for-initializin.patch | 1307 ++++ - ..._eth_soc-add-flow-offloading-support.patch | 561 ++ + ..._eth_soc-add-support-for-initializin.patch | 1307 +++ + ..._eth_soc-add-flow-offloading-support.patch | 574 ++ ...ice-struct-copy-its-DMA-params-to-th.patch | 70 + .../810-pci_disable_common_quirks.patch | 62 + .../811-pci_disable_usb_common_quirks.patch | 115 + ...problem-with-platfom-data-in-w1-gpio.patch | 26 + .../pending-5.10/834-ledtrig-libata.patch | 149 + + ...40-hwrng-bcm2835-set-quality-to-1000.patch | 26 + .../pending-5.10/920-mangle_bootargs.patch | 71 + - 159 files changed, 31996 insertions(+), 11 deletions(-) + 213 files changed, 37361 insertions(+), 59 deletions(-) create mode 100644 target/linux/generic/backport-5.10/010-Kbuild-don-t-hardcode-path-to-awk-in-scripts-ld-vers.patch create mode 100644 target/linux/generic/backport-5.10/011-kbuild-export-SUBARCH.patch + create mode 100644 target/linux/generic/backport-5.10/071-crypto-arm-chacha-neon-optimize-for-non-block-size-m.patch + create mode 100644 target/linux/generic/backport-5.10/072-crypto-arm-chacha-neon-add-missing-counter-increment.patch + create mode 100644 target/linux/generic/backport-5.10/080-wireguard-peer-put-frequently-used-members-above-cac.patch create mode 100644 target/linux/generic/backport-5.10/343-netfilter-nft_flow_offload-handle-netdevice-events-f.patch + create mode 100644 target/linux/generic/backport-5.10/401-v5.11-dt-bindings-mtd-convert-fixed-partitions-to-the-json.patch + create mode 100644 target/linux/generic/backport-5.10/402-v5.12-0001-dt-bindings-mtd-move-partition-binding-to-its-own-fi.patch + create mode 100644 target/linux/generic/backport-5.10/402-v5.12-0002-dt-bindings-mtd-add-binding-for-BCM4908-partitions.patch + create mode 100644 target/linux/generic/backport-5.10/403-v5.13-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch + create mode 100644 target/linux/generic/backport-5.10/404-v5.13-mtd-parsers-ofpart-limit-parsing-of-deprecated-DT-sy.patch + create mode 100644 target/linux/generic/backport-5.10/405-v5.13-mtd-parsers-ofpart-make-symbol-bcm4908_partitions_qu.patch + create mode 100644 target/linux/generic/backport-5.10/406-v5.13-0001-mtd-core-add-nvmem-cells-compatible-to-parse-mtd-as-.patch + create mode 100644 target/linux/generic/backport-5.10/406-v5.13-0002-dt-bindings-nvmem-drop-nodename-restriction.patch + create mode 100644 target/linux/generic/backport-5.10/406-v5.13-0003-dt-bindings-mtd-Document-use-of-nvmem-cells-compatib.patch + create mode 100644 target/linux/generic/backport-5.10/407-v5.13-0001-dt-bindings-mtd-add-binding-for-Linksys-Northstar-pa.patch + create mode 100644 target/linux/generic/backport-5.10/407-v5.13-0002-mtd-parsers-ofpart-support-Linksys-Northstar-partiti.patch + create mode 100644 target/linux/generic/backport-5.10/600-v5.12-net-extract-napi-poll-functionality-to-__napi_poll.patch + create mode 100644 target/linux/generic/backport-5.10/601-v5.12-net-implement-threaded-able-napi-poll-loop-support.patch + create mode 100644 target/linux/generic/backport-5.10/602-v5.12-net-add-sysfs-attribute-to-control-napi-threaded-mod.patch + create mode 100644 target/linux/generic/backport-5.10/603-v5.12-net-fix-race-between-napi-kthread-mode-and-busy-poll.patch + create mode 100644 target/linux/generic/backport-5.10/770-v5.12-net-bridge-notify-switchdev-of-disappearance-of-old-.patch + create mode 100644 target/linux/generic/backport-5.10/771-v5.12-net-dsa-be-louder-when-a-non-legacy-FDB-operation-fa.patch + create mode 100644 target/linux/generic/backport-5.10/772-v5.12-net-dsa-don-t-use-switchdev_notifier_fdb_info-in-dsa.patch + create mode 100644 target/linux/generic/backport-5.10/773-v5.12-net-dsa-move-switchdev-event-implementation-under-th.patch + create mode 100644 target/linux/generic/backport-5.10/774-v5.12-net-dsa-exit-early-in-dsa_slave_switchdev_event-if-w.patch + create mode 100644 target/linux/generic/backport-5.10/775-v5.12-net-dsa-listen-for-SWITCHDEV_-FDB-DEL-_ADD_TO_DEVICE.patch + create mode 100644 target/linux/generic/backport-5.10/780-net-dsa-mt7530-setup-core-clock-even-in-TRGMII-mode.patch + create mode 100644 target/linux/generic/backport-5.10/800-v5.13-0001-firmware-bcm47xx_nvram-rename-finding-function-and-i.patch + create mode 100644 target/linux/generic/backport-5.10/800-v5.13-0002-firmware-bcm47xx_nvram-add-helper-checking-for-NVRAM.patch + create mode 100644 target/linux/generic/backport-5.10/800-v5.13-0003-firmware-bcm47xx_nvram-extract-code-copying-NVRAM.patch + create mode 100644 target/linux/generic/backport-5.10/800-v5.13-0004-firmware-bcm47xx_nvram-look-for-NVRAM-with-for-inste.patch + create mode 100644 target/linux/generic/backport-5.10/800-v5.13-0005-firmware-bcm47xx_nvram-inline-code-checking-NVRAM-si.patch + create mode 100644 target/linux/generic/backport-5.10/810-v5.13-usb-ehci-add-spurious-flag-to-disable-overcurrent-ch.patch + create mode 100644 target/linux/generic/backport-5.10/811-v5.13-usb-host-ehci-platform-add-spurious_oc-DT-support.patch create mode 100644 target/linux/generic/config-5.10 + create mode 100644 target/linux/generic/files/block/partitions/fit.c + create mode 100644 target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_bcm63xx.c create mode 100644 target/linux/generic/hack-5.10/204-module_strip.patch create mode 100644 target/linux/generic/hack-5.10/210-darwin_scripts_include.patch create mode 100644 target/linux/generic/hack-5.10/211-darwin-uuid-typedef-clash.patch @@ -177,6 +265,7 @@ Signed-off-by: Felix Fietkau create mode 100644 target/linux/generic/hack-5.10/220-gc_sections.patch create mode 100644 target/linux/generic/hack-5.10/221-module_exports.patch create mode 100644 target/linux/generic/hack-5.10/230-openwrt_lzma_options.patch + create mode 100644 target/linux/generic/hack-5.10/249-udp-tunnel-selection.patch create mode 100644 target/linux/generic/hack-5.10/250-netfilter_depends.patch create mode 100644 target/linux/generic/hack-5.10/251-kconfig.patch create mode 100644 target/linux/generic/hack-5.10/259-regmap_dynamic.patch @@ -186,14 +275,17 @@ Signed-off-by: Felix Fietkau create mode 100644 target/linux/generic/hack-5.10/300-MIPS-r4k_cache-use-more-efficient-cache-blast.patch create mode 100644 target/linux/generic/hack-5.10/301-mips_image_cmdline_hack.patch create mode 100644 target/linux/generic/hack-5.10/321-powerpc_crtsavres_prereq.patch + create mode 100644 target/linux/generic/hack-5.10/400-block-fit-partition-parser.patch create mode 100644 target/linux/generic/hack-5.10/531-debloat_lzma.patch create mode 100644 target/linux/generic/hack-5.10/640-bridge-only-accept-EAP-locally.patch create mode 100644 target/linux/generic/hack-5.10/645-netfilter-connmark-introduce-set-dscpmark.patch - create mode 100644 target/linux/generic/hack-5.10/650-netfilter-add-xt_OFFLOAD-target.patch + create mode 100644 target/linux/generic/hack-5.10/650-netfilter-add-xt_FLOWOFFLOAD-target.patch create mode 100644 target/linux/generic/hack-5.10/651-wireless_mesh_header.patch create mode 100644 target/linux/generic/hack-5.10/660-fq_codel_defaults.patch create mode 100644 target/linux/generic/hack-5.10/661-use_fq_codel_by_default.patch create mode 100644 target/linux/generic/hack-5.10/700-swconfig_switch_drivers.patch + create mode 100644 target/linux/generic/hack-5.10/710-net-dsa-mv88e6xxx-default-VID-1.patch + create mode 100644 target/linux/generic/hack-5.10/711-net-dsa-mv88e6xxx-disable-ATU-violation.patch create mode 100644 target/linux/generic/hack-5.10/773-bgmac-add-srab-switch.patch create mode 100644 target/linux/generic/hack-5.10/901-debloat_sock_diag.patch create mode 100644 target/linux/generic/hack-5.10/902-debloat_proc.patch @@ -202,7 +294,7 @@ Signed-off-by: Felix Fietkau create mode 100644 target/linux/generic/hack-5.10/911-kobject_add_broadcast_uevent.patch create mode 100644 target/linux/generic/pending-5.10/100-compiler.h-only-include-asm-rwonce.h-for-kernel-code.patch create mode 100644 target/linux/generic/pending-5.10/102-MIPS-only-process-negative-stack-offsets-on-stack-tr.patch - create mode 100644 target/linux/generic/pending-5.10/110-ehci_hcd_ignore_oc.patch + create mode 100644 target/linux/generic/pending-5.10/103-MIPS-select-CPU_MIPS64-for-remaining-MIPS64-CPUs.patch create mode 100644 target/linux/generic/pending-5.10/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch create mode 100644 target/linux/generic/pending-5.10/130-add-linux-spidev-compatible-si3210.patch create mode 100644 target/linux/generic/pending-5.10/140-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch @@ -245,6 +337,7 @@ Signed-off-by: Felix Fietkau create mode 100644 target/linux/generic/pending-5.10/480-mtd-set-rootfs-to-be-root-dev.patch create mode 100644 target/linux/generic/pending-5.10/481-mtd-spi-nor-rework-broken-flash-reset-support.patch create mode 100644 target/linux/generic/pending-5.10/482-mtd-spi-nor-add-support-for-Gigadevice-GD25D05.patch + create mode 100644 target/linux/generic/pending-5.10/483-mtd-spi-nor-add-gd25q512.patch create mode 100644 target/linux/generic/pending-5.10/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch create mode 100644 target/linux/generic/pending-5.10/491-ubi-auto-create-ubiblock-device-for-rootfs.patch create mode 100644 target/linux/generic/pending-5.10/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch @@ -254,6 +347,7 @@ Signed-off-by: Felix Fietkau create mode 100644 target/linux/generic/pending-5.10/496-dt-bindings-add-bindings-for-mtd-concat-devices.patch create mode 100644 target/linux/generic/pending-5.10/497-mtd-mtdconcat-add-dt-driver-for-concat-devices.patch create mode 100644 target/linux/generic/pending-5.10/498-mtd-mtdconcat-select-readwrite-function.patch + create mode 100644 target/linux/generic/pending-5.10/499-mtd-don-t-lock-when-recursively-deleting-partitions.patch create mode 100644 target/linux/generic/pending-5.10/500-fs_cdrom_dependencies.patch create mode 100644 target/linux/generic/pending-5.10/530-jffs2_make_lzma_available.patch create mode 100644 target/linux/generic/pending-5.10/532-jffs2_eofdetect.patch @@ -274,27 +368,34 @@ Signed-off-by: Felix Fietkau create mode 100644 target/linux/generic/pending-5.10/640-07-netfilter-flowtable-add-vlan-support.patch create mode 100644 target/linux/generic/pending-5.10/640-08-selftests-netfilter-flowtable-bridge-and-VLAN-suppor.patch create mode 100644 target/linux/generic/pending-5.10/640-09-net-bridge-resolve-VLAN-tag-actions-in-forwarding-pa.patch - create mode 100644 target/linux/generic/pending-5.10/640-10-net-dsa-resolve-forwarding-path-for-dsa-slave-ports.patch - create mode 100644 target/linux/generic/pending-5.10/640-11-netfilter-flowtable-add-offload-support-for-xmit-pat.patch - create mode 100644 target/linux/generic/pending-5.10/640-12-netfilter-nft_flow_offload-add-dsa-support.patch - create mode 100644 target/linux/generic/pending-5.10/640-13-dsa-slave-add-support-for-TC_SETUP_FT.patch - create mode 100644 target/linux/generic/pending-5.10/640-14-netfilter-nft_flow_offload-add-bridge-vlan-filtering.patch - create mode 100644 target/linux/generic/pending-5.10/640-15-netfilter-nft_flow_offload-use-direct-xmit-if-hardwa.patch - create mode 100644 target/linux/generic/pending-5.10/640-16-netfilter-nft_flow_offload-fix-bridge-vlan-tag-handl.patch - create mode 100644 target/linux/generic/pending-5.10/640-17-netfilter-flowtable-rework-ingress-vlan-matching.patch - create mode 100644 target/linux/generic/pending-5.10/640-18-netfilter-flowtable-handle-bridge-vlan-filter-offloa.patch + create mode 100644 target/linux/generic/pending-5.10/640-10-netfilter-nft_flow_offload-add-bridge-vlan-filtering.patch + create mode 100644 target/linux/generic/pending-5.10/640-11-net-ppp-resolve-forwarding-path-for-bridge-pppoe-dev.patch + create mode 100644 target/linux/generic/pending-5.10/640-12-net-dsa-resolve-forwarding-path-for-dsa-slave-ports.patch + create mode 100644 target/linux/generic/pending-5.10/640-13-netfilter-flowtable-add-pppoe-support.patch + create mode 100644 target/linux/generic/pending-5.10/640-14-netfilter-nft_flow_offload-add-dsa-support.patch + create mode 100644 target/linux/generic/pending-5.10/640-15-netfilter-flowtable-add-offload-support-for-xmit-pat.patch + create mode 100644 target/linux/generic/pending-5.10/640-16-dsa-slave-add-support-for-TC_SETUP_FT.patch + create mode 100644 target/linux/generic/pending-5.10/640-17-netfilter-nft_flow_offload-use-direct-xmit-if-hardwa.patch + create mode 100644 target/linux/generic/pending-5.10/640-18-netfilter-nf_flow_table-fix-untagging-with-hardware-.patch + create mode 100644 target/linux/generic/pending-5.10/640-19-net-flow_offload-add-FLOW_ACTION_PPPOE_PUSH.patch + create mode 100644 target/linux/generic/pending-5.10/640-20-netfilter-flowtable-support-for-FLOW_ACTION_PPPOE_PU.patch create mode 100644 target/linux/generic/pending-5.10/655-increase_skb_pad.patch create mode 100644 target/linux/generic/pending-5.10/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch create mode 100644 target/linux/generic/pending-5.10/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch create mode 100644 target/linux/generic/pending-5.10/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch create mode 100644 target/linux/generic/pending-5.10/680-NET-skip-GRO-for-foreign-MAC-addresses.patch create mode 100644 target/linux/generic/pending-5.10/681-NET-add-of_get_mac_address_mtd.patch - create mode 100644 target/linux/generic/pending-5.10/690-net-add-support-for-threaded-NAPI-polling.patch - create mode 100644 target/linux/generic/pending-5.10/691-net-add-sysfs-attribute-for-enabling-threaded-NAPI.patch create mode 100644 target/linux/generic/pending-5.10/703-phy-add-detach-callback-to-struct-phy_driver.patch create mode 100644 target/linux/generic/pending-5.10/735-net-phy-at803x-fix-at8033-sgmii-mode.patch create mode 100644 target/linux/generic/pending-5.10/760-net-dsa-mv88e6xxx-fix-vlan-setup.patch create mode 100644 target/linux/generic/pending-5.10/761-net-dsa-mt7530-Support-EEE-features.patch + create mode 100644 target/linux/generic/pending-5.10/762-net-bridge-switchdev-Refactor-br_switchdev_fdb_notif.patch + create mode 100644 target/linux/generic/pending-5.10/763-net-bridge-switchdev-Include-local-flag-in-FDB-notif.patch + create mode 100644 target/linux/generic/pending-5.10/764-net-bridge-switchdev-Send-FDB-notifications-for-host.patch + create mode 100644 target/linux/generic/pending-5.10/765-net-dsa-Include-local-addresses-in-assisted-CPU-port.patch + create mode 100644 target/linux/generic/pending-5.10/766-net-dsa-Include-bridge-addresses-in-assisted-CPU-por.patch + create mode 100644 target/linux/generic/pending-5.10/767-net-dsa-Sync-static-FDB-entries-on-foreign-interface.patch + create mode 100644 target/linux/generic/pending-5.10/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch create mode 100644 target/linux/generic/pending-5.10/770-00-net-ethernet-mtk_eth_soc-use-napi_consume_skb.patch create mode 100644 target/linux/generic/pending-5.10/770-01-net-ethernet-mtk_eth_soc-significantly-reduce-mdio-b.patch create mode 100644 target/linux/generic/pending-5.10/770-02-net-ethernet-mtk_eth_soc-fix-rx-vlan-offload.patch @@ -315,23 +416,225 @@ Signed-off-by: Felix Fietkau create mode 100644 target/linux/generic/pending-5.10/811-pci_disable_usb_common_quirks.patch create mode 100644 target/linux/generic/pending-5.10/820-w1-gpio-fix-problem-with-platfom-data-in-w1-gpio.patch create mode 100644 target/linux/generic/pending-5.10/834-ledtrig-libata.patch + create mode 100644 target/linux/generic/pending-5.10/840-hwrng-bcm2835-set-quality-to-1000.patch create mode 100644 target/linux/generic/pending-5.10/920-mangle_bootargs.patch -diff --git a/include/kernel-version.mk b/include/kernel-version.mk -index d65eb790d8..035692f3e3 100644 ---- a/include/kernel-version.mk -+++ b/include/kernel-version.mk -@@ -7,8 +7,10 @@ ifdef CONFIG_TESTING_KERNEL - endif +diff --git a/include/image-commands.mk b/include/image-commands.mk +index 51e745958e..bddbed6052 100644 +--- a/include/image-commands.mk ++++ b/include/image-commands.mk +@@ -200,11 +200,12 @@ define Build/fit + $(TOPDIR)/scripts/mkits.sh \ + -D $(DEVICE_NAME) -o $@.its -k $@ \ + $(if $(word 2,$(1)),-d $(word 2,$(1))) -C $(word 1,$(1)) \ ++ $(if $(word 3,$(1)),-r $(IMAGE_ROOTFS) -f $(subst _,$(comma),$(DEVICE_NAME))) \ + -a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \ + $(if $(DEVICE_FDT_NUM),-n $(DEVICE_FDT_NUM)) \ + -c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config@1") \ + -A $(LINUX_KARCH) -v $(LINUX_VERSION) +- PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new ++ PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(word 3,$(1)),-E -B 0x1000 -p 0x1000) -f $@.its $@.new + @mv $@.new $@ + endef - LINUX_VERSION-5.4 = .105 -+LINUX_VERSION-5.10 = .14 +diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh +index e6f58df4f5..5bc9ff83f9 100644 +--- a/package/base-files/files/lib/upgrade/nand.sh ++++ b/package/base-files/files/lib/upgrade/nand.sh +@@ -3,13 +3,13 @@ - LINUX_KERNEL_HASH-5.4.105 = 244e4cd16184285df55ec5a9501daba011aa8b85c5527ee05eab4592e70fb8b6 -+LINUX_KERNEL_HASH-5.10.14 = fa27b79f198b5be969e497ed5461860df48e0591c85e60699fc8be26837a1d2a + . /lib/functions.sh - remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1)))) - sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1))))))) +-# 'kernel' partition on NAND contains the kernel ++# 'kernel' partition or UBI volume on NAND contains the kernel + CI_KERNPART="${CI_KERNPART:-kernel}" + + # 'ubi' partition on NAND contains UBI + CI_UBIPART="${CI_UBIPART:-ubi}" + +-# 'rootfs' partition on NAND contains the rootfs ++# 'rootfs' UBI volume on NAND contains the rootfs + CI_ROOTPART="${CI_ROOTPART:-rootfs}" + + ubi_mknod() { +@@ -117,9 +117,11 @@ nand_restore_config() { + nand_upgrade_prepare_ubi() { + local rootfs_length="$1" + local rootfs_type="$2" +- local has_kernel="${3:-0}" ++ local kernel_length="$3" + local has_env="${4:-0}" + ++ [ -n "$rootfs_length" -o -n "$kernel_length" ] || return 1 ++ + local mtdnum="$( find_mtd_index "$CI_UBIPART" )" + if [ ! "$mtdnum" ]; then + echo "cannot find ubi mtd partition $CI_UBIPART" +@@ -148,23 +150,24 @@ nand_upgrade_prepare_ubi() { + local root_ubivol="$( nand_find_volume $ubidev $CI_ROOTPART )" + local data_ubivol="$( nand_find_volume $ubidev rootfs_data )" + +- # remove ubiblock device of rootfs +- local root_ubiblk="ubiblock${root_ubivol:3}" +- if [ "$root_ubivol" -a -e "/dev/$root_ubiblk" ]; then +- echo "removing $root_ubiblk" +- if ! ubiblock -r /dev/$root_ubivol; then +- echo "cannot remove $root_ubiblk" +- return 1; ++ local ubiblk ubiblkvol ++ for ubiblk in /dev/ubiblock*_? ; do ++ [ -e "$ubiblk" ] || continue ++ echo "removing ubiblock${ubiblk:13}" ++ ubiblkvol=ubi${ubiblk:13} ++ if ! ubiblock -r /dev/$ubiblkvol; then ++ echo "cannot remove $ubiblk" ++ return 1 + fi +- fi ++ done + + # kill volumes + [ "$kern_ubivol" ] && ubirmvol /dev/$ubidev -N $CI_KERNPART || true +- [ "$root_ubivol" ] && ubirmvol /dev/$ubidev -N $CI_ROOTPART || true ++ [ "$root_ubivol" -a "$root_ubivol" != "$kern_ubivol" ] && ubirmvol /dev/$ubidev -N $CI_ROOTPART || true + [ "$data_ubivol" ] && ubirmvol /dev/$ubidev -N rootfs_data || true + + # update kernel +- if [ "$has_kernel" = "1" ]; then ++ if [ -n "$kernel_length" ]; then + if ! ubimkvol /dev/$ubidev -N $CI_KERNPART -s $kernel_length; then + echo "cannot create kernel volume" + return 1; +@@ -172,15 +175,17 @@ nand_upgrade_prepare_ubi() { + fi + + # update rootfs +- local root_size_param +- if [ "$rootfs_type" = "ubifs" ]; then +- root_size_param="-m" +- else +- root_size_param="-s $rootfs_length" +- fi +- if ! ubimkvol /dev/$ubidev -N $CI_ROOTPART $root_size_param; then +- echo "cannot create rootfs volume" +- return 1; ++ if [ -n "$rootfs_length" ]; then ++ local root_size_param ++ if [ "$rootfs_type" = "ubifs" ]; then ++ root_size_param="-m" ++ else ++ root_size_param="-s $rootfs_length" ++ fi ++ if ! ubimkvol /dev/$ubidev -N $CI_ROOTPART $rootfs_size_param; then ++ echo "cannot create rootfs volume" ++ return 1; ++ fi + fi + + # create rootfs_data for non-ubifs rootfs +@@ -232,7 +237,7 @@ nand_upgrade_ubinized() { + nand_upgrade_ubifs() { + local rootfs_length=$( (cat $1 | wc -c) 2> /dev/null) + +- nand_upgrade_prepare_ubi "$rootfs_length" "ubifs" "0" "0" ++ nand_upgrade_prepare_ubi "$rootfs_length" "ubifs" "" "" + + local ubidev="$( nand_find_ubi "$CI_UBIPART" )" + local root_ubivol="$(nand_find_volume $ubidev $CI_ROOTPART)" +@@ -241,39 +246,59 @@ nand_upgrade_ubifs() { + nand_do_upgrade_success + } + ++nand_upgrade_fit() { ++ local fit_file="$1" ++ local fit_length="$(wc -c < "$fit_file")" ++ ++ nand_upgrade_prepare_ubi "" "" "$fit_length" "1" ++ ++ local fit_ubidev="$(nand_find_ubi "$CI_UBIPART")" ++ local fit_ubivol="$(nand_find_volume $fit_ubidev "$CI_KERNPART")" ++ ubiupdatevol /dev/$fit_ubivol -s $fit_length $fit_file ++ ++ nand_do_upgrade_success ++} ++ + nand_upgrade_tar() { + local tar_file="$1" + local kernel_mtd="$(find_mtd_index $CI_KERNPART)" + +- local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$') ++ local board_dir=$(tar tf "$tar_file" | grep -m 1 '^sysupgrade-.*/$') + board_dir=${board_dir%/} + +- local kernel_length=$( (tar xf $tar_file ${board_dir}/kernel -O | wc -c) 2> /dev/null) +- local rootfs_length=$( (tar xf $tar_file ${board_dir}/root -O | wc -c) 2> /dev/null) ++ kernel_length=$( (tar xf "$tar_file" ${board_dir}/kernel -O | wc -c) 2> /dev/null) ++ local has_rootfs=0 ++ local rootfs_length ++ local rootfs_type + +- local rootfs_type="$(identify_tar "$tar_file" ${board_dir}/root)" ++ tar tf "$tar_file" ${board_dir}/root 1>/dev/null 2>/dev/null && has_rootfs=1 ++ [ "$has_rootfs" = "1" ] && { ++ rootfs_length=$( (tar xf "$tar_file" ${board_dir}/root -O | wc -c) 2> /dev/null) ++ rootfs_type="$(identify_tar "$tar_file" ${board_dir}/root)" ++ } + + local has_kernel=1 + local has_env=0 + + [ "$kernel_length" != 0 -a -n "$kernel_mtd" ] && { +- tar xf $tar_file ${board_dir}/kernel -O | mtd write - $CI_KERNPART ++ tar xf "$tar_file" ${board_dir}/kernel -O | mtd write - $CI_KERNPART + } +- [ "$kernel_length" = 0 -o ! -z "$kernel_mtd" ] && has_kernel=0 ++ [ "$kernel_length" = 0 -o ! -z "$kernel_mtd" ] && has_kernel= + +- nand_upgrade_prepare_ubi "$rootfs_length" "$rootfs_type" "$has_kernel" "$has_env" ++ nand_upgrade_prepare_ubi "$rootfs_length" "$rootfs_type" "${has_kernel:+$kernel_length}" "$has_env" + + local ubidev="$( nand_find_ubi "$CI_UBIPART" )" + [ "$has_kernel" = "1" ] && { +- local kern_ubivol="$(nand_find_volume $ubidev $CI_KERNPART)" +- tar xf $tar_file ${board_dir}/kernel -O | \ ++ local kern_ubivol="$( nand_find_volume $ubidev $CI_KERNPART )" ++ tar xf "$tar_file" ${board_dir}/kernel -O | \ + ubiupdatevol /dev/$kern_ubivol -s $kernel_length - + } + +- local root_ubivol="$(nand_find_volume $ubidev $CI_ROOTPART)" +- tar xf $tar_file ${board_dir}/root -O | \ +- ubiupdatevol /dev/$root_ubivol -s $rootfs_length - +- ++ [ "$has_rootfs" = "1" ] && { ++ local root_ubivol="$( nand_find_volume $ubidev $CI_ROOTPART )" ++ tar xf "$tar_file" ${board_dir}/root -O | \ ++ ubiupdatevol /dev/$root_ubivol -s $rootfs_length - ++ } + nand_do_upgrade_success + } + +@@ -281,9 +306,10 @@ nand_upgrade_tar() { + nand_do_upgrade() { + local file_type=$(identify $1) + +- [ ! "$(find_mtd_index "$CI_UBIPART")" ] && CI_UBIPART="rootfs" ++ [ ! "$( find_mtd_index "$CI_UBIPART" )" ] && CI_UBIPART="rootfs" + + case "$file_type" in ++ "fit") nand_upgrade_fit $1;; + "ubi") nand_upgrade_ubinized $1;; + "ubifs") nand_upgrade_ubifs $1;; + *) nand_upgrade_tar $1;; +@@ -309,7 +335,7 @@ nand_do_platform_check() { + local control_length=$( (tar xf $tar_file sysupgrade-$board_name/CONTROL -O | wc -c) 2> /dev/null) + local file_type="$(identify $2)" + +- [ "$control_length" = 0 -a "$file_type" != "ubi" -a "$file_type" != "ubifs" ] && { ++ [ "$control_length" = 0 -a "$file_type" != "ubi" -a "$file_type" != "ubifs" -a "$file_type" != "fit" ] && { + echo "Invalid sysupgrade file." + return 1 + } diff --git a/package/kernel/linux/modules/block.mk b/package/kernel/linux/modules/block.mk index 373c9fbaab..b7767b3d16 100644 --- a/package/kernel/linux/modules/block.mk @@ -451,6 +754,125 @@ index d050165df3..3dd20a0696 100644 endef define KernelPackage/usb-net-cdc-ncm/description +diff --git a/scripts/mkits.sh b/scripts/mkits.sh +index bb629d6fca..3d68fdacbc 100755 +--- a/scripts/mkits.sh ++++ b/scripts/mkits.sh +@@ -23,18 +23,23 @@ usage() { + printf "\n\t-c ==> set config name 'config'" + printf "\n\t-a ==> set load address to 'addr' (hex)" + printf "\n\t-e ==> set entry point to 'entry' (hex)" ++ printf "\n\t-f ==> set device tree compatible string" + printf "\n\t-v ==> set kernel version to 'version'" + printf "\n\t-k ==> include kernel image 'kernel'" + printf "\n\t-D ==> human friendly Device Tree Blob 'name'" + printf "\n\t-n ==> fdt unit-address 'address'" + printf "\n\t-d ==> include Device Tree Blob 'dtb'" ++ printf "\n\t-r ==> include RootFS blob" ++ printf "\n\t-H ==> specify hash algo instead of SHA1" + printf "\n\t-o ==> create output file 'its_file'\n" + exit 1 + } + + FDTNUM=1 ++ROOTFSNUM=1 ++HASH=sha1 + +-while getopts ":A:a:c:C:D:d:e:k:n:o:v:" OPTION ++while getopts ":A:a:c:C:D:d:e:f:k:n:o:v:r:S" OPTION + do + case $OPTION in + A ) ARCH=$OPTARG;; +@@ -44,9 +49,12 @@ do + D ) DEVICE=$OPTARG;; + d ) DTB=$OPTARG;; + e ) ENTRY_ADDR=$OPTARG;; ++ f ) COMPATIBLE=$OPTARG;; + k ) KERNEL=$OPTARG;; + n ) FDTNUM=$OPTARG;; + o ) OUTPUT=$OPTARG;; ++ r ) ROOTFS=$OPTARG;; ++ S ) HASH=$OPTARG;; + v ) VERSION=$OPTARG;; + * ) echo "Invalid option passed to '$0' (options:$*)" + usage;; +@@ -62,11 +70,16 @@ fi + + ARCH_UPPER=$(echo "$ARCH" | tr '[:lower:]' '[:upper:]') + ++if [ -n "${COMPATIBLE}" ]; then ++ COMPATIBLE_PROP="compatible = \"${COMPATIBLE}\";" ++fi ++ + # Conditionally create fdt information + if [ -n "${DTB}" ]; then + FDT_NODE=" + fdt@$FDTNUM { + description = \"${ARCH_UPPER} OpenWrt ${DEVICE} device tree blob\"; ++ ${COMPATIBLE_PROP} + data = /incbin/(\"${DTB}\"); + type = \"flat_dt\"; + arch = \"${ARCH}\"; +@@ -75,13 +88,34 @@ if [ -n "${DTB}" ]; then + algo = \"crc32\"; + }; + hash@2 { +- algo = \"sha1\"; ++ algo = \"${HASH}\"; + }; + }; + " + FDT_PROP="fdt = \"fdt@$FDTNUM\";" + fi + ++if [ -n "${ROOTFS}" ]; then ++ dd if="${ROOTFS}" of="${ROOTFS}.pagesync" bs=4096 conv=sync ++ ROOTFS_NODE=" ++ rootfs@$ROOTFSNUM { ++ description = \"${ARCH_UPPER} OpenWrt ${DEVICE} rootfs\"; ++ ${COMPATIBLE_PROP} ++ data = /incbin/(\"${ROOTFS}.pagesync\"); ++ type = \"filesystem\"; ++ arch = \"${ARCH}\"; ++ compression = \"none\"; ++ hash@1 { ++ algo = \"crc32\"; ++ }; ++ hash@2 { ++ algo = \"${HASH}\"; ++ }; ++ }; ++" ++ ROOTFS_PROP="loadables = \"rootfs@${ROOTFSNUM}\";" ++fi ++ + # Create a default, fully populated DTS file + DATA="/dts-v1/; + +@@ -103,18 +137,21 @@ DATA="/dts-v1/; + algo = \"crc32\"; + }; + hash@2 { +- algo = \"sha1\"; ++ algo = \"$HASH\"; + }; + }; + ${FDT_NODE} ++${ROOTFS_NODE} + }; + + configurations { + default = \"${CONFIG}\"; + ${CONFIG} { +- description = \"OpenWrt\"; ++ description = \"OpenWrt ${DEVICE}\"; + kernel = \"kernel@1\"; + ${FDT_PROP} ++ ${ROOTFS_PROP} ++ ${COMPATIBLE_PROP} + }; + }; + };" diff --git a/target/linux/generic/backport-5.10/010-Kbuild-don-t-hardcode-path-to-awk-in-scripts-ld-vers.patch b/target/linux/generic/backport-5.10/010-Kbuild-don-t-hardcode-path-to-awk-in-scripts-ld-vers.patch new file mode 100644 index 0000000000..7ac4f9d240 @@ -489,7 +911,7 @@ index 0000000000..7ac4f9d240 ++' diff --git a/target/linux/generic/backport-5.10/011-kbuild-export-SUBARCH.patch b/target/linux/generic/backport-5.10/011-kbuild-export-SUBARCH.patch new file mode 100644 -index 0000000000..a1f0d9aa96 +index 0000000000..bb99e4ddbf --- /dev/null +++ b/target/linux/generic/backport-5.10/011-kbuild-export-SUBARCH.patch @@ -0,0 +1,21 @@ @@ -505,7 +927,7 @@ index 0000000000..a1f0d9aa96 + +--- a/Makefile ++++ b/Makefile -+@@ -506,7 +506,7 @@ KBUILD_LDFLAGS_MODULE := ++@@ -507,7 +507,7 @@ KBUILD_LDFLAGS_MODULE := + KBUILD_LDFLAGS := + CLANG_FLAGS := + @@ -514,6 +936,376 @@ index 0000000000..a1f0d9aa96 + export CPP AR NM STRIP OBJCOPY OBJDUMP READELF PAHOLE RESOLVE_BTFIDS LEX YACC AWK INSTALLKERNEL + export PERL PYTHON PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX + export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD +diff --git a/target/linux/generic/backport-5.10/071-crypto-arm-chacha-neon-optimize-for-non-block-size-m.patch b/target/linux/generic/backport-5.10/071-crypto-arm-chacha-neon-optimize-for-non-block-size-m.patch +new file mode 100644 +index 0000000000..b1f46e9af8 +--- /dev/null ++++ b/target/linux/generic/backport-5.10/071-crypto-arm-chacha-neon-optimize-for-non-block-size-m.patch +@@ -0,0 +1,272 @@ ++From 03662fcd41f4b764857f17b95f9a2a63c24bddd4 Mon Sep 17 00:00:00 2001 ++From: Ard Biesheuvel ++Date: Tue, 3 Nov 2020 17:28:09 +0100 ++Subject: [PATCH 1/2] crypto: arm/chacha-neon - optimize for non-block size ++ multiples ++ ++commit 86cd97ec4b943af35562a74688bc4e909b32c3d1 upstream. ++ ++The current NEON based ChaCha implementation for ARM is optimized for ++multiples of 4x the ChaCha block size (64 bytes). This makes sense for ++block encryption, but given that ChaCha is also often used in the ++context of networking, it makes sense to consider arbitrary length ++inputs as well. ++ ++For example, WireGuard typically uses 1420 byte packets, and performing ++ChaCha encryption involves 5 invocations of chacha_4block_xor_neon() ++and 3 invocations of chacha_block_xor_neon(), where the last one also ++involves a memcpy() using a buffer on the stack to process the final ++chunk of 1420 % 64 == 12 bytes. ++ ++Let's optimize for this case as well, by letting chacha_4block_xor_neon() ++deal with any input size between 64 and 256 bytes, using NEON permutation ++instructions and overlapping loads and stores. This way, the 140 byte ++tail of a 1420 byte input buffer can simply be processed in one go. ++ ++This results in the following performance improvements for 1420 byte ++blocks, without significant impact on power-of-2 input sizes. (Note ++that Raspberry Pi is widely used in combination with a 32-bit kernel, ++even though the core is 64-bit capable) ++ ++ Cortex-A8 (BeagleBone) : 7% ++ Cortex-A15 (Calxeda Midway) : 21% ++ Cortex-A53 (Raspberry Pi 3) : 3% ++ Cortex-A72 (Raspberry Pi 4) : 19% ++ ++Cc: Eric Biggers ++Cc: "Jason A . Donenfeld" ++Signed-off-by: Ard Biesheuvel ++Signed-off-by: Herbert Xu ++Signed-off-by: Jason A. Donenfeld ++--- ++ arch/arm/crypto/chacha-glue.c | 34 +++++------ ++ arch/arm/crypto/chacha-neon-core.S | 97 +++++++++++++++++++++++++++--- ++ 2 files changed, 107 insertions(+), 24 deletions(-) ++ ++--- a/arch/arm/crypto/chacha-glue.c +++++ b/arch/arm/crypto/chacha-glue.c ++@@ -23,7 +23,7 @@ ++ asmlinkage void chacha_block_xor_neon(const u32 *state, u8 *dst, const u8 *src, ++ int nrounds); ++ asmlinkage void chacha_4block_xor_neon(const u32 *state, u8 *dst, const u8 *src, ++- int nrounds); +++ int nrounds, unsigned int nbytes); ++ asmlinkage void hchacha_block_arm(const u32 *state, u32 *out, int nrounds); ++ asmlinkage void hchacha_block_neon(const u32 *state, u32 *out, int nrounds); ++ ++@@ -42,24 +42,24 @@ static void chacha_doneon(u32 *state, u8 ++ { ++ u8 buf[CHACHA_BLOCK_SIZE]; ++ ++- while (bytes >= CHACHA_BLOCK_SIZE * 4) { ++- chacha_4block_xor_neon(state, dst, src, nrounds); ++- bytes -= CHACHA_BLOCK_SIZE * 4; ++- src += CHACHA_BLOCK_SIZE * 4; ++- dst += CHACHA_BLOCK_SIZE * 4; ++- state[12] += 4; ++- } ++- while (bytes >= CHACHA_BLOCK_SIZE) { ++- chacha_block_xor_neon(state, dst, src, nrounds); ++- bytes -= CHACHA_BLOCK_SIZE; ++- src += CHACHA_BLOCK_SIZE; ++- dst += CHACHA_BLOCK_SIZE; ++- state[12]++; +++ while (bytes > CHACHA_BLOCK_SIZE) { +++ unsigned int l = min(bytes, CHACHA_BLOCK_SIZE * 4U); +++ +++ chacha_4block_xor_neon(state, dst, src, nrounds, l); +++ bytes -= l; +++ src += l; +++ dst += l; +++ state[12] += DIV_ROUND_UP(l, CHACHA_BLOCK_SIZE); ++ } ++ if (bytes) { ++- memcpy(buf, src, bytes); ++- chacha_block_xor_neon(state, buf, buf, nrounds); ++- memcpy(dst, buf, bytes); +++ const u8 *s = src; +++ u8 *d = dst; +++ +++ if (bytes != CHACHA_BLOCK_SIZE) +++ s = d = memcpy(buf, src, bytes); +++ chacha_block_xor_neon(state, d, s, nrounds); +++ if (d != dst) +++ memcpy(dst, buf, bytes); ++ } ++ } ++ ++--- a/arch/arm/crypto/chacha-neon-core.S +++++ b/arch/arm/crypto/chacha-neon-core.S ++@@ -47,6 +47,7 @@ ++ */ ++ ++ #include +++#include ++ ++ .text ++ .fpu neon ++@@ -205,7 +206,7 @@ ENDPROC(hchacha_block_neon) ++ ++ .align 5 ++ ENTRY(chacha_4block_xor_neon) ++- push {r4-r5} +++ push {r4, lr} ++ mov r4, sp // preserve the stack pointer ++ sub ip, sp, #0x20 // allocate a 32 byte buffer ++ bic ip, ip, #0x1f // aligned to 32 bytes ++@@ -229,10 +230,10 @@ ENTRY(chacha_4block_xor_neon) ++ vld1.32 {q0-q1}, [r0] ++ vld1.32 {q2-q3}, [ip] ++ ++- adr r5, .Lctrinc +++ adr lr, .Lctrinc ++ vdup.32 q15, d7[1] ++ vdup.32 q14, d7[0] ++- vld1.32 {q4}, [r5, :128] +++ vld1.32 {q4}, [lr, :128] ++ vdup.32 q13, d6[1] ++ vdup.32 q12, d6[0] ++ vdup.32 q11, d5[1] ++@@ -455,7 +456,7 @@ ENTRY(chacha_4block_xor_neon) ++ ++ // Re-interleave the words in the first two rows of each block (x0..7). ++ // Also add the counter values 0-3 to x12[0-3]. ++- vld1.32 {q8}, [r5, :128] // load counter values 0-3 +++ vld1.32 {q8}, [lr, :128] // load counter values 0-3 ++ vzip.32 q0, q1 // => (0 1 0 1) (0 1 0 1) ++ vzip.32 q2, q3 // => (2 3 2 3) (2 3 2 3) ++ vzip.32 q4, q5 // => (4 5 4 5) (4 5 4 5) ++@@ -493,6 +494,8 @@ ENTRY(chacha_4block_xor_neon) ++ ++ // Re-interleave the words in the last two rows of each block (x8..15). ++ vld1.32 {q8-q9}, [sp, :256] +++ mov sp, r4 // restore original stack pointer +++ ldr r4, [r4, #8] // load number of bytes ++ vzip.32 q12, q13 // => (12 13 12 13) (12 13 12 13) ++ vzip.32 q14, q15 // => (14 15 14 15) (14 15 14 15) ++ vzip.32 q8, q9 // => (8 9 8 9) (8 9 8 9) ++@@ -520,41 +523,121 @@ ENTRY(chacha_4block_xor_neon) ++ // XOR the rest of the data with the keystream ++ ++ vld1.8 {q0-q1}, [r2]! +++ subs r4, r4, #96 ++ veor q0, q0, q8 ++ veor q1, q1, q12 +++ ble .Lle96 ++ vst1.8 {q0-q1}, [r1]! ++ ++ vld1.8 {q0-q1}, [r2]! +++ subs r4, r4, #32 ++ veor q0, q0, q2 ++ veor q1, q1, q6 +++ ble .Lle128 ++ vst1.8 {q0-q1}, [r1]! ++ ++ vld1.8 {q0-q1}, [r2]! +++ subs r4, r4, #32 ++ veor q0, q0, q10 ++ veor q1, q1, q14 +++ ble .Lle160 ++ vst1.8 {q0-q1}, [r1]! ++ ++ vld1.8 {q0-q1}, [r2]! +++ subs r4, r4, #32 ++ veor q0, q0, q4 ++ veor q1, q1, q5 +++ ble .Lle192 ++ vst1.8 {q0-q1}, [r1]! ++ ++ vld1.8 {q0-q1}, [r2]! +++ subs r4, r4, #32 ++ veor q0, q0, q9 ++ veor q1, q1, q13 +++ ble .Lle224 ++ vst1.8 {q0-q1}, [r1]! ++ ++ vld1.8 {q0-q1}, [r2]! +++ subs r4, r4, #32 ++ veor q0, q0, q3 ++ veor q1, q1, q7 +++ blt .Llt256 +++.Lout: ++ vst1.8 {q0-q1}, [r1]! ++ ++ vld1.8 {q0-q1}, [r2] ++- mov sp, r4 // restore original stack pointer ++ veor q0, q0, q11 ++ veor q1, q1, q15 ++ vst1.8 {q0-q1}, [r1] ++ ++- pop {r4-r5} ++- bx lr +++ pop {r4, pc} +++ +++.Lle192: +++ vmov q4, q9 +++ vmov q5, q13 +++ +++.Lle160: +++ // nothing to do +++ +++.Lfinalblock: +++ // Process the final block if processing less than 4 full blocks. +++ // Entered with 32 bytes of ChaCha cipher stream in q4-q5, and the +++ // previous 32 byte output block that still needs to be written at +++ // [r1] in q0-q1. +++ beq .Lfullblock +++ +++.Lpartialblock: +++ adr lr, .Lpermute + 32 +++ add r2, r2, r4 +++ add lr, lr, r4 +++ add r4, r4, r1 +++ +++ vld1.8 {q2-q3}, [lr] +++ vld1.8 {q6-q7}, [r2] +++ +++ add r4, r4, #32 +++ +++ vtbl.8 d4, {q4-q5}, d4 +++ vtbl.8 d5, {q4-q5}, d5 +++ vtbl.8 d6, {q4-q5}, d6 +++ vtbl.8 d7, {q4-q5}, d7 +++ +++ veor q6, q6, q2 +++ veor q7, q7, q3 +++ +++ vst1.8 {q6-q7}, [r4] // overlapping stores +++ vst1.8 {q0-q1}, [r1] +++ pop {r4, pc} +++ +++.Lfullblock: +++ vmov q11, q4 +++ vmov q15, q5 +++ b .Lout +++.Lle96: +++ vmov q4, q2 +++ vmov q5, q6 +++ b .Lfinalblock +++.Lle128: +++ vmov q4, q10 +++ vmov q5, q14 +++ b .Lfinalblock +++.Lle224: +++ vmov q4, q3 +++ vmov q5, q7 +++ b .Lfinalblock +++.Llt256: +++ vmov q4, q11 +++ vmov q5, q15 +++ b .Lpartialblock ++ ENDPROC(chacha_4block_xor_neon) +++ +++ .align L1_CACHE_SHIFT +++.Lpermute: +++ .byte 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 +++ .byte 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f +++ .byte 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 +++ .byte 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f +++ .byte 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 +++ .byte 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f +++ .byte 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 +++ .byte 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f +diff --git a/target/linux/generic/backport-5.10/072-crypto-arm-chacha-neon-add-missing-counter-increment.patch b/target/linux/generic/backport-5.10/072-crypto-arm-chacha-neon-add-missing-counter-increment.patch +new file mode 100644 +index 0000000000..1e4d2041e5 +--- /dev/null ++++ b/target/linux/generic/backport-5.10/072-crypto-arm-chacha-neon-add-missing-counter-increment.patch +@@ -0,0 +1,38 @@ ++From 7f63462faf9eab69132bea9abd48c2c05a93145b Mon Sep 17 00:00:00 2001 ++From: Ard Biesheuvel ++Date: Sun, 13 Dec 2020 15:39:29 +0100 ++Subject: [PATCH 2/2] crypto: arm/chacha-neon - add missing counter increment ++ ++commit fd16931a2f518a32753920ff20895e5cf04c8ff1 upstream. ++ ++Commit 86cd97ec4b943af3 ("crypto: arm/chacha-neon - optimize for non-block ++size multiples") refactored the chacha block handling in the glue code in ++a way that may result in the counter increment to be omitted when calling ++chacha_block_xor_neon() to process a full block. This violates the skcipher ++API, which requires that the output IV is suitable for handling more input ++as long as the preceding input has been presented in round multiples of the ++block size. Also, the same code is exposed via the chacha library interface ++whose callers may actually rely on this increment to occur even for final ++blocks that are smaller than the chacha block size. ++ ++So increment the counter after calling chacha_block_xor_neon(). ++ ++Fixes: 86cd97ec4b943af3 ("crypto: arm/chacha-neon - optimize for non-block size multiples") ++Reported-by: Eric Biggers ++Signed-off-by: Ard Biesheuvel ++Signed-off-by: Herbert Xu ++Signed-off-by: Jason A. Donenfeld ++--- ++ arch/arm/crypto/chacha-glue.c | 1 + ++ 1 file changed, 1 insertion(+) ++ ++--- a/arch/arm/crypto/chacha-glue.c +++++ b/arch/arm/crypto/chacha-glue.c ++@@ -60,6 +60,7 @@ static void chacha_doneon(u32 *state, u8 ++ chacha_block_xor_neon(state, d, s, nrounds); ++ if (d != dst) ++ memcpy(dst, buf, bytes); +++ state[12]++; ++ } ++ } ++ +diff --git a/target/linux/generic/backport-5.10/080-wireguard-peer-put-frequently-used-members-above-cac.patch b/target/linux/generic/backport-5.10/080-wireguard-peer-put-frequently-used-members-above-cac.patch +new file mode 100644 +index 0000000000..444fd677b4 +--- /dev/null ++++ b/target/linux/generic/backport-5.10/080-wireguard-peer-put-frequently-used-members-above-cac.patch +@@ -0,0 +1,42 @@ ++From a13827e9091c07e25cdeec9a402d74a27e2a1111 Mon Sep 17 00:00:00 2001 ++From: "Jason A. Donenfeld" ++Date: Mon, 22 Feb 2021 17:25:46 +0100 ++Subject: [PATCH] wireguard: peer: put frequently used members above cache ++ lines ++ ++commit 5a0598695634a6bb4126818902dd9140cd9df8b6 upstream. ++ ++The is_dead boolean is checked for every single packet, while the ++internal_id member is used basically only for pr_debug messages. So it ++makes sense to hoist up is_dead into some space formerly unused by a ++struct hole, while demoting internal_api to below the lowest struct ++cache line. ++ ++Signed-off-by: Jason A. Donenfeld ++Signed-off-by: Jakub Kicinski ++Signed-off-by: Jason A. Donenfeld ++--- ++ drivers/net/wireguard/peer.h | 4 ++-- ++ 1 file changed, 2 insertions(+), 2 deletions(-) ++ ++--- a/drivers/net/wireguard/peer.h +++++ b/drivers/net/wireguard/peer.h ++@@ -39,6 +39,7 @@ struct wg_peer { ++ struct prev_queue tx_queue, rx_queue; ++ struct sk_buff_head staged_packet_queue; ++ int serial_work_cpu; +++ bool is_dead; ++ struct noise_keypairs keypairs; ++ struct endpoint endpoint; ++ struct dst_cache endpoint_cache; ++@@ -61,9 +62,8 @@ struct wg_peer { ++ struct rcu_head rcu; ++ struct list_head peer_list; ++ struct list_head allowedips_list; ++- u64 internal_id; ++ struct napi_struct napi; ++- bool is_dead; +++ u64 internal_id; ++ }; ++ ++ struct wg_peer *wg_peer_create(struct wg_device *wg, diff --git a/target/linux/generic/backport-5.10/343-netfilter-nft_flow_offload-handle-netdevice-events-f.patch b/target/linux/generic/backport-5.10/343-netfilter-nft_flow_offload-handle-netdevice-events-f.patch new file mode 100644 index 0000000000..137264cb9f @@ -626,12 +1418,3882 @@ index 0000000000..137264cb9f + } + + module_init(nft_flow_offload_module_init); +diff --git a/target/linux/generic/backport-5.10/401-v5.11-dt-bindings-mtd-convert-fixed-partitions-to-the-json.patch b/target/linux/generic/backport-5.10/401-v5.11-dt-bindings-mtd-convert-fixed-partitions-to-the-json.patch +new file mode 100644 +index 0000000000..8aded43526 +--- /dev/null ++++ b/target/linux/generic/backport-5.10/401-v5.11-dt-bindings-mtd-convert-fixed-partitions-to-the-json.patch +@@ -0,0 +1,324 @@ ++From 04e9ab75267489224364fa510a88ada83e11c325 Mon Sep 17 00:00:00 2001 ++From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= ++Date: Thu, 10 Dec 2020 18:23:52 +0100 ++Subject: [PATCH] dt-bindings: mtd: convert "fixed-partitions" to the ++ json-schema ++MIME-Version: 1.0 ++Content-Type: text/plain; charset=UTF-8 ++Content-Transfer-Encoding: 8bit ++ ++This standardizes its documentation, allows validating with Makefile ++checks and helps writing DTS files. ++ ++Noticeable changes: ++1. Dropped "Partitions can be represented by sub-nodes of a flash ++ device." as we also support subpartitions (don't have to be part of ++ flash device node) ++2. Dropped "to Linux" as bindings are meant to be os agnostic. ++ ++Signed-off-by: Rafał Miłecki ++Link: https://lore.kernel.org/r/20201210172352.31632-1-zajec5@gmail.com ++Signed-off-by: Rob Herring ++--- ++ .../devicetree/bindings/mtd/partition.txt | 131 +-------------- ++ .../mtd/partitions/fixed-partitions.yaml | 152 ++++++++++++++++++ ++ 2 files changed, 154 insertions(+), 129 deletions(-) ++ create mode 100644 Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml ++ ++--- a/Documentation/devicetree/bindings/mtd/partition.txt +++++ b/Documentation/devicetree/bindings/mtd/partition.txt ++@@ -24,137 +24,10 @@ another partitioning method. ++ Available bindings are listed in the "partitions" subdirectory. ++ ++ ++-Fixed Partitions ++-================ ++- ++-Partitions can be represented by sub-nodes of a flash device. This can be used ++-on platforms which have strong conventions about which portions of a flash are ++-used for what purposes, but which don't use an on-flash partition table such ++-as RedBoot. ++- ++-The partition table should be a subnode of the flash node and should be named ++-'partitions'. This node should have the following property: ++-- compatible : (required) must be "fixed-partitions" ++-Partitions are then defined in subnodes of the partitions node. +++Deprecated: partitions defined in flash node +++============================================ ++ ++ For backwards compatibility partitions as direct subnodes of the flash device are ++ supported. This use is discouraged. ++ NOTE: also for backwards compatibility, direct subnodes that have a compatible ++ string are not considered partitions, as they may be used for other bindings. ++- ++-#address-cells & #size-cells must both be present in the partitions subnode of the ++-flash device. There are two valid values for both: ++-<1>: for partitions that require a single 32-bit cell to represent their ++- size/address (aka the value is below 4 GiB) ++-<2>: for partitions that require two 32-bit cells to represent their ++- size/address (aka the value is 4 GiB or greater). ++- ++-Required properties: ++-- reg : The partition's offset and size within the flash ++- ++-Optional properties: ++-- label : The label / name for this partition. If omitted, the label is taken ++- from the node name (excluding the unit address). ++-- read-only : This parameter, if present, is a hint to Linux that this ++- partition should only be mounted read-only. This is usually used for flash ++- partitions containing early-boot firmware images or data which should not be ++- clobbered. ++-- lock : Do not unlock the partition at initialization time (not supported on ++- all devices) ++-- slc-mode: This parameter, if present, allows one to emulate SLC mode on a ++- partition attached to an MLC NAND thus making this partition immune to ++- paired-pages corruptions ++- ++-Examples: ++- ++- ++-flash@0 { ++- partitions { ++- compatible = "fixed-partitions"; ++- #address-cells = <1>; ++- #size-cells = <1>; ++- ++- partition@0 { ++- label = "u-boot"; ++- reg = <0x0000000 0x100000>; ++- read-only; ++- }; ++- ++- uimage@100000 { ++- reg = <0x0100000 0x200000>; ++- }; ++- }; ++-}; ++- ++-flash@1 { ++- partitions { ++- compatible = "fixed-partitions"; ++- #address-cells = <1>; ++- #size-cells = <2>; ++- ++- /* a 4 GiB partition */ ++- partition@0 { ++- label = "filesystem"; ++- reg = <0x00000000 0x1 0x00000000>; ++- }; ++- }; ++-}; ++- ++-flash@2 { ++- partitions { ++- compatible = "fixed-partitions"; ++- #address-cells = <2>; ++- #size-cells = <2>; ++- ++- /* an 8 GiB partition */ ++- partition@0 { ++- label = "filesystem #1"; ++- reg = <0x0 0x00000000 0x2 0x00000000>; ++- }; ++- ++- /* a 4 GiB partition */ ++- partition@200000000 { ++- label = "filesystem #2"; ++- reg = <0x2 0x00000000 0x1 0x00000000>; ++- }; ++- }; ++-}; ++- ++-flash@3 { ++- partitions { ++- compatible = "fixed-partitions"; ++- #address-cells = <1>; ++- #size-cells = <1>; ++- ++- partition@0 { ++- label = "bootloader"; ++- reg = <0x000000 0x100000>; ++- read-only; ++- }; ++- ++- firmware@100000 { ++- label = "firmware"; ++- reg = <0x100000 0xe00000>; ++- compatible = "brcm,trx"; ++- }; ++- ++- calibration@f00000 { ++- label = "calibration"; ++- reg = <0xf00000 0x100000>; ++- compatible = "fixed-partitions"; ++- ranges = <0 0xf00000 0x100000>; ++- #address-cells = <1>; ++- #size-cells = <1>; ++- ++- partition@0 { ++- label = "wifi0"; ++- reg = <0x000000 0x080000>; ++- }; ++- ++- partition@80000 { ++- label = "wifi1"; ++- reg = <0x080000 0x080000>; ++- }; ++- }; ++- }; ++-}; ++--- /dev/null +++++ b/Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml ++@@ -0,0 +1,152 @@ +++# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +++%YAML 1.2 +++--- +++$id: http://devicetree.org/schemas/mtd/partitions/fixed-partitions.yaml# +++$schema: http://devicetree.org/meta-schemas/core.yaml# +++ +++title: Fixed partitions +++ +++description: | +++ This binding can be used on platforms which have strong conventions about +++ which portions of a flash are used for what purposes, but which don't use an +++ on-flash partition table such as RedBoot. +++ +++ The partition table should be a node named "partitions". Partitions are then +++ defined as subnodes. +++ +++maintainers: +++ - Rafał Miłecki +++ +++properties: +++ compatible: +++ const: fixed-partitions +++ +++ "#address-cells": true +++ +++ "#size-cells": true +++ +++patternProperties: +++ "@[0-9a-f]+$": +++ description: node describing a single flash partition +++ type: object +++ +++ properties: +++ reg: +++ description: partition's offset and size within the flash +++ maxItems: 1 +++ +++ label: +++ description: The label / name for this partition. If omitted, the label +++ is taken from the node name (excluding the unit address). +++ +++ read-only: +++ description: This parameter, if present, is a hint that this partition +++ should only be mounted read-only. This is usually used for flash +++ partitions containing early-boot firmware images or data which should +++ not be clobbered. +++ type: boolean +++ +++ lock: +++ description: Do not unlock the partition at initialization time (not +++ supported on all devices) +++ type: boolean +++ +++ slc-mode: +++ description: This parameter, if present, allows one to emulate SLC mode +++ on a partition attached to an MLC NAND thus making this partition +++ immune to paired-pages corruptions +++ type: boolean +++ +++ required: +++ - reg +++ +++required: +++ - "#address-cells" +++ - "#size-cells" +++ +++additionalProperties: true +++ +++examples: +++ - | +++ partitions { +++ compatible = "fixed-partitions"; +++ #address-cells = <1>; +++ #size-cells = <1>; +++ +++ partition@0 { +++ label = "u-boot"; +++ reg = <0x0000000 0x100000>; +++ read-only; +++ }; +++ +++ uimage@100000 { +++ reg = <0x0100000 0x200000>; +++ }; +++ }; +++ - | +++ partitions { +++ compatible = "fixed-partitions"; +++ #address-cells = <1>; +++ #size-cells = <2>; +++ +++ /* a 4 GiB partition */ +++ partition@0 { +++ label = "filesystem"; +++ reg = <0x00000000 0x1 0x00000000>; +++ }; +++ }; +++ - | +++ partitions { +++ compatible = "fixed-partitions"; +++ #address-cells = <2>; +++ #size-cells = <2>; +++ +++ /* an 8 GiB partition */ +++ partition@0 { +++ label = "filesystem #1"; +++ reg = <0x0 0x00000000 0x2 0x00000000>; +++ }; +++ +++ /* a 4 GiB partition */ +++ partition@200000000 { +++ label = "filesystem #2"; +++ reg = <0x2 0x00000000 0x1 0x00000000>; +++ }; +++ }; +++ - | +++ partitions { +++ compatible = "fixed-partitions"; +++ #address-cells = <1>; +++ #size-cells = <1>; +++ +++ partition@0 { +++ label = "bootloader"; +++ reg = <0x000000 0x100000>; +++ read-only; +++ }; +++ +++ firmware@100000 { +++ compatible = "brcm,trx"; +++ label = "firmware"; +++ reg = <0x100000 0xe00000>; +++ }; +++ +++ calibration@f00000 { +++ compatible = "fixed-partitions"; +++ label = "calibration"; +++ reg = <0xf00000 0x100000>; +++ ranges = <0 0xf00000 0x100000>; +++ #address-cells = <1>; +++ #size-cells = <1>; +++ +++ partition@0 { +++ label = "wifi0"; +++ reg = <0x000000 0x080000>; +++ }; +++ +++ partition@80000 { +++ label = "wifi1"; +++ reg = <0x080000 0x080000>; +++ }; +++ }; +++ }; +diff --git a/target/linux/generic/backport-5.10/402-v5.12-0001-dt-bindings-mtd-move-partition-binding-to-its-own-fi.patch b/target/linux/generic/backport-5.10/402-v5.12-0001-dt-bindings-mtd-move-partition-binding-to-its-own-fi.patch +new file mode 100644 +index 0000000000..f3b1179ecd +--- /dev/null ++++ b/target/linux/generic/backport-5.10/402-v5.12-0001-dt-bindings-mtd-move-partition-binding-to-its-own-fi.patch +@@ -0,0 +1,115 @@ ++From 6418522022c706fd867b00b2571edba48b8fa8c7 Mon Sep 17 00:00:00 2001 ++From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= ++Date: Thu, 11 Feb 2021 23:04:25 +0100 ++Subject: [PATCH] dt-bindings: mtd: move partition binding to its own file ++MIME-Version: 1.0 ++Content-Type: text/plain; charset=UTF-8 ++Content-Transfer-Encoding: 8bit ++ ++Single partition binding is quite common and may be: ++1. Used by multiple parsers ++2. Extended for more specific cases ++ ++Move it to separated file to avoid code duplication. ++ ++Signed-off-by: Rafał Miłecki ++Reviewed-by: Rob Herring ++Signed-off-by: Richard Weinberger ++--- ++ .../mtd/partitions/fixed-partitions.yaml | 33 +------------ ++ .../bindings/mtd/partitions/partition.yaml | 47 +++++++++++++++++++ ++ 2 files changed, 48 insertions(+), 32 deletions(-) ++ create mode 100644 Documentation/devicetree/bindings/mtd/partitions/partition.yaml ++ ++--- a/Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml +++++ b/Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml ++@@ -27,38 +27,7 @@ properties: ++ ++ patternProperties: ++ "@[0-9a-f]+$": ++- description: node describing a single flash partition ++- type: object ++- ++- properties: ++- reg: ++- description: partition's offset and size within the flash ++- maxItems: 1 ++- ++- label: ++- description: The label / name for this partition. If omitted, the label ++- is taken from the node name (excluding the unit address). ++- ++- read-only: ++- description: This parameter, if present, is a hint that this partition ++- should only be mounted read-only. This is usually used for flash ++- partitions containing early-boot firmware images or data which should ++- not be clobbered. ++- type: boolean ++- ++- lock: ++- description: Do not unlock the partition at initialization time (not ++- supported on all devices) ++- type: boolean ++- ++- slc-mode: ++- description: This parameter, if present, allows one to emulate SLC mode ++- on a partition attached to an MLC NAND thus making this partition ++- immune to paired-pages corruptions ++- type: boolean ++- ++- required: ++- - reg +++ $ref: "partition.yaml#" ++ ++ required: ++ - "#address-cells" ++--- /dev/null +++++ b/Documentation/devicetree/bindings/mtd/partitions/partition.yaml ++@@ -0,0 +1,47 @@ +++# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +++%YAML 1.2 +++--- +++$id: http://devicetree.org/schemas/mtd/partitions/partition.yaml# +++$schema: http://devicetree.org/meta-schemas/core.yaml# +++ +++title: Partition +++ +++description: | +++ This binding describes a single flash partition. Each partition must have its +++ relative offset and size specified. Depending on partition function extra +++ properties can be used. +++ +++maintainers: +++ - Rafał Miłecki +++ +++properties: +++ reg: +++ description: partition's offset and size within the flash +++ maxItems: 1 +++ +++ label: +++ description: The label / name for this partition. If omitted, the label +++ is taken from the node name (excluding the unit address). +++ +++ read-only: +++ description: This parameter, if present, is a hint that this partition +++ should only be mounted read-only. This is usually used for flash +++ partitions containing early-boot firmware images or data which should +++ not be clobbered. +++ type: boolean +++ +++ lock: +++ description: Do not unlock the partition at initialization time (not +++ supported on all devices) +++ type: boolean +++ +++ slc-mode: +++ description: This parameter, if present, allows one to emulate SLC mode +++ on a partition attached to an MLC NAND thus making this partition +++ immune to paired-pages corruptions +++ type: boolean +++ +++required: +++ - reg +++ +++additionalProperties: true +diff --git a/target/linux/generic/backport-5.10/402-v5.12-0002-dt-bindings-mtd-add-binding-for-BCM4908-partitions.patch b/target/linux/generic/backport-5.10/402-v5.12-0002-dt-bindings-mtd-add-binding-for-BCM4908-partitions.patch +new file mode 100644 +index 0000000000..8576c7d78d +--- /dev/null ++++ b/target/linux/generic/backport-5.10/402-v5.12-0002-dt-bindings-mtd-add-binding-for-BCM4908-partitions.patch +@@ -0,0 +1,92 @@ ++From 6e9dff6fe3fbc452f16566e4a7e293b0decefdba Mon Sep 17 00:00:00 2001 ++From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= ++Date: Thu, 11 Feb 2021 23:04:26 +0100 ++Subject: [PATCH] dt-bindings: mtd: add binding for BCM4908 partitions ++MIME-Version: 1.0 ++Content-Type: text/plain; charset=UTF-8 ++Content-Transfer-Encoding: 8bit ++ ++BCM4908 uses fixed partitions layout but function of some partitions may ++vary. Some devices use multiple firmware partitions and those partitions ++should be marked to let system discover their purpose. ++ ++Signed-off-by: Rafał Miłecki ++Signed-off-by: Richard Weinberger ++--- ++ .../partitions/brcm,bcm4908-partitions.yaml | 70 +++++++++++++++++++ ++ 1 file changed, 70 insertions(+) ++ create mode 100644 Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml ++ ++--- /dev/null +++++ b/Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml ++@@ -0,0 +1,70 @@ +++# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +++%YAML 1.2 +++--- +++$id: http://devicetree.org/schemas/mtd/partitions/brcm,bcm4908-partitions.yaml# +++$schema: http://devicetree.org/meta-schemas/core.yaml# +++ +++title: Broadcom BCM4908 partitioning +++ +++description: | +++ Broadcom BCM4908 CFE bootloader supports two firmware partitions. One is used +++ for regular booting, the other is treated as fallback. +++ +++ This binding allows defining all fixed partitions and marking those containing +++ firmware. System can use that information e.g. for booting or flashing +++ purposes. +++ +++maintainers: +++ - Rafał Miłecki +++ +++properties: +++ compatible: +++ const: brcm,bcm4908-partitions +++ +++ "#address-cells": +++ enum: [ 1, 2 ] +++ +++ "#size-cells": +++ enum: [ 1, 2 ] +++ +++patternProperties: +++ "^partition@[0-9a-f]+$": +++ $ref: "partition.yaml#" +++ properties: +++ compatible: +++ const: brcm,bcm4908-firmware +++ unevaluatedProperties: false +++ +++required: +++ - "#address-cells" +++ - "#size-cells" +++ +++additionalProperties: false +++ +++examples: +++ - | +++ partitions { +++ compatible = "brcm,bcm4908-partitions"; +++ #address-cells = <1>; +++ #size-cells = <1>; +++ +++ partition@0 { +++ label = "cferom"; +++ reg = <0x0 0x100000>; +++ }; +++ +++ partition@100000 { +++ compatible = "brcm,bcm4908-firmware"; +++ reg = <0x100000 0xf00000>; +++ }; +++ +++ partition@1000000 { +++ compatible = "brcm,bcm4908-firmware"; +++ reg = <0x1000000 0xf00000>; +++ }; +++ +++ partition@1f00000 { +++ label = "calibration"; +++ reg = <0x1f00000 0x100000>; +++ }; +++ }; +diff --git a/target/linux/generic/backport-5.10/403-v5.13-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch b/target/linux/generic/backport-5.10/403-v5.13-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch +new file mode 100644 +index 0000000000..d3891228e2 +--- /dev/null ++++ b/target/linux/generic/backport-5.10/403-v5.13-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch +@@ -0,0 +1,654 @@ ++From afbef8efb591792579c633a7c545f914c6165f82 Mon Sep 17 00:00:00 2001 ++From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= ++Date: Thu, 11 Feb 2021 23:04:27 +0100 ++Subject: [PATCH] mtd: parsers: ofpart: support BCM4908 fixed partitions ++MIME-Version: 1.0 ++Content-Type: text/plain; charset=UTF-8 ++Content-Transfer-Encoding: 8bit ++ ++Some devices use fixed partitioning with some partitions requiring some ++extra logic. E.g. BCM4908 may have multiple firmware partitions but ++detecting currently used one requires checking bootloader parameters. ++ ++To support such cases without duplicating a lot of code (without copying ++most of the ofpart.c code) support for post-parsing callback was added. ++ ++BCM4908 support in ofpart can be enabled using config option and results ++in compiling & executing a specific callback. It simply reads offset of ++currently used firmware partition from the DT. Bootloader specifies it ++using the "brcm_blparms" property. ++ ++Signed-off-by: Rafał Miłecki ++--- ++ drivers/mtd/parsers/Kconfig | 9 +++ ++ drivers/mtd/parsers/Makefile | 2 + ++ drivers/mtd/parsers/ofpart_bcm4908.c | 64 +++++++++++++++++++ ++ drivers/mtd/parsers/ofpart_bcm4908.h | 15 +++++ ++ .../mtd/parsers/{ofpart.c => ofpart_core.c} | 28 +++++++- ++ 5 files changed, 116 insertions(+), 2 deletions(-) ++ create mode 100644 drivers/mtd/parsers/ofpart_bcm4908.c ++ create mode 100644 drivers/mtd/parsers/ofpart_bcm4908.h ++ rename drivers/mtd/parsers/{ofpart.c => ofpart_core.c} (88%) ++ ++--- a/drivers/mtd/parsers/Kconfig +++++ b/drivers/mtd/parsers/Kconfig ++@@ -67,6 +67,15 @@ config MTD_OF_PARTS ++ flash memory node, as described in ++ Documentation/devicetree/bindings/mtd/partition.txt. ++ +++config MTD_OF_PARTS_BCM4908 +++ bool "BCM4908 partitioning support" +++ depends on MTD_OF_PARTS && (ARCH_BCM4908 || COMPILE_TEST) +++ default ARCH_BCM4908 +++ help +++ This provides partitions parser for BCM4908 family devices +++ that can have multiple "firmware" partitions. It takes care of +++ finding currently used one and backup ones. +++ ++ config MTD_PARSER_IMAGETAG ++ tristate "Parser for BCM963XX Image Tag format partitions" ++ depends on BCM63XX || BMIPS_GENERIC || COMPILE_TEST ++--- a/drivers/mtd/parsers/Makefile +++++ b/drivers/mtd/parsers/Makefile ++@@ -4,6 +4,8 @@ obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm4 ++ obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o ++ obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o ++ obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o +++ofpart-y += ofpart_core.o +++ofpart-$(CONFIG_MTD_OF_PARTS_BCM4908) += ofpart_bcm4908.o ++ obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o ++ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o ++ obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o ++--- /dev/null +++++ b/drivers/mtd/parsers/ofpart_bcm4908.c ++@@ -0,0 +1,64 @@ +++// SPDX-License-Identifier: GPL-2.0 +++/* +++ * Copyright (C) 2021 Rafał Miłecki +++ */ +++ +++#include +++#include +++#include +++#include +++#include +++#include +++ +++#include "ofpart_bcm4908.h" +++ +++#define BLPARAMS_FW_OFFSET "NAND_RFS_OFS" +++ +++static long long bcm4908_partitions_fw_offset(void) +++{ +++ struct device_node *root; +++ struct property *prop; +++ const char *s; +++ +++ root = of_find_node_by_path("/"); +++ if (!root) +++ return -ENOENT; +++ +++ of_property_for_each_string(root, "brcm_blparms", prop, s) { +++ size_t len = strlen(BLPARAMS_FW_OFFSET); +++ unsigned long offset; +++ int err; +++ +++ if (strncmp(s, BLPARAMS_FW_OFFSET, len) || s[len] != '=') +++ continue; +++ +++ err = kstrtoul(s + len + 1, 0, &offset); +++ if (err) { +++ pr_err("failed to parse %s\n", s + len + 1); +++ return err; +++ } +++ +++ return offset << 10; +++ } +++ +++ return -ENOENT; +++} +++ +++int bcm4908_partitions_post_parse(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts) +++{ +++ long long fw_offset; +++ int i; +++ +++ fw_offset = bcm4908_partitions_fw_offset(); +++ +++ for (i = 0; i < nr_parts; i++) { +++ if (of_device_is_compatible(parts[i].of_node, "brcm,bcm4908-firmware")) { +++ if (fw_offset < 0 || parts[i].offset == fw_offset) +++ parts[i].name = "firmware"; +++ else +++ parts[i].name = "backup"; +++ } +++ } +++ +++ return 0; +++} ++--- /dev/null +++++ b/drivers/mtd/parsers/ofpart_bcm4908.h ++@@ -0,0 +1,15 @@ +++/* SPDX-License-Identifier: GPL-2.0 */ +++#ifndef __BCM4908_PARTITIONS_H +++#define __BCM4908_PARTITIONS_H +++ +++#ifdef CONFIG_MTD_OF_PARTS_BCM4908 +++int bcm4908_partitions_post_parse(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts); +++#else +++static inline int bcm4908_partitions_post_parse(struct mtd_info *mtd, struct mtd_partition *parts, +++ int nr_parts) +++{ +++ return -EOPNOTSUPP; +++} +++#endif +++ +++#endif ++--- a/drivers/mtd/parsers/ofpart.c +++++ /dev/null ++@@ -1,239 +0,0 @@ ++-// SPDX-License-Identifier: GPL-2.0-or-later ++-/* ++- * Flash partitions described by the OF (or flattened) device tree ++- * ++- * Copyright © 2006 MontaVista Software Inc. ++- * Author: Vitaly Wool ++- * ++- * Revised to handle newer style flash binding by: ++- * Copyright © 2007 David Gibson, IBM Corporation. ++- */ ++- ++-#include ++-#include ++-#include ++-#include ++-#include ++-#include ++- ++-static bool node_has_compatible(struct device_node *pp) ++-{ ++- return of_get_property(pp, "compatible", NULL); ++-} ++- ++-static int parse_fixed_partitions(struct mtd_info *master, ++- const struct mtd_partition **pparts, ++- struct mtd_part_parser_data *data) ++-{ ++- struct mtd_partition *parts; ++- struct device_node *mtd_node; ++- struct device_node *ofpart_node; ++- const char *partname; ++- struct device_node *pp; ++- int nr_parts, i, ret = 0; ++- bool dedicated = true; ++- ++- ++- /* Pull of_node from the master device node */ ++- mtd_node = mtd_get_of_node(master); ++- if (!mtd_node) ++- return 0; ++- ++- ofpart_node = of_get_child_by_name(mtd_node, "partitions"); ++- if (!ofpart_node) { ++- /* ++- * We might get here even when ofpart isn't used at all (e.g., ++- * when using another parser), so don't be louder than ++- * KERN_DEBUG ++- */ ++- pr_debug("%s: 'partitions' subnode not found on %pOF. Trying to parse direct subnodes as partitions.\n", ++- master->name, mtd_node); ++- ofpart_node = mtd_node; ++- dedicated = false; ++- } else if (!of_device_is_compatible(ofpart_node, "fixed-partitions")) { ++- /* The 'partitions' subnode might be used by another parser */ ++- return 0; ++- } ++- ++- /* First count the subnodes */ ++- nr_parts = 0; ++- for_each_child_of_node(ofpart_node, pp) { ++- if (!dedicated && node_has_compatible(pp)) ++- continue; ++- ++- nr_parts++; ++- } ++- ++- if (nr_parts == 0) ++- return 0; ++- ++- parts = kcalloc(nr_parts, sizeof(*parts), GFP_KERNEL); ++- if (!parts) ++- return -ENOMEM; ++- ++- i = 0; ++- for_each_child_of_node(ofpart_node, pp) { ++- const __be32 *reg; ++- int len; ++- int a_cells, s_cells; ++- ++- if (!dedicated && node_has_compatible(pp)) ++- continue; ++- ++- reg = of_get_property(pp, "reg", &len); ++- if (!reg) { ++- if (dedicated) { ++- pr_debug("%s: ofpart partition %pOF (%pOF) missing reg property.\n", ++- master->name, pp, ++- mtd_node); ++- goto ofpart_fail; ++- } else { ++- nr_parts--; ++- continue; ++- } ++- } ++- ++- a_cells = of_n_addr_cells(pp); ++- s_cells = of_n_size_cells(pp); ++- if (len / 4 != a_cells + s_cells) { ++- pr_debug("%s: ofpart partition %pOF (%pOF) error parsing reg property.\n", ++- master->name, pp, ++- mtd_node); ++- goto ofpart_fail; ++- } ++- ++- parts[i].offset = of_read_number(reg, a_cells); ++- parts[i].size = of_read_number(reg + a_cells, s_cells); ++- parts[i].of_node = pp; ++- ++- partname = of_get_property(pp, "label", &len); ++- if (!partname) ++- partname = of_get_property(pp, "name", &len); ++- parts[i].name = partname; ++- ++- if (of_get_property(pp, "read-only", &len)) ++- parts[i].mask_flags |= MTD_WRITEABLE; ++- ++- if (of_get_property(pp, "lock", &len)) ++- parts[i].mask_flags |= MTD_POWERUP_LOCK; ++- ++- if (of_property_read_bool(pp, "slc-mode")) ++- parts[i].add_flags |= MTD_SLC_ON_MLC_EMULATION; ++- ++- i++; ++- } ++- ++- if (!nr_parts) ++- goto ofpart_none; ++- ++- *pparts = parts; ++- return nr_parts; ++- ++-ofpart_fail: ++- pr_err("%s: error parsing ofpart partition %pOF (%pOF)\n", ++- master->name, pp, mtd_node); ++- ret = -EINVAL; ++-ofpart_none: ++- of_node_put(pp); ++- kfree(parts); ++- return ret; ++-} ++- ++-static const struct of_device_id parse_ofpart_match_table[] = { ++- { .compatible = "fixed-partitions" }, ++- {}, ++-}; ++-MODULE_DEVICE_TABLE(of, parse_ofpart_match_table); ++- ++-static struct mtd_part_parser ofpart_parser = { ++- .parse_fn = parse_fixed_partitions, ++- .name = "fixed-partitions", ++- .of_match_table = parse_ofpart_match_table, ++-}; ++- ++-static int parse_ofoldpart_partitions(struct mtd_info *master, ++- const struct mtd_partition **pparts, ++- struct mtd_part_parser_data *data) ++-{ ++- struct mtd_partition *parts; ++- struct device_node *dp; ++- int i, plen, nr_parts; ++- const struct { ++- __be32 offset, len; ++- } *part; ++- const char *names; ++- ++- /* Pull of_node from the master device node */ ++- dp = mtd_get_of_node(master); ++- if (!dp) ++- return 0; ++- ++- part = of_get_property(dp, "partitions", &plen); ++- if (!part) ++- return 0; /* No partitions found */ ++- ++- pr_warn("Device tree uses obsolete partition map binding: %pOF\n", dp); ++- ++- nr_parts = plen / sizeof(part[0]); ++- ++- parts = kcalloc(nr_parts, sizeof(*parts), GFP_KERNEL); ++- if (!parts) ++- return -ENOMEM; ++- ++- names = of_get_property(dp, "partition-names", &plen); ++- ++- for (i = 0; i < nr_parts; i++) { ++- parts[i].offset = be32_to_cpu(part->offset); ++- parts[i].size = be32_to_cpu(part->len) & ~1; ++- /* bit 0 set signifies read only partition */ ++- if (be32_to_cpu(part->len) & 1) ++- parts[i].mask_flags = MTD_WRITEABLE; ++- ++- if (names && (plen > 0)) { ++- int len = strlen(names) + 1; ++- ++- parts[i].name = names; ++- plen -= len; ++- names += len; ++- } else { ++- parts[i].name = "unnamed"; ++- } ++- ++- part++; ++- } ++- ++- *pparts = parts; ++- return nr_parts; ++-} ++- ++-static struct mtd_part_parser ofoldpart_parser = { ++- .parse_fn = parse_ofoldpart_partitions, ++- .name = "ofoldpart", ++-}; ++- ++-static int __init ofpart_parser_init(void) ++-{ ++- register_mtd_parser(&ofpart_parser); ++- register_mtd_parser(&ofoldpart_parser); ++- return 0; ++-} ++- ++-static void __exit ofpart_parser_exit(void) ++-{ ++- deregister_mtd_parser(&ofpart_parser); ++- deregister_mtd_parser(&ofoldpart_parser); ++-} ++- ++-module_init(ofpart_parser_init); ++-module_exit(ofpart_parser_exit); ++- ++-MODULE_LICENSE("GPL"); ++-MODULE_DESCRIPTION("Parser for MTD partitioning information in device tree"); ++-MODULE_AUTHOR("Vitaly Wool, David Gibson"); ++-/* ++- * When MTD core cannot find the requested parser, it tries to load the module ++- * with the same name. Since we provide the ofoldpart parser, we should have ++- * the corresponding alias. ++- */ ++-MODULE_ALIAS("fixed-partitions"); ++-MODULE_ALIAS("ofoldpart"); ++--- /dev/null +++++ b/drivers/mtd/parsers/ofpart_core.c ++@@ -0,0 +1,263 @@ +++// SPDX-License-Identifier: GPL-2.0-or-later +++/* +++ * Flash partitions described by the OF (or flattened) device tree +++ * +++ * Copyright © 2006 MontaVista Software Inc. +++ * Author: Vitaly Wool +++ * +++ * Revised to handle newer style flash binding by: +++ * Copyright © 2007 David Gibson, IBM Corporation. +++ */ +++ +++#include +++#include +++#include +++#include +++#include +++#include +++ +++#include "ofpart_bcm4908.h" +++ +++struct fixed_partitions_quirks { +++ int (*post_parse)(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts); +++}; +++ +++struct fixed_partitions_quirks bcm4908_partitions_quirks = { +++ .post_parse = bcm4908_partitions_post_parse, +++}; +++ +++static const struct of_device_id parse_ofpart_match_table[]; +++ +++static bool node_has_compatible(struct device_node *pp) +++{ +++ return of_get_property(pp, "compatible", NULL); +++} +++ +++static int parse_fixed_partitions(struct mtd_info *master, +++ const struct mtd_partition **pparts, +++ struct mtd_part_parser_data *data) +++{ +++ const struct fixed_partitions_quirks *quirks; +++ const struct of_device_id *of_id; +++ struct mtd_partition *parts; +++ struct device_node *mtd_node; +++ struct device_node *ofpart_node; +++ const char *partname; +++ struct device_node *pp; +++ int nr_parts, i, ret = 0; +++ bool dedicated = true; +++ +++ /* Pull of_node from the master device node */ +++ mtd_node = mtd_get_of_node(master); +++ if (!mtd_node) +++ return 0; +++ +++ ofpart_node = of_get_child_by_name(mtd_node, "partitions"); +++ if (!ofpart_node) { +++ /* +++ * We might get here even when ofpart isn't used at all (e.g., +++ * when using another parser), so don't be louder than +++ * KERN_DEBUG +++ */ +++ pr_debug("%s: 'partitions' subnode not found on %pOF. Trying to parse direct subnodes as partitions.\n", +++ master->name, mtd_node); +++ ofpart_node = mtd_node; +++ dedicated = false; +++ } +++ +++ of_id = of_match_node(parse_ofpart_match_table, ofpart_node); +++ if (dedicated && !of_id) { +++ /* The 'partitions' subnode might be used by another parser */ +++ return 0; +++ } +++ +++ quirks = of_id ? of_id->data : NULL; +++ +++ /* First count the subnodes */ +++ nr_parts = 0; +++ for_each_child_of_node(ofpart_node, pp) { +++ if (!dedicated && node_has_compatible(pp)) +++ continue; +++ +++ nr_parts++; +++ } +++ +++ if (nr_parts == 0) +++ return 0; +++ +++ parts = kcalloc(nr_parts, sizeof(*parts), GFP_KERNEL); +++ if (!parts) +++ return -ENOMEM; +++ +++ i = 0; +++ for_each_child_of_node(ofpart_node, pp) { +++ const __be32 *reg; +++ int len; +++ int a_cells, s_cells; +++ +++ if (!dedicated && node_has_compatible(pp)) +++ continue; +++ +++ reg = of_get_property(pp, "reg", &len); +++ if (!reg) { +++ if (dedicated) { +++ pr_debug("%s: ofpart partition %pOF (%pOF) missing reg property.\n", +++ master->name, pp, +++ mtd_node); +++ goto ofpart_fail; +++ } else { +++ nr_parts--; +++ continue; +++ } +++ } +++ +++ a_cells = of_n_addr_cells(pp); +++ s_cells = of_n_size_cells(pp); +++ if (len / 4 != a_cells + s_cells) { +++ pr_debug("%s: ofpart partition %pOF (%pOF) error parsing reg property.\n", +++ master->name, pp, +++ mtd_node); +++ goto ofpart_fail; +++ } +++ +++ parts[i].offset = of_read_number(reg, a_cells); +++ parts[i].size = of_read_number(reg + a_cells, s_cells); +++ parts[i].of_node = pp; +++ +++ partname = of_get_property(pp, "label", &len); +++ if (!partname) +++ partname = of_get_property(pp, "name", &len); +++ parts[i].name = partname; +++ +++ if (of_get_property(pp, "read-only", &len)) +++ parts[i].mask_flags |= MTD_WRITEABLE; +++ +++ if (of_get_property(pp, "lock", &len)) +++ parts[i].mask_flags |= MTD_POWERUP_LOCK; +++ +++ if (of_property_read_bool(pp, "slc-mode")) +++ parts[i].add_flags |= MTD_SLC_ON_MLC_EMULATION; +++ +++ i++; +++ } +++ +++ if (!nr_parts) +++ goto ofpart_none; +++ +++ if (quirks && quirks->post_parse) +++ quirks->post_parse(master, parts, nr_parts); +++ +++ *pparts = parts; +++ return nr_parts; +++ +++ofpart_fail: +++ pr_err("%s: error parsing ofpart partition %pOF (%pOF)\n", +++ master->name, pp, mtd_node); +++ ret = -EINVAL; +++ofpart_none: +++ of_node_put(pp); +++ kfree(parts); +++ return ret; +++} +++ +++static const struct of_device_id parse_ofpart_match_table[] = { +++ /* Generic */ +++ { .compatible = "fixed-partitions" }, +++ /* Customized */ +++ { .compatible = "brcm,bcm4908-partitions", .data = &bcm4908_partitions_quirks, }, +++ {}, +++}; +++MODULE_DEVICE_TABLE(of, parse_ofpart_match_table); +++ +++static struct mtd_part_parser ofpart_parser = { +++ .parse_fn = parse_fixed_partitions, +++ .name = "fixed-partitions", +++ .of_match_table = parse_ofpart_match_table, +++}; +++ +++static int parse_ofoldpart_partitions(struct mtd_info *master, +++ const struct mtd_partition **pparts, +++ struct mtd_part_parser_data *data) +++{ +++ struct mtd_partition *parts; +++ struct device_node *dp; +++ int i, plen, nr_parts; +++ const struct { +++ __be32 offset, len; +++ } *part; +++ const char *names; +++ +++ /* Pull of_node from the master device node */ +++ dp = mtd_get_of_node(master); +++ if (!dp) +++ return 0; +++ +++ part = of_get_property(dp, "partitions", &plen); +++ if (!part) +++ return 0; /* No partitions found */ +++ +++ pr_warn("Device tree uses obsolete partition map binding: %pOF\n", dp); +++ +++ nr_parts = plen / sizeof(part[0]); +++ +++ parts = kcalloc(nr_parts, sizeof(*parts), GFP_KERNEL); +++ if (!parts) +++ return -ENOMEM; +++ +++ names = of_get_property(dp, "partition-names", &plen); +++ +++ for (i = 0; i < nr_parts; i++) { +++ parts[i].offset = be32_to_cpu(part->offset); +++ parts[i].size = be32_to_cpu(part->len) & ~1; +++ /* bit 0 set signifies read only partition */ +++ if (be32_to_cpu(part->len) & 1) +++ parts[i].mask_flags = MTD_WRITEABLE; +++ +++ if (names && (plen > 0)) { +++ int len = strlen(names) + 1; +++ +++ parts[i].name = names; +++ plen -= len; +++ names += len; +++ } else { +++ parts[i].name = "unnamed"; +++ } +++ +++ part++; +++ } +++ +++ *pparts = parts; +++ return nr_parts; +++} +++ +++static struct mtd_part_parser ofoldpart_parser = { +++ .parse_fn = parse_ofoldpart_partitions, +++ .name = "ofoldpart", +++}; +++ +++static int __init ofpart_parser_init(void) +++{ +++ register_mtd_parser(&ofpart_parser); +++ register_mtd_parser(&ofoldpart_parser); +++ return 0; +++} +++ +++static void __exit ofpart_parser_exit(void) +++{ +++ deregister_mtd_parser(&ofpart_parser); +++ deregister_mtd_parser(&ofoldpart_parser); +++} +++ +++module_init(ofpart_parser_init); +++module_exit(ofpart_parser_exit); +++ +++MODULE_LICENSE("GPL"); +++MODULE_DESCRIPTION("Parser for MTD partitioning information in device tree"); +++MODULE_AUTHOR("Vitaly Wool, David Gibson"); +++/* +++ * When MTD core cannot find the requested parser, it tries to load the module +++ * with the same name. Since we provide the ofoldpart parser, we should have +++ * the corresponding alias. +++ */ +++MODULE_ALIAS("fixed-partitions"); +++MODULE_ALIAS("ofoldpart"); +diff --git a/target/linux/generic/backport-5.10/404-v5.13-mtd-parsers-ofpart-limit-parsing-of-deprecated-DT-sy.patch b/target/linux/generic/backport-5.10/404-v5.13-mtd-parsers-ofpart-limit-parsing-of-deprecated-DT-sy.patch +new file mode 100644 +index 0000000000..55a91d7680 +--- /dev/null ++++ b/target/linux/generic/backport-5.10/404-v5.13-mtd-parsers-ofpart-limit-parsing-of-deprecated-DT-sy.patch +@@ -0,0 +1,69 @@ ++From 2d751203aacf86a1b301a188d8551c7da91043ab Mon Sep 17 00:00:00 2001 ++From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= ++Date: Tue, 2 Mar 2021 20:00:12 +0100 ++Subject: [PATCH] mtd: parsers: ofpart: limit parsing of deprecated DT syntax ++MIME-Version: 1.0 ++Content-Type: text/plain; charset=UTF-8 ++Content-Transfer-Encoding: 8bit ++ ++For backward compatibility ofpart still supports the old syntax like: ++spi-flash@0 { ++ compatible = "jedec,spi-nor"; ++ reg = <0x0>; ++ ++ partition@0 { ++ label = "bootloader"; ++ reg = <0x0 0x100000>; ++ }; ++}; ++(without "partitions" subnode). ++ ++There is no reason however to support nested partitions without a clear ++"compatible" string like: ++partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "bootloader"; ++ reg = <0x0 0x100000>; ++ ++ partition@0 { ++ label = "config"; ++ reg = <0x80000 0x80000>; ++ }; ++ }; ++}; ++(we never officially supported or documented that). ++ ++Make sure ofpart doesn't attempt to parse above. ++ ++Cc: Ansuel Smith ++Signed-off-by: Rafał Miłecki ++Signed-off-by: Miquel Raynal ++Link: https://lore.kernel.org/linux-mtd/20210302190012.1255-1-zajec5@gmail.com ++--- ++ drivers/mtd/parsers/ofpart_core.c | 4 +++- ++ 1 file changed, 3 insertions(+), 1 deletion(-) ++ ++--- a/drivers/mtd/parsers/ofpart_core.c +++++ b/drivers/mtd/parsers/ofpart_core.c ++@@ -53,7 +53,7 @@ static int parse_fixed_partitions(struct ++ return 0; ++ ++ ofpart_node = of_get_child_by_name(mtd_node, "partitions"); ++- if (!ofpart_node) { +++ if (!ofpart_node && !master->parent) { ++ /* ++ * We might get here even when ofpart isn't used at all (e.g., ++ * when using another parser), so don't be louder than ++@@ -64,6 +64,8 @@ static int parse_fixed_partitions(struct ++ ofpart_node = mtd_node; ++ dedicated = false; ++ } +++ if (!ofpart_node) +++ return 0; ++ ++ of_id = of_match_node(parse_ofpart_match_table, ofpart_node); ++ if (dedicated && !of_id) { +diff --git a/target/linux/generic/backport-5.10/405-v5.13-mtd-parsers-ofpart-make-symbol-bcm4908_partitions_qu.patch b/target/linux/generic/backport-5.10/405-v5.13-mtd-parsers-ofpart-make-symbol-bcm4908_partitions_qu.patch +new file mode 100644 +index 0000000000..f1b778a6e1 +--- /dev/null ++++ b/target/linux/generic/backport-5.10/405-v5.13-mtd-parsers-ofpart-make-symbol-bcm4908_partitions_qu.patch +@@ -0,0 +1,34 @@ ++From b87b6d2d6f540e29c3f98e1572d64e560d73d6c1 Mon Sep 17 00:00:00 2001 ++From: Wei Yongjun ++Date: Thu, 4 Mar 2021 06:46:00 +0000 ++Subject: [PATCH] mtd: parsers: ofpart: make symbol 'bcm4908_partitions_quirks' ++ static ++ ++The sparse tool complains as follows: ++ ++drivers/mtd/parsers/ofpart_core.c:25:32: warning: ++ symbol 'bcm4908_partitions_quirks' was not declared. Should it be static? ++ ++This symbol is not used outside of ofpart_core.c, so this ++commit marks it static. ++ ++Fixes: 457da931b608 ("mtd: parsers: ofpart: support BCM4908 fixed partitions") ++Reported-by: Hulk Robot ++Signed-off-by: Wei Yongjun ++Signed-off-by: Miquel Raynal ++Link: https://lore.kernel.org/linux-mtd/20210304064600.3279138-1-weiyongjun1@huawei.com ++--- ++ drivers/mtd/parsers/ofpart_core.c | 2 +- ++ 1 file changed, 1 insertion(+), 1 deletion(-) ++ ++--- a/drivers/mtd/parsers/ofpart_core.c +++++ b/drivers/mtd/parsers/ofpart_core.c ++@@ -22,7 +22,7 @@ struct fixed_partitions_quirks { ++ int (*post_parse)(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts); ++ }; ++ ++-struct fixed_partitions_quirks bcm4908_partitions_quirks = { +++static struct fixed_partitions_quirks bcm4908_partitions_quirks = { ++ .post_parse = bcm4908_partitions_post_parse, ++ }; ++ +diff --git a/target/linux/generic/backport-5.10/406-v5.13-0001-mtd-core-add-nvmem-cells-compatible-to-parse-mtd-as-.patch b/target/linux/generic/backport-5.10/406-v5.13-0001-mtd-core-add-nvmem-cells-compatible-to-parse-mtd-as-.patch +new file mode 100644 +index 0000000000..28335cb71f +--- /dev/null ++++ b/target/linux/generic/backport-5.10/406-v5.13-0001-mtd-core-add-nvmem-cells-compatible-to-parse-mtd-as-.patch +@@ -0,0 +1,38 @@ ++From a5d83d6e2bc747b13f347962d4b335d70b23559b Mon Sep 17 00:00:00 2001 ++From: Ansuel Smith ++Date: Fri, 12 Mar 2021 07:28:19 +0100 ++Subject: [PATCH] mtd: core: add nvmem-cells compatible to parse mtd as nvmem ++ cells ++MIME-Version: 1.0 ++Content-Type: text/plain; charset=UTF-8 ++Content-Transfer-Encoding: 8bit ++ ++Partitions that contains the nvmem-cells compatible will register ++their direct subonodes as nvmem cells and the node will be treated as a ++nvmem provider. ++ ++Signed-off-by: Ansuel Smith ++Tested-by: Rafał Miłecki ++--- ++ drivers/mtd/mtdcore.c | 3 ++- ++ 1 file changed, 2 insertions(+), 1 deletion(-) ++ ++--- a/drivers/mtd/mtdcore.c +++++ b/drivers/mtd/mtdcore.c ++@@ -531,6 +531,7 @@ static int mtd_nvmem_reg_read(void *priv ++ ++ static int mtd_nvmem_add(struct mtd_info *mtd) ++ { +++ struct device_node *node = mtd_get_of_node(mtd); ++ struct nvmem_config config = {}; ++ ++ config.id = -1; ++@@ -543,7 +544,7 @@ static int mtd_nvmem_add(struct mtd_info ++ config.stride = 1; ++ config.read_only = true; ++ config.root_only = true; ++- config.no_of_node = true; +++ config.no_of_node = !of_device_is_compatible(node, "nvmem-cells"); ++ config.priv = mtd; ++ ++ mtd->nvmem = nvmem_register(&config); +diff --git a/target/linux/generic/backport-5.10/406-v5.13-0002-dt-bindings-nvmem-drop-nodename-restriction.patch b/target/linux/generic/backport-5.10/406-v5.13-0002-dt-bindings-nvmem-drop-nodename-restriction.patch +new file mode 100644 +index 0000000000..14ea3f6b8c +--- /dev/null ++++ b/target/linux/generic/backport-5.10/406-v5.13-0002-dt-bindings-nvmem-drop-nodename-restriction.patch +@@ -0,0 +1,25 @@ ++From 42645976c3289b03a12f1bd2bc131fd98fc27170 Mon Sep 17 00:00:00 2001 ++From: Ansuel Smith ++Date: Fri, 12 Mar 2021 07:28:20 +0100 ++Subject: [PATCH] devicetree: nvmem: nvmem: drop $nodename restriction ++ ++Drop $nodename restriction as now mtd partition can also be used as ++nvmem provider. ++ ++Signed-off-by: Ansuel Smith ++--- ++ Documentation/devicetree/bindings/nvmem/nvmem.yaml | 3 --- ++ 1 file changed, 3 deletions(-) ++ ++--- a/Documentation/devicetree/bindings/nvmem/nvmem.yaml +++++ b/Documentation/devicetree/bindings/nvmem/nvmem.yaml ++@@ -20,9 +20,6 @@ description: | ++ storage device. ++ ++ properties: ++- $nodename: ++- pattern: "^(eeprom|efuse|nvram)(@.*|-[0-9a-f])*$" ++- ++ "#address-cells": ++ const: 1 ++ +diff --git a/target/linux/generic/backport-5.10/406-v5.13-0003-dt-bindings-mtd-Document-use-of-nvmem-cells-compatib.patch b/target/linux/generic/backport-5.10/406-v5.13-0003-dt-bindings-mtd-Document-use-of-nvmem-cells-compatib.patch +new file mode 100644 +index 0000000000..0eb4c637cf +--- /dev/null ++++ b/target/linux/generic/backport-5.10/406-v5.13-0003-dt-bindings-mtd-Document-use-of-nvmem-cells-compatib.patch +@@ -0,0 +1,117 @@ ++From 377aa0135dc8489312edd3184d143ce3a89ff7ee Mon Sep 17 00:00:00 2001 ++From: Ansuel Smith ++Date: Fri, 12 Mar 2021 07:28:21 +0100 ++Subject: [PATCH] dt-bindings: mtd: Document use of nvmem-cells compatible ++ ++Document nvmem-cells compatible used to treat mtd partitions as a ++nvmem provider. ++ ++Signed-off-by: Ansuel Smith ++Reviewed-by: Rob Herring ++--- ++ .../bindings/mtd/partitions/nvmem-cells.yaml | 99 +++++++++++++++++++ ++ 1 file changed, 99 insertions(+) ++ create mode 100644 Documentation/devicetree/bindings/mtd/partitions/nvmem-cells.yaml ++ ++--- /dev/null +++++ b/Documentation/devicetree/bindings/mtd/partitions/nvmem-cells.yaml ++@@ -0,0 +1,99 @@ +++# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +++%YAML 1.2 +++--- +++$id: http://devicetree.org/schemas/mtd/partitions/nvmem-cells.yaml# +++$schema: http://devicetree.org/meta-schemas/core.yaml# +++ +++title: Nvmem cells +++ +++description: | +++ Any partition containing the compatible "nvmem-cells" will register as a +++ nvmem provider. +++ Each direct subnodes represents a nvmem cell following the nvmem binding. +++ Nvmem binding to declare nvmem-cells can be found in: +++ Documentation/devicetree/bindings/nvmem/nvmem.yaml +++ +++maintainers: +++ - Ansuel Smith +++ +++allOf: +++ - $ref: /schemas/nvmem/nvmem.yaml# +++ +++properties: +++ compatible: +++ const: nvmem-cells +++ +++required: +++ - compatible +++ +++additionalProperties: true +++ +++examples: +++ - | +++ partitions { +++ compatible = "fixed-partitions"; +++ #address-cells = <1>; +++ #size-cells = <1>; +++ +++ /* ... */ +++ +++ }; +++ art: art@1200000 { +++ compatible = "nvmem-cells"; +++ reg = <0x1200000 0x0140000>; +++ label = "art"; +++ read-only; +++ #address-cells = <1>; +++ #size-cells = <1>; +++ +++ macaddr_gmac1: macaddr_gmac1@0 { +++ reg = <0x0 0x6>; +++ }; +++ +++ macaddr_gmac2: macaddr_gmac2@6 { +++ reg = <0x6 0x6>; +++ }; +++ +++ pre_cal_24g: pre_cal_24g@1000 { +++ reg = <0x1000 0x2f20>; +++ }; +++ +++ pre_cal_5g: pre_cal_5g@5000{ +++ reg = <0x5000 0x2f20>; +++ }; +++ }; +++ - | +++ partitions { +++ compatible = "fixed-partitions"; +++ #address-cells = <1>; +++ #size-cells = <1>; +++ +++ partition@0 { +++ label = "bootloader"; +++ reg = <0x000000 0x100000>; +++ read-only; +++ }; +++ +++ firmware@100000 { +++ compatible = "brcm,trx"; +++ label = "firmware"; +++ reg = <0x100000 0xe00000>; +++ }; +++ +++ calibration@f00000 { +++ compatible = "nvmem-cells"; +++ label = "calibration"; +++ reg = <0xf00000 0x100000>; +++ ranges = <0 0xf00000 0x100000>; +++ #address-cells = <1>; +++ #size-cells = <1>; +++ +++ wifi0@0 { +++ reg = <0x000000 0x080000>; +++ }; +++ +++ wifi1@80000 { +++ reg = <0x080000 0x080000>; +++ }; +++ }; +++ }; +diff --git a/target/linux/generic/backport-5.10/407-v5.13-0001-dt-bindings-mtd-add-binding-for-Linksys-Northstar-pa.patch b/target/linux/generic/backport-5.10/407-v5.13-0001-dt-bindings-mtd-add-binding-for-Linksys-Northstar-pa.patch +new file mode 100644 +index 0000000000..35a4afd67b +--- /dev/null ++++ b/target/linux/generic/backport-5.10/407-v5.13-0001-dt-bindings-mtd-add-binding-for-Linksys-Northstar-pa.patch +@@ -0,0 +1,98 @@ ++From 2fa7294175c76e1ec568aa75c1891fd908728c8d Mon Sep 17 00:00:00 2001 ++From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= ++Date: Fri, 12 Mar 2021 14:49:18 +0100 ++Subject: [PATCH] dt-bindings: mtd: add binding for Linksys Northstar ++ partitions ++MIME-Version: 1.0 ++Content-Type: text/plain; charset=UTF-8 ++Content-Transfer-Encoding: 8bit ++ ++Linksys on Broadcom Northstar devices uses fixed flash layout with ++multiple firmware partitions. ++ ++Signed-off-by: Rafał Miłecki ++Reviewed-by: Rob Herring ++Signed-off-by: Miquel Raynal ++Link: https://lore.kernel.org/linux-mtd/20210312134919.7767-1-zajec5@gmail.com ++--- ++ .../mtd/partitions/linksys,ns-partitions.yaml | 74 +++++++++++++++++++ ++ 1 file changed, 74 insertions(+) ++ create mode 100644 Documentation/devicetree/bindings/mtd/partitions/linksys,ns-partitions.yaml ++ ++--- /dev/null +++++ b/Documentation/devicetree/bindings/mtd/partitions/linksys,ns-partitions.yaml ++@@ -0,0 +1,74 @@ +++# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +++%YAML 1.2 +++--- +++$id: http://devicetree.org/schemas/mtd/partitions/linksys,ns-partitions.yaml# +++$schema: http://devicetree.org/meta-schemas/core.yaml# +++ +++title: Linksys Northstar partitioning +++ +++description: | +++ Linksys devices based on Broadcom Northstar architecture often use two +++ firmware partitions. One is used for regular booting, the other is treated as +++ fallback. +++ +++ This binding allows defining all fixed partitions and marking those containing +++ firmware. System can use that information e.g. for booting or flashing +++ purposes. +++ +++maintainers: +++ - Rafał Miłecki +++ +++properties: +++ compatible: +++ const: linksys,ns-partitions +++ +++ "#address-cells": +++ enum: [ 1, 2 ] +++ +++ "#size-cells": +++ enum: [ 1, 2 ] +++ +++patternProperties: +++ "^partition@[0-9a-f]+$": +++ $ref: "partition.yaml#" +++ properties: +++ compatible: +++ items: +++ - const: linksys,ns-firmware +++ - const: brcm,trx +++ unevaluatedProperties: false +++ +++required: +++ - "#address-cells" +++ - "#size-cells" +++ +++additionalProperties: false +++ +++examples: +++ - | +++ partitions { +++ compatible = "linksys,ns-partitions"; +++ #address-cells = <1>; +++ #size-cells = <1>; +++ +++ partition@0 { +++ label = "boot"; +++ reg = <0x0 0x100000>; +++ read-only; +++ }; +++ +++ partition@100000 { +++ label = "nvram"; +++ reg = <0x100000 0x100000>; +++ }; +++ +++ partition@200000 { +++ compatible = "linksys,ns-firmware", "brcm,trx"; +++ reg = <0x200000 0xf00000>; +++ }; +++ +++ partition@1100000 { +++ compatible = "linksys,ns-firmware", "brcm,trx"; +++ reg = <0x1100000 0xf00000>; +++ }; +++ }; +diff --git a/target/linux/generic/backport-5.10/407-v5.13-0002-mtd-parsers-ofpart-support-Linksys-Northstar-partiti.patch b/target/linux/generic/backport-5.10/407-v5.13-0002-mtd-parsers-ofpart-support-Linksys-Northstar-partiti.patch +new file mode 100644 +index 0000000000..f317889785 +--- /dev/null ++++ b/target/linux/generic/backport-5.10/407-v5.13-0002-mtd-parsers-ofpart-support-Linksys-Northstar-partiti.patch +@@ -0,0 +1,156 @@ ++From 7134a2d026d942210b4d26d6059c9d979ca7866e Mon Sep 17 00:00:00 2001 ++From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= ++Date: Fri, 12 Mar 2021 14:49:19 +0100 ++Subject: [PATCH] mtd: parsers: ofpart: support Linksys Northstar partitions ++MIME-Version: 1.0 ++Content-Type: text/plain; charset=UTF-8 ++Content-Transfer-Encoding: 8bit ++ ++This allows extending ofpart parser with support for Linksys Northstar ++devices. That support uses recently added quirks mechanism. ++ ++Signed-off-by: Rafał Miłecki ++Signed-off-by: Miquel Raynal ++Link: https://lore.kernel.org/linux-mtd/20210312134919.7767-2-zajec5@gmail.com ++--- ++ drivers/mtd/parsers/Kconfig | 10 +++++ ++ drivers/mtd/parsers/Makefile | 1 + ++ drivers/mtd/parsers/ofpart_core.c | 6 +++ ++ drivers/mtd/parsers/ofpart_linksys_ns.c | 50 +++++++++++++++++++++++++ ++ drivers/mtd/parsers/ofpart_linksys_ns.h | 18 +++++++++ ++ 5 files changed, 85 insertions(+) ++ create mode 100644 drivers/mtd/parsers/ofpart_linksys_ns.c ++ create mode 100644 drivers/mtd/parsers/ofpart_linksys_ns.h ++ ++--- a/drivers/mtd/parsers/Kconfig +++++ b/drivers/mtd/parsers/Kconfig ++@@ -76,6 +76,16 @@ config MTD_OF_PARTS_BCM4908 ++ that can have multiple "firmware" partitions. It takes care of ++ finding currently used one and backup ones. ++ +++config MTD_OF_PARTS_LINKSYS_NS +++ bool "Linksys Northstar partitioning support" +++ depends on MTD_OF_PARTS && (ARCH_BCM_5301X || ARCH_BCM4908 || COMPILE_TEST) +++ default ARCH_BCM_5301X +++ help +++ This provides partitions parser for Linksys devices based on Broadcom +++ Northstar architecture. Linksys commonly uses fixed flash layout with +++ two "firmware" partitions. Currently used firmware has to be detected +++ using CFE environment variable. +++ ++ config MTD_PARSER_IMAGETAG ++ tristate "Parser for BCM963XX Image Tag format partitions" ++ depends on BCM63XX || BMIPS_GENERIC || COMPILE_TEST ++--- a/drivers/mtd/parsers/Makefile +++++ b/drivers/mtd/parsers/Makefile ++@@ -6,6 +6,7 @@ obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdl ++ obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o ++ ofpart-y += ofpart_core.o ++ ofpart-$(CONFIG_MTD_OF_PARTS_BCM4908) += ofpart_bcm4908.o +++ofpart-$(CONFIG_MTD_OF_PARTS_LINKSYS_NS)+= ofpart_linksys_ns.o ++ obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o ++ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o ++ obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o ++--- a/drivers/mtd/parsers/ofpart_core.c +++++ b/drivers/mtd/parsers/ofpart_core.c ++@@ -17,6 +17,7 @@ ++ #include ++ ++ #include "ofpart_bcm4908.h" +++#include "ofpart_linksys_ns.h" ++ ++ struct fixed_partitions_quirks { ++ int (*post_parse)(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts); ++@@ -26,6 +27,10 @@ static struct fixed_partitions_quirks bc ++ .post_parse = bcm4908_partitions_post_parse, ++ }; ++ +++static struct fixed_partitions_quirks linksys_ns_partitions_quirks = { +++ .post_parse = linksys_ns_partitions_post_parse, +++}; +++ ++ static const struct of_device_id parse_ofpart_match_table[]; ++ ++ static bool node_has_compatible(struct device_node *pp) ++@@ -167,6 +172,7 @@ static const struct of_device_id parse_o ++ { .compatible = "fixed-partitions" }, ++ /* Customized */ ++ { .compatible = "brcm,bcm4908-partitions", .data = &bcm4908_partitions_quirks, }, +++ { .compatible = "linksys,ns-partitions", .data = &linksys_ns_partitions_quirks, }, ++ {}, ++ }; ++ MODULE_DEVICE_TABLE(of, parse_ofpart_match_table); ++--- /dev/null +++++ b/drivers/mtd/parsers/ofpart_linksys_ns.c ++@@ -0,0 +1,50 @@ +++// SPDX-License-Identifier: GPL-2.0 +++/* +++ * Copyright (C) 2021 Rafał Miłecki +++ */ +++ +++#include +++#include +++#include +++ +++#include "ofpart_linksys_ns.h" +++ +++#define NVRAM_BOOT_PART "bootpartition" +++ +++static int ofpart_linksys_ns_bootpartition(void) +++{ +++ char buf[4]; +++ int bootpartition; +++ +++ /* Check CFE environment variable */ +++ if (bcm47xx_nvram_getenv(NVRAM_BOOT_PART, buf, sizeof(buf)) > 0) { +++ if (!kstrtoint(buf, 0, &bootpartition)) +++ return bootpartition; +++ pr_warn("Failed to parse %s value \"%s\"\n", NVRAM_BOOT_PART, +++ buf); +++ } else { +++ pr_warn("Failed to get NVRAM \"%s\"\n", NVRAM_BOOT_PART); +++ } +++ +++ return 0; +++} +++ +++int linksys_ns_partitions_post_parse(struct mtd_info *mtd, +++ struct mtd_partition *parts, +++ int nr_parts) +++{ +++ int bootpartition = ofpart_linksys_ns_bootpartition(); +++ int trx_idx = 0; +++ int i; +++ +++ for (i = 0; i < nr_parts; i++) { +++ if (of_device_is_compatible(parts[i].of_node, "linksys,ns-firmware")) { +++ if (trx_idx++ == bootpartition) +++ parts[i].name = "firmware"; +++ else +++ parts[i].name = "backup"; +++ } +++ } +++ +++ return 0; +++} ++--- /dev/null +++++ b/drivers/mtd/parsers/ofpart_linksys_ns.h ++@@ -0,0 +1,18 @@ +++/* SPDX-License-Identifier: GPL-2.0 */ +++#ifndef __OFPART_LINKSYS_NS_H +++#define __OFPART_LINKSYS_NS_H +++ +++#ifdef CONFIG_MTD_OF_PARTS_LINKSYS_NS +++int linksys_ns_partitions_post_parse(struct mtd_info *mtd, +++ struct mtd_partition *parts, +++ int nr_parts); +++#else +++static inline int linksys_ns_partitions_post_parse(struct mtd_info *mtd, +++ struct mtd_partition *parts, +++ int nr_parts) +++{ +++ return -EOPNOTSUPP; +++} +++#endif +++ +++#endif +diff --git a/target/linux/generic/backport-5.10/600-v5.12-net-extract-napi-poll-functionality-to-__napi_poll.patch b/target/linux/generic/backport-5.10/600-v5.12-net-extract-napi-poll-functionality-to-__napi_poll.patch +new file mode 100644 +index 0000000000..366f18d94d +--- /dev/null ++++ b/target/linux/generic/backport-5.10/600-v5.12-net-extract-napi-poll-functionality-to-__napi_poll.patch +@@ -0,0 +1,88 @@ ++From: Felix Fietkau ++Date: Mon, 8 Feb 2021 11:34:08 -0800 ++Subject: [PATCH] net: extract napi poll functionality to __napi_poll() ++ ++This commit introduces a new function __napi_poll() which does the main ++logic of the existing napi_poll() function, and will be called by other ++functions in later commits. ++This idea and implementation is done by Felix Fietkau and ++is proposed as part of the patch to move napi work to work_queue ++context. ++This commit by itself is a code restructure. ++ ++Signed-off-by: Felix Fietkau ++Signed-off-by: Wei Wang ++Reviewed-by: Alexander Duyck ++Signed-off-by: David S. Miller ++--- ++ ++--- a/net/core/dev.c +++++ b/net/core/dev.c ++@@ -6752,15 +6752,10 @@ void __netif_napi_del(struct napi_struct ++ } ++ EXPORT_SYMBOL(__netif_napi_del); ++ ++-static int napi_poll(struct napi_struct *n, struct list_head *repoll) +++static int __napi_poll(struct napi_struct *n, bool *repoll) ++ { ++- void *have; ++ int work, weight; ++ ++- list_del_init(&n->poll_list); ++- ++- have = netpoll_poll_lock(n); ++- ++ weight = n->weight; ++ ++ /* This NAPI_STATE_SCHED test is for avoiding a race ++@@ -6780,7 +6775,7 @@ static int napi_poll(struct napi_struct ++ n->poll, work, weight); ++ ++ if (likely(work < weight)) ++- goto out_unlock; +++ return work; ++ ++ /* Drivers must not modify the NAPI state if they ++ * consume the entire weight. In such cases this code ++@@ -6789,7 +6784,7 @@ static int napi_poll(struct napi_struct ++ */ ++ if (unlikely(napi_disable_pending(n))) { ++ napi_complete(n); ++- goto out_unlock; +++ return work; ++ } ++ ++ if (n->gro_bitmask) { ++@@ -6807,12 +6802,29 @@ static int napi_poll(struct napi_struct ++ if (unlikely(!list_empty(&n->poll_list))) { ++ pr_warn_once("%s: Budget exhausted after napi rescheduled\n", ++ n->dev ? n->dev->name : "backlog"); ++- goto out_unlock; +++ return work; ++ } ++ ++- list_add_tail(&n->poll_list, repoll); +++ *repoll = true; +++ +++ return work; +++} +++ +++static int napi_poll(struct napi_struct *n, struct list_head *repoll) +++{ +++ bool do_repoll = false; +++ void *have; +++ int work; +++ +++ list_del_init(&n->poll_list); +++ +++ have = netpoll_poll_lock(n); +++ +++ work = __napi_poll(n, &do_repoll); +++ +++ if (do_repoll) +++ list_add_tail(&n->poll_list, repoll); ++ ++-out_unlock: ++ netpoll_poll_unlock(have); ++ ++ return work; +diff --git a/target/linux/generic/backport-5.10/601-v5.12-net-implement-threaded-able-napi-poll-loop-support.patch b/target/linux/generic/backport-5.10/601-v5.12-net-implement-threaded-able-napi-poll-loop-support.patch +new file mode 100644 +index 0000000000..32f22b392c +--- /dev/null ++++ b/target/linux/generic/backport-5.10/601-v5.12-net-implement-threaded-able-napi-poll-loop-support.patch +@@ -0,0 +1,261 @@ ++From: Wei Wang ++Date: Mon, 8 Feb 2021 11:34:09 -0800 ++Subject: [PATCH] net: implement threaded-able napi poll loop support ++ ++This patch allows running each napi poll loop inside its own ++kernel thread. ++The kthread is created during netif_napi_add() if dev->threaded ++is set. And threaded mode is enabled in napi_enable(). We will ++provide a way to set dev->threaded and enable threaded mode ++without a device up/down in the following patch. ++ ++Once that threaded mode is enabled and the kthread is ++started, napi_schedule() will wake-up such thread instead ++of scheduling the softirq. ++ ++The threaded poll loop behaves quite likely the net_rx_action, ++but it does not have to manipulate local irqs and uses ++an explicit scheduling point based on netdev_budget. ++ ++Co-developed-by: Paolo Abeni ++Signed-off-by: Paolo Abeni ++Co-developed-by: Hannes Frederic Sowa ++Signed-off-by: Hannes Frederic Sowa ++Co-developed-by: Jakub Kicinski ++Signed-off-by: Jakub Kicinski ++Signed-off-by: Wei Wang ++Reviewed-by: Alexander Duyck ++Signed-off-by: David S. Miller ++--- ++ ++--- a/include/linux/netdevice.h +++++ b/include/linux/netdevice.h ++@@ -347,6 +347,7 @@ struct napi_struct { ++ struct list_head dev_list; ++ struct hlist_node napi_hash_node; ++ unsigned int napi_id; +++ struct task_struct *thread; ++ }; ++ ++ enum { ++@@ -357,6 +358,7 @@ enum { ++ NAPI_STATE_LISTED, /* NAPI added to system lists */ ++ NAPI_STATE_NO_BUSY_POLL,/* Do not add in napi_hash, no busy polling */ ++ NAPI_STATE_IN_BUSY_POLL,/* sk_busy_loop() owns this NAPI */ +++ NAPI_STATE_THREADED, /* The poll is performed inside its own thread*/ ++ }; ++ ++ enum { ++@@ -367,6 +369,7 @@ enum { ++ NAPIF_STATE_LISTED = BIT(NAPI_STATE_LISTED), ++ NAPIF_STATE_NO_BUSY_POLL = BIT(NAPI_STATE_NO_BUSY_POLL), ++ NAPIF_STATE_IN_BUSY_POLL = BIT(NAPI_STATE_IN_BUSY_POLL), +++ NAPIF_STATE_THREADED = BIT(NAPI_STATE_THREADED), ++ }; ++ ++ enum gro_result { ++@@ -497,20 +500,7 @@ static inline bool napi_complete(struct ++ */ ++ void napi_disable(struct napi_struct *n); ++ ++-/** ++- * napi_enable - enable NAPI scheduling ++- * @n: NAPI context ++- * ++- * Resume NAPI from being scheduled on this context. ++- * Must be paired with napi_disable. ++- */ ++-static inline void napi_enable(struct napi_struct *n) ++-{ ++- BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state)); ++- smp_mb__before_atomic(); ++- clear_bit(NAPI_STATE_SCHED, &n->state); ++- clear_bit(NAPI_STATE_NPSVC, &n->state); ++-} +++void napi_enable(struct napi_struct *n); ++ ++ /** ++ * napi_synchronize - wait until NAPI is not running ++@@ -1835,6 +1825,8 @@ enum netdev_priv_flags { ++ * ++ * @wol_enabled: Wake-on-LAN is enabled ++ * +++ * @threaded: napi threaded mode is enabled +++ * ++ * @net_notifier_list: List of per-net netdev notifier block ++ * that follow this device when it is moved ++ * to another network namespace. ++@@ -2152,6 +2144,7 @@ struct net_device { ++ struct lock_class_key *qdisc_running_key; ++ bool proto_down; ++ unsigned wol_enabled:1; +++ unsigned threaded:1; ++ ++ struct list_head net_notifier_list; ++ ++--- a/net/core/dev.c +++++ b/net/core/dev.c ++@@ -91,6 +91,7 @@ ++ #include ++ #include ++ #include +++#include ++ #include ++ #include ++ #include ++@@ -1500,6 +1501,27 @@ void netdev_notify_peers(struct net_devi ++ } ++ EXPORT_SYMBOL(netdev_notify_peers); ++ +++static int napi_threaded_poll(void *data); +++ +++static int napi_kthread_create(struct napi_struct *n) +++{ +++ int err = 0; +++ +++ /* Create and wake up the kthread once to put it in +++ * TASK_INTERRUPTIBLE mode to avoid the blocked task +++ * warning and work with loadavg. +++ */ +++ n->thread = kthread_run(napi_threaded_poll, n, "napi/%s-%d", +++ n->dev->name, n->napi_id); +++ if (IS_ERR(n->thread)) { +++ err = PTR_ERR(n->thread); +++ pr_err("kthread_run failed with err %d\n", err); +++ n->thread = NULL; +++ } +++ +++ return err; +++} +++ ++ static int __dev_open(struct net_device *dev, struct netlink_ext_ack *extack) ++ { ++ const struct net_device_ops *ops = dev->netdev_ops; ++@@ -4254,6 +4276,21 @@ int gro_normal_batch __read_mostly = 8; ++ static inline void ____napi_schedule(struct softnet_data *sd, ++ struct napi_struct *napi) ++ { +++ struct task_struct *thread; +++ +++ if (test_bit(NAPI_STATE_THREADED, &napi->state)) { +++ /* Paired with smp_mb__before_atomic() in +++ * napi_enable(). Use READ_ONCE() to guarantee +++ * a complete read on napi->thread. Only call +++ * wake_up_process() when it's not NULL. +++ */ +++ thread = READ_ONCE(napi->thread); +++ if (thread) { +++ wake_up_process(thread); +++ return; +++ } +++ } +++ ++ list_add_tail(&napi->poll_list, &sd->poll_list); ++ __raise_softirq_irqoff(NET_RX_SOFTIRQ); ++ } ++@@ -6705,6 +6742,12 @@ void netif_napi_add(struct net_device *d ++ set_bit(NAPI_STATE_NPSVC, &napi->state); ++ list_add_rcu(&napi->dev_list, &dev->napi_list); ++ napi_hash_add(napi); +++ /* Create kthread for this napi if dev->threaded is set. +++ * Clear dev->threaded if kthread creation failed so that +++ * threaded mode will not be enabled in napi_enable(). +++ */ +++ if (dev->threaded && napi_kthread_create(napi)) +++ dev->threaded = 0; ++ } ++ EXPORT_SYMBOL(netif_napi_add); ++ ++@@ -6721,9 +6764,28 @@ void napi_disable(struct napi_struct *n) ++ hrtimer_cancel(&n->timer); ++ ++ clear_bit(NAPI_STATE_DISABLE, &n->state); +++ clear_bit(NAPI_STATE_THREADED, &n->state); ++ } ++ EXPORT_SYMBOL(napi_disable); ++ +++/** +++ * napi_enable - enable NAPI scheduling +++ * @n: NAPI context +++ * +++ * Resume NAPI from being scheduled on this context. +++ * Must be paired with napi_disable. +++ */ +++void napi_enable(struct napi_struct *n) +++{ +++ BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state)); +++ smp_mb__before_atomic(); +++ clear_bit(NAPI_STATE_SCHED, &n->state); +++ clear_bit(NAPI_STATE_NPSVC, &n->state); +++ if (n->dev->threaded && n->thread) +++ set_bit(NAPI_STATE_THREADED, &n->state); +++} +++EXPORT_SYMBOL(napi_enable); +++ ++ static void flush_gro_hash(struct napi_struct *napi) ++ { ++ int i; ++@@ -6749,6 +6811,11 @@ void __netif_napi_del(struct napi_struct ++ ++ flush_gro_hash(napi); ++ napi->gro_bitmask = 0; +++ +++ if (napi->thread) { +++ kthread_stop(napi->thread); +++ napi->thread = NULL; +++ } ++ } ++ EXPORT_SYMBOL(__netif_napi_del); ++ ++@@ -6830,6 +6897,51 @@ static int napi_poll(struct napi_struct ++ return work; ++ } ++ +++static int napi_thread_wait(struct napi_struct *napi) +++{ +++ set_current_state(TASK_INTERRUPTIBLE); +++ +++ while (!kthread_should_stop() && !napi_disable_pending(napi)) { +++ if (test_bit(NAPI_STATE_SCHED, &napi->state)) { +++ WARN_ON(!list_empty(&napi->poll_list)); +++ __set_current_state(TASK_RUNNING); +++ return 0; +++ } +++ +++ schedule(); +++ set_current_state(TASK_INTERRUPTIBLE); +++ } +++ __set_current_state(TASK_RUNNING); +++ return -1; +++} +++ +++static int napi_threaded_poll(void *data) +++{ +++ struct napi_struct *napi = data; +++ void *have; +++ +++ while (!napi_thread_wait(napi)) { +++ for (;;) { +++ bool repoll = false; +++ +++ local_bh_disable(); +++ +++ have = netpoll_poll_lock(napi); +++ __napi_poll(napi, &repoll); +++ netpoll_poll_unlock(have); +++ +++ __kfree_skb_flush(); +++ local_bh_enable(); +++ +++ if (!repoll) +++ break; +++ +++ cond_resched(); +++ } +++ } +++ return 0; +++} +++ ++ static __latent_entropy void net_rx_action(struct softirq_action *h) ++ { ++ struct softnet_data *sd = this_cpu_ptr(&softnet_data); +diff --git a/target/linux/generic/backport-5.10/602-v5.12-net-add-sysfs-attribute-to-control-napi-threaded-mod.patch b/target/linux/generic/backport-5.10/602-v5.12-net-add-sysfs-attribute-to-control-napi-threaded-mod.patch +new file mode 100644 +index 0000000000..e72d5eeca4 +--- /dev/null ++++ b/target/linux/generic/backport-5.10/602-v5.12-net-add-sysfs-attribute-to-control-napi-threaded-mod.patch +@@ -0,0 +1,177 @@ ++From: Wei Wang ++Date: Mon, 8 Feb 2021 11:34:10 -0800 ++Subject: [PATCH] net: add sysfs attribute to control napi threaded mode ++ ++This patch adds a new sysfs attribute to the network device class. ++Said attribute provides a per-device control to enable/disable the ++threaded mode for all the napi instances of the given network device, ++without the need for a device up/down. ++User sets it to 1 or 0 to enable or disable threaded mode. ++Note: when switching between threaded and the current softirq based mode ++for a napi instance, it will not immediately take effect if the napi is ++currently being polled. The mode switch will happen for the next time ++napi_schedule() is called. ++ ++Co-developed-by: Paolo Abeni ++Signed-off-by: Paolo Abeni ++Co-developed-by: Hannes Frederic Sowa ++Signed-off-by: Hannes Frederic Sowa ++Co-developed-by: Felix Fietkau ++Signed-off-by: Felix Fietkau ++Signed-off-by: Wei Wang ++Reviewed-by: Alexander Duyck ++Signed-off-by: David S. Miller ++--- ++ ++--- a/Documentation/ABI/testing/sysfs-class-net +++++ b/Documentation/ABI/testing/sysfs-class-net ++@@ -337,3 +337,18 @@ Contact: netdev@vger.kernel.org ++ Description: ++ 32-bit unsigned integer counting the number of times the link has ++ been down +++ +++What: /sys/class/net//threaded +++Date: Jan 2021 +++KernelVersion: 5.12 +++Contact: netdev@vger.kernel.org +++Description: +++ Boolean value to control the threaded mode per device. User could +++ set this value to enable/disable threaded mode for all napi +++ belonging to this device, without the need to do device up/down. +++ +++ Possible values: +++ == ================================== +++ 0 threaded mode disabled for this dev +++ 1 threaded mode enabled for this dev +++ == ================================== ++--- a/include/linux/netdevice.h +++++ b/include/linux/netdevice.h ++@@ -491,6 +491,8 @@ static inline bool napi_complete(struct ++ return napi_complete_done(n, 0); ++ } ++ +++int dev_set_threaded(struct net_device *dev, bool threaded); +++ ++ /** ++ * napi_disable - prevent NAPI from scheduling ++ * @n: NAPI context ++--- a/net/core/dev.c +++++ b/net/core/dev.c ++@@ -4280,8 +4280,9 @@ static inline void ____napi_schedule(str ++ ++ if (test_bit(NAPI_STATE_THREADED, &napi->state)) { ++ /* Paired with smp_mb__before_atomic() in ++- * napi_enable(). Use READ_ONCE() to guarantee ++- * a complete read on napi->thread. Only call +++ * napi_enable()/dev_set_threaded(). +++ * Use READ_ONCE() to guarantee a complete +++ * read on napi->thread. Only call ++ * wake_up_process() when it's not NULL. ++ */ ++ thread = READ_ONCE(napi->thread); ++@@ -6715,6 +6716,49 @@ static void init_gro_hash(struct napi_st ++ napi->gro_bitmask = 0; ++ } ++ +++int dev_set_threaded(struct net_device *dev, bool threaded) +++{ +++ struct napi_struct *napi; +++ int err = 0; +++ +++ if (dev->threaded == threaded) +++ return 0; +++ +++ if (threaded) { +++ list_for_each_entry(napi, &dev->napi_list, dev_list) { +++ if (!napi->thread) { +++ err = napi_kthread_create(napi); +++ if (err) { +++ threaded = false; +++ break; +++ } +++ } +++ } +++ } +++ +++ dev->threaded = threaded; +++ +++ /* Make sure kthread is created before THREADED bit +++ * is set. +++ */ +++ smp_mb__before_atomic(); +++ +++ /* Setting/unsetting threaded mode on a napi might not immediately +++ * take effect, if the current napi instance is actively being +++ * polled. In this case, the switch between threaded mode and +++ * softirq mode will happen in the next round of napi_schedule(). +++ * This should not cause hiccups/stalls to the live traffic. +++ */ +++ list_for_each_entry(napi, &dev->napi_list, dev_list) { +++ if (threaded) +++ set_bit(NAPI_STATE_THREADED, &napi->state); +++ else +++ clear_bit(NAPI_STATE_THREADED, &napi->state); +++ } +++ +++ return err; +++} +++ ++ void netif_napi_add(struct net_device *dev, struct napi_struct *napi, ++ int (*poll)(struct napi_struct *, int), int weight) ++ { ++--- a/net/core/net-sysfs.c +++++ b/net/core/net-sysfs.c ++@@ -538,6 +538,45 @@ static ssize_t phys_switch_id_show(struc ++ } ++ static DEVICE_ATTR_RO(phys_switch_id); ++ +++static ssize_t threaded_show(struct device *dev, +++ struct device_attribute *attr, char *buf) +++{ +++ struct net_device *netdev = to_net_dev(dev); +++ ssize_t ret = -EINVAL; +++ +++ if (!rtnl_trylock()) +++ return restart_syscall(); +++ +++ if (dev_isalive(netdev)) +++ ret = sprintf(buf, fmt_dec, netdev->threaded); +++ +++ rtnl_unlock(); +++ return ret; +++} +++ +++static int modify_napi_threaded(struct net_device *dev, unsigned long val) +++{ +++ int ret; +++ +++ if (list_empty(&dev->napi_list)) +++ return -EOPNOTSUPP; +++ +++ if (val != 0 && val != 1) +++ return -EOPNOTSUPP; +++ +++ ret = dev_set_threaded(dev, val); +++ +++ return ret; +++} +++ +++static ssize_t threaded_store(struct device *dev, +++ struct device_attribute *attr, +++ const char *buf, size_t len) +++{ +++ return netdev_store(dev, attr, buf, len, modify_napi_threaded); +++} +++static DEVICE_ATTR_RW(threaded); +++ ++ static struct attribute *net_class_attrs[] __ro_after_init = { ++ &dev_attr_netdev_group.attr, ++ &dev_attr_type.attr, ++@@ -570,6 +609,7 @@ static struct attribute *net_class_attrs ++ &dev_attr_proto_down.attr, ++ &dev_attr_carrier_up_count.attr, ++ &dev_attr_carrier_down_count.attr, +++ &dev_attr_threaded.attr, ++ NULL, ++ }; ++ ATTRIBUTE_GROUPS(net_class); +diff --git a/target/linux/generic/backport-5.10/603-v5.12-net-fix-race-between-napi-kthread-mode-and-busy-poll.patch b/target/linux/generic/backport-5.10/603-v5.12-net-fix-race-between-napi-kthread-mode-and-busy-poll.patch +new file mode 100644 +index 0000000000..dddc35918e +--- /dev/null ++++ b/target/linux/generic/backport-5.10/603-v5.12-net-fix-race-between-napi-kthread-mode-and-busy-poll.patch +@@ -0,0 +1,93 @@ ++From: Wei Wang ++Date: Mon, 1 Mar 2021 17:21:13 -0800 ++Subject: [PATCH] net: fix race between napi kthread mode and busy poll ++ ++Currently, napi_thread_wait() checks for NAPI_STATE_SCHED bit to ++determine if the kthread owns this napi and could call napi->poll() on ++it. However, if socket busy poll is enabled, it is possible that the ++busy poll thread grabs this SCHED bit (after the previous napi->poll() ++invokes napi_complete_done() and clears SCHED bit) and tries to poll ++on the same napi. napi_disable() could grab the SCHED bit as well. ++This patch tries to fix this race by adding a new bit ++NAPI_STATE_SCHED_THREADED in napi->state. This bit gets set in ++____napi_schedule() if the threaded mode is enabled, and gets cleared ++in napi_complete_done(), and we only poll the napi in kthread if this ++bit is set. This helps distinguish the ownership of the napi between ++kthread and other scenarios and fixes the race issue. ++ ++Fixes: 29863d41bb6e ("net: implement threaded-able napi poll loop support") ++Reported-by: Martin Zaharinov ++Suggested-by: Jakub Kicinski ++Signed-off-by: Wei Wang ++Cc: Alexander Duyck ++Cc: Eric Dumazet ++Cc: Paolo Abeni ++Cc: Hannes Frederic Sowa ++--- ++ ++--- a/include/linux/netdevice.h +++++ b/include/linux/netdevice.h ++@@ -359,6 +359,7 @@ enum { ++ NAPI_STATE_NO_BUSY_POLL,/* Do not add in napi_hash, no busy polling */ ++ NAPI_STATE_IN_BUSY_POLL,/* sk_busy_loop() owns this NAPI */ ++ NAPI_STATE_THREADED, /* The poll is performed inside its own thread*/ +++ NAPI_STATE_SCHED_THREADED, /* Napi is currently scheduled in threaded mode */ ++ }; ++ ++ enum { ++@@ -370,6 +371,7 @@ enum { ++ NAPIF_STATE_NO_BUSY_POLL = BIT(NAPI_STATE_NO_BUSY_POLL), ++ NAPIF_STATE_IN_BUSY_POLL = BIT(NAPI_STATE_IN_BUSY_POLL), ++ NAPIF_STATE_THREADED = BIT(NAPI_STATE_THREADED), +++ NAPIF_STATE_SCHED_THREADED = BIT(NAPI_STATE_SCHED_THREADED), ++ }; ++ ++ enum gro_result { ++--- a/net/core/dev.c +++++ b/net/core/dev.c ++@@ -4287,6 +4287,8 @@ static inline void ____napi_schedule(str ++ */ ++ thread = READ_ONCE(napi->thread); ++ if (thread) { +++ if (thread->state != TASK_INTERRUPTIBLE) +++ set_bit(NAPI_STATE_SCHED_THREADED, &napi->state); ++ wake_up_process(thread); ++ return; ++ } ++@@ -6507,7 +6509,8 @@ bool napi_complete_done(struct napi_stru ++ ++ WARN_ON_ONCE(!(val & NAPIF_STATE_SCHED)); ++ ++- new = val & ~(NAPIF_STATE_MISSED | NAPIF_STATE_SCHED); +++ new = val & ~(NAPIF_STATE_MISSED | NAPIF_STATE_SCHED | +++ NAPIF_STATE_SCHED_THREADED); ++ ++ /* If STATE_MISSED was set, leave STATE_SCHED set, ++ * because we will call napi->poll() one more time. ++@@ -6943,16 +6946,25 @@ static int napi_poll(struct napi_struct ++ ++ static int napi_thread_wait(struct napi_struct *napi) ++ { +++ bool woken = false; +++ ++ set_current_state(TASK_INTERRUPTIBLE); ++ ++ while (!kthread_should_stop() && !napi_disable_pending(napi)) { ++- if (test_bit(NAPI_STATE_SCHED, &napi->state)) { +++ /* Testing SCHED_THREADED bit here to make sure the current +++ * kthread owns this napi and could poll on this napi. +++ * Testing SCHED bit is not enough because SCHED bit might be +++ * set by some other busy poll thread or by napi_disable(). +++ */ +++ if (test_bit(NAPI_STATE_SCHED_THREADED, &napi->state) || woken) { ++ WARN_ON(!list_empty(&napi->poll_list)); ++ __set_current_state(TASK_RUNNING); ++ return 0; ++ } ++ ++ schedule(); +++ /* woken being true indicates this thread owns this napi. */ +++ woken = true; ++ set_current_state(TASK_INTERRUPTIBLE); ++ } ++ __set_current_state(TASK_RUNNING); +diff --git a/target/linux/generic/backport-5.10/770-v5.12-net-bridge-notify-switchdev-of-disappearance-of-old-.patch b/target/linux/generic/backport-5.10/770-v5.12-net-bridge-notify-switchdev-of-disappearance-of-old-.patch +new file mode 100644 +index 0000000000..c43cb4d1f2 +--- /dev/null ++++ b/target/linux/generic/backport-5.10/770-v5.12-net-bridge-notify-switchdev-of-disappearance-of-old-.patch +@@ -0,0 +1,126 @@ ++From 90dc8fd36078a536671adae884d0b929cce6480a Mon Sep 17 00:00:00 2001 ++From: Vladimir Oltean ++Date: Wed, 6 Jan 2021 11:51:30 +0200 ++Subject: [PATCH] net: bridge: notify switchdev of disappearance of old FDB ++ entry upon migration ++ ++Currently the bridge emits atomic switchdev notifications for ++dynamically learnt FDB entries. Monitoring these notifications works ++wonders for switchdev drivers that want to keep their hardware FDB in ++sync with the bridge's FDB. ++ ++For example station A wants to talk to station B in the diagram below, ++and we are concerned with the behavior of the bridge on the DUT device: ++ ++ DUT ++ +-------------------------------------+ ++ | br0 | ++ | +------+ +------+ +------+ +------+ | ++ | | | | | | | | | | ++ | | swp0 | | swp1 | | swp2 | | eth0 | | ++ +-------------------------------------+ ++ | | | ++ Station A | | ++ | | ++ +--+------+--+ +--+------+--+ ++ | | | | | | | | ++ | | swp0 | | | | swp0 | | ++ Another | +------+ | | +------+ | Another ++ switch | br0 | | br0 | switch ++ | +------+ | | +------+ | ++ | | | | | | | | ++ | | swp1 | | | | swp1 | | ++ +--+------+--+ +--+------+--+ ++ | ++ Station B ++ ++Interfaces swp0, swp1, swp2 are handled by a switchdev driver that has ++the following property: frames injected from its control interface bypass ++the internal address analyzer logic, and therefore, this hardware does ++not learn from the source address of packets transmitted by the network ++stack through it. So, since bridging between eth0 (where Station B is ++attached) and swp0 (where Station A is attached) is done in software, ++the switchdev hardware will never learn the source address of Station B. ++So the traffic towards that destination will be treated as unknown, i.e. ++flooded. ++ ++This is where the bridge notifications come in handy. When br0 on the ++DUT sees frames with Station B's MAC address on eth0, the switchdev ++driver gets these notifications and can install a rule to send frames ++towards Station B's address that are incoming from swp0, swp1, swp2, ++only towards the control interface. This is all switchdev driver private ++business, which the notification makes possible. ++ ++All is fine until someone unplugs Station B's cable and moves it to the ++other switch: ++ ++ DUT ++ +-------------------------------------+ ++ | br0 | ++ | +------+ +------+ +------+ +------+ | ++ | | | | | | | | | | ++ | | swp0 | | swp1 | | swp2 | | eth0 | | ++ +-------------------------------------+ ++ | | | ++ Station A | | ++ | | ++ +--+------+--+ +--+------+--+ ++ | | | | | | | | ++ | | swp0 | | | | swp0 | | ++ Another | +------+ | | +------+ | Another ++ switch | br0 | | br0 | switch ++ | +------+ | | +------+ | ++ | | | | | | | | ++ | | swp1 | | | | swp1 | | ++ +--+------+--+ +--+------+--+ ++ | ++ Station B ++ ++Luckily for the use cases we care about, Station B is noisy enough that ++the DUT hears it (on swp1 this time). swp1 receives the frames and ++delivers them to the bridge, who enters the unlikely path in br_fdb_update ++of updating an existing entry. It moves the entry in the software bridge ++to swp1 and emits an addition notification towards that. ++ ++As far as the switchdev driver is concerned, all that it needs to ensure ++is that traffic between Station A and Station B is not forever broken. ++If it does nothing, then the stale rule to send frames for Station B ++towards the control interface remains in place. But Station B is no ++longer reachable via the control interface, but via a port that can ++offload the bridge port learning attribute. It's just that the port is ++prevented from learning this address, since the rule overrides FDB ++updates. So the rule needs to go. The question is via what mechanism. ++ ++It sure would be possible for this switchdev driver to keep track of all ++addresses which are sent to the control interface, and then also listen ++for bridge notifier events on its own ports, searching for the ones that ++have a MAC address which was previously sent to the control interface. ++But this is cumbersome and inefficient. Instead, with one small change, ++the bridge could notify of the address deletion from the old port, in a ++symmetrical manner with how it did for the insertion. Then the switchdev ++driver would not be required to monitor learn/forget events for its own ++ports. It could just delete the rule towards the control interface upon ++bridge entry migration. This would make hardware address learning be ++possible again. Then it would take a few more packets until the hardware ++and software FDB would be in sync again. ++ ++Signed-off-by: Vladimir Oltean ++Acked-by: Nikolay Aleksandrov ++Reviewed-by: Ido Schimmel ++Reviewed-by: Andrew Lunn ++Reviewed-by: Florian Fainelli ++Signed-off-by: Jakub Kicinski ++--- ++ net/bridge/br_fdb.c | 1 + ++ 1 file changed, 1 insertion(+) ++ ++--- a/net/bridge/br_fdb.c +++++ b/net/bridge/br_fdb.c ++@@ -602,6 +602,7 @@ void br_fdb_update(struct net_bridge *br ++ /* fastpath: update of existing entry */ ++ if (unlikely(source != fdb->dst && ++ !test_bit(BR_FDB_STICKY, &fdb->flags))) { +++ br_switchdev_fdb_notify(fdb, RTM_DELNEIGH); ++ fdb->dst = source; ++ fdb_modified = true; ++ /* Take over HW learned entry */ +diff --git a/target/linux/generic/backport-5.10/771-v5.12-net-dsa-be-louder-when-a-non-legacy-FDB-operation-fa.patch b/target/linux/generic/backport-5.10/771-v5.12-net-dsa-be-louder-when-a-non-legacy-FDB-operation-fa.patch +new file mode 100644 +index 0000000000..ecb81004cb +--- /dev/null ++++ b/target/linux/generic/backport-5.10/771-v5.12-net-dsa-be-louder-when-a-non-legacy-FDB-operation-fa.patch +@@ -0,0 +1,52 @@ ++From 2fd186501b1cff155cc4a755c210793cfc0dffb5 Mon Sep 17 00:00:00 2001 ++From: Vladimir Oltean ++Date: Wed, 6 Jan 2021 11:51:31 +0200 ++Subject: [PATCH] net: dsa: be louder when a non-legacy FDB operation fails ++ ++The dev_close() call was added in commit c9eb3e0f8701 ("net: dsa: Add ++support for learning FDB through notification") "to indicate inconsistent ++situation" when we could not delete an FDB entry from the port. ++ ++bridge fdb del d8:58:d7:00:ca:6d dev swp0 self master ++ ++It is a bit drastic and at the same time not helpful if the above fails ++to only print with netdev_dbg log level, but on the other hand to bring ++the interface down. ++ ++So increase the verbosity of the error message, and drop dev_close(). ++ ++Signed-off-by: Vladimir Oltean ++Reviewed-by: Andrew Lunn ++Reviewed-by: Florian Fainelli ++Signed-off-by: Jakub Kicinski ++--- ++ net/dsa/slave.c | 10 +++++++--- ++ 1 file changed, 7 insertions(+), 3 deletions(-) ++ ++--- a/net/dsa/slave.c +++++ b/net/dsa/slave.c ++@@ -2075,7 +2075,9 @@ static void dsa_slave_switchdev_event_wo ++ ++ err = dsa_port_fdb_add(dp, fdb_info->addr, fdb_info->vid); ++ if (err) { ++- netdev_dbg(dev, "fdb add failed err=%d\n", err); +++ netdev_err(dev, +++ "failed to add %pM vid %d to fdb: %d\n", +++ fdb_info->addr, fdb_info->vid, err); ++ break; ++ } ++ fdb_info->offloaded = true; ++@@ -2090,9 +2092,11 @@ static void dsa_slave_switchdev_event_wo ++ ++ err = dsa_port_fdb_del(dp, fdb_info->addr, fdb_info->vid); ++ if (err) { ++- netdev_dbg(dev, "fdb del failed err=%d\n", err); ++- dev_close(dev); +++ netdev_err(dev, +++ "failed to delete %pM vid %d from fdb: %d\n", +++ fdb_info->addr, fdb_info->vid, err); ++ } +++ ++ break; ++ } ++ rtnl_unlock(); +diff --git a/target/linux/generic/backport-5.10/772-v5.12-net-dsa-don-t-use-switchdev_notifier_fdb_info-in-dsa.patch b/target/linux/generic/backport-5.10/772-v5.12-net-dsa-don-t-use-switchdev_notifier_fdb_info-in-dsa.patch +new file mode 100644 +index 0000000000..bb943f1312 +--- /dev/null ++++ b/target/linux/generic/backport-5.10/772-v5.12-net-dsa-don-t-use-switchdev_notifier_fdb_info-in-dsa.patch +@@ -0,0 +1,226 @@ ++From c4bb76a9a0ef87c4cc1f636defed5f12deb9f5a7 Mon Sep 17 00:00:00 2001 ++From: Vladimir Oltean ++Date: Wed, 6 Jan 2021 11:51:32 +0200 ++Subject: [PATCH] net: dsa: don't use switchdev_notifier_fdb_info in ++ dsa_switchdev_event_work ++ ++Currently DSA doesn't add FDB entries on the CPU port, because it only ++does so through switchdev, which is associated with a net_device, and ++there are none of those for the CPU port. ++ ++But actually FDB addresses on the CPU port have some use cases of their ++own, if the switchdev operations are initiated from within the DSA ++layer. There is just one problem with the existing code: it passes a ++structure in dsa_switchdev_event_work which was retrieved directly from ++switchdev, so it contains a net_device. We need to generalize the ++contents to something that covers the CPU port as well: the "ds, port" ++tuple is fine for that. ++ ++Note that the new procedure for notifying the successful FDB offload is ++inspired from the rocker model. ++ ++Also, nothing was being done if added_by_user was false. Let's check for ++that a lot earlier, and don't actually bother to schedule the worker ++for nothing. ++ ++Signed-off-by: Vladimir Oltean ++Reviewed-by: Florian Fainelli ++Signed-off-by: Jakub Kicinski ++--- ++ net/dsa/dsa_priv.h | 12 +++++ ++ net/dsa/slave.c | 106 ++++++++++++++++++++++----------------------- ++ 2 files changed, 65 insertions(+), 53 deletions(-) ++ ++--- a/net/dsa/dsa_priv.h +++++ b/net/dsa/dsa_priv.h ++@@ -73,6 +73,18 @@ struct dsa_notifier_mtu_info { ++ int mtu; ++ }; ++ +++struct dsa_switchdev_event_work { +++ struct dsa_switch *ds; +++ int port; +++ struct work_struct work; +++ unsigned long event; +++ /* Specific for SWITCHDEV_FDB_ADD_TO_DEVICE and +++ * SWITCHDEV_FDB_DEL_TO_DEVICE +++ */ +++ unsigned char addr[ETH_ALEN]; +++ u16 vid; +++}; +++ ++ struct dsa_slave_priv { ++ /* Copy of CPU port xmit for faster access in slave transmit hot path */ ++ struct sk_buff * (*xmit)(struct sk_buff *skb, ++--- a/net/dsa/slave.c +++++ b/net/dsa/slave.c ++@@ -2050,76 +2050,66 @@ static int dsa_slave_netdevice_event(str ++ return NOTIFY_DONE; ++ } ++ ++-struct dsa_switchdev_event_work { ++- struct work_struct work; ++- struct switchdev_notifier_fdb_info fdb_info; ++- struct net_device *dev; ++- unsigned long event; ++-}; +++static void +++dsa_fdb_offload_notify(struct dsa_switchdev_event_work *switchdev_work) +++{ +++ struct dsa_switch *ds = switchdev_work->ds; +++ struct switchdev_notifier_fdb_info info; +++ struct dsa_port *dp; +++ +++ if (!dsa_is_user_port(ds, switchdev_work->port)) +++ return; +++ +++ info.addr = switchdev_work->addr; +++ info.vid = switchdev_work->vid; +++ info.offloaded = true; +++ dp = dsa_to_port(ds, switchdev_work->port); +++ call_switchdev_notifiers(SWITCHDEV_FDB_OFFLOADED, +++ dp->slave, &info.info, NULL); +++} ++ ++ static void dsa_slave_switchdev_event_work(struct work_struct *work) ++ { ++ struct dsa_switchdev_event_work *switchdev_work = ++ container_of(work, struct dsa_switchdev_event_work, work); ++- struct net_device *dev = switchdev_work->dev; ++- struct switchdev_notifier_fdb_info *fdb_info; ++- struct dsa_port *dp = dsa_slave_to_port(dev); +++ struct dsa_switch *ds = switchdev_work->ds; +++ struct dsa_port *dp; ++ int err; ++ +++ dp = dsa_to_port(ds, switchdev_work->port); +++ ++ rtnl_lock(); ++ switch (switchdev_work->event) { ++ case SWITCHDEV_FDB_ADD_TO_DEVICE: ++- fdb_info = &switchdev_work->fdb_info; ++- if (!fdb_info->added_by_user) ++- break; ++- ++- err = dsa_port_fdb_add(dp, fdb_info->addr, fdb_info->vid); +++ err = dsa_port_fdb_add(dp, switchdev_work->addr, +++ switchdev_work->vid); ++ if (err) { ++- netdev_err(dev, ++- "failed to add %pM vid %d to fdb: %d\n", ++- fdb_info->addr, fdb_info->vid, err); +++ dev_err(ds->dev, +++ "port %d failed to add %pM vid %d to fdb: %d\n", +++ dp->index, switchdev_work->addr, +++ switchdev_work->vid, err); ++ break; ++ } ++- fdb_info->offloaded = true; ++- call_switchdev_notifiers(SWITCHDEV_FDB_OFFLOADED, dev, ++- &fdb_info->info, NULL); +++ dsa_fdb_offload_notify(switchdev_work); ++ break; ++ ++ case SWITCHDEV_FDB_DEL_TO_DEVICE: ++- fdb_info = &switchdev_work->fdb_info; ++- if (!fdb_info->added_by_user) ++- break; ++- ++- err = dsa_port_fdb_del(dp, fdb_info->addr, fdb_info->vid); +++ err = dsa_port_fdb_del(dp, switchdev_work->addr, +++ switchdev_work->vid); ++ if (err) { ++- netdev_err(dev, ++- "failed to delete %pM vid %d from fdb: %d\n", ++- fdb_info->addr, fdb_info->vid, err); +++ dev_err(ds->dev, +++ "port %d failed to delete %pM vid %d from fdb: %d\n", +++ dp->index, switchdev_work->addr, +++ switchdev_work->vid, err); ++ } ++ ++ break; ++ } ++ rtnl_unlock(); ++ ++- kfree(switchdev_work->fdb_info.addr); ++ kfree(switchdev_work); ++- dev_put(dev); ++-} ++- ++-static int ++-dsa_slave_switchdev_fdb_work_init(struct dsa_switchdev_event_work * ++- switchdev_work, ++- const struct switchdev_notifier_fdb_info * ++- fdb_info) ++-{ ++- memcpy(&switchdev_work->fdb_info, fdb_info, ++- sizeof(switchdev_work->fdb_info)); ++- switchdev_work->fdb_info.addr = kzalloc(ETH_ALEN, GFP_ATOMIC); ++- if (!switchdev_work->fdb_info.addr) ++- return -ENOMEM; ++- ether_addr_copy((u8 *)switchdev_work->fdb_info.addr, ++- fdb_info->addr); ++- return 0; +++ if (dsa_is_user_port(ds, dp->index)) +++ dev_put(dp->slave); ++ } ++ ++ /* Called under rcu_read_lock() */ ++@@ -2127,7 +2117,9 @@ static int dsa_slave_switchdev_event(str ++ unsigned long event, void *ptr) ++ { ++ struct net_device *dev = switchdev_notifier_info_to_dev(ptr); +++ const struct switchdev_notifier_fdb_info *fdb_info; ++ struct dsa_switchdev_event_work *switchdev_work; +++ struct dsa_port *dp; ++ int err; ++ ++ if (event == SWITCHDEV_PORT_ATTR_SET) { ++@@ -2140,20 +2132,32 @@ static int dsa_slave_switchdev_event(str ++ if (!dsa_slave_dev_check(dev)) ++ return NOTIFY_DONE; ++ +++ dp = dsa_slave_to_port(dev); +++ ++ switchdev_work = kzalloc(sizeof(*switchdev_work), GFP_ATOMIC); ++ if (!switchdev_work) ++ return NOTIFY_BAD; ++ ++ INIT_WORK(&switchdev_work->work, ++ dsa_slave_switchdev_event_work); ++- switchdev_work->dev = dev; +++ switchdev_work->ds = dp->ds; +++ switchdev_work->port = dp->index; ++ switchdev_work->event = event; ++ ++ switch (event) { ++ case SWITCHDEV_FDB_ADD_TO_DEVICE: ++ case SWITCHDEV_FDB_DEL_TO_DEVICE: ++- if (dsa_slave_switchdev_fdb_work_init(switchdev_work, ptr)) ++- goto err_fdb_work_init; +++ fdb_info = ptr; +++ +++ if (!fdb_info->added_by_user) { +++ kfree(switchdev_work); +++ return NOTIFY_OK; +++ } +++ +++ ether_addr_copy(switchdev_work->addr, +++ fdb_info->addr); +++ switchdev_work->vid = fdb_info->vid; +++ ++ dev_hold(dev); ++ break; ++ default: ++@@ -2163,10 +2167,6 @@ static int dsa_slave_switchdev_event(str ++ ++ dsa_schedule_work(&switchdev_work->work); ++ return NOTIFY_OK; ++- ++-err_fdb_work_init: ++- kfree(switchdev_work); ++- return NOTIFY_BAD; ++ } ++ ++ static int dsa_slave_switchdev_blocking_event(struct notifier_block *unused, +diff --git a/target/linux/generic/backport-5.10/773-v5.12-net-dsa-move-switchdev-event-implementation-under-th.patch b/target/linux/generic/backport-5.10/773-v5.12-net-dsa-move-switchdev-event-implementation-under-th.patch +new file mode 100644 +index 0000000000..48c2af770b +--- /dev/null ++++ b/target/linux/generic/backport-5.10/773-v5.12-net-dsa-move-switchdev-event-implementation-under-th.patch +@@ -0,0 +1,85 @@ ++From 447d290a58bd335d68f665713842365d3d6447df Mon Sep 17 00:00:00 2001 ++From: Vladimir Oltean ++Date: Wed, 6 Jan 2021 11:51:33 +0200 ++Subject: [PATCH] net: dsa: move switchdev event implementation under the same ++ switch/case statement ++ ++We'll need to start listening to SWITCHDEV_FDB_{ADD,DEL}_TO_DEVICE ++events even for interfaces where dsa_slave_dev_check returns false, so ++we need that check inside the switch-case statement for SWITCHDEV_FDB_*. ++ ++This movement also avoids a useless allocation / free of switchdev_work ++on the untreated "default event" case. ++ ++Signed-off-by: Vladimir Oltean ++Reviewed-by: Florian Fainelli ++Signed-off-by: Jakub Kicinski ++--- ++ net/dsa/slave.c | 35 ++++++++++++++++------------------- ++ 1 file changed, 16 insertions(+), 19 deletions(-) ++ ++--- a/net/dsa/slave.c +++++ b/net/dsa/slave.c ++@@ -2122,31 +2122,29 @@ static int dsa_slave_switchdev_event(str ++ struct dsa_port *dp; ++ int err; ++ ++- if (event == SWITCHDEV_PORT_ATTR_SET) { +++ switch (event) { +++ case SWITCHDEV_PORT_ATTR_SET: ++ err = switchdev_handle_port_attr_set(dev, ptr, ++ dsa_slave_dev_check, ++ dsa_slave_port_attr_set); ++ return notifier_from_errno(err); ++- } ++- ++- if (!dsa_slave_dev_check(dev)) ++- return NOTIFY_DONE; +++ case SWITCHDEV_FDB_ADD_TO_DEVICE: +++ case SWITCHDEV_FDB_DEL_TO_DEVICE: +++ if (!dsa_slave_dev_check(dev)) +++ return NOTIFY_DONE; ++ ++- dp = dsa_slave_to_port(dev); +++ dp = dsa_slave_to_port(dev); ++ ++- switchdev_work = kzalloc(sizeof(*switchdev_work), GFP_ATOMIC); ++- if (!switchdev_work) ++- return NOTIFY_BAD; ++- ++- INIT_WORK(&switchdev_work->work, ++- dsa_slave_switchdev_event_work); ++- switchdev_work->ds = dp->ds; ++- switchdev_work->port = dp->index; ++- switchdev_work->event = event; +++ switchdev_work = kzalloc(sizeof(*switchdev_work), GFP_ATOMIC); +++ if (!switchdev_work) +++ return NOTIFY_BAD; +++ +++ INIT_WORK(&switchdev_work->work, +++ dsa_slave_switchdev_event_work); +++ switchdev_work->ds = dp->ds; +++ switchdev_work->port = dp->index; +++ switchdev_work->event = event; ++ ++- switch (event) { ++- case SWITCHDEV_FDB_ADD_TO_DEVICE: ++- case SWITCHDEV_FDB_DEL_TO_DEVICE: ++ fdb_info = ptr; ++ ++ if (!fdb_info->added_by_user) { ++@@ -2159,13 +2157,12 @@ static int dsa_slave_switchdev_event(str ++ switchdev_work->vid = fdb_info->vid; ++ ++ dev_hold(dev); +++ dsa_schedule_work(&switchdev_work->work); ++ break; ++ default: ++- kfree(switchdev_work); ++ return NOTIFY_DONE; ++ } ++ ++- dsa_schedule_work(&switchdev_work->work); ++ return NOTIFY_OK; ++ } ++ +diff --git a/target/linux/generic/backport-5.10/774-v5.12-net-dsa-exit-early-in-dsa_slave_switchdev_event-if-w.patch b/target/linux/generic/backport-5.10/774-v5.12-net-dsa-exit-early-in-dsa_slave_switchdev_event-if-w.patch +new file mode 100644 +index 0000000000..a1f56353ea +--- /dev/null ++++ b/target/linux/generic/backport-5.10/774-v5.12-net-dsa-exit-early-in-dsa_slave_switchdev_event-if-w.patch +@@ -0,0 +1,42 @@ ++From 5fb4a451a87d8ed3363d28b63a3295399373d6c4 Mon Sep 17 00:00:00 2001 ++From: Vladimir Oltean ++Date: Wed, 6 Jan 2021 11:51:34 +0200 ++Subject: [PATCH] net: dsa: exit early in dsa_slave_switchdev_event if we can't ++ program the FDB ++ ++Right now, the following would happen for a switch driver that does not ++implement .port_fdb_add or .port_fdb_del. ++ ++dsa_slave_switchdev_event returns NOTIFY_OK and schedules: ++-> dsa_slave_switchdev_event_work ++ -> dsa_port_fdb_add ++ -> dsa_port_notify(DSA_NOTIFIER_FDB_ADD) ++ -> dsa_switch_fdb_add ++ -> if (!ds->ops->port_fdb_add) return -EOPNOTSUPP; ++ -> an error is printed with dev_dbg, and ++ dsa_fdb_offload_notify(switchdev_work) is not called. ++ ++We can avoid scheduling the worker for nothing and say NOTIFY_DONE. ++Because we don't call dsa_fdb_offload_notify, the static FDB entry will ++remain just in the software bridge. ++ ++Signed-off-by: Vladimir Oltean ++Reviewed-by: Florian Fainelli ++Reviewed-by: Andrew Lunn ++Signed-off-by: Jakub Kicinski ++--- ++ net/dsa/slave.c | 3 +++ ++ 1 file changed, 3 insertions(+) ++ ++--- a/net/dsa/slave.c +++++ b/net/dsa/slave.c ++@@ -2135,6 +2135,9 @@ static int dsa_slave_switchdev_event(str ++ ++ dp = dsa_slave_to_port(dev); ++ +++ if (!dp->ds->ops->port_fdb_add || !dp->ds->ops->port_fdb_del) +++ return NOTIFY_DONE; +++ ++ switchdev_work = kzalloc(sizeof(*switchdev_work), GFP_ATOMIC); ++ if (!switchdev_work) ++ return NOTIFY_BAD; +diff --git a/target/linux/generic/backport-5.10/775-v5.12-net-dsa-listen-for-SWITCHDEV_-FDB-DEL-_ADD_TO_DEVICE.patch b/target/linux/generic/backport-5.10/775-v5.12-net-dsa-listen-for-SWITCHDEV_-FDB-DEL-_ADD_TO_DEVICE.patch +new file mode 100644 +index 0000000000..e576ff8ce2 +--- /dev/null ++++ b/target/linux/generic/backport-5.10/775-v5.12-net-dsa-listen-for-SWITCHDEV_-FDB-DEL-_ADD_TO_DEVICE.patch +@@ -0,0 +1,264 @@ ++From d5f19486cee79d04c054427577ac96ed123706db Mon Sep 17 00:00:00 2001 ++From: Vladimir Oltean ++Date: Wed, 6 Jan 2021 11:51:35 +0200 ++Subject: [PATCH] net: dsa: listen for SWITCHDEV_{FDB,DEL}_ADD_TO_DEVICE on ++ foreign bridge neighbors ++ ++Some DSA switches (and not only) cannot learn source MAC addresses from ++packets injected from the CPU. They only perform hardware address ++learning from inbound traffic. ++ ++This can be problematic when we have a bridge spanning some DSA switch ++ports and some non-DSA ports (which we'll call "foreign interfaces" from ++DSA's perspective). ++ ++There are 2 classes of problems created by the lack of learning on ++CPU-injected traffic: ++- excessive flooding, due to the fact that DSA treats those addresses as ++ unknown ++- the risk of stale routes, which can lead to temporary packet loss ++ ++To illustrate the second class, consider the following situation, which ++is common in production equipment (wireless access points, where there ++is a WLAN interface and an Ethernet switch, and these form a single ++bridging domain). ++ ++ AP 1: ++ +------------------------------------------------------------------------+ ++ | br0 | ++ +------------------------------------------------------------------------+ ++ +------------+ +------------+ +------------+ +------------+ +------------+ ++ | swp0 | | swp1 | | swp2 | | swp3 | | wlan0 | ++ +------------+ +------------+ +------------+ +------------+ +------------+ ++ | ^ ^ ++ | | | ++ | | | ++ | Client A Client B ++ | ++ | ++ | ++ +------------+ +------------+ +------------+ +------------+ +------------+ ++ | swp0 | | swp1 | | swp2 | | swp3 | | wlan0 | ++ +------------+ +------------+ +------------+ +------------+ +------------+ ++ +------------------------------------------------------------------------+ ++ | br0 | ++ +------------------------------------------------------------------------+ ++ AP 2 ++ ++- br0 of AP 1 will know that Clients A and B are reachable via wlan0 ++- the hardware fdb of a DSA switch driver today is not kept in sync with ++ the software entries on other bridge ports, so it will not know that ++ clients A and B are reachable via the CPU port UNLESS the hardware ++ switch itself performs SA learning from traffic injected from the CPU. ++ Nonetheless, a substantial number of switches don't. ++- the hardware fdb of the DSA switch on AP 2 may autonomously learn that ++ Client A and B are reachable through swp0. Therefore, the software br0 ++ of AP 2 also may or may not learn this. In the example we're ++ illustrating, some Ethernet traffic has been going on, and br0 from AP ++ 2 has indeed learnt that it can reach Client B through swp0. ++ ++One of the wireless clients, say Client B, disconnects from AP 1 and ++roams to AP 2. The topology now looks like this: ++ ++ AP 1: ++ +------------------------------------------------------------------------+ ++ | br0 | ++ +------------------------------------------------------------------------+ ++ +------------+ +------------+ +------------+ +------------+ +------------+ ++ | swp0 | | swp1 | | swp2 | | swp3 | | wlan0 | ++ +------------+ +------------+ +------------+ +------------+ +------------+ ++ | ^ ++ | | ++ | Client A ++ | ++ | ++ | Client B ++ | | ++ | v ++ +------------+ +------------+ +------------+ +------------+ +------------+ ++ | swp0 | | swp1 | | swp2 | | swp3 | | wlan0 | ++ +------------+ +------------+ +------------+ +------------+ +------------+ ++ +------------------------------------------------------------------------+ ++ | br0 | ++ +------------------------------------------------------------------------+ ++ AP 2 ++ ++- br0 of AP 1 still knows that Client A is reachable via wlan0 (no change) ++- br0 of AP 1 will (possibly) know that Client B has left wlan0. There ++ are cases where it might never find out though. Either way, DSA today ++ does not process that notification in any way. ++- the hardware FDB of the DSA switch on AP 1 may learn autonomously that ++ Client B can be reached via swp0, if it receives any packet with ++ Client 1's source MAC address over Ethernet. ++- the hardware FDB of the DSA switch on AP 2 still thinks that Client B ++ can be reached via swp0. It does not know that it has roamed to wlan0, ++ because it doesn't perform SA learning from the CPU port. ++ ++Now Client A contacts Client B. ++AP 1 routes the packet fine towards swp0 and delivers it on the Ethernet ++segment. ++AP 2 sees a frame on swp0 and its fdb says that the destination is swp0. ++Hairpinning is disabled => drop. ++ ++This problem comes from the fact that these switches have a 'blind spot' ++for addresses coming from software bridging. The generic solution is not ++to assume that hardware learning can be enabled somehow, but to listen ++to more bridge learning events. It turns out that the bridge driver does ++learn in software from all inbound frames, in __br_handle_local_finish. ++A proper SWITCHDEV_FDB_ADD_TO_DEVICE notification is emitted for the ++addresses serviced by the bridge on 'foreign' interfaces. The software ++bridge also does the right thing on migration, by notifying that the old ++entry is deleted, so that does not need to be special-cased in DSA. When ++it is deleted, we just need to delete our static FDB entry towards the ++CPU too, and wait. ++ ++The problem is that DSA currently only cares about SWITCHDEV_FDB_ADD_TO_DEVICE ++events received on its own interfaces, such as static FDB entries. ++ ++Luckily we can change that, and DSA can listen to all switchdev FDB ++add/del events in the system and figure out if those events were emitted ++by a bridge that spans at least one of DSA's own ports. In case that is ++true, DSA will also offload that address towards its own CPU port, in ++the eventuality that there might be bridge clients attached to the DSA ++switch who want to talk to the station connected to the foreign ++interface. ++ ++In terms of implementation, we need to keep the fdb_info->added_by_user ++check for the case where the switchdev event was targeted directly at a ++DSA switch port. But we don't need to look at that flag for snooped ++events. So the check is currently too late, we need to move it earlier. ++This also simplifies the code a bit, since we avoid uselessly allocating ++and freeing switchdev_work. ++ ++We could probably do some improvements in the future. For example, ++multi-bridge support is rudimentary at the moment. If there are two ++bridges spanning a DSA switch's ports, and both of them need to service ++the same MAC address, then what will happen is that the migration of one ++of those stations will trigger the deletion of the FDB entry from the ++CPU port while it is still used by other bridge. That could be improved ++with reference counting but is left for another time. ++ ++This behavior needs to be enabled at driver level by setting ++ds->assisted_learning_on_cpu_port = true. This is because we don't want ++to inflict a potential performance penalty (accesses through ++MDIO/I2C/SPI are expensive) to hardware that really doesn't need it ++because address learning on the CPU port works there. ++ ++Reported-by: DENG Qingfang ++Signed-off-by: Vladimir Oltean ++Reviewed-by: Florian Fainelli ++Reviewed-by: Andrew Lunn ++Signed-off-by: Jakub Kicinski ++--- ++ include/net/dsa.h | 5 +++++ ++ net/dsa/slave.c | 66 +++++++++++++++++++++++++++++++++++++++++++++---------- ++ 2 files changed, 60 insertions(+), 11 deletions(-) ++ ++--- a/include/net/dsa.h +++++ b/include/net/dsa.h ++@@ -317,6 +317,11 @@ struct dsa_switch { ++ */ ++ bool untag_bridge_pvid; ++ +++ /* Let DSA manage the FDB entries towards the CPU, based on the +++ * software bridge database. +++ */ +++ bool assisted_learning_on_cpu_port; +++ ++ /* In case vlan_filtering_is_global is set, the VLAN awareness state ++ * should be retrieved from here and not from the per-port settings. ++ */ ++--- a/net/dsa/slave.c +++++ b/net/dsa/slave.c ++@@ -2112,6 +2112,28 @@ static void dsa_slave_switchdev_event_wo ++ dev_put(dp->slave); ++ } ++ +++static int dsa_lower_dev_walk(struct net_device *lower_dev, +++ struct netdev_nested_priv *priv) +++{ +++ if (dsa_slave_dev_check(lower_dev)) { +++ priv->data = (void *)netdev_priv(lower_dev); +++ return 1; +++ } +++ +++ return 0; +++} +++ +++static struct dsa_slave_priv *dsa_slave_dev_lower_find(struct net_device *dev) +++{ +++ struct netdev_nested_priv priv = { +++ .data = NULL, +++ }; +++ +++ netdev_walk_all_lower_dev_rcu(dev, dsa_lower_dev_walk, &priv); +++ +++ return (struct dsa_slave_priv *)priv.data; +++} +++ ++ /* Called under rcu_read_lock() */ ++ static int dsa_slave_switchdev_event(struct notifier_block *unused, ++ unsigned long event, void *ptr) ++@@ -2130,10 +2152,37 @@ static int dsa_slave_switchdev_event(str ++ return notifier_from_errno(err); ++ case SWITCHDEV_FDB_ADD_TO_DEVICE: ++ case SWITCHDEV_FDB_DEL_TO_DEVICE: ++- if (!dsa_slave_dev_check(dev)) ++- return NOTIFY_DONE; +++ fdb_info = ptr; +++ +++ if (dsa_slave_dev_check(dev)) { +++ if (!fdb_info->added_by_user) +++ return NOTIFY_OK; +++ +++ dp = dsa_slave_to_port(dev); +++ } else { +++ /* Snoop addresses learnt on foreign interfaces +++ * bridged with us, for switches that don't +++ * automatically learn SA from CPU-injected traffic +++ */ +++ struct net_device *br_dev; +++ struct dsa_slave_priv *p; +++ +++ br_dev = netdev_master_upper_dev_get_rcu(dev); +++ if (!br_dev) +++ return NOTIFY_DONE; +++ +++ if (!netif_is_bridge_master(br_dev)) +++ return NOTIFY_DONE; +++ +++ p = dsa_slave_dev_lower_find(br_dev); +++ if (!p) +++ return NOTIFY_DONE; ++ ++- dp = dsa_slave_to_port(dev); +++ dp = p->dp->cpu_dp; +++ +++ if (!dp->ds->assisted_learning_on_cpu_port) +++ return NOTIFY_DONE; +++ } ++ ++ if (!dp->ds->ops->port_fdb_add || !dp->ds->ops->port_fdb_del) ++ return NOTIFY_DONE; ++@@ -2148,18 +2197,13 @@ static int dsa_slave_switchdev_event(str ++ switchdev_work->port = dp->index; ++ switchdev_work->event = event; ++ ++- fdb_info = ptr; ++- ++- if (!fdb_info->added_by_user) { ++- kfree(switchdev_work); ++- return NOTIFY_OK; ++- } ++- ++ ether_addr_copy(switchdev_work->addr, ++ fdb_info->addr); ++ switchdev_work->vid = fdb_info->vid; ++ ++- dev_hold(dev); +++ /* Hold a reference on the slave for dsa_fdb_offload_notify */ +++ if (dsa_is_user_port(dp->ds, dp->index)) +++ dev_hold(dev); ++ dsa_schedule_work(&switchdev_work->work); ++ break; ++ default: +diff --git a/target/linux/generic/backport-5.10/780-net-dsa-mt7530-setup-core-clock-even-in-TRGMII-mode.patch b/target/linux/generic/backport-5.10/780-net-dsa-mt7530-setup-core-clock-even-in-TRGMII-mode.patch +new file mode 100644 +index 0000000000..951ae9c664 +--- /dev/null ++++ b/target/linux/generic/backport-5.10/780-net-dsa-mt7530-setup-core-clock-even-in-TRGMII-mode.patch +@@ -0,0 +1,84 @@ ++From c3b8e07909dbe67b0d580416c1a5257643a73be7 Mon Sep 17 00:00:00 2001 ++From: Ilya Lipnitskiy ++Date: Fri, 12 Mar 2021 00:07:03 -0800 ++Subject: [PATCH] net: dsa: mt7530: setup core clock even in TRGMII mode ++ ++A recent change to MIPS ralink reset logic made it so mt7530 actually ++resets the switch on platforms such as mt7621 (where bit 2 is the reset ++line for the switch). That exposed an issue where the switch would not ++function properly in TRGMII mode after a reset. ++ ++Reconfigure core clock in TRGMII mode to fix the issue. ++ ++Tested on Ubiquiti ER-X (MT7621) with TRGMII mode enabled. ++ ++Fixes: 3f9ef7785a9c ("MIPS: ralink: manage low reset lines") ++Signed-off-by: Ilya Lipnitskiy ++Signed-off-by: David S. Miller ++--- ++ drivers/net/dsa/mt7530.c | 52 +++++++++++++++++++--------------------- ++ 1 file changed, 25 insertions(+), 27 deletions(-) ++ ++--- a/drivers/net/dsa/mt7530.c +++++ b/drivers/net/dsa/mt7530.c ++@@ -435,34 +435,32 @@ mt7530_pad_clk_setup(struct dsa_switch * ++ TD_DM_DRVP(8) | TD_DM_DRVN(8)); ++ ++ /* Setup core clock for MT7530 */ ++- if (!trgint) { ++- /* Disable MT7530 core clock */ ++- core_clear(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN); ++- ++- /* Disable PLL, since phy_device has not yet been created ++- * provided for phy_[read,write]_mmd_indirect is called, we ++- * provide our own core_write_mmd_indirect to complete this ++- * function. ++- */ ++- core_write_mmd_indirect(priv, ++- CORE_GSWPLL_GRP1, ++- MDIO_MMD_VEND2, ++- 0); ++- ++- /* Set core clock into 500Mhz */ ++- core_write(priv, CORE_GSWPLL_GRP2, ++- RG_GSWPLL_POSDIV_500M(1) | ++- RG_GSWPLL_FBKDIV_500M(25)); ++- ++- /* Enable PLL */ ++- core_write(priv, CORE_GSWPLL_GRP1, ++- RG_GSWPLL_EN_PRE | ++- RG_GSWPLL_POSDIV_200M(2) | ++- RG_GSWPLL_FBKDIV_200M(32)); ++- ++- /* Enable MT7530 core clock */ ++- core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN); ++- } +++ /* Disable MT7530 core clock */ +++ core_clear(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN); +++ +++ /* Disable PLL, since phy_device has not yet been created +++ * provided for phy_[read,write]_mmd_indirect is called, we +++ * provide our own core_write_mmd_indirect to complete this +++ * function. +++ */ +++ core_write_mmd_indirect(priv, +++ CORE_GSWPLL_GRP1, +++ MDIO_MMD_VEND2, +++ 0); +++ +++ /* Set core clock into 500Mhz */ +++ core_write(priv, CORE_GSWPLL_GRP2, +++ RG_GSWPLL_POSDIV_500M(1) | +++ RG_GSWPLL_FBKDIV_500M(25)); +++ +++ /* Enable PLL */ +++ core_write(priv, CORE_GSWPLL_GRP1, +++ RG_GSWPLL_EN_PRE | +++ RG_GSWPLL_POSDIV_200M(2) | +++ RG_GSWPLL_FBKDIV_200M(32)); +++ +++ /* Enable MT7530 core clock */ +++ core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN); ++ ++ /* Setup the MT7530 TRGMII Tx Clock */ ++ core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN); +diff --git a/target/linux/generic/backport-5.10/800-v5.13-0001-firmware-bcm47xx_nvram-rename-finding-function-and-i.patch b/target/linux/generic/backport-5.10/800-v5.13-0001-firmware-bcm47xx_nvram-rename-finding-function-and-i.patch +new file mode 100644 +index 0000000000..19938704b7 +--- /dev/null ++++ b/target/linux/generic/backport-5.10/800-v5.13-0001-firmware-bcm47xx_nvram-rename-finding-function-and-i.patch +@@ -0,0 +1,80 @@ ++From fb009cbdd0693bd633f11e99526617b3d392cfad Mon Sep 17 00:00:00 2001 ++From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= ++Date: Mon, 8 Mar 2021 10:03:16 +0100 ++Subject: [PATCH] firmware: bcm47xx_nvram: rename finding function and its ++ variables ++MIME-Version: 1.0 ++Content-Type: text/plain; charset=UTF-8 ++Content-Transfer-Encoding: 8bit ++ ++1. Use "bcm47xx_" function name prefix for consistency ++2. It takes flash start as argument so s/iobase/flash_start/ ++3. "off" was used for finding flash end so just call it "flash_size" ++ ++Signed-off-by: Rafał Miłecki ++Signed-off-by: Thomas Bogendoerfer ++--- ++ drivers/firmware/broadcom/bcm47xx_nvram.c | 24 ++++++++++++----------- ++ 1 file changed, 13 insertions(+), 11 deletions(-) ++ ++--- a/drivers/firmware/broadcom/bcm47xx_nvram.c +++++ b/drivers/firmware/broadcom/bcm47xx_nvram.c ++@@ -48,11 +48,13 @@ static u32 find_nvram_size(void __iomem ++ return 0; ++ } ++ ++-/* Probe for NVRAM header */ ++-static int nvram_find_and_copy(void __iomem *iobase, u32 lim) +++/** +++ * bcm47xx_nvram_find_and_copy - find NVRAM on flash mapping & copy it +++ */ +++static int bcm47xx_nvram_find_and_copy(void __iomem *flash_start, size_t res_size) ++ { ++ struct nvram_header __iomem *header; ++- u32 off; +++ size_t flash_size; ++ u32 size; ++ ++ if (nvram_len) { ++@@ -61,25 +63,25 @@ static int nvram_find_and_copy(void __io ++ } ++ ++ /* TODO: when nvram is on nand flash check for bad blocks first. */ ++- off = FLASH_MIN; ++- while (off <= lim) { +++ flash_size = FLASH_MIN; +++ while (flash_size <= res_size) { ++ /* Windowed flash access */ ++- size = find_nvram_size(iobase + off); +++ size = find_nvram_size(flash_start + flash_size); ++ if (size) { ++- header = (struct nvram_header *)(iobase + off - size); +++ header = (struct nvram_header *)(flash_start + flash_size - size); ++ goto found; ++ } ++- off <<= 1; +++ flash_size <<= 1; ++ } ++ ++ /* Try embedded NVRAM at 4 KB and 1 KB as last resorts */ ++- header = (struct nvram_header *)(iobase + 4096); +++ header = (struct nvram_header *)(flash_start + 4096); ++ if (header->magic == NVRAM_MAGIC) { ++ size = NVRAM_SPACE; ++ goto found; ++ } ++ ++- header = (struct nvram_header *)(iobase + 1024); +++ header = (struct nvram_header *)(flash_start + 1024); ++ if (header->magic == NVRAM_MAGIC) { ++ size = NVRAM_SPACE; ++ goto found; ++@@ -124,7 +126,7 @@ int bcm47xx_nvram_init_from_mem(u32 base ++ if (!iobase) ++ return -ENOMEM; ++ ++- err = nvram_find_and_copy(iobase, lim); +++ err = bcm47xx_nvram_find_and_copy(iobase, lim); ++ ++ iounmap(iobase); ++ +diff --git a/target/linux/generic/backport-5.10/800-v5.13-0002-firmware-bcm47xx_nvram-add-helper-checking-for-NVRAM.patch b/target/linux/generic/backport-5.10/800-v5.13-0002-firmware-bcm47xx_nvram-add-helper-checking-for-NVRAM.patch +new file mode 100644 +index 0000000000..6ab072883d +--- /dev/null ++++ b/target/linux/generic/backport-5.10/800-v5.13-0002-firmware-bcm47xx_nvram-add-helper-checking-for-NVRAM.patch +@@ -0,0 +1,90 @@ ++From 0a24b51a3264a3f942a75025ea5ff6133c8989b0 Mon Sep 17 00:00:00 2001 ++From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= ++Date: Mon, 8 Mar 2021 10:03:17 +0100 ++Subject: [PATCH] firmware: bcm47xx_nvram: add helper checking for NVRAM ++MIME-Version: 1.0 ++Content-Type: text/plain; charset=UTF-8 ++Content-Transfer-Encoding: 8bit ++ ++This avoids duplicating code doing casting and checking for NVRAM magic. ++ ++Signed-off-by: Rafał Miłecki ++Signed-off-by: Thomas Bogendoerfer ++--- ++ drivers/firmware/broadcom/bcm47xx_nvram.c | 30 ++++++++++++++--------- ++ 1 file changed, 18 insertions(+), 12 deletions(-) ++ ++--- a/drivers/firmware/broadcom/bcm47xx_nvram.c +++++ b/drivers/firmware/broadcom/bcm47xx_nvram.c ++@@ -34,14 +34,20 @@ static char nvram_buf[NVRAM_SPACE]; ++ static size_t nvram_len; ++ static const u32 nvram_sizes[] = {0x6000, 0x8000, 0xF000, 0x10000}; ++ +++/** +++ * bcm47xx_nvram_is_valid - check for a valid NVRAM at specified memory +++ */ +++static bool bcm47xx_nvram_is_valid(void __iomem *nvram) +++{ +++ return ((struct nvram_header *)nvram)->magic == NVRAM_MAGIC; +++} +++ ++ static u32 find_nvram_size(void __iomem *end) ++ { ++- struct nvram_header __iomem *header; ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(nvram_sizes); i++) { ++- header = (struct nvram_header *)(end - nvram_sizes[i]); ++- if (header->magic == NVRAM_MAGIC) +++ if (bcm47xx_nvram_is_valid(end - nvram_sizes[i])) ++ return nvram_sizes[i]; ++ } ++ ++@@ -55,6 +61,7 @@ static int bcm47xx_nvram_find_and_copy(v ++ { ++ struct nvram_header __iomem *header; ++ size_t flash_size; +++ size_t offset; ++ u32 size; ++ ++ if (nvram_len) { ++@@ -68,31 +75,30 @@ static int bcm47xx_nvram_find_and_copy(v ++ /* Windowed flash access */ ++ size = find_nvram_size(flash_start + flash_size); ++ if (size) { ++- header = (struct nvram_header *)(flash_start + flash_size - size); +++ offset = flash_size - size; ++ goto found; ++ } ++ flash_size <<= 1; ++ } ++ ++ /* Try embedded NVRAM at 4 KB and 1 KB as last resorts */ ++- header = (struct nvram_header *)(flash_start + 4096); ++- if (header->magic == NVRAM_MAGIC) { ++- size = NVRAM_SPACE; +++ +++ offset = 4096; +++ if (bcm47xx_nvram_is_valid(flash_start + offset)) ++ goto found; ++- } ++ ++- header = (struct nvram_header *)(flash_start + 1024); ++- if (header->magic == NVRAM_MAGIC) { ++- size = NVRAM_SPACE; +++ offset = 1024; +++ if (bcm47xx_nvram_is_valid(flash_start + offset)) ++ goto found; ++- } ++ ++ pr_err("no nvram found\n"); ++ return -ENXIO; ++ ++ found: +++ header = (struct nvram_header *)(flash_start + offset); ++ __ioread32_copy(nvram_buf, header, sizeof(*header) / 4); ++ nvram_len = ((struct nvram_header *)(nvram_buf))->len; +++ size = res_size - offset; ++ if (nvram_len > size) { ++ pr_err("The nvram size according to the header seems to be bigger than the partition on flash\n"); ++ nvram_len = size; +diff --git a/target/linux/generic/backport-5.10/800-v5.13-0003-firmware-bcm47xx_nvram-extract-code-copying-NVRAM.patch b/target/linux/generic/backport-5.10/800-v5.13-0003-firmware-bcm47xx_nvram-extract-code-copying-NVRAM.patch +new file mode 100644 +index 0000000000..a1351f1197 +--- /dev/null ++++ b/target/linux/generic/backport-5.10/800-v5.13-0003-firmware-bcm47xx_nvram-extract-code-copying-NVRAM.patch +@@ -0,0 +1,80 @@ ++From 298923cf999cecd2ef06df126f85a3d68da8c4d8 Mon Sep 17 00:00:00 2001 ++From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= ++Date: Mon, 8 Mar 2021 10:03:18 +0100 ++Subject: [PATCH] firmware: bcm47xx_nvram: extract code copying NVRAM ++MIME-Version: 1.0 ++Content-Type: text/plain; charset=UTF-8 ++Content-Transfer-Encoding: 8bit ++ ++This simplifies function finding NVRAM. It doesn't directly deal with ++NVRAM structure anymore and is a bit smaller. ++ ++Signed-off-by: Rafał Miłecki ++Signed-off-by: Thomas Bogendoerfer ++--- ++ drivers/firmware/broadcom/bcm47xx_nvram.c | 43 +++++++++++++---------- ++ 1 file changed, 25 insertions(+), 18 deletions(-) ++ ++--- a/drivers/firmware/broadcom/bcm47xx_nvram.c +++++ b/drivers/firmware/broadcom/bcm47xx_nvram.c ++@@ -55,11 +55,34 @@ static u32 find_nvram_size(void __iomem ++ } ++ ++ /** +++ * bcm47xx_nvram_copy - copy NVRAM to internal buffer +++ */ +++static void bcm47xx_nvram_copy(void __iomem *nvram_start, size_t res_size) +++{ +++ struct nvram_header __iomem *header = nvram_start; +++ size_t copy_size; +++ +++ copy_size = header->len; +++ if (copy_size > res_size) { +++ pr_err("The nvram size according to the header seems to be bigger than the partition on flash\n"); +++ copy_size = res_size; +++ } +++ if (copy_size >= NVRAM_SPACE) { +++ pr_err("nvram on flash (%zu bytes) is bigger than the reserved space in memory, will just copy the first %i bytes\n", +++ copy_size, NVRAM_SPACE - 1); +++ copy_size = NVRAM_SPACE - 1; +++ } +++ +++ __ioread32_copy(nvram_buf, nvram_start, DIV_ROUND_UP(copy_size, 4)); +++ nvram_buf[NVRAM_SPACE - 1] = '\0'; +++ nvram_len = copy_size; +++} +++ +++/** ++ * bcm47xx_nvram_find_and_copy - find NVRAM on flash mapping & copy it ++ */ ++ static int bcm47xx_nvram_find_and_copy(void __iomem *flash_start, size_t res_size) ++ { ++- struct nvram_header __iomem *header; ++ size_t flash_size; ++ size_t offset; ++ u32 size; ++@@ -95,23 +118,7 @@ static int bcm47xx_nvram_find_and_copy(v ++ return -ENXIO; ++ ++ found: ++- header = (struct nvram_header *)(flash_start + offset); ++- __ioread32_copy(nvram_buf, header, sizeof(*header) / 4); ++- nvram_len = ((struct nvram_header *)(nvram_buf))->len; ++- size = res_size - offset; ++- if (nvram_len > size) { ++- pr_err("The nvram size according to the header seems to be bigger than the partition on flash\n"); ++- nvram_len = size; ++- } ++- if (nvram_len >= NVRAM_SPACE) { ++- pr_err("nvram on flash (%zu bytes) is bigger than the reserved space in memory, will just copy the first %i bytes\n", ++- nvram_len, NVRAM_SPACE - 1); ++- nvram_len = NVRAM_SPACE - 1; ++- } ++- /* proceed reading data after header */ ++- __ioread32_copy(nvram_buf + sizeof(*header), header + 1, ++- DIV_ROUND_UP(nvram_len, 4)); ++- nvram_buf[NVRAM_SPACE - 1] = '\0'; +++ bcm47xx_nvram_copy(flash_start + offset, res_size - offset); ++ ++ return 0; ++ } +diff --git a/target/linux/generic/backport-5.10/800-v5.13-0004-firmware-bcm47xx_nvram-look-for-NVRAM-with-for-inste.patch b/target/linux/generic/backport-5.10/800-v5.13-0004-firmware-bcm47xx_nvram-look-for-NVRAM-with-for-inste.patch +new file mode 100644 +index 0000000000..059a13220b +--- /dev/null ++++ b/target/linux/generic/backport-5.10/800-v5.13-0004-firmware-bcm47xx_nvram-look-for-NVRAM-with-for-inste.patch +@@ -0,0 +1,37 @@ ++From 98b68324f67236e8c9152976535dc1f27fb67ba8 Mon Sep 17 00:00:00 2001 ++From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= ++Date: Mon, 8 Mar 2021 10:03:19 +0100 ++Subject: [PATCH] firmware: bcm47xx_nvram: look for NVRAM with for instead of ++ while ++MIME-Version: 1.0 ++Content-Type: text/plain; charset=UTF-8 ++Content-Transfer-Encoding: 8bit ++ ++This loop requires variable initialization, stop condition and post ++iteration increment. It's pretty much a for loop definition. ++ ++Signed-off-by: Rafał Miłecki ++Signed-off-by: Thomas Bogendoerfer ++--- ++ drivers/firmware/broadcom/bcm47xx_nvram.c | 4 +--- ++ 1 file changed, 1 insertion(+), 3 deletions(-) ++ ++--- a/drivers/firmware/broadcom/bcm47xx_nvram.c +++++ b/drivers/firmware/broadcom/bcm47xx_nvram.c ++@@ -93,15 +93,13 @@ static int bcm47xx_nvram_find_and_copy(v ++ } ++ ++ /* TODO: when nvram is on nand flash check for bad blocks first. */ ++- flash_size = FLASH_MIN; ++- while (flash_size <= res_size) { +++ for (flash_size = FLASH_MIN; flash_size <= res_size; flash_size <<= 1) { ++ /* Windowed flash access */ ++ size = find_nvram_size(flash_start + flash_size); ++ if (size) { ++ offset = flash_size - size; ++ goto found; ++ } ++- flash_size <<= 1; ++ } ++ ++ /* Try embedded NVRAM at 4 KB and 1 KB as last resorts */ +diff --git a/target/linux/generic/backport-5.10/800-v5.13-0005-firmware-bcm47xx_nvram-inline-code-checking-NVRAM-si.patch b/target/linux/generic/backport-5.10/800-v5.13-0005-firmware-bcm47xx_nvram-inline-code-checking-NVRAM-si.patch +new file mode 100644 +index 0000000000..21d250049e +--- /dev/null ++++ b/target/linux/generic/backport-5.10/800-v5.13-0005-firmware-bcm47xx_nvram-inline-code-checking-NVRAM-si.patch +@@ -0,0 +1,70 @@ ++From f52da4ccfec9192e17f5c16260dfdd6d3ea76f65 Mon Sep 17 00:00:00 2001 ++From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= ++Date: Mon, 8 Mar 2021 10:03:20 +0100 ++Subject: [PATCH] firmware: bcm47xx_nvram: inline code checking NVRAM size ++MIME-Version: 1.0 ++Content-Type: text/plain; charset=UTF-8 ++Content-Transfer-Encoding: 8bit ++ ++Separated function was not improving code quality much (or at all). ++Moreover it expected possible flash end address as argument and it was ++returning NVRAM size. ++ ++The new code always operates on offsets which means less logic and less ++calculations. ++ ++Signed-off-by: Rafał Miłecki ++Signed-off-by: Thomas Bogendoerfer ++--- ++ drivers/firmware/broadcom/bcm47xx_nvram.c | 25 +++++++---------------- ++ 1 file changed, 7 insertions(+), 18 deletions(-) ++ ++--- a/drivers/firmware/broadcom/bcm47xx_nvram.c +++++ b/drivers/firmware/broadcom/bcm47xx_nvram.c ++@@ -42,18 +42,6 @@ static bool bcm47xx_nvram_is_valid(void ++ return ((struct nvram_header *)nvram)->magic == NVRAM_MAGIC; ++ } ++ ++-static u32 find_nvram_size(void __iomem *end) ++-{ ++- int i; ++- ++- for (i = 0; i < ARRAY_SIZE(nvram_sizes); i++) { ++- if (bcm47xx_nvram_is_valid(end - nvram_sizes[i])) ++- return nvram_sizes[i]; ++- } ++- ++- return 0; ++-} ++- ++ /** ++ * bcm47xx_nvram_copy - copy NVRAM to internal buffer ++ */ ++@@ -85,7 +73,7 @@ static int bcm47xx_nvram_find_and_copy(v ++ { ++ size_t flash_size; ++ size_t offset; ++- u32 size; +++ int i; ++ ++ if (nvram_len) { ++ pr_warn("nvram already initialized\n"); ++@@ -93,12 +81,13 @@ static int bcm47xx_nvram_find_and_copy(v ++ } ++ ++ /* TODO: when nvram is on nand flash check for bad blocks first. */ +++ +++ /* Try every possible flash size and check for NVRAM at its end */ ++ for (flash_size = FLASH_MIN; flash_size <= res_size; flash_size <<= 1) { ++- /* Windowed flash access */ ++- size = find_nvram_size(flash_start + flash_size); ++- if (size) { ++- offset = flash_size - size; ++- goto found; +++ for (i = 0; i < ARRAY_SIZE(nvram_sizes); i++) { +++ offset = flash_size - nvram_sizes[i]; +++ if (bcm47xx_nvram_is_valid(flash_start + offset)) +++ goto found; ++ } ++ } ++ +diff --git a/target/linux/generic/backport-5.10/810-v5.13-usb-ehci-add-spurious-flag-to-disable-overcurrent-ch.patch b/target/linux/generic/backport-5.10/810-v5.13-usb-ehci-add-spurious-flag-to-disable-overcurrent-ch.patch +new file mode 100644 +index 0000000000..8f2021a0fc +--- /dev/null ++++ b/target/linux/generic/backport-5.10/810-v5.13-usb-ehci-add-spurious-flag-to-disable-overcurrent-ch.patch +@@ -0,0 +1,88 @@ ++From 2d5ba37461013253d2ff0a3641b727fd32ea97a9 Mon Sep 17 00:00:00 2001 ++From: Florian Fainelli ++Date: Tue, 23 Feb 2021 18:44:53 +0100 ++Subject: [PATCH 1/3] usb: ehci: add spurious flag to disable overcurrent ++ checking ++MIME-Version: 1.0 ++Content-Type: text/plain; charset=UTF-8 ++Content-Transfer-Encoding: 8bit ++ ++This patch adds an ignore_oc flag which can be set by EHCI controller ++not supporting or wanting to disable overcurrent checking. The EHCI ++platform data in include/linux/usb/ehci_pdriver.h is also augmented to ++take advantage of this new flag. ++ ++Signed-off-by: Florian Fainelli ++Signed-off-by: Álvaro Fernández Rojas ++Link: https://lore.kernel.org/r/20210223174455.1378-2-noltari@gmail.com ++Signed-off-by: Greg Kroah-Hartman ++--- ++ drivers/usb/host/ehci-hcd.c | 2 +- ++ drivers/usb/host/ehci-hub.c | 4 ++-- ++ drivers/usb/host/ehci-platform.c | 2 ++ ++ drivers/usb/host/ehci.h | 1 + ++ include/linux/usb/ehci_pdriver.h | 1 + ++ 5 files changed, 7 insertions(+), 3 deletions(-) ++ ++--- a/drivers/usb/host/ehci-hcd.c +++++ b/drivers/usb/host/ehci-hcd.c ++@@ -651,7 +651,7 @@ static int ehci_run (struct usb_hcd *hcd ++ "USB %x.%x started, EHCI %x.%02x%s\n", ++ ((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f), ++ temp >> 8, temp & 0xff, ++- ignore_oc ? ", overcurrent ignored" : ""); +++ (ignore_oc || ehci->spurious_oc) ? ", overcurrent ignored" : ""); ++ ++ ehci_writel(ehci, INTR_MASK, ++ &ehci->regs->intr_enable); /* Turn On Interrupts */ ++--- a/drivers/usb/host/ehci-hub.c +++++ b/drivers/usb/host/ehci-hub.c ++@@ -643,7 +643,7 @@ ehci_hub_status_data (struct usb_hcd *hc ++ * always set, seem to clear PORT_OCC and PORT_CSC when writing to ++ * PORT_POWER; that's surprising, but maybe within-spec. ++ */ ++- if (!ignore_oc) +++ if (!ignore_oc && !ehci->spurious_oc) ++ mask = PORT_CSC | PORT_PEC | PORT_OCC; ++ else ++ mask = PORT_CSC | PORT_PEC; ++@@ -1013,7 +1013,7 @@ int ehci_hub_control( ++ if (temp & PORT_PEC) ++ status |= USB_PORT_STAT_C_ENABLE << 16; ++ ++- if ((temp & PORT_OCC) && !ignore_oc){ +++ if ((temp & PORT_OCC) && (!ignore_oc && !ehci->spurious_oc)){ ++ status |= USB_PORT_STAT_C_OVERCURRENT << 16; ++ ++ /* ++--- a/drivers/usb/host/ehci-platform.c +++++ b/drivers/usb/host/ehci-platform.c ++@@ -327,6 +327,8 @@ static int ehci_platform_probe(struct pl ++ hcd->has_tt = 1; ++ if (pdata->reset_on_resume) ++ priv->reset_on_resume = true; +++ if (pdata->spurious_oc) +++ ehci->spurious_oc = 1; ++ ++ #ifndef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO ++ if (ehci->big_endian_mmio) { ++--- a/drivers/usb/host/ehci.h +++++ b/drivers/usb/host/ehci.h ++@@ -218,6 +218,7 @@ struct ehci_hcd { /* one per controlle ++ unsigned frame_index_bug:1; /* MosChip (AKA NetMos) */ ++ unsigned need_oc_pp_cycle:1; /* MPC834X port power */ ++ unsigned imx28_write_fix:1; /* For Freescale i.MX28 */ +++ unsigned spurious_oc:1; ++ ++ /* required for usb32 quirk */ ++ #define OHCI_CTRL_HCFS (3 << 6) ++--- a/include/linux/usb/ehci_pdriver.h +++++ b/include/linux/usb/ehci_pdriver.h ++@@ -50,6 +50,7 @@ struct usb_ehci_pdata { ++ unsigned no_io_watchdog:1; ++ unsigned reset_on_resume:1; ++ unsigned dma_mask_64:1; +++ unsigned spurious_oc:1; ++ ++ /* Turn on all power and clocks */ ++ int (*power_on)(struct platform_device *pdev); +diff --git a/target/linux/generic/backport-5.10/811-v5.13-usb-host-ehci-platform-add-spurious_oc-DT-support.patch b/target/linux/generic/backport-5.10/811-v5.13-usb-host-ehci-platform-add-spurious_oc-DT-support.patch +new file mode 100644 +index 0000000000..0094d47718 +--- /dev/null ++++ b/target/linux/generic/backport-5.10/811-v5.13-usb-host-ehci-platform-add-spurious_oc-DT-support.patch +@@ -0,0 +1,31 @@ ++From 4da57dbbffdfa7fe4e2b70b047fc5ff95ff25a3d Mon Sep 17 00:00:00 2001 ++From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= ++Date: Tue, 23 Feb 2021 18:44:55 +0100 ++Subject: [PATCH 3/3] usb: host: ehci-platform: add spurious_oc DT support ++MIME-Version: 1.0 ++Content-Type: text/plain; charset=UTF-8 ++Content-Transfer-Encoding: 8bit ++ ++Over-current reporting isn't supported on some platforms such as bcm63xx. ++These devices will incorrectly report over-current if this flag isn't properly ++activated. ++ ++Signed-off-by: Álvaro Fernández Rojas ++Link: https://lore.kernel.org/r/20210223174455.1378-4-noltari@gmail.com ++Signed-off-by: Greg Kroah-Hartman ++--- ++ drivers/usb/host/ehci-platform.c | 3 +++ ++ 1 file changed, 3 insertions(+) ++ ++--- a/drivers/usb/host/ehci-platform.c +++++ b/drivers/usb/host/ehci-platform.c ++@@ -286,6 +286,9 @@ static int ehci_platform_probe(struct pl ++ if (of_property_read_bool(dev->dev.of_node, "big-endian")) ++ ehci->big_endian_mmio = ehci->big_endian_desc = 1; ++ +++ if (of_property_read_bool(dev->dev.of_node, "spurious-oc")) +++ ehci->spurious_oc = 1; +++ ++ if (of_property_read_bool(dev->dev.of_node, ++ "needs-reset-on-resume")) ++ priv->reset_on_resume = true; diff --git a/target/linux/generic/config-5.10 b/target/linux/generic/config-5.10 new file mode 100644 -index 0000000000..f7cc6c8561 +index 0000000000..4eb5607f17 --- /dev/null +++ b/target/linux/generic/config-5.10 -@@ -0,0 +1,6941 @@ +@@ -0,0 +1,7062 @@ +# CONFIG_104_QUAD_8 is not set +CONFIG_32BIT=y +CONFIG_64BIT_TIME=y @@ -866,6 +5528,7 @@ index 0000000000..f7cc6c8561 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8 +# CONFIG_ARCH_MMP is not set ++# CONFIG_ARCH_MSTARV7 is not set +# CONFIG_ARCH_MULTIPLATFORM is not set +# CONFIG_ARCH_MULTI_V6 is not set +# CONFIG_ARCH_MULTI_V7 is not set @@ -1026,6 +5689,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_ARM_PATCH_PHYS_VIRT is not set +# CONFIG_ARM_PSCI is not set +# CONFIG_ARM_PSCI_CHECKER is not set ++# CONFIG_ARM_PSCI_CPUIDLE is not set +# CONFIG_ARM_PTDUMP_DEBUGFS is not set +# CONFIG_ARM_SBSA_WATCHDOG is not set +# CONFIG_ARM_SCPI_PROTOCOL is not set @@ -1039,6 +5703,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_ARM_UNWIND is not set +# CONFIG_ARM_VIRT_EXT is not set +# CONFIG_AS3935 is not set ++# CONFIG_AS73211 is not set +# CONFIG_ASM9260_TIMER is not set +# CONFIG_ASUS_LAPTOP is not set +# CONFIG_ASUS_WIRELESS is not set @@ -1132,7 +5797,9 @@ index 0000000000..f7cc6c8561 +# CONFIG_BACKLIGHT_CLASS_DEVICE is not set +# CONFIG_BACKLIGHT_GENERIC is not set +# CONFIG_BACKLIGHT_GPIO is not set ++# CONFIG_BACKLIGHT_KTD253 is not set +# CONFIG_BACKLIGHT_LCD_SUPPORT is not set ++# CONFIG_BACKLIGHT_LED is not set +# CONFIG_BACKLIGHT_LM3630A is not set +# CONFIG_BACKLIGHT_LM3639 is not set +# CONFIG_BACKLIGHT_LP855X is not set @@ -1140,6 +5807,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_BACKLIGHT_PANDORA is not set +# CONFIG_BACKLIGHT_PM8941_WLED is not set +# CONFIG_BACKLIGHT_PWM is not set ++# CONFIG_BACKLIGHT_QCOM_WLED is not set +# CONFIG_BACKLIGHT_RPI is not set +# CONFIG_BACKLIGHT_SAHARA is not set +# CONFIG_BACKTRACE_SELF_TEST is not set @@ -1307,6 +5975,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_BONDING is not set +# CONFIG_BOOKE_WDT is not set +CONFIG_BOOKE_WDT_DEFAULT_TIMEOUT=3 ++# CONFIG_BOOTTIME_TRACING is not set +# CONFIG_BOOT_CONFIG is not set +# CONFIG_BOOT_PRINTK_DELAY is not set +CONFIG_BOOT_RAW=y @@ -1421,9 +6090,11 @@ index 0000000000..f7cc6c8561 +# CONFIG_CAN_GW is not set +# CONFIG_CAN_HI311X is not set +# CONFIG_CAN_IFI_CANFD is not set ++# CONFIG_CAN_ISOTP is not set +# CONFIG_CAN_J1939 is not set +# CONFIG_CAN_KVASER_PCIEFD is not set +# CONFIG_CAN_MCBA_USB is not set ++# CONFIG_CAN_MCP251XFD is not set +# CONFIG_CAN_M_CAN is not set +# CONFIG_CAN_PEAK_PCIEFD is not set +# CONFIG_CAN_RAW is not set @@ -1470,6 +6141,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_CHARGER_BQ24735 is not set +# CONFIG_CHARGER_BQ2515X is not set +# CONFIG_CHARGER_BQ25890 is not set ++# CONFIG_CHARGER_BQ25980 is not set +# CONFIG_CHARGER_DETECTOR_MAX14656 is not set +# CONFIG_CHARGER_GPIO is not set +# CONFIG_CHARGER_ISP1704 is not set @@ -1558,7 +6230,6 @@ index 0000000000..f7cc6c8561 +# CONFIG_COMMON_CLK_SI544 is not set +# CONFIG_COMMON_CLK_SI570 is not set +# CONFIG_COMMON_CLK_VC5 is not set -+# CONFIG_COMMON_CLK_VERSATILE is not set +# CONFIG_COMMON_CLK_XGENE is not set +# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set +CONFIG_COMPACTION=y @@ -1567,7 +6238,6 @@ index 0000000000..f7cc6c8561 +# CONFIG_COMPAT_BRK is not set +# CONFIG_COMPILE_TEST is not set +# CONFIG_CONFIGFS_FS is not set -+# CONFIG_CONFIG_KVM_AMD_SEV is not set +# CONFIG_CONNECTOR is not set +CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7 +CONFIG_CONSOLE_LOGLEVEL_QUIET=4 @@ -1597,6 +6267,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_CPU_ICACHE_DISABLE is not set +# CONFIG_CPU_ICACHE_MISMATCH_WORKAROUND is not set +# CONFIG_CPU_IDLE is not set ++# CONFIG_CPU_IDLE_GOV_LADDER is not set +# CONFIG_CPU_IDLE_GOV_MENU is not set +# CONFIG_CPU_IDLE_GOV_TEO is not set +# CONFIG_CPU_IDLE_MULTIPLE_DRIVERS is not set @@ -1607,7 +6278,6 @@ index 0000000000..f7cc6c8561 +# CONFIG_CRAMFS is not set +CONFIG_CRAMFS_BLOCKDEV=y +# CONFIG_CRAMFS_MTD is not set -+CONFIG_CRASHLOG=y +# CONFIG_CRASH_DUMP is not set +# CONFIG_CRC16 is not set +CONFIG_CRC32=y @@ -1650,6 +6320,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_CRYPTO_AUTHENC is not set +# CONFIG_CRYPTO_BLAKE2B is not set +# CONFIG_CRYPTO_BLAKE2S is not set ++# CONFIG_CRYPTO_BLAKE2S_X86 is not set +# CONFIG_CRYPTO_BLOWFISH is not set +# CONFIG_CRYPTO_CAMELLIA is not set +# CONFIG_CRYPTO_CAST5 is not set @@ -1660,6 +6331,8 @@ index 0000000000..f7cc6c8561 +# CONFIG_CRYPTO_CHACHA20 is not set +# CONFIG_CRYPTO_CHACHA20POLY1305 is not set +# CONFIG_CRYPTO_CHACHA20_NEON is not set ++# CONFIG_CRYPTO_CHACHA20_X86_64 is not set ++# CONFIG_CRYPTO_CHACHA_MIPS is not set +# CONFIG_CRYPTO_CMAC is not set +# CONFIG_CRYPTO_CRC32 is not set +# CONFIG_CRYPTO_CRC32C is not set @@ -1670,6 +6343,8 @@ index 0000000000..f7cc6c8561 +# CONFIG_CRYPTO_CTR is not set +# CONFIG_CRYPTO_CTS is not set +# CONFIG_CRYPTO_CURVE25519 is not set ++# CONFIG_CRYPTO_CURVE25519_NEON is not set ++# CONFIG_CRYPTO_CURVE25519_X86 is not set +# CONFIG_CRYPTO_DEFLATE is not set +# CONFIG_CRYPTO_DES is not set +# CONFIG_CRYPTO_DEV_AMLOGIC_GXL is not set @@ -1761,6 +6436,10 @@ index 0000000000..f7cc6c8561 +# CONFIG_CRYPTO_PCOMP2 is not set +CONFIG_CRYPTO_PCRYPT=y +# CONFIG_CRYPTO_POLY1305 is not set ++# CONFIG_CRYPTO_POLY1305_ARM is not set ++# CONFIG_CRYPTO_POLY1305_MIPS is not set ++# CONFIG_CRYPTO_POLY1305_NEON is not set ++# CONFIG_CRYPTO_POLY1305_X86_64 is not set +# CONFIG_CRYPTO_RMD128 is not set +# CONFIG_CRYPTO_RMD160 is not set +# CONFIG_CRYPTO_RMD256 is not set @@ -1780,14 +6459,18 @@ index 0000000000..f7cc6c8561 +# CONFIG_CRYPTO_SHA256_ARM is not set +# CONFIG_CRYPTO_SHA2_ARM_CE is not set +# CONFIG_CRYPTO_SHA3 is not set ++# CONFIG_CRYPTO_SHA3_ARM64 is not set +# CONFIG_CRYPTO_SHA512 is not set +# CONFIG_CRYPTO_SHA512_ARM is not set ++# CONFIG_CRYPTO_SHA512_ARM64_CE is not set +# CONFIG_CRYPTO_SIMD is not set +CONFIG_CRYPTO_SKCIPHER=y +CONFIG_CRYPTO_SKCIPHER2=y +# CONFIG_CRYPTO_SM2 is not set +# CONFIG_CRYPTO_SM3 is not set ++# CONFIG_CRYPTO_SM3_ARM64_CE is not set +# CONFIG_CRYPTO_SM4 is not set ++# CONFIG_CRYPTO_SM4_ARM64_CE is not set +# CONFIG_CRYPTO_SPECK is not set +# CONFIG_CRYPTO_STATS is not set +# CONFIG_CRYPTO_STREEBOG is not set @@ -1799,8 +6482,10 @@ index 0000000000..f7cc6c8561 +# CONFIG_CRYPTO_TWOFISH_COMMON is not set +# CONFIG_CRYPTO_USER is not set +# CONFIG_CRYPTO_USER_API_AEAD is not set ++# CONFIG_CRYPTO_USER_API_ENABLE_OBSOLETE is not set +# CONFIG_CRYPTO_USER_API_HASH is not set +# CONFIG_CRYPTO_USER_API_RNG is not set ++# CONFIG_CRYPTO_USER_API_RNG_CAVP is not set +# CONFIG_CRYPTO_USER_API_SKCIPHER is not set +# CONFIG_CRYPTO_VMAC is not set +# CONFIG_CRYPTO_WP512 is not set @@ -1891,7 +6576,9 @@ index 0000000000..f7cc6c8561 +# CONFIG_DEBUG_TEST_DRIVER_REMOVE is not set +# CONFIG_DEBUG_TIMEKEEPING is not set +# CONFIG_DEBUG_UART_8250_PALMCHIP is not set ++# CONFIG_DEBUG_UART_8250_WORD is not set +# CONFIG_DEBUG_UART_BCM63XX is not set ++# CONFIG_DEBUG_UART_FLOW_CONTROL is not set +# CONFIG_DEBUG_USER is not set +# CONFIG_DEBUG_VIRTUAL is not set +# CONFIG_DEBUG_VM is not set @@ -2007,15 +6694,23 @@ index 0000000000..f7cc6c8561 +# CONFIG_DRM_AMDGPU_USERPTR is not set +# CONFIG_DRM_AMD_ACP is not set +# CONFIG_DRM_AMD_DC_DCN2_0 is not set ++# CONFIG_DRM_AMD_DC_DCN3_0 is not set ++# CONFIG_DRM_AMD_DC_HDCP is not set ++# CONFIG_DRM_AMD_DC_SI is not set ++# CONFIG_DRM_ANALOGIX_ANX6345 is not set +# CONFIG_DRM_ANALOGIX_ANX78XX is not set +# CONFIG_DRM_ARCPGU is not set +# CONFIG_DRM_ARMADA is not set +# CONFIG_DRM_AST is not set +# CONFIG_DRM_BOCHS is not set +# CONFIG_DRM_CDNS_DSI is not set ++# CONFIG_DRM_CDNS_MHDP8546 is not set ++# CONFIG_DRM_CHRONTEL_CH7033 is not set +# CONFIG_DRM_CIRRUS_QEMU is not set ++# CONFIG_DRM_DEBUG_DP_MST_TOPOLOGY_REFS is not set +# CONFIG_DRM_DEBUG_MM is not set +# CONFIG_DRM_DEBUG_SELFTEST is not set ++# CONFIG_DRM_DISPLAY_CONNECTOR is not set +# CONFIG_DRM_DP_AUX_CHARDEV is not set +# CONFIG_DRM_DP_CEC is not set +# CONFIG_DRM_DUMB_VGA_DAC is not set @@ -2041,6 +6736,8 @@ index 0000000000..f7cc6c8561 +# CONFIG_DRM_LIB_RANDOM is not set +# CONFIG_DRM_LIMA is not set +# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set ++# CONFIG_DRM_LONTIUM_LT9611 is not set ++# CONFIG_DRM_LVDS_CODEC is not set +# CONFIG_DRM_LVDS_ENCODER is not set +# CONFIG_DRM_MALI_DISPLAY is not set +# CONFIG_DRM_MCDE is not set @@ -2048,6 +6745,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_DRM_MGAG200 is not set +# CONFIG_DRM_MXSFB is not set +# CONFIG_DRM_NOUVEAU is not set ++# CONFIG_DRM_NWL_MIPI_DSI is not set +# CONFIG_DRM_NXP_PTN3460 is not set +# CONFIG_DRM_OMAP is not set +# CONFIG_DRM_PANEL_ARM_VERSATILE is not set @@ -2076,11 +6774,13 @@ index 0000000000..f7cc6c8561 +# CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2 is not set +# CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03 is not set +# CONFIG_DRM_PANEL_SAMSUNG_S6E63M0 is not set ++# CONFIG_DRM_PANEL_SAMSUNG_S6E88A0_AMS452EF01 is not set +# CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0 is not set +# CONFIG_DRM_PANEL_SEIKO_43WVF1G is not set +# CONFIG_DRM_PANEL_SHARP_LQ101R1SX01 is not set +# CONFIG_DRM_PANEL_SHARP_LS037V7DW01 is not set +# CONFIG_DRM_PANEL_SHARP_LS043T1LE01 is not set ++# CONFIG_DRM_PANEL_SIMPLE is not set +# CONFIG_DRM_PANEL_SITRONIX_ST7701 is not set +# CONFIG_DRM_PANEL_SITRONIX_ST7789V is not set +# CONFIG_DRM_PANEL_SONY_ACX565AKM is not set @@ -2090,6 +6790,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_DRM_PANEL_TRULY_NT35597_WQXGA is not set +# CONFIG_DRM_PANFROST is not set +# CONFIG_DRM_PARADE_PS8622 is not set ++# CONFIG_DRM_PARADE_PS8640 is not set +# CONFIG_DRM_PL111 is not set +# CONFIG_DRM_QXL is not set +# CONFIG_DRM_RADEON is not set @@ -2099,16 +6800,22 @@ index 0000000000..f7cc6c8561 +# CONFIG_DRM_SII902X is not set +# CONFIG_DRM_SII9234 is not set +# CONFIG_DRM_SIL_SII8620 is not set ++# CONFIG_DRM_SIMPLE_BRIDGE is not set +# CONFIG_DRM_STI is not set +# CONFIG_DRM_STM is not set +# CONFIG_DRM_SUN4I is not set +# CONFIG_DRM_THINE_THC63LVD1024 is not set ++# CONFIG_DRM_TIDSS is not set +# CONFIG_DRM_TILCDC is not set +# CONFIG_DRM_TINYDRM is not set +# CONFIG_DRM_TI_SN65DSI86 is not set +# CONFIG_DRM_TI_TFP410 is not set ++# CONFIG_DRM_TI_TPD12S015 is not set ++# CONFIG_DRM_TOSHIBA_TC358762 is not set +# CONFIG_DRM_TOSHIBA_TC358764 is not set +# CONFIG_DRM_TOSHIBA_TC358767 is not set ++# CONFIG_DRM_TOSHIBA_TC358768 is not set ++# CONFIG_DRM_TOSHIBA_TC358775 is not set +# CONFIG_DRM_UDL is not set +# CONFIG_DRM_VBOXVIDEO is not set +# CONFIG_DRM_VC4_HDMI_CEC is not set @@ -2238,6 +6945,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_DVB_TDA8083 is not set +# CONFIG_DVB_TDA8261 is not set +# CONFIG_DVB_TDA826X is not set ++# CONFIG_DVB_TEST_DRIVERS is not set +# CONFIG_DVB_TS2020 is not set +# CONFIG_DVB_TTUSB_BUDGET is not set +# CONFIG_DVB_TTUSB_DEC is not set @@ -2256,6 +6964,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_DVB_ZL10353 is not set +# CONFIG_DWC_XLGMAC is not set +# CONFIG_DWMAC_DWC_QOS_ETH is not set ++# CONFIG_DWMAC_INTEL_PLAT is not set +# CONFIG_DWMAC_IPQ806X is not set +# CONFIG_DWMAC_LPC18XX is not set +# CONFIG_DWMAC_MESON is not set @@ -2457,6 +7166,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_FB_TFT_RA8875 is not set +# CONFIG_FB_TFT_S6D02A1 is not set +# CONFIG_FB_TFT_S6D1121 is not set ++# CONFIG_FB_TFT_SEPS525 is not set +# CONFIG_FB_TFT_SH1106 is not set +# CONFIG_FB_TFT_SSD1289 is not set +# CONFIG_FB_TFT_SSD1305 is not set @@ -2499,6 +7209,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_FIRMWARE_EDID is not set +# CONFIG_FIRMWARE_IN_KERNEL is not set +# CONFIG_FIRMWARE_MEMMAP is not set ++# CONFIG_FIT_PARTITION is not set +# CONFIG_FIXED_PHY is not set +CONFIG_FLATMEM=y +CONFIG_FLATMEM_MANUAL=y @@ -2506,6 +7217,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_FM10K is not set +# CONFIG_FMC is not set +# CONFIG_FONTS is not set ++# CONFIG_FONT_6x8 is not set +# CONFIG_FONT_TER16x32 is not set +# CONFIG_FORCEDETH is not set +CONFIG_FORCE_MAX_ZONEORDER=11 @@ -2524,6 +7236,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_FSL_MC_BUS is not set +# CONFIG_FSL_PQ_MDIO is not set +# CONFIG_FSL_QDMA is not set ++# CONFIG_FSL_RCPM is not set +# CONFIG_FSL_XGMAC_MDIO is not set +CONFIG_FSNOTIFY=y +# CONFIG_FS_DAX is not set @@ -2680,6 +7393,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_HARDLOCKUP_DETECTOR is not set +# CONFIG_HCALL_STATS is not set +# CONFIG_HDC100X is not set ++# CONFIG_HDC2010 is not set +# CONFIG_HDLC is not set +# CONFIG_HDLC_CISCO is not set +# CONFIG_HDLC_FR is not set @@ -2805,6 +7519,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_HISILICON_ERRATUM_161600802 is not set +# CONFIG_HISI_DMA is not set +# CONFIG_HISI_FEMAC is not set ++# CONFIG_HISI_HIKEY_USB is not set +# CONFIG_HIX5HD2_GMAC is not set +# CONFIG_HMC425 is not set +# CONFIG_HMC6352 is not set @@ -2862,6 +7577,7 @@ index 0000000000..f7cc6c8561 +CONFIG_HW_RANDOM_TPM=y +# CONFIG_HW_RANDOM_VIA is not set +# CONFIG_HW_RANDOM_VIRTIO is not set ++# CONFIG_HW_RANDOM_XIPHERA is not set +# CONFIG_HX711 is not set +# CONFIG_HYPERV is not set +# CONFIG_HYPERV_TSCPAGE is not set @@ -2940,6 +7656,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_I2C_PCA_PLATFORM is not set +# CONFIG_I2C_PIIX4 is not set +# CONFIG_I2C_PXA_PCI is not set ++# CONFIG_I2C_PXA_SLAVE is not set +# CONFIG_I2C_RCAR is not set +# CONFIG_I2C_RK3X is not set +# CONFIG_I2C_ROBOTFUZZ_OSIF is not set @@ -3000,6 +7717,9 @@ index 0000000000..f7cc6c8561 +# CONFIG_IIO is not set +# CONFIG_IIO_BUFFER is not set +# CONFIG_IIO_BUFFER_CB is not set ++# CONFIG_IIO_BUFFER_DMA is not set ++# CONFIG_IIO_BUFFER_DMAENGINE is not set ++# CONFIG_IIO_BUFFER_HDC2010 is not set +# CONFIG_IIO_BUFFER_HW_CONSUMER is not set +# CONFIG_IIO_CONFIGFS is not set +CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 @@ -3063,6 +7783,10 @@ index 0000000000..f7cc6c8561 +# CONFIG_INGENIC_CGU_JZ4740 is not set +# CONFIG_INGENIC_CGU_JZ4770 is not set +# CONFIG_INGENIC_CGU_JZ4780 is not set ++# CONFIG_INGENIC_CGU_X1000 is not set ++# CONFIG_INGENIC_CGU_X1830 is not set ++# CONFIG_INGENIC_OST is not set ++# CONFIG_INGENIC_SYSOST is not set +# CONFIG_INGENIC_TCU_CLK is not set +# CONFIG_INGENIC_TCU_IRQ is not set +# CONFIG_INGENIC_TIMER is not set @@ -3135,11 +7859,13 @@ index 0000000000..f7cc6c8561 +# CONFIG_INTEGRITY is not set +# CONFIG_INTEGRITY_AUDIT is not set +# CONFIG_INTEGRITY_SIGNATURE is not set ++# CONFIG_INTEL_ATOMISP2_LED is not set +# CONFIG_INTEL_ATOMISP2_PM is not set +# CONFIG_INTEL_CHT_INT33FE is not set +# CONFIG_INTEL_HID_EVENT is not set +# CONFIG_INTEL_IDLE is not set +# CONFIG_INTEL_IDMA64 is not set ++# CONFIG_INTEL_INT0002_VGPIO is not set +# CONFIG_INTEL_IOATDMA is not set +# CONFIG_INTEL_ISH_HID is not set +# CONFIG_INTEL_MEI is not set @@ -3349,6 +8075,8 @@ index 0000000000..f7cc6c8561 +CONFIG_JOLIET=y +# CONFIG_JSA1212 is not set +# CONFIG_JUMP_LABEL is not set ++# CONFIG_JZ4740_WDT is not set ++# CONFIG_JZ4770_PHY is not set +# CONFIG_KALLSYMS is not set +# CONFIG_KALLSYMS_ABSOLUTE_PERCPU is not set +# CONFIG_KALLSYMS_ALL is not set @@ -3357,6 +8085,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_KARMA_PARTITION is not set +# CONFIG_KASAN is not set +CONFIG_KASAN_STACK=1 ++# CONFIG_KCMP is not set +# CONFIG_KCOV is not set +# CONFIG_KERNEL_BZIP2 is not set +# CONFIG_KERNEL_CAT is not set @@ -3366,6 +8095,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_KERNEL_LZO is not set +CONFIG_KERNEL_MODE_NEON=y +CONFIG_KERNEL_XZ=y ++# CONFIG_KERNEL_ZSTD is not set +CONFIG_KERNFS=y +# CONFIG_KEXEC is not set +# CONFIG_KEXEC_FILE is not set @@ -3413,6 +8143,8 @@ index 0000000000..f7cc6c8561 +# CONFIG_KMX61 is not set +# CONFIG_KPROBES is not set +# CONFIG_KPROBES_SANITY_TEST is not set ++# CONFIG_KPROBE_EVENTS_ON_NOTRACE is not set ++# CONFIG_KPROBE_EVENT_GEN_TEST is not set +# CONFIG_KS7010 is not set +# CONFIG_KS8842 is not set +# CONFIG_KS8851 is not set @@ -3422,8 +8154,10 @@ index 0000000000..f7cc6c8561 +# CONFIG_KUNIT is not set +CONFIG_KUSER_HELPERS=y +# CONFIG_KVM_AMD is not set ++# CONFIG_KVM_AMD_SEV is not set +# CONFIG_KVM_GUEST is not set +# CONFIG_KVM_INTEL is not set ++# CONFIG_KVM_WERROR is not set +# CONFIG_KXCJK1013 is not set +# CONFIG_KXSD9 is not set +# CONFIG_L2TP is not set @@ -3480,6 +8214,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_LEDS_LM3692X is not set +# CONFIG_LEDS_LP3944 is not set +# CONFIG_LEDS_LP3952 is not set ++# CONFIG_LEDS_LP50XX is not set +# CONFIG_LEDS_LP5521 is not set +# CONFIG_LEDS_LP5523 is not set +# CONFIG_LEDS_LP5562 is not set @@ -3519,6 +8254,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_LEDS_TRIGGER_PATTERN is not set +CONFIG_LEDS_TRIGGER_TIMER=y +# CONFIG_LEDS_TRIGGER_TRANSIENT is not set ++# CONFIG_LEDS_TURRIS_OMNIA is not set +# CONFIG_LEDS_USER is not set +# CONFIG_LED_TRIGGER_PHY is not set +# CONFIG_LEGACY_PTYS is not set @@ -3599,8 +8335,10 @@ index 0000000000..f7cc6c8561 +# CONFIG_MACH_ASM9260 is not set +# CONFIG_MACH_DECSTATION is not set +# CONFIG_MACH_INGENIC is not set ++# CONFIG_MACH_INGENIC_SOC is not set +# CONFIG_MACH_JAZZ is not set +# CONFIG_MACH_JZ4740 is not set ++# CONFIG_MACH_LOONGSON2EF is not set +# CONFIG_MACH_LOONGSON32 is not set +# CONFIG_MACH_LOONGSON64 is not set +# CONFIG_MACH_PIC32 is not set @@ -3665,7 +8403,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_MDIO_BUS_MUX_MMIOREG is not set +# CONFIG_MDIO_BUS_MUX_MULTIPLEXER is not set +# CONFIG_MDIO_DEVICE is not set -+CONFIG_MDIO_DEVRES=y ++# CONFIG_MDIO_DEVRES is not set +# CONFIG_MDIO_HISI_FEMAC is not set +# CONFIG_MDIO_IPQ4019 is not set +# CONFIG_MDIO_IPQ8064 is not set @@ -3810,6 +8548,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_MFD_RK808 is not set +# CONFIG_MFD_RN5T618 is not set +# CONFIG_MFD_ROHM_BD70528 is not set ++# CONFIG_MFD_ROHM_BD71828 is not set +# CONFIG_MFD_ROHM_BD718XX is not set +# CONFIG_MFD_RT5033 is not set +# CONFIG_MFD_RTSX_PCI is not set @@ -3876,6 +8615,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_MIPS_FPU_EMULATOR is not set +# CONFIG_MIPS_FP_SUPPORT is not set +# CONFIG_MIPS_GENERIC is not set ++# CONFIG_MIPS_GENERIC_KERNEL is not set +# CONFIG_MIPS_MALTA is not set +# CONFIG_MIPS_O32_FP64_SUPPORT is not set +# CONFIG_MIPS_PARAVIRT is not set @@ -3950,6 +8690,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_MMC_SPI is not set +# CONFIG_MMC_STM32_SDMMC is not set +# CONFIG_MMC_TEST is not set ++# CONFIG_MMC_TIFM_SD is not set +# CONFIG_MMC_TOSHIBA_PCI is not set +# CONFIG_MMC_USDHI6ROL0 is not set +# CONFIG_MMC_USHC is not set @@ -4134,6 +8875,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set +CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT=4096 +CONFIG_MTD_SPLIT=y ++# CONFIG_MTD_SPLIT_BCM63XX_FW is not set +# CONFIG_MTD_SPLIT_BCM_WFI_FW is not set +# CONFIG_MTD_SPLIT_BRNIMAGE_FW is not set +# CONFIG_MTD_SPLIT_ELF_FW is not set @@ -4333,6 +9075,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_NET_DSA_MV88E6352 is not set +# CONFIG_NET_DSA_MV88E6XXX is not set +# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set ++# CONFIG_NET_DSA_MV88E6XXX_PTP is not set +# CONFIG_NET_DSA_QCA8K is not set +# CONFIG_NET_DSA_REALTEK_SMI is not set +# CONFIG_NET_DSA_SJA1105 is not set @@ -4567,8 +9310,8 @@ index 0000000000..f7cc6c8561 +# CONFIG_NF_CONNTRACK_TIMESTAMP is not set +# CONFIG_NF_CONNTRACK_ZONES is not set +# CONFIG_NF_CT_NETLINK is not set -+# CONFIG_NF_CT_NETLINK_TIMEOUT is not set +# CONFIG_NF_CT_NETLINK_HELPER is not set ++# CONFIG_NF_CT_NETLINK_TIMEOUT is not set +# CONFIG_NF_CT_PROTO_DCCP is not set +# CONFIG_NF_CT_PROTO_GRE is not set +# CONFIG_NF_CT_PROTO_SCTP is not set @@ -4706,6 +9449,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_OABI_COMPAT is not set +# CONFIG_OBS600 is not set +# CONFIG_OCFS2_FS is not set ++# CONFIG_OCTEONTX2_AF is not set +# CONFIG_OCTEONTX2_PF is not set +# CONFIG_OF_OVERLAY is not set +CONFIG_OF_RESERVED_MEM=y @@ -4825,6 +9569,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_PCIEAER_INJECT is not set +# CONFIG_PCIEASPM is not set +# CONFIG_PCIEPORTBUS is not set ++# CONFIG_PCIE_AL is not set +# CONFIG_PCIE_ALTERA is not set +# CONFIG_PCIE_ARMADA_8K is not set +# CONFIG_PCIE_BUS_DEFAULT is not set @@ -4965,7 +9710,6 @@ index 0000000000..f7cc6c8561 +# CONFIG_PLATFORM_MHU is not set +# CONFIG_PLAT_SPEAR is not set +# CONFIG_PLIP is not set -+CONFIG_PLUGIN_HOSTCC="" +# CONFIG_PLX_DMA is not set +# CONFIG_PLX_HERMES is not set +# CONFIG_PM is not set @@ -4987,6 +9731,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_POWER_RESET_BRCMSTB is not set +# CONFIG_POWER_RESET_GPIO is not set +# CONFIG_POWER_RESET_GPIO_RESTART is not set ++# CONFIG_POWER_RESET_LINKSTATION is not set +# CONFIG_POWER_RESET_LTC2952 is not set +# CONFIG_POWER_RESET_PIIX4_POWEROFF is not set +# CONFIG_POWER_RESET_RESTART is not set @@ -5065,6 +9810,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_PTP_1588_CLOCK_IXP46X is not set +# CONFIG_PTP_1588_CLOCK_KVM is not set +# CONFIG_PTP_1588_CLOCK_PCH is not set ++# CONFIG_PTP_1588_CLOCK_VMW is not set +# CONFIG_PUBLIC_KEY_ALGO_RSA is not set +# CONFIG_PVPANIC is not set +# CONFIG_PWM is not set @@ -5168,7 +9914,6 @@ index 0000000000..f7cc6c8561 +# CONFIG_REALTEK_PHY is not set +# CONFIG_REDWOOD is not set +# CONFIG_REED_SOLOMON_TEST is not set -+# CONFIG_REFCOUNT_FULL is not set +# CONFIG_REGMAP is not set +# CONFIG_REGMAP_I2C is not set +# CONFIG_REGMAP_MMIO is not set @@ -5194,6 +9939,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_REGULATOR_LTC3589 is not set +# CONFIG_REGULATOR_LTC3676 is not set +# CONFIG_REGULATOR_MAX1586 is not set ++# CONFIG_REGULATOR_MAX77620 is not set +# CONFIG_REGULATOR_MAX77826 is not set +# CONFIG_REGULATOR_MAX8649 is not set +# CONFIG_REGULATOR_MAX8660 is not set @@ -5211,6 +9957,9 @@ index 0000000000..f7cc6c8561 +# CONFIG_REGULATOR_PV88080 is not set +# CONFIG_REGULATOR_PV88090 is not set +# CONFIG_REGULATOR_PWM is not set ++# CONFIG_REGULATOR_RASPBERRYPI_TOUCHSCREEN_ATTINY is not set ++# CONFIG_REGULATOR_RT4801 is not set ++# CONFIG_REGULATOR_RTMV20 is not set +# CONFIG_REGULATOR_SLG51000 is not set +# CONFIG_REGULATOR_SY8106A is not set +# CONFIG_REGULATOR_SY8824X is not set @@ -5313,6 +10062,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_RTC_DRV_ISL12026 is not set +# CONFIG_RTC_DRV_ISL12057 is not set +# CONFIG_RTC_DRV_ISL1208 is not set ++# CONFIG_RTC_DRV_JZ4740 is not set +# CONFIG_RTC_DRV_M41T80 is not set +# CONFIG_RTC_DRV_M41T93 is not set +# CONFIG_RTC_DRV_M41T94 is not set @@ -5347,6 +10097,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_RTC_DRV_RTC7301 is not set +# CONFIG_RTC_DRV_RV3028 is not set +# CONFIG_RTC_DRV_RV3029C2 is not set ++# CONFIG_RTC_DRV_RV3032 is not set +# CONFIG_RTC_DRV_RV8803 is not set +# CONFIG_RTC_DRV_RX4581 is not set +# CONFIG_RTC_DRV_RX6110 is not set @@ -5563,6 +10314,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_SENSORS_ADM1029 is not set +# CONFIG_SENSORS_ADM1031 is not set +# CONFIG_SENSORS_ADM1177 is not set ++# CONFIG_SENSORS_ADM1266 is not set +# CONFIG_SENSORS_ADM1275 is not set +# CONFIG_SENSORS_ADM9240 is not set +# CONFIG_SENSORS_ADS1015 is not set @@ -5591,6 +10343,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_SENSORS_CORSAIR_CPRO is not set +# CONFIG_SENSORS_DELL_SMM is not set +# CONFIG_SENSORS_DME1737 is not set ++# CONFIG_SENSORS_DRIVETEMP is not set +# CONFIG_SENSORS_DS1621 is not set +# CONFIG_SENSORS_DS620 is not set +# CONFIG_SENSORS_EMC1403 is not set @@ -5687,6 +10440,8 @@ index 0000000000..f7cc6c8561 +# CONFIG_SENSORS_MAX6697 is not set +# CONFIG_SENSORS_MAX8688 is not set +# CONFIG_SENSORS_MCP3021 is not set ++# CONFIG_SENSORS_MP2975 is not set ++# CONFIG_SENSORS_MR75203 is not set +# CONFIG_SENSORS_NCT6683 is not set +# CONFIG_SENSORS_NCT6775 is not set +# CONFIG_SENSORS_NCT7802 is not set @@ -5837,7 +10592,9 @@ index 0000000000..f7cc6c8561 +# CONFIG_SGI_IP22 is not set +# CONFIG_SGI_IP27 is not set +# CONFIG_SGI_IP28 is not set ++# CONFIG_SGI_IP30 is not set +# CONFIG_SGI_IP32 is not set ++# CONFIG_SGI_MFD_IOC3 is not set +# CONFIG_SGI_PARTITION is not set +# CONFIG_SG_POOL is not set +# CONFIG_SG_SPLIT is not set @@ -5961,6 +10718,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_SND_GUSMAX is not set +# CONFIG_SND_HDA_INTEL is not set +# CONFIG_SND_HDA_INTEL_DETECT_DMIC is not set ++# CONFIG_SND_HDA_INTEL_HDMI_SILENT_STREAM is not set +CONFIG_SND_HDA_POWER_SAVE_DEFAULT=0 +CONFIG_SND_HDA_PREALLOC_SIZE=64 +# CONFIG_SND_HDSP is not set @@ -6058,6 +10816,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_SND_SOC_ALC5623 is not set +# CONFIG_SND_SOC_AMD_ACP is not set +# CONFIG_SND_SOC_AMD_ACP3x is not set ++# CONFIG_SND_SOC_AMD_RENOIR is not set +# CONFIG_SND_SOC_AU1XAUDIO is not set +# CONFIG_SND_SOC_AU1XPSC is not set +# CONFIG_SND_SOC_BD28623 is not set @@ -6067,6 +10826,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_SND_SOC_CS35L34 is not set +# CONFIG_SND_SOC_CS35L35 is not set +# CONFIG_SND_SOC_CS35L36 is not set ++# CONFIG_SND_SOC_CS4234 is not set +# CONFIG_SND_SOC_CS4265 is not set +# CONFIG_SND_SOC_CS4270 is not set +# CONFIG_SND_SOC_CS4271 is not set @@ -6083,6 +10843,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_SND_SOC_CS4349 is not set +# CONFIG_SND_SOC_CS53L30 is not set +# CONFIG_SND_SOC_CX2072X is not set ++# CONFIG_SND_SOC_DA7213 is not set +# CONFIG_SND_SOC_DIO2125 is not set +# CONFIG_SND_SOC_DMIC is not set +# CONFIG_SND_SOC_ES7134 is not set @@ -6121,6 +10882,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH is not set +# CONFIG_SND_SOC_INTEL_BYT_MAX98090_MACH is not set +# CONFIG_SND_SOC_INTEL_BYT_RT5640_MACH is not set ++# CONFIG_SND_SOC_INTEL_CATPT is not set +# CONFIG_SND_SOC_INTEL_CFL is not set +# CONFIG_SND_SOC_INTEL_CHT_BSW_MAX98090_TI_MACH is not set +# CONFIG_SND_SOC_INTEL_CHT_BSW_NAU8824_MACH is not set @@ -6142,8 +10904,10 @@ index 0000000000..f7cc6c8561 +# CONFIG_SND_SOC_INTEL_SKYLAKE is not set +# CONFIG_SND_SOC_INTEL_SST is not set +CONFIG_SND_SOC_INTEL_SST_TOPLEVEL=y ++# CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES is not set +# CONFIG_SND_SOC_JZ4725B_CODEC is not set +# CONFIG_SND_SOC_JZ4740_CODEC is not set ++# CONFIG_SND_SOC_JZ4770_CODEC is not set +# CONFIG_SND_SOC_MA120X0P is not set +# CONFIG_SND_SOC_MAX9759 is not set +# CONFIG_SND_SOC_MAX98088 is not set @@ -6204,6 +10968,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_SND_SOC_STI_SAS is not set +# CONFIG_SND_SOC_TAS2552 is not set +# CONFIG_SND_SOC_TAS2562 is not set ++# CONFIG_SND_SOC_TAS2764 is not set +# CONFIG_SND_SOC_TAS2770 is not set +# CONFIG_SND_SOC_TAS5086 is not set +# CONFIG_SND_SOC_TAS571X is not set @@ -6332,6 +11097,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_SPI_GPIO is not set +# CONFIG_SPI_GPIO_OLD is not set +# CONFIG_SPI_IMG_SPFI is not set ++# CONFIG_SPI_LANTIQ_SSC is not set +# CONFIG_SPI_LM70_LLP is not set +# CONFIG_SPI_LOOPBACK_TEST is not set +# CONFIG_SPI_MASTER is not set @@ -6458,6 +11224,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_SYNCLINK_CS is not set +# CONFIG_SYNC_FILE is not set +# CONFIG_SYNOPSYS_DWC_ETH_QOS is not set ++# CONFIG_SYNTH_EVENTS is not set +CONFIG_SYN_COOKIES=y +# CONFIG_SYSCON_REBOOT_MODE is not set +CONFIG_SYSCTL=y @@ -6597,6 +11364,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_TINYDRM_HX8357D is not set +# CONFIG_TINYDRM_ILI9225 is not set +# CONFIG_TINYDRM_ILI9341 is not set ++# CONFIG_TINYDRM_ILI9486 is not set +# CONFIG_TINYDRM_MI0283QT is not set +# CONFIG_TINYDRM_REPAPER is not set +# CONFIG_TINYDRM_ST7586 is not set @@ -6766,6 +11534,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_TOUCHSCREEN_WM97XX_ZYLONITE is not set +# CONFIG_TOUCHSCREEN_ZET6223 is not set +# CONFIG_TOUCHSCREEN_ZFORCE is not set ++# CONFIG_TOUCHSCREEN_ZINITIX is not set +# CONFIG_TPL0102 is not set +# CONFIG_TPS6105X is not set +# CONFIG_TPS65010 is not set @@ -6775,6 +11544,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_TRACER_SNAPSHOT_PER_CPU_SWAP is not set +# CONFIG_TRACE_BRANCH_PROFILING is not set +# CONFIG_TRACE_EVAL_MAP_FILE is not set ++# CONFIG_TRACE_EVENT_INJECT is not set +CONFIG_TRACE_IRQFLAGS_SUPPORT=y +# CONFIG_TRACE_SINK is not set +# CONFIG_TRACING_EVENTS_GPIO is not set @@ -6867,6 +11637,11 @@ index 0000000000..f7cc6c8561 +# CONFIG_USB_CDNS3 is not set +# CONFIG_USB_CHAOSKEY is not set +# CONFIG_USB_CHIPIDEA is not set ++# CONFIG_USB_CHIPIDEA_GENERIC is not set ++# CONFIG_USB_CHIPIDEA_IMX is not set ++# CONFIG_USB_CHIPIDEA_MSM is not set ++# CONFIG_USB_CHIPIDEA_PCI is not set ++# CONFIG_USB_CHIPIDEA_TEGRA is not set +# CONFIG_USB_CONFIGFS is not set +# CONFIG_USB_CONN_GPIO is not set +# CONFIG_USB_CXACRU is not set @@ -7015,6 +11790,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_USB_M5602 is not set +# CONFIG_USB_M66592 is not set +# CONFIG_USB_MASS_STORAGE is not set ++# CONFIG_USB_MAX3420_UDC is not set +# CONFIG_USB_MAX3421_HCD is not set +# CONFIG_USB_MDC800 is not set +# CONFIG_USB_MICROTEK is not set @@ -7079,9 +11855,11 @@ index 0000000000..f7cc6c8561 +# CONFIG_USB_PXA27X is not set +# CONFIG_USB_R8A66597 is not set +# CONFIG_USB_R8A66597_HCD is not set ++# CONFIG_USB_RAW_GADGET is not set +# CONFIG_USB_RCAR_PHY is not set +# CONFIG_USB_RENESAS_USBHS is not set +# CONFIG_USB_RIO500 is not set ++# CONFIG_USB_ROLES_INTEL_XHCI is not set +# CONFIG_USB_ROLE_SWITCH is not set +# CONFIG_USB_RTL8150 is not set +# CONFIG_USB_RTL8152 is not set @@ -7205,6 +11983,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_USB_ZR364XX is not set +# CONFIG_USELIB is not set +# CONFIG_USERFAULTFD is not set ++# CONFIG_USERIO is not set +# CONFIG_USE_OF is not set +# CONFIG_UTS_NS is not set +# CONFIG_UWB is not set @@ -7226,6 +12005,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_VF610_ADC is not set +# CONFIG_VF610_DAC is not set +# CONFIG_VFAT_FS is not set ++# CONFIG_VFIO is not set +# CONFIG_VGASTATE is not set +# CONFIG_VGA_ARB is not set +# CONFIG_VGA_SWITCHEROO is not set @@ -7317,6 +12097,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_VIDEO_OV2659 is not set +# CONFIG_VIDEO_OV2680 is not set +# CONFIG_VIDEO_OV2685 is not set ++# CONFIG_VIDEO_OV2740 is not set +# CONFIG_VIDEO_OV5640 is not set +# CONFIG_VIDEO_OV5645 is not set +# CONFIG_VIDEO_OV5647 is not set @@ -7393,6 +12174,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_VIRTIO_INPUT is not set +CONFIG_VIRTIO_MENU=y +# CONFIG_VIRTIO_MMIO is not set ++# CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES is not set +# CONFIG_VIRTIO_PCI is not set +# CONFIG_VIRTUALIZATION is not set +# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set @@ -7525,6 +12307,7 @@ index 0000000000..f7cc6c8561 +# CONFIG_XFS_POSIX_ACL is not set +# CONFIG_XFS_QUOTA is not set +# CONFIG_XFS_RT is not set ++# CONFIG_XFS_SUPPORT_V4 is not set +# CONFIG_XFS_WARN is not set +# CONFIG_XILINX_AXI_EMAC is not set +# CONFIG_XILINX_DMA is not set @@ -7590,8 +12373,544 @@ index 0d53ed9c3c..7d634b56cf 100644 # CONFIG_HAVE_(?!(ARCH_TIMER|TCM|SMP)).* is not set +# CONFIG_SET_FS is not set +# CONFIG_TASKS_.* is not set +diff --git a/target/linux/generic/files/block/partitions/fit.c b/target/linux/generic/files/block/partitions/fit.c +new file mode 100644 +index 0000000000..c0d9642505 +--- /dev/null ++++ b/target/linux/generic/files/block/partitions/fit.c +@@ -0,0 +1,254 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later ++/* ++ * fs/partitions/fit.c ++ * Copyright (C) 2021 Daniel Golle ++ * ++ * headers extracted from U-Boot mkimage sources ++ * (C) Copyright 2008 Semihalf ++ * (C) Copyright 2000-2005 ++ * Wolfgang Denk, DENX Software Engineering, wd@denx.de. ++ * ++ * based on existing partition parsers ++ * Copyright (C) 1991-1998 Linus Torvalds ++ * Re-organised Feb 1998 Russell King ++ */ ++ ++#define pr_fmt(fmt) fmt ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "check.h" ++ ++#define FIT_IMAGES_PATH "/images" ++#define FIT_CONFS_PATH "/configurations" ++ ++/* hash/signature/key node */ ++#define FIT_HASH_NODENAME "hash" ++#define FIT_ALGO_PROP "algo" ++#define FIT_VALUE_PROP "value" ++#define FIT_IGNORE_PROP "uboot-ignore" ++#define FIT_SIG_NODENAME "signature" ++#define FIT_KEY_REQUIRED "required" ++#define FIT_KEY_HINT "key-name-hint" ++ ++/* cipher node */ ++#define FIT_CIPHER_NODENAME "cipher" ++#define FIT_ALGO_PROP "algo" ++ ++/* image node */ ++#define FIT_DATA_PROP "data" ++#define FIT_DATA_POSITION_PROP "data-position" ++#define FIT_DATA_OFFSET_PROP "data-offset" ++#define FIT_DATA_SIZE_PROP "data-size" ++#define FIT_TIMESTAMP_PROP "timestamp" ++#define FIT_DESC_PROP "description" ++#define FIT_ARCH_PROP "arch" ++#define FIT_TYPE_PROP "type" ++#define FIT_OS_PROP "os" ++#define FIT_COMP_PROP "compression" ++#define FIT_ENTRY_PROP "entry" ++#define FIT_LOAD_PROP "load" ++ ++/* configuration node */ ++#define FIT_KERNEL_PROP "kernel" ++#define FIT_FILESYSTEM_PROP "filesystem" ++#define FIT_RAMDISK_PROP "ramdisk" ++#define FIT_FDT_PROP "fdt" ++#define FIT_LOADABLE_PROP "loadables" ++#define FIT_DEFAULT_PROP "default" ++#define FIT_SETUP_PROP "setup" ++#define FIT_FPGA_PROP "fpga" ++#define FIT_FIRMWARE_PROP "firmware" ++#define FIT_STANDALONE_PROP "standalone" ++ ++#define FIT_MAX_HASH_LEN HASH_MAX_DIGEST_SIZE ++ ++#define MIN_FREE_SECT 16 ++#define REMAIN_VOLNAME "rootfs_data" ++ ++int parse_fit_partitions(struct parsed_partitions *state, u64 fit_start_sector, u64 sectors, int *slot, int add_remain) ++{ ++ struct address_space *mapping = state->bdev->bd_inode->i_mapping; ++ struct page *page; ++ void *fit, *init_fit; ++ struct partition_meta_info *info; ++ char tmp[sizeof(info->volname)]; ++ u64 dsize, dsectors, imgmaxsect = 0; ++ u32 size, image_pos, image_len; ++ const u32 *image_offset_be, *image_len_be, *image_pos_be; ++ int ret = 1, node, images, config; ++ const char *image_name, *image_type, *image_description, *config_default, ++ *config_description, *config_loadables; ++ int image_name_len, image_type_len, image_description_len, config_default_len, ++ config_description_len, config_loadables_len; ++ sector_t start_sect, nr_sects; ++ size_t label_min; ++ ++ if (fit_start_sector % (1<<(PAGE_SHIFT - SECTOR_SHIFT))) ++ return -ERANGE; ++ ++ page = read_mapping_page(mapping, fit_start_sector >> (PAGE_SHIFT - SECTOR_SHIFT), NULL); ++ if (!page) ++ return -ENOMEM; ++ ++ init_fit = page_address(page); ++ ++ if (!init_fit) { ++ put_page(page); ++ return -EFAULT; ++ } ++ ++ if (fdt_check_header(init_fit)) { ++ put_page(page); ++ return 0; ++ } ++ ++ dsectors = get_capacity(state->bdev->bd_disk); ++ if (sectors) ++ dsectors = (dsectors>sectors)?sectors:dsectors; ++ ++ dsize = dsectors << SECTOR_SHIFT; ++ printk(KERN_DEBUG "FIT: volume size: %llu sectors (%llu bytes)\n", dsectors, dsize); ++ ++ size = fdt_totalsize(init_fit); ++ printk(KERN_DEBUG "FIT: FDT structure size: %u bytes\n", size); ++ if (size > PAGE_SIZE) { ++ printk(KERN_ERR "FIT: FDT structure beyond page boundaries, use 'mkimage -E ...'!\n"); ++ put_page(page); ++ return -ENOTSUPP; ++ } ++ ++ if (size >= dsize) { ++ put_page(page); ++ state->access_beyond_eod = (size >= dsize); ++ return 0; ++ } ++ ++ fit = kmemdup(init_fit, size, GFP_KERNEL); ++ put_page(page); ++ if (!fit) ++ return -ENOMEM; ++ ++ config = fdt_path_offset(fit, FIT_CONFS_PATH); ++ if (config < 0) { ++ printk(KERN_ERR "FIT: Cannot find %s node: %d\n", FIT_CONFS_PATH, images); ++ ret = -ENOENT; ++ goto ret_out; ++ } ++ ++ config_default = fdt_getprop(fit, config, FIT_DEFAULT_PROP, &config_default_len); ++ ++ if (!config_default) { ++ printk(KERN_ERR "FIT: Cannot find default configuration\n"); ++ ret = -ENOENT; ++ goto ret_out; ++ } ++ ++ node = fdt_subnode_offset(fit, config, config_default); ++ if (node < 0) { ++ printk(KERN_ERR "FIT: Cannot find %s node: %d\n", config_default, node); ++ ret = -ENOENT; ++ goto ret_out; ++ } ++ ++ config_description = fdt_getprop(fit, node, FIT_DESC_PROP, &config_description_len); ++ config_loadables = fdt_getprop(fit, node, FIT_LOADABLE_PROP, &config_loadables_len); ++ ++ printk(KERN_DEBUG "FIT: Default configuration: %s%s%s%s\n", config_default, ++ config_description?" (":"", config_description?:"", config_description?")":""); ++ ++ images = fdt_path_offset(fit, FIT_IMAGES_PATH); ++ if (images < 0) { ++ printk(KERN_ERR "FIT: Cannot find %s node: %d\n", FIT_IMAGES_PATH, images); ++ ret = -EINVAL; ++ goto ret_out; ++ } ++ ++ fdt_for_each_subnode(node, fit, images) { ++ image_name = fdt_get_name(fit, node, &image_name_len); ++ image_type = fdt_getprop(fit, node, FIT_TYPE_PROP, &image_type_len); ++ image_offset_be = fdt_getprop(fit, node, FIT_DATA_OFFSET_PROP, NULL); ++ image_pos_be = fdt_getprop(fit, node, FIT_DATA_POSITION_PROP, NULL); ++ image_len_be = fdt_getprop(fit, node, FIT_DATA_SIZE_PROP, NULL); ++ if (!image_name || !image_type || !image_len_be) ++ continue; ++ ++ image_len = be32_to_cpu(*image_len_be); ++ if (!image_len) ++ continue; ++ ++ if (image_offset_be) ++ image_pos = be32_to_cpu(*image_offset_be) + size; ++ else if (image_pos_be) ++ image_pos = be32_to_cpu(*image_pos_be); ++ else ++ continue; ++ ++ image_description = fdt_getprop(fit, node, FIT_DESC_PROP, &image_description_len); ++ ++ printk(KERN_DEBUG "FIT: %16s sub-image 0x%08x - 0x%08x '%s' %s%s%s\n", ++ image_type, image_pos, image_pos + image_len, image_name, ++ image_description?"(":"", image_description?:"", image_description?") ":""); ++ ++ if (strcmp(image_type, FIT_FILESYSTEM_PROP)) ++ continue; ++ ++ if (image_pos & ((1 << PAGE_SHIFT)-1)) { ++ printk(KERN_ERR "FIT: image %s start not aligned to page boundaries, skipping\n", image_name); ++ continue; ++ } ++ ++ if (image_len & ((1 << PAGE_SHIFT)-1)) { ++ printk(KERN_ERR "FIT: sub-image %s end not aligned to page boundaries, skipping\n", image_name); ++ continue; ++ } ++ ++ start_sect = image_pos >> SECTOR_SHIFT; ++ nr_sects = image_len >> SECTOR_SHIFT; ++ imgmaxsect = (imgmaxsect < (start_sect + nr_sects))?(start_sect + nr_sects):imgmaxsect; ++ ++ if (start_sect + nr_sects > dsectors) { ++ state->access_beyond_eod = 1; ++ continue; ++ } ++ ++ put_partition(state, ++(*slot), fit_start_sector + start_sect, nr_sects); ++ state->parts[*slot].flags = 0; ++ info = &state->parts[*slot].info; ++ ++ label_min = min_t(int, sizeof(info->volname) - 1, image_name_len); ++ strncpy(info->volname, image_name, label_min); ++ info->volname[label_min] = '\0'; ++ ++ snprintf(tmp, sizeof(tmp), "(%s)", info->volname); ++ strlcat(state->pp_buf, tmp, PAGE_SIZE); ++ ++ state->parts[*slot].has_info = true; ++ ++ if (config_loadables && !strcmp(image_name, config_loadables)) { ++ printk(KERN_DEBUG "FIT: selecting configured loadable %s to be root filesystem\n", image_name); ++ state->parts[*slot].flags |= ADDPART_FLAG_ROOTDEV; ++ } ++ } ++ ++ if (add_remain && (imgmaxsect + MIN_FREE_SECT) < dsectors) { ++ put_partition(state, ++(*slot), fit_start_sector + imgmaxsect, dsectors - imgmaxsect); ++ state->parts[*slot].flags = 0; ++ info = &state->parts[*slot].info; ++ strcpy(info->volname, REMAIN_VOLNAME); ++ snprintf(tmp, sizeof(tmp), "(%s)", REMAIN_VOLNAME); ++ strlcat(state->pp_buf, tmp, PAGE_SIZE); ++ } ++ret_out: ++ kfree(fit); ++ return ret; ++} ++ ++int fit_partition(struct parsed_partitions *state) { ++ int slot = 0; ++ return parse_fit_partitions(state, 0, 0, &slot, 0); ++} +diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/Kconfig b/target/linux/generic/files/drivers/mtd/mtdsplit/Kconfig +index 4832b8d9e4..794a39f2c3 100644 +--- a/target/linux/generic/files/drivers/mtd/mtdsplit/Kconfig ++++ b/target/linux/generic/files/drivers/mtd/mtdsplit/Kconfig +@@ -20,6 +20,11 @@ config MTD_SPLIT_SQUASHFS_ROOT + + comment "Firmware partition parsers" + ++config MTD_SPLIT_BCM63XX_FW ++ bool "BCM63xx firmware parser" ++ depends on MTD_SPLIT_SUPPORT ++ select MTD_SPLIT ++ + config MTD_SPLIT_BCM_WFI_FW + bool "Broadcom Whole Flash Image parser" + depends on MTD_SPLIT_SUPPORT +diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/Makefile b/target/linux/generic/files/drivers/mtd/mtdsplit/Makefile +index 9217d8f64f..1461099b7c 100644 +--- a/target/linux/generic/files/drivers/mtd/mtdsplit/Makefile ++++ b/target/linux/generic/files/drivers/mtd/mtdsplit/Makefile +@@ -1,4 +1,5 @@ + obj-$(CONFIG_MTD_SPLIT) += mtdsplit.o ++obj-$(CONFIG_MTD_SPLIT_BCM63XX_FW) += mtdsplit_bcm63xx.o + obj-$(CONFIG_MTD_SPLIT_BCM_WFI_FW) += mtdsplit_bcm_wfi.o + obj-$(CONFIG_MTD_SPLIT_CFE_BOOTFS) += mtdsplit_cfe_bootfs.o + obj-$(CONFIG_MTD_SPLIT_SEAMA_FW) += mtdsplit_seama.o +diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_bcm63xx.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_bcm63xx.c +new file mode 100644 +index 0000000000..3a4b8a754f +--- /dev/null ++++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_bcm63xx.c +@@ -0,0 +1,186 @@ ++/* ++ * Firmware MTD split for BCM63XX, based on bcm63xxpart.c ++ * ++ * Copyright (C) 2006-2008 Florian Fainelli ++ * Copyright (C) 2006-2008 Mike Albon ++ * Copyright (C) 2009-2010 Daniel Dickinson ++ * Copyright (C) 2011-2013 Jonas Gorski ++ * Copyright (C) 2015 Simon Arlott ++ * Copyright (C) 2017 Álvaro Fernández Rojas ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation. ++ * ++ */ ++ ++#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "mtdsplit.h" ++ ++/* Ensure strings read from flash structs are null terminated */ ++#define STR_NULL_TERMINATE(x) \ ++ do { char *_str = (x); _str[sizeof(x) - 1] = 0; } while (0) ++ ++#define BCM63XX_NR_PARTS 2 ++ ++static int bcm63xx_read_image_tag(struct mtd_info *master, loff_t offset, ++ struct bcm_tag *hdr) ++{ ++ int ret; ++ size_t retlen; ++ u32 computed_crc; ++ ++ ret = mtd_read(master, offset, sizeof(*hdr), &retlen, (void *) hdr); ++ if (ret) ++ return ret; ++ ++ if (retlen != sizeof(*hdr)) ++ return -EIO; ++ ++ computed_crc = crc32_le(IMAGETAG_CRC_START, (u8 *)hdr, ++ offsetof(struct bcm_tag, header_crc)); ++ if (computed_crc == hdr->header_crc) { ++ STR_NULL_TERMINATE(hdr->board_id); ++ STR_NULL_TERMINATE(hdr->tag_version); ++ ++ pr_info("CFE image tag found at 0x%llx with version %s, " ++ "board type %s\n", offset, hdr->tag_version, ++ hdr->board_id); ++ ++ return 0; ++ } else { ++ pr_err("CFE image tag at 0x%llx CRC invalid " ++ "(expected %08x, actual %08x)\n", ++ offset, hdr->header_crc, computed_crc); ++ ++ return 1; ++ } ++} ++ ++static int bcm63xx_parse_partitions(struct mtd_info *master, ++ const struct mtd_partition **pparts, ++ struct bcm_tag *hdr) ++{ ++ struct mtd_partition *parts; ++ unsigned int flash_image_start; ++ unsigned int kernel_address; ++ unsigned int kernel_length; ++ size_t kernel_offset = 0, kernel_size = 0; ++ size_t rootfs_offset = 0, rootfs_size = 0; ++ int kernel_part, rootfs_part; ++ ++ STR_NULL_TERMINATE(hdr->flash_image_start); ++ if (kstrtouint(hdr->flash_image_start, 10, &flash_image_start) || ++ flash_image_start < BCM963XX_EXTENDED_SIZE) { ++ pr_err("invalid rootfs address: %*ph\n", ++ (int) sizeof(hdr->flash_image_start), ++ hdr->flash_image_start); ++ return -EINVAL; ++ } ++ ++ STR_NULL_TERMINATE(hdr->kernel_address); ++ if (kstrtouint(hdr->kernel_address, 10, &kernel_address) || ++ kernel_address < BCM963XX_EXTENDED_SIZE) { ++ pr_err("invalid kernel address: %*ph\n", ++ (int) sizeof(hdr->kernel_address), hdr->kernel_address); ++ return -EINVAL; ++ } ++ ++ STR_NULL_TERMINATE(hdr->kernel_length); ++ if (kstrtouint(hdr->kernel_length, 10, &kernel_length) || ++ !kernel_length) { ++ pr_err("invalid kernel length: %*ph\n", ++ (int) sizeof(hdr->kernel_length), hdr->kernel_length); ++ return -EINVAL; ++ } ++ ++ kernel_offset = kernel_address - BCM963XX_EXTENDED_SIZE - ++ mtdpart_get_offset(master); ++ kernel_size = kernel_length; ++ ++ if (flash_image_start < kernel_address) { ++ /* rootfs first */ ++ rootfs_part = 0; ++ kernel_part = 1; ++ rootfs_offset = flash_image_start - BCM963XX_EXTENDED_SIZE - ++ mtdpart_get_offset(master); ++ rootfs_size = kernel_offset - rootfs_offset; ++ } else { ++ /* kernel first */ ++ kernel_part = 0; ++ rootfs_part = 1; ++ rootfs_offset = kernel_offset + kernel_size; ++ rootfs_size = master->size - rootfs_offset; ++ } ++ ++ if (mtd_check_rootfs_magic(master, rootfs_offset, NULL)) ++ pr_warn("rootfs magic not found\n"); ++ ++ parts = kzalloc(BCM63XX_NR_PARTS * sizeof(*parts), GFP_KERNEL); ++ if (!parts) ++ return -ENOMEM; ++ ++ parts[kernel_part].name = KERNEL_PART_NAME; ++ parts[kernel_part].offset = kernel_offset; ++ parts[kernel_part].size = kernel_size; ++ ++ parts[rootfs_part].name = ROOTFS_PART_NAME; ++ parts[rootfs_part].offset = rootfs_offset; ++ parts[rootfs_part].size = rootfs_size; ++ ++ *pparts = parts; ++ return BCM63XX_NR_PARTS; ++} ++ ++static int mtdsplit_parse_bcm63xx(struct mtd_info *master, ++ const struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data) ++{ ++ struct bcm_tag hdr; ++ loff_t offset; ++ ++ if (mtd_type_is_nand(master)) ++ return -EINVAL; ++ ++ /* find bcm63xx_cfe image on erase block boundaries */ ++ for (offset = 0; offset < master->size; offset += master->erasesize) { ++ if (!bcm63xx_read_image_tag(master, offset, (void *) &hdr)) ++ return bcm63xx_parse_partitions(master, pparts, ++ (void *) &hdr); ++ } ++ ++ return -EINVAL; ++} ++ ++static const struct of_device_id mtdsplit_fit_of_match_table[] = { ++ { .compatible = "brcm,bcm963xx-imagetag" }, ++ { }, ++}; ++ ++static struct mtd_part_parser mtdsplit_bcm63xx_parser = { ++ .owner = THIS_MODULE, ++ .name = "bcm63xx-fw", ++ .of_match_table = mtdsplit_fit_of_match_table, ++ .parse_fn = mtdsplit_parse_bcm63xx, ++ .type = MTD_PARSER_TYPE_FIRMWARE, ++}; ++ ++static int __init mtdsplit_bcm63xx_init(void) ++{ ++ register_mtd_parser(&mtdsplit_bcm63xx_parser); ++ ++ return 0; ++} ++ ++module_init(mtdsplit_bcm63xx_init); +diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_cfe_bootfs.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_cfe_bootfs.c +index 5c8a5e1b9b..a3474c9dc2 100644 +--- a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_cfe_bootfs.c ++++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_cfe_bootfs.c +@@ -17,7 +17,7 @@ + #define je16_to_cpu(x) ((x).v16) + #define je32_to_cpu(x) ((x).v32) + +-#define NR_PARTS 1 ++#define NR_PARTS 2 + + static int mtdsplit_cfe_bootfs_parse(struct mtd_info *mtd, + const struct mtd_partition **pparts, +@@ -58,12 +58,16 @@ static int mtdsplit_cfe_bootfs_parse(struct mtd_info *mtd, + if (!parts) + return -ENOMEM; + ++ parts[0].name = "bootfs"; ++ parts[0].offset = 0; ++ parts[0].size = rootfs_offset; ++ + if (type == MTDSPLIT_PART_TYPE_UBI) +- parts[0].name = UBI_PART_NAME; ++ parts[1].name = UBI_PART_NAME; + else +- parts[0].name = ROOTFS_PART_NAME; +- parts[0].offset = rootfs_offset; +- parts[0].size = mtd->size - rootfs_offset; ++ parts[1].name = ROOTFS_PART_NAME; ++ parts[1].offset = rootfs_offset; ++ parts[1].size = mtd->size - rootfs_offset; + + *pparts = parts; + +diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_fit.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_fit.c +index 67ee33d085..5cc1658dbd 100644 +--- a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_fit.c ++++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_fit.c +@@ -49,6 +49,8 @@ mtdsplit_fit_parse(struct mtd_info *mtd, + const struct mtd_partition **pparts, + struct mtd_part_parser_data *data) + { ++ struct device_node *np = mtd_get_of_node(mtd); ++ const char *cmdline_match = NULL; + struct fdt_header hdr; + size_t hdr_len, retlen; + size_t offset; +@@ -57,6 +59,10 @@ mtdsplit_fit_parse(struct mtd_info *mtd, + struct mtd_partition *parts; + int ret; + ++ of_property_read_string(np, "openwrt,cmdline-match", &cmdline_match); ++ if (cmdline_match && !strstr(saved_command_line, cmdline_match)) ++ return -ENODEV; ++ + hdr_len = sizeof(struct fdt_header); + + /* Parse the MTD device & search for the FIT image location */ diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c -index 0b0348bfdf..acfa0ebecd 100644 +index 0b0348bfdf..ef0fc54949 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.c +++ b/target/linux/generic/files/drivers/net/phy/ar8216.c @@ -513,6 +513,8 @@ ar8216_read_port_link(struct ar8xxx_priv *priv, int port, @@ -7612,7 +12931,31 @@ index 0b0348bfdf..acfa0ebecd 100644 int ar8216_wait_bit(struct ar8xxx_priv *priv, int reg, u32 mask, u32 val) { -@@ -2449,6 +2453,7 @@ ar8xxx_phy_config_init(struct phy_device *phydev) +@@ -887,7 +891,11 @@ ar8216_phy_write(struct ar8xxx_priv *priv, int addr, int regnum, u16 val) + static int + ar8229_hw_init(struct ar8xxx_priv *priv) + { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0) ++ phy_interface_t phy_if_mode; ++#else + int phy_if_mode; ++#endif + + if (priv->initialized) + return 0; +@@ -895,7 +903,11 @@ ar8229_hw_init(struct ar8xxx_priv *priv) + ar8xxx_write(priv, AR8216_REG_CTRL, AR8216_CTRL_RESET); + ar8xxx_reg_wait(priv, AR8216_REG_CTRL, AR8216_CTRL_RESET, 0, 1000); + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0) ++ of_get_phy_mode(priv->pdev->of_node, &phy_if_mode); ++#else + phy_if_mode = of_get_phy_mode(priv->pdev->of_node); ++#endif + + if (phy_if_mode == PHY_INTERFACE_MODE_GMII) { + ar8xxx_write(priv, AR8229_REG_OPER_MODE0, +@@ -2449,6 +2461,7 @@ ar8xxx_phy_config_init(struct phy_device *phydev) if (ret) return ret; @@ -7620,7 +12963,7 @@ index 0b0348bfdf..acfa0ebecd 100644 /* VID fixup only needed on ar8216 */ if (chip_is_ar8216(priv)) { dev->phy_ptr = priv; -@@ -2456,6 +2461,7 @@ ar8xxx_phy_config_init(struct phy_device *phydev) +@@ -2456,6 +2469,7 @@ ar8xxx_phy_config_init(struct phy_device *phydev) dev->eth_mangle_rx = ar8216_mangle_rx; dev->eth_mangle_tx = ar8216_mangle_tx; } @@ -7628,7 +12971,7 @@ index 0b0348bfdf..acfa0ebecd 100644 return 0; } -@@ -2687,10 +2693,12 @@ ar8xxx_phy_detach(struct phy_device *phydev) +@@ -2687,10 +2701,12 @@ ar8xxx_phy_detach(struct phy_device *phydev) if (!dev) return; @@ -7643,7 +12986,7 @@ index 0b0348bfdf..acfa0ebecd 100644 static void diff --git a/target/linux/generic/hack-5.10/204-module_strip.patch b/target/linux/generic/hack-5.10/204-module_strip.patch new file mode 100644 -index 0000000000..79fc1057ab +index 0000000000..06159b0120 --- /dev/null +++ b/target/linux/generic/hack-5.10/204-module_strip.patch @@ -0,0 +1,196 @@ @@ -7737,7 +13080,7 @@ index 0000000000..79fc1057ab + +--- a/init/Kconfig ++++ b/init/Kconfig -+@@ -2327,6 +2327,13 @@ config UNUSED_KSYMS_WHITELIST ++@@ -2338,6 +2338,13 @@ config UNUSED_KSYMS_WHITELIST + one per line. The path can be absolute, or relative to the kernel + source tree. + @@ -7753,7 +13096,7 @@ index 0000000000..79fc1057ab + config MODULES_TREE_LOOKUP +--- a/kernel/module.c ++++ b/kernel/module.c -+@@ -3144,9 +3144,11 @@ static int setup_load_info(struct load_i ++@@ -3243,9 +3243,11 @@ static int setup_load_info(struct load_i + + static int check_modinfo(struct module *mod, struct load_info *info, int flags) + { @@ -7766,7 +13109,7 @@ index 0000000000..79fc1057ab + if (flags & MODULE_INIT_IGNORE_VERMAGIC) + modmagic = NULL; + -+@@ -3167,6 +3169,7 @@ static int check_modinfo(struct module * ++@@ -3266,6 +3268,7 @@ static int check_modinfo(struct module * + mod->name); + add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK); + } @@ -11204,7 +16547,7 @@ index 0000000000..810c5aecf5 + __stubs_end = .; \ diff --git a/target/linux/generic/hack-5.10/221-module_exports.patch b/target/linux/generic/hack-5.10/221-module_exports.patch new file mode 100644 -index 0000000000..9dd57ba933 +index 0000000000..07885408f1 --- /dev/null +++ b/target/linux/generic/hack-5.10/221-module_exports.patch @@ -0,0 +1,102 @@ @@ -11240,7 +16583,7 @@ index 0000000000..9dd57ba933 + /* Align . to a 8 byte boundary equals to maximum function alignment. */ + #define ALIGN_FUNCTION() . = ALIGN(8) + -+@@ -470,14 +480,14 @@ ++@@ -473,14 +483,14 @@ + /* Kernel symbol table: Normal symbols */ \ + __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \ + __start___ksymtab = .; \ @@ -11257,7 +16600,7 @@ index 0000000000..9dd57ba933 + __stop___ksymtab_gpl = .; \ + } \ + \ -+@@ -539,7 +549,7 @@ ++@@ -542,7 +552,7 @@ + \ + /* Kernel symbol table: strings */ \ + __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \ @@ -11266,7 +16609,7 @@ index 0000000000..9dd57ba933 + } \ + \ + /* __*init sections */ \ -+@@ -1008,6 +1018,8 @@ ++@@ -1017,6 +1027,8 @@ + + #define COMMON_DISCARDS \ + SANITIZER_DISCARDS \ @@ -11350,6 +16693,23 @@ index 0000000000..906527faf9 + + quiet_cmd_lzo = LZO $@ + cmd_lzo = { cat $(real-prereqs) | $(KLZOP) -9; $(size_append); } > $@ +diff --git a/target/linux/generic/hack-5.10/249-udp-tunnel-selection.patch b/target/linux/generic/hack-5.10/249-udp-tunnel-selection.patch +new file mode 100644 +index 0000000000..2c74298dfe +--- /dev/null ++++ b/target/linux/generic/hack-5.10/249-udp-tunnel-selection.patch +@@ -0,0 +1,11 @@ ++--- a/net/ipv4/Kconfig +++++ b/net/ipv4/Kconfig ++@@ -315,7 +315,7 @@ config NET_IPVTI ++ on top. ++ ++ config NET_UDP_TUNNEL ++- tristate +++ tristate "IP: UDP tunneling support" ++ select NET_IP_TUNNEL ++ default n ++ diff --git a/target/linux/generic/hack-5.10/250-netfilter_depends.patch b/target/linux/generic/hack-5.10/250-netfilter_depends.patch new file mode 100644 index 0000000000..b27b440157 @@ -12056,12 +17416,195 @@ index 0000000000..4bb438295d + ifdef CONFIG_CPU_LITTLE_ENDIAN + KBUILD_CFLAGS += -mlittle-endian + KBUILD_LDFLAGS += -EL +diff --git a/target/linux/generic/hack-5.10/400-block-fit-partition-parser.patch b/target/linux/generic/hack-5.10/400-block-fit-partition-parser.patch +new file mode 100644 +index 0000000000..a414be6e84 +--- /dev/null ++++ b/target/linux/generic/hack-5.10/400-block-fit-partition-parser.patch +@@ -0,0 +1,177 @@ ++--- a/block/blk.h +++++ b/block/blk.h ++@@ -357,6 +357,7 @@ char *disk_name(struct gendisk *hd, int ++ #define ADDPART_FLAG_NONE 0 ++ #define ADDPART_FLAG_RAID 1 ++ #define ADDPART_FLAG_WHOLEDISK 2 +++#define ADDPART_FLAG_ROOTDEV 4 ++ void delete_partition(struct hd_struct *part); ++ int bdev_add_partition(struct block_device *bdev, int partno, ++ sector_t start, sector_t length); ++--- a/block/partitions/Kconfig +++++ b/block/partitions/Kconfig ++@@ -101,6 +101,13 @@ config ATARI_PARTITION ++ Say Y here if you would like to use hard disks under Linux which ++ were partitioned under the Atari OS. ++ +++config FIT_PARTITION +++ bool "Flattened-Image-Tree (FIT) partition support" if PARTITION_ADVANCED +++ default n +++ help +++ Say Y here if your system needs to mount the filesystem part of +++ a Flattened-Image-Tree (FIT) image commonly used with Das U-Boot. +++ ++ config IBM_PARTITION ++ bool "IBM disk label and partition support" ++ depends on PARTITION_ADVANCED && S390 ++--- a/block/partitions/Makefile +++++ b/block/partitions/Makefile ++@@ -8,6 +8,7 @@ obj-$(CONFIG_ACORN_PARTITION) += acorn.o ++ obj-$(CONFIG_AMIGA_PARTITION) += amiga.o ++ obj-$(CONFIG_ATARI_PARTITION) += atari.o ++ obj-$(CONFIG_AIX_PARTITION) += aix.o +++obj-$(CONFIG_FIT_PARTITION) += fit.o ++ obj-$(CONFIG_CMDLINE_PARTITION) += cmdline.o ++ obj-$(CONFIG_MAC_PARTITION) += mac.o ++ obj-$(CONFIG_LDM_PARTITION) += ldm.o ++--- a/block/partitions/check.h +++++ b/block/partitions/check.h ++@@ -58,6 +58,7 @@ int amiga_partition(struct parsed_partit ++ int atari_partition(struct parsed_partitions *state); ++ int cmdline_partition(struct parsed_partitions *state); ++ int efi_partition(struct parsed_partitions *state); +++int fit_partition(struct parsed_partitions *state); ++ int ibm_partition(struct parsed_partitions *); ++ int karma_partition(struct parsed_partitions *state); ++ int ldm_partition(struct parsed_partitions *state); ++@@ -68,3 +69,5 @@ int sgi_partition(struct parsed_partitio ++ int sun_partition(struct parsed_partitions *state); ++ int sysv68_partition(struct parsed_partitions *state); ++ int ultrix_partition(struct parsed_partitions *state); +++ +++int parse_fit_partitions(struct parsed_partitions *state, u64 start_sector, u64 nr_sectors, int *slot, int add_remain); ++--- a/block/partitions/core.c +++++ b/block/partitions/core.c ++@@ -10,6 +10,10 @@ ++ #include ++ #include ++ #include +++#ifdef CONFIG_FIT_PARTITION +++#include +++#endif +++ ++ #include "check.h" ++ ++ static int (*check_part[])(struct parsed_partitions *) = { ++@@ -46,6 +50,9 @@ static int (*check_part[])(struct parsed ++ #ifdef CONFIG_EFI_PARTITION ++ efi_partition, /* this must come before msdos */ ++ #endif +++#ifdef CONFIG_FIT_PARTITION +++ fit_partition, +++#endif ++ #ifdef CONFIG_SGI_PARTITION ++ sgi_partition, ++ #endif ++@@ -215,6 +222,18 @@ static ssize_t part_discard_alignment_sh ++ p->start_sect)); ++ } ++ +++static ssize_t part_name_show(struct device *dev, +++ struct device_attribute *attr, char *buf) +++{ +++ struct hd_struct *p = dev_to_part(dev); +++ +++ if (p->info && p->info->volname) +++ return sprintf(buf, "%s\n", p->info->volname); +++ +++ buf[0] = '\0'; +++ return 0; +++} +++ ++ static DEVICE_ATTR(partition, 0444, part_partition_show, NULL); ++ static DEVICE_ATTR(start, 0444, part_start_show, NULL); ++ static DEVICE_ATTR(size, 0444, part_size_show, NULL); ++@@ -223,6 +242,7 @@ static DEVICE_ATTR(alignment_offset, 044 ++ static DEVICE_ATTR(discard_alignment, 0444, part_discard_alignment_show, NULL); ++ static DEVICE_ATTR(stat, 0444, part_stat_show, NULL); ++ static DEVICE_ATTR(inflight, 0444, part_inflight_show, NULL); +++static DEVICE_ATTR(name, 0444, part_name_show, NULL); ++ #ifdef CONFIG_FAIL_MAKE_REQUEST ++ static struct device_attribute dev_attr_fail = ++ __ATTR(make-it-fail, 0644, part_fail_show, part_fail_store); ++@@ -237,6 +257,7 @@ static struct attribute *part_attrs[] = ++ &dev_attr_discard_alignment.attr, ++ &dev_attr_stat.attr, ++ &dev_attr_inflight.attr, +++ &dev_attr_name.attr, ++ #ifdef CONFIG_FAIL_MAKE_REQUEST ++ &dev_attr_fail.attr, ++ #endif ++@@ -694,6 +715,11 @@ static bool blk_add_partition(struct gen ++ (state->parts[p].flags & ADDPART_FLAG_RAID)) ++ md_autodetect_dev(part_to_dev(part)->devt); ++ +++#ifdef CONFIG_FIT_PARTITION +++ if ((state->parts[p].flags & ADDPART_FLAG_ROOTDEV) && ROOT_DEV == 0) +++ ROOT_DEV = part_to_dev(part)->devt; +++#endif +++ ++ return true; ++ } ++ ++--- a/drivers/mtd/ubi/block.c +++++ b/drivers/mtd/ubi/block.c ++@@ -396,7 +396,7 @@ int ubiblock_create(struct ubi_volume_in ++ dev->leb_size = vi->usable_leb_size; ++ ++ /* Initialize the gendisk of this ubiblock device */ ++- gd = alloc_disk(1); +++ gd = alloc_disk(0); ++ if (!gd) { ++ pr_err("UBI: block: alloc_disk failed\n"); ++ ret = -ENODEV; ++@@ -413,6 +413,7 @@ int ubiblock_create(struct ubi_volume_in ++ goto out_put_disk; ++ } ++ gd->private_data = dev; +++ gd->flags |= GENHD_FL_EXT_DEVT; ++ sprintf(gd->disk_name, "ubiblock%d_%d", dev->ubi_num, dev->vol_id); ++ set_capacity(gd, disk_capacity); ++ dev->gd = gd; ++--- a/block/partitions/efi.c +++++ b/block/partitions/efi.c ++@@ -706,6 +706,9 @@ int efi_partition(struct parsed_partitio ++ gpt_entry *ptes = NULL; ++ u32 i; ++ unsigned ssz = bdev_logical_block_size(state->bdev) / 512; +++#ifdef CONFIG_FIT_PARTITION +++ u32 extra_slot = 64; +++#endif ++ ++ if (!find_valid_gpt(state, &gpt, &ptes) || !gpt || !ptes) { ++ kfree(gpt); ++@@ -739,6 +742,11 @@ int efi_partition(struct parsed_partitio ++ ARRAY_SIZE(ptes[i].partition_name)); ++ utf16_le_to_7bit(ptes[i].partition_name, label_max, info->volname); ++ state->parts[i + 1].has_info = true; +++#ifdef CONFIG_FIT_PARTITION +++ /* If this is a U-Boot FIT volume it may have subpartitions */ +++ if (!efi_guidcmp(ptes[i].partition_type_guid, PARTITION_LINUX_FIT_GUID)) +++ (void) parse_fit_partitions(state, start * ssz, size * ssz, &extra_slot, 1); +++#endif ++ } ++ kfree(ptes); ++ kfree(gpt); ++--- a/block/partitions/efi.h +++++ b/block/partitions/efi.h ++@@ -52,6 +52,9 @@ ++ #define PARTITION_LINUX_LVM_GUID \ ++ EFI_GUID( 0xe6d6d379, 0xf507, 0x44c2, \ ++ 0xa2, 0x3c, 0x23, 0x8f, 0x2a, 0x3d, 0xf9, 0x28) +++#define PARTITION_LINUX_FIT_GUID \ +++ EFI_GUID( 0xcae9be83, 0xb15f, 0x49cc, \ +++ 0x86, 0x3f, 0x08, 0x1b, 0x74, 0x4a, 0x2d, 0x93) ++ ++ typedef struct _gpt_header { ++ __le64 signature; diff --git a/target/linux/generic/hack-5.10/531-debloat_lzma.patch b/target/linux/generic/hack-5.10/531-debloat_lzma.patch new file mode 100644 -index 0000000000..0854872ffa +index 0000000000..2f70eee3e9 --- /dev/null +++ b/target/linux/generic/hack-5.10/531-debloat_lzma.patch -@@ -0,0 +1,1037 @@ +@@ -0,0 +1,1040 @@ +From 3fd297761ac246c54d7723c57fca95c112b99465 Mon Sep 17 00:00:00 2001 +From: Felix Fietkau +Date: Sat, 15 Jul 2017 21:15:44 +0200 @@ -12774,26 +18317,26 @@ index 0000000000..0854872ffa + { + UInt32 dicSize; + Byte d; -+@@ -935,33 +883,11 @@ static SRes LzmaDec_AllocateProbs2(CLzma ++@@ -935,7 +883,7 @@ static SRes LzmaDec_AllocateProbs2(CLzma + return SZ_OK; + } + +-SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) -+-{ -+- CLzmaProps propNew; -+- RINOK(LzmaProps_Decode(&propNew, props, propsSize)); -+- RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); -+- p->prop = propNew; -+- return SZ_OK; -+-} -+- -+-SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) ++static SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) + { + CLzmaProps propNew; -+- SizeT dicBufSize; + RINOK(LzmaProps_Decode(&propNew, props, propsSize)); -+ RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); ++@@ -943,28 +891,6 @@ SRes LzmaDec_AllocateProbs(CLzmaDec *p, ++ p->prop = propNew; ++ return SZ_OK; ++ } ++- ++-SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) ++-{ ++- CLzmaProps propNew; ++- SizeT dicBufSize; ++- RINOK(LzmaProps_Decode(&propNew, props, propsSize)); ++- RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); +- dicBufSize = propNew.dicSize; +- if (p->dic == 0 || dicBufSize != p->dicBufSize) +- { @@ -12806,9 +18349,12 @@ index 0000000000..0854872ffa +- } +- } +- p->dicBufSize = dicBufSize; -+ p->prop = propNew; -+ return SZ_OK; -+ } ++- p->prop = propNew; ++- return SZ_OK; ++-} ++ ++ SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ++ const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, +--- a/lib/lzma/LzmaEnc.c ++++ b/lib/lzma/LzmaEnc.c +@@ -53,7 +53,7 @@ void LzmaEncProps_Init(CLzmaEncProps *p) @@ -13405,15 +18951,15 @@ index 0000000000..2d3fe01a75 + } + }; + -diff --git a/target/linux/generic/hack-5.10/650-netfilter-add-xt_OFFLOAD-target.patch b/target/linux/generic/hack-5.10/650-netfilter-add-xt_OFFLOAD-target.patch +diff --git a/target/linux/generic/hack-5.10/650-netfilter-add-xt_FLOWOFFLOAD-target.patch b/target/linux/generic/hack-5.10/650-netfilter-add-xt_FLOWOFFLOAD-target.patch new file mode 100644 -index 0000000000..eb540acc85 +index 0000000000..97aa7a673b --- /dev/null -+++ b/target/linux/generic/hack-5.10/650-netfilter-add-xt_OFFLOAD-target.patch -@@ -0,0 +1,822 @@ ++++ b/target/linux/generic/hack-5.10/650-netfilter-add-xt_FLOWOFFLOAD-target.patch +@@ -0,0 +1,820 @@ +From: Felix Fietkau +Date: Tue, 20 Feb 2018 15:56:02 +0100 -+Subject: [PATCH] netfilter: add xt_OFFLOAD target ++Subject: [PATCH] netfilter: add xt_FLOWOFFLOAD target + +Signed-off-by: Felix Fietkau +--- @@ -13511,7 +19057,7 @@ index 0000000000..eb540acc85 + obj-$(CONFIG_NETFILTER_XT_TARGET_LED) += xt_LED.o +--- /dev/null ++++ b/net/netfilter/xt_FLOWOFFLOAD.c -+@@ -0,0 +1,660 @@ ++@@ -0,0 +1,658 @@ ++/* ++ * Copyright (C) 2018-2021 Felix Fietkau ++ * @@ -13678,20 +19224,14 @@ index 0000000000..eb540acc85 ++xt_flowoffload_check_hook(struct flow_offload *flow, void *data) ++{ ++ struct xt_flowoffload_table *table = data; -++ struct flow_offload_tuple *tuple = &flow->tuplehash[0].tuple; +++ struct flow_offload_tuple *tuple0 = &flow->tuplehash[0].tuple; +++ struct flow_offload_tuple *tuple1 = &flow->tuplehash[1].tuple; ++ struct xt_flowoffload_hook *hook; ++ ++ spin_lock_bh(&hooks_lock); ++ hlist_for_each_entry(hook, &table->hooks, list) { -++ int ifindex; -++ -++ if (tuple->xmit_type == FLOW_OFFLOAD_XMIT_DIRECT) -++ ifindex = tuple->out.ifidx; -++ else -++ ifindex = tuple->dst_cache->dev->ifindex; -++ -++ if (hook->ops.dev->ifindex != tuple->iifidx && -++ hook->ops.dev->ifindex != ifindex) +++ if (hook->ops.dev->ifindex != tuple0->iifidx && +++ hook->ops.dev->ifindex != tuple1->iifidx) ++ continue; ++ ++ hook->used = true; @@ -13770,6 +19310,7 @@ index 0000000000..eb540acc85 ++ int i; ++ ++ route->tuple[!dir].in.ifindex = dev->ifindex; +++ route->tuple[dir].out.ifindex = dev->ifindex; ++ ++ if (route->tuple[dir].xmit_type == FLOW_OFFLOAD_XMIT_XFRM) ++ return; @@ -13799,52 +19340,54 @@ index 0000000000..eb540acc85 ++ prev_type = DEV_PATH_ETHERNET; ++ for (i = 0; i <= stack.num_paths; i++) { ++ const struct net_device_path *path = &stack.path[i]; -++ int n_vlans = route->tuple[!dir].in.num_vlans; +++ int n_encaps = route->tuple[!dir].in.num_encaps; ++ ++ dev = (struct net_device *)path->dev; ++ if (flow_is_valid_ether_device(dev)) { -++ if (route->tuple[dir].xmit_type != FLOW_OFFLOAD_XMIT_DIRECT) +++ if (route->tuple[dir].xmit_type != FLOW_OFFLOAD_XMIT_DIRECT) { ++ memcpy(route->tuple[dir].out.h_source, ++ dev->dev_addr, ETH_ALEN); +++ route->tuple[dir].out.ifindex = dev->ifindex; +++ } ++ route->tuple[dir].xmit_type = FLOW_OFFLOAD_XMIT_DIRECT; -++ route->tuple[dir].out.ifindex = dev->ifindex; ++ } ++ ++ switch (path->type) { +++ case DEV_PATH_PPPOE: ++ case DEV_PATH_VLAN: -++ if (n_vlans >= NF_FLOW_TABLE_VLAN_MAX || +++ if (n_encaps >= NF_FLOW_TABLE_ENCAP_MAX || ++ i == stack.num_paths) { ++ last = true; ++ break; ++ } ++ -++ route->tuple[!dir].in.num_vlans++; -++ route->tuple[!dir].in.vid[n_vlans] = path->vlan.id; -++ route->tuple[!dir].in.vproto[n_vlans] = path->vlan.proto; +++ route->tuple[!dir].in.num_encaps++; +++ route->tuple[!dir].in.encap[n_encaps].id = path->encap.id; +++ route->tuple[!dir].in.encap[n_encaps].proto = path->encap.proto; +++ if (path->type == DEV_PATH_PPPOE) +++ memcpy(route->tuple[dir].out.h_dest, +++ path->encap.h_dest, ETH_ALEN); ++ break; ++ case DEV_PATH_BRIDGE: ++ switch (path->bridge.vlan_mode) { ++ case DEV_PATH_BR_VLAN_TAG: -++ if (n_vlans >= NF_FLOW_TABLE_VLAN_MAX || +++ if (n_encaps >= NF_FLOW_TABLE_ENCAP_MAX || ++ i == stack.num_paths) { ++ last = true; ++ break; ++ } ++ -++ route->tuple[!dir].in.num_vlans++; -++ route->tuple[!dir].in.vid[n_vlans] = +++ route->tuple[!dir].in.num_encaps++; +++ route->tuple[!dir].in.encap[n_encaps].id = ++ path->bridge.vlan_id; -++ route->tuple[!dir].in.vproto[n_vlans] = +++ route->tuple[!dir].in.encap[n_encaps].proto = ++ path->bridge.vlan_proto; ++ break; -++ case DEV_PATH_BR_VLAN_UNTAG_HW: -++ route->tuple[!dir].in.pvid.id = -++ route->tuple[!dir].in.vid[n_vlans - 1]; -++ route->tuple[!dir].in.pvid.proto = -++ route->tuple[!dir].in.vproto[n_vlans - 1]; -++ fallthrough; ++ case DEV_PATH_BR_VLAN_UNTAG: -++ route->tuple[!dir].in.num_vlans--; +++ route->tuple[!dir].in.num_encaps--; +++ break; +++ case DEV_PATH_BR_VLAN_UNTAG_HW: +++ route->tuple[!dir].in.ingress_vlans |= BIT(n_encaps - 1); ++ break; ++ case DEV_PATH_BR_VLAN_KEEP: ++ break; @@ -13860,6 +19403,7 @@ index 0000000000..eb540acc85 ++ } ++ ++ *out_dev = dev; +++ route->tuple[dir].out.hw_ifindex = dev->ifindex; ++ route->tuple[!dir].in.ifindex = dev->ifindex; ++} ++ @@ -14182,7 +19726,7 @@ index 0000000000..eb540acc85 + #include + #include + #include -+@@ -355,8 +354,7 @@ flow_offload_lookup(struct nf_flowtable ++@@ -356,8 +355,7 @@ flow_offload_lookup(struct nf_flowtable + } + EXPORT_SYMBOL_GPL(flow_offload_lookup); + @@ -14192,7 +19736,7 @@ index 0000000000..eb540acc85 + void (*iter)(struct flow_offload *flow, void *data), + void *data) + { -+@@ -388,6 +386,7 @@ nf_flow_table_iterate(struct nf_flowtabl ++@@ -389,6 +387,7 @@ nf_flow_table_iterate(struct nf_flowtabl + + return err; + } @@ -14222,7 +19766,7 @@ index 0000000000..eb540acc85 ++#endif /* _XT_FLOWOFFLOAD_H */ +--- a/include/net/netfilter/nf_flow_table.h ++++ b/include/net/netfilter/nf_flow_table.h -+@@ -265,6 +265,10 @@ void nf_flow_table_free(struct nf_flowta ++@@ -266,6 +266,10 @@ void nf_flow_table_free(struct nf_flowta + + void flow_offload_teardown(struct flow_offload *flow); + @@ -14537,6 +20081,48 @@ index 0000000000..560937a7c1 + /* only used by MMAP'd driver */ + unsigned big_endian:1; + void __iomem *regs; +diff --git a/target/linux/generic/hack-5.10/710-net-dsa-mv88e6xxx-default-VID-1.patch b/target/linux/generic/hack-5.10/710-net-dsa-mv88e6xxx-default-VID-1.patch +new file mode 100644 +index 0000000000..f301cc1e2d +--- /dev/null ++++ b/target/linux/generic/hack-5.10/710-net-dsa-mv88e6xxx-default-VID-1.patch +@@ -0,0 +1,18 @@ ++--- a/drivers/net/dsa/mv88e6xxx/chip.c +++++ b/drivers/net/dsa/mv88e6xxx/chip.c ++@@ -2088,6 +2088,7 @@ static int mv88e6xxx_port_fdb_add(struct ++ struct mv88e6xxx_chip *chip = ds->priv; ++ int err; ++ +++ vid = vid ? : 1; ++ mv88e6xxx_reg_lock(chip); ++ err = mv88e6xxx_port_db_load_purge(chip, port, addr, vid, ++ MV88E6XXX_G1_ATU_DATA_STATE_UC_STATIC); ++@@ -2102,6 +2103,7 @@ static int mv88e6xxx_port_fdb_del(struct ++ struct mv88e6xxx_chip *chip = ds->priv; ++ int err; ++ +++ vid = vid ? : 1; ++ mv88e6xxx_reg_lock(chip); ++ err = mv88e6xxx_port_db_load_purge(chip, port, addr, vid, 0); ++ mv88e6xxx_reg_unlock(chip); +diff --git a/target/linux/generic/hack-5.10/711-net-dsa-mv88e6xxx-disable-ATU-violation.patch b/target/linux/generic/hack-5.10/711-net-dsa-mv88e6xxx-disable-ATU-violation.patch +new file mode 100644 +index 0000000000..46a1ba1d96 +--- /dev/null ++++ b/target/linux/generic/hack-5.10/711-net-dsa-mv88e6xxx-disable-ATU-violation.patch +@@ -0,0 +1,12 @@ ++--- a/drivers/net/dsa/mv88e6xxx/chip.c +++++ b/drivers/net/dsa/mv88e6xxx/chip.c ++@@ -2650,6 +2650,9 @@ static int mv88e6xxx_setup_port(struct m ++ if (dsa_is_cpu_port(ds, port)) ++ reg = 0; ++ +++ /* Disable ATU member violation interrupt */ +++ reg |= MV88E6XXX_PORT_ASSOC_VECTOR_IGNORE_WRONG; +++ ++ err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_ASSOC_VECTOR, ++ reg); ++ if (err) diff --git a/target/linux/generic/hack-5.10/773-bgmac-add-srab-switch.patch b/target/linux/generic/hack-5.10/773-bgmac-add-srab-switch.patch new file mode 100644 index 0000000000..1c1b727ab7 @@ -14811,7 +20397,7 @@ index 0000000000..fc2a0a4862 + Support for UNIX socket monitoring interface used by the ss tool. diff --git a/target/linux/generic/hack-5.10/902-debloat_proc.patch b/target/linux/generic/hack-5.10/902-debloat_proc.patch new file mode 100644 -index 0000000000..5a6d7d058e +index 0000000000..3208e5554f --- /dev/null +++ b/target/linux/generic/hack-5.10/902-debloat_proc.patch @@ -0,0 +1,408 @@ @@ -14846,7 +20432,7 @@ index 0000000000..5a6d7d058e + +--- a/fs/locks.c ++++ b/fs/locks.c -+@@ -2996,6 +2996,8 @@ static const struct seq_operations locks ++@@ -2993,6 +2993,8 @@ static const struct seq_operations locks + + static int __init proc_locks_init(void) + { @@ -15225,7 +20811,7 @@ index 0000000000..5a6d7d058e + diff --git a/target/linux/generic/hack-5.10/904-debloat_dma_buf.patch b/target/linux/generic/hack-5.10/904-debloat_dma_buf.patch new file mode 100644 -index 0000000000..3c5af9d666 +index 0000000000..2f5f685063 --- /dev/null +++ b/target/linux/generic/hack-5.10/904-debloat_dma_buf.patch @@ -0,0 +1,82 @@ @@ -15293,7 +20879,7 @@ index 0000000000..3c5af9d666 ++MODULE_LICENSE("GPL"); +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c -+@@ -3054,6 +3054,7 @@ int wake_up_state(struct task_struct *p, ++@@ -3051,6 +3051,7 @@ int wake_up_state(struct task_struct *p, + { + return try_to_wake_up(p, state, 0); + } @@ -15529,94 +21115,51 @@ index 0000000000..cc9f99e8b0 + *frame_size = -ip->i_format.simmediate; + return 1; + } -diff --git a/target/linux/generic/pending-5.10/110-ehci_hcd_ignore_oc.patch b/target/linux/generic/pending-5.10/110-ehci_hcd_ignore_oc.patch +diff --git a/target/linux/generic/pending-5.10/103-MIPS-select-CPU_MIPS64-for-remaining-MIPS64-CPUs.patch b/target/linux/generic/pending-5.10/103-MIPS-select-CPU_MIPS64-for-remaining-MIPS64-CPUs.patch new file mode 100644 -index 0000000000..138d4fa1c5 +index 0000000000..cf79e9a449 --- /dev/null -+++ b/target/linux/generic/pending-5.10/110-ehci_hcd_ignore_oc.patch -@@ -0,0 +1,79 @@ -+From: Florian Fainelli -+Subject: USB: EHCI: add ignore_oc flag to disable overcurrent checking ++++ b/target/linux/generic/pending-5.10/103-MIPS-select-CPU_MIPS64-for-remaining-MIPS64-CPUs.patch +@@ -0,0 +1,36 @@ ++From 6523061868212473f63812a0c477a161742bed42 Mon Sep 17 00:00:00 2001 ++From: "Jason A. Donenfeld" ++Date: Sat, 27 Feb 2021 13:20:24 +0100 ++Subject: [PATCH] MIPS: select CPU_MIPS64 for remaining MIPS64 CPUs + -+This patch adds an ignore_oc flag which can be set by EHCI controller -+not supporting or wanting to disable overcurrent checking. The EHCI -+platform data in include/linux/usb/ehci_pdriver.h is also augmented to -+take advantage of this new flag. ++The CPU_MIPS64 and CPU_MIPS32 variables are supposed to be able to ++distinguish broadly between 64-bit and 32-bit MIPS CPUs. However, they ++weren't selected by the specialty CPUs, Octeon and Loongson, which meant ++it was possible to hit a weird state of: + -+Signed-off-by: Florian Fainelli ++ MIPS=y, CONFIG_64BIT=y, CPU_MIPS64=n ++ ++This commit rectifies the issue by having CPU_MIPS64 be selected when ++the missing Octeon or Loongson models are selected. ++ ++Cc: Thomas Bogendoerfer ++Cc: Ralf Baechle ++Cc: George Cherian ++Cc: Huacai Chen ++Cc: Jiaxun Yang ++Signed-off-by: Jason A. Donenfeld +--- -+ drivers/usb/host/ehci-hcd.c | 2 +- -+ drivers/usb/host/ehci-hub.c | 4 ++-- -+ drivers/usb/host/ehci-platform.c | 1 + -+ drivers/usb/host/ehci.h | 1 + -+ include/linux/usb/ehci_pdriver.h | 1 + -+ 5 files changed, 6 insertions(+), 3 deletions(-) ++ arch/mips/Kconfig | 2 +- ++ 1 file changed, 1 insertion(+), 1 deletion(-) + -+--- a/drivers/usb/host/ehci-hcd.c -++++ b/drivers/usb/host/ehci-hcd.c -+@@ -651,7 +651,7 @@ static int ehci_run (struct usb_hcd *hcd -+ "USB %x.%x started, EHCI %x.%02x%s\n", -+ ((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f), -+ temp >> 8, temp & 0xff, -+- ignore_oc ? ", overcurrent ignored" : ""); -++ (ignore_oc || ehci->ignore_oc) ? ", overcurrent ignored" : ""); ++--- a/arch/mips/Kconfig +++++ b/arch/mips/Kconfig ++@@ -2075,7 +2075,7 @@ config CPU_MIPS32 ++ config CPU_MIPS64 ++ bool ++ default y if CPU_MIPS64_R1 || CPU_MIPS64_R2 || CPU_MIPS64_R5 || \ ++- CPU_MIPS64_R6 +++ CPU_MIPS64_R6 || CPU_LOONGSON64 || CPU_CAVIUM_OCTEON + -+ ehci_writel(ehci, INTR_MASK, -+ &ehci->regs->intr_enable); /* Turn On Interrupts */ -+--- a/drivers/usb/host/ehci-hub.c -++++ b/drivers/usb/host/ehci-hub.c -+@@ -643,7 +643,7 @@ ehci_hub_status_data (struct usb_hcd *hc -+ * always set, seem to clear PORT_OCC and PORT_CSC when writing to -+ * PORT_POWER; that's surprising, but maybe within-spec. -+ */ -+- if (!ignore_oc) -++ if (!ignore_oc && !ehci->ignore_oc) -+ mask = PORT_CSC | PORT_PEC | PORT_OCC; -+ else -+ mask = PORT_CSC | PORT_PEC; -+@@ -1013,7 +1013,7 @@ int ehci_hub_control( -+ if (temp & PORT_PEC) -+ status |= USB_PORT_STAT_C_ENABLE << 16; -+ -+- if ((temp & PORT_OCC) && !ignore_oc){ -++ if ((temp & PORT_OCC) && (!ignore_oc && !ehci->ignore_oc)){ -+ status |= USB_PORT_STAT_C_OVERCURRENT << 16; -+ -+ /* -+--- a/drivers/usb/host/ehci-platform.c -++++ b/drivers/usb/host/ehci-platform.c -+@@ -327,6 +327,8 @@ static int ehci_platform_probe(struct pl -+ hcd->has_tt = 1; -+ if (pdata->reset_on_resume) -+ priv->reset_on_resume = true; -++ if (pdata->ignore_oc) -++ ehci->ignore_oc = 1; -+ -+ #ifndef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO -+ if (ehci->big_endian_mmio) { -+--- a/drivers/usb/host/ehci.h -++++ b/drivers/usb/host/ehci.h -+@@ -218,6 +218,7 @@ struct ehci_hcd { /* one per controlle -+ unsigned frame_index_bug:1; /* MosChip (AKA NetMos) */ -+ unsigned need_oc_pp_cycle:1; /* MPC834X port power */ -+ unsigned imx28_write_fix:1; /* For Freescale i.MX28 */ -++ unsigned ignore_oc:1; -+ -+ /* required for usb32 quirk */ -+ #define OHCI_CTRL_HCFS (3 << 6) -+--- a/include/linux/usb/ehci_pdriver.h -++++ b/include/linux/usb/ehci_pdriver.h -+@@ -50,6 +50,7 @@ struct usb_ehci_pdata { -+ unsigned no_io_watchdog:1; -+ unsigned reset_on_resume:1; -+ unsigned dma_mask_64:1; -++ unsigned ignore_oc:1; -+ -+ /* Turn on all power and clocks */ -+ int (*power_on)(struct platform_device *pdev); ++ # ++ # These indicate the revision of the architecture diff --git a/target/linux/generic/pending-5.10/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch b/target/linux/generic/pending-5.10/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch new file mode 100644 -index 0000000000..4e83b98724 +index 0000000000..4375e727cf --- /dev/null +++ b/target/linux/generic/pending-5.10/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch @@ -0,0 +1,82 @@ @@ -15693,7 +21236,7 @@ index 0000000000..4e83b98724 + +--- a/mm/page_alloc.c ++++ b/mm/page_alloc.c -+@@ -6951,7 +6951,7 @@ static void __ref alloc_node_mem_map(str ++@@ -7027,7 +7027,7 @@ static void __ref alloc_node_mem_map(str + if (pgdat == NODE_DATA(0)) { + mem_map = NODE_DATA(0)->node_mem_map; + if (page_to_pfn(mem_map) != pgdat->node_start_pfn) @@ -16144,7 +21687,7 @@ index 0000000000..7e9d0e66c0 + exit: diff --git a/target/linux/generic/pending-5.10/201-extra_optimization.patch b/target/linux/generic/pending-5.10/201-extra_optimization.patch new file mode 100644 -index 0000000000..53486680a2 +index 0000000000..df973258ab --- /dev/null +++ b/target/linux/generic/pending-5.10/201-extra_optimization.patch @@ -0,0 +1,31 @@ @@ -16164,7 +21707,7 @@ index 0000000000..53486680a2 + +--- a/Makefile ++++ b/Makefile -+@@ -733,11 +733,11 @@ KBUILD_CFLAGS += $(call cc-disable-warni ++@@ -734,11 +734,11 @@ KBUILD_CFLAGS += $(call cc-disable-warni + KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) + + ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE @@ -16181,7 +21724,7 @@ index 0000000000..53486680a2 + # Tell gcc to never replace conditional load with a non-conditional one diff --git a/target/linux/generic/pending-5.10/203-kallsyms_uncompressed.patch b/target/linux/generic/pending-5.10/203-kallsyms_uncompressed.patch new file mode 100644 -index 0000000000..35d0333ad5 +index 0000000000..9f2014c8ec --- /dev/null +++ b/target/linux/generic/pending-5.10/203-kallsyms_uncompressed.patch @@ -0,0 +1,119 @@ @@ -16200,7 +21743,7 @@ index 0000000000..35d0333ad5 + +--- a/init/Kconfig ++++ b/init/Kconfig -+@@ -1384,6 +1384,17 @@ config SYSCTL_ARCH_UNALIGN_ALLOW ++@@ -1385,6 +1385,17 @@ config SYSCTL_ARCH_UNALIGN_ALLOW + the unaligned access emulation. + see arch/parisc/kernel/unaligned.c for reference + @@ -16252,7 +21795,7 @@ index 0000000000..35d0333ad5 + static int absolute_percpu; + static int base_relative; + -+@@ -480,6 +481,9 @@ static void write_src(void) ++@@ -486,6 +487,9 @@ static void write_src(void) + + free(markers); + @@ -16262,7 +21805,7 @@ index 0000000000..35d0333ad5 + output_label("kallsyms_token_table"); + off = 0; + for (i = 0; i < 256; i++) { -+@@ -531,6 +535,9 @@ static unsigned char *find_token(unsigne ++@@ -537,6 +541,9 @@ static unsigned char *find_token(unsigne + { + int i; + @@ -16272,7 +21815,7 @@ index 0000000000..35d0333ad5 + for (i = 0; i < len - 1; i++) { + if (str[i] == token[0] && str[i+1] == token[1]) + return &str[i]; -+@@ -603,6 +610,9 @@ static void optimize_result(void) ++@@ -609,6 +616,9 @@ static void optimize_result(void) + { + int i, best; + @@ -16282,7 +21825,7 @@ index 0000000000..35d0333ad5 + /* using the '\0' symbol last allows compress_symbols to use standard + * fast string functions */ + for (i = 255; i >= 0; i--) { -+@@ -767,6 +777,8 @@ int main(int argc, char **argv) ++@@ -773,6 +783,8 @@ int main(int argc, char **argv) + absolute_percpu = 1; + else if (strcmp(argv[i], "--base-relative") == 0) + base_relative = 1; @@ -16928,7 +22471,7 @@ index 0000000000..e1ada22f34 + #endif /* CONFIG_32BIT */ diff --git a/target/linux/generic/pending-5.10/308-mips32r2_tune.patch b/target/linux/generic/pending-5.10/308-mips32r2_tune.patch new file mode 100644 -index 0000000000..54c0e01023 +index 0000000000..bbea947382 --- /dev/null +++ b/target/linux/generic/pending-5.10/308-mips32r2_tune.patch @@ -0,0 +1,22 @@ @@ -16945,7 +22488,7 @@ index 0000000000..54c0e01023 + +--- a/arch/mips/Makefile ++++ b/arch/mips/Makefile -+@@ -155,7 +155,7 @@ cflags-$(CONFIG_CPU_VR41XX) += -march=r4 ++@@ -174,7 +174,7 @@ cflags-$(CONFIG_CPU_VR41XX) += -march=r4 + cflags-$(CONFIG_CPU_R4X00) += -march=r4600 -Wa,--trap + cflags-$(CONFIG_CPU_TX49XX) += -march=r4600 -Wa,--trap + cflags-$(CONFIG_CPU_MIPS32_R1) += -march=mips32 -Wa,--trap @@ -17172,7 +22715,7 @@ index 0000000000..3f8808f702 + /* End of data section */ diff --git a/target/linux/generic/pending-5.10/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch b/target/linux/generic/pending-5.10/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch new file mode 100644 -index 0000000000..5a0e44b76b +index 0000000000..2808c95322 --- /dev/null +++ b/target/linux/generic/pending-5.10/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch @@ -0,0 +1,281 @@ @@ -17445,16 +22988,16 @@ index 0000000000..5a0e44b76b ++ EXPORT(kexec_argv_buf) ++ .skip KEXEC_COMMAND_LINE_SIZE ++ .size kexec_argv_buf, KEXEC_COMMAND_LINE_SIZE +++ +++kexec_argv: +++ EXPORT(kexec_argv) +++ .skip KEXEC_ARGV_SIZE +++ .size kexec_argv, KEXEC_ARGV_SIZE + +-relocate_new_kernel_size: +- EXPORT(relocate_new_kernel_size) +- PTR relocate_new_kernel_end - relocate_new_kernel +- .size relocate_new_kernel_size, PTRSIZE -++kexec_argv: -++ EXPORT(kexec_argv) -++ .skip KEXEC_ARGV_SIZE -++ .size kexec_argv, KEXEC_ARGV_SIZE -++ ++kexec_relocate_new_kernel_end: ++ EXPORT(kexec_relocate_new_kernel_end) diff --git a/target/linux/generic/pending-5.10/332-arc-add-OWRTDTB-section.patch b/target/linux/generic/pending-5.10/332-arc-add-OWRTDTB-section.patch @@ -18004,7 +23547,7 @@ index 0000000000..a2cf838989 + kfree(tmp_fl); diff --git a/target/linux/generic/pending-5.10/430-mtd-add-myloader-partition-parser.patch b/target/linux/generic/pending-5.10/430-mtd-add-myloader-partition-parser.patch new file mode 100644 -index 0000000000..5c00612d03 +index 0000000000..0889c9a343 --- /dev/null +++ b/target/linux/generic/pending-5.10/430-mtd-add-myloader-partition-parser.patch @@ -0,0 +1,229 @@ @@ -18051,8 +23594,8 @@ index 0000000000..5c00612d03 + obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o ++obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o + obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o -+ obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o -+ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o ++ ofpart-y += ofpart_core.o ++ ofpart-$(CONFIG_MTD_OF_PARTS_BCM4908) += ofpart_bcm4908.o +--- /dev/null ++++ b/drivers/mtd/parsers/myloader.c +@@ -0,0 +1,181 @@ @@ -18356,7 +23899,7 @@ index 0000000000..852654d924 + if (buf[0x000 / 4] == TRX_MAGIC) { diff --git a/target/linux/generic/pending-5.10/435-mtd-add-routerbootpart-parser-config.patch b/target/linux/generic/pending-5.10/435-mtd-add-routerbootpart-parser-config.patch new file mode 100644 -index 0000000000..1523e757c7 +index 0000000000..ab1e09a5f1 --- /dev/null +++ b/target/linux/generic/pending-5.10/435-mtd-add-routerbootpart-parser-config.patch @@ -0,0 +1,38 @@ @@ -18378,7 +23921,7 @@ index 0000000000..1523e757c7 + +--- a/drivers/mtd/parsers/Kconfig ++++ b/drivers/mtd/parsers/Kconfig -+@@ -176,3 +176,12 @@ config MTD_REDBOOT_PARTS_READONLY ++@@ -195,3 +195,12 @@ config MTD_REDBOOT_PARTS_READONLY + 'FIS directory' images, enable this option. + + endif # MTD_REDBOOT_PARTS @@ -18393,7 +23936,7 @@ index 0000000000..1523e757c7 ++ formatted DTS. +--- a/drivers/mtd/parsers/Makefile ++++ b/drivers/mtd/parsers/Makefile -+@@ -10,3 +10,4 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o ++@@ -13,3 +13,4 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o + obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o + obj-$(CONFIG_MTD_SHARPSL_PARTS) += sharpslpart.o + obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o @@ -18478,7 +24021,7 @@ index 0000000000..e9a9cad869 + static const struct spi_nor_fixups macronix_fixups = { diff --git a/target/linux/generic/pending-5.10/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch b/target/linux/generic/pending-5.10/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch new file mode 100644 -index 0000000000..bbdab18102 +index 0000000000..d000094e1d --- /dev/null +++ b/target/linux/generic/pending-5.10/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch @@ -0,0 +1,71 @@ @@ -18523,7 +24066,7 @@ index 0000000000..bbdab18102 + endif # MTD_SPI_NOR +--- a/drivers/mtd/spi-nor/core.c ++++ b/drivers/mtd/spi-nor/core.c -+@@ -2784,6 +2784,21 @@ static void spi_nor_info_init_params(str ++@@ -2786,6 +2786,21 @@ static void spi_nor_info_init_params(str + */ + erase_mask = 0; + i = 0; @@ -18545,7 +24088,7 @@ index 0000000000..bbdab18102 + if (info->flags & SECT_4K_PMC) { + erase_mask |= BIT(i); + spi_nor_set_erase_type(&map->erase_type[i], 4096u, -+@@ -2795,6 +2810,7 @@ static void spi_nor_info_init_params(str ++@@ -2797,6 +2812,7 @@ static void spi_nor_info_init_params(str + SPINOR_OP_BE_4K); + i++; + } @@ -18579,7 +24122,7 @@ index 0000000000..325fca62f3 + { "en25qh16", INFO(0x1c7015, 0, 64 * 1024, 32, diff --git a/target/linux/generic/pending-5.10/479-mtd-spi-nor-add-xtx-xt25f128b.patch b/target/linux/generic/pending-5.10/479-mtd-spi-nor-add-xtx-xt25f128b.patch new file mode 100644 -index 0000000000..3e7cd03679 +index 0000000000..9ff6ffae58 --- /dev/null +++ b/target/linux/generic/pending-5.10/479-mtd-spi-nor-add-xtx-xt25f128b.patch @@ -0,0 +1,79 @@ @@ -18644,7 +24187,7 @@ index 0000000000..3e7cd03679 ++}; +--- a/drivers/mtd/spi-nor/core.c ++++ b/drivers/mtd/spi-nor/core.c -+@@ -2024,6 +2024,7 @@ static const struct spi_nor_manufacturer ++@@ -2026,6 +2026,7 @@ static const struct spi_nor_manufacturer + &spi_nor_winbond, + &spi_nor_xilinx, + &spi_nor_xmc, @@ -18664,7 +24207,7 @@ index 0000000000..3e7cd03679 + int spi_nor_write_disable(struct spi_nor *nor); diff --git a/target/linux/generic/pending-5.10/480-mtd-set-rootfs-to-be-root-dev.patch b/target/linux/generic/pending-5.10/480-mtd-set-rootfs-to-be-root-dev.patch new file mode 100644 -index 0000000000..11cdc179d2 +index 0000000000..e01b991942 --- /dev/null +++ b/target/linux/generic/pending-5.10/480-mtd-set-rootfs-to-be-root-dev.patch @@ -0,0 +1,38 @@ @@ -18690,7 +24233,7 @@ index 0000000000..11cdc179d2 + #include + + #include -+@@ -692,6 +693,15 @@ int add_mtd_device(struct mtd_info *mtd) ++@@ -693,6 +694,15 @@ int add_mtd_device(struct mtd_info *mtd) + of this try_ nonsense, and no bitching about it + either. :) */ + __module_get(THIS_MODULE); @@ -18708,7 +24251,7 @@ index 0000000000..11cdc179d2 + fail_nvmem_add: diff --git a/target/linux/generic/pending-5.10/481-mtd-spi-nor-rework-broken-flash-reset-support.patch b/target/linux/generic/pending-5.10/481-mtd-spi-nor-rework-broken-flash-reset-support.patch new file mode 100644 -index 0000000000..e8e737ffca +index 0000000000..5cb85172fb --- /dev/null +++ b/target/linux/generic/pending-5.10/481-mtd-spi-nor-rework-broken-flash-reset-support.patch @@ -0,0 +1,180 @@ @@ -18733,7 +24276,7 @@ index 0000000000..e8e737ffca + +--- a/drivers/mtd/spi-nor/core.c ++++ b/drivers/mtd/spi-nor/core.c -+@@ -1445,6 +1445,23 @@ destroy_erase_cmd_list: ++@@ -1447,6 +1447,23 @@ destroy_erase_cmd_list: + return ret; + } + @@ -18757,7 +24300,7 @@ index 0000000000..e8e737ffca + /* + * Erase an address range on the nor chip. The address range may extend + * one or more erase sectors. Return an error is there is a problem erasing. -+@@ -1472,6 +1489,10 @@ static int spi_nor_erase(struct mtd_info ++@@ -1474,6 +1491,10 @@ static int spi_nor_erase(struct mtd_info + if (ret) + return ret; + @@ -18768,7 +24311,7 @@ index 0000000000..e8e737ffca + /* whole-chip erase? */ + if (len == mtd->size && !(nor->flags & SNOR_F_NO_OP_CHIP_ERASE)) { + unsigned long timeout; -+@@ -1531,6 +1552,7 @@ static int spi_nor_erase(struct mtd_info ++@@ -1533,6 +1554,7 @@ static int spi_nor_erase(struct mtd_info + ret = spi_nor_write_disable(nor); + + erase_err: @@ -18776,7 +24319,7 @@ index 0000000000..e8e737ffca + spi_nor_unlock_and_unprep(nor); + + return ret; -+@@ -1870,7 +1892,9 @@ static int spi_nor_lock(struct mtd_info ++@@ -1872,7 +1894,9 @@ static int spi_nor_lock(struct mtd_info + if (ret) + return ret; + @@ -18786,7 +24329,7 @@ index 0000000000..e8e737ffca + + spi_nor_unlock_and_unprep(nor); + return ret; -+@@ -1885,7 +1909,9 @@ static int spi_nor_unlock(struct mtd_inf ++@@ -1887,7 +1911,9 @@ static int spi_nor_unlock(struct mtd_inf + if (ret) + return ret; + @@ -18796,7 +24339,7 @@ index 0000000000..e8e737ffca + + spi_nor_unlock_and_unprep(nor); + return ret; -+@@ -1900,7 +1926,9 @@ static int spi_nor_is_locked(struct mtd_ ++@@ -1902,7 +1928,9 @@ static int spi_nor_is_locked(struct mtd_ + if (ret) + return ret; + @@ -18806,7 +24349,7 @@ index 0000000000..e8e737ffca + + spi_nor_unlock_and_unprep(nor); + return ret; -+@@ -2093,6 +2121,10 @@ static int spi_nor_read(struct mtd_info ++@@ -2095,6 +2123,10 @@ static int spi_nor_read(struct mtd_info + if (ret) + return ret; + @@ -18817,7 +24360,7 @@ index 0000000000..e8e737ffca + while (len) { + loff_t addr = from; + -+@@ -2116,6 +2148,7 @@ static int spi_nor_read(struct mtd_info ++@@ -2118,6 +2150,7 @@ static int spi_nor_read(struct mtd_info + ret = 0; + + read_err: @@ -18825,7 +24368,7 @@ index 0000000000..e8e737ffca + spi_nor_unlock_and_unprep(nor); + return ret; + } -+@@ -2138,6 +2171,10 @@ static int spi_nor_write(struct mtd_info ++@@ -2140,6 +2173,10 @@ static int spi_nor_write(struct mtd_info + if (ret) + return ret; + @@ -18836,7 +24379,7 @@ index 0000000000..e8e737ffca + for (i = 0; i < len; ) { + ssize_t written; + loff_t addr = to + i; -+@@ -2180,6 +2217,7 @@ static int spi_nor_write(struct mtd_info ++@@ -2182,6 +2219,7 @@ static int spi_nor_write(struct mtd_info + } + + write_err: @@ -18844,7 +24387,7 @@ index 0000000000..e8e737ffca + spi_nor_unlock_and_unprep(nor); + return ret; + } -+@@ -2975,9 +3013,13 @@ static int spi_nor_init(struct spi_nor * ++@@ -2977,9 +3015,13 @@ static int spi_nor_init(struct spi_nor * + * reboots (e.g., crashes). Warn the user (or hopefully, system + * designer) that this is bad. + */ @@ -18920,6 +24463,24 @@ index 0000000000..c32cde559d + { "gd25q16", INFO(0xc84015, 0, 64 * 1024, 32, + SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | + SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) }, +diff --git a/target/linux/generic/pending-5.10/483-mtd-spi-nor-add-gd25q512.patch b/target/linux/generic/pending-5.10/483-mtd-spi-nor-add-gd25q512.patch +new file mode 100644 +index 0000000000..6f41546964 +--- /dev/null ++++ b/target/linux/generic/pending-5.10/483-mtd-spi-nor-add-gd25q512.patch +@@ -0,0 +1,12 @@ ++--- a/drivers/mtd/spi-nor/gigadevice.c +++++ b/drivers/mtd/spi-nor/gigadevice.c ++@@ -53,6 +53,9 @@ static const struct flash_info gigadevic ++ SPI_NOR_4B_OPCODES | SPI_NOR_HAS_LOCK | ++ SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6) ++ .fixups = &gd25q256_fixups }, +++ { "gd25q512", INFO(0xc84020, 0, 64 * 1024, 1024, +++ SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | +++ SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4B_OPCODES) }, ++ }; ++ ++ const struct spi_nor_manufacturer spi_nor_gigadevice = { diff --git a/target/linux/generic/pending-5.10/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch b/target/linux/generic/pending-5.10/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch new file mode 100644 index 0000000000..7c9766fa7b @@ -19025,10 +24586,10 @@ index 0000000000..7c9766fa7b + pr_err("UBI error: block: cannot initialize, error %d\n", err); diff --git a/target/linux/generic/pending-5.10/491-ubi-auto-create-ubiblock-device-for-rootfs.patch b/target/linux/generic/pending-5.10/491-ubi-auto-create-ubiblock-device-for-rootfs.patch new file mode 100644 -index 0000000000..61fcbac92e +index 0000000000..a2b48fd4fc --- /dev/null +++ b/target/linux/generic/pending-5.10/491-ubi-auto-create-ubiblock-device-for-rootfs.patch -@@ -0,0 +1,66 @@ +@@ -0,0 +1,69 @@ +From: Daniel Golle +Subject: ubi: auto-create ubiblock device for rootfs + @@ -19039,7 +24600,7 @@ index 0000000000..61fcbac92e + +--- a/drivers/mtd/ubi/block.c ++++ b/drivers/mtd/ubi/block.c -+@@ -652,6 +652,44 @@ static void __init ubiblock_create_from_ ++@@ -652,6 +652,47 @@ static void __init ubiblock_create_from_ + } + } + @@ -19064,6 +24625,9 @@ index 0000000000..61fcbac92e ++ for (ubi_num = 0; ubi_num < UBI_MAX_DEVICES; ubi_num++) { ++ desc = ubi_open_volume_nm(ubi_num, "rootfs", UBI_READONLY); ++ if (IS_ERR(desc)) +++ desc = ubi_open_volume_nm(ubi_num, "fit", UBI_READONLY);; +++ +++ if (IS_ERR(desc)) ++ continue; ++ ++ ubi_get_volume_info(desc, &vi); @@ -19084,7 +24648,7 @@ index 0000000000..61fcbac92e + static void ubiblock_remove_all(void) + { + struct ubiblock *next; -+@@ -684,6 +722,10 @@ int __init ubiblock_init(void) ++@@ -684,6 +725,10 @@ int __init ubiblock_init(void) + */ + ubiblock_create_from_param(); + @@ -19260,7 +24824,7 @@ index 0000000000..81d32ca5a5 + struct ubi_vid_io_buf *vidb; diff --git a/target/linux/generic/pending-5.10/495-mtd-core-add-get_mtd_device_by_node.patch b/target/linux/generic/pending-5.10/495-mtd-core-add-get_mtd_device_by_node.patch new file mode 100644 -index 0000000000..98c5c2ef19 +index 0000000000..7a7ad6b263 --- /dev/null +++ b/target/linux/generic/pending-5.10/495-mtd-core-add-get_mtd_device_by_node.patch @@ -0,0 +1,75 @@ @@ -19283,7 +24847,7 @@ index 0000000000..98c5c2ef19 + +--- a/drivers/mtd/mtdcore.c ++++ b/drivers/mtd/mtdcore.c -+@@ -1052,6 +1052,44 @@ out_unlock: ++@@ -1053,6 +1053,44 @@ out_unlock: + } + EXPORT_SYMBOL_GPL(get_mtd_device_nm); + @@ -19649,6 +25213,36 @@ index 0000000000..9aad0f3e6c + concat->mtd._sync = concat_sync; + concat->mtd._lock = concat_lock; + concat->mtd._unlock = concat_unlock; +diff --git a/target/linux/generic/pending-5.10/499-mtd-don-t-lock-when-recursively-deleting-partitions.patch b/target/linux/generic/pending-5.10/499-mtd-don-t-lock-when-recursively-deleting-partitions.patch +new file mode 100644 +index 0000000000..505131b684 +--- /dev/null ++++ b/target/linux/generic/pending-5.10/499-mtd-don-t-lock-when-recursively-deleting-partitions.patch +@@ -0,0 +1,24 @@ ++From: David Bauer ++Date: Wed, 17 Feb 2021 03:21:39 +0100 ++Subject: [PATCH] mtd: don't lock when recursively deleting partitions ++ ++When recursively deleting partitions, don't acquire the masters ++partition lock twice. Otherwise the process endy up in a deadlocked ++state. ++ ++Signed-off-by: David Bauer ++--- ++ drivers/mtd/mtdpart.c | 2 +- ++ 1 file changed, 1 insertion(+), 1 deletion(-) ++ ++--- a/drivers/mtd/mtdpart.c +++++ b/drivers/mtd/mtdpart.c ++@@ -474,7 +474,7 @@ static int __del_mtd_partitions(struct m ++ ++ list_for_each_entry_safe(child, next, &mtd->partitions, part.node) { ++ if (mtd_has_partitions(child)) ++- del_mtd_partitions(child); +++ __del_mtd_partitions(child); ++ ++ pr_info("Deleting %s MTD partition\n", child->name); ++ ret = del_mtd_device(child); diff --git a/target/linux/generic/pending-5.10/500-fs_cdrom_dependencies.patch b/target/linux/generic/pending-5.10/500-fs_cdrom_dependencies.patch new file mode 100644 index 0000000000..0a5a3aae5d @@ -25048,7 +30642,7 @@ index 0000000000..f82849c356 + diff --git a/target/linux/generic/pending-5.10/610-netfilter_match_bypass_default_checks.patch b/target/linux/generic/pending-5.10/610-netfilter_match_bypass_default_checks.patch new file mode 100644 -index 0000000000..04f9ba2f08 +index 0000000000..457703121c --- /dev/null +++ b/target/linux/generic/pending-5.10/610-netfilter_match_bypass_default_checks.patch @@ -0,0 +1,110 @@ @@ -25123,7 +30717,7 @@ index 0000000000..04f9ba2f08 + return -ENOMEM; + +@@ -818,6 +846,7 @@ copy_entries_to_user(unsigned int total_ -+ const struct xt_table_info *private = xt_table_get_private_protected(table); ++ const struct xt_table_info *private = table->private; + int ret = 0; + const void *loc_cpu_entry; ++ u8 flags; @@ -25164,7 +30758,7 @@ index 0000000000..04f9ba2f08 + *dstptr += sizeof(struct compat_ipt_entry); diff --git a/target/linux/generic/pending-5.10/611-netfilter_match_bypass_default_table.patch b/target/linux/generic/pending-5.10/611-netfilter_match_bypass_default_table.patch new file mode 100644 -index 0000000000..1792534835 +index 0000000000..baf738a8d2 --- /dev/null +++ b/target/linux/generic/pending-5.10/611-netfilter_match_bypass_default_table.patch @@ -0,0 +1,106 @@ @@ -25218,7 +30812,7 @@ index 0000000000..1792534835 + /* Initialization */ ++ WARN_ON(!(table->valid_hooks & (1 << hook))); ++ local_bh_disable(); -++ private = rcu_access_pointer(table->private); +++ private = READ_ONCE(table->private); /* Address dependency. */ ++ cpu = smp_processor_id(); ++ table_base = private->entries; ++ @@ -25250,7 +30844,7 @@ index 0000000000..1792534835 +- WARN_ON(!(table->valid_hooks & (1 << hook))); +- local_bh_disable(); + addend = xt_write_recseq_begin(); -+- private = rcu_access_pointer(table->private); ++- private = READ_ONCE(table->private); /* Address dependency. */ +- cpu = smp_processor_id(); +- table_base = private->entries; + jumpstack = (struct ipt_entry **)private->jumpstack[cpu]; @@ -25871,12 +31465,12 @@ index 0000000000..e47d03e48d + } diff --git a/target/linux/generic/pending-5.10/640-02-net-resolve-forwarding-path-from-virtual-netdevice-a.patch b/target/linux/generic/pending-5.10/640-02-net-resolve-forwarding-path-from-virtual-netdevice-a.patch new file mode 100644 -index 0000000000..953446baab +index 0000000000..224831d593 --- /dev/null +++ b/target/linux/generic/pending-5.10/640-02-net-resolve-forwarding-path-from-virtual-netdevice-a.patch @@ -0,0 +1,170 @@ +From: Pablo Neira Ayuso -+Date: Sun, 10 Jan 2021 15:53:58 +0100 ++Date: Thu, 4 Mar 2021 23:18:11 +0100 +Subject: [PATCH] net: resolve forwarding path from virtual netdevice and + HW destination address + @@ -25935,7 +31529,7 @@ index 0000000000..953446baab + +--- a/include/linux/netdevice.h ++++ b/include/linux/netdevice.h -+@@ -833,6 +833,27 @@ typedef u16 (*select_queue_fallback_t)(s ++@@ -827,6 +827,27 @@ typedef u16 (*select_queue_fallback_t)(s + struct sk_buff *skb, + struct net_device *sb_dev); + @@ -25963,25 +31557,25 @@ index 0000000000..953446baab + enum tc_setup_type { + TC_SETUP_QDISC_MQPRIO, + TC_SETUP_CLSU32, -+@@ -1279,6 +1300,8 @@ struct netdev_net_notifier { ++@@ -1273,6 +1294,8 @@ struct netdev_net_notifier { + * struct net_device *(*ndo_get_peer_dev)(struct net_device *dev); + * If a device is paired with a peer device, return the peer instance. + * The caller must be under RCU read context. ++ * int (*ndo_fill_forward_path)(struct net_device_path_ctx *ctx, struct net_device_path *path); -++ * Get the forwarding path to reach the real device from the HW destination address +++ * Get the forwarding path to reach the real device from the HW destination address + */ + struct net_device_ops { + int (*ndo_init)(struct net_device *dev); -+@@ -1487,6 +1510,8 @@ struct net_device_ops { ++@@ -1481,6 +1504,8 @@ struct net_device_ops { + int (*ndo_tunnel_ctl)(struct net_device *dev, + struct ip_tunnel_parm *p, int cmd); + struct net_device * (*ndo_get_peer_dev)(struct net_device *dev); -++ int (*ndo_fill_forward_path)(struct net_device_path_ctx *ctx, -++ struct net_device_path *path); +++ int (*ndo_fill_forward_path)(struct net_device_path_ctx *ctx, +++ struct net_device_path *path); + }; + + /** -+@@ -2798,6 +2823,8 @@ void dev_remove_offload(struct packet_of ++@@ -2795,6 +2820,8 @@ void dev_remove_offload(struct packet_of + + int dev_get_iflink(const struct net_device *dev); + int dev_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb); @@ -25992,7 +31586,7 @@ index 0000000000..953446baab + struct net_device *dev_get_by_name(struct net *net, const char *name); +--- a/net/core/dev.c ++++ b/net/core/dev.c -+@@ -846,6 +846,52 @@ int dev_fill_metadata_dst(struct net_dev ++@@ -847,6 +847,52 @@ int dev_fill_metadata_dst(struct net_dev + } + EXPORT_SYMBOL_GPL(dev_fill_metadata_dst); + @@ -26047,7 +31641,7 @@ index 0000000000..953446baab + * @net: the applicable net namespace diff --git a/target/linux/generic/pending-5.10/640-03-net-8021q-resolve-forwarding-path-for-vlan-devices.patch b/target/linux/generic/pending-5.10/640-03-net-8021q-resolve-forwarding-path-for-vlan-devices.patch new file mode 100644 -index 0000000000..ddc0de0d3b +index 0000000000..69e025be26 --- /dev/null +++ b/target/linux/generic/pending-5.10/640-03-net-8021q-resolve-forwarding-path-for-vlan-devices.patch @@ -0,0 +1,80 @@ @@ -26081,7 +31675,7 @@ index 0000000000..ddc0de0d3b + +--- a/include/linux/netdevice.h ++++ b/include/linux/netdevice.h -+@@ -835,11 +835,18 @@ typedef u16 (*select_queue_fallback_t)(s ++@@ -829,11 +829,18 @@ typedef u16 (*select_queue_fallback_t)(s + + enum net_device_path_type { + DEV_PATH_ETHERNET = 0, @@ -26095,7 +31689,7 @@ index 0000000000..ddc0de0d3b ++ struct { ++ u16 id; ++ __be16 proto; -++ } vlan; +++ } encap; ++ }; + }; + @@ -26112,8 +31706,8 @@ index 0000000000..ddc0de0d3b ++ struct vlan_dev_priv *vlan = vlan_dev_priv(ctx->dev); ++ ++ path->type = DEV_PATH_VLAN; -++ path->vlan.id = vlan->vlan_id; -++ path->vlan.proto = vlan->vlan_proto; +++ path->encap.id = vlan->vlan_id; +++ path->encap.proto = vlan->vlan_proto; ++ path->dev = ctx->dev; ++ ctx->dev = vlan->real_dev; ++ @@ -26133,7 +31727,7 @@ index 0000000000..ddc0de0d3b + static void vlan_dev_free(struct net_device *dev) diff --git a/target/linux/generic/pending-5.10/640-04-bridge-resolve-forwarding-path-for-bridge-devices.patch b/target/linux/generic/pending-5.10/640-04-bridge-resolve-forwarding-path-for-bridge-devices.patch new file mode 100644 -index 0000000000..d9093b3da4 +index 0000000000..cfb817f20f --- /dev/null +++ b/target/linux/generic/pending-5.10/640-04-bridge-resolve-forwarding-path-for-bridge-devices.patch @@ -0,0 +1,62 @@ @@ -26148,7 +31742,7 @@ index 0000000000..d9093b3da4 + +--- a/include/linux/netdevice.h ++++ b/include/linux/netdevice.h -+@@ -836,6 +836,7 @@ typedef u16 (*select_queue_fallback_t)(s ++@@ -830,6 +830,7 @@ typedef u16 (*select_queue_fallback_t)(s + enum net_device_path_type { + DEV_PATH_ETHERNET = 0, + DEV_PATH_VLAN, @@ -26201,7 +31795,7 @@ index 0000000000..d9093b3da4 + static struct device_type br_type = { diff --git a/target/linux/generic/pending-5.10/640-05-netfilter-flowtable-use-dev_fill_forward_path-to-obt.patch b/target/linux/generic/pending-5.10/640-05-netfilter-flowtable-use-dev_fill_forward_path-to-obt.patch new file mode 100644 -index 0000000000..34724a5696 +index 0000000000..1f61cff09d --- /dev/null +++ b/target/linux/generic/pending-5.10/640-05-netfilter-flowtable-use-dev_fill_forward_path-to-obt.patch @@ -0,0 +1,191 @@ @@ -26296,7 +31890,7 @@ index 0000000000..34724a5696 ++} ++ ++struct nft_forward_info { -++ const struct net_device *dev; +++ const struct net_device *indev; ++}; ++ ++static void nft_dev_path_info(const struct net_device_path_stack *stack, @@ -26309,12 +31903,12 @@ index 0000000000..34724a5696 ++ path = &stack->path[i]; ++ switch (path->type) { ++ case DEV_PATH_ETHERNET: -++ info->dev = path->dev; +++ info->indev = path->dev; ++ break; ++ case DEV_PATH_VLAN: ++ case DEV_PATH_BRIDGE: ++ default: -++ info->dev = NULL; +++ info->indev = NULL; ++ break; ++ } ++ } @@ -26349,10 +31943,10 @@ index 0000000000..34724a5696 ++ if (nft_dev_fill_forward_path(route, dst, ct, dir, &stack) >= 0) ++ nft_dev_path_info(&stack, &info); ++ -++ if (!info.dev || !nft_flowtable_find_dev(info.dev, ft)) +++ if (!info.indev || !nft_flowtable_find_dev(info.indev, ft)) ++ return; ++ -++ route->tuple[!dir].in.ifindex = info.dev->ifindex; +++ route->tuple[!dir].in.ifindex = info.indev->ifindex; ++} ++ + static int nft_flow_route(const struct nft_pktinfo *pkt, @@ -26398,12 +31992,12 @@ index 0000000000..34724a5696 + flow = flow_offload_alloc(ct); diff --git a/target/linux/generic/pending-5.10/640-06-netfilter-flowtable-use-dev_fill_forward_path-to-obt.patch b/target/linux/generic/pending-5.10/640-06-netfilter-flowtable-use-dev_fill_forward_path-to-obt.patch new file mode 100644 -index 0000000000..d4bf68a690 +index 0000000000..ada14e6c7a --- /dev/null +++ b/target/linux/generic/pending-5.10/640-06-netfilter-flowtable-use-dev_fill_forward_path-to-obt.patch -@@ -0,0 +1,336 @@ +@@ -0,0 +1,344 @@ +From: Pablo Neira Ayuso -+Date: Fri, 20 Nov 2020 13:49:19 +0100 ++Date: Thu, 4 Mar 2021 03:26:35 +0100 +Subject: [PATCH] netfilter: flowtable: use dev_fill_forward_path() to + obtain egress device + @@ -26675,10 +32269,11 @@ index 0000000000..d4bf68a690 + struct neighbour *n; + u8 nud_state; + -+@@ -66,22 +65,35 @@ static int nft_dev_fill_forward_path(con ++@@ -66,27 +65,43 @@ static int nft_dev_fill_forward_path(con + + struct nft_forward_info { -+ const struct net_device *dev; ++ const struct net_device *indev; +++ const struct net_device *outdev; ++ u8 h_source[ETH_ALEN]; ++ u8 h_dest[ETH_ALEN]; ++ enum flow_offload_xmit_type xmit_type; @@ -26698,7 +32293,7 @@ index 0000000000..d4bf68a690 + path = &stack->path[i]; + switch (path->type) { + case DEV_PATH_ETHERNET: -+ info->dev = path->dev; ++ info->indev = path->dev; ++ if (is_zero_ether_addr(info->h_source)) ++ memcpy(info->h_source, path->dev->dev_addr, ETH_ALEN); + break; @@ -26711,9 +32306,16 @@ index 0000000000..d4bf68a690 ++ break; ++ case DEV_PATH_VLAN: + default: -+ info->dev = NULL; ++ info->indev = NULL; + break; -+@@ -114,14 +126,22 @@ static void nft_dev_forward_path(struct ++ } ++ } +++ if (!info->outdev) +++ info->outdev = info->indev; ++ } ++ ++ static bool nft_flowtable_find_dev(const struct net_device *dev, ++@@ -114,14 +129,22 @@ static void nft_dev_forward_path(struct + const struct dst_entry *dst = route->tuple[dir].dst; + struct net_device_path_stack stack; + struct nft_forward_info info = {}; @@ -26724,15 +32326,15 @@ index 0000000000..d4bf68a690 ++ if (nft_dev_fill_forward_path(route, dst, ct, dir, ha, &stack) >= 0) ++ nft_dev_path_info(&stack, &info, ha); + -+ if (!info.dev || !nft_flowtable_find_dev(info.dev, ft)) ++ if (!info.indev || !nft_flowtable_find_dev(info.indev, ft)) + return; + -+ route->tuple[!dir].in.ifindex = info.dev->ifindex; ++ route->tuple[!dir].in.ifindex = info.indev->ifindex; ++ ++ if (info.xmit_type == FLOW_OFFLOAD_XMIT_DIRECT) { ++ memcpy(route->tuple[dir].out.h_source, info.h_source, ETH_ALEN); ++ memcpy(route->tuple[dir].out.h_dest, info.h_dest, ETH_ALEN); -++ route->tuple[dir].out.ifindex = info.dev->ifindex; +++ route->tuple[dir].out.ifindex = info.outdev->ifindex; ++ route->tuple[dir].xmit_type = info.xmit_type; ++ } + } @@ -26740,10 +32342,10 @@ index 0000000000..d4bf68a690 + static int nft_flow_route(const struct nft_pktinfo *pkt, diff --git a/target/linux/generic/pending-5.10/640-07-netfilter-flowtable-add-vlan-support.patch b/target/linux/generic/pending-5.10/640-07-netfilter-flowtable-add-vlan-support.patch new file mode 100644 -index 0000000000..77aeaccbce +index 0000000000..fea1b59dc3 --- /dev/null +++ b/target/linux/generic/pending-5.10/640-07-netfilter-flowtable-add-vlan-support.patch -@@ -0,0 +1,364 @@ +@@ -0,0 +1,391 @@ +From: Pablo Neira Ayuso +Date: Fri, 20 Nov 2020 13:49:20 +0100 +Subject: [PATCH] netfilter: flowtable: add vlan support @@ -26762,7 +32364,7 @@ index 0000000000..77aeaccbce + FLOW_OFFLOAD_XMIT_DIRECT, + }; + -++#define NF_FLOW_TABLE_VLAN_MAX 2 +++#define NF_FLOW_TABLE_ENCAP_MAX 2 ++ + struct flow_offload_tuple { + union { @@ -26774,7 +32376,7 @@ index 0000000000..77aeaccbce ++ struct { ++ u16 id; ++ __be16 proto; -++ } in_vlan[NF_FLOW_TABLE_VLAN_MAX]; +++ } encap[NF_FLOW_TABLE_ENCAP_MAX]; + + /* All members above are keys for lookups, see flow_offload_hash(). */ + struct { } __hash; @@ -26784,17 +32386,19 @@ index 0000000000..77aeaccbce +- ++ u8 dir:4, ++ xmit_type:2, -++ in_vlan_num:2; +++ encap_num:2; + u16 mtu; + union { + struct dst_entry *dst_cache; -+@@ -174,6 +180,9 @@ struct nf_flow_route { ++@@ -174,6 +180,11 @@ struct nf_flow_route { + struct dst_entry *dst; + struct { + u32 ifindex; -++ u16 vid[NF_FLOW_TABLE_VLAN_MAX]; -++ __be16 vproto[NF_FLOW_TABLE_VLAN_MAX]; -++ u8 num_vlans; +++ struct { +++ u16 id; +++ __be16 proto; +++ } encap[NF_FLOW_TABLE_ENCAP_MAX]; +++ u8 num_encaps; + } in; + struct { + u32 ifindex; @@ -26812,33 +32416,36 @@ index 0000000000..77aeaccbce + } + + flow_tuple->iifidx = route->tuple[dir].in.ifindex; -++ for (i = route->tuple[dir].in.num_vlans - 1; i >= 0; i--) { -++ flow_tuple->in_vlan[j].id = route->tuple[dir].in.vid[i]; -++ flow_tuple->in_vlan[j].proto = route->tuple[dir].in.vproto[i]; +++ for (i = route->tuple[dir].in.num_encaps - 1; i >= 0; i--) { +++ flow_tuple->encap[j].id = route->tuple[dir].in.encap[i].id; +++ flow_tuple->encap[j].proto = route->tuple[dir].in.encap[i].proto; ++ j++; ++ } -++ flow_tuple->in_vlan_num = route->tuple[dir].in.num_vlans; +++ flow_tuple->encap_num = route->tuple[dir].in.num_encaps; + + switch (route->tuple[dir].xmit_type) { + case FLOW_OFFLOAD_XMIT_DIRECT: +--- a/net/netfilter/nf_flow_table_ip.c ++++ b/net/netfilter/nf_flow_table_ip.c -+@@ -159,17 +159,35 @@ static bool ip_has_options(unsigned int ++@@ -159,17 +159,38 @@ static bool ip_has_options(unsigned int + return thoff != sizeof(struct iphdr); + } + -++static void nf_flow_tuple_vlan(struct sk_buff *skb, -++ struct flow_offload_tuple *tuple) +++static void nf_flow_tuple_encap(struct sk_buff *skb, +++ struct flow_offload_tuple *tuple) ++{ +++ int i = 0; +++ ++ if (skb_vlan_tag_present(skb)) { -++ tuple->in_vlan[0].id = skb_vlan_tag_get(skb); -++ tuple->in_vlan[0].proto = skb->vlan_proto; +++ tuple->encap[i].id = skb_vlan_tag_get(skb); +++ tuple->encap[i].proto = skb->vlan_proto; +++ i++; ++ } ++ if (skb->protocol == htons(ETH_P_8021Q)) { ++ struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb_mac_header(skb); ++ -++ tuple->in_vlan[1].id = ntohs(veth->h_vlan_TCI); -++ tuple->in_vlan[1].proto = skb->protocol; +++ tuple->encap[i].id = ntohs(veth->h_vlan_TCI); +++ tuple->encap[i].proto = skb->protocol; ++ } ++} ++ @@ -26862,7 +32469,7 @@ index 0000000000..77aeaccbce + thoff = iph->ihl * 4; + + if (ip_is_fragment(iph) || -+@@ -191,11 +209,11 @@ static int nf_flow_tuple_ip(struct sk_bu ++@@ -191,11 +212,11 @@ static int nf_flow_tuple_ip(struct sk_bu + return -1; + + thoff = iph->ihl * 4; @@ -26877,19 +32484,19 @@ index 0000000000..77aeaccbce + + tuple->src_v4.s_addr = iph->saddr; + tuple->dst_v4.s_addr = iph->daddr; -+@@ -204,6 +222,7 @@ static int nf_flow_tuple_ip(struct sk_bu ++@@ -204,6 +225,7 @@ static int nf_flow_tuple_ip(struct sk_bu + tuple->l3proto = AF_INET; + tuple->l4proto = iph->protocol; + tuple->iifidx = dev->ifindex; -++ nf_flow_tuple_vlan(skb, tuple); +++ nf_flow_tuple_encap(skb, tuple); + + return 0; + } -+@@ -248,6 +267,37 @@ static unsigned int nf_flow_xmit_xfrm(st ++@@ -248,6 +270,40 @@ static unsigned int nf_flow_xmit_xfrm(st + return NF_STOLEN; + } + -++static bool nf_flow_skb_vlan_protocol(const struct sk_buff *skb, __be16 proto) +++static bool nf_flow_skb_encap_protocol(const struct sk_buff *skb, __be16 proto) ++{ ++ if (skb->protocol == htons(ETH_P_8021Q)) { ++ struct vlan_ethhdr *veth; @@ -26902,29 +32509,37 @@ index 0000000000..77aeaccbce ++ return false; ++} ++ -++static void nf_flow_vlan_pop(struct sk_buff *skb, -++ struct flow_offload_tuple_rhash *tuplehash) +++static void nf_flow_encap_pop(struct sk_buff *skb, +++ struct flow_offload_tuple_rhash *tuplehash) ++{ ++ struct vlan_hdr *vlan_hdr; ++ int i; ++ -++ for (i = 0; i < tuplehash->tuple.in_vlan_num; i++) { +++ for (i = 0; i < tuplehash->tuple.encap_num; i++) { ++ if (skb_vlan_tag_present(skb)) { ++ __vlan_hwaccel_clear_tag(skb); ++ continue; ++ } -++ vlan_hdr = (struct vlan_hdr *)skb->data; -++ __skb_pull(skb, VLAN_HLEN); -++ vlan_set_encap_proto(skb, vlan_hdr); -++ skb_reset_network_header(skb); +++ if (skb->protocol == htons(ETH_P_8021Q)) { +++ vlan_hdr = (struct vlan_hdr *)skb->data; +++ __skb_pull(skb, VLAN_HLEN); +++ vlan_set_encap_proto(skb, vlan_hdr); +++ skb_reset_network_header(skb); +++ break; +++ } ++ } ++} ++ + static unsigned int nf_flow_queue_xmit(struct net *net, struct sk_buff *skb, + const struct flow_offload_tuple_rhash *tuplehash, + unsigned short type) -+@@ -280,9 +330,11 @@ nf_flow_offload_ip_hook(void *priv, stru -+ unsigned int thoff; ++@@ -276,13 +332,15 @@ nf_flow_offload_ip_hook(void *priv, stru ++ enum flow_offload_tuple_dir dir; ++ struct flow_offload *flow; ++ struct net_device *outdev; +++ unsigned int thoff, mtu; ++ struct rtable *rt; ++- unsigned int thoff; + struct iphdr *iph; + __be32 nexthop; ++ u32 offset = 0; @@ -26932,12 +32547,17 @@ index 0000000000..77aeaccbce + +- if (skb->protocol != htons(ETH_P_IP)) ++ if (skb->protocol != htons(ETH_P_IP) && -++ !nf_flow_skb_vlan_protocol(skb, htons(ETH_P_IP))) +++ !nf_flow_skb_encap_protocol(skb, htons(ETH_P_IP))) + return NF_ACCEPT; + + if (nf_flow_tuple_ip(skb, state->in, &tuple) < 0) -+@@ -298,11 +350,15 @@ nf_flow_offload_ip_hook(void *priv, stru -+ if (unlikely(nf_flow_exceeds_mtu(skb, flow->tuplehash[dir].tuple.mtu))) ++@@ -295,14 +353,19 @@ nf_flow_offload_ip_hook(void *priv, stru ++ dir = tuplehash->tuple.dir; ++ flow = container_of(tuplehash, struct flow_offload, tuplehash[dir]); ++ ++- if (unlikely(nf_flow_exceeds_mtu(skb, flow->tuplehash[dir].tuple.mtu))) +++ mtu = flow->tuplehash[dir].tuple.mtu + offset; +++ if (unlikely(nf_flow_exceeds_mtu(skb, mtu))) + return NF_ACCEPT; + +- if (skb_try_make_writable(skb, sizeof(*iph))) @@ -26955,17 +32575,17 @@ index 0000000000..77aeaccbce + return NF_ACCEPT; + + flow_offload_refresh(flow_table, flow); -+@@ -312,6 +368,9 @@ nf_flow_offload_ip_hook(void *priv, stru ++@@ -312,6 +375,9 @@ nf_flow_offload_ip_hook(void *priv, stru + return NF_ACCEPT; + } + -++ nf_flow_vlan_pop(skb, tuplehash); +++ nf_flow_encap_pop(skb, tuplehash); ++ thoff -= offset; ++ + if (nf_flow_nat_ip(flow, skb, thoff, dir) < 0) + return NF_DROP; + -+@@ -479,14 +538,17 @@ static int nf_flow_nat_ipv6(const struct ++@@ -479,14 +545,17 @@ static int nf_flow_nat_ipv6(const struct + static int nf_flow_tuple_ipv6(struct sk_buff *skb, const struct net_device *dev, + struct flow_offload_tuple *tuple) + { @@ -26986,7 +32606,7 @@ index 0000000000..77aeaccbce + + switch (ip6h->nexthdr) { + case IPPROTO_TCP: -+@@ -503,11 +565,11 @@ static int nf_flow_tuple_ipv6(struct sk_ ++@@ -503,11 +572,11 @@ static int nf_flow_tuple_ipv6(struct sk_ + return -1; + + thoff = sizeof(*ip6h); @@ -27001,29 +32621,35 @@ index 0000000000..77aeaccbce + + tuple->src_v6 = ip6h->saddr; + tuple->dst_v6 = ip6h->daddr; -+@@ -516,6 +578,7 @@ static int nf_flow_tuple_ipv6(struct sk_ ++@@ -516,6 +585,7 @@ static int nf_flow_tuple_ipv6(struct sk_ + tuple->l3proto = AF_INET6; + tuple->l4proto = ip6h->nexthdr; + tuple->iifidx = dev->ifindex; -++ nf_flow_tuple_vlan(skb, tuple); +++ nf_flow_tuple_encap(skb, tuple); + + return 0; + } -+@@ -533,9 +596,11 @@ nf_flow_offload_ipv6_hook(void *priv, st ++@@ -533,9 +603,12 @@ nf_flow_offload_ipv6_hook(void *priv, st + struct net_device *outdev; + struct ipv6hdr *ip6h; + struct rt6_info *rt; +++ unsigned int mtu; ++ u32 offset = 0; + int ret; + +- if (skb->protocol != htons(ETH_P_IPV6)) ++ if (skb->protocol != htons(ETH_P_IPV6) && -++ !nf_flow_skb_vlan_protocol(skb, htons(ETH_P_IPV6))) +++ !nf_flow_skb_encap_protocol(skb, htons(ETH_P_IPV6))) + return NF_ACCEPT; + + if (nf_flow_tuple_ipv6(skb, state->in, &tuple) < 0) -+@@ -551,8 +616,11 @@ nf_flow_offload_ipv6_hook(void *priv, st -+ if (unlikely(nf_flow_exceeds_mtu(skb, flow->tuplehash[dir].tuple.mtu))) ++@@ -548,11 +621,15 @@ nf_flow_offload_ipv6_hook(void *priv, st ++ dir = tuplehash->tuple.dir; ++ flow = container_of(tuplehash, struct flow_offload, tuplehash[dir]); ++ ++- if (unlikely(nf_flow_exceeds_mtu(skb, flow->tuplehash[dir].tuple.mtu))) +++ mtu = flow->tuplehash[dir].tuple.mtu + offset; +++ if (unlikely(nf_flow_exceeds_mtu(skb, mtu))) + return NF_ACCEPT; + +- if (nf_flow_state_check(flow, ipv6_hdr(skb)->nexthdr, skb, @@ -27036,33 +32662,35 @@ index 0000000000..77aeaccbce + return NF_ACCEPT; + + flow_offload_refresh(flow_table, flow); -+@@ -562,6 +630,8 @@ nf_flow_offload_ipv6_hook(void *priv, st ++@@ -562,6 +639,8 @@ nf_flow_offload_ipv6_hook(void *priv, st + return NF_ACCEPT; + } + -++ nf_flow_vlan_pop(skb, tuplehash); +++ nf_flow_encap_pop(skb, tuplehash); ++ + if (skb_try_make_writable(skb, sizeof(*ip6h))) + return NF_DROP; + +--- a/net/netfilter/nft_flow_offload.c ++++ b/net/netfilter/nft_flow_offload.c -+@@ -65,6 +65,9 @@ static int nft_dev_fill_forward_path(con -+ ++@@ -66,6 +66,11 @@ static int nft_dev_fill_forward_path(con + struct nft_forward_info { -+ const struct net_device *dev; -++ __u16 vid[NF_FLOW_TABLE_VLAN_MAX]; -++ __be16 vproto[NF_FLOW_TABLE_VLAN_MAX]; -++ u8 num_vlans; ++ const struct net_device *indev; ++ const struct net_device *outdev; +++ struct id { +++ __u16 id; +++ __be16 proto; +++ } encap[NF_FLOW_TABLE_ENCAP_MAX]; +++ u8 num_encaps; + u8 h_source[ETH_ALEN]; + u8 h_dest[ETH_ALEN]; + enum flow_offload_xmit_type xmit_type; -+@@ -83,9 +86,22 @@ static void nft_dev_path_info(const stru ++@@ -84,9 +89,23 @@ static void nft_dev_path_info(const stru + path = &stack->path[i]; + switch (path->type) { + case DEV_PATH_ETHERNET: ++ case DEV_PATH_VLAN: -+ info->dev = path->dev; ++ info->indev = path->dev; + if (is_zero_ether_addr(info->h_source)) + memcpy(info->h_source, path->dev->dev_addr, ETH_ALEN); ++ @@ -27070,25 +32698,26 @@ index 0000000000..77aeaccbce ++ break; ++ ++ /* DEV_PATH_VLAN */ -++ if (info->num_vlans >= NF_FLOW_TABLE_VLAN_MAX) { -++ info->dev = NULL; +++ if (info->num_encaps >= NF_FLOW_TABLE_ENCAP_MAX) { +++ info->indev = NULL; ++ break; ++ } -++ info->vid[info->num_vlans] = path->vlan.id; -++ info->vproto[info->num_vlans] = path->vlan.proto; -++ info->num_vlans++; +++ info->outdev = path->dev; +++ info->encap[info->num_encaps].id = path->encap.id; +++ info->encap[info->num_encaps].proto = path->encap.proto; +++ info->num_encaps++; + break; + case DEV_PATH_BRIDGE: + if (is_zero_ether_addr(info->h_source)) -+@@ -93,7 +109,6 @@ static void nft_dev_path_info(const stru ++@@ -94,7 +113,6 @@ static void nft_dev_path_info(const stru + + info->xmit_type = FLOW_OFFLOAD_XMIT_DIRECT; + break; +- case DEV_PATH_VLAN: + default: -+ info->dev = NULL; ++ info->indev = NULL; + break; -+@@ -127,6 +142,7 @@ static void nft_dev_forward_path(struct ++@@ -130,6 +148,7 @@ static void nft_dev_forward_path(struct + struct net_device_path_stack stack; + struct nft_forward_info info = {}; + unsigned char ha[ETH_ALEN]; @@ -27096,15 +32725,15 @@ index 0000000000..77aeaccbce + + if (nft_dev_fill_forward_path(route, dst, ct, dir, ha, &stack) >= 0) + nft_dev_path_info(&stack, &info, ha); -+@@ -135,6 +151,11 @@ static void nft_dev_forward_path(struct ++@@ -138,6 +157,11 @@ static void nft_dev_forward_path(struct + return; + -+ route->tuple[!dir].in.ifindex = info.dev->ifindex; -++ for (i = 0; i < info.num_vlans; i++) { -++ route->tuple[!dir].in.vid[i] = info.vid[i]; -++ route->tuple[!dir].in.vproto[i] = info.vproto[i]; ++ route->tuple[!dir].in.ifindex = info.indev->ifindex; +++ for (i = 0; i < info.num_encaps; i++) { +++ route->tuple[!dir].in.encap[i].id = info.encap[i].id; +++ route->tuple[!dir].in.encap[i].proto = info.encap[i].proto; ++ } -++ route->tuple[!dir].in.num_vlans = info.num_vlans; +++ route->tuple[!dir].in.num_encaps = info.num_encaps; + + if (info.xmit_type == FLOW_OFFLOAD_XMIT_DIRECT) { + memcpy(route->tuple[dir].out.h_source, info.h_source, ETH_ALEN); @@ -27223,7 +32852,7 @@ index 0000000000..1ee015c6aa + SPI1=$RANDOM diff --git a/target/linux/generic/pending-5.10/640-09-net-bridge-resolve-VLAN-tag-actions-in-forwarding-pa.patch b/target/linux/generic/pending-5.10/640-09-net-bridge-resolve-VLAN-tag-actions-in-forwarding-pa.patch new file mode 100644 -index 0000000000..fb5f736648 +index 0000000000..8f8d58b299 --- /dev/null +++ b/target/linux/generic/pending-5.10/640-09-net-bridge-resolve-VLAN-tag-actions-in-forwarding-pa.patch @@ -0,0 +1,207 @@ @@ -27244,10 +32873,10 @@ index 0000000000..fb5f736648 + +--- a/include/linux/netdevice.h ++++ b/include/linux/netdevice.h -+@@ -847,10 +847,20 @@ struct net_device_path { ++@@ -841,10 +841,20 @@ struct net_device_path { + u16 id; + __be16 proto; -+ } vlan; ++ } encap; ++ struct { ++ enum { ++ DEV_PATH_BR_VLAN_KEEP, @@ -27265,7 +32894,7 @@ index 0000000000..fb5f736648 + + struct net_device_path_stack { + int num_paths; -+@@ -860,6 +870,12 @@ struct net_device_path_stack { ++@@ -854,6 +864,12 @@ struct net_device_path_stack { + struct net_device_path_ctx { + const struct net_device *dev; + const u8 *daddr; @@ -27281,7 +32910,7 @@ index 0000000000..fb5f736648 +--- a/net/8021q/vlan_dev.c ++++ b/net/8021q/vlan_dev.c +@@ -777,6 +777,12 @@ static int vlan_dev_fill_forward_path(st -+ path->vlan.proto = vlan->vlan_proto; ++ path->encap.proto = vlan->vlan_proto; + path->dev = ctx->dev; + ctx->dev = vlan->real_dev; ++ if (ctx->num_vlans >= ARRAY_SIZE(ctx->vlan)) @@ -27434,32 +33063,173 @@ index 0000000000..fb5f736648 + int br_vlan_get_info(const struct net_device *dev, u16 vid, + struct bridge_vlan_info *p_vinfo) + { -diff --git a/target/linux/generic/pending-5.10/640-10-net-dsa-resolve-forwarding-path-for-dsa-slave-ports.patch b/target/linux/generic/pending-5.10/640-10-net-dsa-resolve-forwarding-path-for-dsa-slave-ports.patch +diff --git a/target/linux/generic/pending-5.10/640-10-netfilter-nft_flow_offload-add-bridge-vlan-filtering.patch b/target/linux/generic/pending-5.10/640-10-netfilter-nft_flow_offload-add-bridge-vlan-filtering.patch new file mode 100644 -index 0000000000..64a2b14af5 +index 0000000000..86fd6bf77b --- /dev/null -+++ b/target/linux/generic/pending-5.10/640-10-net-dsa-resolve-forwarding-path-for-dsa-slave-ports.patch -@@ -0,0 +1,62 @@ ++++ b/target/linux/generic/pending-5.10/640-10-netfilter-nft_flow_offload-add-bridge-vlan-filtering.patch +@@ -0,0 +1,31 @@ ++From: Pablo Neira Ayuso ++Date: Sun, 24 Jan 2021 18:01:34 +0100 ++Subject: [PATCH] netfilter: nft_flow_offload: add bridge vlan filtering ++ support ++ ++Add the vlan tag based when PVID is set on. ++ ++Signed-off-by: Pablo Neira Ayuso ++--- ++ ++--- a/net/netfilter/nft_flow_offload.c +++++ b/net/netfilter/nft_flow_offload.c ++@@ -111,6 +111,18 @@ static void nft_dev_path_info(const stru ++ if (is_zero_ether_addr(info->h_source)) ++ memcpy(info->h_source, path->dev->dev_addr, ETH_ALEN); ++ +++ switch (path->bridge.vlan_mode) { +++ case DEV_PATH_BR_VLAN_TAG: +++ info->encap[info->num_encaps].id = path->bridge.vlan_id; +++ info->encap[info->num_encaps].proto = path->bridge.vlan_proto; +++ info->num_encaps++; +++ break; +++ case DEV_PATH_BR_VLAN_UNTAG: +++ info->num_encaps--; +++ break; +++ case DEV_PATH_BR_VLAN_KEEP: +++ break; +++ } ++ info->xmit_type = FLOW_OFFLOAD_XMIT_DIRECT; ++ break; ++ default: +diff --git a/target/linux/generic/pending-5.10/640-11-net-ppp-resolve-forwarding-path-for-bridge-pppoe-dev.patch b/target/linux/generic/pending-5.10/640-11-net-ppp-resolve-forwarding-path-for-bridge-pppoe-dev.patch +new file mode 100644 +index 0000000000..88c89b27a0 +--- /dev/null ++++ b/target/linux/generic/pending-5.10/640-11-net-ppp-resolve-forwarding-path-for-bridge-pppoe-dev.patch +@@ -0,0 +1,100 @@ ++From: Pablo Neira Ayuso ++Date: Tue, 2 Mar 2021 21:45:16 +0100 ++Subject: [PATCH] net: ppp: resolve forwarding path for bridge pppoe ++ devices ++ ++Pass on the PPPoE session ID and the real device. ++--- ++ ++--- a/drivers/net/ppp/ppp_generic.c +++++ b/drivers/net/ppp/ppp_generic.c ++@@ -1450,12 +1450,34 @@ static void ppp_dev_priv_destructor(stru ++ ppp_destroy_interface(ppp); ++ } ++ +++static int ppp_fill_forward_path(struct net_device_path_ctx *ctx, +++ struct net_device_path *path) +++{ +++ struct ppp *ppp = netdev_priv(path->dev); +++ struct ppp_channel *chan; +++ struct channel *pch; +++ +++ if (ppp->flags & SC_MULTILINK) +++ return -EOPNOTSUPP; +++ +++ if (list_empty(&ppp->channels)) +++ return -ENODEV; +++ +++ pch = list_first_entry(&ppp->channels, struct channel, clist); +++ chan = pch->chan; +++ if (!chan->ops->fill_forward_path) +++ return -EOPNOTSUPP; +++ +++ return chan->ops->fill_forward_path(ctx, path, chan); +++} +++ ++ static const struct net_device_ops ppp_netdev_ops = { ++ .ndo_init = ppp_dev_init, ++ .ndo_uninit = ppp_dev_uninit, ++ .ndo_start_xmit = ppp_start_xmit, ++ .ndo_do_ioctl = ppp_net_ioctl, ++ .ndo_get_stats64 = ppp_get_stats64, +++ .ndo_fill_forward_path = ppp_fill_forward_path, ++ }; ++ ++ static struct device_type ppp_type = { ++--- a/drivers/net/ppp/pppoe.c +++++ b/drivers/net/ppp/pppoe.c ++@@ -972,8 +972,30 @@ static int pppoe_xmit(struct ppp_channel ++ return __pppoe_xmit(sk, skb); ++ } ++ +++static int pppoe_fill_forward_path(struct net_device_path_ctx *ctx, +++ struct net_device_path *path, +++ const struct ppp_channel *chan) +++{ +++ struct sock *sk = (struct sock *)chan->private; +++ struct pppox_sock *po = pppox_sk(sk); +++ struct net_device *dev = po->pppoe_dev; +++ +++ if (sock_flag(sk, SOCK_DEAD) || +++ !(sk->sk_state & PPPOX_CONNECTED) || !dev) +++ return -1; +++ +++ path->type = DEV_PATH_PPPOE; +++ path->encap.proto = htons(ETH_P_PPP_SES); +++ path->encap.id = be16_to_cpu(po->num); +++ path->dev = ctx->dev; +++ ctx->dev = dev; +++ +++ return 0; +++} +++ ++ static const struct ppp_channel_ops pppoe_chan_ops = { ++ .start_xmit = pppoe_xmit, +++ .fill_forward_path = pppoe_fill_forward_path, ++ }; ++ ++ static int pppoe_recvmsg(struct socket *sock, struct msghdr *m, ++--- a/include/linux/netdevice.h +++++ b/include/linux/netdevice.h ++@@ -831,6 +831,7 @@ enum net_device_path_type { ++ DEV_PATH_ETHERNET = 0, ++ DEV_PATH_VLAN, ++ DEV_PATH_BRIDGE, +++ DEV_PATH_PPPOE, ++ }; ++ ++ struct net_device_path { ++--- a/include/linux/ppp_channel.h +++++ b/include/linux/ppp_channel.h ++@@ -28,6 +28,9 @@ struct ppp_channel_ops { ++ int (*start_xmit)(struct ppp_channel *, struct sk_buff *); ++ /* Handle an ioctl call that has come in via /dev/ppp. */ ++ int (*ioctl)(struct ppp_channel *, unsigned int, unsigned long); +++ int (*fill_forward_path)(struct net_device_path_ctx *, +++ struct net_device_path *, +++ const struct ppp_channel *); ++ }; ++ ++ struct ppp_channel { +diff --git a/target/linux/generic/pending-5.10/640-12-net-dsa-resolve-forwarding-path-for-dsa-slave-ports.patch b/target/linux/generic/pending-5.10/640-12-net-dsa-resolve-forwarding-path-for-dsa-slave-ports.patch +new file mode 100644 +index 0000000000..0b85742290 +--- /dev/null ++++ b/target/linux/generic/pending-5.10/640-12-net-dsa-resolve-forwarding-path-for-dsa-slave-ports.patch +@@ -0,0 +1,60 @@ +From: Felix Fietkau -+Date: Mon, 7 Dec 2020 20:31:48 +0100 ++Date: Thu, 4 Mar 2021 23:19:06 +0100 +Subject: [PATCH] net: dsa: resolve forwarding path for dsa slave ports + +Add .ndo_fill_forward_path for dsa slave port devices -+ -+Signed-off-by: Felix Fietkau +--- + +--- a/include/linux/netdevice.h ++++ b/include/linux/netdevice.h -+@@ -837,6 +837,7 @@ enum net_device_path_type { -+ DEV_PATH_ETHERNET = 0, ++@@ -832,6 +832,7 @@ enum net_device_path_type { + DEV_PATH_VLAN, + DEV_PATH_BRIDGE, ++ DEV_PATH_PPPOE, ++ DEV_PATH_DSA, + }; + + struct net_device_path { -+@@ -856,6 +857,10 @@ struct net_device_path { ++@@ -851,6 +852,10 @@ struct net_device_path { + u16 vlan_id; + __be16 vlan_proto; + } bridge; @@ -27472,7 +33242,7 @@ index 0000000000..64a2b14af5 + +--- a/net/dsa/slave.c ++++ b/net/dsa/slave.c -+@@ -1582,6 +1582,21 @@ static struct devlink_port *dsa_slave_ge ++@@ -1617,6 +1617,21 @@ static struct devlink_port *dsa_slave_ge + return dp->ds->devlink ? &dp->devlink_port : NULL; + } + @@ -27494,7 +33264,7 @@ index 0000000000..64a2b14af5 + static const struct net_device_ops dsa_slave_netdev_ops = { + .ndo_open = dsa_slave_open, + .ndo_stop = dsa_slave_close, -+@@ -1607,6 +1622,7 @@ static const struct net_device_ops dsa_s ++@@ -1642,6 +1657,7 @@ static const struct net_device_ops dsa_s + .ndo_vlan_rx_kill_vid = dsa_slave_vlan_rx_kill_vid, + .ndo_get_devlink_port = dsa_slave_get_devlink_port, + .ndo_change_mtu = dsa_slave_change_mtu, @@ -27502,12 +33272,317 @@ index 0000000000..64a2b14af5 + }; + + static struct device_type dsa_type = { -diff --git a/target/linux/generic/pending-5.10/640-11-netfilter-flowtable-add-offload-support-for-xmit-pat.patch b/target/linux/generic/pending-5.10/640-11-netfilter-flowtable-add-offload-support-for-xmit-pat.patch +diff --git a/target/linux/generic/pending-5.10/640-13-netfilter-flowtable-add-pppoe-support.patch b/target/linux/generic/pending-5.10/640-13-netfilter-flowtable-add-pppoe-support.patch new file mode 100644 -index 0000000000..5e3c7e031a +index 0000000000..524f466bf9 --- /dev/null -+++ b/target/linux/generic/pending-5.10/640-11-netfilter-flowtable-add-offload-support-for-xmit-pat.patch -@@ -0,0 +1,307 @@ ++++ b/target/linux/generic/pending-5.10/640-13-netfilter-flowtable-add-pppoe-support.patch +@@ -0,0 +1,263 @@ ++From: Pablo Neira Ayuso ++Date: Mon, 1 Mar 2021 23:52:49 +0100 ++Subject: [PATCH] netfilter: flowtable: add pppoe support ++ ++--- ++ ++--- a/drivers/net/ppp/ppp_generic.c +++++ b/drivers/net/ppp/ppp_generic.c ++@@ -1453,7 +1453,7 @@ static void ppp_dev_priv_destructor(stru ++ static int ppp_fill_forward_path(struct net_device_path_ctx *ctx, ++ struct net_device_path *path) ++ { ++- struct ppp *ppp = netdev_priv(path->dev); +++ struct ppp *ppp = netdev_priv(ctx->dev); ++ struct ppp_channel *chan; ++ struct channel *pch; ++ ++--- a/drivers/net/ppp/pppoe.c +++++ b/drivers/net/ppp/pppoe.c ++@@ -987,6 +987,7 @@ static int pppoe_fill_forward_path(struc ++ path->type = DEV_PATH_PPPOE; ++ path->encap.proto = htons(ETH_P_PPP_SES); ++ path->encap.id = be16_to_cpu(po->num); +++ memcpy(path->encap.h_dest, po->pppoe_pa.remote, ETH_ALEN); ++ path->dev = ctx->dev; ++ ctx->dev = dev; ++ ++--- a/include/linux/netdevice.h +++++ b/include/linux/netdevice.h ++@@ -842,6 +842,7 @@ struct net_device_path { ++ struct { ++ u16 id; ++ __be16 proto; +++ u8 h_dest[ETH_ALEN]; ++ } encap; ++ struct { ++ enum { ++--- a/net/netfilter/nf_flow_table_ip.c +++++ b/net/netfilter/nf_flow_table_ip.c ++@@ -7,6 +7,9 @@ ++ #include ++ #include ++ #include +++#include +++#include +++#include ++ #include ++ #include ++ #include ++@@ -162,6 +165,8 @@ static bool ip_has_options(unsigned int ++ static void nf_flow_tuple_encap(struct sk_buff *skb, ++ struct flow_offload_tuple *tuple) ++ { +++ struct vlan_ethhdr *veth; +++ struct pppoe_hdr *phdr; ++ int i = 0; ++ ++ if (skb_vlan_tag_present(skb)) { ++@@ -169,23 +174,35 @@ static void nf_flow_tuple_encap(struct s ++ tuple->encap[i].proto = skb->vlan_proto; ++ i++; ++ } ++- if (skb->protocol == htons(ETH_P_8021Q)) { ++- struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb_mac_header(skb); ++- +++ switch (skb->protocol) { +++ case htons(ETH_P_8021Q): +++ veth = (struct vlan_ethhdr *)skb_mac_header(skb); ++ tuple->encap[i].id = ntohs(veth->h_vlan_TCI); ++ tuple->encap[i].proto = skb->protocol; +++ break; +++ case htons(ETH_P_PPP_SES): +++ phdr = (struct pppoe_hdr *)skb_mac_header(skb); +++ tuple->encap[i].id = ntohs(phdr->sid); +++ tuple->encap[i].proto = skb->protocol; +++ break; ++ } ++ } ++ ++ static int nf_flow_tuple_ip(struct sk_buff *skb, const struct net_device *dev, ++- struct flow_offload_tuple *tuple) +++ struct flow_offload_tuple *tuple, u32 *nhoff) ++ { ++ unsigned int thoff, hdrsize, offset = 0; ++ struct flow_ports *ports; ++ struct iphdr *iph; ++ ++- if (skb->protocol == htons(ETH_P_8021Q)) +++ switch (skb->protocol) { +++ case htons(ETH_P_8021Q): ++ offset += VLAN_HLEN; +++ break; +++ case htons(ETH_P_PPP_SES): +++ offset += PPPOE_SES_HLEN; +++ break; +++ } ++ ++ if (!pskb_may_pull(skb, sizeof(*iph) + offset)) ++ return -1; ++@@ -226,6 +243,7 @@ static int nf_flow_tuple_ip(struct sk_bu ++ tuple->l4proto = iph->protocol; ++ tuple->iifidx = dev->ifindex; ++ nf_flow_tuple_encap(skb, tuple); +++ *nhoff = offset; ++ ++ return 0; ++ } ++@@ -270,14 +288,36 @@ static unsigned int nf_flow_xmit_xfrm(st ++ return NF_STOLEN; ++ } ++ +++static inline __be16 nf_flow_pppoe_proto(const struct sk_buff *skb) +++{ +++ __be16 proto; +++ +++ proto = *((__be16 *)(skb_mac_header(skb) + ETH_HLEN + +++ sizeof(struct pppoe_hdr))); +++ switch (proto) { +++ case htons(PPP_IP): +++ return htons(ETH_P_IP); +++ case htons(PPP_IPV6): +++ return htons(ETH_P_IPV6); +++ } +++ +++ return 0; +++} +++ ++ static bool nf_flow_skb_encap_protocol(const struct sk_buff *skb, __be16 proto) ++ { ++- if (skb->protocol == htons(ETH_P_8021Q)) { ++- struct vlan_ethhdr *veth; +++ struct vlan_ethhdr *veth; ++ +++ switch (skb->protocol) { +++ case htons(ETH_P_8021Q): ++ veth = (struct vlan_ethhdr *)skb_mac_header(skb); ++ if (veth->h_vlan_encapsulated_proto == proto) ++ return true; +++ break; +++ case htons(ETH_P_PPP_SES): +++ if (nf_flow_pppoe_proto(skb) == proto) +++ return true; +++ break; ++ } ++ ++ return false; ++@@ -294,12 +334,18 @@ static void nf_flow_encap_pop(struct sk_ ++ __vlan_hwaccel_clear_tag(skb); ++ continue; ++ } ++- if (skb->protocol == htons(ETH_P_8021Q)) { +++ switch (skb->protocol) { +++ case htons(ETH_P_8021Q): ++ vlan_hdr = (struct vlan_hdr *)skb->data; ++ __skb_pull(skb, VLAN_HLEN); ++ vlan_set_encap_proto(skb, vlan_hdr); ++ skb_reset_network_header(skb); ++ break; +++ case htons(ETH_P_PPP_SES): +++ skb->protocol = nf_flow_pppoe_proto(skb); +++ skb_pull(skb, PPPOE_SES_HLEN); +++ skb_reset_network_header(skb); +++ break; ++ } ++ } ++ } ++@@ -343,7 +389,7 @@ nf_flow_offload_ip_hook(void *priv, stru ++ !nf_flow_skb_encap_protocol(skb, htons(ETH_P_IP))) ++ return NF_ACCEPT; ++ ++- if (nf_flow_tuple_ip(skb, state->in, &tuple) < 0) +++ if (nf_flow_tuple_ip(skb, state->in, &tuple, &offset) < 0) ++ return NF_ACCEPT; ++ ++ tuplehash = flow_offload_lookup(flow_table, &tuple); ++@@ -357,9 +403,6 @@ nf_flow_offload_ip_hook(void *priv, stru ++ if (unlikely(nf_flow_exceeds_mtu(skb, mtu))) ++ return NF_ACCEPT; ++ ++- if (skb->protocol == htons(ETH_P_8021Q)) ++- offset += VLAN_HLEN; ++- ++ if (skb_try_make_writable(skb, sizeof(*iph) + offset)) ++ return NF_DROP; ++ ++@@ -543,14 +586,20 @@ static int nf_flow_nat_ipv6(const struct ++ } ++ ++ static int nf_flow_tuple_ipv6(struct sk_buff *skb, const struct net_device *dev, ++- struct flow_offload_tuple *tuple) +++ struct flow_offload_tuple *tuple, u32 *nhoff) ++ { ++ unsigned int thoff, hdrsize, offset = 0; ++ struct flow_ports *ports; ++ struct ipv6hdr *ip6h; ++ ++- if (skb->protocol == htons(ETH_P_8021Q)) +++ switch (skb->protocol) { +++ case htons(ETH_P_8021Q): ++ offset += VLAN_HLEN; +++ break; +++ case htons(ETH_P_PPP_SES): +++ offset += PPPOE_SES_HLEN; +++ break; +++ } ++ ++ if (!pskb_may_pull(skb, sizeof(*ip6h) + offset)) ++ return -1; ++@@ -586,6 +635,7 @@ static int nf_flow_tuple_ipv6(struct sk_ ++ tuple->l4proto = ip6h->nexthdr; ++ tuple->iifidx = dev->ifindex; ++ nf_flow_tuple_encap(skb, tuple); +++ *nhoff = offset; ++ ++ return 0; ++ } ++@@ -611,7 +661,7 @@ nf_flow_offload_ipv6_hook(void *priv, st ++ !nf_flow_skb_encap_protocol(skb, htons(ETH_P_IPV6))) ++ return NF_ACCEPT; ++ ++- if (nf_flow_tuple_ipv6(skb, state->in, &tuple) < 0) +++ if (nf_flow_tuple_ipv6(skb, state->in, &tuple, &offset) < 0) ++ return NF_ACCEPT; ++ ++ tuplehash = flow_offload_lookup(flow_table, &tuple); ++@@ -625,9 +675,6 @@ nf_flow_offload_ipv6_hook(void *priv, st ++ if (unlikely(nf_flow_exceeds_mtu(skb, mtu))) ++ return NF_ACCEPT; ++ ++- if (skb->protocol == htons(ETH_P_8021Q)) ++- offset += VLAN_HLEN; ++- ++ ip6h = (struct ipv6hdr *)(skb_network_header(skb) + offset); ++ if (nf_flow_state_check(flow, ip6h->nexthdr, skb, sizeof(*ip6h))) ++ return NF_ACCEPT; ++--- a/net/netfilter/nft_flow_offload.c +++++ b/net/netfilter/nft_flow_offload.c ++@@ -90,6 +90,7 @@ static void nft_dev_path_info(const stru ++ switch (path->type) { ++ case DEV_PATH_ETHERNET: ++ case DEV_PATH_VLAN: +++ case DEV_PATH_PPPOE: ++ info->indev = path->dev; ++ if (is_zero_ether_addr(info->h_source)) ++ memcpy(info->h_source, path->dev->dev_addr, ETH_ALEN); ++@@ -97,7 +98,7 @@ static void nft_dev_path_info(const stru ++ if (path->type == DEV_PATH_ETHERNET) ++ break; ++ ++- /* DEV_PATH_VLAN */ +++ /* DEV_PATH_VLAN and DEV_PATH_PPPOE */ ++ if (info->num_encaps >= NF_FLOW_TABLE_ENCAP_MAX) { ++ info->indev = NULL; ++ break; ++@@ -106,6 +107,8 @@ static void nft_dev_path_info(const stru ++ info->encap[info->num_encaps].id = path->encap.id; ++ info->encap[info->num_encaps].proto = path->encap.proto; ++ info->num_encaps++; +++ if (path->type == DEV_PATH_PPPOE) +++ memcpy(info->h_dest, path->encap.h_dest, ETH_ALEN); ++ break; ++ case DEV_PATH_BRIDGE: ++ if (is_zero_ether_addr(info->h_source)) +diff --git a/target/linux/generic/pending-5.10/640-14-netfilter-nft_flow_offload-add-dsa-support.patch b/target/linux/generic/pending-5.10/640-14-netfilter-nft_flow_offload-add-dsa-support.patch +new file mode 100644 +index 0000000000..7ff5dad1f7 +--- /dev/null ++++ b/target/linux/generic/pending-5.10/640-14-netfilter-nft_flow_offload-add-dsa-support.patch +@@ -0,0 +1,30 @@ ++From: Pablo Neira Ayuso ++Date: Thu, 4 Mar 2021 19:22:55 +0100 ++Subject: [PATCH] netfilter: nft_flow_offload: add dsa support ++ ++Replace the master ethernet device by the dsa slave port. ++ ++Signed-off-by: Pablo Neira Ayuso ++--- ++ ++--- a/net/netfilter/nft_flow_offload.c +++++ b/net/netfilter/nft_flow_offload.c ++@@ -89,6 +89,7 @@ static void nft_dev_path_info(const stru ++ path = &stack->path[i]; ++ switch (path->type) { ++ case DEV_PATH_ETHERNET: +++ case DEV_PATH_DSA: ++ case DEV_PATH_VLAN: ++ case DEV_PATH_PPPOE: ++ info->indev = path->dev; ++@@ -97,6 +98,10 @@ static void nft_dev_path_info(const stru ++ ++ if (path->type == DEV_PATH_ETHERNET) ++ break; +++ if (path->type == DEV_PATH_DSA) { +++ i = stack->num_paths; +++ break; +++ } ++ ++ /* DEV_PATH_VLAN and DEV_PATH_PPPOE */ ++ if (info->num_encaps >= NF_FLOW_TABLE_ENCAP_MAX) { +diff --git a/target/linux/generic/pending-5.10/640-15-netfilter-flowtable-add-offload-support-for-xmit-pat.patch b/target/linux/generic/pending-5.10/640-15-netfilter-flowtable-add-offload-support-for-xmit-pat.patch +new file mode 100644 +index 0000000000..696ea03332 +--- /dev/null ++++ b/target/linux/generic/pending-5.10/640-15-netfilter-flowtable-add-offload-support-for-xmit-pat.patch +@@ -0,0 +1,308 @@ +From: Pablo Neira Ayuso +Date: Mon, 7 Dec 2020 20:31:44 +0100 +Subject: [PATCH] netfilter: flowtable: add offload support for xmit path @@ -27595,12 +33670,14 @@ index 0000000000..5e3c7e031a +- n = dst_neigh_lookup(dst_cache, daddr); +- if (!n) +- return -ENOENT; -++ this_tuple = &flow->tuplehash[dir].tuple; -+ ++- +- read_lock_bh(&n->lock); +- nud_state = n->nud_state; +- ether_addr_copy(ha, n->ha); +- read_unlock_bh(&n->lock); +++ this_tuple = &flow->tuplehash[dir].tuple; ++ ++- if (!(nud_state & NUD_VALID)) { ++ switch (this_tuple->xmit_type) { ++ case FLOW_OFFLOAD_XMIT_DIRECT: ++ ether_addr_copy(ha, this_tuple->out.h_dest); @@ -27612,8 +33689,7 @@ index 0000000000..5e3c7e031a ++ n = dst_neigh_lookup(dst_cache, daddr); ++ if (!n) ++ return -ENOENT; -+ -+- if (!(nud_state & NUD_VALID)) { +++ ++ read_lock_bh(&n->lock); ++ nud_state = n->nud_state; ++ ether_addr_copy(ha, n->ha); @@ -27653,8 +33729,7 @@ index 0000000000..5e3c7e031a ++ struct flow_action_entry *entry; ++ struct net_device *dev; ++ int ifindex; -+ -+- rt = (struct rtable *)flow->tuplehash[dir].tuple.dst_cache; +++ ++ this_tuple = &flow->tuplehash[dir].tuple; ++ switch (this_tuple->xmit_type) { ++ case FLOW_OFFLOAD_XMIT_DIRECT: @@ -27668,7 +33743,8 @@ index 0000000000..5e3c7e031a ++ default: ++ return; ++ } -++ ++ ++- rt = (struct rtable *)flow->tuplehash[dir].tuple.dst_cache; ++ dev = dev_get_by_index(net, ifindex); ++ if (!dev) ++ return; @@ -27738,12 +33814,12 @@ index 0000000000..5e3c7e031a + ++ other_tuple = &flow->tuplehash[!dir].tuple; ++ -++ for (i = 0; i < other_tuple->in_vlan_num; i++) { +++ for (i = 0; i < other_tuple->encap_num; i++) { ++ struct flow_action_entry *entry = flow_action_entry_next(flow_rule); ++ ++ entry->id = FLOW_ACTION_VLAN_PUSH; -++ entry->vlan.vid = other_tuple->in_vlan[i].id; -++ entry->vlan.proto = other_tuple->in_vlan[i].proto; +++ entry->vlan.vid = other_tuple->encap[i].id; +++ entry->vlan.proto = other_tuple->encap[i].proto; ++ } ++ ++ return 0; @@ -27815,47 +33891,11 @@ index 0000000000..5e3c7e031a + err = nf_flow_rule_match(&flow_rule->match, tuple, other_dst); + if (err < 0) + goto err_flow_match; -diff --git a/target/linux/generic/pending-5.10/640-12-netfilter-nft_flow_offload-add-dsa-support.patch b/target/linux/generic/pending-5.10/640-12-netfilter-nft_flow_offload-add-dsa-support.patch +diff --git a/target/linux/generic/pending-5.10/640-16-dsa-slave-add-support-for-TC_SETUP_FT.patch b/target/linux/generic/pending-5.10/640-16-dsa-slave-add-support-for-TC_SETUP_FT.patch new file mode 100644 -index 0000000000..3689a476b3 +index 0000000000..4dade26f60 --- /dev/null -+++ b/target/linux/generic/pending-5.10/640-12-netfilter-nft_flow_offload-add-dsa-support.patch -@@ -0,0 +1,30 @@ -+From: Pablo Neira Ayuso -+Date: Mon, 18 Jan 2021 22:27:45 +0100 -+Subject: [PATCH] netfilter: nft_flow_offload: add dsa support -+ -+Replace the master ethernet device by the dsa slave port. -+ -+Signed-off-by: Pablo Neira Ayuso -+--- -+ -+--- a/net/netfilter/nft_flow_offload.c -++++ b/net/netfilter/nft_flow_offload.c -+@@ -86,6 +86,7 @@ static void nft_dev_path_info(const stru -+ path = &stack->path[i]; -+ switch (path->type) { -+ case DEV_PATH_ETHERNET: -++ case DEV_PATH_DSA: -+ case DEV_PATH_VLAN: -+ info->dev = path->dev; -+ if (is_zero_ether_addr(info->h_source)) -+@@ -93,6 +94,10 @@ static void nft_dev_path_info(const stru -+ -+ if (path->type == DEV_PATH_ETHERNET) -+ break; -++ if (path->type == DEV_PATH_DSA) { -++ i = stack->num_paths; -++ break; -++ } -+ -+ /* DEV_PATH_VLAN */ -+ if (info->num_vlans >= NF_FLOW_TABLE_VLAN_MAX) { -diff --git a/target/linux/generic/pending-5.10/640-13-dsa-slave-add-support-for-TC_SETUP_FT.patch b/target/linux/generic/pending-5.10/640-13-dsa-slave-add-support-for-TC_SETUP_FT.patch -new file mode 100644 -index 0000000000..58a2064c03 ---- /dev/null -+++ b/target/linux/generic/pending-5.10/640-13-dsa-slave-add-support-for-TC_SETUP_FT.patch ++++ b/target/linux/generic/pending-5.10/640-16-dsa-slave-add-support-for-TC_SETUP_FT.patch @@ -0,0 +1,53 @@ +From: Pablo Neira Ayuso +Date: Mon, 18 Jan 2021 22:39:17 +0100 @@ -27876,7 +33916,7 @@ index 0000000000..58a2064c03 + +--- a/net/dsa/slave.c ++++ b/net/dsa/slave.c -+@@ -1202,14 +1202,32 @@ static int dsa_slave_setup_tc_block(stru ++@@ -1237,14 +1237,32 @@ static int dsa_slave_setup_tc_block(stru + } + } + @@ -27910,51 +33950,14 @@ index 0000000000..58a2064c03 + + if (!ds->ops->port_setup_tc) + return -EOPNOTSUPP; -diff --git a/target/linux/generic/pending-5.10/640-14-netfilter-nft_flow_offload-add-bridge-vlan-filtering.patch b/target/linux/generic/pending-5.10/640-14-netfilter-nft_flow_offload-add-bridge-vlan-filtering.patch +diff --git a/target/linux/generic/pending-5.10/640-17-netfilter-nft_flow_offload-use-direct-xmit-if-hardwa.patch b/target/linux/generic/pending-5.10/640-17-netfilter-nft_flow_offload-use-direct-xmit-if-hardwa.patch new file mode 100644 -index 0000000000..2e833117db +index 0000000000..26d172bcf7 --- /dev/null -+++ b/target/linux/generic/pending-5.10/640-14-netfilter-nft_flow_offload-add-bridge-vlan-filtering.patch -@@ -0,0 +1,31 @@ ++++ b/target/linux/generic/pending-5.10/640-17-netfilter-nft_flow_offload-use-direct-xmit-if-hardwa.patch +@@ -0,0 +1,108 @@ +From: Pablo Neira Ayuso -+Date: Sun, 24 Jan 2021 18:01:34 +0100 -+Subject: [PATCH] netfilter: nft_flow_offload: add bridge vlan filtering -+ support -+ -+Add the vlan tag based when PVID is set on. -+ -+Signed-off-by: Pablo Neira Ayuso -+--- -+ -+--- a/net/netfilter/nft_flow_offload.c -++++ b/net/netfilter/nft_flow_offload.c -+@@ -112,6 +112,18 @@ static void nft_dev_path_info(const stru -+ if (is_zero_ether_addr(info->h_source)) -+ memcpy(info->h_source, path->dev->dev_addr, ETH_ALEN); -+ -++ switch (path->bridge.vlan_mode) { -++ case DEV_PATH_BR_VLAN_TAG: -++ info->vid[info->num_vlans] = path->vlan.id; -++ info->vproto[info->num_vlans] = path->vlan.proto; -++ info->num_vlans++; -++ break; -++ case DEV_PATH_BR_VLAN_UNTAG: -++ info->num_vlans--; -++ break; -++ case DEV_PATH_BR_VLAN_KEEP: -++ break; -++ } -+ info->xmit_type = FLOW_OFFLOAD_XMIT_DIRECT; -+ break; -+ default: -diff --git a/target/linux/generic/pending-5.10/640-15-netfilter-nft_flow_offload-use-direct-xmit-if-hardwa.patch b/target/linux/generic/pending-5.10/640-15-netfilter-nft_flow_offload-use-direct-xmit-if-hardwa.patch -new file mode 100644 -index 0000000000..1c65a5e218 ---- /dev/null -+++ b/target/linux/generic/pending-5.10/640-15-netfilter-nft_flow_offload-use-direct-xmit-if-hardwa.patch -@@ -0,0 +1,51 @@ -+From: Pablo Neira Ayuso -+Date: Tue, 2 Feb 2021 17:10:07 +0100 ++Date: Thu, 4 Mar 2021 19:24:11 +0100 +Subject: [PATCH] netfilter: nft_flow_offload: use direct xmit if + hardware offload is enabled + @@ -27962,9 +33965,56 @@ index 0000000000..1c65a5e218 +offload is enabled, then use the direct xmit path. +--- + ++--- a/include/net/netfilter/nf_flow_table.h +++++ b/include/net/netfilter/nf_flow_table.h ++@@ -131,6 +131,7 @@ struct flow_offload_tuple { ++ struct dst_entry *dst_cache; ++ struct { ++ u32 ifidx; +++ u32 hw_ifidx; ++ u8 h_source[ETH_ALEN]; ++ u8 h_dest[ETH_ALEN]; ++ } out; ++@@ -188,6 +189,7 @@ struct nf_flow_route { ++ } in; ++ struct { ++ u32 ifindex; +++ u32 hw_ifindex; ++ u8 h_source[ETH_ALEN]; ++ u8 h_dest[ETH_ALEN]; ++ } out; ++--- a/net/netfilter/nf_flow_table_core.c +++++ b/net/netfilter/nf_flow_table_core.c ++@@ -106,6 +106,7 @@ static int flow_offload_fill_route(struc ++ memcpy(flow_tuple->out.h_source, route->tuple[dir].out.h_source, ++ ETH_ALEN); ++ flow_tuple->out.ifidx = route->tuple[dir].out.ifindex; +++ flow_tuple->out.hw_ifidx = route->tuple[dir].out.hw_ifindex; ++ break; ++ case FLOW_OFFLOAD_XMIT_XFRM: ++ case FLOW_OFFLOAD_XMIT_NEIGH: ++--- a/net/netfilter/nf_flow_table_offload.c +++++ b/net/netfilter/nf_flow_table_offload.c ++@@ -506,7 +506,7 @@ static void flow_offload_redirect(struct ++ switch (this_tuple->xmit_type) { ++ case FLOW_OFFLOAD_XMIT_DIRECT: ++ this_tuple = &flow->tuplehash[dir].tuple; ++- ifindex = this_tuple->out.ifidx; +++ ifindex = this_tuple->out.hw_ifidx; ++ break; ++ case FLOW_OFFLOAD_XMIT_NEIGH: ++ other_tuple = &flow->tuplehash[!dir].tuple; +--- a/net/netfilter/nft_flow_offload.c ++++ b/net/netfilter/nft_flow_offload.c -+@@ -73,9 +73,18 @@ struct nft_forward_info { ++@@ -66,6 +66,7 @@ static int nft_dev_fill_forward_path(con ++ struct nft_forward_info { ++ const struct net_device *indev; ++ const struct net_device *outdev; +++ const struct net_device *hw_outdev; ++ struct id { ++ __u16 id; ++ __be16 proto; ++@@ -76,9 +77,18 @@ struct nft_forward_info { + enum flow_offload_xmit_type xmit_type; + }; + @@ -27984,230 +34034,56 @@ index 0000000000..1c65a5e218 + { + const struct net_device_path *path; + int i; -+@@ -131,6 +140,10 @@ static void nft_dev_path_info(const stru -+ break; -+ } ++@@ -140,6 +150,12 @@ static void nft_dev_path_info(const stru + } ++ if (!info->outdev) ++ info->outdev = info->indev; +++ +++ info->hw_outdev = info->indev; ++ ++ if (nf_flowtable_hw_offload(flowtable) && -++ nft_is_valid_ether_device(info->dev)) +++ nft_is_valid_ether_device(info->indev)) ++ info->xmit_type = FLOW_OFFLOAD_XMIT_DIRECT; + } + + static bool nft_flowtable_find_dev(const struct net_device *dev, -+@@ -162,7 +175,7 @@ static void nft_dev_forward_path(struct ++@@ -171,7 +187,7 @@ static void nft_dev_forward_path(struct + int i; + + if (nft_dev_fill_forward_path(route, dst, ct, dir, ha, &stack) >= 0) +- nft_dev_path_info(&stack, &info, ha); ++ nft_dev_path_info(&stack, &info, ha, &ft->data); + -+ if (!info.dev || !nft_flowtable_find_dev(info.dev, ft)) ++ if (!info.indev || !nft_flowtable_find_dev(info.indev, ft)) + return; -diff --git a/target/linux/generic/pending-5.10/640-16-netfilter-nft_flow_offload-fix-bridge-vlan-tag-handl.patch b/target/linux/generic/pending-5.10/640-16-netfilter-nft_flow_offload-fix-bridge-vlan-tag-handl.patch -new file mode 100644 -index 0000000000..5877e91e78 ---- /dev/null -+++ b/target/linux/generic/pending-5.10/640-16-netfilter-nft_flow_offload-fix-bridge-vlan-tag-handl.patch -@@ -0,0 +1,22 @@ -+From: Felix Fietkau -+Date: Wed, 10 Feb 2021 10:23:38 +0100 -+Subject: [PATCH] netfilter: nft_flow_offload: fix bridge vlan tag handling -+ -+the brigde type uses the path->bridge.vlan_* fields -+ -+Signed-off-by: Felix Fietkau -+--- -+ -+--- a/net/netfilter/nft_flow_offload.c -++++ b/net/netfilter/nft_flow_offload.c -+@@ -123,8 +123,8 @@ static void nft_dev_path_info(const stru -+ -+ switch (path->bridge.vlan_mode) { -+ case DEV_PATH_BR_VLAN_TAG: -+- info->vid[info->num_vlans] = path->vlan.id; -+- info->vproto[info->num_vlans] = path->vlan.proto; -++ info->vid[info->num_vlans] = path->bridge.vlan_id; -++ info->vproto[info->num_vlans] = path->bridge.vlan_proto; -+ info->num_vlans++; -+ break; -+ case DEV_PATH_BR_VLAN_UNTAG: -diff --git a/target/linux/generic/pending-5.10/640-17-netfilter-flowtable-rework-ingress-vlan-matching.patch b/target/linux/generic/pending-5.10/640-17-netfilter-flowtable-rework-ingress-vlan-matching.patch -new file mode 100644 -index 0000000000..67ec263f51 ---- /dev/null -+++ b/target/linux/generic/pending-5.10/640-17-netfilter-flowtable-rework-ingress-vlan-matching.patch -@@ -0,0 +1,143 @@ -+From: Felix Fietkau -+Date: Wed, 10 Feb 2021 19:39:23 +0100 -+Subject: [PATCH] netfilter: flowtable: rework ingress vlan matching -+ -+When dealing with bridges with VLAN filtering and DSA/switchdev offload, -+the hardware could offload adding a VLAN tag configured in the bridge. -+Since there doesn't seem to be an easy way to detect that, this patch -+reworks the code to optionally match the last VLAN tag that would otherwise -+be inserted by the bridge. -+This matters when bypassing the bridge and attaching an ingress hook on -+a DSA port below it. -+ -+Signed-off-by: Felix Fietkau -+--- -+ -+--- a/include/net/netfilter/nf_flow_table.h -++++ b/include/net/netfilter/nf_flow_table.h -+@@ -115,14 +115,15 @@ struct flow_offload_tuple { -+ -+ u8 l3proto; -+ u8 l4proto; -+- struct { -+- u16 id; -+- __be16 proto; -+- } in_vlan[NF_FLOW_TABLE_VLAN_MAX]; -+ -+ /* All members above are keys for lookups, see flow_offload_hash(). */ -+ struct { } __hash; -+ -++ struct { -++ u16 id; -++ __be16 proto; -++ } in_vlan[NF_FLOW_TABLE_VLAN_MAX], in_pvid; -++ -+ u8 dir:4, -+ xmit_type:2, -+ in_vlan_num:2; -+--- a/net/netfilter/nf_flow_table_ip.c -++++ b/net/netfilter/nf_flow_table_ip.c -+@@ -281,12 +281,13 @@ static bool nf_flow_skb_vlan_protocol(co -+ } -+ -+ static void nf_flow_vlan_pop(struct sk_buff *skb, -+- struct flow_offload_tuple_rhash *tuplehash) -++ struct flow_offload_tuple_rhash *tuplehash, -++ bool strip_pvid) -+ { -+ struct vlan_hdr *vlan_hdr; -+ int i; -+ -+- for (i = 0; i < tuplehash->tuple.in_vlan_num; i++) { -++ for (i = 0; i < tuplehash->tuple.in_vlan_num + strip_pvid; i++) { -+ if (skb_vlan_tag_present(skb)) { -+ __vlan_hwaccel_clear_tag(skb); -+ continue; -+@@ -316,6 +317,31 @@ static unsigned int nf_flow_queue_xmit(s -+ return NF_STOLEN; -+ } -+ -++static bool -++nf_flow_offload_check_vlan(struct flow_offload_tuple *tuple, -++ struct flow_offload_tuple *flow_tuple, -++ bool *strip_pvid) -++{ -++ int i, cur = 0; -++ -++ if (flow_tuple->in_pvid.proto && -++ !memcmp(&tuple->in_vlan[0], &flow_tuple->in_pvid, -++ sizeof(tuple->in_vlan[0]))) -++ cur++; -++ -++ *strip_pvid = cur; -++ -++ for (i = 0; i < flow_tuple->in_vlan_num; i++, cur++) { -++ if (!memcmp(&tuple->in_vlan[cur], &flow_tuple->in_vlan[i], -++ sizeof(tuple->in_vlan[0]))) -++ continue; -++ -++ return false; -++ } -++ -++ return true; -++} -++ -+ unsigned int -+ nf_flow_offload_ip_hook(void *priv, struct sk_buff *skb, -+ const struct nf_hook_state *state) -+@@ -329,6 +355,7 @@ nf_flow_offload_ip_hook(void *priv, stru -+ struct rtable *rt; -+ unsigned int thoff; -+ struct iphdr *iph; -++ bool strip_pvid; -+ __be32 nexthop; -+ u32 offset = 0; -+ int ret; -+@@ -344,6 +371,10 @@ nf_flow_offload_ip_hook(void *priv, stru -+ if (tuplehash == NULL) -+ return NF_ACCEPT; -+ -++ if (!nf_flow_offload_check_vlan(&tuple, &tuplehash->tuple, -++ &strip_pvid)) -++ return NF_ACCEPT; -++ -+ dir = tuplehash->tuple.dir; -+ flow = container_of(tuplehash, struct flow_offload, tuplehash[dir]); -+ -+@@ -368,7 +399,7 @@ nf_flow_offload_ip_hook(void *priv, stru -+ return NF_ACCEPT; ++@@ -187,6 +203,7 @@ static void nft_dev_forward_path(struct ++ memcpy(route->tuple[dir].out.h_source, info.h_source, ETH_ALEN); ++ memcpy(route->tuple[dir].out.h_dest, info.h_dest, ETH_ALEN); ++ route->tuple[dir].out.ifindex = info.outdev->ifindex; +++ route->tuple[dir].out.hw_ifindex = info.hw_outdev->ifindex; ++ route->tuple[dir].xmit_type = info.xmit_type; + } -+ -+- nf_flow_vlan_pop(skb, tuplehash); -++ nf_flow_vlan_pop(skb, tuplehash, strip_pvid); -+ thoff -= offset; -+ -+ if (nf_flow_nat_ip(flow, skb, thoff, dir) < 0) -+@@ -596,6 +627,7 @@ nf_flow_offload_ipv6_hook(void *priv, st -+ struct net_device *outdev; -+ struct ipv6hdr *ip6h; -+ struct rt6_info *rt; -++ bool strip_pvid; -+ u32 offset = 0; -+ int ret; -+ -+@@ -610,6 +642,10 @@ nf_flow_offload_ipv6_hook(void *priv, st -+ if (tuplehash == NULL) -+ return NF_ACCEPT; -+ -++ if (!nf_flow_offload_check_vlan(&tuple, &tuplehash->tuple, -++ &strip_pvid)) -++ return NF_ACCEPT; -++ -+ dir = tuplehash->tuple.dir; -+ flow = container_of(tuplehash, struct flow_offload, tuplehash[dir]); -+ -+@@ -630,7 +666,7 @@ nf_flow_offload_ipv6_hook(void *priv, st -+ return NF_ACCEPT; -+ } -+ -+- nf_flow_vlan_pop(skb, tuplehash); -++ nf_flow_vlan_pop(skb, tuplehash, strip_pvid); -+ -+ if (skb_try_make_writable(skb, sizeof(*ip6h))) -+ return NF_DROP; -diff --git a/target/linux/generic/pending-5.10/640-18-netfilter-flowtable-handle-bridge-vlan-filter-offloa.patch b/target/linux/generic/pending-5.10/640-18-netfilter-flowtable-handle-bridge-vlan-filter-offloa.patch ++ } +diff --git a/target/linux/generic/pending-5.10/640-18-netfilter-nf_flow_table-fix-untagging-with-hardware-.patch b/target/linux/generic/pending-5.10/640-18-netfilter-nf_flow_table-fix-untagging-with-hardware-.patch new file mode 100644 -index 0000000000..ba480f3520 +index 0000000000..18f43196eb --- /dev/null -+++ b/target/linux/generic/pending-5.10/640-18-netfilter-flowtable-handle-bridge-vlan-filter-offloa.patch -@@ -0,0 +1,106 @@ ++++ b/target/linux/generic/pending-5.10/640-18-netfilter-nf_flow_table-fix-untagging-with-hardware-.patch +@@ -0,0 +1,122 @@ +From: Felix Fietkau -+Date: Wed, 10 Feb 2021 19:44:33 +0100 -+Subject: [PATCH] netfilter: flowtable: handle bridge vlan filter offload -+ tags from DSA/switchdev ++Date: Mon, 8 Mar 2021 12:06:44 +0100 ++Subject: [PATCH] netfilter: nf_flow_table: fix untagging with ++ hardware-offloaded bridge vlan_filtering + -+When a switchdev/DSA port is an untagged member of a bridge vlan, ingress -+packets could potentially be tagged with the id of the VLAN. -+When the VLAN port group has been uploaded to switchdev, report the bridge -+tag mode as DEV_PATH_BR_VLAN_UNTAG_HW instead of DEV_PATH_BR_VLAN_UNTAG -+and handle it in netfilter flow offloading by storing the tag in the tuple -+in_pvid field. -+This allows the ingress hook to detect the optional tag and remove it for -+software offload. This tag processing is for ingress only, egress needs to be -+fully untagged ++When switchdev offloading is enabled, treat an untagged VLAN as tagged for ++ingress only + +Signed-off-by: Felix Fietkau +--- + +--- a/include/linux/netdevice.h ++++ b/include/linux/netdevice.h -+@@ -853,6 +853,7 @@ struct net_device_path { ++@@ -849,6 +849,7 @@ struct net_device_path { + DEV_PATH_BR_VLAN_KEEP, + DEV_PATH_BR_VLAN_TAG, + DEV_PATH_BR_VLAN_UNTAG, @@ -28217,17 +34093,29 @@ index 0000000000..ba480f3520 + __be16 vlan_proto; +--- a/include/net/netfilter/nf_flow_table.h ++++ b/include/net/netfilter/nf_flow_table.h -+@@ -183,6 +183,10 @@ struct nf_flow_route { -+ u32 ifindex; -+ u16 vid[NF_FLOW_TABLE_VLAN_MAX]; -+ __be16 vproto[NF_FLOW_TABLE_VLAN_MAX]; -++ struct { -++ u16 id; -++ __be16 proto; -++ } pvid; -+ u8 num_vlans; ++@@ -123,9 +123,10 @@ struct flow_offload_tuple { ++ /* All members above are keys for lookups, see flow_offload_hash(). */ ++ struct { } __hash; ++ ++- u8 dir:4, +++ u8 dir:2, ++ xmit_type:2, ++- encap_num:2; +++ encap_num:2, +++ in_vlan_ingress:2; ++ u16 mtu; ++ union { ++ struct dst_entry *dst_cache; ++@@ -185,7 +186,8 @@ struct nf_flow_route { ++ u16 id; ++ __be16 proto; ++ } encap[NF_FLOW_TABLE_ENCAP_MAX]; ++- u8 num_encaps; +++ u8 num_encaps:2, +++ ingress_vlans:2; + } in; + struct { ++ u32 ifindex; +--- a/net/bridge/br_device.c ++++ b/net/bridge/br_device.c +@@ -435,6 +435,7 @@ static int br_fill_forward_path(struct n @@ -28251,48 +34139,128 @@ index 0000000000..ba480f3520 + +--- a/net/netfilter/nf_flow_table_core.c ++++ b/net/netfilter/nf_flow_table_core.c -+@@ -98,6 +98,8 @@ static int flow_offload_fill_route(struc ++@@ -95,6 +95,8 @@ static int flow_offload_fill_route(struc ++ for (i = route->tuple[dir].in.num_encaps - 1; i >= 0; i--) { ++ flow_tuple->encap[j].id = route->tuple[dir].in.encap[i].id; ++ flow_tuple->encap[j].proto = route->tuple[dir].in.encap[i].proto; +++ if (route->tuple[dir].in.ingress_vlans & BIT(i)) +++ flow_tuple->in_vlan_ingress |= BIT(j); + j++; + } -+ flow_tuple->in_vlan_num = route->tuple[dir].in.num_vlans; -++ flow_tuple->in_pvid.id = route->tuple[dir].in.pvid.id; -++ flow_tuple->in_pvid.proto = route->tuple[dir].in.pvid.proto; ++ flow_tuple->encap_num = route->tuple[dir].in.num_encaps; ++--- a/net/netfilter/nf_flow_table_offload.c +++++ b/net/netfilter/nf_flow_table_offload.c ++@@ -592,8 +592,12 @@ nf_flow_rule_route_common(struct net *ne ++ other_tuple = &flow->tuplehash[!dir].tuple; + -+ switch (route->tuple[dir].xmit_type) { -+ case FLOW_OFFLOAD_XMIT_DIRECT: ++ for (i = 0; i < other_tuple->encap_num; i++) { ++- struct flow_action_entry *entry = flow_action_entry_next(flow_rule); +++ struct flow_action_entry *entry; ++ +++ if (other_tuple->in_vlan_ingress & BIT(i)) +++ continue; +++ +++ entry = flow_action_entry_next(flow_rule); ++ entry->id = FLOW_ACTION_VLAN_PUSH; ++ entry->vlan.vid = other_tuple->encap[i].id; ++ entry->vlan.proto = other_tuple->encap[i].proto; +--- a/net/netfilter/nft_flow_offload.c ++++ b/net/netfilter/nft_flow_offload.c -+@@ -67,6 +67,10 @@ struct nft_forward_info { -+ const struct net_device *dev; -+ __u16 vid[NF_FLOW_TABLE_VLAN_MAX]; -+ __be16 vproto[NF_FLOW_TABLE_VLAN_MAX]; -++ struct { -++ __u16 id; -++ __be16 proto; -++ } pvid; -+ u8 num_vlans; ++@@ -72,6 +72,7 @@ struct nft_forward_info { ++ __be16 proto; ++ } encap[NF_FLOW_TABLE_ENCAP_MAX]; ++ u8 num_encaps; +++ u8 ingress_vlans; + u8 h_source[ETH_ALEN]; + u8 h_dest[ETH_ALEN]; -+@@ -127,6 +131,10 @@ static void nft_dev_path_info(const stru -+ info->vproto[info->num_vlans] = path->bridge.vlan_proto; -+ info->num_vlans++; -+ break; ++ enum flow_offload_xmit_type xmit_type; ++@@ -130,6 +131,9 @@ static void nft_dev_path_info(const stru ++ memcpy(info->h_source, path->dev->dev_addr, ETH_ALEN); ++ ++ switch (path->bridge.vlan_mode) { ++ case DEV_PATH_BR_VLAN_UNTAG_HW: -++ info->pvid.id = info->vid[info->num_vlans - 1]; -++ info->pvid.proto = info->vproto[info->num_vlans - 1]; -++ fallthrough; -+ case DEV_PATH_BR_VLAN_UNTAG: -+ info->num_vlans--; -+ break; -+@@ -185,6 +193,8 @@ static void nft_dev_forward_path(struct -+ route->tuple[!dir].in.vid[i] = info.vid[i]; -+ route->tuple[!dir].in.vproto[i] = info.vproto[i]; +++ info->ingress_vlans |= BIT(info->num_encaps - 1); +++ break; ++ case DEV_PATH_BR_VLAN_TAG: ++ info->encap[info->num_encaps].id = path->bridge.vlan_id; ++ info->encap[info->num_encaps].proto = path->bridge.vlan_proto; ++@@ -198,6 +202,7 @@ static void nft_dev_forward_path(struct ++ route->tuple[!dir].in.encap[i].proto = info.encap[i].proto; + } -++ route->tuple[!dir].in.pvid.id = info.pvid.id; -++ route->tuple[!dir].in.pvid.proto = info.pvid.proto; -+ route->tuple[!dir].in.num_vlans = info.num_vlans; ++ route->tuple[!dir].in.num_encaps = info.num_encaps; +++ route->tuple[!dir].in.ingress_vlans = info.ingress_vlans; + + if (info.xmit_type == FLOW_OFFLOAD_XMIT_DIRECT) { ++ memcpy(route->tuple[dir].out.h_source, info.h_source, ETH_ALEN); +diff --git a/target/linux/generic/pending-5.10/640-19-net-flow_offload-add-FLOW_ACTION_PPPOE_PUSH.patch b/target/linux/generic/pending-5.10/640-19-net-flow_offload-add-FLOW_ACTION_PPPOE_PUSH.patch +new file mode 100644 +index 0000000000..3eaad27cdf +--- /dev/null ++++ b/target/linux/generic/pending-5.10/640-19-net-flow_offload-add-FLOW_ACTION_PPPOE_PUSH.patch +@@ -0,0 +1,26 @@ ++From: Pablo Neira Ayuso ++Date: Tue, 2 Mar 2021 00:51:31 +0100 ++Subject: [PATCH] net: flow_offload: add FLOW_ACTION_PPPOE_PUSH ++ ++--- ++ ++--- a/include/net/flow_offload.h +++++ b/include/net/flow_offload.h ++@@ -147,6 +147,7 @@ enum flow_action_id { ++ FLOW_ACTION_MPLS_POP, ++ FLOW_ACTION_MPLS_MANGLE, ++ FLOW_ACTION_GATE, +++ FLOW_ACTION_PPPOE_PUSH, ++ NUM_FLOW_ACTIONS, ++ }; ++ ++@@ -271,6 +272,9 @@ struct flow_action_entry { ++ u32 num_entries; ++ struct action_gate_entry *entries; ++ } gate; +++ struct { /* FLOW_ACTION_PPPOE_PUSH */ +++ u16 sid; +++ } pppoe; ++ }; ++ struct flow_action_cookie *cookie; /* user defined action cookie */ ++ }; +diff --git a/target/linux/generic/pending-5.10/640-20-netfilter-flowtable-support-for-FLOW_ACTION_PPPOE_PU.patch b/target/linux/generic/pending-5.10/640-20-netfilter-flowtable-support-for-FLOW_ACTION_PPPOE_PU.patch +new file mode 100644 +index 0000000000..fcafff1fff +--- /dev/null ++++ b/target/linux/generic/pending-5.10/640-20-netfilter-flowtable-support-for-FLOW_ACTION_PPPOE_PU.patch +@@ -0,0 +1,31 @@ ++From: Pablo Neira Ayuso ++Date: Tue, 2 Mar 2021 01:01:50 +0100 ++Subject: [PATCH] netfilter: flowtable: support for ++ FLOW_ACTION_PPPOE_PUSH ++ ++--- ++ ++--- a/net/netfilter/nf_flow_table_offload.c +++++ b/net/netfilter/nf_flow_table_offload.c ++@@ -598,9 +598,18 @@ nf_flow_rule_route_common(struct net *ne ++ continue; ++ ++ entry = flow_action_entry_next(flow_rule); ++- entry->id = FLOW_ACTION_VLAN_PUSH; ++- entry->vlan.vid = other_tuple->encap[i].id; ++- entry->vlan.proto = other_tuple->encap[i].proto; +++ +++ switch (other_tuple->encap[i].proto) { +++ case htons(ETH_P_PPP_SES): +++ entry->id = FLOW_ACTION_PPPOE_PUSH; +++ entry->pppoe.sid = other_tuple->encap[i].id; +++ break; +++ case htons(ETH_P_8021Q): +++ entry->id = FLOW_ACTION_VLAN_PUSH; +++ entry->vlan.vid = other_tuple->encap[i].id; +++ entry->vlan.proto = other_tuple->encap[i].proto; +++ break; +++ } ++ } ++ ++ return 0; diff --git a/target/linux/generic/pending-5.10/655-increase_skb_pad.patch b/target/linux/generic/pending-5.10/655-increase_skb_pad.patch new file mode 100644 index 0000000000..ff39ddb8b3 @@ -28838,7 +34806,7 @@ index 0000000000..924baa0607 + static struct rtnl_link_ops ip6_link_ops __read_mostly = { diff --git a/target/linux/generic/pending-5.10/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/pending-5.10/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch new file mode 100644 -index 0000000000..fda982fce9 +index 0000000000..625cc430e2 --- /dev/null +++ b/target/linux/generic/pending-5.10/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch @@ -0,0 +1,263 @@ @@ -28963,7 +34931,7 @@ index 0000000000..fda982fce9 + static void ip6_link_failure(struct sk_buff *skb); + static void ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk, + struct sk_buff *skb, u32 mtu, -+@@ -327,6 +329,18 @@ static const struct rt6_info ip6_prohibi ++@@ -309,6 +311,18 @@ static const struct rt6_info ip6_prohibi + .rt6i_flags = (RTF_REJECT | RTF_NONEXTHOP), + }; + @@ -28982,7 +34950,7 @@ index 0000000000..fda982fce9 + static const struct rt6_info ip6_blk_hole_entry_template = { + .dst = { + .__refcnt = ATOMIC_INIT(1), -+@@ -1048,6 +1062,7 @@ static const int fib6_prop[RTN_MAX + 1] ++@@ -1030,6 +1044,7 @@ static const int fib6_prop[RTN_MAX + 1] + [RTN_BLACKHOLE] = -EINVAL, + [RTN_UNREACHABLE] = -EHOSTUNREACH, + [RTN_PROHIBIT] = -EACCES, @@ -28990,7 +34958,7 @@ index 0000000000..fda982fce9 + [RTN_THROW] = -EAGAIN, + [RTN_NAT] = -EINVAL, + [RTN_XRESOLVE] = -EINVAL, -+@@ -1083,6 +1098,10 @@ static void ip6_rt_init_dst_reject(struc ++@@ -1065,6 +1080,10 @@ static void ip6_rt_init_dst_reject(struc + rt->dst.output = ip6_pkt_prohibit_out; + rt->dst.input = ip6_pkt_prohibit; + break; @@ -29001,7 +34969,7 @@ index 0000000000..fda982fce9 + case RTN_THROW: + case RTN_UNREACHABLE: + default: -+@@ -4432,6 +4451,17 @@ static int ip6_pkt_prohibit_out(struct n ++@@ -4414,6 +4433,17 @@ static int ip6_pkt_prohibit_out(struct n + return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES); + } + @@ -29019,7 +34987,7 @@ index 0000000000..fda982fce9 + /* + * Allocate a dst for local (unicast / anycast) address. + */ -+@@ -4912,7 +4942,8 @@ static int rtm_to_fib6_config(struct sk_ ++@@ -4894,7 +4924,8 @@ static int rtm_to_fib6_config(struct sk_ + if (rtm->rtm_type == RTN_UNREACHABLE || + rtm->rtm_type == RTN_BLACKHOLE || + rtm->rtm_type == RTN_PROHIBIT || @@ -29029,7 +34997,7 @@ index 0000000000..fda982fce9 + cfg->fc_flags |= RTF_REJECT; + + if (rtm->rtm_type == RTN_LOCAL) -+@@ -6080,6 +6111,8 @@ static int ip6_route_dev_notify(struct n ++@@ -6062,6 +6093,8 @@ static int ip6_route_dev_notify(struct n + #ifdef CONFIG_IPV6_MULTIPLE_TABLES + net->ipv6.ip6_prohibit_entry->dst.dev = dev; + net->ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(dev); @@ -29038,7 +35006,7 @@ index 0000000000..fda982fce9 + net->ipv6.ip6_blk_hole_entry->dst.dev = dev; + net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev); + #endif -+@@ -6091,6 +6124,7 @@ static int ip6_route_dev_notify(struct n ++@@ -6073,6 +6106,7 @@ static int ip6_route_dev_notify(struct n + in6_dev_put_clear(&net->ipv6.ip6_null_entry->rt6i_idev); + #ifdef CONFIG_IPV6_MULTIPLE_TABLES + in6_dev_put_clear(&net->ipv6.ip6_prohibit_entry->rt6i_idev); @@ -29046,7 +35014,7 @@ index 0000000000..fda982fce9 + in6_dev_put_clear(&net->ipv6.ip6_blk_hole_entry->rt6i_idev); + #endif + } -+@@ -6282,6 +6316,8 @@ static int __net_init ip6_route_net_init ++@@ -6264,6 +6298,8 @@ static int __net_init ip6_route_net_init + + #ifdef CONFIG_IPV6_MULTIPLE_TABLES + net->ipv6.fib6_has_custom_rules = false; @@ -29055,7 +35023,7 @@ index 0000000000..fda982fce9 + net->ipv6.ip6_prohibit_entry = kmemdup(&ip6_prohibit_entry_template, + sizeof(*net->ipv6.ip6_prohibit_entry), + GFP_KERNEL); -+@@ -6292,11 +6328,21 @@ static int __net_init ip6_route_net_init ++@@ -6274,11 +6310,21 @@ static int __net_init ip6_route_net_init + ip6_template_metrics, true); + INIT_LIST_HEAD(&net->ipv6.ip6_prohibit_entry->rt6i_uncached); + @@ -29078,7 +35046,7 @@ index 0000000000..fda982fce9 + net->ipv6.ip6_blk_hole_entry->dst.ops = &net->ipv6.ip6_dst_ops; + dst_init_metrics(&net->ipv6.ip6_blk_hole_entry->dst, + ip6_template_metrics, true); -+@@ -6323,6 +6369,8 @@ out: ++@@ -6305,6 +6351,8 @@ out: + return ret; + + #ifdef CONFIG_IPV6_MULTIPLE_TABLES @@ -29087,7 +35055,7 @@ index 0000000000..fda982fce9 + out_ip6_prohibit_entry: + kfree(net->ipv6.ip6_prohibit_entry); + out_ip6_null_entry: -+@@ -6342,6 +6390,7 @@ static void __net_exit ip6_route_net_exi ++@@ -6324,6 +6372,7 @@ static void __net_exit ip6_route_net_exi + kfree(net->ipv6.ip6_null_entry); + #ifdef CONFIG_IPV6_MULTIPLE_TABLES + kfree(net->ipv6.ip6_prohibit_entry); @@ -29095,7 +35063,7 @@ index 0000000000..fda982fce9 + kfree(net->ipv6.ip6_blk_hole_entry); + #endif + dst_entries_destroy(&net->ipv6.ip6_dst_ops); -+@@ -6419,6 +6468,9 @@ void __init ip6_route_init_special_entri ++@@ -6401,6 +6450,9 @@ void __init ip6_route_init_special_entri + init_net.ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); + init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev; + init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); @@ -29163,7 +35131,7 @@ index 0000000000..0e7f35db89 + diff --git a/target/linux/generic/pending-5.10/680-NET-skip-GRO-for-foreign-MAC-addresses.patch b/target/linux/generic/pending-5.10/680-NET-skip-GRO-for-foreign-MAC-addresses.patch new file mode 100644 -index 0000000000..cd1b30b4af +index 0000000000..4e1ae4b2c8 --- /dev/null +++ b/target/linux/generic/pending-5.10/680-NET-skip-GRO-for-foreign-MAC-addresses.patch @@ -0,0 +1,149 @@ @@ -29180,7 +35148,7 @@ index 0000000000..cd1b30b4af + +--- a/include/linux/netdevice.h ++++ b/include/linux/netdevice.h -+@@ -2031,6 +2031,8 @@ struct net_device { ++@@ -2029,6 +2029,8 @@ struct net_device { + struct netdev_hw_addr_list mc; + struct netdev_hw_addr_list dev_addrs; + @@ -29201,7 +35169,7 @@ index 0000000000..cd1b30b4af + __u16 tc_index; /* traffic control index */ +--- a/net/core/dev.c ++++ b/net/core/dev.c -+@@ -5962,6 +5962,9 @@ static enum gro_result dev_gro_receive(s ++@@ -6017,6 +6017,9 @@ static enum gro_result dev_gro_receive(s + int same_flow; + int grow; + @@ -29211,7 +35179,7 @@ index 0000000000..cd1b30b4af + if (netif_elide_gro(skb->dev)) + goto normal; + -+@@ -7790,6 +7793,48 @@ static void __netdev_adjacent_dev_unlink ++@@ -7985,6 +7988,48 @@ static void __netdev_adjacent_dev_unlink + &upper_dev->adj_list.lower); + } + @@ -29260,7 +35228,7 @@ index 0000000000..cd1b30b4af + static int __netdev_upper_dev_link(struct net_device *dev, + struct net_device *upper_dev, bool master, + void *upper_priv, void *upper_info, -+@@ -7841,6 +7886,7 @@ static int __netdev_upper_dev_link(struc ++@@ -8036,6 +8081,7 @@ static int __netdev_upper_dev_link(struc + if (ret) + return ret; + @@ -29268,7 +35236,7 @@ index 0000000000..cd1b30b4af + ret = call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, + &changeupper_info.info); + ret = notifier_to_errno(ret); -+@@ -7937,6 +7983,7 @@ static void __netdev_upper_dev_unlink(st ++@@ -8132,6 +8178,7 @@ static void __netdev_upper_dev_unlink(st + + __netdev_adjacent_dev_unlink_neighbour(dev, upper_dev); + @@ -29276,7 +35244,7 @@ index 0000000000..cd1b30b4af + call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, + &changeupper_info.info); + -+@@ -8723,6 +8770,7 @@ int dev_set_mac_address(struct net_devic ++@@ -8918,6 +8965,7 @@ int dev_set_mac_address(struct net_devic + if (err) + return err; + dev->addr_assign_type = NET_ADDR_SET; @@ -29457,379 +35425,9 @@ index 0000000000..71fbfe9978 + addr = of_get_mac_addr(np, "mac-address"); + if (addr) + return addr; -diff --git a/target/linux/generic/pending-5.10/690-net-add-support-for-threaded-NAPI-polling.patch b/target/linux/generic/pending-5.10/690-net-add-support-for-threaded-NAPI-polling.patch -new file mode 100644 -index 0000000000..79b7832f2a ---- /dev/null -+++ b/target/linux/generic/pending-5.10/690-net-add-support-for-threaded-NAPI-polling.patch -@@ -0,0 +1,284 @@ -+From: Felix Fietkau -+Date: Sun, 26 Jul 2020 14:03:21 +0200 -+Subject: [PATCH] net: add support for threaded NAPI polling -+ -+For some drivers (especially 802.11 drivers), doing a lot of work in the NAPI -+poll function does not perform well. Since NAPI poll is bound to the CPU it -+was scheduled from, we can easily end up with a few very busy CPUs spending -+most of their time in softirq/ksoftirqd and some idle ones. -+ -+Introduce threaded NAPI for such drivers based on a workqueue. The API is the -+same except for using netif_threaded_napi_add instead of netif_napi_add. -+ -+In my tests with mt76 on MT7621 using threaded NAPI + a thread for tx scheduling -+improves LAN->WLAN bridging throughput by 10-50%. Throughput without threaded -+NAPI is wildly inconsistent, depending on the CPU that runs the tx scheduling -+thread. -+ -+With threaded NAPI, throughput seems stable and consistent (and higher than -+the best results I got without it). -+ -+Based on a patch by Hillf Danton -+ -+Cc: Hillf Danton -+Signed-off-by: Felix Fietkau -+--- -+ -+--- a/include/linux/netdevice.h -++++ b/include/linux/netdevice.h -+@@ -347,6 +347,7 @@ struct napi_struct { -+ struct list_head dev_list; -+ struct hlist_node napi_hash_node; -+ unsigned int napi_id; -++ struct work_struct work; -+ }; -+ -+ enum { -+@@ -357,6 +358,7 @@ enum { -+ NAPI_STATE_LISTED, /* NAPI added to system lists */ -+ NAPI_STATE_NO_BUSY_POLL,/* Do not add in napi_hash, no busy polling */ -+ NAPI_STATE_IN_BUSY_POLL,/* sk_busy_loop() owns this NAPI */ -++ NAPI_STATE_THREADED, /* Use threaded NAPI */ -+ }; -+ -+ enum { -+@@ -367,6 +369,7 @@ enum { -+ NAPIF_STATE_LISTED = BIT(NAPI_STATE_LISTED), -+ NAPIF_STATE_NO_BUSY_POLL = BIT(NAPI_STATE_NO_BUSY_POLL), -+ NAPIF_STATE_IN_BUSY_POLL = BIT(NAPI_STATE_IN_BUSY_POLL), -++ NAPIF_STATE_THREADED = BIT(NAPI_STATE_THREADED), -+ }; -+ -+ enum gro_result { -+@@ -2411,6 +2414,26 @@ void netif_napi_add(struct net_device *d -+ int (*poll)(struct napi_struct *, int), int weight); -+ -+ /** -++ * netif_threaded_napi_add - initialize a NAPI context -++ * @dev: network device -++ * @napi: NAPI context -++ * @poll: polling function -++ * @weight: default weight -++ * -++ * This variant of netif_napi_add() should be used from drivers using NAPI -++ * with CPU intensive poll functions. -++ * This will schedule polling from a high priority workqueue -++ */ -++static inline void netif_threaded_napi_add(struct net_device *dev, -++ struct napi_struct *napi, -++ int (*poll)(struct napi_struct *, int), -++ int weight) -++{ -++ set_bit(NAPI_STATE_THREADED, &napi->state); -++ netif_napi_add(dev, napi, poll, weight); -++} -++ -++/** -+ * netif_tx_napi_add - initialize a NAPI context -+ * @dev: network device -+ * @napi: NAPI context -+--- a/net/core/dev.c -++++ b/net/core/dev.c -+@@ -159,6 +159,7 @@ static DEFINE_SPINLOCK(offload_lock); -+ struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly; -+ struct list_head ptype_all __read_mostly; /* Taps */ -+ static struct list_head offload_base __read_mostly; -++static struct workqueue_struct *napi_workq __read_mostly; -+ -+ static int netif_rx_internal(struct sk_buff *skb); -+ static int call_netdevice_notifiers_info(unsigned long val, -+@@ -6404,6 +6405,11 @@ void __napi_schedule(struct napi_struct -+ { -+ unsigned long flags; -+ -++ if (test_bit(NAPI_STATE_THREADED, &n->state)) { -++ queue_work(napi_workq, &n->work); -++ return; -++ } -++ -+ local_irq_save(flags); -+ ____napi_schedule(this_cpu_ptr(&softnet_data), n); -+ local_irq_restore(flags); -+@@ -6451,6 +6457,11 @@ EXPORT_SYMBOL(napi_schedule_prep); -+ */ -+ void __napi_schedule_irqoff(struct napi_struct *n) -+ { -++ if (test_bit(NAPI_STATE_THREADED, &n->state)) { -++ queue_work(napi_workq, &n->work); -++ return; -++ } -++ -+ ____napi_schedule(this_cpu_ptr(&softnet_data), n); -+ } -+ EXPORT_SYMBOL(__napi_schedule_irqoff); -+@@ -6712,6 +6723,86 @@ static void init_gro_hash(struct napi_st -+ napi->gro_bitmask = 0; -+ } -+ -++static int __napi_poll(struct napi_struct *n, bool *repoll) -++{ -++ int work, weight; -++ -++ weight = n->weight; -++ -++ /* This NAPI_STATE_SCHED test is for avoiding a race -++ * with netpoll's poll_napi(). Only the entity which -++ * obtains the lock and sees NAPI_STATE_SCHED set will -++ * actually make the ->poll() call. Therefore we avoid -++ * accidentally calling ->poll() when NAPI is not scheduled. -++ */ -++ work = 0; -++ if (test_bit(NAPI_STATE_SCHED, &n->state)) { -++ work = n->poll(n, weight); -++ trace_napi_poll(n, work, weight); -++ } -++ -++ if (unlikely(work > weight)) -++ pr_err_once("NAPI poll function %pS returned %d, exceeding its budget of %d.\n", -++ n->poll, work, weight); -++ -++ if (likely(work < weight)) -++ return work; -++ -++ /* Drivers must not modify the NAPI state if they -++ * consume the entire weight. In such cases this code -++ * still "owns" the NAPI instance and therefore can -++ * move the instance around on the list at-will. -++ */ -++ if (unlikely(napi_disable_pending(n))) { -++ napi_complete(n); -++ return work; -++ } -++ -++ if (n->gro_bitmask) { -++ /* flush too old packets -++ * If HZ < 1000, flush all packets. -++ */ -++ napi_gro_flush(n, HZ >= 1000); -++ } -++ -++ gro_normal_list(n); -++ -++ *repoll = true; -++ -++ return work; -++} -++ -++static void napi_workfn(struct work_struct *work) -++{ -++ struct napi_struct *n = container_of(work, struct napi_struct, work); -++ void *have; -++ -++ for (;;) { -++ bool repoll = false; -++ -++ local_bh_disable(); -++ -++ have = netpoll_poll_lock(n); -++ __napi_poll(n, &repoll); -++ netpoll_poll_unlock(have); -++ -++ local_bh_enable(); -++ -++ if (!repoll) -++ return; -++ -++ if (!need_resched()) -++ continue; -++ -++ /* -++ * have to pay for the latency of task switch even if -++ * napi is scheduled -++ */ -++ queue_work(napi_workq, work); -++ return; -++ } -++} -++ -+ void netif_napi_add(struct net_device *dev, struct napi_struct *napi, -+ int (*poll)(struct napi_struct *, int), int weight) -+ { -+@@ -6735,6 +6826,7 @@ void netif_napi_add(struct net_device *d -+ #ifdef CONFIG_NETPOLL -+ napi->poll_owner = -1; -+ #endif -++ INIT_WORK(&napi->work, napi_workfn); -+ set_bit(NAPI_STATE_SCHED, &napi->state); -+ set_bit(NAPI_STATE_NPSVC, &napi->state); -+ list_add_rcu(&napi->dev_list, &dev->napi_list); -+@@ -6777,6 +6869,7 @@ void __netif_napi_del(struct napi_struct -+ if (!test_and_clear_bit(NAPI_STATE_LISTED, &napi->state)) -+ return; -+ -++ cancel_work_sync(&napi->work); -+ napi_hash_del(napi); -+ list_del_rcu(&napi->dev_list); -+ napi_free_frags(napi); -+@@ -6788,52 +6881,18 @@ EXPORT_SYMBOL(__netif_napi_del); -+ -+ static int napi_poll(struct napi_struct *n, struct list_head *repoll) -+ { -++ bool do_repoll = false; -+ void *have; -+- int work, weight; -++ int work; -+ -+ list_del_init(&n->poll_list); -+ -+ have = netpoll_poll_lock(n); -+ -+- weight = n->weight; -+- -+- /* This NAPI_STATE_SCHED test is for avoiding a race -+- * with netpoll's poll_napi(). Only the entity which -+- * obtains the lock and sees NAPI_STATE_SCHED set will -+- * actually make the ->poll() call. Therefore we avoid -+- * accidentally calling ->poll() when NAPI is not scheduled. -+- */ -+- work = 0; -+- if (test_bit(NAPI_STATE_SCHED, &n->state)) { -+- work = n->poll(n, weight); -+- trace_napi_poll(n, work, weight); -+- } -+- -+- if (unlikely(work > weight)) -+- pr_err_once("NAPI poll function %pS returned %d, exceeding its budget of %d.\n", -+- n->poll, work, weight); -+- -+- if (likely(work < weight)) -+- goto out_unlock; -++ work = __napi_poll(n, &do_repoll); -+ -+- /* Drivers must not modify the NAPI state if they -+- * consume the entire weight. In such cases this code -+- * still "owns" the NAPI instance and therefore can -+- * move the instance around on the list at-will. -+- */ -+- if (unlikely(napi_disable_pending(n))) { -+- napi_complete(n); -++ if (!do_repoll) -+ goto out_unlock; -+- } -+- -+- if (n->gro_bitmask) { -+- /* flush too old packets -+- * If HZ < 1000, flush all packets. -+- */ -+- napi_gro_flush(n, HZ >= 1000); -+- } -+- -+- gro_normal_list(n); -+ -+ /* Some drivers may have called napi_schedule -+ * prior to exhausting their budget. -+@@ -11288,6 +11347,10 @@ static int __init net_dev_init(void) -+ sd->backlog.weight = weight_p; -+ } -+ -++ napi_workq = alloc_workqueue("napi_workq", WQ_UNBOUND | WQ_HIGHPRI, -++ WQ_UNBOUND_MAX_ACTIVE | WQ_SYSFS); -++ BUG_ON(!napi_workq); -++ -+ dev_boot_phase = 0; -+ -+ /* The loopback device is special if any other network devices -diff --git a/target/linux/generic/pending-5.10/691-net-add-sysfs-attribute-for-enabling-threaded-NAPI.patch b/target/linux/generic/pending-5.10/691-net-add-sysfs-attribute-for-enabling-threaded-NAPI.patch -new file mode 100644 -index 0000000000..279ae2c25a ---- /dev/null -+++ b/target/linux/generic/pending-5.10/691-net-add-sysfs-attribute-for-enabling-threaded-NAPI.patch -@@ -0,0 +1,74 @@ -+From: Felix Fietkau -+Date: Fri, 21 Aug 2020 15:07:54 +0200 -+Subject: [PATCH] net: add sysfs attribute for enabling threaded NAPI -+ -+This can be used to enable threaded NAPI on drivers that did not explicitly -+request it. -+ -+Suggested-by: Eric Dumazet -+Signed-off-by: Felix Fietkau -+--- -+ -+--- a/net/core/net-sysfs.c -++++ b/net/core/net-sysfs.c -+@@ -472,6 +472,52 @@ static ssize_t proto_down_store(struct d -+ } -+ NETDEVICE_SHOW_RW(proto_down, fmt_dec); -+ -++static int change_napi_threaded(struct net_device *dev, unsigned long val) -++{ -++ struct napi_struct *napi; -++ -++ if (list_empty(&dev->napi_list)) -++ return -EOPNOTSUPP; -++ -++ list_for_each_entry(napi, &dev->napi_list, dev_list) { -++ if (val) -++ set_bit(NAPI_STATE_THREADED, &napi->state); -++ else -++ clear_bit(NAPI_STATE_THREADED, &napi->state); -++ } -++ -++ return 0; -++} -++ -++static ssize_t napi_threaded_store(struct device *dev, -++ struct device_attribute *attr, -++ const char *buf, size_t len) -++{ -++ return netdev_store(dev, attr, buf, len, change_napi_threaded); -++} -++ -++static ssize_t napi_threaded_show(struct device *dev, -++ struct device_attribute *attr, -++ char *buf) -++{ -++ struct net_device *netdev = to_net_dev(dev); -++ struct napi_struct *napi; -++ bool enabled = false; -++ -++ if (!rtnl_trylock()) -++ return restart_syscall(); -++ -++ list_for_each_entry(napi, &netdev->napi_list, dev_list) { -++ if (test_bit(NAPI_STATE_THREADED, &napi->state)) -++ enabled = true; -++ } -++ -++ rtnl_unlock(); -++ -++ return sprintf(buf, fmt_dec, enabled); -++} -++static DEVICE_ATTR_RW(napi_threaded); -++ -+ static ssize_t phys_port_id_show(struct device *dev, -+ struct device_attribute *attr, char *buf) -+ { -+@@ -564,6 +610,7 @@ static struct attribute *net_class_attrs -+ &dev_attr_tx_queue_len.attr, -+ &dev_attr_gro_flush_timeout.attr, -+ &dev_attr_napi_defer_hard_irqs.attr, -++ &dev_attr_napi_threaded.attr, -+ &dev_attr_phys_port_id.attr, -+ &dev_attr_phys_port_name.attr, -+ &dev_attr_phys_switch_id.attr, diff --git a/target/linux/generic/pending-5.10/703-phy-add-detach-callback-to-struct-phy_driver.patch b/target/linux/generic/pending-5.10/703-phy-add-detach-callback-to-struct-phy_driver.patch new file mode 100644 -index 0000000000..371cffc58b +index 0000000000..9aa54082a5 --- /dev/null +++ b/target/linux/generic/pending-5.10/703-phy-add-detach-callback-to-struct-phy_driver.patch @@ -0,0 +1,38 @@ @@ -29846,7 +35444,7 @@ index 0000000000..371cffc58b + +--- a/drivers/net/phy/phy_device.c ++++ b/drivers/net/phy/phy_device.c -+@@ -1663,6 +1663,9 @@ void phy_detach(struct phy_device *phyde ++@@ -1651,6 +1651,9 @@ void phy_detach(struct phy_device *phyde + struct module *ndev_owner = NULL; + struct mii_bus *bus; + @@ -29858,7 +35456,7 @@ index 0000000000..371cffc58b + sysfs_remove_link(&dev->dev.kobj, "phydev"); +--- a/include/linux/phy.h ++++ b/include/linux/phy.h -+@@ -759,6 +759,12 @@ struct phy_driver { ++@@ -761,6 +761,12 @@ struct phy_driver { + /** @handle_interrupt: Override default interrupt handling */ + irqreturn_t (*handle_interrupt)(struct phy_device *phydev); + @@ -29930,7 +35528,7 @@ index 0000000000..b063b10251 + * after HW reset: RX delay enabled and TX delay disabled diff --git a/target/linux/generic/pending-5.10/760-net-dsa-mv88e6xxx-fix-vlan-setup.patch b/target/linux/generic/pending-5.10/760-net-dsa-mv88e6xxx-fix-vlan-setup.patch new file mode 100644 -index 0000000000..e6a3d15b79 +index 0000000000..42b91fe4c3 --- /dev/null +++ b/target/linux/generic/pending-5.10/760-net-dsa-mv88e6xxx-fix-vlan-setup.patch @@ -0,0 +1,27 @@ @@ -29953,7 +35551,7 @@ index 0000000000..e6a3d15b79 + +--- a/drivers/net/dsa/mv88e6xxx/chip.c ++++ b/drivers/net/dsa/mv88e6xxx/chip.c -+@@ -2853,6 +2853,7 @@ static int mv88e6xxx_setup(struct dsa_sw ++@@ -2857,6 +2857,7 @@ static int mv88e6xxx_setup(struct dsa_sw + + chip->ds = ds; + ds->slave_mii_bus = mv88e6xxx_default_mdio_bus(chip); @@ -29963,7 +35561,7 @@ index 0000000000..e6a3d15b79 + diff --git a/target/linux/generic/pending-5.10/761-net-dsa-mt7530-Support-EEE-features.patch b/target/linux/generic/pending-5.10/761-net-dsa-mt7530-Support-EEE-features.patch new file mode 100644 -index 0000000000..3e4413db02 +index 0000000000..3e654f4b04 --- /dev/null +++ b/target/linux/generic/pending-5.10/761-net-dsa-mt7530-Support-EEE-features.patch @@ -0,0 +1,121 @@ @@ -29978,7 +35576,7 @@ index 0000000000..3e4413db02 +Signed-off-by: René van Dorst +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c -+@@ -2266,9 +2266,13 @@ static void mt753x_phylink_mac_link_up(s ++@@ -2264,9 +2264,13 @@ static void mt753x_phylink_mac_link_up(s + switch (speed) { + case SPEED_1000: + mcr |= PMCR_FORCE_SPEED_1000; @@ -29992,7 +35590,7 @@ index 0000000000..3e4413db02 + break; + } + if (duplex == DUPLEX_FULL) { -+@@ -2509,6 +2513,54 @@ mt753x_phy_write(struct dsa_switch *ds, ++@@ -2507,6 +2511,54 @@ mt753x_phy_write(struct dsa_switch *ds, + return priv->info->phy_write(ds, port, regnum, val); + } + @@ -30047,7 +35645,7 @@ index 0000000000..3e4413db02 + static const struct dsa_switch_ops mt7530_switch_ops = { + .get_tag_protocol = mtk_get_tag_protocol, + .setup = mt753x_setup, -+@@ -2537,6 +2589,8 @@ static const struct dsa_switch_ops mt753 ++@@ -2535,6 +2587,8 @@ static const struct dsa_switch_ops mt753 + .phylink_mac_an_restart = mt753x_phylink_mac_an_restart, + .phylink_mac_link_down = mt753x_phylink_mac_link_down, + .phylink_mac_link_up = mt753x_phylink_mac_link_up, @@ -30088,6 +35686,412 @@ index 0000000000..3e4413db02 + + struct mt7530_port ports[MT7530_NUM_PORTS]; + /* protect among processes for registers access*/ +diff --git a/target/linux/generic/pending-5.10/762-net-bridge-switchdev-Refactor-br_switchdev_fdb_notif.patch b/target/linux/generic/pending-5.10/762-net-bridge-switchdev-Refactor-br_switchdev_fdb_notif.patch +new file mode 100644 +index 0000000000..fbc8342b0e +--- /dev/null ++++ b/target/linux/generic/pending-5.10/762-net-bridge-switchdev-Refactor-br_switchdev_fdb_notif.patch +@@ -0,0 +1,77 @@ ++From 46fe6cecb296d850c1ee2b333e57093ac4b733f3 Mon Sep 17 00:00:00 2001 ++From: Tobias Waldekranz ++Date: Sat, 16 Jan 2021 02:25:09 +0100 ++Subject: [PATCH] net: bridge: switchdev: Refactor br_switchdev_fdb_notify ++ ++Instead of having to add more and more arguments to ++br_switchdev_fdb_call_notifiers, get rid of it and build the info ++struct directly in br_switchdev_fdb_notify. ++ ++Signed-off-by: Tobias Waldekranz ++Reviewed-by: Vladimir Oltean ++--- ++ net/bridge/br_switchdev.c | 41 +++++++++++---------------------------- ++ 1 file changed, 11 insertions(+), 30 deletions(-) ++ ++--- a/net/bridge/br_switchdev.c +++++ b/net/bridge/br_switchdev.c ++@@ -102,25 +102,16 @@ int br_switchdev_set_port_flag(struct ne ++ return 0; ++ } ++ ++-static void ++-br_switchdev_fdb_call_notifiers(bool adding, const unsigned char *mac, ++- u16 vid, struct net_device *dev, ++- bool added_by_user, bool offloaded) ++-{ ++- struct switchdev_notifier_fdb_info info; ++- unsigned long notifier_type; ++- ++- info.addr = mac; ++- info.vid = vid; ++- info.added_by_user = added_by_user; ++- info.offloaded = offloaded; ++- notifier_type = adding ? SWITCHDEV_FDB_ADD_TO_DEVICE : SWITCHDEV_FDB_DEL_TO_DEVICE; ++- call_switchdev_notifiers(notifier_type, dev, &info.info, NULL); ++-} ++- ++ void ++ br_switchdev_fdb_notify(const struct net_bridge_fdb_entry *fdb, int type) ++ { +++ struct switchdev_notifier_fdb_info info = { +++ .addr = fdb->key.addr.addr, +++ .vid = fdb->key.vlan_id, +++ .added_by_user = test_bit(BR_FDB_ADDED_BY_USER, &fdb->flags), +++ .offloaded = test_bit(BR_FDB_OFFLOADED, &fdb->flags), +++ }; +++ ++ if (!fdb->dst) ++ return; ++ if (test_bit(BR_FDB_LOCAL, &fdb->flags)) ++@@ -128,22 +119,12 @@ br_switchdev_fdb_notify(const struct net ++ ++ switch (type) { ++ case RTM_DELNEIGH: ++- br_switchdev_fdb_call_notifiers(false, fdb->key.addr.addr, ++- fdb->key.vlan_id, ++- fdb->dst->dev, ++- test_bit(BR_FDB_ADDED_BY_USER, ++- &fdb->flags), ++- test_bit(BR_FDB_OFFLOADED, ++- &fdb->flags)); +++ call_switchdev_notifiers(SWITCHDEV_FDB_DEL_TO_DEVICE, +++ fdb->dst->dev, &info.info, NULL); ++ break; ++ case RTM_NEWNEIGH: ++- br_switchdev_fdb_call_notifiers(true, fdb->key.addr.addr, ++- fdb->key.vlan_id, ++- fdb->dst->dev, ++- test_bit(BR_FDB_ADDED_BY_USER, ++- &fdb->flags), ++- test_bit(BR_FDB_OFFLOADED, ++- &fdb->flags)); +++ call_switchdev_notifiers(SWITCHDEV_FDB_ADD_TO_DEVICE, +++ fdb->dst->dev, &info.info, NULL); ++ break; ++ } ++ } +diff --git a/target/linux/generic/pending-5.10/763-net-bridge-switchdev-Include-local-flag-in-FDB-notif.patch b/target/linux/generic/pending-5.10/763-net-bridge-switchdev-Include-local-flag-in-FDB-notif.patch +new file mode 100644 +index 0000000000..41374c88df +--- /dev/null ++++ b/target/linux/generic/pending-5.10/763-net-bridge-switchdev-Include-local-flag-in-FDB-notif.patch +@@ -0,0 +1,42 @@ ++From ec5be4f79026282925ae383caa431a8d41e3456a Mon Sep 17 00:00:00 2001 ++From: Tobias Waldekranz ++Date: Sat, 16 Jan 2021 02:25:10 +0100 ++Subject: [PATCH] net: bridge: switchdev: Include local flag in FDB ++ notifications ++ ++Some switchdev drivers, notably DSA, ignore all dynamically learned ++address notifications (!added_by_user) as these are autonomously added ++by the switch. Previously, such a notification was indistinguishable ++from a local address notification. Include a local bit in the ++notification so that the two classes can be discriminated. ++ ++This allows DSA-like devices to add local addresses to the hardware ++FDB (with the CPU as the destination), thereby avoiding flows towards ++the CPU being flooded by the switch as unknown unicast. ++ ++Signed-off-by: Tobias Waldekranz ++--- ++ include/net/switchdev.h | 1 + ++ net/bridge/br_switchdev.c | 1 + ++ 2 files changed, 2 insertions(+) ++ ++--- a/include/net/switchdev.h +++++ b/include/net/switchdev.h ++@@ -224,6 +224,7 @@ struct switchdev_notifier_fdb_info { ++ const unsigned char *addr; ++ u16 vid; ++ u8 added_by_user:1, +++ local:1, ++ offloaded:1; ++ }; ++ ++--- a/net/bridge/br_switchdev.c +++++ b/net/bridge/br_switchdev.c ++@@ -109,6 +109,7 @@ br_switchdev_fdb_notify(const struct net ++ .addr = fdb->key.addr.addr, ++ .vid = fdb->key.vlan_id, ++ .added_by_user = test_bit(BR_FDB_ADDED_BY_USER, &fdb->flags), +++ .local = test_bit(BR_FDB_LOCAL, &fdb->flags), ++ .offloaded = test_bit(BR_FDB_OFFLOADED, &fdb->flags), ++ }; ++ +diff --git a/target/linux/generic/pending-5.10/764-net-bridge-switchdev-Send-FDB-notifications-for-host.patch b/target/linux/generic/pending-5.10/764-net-bridge-switchdev-Send-FDB-notifications-for-host.patch +new file mode 100644 +index 0000000000..0e773888df +--- /dev/null ++++ b/target/linux/generic/pending-5.10/764-net-bridge-switchdev-Send-FDB-notifications-for-host.patch +@@ -0,0 +1,96 @@ ++From 2e50fd9322047253c327550b4485cf8761035a8c Mon Sep 17 00:00:00 2001 ++From: Tobias Waldekranz ++Date: Sat, 16 Jan 2021 02:25:11 +0100 ++Subject: [PATCH] net: bridge: switchdev: Send FDB notifications for host ++ addresses ++ ++Treat addresses added to the bridge itself in the same way as regular ++ports and send out a notification so that drivers may sync it down to ++the hardware FDB. ++ ++Signed-off-by: Tobias Waldekranz ++--- ++ net/bridge/br_fdb.c | 4 ++-- ++ net/bridge/br_private.h | 7 ++++--- ++ net/bridge/br_switchdev.c | 11 +++++------ ++ 3 files changed, 11 insertions(+), 11 deletions(-) ++ ++--- a/net/bridge/br_fdb.c +++++ b/net/bridge/br_fdb.c ++@@ -602,7 +602,7 @@ void br_fdb_update(struct net_bridge *br ++ /* fastpath: update of existing entry */ ++ if (unlikely(source != fdb->dst && ++ !test_bit(BR_FDB_STICKY, &fdb->flags))) { ++- br_switchdev_fdb_notify(fdb, RTM_DELNEIGH); +++ br_switchdev_fdb_notify(br, fdb, RTM_DELNEIGH); ++ fdb->dst = source; ++ fdb_modified = true; ++ /* Take over HW learned entry */ ++@@ -735,7 +735,7 @@ static void fdb_notify(struct net_bridge ++ int err = -ENOBUFS; ++ ++ if (swdev_notify) ++- br_switchdev_fdb_notify(fdb, type); +++ br_switchdev_fdb_notify(br, fdb, type); ++ ++ skb = nlmsg_new(fdb_nlmsg_size(), GFP_ATOMIC); ++ if (skb == NULL) ++--- a/net/bridge/br_private.h +++++ b/net/bridge/br_private.h ++@@ -1527,8 +1527,8 @@ bool nbp_switchdev_allowed_egress(const ++ int br_switchdev_set_port_flag(struct net_bridge_port *p, ++ unsigned long flags, ++ unsigned long mask); ++-void br_switchdev_fdb_notify(const struct net_bridge_fdb_entry *fdb, ++- int type); +++void br_switchdev_fdb_notify(struct net_bridge *br, +++ const struct net_bridge_fdb_entry *fdb, int type); ++ int br_switchdev_port_vlan_add(struct net_device *dev, u16 vid, u16 flags, ++ struct netlink_ext_ack *extack); ++ int br_switchdev_port_vlan_del(struct net_device *dev, u16 vid); ++@@ -1574,7 +1574,8 @@ static inline int br_switchdev_port_vlan ++ } ++ ++ static inline void ++-br_switchdev_fdb_notify(const struct net_bridge_fdb_entry *fdb, int type) +++br_switchdev_fdb_notify(struct net_bridge *br, +++ const struct net_bridge_fdb_entry *fdb, int type) ++ { ++ } ++ ++--- a/net/bridge/br_switchdev.c +++++ b/net/bridge/br_switchdev.c ++@@ -103,7 +103,8 @@ int br_switchdev_set_port_flag(struct ne ++ } ++ ++ void ++-br_switchdev_fdb_notify(const struct net_bridge_fdb_entry *fdb, int type) +++br_switchdev_fdb_notify(struct net_bridge *br, +++ const struct net_bridge_fdb_entry *fdb, int type) ++ { ++ struct switchdev_notifier_fdb_info info = { ++ .addr = fdb->key.addr.addr, ++@@ -112,20 +113,19 @@ br_switchdev_fdb_notify(const struct net ++ .local = test_bit(BR_FDB_LOCAL, &fdb->flags), ++ .offloaded = test_bit(BR_FDB_OFFLOADED, &fdb->flags), ++ }; +++ struct net_device *dev = fdb->dst ? fdb->dst->dev : br->dev; ++ ++- if (!fdb->dst) ++- return; ++ if (test_bit(BR_FDB_LOCAL, &fdb->flags)) ++ return; ++ ++ switch (type) { ++ case RTM_DELNEIGH: ++ call_switchdev_notifiers(SWITCHDEV_FDB_DEL_TO_DEVICE, ++- fdb->dst->dev, &info.info, NULL); +++ dev, &info.info, NULL); ++ break; ++ case RTM_NEWNEIGH: ++ call_switchdev_notifiers(SWITCHDEV_FDB_ADD_TO_DEVICE, ++- fdb->dst->dev, &info.info, NULL); +++ dev, &info.info, NULL); ++ break; ++ } ++ } +diff --git a/target/linux/generic/pending-5.10/765-net-dsa-Include-local-addresses-in-assisted-CPU-port.patch b/target/linux/generic/pending-5.10/765-net-dsa-Include-local-addresses-in-assisted-CPU-port.patch +new file mode 100644 +index 0000000000..c86a854212 +--- /dev/null ++++ b/target/linux/generic/pending-5.10/765-net-dsa-Include-local-addresses-in-assisted-CPU-port.patch +@@ -0,0 +1,36 @@ ++From dd082716b43a3684b2f473ae5d1e76d1c076d86d Mon Sep 17 00:00:00 2001 ++From: Tobias Waldekranz ++Date: Sat, 16 Jan 2021 02:25:12 +0100 ++Subject: [PATCH] net: dsa: Include local addresses in assisted CPU port ++ learning ++ ++Add local addresses (i.e. the ports' MAC addresses) to the hardware ++FDB when assisted CPU port learning is enabled. ++ ++NOTE: The bridge's own MAC address is also "local". If that address is ++not shared with any port, the bridge's MAC is not be added by this ++functionality - but the following commit takes care of that case. ++ ++Signed-off-by: Tobias Waldekranz ++--- ++ net/dsa/slave.c | 8 +++++--- ++ 1 file changed, 5 insertions(+), 3 deletions(-) ++ ++--- a/net/dsa/slave.c +++++ b/net/dsa/slave.c ++@@ -2189,10 +2189,12 @@ static int dsa_slave_switchdev_event(str ++ fdb_info = ptr; ++ ++ if (dsa_slave_dev_check(dev)) { ++- if (!fdb_info->added_by_user) ++- return NOTIFY_OK; ++- ++ dp = dsa_slave_to_port(dev); +++ +++ if (fdb_info->local && dp->ds->assisted_learning_on_cpu_port) +++ dp = dp->cpu_dp; +++ else if (!fdb_info->added_by_user) +++ return NOTIFY_OK; ++ } else { ++ /* Snoop addresses learnt on foreign interfaces ++ * bridged with us, for switches that don't +diff --git a/target/linux/generic/pending-5.10/766-net-dsa-Include-bridge-addresses-in-assisted-CPU-por.patch b/target/linux/generic/pending-5.10/766-net-dsa-Include-bridge-addresses-in-assisted-CPU-por.patch +new file mode 100644 +index 0000000000..bf356422de +--- /dev/null ++++ b/target/linux/generic/pending-5.10/766-net-dsa-Include-bridge-addresses-in-assisted-CPU-por.patch +@@ -0,0 +1,30 @@ ++From 0663ebde114a6fb2c28c622ba5212b302d4d2581 Mon Sep 17 00:00:00 2001 ++From: Tobias Waldekranz ++Date: Sat, 16 Jan 2021 02:25:13 +0100 ++Subject: [PATCH] net: dsa: Include bridge addresses in assisted CPU port ++ learning ++ ++Now that notifications are sent out for addresses added to the bridge ++itself, extend DSA to include those addresses in the hardware FDB when ++assisted CPU port learning is enabled. ++ ++Signed-off-by: Tobias Waldekranz ++--- ++ net/dsa/slave.c | 6 +++++- ++ 1 file changed, 5 insertions(+), 1 deletion(-) ++ ++--- a/net/dsa/slave.c +++++ b/net/dsa/slave.c ++@@ -2203,7 +2203,11 @@ static int dsa_slave_switchdev_event(str ++ struct net_device *br_dev; ++ struct dsa_slave_priv *p; ++ ++- br_dev = netdev_master_upper_dev_get_rcu(dev); +++ if (netif_is_bridge_master(dev)) +++ br_dev = dev; +++ else +++ br_dev = netdev_master_upper_dev_get_rcu(dev); +++ ++ if (!br_dev) ++ return NOTIFY_DONE; ++ +diff --git a/target/linux/generic/pending-5.10/767-net-dsa-Sync-static-FDB-entries-on-foreign-interface.patch b/target/linux/generic/pending-5.10/767-net-dsa-Sync-static-FDB-entries-on-foreign-interface.patch +new file mode 100644 +index 0000000000..84ad38f6eb +--- /dev/null ++++ b/target/linux/generic/pending-5.10/767-net-dsa-Sync-static-FDB-entries-on-foreign-interface.patch +@@ -0,0 +1,56 @@ ++From 81e39fd78db82fb51b05fff309b9c521f1a0bc5a Mon Sep 17 00:00:00 2001 ++From: Tobias Waldekranz ++Date: Sat, 16 Jan 2021 02:25:14 +0100 ++Subject: [PATCH] net: dsa: Sync static FDB entries on foreign interfaces to ++ hardware ++ ++Reuse the "assisted_learning_on_cpu_port" functionality to always add ++entries for user-configured entries on foreign interfaces, even if ++assisted_learning_on_cpu_port is not enabled. E.g. in this situation: ++ ++ br0 ++ / \ ++swp0 dummy0 ++ ++$ bridge fdb add 02:00:de:ad:00:01 dev dummy0 vlan 1 master ++ ++Results in DSA adding an entry in the hardware FDB, pointing this ++address towards the CPU port. ++ ++The same is true for entries added to the bridge itself, e.g: ++ ++$ bridge fdb add 02:00:de:ad:00:01 dev br0 vlan 1 self ++ ++Signed-off-by: Tobias Waldekranz ++--- ++ net/dsa/slave.c | 12 ++++++++---- ++ 1 file changed, 8 insertions(+), 4 deletions(-) ++ ++--- a/net/dsa/slave.c +++++ b/net/dsa/slave.c ++@@ -2196,9 +2196,12 @@ static int dsa_slave_switchdev_event(str ++ else if (!fdb_info->added_by_user) ++ return NOTIFY_OK; ++ } else { ++- /* Snoop addresses learnt on foreign interfaces ++- * bridged with us, for switches that don't ++- * automatically learn SA from CPU-injected traffic +++ /* Snoop addresses added to foreign interfaces +++ * bridged with us, or the bridge +++ * itself. Dynamically learned addresses can +++ * also be added for switches that don't +++ * automatically learn SA from CPU-injected +++ * traffic. ++ */ ++ struct net_device *br_dev; ++ struct dsa_slave_priv *p; ++@@ -2220,7 +2223,8 @@ static int dsa_slave_switchdev_event(str ++ ++ dp = p->dp->cpu_dp; ++ ++- if (!dp->ds->assisted_learning_on_cpu_port) +++ if (!fdb_info->added_by_user && +++ !dp->ds->assisted_learning_on_cpu_port) ++ return NOTIFY_DONE; ++ } ++ +diff --git a/target/linux/generic/pending-5.10/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch b/target/linux/generic/pending-5.10/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch +new file mode 100644 +index 0000000000..5b8d058247 +--- /dev/null ++++ b/target/linux/generic/pending-5.10/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch +@@ -0,0 +1,27 @@ ++From: Tobias Waldekranz ++Subject: [RFC net-next 7/7] net: dsa: mv88e6xxx: Request assisted learning on CPU port ++Date: Sat, 16 Jan 2021 02:25:15 +0100 ++Archived-At: ++ ++While the hardware is capable of performing learning on the CPU port, ++it requires alot of additions to the bridge's forwarding path in order ++to handle multi-destination traffic correctly. ++ ++Until that is in place, opt for the next best thing and let DSA sync ++the relevant addresses down to the hardware FDB. ++ ++Signed-off-by: Tobias Waldekranz ++--- ++ drivers/net/dsa/mv88e6xxx/chip.c | 1 + ++ 1 file changed, 1 insertion(+) ++ ++--- a/drivers/net/dsa/mv88e6xxx/chip.c +++++ b/drivers/net/dsa/mv88e6xxx/chip.c ++@@ -5405,6 +5405,7 @@ static int mv88e6xxx_register_switch(str ++ ds->ops = &mv88e6xxx_switch_ops; ++ ds->ageing_time_min = chip->info->age_time_coeff; ++ ds->ageing_time_max = chip->info->age_time_coeff * U8_MAX; +++ ds->assisted_learning_on_cpu_port = true; ++ ++ dev_set_drvdata(dev, ds); ++ diff --git a/target/linux/generic/pending-5.10/770-00-net-ethernet-mtk_eth_soc-use-napi_consume_skb.patch b/target/linux/generic/pending-5.10/770-00-net-ethernet-mtk_eth_soc-use-napi_consume_skb.patch new file mode 100644 index 0000000000..85c859b388 @@ -30979,7 +36983,7 @@ index 0000000000..e94b352b9c + __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), diff --git a/target/linux/generic/pending-5.10/770-15-net-ethernet-mtk_eth_soc-add-support-for-initializin.patch b/target/linux/generic/pending-5.10/770-15-net-ethernet-mtk_eth_soc-add-support-for-initializin.patch new file mode 100644 -index 0000000000..fa4803211a +index 0000000000..09282175b0 --- /dev/null +++ b/target/linux/generic/pending-5.10/770-15-net-ethernet-mtk_eth_soc-add-support-for-initializin.patch @@ -0,0 +1,1307 @@ @@ -31170,7 +37174,7 @@ index 0000000000..fa4803211a ++{ ++ unsigned long timeout = jiffies + HZ; ++ -++ while (time_is_before_jiffies(timeout)) { +++ while (time_is_after_jiffies(timeout)) { ++ if (!(ppe_r32(ppe, MTK_PPE_GLO_CFG) & MTK_PPE_GLO_CFG_BUSY)) ++ return 0; ++ @@ -32292,10 +38296,10 @@ index 0000000000..fa4803211a ++#endif diff --git a/target/linux/generic/pending-5.10/770-16-net-ethernet-mtk_eth_soc-add-flow-offloading-support.patch b/target/linux/generic/pending-5.10/770-16-net-ethernet-mtk_eth_soc-add-flow-offloading-support.patch new file mode 100644 -index 0000000000..fa9cbcafc8 +index 0000000000..2f1ae6cde6 --- /dev/null +++ b/target/linux/generic/pending-5.10/770-16-net-ethernet-mtk_eth_soc-add-flow-offloading-support.patch -@@ -0,0 +1,561 @@ +@@ -0,0 +1,574 @@ +From: Felix Fietkau +Date: Thu, 10 Dec 2020 12:19:18 +0100 +Subject: [PATCH] net: ethernet: mtk_eth_soc: add flow offloading support @@ -32378,7 +38382,7 @@ index 0000000000..fa9cbcafc8 + #endif /* MTK_ETH_H */ +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c -+@@ -0,0 +1,478 @@ ++@@ -0,0 +1,491 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Copyright (C) 2020 Felix Fietkau @@ -32411,6 +38415,10 @@ index 0000000000..fa9cbcafc8 ++ __be16 proto; ++ u8 num; ++ } vlan; +++ struct { +++ u16 sid; +++ u8 num; +++ } pppoe; ++}; ++ ++struct mtk_flow_entry { @@ -32609,13 +38617,20 @@ index 0000000000..fa9cbcafc8 ++ break; ++ case FLOW_ACTION_VLAN_PUSH: ++ if (data.vlan.num == 1 || -++ data.vlan.proto != ETH_P_8021Q) +++ act->vlan.proto != htons(ETH_P_8021Q)) ++ return -EOPNOTSUPP; ++ ++ data.vlan.id = act->vlan.vid; ++ data.vlan.proto = act->vlan.proto; ++ data.vlan.num++; ++ break; +++ case FLOW_ACTION_PPPOE_PUSH: +++ if (data.pppoe.num == 1) +++ return -EOPNOTSUPP; +++ +++ data.pppoe.sid = act->pppoe.sid; +++ data.pppoe.num++; +++ break; ++ default: ++ return -EOPNOTSUPP; ++ } @@ -32690,11 +38705,13 @@ index 0000000000..fa9cbcafc8 ++ } ++ ++ if (data.vlan.num == 1) { -++ if (data.vlan.proto != ETH_P_8021Q) +++ if (data.vlan.proto != htons(ETH_P_8021Q)) ++ return -EOPNOTSUPP; ++ ++ mtk_foe_entry_set_vlan(&foe, data.vlan.id); ++ } +++ if (data.pppoe.num == 1) +++ mtk_foe_entry_set_pppoe(&foe, data.pppoe.sid); ++ ++ err = mtk_flow_set_output_device(eth, &foe, odev); ++ if (err) @@ -33156,7 +39173,7 @@ index 0000000000..33eb34c913 + return -ENOMEM; diff --git a/target/linux/generic/pending-5.10/834-ledtrig-libata.patch b/target/linux/generic/pending-5.10/834-ledtrig-libata.patch new file mode 100644 -index 0000000000..623e48085d +index 0000000000..a52e712d8c --- /dev/null +++ b/target/linux/generic/pending-5.10/834-ledtrig-libata.patch @@ -0,0 +1,149 @@ @@ -33268,11 +39285,11 @@ index 0000000000..623e48085d ++ for (i = 0; i < host->n_ports; i++) { ++ if (unlikely(!host->ports[i]->ledtrig)) ++ continue; -++ ++ ++ snprintf(host->ports[i]->ledtrig_name, ++ sizeof(host->ports[i]->ledtrig_name), "ata%u", ++ host->ports[i]->print_id); -+ +++ ++ host->ports[i]->ledtrig->name = host->ports[i]->ledtrig_name; ++ ++ if (led_trigger_register(host->ports[i]->ledtrig)) { @@ -33309,9 +39326,41 @@ index 0000000000..623e48085d + /* owned by EH */ + u8 sector_buf[ATA_SECT_SIZE] ____cacheline_aligned; + }; +diff --git a/target/linux/generic/pending-5.10/840-hwrng-bcm2835-set-quality-to-1000.patch b/target/linux/generic/pending-5.10/840-hwrng-bcm2835-set-quality-to-1000.patch +new file mode 100644 +index 0000000000..580f0b1bfa +--- /dev/null ++++ b/target/linux/generic/pending-5.10/840-hwrng-bcm2835-set-quality-to-1000.patch +@@ -0,0 +1,26 @@ ++From d6988cf1d16faac56899918bb2b1be8d85155e3f Mon Sep 17 00:00:00 2001 ++From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= ++Date: Sat, 20 Feb 2021 18:36:38 +0100 ++Subject: [PATCH] hwrng: bcm2835: set quality to 1000 ++MIME-Version: 1.0 ++Content-Type: text/plain; charset=UTF-8 ++Content-Transfer-Encoding: 8bit ++ ++This allows devices without a high precission timer to reduce boot from >100s ++to <30s. ++ ++Signed-off-by: Álvaro Fernández Rojas ++--- ++ drivers/char/hw_random/bcm2835-rng.c | 1 + ++ 1 file changed, 1 insertion(+) ++ ++--- a/drivers/char/hw_random/bcm2835-rng.c +++++ b/drivers/char/hw_random/bcm2835-rng.c ++@@ -163,6 +163,7 @@ static int bcm2835_rng_probe(struct plat ++ priv->rng.init = bcm2835_rng_init; ++ priv->rng.read = bcm2835_rng_read; ++ priv->rng.cleanup = bcm2835_rng_cleanup; +++ priv->rng.quality = 1000; ++ ++ if (dev_of_node(dev)) { ++ rng_id = of_match_node(bcm2835_rng_of_match, dev->of_node); diff --git a/target/linux/generic/pending-5.10/920-mangle_bootargs.patch b/target/linux/generic/pending-5.10/920-mangle_bootargs.patch new file mode 100644 -index 0000000000..14fdef31fd +index 0000000000..9008a88e2e --- /dev/null +++ b/target/linux/generic/pending-5.10/920-mangle_bootargs.patch @@ -0,0 +1,71 @@ @@ -33330,7 +39379,7 @@ index 0000000000..14fdef31fd + +--- a/init/Kconfig ++++ b/init/Kconfig -+@@ -1780,6 +1780,15 @@ config EMBEDDED ++@@ -1791,6 +1791,15 @@ config EMBEDDED + an embedded system so certain expert options are available + for configuration. + diff --git a/backports/0004-generic-ar8216-update-version-switch-for-of_get_phy_.patch b/backports/0004-generic-ar8216-update-version-switch-for-of_get_phy_.patch deleted file mode 100644 index 26e1c37f2..000000000 --- a/backports/0004-generic-ar8216-update-version-switch-for-of_get_phy_.patch +++ /dev/null @@ -1,45 +0,0 @@ -From e1053344ae44ac022e1e8262169d7194442d78a6 Mon Sep 17 00:00:00 2001 -From: Adrian Schmutzler -Date: Tue, 16 Feb 2021 22:56:06 +0100 -Subject: [PATCH 04/22] generic: ar8216: update version switch for - of_get_phy_mode fix - -Kernel has changed the of_get_phy_mode API in commit 0c65b2b90d13 -("net: of_get_phy_mode: Change API to solve int/unit warnings"). - -This is already included in kernel 5.5, so fix the version switch -(though this will not actually matter for the versions we support). - -Similar driver adjustments to account for the API change will -probably be necessary to various other local drivers. - -Signed-off-by: Adrian Schmutzler ---- - target/linux/generic/files/drivers/net/phy/ar8216.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c -index d48a415d50..ef0fc54949 100644 ---- a/target/linux/generic/files/drivers/net/phy/ar8216.c -+++ b/target/linux/generic/files/drivers/net/phy/ar8216.c -@@ -891,7 +891,7 @@ ar8216_phy_write(struct ar8xxx_priv *priv, int addr, int regnum, u16 val) - static int - ar8229_hw_init(struct ar8xxx_priv *priv) - { --#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0) - phy_interface_t phy_if_mode; - #else - int phy_if_mode; -@@ -903,7 +903,7 @@ ar8229_hw_init(struct ar8xxx_priv *priv) - ar8xxx_write(priv, AR8216_REG_CTRL, AR8216_CTRL_RESET); - ar8xxx_reg_wait(priv, AR8216_REG_CTRL, AR8216_CTRL_RESET, 0, 1000); - --#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0) - of_get_phy_mode(priv->pdev->of_node, &phy_if_mode); - #else - phy_if_mode = of_get_phy_mode(priv->pdev->of_node); --- -2.25.1 - diff --git a/backports/0012-mediatek-add-work-in-progress-linux-5.10-support.patch b/backports/0004-mediatek-update-to-latest-HEAD.patch similarity index 96% rename from backports/0012-mediatek-add-work-in-progress-linux-5.10-support.patch rename to backports/0004-mediatek-update-to-latest-HEAD.patch index 352209137..ea00b14b7 100644 --- a/backports/0012-mediatek-add-work-in-progress-linux-5.10-support.patch +++ b/backports/0004-mediatek-update-to-latest-HEAD.patch @@ -1,14 +1,20 @@ -From 216db427fb2688b59099410fb5853795aa6c0b4a Mon Sep 17 00:00:00 2001 +From 1c4e9e9ae8d5b765da47891f0e430e6ae360b6fb Mon Sep 17 00:00:00 2001 From: Felix Fietkau -Date: Sat, 24 Oct 2020 21:15:20 +0200 -Subject: [PATCH 12/22] mediatek: add work-in-progress linux 5.10 support +Date: Thu, 9 Apr 2020 09:53:24 +0200 +Subject: [PATCH 01/34] mediatek: update to latest trunk version Signed-off-by: Felix Fietkau --- - target/linux/mediatek/Makefile | 2 +- - .../mt7622-bananapi-bpi-r64-rootdisk.dts | 593 + - .../mediatek/mt7622-elecom-wrc-2533gent.dts | 608 + - .../boot/dts/mediatek/mt7622-rfb1-ubi.dts | 646 + + target/linux/mediatek/Makefile | 4 +- + .../dts/mt7622-buffalo-wsr-2533dhp2.dts | 339 + + .../mt7622-elecom-wrc-2533gent.dts | 3 +- + .../mediatek/dts/mt7622-linksys-e8450-ubi.dts | 61 + + .../mediatek/dts/mt7622-linksys-e8450.dts | 106 + + .../mt7622-linksys-e8450.dtsi} | 344 +- + target/linux/mediatek/dts/mt7622-rfb1-ubi.dts | 68 + + .../mt7622-ubnt-unifi-6-lr.dts | 0 + .../mt7623a-unielec-u7623-02-emmc-512m.dts | 17 + + .../dts/mt7623a-unielec-u7623-02-emmc.dtsi | 339 + .../drivers/net/phy/mtk/mt753x/Kconfig | 3 + .../drivers/net/phy/mtk/mt753x/Makefile | 11 + .../drivers/net/phy/mtk/mt753x/mt7530.c | 631 + @@ -150,13 +156,31 @@ Signed-off-by: Felix Fietkau .../files-5.10/drivers/net/phy/rtk/rtl8367s.c | 580 + .../drivers/net/phy/rtk/rtl8367s_dbg.c | 648 + .../drivers/net/phy/rtk/rtl8367s_mdio.c | 312 + - target/linux/mediatek/image/mt7622.mk | 6 +- - target/linux/mediatek/mt7622/config-5.10 | 433 + + .../boot/dts/mediatek/mt7622-rfb1-ubi.dts | 644 - + target/linux/mediatek/image/Makefile | 2 +- + .../mediatek/image/gen_mt7622_emmc_img.sh | 19 - + target/linux/mediatek/image/mt7622.mk | 176 +- + target/linux/mediatek/image/mt7623.mk | 2 + + .../mt7622/base-files/etc/board.d/01_leds | 17 + + .../mt7622/base-files/etc/board.d/02_network | 21 +- + .../mt7622/base-files/etc/init.d/bootcount | 11 + + .../base-files/etc/uci-defaults/09_fix_crc | 10 + + .../base-files/lib/preinit/79_move_config | 18 - + .../mt7622/base-files/lib/upgrade/buffalo.sh | 126 + + .../mt7622/base-files/lib/upgrade/platform.sh | 61 +- + .../mt7622/{config-5.4 => config-5.10} | 184 +- + target/linux/mediatek/mt7622/target.mk | 3 +- + .../mt7623/base-files/etc/board.d/02_network | 1 - + target/linux/mediatek/mt7623/config-5.4 | 2 +- + .../mt7629/base-files/etc/board.d/02_network | 1 - + target/linux/mediatek/mt7629/config-5.4 | 2 +- .../100-dts-update-mt7622-rfb1.patch | 119 + .../101-dts-update-mt7629-rfb.patch | 37 + .../110-dts-fix-bpi2-console.patch | 10 + .../111-dts-fix-bpi64-console.patch | 11 + - .../120-arm-dts-Add-Unielec-U7623-DTS.patch | 390 + + .../112-dts-fix-bpi64-lan-names.patch | 37 + + .../113-dts-fix-bpi64-leds-and-buttons.patch | 56 + + .../114-dts-bpi64-disable-rtc.patch | 21 + .../130-dts-mt7629-add-snand-support.patch | 97 + .../131-dts-mt7622-add-snand-support.patch | 96 + ...dts-fix-wmac-support-for-mt7622-rfb1.patch | 18 + @@ -165,10 +189,15 @@ Signed-off-by: Felix Fietkau ...e-mtk-ecc-header-file-to-include-mtd.patch | 139 + .../310-mtd-spinand-disable-on-die-ECC.patch | 31 + ...aTek-Add-SPI-NAND-Flash-interface-dr.patch | 1246 + - .../patches-5.10/330-mtk-bmt-support.patch | 840 + + .../patches-5.10/330-mtk-bmt-support.patch | 855 + + ...Add-support-for-the-Fidelix-FM35X1GA.patch | 122 + + ...trx-Allow-to-specify-trx-magic-in-DT.patch | 75 + + ...ove-dependency-to-BRCM-architectures.patch | 23 + + ...Fix-WAITRDY-break-condition-and-time.patch | 36 + ...ypto-add-eip97-inside-secure-support.patch | 27 + ...01-crypto-fix-eip97-cache-incoherent.patch | 26 + .../patches-5.10/410-bt-mtk-serial-fix.patch | 33 + + ...or-add-support-for-Winbond-W25Q512JV.patch | 28 + .../500-gsw-rtl8367s-mt7622-support.patch | 25 + ...ngs-PCI-Mediatek-Update-PCIe-binding.patch | 415 + ...e-regmap-to-get-shared-pcie-cfg-base.patch | 217 + @@ -177,10 +206,26 @@ Signed-off-by: Felix Fietkau ...diatek-fix-clearing-interrupt-status.patch | 24 + ..._eth_soc-add-support-for-coherent-DM.patch | 85 + ...ediatek-add-support-for-coherent-DMA.patch | 108 + - 172 files changed, 104871 insertions(+), 2 deletions(-) - create mode 100644 target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64-rootdisk.dts - create mode 100644 target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-elecom-wrc-2533gent.dts - create mode 100644 target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-rfb1-ubi.dts + .../patches-5.10/800-ubnt-ledbar-driver.patch | 29 + + ...mt7622-bpi-r64-aliases-for-dtoverlay.patch | 80 + + .../0227-arm-dts-Add-Unielec-U7623-DTS.patch | 387 - + .../patches-5.4/0310-mtk-bmt-support.patch | 837 + + ...trx-Allow-to-specify-trx-magic-in-DT.patch | 75 + + ...ove-dependency-to-BRCM-architectures.patch | 23 + + ...e-resolved-link-config-via-mac_link_.patch | 10 +- + ...se-resolved-link-config-in-mac_link_.patch | 14 +- + ...xtend-device-data-ready-for-adding-a.patch | 12 +- + ...530-Add-the-support-of-MT7531-switch.patch | 48 +- + 211 files changed, 105095 insertions(+), 1609 deletions(-) + create mode 100644 target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts + rename target/linux/mediatek/{files-5.4/arch/arm64/boot/dts/mediatek => dts}/mt7622-elecom-wrc-2533gent.dts (99%) + create mode 100644 target/linux/mediatek/dts/mt7622-linksys-e8450-ubi.dts + create mode 100644 target/linux/mediatek/dts/mt7622-linksys-e8450.dts + rename target/linux/mediatek/{files-5.4/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64-rootdisk.dts => dts/mt7622-linksys-e8450.dtsi} (50%) + create mode 100644 target/linux/mediatek/dts/mt7622-rfb1-ubi.dts + rename target/linux/mediatek/{files-5.4/arch/arm64/boot/dts/mediatek => dts}/mt7622-ubnt-unifi-6-lr.dts (100%) + create mode 100644 target/linux/mediatek/dts/mt7623a-unielec-u7623-02-emmc-512m.dts + create mode 100644 target/linux/mediatek/dts/mt7623a-unielec-u7623-02-emmc.dtsi create mode 100644 target/linux/mediatek/files-5.10/drivers/net/phy/mtk/mt753x/Kconfig create mode 100644 target/linux/mediatek/files-5.10/drivers/net/phy/mtk/mt753x/Makefile create mode 100644 target/linux/mediatek/files-5.10/drivers/net/phy/mtk/mt753x/mt7530.c @@ -322,12 +367,23 @@ Signed-off-by: Felix Fietkau create mode 100644 target/linux/mediatek/files-5.10/drivers/net/phy/rtk/rtl8367s.c create mode 100644 target/linux/mediatek/files-5.10/drivers/net/phy/rtk/rtl8367s_dbg.c create mode 100644 target/linux/mediatek/files-5.10/drivers/net/phy/rtk/rtl8367s_mdio.c - create mode 100755 target/linux/mediatek/mt7622/config-5.10 + delete mode 100644 target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-rfb1-ubi.dts + delete mode 100755 target/linux/mediatek/image/gen_mt7622_emmc_img.sh + create mode 100755 target/linux/mediatek/mt7622/base-files/etc/board.d/01_leds + create mode 100755 target/linux/mediatek/mt7622/base-files/etc/init.d/bootcount + create mode 100644 target/linux/mediatek/mt7622/base-files/etc/uci-defaults/09_fix_crc + delete mode 100644 target/linux/mediatek/mt7622/base-files/lib/preinit/79_move_config + create mode 100644 target/linux/mediatek/mt7622/base-files/lib/upgrade/buffalo.sh + rename target/linux/mediatek/mt7622/{config-5.4 => config-5.10} (67%) + mode change 100755 => 100644 target/linux/mediatek/mt7623/base-files/etc/board.d/02_network + mode change 100755 => 100644 target/linux/mediatek/mt7629/base-files/etc/board.d/02_network create mode 100644 target/linux/mediatek/patches-5.10/100-dts-update-mt7622-rfb1.patch create mode 100644 target/linux/mediatek/patches-5.10/101-dts-update-mt7629-rfb.patch create mode 100644 target/linux/mediatek/patches-5.10/110-dts-fix-bpi2-console.patch create mode 100644 target/linux/mediatek/patches-5.10/111-dts-fix-bpi64-console.patch - create mode 100644 target/linux/mediatek/patches-5.10/120-arm-dts-Add-Unielec-U7623-DTS.patch + create mode 100644 target/linux/mediatek/patches-5.10/112-dts-fix-bpi64-lan-names.patch + create mode 100644 target/linux/mediatek/patches-5.10/113-dts-fix-bpi64-leds-and-buttons.patch + create mode 100644 target/linux/mediatek/patches-5.10/114-dts-bpi64-disable-rtc.patch create mode 100644 target/linux/mediatek/patches-5.10/130-dts-mt7629-add-snand-support.patch create mode 100644 target/linux/mediatek/patches-5.10/131-dts-mt7622-add-snand-support.patch create mode 100644 target/linux/mediatek/patches-5.10/140-dts-fix-wmac-support-for-mt7622-rfb1.patch @@ -337,9 +393,14 @@ Signed-off-by: Felix Fietkau create mode 100644 target/linux/mediatek/patches-5.10/310-mtd-spinand-disable-on-die-ECC.patch create mode 100644 target/linux/mediatek/patches-5.10/320-spi-spi-mem-MediaTek-Add-SPI-NAND-Flash-interface-dr.patch create mode 100644 target/linux/mediatek/patches-5.10/330-mtk-bmt-support.patch + create mode 100644 target/linux/mediatek/patches-5.10/340-mtd-spinand-Add-support-for-the-Fidelix-FM35X1GA.patch + create mode 100644 target/linux/mediatek/patches-5.10/350-mtd-parsers-trx-Allow-to-specify-trx-magic-in-DT.patch + create mode 100644 target/linux/mediatek/patches-5.10/351-mtd-parsers-Remove-dependency-to-BRCM-architectures.patch + create mode 100644 target/linux/mediatek/patches-5.10/360-mtd-rawnand-mtk-Fix-WAITRDY-break-condition-and-time.patch create mode 100644 target/linux/mediatek/patches-5.10/400-crypto-add-eip97-inside-secure-support.patch create mode 100644 target/linux/mediatek/patches-5.10/401-crypto-fix-eip97-cache-incoherent.patch create mode 100644 target/linux/mediatek/patches-5.10/410-bt-mtk-serial-fix.patch + create mode 100644 target/linux/mediatek/patches-5.10/420-mtd-spi-nor-add-support-for-Winbond-W25Q512JV.patch create mode 100644 target/linux/mediatek/patches-5.10/500-gsw-rtl8367s-mt7622-support.patch create mode 100644 target/linux/mediatek/patches-5.10/600-dt-bindings-PCI-Mediatek-Update-PCIe-binding.patch create mode 100644 target/linux/mediatek/patches-5.10/601-PCI-mediatek-Use-regmap-to-get-shared-pcie-cfg-base.patch @@ -348,13 +409,23 @@ Signed-off-by: Felix Fietkau create mode 100644 target/linux/mediatek/patches-5.10/610-pcie-mediatek-fix-clearing-interrupt-status.patch create mode 100644 target/linux/mediatek/patches-5.10/700-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch create mode 100644 target/linux/mediatek/patches-5.10/710-pci-pcie-mediatek-add-support-for-coherent-DMA.patch + create mode 100644 target/linux/mediatek/patches-5.10/800-ubnt-ledbar-driver.patch + create mode 100644 target/linux/mediatek/patches-5.10/900-dts-mt7622-bpi-r64-aliases-for-dtoverlay.patch + delete mode 100644 target/linux/mediatek/patches-5.4/0227-arm-dts-Add-Unielec-U7623-DTS.patch + create mode 100644 target/linux/mediatek/patches-5.4/0310-mtk-bmt-support.patch + create mode 100644 target/linux/mediatek/patches-5.4/0350-mtd-parsers-trx-Allow-to-specify-trx-magic-in-DT.patch + create mode 100644 target/linux/mediatek/patches-5.4/0351-mtd-parsers-Remove-dependency-to-BRCM-architectures.patch diff --git a/target/linux/mediatek/Makefile b/target/linux/mediatek/Makefile -index c8ab5e01e6..a088210321 100644 +index c8ab5e01e6..0825b8c6ed 100644 --- a/target/linux/mediatek/Makefile +++ b/target/linux/mediatek/Makefile -@@ -9,7 +9,7 @@ SUBTARGETS:=mt7622 mt7623 mt7629 - FEATURES:=squashfs nand ramdisk fpu +@@ -6,10 +6,10 @@ ARCH:=arm + BOARD:=mediatek + BOARDNAME:=MediaTek Ralink ARM + SUBTARGETS:=mt7622 mt7623 mt7629 +-FEATURES:=squashfs nand ramdisk fpu ++FEATURES:=squashfs nand separate_ramdisk fpu dt-overlay KERNEL_PATCHVER:=5.4 -KERNEL_TESTING_PATCHVER:=5.4 @@ -362,19 +433,13 @@ index c8ab5e01e6..a088210321 100644 include $(INCLUDE_DIR)/target.mk DEFAULT_PACKAGES += \ -diff --git a/target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64-rootdisk.dts b/target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64-rootdisk.dts +diff --git a/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts b/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts new file mode 100644 -index 0000000000..2235306b2b +index 0000000000..ce5cd1c9be --- /dev/null -+++ b/target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64-rootdisk.dts -@@ -0,0 +1,593 @@ -+/* -+ * Copyright (c) 2018 MediaTek Inc. -+ * Author: Ryder Lee -+ * -+ * SPDX-License-Identifier: (GPL-2.0-only OR MIT) -+ */ -+ ++++ b/target/linux/mediatek/dts/mt7622-buffalo-wsr-2533dhp2.dts +@@ -0,0 +1,339 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; +#include +#include @@ -383,113 +448,219 @@ index 0000000000..2235306b2b +#include "mt6380.dtsi" + +/ { -+ model = "Bananapi BPI-R64"; -+ compatible = "bananapi,bpi-r64-rootdisk", "mediatek,mt7622"; ++ model = "Buffalo WSR-2533DHP2"; ++ compatible = "buffalo,wsr-2533dhp2", "mediatek,mt7622"; + + aliases { + serial0 = &uart0; ++ led-boot = &power_green; ++ led-failsafe = &power_amber; ++ led-running = &power_green; ++ led-upgrade = &power_green; + }; + + chosen { -+ stdout-path = "serial0:115200n8"; -+ bootargs = "earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n1 swiotlb=512 root=/dev/mmcblk0p7 rootfstype=squashfs,f2fs"; ++ bootargs = "earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n8 swiotlb=512"; + }; + -+ cpus { -+ cpu@0 { -+ proc-supply = <&mt6380_vcpu_reg>; -+ sram-supply = <&mt6380_vm_reg>; -+ }; -+ -+ cpu@1 { -+ proc-supply = <&mt6380_vcpu_reg>; -+ sram-supply = <&mt6380_vm_reg>; -+ }; -+ }; -+ -+ gpio-keys { -+ compatible = "gpio-keys"; -+ -+ factory { -+ label = "factory"; -+ linux,code = ; -+ gpios = <&pio 0 GPIO_ACTIVE_HIGH>; -+ }; -+ -+ wps { -+ label = "wps"; -+ linux,code = ; -+ gpios = <&pio 102 GPIO_ACTIVE_HIGH>; -+ }; ++ memory { ++ reg = <0 0x40000000 0 0x0F000000>; + }; + + leds { + compatible = "gpio-leds"; + -+ green { -+ label = "bpi-r64:pio:green"; -+ gpios = <&pio 89 GPIO_ACTIVE_HIGH>; -+ default-state = "off"; ++ wireless_amber { ++ label = "amber:wireless"; ++ gpios = <&pio 2 GPIO_ACTIVE_HIGH>; + }; + -+ red { -+ label = "bpi-r64:pio:red"; -+ gpios = <&pio 88 GPIO_ACTIVE_HIGH>; -+ default-state = "off"; ++ power_amber: power_amber { ++ label = "amber:power"; ++ gpios = <&pio 3 GPIO_ACTIVE_LOW>; ++ }; ++ ++ power_green: power_green { ++ label = "green:power"; ++ gpios = <&pio 4 GPIO_ACTIVE_LOW>; ++ default-state = "on"; ++ }; ++ ++ wireless_green { ++ label = "green:wireless"; ++ gpios = <&pio 15 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ internet { ++ label = "green:internet"; ++ gpios = <&pio 19 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ router { ++ label = "green:router"; ++ gpios = <&pio 20 GPIO_ACTIVE_HIGH>; + }; + }; + -+ memory { -+ reg = <0 0x40000000 0 0x40000000>; ++ keys { ++ compatible = "gpio-keys"; ++ poll-interval = <100>; ++ ++ reset { ++ label = "reset"; ++ gpios = <&pio 0 GPIO_ACTIVE_LOW>; ++ linux,code = ; ++ }; ++ ++ /* GPIO 1 and 16 are a tri-state switch button with ++ * ROUTER / AP / WB. ++ */ ++ router { ++ label = "router"; ++ gpios = <&pio 1 GPIO_ACTIVE_LOW>; ++ linux,code = ; ++ linux,input-type = ; ++ }; ++ ++ bridge { ++ label = "wb"; ++ gpios = <&pio 16 GPIO_ACTIVE_LOW>; ++ linux,code = ; ++ linux,input-type = ; ++ }; ++ ++ /* GPIO 18 is a switch button with AUTO / MANUAL. */ ++ manual { ++ label = "manual"; ++ gpios = <&pio 18 GPIO_ACTIVE_LOW>; ++ linux,code = ; ++ linux,input-type = ; ++ }; ++ ++ wps { ++ label = "wps"; ++ gpios = <&pio 102 GPIO_ACTIVE_LOW>; ++ linux,code = ; ++ }; + }; + -+ reg_1p8v: regulator-1p8v { -+ compatible = "regulator-fixed"; -+ regulator-name = "fixed-1.8V"; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ regulator-always-on; ++ rtkgsw: rtkgsw@0 { ++ compatible = "mediatek,rtk-gsw"; ++ mediatek,ethsys = <ðsys>; ++ mediatek,mdio = <&mdio>; ++ mediatek,reset-pin = <&pio 54 GPIO_ACTIVE_HIGH>; ++ }; ++}; ++ ++&cpu0 { ++ proc-supply = <&mt6380_vcpu_reg>; ++ sram-supply = <&mt6380_vm_reg>; ++}; ++ ++&cpu1 { ++ proc-supply = <&mt6380_vcpu_reg>; ++ sram-supply = <&mt6380_vm_reg>; ++}; ++ ++&pcie0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie0_pins>; ++ status = "okay"; ++}; ++ ++&slot0 { ++ status = "okay"; ++ ++ wifi@0,0 { ++ compatible = "mediatek,mt76"; ++ reg = <0x0000 0 0 0 0>; ++ mediatek,mtd-eeprom = <&factory 0x5000>; ++ ieee80211-freq-limit = <5000000 6000000>; ++ }; ++}; ++ ++&pio { ++ eth_pins: eth-pins { ++ mux { ++ function = "eth"; ++ groups = "mdc_mdio", "rgmii_via_gmac2"; ++ }; + }; + -+ reg_3p3v: regulator-3p3v { -+ compatible = "regulator-fixed"; -+ regulator-name = "fixed-3.3V"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-boot-on; -+ regulator-always-on; ++ /* Parallel nand is shared pin with eMMC */ ++ parallel_nand_pins: parallel-nand-pins { ++ mux { ++ function = "flash"; ++ groups = "par_nand"; ++ }; ++ ++ conf-cmd-dat { ++ pins = "NCEB", "NWEB", "NREB", ++ "NDL4", "NDL5", "NDL6", ++ "NDL7", "NRB", "NCLE", ++ "NALE", "NDL0", "NDL1", ++ "NDL2", "NDL3"; ++ input-enable; ++ drive-strength = <8>; ++ bias-pull-up; ++ }; + }; + -+ reg_5v: regulator-5v { -+ compatible = "regulator-fixed"; -+ regulator-name = "fixed-5V"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ regulator-boot-on; -+ regulator-always-on; ++ pcie0_pins: pcie0-pins { ++ mux { ++ function = "pcie"; ++ groups = "pcie0_pad_perst", ++ "pcie0_1_waken", ++ "pcie0_1_clkreq"; ++ }; ++ }; ++ ++ pmic_bus_pins: pmic-bus-pins { ++ mux { ++ function = "pmic"; ++ groups = "pmic_bus"; ++ }; ++ }; ++ ++ pwm7_pins: pwm1-2-pins { ++ mux { ++ function = "pwm"; ++ groups = "pwm_ch7_2"; ++ }; ++ }; ++ ++ uart0_pins: uart0-pins { ++ mux { ++ function = "uart"; ++ groups = "uart0_0_tx_rx" ; ++ }; ++ }; ++ ++ watchdog_pins: watchdog-pins { ++ mux { ++ function = "watchdog"; ++ groups = "watchdog"; ++ }; + }; +}; + +&bch { -+ status = "disabled"; -+}; -+ -+&btif { -+ status = "okay"; -+}; -+ -+&cir { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&irrx_pins>; + status = "okay"; +}; + +ð { ++ pinctrl-names = "default"; ++ pinctrl-0 = <ð_pins>; + status = "okay"; ++ + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; -+ phy-mode = "2500base-x"; ++ ++ phy-connection-type = "2500base-x"; ++ ++ mtd-mac-address = <&factory 0x4>; ++ mtd-mac-address-increment = <(-1)>; + + fixed-link { + speed = <2500>; @@ -498,1058 +669,91 @@ index 0000000000..2235306b2b + }; + }; + -+ gmac1: mac@1 { -+ compatible = "mediatek,eth-mac"; -+ reg = <1>; -+ phy-mode = "rgmii"; -+ -+ fixed-link { -+ speed = <1000>; -+ full-duplex; -+ pause; -+ }; -+ }; -+ + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; -+ -+ switch@1f { -+ compatible = "mediatek,mt7531"; -+ reg = <0x1f>; -+ reset-gpios = <&pio 54 0>; -+ -+ ports { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ wan: port@0 { -+ reg = <0>; -+ label = "wan"; -+ }; -+ -+ port@1 { -+ reg = <1>; -+ label = "lan0"; -+ }; -+ -+ port@2 { -+ reg = <2>; -+ label = "lan1"; -+ }; -+ -+ port@3 { -+ reg = <3>; -+ label = "lan2"; -+ }; -+ -+ port@4 { -+ reg = <4>; -+ label = "lan3"; -+ }; -+ -+ port@6 { -+ reg = <6>; -+ label = "cpu"; -+ ethernet = <&gmac0>; -+ phy-mode = "2500base-x"; -+ -+ fixed-link { -+ speed = <2500>; -+ full-duplex; -+ pause; -+ }; -+ }; -+ }; -+ }; -+ + }; +}; + -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ status = "okay"; -+}; -+ -+&i2c2 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c2_pins>; -+ status = "okay"; -+}; -+ -+&mmc0 { -+ pinctrl-names = "default", "state_uhs"; -+ pinctrl-0 = <&emmc_pins_default>; -+ pinctrl-1 = <&emmc_pins_uhs>; -+ status = "okay"; -+ bus-width = <8>; -+ max-frequency = <50000000>; -+ cap-mmc-highspeed; -+ mmc-hs200-1_8v; -+ vmmc-supply = <®_3p3v>; -+ vqmmc-supply = <®_1p8v>; -+ assigned-clocks = <&topckgen CLK_TOP_MSDC30_0_SEL>; -+ assigned-clock-parents = <&topckgen CLK_TOP_UNIV48M>; -+ non-removable; -+}; -+ -+&mmc1 { -+ pinctrl-names = "default", "state_uhs"; -+ pinctrl-0 = <&sd0_pins_default>; -+ pinctrl-1 = <&sd0_pins_uhs>; -+ status = "okay"; -+ bus-width = <4>; -+ max-frequency = <50000000>; -+ cap-sd-highspeed; -+ r_smpl = <1>; -+ cd-gpios = <&pio 81 GPIO_ACTIVE_LOW>; -+ vmmc-supply = <®_3p3v>; -+ vqmmc-supply = <®_3p3v>; -+ assigned-clocks = <&topckgen CLK_TOP_MSDC30_1_SEL>; -+ assigned-clock-parents = <&topckgen CLK_TOP_UNIV48M>; -+}; -+ +&nandc { + pinctrl-names = "default"; + pinctrl-0 = <¶llel_nand_pins>; -+ status = "disabled"; -+}; ++ status = "okay"; + -+&nor_flash { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi_nor_pins>; -+ status = "disabled"; -+ -+ flash@0 { -+ compatible = "jedec,spi-nor"; ++ nand@0 { + reg = <0>; -+ }; -+}; -+ -+&pcie0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pcie0_pins>; -+ status = "okay"; -+}; -+ -+&pcie1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pcie1_pins>; -+ status = "okay"; -+}; -+ -+&pio { -+ /* Attention: GPIO 90 is used to switch between PCIe@1,0 and -+ * SATA functions. i.e. output-high: PCIe, output-low: SATA -+ */ -+ asm_sel { -+ gpio-hog; -+ gpios = <90 GPIO_ACTIVE_HIGH>; -+ output-high; -+ }; -+ -+ /* eMMC is shared pin with parallel NAND */ -+ emmc_pins_default: emmc-pins-default { -+ mux { -+ function = "emmc", "emmc_rst"; -+ groups = "emmc"; -+ }; -+ -+ /* "NDL0","NDL1","NDL2","NDL3","NDL4","NDL5","NDL6","NDL7", -+ * "NRB","NCLE" pins are used as DAT0,DAT1,DAT2,DAT3,DAT4, -+ * DAT5,DAT6,DAT7,CMD,CLK for eMMC respectively -+ */ -+ conf-cmd-dat { -+ pins = "NDL0", "NDL1", "NDL2", -+ "NDL3", "NDL4", "NDL5", -+ "NDL6", "NDL7", "NRB"; -+ input-enable; -+ bias-pull-up; -+ }; -+ -+ conf-clk { -+ pins = "NCLE"; -+ bias-pull-down; -+ }; -+ }; -+ -+ emmc_pins_uhs: emmc-pins-uhs { -+ mux { -+ function = "emmc"; -+ groups = "emmc"; -+ }; -+ -+ conf-cmd-dat { -+ pins = "NDL0", "NDL1", "NDL2", -+ "NDL3", "NDL4", "NDL5", -+ "NDL6", "NDL7", "NRB"; -+ input-enable; -+ drive-strength = <4>; -+ bias-pull-up; -+ }; -+ -+ conf-clk { -+ pins = "NCLE"; -+ drive-strength = <4>; -+ bias-pull-down; -+ }; -+ }; -+ -+ eth_pins: eth-pins { -+ mux { -+ function = "eth"; -+ groups = "mdc_mdio", "rgmii_via_gmac2"; -+ }; -+ }; -+ -+ i2c1_pins: i2c1-pins { -+ mux { -+ function = "i2c"; -+ groups = "i2c1_0"; -+ }; -+ }; -+ -+ i2c2_pins: i2c2-pins { -+ mux { -+ function = "i2c"; -+ groups = "i2c2_0"; -+ }; -+ }; -+ -+ i2s1_pins: i2s1-pins { -+ mux { -+ function = "i2s"; -+ groups = "i2s_out_mclk_bclk_ws", -+ "i2s1_in_data", -+ "i2s1_out_data"; -+ }; -+ -+ conf { -+ pins = "I2S1_IN", "I2S1_OUT", "I2S_BCLK", -+ "I2S_WS", "I2S_MCLK"; -+ drive-strength = <12>; -+ bias-pull-down; -+ }; -+ }; -+ -+ irrx_pins: irrx-pins { -+ mux { -+ function = "ir"; -+ groups = "ir_1_rx"; -+ }; -+ }; -+ -+ irtx_pins: irtx-pins { -+ mux { -+ function = "ir"; -+ groups = "ir_1_tx"; -+ }; -+ }; -+ -+ /* Parallel nand is shared pin with eMMC */ -+ parallel_nand_pins: parallel-nand-pins { -+ mux { -+ function = "flash"; -+ groups = "par_nand"; -+ }; -+ }; -+ -+ pcie0_pins: pcie0-pins { -+ mux { -+ function = "pcie"; -+ groups = "pcie0_pad_perst", -+ "pcie0_1_waken", -+ "pcie0_1_clkreq"; -+ }; -+ }; -+ -+ pcie1_pins: pcie1-pins { -+ mux { -+ function = "pcie"; -+ groups = "pcie1_pad_perst", -+ "pcie1_0_waken", -+ "pcie1_0_clkreq"; -+ }; -+ }; -+ -+ pmic_bus_pins: pmic-bus-pins { -+ mux { -+ function = "pmic"; -+ groups = "pmic_bus"; -+ }; -+ }; -+ -+ pwm7_pins: pwm1-2-pins { -+ mux { -+ function = "pwm"; -+ groups = "pwm_ch7_2"; -+ }; -+ }; -+ -+ wled_pins: wled-pins { -+ mux { -+ function = "led"; -+ groups = "wled"; -+ }; -+ }; -+ -+ sd0_pins_default: sd0-pins-default { -+ mux { -+ function = "sd"; -+ groups = "sd_0"; -+ }; -+ -+ /* "I2S2_OUT, "I2S4_IN"", "I2S3_IN", "I2S2_IN", -+ * "I2S4_OUT", "I2S3_OUT" are used as DAT0, DAT1, -+ * DAT2, DAT3, CMD, CLK for SD respectively. -+ */ -+ conf-cmd-data { -+ pins = "I2S2_OUT", "I2S4_IN", "I2S3_IN", -+ "I2S2_IN","I2S4_OUT"; -+ input-enable; -+ drive-strength = <8>; -+ bias-pull-up; -+ }; -+ conf-clk { -+ pins = "I2S3_OUT"; -+ drive-strength = <12>; -+ bias-pull-down; -+ }; -+ conf-cd { -+ pins = "TXD3"; -+ bias-pull-up; -+ }; -+ }; -+ -+ sd0_pins_uhs: sd0-pins-uhs { -+ mux { -+ function = "sd"; -+ groups = "sd_0"; -+ }; -+ -+ conf-cmd-data { -+ pins = "I2S2_OUT", "I2S4_IN", "I2S3_IN", -+ "I2S2_IN","I2S4_OUT"; -+ input-enable; -+ bias-pull-up; -+ }; -+ -+ conf-clk { -+ pins = "I2S3_OUT"; -+ bias-pull-down; -+ }; -+ }; -+ -+ /* Serial NAND is shared pin with SPI-NOR */ -+ serial_nand_pins: serial-nand-pins { -+ mux { -+ function = "flash"; -+ groups = "snfi"; -+ }; -+ }; -+ -+ spic0_pins: spic0-pins { -+ mux { -+ function = "spi"; -+ groups = "spic0_0"; -+ }; -+ }; -+ -+ spic1_pins: spic1-pins { -+ mux { -+ function = "spi"; -+ groups = "spic1_0"; -+ }; -+ }; -+ -+ /* SPI-NOR is shared pin with serial NAND */ -+ spi_nor_pins: spi-nor-pins { -+ mux { -+ function = "flash"; -+ groups = "spi_nor"; -+ }; -+ }; -+ -+ /* serial NAND is shared pin with SPI-NOR */ -+ serial_nand_pins: serial-nand-pins { -+ mux { -+ function = "flash"; -+ groups = "snfi"; -+ }; -+ }; -+ -+ uart0_pins: uart0-pins { -+ mux { -+ function = "uart"; -+ groups = "uart0_0_tx_rx" ; -+ }; -+ }; -+ -+ uart2_pins: uart2-pins { -+ mux { -+ function = "uart"; -+ groups = "uart2_1_tx_rx" ; -+ }; -+ }; -+ -+ watchdog_pins: watchdog-pins { -+ mux { -+ function = "watchdog"; -+ groups = "watchdog"; -+ }; -+ }; -+}; -+ -+&pwm { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pwm7_pins>; -+ status = "okay"; -+}; -+ -+&pwrap { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pmic_bus_pins>; -+ -+ status = "okay"; -+}; -+ -+&sata { -+ status = "disable"; -+}; -+ -+&sata_phy { -+ status = "disable"; -+}; -+ -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spic0_pins>; -+ status = "okay"; -+}; -+ -+&spi1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spic1_pins>; -+ status = "okay"; -+}; -+ -+&ssusb { -+ vusb33-supply = <®_3p3v>; -+ vbus-supply = <®_5v>; -+ status = "okay"; -+}; -+ -+&u3phy { -+ status = "okay"; -+}; -+ -+&uart0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart0_pins>; -+ status = "okay"; -+}; -+ -+&uart2 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart2_pins>; -+ status = "okay"; -+}; -+ -+&watchdog { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&watchdog_pins>; -+ status = "okay"; -+}; -diff --git a/target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-elecom-wrc-2533gent.dts b/target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-elecom-wrc-2533gent.dts -new file mode 100644 -index 0000000000..48865ada40 ---- /dev/null -+++ b/target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-elecom-wrc-2533gent.dts -@@ -0,0 +1,608 @@ -+/* -+ * Copyright (c) 2017 MediaTek Inc. -+ * Author: Ming Huang -+ * Sean Wang -+ * -+ * SPDX-License-Identifier: (GPL-2.0-only OR MIT) -+ */ -+ -+/dts-v1/; -+#include -+#include -+ -+#include "mt7622.dtsi" -+#include "mt6380.dtsi" -+ -+/ { -+ model = "Elecom WRC-2533"; -+ compatible = "elecom,wrc-2533gent", "mediatek,mt7622"; -+ -+ aliases { -+ led-boot = &led_power; -+ led-failsafe = &led_power; -+ led-running = &led_power; -+ led-upgrade = &led_power; -+ serial0 = &uart0; -+ }; -+ -+ chosen { -+ stdout-path = "serial0:115200n8"; -+ bootargs = "earlycon=uart8250,mmio32,0x11002000 swiotlb=512 console=ttyS0,115200n8"; -+ }; -+ -+ cpus { -+ cpu@0 { -+ proc-supply = <&mt6380_vcpu_reg>; -+ sram-supply = <&mt6380_vm_reg>; -+ }; -+ -+ cpu@1 { -+ proc-supply = <&mt6380_vcpu_reg>; -+ sram-supply = <&mt6380_vm_reg>; -+ }; -+ }; -+ -+ gpio-keys { -+ compatible = "gpio-keys"; -+ poll-interval = <100>; -+ -+ wps { -+ label = "wps"; -+ linux,code = ; -+ gpios = <&pio 0 GPIO_ACTIVE_HIGH>; -+ }; -+ -+ factory { -+ label = "factory"; -+ linux,code = ; -+ gpios = <&pio 102 GPIO_ACTIVE_LOW>; -+ }; -+ -+ switch0 { -+ label = "switch0"; -+ gpios = <&pio 1 GPIO_ACTIVE_LOW>; -+ linux,code = ; -+ linux,input-type = ; -+ }; -+ -+ switch1 { -+ label = "switch1"; -+ gpios = <&pio 16 GPIO_ACTIVE_LOW>; -+ linux,code = ; -+ linux,input-type = ; -+ }; -+ -+ switch2 { -+ label = "switch2"; -+ gpios = <&pio 17 GPIO_ACTIVE_LOW>; -+ linux,code = ; -+ linux,input-type = ; -+ }; -+ -+ switch3 { -+ label = "switch3"; -+ gpios = <&pio 18 GPIO_ACTIVE_LOW>; -+ linux,code = ; -+ linux,input-type = ; -+ }; -+ }; -+ -+ leds { -+ compatible = "gpio-leds"; -+ -+ led_power: power_g { -+ label = "wrc-2533:green:power"; -+ gpios = <&pio 2 GPIO_ACTIVE_HIGH>; -+ }; -+ -+ power_b { -+ label = "wrc-2533:blue:power"; -+ gpios = <&pio 19 GPIO_ACTIVE_HIGH>; -+ }; -+ -+ power_r { -+ label = "wrc-2533:red:power"; -+ gpios = <&pio 73 GPIO_ACTIVE_HIGH>; -+ }; -+ -+ usb { -+ label = "wrc-2533:blue:usb"; -+ gpios = <&pio 74 GPIO_ACTIVE_HIGH>; -+ }; -+ -+ wps { -+ label = "wrc-2533:red:wps"; -+ gpios = <&pio 76 GPIO_ACTIVE_LOW>; -+ }; -+ -+ wifi2 { -+ label = "wrc-2533:blue:wifi2g"; -+ gpios = <&pio 85 GPIO_ACTIVE_LOW>; -+ }; -+ -+ wifi5 { -+ label = "wrc-2533:blue:wifi5g"; -+ gpios = <&pio 91 GPIO_ACTIVE_LOW>; -+ }; -+ }; -+ -+ reg_usb_vbus: regulator { -+ compatible = "regulator-fixed"; -+ regulator-name = "usb_vbus"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ gpio = <&pio 22 GPIO_ACTIVE_LOW>; -+ enable-active-high; -+ }; -+ -+ memory { -+ reg = <0 0x40000000 0 0x3F000000>; -+ }; -+ -+ reg_1p8v: regulator-1p8v { -+ compatible = "regulator-fixed"; -+ regulator-name = "fixed-1.8V"; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ regulator-always-on; -+ }; -+ -+ reg_3p3v: regulator-3p3v { -+ compatible = "regulator-fixed"; -+ regulator-name = "fixed-3.3V"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-boot-on; -+ regulator-always-on; -+ }; -+ -+ rtkgsw: rtkgsw@0 { -+ compatible = "mediatek,rtk-gsw"; -+ mediatek,ethsys = <ðsys>; -+ mediatek,mdio = <&mdio>; -+ mediatek,reset-pin = <&pio 54 0>; -+ status = "okay"; -+ }; -+}; -+ -+&pcie0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pcie0_pins>; -+ status = "okay"; -+}; -+ -+&slot0 { -+ mt7615@0,0 { -+ reg = <0x0000 0 0 0 0>; -+ mediatek,mtd-eeprom = <&factory 0x05000>; -+ }; -+}; -+ -+&pio { -+ /* eMMC is shared pin with parallel NAND */ -+ emmc_pins_default: emmc-pins-default { -+ mux { -+ function = "emmc", "emmc_rst"; -+ groups = "emmc"; -+ }; -+ -+ /* "NDL0","NDL1","NDL2","NDL3","NDL4","NDL5","NDL6","NDL7", -+ * "NRB","NCLE" pins are used as DAT0,DAT1,DAT2,DAT3,DAT4, -+ * DAT5,DAT6,DAT7,CMD,CLK for eMMC respectively -+ */ -+ conf-cmd-dat { -+ pins = "NDL0", "NDL1", "NDL2", -+ "NDL3", "NDL4", "NDL5", -+ "NDL6", "NDL7", "NRB"; -+ input-enable; -+ bias-pull-up; -+ }; -+ -+ conf-clk { -+ pins = "NCLE"; -+ bias-pull-down; -+ }; -+ }; -+ -+ emmc_pins_uhs: emmc-pins-uhs { -+ mux { -+ function = "emmc"; -+ groups = "emmc"; -+ }; -+ -+ conf-cmd-dat { -+ pins = "NDL0", "NDL1", "NDL2", -+ "NDL3", "NDL4", "NDL5", -+ "NDL6", "NDL7", "NRB"; -+ input-enable; -+ drive-strength = <4>; -+ bias-pull-up; -+ }; -+ -+ conf-clk { -+ pins = "NCLE"; -+ drive-strength = <4>; -+ bias-pull-down; -+ }; -+ }; -+ -+ eth_pins: eth-pins { -+ mux { -+ function = "eth"; -+ groups = "mdc_mdio", "rgmii_via_gmac2"; -+ }; -+ }; -+ -+ i2c1_pins: i2c1-pins { -+ mux { -+ function = "i2c"; -+ groups = "i2c1_0"; -+ }; -+ }; -+ -+ i2c2_pins: i2c2-pins { -+ mux { -+ function = "i2c"; -+ groups = "i2c2_0"; -+ }; -+ }; -+ -+ i2s1_pins: i2s1-pins { -+ mux { -+ function = "i2s"; -+ groups = "i2s_out_mclk_bclk_ws", -+ "i2s1_in_data", -+ "i2s1_out_data"; -+ }; -+ -+ conf { -+ pins = "I2S1_IN", "I2S1_OUT", "I2S_BCLK", -+ "I2S_WS", "I2S_MCLK"; -+ drive-strength = <12>; -+ bias-pull-down; -+ }; -+ }; -+ -+ irrx_pins: irrx-pins { -+ mux { -+ function = "ir"; -+ groups = "ir_1_rx"; -+ }; -+ }; -+ -+ irtx_pins: irtx-pins { -+ mux { -+ function = "ir"; -+ groups = "ir_1_tx"; -+ }; -+ }; -+ -+ /* Parallel nand is shared pin with eMMC */ -+ parallel_nand_pins: parallel-nand-pins { -+ mux { -+ function = "flash"; -+ groups = "par_nand"; -+ }; -+ }; -+ -+ pcie0_pins: pcie0-pins { -+ mux { -+ function = "pcie"; -+ groups = "pcie0_pad_perst", -+ "pcie0_1_waken", -+ "pcie0_1_clkreq"; -+ }; -+ }; -+ -+ pcie1_pins: pcie1-pins { -+ mux { -+ function = "pcie"; -+ groups = "pcie1_pad_perst", -+ "pcie1_0_waken", -+ "pcie1_0_clkreq"; -+ }; -+ }; -+ -+ pmic_bus_pins: pmic-bus-pins { -+ mux { -+ function = "pmic"; -+ groups = "pmic_bus"; -+ }; -+ }; -+ -+ pwm7_pins: pwm1-2-pins { -+ mux { -+ function = "pwm"; -+ groups = "pwm_ch7_2"; -+ }; -+ }; -+ -+ wled_pins: wled-pins { -+ mux { -+ function = "led"; -+ groups = "wled"; -+ }; -+ }; -+ -+ sd0_pins_default: sd0-pins-default { -+ mux { -+ function = "sd"; -+ groups = "sd_0"; -+ }; -+ -+ /* "I2S2_OUT, "I2S4_IN"", "I2S3_IN", "I2S2_IN", -+ * "I2S4_OUT", "I2S3_OUT" are used as DAT0, DAT1, -+ * DAT2, DAT3, CMD, CLK for SD respectively. -+ */ -+ conf-cmd-data { -+ pins = "I2S2_OUT", "I2S4_IN", "I2S3_IN", -+ "I2S2_IN","I2S4_OUT"; -+ input-enable; -+ drive-strength = <8>; -+ bias-pull-up; -+ }; -+ conf-clk { -+ pins = "I2S3_OUT"; -+ drive-strength = <12>; -+ bias-pull-down; -+ }; -+ conf-cd { -+ pins = "TXD3"; -+ bias-pull-up; -+ }; -+ }; -+ -+ sd0_pins_uhs: sd0-pins-uhs { -+ mux { -+ function = "sd"; -+ groups = "sd_0"; -+ }; -+ -+ conf-cmd-data { -+ pins = "I2S2_OUT", "I2S4_IN", "I2S3_IN", -+ "I2S2_IN","I2S4_OUT"; -+ input-enable; -+ bias-pull-up; -+ }; -+ -+ conf-clk { -+ pins = "I2S3_OUT"; -+ bias-pull-down; -+ }; -+ }; -+ -+ /* Serial NAND is shared pin with SPI-NOR */ -+ serial_nand_pins: serial-nand-pins { -+ mux { -+ function = "flash"; -+ groups = "snfi"; -+ }; -+ }; -+ -+ spic0_pins: spic0-pins { -+ mux { -+ function = "spi"; -+ groups = "spic0_0"; -+ }; -+ }; -+ -+ spic1_pins: spic1-pins { -+ mux { -+ function = "spi"; -+ groups = "spic1_0"; -+ }; -+ }; -+ -+ /* SPI-NOR is shared pin with serial NAND */ -+ spi_nor_pins: spi-nor-pins { -+ mux { -+ function = "flash"; -+ groups = "spi_nor"; -+ }; -+ }; -+ -+ /* serial NAND is shared pin with SPI-NOR */ -+ serial_nand_pins: serial-nand-pins { -+ mux { -+ function = "flash"; -+ groups = "snfi"; -+ }; -+ }; -+ -+ uart0_pins: uart0-pins { -+ mux { -+ function = "uart"; -+ groups = "uart0_0_tx_rx" ; -+ }; -+ }; -+ -+ uart2_pins: uart2-pins { -+ mux { -+ function = "uart"; -+ groups = "uart2_1_tx_rx" ; -+ }; -+ }; -+ -+ watchdog_pins: watchdog-pins { -+ mux { -+ function = "watchdog"; -+ groups = "watchdog"; -+ }; -+ }; -+}; -+ -+&bch { -+ status = "okay"; -+}; -+ -+&btif { -+ status = "disabled"; -+}; -+ -+&cir { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&irrx_pins>; -+ status = "okay"; -+}; -+ -+ð { -+ status = "okay"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <ð_pins>; -+ gmac0: mac@0 { -+ compatible = "mediatek,eth-mac"; -+ reg = <0>; -+ phy-mode = "sgmii"; -+ fixed-link { -+ speed = <1000>; -+ full-duplex; -+ pause; -+ }; -+ }; -+ gmac1: mac@1 { -+ compatible = "mediatek,eth-mac"; -+ reg = <1>; -+ phy-mode = "rgmii"; -+ fixed-link { -+ speed = <1000>; -+ full-duplex; -+ pause; -+ }; -+ }; -+ mdio: mdio-bus { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ }; -+}; -+ -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ status = "okay"; -+}; -+ -+&i2c2 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c2_pins>; -+ status = "okay"; -+}; -+ -+&pwm { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pwm7_pins>; -+ status = "okay"; -+}; -+ -+&pwrap { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pmic_bus_pins>; -+ -+ status = "okay"; -+}; -+ -+&snfi { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&serial_nand_pins>; -+ status = "okay"; -+ -+ spi_nand@0 { -+ #address-cells = <1>; -+ #size-cells = <1>; -+ compatible = "spi-nand"; -+ spi-max-frequency = <104000000>; -+ reg = <0>; -+ -+ mediatek,bmt-v2; ++ nand-ecc-mode = "hw"; + + partitions { -+ compatible = "fixed-partitions"; -+ #address-cells = <1>; -+ #size-cells = <1>; ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; + -+ partition@0 { -+ label = "Preloader"; -+ reg = <0x00000 0x0080000>; -+ read-only; -+ }; ++ partition@0 { ++ label = "Preloader"; ++ reg = <0x0 0x80000>; ++ read-only; ++ }; + -+ partition@80000 { -+ label = "ATF"; -+ reg = <0x80000 0x0040000>; -+ read-only; -+ }; ++ partition@80000 { ++ label = "ATF"; ++ reg = <0x80000 0x40000>; ++ read-only; ++ }; + -+ partition@c0000 { -+ label = "uboot"; -+ reg = <0xc0000 0x0080000>; -+ read-only; -+ }; ++ partition@c0000 { ++ label = "Bootloader"; ++ reg = <0xc0000 0x80000>; ++ read-only; ++ }; + -+ partition@140000 { -+ label = "uboot-env"; -+ reg = <0x140000 0x0080000>; -+ read-only; -+ }; ++ partition@140000 { ++ label = "Config"; ++ reg = <0x140000 0x80000>; ++ }; + -+ factory: partition@1c0000 { -+ label = "factory"; -+ reg = <0x1c0000 0x0040000>; -+ read-only; -+ }; ++ factory: partition@1c0000 { ++ label = "factory"; ++ reg = <0x1c0000 0x40000>; ++ read-only; ++ }; + -+ partition@200000 { -+ label = "firmware"; -+ reg = <0x200000 0x2000000>; -+ }; ++ partition@200000 { ++ compatible = "brcm,trx"; ++ trx-magic = <0x32504844>; ++ label = "firmware"; ++ reg = <0x200000 0x3a00000>; ++ }; + -+ partition@2200000 { -+ label = "reserved"; -+ reg = <0x2200000 0x4000000>; -+ }; -+ }; ++ partition@3C00000 { ++ label = "Kernel2"; ++ reg = <0x3c00000 0x3a00000>; ++ }; ++ ++ partition@7600000 { ++ label = "glbcfg"; ++ reg = <0x7600000 0x200000>; ++ read-only; ++ }; ++ ++ partition@7800000 { ++ label = "board_data"; ++ reg = <0x7800000 0x200000>; ++ read-only; ++ }; ++ }; + }; +}; + -+&spi0 { ++&pwm { + pinctrl-names = "default"; -+ pinctrl-0 = <&spic0_pins>; ++ pinctrl-0 = <&pwm7_pins>; + status = "okay"; +}; + -+&spi1 { ++&pwrap { + pinctrl-names = "default"; -+ pinctrl-0 = <&spic1_pins>; -+ status = "okay"; -+}; -+ -+&ssusb { -+ vusb33-supply = <®_3p3v>; -+ vbus-supply = <®_usb_vbus>; -+ status = "okay"; -+}; -+ -+&u3phy { ++ pinctrl-0 = <&pmic_bus_pins>; + status = "okay"; +}; + @@ -1559,12 +763,6 @@ index 0000000000..48865ada40 + status = "okay"; +}; + -+&uart2 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart2_pins>; -+ status = "okay"; -+}; -+ +&watchdog { + pinctrl-names = "default"; + pinctrl-0 = <&watchdog_pins>; @@ -1572,554 +770,725 @@ index 0000000000..48865ada40 +}; + +&wmac { ++ status = "okay"; ++ ++ mediatek,mtd-eeprom = <&factory 0x0>; ++}; ++ ++&rtc { ++ status = "disabled"; ++}; +diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-elecom-wrc-2533gent.dts b/target/linux/mediatek/dts/mt7622-elecom-wrc-2533gent.dts +similarity index 99% +rename from target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-elecom-wrc-2533gent.dts +rename to target/linux/mediatek/dts/mt7622-elecom-wrc-2533gent.dts +index 2ac1c6a671..2f3e5b1fb0 100644 +--- a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-elecom-wrc-2533gent.dts ++++ b/target/linux/mediatek/dts/mt7622-elecom-wrc-2533gent.dts +@@ -1,9 +1,8 @@ ++// SPDX-License-Identifier: (GPL-2.0-only OR MIT) + /* + * Copyright (c) 2017 MediaTek Inc. + * Author: Ming Huang + * Sean Wang +- * +- * SPDX-License-Identifier: (GPL-2.0-only OR MIT) + */ + + /dts-v1/; +diff --git a/target/linux/mediatek/dts/mt7622-linksys-e8450-ubi.dts b/target/linux/mediatek/dts/mt7622-linksys-e8450-ubi.dts +new file mode 100644 +index 0000000000..d6cadd320c +--- /dev/null ++++ b/target/linux/mediatek/dts/mt7622-linksys-e8450-ubi.dts +@@ -0,0 +1,61 @@ ++// SPDX-License-Identifier: (GPL-2.0-only OR MIT) ++ ++/dts-v1/; ++#include "mt7622-linksys-e8450.dtsi" ++ ++/ { ++ model = "Linksys E8450 (UBI)"; ++ compatible = "linksys,e8450-ubi", "mediatek,mt7622"; ++ ++ aliases { ++ label-mac-device = &wan; ++ }; ++}; ++ ++&snand { ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "bl2"; ++ reg = <0x0 0x80000>; ++ read-only; ++ }; ++ ++ partition@80000 { ++ label = "fip"; ++ reg = <0x80000 0x140000>; ++ read-only; ++ }; ++ ++ factory: partition@1c0000 { ++ label = "factory"; ++ reg = <0x1c0000 0x100000>; ++ read-only; ++ }; ++ ++ partition@300000 { ++ label = "ubi"; ++ reg = <0x300000 0x7d00000>; ++ }; ++ }; ++}; ++ ++&wmac { ++ mediatek,mtd-eeprom = <&factory 0x0>; ++ status = "okay"; ++}; ++ ++&wmac1 { ++ mediatek,mtd-eeprom = <&factory 0x5000>; ++}; ++ ++&gmac0 { ++ mtd-mac-address = <&factory 0x7fff4>; ++}; ++ ++&wan { ++ mtd-mac-address = <&factory 0x7fffa>; ++}; +diff --git a/target/linux/mediatek/dts/mt7622-linksys-e8450.dts b/target/linux/mediatek/dts/mt7622-linksys-e8450.dts +new file mode 100644 +index 0000000000..b30b5d2455 +--- /dev/null ++++ b/target/linux/mediatek/dts/mt7622-linksys-e8450.dts +@@ -0,0 +1,106 @@ ++// SPDX-License-Identifier: (GPL-2.0-only OR MIT) ++ ++/dts-v1/; ++#include "mt7622-linksys-e8450.dtsi" ++ ++/ { ++ model = "Linksys E8450"; ++ compatible = "linksys,e8450", "mediatek,mt7622"; ++ ++ aliases { ++ label-mac-device = &wan; ++ }; ++}; ++ ++&snand { ++ mediatek,bmt-v2; ++ mediatek,bmt-table-size = <0x1000>; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "Preloader"; ++ reg = <0x00000 0x0080000>; ++ read-only; ++ }; ++ ++ partition@80000 { ++ label = "ATF"; ++ reg = <0x80000 0x0040000>; ++ }; ++ ++ partition@c0000 { ++ label = "u-boot"; ++ reg = <0xc0000 0x0080000>; ++ }; ++ ++ partition@140000 { ++ label = "u-boot-env"; ++ reg = <0x140000 0x0080000>; ++ }; ++ ++ factory: partition@1c0000 { ++ label = "factory"; ++ reg = <0x1c0000 0x0100000>; ++ }; ++ ++ partition@300000 { ++ label = "devinfo"; ++ reg = <0x300000 0x020000>; ++ }; ++ ++ partition@320000 { ++ label = "senv"; ++ reg = <0x320000 0x020000>; ++ }; ++ ++ partition@360000 { ++ label = "bootseq"; ++ reg = <0x360000 0x020000>; ++ }; ++ ++ partition@500000 { ++ label = "firmware1"; ++ compatible = "denx,fit"; ++ openwrt,cmdline-match = "mtdparts=master"; ++ reg = <0x500000 0x1E00000>; ++ }; ++ ++ partition@2300000 { ++ label = "firmware2"; ++ compatible = "denx,fit"; ++ openwrt,cmdline-match = "mtdparts=slave"; ++ reg = <0x2300000 0x1E00000>; ++ }; ++ ++ partition@4100000 { ++ label = "data"; ++ reg = <0x4100000 0x1900000>; ++ }; ++ ++ partition@5100000 { ++ label = "mfg"; ++ reg = <0x5a00000 0x1400000>; ++ }; ++ }; ++}; ++ ++&wmac { + mediatek,mtd-eeprom = <&factory 0x0000>; + status = "okay"; +}; -diff --git a/target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-rfb1-ubi.dts b/target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-rfb1-ubi.dts -new file mode 100644 -index 0000000000..2589a349ad ---- /dev/null -+++ b/target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-rfb1-ubi.dts -@@ -0,0 +1,646 @@ -+/* -+ * Copyright (c) 2018 MediaTek Inc. -+ * Author: Ryder Lee -+ * -+ * SPDX-License-Identifier: (GPL-2.0-only OR MIT) -+ */ + -+/dts-v1/; -+#include -+#include ++&wmac1 { ++ mediatek,mtd-eeprom = <&factory 0x05000>; ++}; + -+#include "mt7622.dtsi" -+#include "mt6380.dtsi" ++&gmac0 { ++ mtd-mac-address = <&factory 0x7fff4>; ++}; + -+/ { -+ model = "MT7622_MT7531 RFB"; -+ compatible = "mediatek,mt7622,ubi"; -+ -+ aliases { -+ serial0 = &uart0; -+ }; -+ -+ chosen { -+ stdout-path = "serial0:115200n8"; ++&wan { ++ mtd-mac-address = <&factory 0x7fffa>; ++}; +diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64-rootdisk.dts b/target/linux/mediatek/dts/mt7622-linksys-e8450.dtsi +similarity index 50% +rename from target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64-rootdisk.dts +rename to target/linux/mediatek/dts/mt7622-linksys-e8450.dtsi +index 36d908652d..9bcaf4e9d7 100644 +--- a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64-rootdisk.dts ++++ b/target/linux/mediatek/dts/mt7622-linksys-e8450.dtsi +@@ -1,9 +1,4 @@ +-/* +- * Copyright (c) 2018 MediaTek Inc. +- * Author: Ryder Lee +- * +- * SPDX-License-Identifier: (GPL-2.0-only OR MIT) +- */ ++// SPDX-License-Identifier: (GPL-2.0-only OR MIT) + + /dts-v1/; + #include +@@ -13,16 +8,19 @@ + #include "mt6380.dtsi" + + / { +- model = "Bananapi BPI-R64"; +- compatible = "bananapi,bpi-r64-rootdisk", "mediatek,mt7622"; ++ compatible = "linksys,e8450", "mediatek,mt7622"; + + aliases { + serial0 = &uart0; ++ led-boot = &led_power; ++ led-failsafe = &led_power; ++ led-running = &led_power; ++ led-upgrade = &led_power; + }; + + chosen { + stdout-path = "serial0:115200n8"; +- bootargs = "earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n1 swiotlb=512 root=/dev/mmcblk0p7 rootfstype=squashfs,f2fs"; + bootargs = "earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n1 swiotlb=512"; -+ }; -+ -+ cpus { -+ cpu@0 { -+ proc-supply = <&mt6380_vcpu_reg>; -+ sram-supply = <&mt6380_vm_reg>; -+ }; -+ -+ cpu@1 { -+ proc-supply = <&mt6380_vcpu_reg>; -+ sram-supply = <&mt6380_vm_reg>; -+ }; -+ }; -+ -+ gpio-keys { -+ compatible = "gpio-keys"; -+ -+ factory { -+ label = "factory"; -+ linux,code = ; -+ gpios = <&pio 0 GPIO_ACTIVE_HIGH>; -+ }; -+ -+ wps { -+ label = "wps"; -+ linux,code = ; -+ gpios = <&pio 102 GPIO_ACTIVE_HIGH>; -+ }; -+ }; -+ -+ gsw: gsw@0 { -+ compatible = "mediatek,mt753x"; -+ mediatek,ethsys = <ðsys>; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ }; -+ -+ leds { -+ compatible = "gpio-leds"; -+ -+ green { -+ label = "bpi-r64:pio:green"; -+ gpios = <&pio 89 GPIO_ACTIVE_HIGH>; + }; + + cpus { +@@ -41,29 +39,43 @@ + compatible = "gpio-keys"; + + factory { +- label = "factory"; +- linux,code = ; +- gpios = <&pio 0 GPIO_ACTIVE_HIGH>; ++ label = "reset"; ++ linux,code = ; ++ gpios = <&pio 0 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "wps"; + linux,code = ; +- gpios = <&pio 102 GPIO_ACTIVE_HIGH>; ++ gpios = <&pio 102 GPIO_ACTIVE_LOW>; + }; + }; + +- leds { ++ gpio-leds { + compatible = "gpio-leds"; + +- green { +- label = "bpi-r64:pio:green"; +- gpios = <&pio 89 GPIO_ACTIVE_HIGH>; ++ led_power: power_blue { ++ label = "power:blue"; ++ gpios = <&pio 95 GPIO_ACTIVE_LOW>; ++ default-state = "on"; + }; + +- red { +- label = "bpi-r64:pio:red"; +- gpios = <&pio 88 GPIO_ACTIVE_HIGH>; ++ power_orange { ++ label = "power:orange"; ++ gpios = <&pio 96 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + -+ red { -+ label = "bpi-r64:pio:red"; -+ gpios = <&pio 88 GPIO_ACTIVE_HIGH>; ++ inet_blue { ++ label = "inet:blue"; ++ gpios = <&pio 97 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; ++ ++ inet_orange { ++ label = "inet:orange"; ++ gpios = <&pio 98 GPIO_ACTIVE_LOW>; ++ default-state = "off"; + }; + }; + +@@ -71,6 +83,14 @@ + reg = <0 0x40000000 0 0x40000000>; + }; + ++ reserved-memory { ++ ramoops@0x4ff00000 { ++ compatible = "ramoops"; ++ reg = <0 0x4ff00000 0 0x10000>; ++ record-size = <0x1000>; ++ }; + }; + -+ memory { -+ reg = <0 0x40000000 0 0x40000000>; -+ }; -+ -+ reg_1p8v: regulator-1p8v { -+ compatible = "regulator-fixed"; -+ regulator-name = "fixed-1.8V"; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ regulator-always-on; -+ }; -+ -+ reg_3p3v: regulator-3p3v { -+ compatible = "regulator-fixed"; -+ regulator-name = "fixed-3.3V"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-boot-on; -+ regulator-always-on; -+ }; -+ -+ reg_5v: regulator-5v { -+ compatible = "regulator-fixed"; -+ regulator-name = "fixed-5V"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ regulator-boot-on; -+ regulator-always-on; -+ }; -+}; -+ -+&bch { + reg_1p8v: regulator-1p8v { + compatible = "regulator-fixed"; + regulator-name = "fixed-1.8V"; +@@ -99,7 +119,7 @@ + }; + + &bch { +- status = "disabled"; + status = "okay"; -+}; -+ -+&btif { -+ status = "okay"; -+}; -+ -+&cir { + }; + + &btif { +@@ -113,7 +133,10 @@ + }; + + ð { + pinctrl-names = "default"; -+ pinctrl-0 = <&irrx_pins>; -+ status = "okay"; ++ pinctrl-0 = <ð_pins>; + status = "okay"; ++ + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; +@@ -126,54 +149,42 @@ + }; + }; + +- gmac1: mac@1 { +- compatible = "mediatek,eth-mac"; +- reg = <1>; +- phy-mode = "rgmii"; +- +- fixed-link { +- speed = <1000>; +- full-duplex; +- pause; +- }; +- }; +- +- mdio: mdio-bus { ++ mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + +- switch@1f { ++ switch@0 { + compatible = "mediatek,mt7531"; +- reg = <0x1f>; ++ reg = <0>; + reset-gpios = <&pio 54 0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + +- wan: port@0 { ++ port@0 { + reg = <0>; +- label = "wan"; ++ label = "lan1"; + }; + + port@1 { + reg = <1>; +- label = "lan0"; ++ label = "lan2"; + }; + + port@2 { + reg = <2>; +- label = "lan1"; ++ label = "lan3"; + }; + + port@3 { + reg = <3>; +- label = "lan2"; ++ label = "lan4"; + }; + +- port@4 { ++ wan: port@4 { + reg = <4>; +- label = "lan3"; ++ label = "wan"; + }; + + port@6 { +@@ -194,67 +205,6 @@ + }; + }; + +-&i2c1 { +- pinctrl-names = "default"; +- pinctrl-0 = <&i2c1_pins>; +- status = "okay"; +-}; +- +-&i2c2 { +- pinctrl-names = "default"; +- pinctrl-0 = <&i2c2_pins>; +- status = "okay"; +-}; +- +-&mmc0 { +- pinctrl-names = "default", "state_uhs"; +- pinctrl-0 = <&emmc_pins_default>; +- pinctrl-1 = <&emmc_pins_uhs>; +- status = "okay"; +- bus-width = <8>; +- max-frequency = <50000000>; +- cap-mmc-highspeed; +- mmc-hs200-1_8v; +- vmmc-supply = <®_3p3v>; +- vqmmc-supply = <®_1p8v>; +- assigned-clocks = <&topckgen CLK_TOP_MSDC30_0_SEL>; +- assigned-clock-parents = <&topckgen CLK_TOP_UNIV48M>; +- non-removable; +-}; +- +-&mmc1 { +- pinctrl-names = "default", "state_uhs"; +- pinctrl-0 = <&sd0_pins_default>; +- pinctrl-1 = <&sd0_pins_uhs>; +- status = "okay"; +- bus-width = <4>; +- max-frequency = <50000000>; +- cap-sd-highspeed; +- r_smpl = <1>; +- cd-gpios = <&pio 81 GPIO_ACTIVE_LOW>; +- vmmc-supply = <®_3p3v>; +- vqmmc-supply = <®_3p3v>; +- assigned-clocks = <&topckgen CLK_TOP_MSDC30_1_SEL>; +- assigned-clock-parents = <&topckgen CLK_TOP_UNIV48M>; +-}; +- +-&nandc { +- pinctrl-names = "default"; +- pinctrl-0 = <¶llel_nand_pins>; +- status = "disabled"; +-}; +- +-&nor_flash { +- pinctrl-names = "default"; +- pinctrl-0 = <&spi_nor_pins>; +- status = "disabled"; +- +- flash@0 { +- compatible = "jedec,spi-nor"; +- reg = <0>; +- }; +-}; +- + &pcie0 { + pinctrl-names = "default"; + pinctrl-0 = <&pcie0_pins>; +@@ -268,62 +218,6 @@ + }; + + &pio { +- /* Attention: GPIO 90 is used to switch between PCIe@1,0 and +- * SATA functions. i.e. output-high: PCIe, output-low: SATA +- */ +- asm_sel { +- gpio-hog; +- gpios = <90 GPIO_ACTIVE_HIGH>; +- output-high; +- }; +- +- /* eMMC is shared pin with parallel NAND */ +- emmc_pins_default: emmc-pins-default { +- mux { +- function = "emmc", "emmc_rst"; +- groups = "emmc"; +- }; +- +- /* "NDL0","NDL1","NDL2","NDL3","NDL4","NDL5","NDL6","NDL7", +- * "NRB","NCLE" pins are used as DAT0,DAT1,DAT2,DAT3,DAT4, +- * DAT5,DAT6,DAT7,CMD,CLK for eMMC respectively +- */ +- conf-cmd-dat { +- pins = "NDL0", "NDL1", "NDL2", +- "NDL3", "NDL4", "NDL5", +- "NDL6", "NDL7", "NRB"; +- input-enable; +- bias-pull-up; +- }; +- +- conf-clk { +- pins = "NCLE"; +- bias-pull-down; +- }; +- }; +- +- emmc_pins_uhs: emmc-pins-uhs { +- mux { +- function = "emmc"; +- groups = "emmc"; +- }; +- +- conf-cmd-dat { +- pins = "NDL0", "NDL1", "NDL2", +- "NDL3", "NDL4", "NDL5", +- "NDL6", "NDL7", "NRB"; +- input-enable; +- drive-strength = <4>; +- bias-pull-up; +- }; +- +- conf-clk { +- pins = "NCLE"; +- drive-strength = <4>; +- bias-pull-down; +- }; +- }; +- + eth_pins: eth-pins { + mux { + function = "eth"; +@@ -331,36 +225,6 @@ + }; + }; + +- i2c1_pins: i2c1-pins { +- mux { +- function = "i2c"; +- groups = "i2c1_0"; +- }; +- }; +- +- i2c2_pins: i2c2-pins { +- mux { +- function = "i2c"; +- groups = "i2c2_0"; +- }; +- }; +- +- i2s1_pins: i2s1-pins { +- mux { +- function = "i2s"; +- groups = "i2s_out_mclk_bclk_ws", +- "i2s1_in_data", +- "i2s1_out_data"; +- }; +- +- conf { +- pins = "I2S1_IN", "I2S1_OUT", "I2S_BCLK", +- "I2S_WS", "I2S_MCLK"; +- drive-strength = <12>; +- bias-pull-down; +- }; +- }; +- + irrx_pins: irrx-pins { + mux { + function = "ir"; +@@ -375,14 +239,6 @@ + }; + }; + +- /* Parallel nand is shared pin with eMMC */ +- parallel_nand_pins: parallel-nand-pins { +- mux { +- function = "flash"; +- groups = "par_nand"; +- }; +- }; +- + pcie0_pins: pcie0-pins { + mux { + function = "pcie"; +@@ -422,53 +278,6 @@ + }; + }; + +- sd0_pins_default: sd0-pins-default { +- mux { +- function = "sd"; +- groups = "sd_0"; +- }; +- +- /* "I2S2_OUT, "I2S4_IN"", "I2S3_IN", "I2S2_IN", +- * "I2S4_OUT", "I2S3_OUT" are used as DAT0, DAT1, +- * DAT2, DAT3, CMD, CLK for SD respectively. +- */ +- conf-cmd-data { +- pins = "I2S2_OUT", "I2S4_IN", "I2S3_IN", +- "I2S2_IN","I2S4_OUT"; +- input-enable; +- drive-strength = <8>; +- bias-pull-up; +- }; +- conf-clk { +- pins = "I2S3_OUT"; +- drive-strength = <12>; +- bias-pull-down; +- }; +- conf-cd { +- pins = "TXD3"; +- bias-pull-up; +- }; +- }; +- +- sd0_pins_uhs: sd0-pins-uhs { +- mux { +- function = "sd"; +- groups = "sd_0"; +- }; +- +- conf-cmd-data { +- pins = "I2S2_OUT", "I2S4_IN", "I2S3_IN", +- "I2S2_IN","I2S4_OUT"; +- input-enable; +- bias-pull-up; +- }; +- +- conf-clk { +- pins = "I2S3_OUT"; +- bias-pull-down; +- }; +- }; +- + /* Serial NAND is shared pin with SPI-NOR */ + serial_nand_pins: serial-nand-pins { + mux { +@@ -491,22 +300,6 @@ + }; + }; + +- /* SPI-NOR is shared pin with serial NAND */ +- spi_nor_pins: spi-nor-pins { +- mux { +- function = "flash"; +- groups = "spi_nor"; +- }; +- }; +- +- /* serial NAND is shared pin with SPI-NOR */ +- serial_nand_pins: serial-nand-pins { +- mux { +- function = "flash"; +- groups = "snfi"; +- }; +- }; +- + uart0_pins: uart0-pins { + mux { + function = "uart"; +@@ -543,11 +336,32 @@ + }; + + &sata { +- status = "disable"; ++ status = "disabled"; + }; + + &sata_phy { +- status = "disable"; ++ status = "disabled"; +}; + -+ð { ++&slot0 { ++ wmac1: mt7915@0,0 { ++ reg = <0x0000 0 0 0 0>; ++ ieee80211-freq-limit = <5000000 6000000>; ++ }; ++}; ++ ++&snfi { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&serial_nand_pins>; + status = "okay"; -+ gmac0: mac@0 { -+ compatible = "mediatek,eth-mac"; -+ reg = <0>; -+ phy-mode = "2500base-x"; + -+ fixed-link { -+ speed = <2500>; -+ full-duplex; -+ pause; -+ }; -+ }; -+ -+ gmac1: mac@1 { -+ compatible = "mediatek,eth-mac"; -+ reg = <1>; -+ phy-mode = "rgmii"; -+ -+ fixed-link { -+ speed = <1000>; -+ full-duplex; -+ pause; -+ }; -+ }; -+ -+ mdio: mdio-bus { ++ snand: spi_nand@0 { + #address-cells = <1>; -+ #size-cells = <0>; -+ }; -+}; -+ -+&gsw { -+ mediatek,mdio = <&mdio>; -+ mediatek,portmap = "llllw"; -+ mediatek,mdio_master_pinmux = <0>; -+ reset-gpios = <&pio 54 0>; -+ interrupt-parent = <&pio>; -+ interrupts = <53 IRQ_TYPE_LEVEL_HIGH>; -+ status = "okay"; -+ -+ port5: port@5 { -+ compatible = "mediatek,mt753x-port"; -+ reg = <5>; -+ phy-mode = "rgmii"; -+ fixed-link { -+ speed = <1000>; -+ full-duplex; -+ }; -+ }; -+ -+ port6: port@6 { -+ compatible = "mediatek,mt753x-port"; -+ reg = <6>; -+ phy-mode = "sgmii"; -+ fixed-link { -+ speed = <2500>; -+ full-duplex; -+ }; -+ }; -+}; -+ -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ status = "okay"; -+}; -+ -+&i2c2 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c2_pins>; -+ status = "okay"; -+}; -+ -+&mmc0 { -+ pinctrl-names = "default", "state_uhs"; -+ pinctrl-0 = <&emmc_pins_default>; -+ pinctrl-1 = <&emmc_pins_uhs>; -+ status = "okay"; -+ bus-width = <8>; -+ max-frequency = <50000000>; -+ cap-mmc-highspeed; -+ mmc-hs200-1_8v; -+ vmmc-supply = <®_3p3v>; -+ vqmmc-supply = <®_1p8v>; -+ assigned-clocks = <&topckgen CLK_TOP_MSDC30_0_SEL>; -+ assigned-clock-parents = <&topckgen CLK_TOP_UNIV48M>; -+ non-removable; -+}; -+ -+&mmc1 { -+ pinctrl-names = "default", "state_uhs"; -+ pinctrl-0 = <&sd0_pins_default>; -+ pinctrl-1 = <&sd0_pins_uhs>; -+ status = "okay"; -+ bus-width = <4>; -+ max-frequency = <50000000>; -+ cap-sd-highspeed; -+ r_smpl = <1>; -+ cd-gpios = <&pio 81 GPIO_ACTIVE_LOW>; -+ vmmc-supply = <®_3p3v>; -+ vqmmc-supply = <®_3p3v>; -+ assigned-clocks = <&topckgen CLK_TOP_MSDC30_1_SEL>; -+ assigned-clock-parents = <&topckgen CLK_TOP_UNIV48M>; -+}; -+ -+&nandc { -+ pinctrl-names = "default"; -+ pinctrl-0 = <¶llel_nand_pins>; -+ status = "disabled"; -+}; -+ -+&nor_flash { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi_nor_pins>; -+ status = "disabled"; -+ -+ flash@0 { -+ compatible = "jedec,spi-nor"; ++ #size-cells = <1>; ++ compatible = "spi-nand"; ++ spi-max-frequency = <104000000>; + reg = <0>; + }; + }; + + &spi0 { +@@ -584,6 +398,10 @@ + status = "okay"; + }; + ++&rtc { ++ status = "disabled"; +}; + -+&pcie0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pcie0_pins>; -+ status = "okay"; -+}; + &watchdog { + pinctrl-names = "default"; + pinctrl-0 = <&watchdog_pins>; +diff --git a/target/linux/mediatek/dts/mt7622-rfb1-ubi.dts b/target/linux/mediatek/dts/mt7622-rfb1-ubi.dts +new file mode 100644 +index 0000000000..a54e710924 +--- /dev/null ++++ b/target/linux/mediatek/dts/mt7622-rfb1-ubi.dts +@@ -0,0 +1,68 @@ ++/dts-v1/; + -+&pcie1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pcie1_pins>; -+ status = "okay"; -+}; -+ -+&pio { -+ /* Attention: GPIO 90 is used to switch between PCIe@1,0 and -+ * SATA functions. i.e. output-high: PCIe, output-low: SATA -+ */ -+ asm_sel { -+ gpio-hog; -+ gpios = <90 GPIO_ACTIVE_HIGH>; -+ output-high; -+ }; -+ -+ /* eMMC is shared pin with parallel NAND */ -+ emmc_pins_default: emmc-pins-default { -+ mux { -+ function = "emmc", "emmc_rst"; -+ groups = "emmc"; -+ }; -+ -+ /* "NDL0","NDL1","NDL2","NDL3","NDL4","NDL5","NDL6","NDL7", -+ * "NRB","NCLE" pins are used as DAT0,DAT1,DAT2,DAT3,DAT4, -+ * DAT5,DAT6,DAT7,CMD,CLK for eMMC respectively -+ */ -+ conf-cmd-dat { -+ pins = "NDL0", "NDL1", "NDL2", -+ "NDL3", "NDL4", "NDL5", -+ "NDL6", "NDL7", "NRB"; -+ input-enable; -+ bias-pull-up; -+ }; -+ -+ conf-clk { -+ pins = "NCLE"; -+ bias-pull-down; -+ }; -+ }; -+ -+ emmc_pins_uhs: emmc-pins-uhs { -+ mux { -+ function = "emmc"; -+ groups = "emmc"; -+ }; -+ -+ conf-cmd-dat { -+ pins = "NDL0", "NDL1", "NDL2", -+ "NDL3", "NDL4", "NDL5", -+ "NDL6", "NDL7", "NRB"; -+ input-enable; -+ drive-strength = <4>; -+ bias-pull-up; -+ }; -+ -+ conf-clk { -+ pins = "NCLE"; -+ drive-strength = <4>; -+ bias-pull-down; -+ }; -+ }; -+ -+ eth_pins: eth-pins { -+ mux { -+ function = "eth"; -+ groups = "mdc_mdio", "rgmii_via_gmac2"; -+ }; -+ }; -+ -+ i2c1_pins: i2c1-pins { -+ mux { -+ function = "i2c"; -+ groups = "i2c1_0"; -+ }; -+ }; -+ -+ i2c2_pins: i2c2-pins { -+ mux { -+ function = "i2c"; -+ groups = "i2c2_0"; -+ }; -+ }; -+ -+ i2s1_pins: i2s1-pins { -+ mux { -+ function = "i2s"; -+ groups = "i2s_out_mclk_bclk_ws", -+ "i2s1_in_data", -+ "i2s1_out_data"; -+ }; -+ -+ conf { -+ pins = "I2S1_IN", "I2S1_OUT", "I2S_BCLK", -+ "I2S_WS", "I2S_MCLK"; -+ drive-strength = <12>; -+ bias-pull-down; -+ }; -+ }; -+ -+ irrx_pins: irrx-pins { -+ mux { -+ function = "ir"; -+ groups = "ir_1_rx"; -+ }; -+ }; -+ -+ irtx_pins: irtx-pins { -+ mux { -+ function = "ir"; -+ groups = "ir_1_tx"; -+ }; -+ }; -+ -+ /* Parallel nand is shared pin with eMMC */ -+ parallel_nand_pins: parallel-nand-pins { -+ mux { -+ function = "flash"; -+ groups = "par_nand"; -+ }; -+ }; -+ -+ pcie0_pins: pcie0-pins { -+ mux { -+ function = "pcie"; -+ groups = "pcie0_pad_perst", -+ "pcie0_1_waken", -+ "pcie0_1_clkreq"; -+ }; -+ }; -+ -+ pcie1_pins: pcie1-pins { -+ mux { -+ function = "pcie"; -+ groups = "pcie1_pad_perst", -+ "pcie1_0_waken", -+ "pcie1_0_clkreq"; -+ }; -+ }; -+ -+ pmic_bus_pins: pmic-bus-pins { -+ mux { -+ function = "pmic"; -+ groups = "pmic_bus"; -+ }; -+ }; -+ -+ pwm7_pins: pwm1-2-pins { -+ mux { -+ function = "pwm"; -+ groups = "pwm_ch7_2"; -+ }; -+ }; -+ -+ wled_pins: wled-pins { -+ mux { -+ function = "led"; -+ groups = "wled"; -+ }; -+ }; -+ -+ sd0_pins_default: sd0-pins-default { -+ mux { -+ function = "sd"; -+ groups = "sd_0"; -+ }; -+ -+ /* "I2S2_OUT, "I2S4_IN"", "I2S3_IN", "I2S2_IN", -+ * "I2S4_OUT", "I2S3_OUT" are used as DAT0, DAT1, -+ * DAT2, DAT3, CMD, CLK for SD respectively. -+ */ -+ conf-cmd-data { -+ pins = "I2S2_OUT", "I2S4_IN", "I2S3_IN", -+ "I2S2_IN","I2S4_OUT"; -+ input-enable; -+ drive-strength = <8>; -+ bias-pull-up; -+ }; -+ conf-clk { -+ pins = "I2S3_OUT"; -+ drive-strength = <12>; -+ bias-pull-down; -+ }; -+ conf-cd { -+ pins = "TXD3"; -+ bias-pull-up; -+ }; -+ }; -+ -+ sd0_pins_uhs: sd0-pins-uhs { -+ mux { -+ function = "sd"; -+ groups = "sd_0"; -+ }; -+ -+ conf-cmd-data { -+ pins = "I2S2_OUT", "I2S4_IN", "I2S3_IN", -+ "I2S2_IN","I2S4_OUT"; -+ input-enable; -+ bias-pull-up; -+ }; -+ -+ conf-clk { -+ pins = "I2S3_OUT"; -+ bias-pull-down; -+ }; -+ }; -+ -+ /* Serial NAND is shared pin with SPI-NOR */ -+ serial_nand_pins: serial-nand-pins { -+ mux { -+ function = "flash"; -+ groups = "snfi"; -+ }; -+ }; -+ -+ spic0_pins: spic0-pins { -+ mux { -+ function = "spi"; -+ groups = "spic0_0"; -+ }; -+ }; -+ -+ spic1_pins: spic1-pins { -+ mux { -+ function = "spi"; -+ groups = "spic1_0"; -+ }; -+ }; -+ -+ /* SPI-NOR is shared pin with serial NAND */ -+ spi_nor_pins: spi-nor-pins { -+ mux { -+ function = "flash"; -+ groups = "spi_nor"; -+ }; -+ }; -+ -+ /* serial NAND is shared pin with SPI-NOR */ -+ serial_nand_pins: serial-nand-pins { -+ mux { -+ function = "flash"; -+ groups = "snfi"; -+ }; -+ }; -+ -+ uart0_pins: uart0-pins { -+ mux { -+ function = "uart"; -+ groups = "uart0_0_tx_rx" ; -+ }; -+ }; -+ -+ uart2_pins: uart2-pins { -+ mux { -+ function = "uart"; -+ groups = "uart2_1_tx_rx" ; -+ }; -+ }; -+ -+ watchdog_pins: watchdog-pins { -+ mux { -+ function = "watchdog"; -+ groups = "watchdog"; -+ }; -+ }; -+}; -+ -+&pwm { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pwm7_pins>; -+ status = "okay"; -+}; -+ -+&pwrap { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pmic_bus_pins>; -+ -+ status = "okay"; -+}; -+ -+&sata { -+ status = "disable"; -+}; -+ -+&sata_phy { -+ status = "disable"; ++#include "mt7622-rfb1.dts" ++/ { ++ model = "MT7622_MT7531 RFB (UBI)"; ++ compatible = "mediatek,mt7622,ubi"; +}; + +&snfi { @@ -2182,51 +1551,378 @@ index 0000000000..2589a349ad + }; + }; +}; +diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-ubnt-unifi-6-lr.dts b/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr.dts +similarity index 100% +rename from target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-ubnt-unifi-6-lr.dts +rename to target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr.dts +diff --git a/target/linux/mediatek/dts/mt7623a-unielec-u7623-02-emmc-512m.dts b/target/linux/mediatek/dts/mt7623a-unielec-u7623-02-emmc-512m.dts +new file mode 100644 +index 0000000000..822ca3fd49 +--- /dev/null ++++ b/target/linux/mediatek/dts/mt7623a-unielec-u7623-02-emmc-512m.dts +@@ -0,0 +1,17 @@ ++// SPDX-License-Identifier: (GPL-2.0-or-later OR MIT) ++/* ++ * Copyright 2018 Kristian Evensen ++ */ + -+&spi0 { ++/dts-v1/; ++#include "mt7623a-unielec-u7623-02-emmc.dtsi" ++ ++/ { ++ model = "UniElec U7623-02 eMMC (512M RAM)"; ++ compatible = "unielec,u7623-02-emmc-512m", "unielec,u7623-02-emmc", "mediatek,mt7623"; ++ ++ memory@80000000 { ++ device_type = "memory"; ++ reg = <0 0x80000000 0 0x20000000>; ++ }; ++}; +diff --git a/target/linux/mediatek/dts/mt7623a-unielec-u7623-02-emmc.dtsi b/target/linux/mediatek/dts/mt7623a-unielec-u7623-02-emmc.dtsi +new file mode 100644 +index 0000000000..aa1e82b58a +--- /dev/null ++++ b/target/linux/mediatek/dts/mt7623a-unielec-u7623-02-emmc.dtsi +@@ -0,0 +1,339 @@ ++// SPDX-License-Identifier: (GPL-2.0-or-later OR MIT) ++/* ++ * Copyright 2018 Kristian Evensen ++ */ ++ ++#include ++#include "mt7623.dtsi" ++#include "mt6323.dtsi" ++ ++/ { ++ compatible = "unielec,u7623-02-emmc", "mediatek,mt7623"; ++ ++ aliases { ++ serial2 = &uart2; ++ }; ++ ++ chosen { ++ bootargs = "root=/dev/mmcblk0p2 rootfstype=squashfs,f2fs console=ttyS0,115200 blkdevparts=mmcblk0:3M@6M(recovery),256M@9M(root)"; ++ stdout-path = "serial2:115200n8"; ++ }; ++ ++ cpus { ++ cpu@0 { ++ proc-supply = <&mt6323_vproc_reg>; ++ }; ++ ++ cpu@1 { ++ proc-supply = <&mt6323_vproc_reg>; ++ }; ++ ++ cpu@2 { ++ proc-supply = <&mt6323_vproc_reg>; ++ }; ++ ++ cpu@3 { ++ proc-supply = <&mt6323_vproc_reg>; ++ }; ++ }; ++ ++ reg_1p8v: regulator-1p8v { ++ compatible = "regulator-fixed"; ++ regulator-name = "fixed-1.8V"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++ ++ reg_3p3v: regulator-3p3v { ++ compatible = "regulator-fixed"; ++ regulator-name = "fixed-3.3V"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++ ++ reg_5v: regulator-5v { ++ compatible = "regulator-fixed"; ++ regulator-name = "fixed-5V"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&key_pins_a>; ++ ++ factory { ++ label = "factory"; ++ linux,code = ; ++ gpios = <&pio 256 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&led_pins_unielec>; ++ ++ led3 { ++ label = "u7623-01:green:led3"; ++ gpios = <&pio 14 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led4 { ++ label = "u7623-01:green:led4"; ++ gpios = <&pio 15 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++&crypto { ++ status = "okay"; ++}; ++ ++ð { ++ status = "okay"; ++ ++ gmac0: mac@0 { ++ compatible = "mediatek,eth-mac"; ++ reg = <0>; ++ phy-mode = "trgmii"; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ pause; ++ }; ++ }; ++ ++ mdio: mdio-bus { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ mt7530: switch@0 { ++ compatible = "mediatek,mt7530"; ++ }; ++ }; ++}; ++ ++&mt7530 { ++ compatible = "mediatek,mt7530"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0>; + pinctrl-names = "default"; -+ pinctrl-0 = <&spic0_pins>; -+ status = "okay"; ++ mediatek,mcm; ++ resets = <ðsys 2>; ++ reset-names = "mcm"; ++ core-supply = <&mt6323_vpa_reg>; ++ io-supply = <&mt6323_vemc3v3_reg>; ++ ++ dsa,mii-bus = <&mdio>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0>; ++ ++ port@0 { ++ reg = <0>; ++ label = "lan0"; ++ cpu = <&cpu_port0>; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ label = "lan1"; ++ cpu = <&cpu_port0>; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ label = "lan2"; ++ cpu = <&cpu_port0>; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ label = "lan3"; ++ cpu = <&cpu_port0>; ++ }; ++ ++ port@4 { ++ reg = <4>; ++ label = "wan"; ++ cpu = <&cpu_port0>; ++ }; ++ ++ cpu_port0: port@6 { ++ reg = <6>; ++ label = "cpu"; ++ ethernet = <&gmac0>; ++ phy-mode = "trgmii"; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; ++ }; +}; + -+&spi1 { ++&mmc0 { ++ pinctrl-names = "default", "state_uhs"; ++ pinctrl-0 = <&mmc0_pins_default>; ++ pinctrl-1 = <&mmc0_pins_uhs>; ++ status = "okay"; ++ bus-width = <8>; ++ max-frequency = <50000000>; ++ cap-mmc-highspeed; ++ vmmc-supply = <®_3p3v>; ++ vqmmc-supply = <®_1p8v>; ++ non-removable; ++}; ++ ++&pio { ++ key_pins_a: keys-alt { ++ pins-keys { ++ pinmux = , ++ ; ++ input-enable; ++ }; ++ }; ++ ++ led_pins_unielec: leds-unielec { ++ pins-leds { ++ pinmux = , ++ ; ++ }; ++ }; ++ ++ mmc0_pins_default: mmc0default { ++ pins_cmd_dat { ++ pinmux = , ++ , ++ , ++ , ++ , ++ , ++ , ++ , ++ ; ++ input-enable; ++ bias-pull-up; ++ }; ++ ++ pins_clk { ++ pinmux = ; ++ bias-pull-down; ++ }; ++ ++ pins_rst { ++ pinmux = ; ++ bias-pull-up; ++ }; ++ }; ++ ++ mmc0_pins_uhs: mmc0 { ++ pins_cmd_dat { ++ pinmux = , ++ , ++ , ++ , ++ , ++ , ++ , ++ , ++ ; ++ input-enable; ++ drive-strength = ; ++ bias-pull-up = ; ++ }; ++ ++ pins_clk { ++ pinmux = ; ++ drive-strength = ; ++ bias-pull-down = ; ++ }; ++ ++ pins_rst { ++ pinmux = ; ++ bias-pull-up; ++ }; ++ }; ++ ++ pcie_default: pcie_pin_default { ++ pins_cmd_dat { ++ pinmux = , ++ ; ++ bias-disable; ++ }; ++ }; ++}; ++ ++&pwm { + pinctrl-names = "default"; -+ pinctrl-0 = <&spic1_pins>; ++ pinctrl-0 = <&pwm_pins_a>; + status = "okay"; +}; + -+&ssusb { -+ vusb33-supply = <®_3p3v>; -+ vbus-supply = <®_5v>; -+ status = "okay"; -+}; ++&pwrap { ++ mt6323 { ++ mt6323led: led { ++ compatible = "mediatek,mt6323-led"; ++ #address-cells = <1>; ++ #size-cells = <0>; + -+&u3phy { -+ status = "okay"; -+}; -+ -+&uart0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart0_pins>; -+ status = "okay"; ++ led@0 { ++ reg = <0>; ++ label = "led0"; ++ }; ++ }; ++ }; +}; + +&uart2 { + pinctrl-names = "default"; -+ pinctrl-0 = <&uart2_pins>; ++ pinctrl-0 = <&uart2_pins_b>; + status = "okay"; +}; + -+&watchdog { ++&usb1 { ++ vusb33-supply = <®_3p3v>; ++ vbus-supply = <®_3p3v>; ++ status = "okay"; ++}; ++ ++&u3phy1 { ++ status = "okay"; ++}; ++ ++&u3phy2 { ++ status = "okay"; ++ mediatek,phy-switch = <&hifsys>; ++}; ++ ++&pcie { + pinctrl-names = "default"; -+ pinctrl-0 = <&watchdog_pins>; ++ pinctrl-0 = <&pcie_default>; ++ status = "okay"; ++ ++ pcie@1,0 { ++ status = "okay"; ++ }; ++ ++ pcie@2,0 { ++ status = "okay"; ++ }; ++}; ++ ++&pcie1_phy { + status = "okay"; +}; + -+&wmac { -+ mediatek,mtd-eeprom = <&factory 0x0000>; -+ status = "okay"; -+}; diff --git a/target/linux/mediatek/files-5.10/drivers/net/phy/mtk/mt753x/Kconfig b/target/linux/mediatek/files-5.10/drivers/net/phy/mtk/mt753x/Kconfig new file mode 100644 index 0000000000..d9e0230cf0 @@ -100955,459 +100651,1720 @@ index 0000000000..ae958e8967 +MODULE_AUTHOR("Mark Lee "); +MODULE_DESCRIPTION("rtl8367c switch driver for MT7622"); + +diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-rfb1-ubi.dts b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-rfb1-ubi.dts +deleted file mode 100644 +index 8b58c1e12f..0000000000 +--- a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-rfb1-ubi.dts ++++ /dev/null +@@ -1,644 +0,0 @@ +-/* +- * Copyright (c) 2018 MediaTek Inc. +- * Author: Ryder Lee +- * +- * SPDX-License-Identifier: (GPL-2.0-only OR MIT) +- */ +- +-/dts-v1/; +-#include +-#include +- +-#include "mt7622.dtsi" +-#include "mt6380.dtsi" +- +-/ { +- model = "MT7622_MT7531 RFB"; +- compatible = "mediatek,mt7622,ubi"; +- +- aliases { +- serial0 = &uart0; +- }; +- +- chosen { +- stdout-path = "serial0:115200n8"; +- bootargs = "earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n1 swiotlb=512"; +- }; +- +- cpus { +- cpu@0 { +- proc-supply = <&mt6380_vcpu_reg>; +- sram-supply = <&mt6380_vm_reg>; +- }; +- +- cpu@1 { +- proc-supply = <&mt6380_vcpu_reg>; +- sram-supply = <&mt6380_vm_reg>; +- }; +- }; +- +- gpio-keys { +- compatible = "gpio-keys"; +- +- factory { +- label = "factory"; +- linux,code = ; +- gpios = <&pio 0 GPIO_ACTIVE_HIGH>; +- }; +- +- wps { +- label = "wps"; +- linux,code = ; +- gpios = <&pio 102 GPIO_ACTIVE_HIGH>; +- }; +- }; +- +- gsw: gsw@0 { +- compatible = "mediatek,mt753x"; +- mediatek,ethsys = <ðsys>; +- #address-cells = <1>; +- #size-cells = <0>; +- }; +- +- leds { +- compatible = "gpio-leds"; +- +- green { +- label = "bpi-r64:pio:green"; +- gpios = <&pio 89 GPIO_ACTIVE_HIGH>; +- }; +- +- red { +- label = "bpi-r64:pio:red"; +- gpios = <&pio 88 GPIO_ACTIVE_HIGH>; +- }; +- }; +- +- memory { +- reg = <0 0x40000000 0 0x40000000>; +- }; +- +- reg_1p8v: regulator-1p8v { +- compatible = "regulator-fixed"; +- regulator-name = "fixed-1.8V"; +- regulator-min-microvolt = <1800000>; +- regulator-max-microvolt = <1800000>; +- regulator-always-on; +- }; +- +- reg_3p3v: regulator-3p3v { +- compatible = "regulator-fixed"; +- regulator-name = "fixed-3.3V"; +- regulator-min-microvolt = <3300000>; +- regulator-max-microvolt = <3300000>; +- regulator-boot-on; +- regulator-always-on; +- }; +- +- reg_5v: regulator-5v { +- compatible = "regulator-fixed"; +- regulator-name = "fixed-5V"; +- regulator-min-microvolt = <5000000>; +- regulator-max-microvolt = <5000000>; +- regulator-boot-on; +- regulator-always-on; +- }; +-}; +- +-&bch { +- status = "okay"; +-}; +- +-&btif { +- status = "okay"; +-}; +- +-&cir { +- pinctrl-names = "default"; +- pinctrl-0 = <&irrx_pins>; +- status = "okay"; +-}; +- +-ð { +- status = "okay"; +- gmac0: mac@0 { +- compatible = "mediatek,eth-mac"; +- reg = <0>; +- phy-mode = "2500base-x"; +- +- fixed-link { +- speed = <2500>; +- full-duplex; +- pause; +- }; +- }; +- +- gmac1: mac@1 { +- compatible = "mediatek,eth-mac"; +- reg = <1>; +- phy-mode = "rgmii"; +- +- fixed-link { +- speed = <1000>; +- full-duplex; +- pause; +- }; +- }; +- +- mdio: mdio-bus { +- #address-cells = <1>; +- #size-cells = <0>; +- }; +-}; +- +-&gsw { +- mediatek,mdio = <&mdio>; +- mediatek,portmap = "llllw"; +- mediatek,mdio_master_pinmux = <0>; +- reset-gpios = <&pio 54 0>; +- interrupt-parent = <&pio>; +- interrupts = <53 IRQ_TYPE_LEVEL_HIGH>; +- status = "okay"; +- +- port5: port@5 { +- compatible = "mediatek,mt753x-port"; +- reg = <5>; +- phy-mode = "rgmii"; +- fixed-link { +- speed = <1000>; +- full-duplex; +- }; +- }; +- +- port6: port@6 { +- compatible = "mediatek,mt753x-port"; +- reg = <6>; +- phy-mode = "sgmii"; +- fixed-link { +- speed = <2500>; +- full-duplex; +- }; +- }; +-}; +- +-&i2c1 { +- pinctrl-names = "default"; +- pinctrl-0 = <&i2c1_pins>; +- status = "okay"; +-}; +- +-&i2c2 { +- pinctrl-names = "default"; +- pinctrl-0 = <&i2c2_pins>; +- status = "okay"; +-}; +- +-&mmc0 { +- pinctrl-names = "default", "state_uhs"; +- pinctrl-0 = <&emmc_pins_default>; +- pinctrl-1 = <&emmc_pins_uhs>; +- status = "okay"; +- bus-width = <8>; +- max-frequency = <50000000>; +- cap-mmc-highspeed; +- mmc-hs200-1_8v; +- vmmc-supply = <®_3p3v>; +- vqmmc-supply = <®_1p8v>; +- assigned-clocks = <&topckgen CLK_TOP_MSDC30_0_SEL>; +- assigned-clock-parents = <&topckgen CLK_TOP_UNIV48M>; +- non-removable; +-}; +- +-&mmc1 { +- pinctrl-names = "default", "state_uhs"; +- pinctrl-0 = <&sd0_pins_default>; +- pinctrl-1 = <&sd0_pins_uhs>; +- status = "okay"; +- bus-width = <4>; +- max-frequency = <50000000>; +- cap-sd-highspeed; +- r_smpl = <1>; +- cd-gpios = <&pio 81 GPIO_ACTIVE_LOW>; +- vmmc-supply = <®_3p3v>; +- vqmmc-supply = <®_3p3v>; +- assigned-clocks = <&topckgen CLK_TOP_MSDC30_1_SEL>; +- assigned-clock-parents = <&topckgen CLK_TOP_UNIV48M>; +-}; +- +-&nandc { +- pinctrl-names = "default"; +- pinctrl-0 = <¶llel_nand_pins>; +- status = "disabled"; +-}; +- +-&nor_flash { +- pinctrl-names = "default"; +- pinctrl-0 = <&spi_nor_pins>; +- status = "disabled"; +- +- flash@0 { +- compatible = "jedec,spi-nor"; +- reg = <0>; +- }; +-}; +- +-&pcie0 { +- pinctrl-names = "default"; +- pinctrl-0 = <&pcie0_pins>; +- status = "okay"; +-}; +- +-&pcie1 { +- pinctrl-names = "default"; +- pinctrl-0 = <&pcie1_pins>; +- status = "okay"; +-}; +- +-&pio { +- /* Attention: GPIO 90 is used to switch between PCIe@1,0 and +- * SATA functions. i.e. output-high: PCIe, output-low: SATA +- */ +- asm_sel { +- gpio-hog; +- gpios = <90 GPIO_ACTIVE_HIGH>; +- output-high; +- }; +- +- /* eMMC is shared pin with parallel NAND */ +- emmc_pins_default: emmc-pins-default { +- mux { +- function = "emmc", "emmc_rst"; +- groups = "emmc"; +- }; +- +- /* "NDL0","NDL1","NDL2","NDL3","NDL4","NDL5","NDL6","NDL7", +- * "NRB","NCLE" pins are used as DAT0,DAT1,DAT2,DAT3,DAT4, +- * DAT5,DAT6,DAT7,CMD,CLK for eMMC respectively +- */ +- conf-cmd-dat { +- pins = "NDL0", "NDL1", "NDL2", +- "NDL3", "NDL4", "NDL5", +- "NDL6", "NDL7", "NRB"; +- input-enable; +- bias-pull-up; +- }; +- +- conf-clk { +- pins = "NCLE"; +- bias-pull-down; +- }; +- }; +- +- emmc_pins_uhs: emmc-pins-uhs { +- mux { +- function = "emmc"; +- groups = "emmc"; +- }; +- +- conf-cmd-dat { +- pins = "NDL0", "NDL1", "NDL2", +- "NDL3", "NDL4", "NDL5", +- "NDL6", "NDL7", "NRB"; +- input-enable; +- drive-strength = <4>; +- bias-pull-up; +- }; +- +- conf-clk { +- pins = "NCLE"; +- drive-strength = <4>; +- bias-pull-down; +- }; +- }; +- +- eth_pins: eth-pins { +- mux { +- function = "eth"; +- groups = "mdc_mdio", "rgmii_via_gmac2"; +- }; +- }; +- +- i2c1_pins: i2c1-pins { +- mux { +- function = "i2c"; +- groups = "i2c1_0"; +- }; +- }; +- +- i2c2_pins: i2c2-pins { +- mux { +- function = "i2c"; +- groups = "i2c2_0"; +- }; +- }; +- +- i2s1_pins: i2s1-pins { +- mux { +- function = "i2s"; +- groups = "i2s_out_mclk_bclk_ws", +- "i2s1_in_data", +- "i2s1_out_data"; +- }; +- +- conf { +- pins = "I2S1_IN", "I2S1_OUT", "I2S_BCLK", +- "I2S_WS", "I2S_MCLK"; +- drive-strength = <12>; +- bias-pull-down; +- }; +- }; +- +- irrx_pins: irrx-pins { +- mux { +- function = "ir"; +- groups = "ir_1_rx"; +- }; +- }; +- +- irtx_pins: irtx-pins { +- mux { +- function = "ir"; +- groups = "ir_1_tx"; +- }; +- }; +- +- /* Parallel nand is shared pin with eMMC */ +- parallel_nand_pins: parallel-nand-pins { +- mux { +- function = "flash"; +- groups = "par_nand"; +- }; +- }; +- +- pcie0_pins: pcie0-pins { +- mux { +- function = "pcie"; +- groups = "pcie0_pad_perst", +- "pcie0_1_waken", +- "pcie0_1_clkreq"; +- }; +- }; +- +- pcie1_pins: pcie1-pins { +- mux { +- function = "pcie"; +- groups = "pcie1_pad_perst", +- "pcie1_0_waken", +- "pcie1_0_clkreq"; +- }; +- }; +- +- pmic_bus_pins: pmic-bus-pins { +- mux { +- function = "pmic"; +- groups = "pmic_bus"; +- }; +- }; +- +- pwm7_pins: pwm1-2-pins { +- mux { +- function = "pwm"; +- groups = "pwm_ch7_2"; +- }; +- }; +- +- wled_pins: wled-pins { +- mux { +- function = "led"; +- groups = "wled"; +- }; +- }; +- +- sd0_pins_default: sd0-pins-default { +- mux { +- function = "sd"; +- groups = "sd_0"; +- }; +- +- /* "I2S2_OUT, "I2S4_IN"", "I2S3_IN", "I2S2_IN", +- * "I2S4_OUT", "I2S3_OUT" are used as DAT0, DAT1, +- * DAT2, DAT3, CMD, CLK for SD respectively. +- */ +- conf-cmd-data { +- pins = "I2S2_OUT", "I2S4_IN", "I2S3_IN", +- "I2S2_IN","I2S4_OUT"; +- input-enable; +- drive-strength = <8>; +- bias-pull-up; +- }; +- conf-clk { +- pins = "I2S3_OUT"; +- drive-strength = <12>; +- bias-pull-down; +- }; +- conf-cd { +- pins = "TXD3"; +- bias-pull-up; +- }; +- }; +- +- sd0_pins_uhs: sd0-pins-uhs { +- mux { +- function = "sd"; +- groups = "sd_0"; +- }; +- +- conf-cmd-data { +- pins = "I2S2_OUT", "I2S4_IN", "I2S3_IN", +- "I2S2_IN","I2S4_OUT"; +- input-enable; +- bias-pull-up; +- }; +- +- conf-clk { +- pins = "I2S3_OUT"; +- bias-pull-down; +- }; +- }; +- +- /* Serial NAND is shared pin with SPI-NOR */ +- serial_nand_pins: serial-nand-pins { +- mux { +- function = "flash"; +- groups = "snfi"; +- }; +- }; +- +- spic0_pins: spic0-pins { +- mux { +- function = "spi"; +- groups = "spic0_0"; +- }; +- }; +- +- spic1_pins: spic1-pins { +- mux { +- function = "spi"; +- groups = "spic1_0"; +- }; +- }; +- +- /* SPI-NOR is shared pin with serial NAND */ +- spi_nor_pins: spi-nor-pins { +- mux { +- function = "flash"; +- groups = "spi_nor"; +- }; +- }; +- +- /* serial NAND is shared pin with SPI-NOR */ +- serial_nand_pins: serial-nand-pins { +- mux { +- function = "flash"; +- groups = "snfi"; +- }; +- }; +- +- uart0_pins: uart0-pins { +- mux { +- function = "uart"; +- groups = "uart0_0_tx_rx" ; +- }; +- }; +- +- uart2_pins: uart2-pins { +- mux { +- function = "uart"; +- groups = "uart2_1_tx_rx" ; +- }; +- }; +- +- watchdog_pins: watchdog-pins { +- mux { +- function = "watchdog"; +- groups = "watchdog"; +- }; +- }; +-}; +- +-&pwm { +- pinctrl-names = "default"; +- pinctrl-0 = <&pwm7_pins>; +- status = "okay"; +-}; +- +-&pwrap { +- pinctrl-names = "default"; +- pinctrl-0 = <&pmic_bus_pins>; +- +- status = "okay"; +-}; +- +-&sata { +- status = "disable"; +-}; +- +-&sata_phy { +- status = "disable"; +-}; +- +-&snfi { +- pinctrl-names = "default"; +- pinctrl-0 = <&serial_nand_pins>; +- status = "okay"; +- +- spi_nand@0 { +- #address-cells = <1>; +- #size-cells = <1>; +- compatible = "spi-nand"; +- spi-max-frequency = <104000000>; +- reg = <0>; +- +- partitions { +- compatible = "fixed-partitions"; +- #address-cells = <1>; +- #size-cells = <1>; +- +- partition@0 { +- label = "Preloader"; +- reg = <0x00000 0x0080000>; +- read-only; +- }; +- +- partition@80000 { +- label = "ATF"; +- reg = <0x80000 0x0040000>; +- }; +- +- partition@c0000 { +- label = "Bootloader"; +- reg = <0xc0000 0x0080000>; +- }; +- +- partition@140000 { +- label = "Config"; +- reg = <0x140000 0x0080000>; +- }; +- +- factory: partition@1c0000 { +- label = "Factory"; +- reg = <0x1c0000 0x0040000>; +- }; +- +- partition@200000 { +- label = "kernel"; +- reg = <0x200000 0x400000>; +- }; +- +- partition@600000 { +- label = "ubi"; +- reg = <0x600000 0x1C00000>; +- }; +- +- partition@2200000 { +- label = "User_data"; +- reg = <0x2200000 0x4000000>; +- }; +- }; +- }; +-}; +- +-&spi0 { +- pinctrl-names = "default"; +- pinctrl-0 = <&spic0_pins>; +- status = "okay"; +-}; +- +-&spi1 { +- pinctrl-names = "default"; +- pinctrl-0 = <&spic1_pins>; +- status = "okay"; +-}; +- +-&ssusb { +- vusb33-supply = <®_3p3v>; +- vbus-supply = <®_5v>; +- status = "okay"; +-}; +- +-&u3phy { +- status = "okay"; +-}; +- +-&uart0 { +- pinctrl-names = "default"; +- pinctrl-0 = <&uart0_pins>; +- status = "okay"; +-}; +- +-&uart2 { +- pinctrl-names = "default"; +- pinctrl-0 = <&uart2_pins>; +- status = "okay"; +-}; +- +-&watchdog { +- pinctrl-names = "default"; +- pinctrl-0 = <&watchdog_pins>; +- status = "okay"; +-}; +- +-&wmac { +- mediatek,mtd-eeprom = <&factory 0x0000>; +- status = "okay"; +-}; +diff --git a/target/linux/mediatek/image/Makefile b/target/linux/mediatek/image/Makefile +index 45e83cece5..7aa7a7285c 100644 +--- a/target/linux/mediatek/image/Makefile ++++ b/target/linux/mediatek/image/Makefile +@@ -23,7 +23,7 @@ define Device/Default + KERNEL = kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + KERNEL_INITRAMFS = kernel-bin | lzma | \ +- fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb ++ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd + FILESYSTEMS := squashfs + DEVICE_DTS_DIR := $(DTS_DIR) + IMAGES := sysupgrade.bin +diff --git a/target/linux/mediatek/image/gen_mt7622_emmc_img.sh b/target/linux/mediatek/image/gen_mt7622_emmc_img.sh +deleted file mode 100755 +index d74068c7b1..0000000000 +--- a/target/linux/mediatek/image/gen_mt7622_emmc_img.sh ++++ /dev/null +@@ -1,19 +0,0 @@ +-#!/bin/sh +- +-OUTPUT_FILE=$1 +-KERNEL_FILE=$2 +-RECOVERY_FILE=$3 +-ROOTFS_FILE=$4 +- +-BS=512 +- +-#RECOVERY_OFFSET= kernel size / BS = 20M / 512 (blocks) +-RECOVERY_OFFSET=40960 +- +-#ROOTFS_OFFSET = RECOVERY_OFFSET + (RECOVERY_SIZE / BS) +-# = 40960 + (10M / 512) (blocks) +-ROOTFS_OFFSET=61440 +-dd bs="$BS" of="$OUTPUT_FILE" if="$KERNEL_FILE" +-dd bs="$BS" of="$OUTPUT_FILE" if="$RECOVERY_FILE" seek="$RECOVERY_OFFSET" +-dd bs="$BS" of="$OUTPUT_FILE" if="$ROOTFS_FILE" seek="$ROOTFS_OFFSET" +-dd if=/dev/zero of="$OUTPUT_FILE" bs=128k count=1 oflag=append conv=notrunc diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk -index bf706930e4..74f6eba19a 100644 +index bf706930e4..2311887761 100644 --- a/target/linux/mediatek/image/mt7622.mk +++ b/target/linux/mediatek/image/mt7622.mk -@@ -1,4 +1,8 @@ +@@ -1,51 +1,165 @@ -KERNEL_LOADADDR := 0x44080000 ++DTS_DIR := $(DTS_DIR)/mediatek + +-define Device/bpi_bananapi-r64 +- DEVICE_VENDOR := Bpi +- DEVICE_MODEL := Banana Pi R64 +- DEVICE_DTS := mt7622-bananapi-bpi-r64 +- DEVICE_DTS_DIR := $(DTS_DIR)/mediatek +- SUPPORTED_DEVICES := bananapi,bpi-r64 +- DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-ata-ahci-mtk +ifdef CONFIG_LINUX_5_4 + KERNEL_LOADADDR := 0x44080000 +else + KERNEL_LOADADDR := 0x44000000 +endif ++ ++define Image/Prepare ++ # For UBI we want only one extra block ++ rm -f $(KDIR)/ubi_mark ++ echo -ne '\xde\xad\xc0\xde' > $(KDIR)/ubi_mark ++endef ++ ++define Build/buffalo-kernel-trx ++ $(eval magic=$(word 1,$(1))) ++ $(eval dummy=$(word 2,$(1))) ++ $(eval kern_size=$(if $(KERNEL_SIZE),$(KERNEL_SIZE),0x400000)) ++ ++ $(if $(dummy),touch $(dummy)) ++ $(STAGING_DIR_HOST)/bin/otrx create $@.new \ ++ $(if $(magic),-M $(magic),) \ ++ -f $@ \ ++ $(if $(dummy),\ ++ -a 0x20000 \ ++ -b $$(( $(subst k, * 1024,$(kern_size)) )) \ ++ -f $(dummy),) ++ mv $@.new $@ ++endef ++ ++define Build/bl2 ++ cat $(STAGING_DIR_IMAGE)/mt7622-$1-bl2.img >> $@ ++endef ++ ++define Build/bl31-uboot ++ cat $(STAGING_DIR_IMAGE)/mt7622_$1-u-boot.fip >> $@ ++endef ++ ++define Build/mt7622-gpt ++ cp $@ $@.tmp 2>/dev/null || true ++ ptgen -g -o $@.tmp -a 1 -l 1024 \ ++ $(if $(findstring sdmmc,$1), \ ++ -H \ ++ -t 0x83 -N bl2 -r -p 512k@512k \ ++ ) \ ++ -t 0xef -N fip -r -p 1M@2M \ ++ -t 0x83 -N ubootenv -r -p 1M@4M \ ++ -N recovery -r -p 32M@6M \ ++ $(if $(findstring sdmmc,$1), \ ++ -t 0x2e -N production -p 216M@40M \ ++ ) \ ++ $(if $(findstring emmc,$1), \ ++ -t 0x2e -N production -p 980M@40M \ ++ ) ++ cat $@.tmp >> $@ ++ rm $@.tmp ++endef ++ ++define Build/trx-nand ++ # kernel: always use 4 MiB (-28 B or TRX header) to allow upgrades even ++ # if it grows up between releases ++ # root: UBI with one extra block containing UBI mark to trigger erasing ++ # rest of partition ++ $(STAGING_DIR_HOST)/bin/otrx create $@.new \ ++ -M 0x32504844 \ ++ -f $(IMAGE_KERNEL) -a 0x20000 -b 0x400000 \ ++ -f $@ \ ++ -A $(KDIR)/ubi_mark -a 0x20000 ++ mv $@.new $@ + endef +-TARGET_DEVICES += bpi_bananapi-r64 - define Device/bpi_bananapi-r64 - DEVICE_VENDOR := Bpi -diff --git a/target/linux/mediatek/mt7622/config-5.10 b/target/linux/mediatek/mt7622/config-5.10 +-define Device/bpi_bananapi-r64-rootdisk +- DEVICE_VENDOR := Bpi +- DEVICE_MODEL := Banana Pi R64 (rootdisk) +- DEVICE_DTS := mt7622-bananapi-bpi-r64-rootdisk +- DEVICE_DTS_DIR := $(DTS_DIR)/mediatek +- SUPPORTED_DEVICES := bananapi,bpi-r64 +- DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-ata-ahci-mtk +- IMAGES := sysupgrade-emmc.bin.gz +- IMAGE/sysupgrade-emmc.bin.gz := sysupgrade-emmc | gzip | append-metadata ++define Device/buffalo_wsr-2533dhp2 ++ DEVICE_VENDOR := Buffalo ++ DEVICE_MODEL := WSR-2533DHP2 ++ DEVICE_DTS := mt7622-buffalo-wsr-2533dhp2 ++ DEVICE_DTS_DIR := ../dts ++ IMAGE_SIZE := 59392k ++ KERNEL_SIZE := 4096k ++ BLOCKSIZE := 128k ++ PAGESIZE := 2048 ++ SUBPAGESIZE := 512 ++ UBINIZE_OPTS := -E 5 ++ BUFFALO_TAG_PLATFORM := MTK ++ BUFFALO_TAG_VERSION := 9.99 ++ BUFFALO_TAG_MINOR := 9.99 ++ IMAGES += factory.bin factory-uboot.bin ++ KERNEL_INITRAMFS := kernel-bin | lzma | \ ++ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | \ ++ buffalo-kernel-trx ++ IMAGE/factory.bin := append-ubi | trx-nand | \ ++ buffalo-enc WSR-2533DHP2 $$(BUFFALO_TAG_VERSION) -l | \ ++ buffalo-tag-dhp WSR-2533DHP2 JP JP | buffalo-enc-tag -l | buffalo-dhp-image ++ IMAGE/factory-uboot.bin := append-ubi | trx-nand ++ IMAGE/sysupgrade.bin := append-kernel | \ ++ buffalo-kernel-trx 0x32504844 $(KDIR)/tmp/$$(DEVICE_NAME).null | \ ++ sysupgrade-tar kernel=$$$$@ | append-metadata ++ DEVICE_PACKAGES := swconfig + endef +-TARGET_DEVICES += bpi_bananapi-r64-rootdisk ++TARGET_DEVICES += buffalo_wsr-2533dhp2 + + define Device/elecom_wrc-2533gent + DEVICE_VENDOR := Elecom + DEVICE_MODEL := WRC-2533GENT + DEVICE_DTS := mt7622-elecom-wrc-2533gent +- DEVICE_DTS_DIR := $(DTS_DIR)/mediatek +- DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-mt7615e \ +- kmod-mt7615-firmware kmod-btmtkuart swconfig ++ DEVICE_DTS_DIR := ../dts ++ DEVICE_PACKAGES := kmod-btmtkuart kmod-usb3 swconfig + endef + TARGET_DEVICES += elecom_wrc-2533gent + ++define Device/linksys_e8450 ++ DEVICE_VENDOR := Linksys ++ DEVICE_MODEL := E8450 ++ DEVICE_ALT0_VENDOR := Belkin ++ DEVICE_ALT0_MODEL := RT3200 ++ DEVICE_DTS := mt7622-linksys-e8450 ++ DEVICE_DTS_DIR := ../dts ++ DEVICE_PACKAGES := kmod-mt7915e kmod-usb3 ++endef ++TARGET_DEVICES += linksys_e8450 ++ ++define Device/linksys_e8450-ubi ++ DEVICE_VENDOR := Linksys ++ DEVICE_MODEL := E8450 ++ DEVICE_VARIANT := UBI ++ DEVICE_ALT0_VENDOR := Belkin ++ DEVICE_ALT0_MODEL := RT3200 ++ DEVICE_ALT0_VARIANT := UBI ++ DEVICE_DTS := mt7622-linksys-e8450-ubi ++ DEVICE_DTS_DIR := ../dts ++ DEVICE_PACKAGES := kmod-mt7915e kmod-usb3 ++ UBINIZE_OPTS := -E 5 ++ BLOCKSIZE := 128k ++ PAGESIZE := 2048 ++ UBOOTENV_IN_UBI := 1 ++ KERNEL_IN_UBI := 1 ++ KERNEL := kernel-bin | gzip ++# recovery can also be used with stock firmware web-ui, hence the padding... ++ KERNEL_INITRAMFS := kernel-bin | lzma | \ ++ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 128k ++ KERNEL_INITRAMFS_SUFFIX := -recovery.itb ++ IMAGES := sysupgrade.itb ++ IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata ++ ARTIFACTS := preloader.bin bl31-uboot.fip ++ ARTIFACT/preloader.bin := bl2 snand-1ddr ++ ARTIFACT/bl31-uboot.fip := bl31-uboot linksys_e8450 ++endef ++TARGET_DEVICES += linksys_e8450-ubi ++ + define Device/mediatek_mt7622-rfb1 + DEVICE_VENDOR := MediaTek + DEVICE_MODEL := MTK7622 rfb1 AP + DEVICE_DTS := mt7622-rfb1 +- DEVICE_DTS_DIR := $(DTS_DIR)/mediatek +- DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-ata-ahci-mtk ++ DEVICE_PACKAGES := kmod-ata-ahci-mtk kmod-btmtkuart kmod-usb3 + endef + TARGET_DEVICES += mediatek_mt7622-rfb1 + +-define Device/mediatek_mt7622-ubi ++define Device/mediatek_mt7622-rfb1-ubi + DEVICE_VENDOR := MediaTek +- DEVICE_MODEL := MTK7622 AP (UBI) ++ DEVICE_MODEL := MTK7622 rfb1 AP (UBI) + DEVICE_DTS := mt7622-rfb1-ubi +- DEVICE_DTS_DIR := $(DTS_DIR)/mediatek ++ DEVICE_DTS_DIR := ../dts ++ DEVICE_PACKAGES := kmod-ata-ahci-mtk kmod-btmtkuart kmod-usb3 + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 +@@ -54,16 +168,16 @@ define Device/mediatek_mt7622-ubi + IMAGES += factory.bin + IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ + check-size $$$$(IMAGE_SIZE) +- IMAGE/sysupgrade.bin := sysupgrade-tar +- DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-ata-ahci-mtk ++ IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + endef +-TARGET_DEVICES += mediatek_mt7622-ubi ++TARGET_DEVICES += mediatek_mt7622-rfb1-ubi + + define Device/ubnt_unifi-6-lr + DEVICE_VENDOR := Ubiquiti + DEVICE_MODEL := UniFi 6 LR ++ DEVICE_DTS_CONFIG := config@1 + DEVICE_DTS := mt7622-ubnt-unifi-6-lr +- DEVICE_DTS_DIR := $(DTS_DIR)/mediatek ++ DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e + endef + TARGET_DEVICES += ubnt_unifi-6-lr +diff --git a/target/linux/mediatek/image/mt7623.mk b/target/linux/mediatek/image/mt7623.mk +index 72758ddbaa..56f67c0e89 100644 +--- a/target/linux/mediatek/image/mt7623.mk ++++ b/target/linux/mediatek/image/mt7623.mk +@@ -63,6 +63,7 @@ define Device/unielec_u7623-emmc + # When we use FIT images, U-Boot will populate the /memory node with the correct + # memory size discovered from the preloader, so we don't need separate builds. + DEVICE_DTS := mt7623a-unielec-u7623-02-emmc-512m ++ DEVICE_DTS_DIR := ../dts + SUPPORTED_DEVICES := unielec,u7623-02-emmc-512m + UBOOT_ENVSIZE := 0x1000 + UBOOT_OFFSET := 256k +@@ -83,6 +84,7 @@ define Device/unielec_u7623-02-emmc-512m-legacy + DEVICE_MODEL := U7623-02 + DEVICE_VARIANT := eMMC/512MiB RAM (legacy image) + DEVICE_DTS := mt7623a-unielec-u7623-02-emmc-512m ++ DEVICE_DTS_DIR := ../dts + KERNEL_NAME := zImage + KERNEL := kernel-bin | append-dtb | uImage none + KERNEL_INITRAMFS := kernel-bin | append-dtb | uImage none +diff --git a/target/linux/mediatek/mt7622/base-files/etc/board.d/01_leds b/target/linux/mediatek/mt7622/base-files/etc/board.d/01_leds new file mode 100755 -index 0000000000..ccb54471c3 +index 0000000000..65a81df8da --- /dev/null ++++ b/target/linux/mediatek/mt7622/base-files/etc/board.d/01_leds +@@ -0,0 +1,17 @@ ++. /lib/functions/leds.sh ++. /lib/functions/uci-defaults.sh ++ ++board=$(board_name) ++ ++board_config_update ++ ++case $board in ++linksys,e8450|\ ++linksys,e8450-ubi) ++ ucidef_set_led_netdev "wan" "WAN" "inet:blue" "wan" ++ ;; ++esac ++ ++board_config_flush ++ ++exit 0 +diff --git a/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network +index 3a409c8ec9..f1daa2fae1 100755 +--- a/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network ++++ b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network +@@ -1,4 +1,3 @@ +-#!/bin/sh + + . /lib/functions.sh + . /lib/functions/uci-defaults.sh +@@ -9,13 +8,16 @@ mediatek_setup_interfaces() + local board="$1" + + case $board in +- bananapi,bpi-r64-rootdisk|\ +- bananapi,bpi-r64) +- ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" wan +- ;; ++ bananapi,bpi-r64|\ ++ linksys,e8450|\ ++ linksys,e8450-ubi|\ + mediatek,mt7622-rfb1) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" wan + ;; ++ buffalo,wsr-2533dhp2) ++ ucidef_add_switch "switch0" \ ++ "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0" ++ ;; + ubnt,unifi-6-lr) + ucidef_set_interfaces_lan "eth0" + ;; +@@ -26,18 +28,9 @@ mediatek_setup_interfaces() + esac + } + +-mediatek_setup_macs() +-{ +- local board="$1" +- +- case $board in +- esac +-} +- + board_config_update + board=$(board_name) + mediatek_setup_interfaces $board +-mediatek_setup_macs $board + board_config_flush + + exit 0 +diff --git a/target/linux/mediatek/mt7622/base-files/etc/init.d/bootcount b/target/linux/mediatek/mt7622/base-files/etc/init.d/bootcount +new file mode 100755 +index 0000000000..bc4eeb6530 +--- /dev/null ++++ b/target/linux/mediatek/mt7622/base-files/etc/init.d/bootcount +@@ -0,0 +1,11 @@ ++#!/bin/sh /etc/rc.common ++ ++START=99 ++ ++boot() { ++ case $(board_name) in ++ linksys,e8450) ++ mtd erase senv || true ++ ;; ++ esac ++} +diff --git a/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/09_fix_crc b/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/09_fix_crc +new file mode 100644 +index 0000000000..81cb6b18b7 +--- /dev/null ++++ b/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/09_fix_crc +@@ -0,0 +1,10 @@ ++. /lib/functions.sh ++ ++kernel_size=$(sed -n 's/mtd[0-9]*: \([0-9a-f]*\).*"\(kernel\|linux\)".*/\1/p' /proc/mtd) ++ ++case "$(board_name)" in ++buffalo,wsr-2533dhp2) ++ mtd -M 0x44485032 ${kernel_size:+-c 0x$kernel_size} fixtrx firmware && exit 0 ++ exit 1 ++ ;; ++esac +diff --git a/target/linux/mediatek/mt7622/base-files/lib/preinit/79_move_config b/target/linux/mediatek/mt7622/base-files/lib/preinit/79_move_config +deleted file mode 100644 +index 8a30b84497..0000000000 +--- a/target/linux/mediatek/mt7622/base-files/lib/preinit/79_move_config ++++ /dev/null +@@ -1,18 +0,0 @@ +-. /lib/upgrade/common.sh +- +-RECOVERY_PART=/dev/mmcblk0p6 +- +-move_config() { +- if [ -b $RECOVERY_PART ]; then +- insmod nls_cp437 +- insmod nls_iso8859-1 +- insmod fat +- insmod vfat +- mkdir -p /recovery +- mount -o rw,noatime $RECOVERY_PART /recovery +- [ -f "/recovery/$BACKUP_FILE" ] && mv -f "/recovery/$BACKUP_FILE" / +- umount /recovery +- fi +-} +- +-boot_hook_add preinit_mount_root move_config +diff --git a/target/linux/mediatek/mt7622/base-files/lib/upgrade/buffalo.sh b/target/linux/mediatek/mt7622/base-files/lib/upgrade/buffalo.sh +new file mode 100644 +index 0000000000..844cc4ed95 +--- /dev/null ++++ b/target/linux/mediatek/mt7622/base-files/lib/upgrade/buffalo.sh +@@ -0,0 +1,126 @@ ++# ======== dev note ======== ++# for following buffalo MT7622 devices: ++# ++# - WSR-2533DHP2 (trx magic: "DHP2") ++# - WSR-2533DHP3 (trx magic: "DHP3") ++# - WSR-3200AX4S (trx magic: "DHP3") ++# ++# sysupgrade-tar image: ++# ++# This is for normal upgrading for OpenWrt. ++# use nand_do_upgrade with CI_KERNPART="firmware" ++# ++# - if the size of new kernel is not equal with the current kernel's ++# -> block upgrade and print a message about using TRX + UBI ++# formatted image ++# (should be flashed the new ubi contains rootfs + rootfs_data ++# with the offset (=new padded kernel's end) if this case? But ++# it maybe too hard for writing scripts...) ++# ++# TRX + UBI formatted image: ++# ++# This is for upgrading if the new kernel is larger than the ++# current kernel. ++# ++# ex: ++# - stock firmware is installed in the flash and booted with ++# OpenWrt initramfs image ++# - kernel partition is increased from 4MiB in OpenWrt in the ++# future ++# ++# packing TRX + UBI formatted image by tar is needed for image validation ++# with the metadata in the future? ++# ====== dev note end ====== ++# ++# The mtd partitions "firmware" and "Kernel2" on NAND flash are os-image ++# partitions. These partitions are called as "Image1/Image2" in U-Boot ++# on WSR-2533DHP2, and they are checked conditions when booting. ++# "Image1" is always used for booting. ++# ++# == U-Boot Behaviors == ++# - "Image1"/"Image2" images are good, images are different or ++# "Image2" image is broken ++# -> writes os-image to "Image2" from "Image1" ++# ++# - "Image1" image is broken ++# -> writes os-image to "Image1" from "Image2" ++# ++# - "Image1"/"Image2" images are broken ++# -> fall to U-Boot command line ++ ++buffalo_check_image() { ++ local board="$1" ++ local boardname="$(echo $board | tr ',' '_')" ++ local magic="$2" ++ local fw_image="$3" ++ ++ # return error state if TRX + UBI formatted image specified ++ # to notify about configurations ++ if [ "$magic" = "44485032" -o "$magic" = "44485033" ]; then ++ echo "Your configurations won't be saved if factory-uboot.bin image specified." ++ echo "But if you want to upgrade, please execute sysupgrade with \"-F\" option." ++ return 1 ++ fi ++ ++ # check if valid tar file specifed ++ if ! tar tf "$fw_image" &>/dev/null; then ++ echo "Specified file is not a tar archive: $fw_image" ++ return 1 ++ fi ++ ++ local control_len=$( (tar xf $fw_image sysupgrade-$boardname/CONTROL -O | wc -c) 2> /dev/null) ++ ++ # check if valid sysupgrade tar archive ++ if [ "$control_len" = "0" ]; then ++ echo "Invalid sysupgrade file: $fw_image" ++ return 1 ++ fi ++ ++ local kern_part_len=$(grep "\"linux\"" /proc/mtd | sed "s/mtd[0-9]*:[ \t]*\([^ \t]*\).*/\1/") ++ [ -z "$kern_part_len" ] && { ++ echo "Unable to get \"linux\" partition size" ++ return 1 ++ } ++ kern_part_len=$((0x$kern_part_len)) ++ ++ # this also checks if the sysupgrade image is for correct models ++ local kern_bin_len=$( (tar xf $fw_image sysupgrade-${boardname}/kernel -O | wc -c) 2> /dev/null) ++ if [ -z "$kern_bin_len" ]; then ++ echo "Failed to get new kernel size, is valid sysupgrade image specified for the device?" ++ return 1 ++ fi ++ ++ # kernel binary has a trx header (len: 28 (0x1c)) ++ kern_bin_len=$((kern_bin_len - 28)) ++ ++ if [ "$kern_bin_len" != "$kern_part_len" ]; then ++ echo -n "The length of new kernel is invalid for current " ++ echo "\"linux\" partition, please use factory-uboot.bin image." ++ echo "\"linux\" partition: $kern_part_len, new kernel: $kern_bin_len" ++ return 1 ++ fi ++} ++ ++# for TRX + UBI formatted image ++buffalo_upgrade_ubinized() { ++ sync ++ echo 3 > /proc/sys/vm/drop_caches ++ ++ local mtdnum="$( find_mtd_index "ubi" )" ++ # if no "ubi", don't return error for the purpose of recovery ++ # ex: recovery after accidental erasing "firmware" partition ++ if [ ! "$mtdnum" ]; then ++ echo "cannot find ubi mtd partition \"ubi\", skip detachment" ++ else ++ ubidetach -m "$mtdnum" ++ fi ++ ++ # erase all data in "firmware" ++ mtd erase "${PART_NAME}" ++ # write TRX + UBI formatted image to "firmware" ++ get_image "$1" | mtd $MTD_ARGS write - "${PART_NAME:-firmware}" ++ if [ $? -ne 0 ]; then ++ echo "Failed to write the specified image." ++ exit 1 ++ fi ++} +diff --git a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh +index 8144476943..2c1460650f 100755 +--- a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh ++++ b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh +@@ -1,15 +1,51 @@ ++REQUIRE_IMAGE_METADATA=1 ++RAMFS_COPY_BIN='fw_printenv fw_setenv blockdev' ++RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock' ++ + platform_do_upgrade() { + local board=$(board_name) ++ local file_type=$(identify $1) + + case "$board" in +- bananapi,bpi-r64-rootdisk) +- #2097152=0x200000 is the offset in bytes from the start +- #of eMMC and to the location of the kernel +- get_image "$1" | dd of=/dev/mmcblk0 bs=2097152 seek=1 conv=fsync ++ bananapi,bpi-r64) ++ export_bootdevice ++ export_partdevice rootdev 0 ++ local fitpart=$(get_partition_by_name $rootdev "production") ++ [ "$fitpart" ] || return 1 ++ dd if=/dev/zero of=/dev/$fitpart bs=4096 count=1 2>/dev/null ++ blockdev --rereadpt /dev/$rootdev ++ get_image "$1" | dd of=/dev/$fitpart ++ blockdev --rereadpt /dev/$rootdev ++ local datapart=$(get_partition_by_name $rootdev "rootfs_data") ++ [ "$datapart" ] || return 0 ++ dd if=/dev/zero of=/dev/$datapart bs=4096 count=1 2>/dev/null ++ echo $datapart > /tmp/sysupgrade.datapart ++ ;; ++ buffalo,wsr-2533dhp2) ++ local magic="$(get_magic_long "$1")" ++ ++ # use "mtd write" if the magic is "DHP2 (0x44485032)" ++ # or "DHP3 (0x44485033)" ++ if [ "$magic" = "44485032" -o "$magic" = "44485033" ]; then ++ buffalo_upgrade_ubinized "$1" ++ else ++ CI_KERNPART="firmware" ++ nand_do_upgrade "$1" ++ fi + ;; ++ linksys,e8450-ubi|\ + mediatek,mt7622,ubi) ++ CI_KERNPART="fit" + nand_do_upgrade "$1" + ;; ++ linksys,e8450) ++ if grep -q mtdparts=slave /proc/cmdline; then ++ PART_NAME=firmware2 ++ else ++ PART_NAME=firmware1 ++ fi ++ default_do_upgrade "$1" ++ ;; + *) + default_do_upgrade "$1" + ;; +@@ -25,6 +61,9 @@ platform_check_image() { + [ "$#" -gt 1 ] && return 1 + + case "$board" in ++ buffalo,wsr-2533dhp2) ++ buffalo_check_image "$board" "$magic" "$1" || return 1 ++ ;; + *) + [ "$magic" != "d00dfeed" ] && { + echo "Invalid image type." +@@ -37,18 +76,18 @@ platform_check_image() { + return 0 + } + +-platform_copy_config_emmc() { +- mkdir -p /recovery +- mount -o rw,noatime /dev/mmcblk0p6 /recovery +- cp -af "$UPGRADE_BACKUP" "/recovery/$BACKUP_FILE" ++platform_copy_config_mmc() { ++ [ -e "$UPGRADE_BACKUP" ] || return ++ local datapart=$(cat /tmp/sysupgrade.datapart) ++ [ "$datapart" ] || echo "no rootfs_data partition, cannot keep configuration." >&2 ++ dd if="$UPGRADE_BACKUP" of=/dev/$datapart + sync +- umount /recovery + } + + platform_copy_config() { + case "$(board_name)" in +- bananapi,bpi-r64-rootdisk) +- platform_copy_config_emmc ++ bananapi,bpi-r64) ++ platform_copy_config_mmc + ;; + esac + } +diff --git a/target/linux/mediatek/mt7622/config-5.4 b/target/linux/mediatek/mt7622/config-5.10 +similarity index 67% +rename from target/linux/mediatek/mt7622/config-5.4 +rename to target/linux/mediatek/mt7622/config-5.10 +index 1b0b1e36a6..7f1c3d169a 100644 +--- a/target/linux/mediatek/mt7622/config-5.4 +++ b/target/linux/mediatek/mt7622/config-5.10 -@@ -0,0 +1,433 @@ -+CONFIG_64BIT=y -+CONFIG_AHCI_MTK=y -+CONFIG_ARCH_DMA_ADDR_T_64BIT=y -+CONFIG_ARCH_KEEP_MEMBLOCK=y -+CONFIG_ARCH_MEDIATEK=y -+CONFIG_ARCH_MMAP_RND_BITS=18 -+CONFIG_ARCH_MMAP_RND_BITS_MAX=24 -+CONFIG_ARCH_MMAP_RND_BITS_MIN=18 -+CONFIG_ARCH_MMAP_RND_COMPAT_BITS=11 -+CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 -+CONFIG_ARCH_PROC_KCORE_TEXT=y -+CONFIG_ARCH_SELECT_MEMORY_MODEL=y -+CONFIG_ARCH_SPARSEMEM_DEFAULT=y -+CONFIG_ARCH_SPARSEMEM_ENABLE=y +@@ -1,59 +1,6 @@ + CONFIG_64BIT=y + CONFIG_AHCI_MTK=y +-CONFIG_ARCH_CLOCKSOURCE_DATA=y + CONFIG_ARCH_DMA_ADDR_T_64BIT=y +-CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y +-CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK=y +-CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y +-CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y +-CONFIG_ARCH_HAS_DMA_COHERENT_TO_PFN=y +-CONFIG_ARCH_HAS_DMA_PREP_COHERENT=y +-CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +-CONFIG_ARCH_HAS_FAST_MULTIPLIER=y +-CONFIG_ARCH_HAS_FORTIFY_SOURCE=y +-CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y +-CONFIG_ARCH_HAS_GIGANTIC_PAGE=y +-CONFIG_ARCH_HAS_KCOV=y +-CONFIG_ARCH_HAS_KEEPINITRD=y +-CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE=y +-CONFIG_ARCH_HAS_PTE_DEVMAP=y +-CONFIG_ARCH_HAS_PTE_SPECIAL=y +-CONFIG_ARCH_HAS_SETUP_DMA_OPS=y +-CONFIG_ARCH_HAS_SET_DIRECT_MAP=y +-CONFIG_ARCH_HAS_SET_MEMORY=y +-CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y +-CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y +-CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU=y +-CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE=y +-CONFIG_ARCH_HAS_SYSCALL_WRAPPER=y +-CONFIG_ARCH_HAS_TICK_BROADCAST=y +-CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y +-CONFIG_ARCH_INLINE_READ_LOCK=y +-CONFIG_ARCH_INLINE_READ_LOCK_BH=y +-CONFIG_ARCH_INLINE_READ_LOCK_IRQ=y +-CONFIG_ARCH_INLINE_READ_LOCK_IRQSAVE=y +-CONFIG_ARCH_INLINE_READ_UNLOCK=y +-CONFIG_ARCH_INLINE_READ_UNLOCK_BH=y +-CONFIG_ARCH_INLINE_READ_UNLOCK_IRQ=y +-CONFIG_ARCH_INLINE_READ_UNLOCK_IRQRESTORE=y +-CONFIG_ARCH_INLINE_SPIN_LOCK=y +-CONFIG_ARCH_INLINE_SPIN_LOCK_BH=y +-CONFIG_ARCH_INLINE_SPIN_LOCK_IRQ=y +-CONFIG_ARCH_INLINE_SPIN_LOCK_IRQSAVE=y +-CONFIG_ARCH_INLINE_SPIN_TRYLOCK=y +-CONFIG_ARCH_INLINE_SPIN_TRYLOCK_BH=y +-CONFIG_ARCH_INLINE_SPIN_UNLOCK=y +-CONFIG_ARCH_INLINE_SPIN_UNLOCK_BH=y +-CONFIG_ARCH_INLINE_SPIN_UNLOCK_IRQ=y +-CONFIG_ARCH_INLINE_SPIN_UNLOCK_IRQRESTORE=y +-CONFIG_ARCH_INLINE_WRITE_LOCK=y +-CONFIG_ARCH_INLINE_WRITE_LOCK_BH=y +-CONFIG_ARCH_INLINE_WRITE_LOCK_IRQ=y +-CONFIG_ARCH_INLINE_WRITE_LOCK_IRQSAVE=y +-CONFIG_ARCH_INLINE_WRITE_UNLOCK=y +-CONFIG_ARCH_INLINE_WRITE_UNLOCK_BH=y +-CONFIG_ARCH_INLINE_WRITE_UNLOCK_IRQ=y +-CONFIG_ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE=y + CONFIG_ARCH_KEEP_MEMBLOCK=y + CONFIG_ARCH_MEDIATEK=y + CONFIG_ARCH_MMAP_RND_BITS=18 +@@ -65,25 +12,11 @@ CONFIG_ARCH_PROC_KCORE_TEXT=y + CONFIG_ARCH_SELECT_MEMORY_MODEL=y + CONFIG_ARCH_SPARSEMEM_DEFAULT=y + CONFIG_ARCH_SPARSEMEM_ENABLE=y +-CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +-CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y +-CONFIG_ARCH_SUPPORTS_INT128=y +-CONFIG_ARCH_SUPPORTS_MEMORY_FAILURE=y +-CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y +-CONFIG_ARCH_SUPPORTS_UPROBES=y +CONFIG_ARCH_STACKWALK=y -+CONFIG_ARCH_SUSPEND_POSSIBLE=y -+CONFIG_ARM64=y -+CONFIG_ARM64_4K_PAGES=y -+# CONFIG_ARM64_CNP is not set -+# CONFIG_ARM64_ERRATUM_1165522 is not set -+# CONFIG_ARM64_ERRATUM_1286807 is not set -+# CONFIG_ARM64_ERRATUM_1418040 is not set -+CONFIG_ARM64_ERRATUM_843419=y -+CONFIG_ARM64_ERRATUM_845719=y -+CONFIG_ARM64_MODULE_PLTS=y -+CONFIG_ARM64_PAGE_SHIFT=12 -+CONFIG_ARM64_PA_BITS=48 -+CONFIG_ARM64_PA_BITS_48=y -+# CONFIG_ARM64_PTR_AUTH is not set -+# CONFIG_ARM64_SVE is not set -+# CONFIG_ARM64_SW_TTBR0_PAN is not set -+CONFIG_ARM64_TAGGED_ADDR_ABI=y -+CONFIG_ARM64_VA_BITS=39 -+CONFIG_ARM64_VA_BITS_39=y -+# CONFIG_ARMV8_DEPRECATED is not set -+CONFIG_ARM_AMBA=y -+CONFIG_ARM_ARCH_TIMER=y -+CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y -+CONFIG_ARM_GIC=y -+CONFIG_ARM_GIC_V2M=y -+CONFIG_ARM_GIC_V3=y -+CONFIG_ARM_GIC_V3_ITS=y -+CONFIG_ARM_GIC_V3_ITS_PCI=y -+CONFIG_ARM_MEDIATEK_CPUFREQ=y -+CONFIG_ARM_PMU=y -+CONFIG_ARM_PSCI_FW=y -+CONFIG_ATA=y -+CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y -+CONFIG_BLK_DEV_SD=y -+CONFIG_BLK_MQ_PCI=y -+CONFIG_BLK_PM=y -+CONFIG_BLK_SCSI_REQUEST=y -+CONFIG_BLOCK_COMPAT=y -+CONFIG_BSD_PROCESS_ACCT=y -+CONFIG_BSD_PROCESS_ACCT_V3=y -+# CONFIG_CAVIUM_TX2_ERRATUM_219 is not set -+CONFIG_CLKDEV_LOOKUP=y -+CONFIG_CLKSRC_MMIO=y -+CONFIG_CLONE_BACKWARDS=y -+CONFIG_COMMON_CLK=y -+CONFIG_COMMON_CLK_MEDIATEK=y -+CONFIG_COMMON_CLK_MT2712=y -+# CONFIG_COMMON_CLK_MT2712_BDPSYS is not set -+# CONFIG_COMMON_CLK_MT2712_IMGSYS is not set -+# CONFIG_COMMON_CLK_MT2712_JPGDECSYS is not set -+# CONFIG_COMMON_CLK_MT2712_MFGCFG is not set -+# CONFIG_COMMON_CLK_MT2712_MMSYS is not set -+# CONFIG_COMMON_CLK_MT2712_VDECSYS is not set -+# CONFIG_COMMON_CLK_MT2712_VENCSYS is not set -+# CONFIG_COMMON_CLK_MT6779 is not set -+# CONFIG_COMMON_CLK_MT6797 is not set -+CONFIG_COMMON_CLK_MT7622=y -+CONFIG_COMMON_CLK_MT7622_AUDSYS=y -+CONFIG_COMMON_CLK_MT7622_ETHSYS=y -+CONFIG_COMMON_CLK_MT7622_HIFSYS=y -+# CONFIG_COMMON_CLK_MT8173 is not set -+CONFIG_COMMON_CLK_MT8183=y -+# CONFIG_COMMON_CLK_MT8183_AUDIOSYS is not set -+# CONFIG_COMMON_CLK_MT8183_CAMSYS is not set -+# CONFIG_COMMON_CLK_MT8183_IMGSYS is not set -+# CONFIG_COMMON_CLK_MT8183_IPU_ADL is not set -+# CONFIG_COMMON_CLK_MT8183_IPU_CONN is not set -+# CONFIG_COMMON_CLK_MT8183_IPU_CORE0 is not set -+# CONFIG_COMMON_CLK_MT8183_IPU_CORE1 is not set -+# CONFIG_COMMON_CLK_MT8183_MFGCFG is not set -+# CONFIG_COMMON_CLK_MT8183_MMSYS is not set -+# CONFIG_COMMON_CLK_MT8183_VDECSYS is not set -+# CONFIG_COMMON_CLK_MT8183_VENCSYS is not set -+CONFIG_COMMON_CLK_MT8516=y -+# CONFIG_COMMON_CLK_MT8516_AUDSYS is not set -+CONFIG_COMPAT=y -+CONFIG_COMPAT_32BIT_TIME=y -+CONFIG_COMPAT_BINFMT_ELF=y -+CONFIG_COMPAT_NETLINK_MESSAGES=y -+CONFIG_COMPAT_OLD_SIGACTION=y -+CONFIG_CONSOLE_LOGLEVEL_DEFAULT=15 -+# CONFIG_CPUFREQ_DT is not set -+CONFIG_CPU_FREQ=y -+# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set -+CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y -+CONFIG_CPU_FREQ_GOV_ATTR_SET=y -+CONFIG_CPU_FREQ_GOV_COMMON=y -+CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y -+CONFIG_CPU_FREQ_GOV_ONDEMAND=y -+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -+CONFIG_CPU_FREQ_GOV_POWERSAVE=y -+CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y -+CONFIG_CPU_FREQ_GOV_USERSPACE=y -+CONFIG_CPU_FREQ_STAT=y -+CONFIG_CPU_RMAP=y -+CONFIG_CPU_THERMAL=y -+CONFIG_CRC16=y -+CONFIG_CRYPTO_ACOMP2=y -+CONFIG_CRYPTO_AEAD=y -+CONFIG_CRYPTO_AEAD2=y -+CONFIG_CRYPTO_CMAC=y -+CONFIG_CRYPTO_DEFLATE=y -+CONFIG_CRYPTO_DRBG=y -+CONFIG_CRYPTO_DRBG_HMAC=y -+CONFIG_CRYPTO_DRBG_MENU=y -+CONFIG_CRYPTO_ECB=y -+CONFIG_CRYPTO_ECC=y -+CONFIG_CRYPTO_ECDH=y -+CONFIG_CRYPTO_HASH=y -+CONFIG_CRYPTO_HASH2=y -+CONFIG_CRYPTO_HASH_INFO=y -+CONFIG_CRYPTO_HMAC=y -+CONFIG_CRYPTO_JITTERENTROPY=y -+CONFIG_CRYPTO_KPP=y -+CONFIG_CRYPTO_KPP2=y -+CONFIG_CRYPTO_LIB_SHA256=y -+CONFIG_CRYPTO_LZO=y -+CONFIG_CRYPTO_MANAGER=y -+CONFIG_CRYPTO_MANAGER2=y -+CONFIG_CRYPTO_NULL2=y -+CONFIG_CRYPTO_RNG=y -+CONFIG_CRYPTO_RNG2=y -+CONFIG_CRYPTO_RNG_DEFAULT=y -+CONFIG_CRYPTO_SHA256=y -+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 -+CONFIG_DMA_ENGINE=y -+CONFIG_DMA_ENGINE_RAID=y -+CONFIG_DMA_OF=y -+CONFIG_DMA_REMAP=y -+CONFIG_DMA_VIRTUAL_CHANNELS=y -+CONFIG_DTC=y -+CONFIG_DYNAMIC_DEBUG=y -+CONFIG_EDAC_SUPPORT=y -+CONFIG_EINT_MTK=y -+CONFIG_FIXED_PHY=y -+CONFIG_FIX_EARLYCON_MEM=y -+# CONFIG_FLATMEM_MANUAL is not set -+CONFIG_FRAME_POINTER=y -+# CONFIG_FUJITSU_ERRATUM_010001 is not set -+CONFIG_FW_LOADER_PAGED_BUF=y -+CONFIG_GENERIC_ALLOCATOR=y -+CONFIG_GENERIC_ARCH_TOPOLOGY=y -+CONFIG_GENERIC_BUG=y -+CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y -+CONFIG_GENERIC_CLOCKEVENTS=y -+CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y -+CONFIG_GENERIC_CPU_AUTOPROBE=y -+CONFIG_GENERIC_CPU_VULNERABILITIES=y -+CONFIG_GENERIC_CSUM=y -+CONFIG_GENERIC_EARLY_IOREMAP=y -+CONFIG_GENERIC_GETTIMEOFDAY=y -+CONFIG_GENERIC_IDLE_POLL_SETUP=y -+CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y -+CONFIG_GENERIC_IRQ_MULTI_HANDLER=y -+CONFIG_GENERIC_IRQ_SHOW=y -+CONFIG_GENERIC_IRQ_SHOW_LEVEL=y -+CONFIG_GENERIC_MSI_IRQ=y -+CONFIG_GENERIC_MSI_IRQ_DOMAIN=y -+CONFIG_GENERIC_PCI_IOMAP=y -+CONFIG_GENERIC_PHY=y -+CONFIG_GENERIC_PINCONF=y -+CONFIG_GENERIC_PINCTRL_GROUPS=y -+CONFIG_GENERIC_PINMUX_FUNCTIONS=y -+CONFIG_GENERIC_SCHED_CLOCK=y -+CONFIG_GENERIC_SMP_IDLE_THREAD=y -+CONFIG_GENERIC_STRNCPY_FROM_USER=y -+CONFIG_GENERIC_STRNLEN_USER=y -+CONFIG_GENERIC_TIME_VSYSCALL=y -+CONFIG_GLOB=y -+CONFIG_GPIOLIB=y -+CONFIG_GRO_CELLS=y -+CONFIG_HANDLE_DOMAIN_IRQ=y -+CONFIG_HARDIRQS_SW_RESEND=y -+CONFIG_HAS_DMA=y -+CONFIG_HAS_IOMEM=y -+CONFIG_HAS_IOPORT_MAP=y -+CONFIG_HOLES_IN_ZONE=y -+CONFIG_HZ=250 -+CONFIG_HZ_250=y -+CONFIG_ICPLUS_PHY=y -+CONFIG_IIO=y -+CONFIG_IKCONFIG=y -+CONFIG_IKCONFIG_PROC=y -+CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 -+CONFIG_INITRAMFS_SOURCE="" -+CONFIG_IO_URING=y -+CONFIG_IRQCHIP=y -+CONFIG_IRQ_DOMAIN=y -+CONFIG_IRQ_DOMAIN_HIERARCHY=y -+CONFIG_IRQ_FORCED_THREADING=y -+CONFIG_IRQ_TIME_ACCOUNTING=y -+CONFIG_IRQ_WORK=y -+CONFIG_JUMP_LABEL=y -+CONFIG_LIBFDT=y + CONFIG_ARCH_SUSPEND_POSSIBLE=y +-CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y +-CONFIG_ARCH_USE_MEMREMAP_PROT=y +-CONFIG_ARCH_USE_QUEUED_RWLOCKS=y +-CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y +-CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y +-CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT=y +-CONFIG_ARCH_WANT_FRAME_POINTERS=y +-CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y + CONFIG_ARM64=y + CONFIG_ARM64_4K_PAGES=y + # CONFIG_ARM64_CNP is not set +-CONFIG_ARM64_CONT_SHIFT=4 + # CONFIG_ARM64_ERRATUM_1165522 is not set + # CONFIG_ARM64_ERRATUM_1286807 is not set + # CONFIG_ARM64_ERRATUM_1418040 is not set +@@ -94,7 +27,6 @@ CONFIG_ARM64_PAGE_SHIFT=12 + CONFIG_ARM64_PA_BITS=48 + CONFIG_ARM64_PA_BITS_48=y + # CONFIG_ARM64_PTR_AUTH is not set +-CONFIG_ARM64_SSBD=y + # CONFIG_ARM64_SVE is not set + # CONFIG_ARM64_SW_TTBR0_PAN is not set + CONFIG_ARM64_TAGGED_ADDR_ABI=y +@@ -114,6 +46,7 @@ CONFIG_ARM_PMU=y + CONFIG_ARM_PSCI_FW=y + CONFIG_ATA=y + CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y ++CONFIG_BLK_DEV_LOOP=y + CONFIG_BLK_DEV_SD=y + CONFIG_BLK_MQ_PCI=y + CONFIG_BLK_PM=y +@@ -122,10 +55,8 @@ CONFIG_BLOCK_COMPAT=y + CONFIG_BSD_PROCESS_ACCT=y + CONFIG_BSD_PROCESS_ACCT_V3=y + # CONFIG_CAVIUM_TX2_ERRATUM_219 is not set +-CONFIG_CC_HAS_KASAN_GENERIC=y + CONFIG_CLKDEV_LOOKUP=y + CONFIG_CLKSRC_MMIO=y +-CONFIG_CLOCK_THERMAL=y + CONFIG_CLONE_BACKWARDS=y + CONFIG_COMMON_CLK=y + CONFIG_COMMON_CLK_MEDIATEK=y +@@ -220,19 +151,17 @@ CONFIG_DMA_ENGINE_RAID=y + CONFIG_DMA_OF=y + CONFIG_DMA_REMAP=y + CONFIG_DMA_VIRTUAL_CHANNELS=y +-CONFIG_DRM_RCAR_WRITEBACK=y + CONFIG_DTC=y + CONFIG_DYNAMIC_DEBUG=y + CONFIG_EDAC_SUPPORT=y +-CONFIG_EFI_EARLYCON=y + CONFIG_EINT_MTK=y ++CONFIG_EXT4_FS=y ++CONFIG_FIT_PARTITION=y + CONFIG_FIXED_PHY=y + CONFIG_FIX_EARLYCON_MEM=y + # CONFIG_FLATMEM_MANUAL is not set +-CONFIG_FONT_8x16=y +-CONFIG_FONT_AUTOSELECT=y +-CONFIG_FONT_SUPPORT=y + CONFIG_FRAME_POINTER=y ++CONFIG_F2FS_FS=y + # CONFIG_FUJITSU_ERRATUM_010001 is not set + CONFIG_FW_LOADER_PAGED_BUF=y + CONFIG_GENERIC_ALLOCATOR=y +@@ -267,102 +196,19 @@ CONFIG_GLOB=y + CONFIG_GPIOLIB=y + CONFIG_GRO_CELLS=y + CONFIG_HANDLE_DOMAIN_IRQ=y +-# CONFIG_HARDEN_BRANCH_PREDICTOR is not set +-# CONFIG_HARDEN_EL2_VECTORS is not set + CONFIG_HARDIRQS_SW_RESEND=y + CONFIG_HAS_DMA=y + CONFIG_HAS_IOMEM=y + CONFIG_HAS_IOPORT_MAP=y +-CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y +-CONFIG_HAVE_ARCH_AUDITSYSCALL=y +-CONFIG_HAVE_ARCH_BITREVERSE=y +-CONFIG_HAVE_ARCH_HUGE_VMAP=y +-CONFIG_HAVE_ARCH_JUMP_LABEL=y +-CONFIG_HAVE_ARCH_JUMP_LABEL_RELATIVE=y +-CONFIG_HAVE_ARCH_KASAN=y +-CONFIG_HAVE_ARCH_KASAN_SW_TAGS=y +-CONFIG_HAVE_ARCH_KGDB=y +-CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y +-CONFIG_HAVE_ARCH_PFN_VALID=y +-CONFIG_HAVE_ARCH_PREL32_RELOCATIONS=y +-CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +-CONFIG_HAVE_ARCH_STACKLEAK=y +-CONFIG_HAVE_ARCH_THREAD_STRUCT_WHITELIST=y +-CONFIG_HAVE_ARCH_TRACEHOOK=y +-CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y +-CONFIG_HAVE_ARCH_VMAP_STACK=y +-CONFIG_HAVE_ARM_SMCCC=y +-CONFIG_HAVE_ASM_MODVERSIONS=y +-CONFIG_HAVE_CLK=y +-CONFIG_HAVE_CLK_PREPARE=y +-CONFIG_HAVE_CMPXCHG_DOUBLE=y +-CONFIG_HAVE_CMPXCHG_LOCAL=y +-CONFIG_HAVE_CONTEXT_TRACKING=y +-CONFIG_HAVE_COPY_THREAD_TLS=y +-CONFIG_HAVE_C_RECORDMCOUNT=y +-CONFIG_HAVE_DEBUG_BUGVERBOSE=y +-CONFIG_HAVE_DEBUG_KMEMLEAK=y +-CONFIG_HAVE_DMA_CONTIGUOUS=y +-CONFIG_HAVE_DYNAMIC_FTRACE=y +-CONFIG_HAVE_EBPF_JIT=y +-CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +-CONFIG_HAVE_FAST_GUP=y +-CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +-CONFIG_HAVE_FUNCTION_ARG_ACCESS_API=y +-CONFIG_HAVE_FUNCTION_ERROR_INJECTION=y +-CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +-CONFIG_HAVE_FUNCTION_TRACER=y +-CONFIG_HAVE_GENERIC_VDSO=y +-CONFIG_HAVE_HW_BREAKPOINT=y +-CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y +-CONFIG_HAVE_MEMORY_PRESENT=y +-CONFIG_HAVE_MOD_ARCH_SPECIFIC=y +-CONFIG_HAVE_NET_DSA=y +-CONFIG_HAVE_PATA_PLATFORM=y +-CONFIG_HAVE_PCI=y +-CONFIG_HAVE_PERF_EVENTS=y +-CONFIG_HAVE_PERF_REGS=y +-CONFIG_HAVE_PERF_USER_STACK_DUMP=y +-CONFIG_HAVE_RCU_TABLE_FREE=y +-CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +-CONFIG_HAVE_RSEQ=y +-CONFIG_HAVE_SCHED_AVG_IRQ=y +-CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +-CONFIG_HAVE_UID16=y +-CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y + CONFIG_HOLES_IN_ZONE=y + CONFIG_HZ=250 + CONFIG_HZ_250=y +-CONFIG_I2C=y +-CONFIG_I2C_BOARDINFO=y +-CONFIG_I2C_CHARDEV=y +-CONFIG_I2C_MT65XX=y + CONFIG_ICPLUS_PHY=y + CONFIG_IIO=y + CONFIG_IKCONFIG=y + CONFIG_IKCONFIG_PROC=y + CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 + CONFIG_INITRAMFS_SOURCE="" +-CONFIG_INLINE_READ_LOCK=y +-CONFIG_INLINE_READ_LOCK_BH=y +-CONFIG_INLINE_READ_LOCK_IRQ=y +-CONFIG_INLINE_READ_LOCK_IRQSAVE=y +-CONFIG_INLINE_READ_UNLOCK_BH=y +-CONFIG_INLINE_READ_UNLOCK_IRQRESTORE=y +-CONFIG_INLINE_SPIN_LOCK=y +-CONFIG_INLINE_SPIN_LOCK_BH=y +-CONFIG_INLINE_SPIN_LOCK_IRQ=y +-CONFIG_INLINE_SPIN_LOCK_IRQSAVE=y +-CONFIG_INLINE_SPIN_TRYLOCK=y +-CONFIG_INLINE_SPIN_TRYLOCK_BH=y +-CONFIG_INLINE_SPIN_UNLOCK_BH=y +-CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE=y +-CONFIG_INLINE_WRITE_LOCK=y +-CONFIG_INLINE_WRITE_LOCK_BH=y +-CONFIG_INLINE_WRITE_LOCK_IRQ=y +-CONFIG_INLINE_WRITE_LOCK_IRQSAVE=y +-CONFIG_INLINE_WRITE_UNLOCK_BH=y +-CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE=y + CONFIG_IO_URING=y + CONFIG_IRQCHIP=y + CONFIG_IRQ_DOMAIN=y +@@ -371,8 +217,8 @@ CONFIG_IRQ_FORCED_THREADING=y + CONFIG_IRQ_TIME_ACCOUNTING=y + CONFIG_IRQ_WORK=y + CONFIG_JUMP_LABEL=y +-CONFIG_LEDS_UBNT_LEDBAR=y + CONFIG_LIBFDT=y +CONFIG_LLD_VERSION=0 -+CONFIG_LOCK_DEBUGGING_SUPPORT=y -+CONFIG_LOCK_SPIN_ON_OWNER=y -+CONFIG_LZO_COMPRESS=y -+CONFIG_LZO_DECOMPRESS=y -+CONFIG_MAGIC_SYSRQ=y -+CONFIG_MDIO_BUS=y -+CONFIG_MDIO_DEVICE=y -+CONFIG_MEDIATEK_MT6577_AUXADC=y -+CONFIG_MEDIATEK_WATCHDOG=y -+CONFIG_MEMFD_CREATE=y -+CONFIG_MESSAGE_LOGLEVEL_DEFAULT=7 -+CONFIG_MFD_SYSCON=y -+CONFIG_MIGRATION=y -+CONFIG_MMC=y + CONFIG_LOCK_DEBUGGING_SUPPORT=y + CONFIG_LOCK_SPIN_ON_OWNER=y + CONFIG_LZO_COMPRESS=y +@@ -382,23 +228,25 @@ CONFIG_MDIO_BUS=y + CONFIG_MDIO_DEVICE=y + CONFIG_MEDIATEK_MT6577_AUXADC=y + CONFIG_MEDIATEK_WATCHDOG=y +-CONFIG_MEDIA_SUPPORT=y + CONFIG_MEMFD_CREATE=y + CONFIG_MESSAGE_LOGLEVEL_DEFAULT=7 + CONFIG_MFD_SYSCON=y + CONFIG_MIGRATION=y + CONFIG_MMC=y ++CONFIG_MMC_BLOCK=y +CONFIG_MMC_CQHCI=y -+CONFIG_MMC_MTK=y -+# CONFIG_MMC_TIFM_SD is not set -+CONFIG_MODULES_TREE_LOOKUP=y -+CONFIG_MODULES_USE_ELF_RELA=y -+CONFIG_MTD_NAND_CORE=y + CONFIG_MMC_MTK=y +-# CONFIG_MMC_TIFM_SD is not set + CONFIG_MODULES_TREE_LOOKUP=y + CONFIG_MODULES_USE_ELF_RELA=y +-CONFIG_MT753X_GSW=y + CONFIG_MTD_NAND_CORE=y +CONFIG_MTD_NAND_ECC=y -+CONFIG_MTD_NAND_ECC_SW_HAMMING=y -+CONFIG_MTD_NAND_MTK=y + CONFIG_MTD_NAND_ECC_SW_HAMMING=y + CONFIG_MTD_NAND_MTK=y +CONFIG_MTD_NAND_MTK_BMT=y -+CONFIG_MTD_RAW_NAND=y -+CONFIG_MTD_SPI_NAND=y -+CONFIG_MTD_SPI_NOR=y -+CONFIG_MTD_SPLIT_FIRMWARE=y -+CONFIG_MTD_SPLIT_FIT_FW=y -+CONFIG_MTD_UBI=y -+CONFIG_MTD_UBI_BEB_LIMIT=20 -+CONFIG_MTD_UBI_BLOCK=y -+CONFIG_MTD_UBI_WL_THRESHOLD=4096 -+# CONFIG_MTK_CMDQ is not set -+# CONFIG_MTK_CQDMA is not set -+CONFIG_MTK_EFUSE=y -+CONFIG_MTK_HSDMA=y -+CONFIG_MTK_INFRACFG=y -+CONFIG_MTK_PMIC_WRAP=y -+CONFIG_MTK_SCPSYS=y -+CONFIG_MTK_THERMAL=y -+CONFIG_MTK_TIMER=y -+# CONFIG_MTK_UART_APDMA is not set -+CONFIG_MUTEX_SPIN_ON_OWNER=y -+CONFIG_NEED_DMA_MAP_STATE=y -+CONFIG_NEED_SG_DMA_LENGTH=y -+CONFIG_NET_DEVLINK=y -+CONFIG_NET_DSA=y -+CONFIG_NET_DSA_MT7530=y -+CONFIG_NET_DSA_TAG_MTK=y -+CONFIG_NET_FLOW_LIMIT=y -+CONFIG_NET_MEDIATEK_SOC=y -+CONFIG_NET_SWITCHDEV=y -+CONFIG_NET_VENDOR_MEDIATEK=y -+CONFIG_NLS=y -+CONFIG_NO_HZ_COMMON=y -+CONFIG_NO_HZ_IDLE=y -+CONFIG_NR_CPUS=2 -+CONFIG_NVMEM=y -+CONFIG_NVMEM_SYSFS=y -+# CONFIG_OCTEONTX2_AF is not set -+CONFIG_OF=y -+CONFIG_OF_ADDRESS=y -+CONFIG_OF_EARLY_FLATTREE=y -+CONFIG_OF_FLATTREE=y -+CONFIG_OF_GPIO=y -+CONFIG_OF_IRQ=y -+CONFIG_OF_KOBJ=y -+CONFIG_OF_MDIO=y -+CONFIG_OF_NET=y -+CONFIG_OLD_SIGSUSPEND3=y -+CONFIG_PADATA=y -+CONFIG_PARTITION_PERCPU=y -+CONFIG_PCI=y -+CONFIG_PCIEAER=y -+CONFIG_PCIEASPM=y -+# 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 -+CONFIG_PCI_MSI=y -+CONFIG_PCI_MSI_IRQ_DOMAIN=y + CONFIG_MTD_RAW_NAND=y + CONFIG_MTD_SPI_NAND=y + CONFIG_MTD_SPI_NOR=y ++CONFIG_MTD_PARSER_TRX=y + CONFIG_MTD_SPLIT_FIRMWARE=y + CONFIG_MTD_SPLIT_FIT_FW=y + CONFIG_MTD_UBI=y +@@ -423,7 +271,6 @@ 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 +@@ -433,7 +280,6 @@ CONFIG_NO_HZ_IDLE=y + CONFIG_NR_CPUS=2 + CONFIG_NVMEM=y + CONFIG_NVMEM_SYSFS=y +-# CONFIG_OCTEONTX2_AF is not set + CONFIG_OF=y + CONFIG_OF_ADDRESS=y + CONFIG_OF_EARLY_FLATTREE=y +@@ -449,13 +295,11 @@ 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 +@@ -463,6 +307,7 @@ CONFIG_PCI_DOMAINS=y + CONFIG_PCI_DOMAINS_GENERIC=y + CONFIG_PCI_MSI=y + CONFIG_PCI_MSI_IRQ_DOMAIN=y +CONFIG_PERF_EVENTS=y -+CONFIG_PGTABLE_LEVELS=3 -+CONFIG_PHYLIB=y -+CONFIG_PHYLINK=y -+CONFIG_PHYS_ADDR_T_64BIT=y -+CONFIG_PHY_MTK_TPHY=y -+# CONFIG_PHY_MTK_UFS is not set -+# CONFIG_PHY_MTK_XSPHY is not set -+CONFIG_PINCTRL=y -+# CONFIG_PINCTRL_MT2712 is not set -+# CONFIG_PINCTRL_MT6765 is not set -+# CONFIG_PINCTRL_MT6797 is not set -+CONFIG_PINCTRL_MT7622=y -+# CONFIG_PINCTRL_MT8173 is not set -+# CONFIG_PINCTRL_MT8183 is not set -+CONFIG_PINCTRL_MT8516=y -+CONFIG_PINCTRL_MTK=y -+CONFIG_PINCTRL_MTK_MOORE=y + CONFIG_PGTABLE_LEVELS=3 + CONFIG_PHYLIB=y + CONFIG_PHYLINK=y +@@ -480,7 +325,7 @@ CONFIG_PINCTRL_MT7622=y + CONFIG_PINCTRL_MT8516=y + CONFIG_PINCTRL_MTK=y + CONFIG_PINCTRL_MTK_MOORE=y +-CONFIG_PLUGIN_HOSTCC="g++" +CONFIG_PINCTRL_MTK_V2=y -+CONFIG_PM=y -+CONFIG_PM_CLK=y -+CONFIG_PM_GENERIC_DOMAINS=y -+CONFIG_PM_GENERIC_DOMAINS_OF=y -+CONFIG_PM_OPP=y -+CONFIG_POWER_RESET=y -+CONFIG_POWER_RESET_SYSCON=y -+CONFIG_POWER_SUPPLY=y -+CONFIG_PRINTK_TIME=y -+CONFIG_PWM=y -+CONFIG_PWM_MEDIATEK=y -+# CONFIG_PWM_MTK_DISP is not set -+CONFIG_PWM_SYSFS=y -+CONFIG_QUEUED_RWLOCKS=y -+CONFIG_QUEUED_SPINLOCKS=y -+CONFIG_RAS=y -+CONFIG_RATIONAL=y -+# CONFIG_RAVE_SP_CORE is not set -+CONFIG_RCU_NEED_SEGCBLIST=y -+CONFIG_RCU_STALL_COMMON=y -+CONFIG_REALTEK_PHY=y -+CONFIG_REGMAP=y -+CONFIG_REGMAP_MMIO=y -+CONFIG_REGULATOR=y -+CONFIG_REGULATOR_FIXED_VOLTAGE=y -+CONFIG_REGULATOR_MT6380=y -+CONFIG_RESET_CONTROLLER=y -+CONFIG_RFS_ACCEL=y -+CONFIG_RODATA_FULL_DEFAULT_ENABLED=y -+CONFIG_RPS=y -+CONFIG_RTC_CLASS=y -+CONFIG_RTC_DRV_MT7622=y -+CONFIG_RTC_I2C_AND_SPI=y -+CONFIG_RTL8367S_GSW=y -+CONFIG_RWSEM_SPIN_ON_OWNER=y + CONFIG_PM=y + CONFIG_PM_CLK=y + CONFIG_PM_GENERIC_DOMAINS=y +@@ -502,7 +347,6 @@ CONFIG_RATIONAL=y + CONFIG_RCU_NEED_SEGCBLIST=y + CONFIG_RCU_STALL_COMMON=y + CONFIG_REALTEK_PHY=y +-CONFIG_REFCOUNT_FULL=y + CONFIG_REGMAP=y + CONFIG_REGMAP_MMIO=y + CONFIG_REGULATOR=y +@@ -517,6 +361,7 @@ CONFIG_RTC_DRV_MT7622=y + CONFIG_RTC_I2C_AND_SPI=y + CONFIG_RTL8367S_GSW=y + CONFIG_RWSEM_SPIN_ON_OWNER=y +CONFIG_SATA_HOST=y -+CONFIG_SCSI=y -+# CONFIG_SECTION_MISMATCH_WARN_ONLY is not set -+CONFIG_SERIAL_8250_FSL=y -+CONFIG_SERIAL_8250_MT6577=y -+CONFIG_SERIAL_8250_NR_UARTS=3 -+CONFIG_SERIAL_8250_RUNTIME_UARTS=3 -+CONFIG_SERIAL_DEV_BUS=y -+CONFIG_SERIAL_DEV_CTRL_TTYPORT=y -+CONFIG_SERIAL_MCTRL_GPIO=y -+CONFIG_SERIAL_OF_PLATFORM=y -+CONFIG_SGL_ALLOC=y -+CONFIG_SG_POOL=y -+CONFIG_SMP=y -+CONFIG_SPARSEMEM=y -+CONFIG_SPARSEMEM_EXTREME=y -+CONFIG_SPARSEMEM_MANUAL=y -+CONFIG_SPARSEMEM_VMEMMAP=y -+CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y -+CONFIG_SPARSE_IRQ=y -+CONFIG_SPI=y -+CONFIG_SPI_MASTER=y -+CONFIG_SPI_MEM=y -+CONFIG_SPI_MT65XX=y -+# CONFIG_SPI_MTK_NOR is not set -+CONFIG_SPI_MTK_SNFI=y -+CONFIG_SRCU=y -+CONFIG_SWCONFIG=y -+CONFIG_SWIOTLB=y -+CONFIG_SWPHY=y -+CONFIG_SYSCTL_EXCEPTION_TRACE=y -+CONFIG_SYSVIPC_COMPAT=y -+CONFIG_SYS_SUPPORTS_HUGETLBFS=y -+CONFIG_THERMAL=y -+CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y -+CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 -+CONFIG_THERMAL_EMULATION=y -+CONFIG_THERMAL_GOV_BANG_BANG=y -+CONFIG_THERMAL_GOV_FAIR_SHARE=y -+CONFIG_THERMAL_GOV_STEP_WISE=y -+CONFIG_THERMAL_GOV_USER_SPACE=y -+CONFIG_THERMAL_OF=y -+CONFIG_THERMAL_WRITABLE_TRIPS=y -+CONFIG_THREAD_INFO_IN_TASK=y -+CONFIG_TICK_CPU_ACCOUNTING=y -+CONFIG_TIMER_OF=y -+CONFIG_TIMER_PROBE=y -+CONFIG_TREE_RCU=y -+CONFIG_TREE_SRCU=y -+CONFIG_UBIFS_FS=y -+CONFIG_UBIFS_FS_ADVANCED_COMPR=y -+CONFIG_UBIFS_FS_LZO=y -+CONFIG_UBIFS_FS_ZLIB=y -+# CONFIG_UCLAMP_TASK is not set -+# CONFIG_UNMAP_KERNEL_AT_EL0 is not set -+CONFIG_USB=y -+CONFIG_USB_COMMON=y -+CONFIG_USB_SUPPORT=y -+CONFIG_USB_XHCI_HCD=y -+CONFIG_USB_XHCI_MTK=y -+# CONFIG_USB_XHCI_PLATFORM is not set -+CONFIG_VMAP_STACK=y -+CONFIG_WATCHDOG_CORE=y -+CONFIG_WATCHDOG_PRETIMEOUT_DEFAULT_GOV_PANIC=y -+CONFIG_WATCHDOG_PRETIMEOUT_GOV=y -+# CONFIG_WATCHDOG_PRETIMEOUT_GOV_NOOP is not set -+CONFIG_WATCHDOG_PRETIMEOUT_GOV_PANIC=y -+CONFIG_WATCHDOG_PRETIMEOUT_GOV_SEL=m -+CONFIG_WATCHDOG_SYSFS=y -+CONFIG_XPS=y -+CONFIG_ZLIB_DEFLATE=y -+CONFIG_ZLIB_INFLATE=y -+CONFIG_ZONE_DMA32=y + CONFIG_SCSI=y + # CONFIG_SECTION_MISMATCH_WARN_ONLY is not set + CONFIG_SERIAL_8250_FSL=y +@@ -555,7 +400,6 @@ CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 + CONFIG_THERMAL_EMULATION=y + CONFIG_THERMAL_GOV_BANG_BANG=y + CONFIG_THERMAL_GOV_FAIR_SHARE=y +-CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y + CONFIG_THERMAL_GOV_STEP_WISE=y + CONFIG_THERMAL_GOV_USER_SPACE=y + CONFIG_THERMAL_OF=y +diff --git a/target/linux/mediatek/mt7622/target.mk b/target/linux/mediatek/mt7622/target.mk +index cb5a6b48cd..f43a6c4bf4 100644 +--- a/target/linux/mediatek/mt7622/target.mk ++++ b/target/linux/mediatek/mt7622/target.mk +@@ -2,8 +2,9 @@ ARCH:=aarch64 + SUBTARGET:=mt7622 + BOARDNAME:=MT7622 + CPU_TYPE:=cortex-a53 +-DEFAULT_PACKAGES += kmod-mt7615e kmod-mt7615-firmware wpad-basic-wolfssl ++DEFAULT_PACKAGES += kmod-mt7615e kmod-mt7615-firmware wpad-basic-wolfssl blockdev uboot-envtools + KERNELNAME:=Image dtbs ++KERNEL_PATCHVER:=5.10 + + define Target/Description + Build firmware images for MediaTek MT7622 ARM based boards. +diff --git a/target/linux/mediatek/mt7623/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7623/base-files/etc/board.d/02_network +old mode 100755 +new mode 100644 +index 391b1ddc07..2006248530 +--- a/target/linux/mediatek/mt7623/base-files/etc/board.d/02_network ++++ b/target/linux/mediatek/mt7623/base-files/etc/board.d/02_network +@@ -1,4 +1,3 @@ +-#!/bin/sh + + . /lib/functions.sh + . /lib/functions/uci-defaults.sh +diff --git a/target/linux/mediatek/mt7623/config-5.4 b/target/linux/mediatek/mt7623/config-5.4 +index dbd3055d3b..45ae7a4261 100644 +--- a/target/linux/mediatek/mt7623/config-5.4 ++++ b/target/linux/mediatek/mt7623/config-5.4 +@@ -327,11 +327,11 @@ CONFIG_MMC_MTK=y + CONFIG_MMC_SDHCI=y + # CONFIG_MMC_SDHCI_PCI is not set + CONFIG_MMC_SDHCI_PLTFM=y +-# CONFIG_MMC_TIFM_SD is not set + CONFIG_MODULES_USE_ELF_REL=y + # CONFIG_MT753X_GSW is not set + CONFIG_MTD_BLOCK2MTD=y + CONFIG_MTD_CMDLINE_PARTS=y ++# CONFIG_MTD_NAND_MTK_BMT is not set + CONFIG_MTD_SPI_NOR=y + CONFIG_MTD_SPLIT_FIRMWARE=y + CONFIG_MTD_SPLIT_UIMAGE_FW=y +diff --git a/target/linux/mediatek/mt7629/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7629/base-files/etc/board.d/02_network +old mode 100755 +new mode 100644 +index 24c66de788..c39417abbc +--- a/target/linux/mediatek/mt7629/base-files/etc/board.d/02_network ++++ b/target/linux/mediatek/mt7629/base-files/etc/board.d/02_network +@@ -1,4 +1,3 @@ +-#!/bin/sh + + . /lib/functions.sh + . /lib/functions/uci-defaults.sh +diff --git a/target/linux/mediatek/mt7629/config-5.4 b/target/linux/mediatek/mt7629/config-5.4 +index 7fe01d1748..1c7d54cd37 100644 +--- a/target/linux/mediatek/mt7629/config-5.4 ++++ b/target/linux/mediatek/mt7629/config-5.4 +@@ -91,7 +91,6 @@ CONFIG_CPU_CP15=y + CONFIG_CPU_CP15_MMU=y + CONFIG_CPU_HAS_ASID=y + CONFIG_CPU_IDLE=y +-# CONFIG_CPU_IDLE_GOV_LADDER is not set + CONFIG_CPU_IDLE_GOV_MENU=y + CONFIG_CPU_PABRT_V7=y + CONFIG_CPU_PM=y +@@ -240,6 +239,7 @@ CONFIG_MT753X_GSW=y + CONFIG_MTD_NAND_CORE=y + CONFIG_MTD_NAND_ECC_SW_HAMMING=y + CONFIG_MTD_NAND_MTK=y ++# CONFIG_MTD_NAND_MTK_BMT is not set + CONFIG_MTD_RAW_NAND=y + CONFIG_MTD_SPI_NAND=y + CONFIG_MTD_SPI_NOR=y diff --git a/target/linux/mediatek/patches-5.10/100-dts-update-mt7622-rfb1.patch b/target/linux/mediatek/patches-5.10/100-dts-update-mt7622-rfb1.patch new file mode 100644 index 0000000000..f4e77cf69c @@ -101609,402 +102566,138 @@ index 0000000000..07a2eae245 + }; + + cpus { -diff --git a/target/linux/mediatek/patches-5.10/120-arm-dts-Add-Unielec-U7623-DTS.patch b/target/linux/mediatek/patches-5.10/120-arm-dts-Add-Unielec-U7623-DTS.patch +diff --git a/target/linux/mediatek/patches-5.10/112-dts-fix-bpi64-lan-names.patch b/target/linux/mediatek/patches-5.10/112-dts-fix-bpi64-lan-names.patch new file mode 100644 -index 0000000000..56d51aac38 +index 0000000000..6ce85efde9 --- /dev/null -+++ b/target/linux/mediatek/patches-5.10/120-arm-dts-Add-Unielec-U7623-DTS.patch -@@ -0,0 +1,390 @@ -+From 004eb24e939b5b31f828333f37fb5cb2a877d6f2 Mon Sep 17 00:00:00 2001 -+From: Kristian Evensen -+Date: Sun, 17 Jun 2018 14:41:47 +0200 -+Subject: [PATCH] arm: dts: Add Unielec U7623 DTS -+ -+--- -+ arch/arm/boot/dts/Makefile | 1 + -+ .../dts/mt7623a-unielec-u7623-02-emmc-512m.dts | 18 + -+ .../boot/dts/mt7623a-unielec-u7623-02-emmc.dtsi | 366 +++++++++++++++++++++ -+ 3 files changed, 385 insertions(+) -+ create mode 100644 arch/arm/boot/dts/mt7623a-unielec-u7623-02-emmc-512m.dts -+ create mode 100644 arch/arm/boot/dts/mt7623a-unielec-u7623-02-emmc.dtsi -+ -+--- a/arch/arm/boot/dts/Makefile -++++ b/arch/arm/boot/dts/Makefile -+@@ -1366,6 +1366,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ -+ mt7623a-rfb-nand.dtb \ -+ mt7623n-rfb-emmc.dtb \ -+ mt7623n-bananapi-bpi-r2.dtb \ -++ mt7623a-unielec-u7623-02-emmc-512m.dtb \ -+ mt7629-rfb.dtb \ -+ mt8127-moose.dtb \ -+ mt8135-evbp1.dtb -+--- /dev/null -++++ b/arch/arm/boot/dts/mt7623a-unielec-u7623-02-emmc-512m.dts -+@@ -0,0 +1,18 @@ -++/* -++ * Copyright 2018 Kristian Evensen -++ * -++ * SPDX-License-Identifier: (GPL-2.0+ OR MIT) -++ */ -++ -++/dts-v1/; -++#include "mt7623a-unielec-u7623-02-emmc.dtsi" -++ -++/ { -++ model = "UniElec U7623-02 eMMC (512M RAM)"; -++ compatible = "unielec,u7623-02-emmc-512m", "unielec,u7623-02-emmc", "mediatek,mt7623"; -++ -++ memory@80000000 { -++ device_type = "memory"; -++ reg = <0 0x80000000 0 0x20000000>; -++ }; -++}; -+--- /dev/null -++++ b/arch/arm/boot/dts/mt7623a-unielec-u7623-02-emmc.dtsi -+@@ -0,0 +1,343 @@ -++/* -++ * Copyright 2018 Kristian Evensen -++ * -++ * SPDX-License-Identifier: (GPL-2.0+ OR MIT) -++ */ -++ -++#include -++#include "mt7623.dtsi" -++#include "mt6323.dtsi" -++ -++/ { -++ compatible = "unielec,u7623-02-emmc", "mediatek,mt7623"; -++ -++ aliases { -++ serial2 = &uart2; -++ }; -++ -++ chosen { -++ bootargs = "root=/dev/mmcblk0p2 rootfstype=squashfs,f2fs console=ttyS0,115200 blkdevparts=mmcblk0:3M@6M(recovery),256M@9M(root)"; -++ stdout-path = "serial2:115200n8"; -++ }; -++ -++ cpus { -++ cpu@0 { -++ proc-supply = <&mt6323_vproc_reg>; -++ }; -++ -++ cpu@1 { -++ proc-supply = <&mt6323_vproc_reg>; -++ }; -++ -++ cpu@2 { -++ proc-supply = <&mt6323_vproc_reg>; -++ }; -++ -++ cpu@3 { -++ proc-supply = <&mt6323_vproc_reg>; -++ }; -++ }; -++ -++ reg_1p8v: regulator-1p8v { -++ compatible = "regulator-fixed"; -++ regulator-name = "fixed-1.8V"; -++ regulator-min-microvolt = <1800000>; -++ regulator-max-microvolt = <1800000>; -++ regulator-boot-on; -++ regulator-always-on; -++ }; -++ -++ reg_3p3v: regulator-3p3v { -++ compatible = "regulator-fixed"; -++ regulator-name = "fixed-3.3V"; -++ regulator-min-microvolt = <3300000>; -++ regulator-max-microvolt = <3300000>; -++ regulator-boot-on; -++ regulator-always-on; -++ }; -++ -++ reg_5v: regulator-5v { -++ compatible = "regulator-fixed"; -++ regulator-name = "fixed-5V"; -++ regulator-min-microvolt = <5000000>; -++ regulator-max-microvolt = <5000000>; -++ regulator-boot-on; -++ regulator-always-on; -++ }; -++ -++ gpio-keys { -++ compatible = "gpio-keys"; -++ pinctrl-names = "default"; -++ pinctrl-0 = <&key_pins_a>; -++ -++ factory { -++ label = "factory"; ++++ b/target/linux/mediatek/patches-5.10/112-dts-fix-bpi64-lan-names.patch +@@ -0,0 +1,37 @@ ++--- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +++++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts ++@@ -18,6 +18,7 @@ ++ ++ aliases { ++ serial0 = &uart0; +++ ethernet0 = &gmac0; ++ }; ++ ++ chosen { ++@@ -160,22 +161,22 @@ ++ ++ port@1 { ++ reg = <1>; ++- label = "lan0"; +++ label = "lan1"; ++ }; ++ ++ port@2 { ++ reg = <2>; ++- label = "lan1"; +++ label = "lan2"; ++ }; ++ ++ port@3 { ++ reg = <3>; ++- label = "lan2"; +++ label = "lan3"; ++ }; ++ ++ port@4 { ++ reg = <4>; ++- label = "lan3"; +++ label = "lan4"; ++ }; ++ ++ port@6 { +diff --git a/target/linux/mediatek/patches-5.10/113-dts-fix-bpi64-leds-and-buttons.patch b/target/linux/mediatek/patches-5.10/113-dts-fix-bpi64-leds-and-buttons.patch +new file mode 100644 +index 0000000000..f88dbc7195 +--- /dev/null ++++ b/target/linux/mediatek/patches-5.10/113-dts-fix-bpi64-leds-and-buttons.patch +@@ -0,0 +1,56 @@ ++--- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +++++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts ++@@ -19,6 +19,10 @@ ++ aliases { ++ serial0 = &uart0; ++ ethernet0 = &gmac0; +++ led-boot = &led_system_green; +++ led-failsafe = &led_system_blue; +++ led-running = &led_system_green; +++ led-upgrade = &led_system_blue; ++ }; ++ ++ chosen { ++@@ -42,8 +46,8 @@ ++ compatible = "gpio-keys"; ++ ++ factory { ++- label = "factory"; ++- linux,code = ; +++ label = "reset"; ++ linux,code = ; -++ gpios = <&pio 256 GPIO_ACTIVE_LOW>; -++ }; -++ }; ++ gpios = <&pio 0 GPIO_ACTIVE_HIGH>; ++ }; ++ ++@@ -57,17 +61,25 @@ ++ leds { ++ compatible = "gpio-leds"; ++ ++- green { ++- label = "bpi-r64:pio:green"; ++- gpios = <&pio 89 GPIO_ACTIVE_HIGH>; +++ led_system_blue: blue { +++ label = "bpi-r64:pio:blue"; +++ gpios = <&pio 85 GPIO_ACTIVE_HIGH>; ++ default-state = "off"; ++ }; ++ ++- red { ++- label = "bpi-r64:pio:red"; ++- gpios = <&pio 88 GPIO_ACTIVE_HIGH>; +++ led_system_green: green { +++ label = "bpi-r64:pio:green"; +++ gpios = <&pio 89 GPIO_ACTIVE_HIGH>; ++ default-state = "off"; ++ }; ++ -++ leds { -++ compatible = "gpio-leds"; -++ pinctrl-names = "default"; -++ pinctrl-0 = <&led_pins_unielec>; -++ -++ led3 { -++ label = "u7623-01:green:led3"; -++ gpios = <&pio 14 GPIO_ACTIVE_LOW>; -++ default-state = "off"; -++ }; -++ -++ led4 { -++ label = "u7623-01:green:led4"; -++ gpios = <&pio 15 GPIO_ACTIVE_LOW>; -++ default-state = "off"; -++ }; -++ }; -++}; -++ -++&crypto { -++ status = "okay"; -++}; -++ -++ð { -++ status = "okay"; -++ -++ gmac0: mac@0 { -++ compatible = "mediatek,eth-mac"; -++ reg = <0>; -++ phy-mode = "trgmii"; -++ -++ fixed-link { -++ speed = <1000>; -++ full-duplex; -++ pause; -++ }; -++ }; -++ -++ mdio: mdio-bus { -++ #address-cells = <1>; -++ #size-cells = <0>; -++ -++ mt7530: switch@0 { -++ compatible = "mediatek,mt7530"; -++ }; -++ }; -++}; -++ -++&mt7530 { -++ compatible = "mediatek,mt7530"; -++ #address-cells = <1>; -++ #size-cells = <0>; -++ reg = <0>; -++ pinctrl-names = "default"; -++ mediatek,mcm; -++ resets = <ðsys 2>; -++ reset-names = "mcm"; -++ core-supply = <&mt6323_vpa_reg>; -++ io-supply = <&mt6323_vemc3v3_reg>; -++ -++ dsa,mii-bus = <&mdio>; -++ -++ ports { -++ #address-cells = <1>; -++ #size-cells = <0>; -++ reg = <0>; -++ -++ port@0 { -++ reg = <0>; -++ label = "lan0"; -++ cpu = <&cpu_port0>; -++ }; -++ -++ port@1 { -++ reg = <1>; -++ label = "lan1"; -++ cpu = <&cpu_port0>; -++ }; -++ -++ port@2 { -++ reg = <2>; -++ label = "lan2"; -++ cpu = <&cpu_port0>; -++ }; -++ -++ port@3 { -++ reg = <3>; -++ label = "lan3"; -++ cpu = <&cpu_port0>; -++ }; -++ -++ port@4 { -++ reg = <4>; -++ label = "wan"; -++ cpu = <&cpu_port0>; -++ }; -++ -++ cpu_port0: port@6 { -++ reg = <6>; -++ label = "cpu"; -++ ethernet = <&gmac0>; -++ phy-mode = "trgmii"; -++ -++ fixed-link { -++ speed = <1000>; -++ full-duplex; -++ }; -++ }; -++ }; -++}; -++ -++&mmc0 { -++ pinctrl-names = "default", "state_uhs"; -++ pinctrl-0 = <&mmc0_pins_default>; -++ pinctrl-1 = <&mmc0_pins_uhs>; -++ status = "okay"; -++ bus-width = <8>; -++ max-frequency = <50000000>; -++ cap-mmc-highspeed; -++ vmmc-supply = <®_3p3v>; -++ vqmmc-supply = <®_1p8v>; -++ non-removable; -++}; -++ -++&pio { -++ key_pins_a: keys-alt { -++ pins-keys { -++ pinmux = , -++ ; -++ input-enable; -++ }; -++ }; -++ -++ led_pins_unielec: leds-unielec { -++ pins-leds { -++ pinmux = , -++ ; -++ }; -++ }; -++ -++ mmc0_pins_default: mmc0default { -++ pins_cmd_dat { -++ pinmux = , -++ , -++ , -++ , -++ , -++ , -++ , -++ , -++ ; -++ input-enable; -++ bias-pull-up; -++ }; -++ -++ pins_clk { -++ pinmux = ; -++ bias-pull-down; -++ }; -++ -++ pins_rst { -++ pinmux = ; -++ bias-pull-up; -++ }; -++ }; -++ -++ mmc0_pins_uhs: mmc0 { -++ pins_cmd_dat { -++ pinmux = , -++ , -++ , -++ , -++ , -++ , -++ , -++ , -++ ; -++ input-enable; -++ drive-strength = ; -++ bias-pull-up = ; -++ }; -++ -++ pins_clk { -++ pinmux = ; -++ drive-strength = ; -++ bias-pull-down = ; -++ }; -++ -++ pins_rst { -++ pinmux = ; -++ bias-pull-up; -++ }; -++ }; -++ -++ pcie_default: pcie_pin_default { -++ pins_cmd_dat { -++ pinmux = , -++ ; -++ bias-disable; -++ }; -++ }; -++}; -++ -++&pwm { -++ pinctrl-names = "default"; -++ pinctrl-0 = <&pwm_pins_a>; -++ status = "okay"; -++}; -++ -++&pwrap { -++ mt6323 { -++ mt6323led: led { -++ compatible = "mediatek,mt6323-led"; -++ #address-cells = <1>; -++ #size-cells = <0>; -++ -++ led@0 { -++ reg = <0>; -++ label = "led0"; -++ default-state = "off"; -++ }; -++ }; -++ }; -++}; -++ -++&uart2 { -++ pinctrl-names = "default"; -++ pinctrl-0 = <&uart2_pins_b>; -++ status = "okay"; -++}; -++ -++&usb1 { -++ vusb33-supply = <®_3p3v>; -++ vbus-supply = <®_3p3v>; -++ status = "okay"; -++}; -++ -++&u3phy1 { -++ status = "okay"; -++}; -++ -++&u3phy2 { -++ status = "okay"; -++ mediatek,phy-switch = <&hifsys>; -++}; -++ -++&pcie { -++ pinctrl-names = "default"; -++ pinctrl-0 = <&pcie_default>; -++ status = "okay"; -++ -++ pcie@1,0 { -++ status = "okay"; -++ }; -++ -++ pcie@2,0 { -++ status = "okay"; -++ }; -++}; -++ -++&pcie1_phy { -++ status = "okay"; +++/* +++ * red { +++ * label = "bpi-r64:pio:red"; +++ * gpios = <&pio 88 GPIO_ACTIVE_HIGH>; +++ * default-state = "off"; +++ * }; +++ */ ++ }; ++ ++ memory { +diff --git a/target/linux/mediatek/patches-5.10/114-dts-bpi64-disable-rtc.patch b/target/linux/mediatek/patches-5.10/114-dts-bpi64-disable-rtc.patch +new file mode 100644 +index 0000000000..261579bf37 +--- /dev/null ++++ b/target/linux/mediatek/patches-5.10/114-dts-bpi64-disable-rtc.patch +@@ -0,0 +1,21 @@ ++--- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +++++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts ++@@ -559,12 +559,16 @@ ++ status = "okay"; ++ }; ++ +++&rtc { +++ status = "disabled"; ++}; ++ ++ &sata { ++- status = "disable"; +++ status = "disabled"; ++ }; ++ ++ &sata_phy { ++- status = "disable"; +++ status = "disabled"; ++ }; ++ ++ &spi0 { diff --git a/target/linux/mediatek/patches-5.10/130-dts-mt7629-add-snand-support.patch b/target/linux/mediatek/patches-5.10/130-dts-mt7629-add-snand-support.patch new file mode 100644 index 0000000000..479694b400 @@ -103771,10 +104464,10 @@ index 0000000000..53e2aed51e ++MODULE_DESCRIPTION("Mediatek SPI Memory Interface Driver"); diff --git a/target/linux/mediatek/patches-5.10/330-mtk-bmt-support.patch b/target/linux/mediatek/patches-5.10/330-mtk-bmt-support.patch new file mode 100644 -index 0000000000..5c20952611 +index 0000000000..504c602c50 --- /dev/null +++ b/target/linux/mediatek/patches-5.10/330-mtk-bmt-support.patch -@@ -0,0 +1,840 @@ +@@ -0,0 +1,855 @@ +--- a/drivers/mtd/nand/Kconfig ++++ b/drivers/mtd/nand/Kconfig +@@ -15,6 +15,10 @@ config MTD_NAND_ECC @@ -103800,6 +104493,3338 @@ index 0000000000..5c20952611 + obj-y += raw/ +--- /dev/null ++++ b/drivers/mtd/nand/mtk_bmt.c ++@@ -0,0 +1,781 @@ +++/* +++ * Copyright (c) 2017 MediaTek Inc. +++ * Author: Xiangsheng Hou +++ * Copyright (c) 2020 Felix Fietkau +++ * +++ * This program is free software; you can redistribute it and/or modify +++ * it under the terms of the GNU General Public License version 2 as +++ * published by the Free Software Foundation. +++ * +++ * This program is distributed in the hope that it will be useful, +++ * but WITHOUT ANY WARRANTY; without even the implied warranty of +++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +++ * GNU General Public License for more details. +++ */ +++ +++#include +++#include +++#include +++#include +++#include +++#include +++#include +++#include +++#include +++ +++#define MAIN_SIGNATURE_OFFSET 0 +++#define OOB_SIGNATURE_OFFSET 1 +++#define BBPOOL_RATIO 2 +++ +++#define BBT_LOG(fmt, ...) pr_debug("[BBT][%s|%d] "fmt"\n", __func__, __LINE__, ##__VA_ARGS__) +++ +++/* Maximum 8k blocks */ +++#define BB_TABLE_MAX bmtd.table_size +++#define BMT_TABLE_MAX (BB_TABLE_MAX * BBPOOL_RATIO / 100) +++#define BMT_TBL_DEF_VAL 0x0 +++ +++/* +++ * Burner Bad Block Table +++ * --------- Only support SLC Nand Chips!!!!!!!!!!! ---------- +++ */ +++ +++struct bbbt { +++ char signature[3]; +++ /* This version is used to distinguish the legacy and new algorithm */ +++#define BBMT_VERSION 2 +++ unsigned char version; +++ /* Below 2 tables will be written in SLC */ +++ u16 bb_tbl[]; +++}; +++ +++struct bbmt { +++ u16 block; +++#define NO_MAPPED 0 +++#define NORMAL_MAPPED 1 +++#define BMT_MAPPED 2 +++ u16 mapped; +++}; +++ +++static struct bmt_desc { +++ struct mtd_info *mtd; +++ +++ int (*_read_oob) (struct mtd_info *mtd, loff_t from, +++ struct mtd_oob_ops *ops); +++ int (*_write_oob) (struct mtd_info *mtd, loff_t to, +++ struct mtd_oob_ops *ops); +++ const struct nand_ops *nand_ops; +++ +++ struct bbbt *bbt; +++ +++ struct dentry *debugfs_dir; +++ +++ u32 table_size; +++ u32 pg_size; +++ u32 blk_size; +++ u16 pg_shift; +++ u16 blk_shift; +++ /* bbt logical address */ +++ u16 pool_lba; +++ /* bbt physical address */ +++ u16 pool_pba; +++ /* Maximum count of bad blocks that the vendor guaranteed */ +++ u16 bb_max; +++ /* Total blocks of the Nand Chip */ +++ u16 total_blks; +++ /* The block(n) BMT is located at (bmt_tbl[n]) */ +++ u16 bmt_blk_idx; +++ /* How many pages needs to store 'struct bbbt' */ +++ u32 bmt_pgs; +++ +++ /* to compensate for driver level remapping */ +++ u8 oob_offset; +++} bmtd = {0}; +++ +++static unsigned char *nand_bbt_buf; +++static unsigned char *nand_data_buf; +++ +++/* -------- Unit conversions -------- */ +++static inline u32 blk_pg(u16 block) +++{ +++ return (u32)(block << (bmtd.blk_shift - bmtd.pg_shift)); +++} +++ +++/* -------- Nand operations wrapper -------- */ +++static inline int +++bbt_nand_read(u32 page, unsigned char *dat, int dat_len, +++ unsigned char *fdm, int fdm_len) +++{ +++ struct mtd_oob_ops ops = { +++ .mode = MTD_OPS_PLACE_OOB, +++ .ooboffs = bmtd.oob_offset, +++ .oobbuf = fdm, +++ .ooblen = fdm_len, +++ .datbuf = dat, +++ .len = dat_len, +++ }; +++ +++ return bmtd._read_oob(bmtd.mtd, page << bmtd.pg_shift, &ops); +++} +++ +++static inline int bbt_nand_erase(u16 block) +++{ +++ struct nand_device *nand = mtd_to_nanddev(bmtd.mtd); +++ loff_t addr = (loff_t)block << bmtd.blk_shift; +++ struct nand_pos pos; +++ +++ nanddev_offs_to_pos(nand, addr, &pos); +++ return bmtd.nand_ops->erase(nand, &pos); +++} +++ +++/* -------- Bad Blocks Management -------- */ +++static inline struct bbmt *bmt_tbl(struct bbbt *bbbt) +++{ +++ return (struct bbmt *)&bbbt->bb_tbl[bmtd.table_size]; +++} +++ +++static int +++read_bmt(u16 block, unsigned char *dat, unsigned char *fdm, int fdm_len) +++{ +++ u32 len = bmtd.bmt_pgs << bmtd.pg_shift; +++ +++ return bbt_nand_read(blk_pg(block), dat, len, fdm, fdm_len); +++} +++ +++static int write_bmt(u16 block, unsigned char *dat) +++{ +++ struct mtd_oob_ops ops = { +++ .mode = MTD_OPS_PLACE_OOB, +++ .ooboffs = OOB_SIGNATURE_OFFSET + bmtd.oob_offset, +++ .oobbuf = "bmt", +++ .ooblen = 3, +++ .datbuf = dat, +++ .len = bmtd.bmt_pgs << bmtd.pg_shift, +++ }; +++ loff_t addr = (loff_t)block << bmtd.blk_shift; +++ +++ return bmtd._write_oob(bmtd.mtd, addr, &ops); +++} +++ +++static u16 find_valid_block(u16 block) +++{ +++ u8 fdm[4]; +++ int ret; +++ int loop = 0; +++ +++retry: +++ if (block >= bmtd.total_blks) +++ return 0; +++ +++ ret = bbt_nand_read(blk_pg(block), nand_data_buf, bmtd.pg_size, +++ fdm, sizeof(fdm)); +++ /* Read the 1st byte of FDM to judge whether it's a bad +++ * or not +++ */ +++ if (ret || fdm[0] != 0xff) { +++ pr_info("nand: found bad block 0x%x\n", block); +++ if (loop >= bmtd.bb_max) { +++ pr_info("nand: FATAL ERR: too many bad blocks!!\n"); +++ return 0; +++ } +++ +++ loop++; +++ block++; +++ goto retry; +++ } +++ +++ return block; +++} +++ +++/* Find out all bad blocks, and fill in the mapping table */ +++static int scan_bad_blocks(struct bbbt *bbt) +++{ +++ int i; +++ u16 block = 0; +++ +++ /* First time download, the block0 MUST NOT be a bad block, +++ * this is guaranteed by vendor +++ */ +++ bbt->bb_tbl[0] = 0; +++ +++ /* +++ * Construct the mapping table of Normal data area(non-PMT/BMTPOOL) +++ * G - Good block; B - Bad block +++ * --------------------------- +++ * physical |G|G|B|G|B|B|G|G|G|G|B|G|B| +++ * --------------------------- +++ * What bb_tbl[i] looks like: +++ * physical block(i): +++ * 0 1 2 3 4 5 6 7 8 9 a b c +++ * mapped block(bb_tbl[i]): +++ * 0 1 3 6 7 8 9 b ...... +++ * ATTENTION: +++ * If new bad block ocurred(n), search bmt_tbl to find +++ * a available block(x), and fill in the bb_tbl[n] = x; +++ */ +++ for (i = 1; i < bmtd.pool_lba; i++) { +++ bbt->bb_tbl[i] = find_valid_block(bbt->bb_tbl[i - 1] + 1); +++ BBT_LOG("bb_tbl[0x%x] = 0x%x", i, bbt->bb_tbl[i]); +++ if (bbt->bb_tbl[i] == 0) +++ return -1; +++ } +++ +++ /* Physical Block start Address of BMT pool */ +++ bmtd.pool_pba = bbt->bb_tbl[i - 1] + 1; +++ if (bmtd.pool_pba >= bmtd.total_blks - 2) { +++ pr_info("nand: FATAL ERR: Too many bad blocks!!\n"); +++ return -1; +++ } +++ +++ BBT_LOG("pool_pba=0x%x", bmtd.pool_pba); +++ i = 0; +++ block = bmtd.pool_pba; +++ /* +++ * The bmt table is used for runtime bad block mapping +++ * G - Good block; B - Bad block +++ * --------------------------- +++ * physical |G|G|B|G|B|B|G|G|G|G|B|G|B| +++ * --------------------------- +++ * block: 0 1 2 3 4 5 6 7 8 9 a b c +++ * What bmt_tbl[i] looks like in initial state: +++ * i: +++ * 0 1 2 3 4 5 6 7 +++ * bmt_tbl[i].block: +++ * 0 1 3 6 7 8 9 b +++ * bmt_tbl[i].mapped: +++ * N N N N N N N B +++ * N - Not mapped(Available) +++ * M - Mapped +++ * B - BMT +++ * ATTENTION: +++ * BMT always in the last valid block in pool +++ */ +++ while ((block = find_valid_block(block)) != 0) { +++ bmt_tbl(bbt)[i].block = block; +++ bmt_tbl(bbt)[i].mapped = NO_MAPPED; +++ BBT_LOG("bmt_tbl[%d].block = 0x%x", i, block); +++ block++; +++ i++; +++ } +++ +++ /* i - How many available blocks in pool, which is the length of bmt_tbl[] +++ * bmtd.bmt_blk_idx - bmt_tbl[bmtd.bmt_blk_idx].block => the BMT block +++ */ +++ bmtd.bmt_blk_idx = i - 1; +++ bmt_tbl(bbt)[bmtd.bmt_blk_idx].mapped = BMT_MAPPED; +++ +++ if (i < 1) { +++ pr_info("nand: FATAL ERR: no space to store BMT!!\n"); +++ return -1; +++ } +++ +++ pr_info("[BBT] %d available blocks in BMT pool\n", i); +++ +++ return 0; +++} +++ +++static bool is_valid_bmt(unsigned char *buf, unsigned char *fdm) +++{ +++ struct bbbt *bbt = (struct bbbt *)buf; +++ u8 *sig = (u8*)bbt->signature + MAIN_SIGNATURE_OFFSET; +++ +++ +++ if (memcmp(bbt->signature + MAIN_SIGNATURE_OFFSET, "BMT", 3) == 0 && +++ memcmp(fdm + OOB_SIGNATURE_OFFSET, "bmt", 3) == 0) { +++ if (bbt->version == BBMT_VERSION) +++ return true; +++ } +++ BBT_LOG("[BBT] BMT Version not match,upgrage preloader and uboot please! sig=%02x%02x%02x, fdm=%02x%02x%02x", +++ sig[0], sig[1], sig[2], +++ fdm[1], fdm[2], fdm[3]); +++ return false; +++} +++ +++static u16 get_bmt_index(struct bbmt *bmt) +++{ +++ int i = 0; +++ +++ while (bmt[i].block != BMT_TBL_DEF_VAL) { +++ if (bmt[i].mapped == BMT_MAPPED) +++ return i; +++ i++; +++ } +++ return 0; +++} +++ +++static struct bbbt *scan_bmt(u16 block) +++{ +++ u8 fdm[4]; +++ +++ if (block < bmtd.pool_lba) +++ return NULL; +++ +++ if (read_bmt(block, nand_bbt_buf, fdm, sizeof(fdm))) +++ return scan_bmt(block - 1); +++ +++ if (is_valid_bmt(nand_bbt_buf, fdm)) { +++ bmtd.bmt_blk_idx = get_bmt_index(bmt_tbl((struct bbbt *)nand_bbt_buf)); +++ if (bmtd.bmt_blk_idx == 0) { +++ pr_info("[BBT] FATAL ERR: bmt block index is wrong!\n"); +++ return NULL; +++ } +++ pr_info("[BBT] BMT.v2 is found at 0x%x\n", block); +++ return (struct bbbt *)nand_bbt_buf; +++ } else +++ return scan_bmt(block - 1); +++} +++ +++/* Write the Burner Bad Block Table to Nand Flash +++ * n - write BMT to bmt_tbl[n] +++ */ +++static u16 upload_bmt(struct bbbt *bbt, int n) +++{ +++ u16 block; +++ +++retry: +++ if (n < 0 || bmt_tbl(bbt)[n].mapped == NORMAL_MAPPED) { +++ pr_info("nand: FATAL ERR: no space to store BMT!\n"); +++ return (u16)-1; +++ } +++ +++ block = bmt_tbl(bbt)[n].block; +++ BBT_LOG("n = 0x%x, block = 0x%x", n, block); +++ if (bbt_nand_erase(block)) { +++ bmt_tbl(bbt)[n].block = 0; +++ /* erase failed, try the previous block: bmt_tbl[n - 1].block */ +++ n--; +++ goto retry; +++ } +++ +++ /* The signature offset is fixed set to 0, +++ * oob signature offset is fixed set to 1 +++ */ +++ memcpy(bbt->signature + MAIN_SIGNATURE_OFFSET, "BMT", 3); +++ bbt->version = BBMT_VERSION; +++ +++ if (write_bmt(block, (unsigned char *)bbt)) { +++ bmt_tbl(bbt)[n].block = 0; +++ +++ /* write failed, try the previous block in bmt_tbl[n - 1] */ +++ n--; +++ goto retry; +++ } +++ +++ /* Return the current index(n) of BMT pool (bmt_tbl[n]) */ +++ return n; +++} +++ +++static u16 find_valid_block_in_pool(struct bbbt *bbt) +++{ +++ int i; +++ +++ if (bmtd.bmt_blk_idx == 0) +++ goto error; +++ +++ for (i = 0; i < bmtd.bmt_blk_idx; i++) { +++ if (bmt_tbl(bbt)[i].block != 0 && bmt_tbl(bbt)[i].mapped == NO_MAPPED) { +++ bmt_tbl(bbt)[i].mapped = NORMAL_MAPPED; +++ return bmt_tbl(bbt)[i].block; +++ } +++ } +++ +++error: +++ pr_info("nand: FATAL ERR: BMT pool is run out!\n"); +++ return 0; +++} +++ +++/* We met a bad block, mark it as bad and map it to a valid block in pool, +++ * if it's a write failure, we need to write the data to mapped block +++ */ +++static bool update_bmt(u16 block) +++{ +++ u16 mapped_blk; +++ struct bbbt *bbt; +++ +++ bbt = bmtd.bbt; +++ mapped_blk = find_valid_block_in_pool(bbt); +++ if (mapped_blk == 0) +++ return false; +++ +++ /* Map new bad block to available block in pool */ +++ bbt->bb_tbl[block] = mapped_blk; +++ bmtd.bmt_blk_idx = upload_bmt(bbt, bmtd.bmt_blk_idx); +++ +++ return true; +++} +++ +++u16 get_mapping_block_index(int block) +++{ +++ int mapping_block; +++ +++ if (block < bmtd.pool_lba) +++ mapping_block = bmtd.bbt->bb_tbl[block]; +++ else +++ mapping_block = block; +++ BBT_LOG("0x%x mapped to 0x%x", block, mapping_block); +++ +++ return mapping_block; +++} +++ +++static int +++mtk_bmt_read(struct mtd_info *mtd, loff_t from, +++ struct mtd_oob_ops *ops) +++{ +++ struct mtd_oob_ops cur_ops = *ops; +++ int retry_count = 0; +++ loff_t cur_from; +++ int ret; +++ +++ ops->retlen = 0; +++ ops->oobretlen = 0; +++ +++ while (ops->retlen < ops->len || ops->oobretlen < ops->ooblen) { +++ u32 offset = from & (bmtd.blk_size - 1); +++ u32 block = from >> bmtd.blk_shift; +++ u32 cur_block; +++ +++ cur_block = get_mapping_block_index(block); +++ cur_from = ((loff_t)cur_block << bmtd.blk_shift) + offset; +++ +++ cur_ops.oobretlen = 0; +++ cur_ops.retlen = 0; +++ cur_ops.len = min_t(u32, mtd->erasesize - offset, +++ ops->len - ops->retlen); +++ ret = bmtd._read_oob(mtd, cur_from, &cur_ops); +++ if (ret < 0) { +++ update_bmt(block); +++ if (retry_count++ < 10) +++ continue; +++ +++ return ret; +++ } +++ +++ ops->retlen += cur_ops.retlen; +++ ops->oobretlen += cur_ops.oobretlen; +++ +++ cur_ops.ooboffs = 0; +++ cur_ops.datbuf += cur_ops.retlen; +++ cur_ops.oobbuf += cur_ops.oobretlen; +++ cur_ops.ooblen -= cur_ops.oobretlen; +++ +++ if (!cur_ops.len) +++ cur_ops.len = mtd->erasesize - offset; +++ +++ from += cur_ops.len; +++ retry_count = 0; +++ } +++ +++ return 0; +++} +++ +++static int +++mtk_bmt_write(struct mtd_info *mtd, loff_t to, +++ struct mtd_oob_ops *ops) +++{ +++ struct mtd_oob_ops cur_ops = *ops; +++ int retry_count = 0; +++ loff_t cur_to; +++ int ret; +++ +++ ops->retlen = 0; +++ ops->oobretlen = 0; +++ +++ while (ops->retlen < ops->len || ops->oobretlen < ops->ooblen) { +++ u32 offset = to & (bmtd.blk_size - 1); +++ u32 block = to >> bmtd.blk_shift; +++ u32 cur_block; +++ +++ cur_block = get_mapping_block_index(block); +++ cur_to = ((loff_t)cur_block << bmtd.blk_shift) + offset; +++ +++ cur_ops.oobretlen = 0; +++ cur_ops.retlen = 0; +++ cur_ops.len = min_t(u32, bmtd.blk_size - offset, +++ ops->len - ops->retlen); +++ ret = bmtd._write_oob(mtd, cur_to, &cur_ops); +++ if (ret < 0) { +++ update_bmt(block); +++ if (retry_count++ < 10) +++ continue; +++ +++ return ret; +++ } +++ +++ ops->retlen += cur_ops.retlen; +++ ops->oobretlen += cur_ops.oobretlen; +++ +++ cur_ops.ooboffs = 0; +++ cur_ops.datbuf += cur_ops.retlen; +++ cur_ops.oobbuf += cur_ops.oobretlen; +++ cur_ops.ooblen -= cur_ops.oobretlen; +++ +++ if (!cur_ops.len) +++ cur_ops.len = mtd->erasesize - offset; +++ +++ to += cur_ops.len; +++ retry_count = 0; +++ } +++ +++ return 0; +++} +++ +++ +++ +++static int +++mtk_bmt_erase(struct nand_device *nand, const struct nand_pos *pos) +++{ +++ struct nand_pos new_pos = *pos; +++ int retry_count = 0; +++ int ret; +++ +++retry: +++ new_pos.eraseblock = get_mapping_block_index(pos->eraseblock); +++ +++ ret = bmtd.nand_ops->erase(nand, &new_pos); +++ if (ret) { +++ update_bmt(pos->eraseblock); +++ if (retry_count++ < 10) +++ goto retry; +++ } +++ +++ return ret; +++} +++ +++static bool +++mtk_bmt_isbad(struct nand_device *nand, const struct nand_pos *pos) +++{ +++ struct nand_pos new_pos = *pos; +++ int retry_count = 0; +++ bool ret; +++ +++retry: +++ new_pos.eraseblock = get_mapping_block_index(pos->eraseblock); +++ +++ ret = bmtd.nand_ops->isbad(nand, &new_pos); +++ if (ret) { +++ update_bmt(pos->eraseblock); +++ if (retry_count++ < 10) +++ goto retry; +++ } +++ +++ return ret; +++} +++ +++static int +++mtk_bmt_markbad(struct nand_device *nand, const struct nand_pos *pos) +++{ +++ struct nand_pos new_pos = *pos; +++ +++ new_pos.eraseblock = get_mapping_block_index(new_pos.eraseblock); +++ update_bmt(pos->eraseblock); +++ +++ return bmtd.nand_ops->markbad(nand, &new_pos); +++} +++ +++static void +++mtk_bmt_replace_ops(struct mtd_info *mtd) +++{ +++ static const struct nand_ops mtk_bmt_nand_ops = { +++ .erase = mtk_bmt_erase, +++ .isbad = mtk_bmt_isbad, +++ .markbad = mtk_bmt_markbad, +++ }; +++ struct nand_device *nand = mtd_to_nanddev(mtd); +++ +++ bmtd.nand_ops = nand->ops; +++ bmtd._read_oob = mtd->_read_oob; +++ bmtd._write_oob = mtd->_write_oob; +++ +++ mtd->_read_oob = mtk_bmt_read; +++ mtd->_write_oob = mtk_bmt_write; +++ nand->ops = &mtk_bmt_nand_ops; +++} +++ +++static int mtk_bmt_debug_mark_good(void *data, u64 val) +++{ +++ u32 block = val >> bmtd.blk_shift; +++ +++ bmtd.bbt->bb_tbl[block] = block; +++ bmtd.bmt_blk_idx = upload_bmt(bmtd.bbt, bmtd.bmt_blk_idx); +++ +++ return 0; +++} +++ +++static int mtk_bmt_debug_mark_bad(void *data, u64 val) +++{ +++ u32 block = val >> bmtd.blk_shift; +++ +++ update_bmt(block); +++ +++ return 0; +++} +++ +++DEFINE_DEBUGFS_ATTRIBUTE(fops_mark_good, NULL, mtk_bmt_debug_mark_good, "%llu\n"); +++DEFINE_DEBUGFS_ATTRIBUTE(fops_mark_bad, NULL, mtk_bmt_debug_mark_bad, "%llu\n"); +++ +++static void +++mtk_bmt_add_debugfs(void) +++{ +++ struct dentry *dir; +++ +++ dir = bmtd.debugfs_dir = debugfs_create_dir("mtk-bmt", NULL); +++ if (!dir) +++ return; +++ +++ debugfs_create_file_unsafe("mark_good", S_IWUSR, dir, NULL, &fops_mark_good); +++ debugfs_create_file_unsafe("mark_bad", S_IWUSR, dir, NULL, &fops_mark_bad); +++} +++ +++void mtk_bmt_detach(struct mtd_info *mtd) +++{ +++ struct nand_device *nand = mtd_to_nanddev(mtd); +++ +++ if (bmtd.mtd != mtd) +++ return; +++ +++ if (bmtd.debugfs_dir) +++ debugfs_remove_recursive(bmtd.debugfs_dir); +++ bmtd.debugfs_dir = NULL; +++ +++ kfree(nand_bbt_buf); +++ kfree(nand_data_buf); +++ +++ mtd->_read_oob = bmtd._read_oob; +++ mtd->_write_oob = bmtd._write_oob; +++ mtd->size = bmtd.total_blks << bmtd.blk_shift; +++ nand->ops = bmtd.nand_ops; +++ +++ memset(&bmtd, 0, sizeof(bmtd)); +++} +++ +++/* total_blocks - The total count of blocks that the Nand Chip has */ +++int mtk_bmt_attach(struct mtd_info *mtd) +++{ +++ struct device_node *np; +++ struct bbbt *bbt; +++ u32 bufsz; +++ u32 block; +++ u16 total_blocks, pmt_block; +++ int ret = 0; +++ u32 bmt_pool_size, bmt_table_size; +++ +++ if (bmtd.mtd) +++ return -ENOSPC; +++ +++ np = mtd_get_of_node(mtd); +++ if (!np) +++ return 0; +++ +++ if (!of_property_read_bool(np, "mediatek,bmt-v2")) +++ return 0; +++ +++ if (of_property_read_u32(np, "mediatek,bmt-pool-size", +++ &bmt_pool_size) != 0) +++ bmt_pool_size = 80; +++ +++ if (of_property_read_u8(np, "mediatek,bmt-oob-offset", +++ &bmtd.oob_offset) != 0) +++ bmtd.oob_offset = 8; +++ +++ if (of_property_read_u32(np, "mediatek,bmt-table-size", +++ &bmt_table_size) != 0) +++ bmt_table_size = 0x2000U; +++ +++ bmtd.mtd = mtd; +++ mtk_bmt_replace_ops(mtd); +++ +++ bmtd.table_size = bmt_table_size; +++ bmtd.blk_size = mtd->erasesize; +++ bmtd.blk_shift = ffs(bmtd.blk_size) - 1; +++ bmtd.pg_size = mtd->writesize; +++ bmtd.pg_shift = ffs(bmtd.pg_size) - 1; +++ total_blocks = mtd->size >> bmtd.blk_shift; +++ pmt_block = total_blocks - bmt_pool_size - 2; +++ +++ mtd->size = pmt_block << bmtd.blk_shift; +++ +++ /* +++ * --------------------------------------- +++ * | PMT(2blks) | BMT POOL(totalblks * 2%) | +++ * --------------------------------------- +++ * ^ ^ +++ * | | +++ * pmt_block pmt_block + 2blocks(pool_lba) +++ * +++ * ATTETION!!!!!! +++ * The blocks ahead of the boundary block are stored in bb_tbl +++ * and blocks behind are stored in bmt_tbl +++ */ +++ +++ bmtd.pool_lba = (u16)(pmt_block + 2); +++ bmtd.total_blks = total_blocks; +++ bmtd.bb_max = bmtd.total_blks * BBPOOL_RATIO / 100; +++ +++ /* 3 buffers we need */ +++ bufsz = round_up(sizeof(struct bbbt) + +++ bmt_table_size * sizeof(struct bbmt), bmtd.pg_size); +++ bmtd.bmt_pgs = bufsz >> bmtd.pg_shift; +++ +++ nand_bbt_buf = kzalloc(bufsz, GFP_KERNEL); +++ nand_data_buf = kzalloc(bmtd.pg_size, GFP_KERNEL); +++ +++ if (!nand_bbt_buf || !nand_data_buf) { +++ pr_info("nand: FATAL ERR: allocate buffer failed!\n"); +++ ret = -1; +++ goto error; +++ } +++ +++ memset(nand_bbt_buf, 0xff, bufsz); +++ memset(nand_data_buf, 0xff, bmtd.pg_size); +++ +++ BBT_LOG("bbtbuf=0x%p(0x%x) dat=0x%p(0x%x)", +++ nand_bbt_buf, bufsz, nand_data_buf, bmtd.pg_size); +++ BBT_LOG("pool_lba=0x%x total_blks=0x%x bb_max=0x%x", +++ bmtd.pool_lba, bmtd.total_blks, bmtd.bb_max); +++ +++ /* Scanning start from the first page of the last block +++ * of whole flash +++ */ +++ bbt = scan_bmt(bmtd.total_blks - 1); +++ if (!bbt) { +++ /* BMT not found */ +++ if (bmtd.total_blks > BB_TABLE_MAX + BMT_TABLE_MAX) { +++ pr_info("nand: FATAL: Too many blocks, can not support!\n"); +++ ret = -1; +++ goto error; +++ } +++ +++ bbt = (struct bbbt *)nand_bbt_buf; +++ memset(bmt_tbl(bbt), BMT_TBL_DEF_VAL, bmtd.table_size * sizeof(struct bbmt)); +++ +++ if (scan_bad_blocks(bbt)) { +++ ret = -1; +++ goto error; +++ } +++ +++ /* BMT always in the last valid block in pool */ +++ bmtd.bmt_blk_idx = upload_bmt(bbt, bmtd.bmt_blk_idx); +++ block = bmt_tbl(bbt)[bmtd.bmt_blk_idx].block; +++ pr_notice("[BBT] BMT.v2 is written into PBA:0x%x\n", block); +++ +++ if (bmtd.bmt_blk_idx == 0) +++ pr_info("nand: Warning: no available block in BMT pool!\n"); +++ else if (bmtd.bmt_blk_idx == (u16)-1) { +++ ret = -1; +++ goto error; +++ } +++ } +++ mtk_bmt_add_debugfs(); +++ +++ bmtd.bbt = bbt; +++ return 0; +++ +++error: +++ mtk_bmt_detach(mtd); +++ return ret; +++} +++ +++ +++MODULE_LICENSE("GPL"); +++MODULE_AUTHOR("Xiangsheng Hou , Felix Fietkau "); +++MODULE_DESCRIPTION("Bad Block mapping management v2 for MediaTek NAND Flash Driver"); +++ ++--- a/drivers/mtd/nand/spi/core.c +++++ b/drivers/mtd/nand/spi/core.c ++@@ -19,6 +19,7 @@ ++ #include ++ #include ++ #include +++#include ++ ++ static int spinand_read_reg_op(struct spinand_device *spinand, u8 reg, u8 *val) ++ { ++@@ -1139,6 +1140,8 @@ static int spinand_probe(struct spi_mem ++ if (ret) ++ return ret; ++ +++ mtk_bmt_attach(mtd); +++ ++ ret = mtd_device_register(mtd, NULL, 0); ++ if (ret) ++ goto err_spinand_cleanup; ++@@ -1164,6 +1167,7 @@ static int spinand_remove(struct spi_mem ++ if (ret) ++ return ret; ++ +++ mtk_bmt_detach(mtd); ++ spinand_cleanup(spinand); ++ ++ return 0; ++--- /dev/null +++++ b/include/linux/mtd/mtk_bmt.h ++@@ -0,0 +1,18 @@ +++#ifndef __MTK_BMT_H +++#define __MTK_BMT_H +++ +++#ifdef CONFIG_MTD_NAND_MTK_BMT +++int mtk_bmt_attach(struct mtd_info *mtd); +++void mtk_bmt_detach(struct mtd_info *mtd); +++#else +++static inline int mtk_bmt_attach(struct mtd_info *mtd) +++{ +++ return 0; +++} +++ +++static inline void mtk_bmt_detach(struct mtd_info *mtd) +++{ +++} +++#endif +++ +++#endif +diff --git a/target/linux/mediatek/patches-5.10/340-mtd-spinand-Add-support-for-the-Fidelix-FM35X1GA.patch b/target/linux/mediatek/patches-5.10/340-mtd-spinand-Add-support-for-the-Fidelix-FM35X1GA.patch +new file mode 100644 +index 0000000000..69a9297e1f +--- /dev/null ++++ b/target/linux/mediatek/patches-5.10/340-mtd-spinand-Add-support-for-the-Fidelix-FM35X1GA.patch +@@ -0,0 +1,122 @@ ++From ea0df4552efcdcc2806fe6eba0540b5f719d80b6 Mon Sep 17 00:00:00 2001 ++From: Davide Fioravanti ++Date: Fri, 8 Jan 2021 15:35:24 +0100 ++Subject: [PATCH 1/1] mtd: spinand: Add support for the Fidelix FM35X1GA ++ ++Datasheet: http://www.hobos.com.cn/upload/datasheet/DS35X1GAXXX_100_rev00.pdf ++ ++Signed-off-by: Davide Fioravanti ++--- ++ drivers/mtd/nand/spi/Makefile | 2 +- ++ drivers/mtd/nand/spi/core.c | 1 + ++ drivers/mtd/nand/spi/fidelix.c | 80 ++++++++++++++++++++++++++++++++++ ++ include/linux/mtd/spinand.h | 1 + ++ 4 files changed, 83 insertions(+), 1 deletion(-) ++ create mode 100644 drivers/mtd/nand/spi/fidelix.c ++ ++--- a/drivers/mtd/nand/spi/Makefile +++++ b/drivers/mtd/nand/spi/Makefile ++@@ -1,3 +1,3 @@ ++ # SPDX-License-Identifier: GPL-2.0 ++-spinand-objs := core.o gigadevice.o macronix.o micron.o paragon.o toshiba.o winbond.o +++spinand-objs := core.o fidelix.o gigadevice.o macronix.o micron.o paragon.o toshiba.o winbond.o ++ obj-$(CONFIG_MTD_SPI_NAND) += spinand.o ++--- a/drivers/mtd/nand/spi/core.c +++++ b/drivers/mtd/nand/spi/core.c ++@@ -755,6 +755,7 @@ static const struct nand_ops spinand_ops ++ }; ++ ++ static const struct spinand_manufacturer *spinand_manufacturers[] = { +++ &fidelix_spinand_manufacturer, ++ &gigadevice_spinand_manufacturer, ++ ¯onix_spinand_manufacturer, ++ µn_spinand_manufacturer, ++--- /dev/null +++++ b/drivers/mtd/nand/spi/fidelix.c ++@@ -0,0 +1,76 @@ +++// SPDX-License-Identifier: GPL-2.0 +++/* +++ * Copyright (c) 2020 Davide Fioravanti +++ */ +++ +++#include +++#include +++#include +++ +++#define SPINAND_MFR_FIDELIX 0xE5 +++#define FIDELIX_ECCSR_MASK 0x0F +++ +++static SPINAND_OP_VARIANTS(read_cache_variants, +++ SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), +++ SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0), +++ SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0)); +++ +++static SPINAND_OP_VARIANTS(write_cache_variants, +++ SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), +++ SPINAND_PROG_LOAD(true, 0, NULL, 0)); +++ +++static SPINAND_OP_VARIANTS(update_cache_variants, +++ SPINAND_PROG_LOAD_X4(false, 0, NULL, 0), +++ SPINAND_PROG_LOAD(false, 0, NULL, 0)); +++ +++static int fm35x1ga_ooblayout_ecc(struct mtd_info *mtd, int section, +++ struct mtd_oob_region *region) +++{ +++ if (section > 3) +++ return -ERANGE; +++ +++ region->offset = (16 * section) + 8; +++ region->length = 8; +++ +++ return 0; +++} +++ +++static int fm35x1ga_ooblayout_free(struct mtd_info *mtd, int section, +++ struct mtd_oob_region *region) +++{ +++ if (section > 3) +++ return -ERANGE; +++ +++ region->offset = (16 * section) + 2; +++ region->length = 6; +++ +++ return 0; +++} +++ +++static const struct mtd_ooblayout_ops fm35x1ga_ooblayout = { +++ .ecc = fm35x1ga_ooblayout_ecc, +++ .free = fm35x1ga_ooblayout_free, +++}; +++ +++static const struct spinand_info fidelix_spinand_table[] = { +++ SPINAND_INFO("FM35X1GA", +++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x71), +++ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1), +++ NAND_ECCREQ(4, 512), +++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants, +++ &write_cache_variants, +++ &update_cache_variants), +++ SPINAND_HAS_QE_BIT, +++ SPINAND_ECCINFO(&fm35x1ga_ooblayout, NULL)), +++}; +++ +++static const struct spinand_manufacturer_ops fidelix_spinand_manuf_ops = { +++}; +++ +++const struct spinand_manufacturer fidelix_spinand_manufacturer = { +++ .id = SPINAND_MFR_FIDELIX, +++ .name = "Fidelix", +++ .chips = fidelix_spinand_table, +++ .nchips = ARRAY_SIZE(fidelix_spinand_table), +++ .ops = &fidelix_spinand_manuf_ops, +++}; ++--- a/include/linux/mtd/spinand.h +++++ b/include/linux/mtd/spinand.h ++@@ -238,6 +238,7 @@ struct spinand_manufacturer { ++ }; ++ ++ /* SPI NAND manufacturers */ +++extern const struct spinand_manufacturer fidelix_spinand_manufacturer; ++ extern const struct spinand_manufacturer gigadevice_spinand_manufacturer; ++ extern const struct spinand_manufacturer macronix_spinand_manufacturer; ++ extern const struct spinand_manufacturer micron_spinand_manufacturer; +diff --git a/target/linux/mediatek/patches-5.10/350-mtd-parsers-trx-Allow-to-specify-trx-magic-in-DT.patch b/target/linux/mediatek/patches-5.10/350-mtd-parsers-trx-Allow-to-specify-trx-magic-in-DT.patch +new file mode 100644 +index 0000000000..4db51a88ad +--- /dev/null ++++ b/target/linux/mediatek/patches-5.10/350-mtd-parsers-trx-Allow-to-specify-trx-magic-in-DT.patch +@@ -0,0 +1,75 @@ ++From 0600e3d81628002a5cd80cf83ee454851b0063c0 Mon Sep 17 00:00:00 2001 ++From: Hauke Mehrtens ++Date: Sun, 7 Mar 2021 18:19:26 +0100 ++Subject: mtd: parsers: trx: Allow to specify trx-magic in DT ++ ++Buffalo uses a different TRX magic for every device, to be able to use ++this trx parser, make it possible to specify the TRX magic in device ++tree. If no TRX magic is specified in device tree, the standard value ++will be used. This value should only be specified if a vendor chooses to ++use a non standard TRX magic. ++ ++Signed-off-by: Hauke Mehrtens ++--- ++ .../bindings/mtd/partitions/brcm,trx.txt | 5 +++++ ++ drivers/mtd/parsers/parser_trx.c | 21 ++++++++++++++++++- ++ 2 files changed, 25 insertions(+), 1 deletion(-) ++ ++--- a/Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt +++++ b/Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt ++@@ -28,6 +28,11 @@ detected by a software parsing TRX heade ++ Required properties: ++ - compatible : (required) must be "brcm,trx" ++ +++Optional properties: +++ +++- trx-magic: TRX magic, if it is different from the default magic +++ 0x30524448 as a u32. +++ ++ Example: ++ ++ flash@0 { ++--- a/drivers/mtd/parsers/parser_trx.c +++++ b/drivers/mtd/parsers/parser_trx.c ++@@ -74,6 +74,24 @@ out_default: ++ return "rootfs"; ++ } ++ +++static uint32_t parser_trx_get_magic(struct mtd_info *mtd) +++{ +++ uint32_t trx_magic = TRX_MAGIC; +++ struct device_node *np; +++ int err; +++ +++ np = mtd_get_of_node(mtd); +++ if (!np) +++ return trx_magic; +++ +++ /* Get different magic from device tree if specified */ +++ err = of_property_read_u32(np, "trx-magic", &trx_magic); +++ if (err != 0 && err != -EINVAL) +++ pr_err("failed to parse \"trx-magic\" DT attribute, use default: %d\n", err); +++ +++ return trx_magic; +++} +++ ++ static int parser_trx_parse(struct mtd_info *mtd, ++ const struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data) ++@@ -83,6 +101,7 @@ static int parser_trx_parse(struct mtd_i ++ struct trx_header trx; ++ size_t bytes_read; ++ uint8_t curr_part = 0, i = 0; +++ uint32_t trx_magic = parser_trx_get_magic(mtd); ++ int err; ++ ++ parts = kcalloc(TRX_PARSER_MAX_PARTS, sizeof(struct mtd_partition), ++@@ -97,7 +116,7 @@ static int parser_trx_parse(struct mtd_i ++ return err; ++ } ++ ++- if (trx.magic != TRX_MAGIC) { +++ if (trx.magic != trx_magic) { ++ kfree(parts); ++ return -ENOENT; ++ } +diff --git a/target/linux/mediatek/patches-5.10/351-mtd-parsers-Remove-dependency-to-BRCM-architectures.patch b/target/linux/mediatek/patches-5.10/351-mtd-parsers-Remove-dependency-to-BRCM-architectures.patch +new file mode 100644 +index 0000000000..fa94c22304 +--- /dev/null ++++ b/target/linux/mediatek/patches-5.10/351-mtd-parsers-Remove-dependency-to-BRCM-architectures.patch +@@ -0,0 +1,23 @@ ++From 63f0cf88ab5461acb0911252f12bb94ee3bf05a2 Mon Sep 17 00:00:00 2001 ++From: Hauke Mehrtens ++Date: Sun, 7 Mar 2021 18:23:29 +0100 ++Subject: mtd: parsers: Remove dependency to BRCM architectures ++ ++Buffalo uses the TRX partition format also on Mediatek SoCs. ++ ++Signed-off-by: Hauke Mehrtens ++--- ++ drivers/mtd/parsers/Kconfig | 2 +- ++ 1 file changed, 1 insertion(+), 1 deletion(-) ++ ++--- a/drivers/mtd/parsers/Kconfig +++++ b/drivers/mtd/parsers/Kconfig ++@@ -131,7 +131,7 @@ config MTD_AFS_PARTS ++ ++ config MTD_PARSER_TRX ++ tristate "Parser for TRX format partitions" ++- depends on MTD && (BCM47XX || ARCH_BCM_5301X || COMPILE_TEST) +++ depends on MTD ++ help ++ TRX is a firmware format used by Broadcom on their devices. It ++ may contain up to 3/4 partitions (depending on the version). +diff --git a/target/linux/mediatek/patches-5.10/360-mtd-rawnand-mtk-Fix-WAITRDY-break-condition-and-time.patch b/target/linux/mediatek/patches-5.10/360-mtd-rawnand-mtk-Fix-WAITRDY-break-condition-and-time.patch +new file mode 100644 +index 0000000000..340e80f67b +--- /dev/null ++++ b/target/linux/mediatek/patches-5.10/360-mtd-rawnand-mtk-Fix-WAITRDY-break-condition-and-time.patch +@@ -0,0 +1,36 @@ ++From 4a4854761c9dedeedbf72c25d1317ab2e7600d4f Mon Sep 17 00:00:00 2001 ++From: Hauke Mehrtens ++Date: Mon, 8 Mar 2021 23:16:17 +0100 ++Subject: [PATCH] mtd: rawnand: mtk: Fix WAITRDY break condition and timeout ++ ++This fixes NAND_OP_WAITRDY_INSTR operation in the driver. Without this ++change the driver waits till the system is busy, but we should wait till ++the busy flag is cleared. The readl_poll_timeout() function gets a break ++condition, not a wait condition. ++ ++In addition fix the timeout. The timeout_ms is given in ms, but the ++readl_poll_timeout() function takes the timeout in us. Multiple the ++given timeout by 1000 to convert it. ++ ++Without this change, the driver does not work at all, it doesn't even ++identify the NAND chip. ++ ++Fixes: 5197360f9e09 ("mtd: rawnand: mtk: Convert the driver to exec_op()") ++Signed-off-by: Hauke Mehrtens ++--- ++ drivers/mtd/nand/raw/mtk_nand.c | 4 ++-- ++ 1 file changed, 2 insertions(+), 2 deletions(-) ++ ++--- a/drivers/mtd/nand/raw/mtk_nand.c +++++ b/drivers/mtd/nand/raw/mtk_nand.c ++@@ -488,8 +488,8 @@ static int mtk_nfc_exec_instr(struct nan ++ return 0; ++ case NAND_OP_WAITRDY_INSTR: ++ return readl_poll_timeout(nfc->regs + NFI_STA, status, ++- status & STA_BUSY, 20, ++- instr->ctx.waitrdy.timeout_ms); +++ !(status & STA_BUSY), 20, +++ instr->ctx.waitrdy.timeout_ms * 1000); ++ default: ++ break; ++ } +diff --git a/target/linux/mediatek/patches-5.10/400-crypto-add-eip97-inside-secure-support.patch b/target/linux/mediatek/patches-5.10/400-crypto-add-eip97-inside-secure-support.patch +new file mode 100644 +index 0000000000..e0941a9550 +--- /dev/null ++++ b/target/linux/mediatek/patches-5.10/400-crypto-add-eip97-inside-secure-support.patch +@@ -0,0 +1,27 @@ ++--- a/drivers/crypto/inside-secure/safexcel.c +++++ b/drivers/crypto/inside-secure/safexcel.c ++@@ -600,6 +600,14 @@ static int safexcel_hw_init(struct safex ++ val |= EIP197_MST_CTRL_TX_MAX_CMD(5); ++ writel(val, EIP197_HIA_AIC(priv) + EIP197_HIA_MST_CTRL); ++ } +++ /* +++ * Set maximum number of TX commands to 2^4 = 16 for EIP97 HW2.1/HW2.3 +++ */ +++ else { +++ val = 0; +++ val |= EIP97_MST_CTRL_TX_MAX_CMD(4); +++ writel(val, EIP197_HIA_AIC(priv) + EIP197_HIA_MST_CTRL); +++ } ++ ++ /* Configure wr/rd cache values */ ++ writel(EIP197_MST_CTRL_RD_CACHE(RD_CACHE_4BITS) | ++--- a/drivers/crypto/inside-secure/safexcel.h +++++ b/drivers/crypto/inside-secure/safexcel.h ++@@ -314,6 +314,7 @@ ++ #define EIP197_MST_CTRL_RD_CACHE(n) (((n) & 0xf) << 0) ++ #define EIP197_MST_CTRL_WD_CACHE(n) (((n) & 0xf) << 4) ++ #define EIP197_MST_CTRL_TX_MAX_CMD(n) (((n) & 0xf) << 20) +++#define EIP97_MST_CTRL_TX_MAX_CMD(n) (((n) & 0xf) << 4) ++ #define EIP197_MST_CTRL_BYTE_SWAP BIT(24) ++ #define EIP197_MST_CTRL_NO_BYTE_SWAP BIT(25) ++ #define EIP197_MST_CTRL_BYTE_SWAP_BITS GENMASK(25, 24) +diff --git a/target/linux/mediatek/patches-5.10/401-crypto-fix-eip97-cache-incoherent.patch b/target/linux/mediatek/patches-5.10/401-crypto-fix-eip97-cache-incoherent.patch +new file mode 100644 +index 0000000000..be2bffb749 +--- /dev/null ++++ b/target/linux/mediatek/patches-5.10/401-crypto-fix-eip97-cache-incoherent.patch +@@ -0,0 +1,26 @@ ++--- a/drivers/crypto/inside-secure/safexcel.h +++++ b/drivers/crypto/inside-secure/safexcel.h ++@@ -736,6 +736,9 @@ enum safexcel_eip_version { ++ /* Priority we use for advertising our algorithms */ ++ #define SAFEXCEL_CRA_PRIORITY 300 ++ +++/* System cache line size */ +++#define SYSTEM_CACHELINE_SIZE 64 +++ ++ /* SM3 digest result for zero length message */ ++ #define EIP197_SM3_ZEROM_HASH "\x1A\xB2\x1D\x83\x55\xCF\xA1\x7F" \ ++ "\x8E\x61\x19\x48\x31\xE8\x1A\x8F" \ ++--- a/drivers/crypto/inside-secure/safexcel_hash.c +++++ b/drivers/crypto/inside-secure/safexcel_hash.c ++@@ -53,9 +53,9 @@ struct safexcel_ahash_req { ++ u8 block_sz; /* block size, only set once */ ++ u8 digest_sz; /* output digest size, only set once */ ++ __le32 state[SHA3_512_BLOCK_SIZE / ++- sizeof(__le32)] __aligned(sizeof(__le32)); +++ sizeof(__le32)] __aligned(SYSTEM_CACHELINE_SIZE); ++ ++- u64 len; +++ u64 len __aligned(SYSTEM_CACHELINE_SIZE); ++ u64 processed; ++ ++ u8 cache[HASH_CACHE_SIZE] __aligned(sizeof(u32)); +diff --git a/target/linux/mediatek/patches-5.10/410-bt-mtk-serial-fix.patch b/target/linux/mediatek/patches-5.10/410-bt-mtk-serial-fix.patch +new file mode 100644 +index 0000000000..2e474dd5fe +--- /dev/null ++++ b/target/linux/mediatek/patches-5.10/410-bt-mtk-serial-fix.patch +@@ -0,0 +1,33 @@ ++--- a/drivers/tty/serial/8250/8250.h +++++ b/drivers/tty/serial/8250/8250.h ++@@ -82,6 +82,7 @@ struct serial8250_config { ++ #define UART_CAP_MINI (1 << 17) /* Mini UART on BCM283X family lacks: ++ * STOP PARITY EPAR SPAR WLEN5 WLEN6 ++ */ +++#define UART_CAP_NMOD (1 << 18) /* UART doesn't do termios */ ++ ++ #define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */ ++ #define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */ ++--- a/drivers/tty/serial/8250/8250_port.c +++++ b/drivers/tty/serial/8250/8250_port.c ++@@ -287,7 +287,7 @@ static const struct serial8250_config ua ++ .tx_loadsz = 16, ++ .fcr = UART_FCR_ENABLE_FIFO | ++ UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT, ++- .flags = UART_CAP_FIFO, +++ .flags = UART_CAP_FIFO | UART_CAP_NMOD, ++ }, ++ [PORT_NPCM] = { ++ .name = "Nuvoton 16550", ++@@ -2687,6 +2687,11 @@ serial8250_do_set_termios(struct uart_po ++ unsigned long flags; ++ unsigned int baud, quot, frac = 0; ++ +++ if (up->capabilities & UART_CAP_NMOD) { +++ termios->c_cflag = 0; +++ return; +++ } +++ ++ if (up->capabilities & UART_CAP_MINI) { ++ termios->c_cflag &= ~(CSTOPB | PARENB | PARODD | CMSPAR); ++ if ((termios->c_cflag & CSIZE) == CS5 || +diff --git a/target/linux/mediatek/patches-5.10/420-mtd-spi-nor-add-support-for-Winbond-W25Q512JV.patch b/target/linux/mediatek/patches-5.10/420-mtd-spi-nor-add-support-for-Winbond-W25Q512JV.patch +new file mode 100644 +index 0000000000..f8527ba424 +--- /dev/null ++++ b/target/linux/mediatek/patches-5.10/420-mtd-spi-nor-add-support-for-Winbond-W25Q512JV.patch +@@ -0,0 +1,28 @@ ++From: David Bauer ++To: linux-mtd@lists.infradead.org ++Subject: [PATCH] mtd: spi-nor: add support for Winbond W25Q512JV ++Date: Sat, 13 Feb 2021 16:10:47 +0100 ++ ++The Winbond W25Q512JV is a 512mb SPI-NOR chip. It supports 4K ++sectors as well as block protection and Dual-/Quad-read. ++ ++Tested on: Ubiquiti UniFi 6 LR ++ ++Signed-off-by: David Bauer ++--- ++ drivers/mtd/spi-nor/winbond.c | 4 ++++ ++ 1 file changed, 4 insertions(+) ++ ++--- a/drivers/mtd/spi-nor/winbond.c +++++ b/drivers/mtd/spi-nor/winbond.c ++@@ -95,6 +95,10 @@ static const struct flash_info winbond_p ++ SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, ++ { "w25q256jw", INFO(0xef6019, 0, 64 * 1024, 512, ++ SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, +++ { "w25q512jv", INFO(0xef4020, 0, 64 * 1024, 1024, +++ SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_DUAL_READ | +++ SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | +++ SPI_NOR_HAS_LOCK | SPI_NOR_4BIT_BP) }, ++ { "w25m512jv", INFO(0xef7119, 0, 64 * 1024, 1024, ++ SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_DUAL_READ) }, ++ }; +diff --git a/target/linux/mediatek/patches-5.10/500-gsw-rtl8367s-mt7622-support.patch b/target/linux/mediatek/patches-5.10/500-gsw-rtl8367s-mt7622-support.patch +new file mode 100644 +index 0000000000..bdd482def3 +--- /dev/null ++++ b/target/linux/mediatek/patches-5.10/500-gsw-rtl8367s-mt7622-support.patch +@@ -0,0 +1,25 @@ ++--- a/drivers/net/phy/Kconfig +++++ b/drivers/net/phy/Kconfig ++@@ -334,6 +334,12 @@ config ROCKCHIP_PHY ++ help ++ Currently supports the integrated Ethernet PHY. ++ +++config RTL8367S_GSW +++ tristate "rtl8367 Gigabit Switch support for mt7622" +++ depends on NET_VENDOR_MEDIATEK +++ help +++ This driver supports rtl8367s in mt7622 +++ ++ config SMSC_PHY ++ tristate "SMSC PHYs" ++ help ++--- a/drivers/net/phy/Makefile +++++ b/drivers/net/phy/Makefile ++@@ -88,6 +88,7 @@ obj-$(CONFIG_QSEMI_PHY) += qsemi.o ++ obj-$(CONFIG_REALTEK_PHY) += realtek.o ++ obj-$(CONFIG_RENESAS_PHY) += uPD60620.o ++ obj-$(CONFIG_ROCKCHIP_PHY) += rockchip.o +++obj-$(CONFIG_RTL8367S_GSW) += rtk/ ++ obj-$(CONFIG_SMSC_PHY) += smsc.o ++ obj-$(CONFIG_STE10XP) += ste10Xp.o ++ obj-$(CONFIG_TERANETICS_PHY) += teranetics.o +diff --git a/target/linux/mediatek/patches-5.10/600-dt-bindings-PCI-Mediatek-Update-PCIe-binding.patch b/target/linux/mediatek/patches-5.10/600-dt-bindings-PCI-Mediatek-Update-PCIe-binding.patch +new file mode 100644 +index 0000000000..02e4c130ea +--- /dev/null ++++ b/target/linux/mediatek/patches-5.10/600-dt-bindings-PCI-Mediatek-Update-PCIe-binding.patch +@@ -0,0 +1,415 @@ ++From patchwork Thu May 28 06:16:45 2020 ++Content-Type: text/plain; charset="utf-8" ++MIME-Version: 1.0 ++Content-Transfer-Encoding: 7bit ++X-Patchwork-Submitter: Chuanjia Liu ++X-Patchwork-Id: 11574793 ++Return-Path: ++ ++Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org ++ [172.30.200.123]) ++ by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 391201392 ++ for ; ++ Thu, 28 May 2020 06:20:27 +0000 (UTC) ++Received: from bombadil.infradead.org (bombadil.infradead.org ++ [198.137.202.133]) ++ (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) ++ (No client certificate requested) ++ by mail.kernel.org (Postfix) with ESMTPS id 104F620657 ++ for ; ++ Thu, 28 May 2020 06:20:27 +0000 (UTC) ++Authentication-Results: mail.kernel.org; ++ dkim=pass (2048-bit key) header.d=lists.infradead.org ++ header.i=@lists.infradead.org header.b="raZHaWxs"; ++ dkim=fail reason="signature verification failed" (1024-bit key) ++ header.d=mediatek.com header.i=@mediatek.com header.b="YztrByG/" ++DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 104F620657 ++Authentication-Results: mail.kernel.org; ++ dmarc=fail (p=none dis=none) header.from=mediatek.com ++Authentication-Results: mail.kernel.org; ++ spf=none ++ smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org ++DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; ++ d=lists.infradead.org; s=bombadil.20170209; h=Sender: ++ Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: ++ List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: ++ Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: ++ Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: ++ List-Owner; bh=aVtKU+Ey8KEM97+S66fz9ZMo+H8BP570jhAAvaRsNWc=; b=raZHaWxsfCxsrd ++ Byn/w1oLN/J82ApnNdBBXixq9Qj0uXIU2tBVqkiQ9lG6QDk7uguxQSJLeTqrsI/uxQmCI/PGQtZdP ++ sH0oboi2sbQSqJ/1ud4uL2pPaiLRJCxINF5oWjoZMsjn/b2fWvn52P6vTr/dxDTaabiVhY0HL0J+X ++ 7YGc1aYtO76HZHE2ke3puR42QkI8hE9E2cEhiLWeuUiLdUBegNM5MdYftu4nJTcCXnAeJjp/wIpYG ++ 7X737N9cmanDf6Bxr2bNPgaYzH+m7JK6eGxuAvWo0+PE9OX7MLrXY3KjixcjD/b0he0mfEM++gBAq ++ KBYKl5wh1mnlR2WIWXew==; ++Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) ++ by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) ++ id 1jeBtx-0005JC-DJ; Thu, 28 May 2020 06:20:25 +0000 ++Received: from mailgw01.mediatek.com ([216.200.240.184]) ++ by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) ++ id 1jeBtW-0002f2-75; Thu, 28 May 2020 06:20:01 +0000 ++X-UUID: d5cb6d96c2a5421796c2f8a284ff3670-20200527 ++DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; ++ d=mediatek.com; ++ s=dk; ++ h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; ++ bh=EqjC+5cHgv6eykN7FPf2mtwK9UivJ3XSCE0jEvb8h+8=; ++ b=YztrByG/Ia304l9KDPBwoHFYkFCN6qBXPqwZgg56CA9VitadAg2+K1VgfEU+oHqsqcsGAMdZTRMQh17tpm4bJParw6MMzAQ28te2TcxvQMV8PZMkerJdZyyYblI7ybauPWuofAQgQMtuwSKVii8eTRJbf99OZ9vDGJP3zo2j1wU=; ++X-UUID: d5cb6d96c2a5421796c2f8a284ff3670-20200527 ++Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by ++ mailgw01.mediatek.com ++ (envelope-from ) ++ (musrelay.mediatek.com ESMTP with TLS) ++ with ESMTP id 681958707; Wed, 27 May 2020 22:20:16 -0800 ++Received: from MTKMBS07N2.mediatek.inc (172.21.101.141) by ++ MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id ++ 15.0.1497.2; Wed, 27 May 2020 23:18:52 -0700 ++Received: from mtkcas07.mediatek.inc (172.21.101.84) by ++ mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id ++ 15.0.1497.2; Thu, 28 May 2020 14:18:49 +0800 ++Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc ++ (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend ++ Transport; Thu, 28 May 2020 14:18:47 +0800 ++From: ++To: , , ++Subject: [PATCH v2 1/4] dt-bindings: PCI: Mediatek: Update PCIe binding ++Date: Thu, 28 May 2020 14:16:45 +0800 ++Message-ID: <20200528061648.32078-2-chuanjia.liu@mediatek.com> ++X-Mailer: git-send-email 2.18.0 ++In-Reply-To: <20200528061648.32078-1-chuanjia.liu@mediatek.com> ++References: <20200528061648.32078-1-chuanjia.liu@mediatek.com> ++MIME-Version: 1.0 ++X-MTK: N ++X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ++X-CRM114-CacheID: sfid-20200527_231958_261064_608CC03E ++X-CRM114-Status: GOOD ( 13.95 ) ++X-Spam-Score: -0.2 (/) ++X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: ++ Content analysis details: (-0.2 points) ++ pts rule name description ++ ---- ---------------------- ++ -------------------------------------------------- ++ -0.0 SPF_PASS SPF: sender matches SPF record ++ 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record ++ 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 ++ encoding ++ -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from ++ author's domain ++ 0.1 DKIM_SIGNED Message has a DKIM or DK signature, ++ not necessarily ++ valid ++ -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature ++ -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from ++ envelope-from domain ++ 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay ++ lines ++X-BeenThere: linux-mediatek@lists.infradead.org ++X-Mailman-Version: 2.1.29 ++Precedence: list ++List-Id: ++List-Unsubscribe: , ++ ++List-Archive: ++List-Post: ++List-Help: ++List-Subscribe: , ++ ++Cc: devicetree@vger.kernel.org, lorenzo.pieralisi@arm.com, ++ srv_heupstream@mediatek.com, "chuanjia.liu" , ++ linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, ++ jianjun.wang@mediatek.com, linux-mediatek@lists.infradead.org, ++ yong.wu@mediatek.com, bhelgaas@google.com, ++ linux-arm-kernel@lists.infradead.org, amurray@thegoodpenguin.co.uk ++Sender: "Linux-mediatek" ++Errors-To: ++ linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org ++ ++From: "chuanjia.liu" ++ ++There are two independent PCIe controllers in MT2712/MT7622 platform, ++and each of them should contain an independent MSI domain. ++ ++In current architecture, MSI domain will be inherited from the root ++bridge, and all of the devices will share the same MSI domain. ++Hence that, the PCIe devices will not work properly if the irq number ++which required is more than 32. ++ ++Split the PCIe node for MT2712/MT7622 platform to fix MSI issue and ++comply with the hardware design. ++ ++Signed-off-by: chuanjia.liu ++--- ++ .../bindings/pci/mediatek-pcie-cfg.yaml | 38 +++++ ++ .../devicetree/bindings/pci/mediatek-pcie.txt | 144 +++++++++++------- ++ 2 files changed, 129 insertions(+), 53 deletions(-) ++ create mode 100644 Documentation/devicetree/bindings/pci/mediatek-pcie-cfg.yaml ++ ++--- /dev/null +++++ b/Documentation/devicetree/bindings/pci/mediatek-pcie-cfg.yaml ++@@ -0,0 +1,38 @@ +++# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +++%YAML 1.2 +++--- +++$id: http://devicetree.org/schemas/pci/mediatek-pcie-cfg.yaml# +++$schema: http://devicetree.org/meta-schemas/core.yaml# +++ +++title: Mediatek PCIECFG controller +++ +++maintainers: +++ - Chuanjia Liu +++ - Jianjun Wang +++ +++description: | +++ The MediaTek PCIECFG controller controls some feature about +++ LTSSM, ASPM and so on. +++ +++properties: +++ compatible: +++ items: +++ - enum: +++ - mediatek,mt7622-pciecfg +++ - mediatek,mt7629-pciecfg +++ - const: syscon +++ +++ reg: +++ maxItems: 1 +++ +++required: +++ - compatible +++ - reg +++ +++examples: +++ - | +++ pciecfg: pciecfg@1a140000 { +++ compatible = "mediatek,mt7622-pciecfg", "syscon"; +++ reg = <0 0x1a140000 0 0x1000>; +++ }; +++... ++--- a/Documentation/devicetree/bindings/pci/mediatek-pcie.txt +++++ b/Documentation/devicetree/bindings/pci/mediatek-pcie.txt ++@@ -8,7 +8,7 @@ Required properties: ++ "mediatek,mt7623-pcie" ++ "mediatek,mt7629-pcie" ++ - device_type: Must be "pci" ++-- reg: Base addresses and lengths of the PCIe subsys and root ports. +++- reg: Base addresses and lengths of the root ports. ++ - reg-names: Names of the above areas to use during resource lookup. ++ - #address-cells: Address representation for root ports (must be 3) ++ - #size-cells: Size representation for root ports (must be 2) ++@@ -19,10 +19,10 @@ Required properties: ++ - sys_ckN :transaction layer and data link layer clock ++ Required entries for MT2701/MT7623: ++ - free_ck :for reference clock of PCIe subsys ++- Required entries for MT2712/MT7622: +++ Required entries for MT2712/MT7622/MT7629: ++ - ahb_ckN :AHB slave interface operating clock for CSR access and RC ++ initiated MMIO access ++- Required entries for MT7622: +++ Required entries for MT7622/MT7629: ++ - axi_ckN :application layer MMIO channel operating clock ++ - aux_ckN :pe2_mac_bridge and pe2_mac_core operating clock when ++ pcie_mac_ck/pcie_pipe_ck is turned off ++@@ -47,10 +47,13 @@ Required properties for MT7623/MT2701: ++ - reset-names: Must be "pcie-rst0", "pcie-rst1", "pcie-rstN".. based on the ++ number of root ports. ++ ++-Required properties for MT2712/MT7622: +++Required properties for MT2712/MT7622/MT7629: ++ -interrupts: A list of interrupt outputs of the controller, must have one ++ entry for each PCIe port ++ +++Required properties for MT7622/MT7629: +++- mediatek,pcie-subsys: Should be a phandle of the pciecfg node. +++ ++ In addition, the device tree node must have sub-nodes describing each ++ PCIe port interface, having the following mandatory properties: ++ ++@@ -143,56 +146,73 @@ Examples for MT7623: ++ ++ Examples for MT2712: ++ ++- pcie: pcie@11700000 { +++ pcie1: pcie@112ff000 { ++ compatible = "mediatek,mt2712-pcie"; ++ device_type = "pci"; ++- reg = <0 0x11700000 0 0x1000>, ++- <0 0x112ff000 0 0x1000>; ++- reg-names = "port0", "port1"; +++ reg = <0 0x112ff000 0 0x1000>; +++ reg-names = "port1"; ++ #address-cells = <3>; ++ #size-cells = <2>; ++- interrupts = , ++- ; ++- clocks = <&topckgen CLK_TOP_PE2_MAC_P0_SEL>, ++- <&topckgen CLK_TOP_PE2_MAC_P1_SEL>, ++- <&pericfg CLK_PERI_PCIE0>, +++ interrupts = ; +++ interrupt-names = "pcie_irq"; +++ clocks = <&topckgen CLK_TOP_PE2_MAC_P1_SEL>, ++ <&pericfg CLK_PERI_PCIE1>; ++- clock-names = "sys_ck0", "sys_ck1", "ahb_ck0", "ahb_ck1"; ++- phys = <&pcie0_phy PHY_TYPE_PCIE>, <&pcie1_phy PHY_TYPE_PCIE>; ++- phy-names = "pcie-phy0", "pcie-phy1"; +++ clock-names = "sys_ck1", "ahb_ck1"; +++ phys = <&u3port1 PHY_TYPE_PCIE>; +++ phy-names = "pcie-phy1"; ++ bus-range = <0x00 0xff>; ++- ranges = <0x82000000 0 0x20000000 0x0 0x20000000 0 0x10000000>; +++ ranges = <0x82000000 0 0x11400000 0x0 0x11400000 0 0x300000>; +++ status = "disabled"; ++ ++- pcie0: pcie@0,0 { ++- reg = <0x0000 0 0 0 0>; +++ slot1: pcie@1,0 { +++ reg = <0x0800 0 0 0 0>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ #interrupt-cells = <1>; ++ ranges; ++ interrupt-map-mask = <0 0 0 7>; ++- interrupt-map = <0 0 0 1 &pcie_intc0 0>, ++- <0 0 0 2 &pcie_intc0 1>, ++- <0 0 0 3 &pcie_intc0 2>, ++- <0 0 0 4 &pcie_intc0 3>; ++- pcie_intc0: interrupt-controller { +++ interrupt-map = <0 0 0 1 &pcie_intc1 0>, +++ <0 0 0 2 &pcie_intc1 1>, +++ <0 0 0 3 &pcie_intc1 2>, +++ <0 0 0 4 &pcie_intc1 3>; +++ pcie_intc1: interrupt-controller { ++ interrupt-controller; ++ #address-cells = <0>; ++ #interrupt-cells = <1>; ++ }; ++ }; +++ }; ++ ++- pcie1: pcie@1,0 { ++- reg = <0x0800 0 0 0 0>; +++ pcie0: pcie@11700000 { +++ compatible = "mediatek,mt2712-pcie"; +++ device_type = "pci"; +++ reg = <0 0x11700000 0 0x1000>; +++ reg-names = "port0"; +++ #address-cells = <3>; +++ #size-cells = <2>; +++ interrupts = ; +++ interrupt-names = "pcie_irq"; +++ clocks = <&topckgen CLK_TOP_PE2_MAC_P0_SEL>, +++ <&pericfg CLK_PERI_PCIE0>; +++ clock-names = "sys_ck0", "ahb_ck0"; +++ phys = <&u3port0 PHY_TYPE_PCIE>; +++ phy-names = "pcie-phy0"; +++ bus-range = <0x00 0xff>; +++ ranges = <0x82000000 0 0x20000000 0x0 0x20000000 0 0x10000000>; +++ status = "disabled"; +++ +++ slot0: pcie@0,0 { +++ reg = <0x0000 0 0 0 0>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ #interrupt-cells = <1>; ++ ranges; ++ interrupt-map-mask = <0 0 0 7>; ++- interrupt-map = <0 0 0 1 &pcie_intc1 0>, ++- <0 0 0 2 &pcie_intc1 1>, ++- <0 0 0 3 &pcie_intc1 2>, ++- <0 0 0 4 &pcie_intc1 3>; ++- pcie_intc1: interrupt-controller { +++ interrupt-map = <0 0 0 1 &pcie_intc0 0>, +++ <0 0 0 2 &pcie_intc0 1>, +++ <0 0 0 3 &pcie_intc0 2>, +++ <0 0 0 4 &pcie_intc0 3>; +++ pcie_intc0: interrupt-controller { ++ interrupt-controller; ++ #address-cells = <0>; ++ #interrupt-cells = <1>; ++@@ -202,39 +222,31 @@ Examples for MT2712: ++ ++ Examples for MT7622: ++ ++- pcie: pcie@1a140000 { +++ pcie0: pcie@1a143000 { ++ compatible = "mediatek,mt7622-pcie"; ++ device_type = "pci"; ++- reg = <0 0x1a140000 0 0x1000>, ++- <0 0x1a143000 0 0x1000>, ++- <0 0x1a145000 0 0x1000>; ++- reg-names = "subsys", "port0", "port1"; +++ reg = <0 0x1a143000 0 0x1000>; +++ reg-names = "port0"; +++ mediatek,pcie-cfg = <&pciecfg>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++- interrupts = , ++- ; +++ interrupts = ; +++ interrupt-names = "pcie_irq"; ++ clocks = <&pciesys CLK_PCIE_P0_MAC_EN>, ++- <&pciesys CLK_PCIE_P1_MAC_EN>, ++ <&pciesys CLK_PCIE_P0_AHB_EN>, ++- <&pciesys CLK_PCIE_P1_AHB_EN>, ++ <&pciesys CLK_PCIE_P0_AUX_EN>, ++- <&pciesys CLK_PCIE_P1_AUX_EN>, ++ <&pciesys CLK_PCIE_P0_AXI_EN>, ++- <&pciesys CLK_PCIE_P1_AXI_EN>, ++ <&pciesys CLK_PCIE_P0_OBFF_EN>, ++- <&pciesys CLK_PCIE_P1_OBFF_EN>, ++- <&pciesys CLK_PCIE_P0_PIPE_EN>, ++- <&pciesys CLK_PCIE_P1_PIPE_EN>; ++- clock-names = "sys_ck0", "sys_ck1", "ahb_ck0", "ahb_ck1", ++- "aux_ck0", "aux_ck1", "axi_ck0", "axi_ck1", ++- "obff_ck0", "obff_ck1", "pipe_ck0", "pipe_ck1"; ++- phys = <&pcie0_phy PHY_TYPE_PCIE>, <&pcie1_phy PHY_TYPE_PCIE>; ++- phy-names = "pcie-phy0", "pcie-phy1"; +++ <&pciesys CLK_PCIE_P0_PIPE_EN>; +++ clock-names = "sys_ck0", "ahb_ck0", "aux_ck0", +++ "axi_ck0", "obff_ck0", "pipe_ck0"; +++ ++ power-domains = <&scpsys MT7622_POWER_DOMAIN_HIF0>; ++ bus-range = <0x00 0xff>; ++- ranges = <0x82000000 0 0x20000000 0x0 0x20000000 0 0x10000000>; +++ ranges = <0x82000000 0 0x20000000 0 0x20000000 0 0x8000000>; +++ status = "disabled"; ++ ++- pcie0: pcie@0,0 { +++ slot0: pcie@0,0 { ++ reg = <0x0000 0 0 0 0>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++@@ -251,8 +263,34 @@ Examples for MT7622: ++ #interrupt-cells = <1>; ++ }; ++ }; +++ }; +++ +++ pcie1: pcie@1a145000 { +++ compatible = "mediatek,mt7622-pcie"; +++ device_type = "pci"; +++ reg = <0 0x1a145000 0 0x1000>; +++ reg-names = "port1"; +++ mediatek,pcie-cfg = <&pciecfg>; +++ #address-cells = <3>; +++ #size-cells = <2>; +++ interrupts = ; +++ interrupt-names = "pcie_irq"; +++ clocks = <&pciesys CLK_PCIE_P1_MAC_EN>, +++ /* designer has connect RC1 with p0_ahb clock */ +++ <&pciesys CLK_PCIE_P0_AHB_EN>, +++ <&pciesys CLK_PCIE_P1_AUX_EN>, +++ <&pciesys CLK_PCIE_P1_AXI_EN>, +++ <&pciesys CLK_PCIE_P1_OBFF_EN>, +++ <&pciesys CLK_PCIE_P1_PIPE_EN>; +++ clock-names = "sys_ck1", "ahb_ck1", "aux_ck1", +++ "axi_ck1", "obff_ck1", "pipe_ck1"; +++ +++ power-domains = <&scpsys MT7622_POWER_DOMAIN_HIF0>; +++ bus-range = <0x00 0xff>; +++ ranges = <0x82000000 0 0x28000000 0 0x28000000 0 0x8000000>; +++ status = "disabled"; ++ ++- pcie1: pcie@1,0 { +++ slot1: pcie@1,0 { ++ reg = <0x0800 0 0 0 0>; ++ #address-cells = <3>; ++ #size-cells = <2>; +diff --git a/target/linux/mediatek/patches-5.10/601-PCI-mediatek-Use-regmap-to-get-shared-pcie-cfg-base.patch b/target/linux/mediatek/patches-5.10/601-PCI-mediatek-Use-regmap-to-get-shared-pcie-cfg-base.patch +new file mode 100644 +index 0000000000..9c18565319 +--- /dev/null ++++ b/target/linux/mediatek/patches-5.10/601-PCI-mediatek-Use-regmap-to-get-shared-pcie-cfg-base.patch +@@ -0,0 +1,217 @@ ++From patchwork Thu May 28 06:16:46 2020 ++Content-Type: text/plain; charset="utf-8" ++MIME-Version: 1.0 ++Content-Transfer-Encoding: 7bit ++X-Patchwork-Submitter: Chuanjia Liu ++X-Patchwork-Id: 11574781 ++Return-Path: ++ ++Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org ++ [172.30.200.123]) ++ by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0A99B60D ++ for ; ++ Thu, 28 May 2020 06:19:04 +0000 (UTC) ++Received: from bombadil.infradead.org (bombadil.infradead.org ++ [198.137.202.133]) ++ (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) ++ (No client certificate requested) ++ by mail.kernel.org (Postfix) with ESMTPS id DCC99208FE ++ for ; ++ Thu, 28 May 2020 06:19:03 +0000 (UTC) ++Authentication-Results: mail.kernel.org; ++ dkim=pass (2048-bit key) header.d=lists.infradead.org ++ header.i=@lists.infradead.org header.b="SpOi0ueF"; ++ dkim=fail reason="signature verification failed" (1024-bit key) ++ header.d=mediatek.com header.i=@mediatek.com header.b="UGIBoIEG" ++DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DCC99208FE ++Authentication-Results: mail.kernel.org; ++ dmarc=fail (p=none dis=none) header.from=mediatek.com ++Authentication-Results: mail.kernel.org; ++ spf=none ++ smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org ++DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; ++ d=lists.infradead.org; s=bombadil.20170209; h=Sender: ++ Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: ++ List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: ++ Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: ++ Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: ++ List-Owner; bh=LIr5poLUT/UdH6/akh/pnICGGa3rUBkN+4FhE1DyOrU=; b=SpOi0ueFcoJ/ka ++ 4esa6cDd5oU4fp0z684ZVPaVvvhm/azSZBBMYinHaAW6EvzKcMNYIX9grP8eg/728lEPNTKVq0I8H ++ PQZ9KvD4uTu8Opo1hD8LsRSLr+YLpNKt3KPOY/4gpwQ97uU9rI5PwkuAxPBgR949Vh5EiG0Vaww1H ++ Ep+I5BFRn2LVVQZP1Z7U0A0VUcOTLJ4znoWRLEXxtM9/Wd4hwQsrEPQszeDFti/RbwGfJ5efOb5UL ++ fhwBzSxELEzAAgH7env/XD2sSSpVf2Qsn6WO8D3ZepMtWrRtARiaRKSNxSBQTg2SSHcjmBSJSzcX+ ++ w8wqWaUMs0crlBuZWS1g==; ++Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) ++ by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) ++ id 1jeBsc-0001tI-88; Thu, 28 May 2020 06:19:02 +0000 ++Received: from mailgw01.mediatek.com ([216.200.240.184]) ++ by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) ++ id 1jeBsZ-0001rp-6g; Thu, 28 May 2020 06:19:01 +0000 ++X-UUID: beeaf5765357439c91eab1f67ca7ef43-20200527 ++DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; ++ d=mediatek.com; ++ s=dk; ++ h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; ++ bh=+IjWjsF/DhknqZB+lLSZ50cyvxDap+8w4tvqhp8Dv68=; ++ b=UGIBoIEGJUuq5pEvYEad1HVGpiv6yma+94hva83D2gD8lYmihRWkpJxB2yn+dVtNm7ZXXoQBf+jvvULOmslJgs1HZTLJTnjpdvLmQqo42OXRXSVpTE49HdRkJZDAIWIAReBfOEkFgNxcIX3uedrtnww/NLJ2lagrYPG5ET4lI2E=; ++X-UUID: beeaf5765357439c91eab1f67ca7ef43-20200527 ++Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw01.mediatek.com ++ (envelope-from ) ++ (musrelay.mediatek.com ESMTP with TLS) ++ with ESMTP id 603406343; Wed, 27 May 2020 22:19:17 -0800 ++Received: from mtkmbs07n1.mediatek.inc (172.21.101.16) by ++ MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id ++ 15.0.1497.2; Wed, 27 May 2020 23:18:47 -0700 ++Received: from mtkcas07.mediatek.inc (172.21.101.84) by ++ mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id ++ 15.0.1497.2; Thu, 28 May 2020 14:18:51 +0800 ++Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc ++ (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend ++ Transport; Thu, 28 May 2020 14:18:49 +0800 ++From: ++To: , , ++Subject: [PATCH v2 2/4] PCI: mediatek: Use regmap to get shared pcie-cfg base ++Date: Thu, 28 May 2020 14:16:46 +0800 ++Message-ID: <20200528061648.32078-3-chuanjia.liu@mediatek.com> ++X-Mailer: git-send-email 2.18.0 ++In-Reply-To: <20200528061648.32078-1-chuanjia.liu@mediatek.com> ++References: <20200528061648.32078-1-chuanjia.liu@mediatek.com> ++MIME-Version: 1.0 ++X-MTK: N ++X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ++X-CRM114-CacheID: sfid-20200527_231859_251275_BED2B1E2 ++X-CRM114-Status: GOOD ( 11.62 ) ++X-Spam-Score: -0.2 (/) ++X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: ++ Content analysis details: (-0.2 points) ++ pts rule name description ++ ---- ---------------------- ++ -------------------------------------------------- ++ -0.0 SPF_PASS SPF: sender matches SPF record ++ 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record ++ 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 ++ encoding ++ -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from ++ author's domain ++ 0.1 DKIM_SIGNED Message has a DKIM or DK signature, ++ not necessarily ++ valid ++ -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature ++ -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from ++ envelope-from domain ++ 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay ++ lines ++X-BeenThere: linux-mediatek@lists.infradead.org ++X-Mailman-Version: 2.1.29 ++Precedence: list ++List-Id: ++List-Unsubscribe: , ++ ++List-Archive: ++List-Post: ++List-Help: ++List-Subscribe: , ++ ++Cc: devicetree@vger.kernel.org, lorenzo.pieralisi@arm.com, ++ srv_heupstream@mediatek.com, "chuanjia.liu" , ++ linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, ++ jianjun.wang@mediatek.com, linux-mediatek@lists.infradead.org, ++ yong.wu@mediatek.com, bhelgaas@google.com, ++ linux-arm-kernel@lists.infradead.org, amurray@thegoodpenguin.co.uk ++Sender: "Linux-mediatek" ++Errors-To: ++ linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org ++ ++From: "chuanjia.liu" ++ ++Use regmap to get shared pcie-cfg base and change ++the method to get pcie irq. ++ ++Signed-off-by: chuanjia.liu ++--- ++ drivers/pci/controller/pcie-mediatek.c | 25 ++++++++++++++++++------- ++ 1 file changed, 18 insertions(+), 7 deletions(-) ++ ++--- a/drivers/pci/controller/pcie-mediatek.c +++++ b/drivers/pci/controller/pcie-mediatek.c ++@@ -14,6 +14,7 @@ ++ #include ++ #include ++ #include +++#include ++ #include ++ #include ++ #include ++@@ -23,6 +24,7 @@ ++ #include ++ #include ++ #include +++#include ++ #include ++ ++ #include "../pci.h" ++@@ -205,6 +207,7 @@ struct mtk_pcie_port { ++ * struct mtk_pcie - PCIe host information ++ * @dev: pointer to PCIe device ++ * @base: IO mapped register base +++ * @cfg: IO mapped register map for PCIe config ++ * @free_ck: free-run reference clock ++ * @mem: non-prefetchable memory resource ++ * @ports: pointer to PCIe port information ++@@ -213,6 +216,7 @@ struct mtk_pcie_port { ++ struct mtk_pcie { ++ struct device *dev; ++ void __iomem *base; +++ struct regmap *cfg; ++ struct clk *free_ck; ++ ++ struct list_head ports; ++@@ -648,7 +652,7 @@ static int mtk_pcie_setup_irq(struct mtk ++ return err; ++ } ++ ++- port->irq = platform_get_irq(pdev, port->slot); +++ port->irq = platform_get_irq_byname(pdev, "pcie_irq"); ++ if (port->irq < 0) ++ return port->irq; ++ ++@@ -674,12 +678,11 @@ static int mtk_pcie_startup_port_v2(stru ++ if (!mem) ++ return -EINVAL; ++ ++- /* MT7622 platforms need to enable LTSSM and ASPM from PCIe subsys */ ++- if (pcie->base) { ++- val = readl(pcie->base + PCIE_SYS_CFG_V2); ++- val |= PCIE_CSR_LTSSM_EN(port->slot) | ++- PCIE_CSR_ASPM_L1_EN(port->slot); ++- writel(val, pcie->base + PCIE_SYS_CFG_V2); +++ /* MT7622/MT7629 platforms need to enable LTSSM and ASPM. */ +++ if (pcie->cfg) { +++ val = PCIE_CSR_LTSSM_EN(port->slot) | +++ PCIE_CSR_ASPM_L1_EN(port->slot); +++ regmap_update_bits(pcie->cfg, PCIE_SYS_CFG_V2, val, val); ++ } ++ ++ /* Assert all reset signals */ ++@@ -983,6 +986,7 @@ static int mtk_pcie_subsys_powerup(struc ++ struct device *dev = pcie->dev; ++ struct platform_device *pdev = to_platform_device(dev); ++ struct resource *regs; +++ struct device_node *cfg_node; ++ int err; ++ ++ /* get shared registers, which are optional */ ++@@ -995,6 +999,13 @@ static int mtk_pcie_subsys_powerup(struc ++ } ++ } ++ +++ cfg_node = of_parse_phandle(dev->of_node, "mediatek,pcie-cfg", 0); +++ if (cfg_node) { +++ pcie->cfg = syscon_node_to_regmap(cfg_node); +++ if (IS_ERR(pcie->cfg)) +++ return PTR_ERR(pcie->cfg); +++ } +++ ++ pcie->free_ck = devm_clk_get(dev, "free_ck"); ++ if (IS_ERR(pcie->free_ck)) { ++ if (PTR_ERR(pcie->free_ck) == -EPROBE_DEFER) +diff --git a/target/linux/mediatek/patches-5.10/602-arm64-dts-mediatek-Split-PCIe-node-for-MT2712-MT7622.patch b/target/linux/mediatek/patches-5.10/602-arm64-dts-mediatek-Split-PCIe-node-for-MT2712-MT7622.patch +new file mode 100644 +index 0000000000..5e0114328c +--- /dev/null ++++ b/target/linux/mediatek/patches-5.10/602-arm64-dts-mediatek-Split-PCIe-node-for-MT2712-MT7622.patch +@@ -0,0 +1,417 @@ ++From patchwork Thu May 28 06:16:47 2020 ++Content-Type: text/plain; charset="utf-8" ++MIME-Version: 1.0 ++Content-Transfer-Encoding: 7bit ++X-Patchwork-Submitter: Chuanjia Liu ++X-Patchwork-Id: 11574785 ++Return-Path: ++ ++Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org ++ [172.30.200.123]) ++ by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 933301391 ++ for ; ++ Thu, 28 May 2020 06:19:16 +0000 (UTC) ++Received: from bombadil.infradead.org (bombadil.infradead.org ++ [198.137.202.133]) ++ (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) ++ (No client certificate requested) ++ by mail.kernel.org (Postfix) with ESMTPS id D19F02078C ++ for ; ++ Thu, 28 May 2020 06:19:15 +0000 (UTC) ++Authentication-Results: mail.kernel.org; ++ dkim=pass (2048-bit key) header.d=lists.infradead.org ++ header.i=@lists.infradead.org header.b="s8K7t7DF"; ++ dkim=fail reason="signature verification failed" (1024-bit key) ++ header.d=mediatek.com header.i=@mediatek.com header.b="RhX81Iqp" ++DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D19F02078C ++Authentication-Results: mail.kernel.org; ++ dmarc=fail (p=none dis=none) header.from=mediatek.com ++Authentication-Results: mail.kernel.org; ++ spf=none ++ smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org ++DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; ++ d=lists.infradead.org; s=bombadil.20170209; h=Sender: ++ Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: ++ List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: ++ Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: ++ Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: ++ List-Owner; bh=NHyHqNMcE7LW10MwduOJoKiWe8cv+XayY+L6WDZeSu0=; b=s8K7t7DFh1iQ5w ++ eGvuMRgXEQv/YWRuSZRyX8lx8R2H9IuawEIgkhO6lEo6xv0VdsRuj8SptfoWg5afCItMhih373M21 ++ 6sUy3tEiuKGgklfxLU0reLEkaATkKRGLJDY3eSSs1mvZDrydKuZLDTka+YDGaiESlOhqMr95Nm6YM ++ yK8O00qTwSRPJUILRsBv1e/Kz8NRCmYhs56snABJkKeJ51NRAkb20R6qGTEd6UyBlz3jTVYwluLgF ++ bdqzywDT6+BNg/Agh6Zd+v2PpO4cmwCpGm62+3UUyZkfi/aQ4qZ/AFAfSQI+3ZBAgsKMC1PGifOi/ ++ FgGxIvAUk6atBy7DAHuw==; ++Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) ++ by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) ++ id 1jeBsn-00025C-EF; Thu, 28 May 2020 06:19:13 +0000 ++Received: from mailgw01.mediatek.com ([216.200.240.184]) ++ by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) ++ id 1jeBsZ-0001s4-6j; Thu, 28 May 2020 06:19:01 +0000 ++X-UUID: c6210e6371fa445db0ae40a8b8a7a0a1-20200527 ++DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; ++ d=mediatek.com; ++ s=dk; ++ h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; ++ bh=X9AwTdbhpWmlWY4LjTm8KLq4Cca3YI9UnyCX3O0BAak=; ++ b=RhX81Iqp0mWhBDyMQMFSEtt23+DGAWoin1SrFGP1bzp6GEtu38b2pK5RJVBshJtuxi/a1uMXZjeDsHJn02VGdNA07FrzZ7jq6YYEL+8cJs2DnhySmNElZazXPv2vKu9TWygfilTT24h/u8V/eszuRuhkdoUKWol8LwDlPl9gskg=; ++X-UUID: c6210e6371fa445db0ae40a8b8a7a0a1-20200527 ++Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw01.mediatek.com ++ (envelope-from ) ++ (musrelay.mediatek.com ESMTP with TLS) ++ with ESMTP id 7561992; Wed, 27 May 2020 22:19:17 -0800 ++Received: from mtkmbs07n1.mediatek.inc (172.21.101.16) by ++ MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id ++ 15.0.1497.2; Wed, 27 May 2020 23:18:47 -0700 ++Received: from mtkcas07.mediatek.inc (172.21.101.84) by ++ mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id ++ 15.0.1497.2; Thu, 28 May 2020 14:18:52 +0800 ++Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc ++ (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend ++ Transport; Thu, 28 May 2020 14:18:51 +0800 ++From: ++To: , , ++Subject: [PATCH v2 3/4] arm64: dts: mediatek: Split PCIe node for ++ MT2712/MT7622 ++Date: Thu, 28 May 2020 14:16:47 +0800 ++Message-ID: <20200528061648.32078-4-chuanjia.liu@mediatek.com> ++X-Mailer: git-send-email 2.18.0 ++In-Reply-To: <20200528061648.32078-1-chuanjia.liu@mediatek.com> ++References: <20200528061648.32078-1-chuanjia.liu@mediatek.com> ++MIME-Version: 1.0 ++X-MTK: N ++X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ++X-CRM114-CacheID: sfid-20200527_231859_253529_B6751C5A ++X-CRM114-Status: GOOD ( 12.20 ) ++X-Spam-Score: -0.2 (/) ++X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: ++ Content analysis details: (-0.2 points) ++ pts rule name description ++ ---- ---------------------- ++ -------------------------------------------------- ++ -0.0 SPF_PASS SPF: sender matches SPF record ++ 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record ++ 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 ++ encoding ++ -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from ++ author's domain ++ 0.1 DKIM_SIGNED Message has a DKIM or DK signature, ++ not necessarily ++ valid ++ -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature ++ -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from ++ envelope-from domain ++ 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay ++ lines ++X-BeenThere: linux-mediatek@lists.infradead.org ++X-Mailman-Version: 2.1.29 ++Precedence: list ++List-Id: ++List-Unsubscribe: , ++ ++List-Archive: ++List-Post: ++List-Help: ++List-Subscribe: , ++ ++Cc: devicetree@vger.kernel.org, lorenzo.pieralisi@arm.com, ++ srv_heupstream@mediatek.com, "chuanjia.liu" , ++ linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, ++ jianjun.wang@mediatek.com, linux-mediatek@lists.infradead.org, ++ yong.wu@mediatek.com, bhelgaas@google.com, ++ linux-arm-kernel@lists.infradead.org, amurray@thegoodpenguin.co.uk ++Sender: "Linux-mediatek" ++Errors-To: ++ linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org ++ ++From: "chuanjia.liu" ++ ++There are two independent PCIe controllers in MT2712/MT7622 platform, ++and each of them should contain an independent MSI domain. ++ ++In current architecture, MSI domain will be inherited from the root ++bridge, and all of the devices will share the same MSI domain. ++Hence that, the PCIe devices will not work properly if the irq number ++which required is more than 32. ++ ++Split the PCIe node for MT2712/MT7622 platform to fix MSI issue and ++comply with the hardware design. ++ ++Signed-off-by: chuanjia.liu ++--- ++ arch/arm64/boot/dts/mediatek/mt2712e.dtsi | 75 +++++++++++-------- ++ .../dts/mediatek/mt7622-bananapi-bpi-r64.dts | 16 ++-- ++ arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts | 6 +- ++ arch/arm64/boot/dts/mediatek/mt7622.dtsi | 68 +++++++++++------ ++ 4 files changed, 96 insertions(+), 69 deletions(-) ++ ++--- a/arch/arm64/boot/dts/mediatek/mt2712e.dtsi +++++ b/arch/arm64/boot/dts/mediatek/mt2712e.dtsi ++@@ -915,60 +915,73 @@ ++ }; ++ }; ++ ++- pcie: pcie@11700000 { +++ pcie1: pcie@112ff000 { ++ compatible = "mediatek,mt2712-pcie"; ++ device_type = "pci"; ++- reg = <0 0x11700000 0 0x1000>, ++- <0 0x112ff000 0 0x1000>; ++- reg-names = "port0", "port1"; +++ reg = <0 0x112ff000 0 0x1000>; +++ reg-names = "port1"; ++ #address-cells = <3>; ++ #size-cells = <2>; ++- interrupts = , ++- ; ++- clocks = <&topckgen CLK_TOP_PE2_MAC_P0_SEL>, ++- <&topckgen CLK_TOP_PE2_MAC_P1_SEL>, ++- <&pericfg CLK_PERI_PCIE0>, +++ interrupts = ; +++ interrupt-names = "pcie_irq"; +++ clocks = <&topckgen CLK_TOP_PE2_MAC_P1_SEL>, ++ <&pericfg CLK_PERI_PCIE1>; ++- clock-names = "sys_ck0", "sys_ck1", "ahb_ck0", "ahb_ck1"; ++- phys = <&u3port0 PHY_TYPE_PCIE>, <&u3port1 PHY_TYPE_PCIE>; ++- phy-names = "pcie-phy0", "pcie-phy1"; +++ clock-names = "sys_ck1", "ahb_ck1"; +++ phys = <&u3port1 PHY_TYPE_PCIE>; +++ phy-names = "pcie-phy1"; ++ bus-range = <0x00 0xff>; ++- ranges = <0x82000000 0 0x20000000 0x0 0x20000000 0 0x10000000>; +++ ranges = <0x82000000 0 0x11400000 0x0 0x11400000 0 0x300000>; +++ status = "disabled"; ++ ++- pcie0: pcie@0,0 { ++- device_type = "pci"; ++- status = "disabled"; ++- reg = <0x0000 0 0 0 0>; +++ slot1: pcie@1,0 { +++ reg = <0x0800 0 0 0 0>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ #interrupt-cells = <1>; ++ ranges; ++ interrupt-map-mask = <0 0 0 7>; ++- interrupt-map = <0 0 0 1 &pcie_intc0 0>, ++- <0 0 0 2 &pcie_intc0 1>, ++- <0 0 0 3 &pcie_intc0 2>, ++- <0 0 0 4 &pcie_intc0 3>; ++- pcie_intc0: interrupt-controller { +++ interrupt-map = <0 0 0 1 &pcie_intc1 0>, +++ <0 0 0 2 &pcie_intc1 1>, +++ <0 0 0 3 &pcie_intc1 2>, +++ <0 0 0 4 &pcie_intc1 3>; +++ pcie_intc1: interrupt-controller { ++ interrupt-controller; ++ #address-cells = <0>; ++ #interrupt-cells = <1>; ++ }; ++ }; +++ }; ++ ++- pcie1: pcie@1,0 { ++- device_type = "pci"; ++- status = "disabled"; ++- reg = <0x0800 0 0 0 0>; +++ pcie0: pcie@11700000 { +++ compatible = "mediatek,mt2712-pcie"; +++ device_type = "pci"; +++ reg = <0 0x11700000 0 0x1000>; +++ reg-names = "port0"; +++ #address-cells = <3>; +++ #size-cells = <2>; +++ interrupts = ; +++ interrupt-names = "pcie_irq"; +++ clocks = <&topckgen CLK_TOP_PE2_MAC_P0_SEL>, +++ <&pericfg CLK_PERI_PCIE0>; +++ clock-names = "sys_ck0", "ahb_ck0"; +++ phys = <&u3port0 PHY_TYPE_PCIE>; +++ phy-names = "pcie-phy0"; +++ bus-range = <0x00 0xff>; +++ ranges = <0x82000000 0 0x20000000 0x0 0x20000000 0 0x10000000>; +++ status = "disabled"; +++ +++ slot0: pcie@0,0 { +++ reg = <0x0000 0 0 0 0>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ #interrupt-cells = <1>; ++ ranges; ++ interrupt-map-mask = <0 0 0 7>; ++- interrupt-map = <0 0 0 1 &pcie_intc1 0>, ++- <0 0 0 2 &pcie_intc1 1>, ++- <0 0 0 3 &pcie_intc1 2>, ++- <0 0 0 4 &pcie_intc1 3>; ++- pcie_intc1: interrupt-controller { +++ interrupt-map = <0 0 0 1 &pcie_intc0 0>, +++ <0 0 0 2 &pcie_intc0 1>, +++ <0 0 0 3 &pcie_intc0 2>, +++ <0 0 0 4 &pcie_intc0 3>; +++ pcie_intc0: interrupt-controller { ++ interrupt-controller; ++ #address-cells = <0>; ++ #interrupt-cells = <1>; ++--- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +++++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts ++@@ -270,18 +270,16 @@ ++ }; ++ }; ++ ++-&pcie { +++&pcie0 { ++ pinctrl-names = "default"; ++- pinctrl-0 = <&pcie0_pins>, <&pcie1_pins>; +++ pinctrl-0 = <&pcie0_pins>; ++ status = "okay"; +++}; ++ ++- pcie@0,0 { ++- status = "okay"; ++- }; ++- ++- pcie@1,0 { ++- status = "okay"; ++- }; +++&pcie1 { +++ pinctrl-names = "default"; +++ pinctrl-0 = <&pcie1_pins>; +++ status = "okay"; ++ }; ++ ++ &pio { ++--- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi +++++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi ++@@ -794,45 +794,41 @@ ++ #reset-cells = <1>; ++ }; ++ ++- pcie: pcie@1a140000 { +++ pciecfg: pciecfg@1a140000 { +++ compatible = "mediatek,mt7622-pciecfg", "syscon"; +++ reg = <0 0x1a140000 0 0x1000>; +++ }; +++ +++ pcie0: pcie@1a143000 { ++ compatible = "mediatek,mt7622-pcie"; ++ device_type = "pci"; ++- reg = <0 0x1a140000 0 0x1000>, ++- <0 0x1a143000 0 0x1000>, ++- <0 0x1a145000 0 0x1000>; ++- reg-names = "subsys", "port0", "port1"; +++ reg = <0 0x1a143000 0 0x1000>; +++ reg-names = "port0"; +++ mediatek,pcie-cfg = <&pciecfg>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++- interrupts = , ++- ; +++ interrupts = ; +++ interrupt-names = "pcie_irq"; ++ clocks = <&pciesys CLK_PCIE_P0_MAC_EN>, ++- <&pciesys CLK_PCIE_P1_MAC_EN>, ++- <&pciesys CLK_PCIE_P0_AHB_EN>, ++ <&pciesys CLK_PCIE_P0_AHB_EN>, ++ <&pciesys CLK_PCIE_P0_AUX_EN>, ++- <&pciesys CLK_PCIE_P1_AUX_EN>, ++ <&pciesys CLK_PCIE_P0_AXI_EN>, ++- <&pciesys CLK_PCIE_P1_AXI_EN>, ++ <&pciesys CLK_PCIE_P0_OBFF_EN>, ++- <&pciesys CLK_PCIE_P1_OBFF_EN>, ++- <&pciesys CLK_PCIE_P0_PIPE_EN>, ++- <&pciesys CLK_PCIE_P1_PIPE_EN>; ++- clock-names = "sys_ck0", "sys_ck1", "ahb_ck0", "ahb_ck1", ++- "aux_ck0", "aux_ck1", "axi_ck0", "axi_ck1", ++- "obff_ck0", "obff_ck1", "pipe_ck0", "pipe_ck1"; +++ <&pciesys CLK_PCIE_P0_PIPE_EN>; +++ clock-names = "sys_ck0", "ahb_ck0", "aux_ck0", +++ "axi_ck0", "obff_ck0", "pipe_ck0"; +++ ++ power-domains = <&scpsys MT7622_POWER_DOMAIN_HIF0>; ++ bus-range = <0x00 0xff>; ++- ranges = <0x82000000 0 0x20000000 0x0 0x20000000 0 0x10000000>; +++ ranges = <0x82000000 0 0x20000000 0x0 0x20000000 0 0x8000000>; ++ status = "disabled"; ++ ++- pcie0: pcie@0,0 { +++ slot0: pcie@0,0 { ++ reg = <0x0000 0 0 0 0>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ #interrupt-cells = <1>; ++ ranges; ++- status = "disabled"; ++- ++ interrupt-map-mask = <0 0 0 7>; ++ interrupt-map = <0 0 0 1 &pcie_intc0 0>, ++ <0 0 0 2 &pcie_intc0 1>, ++@@ -844,15 +840,39 @@ ++ #interrupt-cells = <1>; ++ }; ++ }; +++ }; ++ ++- pcie1: pcie@1,0 { +++ pcie1: pcie@1a145000 { +++ compatible = "mediatek,mt7622-pcie"; +++ device_type = "pci"; +++ reg = <0 0x1a145000 0 0x1000>; +++ reg-names = "port1"; +++ mediatek,pcie-cfg = <&pciecfg>; +++ #address-cells = <3>; +++ #size-cells = <2>; +++ interrupts = ; +++ interrupt-names = "pcie_irq"; +++ clocks = <&pciesys CLK_PCIE_P1_MAC_EN>, +++ /* designer has connect RC1 with p0_ahb clock */ +++ <&pciesys CLK_PCIE_P0_AHB_EN>, +++ <&pciesys CLK_PCIE_P1_AUX_EN>, +++ <&pciesys CLK_PCIE_P1_AXI_EN>, +++ <&pciesys CLK_PCIE_P1_OBFF_EN>, +++ <&pciesys CLK_PCIE_P1_PIPE_EN>; +++ clock-names = "sys_ck1", "ahb_ck1", "aux_ck1", +++ "axi_ck1", "obff_ck1", "pipe_ck1"; +++ +++ power-domains = <&scpsys MT7622_POWER_DOMAIN_HIF0>; +++ bus-range = <0x00 0xff>; +++ ranges = <0x82000000 0 0x28000000 0x0 0x28000000 0 0x8000000>; +++ status = "disabled"; +++ +++ slot1: pcie@1,0 { ++ reg = <0x0800 0 0 0 0>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ #interrupt-cells = <1>; ++ ranges; ++- status = "disabled"; ++- ++ interrupt-map-mask = <0 0 0 7>; ++ interrupt-map = <0 0 0 1 &pcie_intc1 0>, ++ <0 0 0 2 &pcie_intc1 1>, ++--- a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts +++++ b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts ++@@ -232,18 +232,16 @@ ++ }; ++ }; ++ ++-&pcie { +++&pcie0 { ++ pinctrl-names = "default"; ++- pinctrl-0 = <&pcie0_pins>, <&pcie1_pins>; +++ pinctrl-0 = <&pcie0_pins>; ++ status = "okay"; +++}; ++ ++- pcie@0,0 { ++- status = "okay"; ++- }; ++- ++- pcie@1,0 { ++- status = "okay"; ++- }; +++&pcie1 { +++ pinctrl-names = "default"; +++ pinctrl-0 = <&pcie1_pins>; +++ status = "okay"; ++ }; ++ ++ &pio { +diff --git a/target/linux/mediatek/patches-5.10/603-ARM-dts-mediatek-Update-mt7629-PCIe-node.patch b/target/linux/mediatek/patches-5.10/603-ARM-dts-mediatek-Update-mt7629-PCIe-node.patch +new file mode 100644 +index 0000000000..799cc31ab7 +--- /dev/null ++++ b/target/linux/mediatek/patches-5.10/603-ARM-dts-mediatek-Update-mt7629-PCIe-node.patch +@@ -0,0 +1,203 @@ ++From patchwork Thu May 28 06:16:48 2020 ++Content-Type: text/plain; charset="utf-8" ++MIME-Version: 1.0 ++Content-Transfer-Encoding: 7bit ++X-Patchwork-Submitter: Chuanjia Liu ++X-Patchwork-Id: 11574797 ++Return-Path: ++ ++Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org ++ [172.30.200.123]) ++ by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 30A5E1392 ++ for ; ++ Thu, 28 May 2020 06:29:05 +0000 (UTC) ++Received: from bombadil.infradead.org (bombadil.infradead.org ++ [198.137.202.133]) ++ (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) ++ (No client certificate requested) ++ by mail.kernel.org (Postfix) with ESMTPS id 08B6320721 ++ for ; ++ Thu, 28 May 2020 06:29:05 +0000 (UTC) ++Authentication-Results: mail.kernel.org; ++ dkim=pass (2048-bit key) header.d=lists.infradead.org ++ header.i=@lists.infradead.org header.b="auhxDafY"; ++ dkim=fail reason="signature verification failed" (1024-bit key) ++ header.d=mediatek.com header.i=@mediatek.com header.b="Kj09Arxb" ++DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 08B6320721 ++Authentication-Results: mail.kernel.org; ++ dmarc=fail (p=none dis=none) header.from=mediatek.com ++Authentication-Results: mail.kernel.org; ++ spf=none ++ smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org ++DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; ++ d=lists.infradead.org; s=bombadil.20170209; h=Sender: ++ Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: ++ List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: ++ Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: ++ Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: ++ List-Owner; bh=+QPxF1vlOH7StIZYuXJa3V40x8QVDxCLF9AFXHblB9M=; b=auhxDafYBeaUZO ++ aYp2KVO8Aie0v4tYtRwBon7hF+x55JwD78SAxQR2RsSvrlOo9cMYYby+ToUWflVUWQ60FapAl+w+l ++ nkEjIOrLBErHwxNOcsD8T5kjyCBMqlz4OMAQYUDNJ3fSugRlGhOtxkjCGd9ebB8N2Rvu6/U8P1A9n ++ P15mEQoc+RLonR1+9mBgwTEXErjsraxkimTD4Txsp4IvMs3UdsMkP+r3OT5S/p+Uj6O9ES0h7xIon ++ aL79KaVqRLHrfZxnrVwuGiecAiTp8qLy9clHuJU32NA6ZcXH1OnWipKApgp8Ck7ys80WPKaMrat9B ++ XuskJ63w13DZAbCVvuGQ==; ++Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) ++ by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) ++ id 1jeC2J-00014n-M9; Thu, 28 May 2020 06:29:03 +0000 ++Received: from mailgw02.mediatek.com ([216.200.240.185]) ++ by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) ++ id 1jeC2H-00013t-Li; Thu, 28 May 2020 06:29:03 +0000 ++X-UUID: a4877c1586e64afeb2d6172e10605d2b-20200527 ++DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; ++ d=mediatek.com; ++ s=dk; ++ h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; ++ bh=CIwcBFK1x0LbOjDt1BG6/knHFxDHRiqj8ov/jWEZDBY=; ++ b=Kj09ArxbnLVTc9bpaVPT3jQrIVjhL87sSYyVF9dFypS976k78Ce9gZd0f4K3zAZbYZHYoQtuyOQ9TOeufQfgD+Cr+j5VR7pTdO2E1iXHFs/eQAz5gAjvjlK01z1JiunrLnn9dvIr6c1gEkjQHny0VpuZ1duxx79jwYusg/Nw6Wc=; ++X-UUID: a4877c1586e64afeb2d6172e10605d2b-20200527 ++Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by ++ mailgw02.mediatek.com ++ (envelope-from ) ++ (musrelay.mediatek.com ESMTP with TLS) ++ with ESMTP id 899663677; Wed, 27 May 2020 22:29:21 -0800 ++Received: from MTKMBS07N2.mediatek.inc (172.21.101.141) by ++ MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id ++ 15.0.1497.2; Wed, 27 May 2020 23:18:50 -0700 ++Received: from mtkcas07.mediatek.inc (172.21.101.84) by ++ mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id ++ 15.0.1497.2; Thu, 28 May 2020 14:18:54 +0800 ++Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc ++ (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend ++ Transport; Thu, 28 May 2020 14:18:52 +0800 ++From: ++To: , , ++Subject: [PATCH v2 4/4] ARM: dts: mediatek: Update mt7629 PCIe node ++Date: Thu, 28 May 2020 14:16:48 +0800 ++Message-ID: <20200528061648.32078-5-chuanjia.liu@mediatek.com> ++X-Mailer: git-send-email 2.18.0 ++In-Reply-To: <20200528061648.32078-1-chuanjia.liu@mediatek.com> ++References: <20200528061648.32078-1-chuanjia.liu@mediatek.com> ++MIME-Version: 1.0 ++X-MTK: N ++X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ++X-CRM114-CacheID: sfid-20200527_232901_719172_E5A99C62 ++X-CRM114-Status: GOOD ( 11.61 ) ++X-Spam-Score: -0.2 (/) ++X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: ++ Content analysis details: (-0.2 points) ++ pts rule name description ++ ---- ---------------------- ++ -------------------------------------------------- ++ -0.0 SPF_PASS SPF: sender matches SPF record ++ 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record ++ 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 ++ encoding ++ -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from ++ author's domain ++ 0.1 DKIM_SIGNED Message has a DKIM or DK signature, ++ not necessarily ++ valid ++ -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature ++ -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from ++ envelope-from domain ++ 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay ++ lines ++X-BeenThere: linux-mediatek@lists.infradead.org ++X-Mailman-Version: 2.1.29 ++Precedence: list ++List-Id: ++List-Unsubscribe: , ++ ++List-Archive: ++List-Post: ++List-Help: ++List-Subscribe: , ++ ++Cc: devicetree@vger.kernel.org, lorenzo.pieralisi@arm.com, ++ srv_heupstream@mediatek.com, "chuanjia.liu" , ++ linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, ++ jianjun.wang@mediatek.com, linux-mediatek@lists.infradead.org, ++ yong.wu@mediatek.com, bhelgaas@google.com, ++ linux-arm-kernel@lists.infradead.org, amurray@thegoodpenguin.co.uk ++Sender: "Linux-mediatek" ++Errors-To: ++ linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org ++ ++From: "chuanjia.liu" ++ ++Remove unused property and add pciecfg node. ++ ++Signed-off-by: chuanjia.liu ++--- ++ arch/arm/boot/dts/mt7629-rfb.dts | 3 ++- ++ arch/arm/boot/dts/mt7629.dtsi | 23 +++++++++++++---------- ++ 2 files changed, 15 insertions(+), 11 deletions(-) ++ ++--- a/arch/arm/boot/dts/mt7629-rfb.dts +++++ b/arch/arm/boot/dts/mt7629-rfb.dts ++@@ -144,9 +144,10 @@ ++ }; ++ }; ++ ++-&pcie { +++&pcie1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_pins>; +++ status = "okay"; ++ }; ++ ++ &pciephy1 { ++--- a/arch/arm/boot/dts/mt7629.dtsi +++++ b/arch/arm/boot/dts/mt7629.dtsi ++@@ -382,16 +382,21 @@ ++ #reset-cells = <1>; ++ }; ++ ++- pcie: pcie@1a140000 { +++ pciecfg: pciecfg@1a140000 { +++ compatible = "mediatek,mt7629-pciecfg", "syscon"; +++ reg = <0x1a140000 0x1000>; +++ }; +++ +++ pcie1: pcie@1a145000 { ++ compatible = "mediatek,mt7629-pcie"; ++ device_type = "pci"; ++- reg = <0x1a140000 0x1000>, ++- <0x1a145000 0x1000>; ++- reg-names = "subsys","port1"; +++ reg = <0x1a145000 0x1000>; +++ reg-names = "port1"; +++ mediatek,pcie-cfg = <&pciecfg>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++- interrupts = , ++- ; +++ interrupts = ; +++ interrupt-names = "pcie_irq"; ++ clocks = <&pciesys CLK_PCIE_P1_MAC_EN>, ++ <&pciesys CLK_PCIE_P0_AHB_EN>, ++ <&pciesys CLK_PCIE_P1_AUX_EN>, ++@@ -412,21 +417,19 @@ ++ power-domains = <&scpsys MT7622_POWER_DOMAIN_HIF0>; ++ bus-range = <0x00 0xff>; ++ ranges = <0x82000000 0 0x20000000 0x20000000 0 0x10000000>; +++ status = "disabled"; ++ ++- pcie1: pcie@1,0 { ++- device_type = "pci"; +++ slot1: pcie@1,0 { ++ reg = <0x0800 0 0 0 0>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ #interrupt-cells = <1>; ++ ranges; ++- num-lanes = <1>; ++ interrupt-map-mask = <0 0 0 7>; ++ interrupt-map = <0 0 0 1 &pcie_intc1 0>, ++ <0 0 0 2 &pcie_intc1 1>, ++ <0 0 0 3 &pcie_intc1 2>, ++ <0 0 0 4 &pcie_intc1 3>; ++- ++ pcie_intc1: interrupt-controller { ++ interrupt-controller; ++ #address-cells = <0>; +diff --git a/target/linux/mediatek/patches-5.10/610-pcie-mediatek-fix-clearing-interrupt-status.patch b/target/linux/mediatek/patches-5.10/610-pcie-mediatek-fix-clearing-interrupt-status.patch +new file mode 100644 +index 0000000000..7b74a8ac73 +--- /dev/null ++++ b/target/linux/mediatek/patches-5.10/610-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 ++@@ -613,10 +613,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); ++ } ++ } ++ +diff --git a/target/linux/mediatek/patches-5.10/700-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch b/target/linux/mediatek/patches-5.10/700-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch +new file mode 100644 +index 0000000000..873317eb00 +--- /dev/null ++++ b/target/linux/mediatek/patches-5.10/700-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch +@@ -0,0 +1,85 @@ ++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>; ++ }; ++@@ -969,6 +969,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 ++@@ -2482,6 +2483,13 @@ 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 | +++ ETHSYS_DMA_AG_MAP_PPE; +++ +++ 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) { ++@@ -3061,6 +3069,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 ++@@ -437,6 +437,12 @@ ++ #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) +++#define ETHSYS_DMA_AG_MAP_PPE BIT(2) +++ ++ /* SGMII subsystem config registers */ ++ /* Register to auto-negotiation restart */ ++ #define SGMSYS_PCS_CONTROL_1 0x0 +diff --git a/target/linux/mediatek/patches-5.10/710-pci-pcie-mediatek-add-support-for-coherent-DMA.patch b/target/linux/mediatek/patches-5.10/710-pci-pcie-mediatek-add-support-for-coherent-DMA.patch +new file mode 100644 +index 0000000000..0156d89bba +--- /dev/null ++++ b/target/linux/mediatek/patches-5.10/710-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 ++@@ -805,6 +805,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 = ; ++@@ -822,6 +824,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>; ++@@ -848,6 +851,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 = ; ++@@ -866,6 +871,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>; ++@@ -925,6 +931,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; ++ ++ /** ++@@ -1040,6 +1046,27 @@ static int mtk_pcie_setup(struct mtk_pci ++ struct mtk_pcie_port *port, *tmp; ++ int err; ++ +++ 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; ++ +diff --git a/target/linux/mediatek/patches-5.10/800-ubnt-ledbar-driver.patch b/target/linux/mediatek/patches-5.10/800-ubnt-ledbar-driver.patch +new file mode 100644 +index 0000000000..013391e1d9 +--- /dev/null ++++ b/target/linux/mediatek/patches-5.10/800-ubnt-ledbar-driver.patch +@@ -0,0 +1,29 @@ ++--- a/drivers/leds/Kconfig +++++ b/drivers/leds/Kconfig ++@@ -928,6 +928,16 @@ config LEDS_ACER_A500 ++ This option enables support for the Power Button LED of ++ Acer Iconia Tab A500. ++ +++config LEDS_UBNT_LEDBAR +++ tristate "LED support for Ubiquiti UniFi 6 LR" +++ depends on LEDS_CLASS && I2C && OF +++ help +++ This option enables support for the Ubiquiti LEDBAR +++ LED driver. +++ +++ To compile this driver as a module, choose M here: the module +++ will be called leds-ubnt-ledbar. +++ ++ comment "LED Triggers" ++ source "drivers/leds/trigger/Kconfig" ++ ++--- a/drivers/leds/Makefile +++++ b/drivers/leds/Makefile ++@@ -93,6 +93,7 @@ obj-$(CONFIG_LEDS_TURRIS_OMNIA) += leds ++ obj-$(CONFIG_LEDS_WM831X_STATUS) += leds-wm831x-status.o ++ obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o ++ obj-$(CONFIG_LEDS_WRAP) += leds-wrap.o +++obj-$(CONFIG_LEDS_UBNT_LEDBAR) += leds-ubnt-ledbar.o ++ ++ # LED SPI Drivers ++ obj-$(CONFIG_LEDS_CR0014114) += leds-cr0014114.o +diff --git a/target/linux/mediatek/patches-5.10/900-dts-mt7622-bpi-r64-aliases-for-dtoverlay.patch b/target/linux/mediatek/patches-5.10/900-dts-mt7622-bpi-r64-aliases-for-dtoverlay.patch +new file mode 100644 +index 0000000000..4c6df93089 +--- /dev/null ++++ b/target/linux/mediatek/patches-5.10/900-dts-mt7622-bpi-r64-aliases-for-dtoverlay.patch +@@ -0,0 +1,80 @@ ++--- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +++++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts ++@@ -279,14 +279,14 @@ ++ &pcie1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie1_pins>; ++- status = "okay"; +++ status = "disabled"; ++ }; ++ ++ &pio { ++ /* Attention: GPIO 90 is used to switch between PCIe@1,0 and ++ * SATA functions. i.e. output-high: PCIe, output-low: SATA ++ */ ++- asm_sel { +++ asmsel: asm_sel { ++ gpio-hog; ++ gpios = <90 GPIO_ACTIVE_HIGH>; ++ output-high; ++--- /dev/null +++++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64-sata.dts ++@@ -0,0 +1,31 @@ +++/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */ +++ +++#include +++ +++/dts-v1/; +++/plugin/; +++ +++/ { +++ compatible = "bananapi,bpi-r64", "mediatek,mt7622"; +++ +++ fragment@0 { +++ target = <&asmsel>; +++ __overlay__ { +++ gpios = <90 GPIO_ACTIVE_LOW>; +++ }; +++ }; +++ +++ fragment@1 { +++ target = <&sata>; +++ __overlay__ { +++ status = "okay"; +++ }; +++ }; +++ +++ fragment@2 { +++ target = <&sata_phy>; +++ __overlay__ { +++ status = "okay"; +++ }; +++ }; +++}; ++--- /dev/null +++++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64-pcie1.dts ++@@ -0,0 +1,24 @@ +++/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */ +++ +++#include +++ +++/dts-v1/; +++/plugin/; +++ +++/ { +++ compatible = "bananapi,bpi-r64", "mediatek,mt7622"; +++ +++ fragment@0 { +++ target = <&asmsel>; +++ __overlay__ { +++ gpios = <90 GPIO_ACTIVE_HIGH>; +++ }; +++ }; +++ +++ fragment@1 { +++ target = <&pcie1>; +++ __overlay__ { +++ status = "okay"; +++ }; +++ }; +++}; +diff --git a/target/linux/mediatek/patches-5.4/0227-arm-dts-Add-Unielec-U7623-DTS.patch b/target/linux/mediatek/patches-5.4/0227-arm-dts-Add-Unielec-U7623-DTS.patch +deleted file mode 100644 +index 3cb1dab69f..0000000000 +--- a/target/linux/mediatek/patches-5.4/0227-arm-dts-Add-Unielec-U7623-DTS.patch ++++ /dev/null +@@ -1,387 +0,0 @@ +-From 004eb24e939b5b31f828333f37fb5cb2a877d6f2 Mon Sep 17 00:00:00 2001 +-From: Kristian Evensen +-Date: Sun, 17 Jun 2018 14:41:47 +0200 +-Subject: [PATCH] arm: dts: Add Unielec U7623 DTS +- +---- +- arch/arm/boot/dts/Makefile | 1 + +- .../dts/mt7623a-unielec-u7623-02-emmc-512m.dts | 18 + +- .../boot/dts/mt7623a-unielec-u7623-02-emmc.dtsi | 366 +++++++++++++++++++++ +- 3 files changed, 385 insertions(+) +- create mode 100644 arch/arm/boot/dts/mt7623a-unielec-u7623-02-emmc-512m.dts +- create mode 100644 arch/arm/boot/dts/mt7623a-unielec-u7623-02-emmc.dtsi +- +---- a/arch/arm/boot/dts/Makefile +-+++ b/arch/arm/boot/dts/Makefile +-@@ -1272,6 +1272,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ +- mt7623a-rfb-nand.dtb \ +- mt7623n-rfb-emmc.dtb \ +- mt7623n-bananapi-bpi-r2.dtb \ +-+ mt7623a-unielec-u7623-02-emmc-512m.dtb \ +- mt7629-rfb.dtb \ +- mt8127-moose.dtb \ +- mt8135-evbp1.dtb +---- /dev/null +-+++ b/arch/arm/boot/dts/mt7623a-unielec-u7623-02-emmc-512m.dts +-@@ -0,0 +1,18 @@ +-+/* +-+ * Copyright 2018 Kristian Evensen +-+ * +-+ * SPDX-License-Identifier: (GPL-2.0+ OR MIT) +-+ */ +-+ +-+/dts-v1/; +-+#include "mt7623a-unielec-u7623-02-emmc.dtsi" +-+ +-+/ { +-+ model = "UniElec U7623-02 eMMC (512M RAM)"; +-+ compatible = "unielec,u7623-02-emmc-512m", "unielec,u7623-02-emmc", "mediatek,mt7623"; +-+ +-+ memory@80000000 { +-+ device_type = "memory"; +-+ reg = <0 0x80000000 0 0x20000000>; +-+ }; +-+}; +---- /dev/null +-+++ b/arch/arm/boot/dts/mt7623a-unielec-u7623-02-emmc.dtsi +-@@ -0,0 +1,340 @@ +-+/* +-+ * Copyright 2018 Kristian Evensen +-+ * +-+ * SPDX-License-Identifier: (GPL-2.0+ OR MIT) +-+ */ +-+ +-+#include +-+#include "mt7623.dtsi" +-+#include "mt6323.dtsi" +-+ +-+/ { +-+ compatible = "unielec,u7623-02-emmc", "mediatek,mt7623"; +-+ +-+ aliases { +-+ serial2 = &uart2; +-+ }; +-+ +-+ chosen { +-+ bootargs = "root=/dev/mmcblk0p2 rootfstype=squashfs,f2fs console=ttyS0,115200 blkdevparts=mmcblk0:3M@6M(recovery),256M@9M(root)"; +-+ stdout-path = "serial2:115200n8"; +-+ }; +-+ +-+ cpus { +-+ cpu@0 { +-+ proc-supply = <&mt6323_vproc_reg>; +-+ }; +-+ +-+ cpu@1 { +-+ proc-supply = <&mt6323_vproc_reg>; +-+ }; +-+ +-+ cpu@2 { +-+ proc-supply = <&mt6323_vproc_reg>; +-+ }; +-+ +-+ cpu@3 { +-+ proc-supply = <&mt6323_vproc_reg>; +-+ }; +-+ }; +-+ +-+ reg_1p8v: regulator-1p8v { +-+ compatible = "regulator-fixed"; +-+ regulator-name = "fixed-1.8V"; +-+ regulator-min-microvolt = <1800000>; +-+ regulator-max-microvolt = <1800000>; +-+ regulator-boot-on; +-+ regulator-always-on; +-+ }; +-+ +-+ reg_3p3v: regulator-3p3v { +-+ compatible = "regulator-fixed"; +-+ regulator-name = "fixed-3.3V"; +-+ regulator-min-microvolt = <3300000>; +-+ regulator-max-microvolt = <3300000>; +-+ regulator-boot-on; +-+ regulator-always-on; +-+ }; +-+ +-+ reg_5v: regulator-5v { +-+ compatible = "regulator-fixed"; +-+ regulator-name = "fixed-5V"; +-+ regulator-min-microvolt = <5000000>; +-+ regulator-max-microvolt = <5000000>; +-+ regulator-boot-on; +-+ regulator-always-on; +-+ }; +-+ +-+ gpio-keys { +-+ compatible = "gpio-keys"; +-+ pinctrl-names = "default"; +-+ pinctrl-0 = <&key_pins_a>; +-+ +-+ factory { +-+ label = "factory"; +-+ linux,code = ; +-+ gpios = <&pio 256 GPIO_ACTIVE_LOW>; +-+ }; +-+ }; +-+ +-+ leds { +-+ compatible = "gpio-leds"; +-+ pinctrl-names = "default"; +-+ pinctrl-0 = <&led_pins_unielec>; +-+ +-+ led3 { +-+ label = "u7623-01:green:led3"; +-+ gpios = <&pio 14 GPIO_ACTIVE_LOW>; +-+ }; +-+ +-+ led4 { +-+ label = "u7623-01:green:led4"; +-+ gpios = <&pio 15 GPIO_ACTIVE_LOW>; +-+ }; +-+ }; +-+}; +-+ +-+&crypto { +-+ status = "okay"; +-+}; +-+ +-+ð { +-+ status = "okay"; +-+ +-+ gmac0: mac@0 { +-+ compatible = "mediatek,eth-mac"; +-+ reg = <0>; +-+ phy-mode = "trgmii"; +-+ +-+ fixed-link { +-+ speed = <1000>; +-+ full-duplex; +-+ pause; +-+ }; +-+ }; +-+ +-+ mdio: mdio-bus { +-+ #address-cells = <1>; +-+ #size-cells = <0>; +-+ +-+ mt7530: switch@0 { +-+ compatible = "mediatek,mt7530"; +-+ }; +-+ }; +-+}; +-+ +-+&mt7530 { +-+ compatible = "mediatek,mt7530"; +-+ #address-cells = <1>; +-+ #size-cells = <0>; +-+ reg = <0>; +-+ pinctrl-names = "default"; +-+ mediatek,mcm; +-+ resets = <ðsys 2>; +-+ reset-names = "mcm"; +-+ core-supply = <&mt6323_vpa_reg>; +-+ io-supply = <&mt6323_vemc3v3_reg>; +-+ +-+ dsa,mii-bus = <&mdio>; +-+ +-+ ports { +-+ #address-cells = <1>; +-+ #size-cells = <0>; +-+ reg = <0>; +-+ +-+ port@0 { +-+ reg = <0>; +-+ label = "lan0"; +-+ cpu = <&cpu_port0>; +-+ }; +-+ +-+ port@1 { +-+ reg = <1>; +-+ label = "lan1"; +-+ cpu = <&cpu_port0>; +-+ }; +-+ +-+ port@2 { +-+ reg = <2>; +-+ label = "lan2"; +-+ cpu = <&cpu_port0>; +-+ }; +-+ +-+ port@3 { +-+ reg = <3>; +-+ label = "lan3"; +-+ cpu = <&cpu_port0>; +-+ }; +-+ +-+ port@4 { +-+ reg = <4>; +-+ label = "wan"; +-+ cpu = <&cpu_port0>; +-+ }; +-+ +-+ cpu_port0: port@6 { +-+ reg = <6>; +-+ label = "cpu"; +-+ ethernet = <&gmac0>; +-+ phy-mode = "trgmii"; +-+ +-+ fixed-link { +-+ speed = <1000>; +-+ full-duplex; +-+ }; +-+ }; +-+ }; +-+}; +-+ +-+&mmc0 { +-+ pinctrl-names = "default", "state_uhs"; +-+ pinctrl-0 = <&mmc0_pins_default>; +-+ pinctrl-1 = <&mmc0_pins_uhs>; +-+ status = "okay"; +-+ bus-width = <8>; +-+ max-frequency = <50000000>; +-+ cap-mmc-highspeed; +-+ vmmc-supply = <®_3p3v>; +-+ vqmmc-supply = <®_1p8v>; +-+ non-removable; +-+}; +-+ +-+&pio { +-+ key_pins_a: keys-alt { +-+ pins-keys { +-+ pinmux = , +-+ ; +-+ input-enable; +-+ }; +-+ }; +-+ +-+ led_pins_unielec: leds-unielec { +-+ pins-leds { +-+ pinmux = , +-+ ; +-+ }; +-+ }; +-+ +-+ mmc0_pins_default: mmc0default { +-+ pins_cmd_dat { +-+ pinmux = , +-+ , +-+ , +-+ , +-+ , +-+ , +-+ , +-+ , +-+ ; +-+ input-enable; +-+ bias-pull-up; +-+ }; +-+ +-+ pins_clk { +-+ pinmux = ; +-+ bias-pull-down; +-+ }; +-+ +-+ pins_rst { +-+ pinmux = ; +-+ bias-pull-up; +-+ }; +-+ }; +-+ +-+ mmc0_pins_uhs: mmc0 { +-+ pins_cmd_dat { +-+ pinmux = , +-+ , +-+ , +-+ , +-+ , +-+ , +-+ , +-+ , +-+ ; +-+ input-enable; +-+ drive-strength = ; +-+ bias-pull-up = ; +-+ }; +-+ +-+ pins_clk { +-+ pinmux = ; +-+ drive-strength = ; +-+ bias-pull-down = ; +-+ }; +-+ +-+ pins_rst { +-+ pinmux = ; +-+ bias-pull-up; +-+ }; +-+ }; +-+ +-+ pcie_default: pcie_pin_default { +-+ pins_cmd_dat { +-+ pinmux = , +-+ ; +-+ bias-disable; +-+ }; +-+ }; +-+}; +-+ +-+&pwm { +-+ pinctrl-names = "default"; +-+ pinctrl-0 = <&pwm_pins_a>; +-+ status = "okay"; +-+}; +-+ +-+&pwrap { +-+ mt6323 { +-+ mt6323led: led { +-+ compatible = "mediatek,mt6323-led"; +-+ #address-cells = <1>; +-+ #size-cells = <0>; +-+ +-+ led@0 { +-+ reg = <0>; +-+ label = "led0"; +-+ }; +-+ }; +-+ }; +-+}; +-+ +-+&uart2 { +-+ pinctrl-names = "default"; +-+ pinctrl-0 = <&uart2_pins_b>; +-+ status = "okay"; +-+}; +-+ +-+&usb1 { +-+ vusb33-supply = <®_3p3v>; +-+ vbus-supply = <®_3p3v>; +-+ status = "okay"; +-+}; +-+ +-+&u3phy1 { +-+ status = "okay"; +-+}; +-+ +-+&u3phy2 { +-+ status = "okay"; +-+ mediatek,phy-switch = <&hifsys>; +-+}; +-+ +-+&pcie { +-+ pinctrl-names = "default"; +-+ pinctrl-0 = <&pcie_default>; +-+ status = "okay"; +-+ +-+ pcie@1,0 { +-+ status = "okay"; +-+ }; +-+ +-+ pcie@2,0 { +-+ status = "okay"; +-+ }; +-+}; +-+ +-+&pcie1_phy { +-+ status = "okay"; +-+}; +-+ +diff --git a/target/linux/mediatek/patches-5.4/0310-mtk-bmt-support.patch b/target/linux/mediatek/patches-5.4/0310-mtk-bmt-support.patch +new file mode 100644 +index 0000000000..2a23f8c3dc +--- /dev/null ++++ b/target/linux/mediatek/patches-5.4/0310-mtk-bmt-support.patch +@@ -0,0 +1,837 @@ ++--- a/drivers/mtd/nand/Kconfig +++++ b/drivers/mtd/nand/Kconfig ++@@ -5,3 +5,7 @@ config MTD_NAND_CORE ++ source "drivers/mtd/nand/onenand/Kconfig" ++ source "drivers/mtd/nand/raw/Kconfig" ++ source "drivers/mtd/nand/spi/Kconfig" +++ +++config MTD_NAND_MTK_BMT +++ bool "Support MediaTek NAND Bad-block Management Table" +++ default n ++--- a/drivers/mtd/nand/Makefile +++++ b/drivers/mtd/nand/Makefile ++@@ -2,6 +2,7 @@ ++ ++ nandcore-objs := core.o bbt.o ++ obj-$(CONFIG_MTD_NAND_CORE) += nandcore.o +++obj-$(CONFIG_MTD_NAND_MTK_BMT) += mtk_bmt.o ++ ++ obj-y += onenand/ ++ obj-y += raw/ ++--- /dev/null +++++ b/drivers/mtd/nand/mtk_bmt.c +@@ -0,0 +1,766 @@ ++/* ++ * Copyright (c) 2017 MediaTek Inc. @@ -104569,15 +108594,15 @@ index 0000000000..5c20952611 ++ +--- a/drivers/mtd/nand/spi/core.c ++++ b/drivers/mtd/nand/spi/core.c -+@@ -19,6 +19,7 @@ -+ #include ++@@ -18,6 +18,7 @@ ++ #include + #include + #include ++#include + + static int spinand_read_reg_op(struct spinand_device *spinand, u8 reg, u8 *val) + { -+@@ -1139,6 +1140,8 @@ static int spinand_probe(struct spi_mem ++@@ -1099,6 +1100,8 @@ static int spinand_probe(struct spi_mem + if (ret) + return ret; + @@ -104586,7 +108611,7 @@ index 0000000000..5c20952611 + ret = mtd_device_register(mtd, NULL, 0); + if (ret) + goto err_spinand_cleanup; -+@@ -1164,6 +1167,7 @@ static int spinand_remove(struct spi_mem ++@@ -1124,6 +1127,7 @@ static int spinand_remove(struct spi_mem + if (ret) + return ret; + @@ -104615,1652 +108640,510 @@ index 0000000000..5c20952611 ++#endif ++ ++#endif -diff --git a/target/linux/mediatek/patches-5.10/400-crypto-add-eip97-inside-secure-support.patch b/target/linux/mediatek/patches-5.10/400-crypto-add-eip97-inside-secure-support.patch +diff --git a/target/linux/mediatek/patches-5.4/0350-mtd-parsers-trx-Allow-to-specify-trx-magic-in-DT.patch b/target/linux/mediatek/patches-5.4/0350-mtd-parsers-trx-Allow-to-specify-trx-magic-in-DT.patch new file mode 100644 -index 0000000000..e0941a9550 +index 0000000000..4db51a88ad --- /dev/null -+++ b/target/linux/mediatek/patches-5.10/400-crypto-add-eip97-inside-secure-support.patch -@@ -0,0 +1,27 @@ -+--- a/drivers/crypto/inside-secure/safexcel.c -++++ b/drivers/crypto/inside-secure/safexcel.c -+@@ -600,6 +600,14 @@ static int safexcel_hw_init(struct safex -+ val |= EIP197_MST_CTRL_TX_MAX_CMD(5); -+ writel(val, EIP197_HIA_AIC(priv) + EIP197_HIA_MST_CTRL); -+ } -++ /* -++ * Set maximum number of TX commands to 2^4 = 16 for EIP97 HW2.1/HW2.3 -++ */ -++ else { -++ val = 0; -++ val |= EIP97_MST_CTRL_TX_MAX_CMD(4); -++ writel(val, EIP197_HIA_AIC(priv) + EIP197_HIA_MST_CTRL); -++ } -+ -+ /* Configure wr/rd cache values */ -+ writel(EIP197_MST_CTRL_RD_CACHE(RD_CACHE_4BITS) | -+--- a/drivers/crypto/inside-secure/safexcel.h -++++ b/drivers/crypto/inside-secure/safexcel.h -+@@ -314,6 +314,7 @@ -+ #define EIP197_MST_CTRL_RD_CACHE(n) (((n) & 0xf) << 0) -+ #define EIP197_MST_CTRL_WD_CACHE(n) (((n) & 0xf) << 4) -+ #define EIP197_MST_CTRL_TX_MAX_CMD(n) (((n) & 0xf) << 20) -++#define EIP97_MST_CTRL_TX_MAX_CMD(n) (((n) & 0xf) << 4) -+ #define EIP197_MST_CTRL_BYTE_SWAP BIT(24) -+ #define EIP197_MST_CTRL_NO_BYTE_SWAP BIT(25) -+ #define EIP197_MST_CTRL_BYTE_SWAP_BITS GENMASK(25, 24) -diff --git a/target/linux/mediatek/patches-5.10/401-crypto-fix-eip97-cache-incoherent.patch b/target/linux/mediatek/patches-5.10/401-crypto-fix-eip97-cache-incoherent.patch -new file mode 100644 -index 0000000000..be2bffb749 ---- /dev/null -+++ b/target/linux/mediatek/patches-5.10/401-crypto-fix-eip97-cache-incoherent.patch -@@ -0,0 +1,26 @@ -+--- a/drivers/crypto/inside-secure/safexcel.h -++++ b/drivers/crypto/inside-secure/safexcel.h -+@@ -736,6 +736,9 @@ enum safexcel_eip_version { -+ /* Priority we use for advertising our algorithms */ -+ #define SAFEXCEL_CRA_PRIORITY 300 -+ -++/* System cache line size */ -++#define SYSTEM_CACHELINE_SIZE 64 -++ -+ /* SM3 digest result for zero length message */ -+ #define EIP197_SM3_ZEROM_HASH "\x1A\xB2\x1D\x83\x55\xCF\xA1\x7F" \ -+ "\x8E\x61\x19\x48\x31\xE8\x1A\x8F" \ -+--- a/drivers/crypto/inside-secure/safexcel_hash.c -++++ b/drivers/crypto/inside-secure/safexcel_hash.c -+@@ -53,9 +53,9 @@ struct safexcel_ahash_req { -+ u8 block_sz; /* block size, only set once */ -+ u8 digest_sz; /* output digest size, only set once */ -+ __le32 state[SHA3_512_BLOCK_SIZE / -+- sizeof(__le32)] __aligned(sizeof(__le32)); -++ sizeof(__le32)] __aligned(SYSTEM_CACHELINE_SIZE); -+ -+- u64 len; -++ u64 len __aligned(SYSTEM_CACHELINE_SIZE); -+ u64 processed; -+ -+ u8 cache[HASH_CACHE_SIZE] __aligned(sizeof(u32)); -diff --git a/target/linux/mediatek/patches-5.10/410-bt-mtk-serial-fix.patch b/target/linux/mediatek/patches-5.10/410-bt-mtk-serial-fix.patch -new file mode 100644 -index 0000000000..2e474dd5fe ---- /dev/null -+++ b/target/linux/mediatek/patches-5.10/410-bt-mtk-serial-fix.patch -@@ -0,0 +1,33 @@ -+--- a/drivers/tty/serial/8250/8250.h -++++ b/drivers/tty/serial/8250/8250.h -+@@ -82,6 +82,7 @@ struct serial8250_config { -+ #define UART_CAP_MINI (1 << 17) /* Mini UART on BCM283X family lacks: -+ * STOP PARITY EPAR SPAR WLEN5 WLEN6 -+ */ -++#define UART_CAP_NMOD (1 << 18) /* UART doesn't do termios */ -+ -+ #define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */ -+ #define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */ -+--- a/drivers/tty/serial/8250/8250_port.c -++++ b/drivers/tty/serial/8250/8250_port.c -+@@ -287,7 +287,7 @@ static const struct serial8250_config ua -+ .tx_loadsz = 16, -+ .fcr = UART_FCR_ENABLE_FIFO | -+ UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT, -+- .flags = UART_CAP_FIFO, -++ .flags = UART_CAP_FIFO | UART_CAP_NMOD, -+ }, -+ [PORT_NPCM] = { -+ .name = "Nuvoton 16550", -+@@ -2687,6 +2687,11 @@ serial8250_do_set_termios(struct uart_po -+ unsigned long flags; -+ unsigned int baud, quot, frac = 0; -+ -++ if (up->capabilities & UART_CAP_NMOD) { -++ termios->c_cflag = 0; -++ return; -++ } -++ -+ if (up->capabilities & UART_CAP_MINI) { -+ termios->c_cflag &= ~(CSTOPB | PARENB | PARODD | CMSPAR); -+ if ((termios->c_cflag & CSIZE) == CS5 || -diff --git a/target/linux/mediatek/patches-5.10/500-gsw-rtl8367s-mt7622-support.patch b/target/linux/mediatek/patches-5.10/500-gsw-rtl8367s-mt7622-support.patch -new file mode 100644 -index 0000000000..bdd482def3 ---- /dev/null -+++ b/target/linux/mediatek/patches-5.10/500-gsw-rtl8367s-mt7622-support.patch -@@ -0,0 +1,25 @@ -+--- a/drivers/net/phy/Kconfig -++++ b/drivers/net/phy/Kconfig -+@@ -334,6 +334,12 @@ config ROCKCHIP_PHY -+ help -+ Currently supports the integrated Ethernet PHY. -+ -++config RTL8367S_GSW -++ tristate "rtl8367 Gigabit Switch support for mt7622" -++ depends on NET_VENDOR_MEDIATEK -++ help -++ This driver supports rtl8367s in mt7622 -++ -+ config SMSC_PHY -+ tristate "SMSC PHYs" -+ help -+--- a/drivers/net/phy/Makefile -++++ b/drivers/net/phy/Makefile -+@@ -88,6 +88,7 @@ obj-$(CONFIG_QSEMI_PHY) += qsemi.o -+ obj-$(CONFIG_REALTEK_PHY) += realtek.o -+ obj-$(CONFIG_RENESAS_PHY) += uPD60620.o -+ obj-$(CONFIG_ROCKCHIP_PHY) += rockchip.o -++obj-$(CONFIG_RTL8367S_GSW) += rtk/ -+ obj-$(CONFIG_SMSC_PHY) += smsc.o -+ obj-$(CONFIG_STE10XP) += ste10Xp.o -+ obj-$(CONFIG_TERANETICS_PHY) += teranetics.o -diff --git a/target/linux/mediatek/patches-5.10/600-dt-bindings-PCI-Mediatek-Update-PCIe-binding.patch b/target/linux/mediatek/patches-5.10/600-dt-bindings-PCI-Mediatek-Update-PCIe-binding.patch -new file mode 100644 -index 0000000000..02e4c130ea ---- /dev/null -+++ b/target/linux/mediatek/patches-5.10/600-dt-bindings-PCI-Mediatek-Update-PCIe-binding.patch -@@ -0,0 +1,415 @@ -+From patchwork Thu May 28 06:16:45 2020 -+Content-Type: text/plain; charset="utf-8" -+MIME-Version: 1.0 -+Content-Transfer-Encoding: 7bit -+X-Patchwork-Submitter: Chuanjia Liu -+X-Patchwork-Id: 11574793 -+Return-Path: -+ -+Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org -+ [172.30.200.123]) -+ by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 391201392 -+ for ; -+ Thu, 28 May 2020 06:20:27 +0000 (UTC) -+Received: from bombadil.infradead.org (bombadil.infradead.org -+ [198.137.202.133]) -+ (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) -+ (No client certificate requested) -+ by mail.kernel.org (Postfix) with ESMTPS id 104F620657 -+ for ; -+ Thu, 28 May 2020 06:20:27 +0000 (UTC) -+Authentication-Results: mail.kernel.org; -+ dkim=pass (2048-bit key) header.d=lists.infradead.org -+ header.i=@lists.infradead.org header.b="raZHaWxs"; -+ dkim=fail reason="signature verification failed" (1024-bit key) -+ header.d=mediatek.com header.i=@mediatek.com header.b="YztrByG/" -+DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 104F620657 -+Authentication-Results: mail.kernel.org; -+ dmarc=fail (p=none dis=none) header.from=mediatek.com -+Authentication-Results: mail.kernel.org; -+ spf=none -+ smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org -+DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; -+ d=lists.infradead.org; s=bombadil.20170209; h=Sender: -+ Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: -+ List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: -+ Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: -+ Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: -+ List-Owner; bh=aVtKU+Ey8KEM97+S66fz9ZMo+H8BP570jhAAvaRsNWc=; b=raZHaWxsfCxsrd -+ Byn/w1oLN/J82ApnNdBBXixq9Qj0uXIU2tBVqkiQ9lG6QDk7uguxQSJLeTqrsI/uxQmCI/PGQtZdP -+ sH0oboi2sbQSqJ/1ud4uL2pPaiLRJCxINF5oWjoZMsjn/b2fWvn52P6vTr/dxDTaabiVhY0HL0J+X -+ 7YGc1aYtO76HZHE2ke3puR42QkI8hE9E2cEhiLWeuUiLdUBegNM5MdYftu4nJTcCXnAeJjp/wIpYG -+ 7X737N9cmanDf6Bxr2bNPgaYzH+m7JK6eGxuAvWo0+PE9OX7MLrXY3KjixcjD/b0he0mfEM++gBAq -+ KBYKl5wh1mnlR2WIWXew==; -+Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) -+ by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) -+ id 1jeBtx-0005JC-DJ; Thu, 28 May 2020 06:20:25 +0000 -+Received: from mailgw01.mediatek.com ([216.200.240.184]) -+ by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) -+ id 1jeBtW-0002f2-75; Thu, 28 May 2020 06:20:01 +0000 -+X-UUID: d5cb6d96c2a5421796c2f8a284ff3670-20200527 -+DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; -+ d=mediatek.com; -+ s=dk; -+ h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; -+ bh=EqjC+5cHgv6eykN7FPf2mtwK9UivJ3XSCE0jEvb8h+8=; -+ b=YztrByG/Ia304l9KDPBwoHFYkFCN6qBXPqwZgg56CA9VitadAg2+K1VgfEU+oHqsqcsGAMdZTRMQh17tpm4bJParw6MMzAQ28te2TcxvQMV8PZMkerJdZyyYblI7ybauPWuofAQgQMtuwSKVii8eTRJbf99OZ9vDGJP3zo2j1wU=; -+X-UUID: d5cb6d96c2a5421796c2f8a284ff3670-20200527 -+Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by -+ mailgw01.mediatek.com -+ (envelope-from ) -+ (musrelay.mediatek.com ESMTP with TLS) -+ with ESMTP id 681958707; Wed, 27 May 2020 22:20:16 -0800 -+Received: from MTKMBS07N2.mediatek.inc (172.21.101.141) by -+ MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id -+ 15.0.1497.2; Wed, 27 May 2020 23:18:52 -0700 -+Received: from mtkcas07.mediatek.inc (172.21.101.84) by -+ mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id -+ 15.0.1497.2; Thu, 28 May 2020 14:18:49 +0800 -+Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc -+ (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend -+ Transport; Thu, 28 May 2020 14:18:47 +0800 -+From: -+To: , , -+Subject: [PATCH v2 1/4] dt-bindings: PCI: Mediatek: Update PCIe binding -+Date: Thu, 28 May 2020 14:16:45 +0800 -+Message-ID: <20200528061648.32078-2-chuanjia.liu@mediatek.com> -+X-Mailer: git-send-email 2.18.0 -+In-Reply-To: <20200528061648.32078-1-chuanjia.liu@mediatek.com> -+References: <20200528061648.32078-1-chuanjia.liu@mediatek.com> -+MIME-Version: 1.0 -+X-MTK: N -+X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 -+X-CRM114-CacheID: sfid-20200527_231958_261064_608CC03E -+X-CRM114-Status: GOOD ( 13.95 ) -+X-Spam-Score: -0.2 (/) -+X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: -+ Content analysis details: (-0.2 points) -+ pts rule name description -+ ---- ---------------------- -+ -------------------------------------------------- -+ -0.0 SPF_PASS SPF: sender matches SPF record -+ 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -+ 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 -+ encoding -+ -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from -+ author's domain -+ 0.1 DKIM_SIGNED Message has a DKIM or DK signature, -+ not necessarily -+ valid -+ -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -+ -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from -+ envelope-from domain -+ 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay -+ lines -+X-BeenThere: linux-mediatek@lists.infradead.org -+X-Mailman-Version: 2.1.29 -+Precedence: list -+List-Id: -+List-Unsubscribe: , -+ -+List-Archive: -+List-Post: -+List-Help: -+List-Subscribe: , -+ -+Cc: devicetree@vger.kernel.org, lorenzo.pieralisi@arm.com, -+ srv_heupstream@mediatek.com, "chuanjia.liu" , -+ linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, -+ jianjun.wang@mediatek.com, linux-mediatek@lists.infradead.org, -+ yong.wu@mediatek.com, bhelgaas@google.com, -+ linux-arm-kernel@lists.infradead.org, amurray@thegoodpenguin.co.uk -+Sender: "Linux-mediatek" -+Errors-To: -+ linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org ++++ b/target/linux/mediatek/patches-5.4/0350-mtd-parsers-trx-Allow-to-specify-trx-magic-in-DT.patch +@@ -0,0 +1,75 @@ ++From 0600e3d81628002a5cd80cf83ee454851b0063c0 Mon Sep 17 00:00:00 2001 ++From: Hauke Mehrtens ++Date: Sun, 7 Mar 2021 18:19:26 +0100 ++Subject: mtd: parsers: trx: Allow to specify trx-magic in DT + -+From: "chuanjia.liu" ++Buffalo uses a different TRX magic for every device, to be able to use ++this trx parser, make it possible to specify the TRX magic in device ++tree. If no TRX magic is specified in device tree, the standard value ++will be used. This value should only be specified if a vendor chooses to ++use a non standard TRX magic. + -+There are two independent PCIe controllers in MT2712/MT7622 platform, -+and each of them should contain an independent MSI domain. -+ -+In current architecture, MSI domain will be inherited from the root -+bridge, and all of the devices will share the same MSI domain. -+Hence that, the PCIe devices will not work properly if the irq number -+which required is more than 32. -+ -+Split the PCIe node for MT2712/MT7622 platform to fix MSI issue and -+comply with the hardware design. -+ -+Signed-off-by: chuanjia.liu ++Signed-off-by: Hauke Mehrtens +--- -+ .../bindings/pci/mediatek-pcie-cfg.yaml | 38 +++++ -+ .../devicetree/bindings/pci/mediatek-pcie.txt | 144 +++++++++++------- -+ 2 files changed, 129 insertions(+), 53 deletions(-) -+ create mode 100644 Documentation/devicetree/bindings/pci/mediatek-pcie-cfg.yaml ++ .../bindings/mtd/partitions/brcm,trx.txt | 5 +++++ ++ drivers/mtd/parsers/parser_trx.c | 21 ++++++++++++++++++- ++ 2 files changed, 25 insertions(+), 1 deletion(-) + -+--- /dev/null -++++ b/Documentation/devicetree/bindings/pci/mediatek-pcie-cfg.yaml -+@@ -0,0 +1,38 @@ -++# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause -++%YAML 1.2 -++--- -++$id: http://devicetree.org/schemas/pci/mediatek-pcie-cfg.yaml# -++$schema: http://devicetree.org/meta-schemas/core.yaml# ++--- a/Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt +++++ b/Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt ++@@ -28,6 +28,11 @@ detected by a software parsing TRX heade ++ Required properties: ++ - compatible : (required) must be "brcm,trx" ++ +++Optional properties: ++ -++title: Mediatek PCIECFG controller +++- trx-magic: TRX magic, if it is different from the default magic +++ 0x30524448 as a u32. ++ -++maintainers: -++ - Chuanjia Liu -++ - Jianjun Wang ++ Example: ++ ++ flash@0 { ++--- a/drivers/mtd/parsers/parser_trx.c +++++ b/drivers/mtd/parsers/parser_trx.c ++@@ -74,6 +74,24 @@ out_default: ++ return "rootfs"; ++ } ++ +++static uint32_t parser_trx_get_magic(struct mtd_info *mtd) +++{ +++ uint32_t trx_magic = TRX_MAGIC; +++ struct device_node *np; +++ int err; ++ -++description: | -++ The MediaTek PCIECFG controller controls some feature about -++ LTSSM, ASPM and so on. +++ np = mtd_get_of_node(mtd); +++ if (!np) +++ return trx_magic; ++ -++properties: -++ compatible: -++ items: -++ - enum: -++ - mediatek,mt7622-pciecfg -++ - mediatek,mt7629-pciecfg -++ - const: syscon +++ /* Get different magic from device tree if specified */ +++ err = of_property_read_u32(np, "trx-magic", &trx_magic); +++ if (err != 0 && err != -EINVAL) +++ pr_err("failed to parse \"trx-magic\" DT attribute, use default: %d\n", err); ++ -++ reg: -++ maxItems: 1 +++ return trx_magic; +++} ++ -++required: -++ - compatible -++ - reg -++ -++examples: -++ - | -++ pciecfg: pciecfg@1a140000 { -++ compatible = "mediatek,mt7622-pciecfg", "syscon"; -++ reg = <0 0x1a140000 0 0x1000>; -++ }; -++... -+--- a/Documentation/devicetree/bindings/pci/mediatek-pcie.txt -++++ b/Documentation/devicetree/bindings/pci/mediatek-pcie.txt -+@@ -8,7 +8,7 @@ Required properties: -+ "mediatek,mt7623-pcie" -+ "mediatek,mt7629-pcie" -+ - device_type: Must be "pci" -+-- reg: Base addresses and lengths of the PCIe subsys and root ports. -++- reg: Base addresses and lengths of the root ports. -+ - reg-names: Names of the above areas to use during resource lookup. -+ - #address-cells: Address representation for root ports (must be 3) -+ - #size-cells: Size representation for root ports (must be 2) -+@@ -19,10 +19,10 @@ Required properties: -+ - sys_ckN :transaction layer and data link layer clock -+ Required entries for MT2701/MT7623: -+ - free_ck :for reference clock of PCIe subsys -+- Required entries for MT2712/MT7622: -++ Required entries for MT2712/MT7622/MT7629: -+ - ahb_ckN :AHB slave interface operating clock for CSR access and RC -+ initiated MMIO access -+- Required entries for MT7622: -++ Required entries for MT7622/MT7629: -+ - axi_ckN :application layer MMIO channel operating clock -+ - aux_ckN :pe2_mac_bridge and pe2_mac_core operating clock when -+ pcie_mac_ck/pcie_pipe_ck is turned off -+@@ -47,10 +47,13 @@ Required properties for MT7623/MT2701: -+ - reset-names: Must be "pcie-rst0", "pcie-rst1", "pcie-rstN".. based on the -+ number of root ports. ++ static int parser_trx_parse(struct mtd_info *mtd, ++ const struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data) ++@@ -83,6 +101,7 @@ static int parser_trx_parse(struct mtd_i ++ struct trx_header trx; ++ size_t bytes_read; ++ uint8_t curr_part = 0, i = 0; +++ uint32_t trx_magic = parser_trx_get_magic(mtd); ++ int err; + -+-Required properties for MT2712/MT7622: -++Required properties for MT2712/MT7622/MT7629: -+ -interrupts: A list of interrupt outputs of the controller, must have one -+ entry for each PCIe port -+ -++Required properties for MT7622/MT7629: -++- mediatek,pcie-subsys: Should be a phandle of the pciecfg node. -++ -+ In addition, the device tree node must have sub-nodes describing each -+ PCIe port interface, having the following mandatory properties: -+ -+@@ -143,56 +146,73 @@ Examples for MT7623: -+ -+ Examples for MT2712: -+ -+- pcie: pcie@11700000 { -++ pcie1: pcie@112ff000 { -+ compatible = "mediatek,mt2712-pcie"; -+ device_type = "pci"; -+- reg = <0 0x11700000 0 0x1000>, -+- <0 0x112ff000 0 0x1000>; -+- reg-names = "port0", "port1"; -++ reg = <0 0x112ff000 0 0x1000>; -++ reg-names = "port1"; -+ #address-cells = <3>; -+ #size-cells = <2>; -+- interrupts = , -+- ; -+- clocks = <&topckgen CLK_TOP_PE2_MAC_P0_SEL>, -+- <&topckgen CLK_TOP_PE2_MAC_P1_SEL>, -+- <&pericfg CLK_PERI_PCIE0>, -++ interrupts = ; -++ interrupt-names = "pcie_irq"; -++ clocks = <&topckgen CLK_TOP_PE2_MAC_P1_SEL>, -+ <&pericfg CLK_PERI_PCIE1>; -+- clock-names = "sys_ck0", "sys_ck1", "ahb_ck0", "ahb_ck1"; -+- phys = <&pcie0_phy PHY_TYPE_PCIE>, <&pcie1_phy PHY_TYPE_PCIE>; -+- phy-names = "pcie-phy0", "pcie-phy1"; -++ clock-names = "sys_ck1", "ahb_ck1"; -++ phys = <&u3port1 PHY_TYPE_PCIE>; -++ phy-names = "pcie-phy1"; -+ bus-range = <0x00 0xff>; -+- ranges = <0x82000000 0 0x20000000 0x0 0x20000000 0 0x10000000>; -++ ranges = <0x82000000 0 0x11400000 0x0 0x11400000 0 0x300000>; -++ status = "disabled"; -+ -+- pcie0: pcie@0,0 { -+- reg = <0x0000 0 0 0 0>; -++ slot1: pcie@1,0 { -++ reg = <0x0800 0 0 0 0>; -+ #address-cells = <3>; -+ #size-cells = <2>; -+ #interrupt-cells = <1>; -+ ranges; -+ interrupt-map-mask = <0 0 0 7>; -+- interrupt-map = <0 0 0 1 &pcie_intc0 0>, -+- <0 0 0 2 &pcie_intc0 1>, -+- <0 0 0 3 &pcie_intc0 2>, -+- <0 0 0 4 &pcie_intc0 3>; -+- pcie_intc0: interrupt-controller { -++ interrupt-map = <0 0 0 1 &pcie_intc1 0>, -++ <0 0 0 2 &pcie_intc1 1>, -++ <0 0 0 3 &pcie_intc1 2>, -++ <0 0 0 4 &pcie_intc1 3>; -++ pcie_intc1: interrupt-controller { -+ interrupt-controller; -+ #address-cells = <0>; -+ #interrupt-cells = <1>; -+ }; -+ }; -++ }; -+ -+- pcie1: pcie@1,0 { -+- reg = <0x0800 0 0 0 0>; -++ pcie0: pcie@11700000 { -++ compatible = "mediatek,mt2712-pcie"; -++ device_type = "pci"; -++ reg = <0 0x11700000 0 0x1000>; -++ reg-names = "port0"; -++ #address-cells = <3>; -++ #size-cells = <2>; -++ interrupts = ; -++ interrupt-names = "pcie_irq"; -++ clocks = <&topckgen CLK_TOP_PE2_MAC_P0_SEL>, -++ <&pericfg CLK_PERI_PCIE0>; -++ clock-names = "sys_ck0", "ahb_ck0"; -++ phys = <&u3port0 PHY_TYPE_PCIE>; -++ phy-names = "pcie-phy0"; -++ bus-range = <0x00 0xff>; -++ ranges = <0x82000000 0 0x20000000 0x0 0x20000000 0 0x10000000>; -++ status = "disabled"; -++ -++ slot0: pcie@0,0 { -++ reg = <0x0000 0 0 0 0>; -+ #address-cells = <3>; -+ #size-cells = <2>; -+ #interrupt-cells = <1>; -+ ranges; -+ interrupt-map-mask = <0 0 0 7>; -+- interrupt-map = <0 0 0 1 &pcie_intc1 0>, -+- <0 0 0 2 &pcie_intc1 1>, -+- <0 0 0 3 &pcie_intc1 2>, -+- <0 0 0 4 &pcie_intc1 3>; -+- pcie_intc1: interrupt-controller { -++ interrupt-map = <0 0 0 1 &pcie_intc0 0>, -++ <0 0 0 2 &pcie_intc0 1>, -++ <0 0 0 3 &pcie_intc0 2>, -++ <0 0 0 4 &pcie_intc0 3>; -++ pcie_intc0: interrupt-controller { -+ interrupt-controller; -+ #address-cells = <0>; -+ #interrupt-cells = <1>; -+@@ -202,39 +222,31 @@ Examples for MT2712: -+ -+ Examples for MT7622: -+ -+- pcie: pcie@1a140000 { -++ pcie0: pcie@1a143000 { -+ compatible = "mediatek,mt7622-pcie"; -+ device_type = "pci"; -+- reg = <0 0x1a140000 0 0x1000>, -+- <0 0x1a143000 0 0x1000>, -+- <0 0x1a145000 0 0x1000>; -+- reg-names = "subsys", "port0", "port1"; -++ reg = <0 0x1a143000 0 0x1000>; -++ reg-names = "port0"; -++ mediatek,pcie-cfg = <&pciecfg>; -+ #address-cells = <3>; -+ #size-cells = <2>; -+- interrupts = , -+- ; -++ interrupts = ; -++ interrupt-names = "pcie_irq"; -+ clocks = <&pciesys CLK_PCIE_P0_MAC_EN>, -+- <&pciesys CLK_PCIE_P1_MAC_EN>, -+ <&pciesys CLK_PCIE_P0_AHB_EN>, -+- <&pciesys CLK_PCIE_P1_AHB_EN>, -+ <&pciesys CLK_PCIE_P0_AUX_EN>, -+- <&pciesys CLK_PCIE_P1_AUX_EN>, -+ <&pciesys CLK_PCIE_P0_AXI_EN>, -+- <&pciesys CLK_PCIE_P1_AXI_EN>, -+ <&pciesys CLK_PCIE_P0_OBFF_EN>, -+- <&pciesys CLK_PCIE_P1_OBFF_EN>, -+- <&pciesys CLK_PCIE_P0_PIPE_EN>, -+- <&pciesys CLK_PCIE_P1_PIPE_EN>; -+- clock-names = "sys_ck0", "sys_ck1", "ahb_ck0", "ahb_ck1", -+- "aux_ck0", "aux_ck1", "axi_ck0", "axi_ck1", -+- "obff_ck0", "obff_ck1", "pipe_ck0", "pipe_ck1"; -+- phys = <&pcie0_phy PHY_TYPE_PCIE>, <&pcie1_phy PHY_TYPE_PCIE>; -+- phy-names = "pcie-phy0", "pcie-phy1"; -++ <&pciesys CLK_PCIE_P0_PIPE_EN>; -++ clock-names = "sys_ck0", "ahb_ck0", "aux_ck0", -++ "axi_ck0", "obff_ck0", "pipe_ck0"; -++ -+ power-domains = <&scpsys MT7622_POWER_DOMAIN_HIF0>; -+ bus-range = <0x00 0xff>; -+- ranges = <0x82000000 0 0x20000000 0x0 0x20000000 0 0x10000000>; -++ ranges = <0x82000000 0 0x20000000 0 0x20000000 0 0x8000000>; -++ status = "disabled"; -+ -+- pcie0: pcie@0,0 { -++ slot0: pcie@0,0 { -+ reg = <0x0000 0 0 0 0>; -+ #address-cells = <3>; -+ #size-cells = <2>; -+@@ -251,8 +263,34 @@ Examples for MT7622: -+ #interrupt-cells = <1>; -+ }; -+ }; -++ }; -++ -++ pcie1: pcie@1a145000 { -++ compatible = "mediatek,mt7622-pcie"; -++ device_type = "pci"; -++ reg = <0 0x1a145000 0 0x1000>; -++ reg-names = "port1"; -++ mediatek,pcie-cfg = <&pciecfg>; -++ #address-cells = <3>; -++ #size-cells = <2>; -++ interrupts = ; -++ interrupt-names = "pcie_irq"; -++ clocks = <&pciesys CLK_PCIE_P1_MAC_EN>, -++ /* designer has connect RC1 with p0_ahb clock */ -++ <&pciesys CLK_PCIE_P0_AHB_EN>, -++ <&pciesys CLK_PCIE_P1_AUX_EN>, -++ <&pciesys CLK_PCIE_P1_AXI_EN>, -++ <&pciesys CLK_PCIE_P1_OBFF_EN>, -++ <&pciesys CLK_PCIE_P1_PIPE_EN>; -++ clock-names = "sys_ck1", "ahb_ck1", "aux_ck1", -++ "axi_ck1", "obff_ck1", "pipe_ck1"; -++ -++ power-domains = <&scpsys MT7622_POWER_DOMAIN_HIF0>; -++ bus-range = <0x00 0xff>; -++ ranges = <0x82000000 0 0x28000000 0 0x28000000 0 0x8000000>; -++ status = "disabled"; -+ -+- pcie1: pcie@1,0 { -++ slot1: pcie@1,0 { -+ reg = <0x0800 0 0 0 0>; -+ #address-cells = <3>; -+ #size-cells = <2>; -diff --git a/target/linux/mediatek/patches-5.10/601-PCI-mediatek-Use-regmap-to-get-shared-pcie-cfg-base.patch b/target/linux/mediatek/patches-5.10/601-PCI-mediatek-Use-regmap-to-get-shared-pcie-cfg-base.patch -new file mode 100644 -index 0000000000..9c18565319 ---- /dev/null -+++ b/target/linux/mediatek/patches-5.10/601-PCI-mediatek-Use-regmap-to-get-shared-pcie-cfg-base.patch -@@ -0,0 +1,217 @@ -+From patchwork Thu May 28 06:16:46 2020 -+Content-Type: text/plain; charset="utf-8" -+MIME-Version: 1.0 -+Content-Transfer-Encoding: 7bit -+X-Patchwork-Submitter: Chuanjia Liu -+X-Patchwork-Id: 11574781 -+Return-Path: -+ -+Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org -+ [172.30.200.123]) -+ by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0A99B60D -+ for ; -+ Thu, 28 May 2020 06:19:04 +0000 (UTC) -+Received: from bombadil.infradead.org (bombadil.infradead.org -+ [198.137.202.133]) -+ (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) -+ (No client certificate requested) -+ by mail.kernel.org (Postfix) with ESMTPS id DCC99208FE -+ for ; -+ Thu, 28 May 2020 06:19:03 +0000 (UTC) -+Authentication-Results: mail.kernel.org; -+ dkim=pass (2048-bit key) header.d=lists.infradead.org -+ header.i=@lists.infradead.org header.b="SpOi0ueF"; -+ dkim=fail reason="signature verification failed" (1024-bit key) -+ header.d=mediatek.com header.i=@mediatek.com header.b="UGIBoIEG" -+DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DCC99208FE -+Authentication-Results: mail.kernel.org; -+ dmarc=fail (p=none dis=none) header.from=mediatek.com -+Authentication-Results: mail.kernel.org; -+ spf=none -+ smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org -+DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; -+ d=lists.infradead.org; s=bombadil.20170209; h=Sender: -+ Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: -+ List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: -+ Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: -+ Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: -+ List-Owner; bh=LIr5poLUT/UdH6/akh/pnICGGa3rUBkN+4FhE1DyOrU=; b=SpOi0ueFcoJ/ka -+ 4esa6cDd5oU4fp0z684ZVPaVvvhm/azSZBBMYinHaAW6EvzKcMNYIX9grP8eg/728lEPNTKVq0I8H -+ PQZ9KvD4uTu8Opo1hD8LsRSLr+YLpNKt3KPOY/4gpwQ97uU9rI5PwkuAxPBgR949Vh5EiG0Vaww1H -+ Ep+I5BFRn2LVVQZP1Z7U0A0VUcOTLJ4znoWRLEXxtM9/Wd4hwQsrEPQszeDFti/RbwGfJ5efOb5UL -+ fhwBzSxELEzAAgH7env/XD2sSSpVf2Qsn6WO8D3ZepMtWrRtARiaRKSNxSBQTg2SSHcjmBSJSzcX+ -+ w8wqWaUMs0crlBuZWS1g==; -+Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) -+ by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) -+ id 1jeBsc-0001tI-88; Thu, 28 May 2020 06:19:02 +0000 -+Received: from mailgw01.mediatek.com ([216.200.240.184]) -+ by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) -+ id 1jeBsZ-0001rp-6g; Thu, 28 May 2020 06:19:01 +0000 -+X-UUID: beeaf5765357439c91eab1f67ca7ef43-20200527 -+DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; -+ d=mediatek.com; -+ s=dk; -+ h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; -+ bh=+IjWjsF/DhknqZB+lLSZ50cyvxDap+8w4tvqhp8Dv68=; -+ b=UGIBoIEGJUuq5pEvYEad1HVGpiv6yma+94hva83D2gD8lYmihRWkpJxB2yn+dVtNm7ZXXoQBf+jvvULOmslJgs1HZTLJTnjpdvLmQqo42OXRXSVpTE49HdRkJZDAIWIAReBfOEkFgNxcIX3uedrtnww/NLJ2lagrYPG5ET4lI2E=; -+X-UUID: beeaf5765357439c91eab1f67ca7ef43-20200527 -+Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw01.mediatek.com -+ (envelope-from ) -+ (musrelay.mediatek.com ESMTP with TLS) -+ with ESMTP id 603406343; Wed, 27 May 2020 22:19:17 -0800 -+Received: from mtkmbs07n1.mediatek.inc (172.21.101.16) by -+ MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id -+ 15.0.1497.2; Wed, 27 May 2020 23:18:47 -0700 -+Received: from mtkcas07.mediatek.inc (172.21.101.84) by -+ mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id -+ 15.0.1497.2; Thu, 28 May 2020 14:18:51 +0800 -+Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc -+ (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend -+ Transport; Thu, 28 May 2020 14:18:49 +0800 -+From: -+To: , , -+Subject: [PATCH v2 2/4] PCI: mediatek: Use regmap to get shared pcie-cfg base -+Date: Thu, 28 May 2020 14:16:46 +0800 -+Message-ID: <20200528061648.32078-3-chuanjia.liu@mediatek.com> -+X-Mailer: git-send-email 2.18.0 -+In-Reply-To: <20200528061648.32078-1-chuanjia.liu@mediatek.com> -+References: <20200528061648.32078-1-chuanjia.liu@mediatek.com> -+MIME-Version: 1.0 -+X-MTK: N -+X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 -+X-CRM114-CacheID: sfid-20200527_231859_251275_BED2B1E2 -+X-CRM114-Status: GOOD ( 11.62 ) -+X-Spam-Score: -0.2 (/) -+X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: -+ Content analysis details: (-0.2 points) -+ pts rule name description -+ ---- ---------------------- -+ -------------------------------------------------- -+ -0.0 SPF_PASS SPF: sender matches SPF record -+ 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -+ 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 -+ encoding -+ -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from -+ author's domain -+ 0.1 DKIM_SIGNED Message has a DKIM or DK signature, -+ not necessarily -+ valid -+ -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -+ -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from -+ envelope-from domain -+ 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay -+ lines -+X-BeenThere: linux-mediatek@lists.infradead.org -+X-Mailman-Version: 2.1.29 -+Precedence: list -+List-Id: -+List-Unsubscribe: , -+ -+List-Archive: -+List-Post: -+List-Help: -+List-Subscribe: , -+ -+Cc: devicetree@vger.kernel.org, lorenzo.pieralisi@arm.com, -+ srv_heupstream@mediatek.com, "chuanjia.liu" , -+ linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, -+ jianjun.wang@mediatek.com, linux-mediatek@lists.infradead.org, -+ yong.wu@mediatek.com, bhelgaas@google.com, -+ linux-arm-kernel@lists.infradead.org, amurray@thegoodpenguin.co.uk -+Sender: "Linux-mediatek" -+Errors-To: -+ linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org -+ -+From: "chuanjia.liu" -+ -+Use regmap to get shared pcie-cfg base and change -+the method to get pcie irq. -+ -+Signed-off-by: chuanjia.liu -+--- -+ drivers/pci/controller/pcie-mediatek.c | 25 ++++++++++++++++++------- -+ 1 file changed, 18 insertions(+), 7 deletions(-) -+ -+--- a/drivers/pci/controller/pcie-mediatek.c -++++ b/drivers/pci/controller/pcie-mediatek.c -+@@ -14,6 +14,7 @@ -+ #include -+ #include -+ #include -++#include -+ #include -+ #include -+ #include -+@@ -23,6 +24,7 @@ -+ #include -+ #include -+ #include -++#include -+ #include -+ -+ #include "../pci.h" -+@@ -205,6 +207,7 @@ struct mtk_pcie_port { -+ * struct mtk_pcie - PCIe host information -+ * @dev: pointer to PCIe device -+ * @base: IO mapped register base -++ * @cfg: IO mapped register map for PCIe config -+ * @free_ck: free-run reference clock -+ * @mem: non-prefetchable memory resource -+ * @ports: pointer to PCIe port information -+@@ -213,6 +216,7 @@ struct mtk_pcie_port { -+ struct mtk_pcie { -+ struct device *dev; -+ void __iomem *base; -++ struct regmap *cfg; -+ struct clk *free_ck; -+ -+ struct list_head ports; -+@@ -648,7 +652,7 @@ static int mtk_pcie_setup_irq(struct mtk ++ parts = kcalloc(TRX_PARSER_MAX_PARTS, sizeof(struct mtd_partition), ++@@ -97,7 +116,7 @@ static int parser_trx_parse(struct mtd_i + return err; + } + -+- port->irq = platform_get_irq(pdev, port->slot); -++ port->irq = platform_get_irq_byname(pdev, "pcie_irq"); -+ if (port->irq < 0) -+ return port->irq; -+ -+@@ -674,12 +678,11 @@ static int mtk_pcie_startup_port_v2(stru -+ if (!mem) -+ return -EINVAL; -+ -+- /* MT7622 platforms need to enable LTSSM and ASPM from PCIe subsys */ -+- if (pcie->base) { -+- val = readl(pcie->base + PCIE_SYS_CFG_V2); -+- val |= PCIE_CSR_LTSSM_EN(port->slot) | -+- PCIE_CSR_ASPM_L1_EN(port->slot); -+- writel(val, pcie->base + PCIE_SYS_CFG_V2); -++ /* MT7622/MT7629 platforms need to enable LTSSM and ASPM. */ -++ if (pcie->cfg) { -++ val = PCIE_CSR_LTSSM_EN(port->slot) | -++ PCIE_CSR_ASPM_L1_EN(port->slot); -++ regmap_update_bits(pcie->cfg, PCIE_SYS_CFG_V2, val, val); ++- if (trx.magic != TRX_MAGIC) { +++ if (trx.magic != trx_magic) { ++ kfree(parts); ++ return -ENOENT; + } -+ -+ /* Assert all reset signals */ -+@@ -983,6 +986,7 @@ static int mtk_pcie_subsys_powerup(struc -+ struct device *dev = pcie->dev; -+ struct platform_device *pdev = to_platform_device(dev); -+ struct resource *regs; -++ struct device_node *cfg_node; -+ int err; -+ -+ /* get shared registers, which are optional */ -+@@ -995,6 +999,13 @@ static int mtk_pcie_subsys_powerup(struc -+ } -+ } -+ -++ cfg_node = of_parse_phandle(dev->of_node, "mediatek,pcie-cfg", 0); -++ if (cfg_node) { -++ pcie->cfg = syscon_node_to_regmap(cfg_node); -++ if (IS_ERR(pcie->cfg)) -++ return PTR_ERR(pcie->cfg); -++ } -++ -+ pcie->free_ck = devm_clk_get(dev, "free_ck"); -+ if (IS_ERR(pcie->free_ck)) { -+ if (PTR_ERR(pcie->free_ck) == -EPROBE_DEFER) -diff --git a/target/linux/mediatek/patches-5.10/602-arm64-dts-mediatek-Split-PCIe-node-for-MT2712-MT7622.patch b/target/linux/mediatek/patches-5.10/602-arm64-dts-mediatek-Split-PCIe-node-for-MT2712-MT7622.patch +diff --git a/target/linux/mediatek/patches-5.4/0351-mtd-parsers-Remove-dependency-to-BRCM-architectures.patch b/target/linux/mediatek/patches-5.4/0351-mtd-parsers-Remove-dependency-to-BRCM-architectures.patch new file mode 100644 -index 0000000000..fa4a6ce2db +index 0000000000..fa94c22304 --- /dev/null -+++ b/target/linux/mediatek/patches-5.10/602-arm64-dts-mediatek-Split-PCIe-node-for-MT2712-MT7622.patch -@@ -0,0 +1,417 @@ -+From patchwork Thu May 28 06:16:47 2020 -+Content-Type: text/plain; charset="utf-8" -+MIME-Version: 1.0 -+Content-Transfer-Encoding: 7bit -+X-Patchwork-Submitter: Chuanjia Liu -+X-Patchwork-Id: 11574785 -+Return-Path: -+ -+Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org -+ [172.30.200.123]) -+ by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 933301391 -+ for ; -+ Thu, 28 May 2020 06:19:16 +0000 (UTC) -+Received: from bombadil.infradead.org (bombadil.infradead.org -+ [198.137.202.133]) -+ (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) -+ (No client certificate requested) -+ by mail.kernel.org (Postfix) with ESMTPS id D19F02078C -+ for ; -+ Thu, 28 May 2020 06:19:15 +0000 (UTC) -+Authentication-Results: mail.kernel.org; -+ dkim=pass (2048-bit key) header.d=lists.infradead.org -+ header.i=@lists.infradead.org header.b="s8K7t7DF"; -+ dkim=fail reason="signature verification failed" (1024-bit key) -+ header.d=mediatek.com header.i=@mediatek.com header.b="RhX81Iqp" -+DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D19F02078C -+Authentication-Results: mail.kernel.org; -+ dmarc=fail (p=none dis=none) header.from=mediatek.com -+Authentication-Results: mail.kernel.org; -+ spf=none -+ smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org -+DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; -+ d=lists.infradead.org; s=bombadil.20170209; h=Sender: -+ Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: -+ List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: -+ Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: -+ Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: -+ List-Owner; bh=NHyHqNMcE7LW10MwduOJoKiWe8cv+XayY+L6WDZeSu0=; b=s8K7t7DFh1iQ5w -+ eGvuMRgXEQv/YWRuSZRyX8lx8R2H9IuawEIgkhO6lEo6xv0VdsRuj8SptfoWg5afCItMhih373M21 -+ 6sUy3tEiuKGgklfxLU0reLEkaATkKRGLJDY3eSSs1mvZDrydKuZLDTka+YDGaiESlOhqMr95Nm6YM -+ yK8O00qTwSRPJUILRsBv1e/Kz8NRCmYhs56snABJkKeJ51NRAkb20R6qGTEd6UyBlz3jTVYwluLgF -+ bdqzywDT6+BNg/Agh6Zd+v2PpO4cmwCpGm62+3UUyZkfi/aQ4qZ/AFAfSQI+3ZBAgsKMC1PGifOi/ -+ FgGxIvAUk6atBy7DAHuw==; -+Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) -+ by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) -+ id 1jeBsn-00025C-EF; Thu, 28 May 2020 06:19:13 +0000 -+Received: from mailgw01.mediatek.com ([216.200.240.184]) -+ by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) -+ id 1jeBsZ-0001s4-6j; Thu, 28 May 2020 06:19:01 +0000 -+X-UUID: c6210e6371fa445db0ae40a8b8a7a0a1-20200527 -+DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; -+ d=mediatek.com; -+ s=dk; -+ h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; -+ bh=X9AwTdbhpWmlWY4LjTm8KLq4Cca3YI9UnyCX3O0BAak=; -+ b=RhX81Iqp0mWhBDyMQMFSEtt23+DGAWoin1SrFGP1bzp6GEtu38b2pK5RJVBshJtuxi/a1uMXZjeDsHJn02VGdNA07FrzZ7jq6YYEL+8cJs2DnhySmNElZazXPv2vKu9TWygfilTT24h/u8V/eszuRuhkdoUKWol8LwDlPl9gskg=; -+X-UUID: c6210e6371fa445db0ae40a8b8a7a0a1-20200527 -+Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw01.mediatek.com -+ (envelope-from ) -+ (musrelay.mediatek.com ESMTP with TLS) -+ with ESMTP id 7561992; Wed, 27 May 2020 22:19:17 -0800 -+Received: from mtkmbs07n1.mediatek.inc (172.21.101.16) by -+ MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id -+ 15.0.1497.2; Wed, 27 May 2020 23:18:47 -0700 -+Received: from mtkcas07.mediatek.inc (172.21.101.84) by -+ mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id -+ 15.0.1497.2; Thu, 28 May 2020 14:18:52 +0800 -+Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc -+ (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend -+ Transport; Thu, 28 May 2020 14:18:51 +0800 -+From: -+To: , , -+Subject: [PATCH v2 3/4] arm64: dts: mediatek: Split PCIe node for -+ MT2712/MT7622 -+Date: Thu, 28 May 2020 14:16:47 +0800 -+Message-ID: <20200528061648.32078-4-chuanjia.liu@mediatek.com> -+X-Mailer: git-send-email 2.18.0 -+In-Reply-To: <20200528061648.32078-1-chuanjia.liu@mediatek.com> -+References: <20200528061648.32078-1-chuanjia.liu@mediatek.com> -+MIME-Version: 1.0 -+X-MTK: N -+X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 -+X-CRM114-CacheID: sfid-20200527_231859_253529_B6751C5A -+X-CRM114-Status: GOOD ( 12.20 ) -+X-Spam-Score: -0.2 (/) -+X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: -+ Content analysis details: (-0.2 points) -+ pts rule name description -+ ---- ---------------------- -+ -------------------------------------------------- -+ -0.0 SPF_PASS SPF: sender matches SPF record -+ 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -+ 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 -+ encoding -+ -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from -+ author's domain -+ 0.1 DKIM_SIGNED Message has a DKIM or DK signature, -+ not necessarily -+ valid -+ -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -+ -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from -+ envelope-from domain -+ 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay -+ lines -+X-BeenThere: linux-mediatek@lists.infradead.org -+X-Mailman-Version: 2.1.29 -+Precedence: list -+List-Id: -+List-Unsubscribe: , -+ -+List-Archive: -+List-Post: -+List-Help: -+List-Subscribe: , -+ -+Cc: devicetree@vger.kernel.org, lorenzo.pieralisi@arm.com, -+ srv_heupstream@mediatek.com, "chuanjia.liu" , -+ linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, -+ jianjun.wang@mediatek.com, linux-mediatek@lists.infradead.org, -+ yong.wu@mediatek.com, bhelgaas@google.com, -+ linux-arm-kernel@lists.infradead.org, amurray@thegoodpenguin.co.uk -+Sender: "Linux-mediatek" -+Errors-To: -+ linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org ++++ b/target/linux/mediatek/patches-5.4/0351-mtd-parsers-Remove-dependency-to-BRCM-architectures.patch +@@ -0,0 +1,23 @@ ++From 63f0cf88ab5461acb0911252f12bb94ee3bf05a2 Mon Sep 17 00:00:00 2001 ++From: Hauke Mehrtens ++Date: Sun, 7 Mar 2021 18:23:29 +0100 ++Subject: mtd: parsers: Remove dependency to BRCM architectures + -+From: "chuanjia.liu" ++Buffalo uses the TRX partition format also on Mediatek SoCs. + -+There are two independent PCIe controllers in MT2712/MT7622 platform, -+and each of them should contain an independent MSI domain. -+ -+In current architecture, MSI domain will be inherited from the root -+bridge, and all of the devices will share the same MSI domain. -+Hence that, the PCIe devices will not work properly if the irq number -+which required is more than 32. -+ -+Split the PCIe node for MT2712/MT7622 platform to fix MSI issue and -+comply with the hardware design. -+ -+Signed-off-by: chuanjia.liu ++Signed-off-by: Hauke Mehrtens +--- -+ arch/arm64/boot/dts/mediatek/mt2712e.dtsi | 75 +++++++++++-------- -+ .../dts/mediatek/mt7622-bananapi-bpi-r64.dts | 16 ++-- -+ arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts | 6 +- -+ arch/arm64/boot/dts/mediatek/mt7622.dtsi | 68 +++++++++++------ -+ 4 files changed, 96 insertions(+), 69 deletions(-) ++ drivers/mtd/parsers/Kconfig | 2 +- ++ 1 file changed, 1 insertion(+), 1 deletion(-) + -+--- a/arch/arm64/boot/dts/mediatek/mt2712e.dtsi -++++ b/arch/arm64/boot/dts/mediatek/mt2712e.dtsi -+@@ -915,60 +915,73 @@ -+ }; -+ }; -+ -+- pcie: pcie@11700000 { -++ pcie1: pcie@112ff000 { -+ compatible = "mediatek,mt2712-pcie"; -+ device_type = "pci"; -+- reg = <0 0x11700000 0 0x1000>, -+- <0 0x112ff000 0 0x1000>; -+- reg-names = "port0", "port1"; -++ reg = <0 0x112ff000 0 0x1000>; -++ reg-names = "port1"; -+ #address-cells = <3>; -+ #size-cells = <2>; -+- interrupts = , -+- ; -+- clocks = <&topckgen CLK_TOP_PE2_MAC_P0_SEL>, -+- <&topckgen CLK_TOP_PE2_MAC_P1_SEL>, -+- <&pericfg CLK_PERI_PCIE0>, -++ interrupts = ; -++ interrupt-names = "pcie_irq"; -++ clocks = <&topckgen CLK_TOP_PE2_MAC_P1_SEL>, -+ <&pericfg CLK_PERI_PCIE1>; -+- clock-names = "sys_ck0", "sys_ck1", "ahb_ck0", "ahb_ck1"; -+- phys = <&u3port0 PHY_TYPE_PCIE>, <&u3port1 PHY_TYPE_PCIE>; -+- phy-names = "pcie-phy0", "pcie-phy1"; -++ clock-names = "sys_ck1", "ahb_ck1"; -++ phys = <&u3port1 PHY_TYPE_PCIE>; -++ phy-names = "pcie-phy1"; -+ bus-range = <0x00 0xff>; -+- ranges = <0x82000000 0 0x20000000 0x0 0x20000000 0 0x10000000>; -++ ranges = <0x82000000 0 0x11400000 0x0 0x11400000 0 0x300000>; -++ status = "disabled"; -+ -+- pcie0: pcie@0,0 { -+- device_type = "pci"; -+- status = "disabled"; -+- reg = <0x0000 0 0 0 0>; -++ slot1: pcie@1,0 { -++ reg = <0x0800 0 0 0 0>; -+ #address-cells = <3>; -+ #size-cells = <2>; -+ #interrupt-cells = <1>; -+ ranges; -+ interrupt-map-mask = <0 0 0 7>; -+- interrupt-map = <0 0 0 1 &pcie_intc0 0>, -+- <0 0 0 2 &pcie_intc0 1>, -+- <0 0 0 3 &pcie_intc0 2>, -+- <0 0 0 4 &pcie_intc0 3>; -+- pcie_intc0: interrupt-controller { -++ interrupt-map = <0 0 0 1 &pcie_intc1 0>, -++ <0 0 0 2 &pcie_intc1 1>, -++ <0 0 0 3 &pcie_intc1 2>, -++ <0 0 0 4 &pcie_intc1 3>; -++ pcie_intc1: interrupt-controller { -+ interrupt-controller; -+ #address-cells = <0>; -+ #interrupt-cells = <1>; -+ }; -+ }; -++ }; -+ -+- pcie1: pcie@1,0 { -+- device_type = "pci"; -+- status = "disabled"; -+- reg = <0x0800 0 0 0 0>; -++ pcie0: pcie@11700000 { -++ compatible = "mediatek,mt2712-pcie"; -++ device_type = "pci"; -++ reg = <0 0x11700000 0 0x1000>; -++ reg-names = "port0"; -++ #address-cells = <3>; -++ #size-cells = <2>; -++ interrupts = ; -++ interrupt-names = "pcie_irq"; -++ clocks = <&topckgen CLK_TOP_PE2_MAC_P0_SEL>, -++ <&pericfg CLK_PERI_PCIE0>; -++ clock-names = "sys_ck0", "ahb_ck0"; -++ phys = <&u3port0 PHY_TYPE_PCIE>; -++ phy-names = "pcie-phy0"; -++ bus-range = <0x00 0xff>; -++ ranges = <0x82000000 0 0x20000000 0x0 0x20000000 0 0x10000000>; -++ status = "disabled"; -++ -++ slot0: pcie@0,0 { -++ reg = <0x0000 0 0 0 0>; -+ #address-cells = <3>; -+ #size-cells = <2>; -+ #interrupt-cells = <1>; -+ ranges; -+ interrupt-map-mask = <0 0 0 7>; -+- interrupt-map = <0 0 0 1 &pcie_intc1 0>, -+- <0 0 0 2 &pcie_intc1 1>, -+- <0 0 0 3 &pcie_intc1 2>, -+- <0 0 0 4 &pcie_intc1 3>; -+- pcie_intc1: interrupt-controller { -++ interrupt-map = <0 0 0 1 &pcie_intc0 0>, -++ <0 0 0 2 &pcie_intc0 1>, -++ <0 0 0 3 &pcie_intc0 2>, -++ <0 0 0 4 &pcie_intc0 3>; -++ pcie_intc0: interrupt-controller { -+ interrupt-controller; -+ #address-cells = <0>; -+ #interrupt-cells = <1>; -+--- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts -++++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts -+@@ -257,18 +257,16 @@ -+ }; -+ }; -+ -+-&pcie { -++&pcie0 { -+ pinctrl-names = "default"; -+- pinctrl-0 = <&pcie0_pins>, <&pcie1_pins>; -++ pinctrl-0 = <&pcie0_pins>; -+ status = "okay"; -++}; -+ -+- pcie@0,0 { -+- status = "okay"; -+- }; -+- -+- pcie@1,0 { -+- status = "okay"; -+- }; -++&pcie1 { -++ pinctrl-names = "default"; -++ pinctrl-0 = <&pcie1_pins>; -++ status = "okay"; -+ }; -+ -+ &pio { -+--- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi -++++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi -+@@ -792,45 +792,41 @@ -+ #reset-cells = <1>; -+ }; -+ -+- pcie: pcie@1a140000 { -++ pciecfg: pciecfg@1a140000 { -++ compatible = "mediatek,mt7622-pciecfg", "syscon"; -++ reg = <0 0x1a140000 0 0x1000>; -++ }; -++ -++ pcie0: pcie@1a143000 { -+ compatible = "mediatek,mt7622-pcie"; -+ device_type = "pci"; -+- reg = <0 0x1a140000 0 0x1000>, -+- <0 0x1a143000 0 0x1000>, -+- <0 0x1a145000 0 0x1000>; -+- reg-names = "subsys", "port0", "port1"; -++ reg = <0 0x1a143000 0 0x1000>; -++ reg-names = "port0"; -++ mediatek,pcie-cfg = <&pciecfg>; -+ #address-cells = <3>; -+ #size-cells = <2>; -+- interrupts = , -+- ; -++ interrupts = ; -++ interrupt-names = "pcie_irq"; -+ clocks = <&pciesys CLK_PCIE_P0_MAC_EN>, -+- <&pciesys CLK_PCIE_P1_MAC_EN>, -+- <&pciesys CLK_PCIE_P0_AHB_EN>, -+ <&pciesys CLK_PCIE_P0_AHB_EN>, -+ <&pciesys CLK_PCIE_P0_AUX_EN>, -+- <&pciesys CLK_PCIE_P1_AUX_EN>, -+ <&pciesys CLK_PCIE_P0_AXI_EN>, -+- <&pciesys CLK_PCIE_P1_AXI_EN>, -+ <&pciesys CLK_PCIE_P0_OBFF_EN>, -+- <&pciesys CLK_PCIE_P1_OBFF_EN>, -+- <&pciesys CLK_PCIE_P0_PIPE_EN>, -+- <&pciesys CLK_PCIE_P1_PIPE_EN>; -+- clock-names = "sys_ck0", "sys_ck1", "ahb_ck0", "ahb_ck1", -+- "aux_ck0", "aux_ck1", "axi_ck0", "axi_ck1", -+- "obff_ck0", "obff_ck1", "pipe_ck0", "pipe_ck1"; -++ <&pciesys CLK_PCIE_P0_PIPE_EN>; -++ clock-names = "sys_ck0", "ahb_ck0", "aux_ck0", -++ "axi_ck0", "obff_ck0", "pipe_ck0"; -++ -+ power-domains = <&scpsys MT7622_POWER_DOMAIN_HIF0>; -+ bus-range = <0x00 0xff>; -+- ranges = <0x82000000 0 0x20000000 0x0 0x20000000 0 0x10000000>; -++ ranges = <0x82000000 0 0x20000000 0x0 0x20000000 0 0x8000000>; -+ status = "disabled"; -+ -+- pcie0: pcie@0,0 { -++ slot0: pcie@0,0 { -+ reg = <0x0000 0 0 0 0>; -+ #address-cells = <3>; -+ #size-cells = <2>; -+ #interrupt-cells = <1>; -+ ranges; -+- status = "disabled"; -+- -+ interrupt-map-mask = <0 0 0 7>; -+ interrupt-map = <0 0 0 1 &pcie_intc0 0>, -+ <0 0 0 2 &pcie_intc0 1>, -+@@ -842,15 +838,39 @@ -+ #interrupt-cells = <1>; -+ }; -+ }; -++ }; -+ -+- pcie1: pcie@1,0 { -++ pcie1: pcie@1a145000 { -++ compatible = "mediatek,mt7622-pcie"; -++ device_type = "pci"; -++ reg = <0 0x1a145000 0 0x1000>; -++ reg-names = "port1"; -++ mediatek,pcie-cfg = <&pciecfg>; -++ #address-cells = <3>; -++ #size-cells = <2>; -++ interrupts = ; -++ interrupt-names = "pcie_irq"; -++ clocks = <&pciesys CLK_PCIE_P1_MAC_EN>, -++ /* designer has connect RC1 with p0_ahb clock */ -++ <&pciesys CLK_PCIE_P0_AHB_EN>, -++ <&pciesys CLK_PCIE_P1_AUX_EN>, -++ <&pciesys CLK_PCIE_P1_AXI_EN>, -++ <&pciesys CLK_PCIE_P1_OBFF_EN>, -++ <&pciesys CLK_PCIE_P1_PIPE_EN>; -++ clock-names = "sys_ck1", "ahb_ck1", "aux_ck1", -++ "axi_ck1", "obff_ck1", "pipe_ck1"; -++ -++ power-domains = <&scpsys MT7622_POWER_DOMAIN_HIF0>; -++ bus-range = <0x00 0xff>; -++ ranges = <0x82000000 0 0x28000000 0x0 0x28000000 0 0x8000000>; -++ status = "disabled"; -++ -++ slot1: pcie@1,0 { -+ reg = <0x0800 0 0 0 0>; -+ #address-cells = <3>; -+ #size-cells = <2>; -+ #interrupt-cells = <1>; -+ ranges; -+- status = "disabled"; -+- -+ interrupt-map-mask = <0 0 0 7>; -+ interrupt-map = <0 0 0 1 &pcie_intc1 0>, -+ <0 0 0 2 &pcie_intc1 1>, -+--- a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts -++++ b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts -+@@ -232,18 +232,16 @@ -+ }; -+ }; -+ -+-&pcie { -++&pcie0 { -+ pinctrl-names = "default"; -+- pinctrl-0 = <&pcie0_pins>, <&pcie1_pins>; -++ pinctrl-0 = <&pcie0_pins>; -+ status = "okay"; -++}; -+ -+- pcie@0,0 { -+- status = "okay"; -+- }; -+- -+- pcie@1,0 { -+- status = "okay"; -+- }; -++&pcie1 { -++ pinctrl-names = "default"; -++ pinctrl-0 = <&pcie1_pins>; -++ status = "okay"; -+ }; -+ -+ &pio { -diff --git a/target/linux/mediatek/patches-5.10/603-ARM-dts-mediatek-Update-mt7629-PCIe-node.patch b/target/linux/mediatek/patches-5.10/603-ARM-dts-mediatek-Update-mt7629-PCIe-node.patch -new file mode 100644 -index 0000000000..799cc31ab7 ---- /dev/null -+++ b/target/linux/mediatek/patches-5.10/603-ARM-dts-mediatek-Update-mt7629-PCIe-node.patch -@@ -0,0 +1,203 @@ -+From patchwork Thu May 28 06:16:48 2020 -+Content-Type: text/plain; charset="utf-8" -+MIME-Version: 1.0 -+Content-Transfer-Encoding: 7bit -+X-Patchwork-Submitter: Chuanjia Liu -+X-Patchwork-Id: 11574797 -+Return-Path: -+ -+Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org -+ [172.30.200.123]) -+ by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 30A5E1392 -+ for ; -+ Thu, 28 May 2020 06:29:05 +0000 (UTC) -+Received: from bombadil.infradead.org (bombadil.infradead.org -+ [198.137.202.133]) -+ (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) -+ (No client certificate requested) -+ by mail.kernel.org (Postfix) with ESMTPS id 08B6320721 -+ for ; -+ Thu, 28 May 2020 06:29:05 +0000 (UTC) -+Authentication-Results: mail.kernel.org; -+ dkim=pass (2048-bit key) header.d=lists.infradead.org -+ header.i=@lists.infradead.org header.b="auhxDafY"; -+ dkim=fail reason="signature verification failed" (1024-bit key) -+ header.d=mediatek.com header.i=@mediatek.com header.b="Kj09Arxb" -+DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 08B6320721 -+Authentication-Results: mail.kernel.org; -+ dmarc=fail (p=none dis=none) header.from=mediatek.com -+Authentication-Results: mail.kernel.org; -+ spf=none -+ smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org -+DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; -+ d=lists.infradead.org; s=bombadil.20170209; h=Sender: -+ Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: -+ List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: -+ Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: -+ Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: -+ List-Owner; bh=+QPxF1vlOH7StIZYuXJa3V40x8QVDxCLF9AFXHblB9M=; b=auhxDafYBeaUZO -+ aYp2KVO8Aie0v4tYtRwBon7hF+x55JwD78SAxQR2RsSvrlOo9cMYYby+ToUWflVUWQ60FapAl+w+l -+ nkEjIOrLBErHwxNOcsD8T5kjyCBMqlz4OMAQYUDNJ3fSugRlGhOtxkjCGd9ebB8N2Rvu6/U8P1A9n -+ P15mEQoc+RLonR1+9mBgwTEXErjsraxkimTD4Txsp4IvMs3UdsMkP+r3OT5S/p+Uj6O9ES0h7xIon -+ aL79KaVqRLHrfZxnrVwuGiecAiTp8qLy9clHuJU32NA6ZcXH1OnWipKApgp8Ck7ys80WPKaMrat9B -+ XuskJ63w13DZAbCVvuGQ==; -+Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) -+ by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) -+ id 1jeC2J-00014n-M9; Thu, 28 May 2020 06:29:03 +0000 -+Received: from mailgw02.mediatek.com ([216.200.240.185]) -+ by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) -+ id 1jeC2H-00013t-Li; Thu, 28 May 2020 06:29:03 +0000 -+X-UUID: a4877c1586e64afeb2d6172e10605d2b-20200527 -+DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; -+ d=mediatek.com; -+ s=dk; -+ h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; -+ bh=CIwcBFK1x0LbOjDt1BG6/knHFxDHRiqj8ov/jWEZDBY=; -+ b=Kj09ArxbnLVTc9bpaVPT3jQrIVjhL87sSYyVF9dFypS976k78Ce9gZd0f4K3zAZbYZHYoQtuyOQ9TOeufQfgD+Cr+j5VR7pTdO2E1iXHFs/eQAz5gAjvjlK01z1JiunrLnn9dvIr6c1gEkjQHny0VpuZ1duxx79jwYusg/Nw6Wc=; -+X-UUID: a4877c1586e64afeb2d6172e10605d2b-20200527 -+Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by -+ mailgw02.mediatek.com -+ (envelope-from ) -+ (musrelay.mediatek.com ESMTP with TLS) -+ with ESMTP id 899663677; Wed, 27 May 2020 22:29:21 -0800 -+Received: from MTKMBS07N2.mediatek.inc (172.21.101.141) by -+ MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id -+ 15.0.1497.2; Wed, 27 May 2020 23:18:50 -0700 -+Received: from mtkcas07.mediatek.inc (172.21.101.84) by -+ mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id -+ 15.0.1497.2; Thu, 28 May 2020 14:18:54 +0800 -+Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc -+ (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend -+ Transport; Thu, 28 May 2020 14:18:52 +0800 -+From: -+To: , , -+Subject: [PATCH v2 4/4] ARM: dts: mediatek: Update mt7629 PCIe node -+Date: Thu, 28 May 2020 14:16:48 +0800 -+Message-ID: <20200528061648.32078-5-chuanjia.liu@mediatek.com> -+X-Mailer: git-send-email 2.18.0 -+In-Reply-To: <20200528061648.32078-1-chuanjia.liu@mediatek.com> -+References: <20200528061648.32078-1-chuanjia.liu@mediatek.com> -+MIME-Version: 1.0 -+X-MTK: N -+X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 -+X-CRM114-CacheID: sfid-20200527_232901_719172_E5A99C62 -+X-CRM114-Status: GOOD ( 11.61 ) -+X-Spam-Score: -0.2 (/) -+X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: -+ Content analysis details: (-0.2 points) -+ pts rule name description -+ ---- ---------------------- -+ -------------------------------------------------- -+ -0.0 SPF_PASS SPF: sender matches SPF record -+ 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -+ 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 -+ encoding -+ -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from -+ author's domain -+ 0.1 DKIM_SIGNED Message has a DKIM or DK signature, -+ not necessarily -+ valid -+ -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -+ -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from -+ envelope-from domain -+ 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay -+ lines -+X-BeenThere: linux-mediatek@lists.infradead.org -+X-Mailman-Version: 2.1.29 -+Precedence: list -+List-Id: -+List-Unsubscribe: , -+ -+List-Archive: -+List-Post: -+List-Help: -+List-Subscribe: , -+ -+Cc: devicetree@vger.kernel.org, lorenzo.pieralisi@arm.com, -+ srv_heupstream@mediatek.com, "chuanjia.liu" , -+ linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, -+ jianjun.wang@mediatek.com, linux-mediatek@lists.infradead.org, -+ yong.wu@mediatek.com, bhelgaas@google.com, -+ linux-arm-kernel@lists.infradead.org, amurray@thegoodpenguin.co.uk -+Sender: "Linux-mediatek" -+Errors-To: -+ linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org -+ -+From: "chuanjia.liu" -+ -+Remove unused property and add pciecfg node. -+ -+Signed-off-by: chuanjia.liu -+--- -+ arch/arm/boot/dts/mt7629-rfb.dts | 3 ++- -+ arch/arm/boot/dts/mt7629.dtsi | 23 +++++++++++++---------- -+ 2 files changed, 15 insertions(+), 11 deletions(-) -+ -+--- a/arch/arm/boot/dts/mt7629-rfb.dts -++++ b/arch/arm/boot/dts/mt7629-rfb.dts -+@@ -144,9 +144,10 @@ -+ }; -+ }; -+ -+-&pcie { -++&pcie1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pcie_pins>; -++ status = "okay"; -+ }; -+ -+ &pciephy1 { -+--- a/arch/arm/boot/dts/mt7629.dtsi -++++ b/arch/arm/boot/dts/mt7629.dtsi -+@@ -382,16 +382,21 @@ -+ #reset-cells = <1>; -+ }; -+ -+- pcie: pcie@1a140000 { -++ pciecfg: pciecfg@1a140000 { -++ compatible = "mediatek,mt7629-pciecfg", "syscon"; -++ reg = <0x1a140000 0x1000>; -++ }; -++ -++ pcie1: pcie@1a145000 { -+ compatible = "mediatek,mt7629-pcie"; -+ device_type = "pci"; -+- reg = <0x1a140000 0x1000>, -+- <0x1a145000 0x1000>; -+- reg-names = "subsys","port1"; -++ reg = <0x1a145000 0x1000>; -++ reg-names = "port1"; -++ mediatek,pcie-cfg = <&pciecfg>; -+ #address-cells = <3>; -+ #size-cells = <2>; -+- interrupts = , -+- ; -++ interrupts = ; -++ interrupt-names = "pcie_irq"; -+ clocks = <&pciesys CLK_PCIE_P1_MAC_EN>, -+ <&pciesys CLK_PCIE_P0_AHB_EN>, -+ <&pciesys CLK_PCIE_P1_AUX_EN>, -+@@ -412,21 +417,19 @@ -+ power-domains = <&scpsys MT7622_POWER_DOMAIN_HIF0>; -+ bus-range = <0x00 0xff>; -+ ranges = <0x82000000 0 0x20000000 0x20000000 0 0x10000000>; -++ status = "disabled"; -+ -+- pcie1: pcie@1,0 { -+- device_type = "pci"; -++ slot1: pcie@1,0 { -+ reg = <0x0800 0 0 0 0>; -+ #address-cells = <3>; -+ #size-cells = <2>; -+ #interrupt-cells = <1>; -+ ranges; -+- num-lanes = <1>; -+ interrupt-map-mask = <0 0 0 7>; -+ interrupt-map = <0 0 0 1 &pcie_intc1 0>, -+ <0 0 0 2 &pcie_intc1 1>, -+ <0 0 0 3 &pcie_intc1 2>, -+ <0 0 0 4 &pcie_intc1 3>; -+- -+ pcie_intc1: interrupt-controller { -+ interrupt-controller; -+ #address-cells = <0>; -diff --git a/target/linux/mediatek/patches-5.10/610-pcie-mediatek-fix-clearing-interrupt-status.patch b/target/linux/mediatek/patches-5.10/610-pcie-mediatek-fix-clearing-interrupt-status.patch -new file mode 100644 -index 0000000000..7b74a8ac73 ---- /dev/null -+++ b/target/linux/mediatek/patches-5.10/610-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 -+@@ -613,10 +613,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); -+ } -+ } -+ -diff --git a/target/linux/mediatek/patches-5.10/700-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch b/target/linux/mediatek/patches-5.10/700-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch -new file mode 100644 -index 0000000000..8c9194e5f2 ---- /dev/null -+++ b/target/linux/mediatek/patches-5.10/700-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch -@@ -0,0 +1,85 @@ -+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>; -+ }; -+@@ -967,6 +967,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 -+@@ -2482,6 +2483,13 @@ 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 | -++ ETHSYS_DMA_AG_MAP_PPE; -++ -++ 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) { -+@@ -3061,6 +3069,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 -+@@ -437,6 +437,12 @@ -+ #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) -++#define ETHSYS_DMA_AG_MAP_PPE BIT(2) -++ -+ /* SGMII subsystem config registers */ -+ /* Register to auto-negotiation restart */ -+ #define SGMSYS_PCS_CONTROL_1 0x0 -diff --git a/target/linux/mediatek/patches-5.10/710-pci-pcie-mediatek-add-support-for-coherent-DMA.patch b/target/linux/mediatek/patches-5.10/710-pci-pcie-mediatek-add-support-for-coherent-DMA.patch -new file mode 100644 -index 0000000000..503cc8937d ---- /dev/null -+++ b/target/linux/mediatek/patches-5.10/710-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 -+@@ -803,6 +803,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 = ; -+@@ -820,6 +822,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>; -+@@ -846,6 +849,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 = ; -+@@ -864,6 +869,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>; -+@@ -923,6 +929,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; -+ -+ /** -+@@ -1040,6 +1046,27 @@ static int mtk_pcie_setup(struct mtk_pci -+ struct mtk_pcie_port *port, *tmp; -+ int err; -+ -++ 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; ++--- a/drivers/mtd/parsers/Kconfig +++++ b/drivers/mtd/parsers/Kconfig ++@@ -131,7 +131,7 @@ config MTD_AFS_PARTS + ++ config MTD_PARSER_TRX ++ tristate "Parser for TRX format partitions" ++- depends on MTD && (BCM47XX || ARCH_BCM_5301X || COMPILE_TEST) +++ depends on MTD ++ help ++ TRX is a firmware format used by Broadcom on their devices. It ++ may contain up to 3/4 partitions (depending on the version). +diff --git a/target/linux/mediatek/patches-5.4/0601-net-dsa-propagate-resolved-link-config-via-mac_link_.patch b/target/linux/mediatek/patches-5.4/0601-net-dsa-propagate-resolved-link-config-via-mac_link_.patch +index f122a502a4..4c939e8017 100644 +--- a/target/linux/mediatek/patches-5.4/0601-net-dsa-propagate-resolved-link-config-via-mac_link_.patch ++++ b/target/linux/mediatek/patches-5.4/0601-net-dsa-propagate-resolved-link-config-via-mac_link_.patch +@@ -12,7 +12,7 @@ Signed-off-by: David S. Miller + + --- a/drivers/net/dsa/b53/b53_common.c + +++ b/drivers/net/dsa/b53/b53_common.c +-@@ -1291,7 +1291,9 @@ EXPORT_SYMBOL(b53_phylink_mac_link_down) ++@@ -1284,7 +1284,9 @@ EXPORT_SYMBOL(b53_phylink_mac_link_down) + void b53_phylink_mac_link_up(struct dsa_switch *ds, int port, + unsigned int mode, + phy_interface_t interface, +@@ -38,7 +38,7 @@ Signed-off-by: David S. Miller + const struct switchdev_obj_port_vlan *vlan); + --- a/drivers/net/dsa/bcm_sf2.c + +++ b/drivers/net/dsa/bcm_sf2.c +-@@ -634,7 +634,9 @@ static void bcm_sf2_sw_mac_link_down(str ++@@ -636,7 +636,9 @@ static void bcm_sf2_sw_mac_link_down(str + static void bcm_sf2_sw_mac_link_up(struct dsa_switch *ds, int port, + unsigned int mode, + phy_interface_t interface, +@@ -64,7 +64,7 @@ Signed-off-by: David S. Miller + + --- a/drivers/net/dsa/mt7530.c + +++ b/drivers/net/dsa/mt7530.c +-@@ -1452,7 +1452,9 @@ static void mt7530_phylink_mac_link_down ++@@ -1450,7 +1450,9 @@ static void mt7530_phylink_mac_link_down + static void mt7530_phylink_mac_link_up(struct dsa_switch *ds, int port, + unsigned int mode, + phy_interface_t interface, +@@ -103,7 +103,7 @@ Signed-off-by: David S. Miller + } + --- a/include/net/dsa.h + +++ b/include/net/dsa.h +-@@ -401,7 +401,9 @@ struct dsa_switch_ops { ++@@ -406,7 +406,9 @@ struct dsa_switch_ops { + void (*phylink_mac_link_up)(struct dsa_switch *ds, int port, + unsigned int mode, + phy_interface_t interface, +@@ -128,7 +128,7 @@ Signed-off-by: David S. Miller + + --- a/net/dsa/dsa_priv.h + +++ b/net/dsa/dsa_priv.h +-@@ -180,9 +180,11 @@ void dsa_port_phylink_mac_link_down(stru ++@@ -192,9 +192,11 @@ void dsa_port_phylink_mac_link_down(stru + unsigned int mode, + phy_interface_t interface); + void dsa_port_phylink_mac_link_up(struct phylink_config *config, +diff --git a/target/linux/mediatek/patches-5.4/0602-net-dsa-mt7530-use-resolved-link-config-in-mac_link_.patch b/target/linux/mediatek/patches-5.4/0602-net-dsa-mt7530-use-resolved-link-config-in-mac_link_.patch +index ae153847dc..de5b260778 100644 +--- a/target/linux/mediatek/patches-5.4/0602-net-dsa-mt7530-use-resolved-link-config-in-mac_link_.patch ++++ b/target/linux/mediatek/patches-5.4/0602-net-dsa-mt7530-use-resolved-link-config-in-mac_link_.patch +@@ -15,7 +15,7 @@ Signed-off-by: David S. Miller + + --- a/drivers/net/dsa/mt7530.c + +++ b/drivers/net/dsa/mt7530.c +-@@ -490,17 +490,6 @@ mt7530_mib_reset(struct dsa_switch *ds) ++@@ -488,17 +488,6 @@ mt7530_mib_reset(struct dsa_switch *ds) + mt7530_write(priv, MT7530_MIB_CCR, CCR_MIB_ACTIVATE); + } + +@@ -33,7 +33,7 @@ Signed-off-by: David S. Miller + static int mt7530_phy_read(struct dsa_switch *ds, int port, int regnum) + { + struct mt7530_priv *priv = ds->priv; +-@@ -674,7 +663,7 @@ mt7530_port_enable(struct dsa_switch *ds ++@@ -672,7 +661,7 @@ mt7530_port_enable(struct dsa_switch *ds + priv->ports[port].enable = true; + mt7530_rmw(priv, MT7530_PCR_P(port), PCR_MATRIX_MASK, + priv->ports[port].pm); +@@ -42,7 +42,7 @@ Signed-off-by: David S. Miller + + mutex_unlock(&priv->reg_mutex); + +-@@ -697,7 +686,7 @@ mt7530_port_disable(struct dsa_switch *d ++@@ -695,7 +684,7 @@ mt7530_port_disable(struct dsa_switch *d + priv->ports[port].enable = false; + mt7530_rmw(priv, MT7530_PCR_P(port), PCR_MATRIX_MASK, + PCR_MATRIX_CLR); +@@ -51,7 +51,7 @@ Signed-off-by: David S. Miller + + mutex_unlock(&priv->reg_mutex); + } +-@@ -1407,8 +1396,7 @@ static void mt7530_phylink_mac_config(st ++@@ -1405,8 +1394,7 @@ static void mt7530_phylink_mac_config(st + + mcr_cur = mt7530_read(priv, MT7530_PMCR_P(port)); + mcr_new = mcr_cur; +@@ -61,7 +61,7 @@ Signed-off-by: David S. Miller + mcr_new |= PMCR_IFG_XMIT(1) | PMCR_MAC_MODE | PMCR_BACKOFF_EN | + PMCR_BACKPR_EN | PMCR_FORCE_MODE; + +-@@ -1416,26 +1404,6 @@ static void mt7530_phylink_mac_config(st ++@@ -1414,26 +1402,6 @@ static void mt7530_phylink_mac_config(st + if (port == 5 && dsa_is_user_port(ds, 5)) + mcr_new |= PMCR_EXT_PHY; + +@@ -88,7 +88,7 @@ Signed-off-by: David S. Miller + if (mcr_new != mcr_cur) + mt7530_write(priv, MT7530_PMCR_P(port), mcr_new); + } +-@@ -1446,7 +1414,7 @@ static void mt7530_phylink_mac_link_down ++@@ -1444,7 +1412,7 @@ static void mt7530_phylink_mac_link_down + { + struct mt7530_priv *priv = ds->priv; + +@@ -97,7 +97,7 @@ Signed-off-by: David S. Miller + } + + static void mt7530_phylink_mac_link_up(struct dsa_switch *ds, int port, +-@@ -1457,8 +1425,31 @@ static void mt7530_phylink_mac_link_up(s ++@@ -1455,8 +1423,31 @@ static void mt7530_phylink_mac_link_up(s + bool tx_pause, bool rx_pause) + { + struct mt7530_priv *priv = ds->priv; +diff --git a/target/linux/mediatek/patches-5.4/0603-net-dsa-mt7530-Extend-device-data-ready-for-adding-a.patch b/target/linux/mediatek/patches-5.4/0603-net-dsa-mt7530-Extend-device-data-ready-for-adding-a.patch +index b86c5b8283..04189e8e31 100644 +--- a/target/linux/mediatek/patches-5.4/0603-net-dsa-mt7530-Extend-device-data-ready-for-adding-a.patch ++++ b/target/linux/mediatek/patches-5.4/0603-net-dsa-mt7530-Extend-device-data-ready-for-adding-a.patch +@@ -47,7 +47,7 @@ Signed-off-by: Sean Wang + return -EINVAL; + } + +-@@ -1344,12 +1346,11 @@ mt7530_setup(struct dsa_switch *ds) ++@@ -1342,12 +1344,11 @@ mt7530_setup(struct dsa_switch *ds) + return 0; + } + +@@ -63,7 +63,7 @@ Signed-off-by: Sean Wang + + switch (port) { + case 0: /* Internal phy */ +-@@ -1358,33 +1359,114 @@ static void mt7530_phylink_mac_config(st ++@@ -1356,33 +1357,114 @@ static void mt7530_phylink_mac_config(st + case 3: + case 4: + if (state->interface != PHY_INTERFACE_MODE_GMII) +@@ -189,7 +189,7 @@ Signed-off-by: Sean Wang + return; + } + +-@@ -1452,61 +1534,44 @@ static void mt7530_phylink_mac_link_up(s ++@@ -1450,61 +1532,44 @@ static void mt7530_phylink_mac_link_up(s + mt7530_set(priv, MT7530_PMCR_P(port), mcr); + } + +@@ -274,7 +274,7 @@ Signed-off-by: Sean Wang + phylink_set(mask, Pause); + phylink_set(mask, Asym_Pause); + +-@@ -1602,12 +1667,45 @@ static int mt7530_set_mac_eee(struct dsa ++@@ -1600,12 +1665,45 @@ static int mt7530_set_mac_eee(struct dsa + return 0; + } + +@@ -323,7 +323,7 @@ Signed-off-by: Sean Wang + .get_ethtool_stats = mt7530_get_ethtool_stats, + .get_sset_count = mt7530_get_sset_count, + .port_enable = mt7530_port_enable, +-@@ -1624,18 +1722,43 @@ static const struct dsa_switch_ops mt753 ++@@ -1622,18 +1720,43 @@ static const struct dsa_switch_ops mt753 + .port_vlan_del = mt7530_port_vlan_del, + .port_mirror_add = mt7530_port_mirror_add, + .port_mirror_del = mt7530_port_mirror_del, +@@ -372,7 +372,7 @@ Signed-off-by: Sean Wang + { /* sentinel */ }, + }; + MODULE_DEVICE_TABLE(of, mt7530_of_match); +-@@ -1673,8 +1796,21 @@ mt7530_probe(struct mdio_device *mdiodev ++@@ -1671,8 +1794,21 @@ mt7530_probe(struct mdio_device *mdiodev + /* Get the hardware identifier from the devicetree node. + * We will need it for some of the clock and regulator setup. + */ +diff --git a/target/linux/mediatek/patches-5.4/0604-net-dsa-mt7530-Add-the-support-of-MT7531-switch.patch b/target/linux/mediatek/patches-5.4/0604-net-dsa-mt7530-Add-the-support-of-MT7531-switch.patch +index 1e6126eb7f..9333f03aaf 100644 +--- a/target/linux/mediatek/patches-5.4/0604-net-dsa-mt7530-Add-the-support-of-MT7531-switch.patch ++++ b/target/linux/mediatek/patches-5.4/0604-net-dsa-mt7530-Add-the-support-of-MT7531-switch.patch +@@ -41,7 +41,7 @@ Signed-off-by: Sean Wang + _mt7530_read(struct mt7530_dummy_poll *p) + { + struct mii_bus *bus = p->priv->bus; +-@@ -483,6 +489,108 @@ mt7530_pad_clk_setup(struct dsa_switch * ++@@ -481,6 +487,108 @@ mt7530_pad_clk_setup(struct dsa_switch * + return 0; + } + +@@ -150,7 +150,7 @@ Signed-off-by: Sean Wang + static void + mt7530_mib_reset(struct dsa_switch *ds) + { +-@@ -507,6 +615,217 @@ static int mt7530_phy_write(struct dsa_s ++@@ -505,6 +613,217 @@ static int mt7530_phy_write(struct dsa_s + return mdiobus_write_nested(priv->bus, port, regnum, val); + } + +@@ -368,7 +368,7 @@ Signed-off-by: Sean Wang + static void + mt7530_get_strings(struct dsa_switch *ds, int port, u32 stringset, + uint8_t *data) +-@@ -623,9 +942,14 @@ unlock_exit: ++@@ -621,9 +940,14 @@ unlock_exit: + } + + static int +@@ -385,7 +385,7 @@ Signed-off-by: Sean Wang + /* Enable Mediatek header mode on the cpu port */ + mt7530_write(priv, MT7530_PVC_P(port), + PORT_SPEC_TAG); +-@@ -638,7 +962,7 @@ mt7530_cpu_port_enable(struct mt7530_pri ++@@ -636,7 +960,7 @@ mt7530_cpu_port_enable(struct mt7530_pri + mt7530_rmw(priv, MT7530_MFC, CPU_MASK, CPU_EN | CPU_PORT(port)); + + /* CPU port gets connected to all user ports of +@@ -394,7 +394,7 @@ Signed-off-by: Sean Wang + */ + mt7530_write(priv, MT7530_PCR_P(port), + PCR_MATRIX(dsa_user_ports(priv->ds))); +-@@ -1132,27 +1456,42 @@ mt7530_port_vlan_del(struct dsa_switch * ++@@ -1130,27 +1454,42 @@ mt7530_port_vlan_del(struct dsa_switch * + return 0; + } + +@@ -444,7 +444,7 @@ Signed-off-by: Sean Wang + + val = mt7530_read(priv, MT7530_PCR_P(port)); + if (ingress) { +-@@ -1167,7 +1506,7 @@ static int mt7530_port_mirror_add(struct ++@@ -1165,7 +1504,7 @@ static int mt7530_port_mirror_add(struct + return 0; + } + +@@ -453,7 +453,7 @@ Signed-off-by: Sean Wang + struct dsa_mall_mirror_tc_entry *mirror) + { + struct mt7530_priv *priv = ds->priv; +-@@ -1184,9 +1523,9 @@ static void mt7530_port_mirror_del(struc ++@@ -1182,9 +1521,9 @@ static void mt7530_port_mirror_del(struc + mt7530_write(priv, MT7530_PCR_P(port), val); + + if (!priv->mirror_rx && !priv->mirror_tx) { +@@ -466,7 +466,7 @@ Signed-off-by: Sean Wang + } + } + +-@@ -1292,7 +1631,7 @@ mt7530_setup(struct dsa_switch *ds) ++@@ -1290,7 +1629,7 @@ mt7530_setup(struct dsa_switch *ds) + PCR_MATRIX_CLR); + + if (dsa_is_cpu_port(ds, i)) +@@ -475,7 +475,7 @@ Signed-off-by: Sean Wang + else + mt7530_port_disable(ds, i); + +-@@ -1346,6 +1685,118 @@ mt7530_setup(struct dsa_switch *ds) ++@@ -1344,6 +1683,118 @@ mt7530_setup(struct dsa_switch *ds) + return 0; + } + +@@ -594,7 +594,7 @@ Signed-off-by: Sean Wang + static bool + mt7530_phy_mode_supported(struct dsa_switch *ds, int port, + const struct phylink_link_state *state) +-@@ -1384,6 +1835,47 @@ unsupported: ++@@ -1382,6 +1833,47 @@ unsupported: + return false; + } + +@@ -642,7 +642,7 @@ Signed-off-by: Sean Wang + static bool + mt753x_phy_mode_supported(struct dsa_switch *ds, int port, + const struct phylink_link_state *state) +-@@ -1416,6 +1908,227 @@ mt7530_mac_config(struct dsa_switch *ds, ++@@ -1414,6 +1906,227 @@ mt7530_mac_config(struct dsa_switch *ds, + return 0; + } + +@@ -870,7 +870,7 @@ Signed-off-by: Sean Wang + static int + mt753x_mac_config(struct dsa_switch *ds, int port, unsigned int mode, + const struct phylink_link_state *state) +-@@ -1451,6 +2164,8 @@ mt753x_phylink_mac_config(struct dsa_swi ++@@ -1449,6 +2162,8 @@ mt753x_phylink_mac_config(struct dsa_swi + if (mt753x_mac_config(ds, port, mode, state) < 0) + goto unsupported; + +@@ -879,7 +879,7 @@ Signed-off-by: Sean Wang + break; + case 6: /* 1st cpu port */ + if (priv->p6_interface == state->interface) +-@@ -1470,7 +2185,8 @@ unsupported: ++@@ -1468,7 +2183,8 @@ unsupported: + return; + } + +@@ -889,7 +889,7 @@ Signed-off-by: Sean Wang + dev_err(ds->dev, "%s: in-band negotiation unsupported\n", + __func__); + return; +-@@ -1480,7 +2196,7 @@ unsupported: ++@@ -1478,7 +2194,7 @@ unsupported: + mcr_new = mcr_cur; + mcr_new &= ~PMCR_LINK_SETTINGS_MASK; + mcr_new |= PMCR_IFG_XMIT(1) | PMCR_MAC_MODE | PMCR_BACKOFF_EN | +@@ -898,7 +898,7 @@ Signed-off-by: Sean Wang + + /* Are we connected to external phy */ + if (port == 5 && dsa_is_user_port(ds, 5)) +-@@ -1490,7 +2206,18 @@ unsupported: ++@@ -1488,7 +2204,18 @@ unsupported: + mt7530_write(priv, MT7530_PMCR_P(port), mcr_new); + } + +@@ -918,7 +918,7 @@ Signed-off-by: Sean Wang + unsigned int mode, + phy_interface_t interface) + { +-@@ -1499,7 +2226,19 @@ static void mt7530_phylink_mac_link_down ++@@ -1497,7 +2224,19 @@ static void mt7530_phylink_mac_link_down + mt7530_clear(priv, MT7530_PMCR_P(port), PMCR_LINK_SETTINGS_MASK); + } + +@@ -939,7 +939,7 @@ Signed-off-by: Sean Wang + unsigned int mode, + phy_interface_t interface, + struct phy_device *phydev, +-@@ -1509,18 +2248,29 @@ static void mt7530_phylink_mac_link_up(s ++@@ -1507,18 +2246,29 @@ static void mt7530_phylink_mac_link_up(s + struct mt7530_priv *priv = ds->priv; + u32 mcr; + +@@ -971,7 +971,7 @@ Signed-off-by: Sean Wang + break; + } + if (duplex == DUPLEX_FULL) { +-@@ -1534,6 +2284,45 @@ static void mt7530_phylink_mac_link_up(s ++@@ -1532,6 +2282,45 @@ static void mt7530_phylink_mac_link_up(s + mt7530_set(priv, MT7530_PMCR_P(port), mcr); + } + +@@ -1017,7 +1017,7 @@ Signed-off-by: Sean Wang + static void + mt7530_mac_port_validate(struct dsa_switch *ds, int port, + unsigned long *supported) +-@@ -1542,6 +2331,14 @@ mt7530_mac_port_validate(struct dsa_swit ++@@ -1540,6 +2329,14 @@ mt7530_mac_port_validate(struct dsa_swit + phylink_set(supported, 1000baseX_Full); + } + +@@ -1032,7 +1032,7 @@ Signed-off-by: Sean Wang + static void + mt753x_phylink_validate(struct dsa_switch *ds, int port, + unsigned long *supported, +-@@ -1558,7 +2355,8 @@ mt753x_phylink_validate(struct dsa_switc ++@@ -1556,7 +2353,8 @@ mt753x_phylink_validate(struct dsa_switc + + phylink_set_port_modes(mask); + +@@ -1042,7 +1042,7 @@ Signed-off-by: Sean Wang + phylink_set(mask, 10baseT_Half); + phylink_set(mask, 10baseT_Full); + phylink_set(mask, 100baseT_Half); +-@@ -1577,6 +2375,11 @@ mt753x_phylink_validate(struct dsa_switc ++@@ -1575,6 +2373,11 @@ mt753x_phylink_validate(struct dsa_switc + + linkmode_and(supported, supported, mask); + linkmode_and(state->advertising, state->advertising, mask); +@@ -1054,7 +1054,7 @@ Signed-off-by: Sean Wang + } + + static int +-@@ -1667,6 +2470,63 @@ static int mt7530_set_mac_eee(struct dsa ++@@ -1665,6 +2468,63 @@ static int mt7530_set_mac_eee(struct dsa + return 0; + } + +@@ -1118,7 +1118,7 @@ Signed-off-by: Sean Wang + static int + mt753x_phylink_mac_link_state(struct dsa_switch *ds, int port, + struct phylink_link_state *state) +-@@ -1720,13 +2580,14 @@ static const struct dsa_switch_ops mt753 ++@@ -1718,13 +2578,14 @@ static const struct dsa_switch_ops mt753 + .port_vlan_prepare = mt7530_port_vlan_prepare, + .port_vlan_add = mt7530_port_vlan_add, + .port_vlan_del = mt7530_port_vlan_del, +@@ -1137,7 +1137,7 @@ Signed-off-by: Sean Wang + .get_mac_eee = mt7530_get_mac_eee, + .set_mac_eee = mt7530_set_mac_eee, + }; +-@@ -1754,11 +2615,26 @@ static const struct mt753x_info mt753x_t ++@@ -1752,11 +2613,26 @@ static const struct mt753x_info mt753x_t + .mac_port_get_state = mt7530_phylink_mac_link_state, + .mac_port_config = mt7530_mac_config, + }, -- 2.25.1 diff --git a/backports/0005-kernel-5.10-fix-busy-wait-loop-in-mediatek-PPE-code.patch b/backports/0005-kernel-5.10-fix-busy-wait-loop-in-mediatek-PPE-code.patch deleted file mode 100644 index f3e1cfac9..000000000 --- a/backports/0005-kernel-5.10-fix-busy-wait-loop-in-mediatek-PPE-code.patch +++ /dev/null @@ -1,36 +0,0 @@ -From c3a5b35f6971a4c6daed3674badb6718058f5ebe Mon Sep 17 00:00:00 2001 -From: Adrian Schmutzler -Date: Tue, 16 Feb 2021 23:16:00 +0100 -Subject: [PATCH 05/22] kernel: 5.10: fix busy wait loop in mediatek PPE code - -Reapply changes added to 5.4 but not copied to 5.10: -3da4acaa7bba ("kernel: fix busy wait loop in mediatek PPE code") - -The intention is for the loop to timeout if the body does not succeed. -The current logic calls time_is_before_jiffies(timeout) which is false -until after the timeout, so the loop body never executes. - -time_is_after_jiffies(timeout) will return true until timeout is less -than jiffies, which is the intended behavior here. - -Signed-off-by: Adrian Schmutzler ---- - ...5-net-ethernet-mtk_eth_soc-add-support-for-initializin.patch | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/target/linux/generic/pending-5.10/770-15-net-ethernet-mtk_eth_soc-add-support-for-initializin.patch b/target/linux/generic/pending-5.10/770-15-net-ethernet-mtk_eth_soc-add-support-for-initializin.patch -index fa4803211a..09282175b0 100644 ---- a/target/linux/generic/pending-5.10/770-15-net-ethernet-mtk_eth_soc-add-support-for-initializin.patch -+++ b/target/linux/generic/pending-5.10/770-15-net-ethernet-mtk_eth_soc-add-support-for-initializin.patch -@@ -185,7 +185,7 @@ Signed-off-by: Felix Fietkau - +{ - + unsigned long timeout = jiffies + HZ; - + --+ while (time_is_before_jiffies(timeout)) { -++ while (time_is_after_jiffies(timeout)) { - + if (!(ppe_r32(ppe, MTK_PPE_GLO_CFG) & MTK_PPE_GLO_CFG_BUSY)) - + return 0; - + --- -2.25.1 - diff --git a/backports/0018-sysupgrade-nand-allow-limiting-rootfs_data-by-settin.patch b/backports/0005-sysupgrade-nand-allow-limiting-rootfs_data-by-settin.patch similarity index 95% rename from backports/0018-sysupgrade-nand-allow-limiting-rootfs_data-by-settin.patch rename to backports/0005-sysupgrade-nand-allow-limiting-rootfs_data-by-settin.patch index f7aef475f..2c70d2a7d 100644 --- a/backports/0018-sysupgrade-nand-allow-limiting-rootfs_data-by-settin.patch +++ b/backports/0005-sysupgrade-nand-allow-limiting-rootfs_data-by-settin.patch @@ -1,7 +1,7 @@ -From 9f0be984310a4d2bdacf94e53bd198aba3fa8675 Mon Sep 17 00:00:00 2001 +From 53e43a9bedff657125f9023384c588eca871ef97 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sat, 20 Feb 2021 08:36:43 +0100 -Subject: [PATCH 18/22] sysupgrade-nand: allow limiting rootfs_data by setting +Subject: [PATCH 05/37] sysupgrade-nand: allow limiting rootfs_data by setting env variable Check if firmware environment variable 'rootfs_data_max' exists and is diff --git a/backports/0006-kernel-hack-5.10-make-UDP-tunneling-user-selectable.patch b/backports/0006-kernel-hack-5.10-make-UDP-tunneling-user-selectable.patch deleted file mode 100644 index 36fd9c5f9..000000000 --- a/backports/0006-kernel-hack-5.10-make-UDP-tunneling-user-selectable.patch +++ /dev/null @@ -1,43 +0,0 @@ -From c7c270cedef77aa077f1f0dcc31964b43d573597 Mon Sep 17 00:00:00 2001 -From: Adrian Schmutzler -Date: Tue, 16 Feb 2021 23:25:00 +0100 -Subject: [PATCH 06/22] kernel: hack-5.10: make UDP tunneling user-selectable - -This applies another patch from 5.4 to 5.10 as well: -de09355f74c3 ("kernel/hack-5.4: make UDP tunneling user-selectable") - -UDP tunneling support isn't user-selectable, but it's required by WireGuard -which is, for the time being, an out-of-tree module. We currently work around -this issue by selecting an unrelated module which depends on UDP tunnelling -(VXLAN). This is inconvenient, as it implies this unrelated module needs to be -built-in when doing a monolithic build. - -Fix this inconvenience by making UDP tunneling user-selectable in the kernel -configuration. - -Signed-off-by: Adrian Schmutzler ---- - .../generic/hack-5.10/249-udp-tunnel-selection.patch | 11 +++++++++++ - 1 file changed, 11 insertions(+) - create mode 100644 target/linux/generic/hack-5.10/249-udp-tunnel-selection.patch - -diff --git a/target/linux/generic/hack-5.10/249-udp-tunnel-selection.patch b/target/linux/generic/hack-5.10/249-udp-tunnel-selection.patch -new file mode 100644 -index 0000000000..2c74298dfe ---- /dev/null -+++ b/target/linux/generic/hack-5.10/249-udp-tunnel-selection.patch -@@ -0,0 +1,11 @@ -+--- a/net/ipv4/Kconfig -++++ b/net/ipv4/Kconfig -+@@ -315,7 +315,7 @@ config NET_IPVTI -+ on top. -+ -+ config NET_UDP_TUNNEL -+- tristate -++ tristate "IP: UDP tunneling support" -+ select NET_IP_TUNNEL -+ default n -+ --- -2.25.1 - diff --git a/backports/0019-uboot-mediatek-add-support-for-linksys-e8450.patch b/backports/0006-uboot-mediatek-add-support-for-linksys-e8450.patch similarity index 99% rename from backports/0019-uboot-mediatek-add-support-for-linksys-e8450.patch rename to backports/0006-uboot-mediatek-add-support-for-linksys-e8450.patch index dd8bb6d92..b5f6b8e9a 100644 --- a/backports/0019-uboot-mediatek-add-support-for-linksys-e8450.patch +++ b/backports/0006-uboot-mediatek-add-support-for-linksys-e8450.patch @@ -1,7 +1,7 @@ -From 071191934f2b2eeb080f5e60f405ccc43c2d2ed8 Mon Sep 17 00:00:00 2001 +From fa6f7e0c0d7bf5d6c9697096e598372b52f51085 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 30 Jan 2021 13:58:16 +0000 -Subject: [PATCH 19/22] uboot-mediatek: add support for linksys e8450 +Subject: [PATCH 06/37] uboot-mediatek: add support for linksys e8450 Build U-Boot for the Linksys E8450 in order to have support for UBI. The loader has a default environment with scripts handling the reset diff --git a/backports/0007-kernel-5.10-add-missing-partitions-doc-syntax-commit.patch b/backports/0007-kernel-5.10-add-missing-partitions-doc-syntax-commit.patch deleted file mode 100644 index 4ea84201f..000000000 --- a/backports/0007-kernel-5.10-add-missing-partitions-doc-syntax-commit.patch +++ /dev/null @@ -1,347 +0,0 @@ -From 56c65b4ffa04a202b777e8119aaa8069264d7789 Mon Sep 17 00:00:00 2001 -From: Adrian Schmutzler -Date: Tue, 16 Feb 2021 23:31:40 +0100 -Subject: [PATCH 07/22] kernel: 5.10: add missing partitions doc syntax commit - -This patch has been added to 5.4, but not been copied to 5.10: -7495acb55573 ("kernel: backport mtd commit converting partitions doc syntax") - -Signed-off-by: Adrian Schmutzler ---- - ...convert-fixed-partitions-to-the-json.patch | 324 ++++++++++++++++++ - 1 file changed, 324 insertions(+) - create mode 100644 target/linux/generic/backport-5.10/401-v5.11-dt-bindings-mtd-convert-fixed-partitions-to-the-json.patch - -diff --git a/target/linux/generic/backport-5.10/401-v5.11-dt-bindings-mtd-convert-fixed-partitions-to-the-json.patch b/target/linux/generic/backport-5.10/401-v5.11-dt-bindings-mtd-convert-fixed-partitions-to-the-json.patch -new file mode 100644 -index 0000000000..8aded43526 ---- /dev/null -+++ b/target/linux/generic/backport-5.10/401-v5.11-dt-bindings-mtd-convert-fixed-partitions-to-the-json.patch -@@ -0,0 +1,324 @@ -+From 04e9ab75267489224364fa510a88ada83e11c325 Mon Sep 17 00:00:00 2001 -+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -+Date: Thu, 10 Dec 2020 18:23:52 +0100 -+Subject: [PATCH] dt-bindings: mtd: convert "fixed-partitions" to the -+ json-schema -+MIME-Version: 1.0 -+Content-Type: text/plain; charset=UTF-8 -+Content-Transfer-Encoding: 8bit -+ -+This standardizes its documentation, allows validating with Makefile -+checks and helps writing DTS files. -+ -+Noticeable changes: -+1. Dropped "Partitions can be represented by sub-nodes of a flash -+ device." as we also support subpartitions (don't have to be part of -+ flash device node) -+2. Dropped "to Linux" as bindings are meant to be os agnostic. -+ -+Signed-off-by: Rafał Miłecki -+Link: https://lore.kernel.org/r/20201210172352.31632-1-zajec5@gmail.com -+Signed-off-by: Rob Herring -+--- -+ .../devicetree/bindings/mtd/partition.txt | 131 +-------------- -+ .../mtd/partitions/fixed-partitions.yaml | 152 ++++++++++++++++++ -+ 2 files changed, 154 insertions(+), 129 deletions(-) -+ create mode 100644 Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml -+ -+--- a/Documentation/devicetree/bindings/mtd/partition.txt -++++ b/Documentation/devicetree/bindings/mtd/partition.txt -+@@ -24,137 +24,10 @@ another partitioning method. -+ Available bindings are listed in the "partitions" subdirectory. -+ -+ -+-Fixed Partitions -+-================ -+- -+-Partitions can be represented by sub-nodes of a flash device. This can be used -+-on platforms which have strong conventions about which portions of a flash are -+-used for what purposes, but which don't use an on-flash partition table such -+-as RedBoot. -+- -+-The partition table should be a subnode of the flash node and should be named -+-'partitions'. This node should have the following property: -+-- compatible : (required) must be "fixed-partitions" -+-Partitions are then defined in subnodes of the partitions node. -++Deprecated: partitions defined in flash node -++============================================ -+ -+ For backwards compatibility partitions as direct subnodes of the flash device are -+ supported. This use is discouraged. -+ NOTE: also for backwards compatibility, direct subnodes that have a compatible -+ string are not considered partitions, as they may be used for other bindings. -+- -+-#address-cells & #size-cells must both be present in the partitions subnode of the -+-flash device. There are two valid values for both: -+-<1>: for partitions that require a single 32-bit cell to represent their -+- size/address (aka the value is below 4 GiB) -+-<2>: for partitions that require two 32-bit cells to represent their -+- size/address (aka the value is 4 GiB or greater). -+- -+-Required properties: -+-- reg : The partition's offset and size within the flash -+- -+-Optional properties: -+-- label : The label / name for this partition. If omitted, the label is taken -+- from the node name (excluding the unit address). -+-- read-only : This parameter, if present, is a hint to Linux that this -+- partition should only be mounted read-only. This is usually used for flash -+- partitions containing early-boot firmware images or data which should not be -+- clobbered. -+-- lock : Do not unlock the partition at initialization time (not supported on -+- all devices) -+-- slc-mode: This parameter, if present, allows one to emulate SLC mode on a -+- partition attached to an MLC NAND thus making this partition immune to -+- paired-pages corruptions -+- -+-Examples: -+- -+- -+-flash@0 { -+- partitions { -+- compatible = "fixed-partitions"; -+- #address-cells = <1>; -+- #size-cells = <1>; -+- -+- partition@0 { -+- label = "u-boot"; -+- reg = <0x0000000 0x100000>; -+- read-only; -+- }; -+- -+- uimage@100000 { -+- reg = <0x0100000 0x200000>; -+- }; -+- }; -+-}; -+- -+-flash@1 { -+- partitions { -+- compatible = "fixed-partitions"; -+- #address-cells = <1>; -+- #size-cells = <2>; -+- -+- /* a 4 GiB partition */ -+- partition@0 { -+- label = "filesystem"; -+- reg = <0x00000000 0x1 0x00000000>; -+- }; -+- }; -+-}; -+- -+-flash@2 { -+- partitions { -+- compatible = "fixed-partitions"; -+- #address-cells = <2>; -+- #size-cells = <2>; -+- -+- /* an 8 GiB partition */ -+- partition@0 { -+- label = "filesystem #1"; -+- reg = <0x0 0x00000000 0x2 0x00000000>; -+- }; -+- -+- /* a 4 GiB partition */ -+- partition@200000000 { -+- label = "filesystem #2"; -+- reg = <0x2 0x00000000 0x1 0x00000000>; -+- }; -+- }; -+-}; -+- -+-flash@3 { -+- partitions { -+- compatible = "fixed-partitions"; -+- #address-cells = <1>; -+- #size-cells = <1>; -+- -+- partition@0 { -+- label = "bootloader"; -+- reg = <0x000000 0x100000>; -+- read-only; -+- }; -+- -+- firmware@100000 { -+- label = "firmware"; -+- reg = <0x100000 0xe00000>; -+- compatible = "brcm,trx"; -+- }; -+- -+- calibration@f00000 { -+- label = "calibration"; -+- reg = <0xf00000 0x100000>; -+- compatible = "fixed-partitions"; -+- ranges = <0 0xf00000 0x100000>; -+- #address-cells = <1>; -+- #size-cells = <1>; -+- -+- partition@0 { -+- label = "wifi0"; -+- reg = <0x000000 0x080000>; -+- }; -+- -+- partition@80000 { -+- label = "wifi1"; -+- reg = <0x080000 0x080000>; -+- }; -+- }; -+- }; -+-}; -+--- /dev/null -++++ b/Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml -+@@ -0,0 +1,152 @@ -++# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause -++%YAML 1.2 -++--- -++$id: http://devicetree.org/schemas/mtd/partitions/fixed-partitions.yaml# -++$schema: http://devicetree.org/meta-schemas/core.yaml# -++ -++title: Fixed partitions -++ -++description: | -++ This binding can be used on platforms which have strong conventions about -++ which portions of a flash are used for what purposes, but which don't use an -++ on-flash partition table such as RedBoot. -++ -++ The partition table should be a node named "partitions". Partitions are then -++ defined as subnodes. -++ -++maintainers: -++ - Rafał Miłecki -++ -++properties: -++ compatible: -++ const: fixed-partitions -++ -++ "#address-cells": true -++ -++ "#size-cells": true -++ -++patternProperties: -++ "@[0-9a-f]+$": -++ description: node describing a single flash partition -++ type: object -++ -++ properties: -++ reg: -++ description: partition's offset and size within the flash -++ maxItems: 1 -++ -++ label: -++ description: The label / name for this partition. If omitted, the label -++ is taken from the node name (excluding the unit address). -++ -++ read-only: -++ description: This parameter, if present, is a hint that this partition -++ should only be mounted read-only. This is usually used for flash -++ partitions containing early-boot firmware images or data which should -++ not be clobbered. -++ type: boolean -++ -++ lock: -++ description: Do not unlock the partition at initialization time (not -++ supported on all devices) -++ type: boolean -++ -++ slc-mode: -++ description: This parameter, if present, allows one to emulate SLC mode -++ on a partition attached to an MLC NAND thus making this partition -++ immune to paired-pages corruptions -++ type: boolean -++ -++ required: -++ - reg -++ -++required: -++ - "#address-cells" -++ - "#size-cells" -++ -++additionalProperties: true -++ -++examples: -++ - | -++ partitions { -++ compatible = "fixed-partitions"; -++ #address-cells = <1>; -++ #size-cells = <1>; -++ -++ partition@0 { -++ label = "u-boot"; -++ reg = <0x0000000 0x100000>; -++ read-only; -++ }; -++ -++ uimage@100000 { -++ reg = <0x0100000 0x200000>; -++ }; -++ }; -++ - | -++ partitions { -++ compatible = "fixed-partitions"; -++ #address-cells = <1>; -++ #size-cells = <2>; -++ -++ /* a 4 GiB partition */ -++ partition@0 { -++ label = "filesystem"; -++ reg = <0x00000000 0x1 0x00000000>; -++ }; -++ }; -++ - | -++ partitions { -++ compatible = "fixed-partitions"; -++ #address-cells = <2>; -++ #size-cells = <2>; -++ -++ /* an 8 GiB partition */ -++ partition@0 { -++ label = "filesystem #1"; -++ reg = <0x0 0x00000000 0x2 0x00000000>; -++ }; -++ -++ /* a 4 GiB partition */ -++ partition@200000000 { -++ label = "filesystem #2"; -++ reg = <0x2 0x00000000 0x1 0x00000000>; -++ }; -++ }; -++ - | -++ partitions { -++ compatible = "fixed-partitions"; -++ #address-cells = <1>; -++ #size-cells = <1>; -++ -++ partition@0 { -++ label = "bootloader"; -++ reg = <0x000000 0x100000>; -++ read-only; -++ }; -++ -++ firmware@100000 { -++ compatible = "brcm,trx"; -++ label = "firmware"; -++ reg = <0x100000 0xe00000>; -++ }; -++ -++ calibration@f00000 { -++ compatible = "fixed-partitions"; -++ label = "calibration"; -++ reg = <0xf00000 0x100000>; -++ ranges = <0 0xf00000 0x100000>; -++ #address-cells = <1>; -++ #size-cells = <1>; -++ -++ partition@0 { -++ label = "wifi0"; -++ reg = <0x000000 0x080000>; -++ }; -++ -++ partition@80000 { -++ label = "wifi1"; -++ reg = <0x080000 0x080000>; -++ }; -++ }; -++ }; --- -2.25.1 - diff --git a/backports/0020-uboot-envtools-add-defaults-for-linksys-e8450-ubi.patch b/backports/0007-uboot-envtools-add-defaults-for-linksys-e8450-ubi.patch similarity index 90% rename from backports/0020-uboot-envtools-add-defaults-for-linksys-e8450-ubi.patch rename to backports/0007-uboot-envtools-add-defaults-for-linksys-e8450-ubi.patch index 63a2d112f..3c14a94b0 100644 --- a/backports/0020-uboot-envtools-add-defaults-for-linksys-e8450-ubi.patch +++ b/backports/0007-uboot-envtools-add-defaults-for-linksys-e8450-ubi.patch @@ -1,7 +1,7 @@ -From ce99ccf70f226ea3aac19120ab8634b8cb6a1478 Mon Sep 17 00:00:00 2001 +From afdb544b7378d99ad776e8b2bc66a00dbeb48c06 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Fri, 12 Feb 2021 03:09:39 +0000 -Subject: [PATCH 20/22] uboot-envtools: add defaults for linksys-e8450-ubi +Subject: [PATCH 07/37] uboot-envtools: add defaults for linksys-e8450-ubi Add U-Boot environment configuration for the Linksys E8450 (UBI) to allow access to the bootloader environment from OpenWrt via diff --git a/backports/0008-kernel-5.10-refresh-patches.patch b/backports/0008-kernel-5.10-refresh-patches.patch deleted file mode 100644 index f1bc16074..000000000 --- a/backports/0008-kernel-5.10-refresh-patches.patch +++ /dev/null @@ -1,226 +0,0 @@ -From cebbb0ffa366e356268afe15fb243682313e02fc Mon Sep 17 00:00:00 2001 -From: Adrian Schmutzler -Date: Tue, 16 Feb 2021 23:39:32 +0100 -Subject: [PATCH 08/22] kernel: 5.10: refresh patches - -Signed-off-by: Adrian Schmutzler ---- - .../generic/hack-5.10/531-debloat_lzma.patch | 33 ++++++++++--------- - ...t-command-line-parameters-from-users.patch | 10 +++--- - ...ble-add-offload-support-for-xmit-pat.patch | 15 +++++---- - ...dd-support-for-threaded-NAPI-polling.patch | 15 +++++---- - .../pending-5.10/834-ledtrig-libata.patch | 4 +-- - 5 files changed, 41 insertions(+), 36 deletions(-) - -diff --git a/target/linux/generic/hack-5.10/531-debloat_lzma.patch b/target/linux/generic/hack-5.10/531-debloat_lzma.patch -index 0854872ffa..2f70eee3e9 100644 ---- a/target/linux/generic/hack-5.10/531-debloat_lzma.patch -+++ b/target/linux/generic/hack-5.10/531-debloat_lzma.patch -@@ -710,26 +710,26 @@ Signed-off-by: Felix Fietkau - { - UInt32 dicSize; - Byte d; --@@ -935,33 +883,11 @@ static SRes LzmaDec_AllocateProbs2(CLzma -+@@ -935,7 +883,7 @@ static SRes LzmaDec_AllocateProbs2(CLzma - return SZ_OK; - } - - -SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) ---{ --- CLzmaProps propNew; --- RINOK(LzmaProps_Decode(&propNew, props, propsSize)); --- RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); --- p->prop = propNew; --- return SZ_OK; ---} --- ---SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) - +static SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) - { - CLzmaProps propNew; --- SizeT dicBufSize; - RINOK(LzmaProps_Decode(&propNew, props, propsSize)); -- RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); -+@@ -943,28 +891,6 @@ SRes LzmaDec_AllocateProbs(CLzmaDec *p, -+ p->prop = propNew; -+ return SZ_OK; -+ } -+- -+-SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) -+-{ -+- CLzmaProps propNew; -+- SizeT dicBufSize; -+- RINOK(LzmaProps_Decode(&propNew, props, propsSize)); -+- RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); - - dicBufSize = propNew.dicSize; - - if (p->dic == 0 || dicBufSize != p->dicBufSize) - - { -@@ -742,9 +742,12 @@ Signed-off-by: Felix Fietkau - - } - - } - - p->dicBufSize = dicBufSize; -- p->prop = propNew; -- return SZ_OK; -- } -+- p->prop = propNew; -+- return SZ_OK; -+-} -+ -+ SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, -+ const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, - --- a/lib/lzma/LzmaEnc.c - +++ b/lib/lzma/LzmaEnc.c - @@ -53,7 +53,7 @@ void LzmaEncProps_Init(CLzmaEncProps *p) -diff --git a/target/linux/generic/pending-5.10/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch b/target/linux/generic/pending-5.10/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch -index 5a0e44b76b..2808c95322 100644 ---- a/target/linux/generic/pending-5.10/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch -+++ b/target/linux/generic/pending-5.10/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch -@@ -267,15 +267,15 @@ Signed-off-by: Yousong Zhou - + EXPORT(kexec_argv_buf) - + .skip KEXEC_COMMAND_LINE_SIZE - + .size kexec_argv_buf, KEXEC_COMMAND_LINE_SIZE -++ -++kexec_argv: -++ EXPORT(kexec_argv) -++ .skip KEXEC_ARGV_SIZE -++ .size kexec_argv, KEXEC_ARGV_SIZE - - -relocate_new_kernel_size: - - EXPORT(relocate_new_kernel_size) - - PTR relocate_new_kernel_end - relocate_new_kernel - - .size relocate_new_kernel_size, PTRSIZE --+kexec_argv: --+ EXPORT(kexec_argv) --+ .skip KEXEC_ARGV_SIZE --+ .size kexec_argv, KEXEC_ARGV_SIZE --+ - +kexec_relocate_new_kernel_end: - + EXPORT(kexec_relocate_new_kernel_end) -diff --git a/target/linux/generic/pending-5.10/640-11-netfilter-flowtable-add-offload-support-for-xmit-pat.patch b/target/linux/generic/pending-5.10/640-11-netfilter-flowtable-add-offload-support-for-xmit-pat.patch -index 5e3c7e031a..508dc90e14 100644 ---- a/target/linux/generic/pending-5.10/640-11-netfilter-flowtable-add-offload-support-for-xmit-pat.patch -+++ b/target/linux/generic/pending-5.10/640-11-netfilter-flowtable-add-offload-support-for-xmit-pat.patch -@@ -85,12 +85,14 @@ tag to the driver. - - n = dst_neigh_lookup(dst_cache, daddr); - - if (!n) - - return -ENOENT; --+ this_tuple = &flow->tuplehash[dir].tuple; -- -+- - - read_lock_bh(&n->lock); - - nud_state = n->nud_state; - - ether_addr_copy(ha, n->ha); - - read_unlock_bh(&n->lock); -++ this_tuple = &flow->tuplehash[dir].tuple; -+ -+- if (!(nud_state & NUD_VALID)) { - + switch (this_tuple->xmit_type) { - + case FLOW_OFFLOAD_XMIT_DIRECT: - + ether_addr_copy(ha, this_tuple->out.h_dest); -@@ -102,8 +104,7 @@ tag to the driver. - + n = dst_neigh_lookup(dst_cache, daddr); - + if (!n) - + return -ENOENT; -- --- if (!(nud_state & NUD_VALID)) { -++ - + read_lock_bh(&n->lock); - + nud_state = n->nud_state; - + ether_addr_copy(ha, n->ha); -@@ -143,8 +144,7 @@ tag to the driver. - + struct flow_action_entry *entry; - + struct net_device *dev; - + int ifindex; -- --- rt = (struct rtable *)flow->tuplehash[dir].tuple.dst_cache; -++ - + this_tuple = &flow->tuplehash[dir].tuple; - + switch (this_tuple->xmit_type) { - + case FLOW_OFFLOAD_XMIT_DIRECT: -@@ -158,7 +158,8 @@ tag to the driver. - + default: - + return; - + } --+ -+ -+- rt = (struct rtable *)flow->tuplehash[dir].tuple.dst_cache; - + dev = dev_get_by_index(net, ifindex); - + if (!dev) - + return; -diff --git a/target/linux/generic/pending-5.10/690-net-add-support-for-threaded-NAPI-polling.patch b/target/linux/generic/pending-5.10/690-net-add-support-for-threaded-NAPI-polling.patch -index 79b7832f2a..2979934926 100644 ---- a/target/linux/generic/pending-5.10/690-net-add-support-for-threaded-NAPI-polling.patch -+++ b/target/linux/generic/pending-5.10/690-net-add-support-for-threaded-NAPI-polling.patch -@@ -214,7 +214,7 @@ Signed-off-by: Felix Fietkau - napi_hash_del(napi); - list_del_rcu(&napi->dev_list); - napi_free_frags(napi); --@@ -6788,52 +6881,18 @@ EXPORT_SYMBOL(__netif_napi_del); -+@@ -6788,53 +6881,19 @@ EXPORT_SYMBOL(__netif_napi_del); - - static int napi_poll(struct napi_struct *n, struct list_head *repoll) - { -@@ -228,7 +228,8 @@ Signed-off-by: Felix Fietkau - have = netpoll_poll_lock(n); - - - weight = n->weight; --- -++ work = __napi_poll(n, &do_repoll); -+ - - /* This NAPI_STATE_SCHED test is for avoiding a race - - * with netpoll's poll_napi(). Only the entity which - - * obtains the lock and sees NAPI_STATE_SCHED set will -@@ -246,8 +247,8 @@ Signed-off-by: Felix Fietkau - - n->poll, work, weight); - - - - if (likely(work < weight)) --- goto out_unlock; --+ work = __napi_poll(n, &do_repoll); -++ if (!do_repoll) -+ goto out_unlock; - - - /* Drivers must not modify the NAPI state if they - - * consume the entire weight. In such cases this code -@@ -256,8 +257,7 @@ Signed-off-by: Felix Fietkau - - */ - - if (unlikely(napi_disable_pending(n))) { - - napi_complete(n); --+ if (!do_repoll) -- goto out_unlock; -+- goto out_unlock; - - } - - - - if (n->gro_bitmask) { -@@ -268,9 +268,10 @@ Signed-off-by: Felix Fietkau - - } - - - - gro_normal_list(n); -- -+- - /* Some drivers may have called napi_schedule - * prior to exhausting their budget. -+ */ - @@ -11288,6 +11347,10 @@ static int __init net_dev_init(void) - sd->backlog.weight = weight_p; - } -diff --git a/target/linux/generic/pending-5.10/834-ledtrig-libata.patch b/target/linux/generic/pending-5.10/834-ledtrig-libata.patch -index 623e48085d..a52e712d8c 100644 ---- a/target/linux/generic/pending-5.10/834-ledtrig-libata.patch -+++ b/target/linux/generic/pending-5.10/834-ledtrig-libata.patch -@@ -106,11 +106,11 @@ Signed-off-by: Daniel Golle - + for (i = 0; i < host->n_ports; i++) { - + if (unlikely(!host->ports[i]->ledtrig)) - + continue; --+ -+ - + snprintf(host->ports[i]->ledtrig_name, - + sizeof(host->ports[i]->ledtrig_name), "ata%u", - + host->ports[i]->print_id); -- -++ - + host->ports[i]->ledtrig->name = host->ports[i]->ledtrig_name; - + - + if (led_trigger_register(host->ports[i]->ledtrig)) { --- -2.25.1 - diff --git a/backports/0022-realtek-update-to-latest-owrt-HEAD.patch b/backports/0008-realtek-update-to-latest-owrt-HEAD.patch similarity index 99% rename from backports/0022-realtek-update-to-latest-owrt-HEAD.patch rename to backports/0008-realtek-update-to-latest-owrt-HEAD.patch index ef7891372..a478794b6 100644 --- a/backports/0022-realtek-update-to-latest-owrt-HEAD.patch +++ b/backports/0008-realtek-update-to-latest-owrt-HEAD.patch @@ -1,7 +1,7 @@ -From 7af6b8d742289a728629ecae929a0f8fa441ba3f Mon Sep 17 00:00:00 2001 +From c07c28c4cbd35e1cfd5033b1da6226d1a54f0454 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 16 Mar 2021 10:46:51 +0100 -Subject: [PATCH 22/22] realtek: update to latest owrt HEAD +Subject: [PATCH 08/37] realtek: update to latest owrt HEAD Signed-off-by: John Crispin --- diff --git a/backports/0009-include-set-kernel-version.mk.patch b/backports/0009-include-set-kernel-version.mk.patch new file mode 100644 index 000000000..ffbdc700f --- /dev/null +++ b/backports/0009-include-set-kernel-version.mk.patch @@ -0,0 +1,31 @@ +From a8c9777a9edb012fd67d2419b207a7c591f08aba Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Wed, 7 Apr 2021 10:46:26 +0200 +Subject: [PATCH 09/37] include: set kernel-version.mk + +Signed-off-by: John Crispin +--- + include/kernel-version.mk | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/include/kernel-version.mk b/include/kernel-version.mk +index aff812e57f..ace6d45149 100644 +--- a/include/kernel-version.mk ++++ b/include/kernel-version.mk +@@ -6,9 +6,13 @@ ifdef CONFIG_TESTING_KERNEL + KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER) + endif + ++LINUX_VERSION-4.4 = .60 + LINUX_VERSION-5.4 = .108 ++LINUX_VERSION-5.10 = .27 + ++LINUX_KERNEL_HASH-4.4.60 = 2cd8df6f1ac6a5329c5a286ec9b5956215977221a1b731597ed169fff74a9659 + LINUX_KERNEL_HASH-5.4.108 = f212ac07c21bd33e6898fdbb2ddba2a454f74578bbe7bef8fe4dbbbc0ec52172 ++LINUX_KERNEL_HASH-5.10.27 = d99dc9662951299c53a0a8d8c8d0a72a16ff861d20e927c0f9b14f63282d69d9 + + remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1)))) + sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1))))))) +-- +2.25.1 + diff --git a/backports/0010-kernel-update-kernel-5.10-to-5.10.16.patch b/backports/0010-kernel-update-kernel-5.10-to-5.10.16.patch deleted file mode 100644 index 3bbf02762..000000000 --- a/backports/0010-kernel-update-kernel-5.10-to-5.10.16.patch +++ /dev/null @@ -1,60 +0,0 @@ -From c0484713ff059736b169496d396f722af5db31c0 Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Sun, 14 Feb 2021 20:17:31 +0000 -Subject: [PATCH 10/22] kernel: update kernel 5.10 to 5.10.16 - -Compile and runtime-tested on mediatek/mt7622 - -Signed-off-by: Daniel Golle ---- - include/kernel-version.mk | 4 ++-- - .../491-ubi-auto-create-ubiblock-device-for-rootfs.patch | 2 +- - .../pending-5.10/760-net-dsa-mv88e6xxx-fix-vlan-setup.patch | 2 +- - 3 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/include/kernel-version.mk b/include/kernel-version.mk -index 035692f3e3..26f24bae42 100644 ---- a/include/kernel-version.mk -+++ b/include/kernel-version.mk -@@ -7,10 +7,10 @@ ifdef CONFIG_TESTING_KERNEL - endif - - LINUX_VERSION-5.4 = .105 --LINUX_VERSION-5.10 = .14 -+LINUX_VERSION-5.10 = .16 - - LINUX_KERNEL_HASH-5.4.105 = 244e4cd16184285df55ec5a9501daba011aa8b85c5527ee05eab4592e70fb8b6 --LINUX_KERNEL_HASH-5.10.14 = fa27b79f198b5be969e497ed5461860df48e0591c85e60699fc8be26837a1d2a -+LINUX_KERNEL_HASH-5.10.16 = 536fe3ea273bfcc72b3571d3b3a7ff0a5bcdc16068efd22e42c4f9d03c200a37 - - remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1)))) - sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1))))))) -diff --git a/target/linux/generic/pending-5.10/491-ubi-auto-create-ubiblock-device-for-rootfs.patch b/target/linux/generic/pending-5.10/491-ubi-auto-create-ubiblock-device-for-rootfs.patch -index 61fcbac92e..e5ee2c8656 100644 ---- a/target/linux/generic/pending-5.10/491-ubi-auto-create-ubiblock-device-for-rootfs.patch -+++ b/target/linux/generic/pending-5.10/491-ubi-auto-create-ubiblock-device-for-rootfs.patch -@@ -53,7 +53,7 @@ Signed-off-by: Daniel Golle - static void ubiblock_remove_all(void) - { - struct ubiblock *next; --@@ -684,6 +722,10 @@ int __init ubiblock_init(void) -+@@ -684,6 +725,10 @@ int __init ubiblock_init(void) - */ - ubiblock_create_from_param(); - -diff --git a/target/linux/generic/pending-5.10/760-net-dsa-mv88e6xxx-fix-vlan-setup.patch b/target/linux/generic/pending-5.10/760-net-dsa-mv88e6xxx-fix-vlan-setup.patch -index e6a3d15b79..42b91fe4c3 100644 ---- a/target/linux/generic/pending-5.10/760-net-dsa-mv88e6xxx-fix-vlan-setup.patch -+++ b/target/linux/generic/pending-5.10/760-net-dsa-mv88e6xxx-fix-vlan-setup.patch -@@ -17,7 +17,7 @@ Signed-off-by: DENG Qingfang - - --- a/drivers/net/dsa/mv88e6xxx/chip.c - +++ b/drivers/net/dsa/mv88e6xxx/chip.c --@@ -2853,6 +2853,7 @@ static int mv88e6xxx_setup(struct dsa_sw -+@@ -2857,6 +2857,7 @@ static int mv88e6xxx_setup(struct dsa_sw - - chip->ds = ds; - ds->slave_mii_bus = mv88e6xxx_default_mdio_bus(chip); --- -2.25.1 - diff --git a/backports/0010-mt76-update-to-latest-HEAD-revision.patch b/backports/0010-mt76-update-to-latest-HEAD-revision.patch new file mode 100644 index 000000000..860331f84 --- /dev/null +++ b/backports/0010-mt76-update-to-latest-HEAD-revision.patch @@ -0,0 +1,45 @@ +From ea0fbd7e8fcf269feaf54b639512651faf96dcfd Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Wed, 7 Apr 2021 11:11:04 +0200 +Subject: [PATCH 10/37] mt76: update to latest HEAD revision + +Signed-off-by: John Crispin +--- + package/kernel/mt76/Makefile | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile +index 45375ef564..c58d9aa9f6 100644 +--- a/package/kernel/mt76/Makefile ++++ b/package/kernel/mt76/Makefile +@@ -8,9 +8,9 @@ PKG_LICENSE_FILES:= + + PKG_SOURCE_URL:=https://github.com/openwrt/mt76 + PKG_SOURCE_PROTO:=git +-PKG_SOURCE_DATE:=2021-02-14 +-PKG_SOURCE_VERSION:=289cd7804587dc48f776d450db9cd3762692a370 +-PKG_MIRROR_HASH:=91885feca9d935586c6e33a8e3734bfa61991d869bf42ac0d1c8c3b19bfa9653 ++PKG_SOURCE_DATE:=2021-04-07 ++PKG_SOURCE_VERSION:=813db729c02ffa74fdda6d461afeb5aabc5706bb ++PKG_MIRROR_HASH:=63bd913f8ba3e85ae7a4575737a2c66377ebf59fa543e025150c650dd9ae13f2 + + PKG_MAINTAINER:=Felix Fietkau + PKG_BUILD_PARALLEL:=1 +@@ -407,6 +407,14 @@ define KernelPackage/mt7915e/install + $(1)/lib/firmware/mediatek + endef + ++define KernelPackage/mt7921e/install ++ $(INSTALL_DIR) $(1)/lib/firmware/mediatek ++ cp \ ++ $(PKG_BUILD_DIR)/firmware/WIFI_MT7961_patch_mcu_1_2_hdr.bin \ ++ $(PKG_BUILD_DIR)/firmware/WIFI_RAM_CODE_MT7961_1.bin \ ++ $(1)/lib/firmware/mediatek ++endef ++ + define Package/mt76-test/install + mkdir -p $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/mt76-test $(1)/usr/sbin +-- +2.25.1 + diff --git a/backports/0011-mediatek-implement-bad-block-management-table-suppor.patch b/backports/0011-mediatek-implement-bad-block-management-table-suppor.patch deleted file mode 100644 index aef95cd69..000000000 --- a/backports/0011-mediatek-implement-bad-block-management-table-suppor.patch +++ /dev/null @@ -1,910 +0,0 @@ -From 4ff7b77727cc6c4ed02fa89ced3aaa3d9437bf22 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Thu, 9 Apr 2020 09:53:24 +0200 -Subject: [PATCH 11/22] mediatek: implement bad-block management table support - -Signed-off-by: Felix Fietkau ---- - .../mediatek/mt7622-elecom-wrc-2533gent.dts | 2 + - target/linux/mediatek/mt7622/config-5.4 | 1 + - target/linux/mediatek/mt7623/config-5.4 | 1 + - target/linux/mediatek/mt7629/config-5.4 | 1 + - .../patches-5.4/0310-mtk-bmt-support.patch | 837 ++++++++++++++++++ - 5 files changed, 842 insertions(+) - create mode 100644 target/linux/mediatek/patches-5.4/0310-mtk-bmt-support.patch - -diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-elecom-wrc-2533gent.dts b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-elecom-wrc-2533gent.dts -index 2ac1c6a671..3971ce0389 100644 ---- a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-elecom-wrc-2533gent.dts -+++ b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7622-elecom-wrc-2533gent.dts -@@ -514,6 +514,8 @@ - spi-max-frequency = <104000000>; - reg = <0>; - -+ mediatek,bmt-v2; -+ - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; -diff --git a/target/linux/mediatek/mt7622/config-5.4 b/target/linux/mediatek/mt7622/config-5.4 -index 1b0b1e36a6..cdb73bd7bc 100644 ---- a/target/linux/mediatek/mt7622/config-5.4 -+++ b/target/linux/mediatek/mt7622/config-5.4 -@@ -396,6 +396,7 @@ CONFIG_MT753X_GSW=y - CONFIG_MTD_NAND_CORE=y - CONFIG_MTD_NAND_ECC_SW_HAMMING=y - CONFIG_MTD_NAND_MTK=y -+CONFIG_MTD_NAND_MTK_BMT=y - CONFIG_MTD_RAW_NAND=y - CONFIG_MTD_SPI_NAND=y - CONFIG_MTD_SPI_NOR=y -diff --git a/target/linux/mediatek/mt7623/config-5.4 b/target/linux/mediatek/mt7623/config-5.4 -index dbd3055d3b..839eb71008 100644 ---- a/target/linux/mediatek/mt7623/config-5.4 -+++ b/target/linux/mediatek/mt7623/config-5.4 -@@ -332,6 +332,7 @@ CONFIG_MODULES_USE_ELF_REL=y - # CONFIG_MT753X_GSW is not set - CONFIG_MTD_BLOCK2MTD=y - CONFIG_MTD_CMDLINE_PARTS=y -+# CONFIG_MTD_NAND_MTK_BMT is not set - CONFIG_MTD_SPI_NOR=y - CONFIG_MTD_SPLIT_FIRMWARE=y - CONFIG_MTD_SPLIT_UIMAGE_FW=y -diff --git a/target/linux/mediatek/mt7629/config-5.4 b/target/linux/mediatek/mt7629/config-5.4 -index 7fe01d1748..6ecde5ced6 100644 ---- a/target/linux/mediatek/mt7629/config-5.4 -+++ b/target/linux/mediatek/mt7629/config-5.4 -@@ -240,6 +240,7 @@ CONFIG_MT753X_GSW=y - CONFIG_MTD_NAND_CORE=y - CONFIG_MTD_NAND_ECC_SW_HAMMING=y - CONFIG_MTD_NAND_MTK=y -+# CONFIG_MTD_NAND_MTK_BMT is not set - CONFIG_MTD_RAW_NAND=y - CONFIG_MTD_SPI_NAND=y - CONFIG_MTD_SPI_NOR=y -diff --git a/target/linux/mediatek/patches-5.4/0310-mtk-bmt-support.patch b/target/linux/mediatek/patches-5.4/0310-mtk-bmt-support.patch -new file mode 100644 -index 0000000000..2a23f8c3dc ---- /dev/null -+++ b/target/linux/mediatek/patches-5.4/0310-mtk-bmt-support.patch -@@ -0,0 +1,837 @@ -+--- a/drivers/mtd/nand/Kconfig -++++ b/drivers/mtd/nand/Kconfig -+@@ -5,3 +5,7 @@ config MTD_NAND_CORE -+ source "drivers/mtd/nand/onenand/Kconfig" -+ source "drivers/mtd/nand/raw/Kconfig" -+ source "drivers/mtd/nand/spi/Kconfig" -++ -++config MTD_NAND_MTK_BMT -++ bool "Support MediaTek NAND Bad-block Management Table" -++ default n -+--- a/drivers/mtd/nand/Makefile -++++ b/drivers/mtd/nand/Makefile -+@@ -2,6 +2,7 @@ -+ -+ nandcore-objs := core.o bbt.o -+ obj-$(CONFIG_MTD_NAND_CORE) += nandcore.o -++obj-$(CONFIG_MTD_NAND_MTK_BMT) += mtk_bmt.o -+ -+ obj-y += onenand/ -+ obj-y += raw/ -+--- /dev/null -++++ b/drivers/mtd/nand/mtk_bmt.c -+@@ -0,0 +1,766 @@ -++/* -++ * Copyright (c) 2017 MediaTek Inc. -++ * Author: Xiangsheng Hou -++ * Copyright (c) 2020 Felix Fietkau -++ * -++ * This program is free software; you can redistribute it and/or modify -++ * it under the terms of the GNU General Public License version 2 as -++ * published by the Free Software Foundation. -++ * -++ * This program is distributed in the hope that it will be useful, -++ * but WITHOUT ANY WARRANTY; without even the implied warranty of -++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -++ * GNU General Public License for more details. -++ */ -++ -++#include -++#include -++#include -++#include -++#include -++#include -++#include -++#include -++#include -++ -++#define MAIN_SIGNATURE_OFFSET 0 -++#define OOB_SIGNATURE_OFFSET 1 -++#define BBPOOL_RATIO 2 -++ -++#define BBT_LOG(fmt, ...) pr_debug("[BBT][%s|%d] "fmt"\n", __func__, __LINE__, ##__VA_ARGS__) -++ -++/* Maximum 8k blocks */ -++#define BB_TABLE_MAX 0x2000U -++#define BMT_TABLE_MAX (BB_TABLE_MAX * BBPOOL_RATIO / 100) -++#define BMT_TBL_DEF_VAL 0x0 -++ -++/* -++ * Burner Bad Block Table -++ * --------- Only support SLC Nand Chips!!!!!!!!!!! ---------- -++ */ -++ -++struct bbbt { -++ char signature[3]; -++ /* This version is used to distinguish the legacy and new algorithm */ -++#define BBMT_VERSION 2 -++ unsigned char version; -++ /* Below 2 tables will be written in SLC */ -++ u16 bb_tbl[BB_TABLE_MAX]; -++ struct bbmt { -++ u16 block; -++#define NO_MAPPED 0 -++#define NORMAL_MAPPED 1 -++#define BMT_MAPPED 2 -++ u16 mapped; -++ } bmt_tbl[BMT_TABLE_MAX]; -++}; -++ -++static struct bmt_desc { -++ struct mtd_info *mtd; -++ -++ int (*_read_oob) (struct mtd_info *mtd, loff_t from, -++ struct mtd_oob_ops *ops); -++ int (*_write_oob) (struct mtd_info *mtd, loff_t to, -++ struct mtd_oob_ops *ops); -++ const struct nand_ops *nand_ops; -++ -++ struct bbbt *bbt; -++ -++ struct dentry *debugfs_dir; -++ -++ u32 pg_size; -++ u32 blk_size; -++ u16 pg_shift; -++ u16 blk_shift; -++ /* bbt logical address */ -++ u16 pool_lba; -++ /* bbt physical address */ -++ u16 pool_pba; -++ /* Maximum count of bad blocks that the vendor guaranteed */ -++ u16 bb_max; -++ /* Total blocks of the Nand Chip */ -++ u16 total_blks; -++ /* The block(n) BMT is located at (bmt_tbl[n]) */ -++ u16 bmt_blk_idx; -++ /* How many pages needs to store 'struct bbbt' */ -++ u32 bmt_pgs; -++ -++ /* to compensate for driver level remapping */ -++ u8 oob_offset; -++} bmtd = {0}; -++ -++static unsigned char *nand_bbt_buf; -++static unsigned char *nand_data_buf; -++ -++/* -------- Unit conversions -------- */ -++static inline u32 blk_pg(u16 block) -++{ -++ return (u32)(block << (bmtd.blk_shift - bmtd.pg_shift)); -++} -++ -++/* -------- Nand operations wrapper -------- */ -++static inline int -++bbt_nand_read(u32 page, unsigned char *dat, int dat_len, -++ unsigned char *fdm, int fdm_len) -++{ -++ struct mtd_oob_ops ops = { -++ .mode = MTD_OPS_PLACE_OOB, -++ .ooboffs = bmtd.oob_offset, -++ .oobbuf = fdm, -++ .ooblen = fdm_len, -++ .datbuf = dat, -++ .len = dat_len, -++ }; -++ -++ return bmtd._read_oob(bmtd.mtd, page << bmtd.pg_shift, &ops); -++} -++ -++static inline int bbt_nand_erase(u16 block) -++{ -++ struct nand_device *nand = mtd_to_nanddev(bmtd.mtd); -++ loff_t addr = (loff_t)block << bmtd.blk_shift; -++ struct nand_pos pos; -++ -++ nanddev_offs_to_pos(nand, addr, &pos); -++ return bmtd.nand_ops->erase(nand, &pos); -++} -++ -++/* -------- Bad Blocks Management -------- */ -++static int -++read_bmt(u16 block, unsigned char *dat, unsigned char *fdm, int fdm_len) -++{ -++ u32 len = bmtd.bmt_pgs << bmtd.pg_shift; -++ -++ return bbt_nand_read(blk_pg(block), dat, len, fdm, fdm_len); -++} -++ -++static int write_bmt(u16 block, unsigned char *dat) -++{ -++ struct mtd_oob_ops ops = { -++ .mode = MTD_OPS_PLACE_OOB, -++ .ooboffs = OOB_SIGNATURE_OFFSET + bmtd.oob_offset, -++ .oobbuf = "bmt", -++ .ooblen = 3, -++ .datbuf = dat, -++ .len = bmtd.bmt_pgs << bmtd.pg_shift, -++ }; -++ loff_t addr = (loff_t)block << bmtd.blk_shift; -++ -++ return bmtd._write_oob(bmtd.mtd, addr, &ops); -++} -++ -++static u16 find_valid_block(u16 block) -++{ -++ u8 fdm[4]; -++ int ret; -++ int loop = 0; -++ -++retry: -++ if (block >= bmtd.total_blks) -++ return 0; -++ -++ ret = bbt_nand_read(blk_pg(block), nand_data_buf, bmtd.pg_size, -++ fdm, sizeof(fdm)); -++ /* Read the 1st byte of FDM to judge whether it's a bad -++ * or not -++ */ -++ if (ret || fdm[0] != 0xff) { -++ pr_info("nand: found bad block 0x%x\n", block); -++ if (loop >= bmtd.bb_max) { -++ pr_info("nand: FATAL ERR: too many bad blocks!!\n"); -++ return 0; -++ } -++ -++ loop++; -++ block++; -++ goto retry; -++ } -++ -++ return block; -++} -++ -++/* Find out all bad blocks, and fill in the mapping table */ -++static int scan_bad_blocks(struct bbbt *bbt) -++{ -++ int i; -++ u16 block = 0; -++ -++ /* First time download, the block0 MUST NOT be a bad block, -++ * this is guaranteed by vendor -++ */ -++ bbt->bb_tbl[0] = 0; -++ -++ /* -++ * Construct the mapping table of Normal data area(non-PMT/BMTPOOL) -++ * G - Good block; B - Bad block -++ * --------------------------- -++ * physical |G|G|B|G|B|B|G|G|G|G|B|G|B| -++ * --------------------------- -++ * What bb_tbl[i] looks like: -++ * physical block(i): -++ * 0 1 2 3 4 5 6 7 8 9 a b c -++ * mapped block(bb_tbl[i]): -++ * 0 1 3 6 7 8 9 b ...... -++ * ATTENTION: -++ * If new bad block ocurred(n), search bmt_tbl to find -++ * a available block(x), and fill in the bb_tbl[n] = x; -++ */ -++ for (i = 1; i < bmtd.pool_lba; i++) { -++ bbt->bb_tbl[i] = find_valid_block(bbt->bb_tbl[i - 1] + 1); -++ BBT_LOG("bb_tbl[0x%x] = 0x%x", i, bbt->bb_tbl[i]); -++ if (bbt->bb_tbl[i] == 0) -++ return -1; -++ } -++ -++ /* Physical Block start Address of BMT pool */ -++ bmtd.pool_pba = bbt->bb_tbl[i - 1] + 1; -++ if (bmtd.pool_pba >= bmtd.total_blks - 2) { -++ pr_info("nand: FATAL ERR: Too many bad blocks!!\n"); -++ return -1; -++ } -++ -++ BBT_LOG("pool_pba=0x%x", bmtd.pool_pba); -++ i = 0; -++ block = bmtd.pool_pba; -++ /* -++ * The bmt table is used for runtime bad block mapping -++ * G - Good block; B - Bad block -++ * --------------------------- -++ * physical |G|G|B|G|B|B|G|G|G|G|B|G|B| -++ * --------------------------- -++ * block: 0 1 2 3 4 5 6 7 8 9 a b c -++ * What bmt_tbl[i] looks like in initial state: -++ * i: -++ * 0 1 2 3 4 5 6 7 -++ * bmt_tbl[i].block: -++ * 0 1 3 6 7 8 9 b -++ * bmt_tbl[i].mapped: -++ * N N N N N N N B -++ * N - Not mapped(Available) -++ * M - Mapped -++ * B - BMT -++ * ATTENTION: -++ * BMT always in the last valid block in pool -++ */ -++ while ((block = find_valid_block(block)) != 0) { -++ bbt->bmt_tbl[i].block = block; -++ bbt->bmt_tbl[i].mapped = NO_MAPPED; -++ BBT_LOG("bmt_tbl[%d].block = 0x%x", i, block); -++ block++; -++ i++; -++ } -++ -++ /* i - How many available blocks in pool, which is the length of bmt_tbl[] -++ * bmtd.bmt_blk_idx - bmt_tbl[bmtd.bmt_blk_idx].block => the BMT block -++ */ -++ bmtd.bmt_blk_idx = i - 1; -++ bbt->bmt_tbl[bmtd.bmt_blk_idx].mapped = BMT_MAPPED; -++ -++ if (i < 1) { -++ pr_info("nand: FATAL ERR: no space to store BMT!!\n"); -++ return -1; -++ } -++ -++ pr_info("[BBT] %d available blocks in BMT pool\n", i); -++ -++ return 0; -++} -++ -++static bool is_valid_bmt(unsigned char *buf, unsigned char *fdm) -++{ -++ struct bbbt *bbt = (struct bbbt *)buf; -++ u8 *sig = (u8*)bbt->signature + MAIN_SIGNATURE_OFFSET; -++ -++ -++ if (memcmp(bbt->signature + MAIN_SIGNATURE_OFFSET, "BMT", 3) == 0 && -++ memcmp(fdm + OOB_SIGNATURE_OFFSET, "bmt", 3) == 0) { -++ if (bbt->version == BBMT_VERSION) -++ return true; -++ } -++ BBT_LOG("[BBT] BMT Version not match,upgrage preloader and uboot please! sig=%02x%02x%02x, fdm=%02x%02x%02x", -++ sig[0], sig[1], sig[2], -++ fdm[1], fdm[2], fdm[3]); -++ return false; -++} -++ -++static u16 get_bmt_index(struct bbmt *bmt) -++{ -++ int i = 0; -++ -++ while (bmt[i].block != BMT_TBL_DEF_VAL) { -++ if (bmt[i].mapped == BMT_MAPPED) -++ return i; -++ i++; -++ } -++ return 0; -++} -++ -++static struct bbbt *scan_bmt(u16 block) -++{ -++ u8 fdm[4]; -++ -++ if (block < bmtd.pool_lba) -++ return NULL; -++ -++ if (read_bmt(block, nand_bbt_buf, fdm, sizeof(fdm))) -++ return scan_bmt(block - 1); -++ -++ if (is_valid_bmt(nand_bbt_buf, fdm)) { -++ bmtd.bmt_blk_idx = get_bmt_index(((struct bbbt *)nand_bbt_buf)->bmt_tbl); -++ if (bmtd.bmt_blk_idx == 0) { -++ pr_info("[BBT] FATAL ERR: bmt block index is wrong!\n"); -++ return NULL; -++ } -++ pr_info("[BBT] BMT.v2 is found at 0x%x\n", block); -++ return (struct bbbt *)nand_bbt_buf; -++ } else -++ return scan_bmt(block - 1); -++} -++ -++/* Write the Burner Bad Block Table to Nand Flash -++ * n - write BMT to bmt_tbl[n] -++ */ -++static u16 upload_bmt(struct bbbt *bbt, int n) -++{ -++ u16 block; -++ -++retry: -++ if (n < 0 || bbt->bmt_tbl[n].mapped == NORMAL_MAPPED) { -++ pr_info("nand: FATAL ERR: no space to store BMT!\n"); -++ return (u16)-1; -++ } -++ -++ block = bbt->bmt_tbl[n].block; -++ BBT_LOG("n = 0x%x, block = 0x%x", n, block); -++ if (bbt_nand_erase(block)) { -++ bbt->bmt_tbl[n].block = 0; -++ /* erase failed, try the previous block: bmt_tbl[n - 1].block */ -++ n--; -++ goto retry; -++ } -++ -++ /* The signature offset is fixed set to 0, -++ * oob signature offset is fixed set to 1 -++ */ -++ memcpy(bbt->signature + MAIN_SIGNATURE_OFFSET, "BMT", 3); -++ bbt->version = BBMT_VERSION; -++ -++ if (write_bmt(block, (unsigned char *)bbt)) { -++ bbt->bmt_tbl[n].block = 0; -++ -++ /* write failed, try the previous block in bmt_tbl[n - 1] */ -++ n--; -++ goto retry; -++ } -++ -++ /* Return the current index(n) of BMT pool (bmt_tbl[n]) */ -++ return n; -++} -++ -++static u16 find_valid_block_in_pool(struct bbbt *bbt) -++{ -++ int i; -++ -++ if (bmtd.bmt_blk_idx == 0) -++ goto error; -++ -++ for (i = 0; i < bmtd.bmt_blk_idx; i++) { -++ if (bbt->bmt_tbl[i].block != 0 && bbt->bmt_tbl[i].mapped == NO_MAPPED) { -++ bbt->bmt_tbl[i].mapped = NORMAL_MAPPED; -++ return bbt->bmt_tbl[i].block; -++ } -++ } -++ -++error: -++ pr_info("nand: FATAL ERR: BMT pool is run out!\n"); -++ return 0; -++} -++ -++/* We met a bad block, mark it as bad and map it to a valid block in pool, -++ * if it's a write failure, we need to write the data to mapped block -++ */ -++static bool update_bmt(u16 block) -++{ -++ u16 mapped_blk; -++ struct bbbt *bbt; -++ -++ bbt = bmtd.bbt; -++ mapped_blk = find_valid_block_in_pool(bbt); -++ if (mapped_blk == 0) -++ return false; -++ -++ /* Map new bad block to available block in pool */ -++ bbt->bb_tbl[block] = mapped_blk; -++ bmtd.bmt_blk_idx = upload_bmt(bbt, bmtd.bmt_blk_idx); -++ -++ return true; -++} -++ -++u16 get_mapping_block_index(int block) -++{ -++ int mapping_block; -++ -++ if (block < bmtd.pool_lba) -++ mapping_block = bmtd.bbt->bb_tbl[block]; -++ else -++ mapping_block = block; -++ BBT_LOG("0x%x mapped to 0x%x", block, mapping_block); -++ -++ return mapping_block; -++} -++ -++static int -++mtk_bmt_read(struct mtd_info *mtd, loff_t from, -++ struct mtd_oob_ops *ops) -++{ -++ struct mtd_oob_ops cur_ops = *ops; -++ int retry_count = 0; -++ loff_t cur_from; -++ int ret; -++ -++ ops->retlen = 0; -++ ops->oobretlen = 0; -++ -++ while (ops->retlen < ops->len || ops->oobretlen < ops->ooblen) { -++ u32 offset = from & (bmtd.blk_size - 1); -++ u32 block = from >> bmtd.blk_shift; -++ u32 cur_block; -++ -++ cur_block = get_mapping_block_index(block); -++ cur_from = ((loff_t)cur_block << bmtd.blk_shift) + offset; -++ -++ cur_ops.oobretlen = 0; -++ cur_ops.retlen = 0; -++ cur_ops.len = min_t(u32, mtd->erasesize - offset, -++ ops->len - ops->retlen); -++ ret = bmtd._read_oob(mtd, cur_from, &cur_ops); -++ if (ret < 0) { -++ update_bmt(block); -++ if (retry_count++ < 10) -++ continue; -++ -++ return ret; -++ } -++ -++ ops->retlen += cur_ops.retlen; -++ ops->oobretlen += cur_ops.oobretlen; -++ -++ cur_ops.datbuf += cur_ops.retlen; -++ cur_ops.oobbuf += cur_ops.oobretlen; -++ cur_ops.ooblen -= cur_ops.oobretlen; -++ -++ if (!cur_ops.len) -++ cur_ops.len = mtd->erasesize - offset; -++ -++ from += cur_ops.len; -++ retry_count = 0; -++ } -++ -++ return 0; -++} -++ -++static int -++mtk_bmt_write(struct mtd_info *mtd, loff_t to, -++ struct mtd_oob_ops *ops) -++{ -++ struct mtd_oob_ops cur_ops = *ops; -++ int retry_count = 0; -++ loff_t cur_to; -++ int ret; -++ -++ ops->retlen = 0; -++ ops->oobretlen = 0; -++ -++ while (ops->retlen < ops->len || ops->oobretlen < ops->ooblen) { -++ u32 offset = to & (bmtd.blk_size - 1); -++ u32 block = to >> bmtd.blk_shift; -++ u32 cur_block; -++ -++ cur_block = get_mapping_block_index(block); -++ cur_to = ((loff_t)cur_block << bmtd.blk_shift) + offset; -++ -++ cur_ops.oobretlen = 0; -++ cur_ops.retlen = 0; -++ cur_ops.len = min_t(u32, bmtd.blk_size - offset, -++ ops->len - ops->retlen); -++ ret = bmtd._write_oob(mtd, cur_to, &cur_ops); -++ if (ret < 0) { -++ update_bmt(block); -++ if (retry_count++ < 10) -++ continue; -++ -++ return ret; -++ } -++ -++ ops->retlen += cur_ops.retlen; -++ ops->oobretlen += cur_ops.oobretlen; -++ -++ cur_ops.datbuf += cur_ops.retlen; -++ cur_ops.oobbuf += cur_ops.oobretlen; -++ cur_ops.ooblen -= cur_ops.oobretlen; -++ -++ if (!cur_ops.len) -++ cur_ops.len = mtd->erasesize - offset; -++ -++ to += cur_ops.len; -++ retry_count = 0; -++ } -++ -++ return 0; -++} -++ -++ -++ -++static int -++mtk_bmt_erase(struct nand_device *nand, const struct nand_pos *pos) -++{ -++ struct nand_pos new_pos = *pos; -++ int retry_count = 0; -++ int ret; -++ -++retry: -++ new_pos.eraseblock = get_mapping_block_index(pos->eraseblock); -++ -++ ret = bmtd.nand_ops->erase(nand, &new_pos); -++ if (ret) { -++ update_bmt(pos->eraseblock); -++ if (retry_count++ < 10) -++ goto retry; -++ } -++ -++ return ret; -++} -++ -++static bool -++mtk_bmt_isbad(struct nand_device *nand, const struct nand_pos *pos) -++{ -++ struct nand_pos new_pos = *pos; -++ int retry_count = 0; -++ bool ret; -++ -++retry: -++ new_pos.eraseblock = get_mapping_block_index(pos->eraseblock); -++ -++ ret = bmtd.nand_ops->isbad(nand, &new_pos); -++ if (ret) { -++ update_bmt(pos->eraseblock); -++ if (retry_count++ < 10) -++ goto retry; -++ } -++ -++ return ret; -++} -++ -++static int -++mtk_bmt_markbad(struct nand_device *nand, const struct nand_pos *pos) -++{ -++ struct nand_pos new_pos = *pos; -++ -++ new_pos.eraseblock = get_mapping_block_index(new_pos.eraseblock); -++ update_bmt(pos->eraseblock); -++ -++ return bmtd.nand_ops->markbad(nand, &new_pos); -++} -++ -++static void -++mtk_bmt_replace_ops(struct mtd_info *mtd) -++{ -++ static const struct nand_ops mtk_bmt_nand_ops = { -++ .erase = mtk_bmt_erase, -++ .isbad = mtk_bmt_isbad, -++ .markbad = mtk_bmt_markbad, -++ }; -++ struct nand_device *nand = mtd_to_nanddev(mtd); -++ -++ bmtd.nand_ops = nand->ops; -++ bmtd._read_oob = mtd->_read_oob; -++ bmtd._write_oob = mtd->_write_oob; -++ -++ mtd->_read_oob = mtk_bmt_read; -++ mtd->_write_oob = mtk_bmt_write; -++ nand->ops = &mtk_bmt_nand_ops; -++} -++ -++static int mtk_bmt_debug_mark_good(void *data, u64 val) -++{ -++ u32 block = val >> bmtd.blk_shift; -++ -++ bmtd.bbt->bb_tbl[block] = block; -++ bmtd.bmt_blk_idx = upload_bmt(bmtd.bbt, bmtd.bmt_blk_idx); -++ -++ return 0; -++} -++ -++static int mtk_bmt_debug_mark_bad(void *data, u64 val) -++{ -++ u32 block = val >> bmtd.blk_shift; -++ -++ update_bmt(block); -++ -++ return 0; -++} -++ -++DEFINE_DEBUGFS_ATTRIBUTE(fops_mark_good, NULL, mtk_bmt_debug_mark_good, "%llu\n"); -++DEFINE_DEBUGFS_ATTRIBUTE(fops_mark_bad, NULL, mtk_bmt_debug_mark_bad, "%llu\n"); -++ -++static void -++mtk_bmt_add_debugfs(void) -++{ -++ struct dentry *dir; -++ -++ dir = bmtd.debugfs_dir = debugfs_create_dir("mtk-bmt", NULL); -++ if (!dir) -++ return; -++ -++ debugfs_create_file_unsafe("mark_good", S_IWUSR, dir, NULL, &fops_mark_good); -++ debugfs_create_file_unsafe("mark_bad", S_IWUSR, dir, NULL, &fops_mark_bad); -++} -++ -++void mtk_bmt_detach(struct mtd_info *mtd) -++{ -++ struct nand_device *nand = mtd_to_nanddev(mtd); -++ -++ if (bmtd.mtd != mtd) -++ return; -++ -++ if (bmtd.debugfs_dir) -++ debugfs_remove_recursive(bmtd.debugfs_dir); -++ bmtd.debugfs_dir = NULL; -++ -++ kfree(nand_bbt_buf); -++ kfree(nand_data_buf); -++ -++ mtd->_read_oob = bmtd._read_oob; -++ mtd->_write_oob = bmtd._write_oob; -++ mtd->size = bmtd.total_blks << bmtd.blk_shift; -++ nand->ops = bmtd.nand_ops; -++ -++ memset(&bmtd, 0, sizeof(bmtd)); -++} -++ -++/* total_blocks - The total count of blocks that the Nand Chip has */ -++int mtk_bmt_attach(struct mtd_info *mtd) -++{ -++ struct device_node *np; -++ struct bbbt *bbt; -++ u32 bufsz; -++ u32 block; -++ u16 total_blocks, pmt_block; -++ int ret = 0; -++ u32 bmt_pool_size; -++ -++ if (bmtd.mtd) -++ return -ENOSPC; -++ -++ np = mtd_get_of_node(mtd); -++ if (!np) -++ return 0; -++ -++ if (!of_property_read_bool(np, "mediatek,bmt-v2")) -++ return 0; -++ -++ if (of_property_read_u32(np, "mediatek,bmt-pool-size", -++ &bmt_pool_size) != 0) -++ bmt_pool_size = 80; -++ -++ if (of_property_read_u8(np, "mediatek,bmt-oob-offset", -++ &bmtd.oob_offset) != 0) -++ bmtd.oob_offset = 8; -++ -++ bmtd.mtd = mtd; -++ mtk_bmt_replace_ops(mtd); -++ -++ bmtd.blk_size = mtd->erasesize; -++ bmtd.blk_shift = ffs(bmtd.blk_size) - 1; -++ bmtd.pg_size = mtd->writesize; -++ bmtd.pg_shift = ffs(bmtd.pg_size) - 1; -++ total_blocks = mtd->size >> bmtd.blk_shift; -++ pmt_block = total_blocks - bmt_pool_size - 2; -++ -++ mtd->size = pmt_block << bmtd.blk_shift; -++ -++ /* -++ * --------------------------------------- -++ * | PMT(2blks) | BMT POOL(totalblks * 2%) | -++ * --------------------------------------- -++ * ^ ^ -++ * | | -++ * pmt_block pmt_block + 2blocks(pool_lba) -++ * -++ * ATTETION!!!!!! -++ * The blocks ahead of the boundary block are stored in bb_tbl -++ * and blocks behind are stored in bmt_tbl -++ */ -++ -++ bmtd.pool_lba = (u16)(pmt_block + 2); -++ bmtd.total_blks = total_blocks; -++ bmtd.bb_max = bmtd.total_blks * BBPOOL_RATIO / 100; -++ -++ /* 3 buffers we need */ -++ bufsz = round_up(sizeof(struct bbbt), bmtd.pg_size); -++ bmtd.bmt_pgs = bufsz >> bmtd.pg_shift; -++ -++ nand_bbt_buf = kzalloc(bufsz, GFP_KERNEL); -++ nand_data_buf = kzalloc(bmtd.pg_size, GFP_KERNEL); -++ -++ if (!nand_bbt_buf || !nand_data_buf) { -++ pr_info("nand: FATAL ERR: allocate buffer failed!\n"); -++ ret = -1; -++ goto error; -++ } -++ -++ memset(nand_bbt_buf, 0xff, bufsz); -++ memset(nand_data_buf, 0xff, bmtd.pg_size); -++ -++ BBT_LOG("bbtbuf=0x%p(0x%x) dat=0x%p(0x%x)", -++ nand_bbt_buf, bufsz, nand_data_buf, bmtd.pg_size); -++ BBT_LOG("pool_lba=0x%x total_blks=0x%x bb_max=0x%x", -++ bmtd.pool_lba, bmtd.total_blks, bmtd.bb_max); -++ -++ /* Scanning start from the first page of the last block -++ * of whole flash -++ */ -++ bbt = scan_bmt(bmtd.total_blks - 1); -++ if (!bbt) { -++ /* BMT not found */ -++ if (bmtd.total_blks > BB_TABLE_MAX + BMT_TABLE_MAX) { -++ pr_info("nand: FATAL: Too many blocks, can not support!\n"); -++ ret = -1; -++ goto error; -++ } -++ -++ bbt = (struct bbbt *)nand_bbt_buf; -++ memset(bbt->bmt_tbl, BMT_TBL_DEF_VAL, sizeof(bbt->bmt_tbl)); -++ -++ if (scan_bad_blocks(bbt)) { -++ ret = -1; -++ goto error; -++ } -++ -++ /* BMT always in the last valid block in pool */ -++ bmtd.bmt_blk_idx = upload_bmt(bbt, bmtd.bmt_blk_idx); -++ block = bbt->bmt_tbl[bmtd.bmt_blk_idx].block; -++ pr_notice("[BBT] BMT.v2 is written into PBA:0x%x\n", block); -++ -++ if (bmtd.bmt_blk_idx == 0) -++ pr_info("nand: Warning: no available block in BMT pool!\n"); -++ else if (bmtd.bmt_blk_idx == (u16)-1) { -++ ret = -1; -++ goto error; -++ } -++ } -++ mtk_bmt_add_debugfs(); -++ -++ bmtd.bbt = bbt; -++ return 0; -++ -++error: -++ mtk_bmt_detach(mtd); -++ return ret; -++} -++ -++ -++MODULE_LICENSE("GPL"); -++MODULE_AUTHOR("Xiangsheng Hou , Felix Fietkau "); -++MODULE_DESCRIPTION("Bad Block mapping management v2 for MediaTek NAND Flash Driver"); -++ -+--- a/drivers/mtd/nand/spi/core.c -++++ b/drivers/mtd/nand/spi/core.c -+@@ -18,6 +18,7 @@ -+ #include -+ #include -+ #include -++#include -+ -+ static int spinand_read_reg_op(struct spinand_device *spinand, u8 reg, u8 *val) -+ { -+@@ -1099,6 +1100,8 @@ static int spinand_probe(struct spi_mem -+ if (ret) -+ return ret; -+ -++ mtk_bmt_attach(mtd); -++ -+ ret = mtd_device_register(mtd, NULL, 0); -+ if (ret) -+ goto err_spinand_cleanup; -+@@ -1124,6 +1127,7 @@ static int spinand_remove(struct spi_mem -+ if (ret) -+ return ret; -+ -++ mtk_bmt_detach(mtd); -+ spinand_cleanup(spinand); -+ -+ return 0; -+--- /dev/null -++++ b/include/linux/mtd/mtk_bmt.h -+@@ -0,0 +1,18 @@ -++#ifndef __MTK_BMT_H -++#define __MTK_BMT_H -++ -++#ifdef CONFIG_MTD_NAND_MTK_BMT -++int mtk_bmt_attach(struct mtd_info *mtd); -++void mtk_bmt_detach(struct mtd_info *mtd); -++#else -++static inline int mtk_bmt_attach(struct mtd_info *mtd) -++{ -++ return 0; -++} -++ -++static inline void mtk_bmt_detach(struct mtd_info *mtd) -++{ -++} -++#endif -++ -++#endif --- -2.25.1 - diff --git a/backports/0013-mediatek-add-support-for-configuring-BMT-table-size-.patch b/backports/0013-mediatek-add-support-for-configuring-BMT-table-size-.patch deleted file mode 100644 index ccb3406a6..000000000 --- a/backports/0013-mediatek-add-support-for-configuring-BMT-table-size-.patch +++ /dev/null @@ -1,215 +0,0 @@ -From 1572b27651f11ac0e8f14a543815963147eb26ae Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Wed, 3 Feb 2021 19:34:29 +0100 -Subject: [PATCH 13/22] mediatek: add support for configuring BMT table size - via device tree - -Signed-off-by: Felix Fietkau ---- - .../patches-5.10/330-mtk-bmt-support.patch | 59 ++++++++++++------- - 1 file changed, 37 insertions(+), 22 deletions(-) - -diff --git a/target/linux/mediatek/patches-5.10/330-mtk-bmt-support.patch b/target/linux/mediatek/patches-5.10/330-mtk-bmt-support.patch -index 5c20952611..504c602c50 100644 ---- a/target/linux/mediatek/patches-5.10/330-mtk-bmt-support.patch -+++ b/target/linux/mediatek/patches-5.10/330-mtk-bmt-support.patch -@@ -23,7 +23,7 @@ - obj-y += raw/ - --- /dev/null - +++ b/drivers/mtd/nand/mtk_bmt.c --@@ -0,0 +1,766 @@ -+@@ -0,0 +1,781 @@ - +/* - + * Copyright (c) 2017 MediaTek Inc. - + * Author: Xiangsheng Hou -@@ -56,7 +56,7 @@ - +#define BBT_LOG(fmt, ...) pr_debug("[BBT][%s|%d] "fmt"\n", __func__, __LINE__, ##__VA_ARGS__) - + - +/* Maximum 8k blocks */ --+#define BB_TABLE_MAX 0x2000U -++#define BB_TABLE_MAX bmtd.table_size - +#define BMT_TABLE_MAX (BB_TABLE_MAX * BBPOOL_RATIO / 100) - +#define BMT_TBL_DEF_VAL 0x0 - + -@@ -71,14 +71,15 @@ - +#define BBMT_VERSION 2 - + unsigned char version; - + /* Below 2 tables will be written in SLC */ --+ u16 bb_tbl[BB_TABLE_MAX]; --+ struct bbmt { --+ u16 block; -++ u16 bb_tbl[]; -++}; -++ -++struct bbmt { -++ u16 block; - +#define NO_MAPPED 0 - +#define NORMAL_MAPPED 1 - +#define BMT_MAPPED 2 --+ u16 mapped; --+ } bmt_tbl[BMT_TABLE_MAX]; -++ u16 mapped; - +}; - + - +static struct bmt_desc { -@@ -94,6 +95,7 @@ - + - + struct dentry *debugfs_dir; - + -++ u32 table_size; - + u32 pg_size; - + u32 blk_size; - + u16 pg_shift; -@@ -152,6 +154,11 @@ - +} - + - +/* -------- Bad Blocks Management -------- */ -++static inline struct bbmt *bmt_tbl(struct bbbt *bbbt) -++{ -++ return (struct bbmt *)&bbbt->bb_tbl[bmtd.table_size]; -++} -++ - +static int - +read_bmt(u16 block, unsigned char *dat, unsigned char *fdm, int fdm_len) - +{ -@@ -269,8 +276,8 @@ - + * BMT always in the last valid block in pool - + */ - + while ((block = find_valid_block(block)) != 0) { --+ bbt->bmt_tbl[i].block = block; --+ bbt->bmt_tbl[i].mapped = NO_MAPPED; -++ bmt_tbl(bbt)[i].block = block; -++ bmt_tbl(bbt)[i].mapped = NO_MAPPED; - + BBT_LOG("bmt_tbl[%d].block = 0x%x", i, block); - + block++; - + i++; -@@ -280,7 +287,7 @@ - + * bmtd.bmt_blk_idx - bmt_tbl[bmtd.bmt_blk_idx].block => the BMT block - + */ - + bmtd.bmt_blk_idx = i - 1; --+ bbt->bmt_tbl[bmtd.bmt_blk_idx].mapped = BMT_MAPPED; -++ bmt_tbl(bbt)[bmtd.bmt_blk_idx].mapped = BMT_MAPPED; - + - + if (i < 1) { - + pr_info("nand: FATAL ERR: no space to store BMT!!\n"); -@@ -332,7 +339,7 @@ - + return scan_bmt(block - 1); - + - + if (is_valid_bmt(nand_bbt_buf, fdm)) { --+ bmtd.bmt_blk_idx = get_bmt_index(((struct bbbt *)nand_bbt_buf)->bmt_tbl); -++ bmtd.bmt_blk_idx = get_bmt_index(bmt_tbl((struct bbbt *)nand_bbt_buf)); - + if (bmtd.bmt_blk_idx == 0) { - + pr_info("[BBT] FATAL ERR: bmt block index is wrong!\n"); - + return NULL; -@@ -351,15 +358,15 @@ - + u16 block; - + - +retry: --+ if (n < 0 || bbt->bmt_tbl[n].mapped == NORMAL_MAPPED) { -++ if (n < 0 || bmt_tbl(bbt)[n].mapped == NORMAL_MAPPED) { - + pr_info("nand: FATAL ERR: no space to store BMT!\n"); - + return (u16)-1; - + } - + --+ block = bbt->bmt_tbl[n].block; -++ block = bmt_tbl(bbt)[n].block; - + BBT_LOG("n = 0x%x, block = 0x%x", n, block); - + if (bbt_nand_erase(block)) { --+ bbt->bmt_tbl[n].block = 0; -++ bmt_tbl(bbt)[n].block = 0; - + /* erase failed, try the previous block: bmt_tbl[n - 1].block */ - + n--; - + goto retry; -@@ -372,7 +379,7 @@ - + bbt->version = BBMT_VERSION; - + - + if (write_bmt(block, (unsigned char *)bbt)) { --+ bbt->bmt_tbl[n].block = 0; -++ bmt_tbl(bbt)[n].block = 0; - + - + /* write failed, try the previous block in bmt_tbl[n - 1] */ - + n--; -@@ -391,9 +398,9 @@ - + goto error; - + - + for (i = 0; i < bmtd.bmt_blk_idx; i++) { --+ if (bbt->bmt_tbl[i].block != 0 && bbt->bmt_tbl[i].mapped == NO_MAPPED) { --+ bbt->bmt_tbl[i].mapped = NORMAL_MAPPED; --+ return bbt->bmt_tbl[i].block; -++ if (bmt_tbl(bbt)[i].block != 0 && bmt_tbl(bbt)[i].mapped == NO_MAPPED) { -++ bmt_tbl(bbt)[i].mapped = NORMAL_MAPPED; -++ return bmt_tbl(bbt)[i].block; - + } - + } - + -@@ -471,6 +478,7 @@ - + ops->retlen += cur_ops.retlen; - + ops->oobretlen += cur_ops.oobretlen; - + -++ cur_ops.ooboffs = 0; - + cur_ops.datbuf += cur_ops.retlen; - + cur_ops.oobbuf += cur_ops.oobretlen; - + cur_ops.ooblen -= cur_ops.oobretlen; -@@ -521,6 +529,7 @@ - + ops->retlen += cur_ops.retlen; - + ops->oobretlen += cur_ops.oobretlen; - + -++ cur_ops.ooboffs = 0; - + cur_ops.datbuf += cur_ops.retlen; - + cur_ops.oobbuf += cur_ops.oobretlen; - + cur_ops.ooblen -= cur_ops.oobretlen; -@@ -673,7 +682,7 @@ - + u32 block; - + u16 total_blocks, pmt_block; - + int ret = 0; --+ u32 bmt_pool_size; -++ u32 bmt_pool_size, bmt_table_size; - + - + if (bmtd.mtd) - + return -ENOSPC; -@@ -693,9 +702,14 @@ - + &bmtd.oob_offset) != 0) - + bmtd.oob_offset = 8; - + -++ if (of_property_read_u32(np, "mediatek,bmt-table-size", -++ &bmt_table_size) != 0) -++ bmt_table_size = 0x2000U; -++ - + bmtd.mtd = mtd; - + mtk_bmt_replace_ops(mtd); - + -++ bmtd.table_size = bmt_table_size; - + bmtd.blk_size = mtd->erasesize; - + bmtd.blk_shift = ffs(bmtd.blk_size) - 1; - + bmtd.pg_size = mtd->writesize; -@@ -723,7 +737,8 @@ - + bmtd.bb_max = bmtd.total_blks * BBPOOL_RATIO / 100; - + - + /* 3 buffers we need */ --+ bufsz = round_up(sizeof(struct bbbt), bmtd.pg_size); -++ bufsz = round_up(sizeof(struct bbbt) + -++ bmt_table_size * sizeof(struct bbmt), bmtd.pg_size); - + bmtd.bmt_pgs = bufsz >> bmtd.pg_shift; - + - + nand_bbt_buf = kzalloc(bufsz, GFP_KERNEL); -@@ -756,7 +771,7 @@ - + } - + - + bbt = (struct bbbt *)nand_bbt_buf; --+ memset(bbt->bmt_tbl, BMT_TBL_DEF_VAL, sizeof(bbt->bmt_tbl)); -++ memset(bmt_tbl(bbt), BMT_TBL_DEF_VAL, bmtd.table_size * sizeof(struct bbmt)); - + - + if (scan_bad_blocks(bbt)) { - + ret = -1; -@@ -765,7 +780,7 @@ - + - + /* BMT always in the last valid block in pool */ - + bmtd.bmt_blk_idx = upload_bmt(bbt, bmtd.bmt_blk_idx); --+ block = bbt->bmt_tbl[bmtd.bmt_blk_idx].block; -++ block = bmt_tbl(bbt)[bmtd.bmt_blk_idx].block; - + pr_notice("[BBT] BMT.v2 is written into PBA:0x%x\n", block); - + - + if (bmtd.bmt_blk_idx == 0) --- -2.25.1 - diff --git a/backports/0014-kernel-add-support-for-enabling-fit-firmware-partiti.patch b/backports/0014-kernel-add-support-for-enabling-fit-firmware-partiti.patch deleted file mode 100644 index 748bb6d55..000000000 --- a/backports/0014-kernel-add-support-for-enabling-fit-firmware-partiti.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 29da2c500a856b214e9a0eca3ccdc98a6470da48 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Wed, 3 Feb 2021 20:37:03 +0100 -Subject: [PATCH 14/22] kernel: add support for enabling fit firmware partition - parser via cmdline - -This is useful for dual-boot setups where the loader sets variables depending -on the flash boot partition. -For example the Linksys E8450 sets mtdparts=master for the first partition -and mtdparts=slave for the second one. - -Signed-off-by: Felix Fietkau ---- - .../linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_fit.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_fit.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_fit.c -index 67ee33d085..5cc1658dbd 100644 ---- a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_fit.c -+++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_fit.c -@@ -49,6 +49,8 @@ mtdsplit_fit_parse(struct mtd_info *mtd, - const struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { -+ struct device_node *np = mtd_get_of_node(mtd); -+ const char *cmdline_match = NULL; - struct fdt_header hdr; - size_t hdr_len, retlen; - size_t offset; -@@ -57,6 +59,10 @@ mtdsplit_fit_parse(struct mtd_info *mtd, - struct mtd_partition *parts; - int ret; - -+ of_property_read_string(np, "openwrt,cmdline-match", &cmdline_match); -+ if (cmdline_match && !strstr(saved_command_line, cmdline_match)) -+ return -ENODEV; -+ - hdr_len = sizeof(struct fdt_header); - - /* Parse the MTD device & search for the FIT image location */ --- -2.25.1 - diff --git a/backports/0015-mediatek-add-linksys-e8450-support.patch b/backports/0015-mediatek-add-linksys-e8450-support.patch deleted file mode 100644 index 14a7ca486..000000000 --- a/backports/0015-mediatek-add-linksys-e8450-support.patch +++ /dev/null @@ -1,757 +0,0 @@ -From f0d0621227f82d56676485cb31918c17fb3ed564 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 2 Feb 2021 16:29:58 +0100 -Subject: [PATCH 15/22] mediatek: add linksys-e8450 support - -Signed-off-by: John Crispin -Signed-off-by: Felix Fietkau ---- - .../dts/mediatek/mt7622-linksys-e8450.dts | 488 ++++++++++++++++++ - target/linux/mediatek/image/mt7622.mk | 10 + - .../mt7622/base-files/etc/board.d/01_leds | 18 + - .../mt7622/base-files/etc/board.d/02_network | 11 +- - .../mt7622/base-files/etc/init.d/bootcount | 11 + - .../mt7622/base-files/lib/upgrade/platform.sh | 8 + - ...Add-support-for-the-Fidelix-FM35X1GA.patch | 122 +++++ - 7 files changed, 667 insertions(+), 1 deletion(-) - create mode 100644 target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-linksys-e8450.dts - create mode 100755 target/linux/mediatek/mt7622/base-files/etc/board.d/01_leds - create mode 100755 target/linux/mediatek/mt7622/base-files/etc/init.d/bootcount - create mode 100644 target/linux/mediatek/patches-5.10/340-mtd-spinand-Add-support-for-the-Fidelix-FM35X1GA.patch - -diff --git a/target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-linksys-e8450.dts b/target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-linksys-e8450.dts -new file mode 100644 -index 0000000000..00b11690f0 ---- /dev/null -+++ b/target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-linksys-e8450.dts -@@ -0,0 +1,488 @@ -+/* -+ * SPDX-License-Identifier: (GPL-2.0 OR MIT) -+ */ -+ -+/dts-v1/; -+#include -+#include -+ -+#include "mt7622.dtsi" -+#include "mt6380.dtsi" -+ -+/ { -+ model = "Linksys E8450"; -+ compatible = "linksys,e8450", "mediatek,mt7622"; -+ -+ aliases { -+ serial0 = &uart0; -+ led-boot = &led_power; -+ led-failsafe = &led_power; -+ led-running = &led_power; -+ led-upgrade = &led_power; -+ }; -+ -+ chosen { -+ stdout-path = "serial0:115200n8"; -+ bootargs = "earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n1 swiotlb=512"; -+ }; -+ -+ cpus { -+ cpu@0 { -+ proc-supply = <&mt6380_vcpu_reg>; -+ sram-supply = <&mt6380_vm_reg>; -+ }; -+ -+ cpu@1 { -+ proc-supply = <&mt6380_vcpu_reg>; -+ sram-supply = <&mt6380_vm_reg>; -+ }; -+ }; -+ -+ gpio-keys { -+ compatible = "gpio-keys"; -+ -+ factory { -+ label = "reset"; -+ linux,code = ; -+ gpios = <&pio 0 GPIO_ACTIVE_LOW>; -+ }; -+ -+ wps { -+ label = "wps"; -+ linux,code = ; -+ gpios = <&pio 102 GPIO_ACTIVE_LOW>; -+ }; -+ }; -+ -+ gpio-leds { -+ compatible = "gpio-leds"; -+ -+ led_power: power_blue { -+ label = "power:blue"; -+ gpios = <&pio 95 GPIO_ACTIVE_LOW>; -+ default-state = "on"; -+ }; -+ -+ power_orange { -+ label = "power:orange"; -+ gpios = <&pio 96 GPIO_ACTIVE_LOW>; -+ default-state = "off"; -+ }; -+ -+ inet_blue { -+ label = "inet:blue"; -+ gpios = <&pio 97 GPIO_ACTIVE_LOW>; -+ default-state = "off"; -+ }; -+ -+ inet_orange { -+ label = "inet:orange"; -+ gpios = <&pio 98 GPIO_ACTIVE_LOW>; -+ default-state = "off"; -+ }; -+ }; -+ -+ memory { -+ reg = <0 0x40000000 0 0x40000000>; -+ }; -+ -+ reg_1p8v: regulator-1p8v { -+ compatible = "regulator-fixed"; -+ regulator-name = "fixed-1.8V"; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ regulator-always-on; -+ }; -+ -+ reg_3p3v: regulator-3p3v { -+ compatible = "regulator-fixed"; -+ regulator-name = "fixed-3.3V"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-boot-on; -+ regulator-always-on; -+ }; -+ -+ reg_5v: regulator-5v { -+ compatible = "regulator-fixed"; -+ regulator-name = "fixed-5V"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ regulator-boot-on; -+ regulator-always-on; -+ }; -+}; -+ -+&bch { -+ status = "okay"; -+}; -+ -+&btif { -+ status = "okay"; -+}; -+ -+&cir { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&irrx_pins>; -+ status = "okay"; -+}; -+ -+ð { -+ pinctrl-names = "default"; -+ pinctrl-0 = <ð_pins>; -+ status = "okay"; -+ -+ gmac0: mac@0 { -+ compatible = "mediatek,eth-mac"; -+ reg = <0>; -+ phy-mode = "2500base-x"; -+ -+ fixed-link { -+ speed = <2500>; -+ full-duplex; -+ pause; -+ }; -+ }; -+ -+ mdio-bus { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ switch@0 { -+ compatible = "mediatek,mt7531"; -+ reg = <0>; -+ reset-gpios = <&pio 54 0>; -+ -+ ports { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ port@0 { -+ reg = <0>; -+ label = "lan1"; -+ }; -+ -+ port@1 { -+ reg = <1>; -+ label = "lan2"; -+ }; -+ -+ port@2 { -+ reg = <2>; -+ label = "lan3"; -+ }; -+ -+ port@3 { -+ reg = <3>; -+ label = "lan4"; -+ }; -+ -+ port@4 { -+ reg = <4>; -+ label = "wan"; -+ }; -+ -+ port@6 { -+ reg = <6>; -+ label = "cpu"; -+ ethernet = <&gmac0>; -+ phy-mode = "2500base-x"; -+ -+ fixed-link { -+ speed = <2500>; -+ full-duplex; -+ pause; -+ }; -+ }; -+ }; -+ }; -+ -+ }; -+}; -+ -+&pcie0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pcie0_pins>; -+ status = "okay"; -+}; -+ -+&pcie1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pcie1_pins>; -+ status = "okay"; -+}; -+ -+&slot0 { -+ mt7915@0,0 { -+ reg = <0x0000 0 0 0 0>; -+ mediatek,mtd-eeprom = <&factory 0x05000>; -+ }; -+}; -+ -+&pio { -+ /* Attention: GPIO 90 is used to switch between PCIe@1,0 and -+ * SATA functions. i.e. output-high: PCIe, output-low: SATA -+ */ -+// asm_sel { -+// gpio-hog; -+// gpios = <90 GPIO_ACTIVE_HIGH>; -+// output-high; -+// }; -+ -+ eth_pins: eth-pins { -+ mux { -+ function = "eth"; -+ groups = "mdc_mdio", "rgmii_via_gmac2"; -+ }; -+ }; -+ -+ irrx_pins: irrx-pins { -+ mux { -+ function = "ir"; -+ groups = "ir_1_rx"; -+ }; -+ }; -+ -+ irtx_pins: irtx-pins { -+ mux { -+ function = "ir"; -+ groups = "ir_1_tx"; -+ }; -+ }; -+ -+ pcie0_pins: pcie0-pins { -+ mux { -+ function = "pcie"; -+ groups = "pcie0_pad_perst", -+ "pcie0_1_waken", -+ "pcie0_1_clkreq"; -+ }; -+ }; -+ -+ pcie1_pins: pcie1-pins { -+ mux { -+ function = "pcie"; -+ groups = "pcie1_pad_perst", -+ "pcie1_0_waken", -+ "pcie1_0_clkreq"; -+ }; -+ }; -+ -+ pmic_bus_pins: pmic-bus-pins { -+ mux { -+ function = "pmic"; -+ groups = "pmic_bus"; -+ }; -+ }; -+ -+ pwm7_pins: pwm1-2-pins { -+ mux { -+ function = "pwm"; -+ groups = "pwm_ch7_2"; -+ }; -+ }; -+ -+ wled_pins: wled-pins { -+ mux { -+ function = "led"; -+ groups = "wled"; -+ }; -+ }; -+ -+ /* Serial NAND is shared pin with SPI-NOR */ -+ serial_nand_pins: serial-nand-pins { -+ mux { -+ function = "flash"; -+ groups = "snfi"; -+ }; -+ }; -+ -+ spic0_pins: spic0-pins { -+ mux { -+ function = "spi"; -+ groups = "spic0_0"; -+ }; -+ }; -+ -+ spic1_pins: spic1-pins { -+ mux { -+ function = "spi"; -+ groups = "spic1_0"; -+ }; -+ }; -+ -+ uart0_pins: uart0-pins { -+ mux { -+ function = "uart"; -+ groups = "uart0_0_tx_rx" ; -+ }; -+ }; -+ -+ uart2_pins: uart2-pins { -+ mux { -+ function = "uart"; -+ groups = "uart2_1_tx_rx" ; -+ }; -+ }; -+ -+ watchdog_pins: watchdog-pins { -+ mux { -+ function = "watchdog"; -+ groups = "watchdog"; -+ }; -+ }; -+}; -+ -+&pwm { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pwm7_pins>; -+ status = "okay"; -+}; -+ -+&pwrap { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pmic_bus_pins>; -+ -+ status = "okay"; -+}; -+ -+&sata { -+ status = "disabled"; -+}; -+ -+&sata_phy { -+ status = "disabled"; -+}; -+ -+&snfi { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&serial_nand_pins>; -+ status = "okay"; -+ -+ spi_nand@0 { -+ #address-cells = <1>; -+ #size-cells = <1>; -+ compatible = "spi-nand"; -+ spi-max-frequency = <104000000>; -+ reg = <0>; -+ -+ mediatek,bmt-v2; -+ mediatek,bmt-table-size = <0x1000>; -+ -+ partitions { -+ compatible = "fixed-partitions"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ -+ partition@0 { -+ label = "Preloader"; -+ reg = <0x00000 0x0080000>; -+ read-only; -+ }; -+ -+ partition@80000 { -+ label = "ATF"; -+ reg = <0x80000 0x0040000>; -+ }; -+ -+ partition@c0000 { -+ label = "u-boot"; -+ reg = <0xc0000 0x0080000>; -+ }; -+ -+ partition@140000 { -+ label = "u-boot-env"; -+ reg = <0x140000 0x0080000>; -+ }; -+ -+ factory: partition@1c0000 { -+ label = "factory"; -+ reg = <0x1c0000 0x0100000>; -+ }; -+ -+ partition@300000 { -+ label = "devinfo"; -+ reg = <0x300000 0x020000>; -+ }; -+ -+ partition@320000 { -+ label = "senv"; -+ reg = <0x320000 0x020000>; -+ }; -+ -+ partition@360000 { -+ label = "bootseq"; -+ reg = <0x360000 0x020000>; -+ }; -+ -+ partition@500000 { -+ label = "firmware1"; -+ compatible = "denx,fit"; -+ openwrt,cmdline-match = "mtdparts=master"; -+ reg = <0x500000 0x1E00000>; -+ }; -+ -+ partition@2300000 { -+ label = "firmware2"; -+ compatible = "denx,fit"; -+ openwrt,cmdline-match = "mtdparts=slave"; -+ reg = <0x2300000 0x1E00000>; -+ }; -+ -+ partition@4100000 { -+ label = "data"; -+ reg = <0x4100000 0x1900000>; -+ }; -+ -+ partition@5100000 { -+ label = "mfg"; -+ reg = <0x5a00000 0x1400000>; -+ }; -+ }; -+ }; -+}; -+ -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spic0_pins>; -+ status = "okay"; -+}; -+ -+&spi1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spic1_pins>; -+ status = "okay"; -+}; -+ -+&ssusb { -+ vusb33-supply = <®_3p3v>; -+ vbus-supply = <®_5v>; -+ status = "okay"; -+}; -+ -+&u3phy { -+ status = "okay"; -+}; -+ -+&uart0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart0_pins>; -+ status = "okay"; -+}; -+ -+&uart2 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart2_pins>; -+ status = "okay"; -+}; -+ -+&watchdog { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&watchdog_pins>; -+ status = "okay"; -+}; -+ -+&wmac { -+ mediatek,mtd-eeprom = <&factory 0x0000>; -+ status = "okay"; -+}; -diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk -index 74f6eba19a..efaa3bcaa3 100644 ---- a/target/linux/mediatek/image/mt7622.mk -+++ b/target/linux/mediatek/image/mt7622.mk -@@ -36,6 +36,16 @@ define Device/elecom_wrc-2533gent - endef - TARGET_DEVICES += elecom_wrc-2533gent - -+define Device/linksys_e8450 -+ DEVICE_VENDOR := Linksys -+ DEVICE_MODEL := E8450 -+ DEVICE_DTS := mt7622-linksys-e8450 -+ DEVICE_DTS_DIR := $(DTS_DIR)/mediatek -+ DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-ata-ahci-mtk \ -+ kmod-mt7615e kmod-mt7615-firmware kmod-mt7915 -+endef -+TARGET_DEVICES += linksys_e8450 -+ - define Device/mediatek_mt7622-rfb1 - DEVICE_VENDOR := MediaTek - DEVICE_MODEL := MTK7622 rfb1 AP -diff --git a/target/linux/mediatek/mt7622/base-files/etc/board.d/01_leds b/target/linux/mediatek/mt7622/base-files/etc/board.d/01_leds -new file mode 100755 -index 0000000000..e74944a65f ---- /dev/null -+++ b/target/linux/mediatek/mt7622/base-files/etc/board.d/01_leds -@@ -0,0 +1,18 @@ -+#!/bin/sh -+ -+. /lib/functions/leds.sh -+. /lib/functions/uci-defaults.sh -+ -+board=$(board_name) -+ -+board_config_update -+ -+case $board in -+linksys,e8450) -+ ucidef_set_led_netdev "wan" "WAN" "inet:blue" "wan" -+ ;; -+esac -+ -+board_config_flush -+ -+exit 0 -diff --git a/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network -index 3a409c8ec9..f6cd4ba3fc 100755 ---- a/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network -+++ b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network -@@ -10,7 +10,8 @@ mediatek_setup_interfaces() - - case $board in - bananapi,bpi-r64-rootdisk|\ -- bananapi,bpi-r64) -+ bananapi,bpi-r64|\ -+ linksys,e8450) - ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" wan - ;; - mediatek,mt7622-rfb1) -@@ -31,7 +32,15 @@ mediatek_setup_macs() - local board="$1" - - case $board in -+ linksys,e8450) -+ wan_mac=$(mtd_get_mac_ascii devinfo wan_mac_addr) -+ lan_mac=$(mtd_get_mac_ascii devinfo lan_mac_addr) -+ label_mac=$wan_mac -+ ;; - esac -+ [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac -+ [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac -+ [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac - } - - board_config_update -diff --git a/target/linux/mediatek/mt7622/base-files/etc/init.d/bootcount b/target/linux/mediatek/mt7622/base-files/etc/init.d/bootcount -new file mode 100755 -index 0000000000..bc4eeb6530 ---- /dev/null -+++ b/target/linux/mediatek/mt7622/base-files/etc/init.d/bootcount -@@ -0,0 +1,11 @@ -+#!/bin/sh /etc/rc.common -+ -+START=99 -+ -+boot() { -+ case $(board_name) in -+ linksys,e8450) -+ mtd erase senv || true -+ ;; -+ esac -+} -diff --git a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh -index 8144476943..95ac8b5657 100755 ---- a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh -+++ b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh -@@ -10,6 +10,14 @@ platform_do_upgrade() { - mediatek,mt7622,ubi) - nand_do_upgrade "$1" - ;; -+ linksys,e8450) -+ if grep -q mtdparts=slave /proc/cmdline; then -+ PART_NAME=firmware2 -+ else -+ PART_NAME=firmware1 -+ fi -+ default_do_upgrade "$1" -+ ;; - *) - default_do_upgrade "$1" - ;; -diff --git a/target/linux/mediatek/patches-5.10/340-mtd-spinand-Add-support-for-the-Fidelix-FM35X1GA.patch b/target/linux/mediatek/patches-5.10/340-mtd-spinand-Add-support-for-the-Fidelix-FM35X1GA.patch -new file mode 100644 -index 0000000000..69a9297e1f ---- /dev/null -+++ b/target/linux/mediatek/patches-5.10/340-mtd-spinand-Add-support-for-the-Fidelix-FM35X1GA.patch -@@ -0,0 +1,122 @@ -+From ea0df4552efcdcc2806fe6eba0540b5f719d80b6 Mon Sep 17 00:00:00 2001 -+From: Davide Fioravanti -+Date: Fri, 8 Jan 2021 15:35:24 +0100 -+Subject: [PATCH 1/1] mtd: spinand: Add support for the Fidelix FM35X1GA -+ -+Datasheet: http://www.hobos.com.cn/upload/datasheet/DS35X1GAXXX_100_rev00.pdf -+ -+Signed-off-by: Davide Fioravanti -+--- -+ drivers/mtd/nand/spi/Makefile | 2 +- -+ drivers/mtd/nand/spi/core.c | 1 + -+ drivers/mtd/nand/spi/fidelix.c | 80 ++++++++++++++++++++++++++++++++++ -+ include/linux/mtd/spinand.h | 1 + -+ 4 files changed, 83 insertions(+), 1 deletion(-) -+ create mode 100644 drivers/mtd/nand/spi/fidelix.c -+ -+--- a/drivers/mtd/nand/spi/Makefile -++++ b/drivers/mtd/nand/spi/Makefile -+@@ -1,3 +1,3 @@ -+ # SPDX-License-Identifier: GPL-2.0 -+-spinand-objs := core.o gigadevice.o macronix.o micron.o paragon.o toshiba.o winbond.o -++spinand-objs := core.o fidelix.o gigadevice.o macronix.o micron.o paragon.o toshiba.o winbond.o -+ obj-$(CONFIG_MTD_SPI_NAND) += spinand.o -+--- a/drivers/mtd/nand/spi/core.c -++++ b/drivers/mtd/nand/spi/core.c -+@@ -755,6 +755,7 @@ static const struct nand_ops spinand_ops -+ }; -+ -+ static const struct spinand_manufacturer *spinand_manufacturers[] = { -++ &fidelix_spinand_manufacturer, -+ &gigadevice_spinand_manufacturer, -+ ¯onix_spinand_manufacturer, -+ µn_spinand_manufacturer, -+--- /dev/null -++++ b/drivers/mtd/nand/spi/fidelix.c -+@@ -0,0 +1,76 @@ -++// SPDX-License-Identifier: GPL-2.0 -++/* -++ * Copyright (c) 2020 Davide Fioravanti -++ */ -++ -++#include -++#include -++#include -++ -++#define SPINAND_MFR_FIDELIX 0xE5 -++#define FIDELIX_ECCSR_MASK 0x0F -++ -++static SPINAND_OP_VARIANTS(read_cache_variants, -++ SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), -++ SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0), -++ SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0)); -++ -++static SPINAND_OP_VARIANTS(write_cache_variants, -++ SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), -++ SPINAND_PROG_LOAD(true, 0, NULL, 0)); -++ -++static SPINAND_OP_VARIANTS(update_cache_variants, -++ SPINAND_PROG_LOAD_X4(false, 0, NULL, 0), -++ SPINAND_PROG_LOAD(false, 0, NULL, 0)); -++ -++static int fm35x1ga_ooblayout_ecc(struct mtd_info *mtd, int section, -++ struct mtd_oob_region *region) -++{ -++ if (section > 3) -++ return -ERANGE; -++ -++ region->offset = (16 * section) + 8; -++ region->length = 8; -++ -++ return 0; -++} -++ -++static int fm35x1ga_ooblayout_free(struct mtd_info *mtd, int section, -++ struct mtd_oob_region *region) -++{ -++ if (section > 3) -++ return -ERANGE; -++ -++ region->offset = (16 * section) + 2; -++ region->length = 6; -++ -++ return 0; -++} -++ -++static const struct mtd_ooblayout_ops fm35x1ga_ooblayout = { -++ .ecc = fm35x1ga_ooblayout_ecc, -++ .free = fm35x1ga_ooblayout_free, -++}; -++ -++static const struct spinand_info fidelix_spinand_table[] = { -++ SPINAND_INFO("FM35X1GA", -++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x71), -++ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1), -++ NAND_ECCREQ(4, 512), -++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants, -++ &write_cache_variants, -++ &update_cache_variants), -++ SPINAND_HAS_QE_BIT, -++ SPINAND_ECCINFO(&fm35x1ga_ooblayout, NULL)), -++}; -++ -++static const struct spinand_manufacturer_ops fidelix_spinand_manuf_ops = { -++}; -++ -++const struct spinand_manufacturer fidelix_spinand_manufacturer = { -++ .id = SPINAND_MFR_FIDELIX, -++ .name = "Fidelix", -++ .chips = fidelix_spinand_table, -++ .nchips = ARRAY_SIZE(fidelix_spinand_table), -++ .ops = &fidelix_spinand_manuf_ops, -++}; -+--- a/include/linux/mtd/spinand.h -++++ b/include/linux/mtd/spinand.h -+@@ -238,6 +238,7 @@ struct spinand_manufacturer { -+ }; -+ -+ /* SPI NAND manufacturers */ -++extern const struct spinand_manufacturer fidelix_spinand_manufacturer; -+ extern const struct spinand_manufacturer gigadevice_spinand_manufacturer; -+ extern const struct spinand_manufacturer macronix_spinand_manufacturer; -+ extern const struct spinand_manufacturer micron_spinand_manufacturer; --- -2.25.1 - diff --git a/backports/0016-mediatek-linksys-e8450-fix-wifi-and-lan4.patch b/backports/0016-mediatek-linksys-e8450-fix-wifi-and-lan4.patch deleted file mode 100644 index d3dc47776..000000000 --- a/backports/0016-mediatek-linksys-e8450-fix-wifi-and-lan4.patch +++ /dev/null @@ -1,42 +0,0 @@ -From d8505bfc5491c7b3c9cfb6a58380c115f83ffeb7 Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Sat, 30 Jan 2021 23:08:27 +0000 -Subject: [PATCH 16/22] mediatek: linksys-e8450: fix wifi and lan4 - -Signed-off-by: Daniel Golle ---- - target/linux/mediatek/image/mt7622.mk | 2 +- - .../linux/mediatek/mt7622/base-files/etc/board.d/02_network | 4 +--- - 2 files changed, 2 insertions(+), 4 deletions(-) - -diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk -index efaa3bcaa3..df9e0d7d17 100644 ---- a/target/linux/mediatek/image/mt7622.mk -+++ b/target/linux/mediatek/image/mt7622.mk -@@ -42,7 +42,7 @@ define Device/linksys_e8450 - DEVICE_DTS := mt7622-linksys-e8450 - DEVICE_DTS_DIR := $(DTS_DIR)/mediatek - DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-ata-ahci-mtk \ -- kmod-mt7615e kmod-mt7615-firmware kmod-mt7915 -+ kmod-mt7615e kmod-mt7615-firmware kmod-mt7915e - endef - TARGET_DEVICES += linksys_e8450 - -diff --git a/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network -index f6cd4ba3fc..3d2b9ffe49 100755 ---- a/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network -+++ b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network -@@ -11,9 +11,7 @@ mediatek_setup_interfaces() - case $board in - bananapi,bpi-r64-rootdisk|\ - bananapi,bpi-r64|\ -- linksys,e8450) -- ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" wan -- ;; -+ linksys,e8450|\ - mediatek,mt7622-rfb1) - ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" wan - ;; --- -2.25.1 - diff --git a/backports/0017-image-add-support-for-building-FIT-image-with-filesy.patch b/backports/0017-image-add-support-for-building-FIT-image-with-filesy.patch deleted file mode 100644 index e16525cad..000000000 --- a/backports/0017-image-add-support-for-building-FIT-image-with-filesy.patch +++ /dev/null @@ -1,754 +0,0 @@ -From 86c2de0e5b6b800525df4abf533366c34554064f Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Mon, 15 Feb 2021 14:37:17 +0000 -Subject: [PATCH 17/22] image: add support for building FIT image with - filesystem - -Allow for single (external-data) FIT image to hold kernel, dtb and -squashfs. In that way, the bootloader verify the system integrity -including the rootfs, flashing sysupgrade and factory on many platforms -becomes much easier. -In short: mkimage has a parameter '-E' which allows generating FIT -images with 'external' data rather than embedding the data into the -device-tree blob itself. In this way, the FIT structure itself remains -small and can be parsed easily (rather than having to page around -megabytes of image content). This patch makes use of that and adds -support for adding sub-images of type 'filesystem' which are used to -store the squashfs. Now U-Boot can verify the whole OS and the new -partition parsers added in the Linux kernel can detect the filesystem -sub-images and create partitions for them, and select the active -rootfs volume based on the configuration in FIT. - -This new FIT partition parser works for NOR flash (on top of mtdblock), -NAND flash (on top of ubiblock) as well as classic block devices -(ie. eMMC, SDcard, SATA, NVME, ...) as well as . -See the follow-up commits for a good example of its use (on SPI-NAND). - -Signed-off-by: Daniel Golle ---- - include/image-commands.mk | 3 +- - package/base-files/files/lib/upgrade/nand.sh | 102 +++++--- - scripts/mkits.sh | 45 +++- - target/linux/generic/config-5.10 | 1 + - .../generic/files/block/partitions/fit.c | 234 ++++++++++++++++++ - .../400-block-fit-partition-parser.patch | 96 +++++++ - ...to-create-ubiblock-device-for-rootfs.patch | 5 +- - 7 files changed, 442 insertions(+), 44 deletions(-) - create mode 100644 target/linux/generic/files/block/partitions/fit.c - create mode 100644 target/linux/generic/hack-5.10/400-block-fit-partition-parser.patch - -diff --git a/include/image-commands.mk b/include/image-commands.mk -index 51e745958e..bddbed6052 100644 ---- a/include/image-commands.mk -+++ b/include/image-commands.mk -@@ -200,11 +200,12 @@ define Build/fit - $(TOPDIR)/scripts/mkits.sh \ - -D $(DEVICE_NAME) -o $@.its -k $@ \ - $(if $(word 2,$(1)),-d $(word 2,$(1))) -C $(word 1,$(1)) \ -+ $(if $(word 3,$(1)),-r $(IMAGE_ROOTFS) -f $(subst _,$(comma),$(DEVICE_NAME))) \ - -a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \ - $(if $(DEVICE_FDT_NUM),-n $(DEVICE_FDT_NUM)) \ - -c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config@1") \ - -A $(LINUX_KARCH) -v $(LINUX_VERSION) -- PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new -+ PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(word 3,$(1)),-E -B 0x1000 -p 0x1000) -f $@.its $@.new - @mv $@.new $@ - endef - -diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh -index e6f58df4f5..5bc9ff83f9 100644 ---- a/package/base-files/files/lib/upgrade/nand.sh -+++ b/package/base-files/files/lib/upgrade/nand.sh -@@ -3,13 +3,13 @@ - - . /lib/functions.sh - --# 'kernel' partition on NAND contains the kernel -+# 'kernel' partition or UBI volume on NAND contains the kernel - CI_KERNPART="${CI_KERNPART:-kernel}" - - # 'ubi' partition on NAND contains UBI - CI_UBIPART="${CI_UBIPART:-ubi}" - --# 'rootfs' partition on NAND contains the rootfs -+# 'rootfs' UBI volume on NAND contains the rootfs - CI_ROOTPART="${CI_ROOTPART:-rootfs}" - - ubi_mknod() { -@@ -117,9 +117,11 @@ nand_restore_config() { - nand_upgrade_prepare_ubi() { - local rootfs_length="$1" - local rootfs_type="$2" -- local has_kernel="${3:-0}" -+ local kernel_length="$3" - local has_env="${4:-0}" - -+ [ -n "$rootfs_length" -o -n "$kernel_length" ] || return 1 -+ - local mtdnum="$( find_mtd_index "$CI_UBIPART" )" - if [ ! "$mtdnum" ]; then - echo "cannot find ubi mtd partition $CI_UBIPART" -@@ -148,23 +150,24 @@ nand_upgrade_prepare_ubi() { - local root_ubivol="$( nand_find_volume $ubidev $CI_ROOTPART )" - local data_ubivol="$( nand_find_volume $ubidev rootfs_data )" - -- # remove ubiblock device of rootfs -- local root_ubiblk="ubiblock${root_ubivol:3}" -- if [ "$root_ubivol" -a -e "/dev/$root_ubiblk" ]; then -- echo "removing $root_ubiblk" -- if ! ubiblock -r /dev/$root_ubivol; then -- echo "cannot remove $root_ubiblk" -- return 1; -+ local ubiblk ubiblkvol -+ for ubiblk in /dev/ubiblock*_? ; do -+ [ -e "$ubiblk" ] || continue -+ echo "removing ubiblock${ubiblk:13}" -+ ubiblkvol=ubi${ubiblk:13} -+ if ! ubiblock -r /dev/$ubiblkvol; then -+ echo "cannot remove $ubiblk" -+ return 1 - fi -- fi -+ done - - # kill volumes - [ "$kern_ubivol" ] && ubirmvol /dev/$ubidev -N $CI_KERNPART || true -- [ "$root_ubivol" ] && ubirmvol /dev/$ubidev -N $CI_ROOTPART || true -+ [ "$root_ubivol" -a "$root_ubivol" != "$kern_ubivol" ] && ubirmvol /dev/$ubidev -N $CI_ROOTPART || true - [ "$data_ubivol" ] && ubirmvol /dev/$ubidev -N rootfs_data || true - - # update kernel -- if [ "$has_kernel" = "1" ]; then -+ if [ -n "$kernel_length" ]; then - if ! ubimkvol /dev/$ubidev -N $CI_KERNPART -s $kernel_length; then - echo "cannot create kernel volume" - return 1; -@@ -172,15 +175,17 @@ nand_upgrade_prepare_ubi() { - fi - - # update rootfs -- local root_size_param -- if [ "$rootfs_type" = "ubifs" ]; then -- root_size_param="-m" -- else -- root_size_param="-s $rootfs_length" -- fi -- if ! ubimkvol /dev/$ubidev -N $CI_ROOTPART $root_size_param; then -- echo "cannot create rootfs volume" -- return 1; -+ if [ -n "$rootfs_length" ]; then -+ local root_size_param -+ if [ "$rootfs_type" = "ubifs" ]; then -+ root_size_param="-m" -+ else -+ root_size_param="-s $rootfs_length" -+ fi -+ if ! ubimkvol /dev/$ubidev -N $CI_ROOTPART $rootfs_size_param; then -+ echo "cannot create rootfs volume" -+ return 1; -+ fi - fi - - # create rootfs_data for non-ubifs rootfs -@@ -232,7 +237,7 @@ nand_upgrade_ubinized() { - nand_upgrade_ubifs() { - local rootfs_length=$( (cat $1 | wc -c) 2> /dev/null) - -- nand_upgrade_prepare_ubi "$rootfs_length" "ubifs" "0" "0" -+ nand_upgrade_prepare_ubi "$rootfs_length" "ubifs" "" "" - - local ubidev="$( nand_find_ubi "$CI_UBIPART" )" - local root_ubivol="$(nand_find_volume $ubidev $CI_ROOTPART)" -@@ -241,39 +246,59 @@ nand_upgrade_ubifs() { - nand_do_upgrade_success - } - -+nand_upgrade_fit() { -+ local fit_file="$1" -+ local fit_length="$(wc -c < "$fit_file")" -+ -+ nand_upgrade_prepare_ubi "" "" "$fit_length" "1" -+ -+ local fit_ubidev="$(nand_find_ubi "$CI_UBIPART")" -+ local fit_ubivol="$(nand_find_volume $fit_ubidev "$CI_KERNPART")" -+ ubiupdatevol /dev/$fit_ubivol -s $fit_length $fit_file -+ -+ nand_do_upgrade_success -+} -+ - nand_upgrade_tar() { - local tar_file="$1" - local kernel_mtd="$(find_mtd_index $CI_KERNPART)" - -- local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$') -+ local board_dir=$(tar tf "$tar_file" | grep -m 1 '^sysupgrade-.*/$') - board_dir=${board_dir%/} - -- local kernel_length=$( (tar xf $tar_file ${board_dir}/kernel -O | wc -c) 2> /dev/null) -- local rootfs_length=$( (tar xf $tar_file ${board_dir}/root -O | wc -c) 2> /dev/null) -+ kernel_length=$( (tar xf "$tar_file" ${board_dir}/kernel -O | wc -c) 2> /dev/null) -+ local has_rootfs=0 -+ local rootfs_length -+ local rootfs_type - -- local rootfs_type="$(identify_tar "$tar_file" ${board_dir}/root)" -+ tar tf "$tar_file" ${board_dir}/root 1>/dev/null 2>/dev/null && has_rootfs=1 -+ [ "$has_rootfs" = "1" ] && { -+ rootfs_length=$( (tar xf "$tar_file" ${board_dir}/root -O | wc -c) 2> /dev/null) -+ rootfs_type="$(identify_tar "$tar_file" ${board_dir}/root)" -+ } - - local has_kernel=1 - local has_env=0 - - [ "$kernel_length" != 0 -a -n "$kernel_mtd" ] && { -- tar xf $tar_file ${board_dir}/kernel -O | mtd write - $CI_KERNPART -+ tar xf "$tar_file" ${board_dir}/kernel -O | mtd write - $CI_KERNPART - } -- [ "$kernel_length" = 0 -o ! -z "$kernel_mtd" ] && has_kernel=0 -+ [ "$kernel_length" = 0 -o ! -z "$kernel_mtd" ] && has_kernel= - -- nand_upgrade_prepare_ubi "$rootfs_length" "$rootfs_type" "$has_kernel" "$has_env" -+ nand_upgrade_prepare_ubi "$rootfs_length" "$rootfs_type" "${has_kernel:+$kernel_length}" "$has_env" - - local ubidev="$( nand_find_ubi "$CI_UBIPART" )" - [ "$has_kernel" = "1" ] && { -- local kern_ubivol="$(nand_find_volume $ubidev $CI_KERNPART)" -- tar xf $tar_file ${board_dir}/kernel -O | \ -+ local kern_ubivol="$( nand_find_volume $ubidev $CI_KERNPART )" -+ tar xf "$tar_file" ${board_dir}/kernel -O | \ - ubiupdatevol /dev/$kern_ubivol -s $kernel_length - - } - -- local root_ubivol="$(nand_find_volume $ubidev $CI_ROOTPART)" -- tar xf $tar_file ${board_dir}/root -O | \ -- ubiupdatevol /dev/$root_ubivol -s $rootfs_length - -- -+ [ "$has_rootfs" = "1" ] && { -+ local root_ubivol="$( nand_find_volume $ubidev $CI_ROOTPART )" -+ tar xf "$tar_file" ${board_dir}/root -O | \ -+ ubiupdatevol /dev/$root_ubivol -s $rootfs_length - -+ } - nand_do_upgrade_success - } - -@@ -281,9 +306,10 @@ nand_upgrade_tar() { - nand_do_upgrade() { - local file_type=$(identify $1) - -- [ ! "$(find_mtd_index "$CI_UBIPART")" ] && CI_UBIPART="rootfs" -+ [ ! "$( find_mtd_index "$CI_UBIPART" )" ] && CI_UBIPART="rootfs" - - case "$file_type" in -+ "fit") nand_upgrade_fit $1;; - "ubi") nand_upgrade_ubinized $1;; - "ubifs") nand_upgrade_ubifs $1;; - *) nand_upgrade_tar $1;; -@@ -309,7 +335,7 @@ nand_do_platform_check() { - local control_length=$( (tar xf $tar_file sysupgrade-$board_name/CONTROL -O | wc -c) 2> /dev/null) - local file_type="$(identify $2)" - -- [ "$control_length" = 0 -a "$file_type" != "ubi" -a "$file_type" != "ubifs" ] && { -+ [ "$control_length" = 0 -a "$file_type" != "ubi" -a "$file_type" != "ubifs" -a "$file_type" != "fit" ] && { - echo "Invalid sysupgrade file." - return 1 - } -diff --git a/scripts/mkits.sh b/scripts/mkits.sh -index bb629d6fca..3d68fdacbc 100755 ---- a/scripts/mkits.sh -+++ b/scripts/mkits.sh -@@ -23,18 +23,23 @@ usage() { - printf "\n\t-c ==> set config name 'config'" - printf "\n\t-a ==> set load address to 'addr' (hex)" - printf "\n\t-e ==> set entry point to 'entry' (hex)" -+ printf "\n\t-f ==> set device tree compatible string" - printf "\n\t-v ==> set kernel version to 'version'" - printf "\n\t-k ==> include kernel image 'kernel'" - printf "\n\t-D ==> human friendly Device Tree Blob 'name'" - printf "\n\t-n ==> fdt unit-address 'address'" - printf "\n\t-d ==> include Device Tree Blob 'dtb'" -+ printf "\n\t-r ==> include RootFS blob" -+ printf "\n\t-H ==> specify hash algo instead of SHA1" - printf "\n\t-o ==> create output file 'its_file'\n" - exit 1 - } - - FDTNUM=1 -+ROOTFSNUM=1 -+HASH=sha1 - --while getopts ":A:a:c:C:D:d:e:k:n:o:v:" OPTION -+while getopts ":A:a:c:C:D:d:e:f:k:n:o:v:r:S" OPTION - do - case $OPTION in - A ) ARCH=$OPTARG;; -@@ -44,9 +49,12 @@ do - D ) DEVICE=$OPTARG;; - d ) DTB=$OPTARG;; - e ) ENTRY_ADDR=$OPTARG;; -+ f ) COMPATIBLE=$OPTARG;; - k ) KERNEL=$OPTARG;; - n ) FDTNUM=$OPTARG;; - o ) OUTPUT=$OPTARG;; -+ r ) ROOTFS=$OPTARG;; -+ S ) HASH=$OPTARG;; - v ) VERSION=$OPTARG;; - * ) echo "Invalid option passed to '$0' (options:$*)" - usage;; -@@ -62,11 +70,16 @@ fi - - ARCH_UPPER=$(echo "$ARCH" | tr '[:lower:]' '[:upper:]') - -+if [ -n "${COMPATIBLE}" ]; then -+ COMPATIBLE_PROP="compatible = \"${COMPATIBLE}\";" -+fi -+ - # Conditionally create fdt information - if [ -n "${DTB}" ]; then - FDT_NODE=" - fdt@$FDTNUM { - description = \"${ARCH_UPPER} OpenWrt ${DEVICE} device tree blob\"; -+ ${COMPATIBLE_PROP} - data = /incbin/(\"${DTB}\"); - type = \"flat_dt\"; - arch = \"${ARCH}\"; -@@ -75,13 +88,34 @@ if [ -n "${DTB}" ]; then - algo = \"crc32\"; - }; - hash@2 { -- algo = \"sha1\"; -+ algo = \"${HASH}\"; - }; - }; - " - FDT_PROP="fdt = \"fdt@$FDTNUM\";" - fi - -+if [ -n "${ROOTFS}" ]; then -+ dd if="${ROOTFS}" of="${ROOTFS}.pagesync" bs=4096 conv=sync -+ ROOTFS_NODE=" -+ rootfs@$ROOTFSNUM { -+ description = \"${ARCH_UPPER} OpenWrt ${DEVICE} rootfs\"; -+ ${COMPATIBLE_PROP} -+ data = /incbin/(\"${ROOTFS}.pagesync\"); -+ type = \"filesystem\"; -+ arch = \"${ARCH}\"; -+ compression = \"none\"; -+ hash@1 { -+ algo = \"crc32\"; -+ }; -+ hash@2 { -+ algo = \"${HASH}\"; -+ }; -+ }; -+" -+ ROOTFS_PROP="loadables = \"rootfs@${ROOTFSNUM}\";" -+fi -+ - # Create a default, fully populated DTS file - DATA="/dts-v1/; - -@@ -103,18 +137,21 @@ DATA="/dts-v1/; - algo = \"crc32\"; - }; - hash@2 { -- algo = \"sha1\"; -+ algo = \"$HASH\"; - }; - }; - ${FDT_NODE} -+${ROOTFS_NODE} - }; - - configurations { - default = \"${CONFIG}\"; - ${CONFIG} { -- description = \"OpenWrt\"; -+ description = \"OpenWrt ${DEVICE}\"; - kernel = \"kernel@1\"; - ${FDT_PROP} -+ ${ROOTFS_PROP} -+ ${COMPATIBLE_PROP} - }; - }; - };" -diff --git a/target/linux/generic/config-5.10 b/target/linux/generic/config-5.10 -index f7cc6c8561..ba6317e35f 100644 ---- a/target/linux/generic/config-5.10 -+++ b/target/linux/generic/config-5.10 -@@ -1859,6 +1859,7 @@ CONFIG_FIB_RULES=y - # CONFIG_FIELDBUS_DEV is not set - CONFIG_FILE_LOCKING=y - # CONFIG_FIND_BIT_BENCHMARK is not set -+# CONFIG_FIT_PARTITION is not set - # CONFIG_FIREWIRE is not set - # CONFIG_FIREWIRE_NOSY is not set - # CONFIG_FIREWIRE_SERIAL is not set -diff --git a/target/linux/generic/files/block/partitions/fit.c b/target/linux/generic/files/block/partitions/fit.c -new file mode 100644 -index 0000000000..3694a22667 ---- /dev/null -+++ b/target/linux/generic/files/block/partitions/fit.c -@@ -0,0 +1,234 @@ -+// SPvDX-License-Identifier: GPL-2.0 -+/* -+ * fs/partitions/fit.c -+ * Copyright (C) 2021 Daniel Golle -+ * -+ * headers extracted from U-Boot mkimage sources -+ * (C) Copyright 2008 Semihalf -+ * (C) Copyright 2000-2005 -+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de. -+ * -+ * based on existing partition parsers -+ * Copyright (C) 1991-1998 Linus Torvalds -+ * Re-organised Feb 1998 Russell King -+ */ -+ -+#define pr_fmt(fmt) fmt -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include "check.h" -+ -+#define FIT_IMAGES_PATH "/images" -+#define FIT_CONFS_PATH "/configurations" -+ -+/* hash/signature/key node */ -+#define FIT_HASH_NODENAME "hash" -+#define FIT_ALGO_PROP "algo" -+#define FIT_VALUE_PROP "value" -+#define FIT_IGNORE_PROP "uboot-ignore" -+#define FIT_SIG_NODENAME "signature" -+#define FIT_KEY_REQUIRED "required" -+#define FIT_KEY_HINT "key-name-hint" -+ -+/* cipher node */ -+#define FIT_CIPHER_NODENAME "cipher" -+#define FIT_ALGO_PROP "algo" -+ -+/* image node */ -+#define FIT_DATA_PROP "data" -+#define FIT_DATA_POSITION_PROP "data-position" -+#define FIT_DATA_OFFSET_PROP "data-offset" -+#define FIT_DATA_SIZE_PROP "data-size" -+#define FIT_TIMESTAMP_PROP "timestamp" -+#define FIT_DESC_PROP "description" -+#define FIT_ARCH_PROP "arch" -+#define FIT_TYPE_PROP "type" -+#define FIT_OS_PROP "os" -+#define FIT_COMP_PROP "compression" -+#define FIT_ENTRY_PROP "entry" -+#define FIT_LOAD_PROP "load" -+ -+/* configuration node */ -+#define FIT_KERNEL_PROP "kernel" -+#define FIT_FILESYSTEM_PROP "filesystem" -+#define FIT_RAMDISK_PROP "ramdisk" -+#define FIT_FDT_PROP "fdt" -+#define FIT_LOADABLE_PROP "loadables" -+#define FIT_DEFAULT_PROP "default" -+#define FIT_SETUP_PROP "setup" -+#define FIT_FPGA_PROP "fpga" -+#define FIT_FIRMWARE_PROP "firmware" -+#define FIT_STANDALONE_PROP "standalone" -+ -+#define FIT_MAX_HASH_LEN HASH_MAX_DIGEST_SIZE -+ -+int fit_partition(struct parsed_partitions *state) -+{ -+ struct address_space *mapping = state->bdev->bd_inode->i_mapping; -+ struct page *page = read_mapping_page(mapping, 0, NULL); -+ void *fit, *init_fit; -+ struct partition_meta_info *info; -+ char tmp[sizeof(info->volname)]; -+ u64 dsize, dsectors, isectors; -+ u32 size, image_pos, image_len; -+ const u32 *image_offset_be, *image_len_be, *image_pos_be; -+ int ret = 1, node, images, config, slot; -+ const char *image_name, *image_type, *image_description, *config_default, -+ *config_description, *config_loadables; -+ int image_name_len, image_type_len, image_description_len, config_default_len, -+ config_description_len, config_loadables_len; -+ sector_t start_sect, nr_sects; -+ size_t label_min; -+ -+ if (!page) -+ return -ENOMEM; -+ -+ init_fit = page_address(page); -+ -+ if (!init_fit) { -+ put_page(page); -+ return -EFAULT; -+ } -+ -+ if (fdt_check_header(init_fit)) { -+ put_page(page); -+ return 0; -+ } -+ -+ dsectors = get_capacity(state->bdev->bd_disk); -+ dsize = dsectors << SECTOR_SHIFT; -+ -+ printk(KERN_INFO "FIT: volume size: %llu sectors (%llu bytes)\n", dsectors, dsize); -+ -+ size = fdt_totalsize(init_fit); -+ isectors = size >> SECTOR_SHIFT; -+ if ((isectors << SECTOR_SHIFT) < size) -+ ++isectors; -+ -+ printk(KERN_INFO "FIT: FDT structure size: %llu sectors (%u bytes)\n", isectors, size); -+ -+ if (size >= dsize || size > PAGE_SIZE) -+ { -+ put_page(page); -+ state->access_beyond_eod = (size >= dsize); -+ return 0; -+ } -+ -+ fit = kmemdup(init_fit, size, GFP_KERNEL); -+ put_page(page); -+ if (!fit) -+ return -ENOMEM; -+ -+ config = fdt_path_offset(fit, FIT_CONFS_PATH); -+ if (config < 0) { -+ printk(KERN_INFO "FIT: Cannot find %s node: %d\n", FIT_CONFS_PATH, images); -+ ret = -ENOENT; -+ goto ret_out; -+ } -+ -+ config_default = fdt_getprop(fit, config, FIT_DEFAULT_PROP, &config_default_len); -+ -+ if (!config_default) { -+ printk(KERN_INFO "FIT: Cannot find default configuration\n"); -+ ret = -ENOENT; -+ goto ret_out; -+ } -+ -+ node = fdt_subnode_offset(fit, config, config_default); -+ if (node < 0) { -+ printk(KERN_INFO "FIT: Cannot find %s node: %d\n", config_default, node); -+ ret = -ENOENT; -+ goto ret_out; -+ } -+ -+ config_description = fdt_getprop(fit, node, FIT_DESC_PROP, &config_description_len); -+ config_loadables = fdt_getprop(fit, node, FIT_LOADABLE_PROP, &config_loadables_len); -+ -+ printk(KERN_INFO "FIT: Default configuration: %s%s%s%s\n", config_default, -+ config_description?" (":"", config_description?:"", config_description?")":""); -+ -+ images = fdt_path_offset(fit, FIT_IMAGES_PATH); -+ if (images < 0) { -+ printk(KERN_INFO "FIT: Cannot find %s node: %d\n", FIT_IMAGES_PATH, images); -+ ret = -EINVAL; -+ goto ret_out; -+ } -+ -+ slot = 1; -+ fdt_for_each_subnode(node, fit, images) { -+ image_name = fdt_get_name(fit, node, &image_name_len); -+ image_type = fdt_getprop(fit, node, FIT_TYPE_PROP, &image_type_len); -+ image_offset_be = fdt_getprop(fit, node, FIT_DATA_OFFSET_PROP, NULL); -+ image_pos_be = fdt_getprop(fit, node, FIT_DATA_POSITION_PROP, NULL); -+ image_len_be = fdt_getprop(fit, node, FIT_DATA_SIZE_PROP, NULL); -+ if (!image_name || !image_type || !image_len_be) -+ continue; -+ -+ image_len = be32_to_cpu(*image_len_be); -+ if (!image_len) -+ continue; -+ -+ if (image_offset_be) -+ image_pos = be32_to_cpu(*image_offset_be) + size; -+ else if (image_pos_be) -+ image_pos = be32_to_cpu(*image_pos_be); -+ else -+ continue; -+ -+ image_description = fdt_getprop(fit, node, FIT_DESC_PROP, &image_description_len); -+ -+ printk(KERN_INFO "FIT: %16s sub-image 0x%08x - 0x%08x '%s' %s%s%s\n", -+ image_type, image_pos, image_pos + image_len, image_name, -+ image_description?"(":"", image_description?:"", image_description?") ":""); -+ -+ if (strcmp(image_type, FIT_FILESYSTEM_PROP)) -+ continue; -+ -+ if (image_pos & ((1 << PAGE_SHIFT)-1)) { -+ printk(KERN_INFO "FIT: image %s start not aligned to page boundaries, skipping\n", image_name); -+ continue; -+ } -+ -+ if (image_len & ((1 << PAGE_SHIFT)-1)) { -+ printk(KERN_INFO "FIT: sub-image %s end not aligned to page boundaries, skipping\n", image_name); -+ continue; -+ } -+ -+ start_sect = image_pos >> SECTOR_SHIFT; -+ nr_sects = image_len >> SECTOR_SHIFT; -+ -+ if (start_sect + nr_sects > dsectors) { -+ state->access_beyond_eod = 1; -+ continue; -+ } -+ -+ put_partition(state, slot, start_sect, nr_sects); -+ state->parts[slot].flags = 0; -+ info = &state->parts[slot].info; -+ -+ label_min = min_t(int, sizeof(info->volname) - 1, image_name_len); -+ strncpy(info->volname, image_name, label_min); -+ info->volname[label_min] = '\0'; -+ -+ snprintf(tmp, sizeof(tmp), "(%s)", info->volname); -+ strlcat(state->pp_buf, tmp, PAGE_SIZE); -+ -+ state->parts[slot].has_info = true; -+ -+ if (config_loadables && !strcmp(image_name, config_loadables)) { -+ printk(KERN_INFO "FIT: selecting configured loadable %s to be root filesystem\n", image_name); -+ state->parts[slot].flags |= ADDPART_FLAG_ROOTDEV; -+ } -+ -+ ++slot; -+ } -+ -+ret_out: -+ kfree(fit); -+ return ret; -+} -diff --git a/target/linux/generic/hack-5.10/400-block-fit-partition-parser.patch b/target/linux/generic/hack-5.10/400-block-fit-partition-parser.patch -new file mode 100644 -index 0000000000..9eaf8637d0 ---- /dev/null -+++ b/target/linux/generic/hack-5.10/400-block-fit-partition-parser.patch -@@ -0,0 +1,96 @@ -+--- a/block/blk.h -++++ b/block/blk.h -+@@ -357,6 +357,7 @@ char *disk_name(struct gendisk *hd, int -+ #define ADDPART_FLAG_NONE 0 -+ #define ADDPART_FLAG_RAID 1 -+ #define ADDPART_FLAG_WHOLEDISK 2 -++#define ADDPART_FLAG_ROOTDEV 4 -+ void delete_partition(struct hd_struct *part); -+ int bdev_add_partition(struct block_device *bdev, int partno, -+ sector_t start, sector_t length); -+--- a/block/partitions/Kconfig -++++ b/block/partitions/Kconfig -+@@ -101,6 +101,13 @@ config ATARI_PARTITION -+ Say Y here if you would like to use hard disks under Linux which -+ were partitioned under the Atari OS. -+ -++config FIT_PARTITION -++ bool "Flattened-Image-Tree (FIT) partition support" if PARTITION_ADVANCED -++ default n -++ help -++ Say Y here if your system needs to mount the filesystem part of -++ a Flattened-Image-Tree (FIT) image commonly used with Das U-Boot. -++ -+ config IBM_PARTITION -+ bool "IBM disk label and partition support" -+ depends on PARTITION_ADVANCED && S390 -+--- a/block/partitions/Makefile -++++ b/block/partitions/Makefile -+@@ -8,6 +8,7 @@ obj-$(CONFIG_ACORN_PARTITION) += acorn.o -+ obj-$(CONFIG_AMIGA_PARTITION) += amiga.o -+ obj-$(CONFIG_ATARI_PARTITION) += atari.o -+ obj-$(CONFIG_AIX_PARTITION) += aix.o -++obj-$(CONFIG_FIT_PARTITION) += fit.o -+ obj-$(CONFIG_CMDLINE_PARTITION) += cmdline.o -+ obj-$(CONFIG_MAC_PARTITION) += mac.o -+ obj-$(CONFIG_LDM_PARTITION) += ldm.o -+--- a/block/partitions/check.h -++++ b/block/partitions/check.h -+@@ -58,6 +58,7 @@ int amiga_partition(struct parsed_partit -+ int atari_partition(struct parsed_partitions *state); -+ int cmdline_partition(struct parsed_partitions *state); -+ int efi_partition(struct parsed_partitions *state); -++int fit_partition(struct parsed_partitions *state); -+ int ibm_partition(struct parsed_partitions *); -+ int karma_partition(struct parsed_partitions *state); -+ int ldm_partition(struct parsed_partitions *state); -+--- a/block/partitions/core.c -++++ b/block/partitions/core.c -+@@ -10,6 +10,8 @@ -+ #include -+ #include -+ #include -++#include -++ -+ #include "check.h" -+ -+ static int (*check_part[])(struct parsed_partitions *) = { -+@@ -46,6 +48,9 @@ static int (*check_part[])(struct parsed -+ #ifdef CONFIG_EFI_PARTITION -+ efi_partition, /* this must come before msdos */ -+ #endif -++#ifdef CONFIG_FIT_PARTITION -++ fit_partition, -++#endif -+ #ifdef CONFIG_SGI_PARTITION -+ sgi_partition, -+ #endif -+@@ -694,6 +699,9 @@ static bool blk_add_partition(struct gen -+ (state->parts[p].flags & ADDPART_FLAG_RAID)) -+ md_autodetect_dev(part_to_dev(part)->devt); -+ -++ if ((state->parts[p].flags & ADDPART_FLAG_ROOTDEV) && ROOT_DEV == 0) -++ ROOT_DEV = part_to_dev(part)->devt; -++ -+ return true; -+ } -+ -+--- a/drivers/mtd/ubi/block.c -++++ b/drivers/mtd/ubi/block.c -+@@ -396,7 +396,7 @@ int ubiblock_create(struct ubi_volume_in -+ dev->leb_size = vi->usable_leb_size; -+ -+ /* Initialize the gendisk of this ubiblock device */ -+- gd = alloc_disk(1); -++ gd = alloc_disk(0); -+ if (!gd) { -+ pr_err("UBI: block: alloc_disk failed\n"); -+ ret = -ENODEV; -+@@ -413,6 +413,7 @@ int ubiblock_create(struct ubi_volume_in -+ goto out_put_disk; -+ } -+ gd->private_data = dev; -++ gd->flags |= GENHD_FL_EXT_DEVT; -+ sprintf(gd->disk_name, "ubiblock%d_%d", dev->ubi_num, dev->vol_id); -+ set_capacity(gd, disk_capacity); -+ dev->gd = gd; -diff --git a/target/linux/generic/pending-5.10/491-ubi-auto-create-ubiblock-device-for-rootfs.patch b/target/linux/generic/pending-5.10/491-ubi-auto-create-ubiblock-device-for-rootfs.patch -index e5ee2c8656..a2b48fd4fc 100644 ---- a/target/linux/generic/pending-5.10/491-ubi-auto-create-ubiblock-device-for-rootfs.patch -+++ b/target/linux/generic/pending-5.10/491-ubi-auto-create-ubiblock-device-for-rootfs.patch -@@ -8,7 +8,7 @@ Signed-off-by: Daniel Golle - - --- a/drivers/mtd/ubi/block.c - +++ b/drivers/mtd/ubi/block.c --@@ -652,6 +652,44 @@ static void __init ubiblock_create_from_ -+@@ -652,6 +652,47 @@ static void __init ubiblock_create_from_ - } - } - -@@ -33,6 +33,9 @@ Signed-off-by: Daniel Golle - + for (ubi_num = 0; ubi_num < UBI_MAX_DEVICES; ubi_num++) { - + desc = ubi_open_volume_nm(ubi_num, "rootfs", UBI_READONLY); - + if (IS_ERR(desc)) -++ desc = ubi_open_volume_nm(ubi_num, "fit", UBI_READONLY);; -++ -++ if (IS_ERR(desc)) - + continue; - + - + ubi_get_volume_info(desc, &vi); --- -2.25.1 - diff --git a/backports/0021-mediatek-linksys-e8450-ubi-add-alternative-UBI-NAND-.patch b/backports/0021-mediatek-linksys-e8450-ubi-add-alternative-UBI-NAND-.patch deleted file mode 100644 index 919386188..000000000 --- a/backports/0021-mediatek-linksys-e8450-ubi-add-alternative-UBI-NAND-.patch +++ /dev/null @@ -1,1584 +0,0 @@ -From 75d5297ad7f52a705f543e98e683f54bf1fafff6 Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Tue, 9 Feb 2021 23:07:42 +0000 -Subject: [PATCH 01/23] mediatek: linksys-e8450-ubi: add alternative UBI NAND - layout - -The vendor flash layout of the Linksys E8450 is problematic as it uses -the SPI-NAND chip without any wear-leveling while at the same time -wasting a lot of space for padding. -Use an all-UBI layout instead, storing the kernel+dtb+squashfs in -uImage.FIT standard format in UBI volume 'fit', the read-write -overlay in UBI volume 'rootfs_data' as well as reduntant U-Boot -environments 'ubootenv' and 'ubootenv2', and a 'recovery' -kernel+dtb+initramfs uImage.FIT for dual-boot. - -** WARNING ** -THIS PROCEDURE CAN EASILY BRICK YOUR DEVICE PERMANENTLY IF NOT CARRIED -OUT VERY CAREFULLY AND EXACTLY AS DESCRIBED! -MAKE A COMPLETE BACKUP OF YOUR FLASH NOW! -(you can use *linksys_e8450_ubi-initramfs-kernel.bin to have full -access to the flash including raw access to the BBT area which is at -the end. this area at the end of the flash is used for legacy MTK -bad-block management and you will need to write it back there if you -ever want to go back to the vendor firmware or non-UBI OpenWrt!) - -In order to make use of a UBI-based flash layout, the complete boot- -chain needs to be replaced **in one go** (eg. using the original -bootloader). -Write the following files to the addresses listed below in flash: - -0x00000000-0x00020000 *-mt7622-linksys_e8450_ubi-preloader.bin -0x00080000-0x00180000 *-mt7622-linksys_e8450_ubi-bl31-uboot.fip - -An easy way to do that in the vendor loader's console: - -tftpboot 0x40080000 openwrt-mediatek-mt7622-linksys_e8450_ubi-preloader.bin -tftpboot 0x40100000 openwrt-mediatek-mt7622-linksys_e8450_ubi-bl31-uboot.fip -nand erase 0x0 0x180000 -nand write 0x40080000 0x0 0x180000 -reset - -Once the new bootchain comes up, the loader will initialize UBI and the -ubootenv volumes. It will then of course fail to find any bootable -volume and hence resort to load kernel via TFTP from server -192.168.1.254 while giving itself the address 192.168.1.1 -(bootp or even PXE could easily be used instead). - -The requested file is called -openwrt-mediatek-mt7622-linksys_e8450_ubi-initramfs-kernel.bin -and you should provide exactly that :) -It will be written to UBI as recovery image and booted. -You can then continue and flash the production OS image, either -by using sysupgrade in the booted initramfs recovery OS, or by using -the bootloader menu and TFTP. - -That's it. Go ahead and mess around with a bootchain built almost -completely from source (only DRAM calibration blobs are fitted in bl2, -and the irreplacable on-chip ROM loader remains, of course). -And enjoy U-Boot built with many great features out-of-the-box. - -You can access the bootloader environment from within OpenWrt using the -'fw_printenv' and 'fw_setenv' commands. Don't be afraid, once you got -the new bootchain installed the device should be fairly unbrickable -(holding reset button before and during power-on resets things and -allows reflashing recovery image via TFTP) - -Special thanks to @dvn0 (Devan Carpenter) for providing amazingly fast -infra for test-builds, allowing for `make clean ; make -j$(nproc)` in -less than two minutes :) - -Signed-off-by: Daniel Golle ---- - .../dts/mediatek/mt7622-linksys-e8450-ubi.dts | 59 +++ - .../dts/mediatek/mt7622-linksys-e8450.dts | 494 ++---------------- - .../dts/mediatek/mt7622-linksys-e8450.dtsi | 408 +++++++++++++++ - .../dts/mediatek/mt7622-ubnt-unifi-6-lr.dts | 327 ++++++++++++ - target/linux/mediatek/image/Makefile | 1 + - target/linux/mediatek/image/mt7622.mk | 28 + - .../mt7622/base-files/etc/board.d/01_leds | 2 +- - .../mt7622/base-files/etc/board.d/02_network | 8 +- - .../mt7622/base-files/lib/upgrade/platform.sh | 6 + - target/linux/mediatek/mt7622/config-5.10 | 1 + - 10 files changed, 890 insertions(+), 444 deletions(-) - create mode 100644 target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-linksys-e8450-ubi.dts - create mode 100644 target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-linksys-e8450.dtsi - create mode 100644 target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-ubnt-unifi-6-lr.dts - mode change 100755 => 100644 target/linux/mediatek/mt7622/config-5.10 - -diff --git a/target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-linksys-e8450-ubi.dts b/target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-linksys-e8450-ubi.dts -new file mode 100644 -index 0000000000..02b3bc8adc ---- /dev/null -+++ b/target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-linksys-e8450-ubi.dts -@@ -0,0 +1,59 @@ -+/* -+ * SPDX-License-Identifier: (GPL-2.0 OR MIT) -+ */ -+ -+/dts-v1/; -+#include "mt7622-linksys-e8450.dtsi" -+ -+/ { -+ model = "Linksys E8450 (UBI)"; -+ compatible = "linksys,e8450,ubi", "mediatek,mt7622"; -+ -+ aliases { -+ label-mac-device = &gmac0; -+ }; -+}; -+ -+&snand { -+ partitions { -+ compatible = "fixed-partitions"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ -+ partition@0 { -+ label = "bl2"; -+ reg = <0x00000 0x0080000>; -+ read-only; -+ }; -+ -+ partition@80000 { -+ label = "fip"; -+ reg = <0x80000 0x0140000>; -+ read-only; -+ }; -+ -+ factory: partition@1c0000 { -+ label = "factory"; -+ reg = <0x1c0000 0x0100000>; -+ read-only; -+ }; -+ -+ partition@300000 { -+ label = "ubi"; -+ reg = <0x300000 0x7d00000>; -+ }; -+ }; -+}; -+ -+&wmac { -+ mediatek,mtd-eeprom = <&factory 0x0000>; -+ status = "okay"; -+}; -+ -+&wmac1 { -+ mediatek,mtd-eeprom = <&factory 0x05000>; -+}; -+ -+&gmac0 { -+ mtd-mac-address = <&factory 0x7fffa>; -+}; -diff --git a/target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-linksys-e8450.dts b/target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-linksys-e8450.dts -index 00b11690f0..53762d3fd1 100644 ---- a/target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-linksys-e8450.dts -+++ b/target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-linksys-e8450.dts -@@ -3,486 +3,102 @@ - */ - - /dts-v1/; --#include --#include -- --#include "mt7622.dtsi" --#include "mt6380.dtsi" -+#include "mt7622-linksys-e8450.dtsi" - - / { - model = "Linksys E8450"; - compatible = "linksys,e8450", "mediatek,mt7622"; - - aliases { -- serial0 = &uart0; -- led-boot = &led_power; -- led-failsafe = &led_power; -- led-running = &led_power; -- led-upgrade = &led_power; -- }; -- -- chosen { -- stdout-path = "serial0:115200n8"; -- bootargs = "earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n1 swiotlb=512"; -- }; -- -- cpus { -- cpu@0 { -- proc-supply = <&mt6380_vcpu_reg>; -- sram-supply = <&mt6380_vm_reg>; -- }; -- -- cpu@1 { -- proc-supply = <&mt6380_vcpu_reg>; -- sram-supply = <&mt6380_vm_reg>; -- }; -- }; -- -- gpio-keys { -- compatible = "gpio-keys"; -- -- factory { -- label = "reset"; -- linux,code = ; -- gpios = <&pio 0 GPIO_ACTIVE_LOW>; -- }; -- -- wps { -- label = "wps"; -- linux,code = ; -- gpios = <&pio 102 GPIO_ACTIVE_LOW>; -- }; -- }; -- -- gpio-leds { -- compatible = "gpio-leds"; -- -- led_power: power_blue { -- label = "power:blue"; -- gpios = <&pio 95 GPIO_ACTIVE_LOW>; -- default-state = "on"; -- }; -- -- power_orange { -- label = "power:orange"; -- gpios = <&pio 96 GPIO_ACTIVE_LOW>; -- default-state = "off"; -- }; -- -- inet_blue { -- label = "inet:blue"; -- gpios = <&pio 97 GPIO_ACTIVE_LOW>; -- default-state = "off"; -- }; -- -- inet_orange { -- label = "inet:orange"; -- gpios = <&pio 98 GPIO_ACTIVE_LOW>; -- default-state = "off"; -- }; -- }; -- -- memory { -- reg = <0 0x40000000 0 0x40000000>; -- }; -- -- reg_1p8v: regulator-1p8v { -- compatible = "regulator-fixed"; -- regulator-name = "fixed-1.8V"; -- regulator-min-microvolt = <1800000>; -- regulator-max-microvolt = <1800000>; -- regulator-always-on; -- }; -- -- reg_3p3v: regulator-3p3v { -- compatible = "regulator-fixed"; -- regulator-name = "fixed-3.3V"; -- regulator-min-microvolt = <3300000>; -- regulator-max-microvolt = <3300000>; -- regulator-boot-on; -- regulator-always-on; -- }; -- -- reg_5v: regulator-5v { -- compatible = "regulator-fixed"; -- regulator-name = "fixed-5V"; -- regulator-min-microvolt = <5000000>; -- regulator-max-microvolt = <5000000>; -- regulator-boot-on; -- regulator-always-on; -+ label-mac-device = &gmac0; - }; - }; - --&bch { -- status = "okay"; --}; -+&snand { -+ mediatek,bmt-v2; -+ mediatek,bmt-table-size = <0x1000>; - --&btif { -- status = "okay"; --}; -- --&cir { -- pinctrl-names = "default"; -- pinctrl-0 = <&irrx_pins>; -- status = "okay"; --}; -- --ð { -- pinctrl-names = "default"; -- pinctrl-0 = <ð_pins>; -- status = "okay"; -- -- gmac0: mac@0 { -- compatible = "mediatek,eth-mac"; -- reg = <0>; -- phy-mode = "2500base-x"; -- -- fixed-link { -- speed = <2500>; -- full-duplex; -- pause; -- }; -- }; -- -- mdio-bus { -+ partitions { -+ compatible = "fixed-partitions"; - #address-cells = <1>; -- #size-cells = <0>; -- -- switch@0 { -- compatible = "mediatek,mt7531"; -- reg = <0>; -- reset-gpios = <&pio 54 0>; -- -- ports { -- #address-cells = <1>; -- #size-cells = <0>; -- -- port@0 { -- reg = <0>; -- label = "lan1"; -- }; -- -- port@1 { -- reg = <1>; -- label = "lan2"; -- }; -- -- port@2 { -- reg = <2>; -- label = "lan3"; -- }; -- -- port@3 { -- reg = <3>; -- label = "lan4"; -- }; -- -- port@4 { -- reg = <4>; -- label = "wan"; -- }; -- -- port@6 { -- reg = <6>; -- label = "cpu"; -- ethernet = <&gmac0>; -- phy-mode = "2500base-x"; -- -- fixed-link { -- speed = <2500>; -- full-duplex; -- pause; -- }; -- }; -- }; -- }; -- -- }; --}; -- --&pcie0 { -- pinctrl-names = "default"; -- pinctrl-0 = <&pcie0_pins>; -- status = "okay"; --}; -- --&pcie1 { -- pinctrl-names = "default"; -- pinctrl-0 = <&pcie1_pins>; -- status = "okay"; --}; -- --&slot0 { -- mt7915@0,0 { -- reg = <0x0000 0 0 0 0>; -- mediatek,mtd-eeprom = <&factory 0x05000>; -- }; --}; -- --&pio { -- /* Attention: GPIO 90 is used to switch between PCIe@1,0 and -- * SATA functions. i.e. output-high: PCIe, output-low: SATA -- */ --// asm_sel { --// gpio-hog; --// gpios = <90 GPIO_ACTIVE_HIGH>; --// output-high; --// }; -- -- eth_pins: eth-pins { -- mux { -- function = "eth"; -- groups = "mdc_mdio", "rgmii_via_gmac2"; -- }; -- }; -- -- irrx_pins: irrx-pins { -- mux { -- function = "ir"; -- groups = "ir_1_rx"; -- }; -- }; -- -- irtx_pins: irtx-pins { -- mux { -- function = "ir"; -- groups = "ir_1_tx"; -- }; -- }; -+ #size-cells = <1>; - -- pcie0_pins: pcie0-pins { -- mux { -- function = "pcie"; -- groups = "pcie0_pad_perst", -- "pcie0_1_waken", -- "pcie0_1_clkreq"; -+ partition@0 { -+ label = "Preloader"; -+ reg = <0x00000 0x0080000>; -+ read-only; - }; -- }; - -- pcie1_pins: pcie1-pins { -- mux { -- function = "pcie"; -- groups = "pcie1_pad_perst", -- "pcie1_0_waken", -- "pcie1_0_clkreq"; -+ partition@80000 { -+ label = "ATF"; -+ reg = <0x80000 0x0040000>; - }; -- }; - -- pmic_bus_pins: pmic-bus-pins { -- mux { -- function = "pmic"; -- groups = "pmic_bus"; -+ partition@c0000 { -+ label = "u-boot"; -+ reg = <0xc0000 0x0080000>; - }; -- }; - -- pwm7_pins: pwm1-2-pins { -- mux { -- function = "pwm"; -- groups = "pwm_ch7_2"; -+ partition@140000 { -+ label = "u-boot-env"; -+ reg = <0x140000 0x0080000>; - }; -- }; - -- wled_pins: wled-pins { -- mux { -- function = "led"; -- groups = "wled"; -+ factory: partition@1c0000 { -+ label = "factory"; -+ reg = <0x1c0000 0x0100000>; - }; -- }; - -- /* Serial NAND is shared pin with SPI-NOR */ -- serial_nand_pins: serial-nand-pins { -- mux { -- function = "flash"; -- groups = "snfi"; -+ partition@300000 { -+ label = "devinfo"; -+ reg = <0x300000 0x020000>; - }; -- }; - -- spic0_pins: spic0-pins { -- mux { -- function = "spi"; -- groups = "spic0_0"; -+ partition@320000 { -+ label = "senv"; -+ reg = <0x320000 0x020000>; - }; -- }; - -- spic1_pins: spic1-pins { -- mux { -- function = "spi"; -- groups = "spic1_0"; -+ partition@360000 { -+ label = "bootseq"; -+ reg = <0x360000 0x020000>; - }; -- }; - -- uart0_pins: uart0-pins { -- mux { -- function = "uart"; -- groups = "uart0_0_tx_rx" ; -+ partition@500000 { -+ label = "firmware1"; -+ compatible = "denx,fit"; -+ openwrt,cmdline-match = "mtdparts=master"; -+ reg = <0x500000 0x1E00000>; - }; -- }; - -- uart2_pins: uart2-pins { -- mux { -- function = "uart"; -- groups = "uart2_1_tx_rx" ; -+ partition@2300000 { -+ label = "firmware2"; -+ compatible = "denx,fit"; -+ openwrt,cmdline-match = "mtdparts=slave"; -+ reg = <0x2300000 0x1E00000>; - }; -- }; - -- watchdog_pins: watchdog-pins { -- mux { -- function = "watchdog"; -- groups = "watchdog"; -+ partition@4100000 { -+ label = "data"; -+ reg = <0x4100000 0x1900000>; - }; -- }; --}; -- --&pwm { -- pinctrl-names = "default"; -- pinctrl-0 = <&pwm7_pins>; -- status = "okay"; --}; -- --&pwrap { -- pinctrl-names = "default"; -- pinctrl-0 = <&pmic_bus_pins>; -- -- status = "okay"; --}; -- --&sata { -- status = "disabled"; --}; -- --&sata_phy { -- status = "disabled"; --}; -- --&snfi { -- pinctrl-names = "default"; -- pinctrl-0 = <&serial_nand_pins>; -- status = "okay"; -- -- spi_nand@0 { -- #address-cells = <1>; -- #size-cells = <1>; -- compatible = "spi-nand"; -- spi-max-frequency = <104000000>; -- reg = <0>; -- -- mediatek,bmt-v2; -- mediatek,bmt-table-size = <0x1000>; -- -- partitions { -- compatible = "fixed-partitions"; -- #address-cells = <1>; -- #size-cells = <1>; -- -- partition@0 { -- label = "Preloader"; -- reg = <0x00000 0x0080000>; -- read-only; -- }; -- -- partition@80000 { -- label = "ATF"; -- reg = <0x80000 0x0040000>; -- }; -- -- partition@c0000 { -- label = "u-boot"; -- reg = <0xc0000 0x0080000>; -- }; -- -- partition@140000 { -- label = "u-boot-env"; -- reg = <0x140000 0x0080000>; -- }; -- -- factory: partition@1c0000 { -- label = "factory"; -- reg = <0x1c0000 0x0100000>; -- }; -- -- partition@300000 { -- label = "devinfo"; -- reg = <0x300000 0x020000>; -- }; - -- partition@320000 { -- label = "senv"; -- reg = <0x320000 0x020000>; -- }; -- -- partition@360000 { -- label = "bootseq"; -- reg = <0x360000 0x020000>; -- }; -- -- partition@500000 { -- label = "firmware1"; -- compatible = "denx,fit"; -- openwrt,cmdline-match = "mtdparts=master"; -- reg = <0x500000 0x1E00000>; -- }; -- -- partition@2300000 { -- label = "firmware2"; -- compatible = "denx,fit"; -- openwrt,cmdline-match = "mtdparts=slave"; -- reg = <0x2300000 0x1E00000>; -- }; -- -- partition@4100000 { -- label = "data"; -- reg = <0x4100000 0x1900000>; -- }; -- -- partition@5100000 { -- label = "mfg"; -- reg = <0x5a00000 0x1400000>; -- }; -+ partition@5100000 { -+ label = "mfg"; -+ reg = <0x5a00000 0x1400000>; - }; - }; - }; - --&spi0 { -- pinctrl-names = "default"; -- pinctrl-0 = <&spic0_pins>; -- status = "okay"; --}; -- --&spi1 { -- pinctrl-names = "default"; -- pinctrl-0 = <&spic1_pins>; -- status = "okay"; --}; -- --&ssusb { -- vusb33-supply = <®_3p3v>; -- vbus-supply = <®_5v>; -- status = "okay"; --}; -- --&u3phy { -- status = "okay"; --}; -- --&uart0 { -- pinctrl-names = "default"; -- pinctrl-0 = <&uart0_pins>; -- status = "okay"; --}; -- --&uart2 { -- pinctrl-names = "default"; -- pinctrl-0 = <&uart2_pins>; -+&wmac { -+ mediatek,mtd-eeprom = <&factory 0x0000>; - status = "okay"; - }; - --&watchdog { -- pinctrl-names = "default"; -- pinctrl-0 = <&watchdog_pins>; -- status = "okay"; -+&wmac1 { -+ mediatek,mtd-eeprom = <&factory 0x05000>; - }; - --&wmac { -- mediatek,mtd-eeprom = <&factory 0x0000>; -- status = "okay"; -+&gmac0 { -+ mtd-mac-address = <&factory 0x7fffa>; - }; -diff --git a/target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-linksys-e8450.dtsi b/target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-linksys-e8450.dtsi -new file mode 100644 -index 0000000000..032e5b4320 ---- /dev/null -+++ b/target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-linksys-e8450.dtsi -@@ -0,0 +1,408 @@ -+/* -+ * SPDX-License-Identifier: (GPL-2.0 OR MIT) -+ */ -+ -+/dts-v1/; -+#include -+#include -+ -+#include "mt7622.dtsi" -+#include "mt6380.dtsi" -+ -+/ { -+ compatible = "linksys,e8450", "mediatek,mt7622"; -+ -+ aliases { -+ serial0 = &uart0; -+ led-boot = &led_power; -+ led-failsafe = &led_power; -+ led-running = &led_power; -+ led-upgrade = &led_power; -+ }; -+ -+ chosen { -+ stdout-path = "serial0:115200n8"; -+ bootargs = "earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n1 swiotlb=512"; -+ }; -+ -+ cpus { -+ cpu@0 { -+ proc-supply = <&mt6380_vcpu_reg>; -+ sram-supply = <&mt6380_vm_reg>; -+ }; -+ -+ cpu@1 { -+ proc-supply = <&mt6380_vcpu_reg>; -+ sram-supply = <&mt6380_vm_reg>; -+ }; -+ }; -+ -+ gpio-keys { -+ compatible = "gpio-keys"; -+ -+ factory { -+ label = "reset"; -+ linux,code = ; -+ gpios = <&pio 0 GPIO_ACTIVE_LOW>; -+ }; -+ -+ wps { -+ label = "wps"; -+ linux,code = ; -+ gpios = <&pio 102 GPIO_ACTIVE_LOW>; -+ }; -+ }; -+ -+ gpio-leds { -+ compatible = "gpio-leds"; -+ -+ led_power: power_blue { -+ label = "power:blue"; -+ gpios = <&pio 95 GPIO_ACTIVE_LOW>; -+ default-state = "on"; -+ }; -+ -+ power_orange { -+ label = "power:orange"; -+ gpios = <&pio 96 GPIO_ACTIVE_LOW>; -+ default-state = "off"; -+ }; -+ -+ inet_blue { -+ label = "inet:blue"; -+ gpios = <&pio 97 GPIO_ACTIVE_LOW>; -+ default-state = "off"; -+ }; -+ -+ inet_orange { -+ label = "inet:orange"; -+ gpios = <&pio 98 GPIO_ACTIVE_LOW>; -+ default-state = "off"; -+ }; -+ }; -+ -+ memory { -+ reg = <0 0x40000000 0 0x40000000>; -+ }; -+ -+ reg_1p8v: regulator-1p8v { -+ compatible = "regulator-fixed"; -+ regulator-name = "fixed-1.8V"; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ regulator-always-on; -+ }; -+ -+ reg_3p3v: regulator-3p3v { -+ compatible = "regulator-fixed"; -+ regulator-name = "fixed-3.3V"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-boot-on; -+ regulator-always-on; -+ }; -+ -+ reg_5v: regulator-5v { -+ compatible = "regulator-fixed"; -+ regulator-name = "fixed-5V"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ regulator-boot-on; -+ regulator-always-on; -+ }; -+}; -+ -+&bch { -+ status = "okay"; -+}; -+ -+&btif { -+ status = "okay"; -+}; -+ -+&cir { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&irrx_pins>; -+ status = "okay"; -+}; -+ -+ð { -+ pinctrl-names = "default"; -+ pinctrl-0 = <ð_pins>; -+ status = "okay"; -+ -+ gmac0: mac@0 { -+ compatible = "mediatek,eth-mac"; -+ reg = <0>; -+ phy-mode = "2500base-x"; -+ -+ fixed-link { -+ speed = <2500>; -+ full-duplex; -+ pause; -+ }; -+ }; -+ -+ mdio-bus { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ switch@0 { -+ compatible = "mediatek,mt7531"; -+ reg = <0>; -+ reset-gpios = <&pio 54 0>; -+ -+ ports { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ port@0 { -+ reg = <0>; -+ label = "lan1"; -+ }; -+ -+ port@1 { -+ reg = <1>; -+ label = "lan2"; -+ }; -+ -+ port@2 { -+ reg = <2>; -+ label = "lan3"; -+ }; -+ -+ port@3 { -+ reg = <3>; -+ label = "lan4"; -+ }; -+ -+ port@4 { -+ reg = <4>; -+ label = "wan"; -+ }; -+ -+ port@6 { -+ reg = <6>; -+ label = "cpu"; -+ ethernet = <&gmac0>; -+ phy-mode = "2500base-x"; -+ -+ fixed-link { -+ speed = <2500>; -+ full-duplex; -+ pause; -+ }; -+ }; -+ }; -+ }; -+ -+ }; -+}; -+ -+&pcie0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pcie0_pins>; -+ status = "okay"; -+}; -+ -+&pcie1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pcie1_pins>; -+ status = "okay"; -+}; -+ -+&pio { -+ /* Attention: GPIO 90 is used to switch between PCIe@1,0 and -+ * SATA functions. i.e. output-high: PCIe, output-low: SATA -+ */ -+// asm_sel { -+// gpio-hog; -+// gpios = <90 GPIO_ACTIVE_HIGH>; -+// output-high; -+// }; -+ -+ eth_pins: eth-pins { -+ mux { -+ function = "eth"; -+ groups = "mdc_mdio", "rgmii_via_gmac2"; -+ }; -+ }; -+ -+ irrx_pins: irrx-pins { -+ mux { -+ function = "ir"; -+ groups = "ir_1_rx"; -+ }; -+ }; -+ -+ irtx_pins: irtx-pins { -+ mux { -+ function = "ir"; -+ groups = "ir_1_tx"; -+ }; -+ }; -+ -+ pcie0_pins: pcie0-pins { -+ mux { -+ function = "pcie"; -+ groups = "pcie0_pad_perst", -+ "pcie0_1_waken", -+ "pcie0_1_clkreq"; -+ }; -+ }; -+ -+ pcie1_pins: pcie1-pins { -+ mux { -+ function = "pcie"; -+ groups = "pcie1_pad_perst", -+ "pcie1_0_waken", -+ "pcie1_0_clkreq"; -+ }; -+ }; -+ -+ pmic_bus_pins: pmic-bus-pins { -+ mux { -+ function = "pmic"; -+ groups = "pmic_bus"; -+ }; -+ }; -+ -+ pwm7_pins: pwm1-2-pins { -+ mux { -+ function = "pwm"; -+ groups = "pwm_ch7_2"; -+ }; -+ }; -+ -+ wled_pins: wled-pins { -+ mux { -+ function = "led"; -+ groups = "wled"; -+ }; -+ }; -+ -+ /* Serial NAND is shared pin with SPI-NOR */ -+ serial_nand_pins: serial-nand-pins { -+ mux { -+ function = "flash"; -+ groups = "snfi"; -+ }; -+ }; -+ -+ spic0_pins: spic0-pins { -+ mux { -+ function = "spi"; -+ groups = "spic0_0"; -+ }; -+ }; -+ -+ spic1_pins: spic1-pins { -+ mux { -+ function = "spi"; -+ groups = "spic1_0"; -+ }; -+ }; -+ -+ uart0_pins: uart0-pins { -+ mux { -+ function = "uart"; -+ groups = "uart0_0_tx_rx" ; -+ }; -+ }; -+ -+ uart2_pins: uart2-pins { -+ mux { -+ function = "uart"; -+ groups = "uart2_1_tx_rx" ; -+ }; -+ }; -+ -+ watchdog_pins: watchdog-pins { -+ mux { -+ function = "watchdog"; -+ groups = "watchdog"; -+ }; -+ }; -+}; -+ -+&pwm { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pwm7_pins>; -+ status = "okay"; -+}; -+ -+&pwrap { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pmic_bus_pins>; -+ -+ status = "okay"; -+}; -+ -+&sata { -+ status = "disabled"; -+}; -+ -+&sata_phy { -+ status = "disabled"; -+}; -+ -+&slot0 { -+ wmac1: mt7915@0,0 { -+ reg = <0x0000 0 0 0 0>; -+ ieee80211-freq-limit = <5000000 6000000>; -+ }; -+}; -+ -+&snfi { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&serial_nand_pins>; -+ status = "okay"; -+ -+ snand: spi_nand@0 { -+ #address-cells = <1>; -+ #size-cells = <1>; -+ compatible = "spi-nand"; -+ spi-max-frequency = <104000000>; -+ reg = <0>; -+ }; -+}; -+ -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spic0_pins>; -+ status = "okay"; -+}; -+ -+&spi1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spic1_pins>; -+ status = "okay"; -+}; -+ -+&ssusb { -+ vusb33-supply = <®_3p3v>; -+ vbus-supply = <®_5v>; -+ status = "okay"; -+}; -+ -+&u3phy { -+ status = "okay"; -+}; -+ -+&uart0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart0_pins>; -+ status = "okay"; -+}; -+ -+&uart2 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart2_pins>; -+ status = "okay"; -+}; -+ -+&watchdog { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&watchdog_pins>; -+ status = "okay"; -+}; -diff --git a/target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-ubnt-unifi-6-lr.dts b/target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-ubnt-unifi-6-lr.dts -new file mode 100644 -index 0000000000..1f410b1d47 ---- /dev/null -+++ b/target/linux/mediatek/files-5.10/arch/arm64/boot/dts/mediatek/mt7622-ubnt-unifi-6-lr.dts -@@ -0,0 +1,327 @@ -+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -+ -+/dts-v1/; -+#include -+#include -+#include -+ -+#include "mt7622.dtsi" -+#include "mt6380.dtsi" -+ -+/ { -+ model = "Ubiquiti UniFi 6 LR"; -+ compatible = "ubnt,unifi-6-lr", "mediatek,mt7622"; -+ -+ aliases { -+ led-boot = &led_blue; -+ led-failsafe = &led_blue; -+ led-running = &led_blue; -+ led-upgrade = &led_blue; -+ label-mac-device = &gmac0; -+ serial0 = &uart0; -+ }; -+ -+ chosen { -+ stdout-path = "serial0:115200n8"; -+ bootargs = "earlycon=uart8250,mmio32,0x11002000 swiotlb=512 console=ttyS0,115200n8"; -+ }; -+ -+ cpus { -+ cpu@0 { -+ proc-supply = <&mt6380_vcpu_reg>; -+ sram-supply = <&mt6380_vm_reg>; -+ }; -+ -+ cpu@1 { -+ proc-supply = <&mt6380_vcpu_reg>; -+ sram-supply = <&mt6380_vm_reg>; -+ }; -+ }; -+ -+ gpio-keys { -+ compatible = "gpio-keys"; -+ -+ reset { -+ label = "reset"; -+ linux,code = ; -+ gpios = <&pio 62 GPIO_ACTIVE_LOW>; -+ }; -+ }; -+ -+ memory { -+ reg = <0 0x40000000 0 0x3f000000>; -+ }; -+ -+ reg_1p8v: regulator-1p8v { -+ compatible = "regulator-fixed"; -+ regulator-name = "fixed-1.8V"; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ regulator-always-on; -+ }; -+ -+ reg_3p3v: regulator-3p3v { -+ compatible = "regulator-fixed"; -+ regulator-name = "fixed-3.3V"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-boot-on; -+ regulator-always-on; -+ }; -+}; -+ -+&pcie0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pcie0_pins>; -+ status = "okay"; -+}; -+ -+&slot0 { -+ wifi@0,0 { -+ reg = <0x0 0 0 0 0>; -+ mediatek,mtd-eeprom = <&factory 0x20000>; -+ mtd-mac-address = <&eeprom 0x6>; -+ ieee80211-freq-limit = <5000000 6000000>; -+ }; -+}; -+ -+&pio { -+ eth_pins: eth-pins { -+ mux { -+ function = "eth"; -+ groups = "mdc_mdio", "rgmii_via_gmac2"; -+ }; -+ }; -+ -+ pcie0_pins: pcie0-pins { -+ mux { -+ function = "pcie"; -+ groups = "pcie0_pad_perst", -+ "pcie0_1_waken", -+ "pcie0_1_clkreq"; -+ }; -+ }; -+ -+ pcie1_pins: pcie1-pins { -+ mux { -+ function = "pcie"; -+ groups = "pcie1_pad_perst", -+ "pcie1_0_waken", -+ "pcie1_0_clkreq"; -+ }; -+ }; -+ -+ pmic_bus_pins: pmic-bus-pins { -+ mux { -+ function = "pmic"; -+ groups = "pmic_bus"; -+ }; -+ }; -+ -+ spi_nor_pins: spi-nor-pins { -+ mux { -+ function = "flash"; -+ groups = "spi_nor"; -+ }; -+ }; -+ -+ uart0_pins: uart0-pins { -+ mux { -+ function = "uart"; -+ groups = "uart0_0_tx_rx" ; -+ }; -+ }; -+ -+ uart3_pins: uart3-pins { -+ mux { -+ function = "uart"; -+ groups = "uart3_1_tx_rx" ; -+ }; -+ }; -+ -+ i2c0_pins: i2c0-pins { -+ mux { -+ function = "i2c"; -+ groups = "i2c0"; -+ }; -+ }; -+ -+ watchdog_pins: watchdog-pins { -+ mux { -+ function = "watchdog"; -+ groups = "watchdog"; -+ }; -+ }; -+}; -+ -+&bch { -+ status = "okay"; -+}; -+ -+&btif { -+ status = "disabled"; -+}; -+ -+ð { -+ status = "okay"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <ð_pins>; -+ -+ gmac0: mac@0 { -+ compatible = "mediatek,eth-mac"; -+ reg = <0>; -+ -+ phy-mode = "2500base-x"; -+ mtd-mac-address = <&eeprom 0x0>; -+ -+ fixed-link { -+ speed = <2500>; -+ full-duplex; -+ }; -+ }; -+ -+ mdio: mdio-bus { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ ethernet-phy@8 { -+ /* Marvell AQRate AQR112W - no driver */ -+ compatible = "ethernet-phy-ieee802.3-c45"; -+ reg = <0x8>; -+ }; -+ }; -+}; -+ -+&pwrap { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pmic_bus_pins>; -+ -+ status = "okay"; -+}; -+ -+&nor_flash { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi_nor_pins>; -+ -+ status = "okay"; -+ -+ flash@0 { -+ compatible = "jedec,spi-nor"; -+ reg = <0>; -+ spi-max-frequency = <50000000>; -+ -+ partitions { -+ compatible = "fixed-partitions"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ -+ partition@0 { -+ label = "preloader"; -+ reg = <0x0 0x40000>; -+ read-only; -+ }; -+ -+ partition@40000 { -+ label = "atf"; -+ reg = <0x40000 0x20000>; -+ read-only; -+ }; -+ -+ partition@60000 { -+ label = "u-boot"; -+ reg = <0x60000 0x60000>; -+ read-only; -+ }; -+ -+ partition@c0000 { -+ label = "u-boot-env"; -+ reg = <0xc0000 0x10000>; -+ }; -+ -+ factory: partition@d0000 { -+ label = "factory"; -+ reg = <0xd0000 0x40000>; -+ read-only; -+ }; -+ -+ eeprom: partition@110000 { -+ label = "eeprom"; -+ reg = <0x110000 0x10000>; -+ read-only; -+ }; -+ -+ partition@120000 { -+ label = "bs"; -+ reg = <0x120000 0x10000>; -+ }; -+ -+ partition@130000 { -+ label = "cfg"; -+ reg = <0x130000 0x100000>; -+ read-only; -+ }; -+ -+ partition@230000 { -+ compatible = "denx,fit"; -+ label = "firmware"; -+ reg = <0x230000 0x1ee0000>; -+ }; -+ -+ partition@2110000 { -+ label = "kernel1"; -+ reg = <0x2110000 0x1ee0000>; -+ }; -+ }; -+ }; -+}; -+ -+&uart0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart0_pins>; -+ status = "okay"; -+}; -+ -+&uart3 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart3_pins>; -+ status = "okay"; -+ -+ /* MT7915 Bluetooth */ -+}; -+ -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins>; -+ status = "okay"; -+ -+ led-controller@30 { -+ compatible = "ubnt,ledbar"; -+ reg = <0x30>; -+ -+ enable-gpio = <&pio 59 0>; -+ -+ red { -+ label = "red"; -+ }; -+ -+ green { -+ label = "green"; -+ }; -+ -+ led_blue: blue { -+ label = "blue"; -+ }; -+ }; -+}; -+ -+&watchdog { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&watchdog_pins>; -+ status = "okay"; -+}; -+ -+&wmac { -+ mediatek,mtd-eeprom = <&factory 0x0>; -+ mtd-mac-address = <&eeprom 0x0>; -+ status = "okay"; -+}; -diff --git a/target/linux/mediatek/image/Makefile b/target/linux/mediatek/image/Makefile -index 45e83cece5..0ad447e6c9 100644 ---- a/target/linux/mediatek/image/Makefile -+++ b/target/linux/mediatek/image/Makefile -@@ -29,6 +29,7 @@ define Device/Default - IMAGES := sysupgrade.bin - IMAGE/sysupgrade.bin := append-kernel | pad-to 128k | append-rootfs | \ - pad-rootfs | append-metadata -+ SUPPORTED_DEVICES := - endef - - include $(SUBTARGET).mk -diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk -index df9e0d7d17..c33949ce05 100644 ---- a/target/linux/mediatek/image/mt7622.mk -+++ b/target/linux/mediatek/image/mt7622.mk -@@ -4,6 +4,14 @@ else - KERNEL_LOADADDR := 0x44000000 - endif - -+define Build/bl2 -+ $(CP) $(STAGING_DIR_IMAGE)/mt7622-$1-bl2.img $@ -+endef -+ -+define Build/bl31-uboot -+ $(CP) $(STAGING_DIR_IMAGE)/mt7622_$1-u-boot.fip $@ -+endef -+ - define Device/bpi_bananapi-r64 - DEVICE_VENDOR := Bpi - DEVICE_MODEL := Banana Pi R64 -@@ -46,6 +54,26 @@ define Device/linksys_e8450 - endef - TARGET_DEVICES += linksys_e8450 - -+define Device/linksys_e8450_ubi -+ DEVICE_VENDOR := Linksys -+ DEVICE_MODEL := E8450 (UBI) -+ DEVICE_DTS := mt7622-linksys-e8450-ubi -+ DEVICE_DTS_DIR := $(DTS_DIR)/mediatek -+ UBINIZE_OPTS := -E 5 -+ BLOCKSIZE := 128k -+ PAGESIZE := 2048 -+ UBOOTENV_IN_UBI := 1 -+ KERNEL_IN_UBI := 1 -+ KERNEL := kernel-bin | gzip -+ KERNEL_INITRAMFS := kernel-bin | gzip | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb -+ IMAGES := sysupgrade.fit -+ IMAGE/sysupgrade.fit := append-kernel | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-rootfs | append-metadata -+ DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-ata-ahci-mtk \ -+ kmod-mt7615e kmod-mt7615-firmware kmod-mt7915e \ -+ uboot-envtools -+endef -+TARGET_DEVICES += linksys_e8450_ubi -+ - define Device/mediatek_mt7622-rfb1 - DEVICE_VENDOR := MediaTek - DEVICE_MODEL := MTK7622 rfb1 AP -diff --git a/target/linux/mediatek/mt7622/base-files/etc/board.d/01_leds b/target/linux/mediatek/mt7622/base-files/etc/board.d/01_leds -index e74944a65f..214e53257b 100755 ---- a/target/linux/mediatek/mt7622/base-files/etc/board.d/01_leds -+++ b/target/linux/mediatek/mt7622/base-files/etc/board.d/01_leds -@@ -8,7 +8,7 @@ board=$(board_name) - board_config_update - - case $board in --linksys,e8450) -+linksys,e8450*) - ucidef_set_led_netdev "wan" "WAN" "inet:blue" "wan" - ;; - esac -diff --git a/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network -index 3d2b9ffe49..82dba44587 100755 ---- a/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network -+++ b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network -@@ -11,7 +11,7 @@ mediatek_setup_interfaces() - case $board in - bananapi,bpi-r64-rootdisk|\ - bananapi,bpi-r64|\ -- linksys,e8450|\ -+ linksys,e8450*|\ - mediatek,mt7622-rfb1) - ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" wan - ;; -@@ -30,9 +30,9 @@ mediatek_setup_macs() - local board="$1" - - case $board in -- linksys,e8450) -- wan_mac=$(mtd_get_mac_ascii devinfo wan_mac_addr) -- lan_mac=$(mtd_get_mac_ascii devinfo lan_mac_addr) -+ linksys,e8450*) -+ wan_mac=$(mtd_get_mac_binary factory 524282) -+ lan_mac=$(macaddr_add "$wan_mac" 1) - label_mac=$wan_mac - ;; - esac -diff --git a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh -index 95ac8b5657..682724d85a 100755 ---- a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh -+++ b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh -@@ -1,5 +1,9 @@ -+RAMFS_COPY_BIN='fw_printenv fw_setenv' -+RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock' -+ - platform_do_upgrade() { - local board=$(board_name) -+ local file_type=$(identify $1) - - case "$board" in - bananapi,bpi-r64-rootdisk) -@@ -7,7 +11,9 @@ platform_do_upgrade() { - #of eMMC and to the location of the kernel - get_image "$1" | dd of=/dev/mmcblk0 bs=2097152 seek=1 conv=fsync - ;; -+ linksys,e8450,ubi|\ - mediatek,mt7622,ubi) -+ CI_KERNPART="fit" - nand_do_upgrade "$1" - ;; - linksys,e8450) -diff --git a/target/linux/mediatek/mt7622/config-5.10 b/target/linux/mediatek/mt7622/config-5.10 -old mode 100755 -new mode 100644 -index ccb54471c3..0098aa7204 ---- a/target/linux/mediatek/mt7622/config-5.10 -+++ b/target/linux/mediatek/mt7622/config-5.10 -@@ -154,6 +154,7 @@ CONFIG_DTC=y - CONFIG_DYNAMIC_DEBUG=y - CONFIG_EDAC_SUPPORT=y - CONFIG_EINT_MTK=y -+CONFIG_FIT_PARTITION=y - CONFIG_FIXED_PHY=y - CONFIG_FIX_EARLYCON_MEM=y - # CONFIG_FLATMEM_MANUAL is not set --- -2.25.1 - diff --git a/config.yml b/config.yml index 816a87ef2..0f5b39291 100644 --- a/config.yml +++ b/config.yml @@ -1,6 +1,6 @@ repo: https://github.com/openwrt/openwrt.git branch: openwrt-21.02 -revision: fdc0342704b692c46ccb65c6372a853ff89094c4 +revision: 64ddac2c1cdf068e66a1325eb4c4d6972a6a8b4f output_dir: ./output patch_folders: diff --git a/feeds/ucentral/opennds/Makefile b/feeds/ucentral/opennds/Makefile new file mode 100644 index 000000000..d9ee170fb --- /dev/null +++ b/feeds/ucentral/opennds/Makefile @@ -0,0 +1,87 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=opennds +PKG_FIXUP:=autoreconf +PKG_VERSION:=8.1.1 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=https://codeload.github.com/opennds/opennds/tar.gz/v$(PKG_VERSION)? +PKG_SOURCE:=opennds-$(PKG_VERSION).tar.gz +PKG_HASH:=9e0ede334755dc95a4133a94304f4294b956d4849c48c5521f12b4ed295e356f +PKG_BUILD_DIR:=$(BUILD_DIR)/openNDS-$(PKG_VERSION) + +PKG_MAINTAINER:=Rob White +PKG_BUILD_PARALLEL:=1 +PKG_LICENSE:=GPL-2.0+ + +include $(INCLUDE_DIR)/package.mk + + +define Package/opennds + SUBMENU:=Captive Portals + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libpthread +iptables-mod-ipopt +libmicrohttpd-no-ssl + TITLE:=Open public network gateway daemon + URL:=https://github.com/opennds/opennds + CONFLICTS:=nodogsplash nodogsplash2 +endef + +define Package/opennds/description + openNDS is a Captive Portal solution that offers an instant way to provide restricted access to the Internet. + With little or no configuration, a dynamically generated and adaptive splash page sequence is automatically served. + Internet access is granted by either a click to continue button, or after credential verification. + The package incorporates the FAS API allowing many flexible customisation options. + The creation of sophisticated third party authentication applications is fully supported. + Internet hosted https portals can be utilised to inspire maximum user confidence. +endef + +define Package/opennds/install + + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/opennds $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ndsctl $(1)/usr/bin/ + + $(INSTALL_DIR) $(1)/etc/opennds/htdocs/images + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_DIR) $(1)/usr/lib/opennds + $(CP) $(PKG_BUILD_DIR)/resources/splash.html $(1)/etc/opennds/htdocs/ + $(CP) $(PKG_BUILD_DIR)/resources/splash.css $(1)/etc/opennds/htdocs/ + $(CP) $(PKG_BUILD_DIR)/resources/status.html $(1)/etc/opennds/htdocs/ + $(CP) $(PKG_BUILD_DIR)/resources/splash.jpg $(1)/etc/opennds/htdocs/images/ + $(CP) $(PKG_BUILD_DIR)/linux_openwrt/opennds/files/etc/config/opennds $(1)/etc/config/ + $(CP) $(PKG_BUILD_DIR)/linux_openwrt/opennds/files/etc/init.d/opennds $(1)/etc/init.d/ + $(CP) $(PKG_BUILD_DIR)/linux_openwrt/opennds/files/etc/uci-defaults/40_opennds $(1)/etc/uci-defaults/ + $(CP) $(PKG_BUILD_DIR)/linux_openwrt/opennds/files/usr/lib/opennds/restart.sh $(1)/usr/lib/opennds/ + $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/binauth/binauth_log.sh $(1)/usr/lib/opennds/ + $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/PreAuth/login.sh $(1)/usr/lib/opennds/ + $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/libs/get_client_interface.sh $(1)/usr/lib/opennds/ + $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/libs/get_client_token.sh $(1)/usr/lib/opennds/ + $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/libs/client_params.sh $(1)/usr/lib/opennds/ + $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/libs/unescape.sh $(1)/usr/lib/opennds/ + $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/libs/authmon.sh $(1)/usr/lib/opennds/ + $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/libs/dnsconfig.sh $(1)/usr/lib/opennds/ + $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/libs/post-request.php $(1)/usr/lib/opennds/ + $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/fas-aes/fas-aes.php $(1)/etc/opennds/ + $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/fas-hid/fas-hid.php $(1)/etc/opennds/ + $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/fas-aes/fas-aes-https.php $(1)/etc/opennds/ +endef + +define Package/opennds/postrm +#!/bin/sh +uci delete firewall.opennds +uci commit firewall +endef + +define Package/opennds/conffiles +/etc/config/opennds +endef + +$(eval $(call BuildPackage,opennds)) diff --git a/feeds/ucentral/opennds/patches/100-config-reload.patch b/feeds/ucentral/opennds/patches/100-config-reload.patch new file mode 100644 index 000000000..ba099e985 --- /dev/null +++ b/feeds/ucentral/opennds/patches/100-config-reload.patch @@ -0,0 +1,16 @@ +Index: openNDS-8.1.1/linux_openwrt/opennds/files/etc/init.d/opennds +=================================================================== +--- openNDS-8.1.1.orig/linux_openwrt/opennds/files/etc/init.d/opennds ++++ openNDS-8.1.1/linux_openwrt/opennds/files/etc/init.d/opennds +@@ -183,6 +183,11 @@ start_service() { + config_foreach create_instance opennds + } + ++service_triggers() ++{ ++ procd_add_reload_trigger "opennds" ++} ++ + stop_service() { + # When procd terminates opennds, it does not exit fast enough. + # Otherwise procd will restart opennds twice. First time starting diff --git a/feeds/ucentral/ucentral-client/files/etc/uci-defaults/zzz-ucentral b/feeds/ucentral/ucentral-client/files/etc/uci-defaults/zzz-ucentral index 3b3180a77..72ad87984 100755 --- a/feeds/ucentral/ucentral-client/files/etc/uci-defaults/zzz-ucentral +++ b/feeds/ucentral/ucentral-client/files/etc/uci-defaults/zzz-ucentral @@ -2,26 +2,6 @@ [ -d /etc/config-shadow/ ] && exit 0 -hname=$(cat /sys/class/net/eth0/address | tr -d : | awk '{print tolower($0)}') -uci set system.@system[-1].hostname=$hname -uci set ucentral.config.serial=$hname -uci set network.wan6.ifname=@wan -uci set network.wan.type=bridge -uci rename opennds.@opennds[-1]=opennds -uci set opennds.opennds.enabled=0 uci commit cp -r /etc/config/ /etc/config-shadow/ - -. /lib/functions.sh - -UCI_CONFIG_DIR=/etc/config-shadow - -iface_del() { - uci -c $UCI_CONFIG_DIR delete wireless.$1 -} - -config_load wireless -config_foreach iface_del wifi-iface - -uci -c $UCI_CONFIG_DIR commit diff --git a/feeds/ucentral/ucentral-defaults/files/etc/sysctl.d/20-oom-reboot.conf b/feeds/ucentral/ucentral-defaults/files/etc/sysctl.d/20-oom-reboot.conf new file mode 100644 index 000000000..6c161611c --- /dev/null +++ b/feeds/ucentral/ucentral-defaults/files/etc/sysctl.d/20-oom-reboot.conf @@ -0,0 +1,2 @@ +vm.panic_on_oom = 1 +kernel.panic = 10 diff --git a/feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-hostname b/feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-hostname new file mode 100755 index 000000000..bc96c5a0c --- /dev/null +++ b/feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-hostname @@ -0,0 +1,5 @@ +#!/bin.sh + +hname=$(cat /sys/class/net/eth0/address | tr -d : | awk '{print tolower($0)}') +uci set system.@system[-1].hostname=$hname +uci set ucentral.config.serial=$hname diff --git a/feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-network b/feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-network new file mode 100755 index 000000000..162f679c4 --- /dev/null +++ b/feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-network @@ -0,0 +1,4 @@ +#!/bin/sh + +uci set network.wan6.ifname=@wan +uci set network.wan.type=bridge diff --git a/feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-opennds b/feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-opennds new file mode 100755 index 000000000..282e8fdd3 --- /dev/null +++ b/feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-opennds @@ -0,0 +1,3 @@ +#!/bin/sh + +uci set opennds.@opennds[-1].enabled=0 diff --git a/feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-umdns b/feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-umdns new file mode 100755 index 000000000..9499c74e8 --- /dev/null +++ b/feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-umdns @@ -0,0 +1,3 @@ +#!/bin/sh + +uci delete umdns.@umdns[0].network diff --git a/feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-wifi b/feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-wifi new file mode 100755 index 000000000..73cfce7ed --- /dev/null +++ b/feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-wifi @@ -0,0 +1,10 @@ +#!/bin/sh + +. /lib/functions.sh + +iface_del() { + uci delete wireless.$1 +} + +config_load wireless +config_foreach iface_del wifi-iface diff --git a/feeds/ucentral/ucentral-client/files/usr/libexec/ucentral/ucentral_apply.sh b/feeds/ucentral/ucentral-defaults/files/usr/libexec/ucentral/ucentral_apply.sh similarity index 100% rename from feeds/ucentral/ucentral-client/files/usr/libexec/ucentral/ucentral_apply.sh rename to feeds/ucentral/ucentral-defaults/files/usr/libexec/ucentral/ucentral_apply.sh diff --git a/feeds/ucentral/ucentral-client/files/usr/libexec/ucentral/ucentral_cmd.sh b/feeds/ucentral/ucentral-defaults/files/usr/libexec/ucentral/ucentral_cmd.sh similarity index 100% rename from feeds/ucentral/ucentral-client/files/usr/libexec/ucentral/ucentral_cmd.sh rename to feeds/ucentral/ucentral-defaults/files/usr/libexec/ucentral/ucentral_cmd.sh diff --git a/feeds/ucentral/ucentral-client/files/usr/libexec/ucentral/ucentral_factory.sh b/feeds/ucentral/ucentral-defaults/files/usr/libexec/ucentral/ucentral_factory.sh similarity index 100% rename from feeds/ucentral/ucentral-client/files/usr/libexec/ucentral/ucentral_factory.sh rename to feeds/ucentral/ucentral-defaults/files/usr/libexec/ucentral/ucentral_factory.sh diff --git a/feeds/ucentral/ucentral-client/files/usr/libexec/ucentral/ucentral_failsafe.sh b/feeds/ucentral/ucentral-defaults/files/usr/libexec/ucentral/ucentral_failsafe.sh similarity index 100% rename from feeds/ucentral/ucentral-client/files/usr/libexec/ucentral/ucentral_failsafe.sh rename to feeds/ucentral/ucentral-defaults/files/usr/libexec/ucentral/ucentral_failsafe.sh diff --git a/feeds/ucentral/ucentral-client/files/usr/libexec/ucentral/ucentral_led_blink.sh b/feeds/ucentral/ucentral-defaults/files/usr/libexec/ucentral/ucentral_led_blink.sh similarity index 100% rename from feeds/ucentral/ucentral-client/files/usr/libexec/ucentral/ucentral_led_blink.sh rename to feeds/ucentral/ucentral-defaults/files/usr/libexec/ucentral/ucentral_led_blink.sh diff --git a/feeds/ucentral/ucentral-client/files/usr/libexec/ucentral/ucentral_state.sh b/feeds/ucentral/ucentral-defaults/files/usr/libexec/ucentral/ucentral_state.sh similarity index 100% rename from feeds/ucentral/ucentral-client/files/usr/libexec/ucentral/ucentral_state.sh rename to feeds/ucentral/ucentral-defaults/files/usr/libexec/ucentral/ucentral_state.sh diff --git a/feeds/ucentral/ucentral-client/files/usr/libexec/ucentral/ucentral_sysupgrade.sh b/feeds/ucentral/ucentral-defaults/files/usr/libexec/ucentral/ucentral_sysupgrade.sh similarity index 100% rename from feeds/ucentral/ucentral-client/files/usr/libexec/ucentral/ucentral_sysupgrade.sh rename to feeds/ucentral/ucentral-defaults/files/usr/libexec/ucentral/ucentral_sysupgrade.sh diff --git a/feeds/ucentral/ucentral-client/files/usr/libexec/ucentral/ucentral_verify.sh b/feeds/ucentral/ucentral-defaults/files/usr/libexec/ucentral/ucentral_verify.sh similarity index 100% rename from feeds/ucentral/ucentral-client/files/usr/libexec/ucentral/ucentral_verify.sh rename to feeds/ucentral/ucentral-defaults/files/usr/libexec/ucentral/ucentral_verify.sh diff --git a/feeds/ucentral/ucentral-client/files/usr/share/ucentral/crashlog.uc b/feeds/ucentral/ucentral-defaults/files/usr/share/ucentral/crashlog.uc similarity index 100% rename from feeds/ucentral/ucentral-client/files/usr/share/ucentral/crashlog.uc rename to feeds/ucentral/ucentral-defaults/files/usr/share/ucentral/crashlog.uc diff --git a/feeds/ucentral/ucentral-schema/Makefile b/feeds/ucentral/ucentral-schema/Makefile index b0a2f19d7..6c366e619 100644 --- a/feeds/ucentral/ucentral-schema/Makefile +++ b/feeds/ucentral/ucentral-schema/Makefile @@ -6,7 +6,7 @@ PKG_RELEASE:=1 PKG_SOURCE_URL=https://github.com/blogic/ucentral-schema.git PKG_SOURCE_PROTO:=git PKG_SOURCE_DATE:=2021-02-15 -PKG_SOURCE_VERSION:=9e65a86cd998d87415cf8325895a64e4d8e2e425 +PKG_SOURCE_VERSION:=af642bae596fb127dfd897ef093be6f4363759fc PKG_MAINTAINER:=John Crispin PKG_LICENSE:=BSD-3-Clause diff --git a/feeds/ucentral/ucode/Makefile b/feeds/ucentral/ucode/Makefile index 958295575..7d2d91fdb 100644 --- a/feeds/ucentral/ucode/Makefile +++ b/feeds/ucentral/ucode/Makefile @@ -13,7 +13,7 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/jow-/ucode.git PKG_SOURCE_DATE:=2021-03-15 -PKG_SOURCE_VERSION:=aa9621db401e881ffcdea03be272c94149484ccf +PKG_SOURCE_VERSION:=7f0ff9143159cfa76408ed3dfedb2d730b17fb46 PKG_MIRROR_HASH:= PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC diff --git a/patches/0016-linux-modules-fix-some-v4.4-dependencies.patch b/patches/0016-linux-modules-fix-some-v4.4-dependencies.patch index ee9fd8014..6cf32e5f1 100644 --- a/patches/0016-linux-modules-fix-some-v4.4-dependencies.patch +++ b/patches/0016-linux-modules-fix-some-v4.4-dependencies.patch @@ -9,7 +9,6 @@ Signed-off-by: John Crispin --- config/Config-images.in | 1 + include/image.mk | 2 ++ - include/kernel-version.mk | 2 ++ include/kernel.mk | 7 +++-- include/netfilter.mk | 30 +++++++++++++++--- include/package.mk | 8 ++--- @@ -62,22 +61,6 @@ index 2530108211..10e7063f41 100644 define Image/pad-to dd if=$(1) of=$(1).new bs=$(2) conv=sync -diff --git a/include/kernel-version.mk b/include/kernel-version.mk -index 26f24bae42..70eb3a6d08 100644 ---- a/include/kernel-version.mk -+++ b/include/kernel-version.mk -@@ -6,9 +6,11 @@ ifdef CONFIG_TESTING_KERNEL - KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER) - endif - -+LINUX_VERSION-4.4 = .60 - LINUX_VERSION-5.4 = .105 - LINUX_VERSION-5.10 = .16 - -+LINUX_KERNEL_HASH-4.4.60 = 2cd8df6f1ac6a5329c5a286ec9b5956215977221a1b731597ed169fff74a9659 - LINUX_KERNEL_HASH-5.4.105 = 244e4cd16184285df55ec5a9501daba011aa8b85c5527ee05eab4592e70fb8b6 - LINUX_KERNEL_HASH-5.10.16 = 536fe3ea273bfcc72b3571d3b3a7ff0a5bcdc16068efd22e42c4f9d03c200a37 - diff --git a/include/kernel.mk b/include/kernel.mk index d2a5b42138..4e9561c93c 100644 --- a/include/kernel.mk diff --git a/patches/0022-base-files-add-sysctl-to-reboot-upon-OOM.patch b/patches/0022-base-files-add-sysctl-to-reboot-upon-OOM.patch deleted file mode 100644 index 701be6ef4..000000000 --- a/patches/0022-base-files-add-sysctl-to-reboot-upon-OOM.patch +++ /dev/null @@ -1,22 +0,0 @@ -From cd1f76355a70ff394db64ac1f947c2704ed6c305 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Thu, 25 Mar 2021 08:03:28 +0100 -Subject: [PATCH 22/23] base-files: add sysctl to reboot upon OOM - -Signed-off-by: John Crispin ---- - package/base-files/files/etc/sysctl.d/20-oom-reboot.conf | 2 ++ - 1 file changed, 2 insertions(+) - create mode 100644 package/base-files/files/etc/sysctl.d/20-oom-reboot.conf - -diff --git a/package/base-files/files/etc/sysctl.d/20-oom-reboot.conf b/package/base-files/files/etc/sysctl.d/20-oom-reboot.conf -new file mode 100644 -index 0000000000..6c161611c8 ---- /dev/null -+++ b/package/base-files/files/etc/sysctl.d/20-oom-reboot.conf -@@ -0,0 +1,2 @@ -+vm.panic_on_oom = 1 -+kernel.panic = 10 --- -2.25.1 - diff --git a/patches/0024-target-enable-vlan-filtering-on-various-targets.patch b/patches/0024-target-enable-vlan-filtering-on-various-targets.patch index cac96573c..417d7fe0f 100644 --- a/patches/0024-target-enable-vlan-filtering-on-various-targets.patch +++ b/patches/0024-target-enable-vlan-filtering-on-various-targets.patch @@ -1,7 +1,7 @@ -From b4b632ac77e22d2522c3cb2cccf24b1dfae379f4 Mon Sep 17 00:00:00 2001 +From 4cbb46d6f0fbf451439f9bcb96ffdcd32529c20d Mon Sep 17 00:00:00 2001 From: John Crispin Date: Mon, 29 Mar 2021 16:05:14 +0200 -Subject: [PATCH] target: enable vlan-filtering on various targets +Subject: [PATCH 33/37] target: enable vlan-filtering on various targets Signed-off-by: John Crispin --- @@ -22,17 +22,17 @@ index fe21dc8035..8b7364ff33 100755 ipq40xx_setup_macs $board board_config_flush diff --git a/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network -index 82dba44587..d8a90e507e 100755 +index f1daa2fae1..fa48c4008c 100644 --- a/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network -@@ -43,6 +43,7 @@ mediatek_setup_macs() +@@ -30,6 +30,7 @@ mediatek_setup_interfaces() board_config_update board=$(board_name) +ucidef_set_bridge_device bridge mediatek_setup_interfaces $board - mediatek_setup_macs $board board_config_flush + -- 2.25.1 diff --git a/patches/0025-target-add-pstore-support.patch b/patches/0025-target-add-pstore-support.patch index fd88eaad4..e0af77e88 100644 --- a/patches/0025-target-add-pstore-support.patch +++ b/patches/0025-target-add-pstore-support.patch @@ -1,15 +1,44 @@ -From 7f2bd477546246bb6fab92873b6a2d27ba2b978a Mon Sep 17 00:00:00 2001 +From e0ff8f29f0c0c147b34fe943698e8f95dfa6c688 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 30 Mar 2021 19:03:43 +0200 -Subject: [PATCH] target: add pstore support +Subject: [PATCH 1/6] target: add pstore support Signed-off-by: John Crispin --- + target/linux/generic/config-5.10 | 15 ++++++++++++++- target/linux/generic/config-5.4 | 14 +++++++++++++- .../linux/ipq40xx/patches-5.4/903-pstore.patch | 17 +++++++++++++++++ - 2 files changed, 30 insertions(+), 1 deletion(-) + .../patches-5.10/160-add-pstore-support.patch | 17 +++++++++++++++++ + 4 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 target/linux/ipq40xx/patches-5.4/903-pstore.patch + create mode 100644 target/linux/mediatek/patches-5.10/160-add-pstore-support.patch +diff --git a/target/linux/generic/config-5.10 b/target/linux/generic/config-5.10 +index ba6317e35f..3e911a2619 100644 +--- a/target/linux/generic/config-5.10 ++++ b/target/linux/generic/config-5.10 +@@ -4424,7 +4424,20 @@ CONFIG_PROC_SYSCTL=y + # CONFIG_PSAMPLE is not set + # CONFIG_PSB6970_PHY is not set + # CONFIG_PSI is not set +-# CONFIG_PSTORE is not set ++CONFIG_PSTORE=y ++# CONFIG_PSTORE_842_COMPRESS is not set ++# CONFIG_PSTORE_BLK is not set ++CONFIG_PSTORE_COMPRESS=y ++CONFIG_PSTORE_COMPRESS_DEFAULT="deflate" ++# CONFIG_PSTORE_CONSOLE is not set ++CONFIG_PSTORE_DEFLATE_COMPRESS=y ++CONFIG_PSTORE_DEFLATE_COMPRESS_DEFAULT=y ++# CONFIG_PSTORE_LZ4HC_COMPRESS is not set ++# CONFIG_PSTORE_LZ4_COMPRESS is not set ++# CONFIG_PSTORE_LZO_COMPRESS is not set ++# CONFIG_PSTORE_PMSG is not set ++CONFIG_PSTORE_RAM=y ++# CONFIG_PSTORE_ZSTD_COMPRESS is not set + # CONFIG_PTDUMP_DEBUGFS is not set + # CONFIG_PTP_1588_CLOCK is not set + # CONFIG_PTP_1588_CLOCK_IDT82P33 is not set diff --git a/target/linux/generic/config-5.4 b/target/linux/generic/config-5.4 index a0193ca718..da2cc8db65 100644 --- a/target/linux/generic/config-5.4 @@ -58,6 +87,29 @@ index 0000000000..89ea4a438e + }; + + aliases { +diff --git a/target/linux/mediatek/patches-5.10/160-add-pstore-support.patch b/target/linux/mediatek/patches-5.10/160-add-pstore-support.patch +new file mode 100644 +index 0000000000..6959fc09b3 +--- /dev/null ++++ b/target/linux/mediatek/patches-5.10/160-add-pstore-support.patch +@@ -0,0 +1,17 @@ ++Index: linux-5.10.16/arch/arm64/boot/dts/mediatek/mt7622.dtsi ++=================================================================== ++--- linux-5.10.16.orig/arch/arm64/boot/dts/mediatek/mt7622.dtsi +++++ linux-5.10.16/arch/arm64/boot/dts/mediatek/mt7622.dtsi ++@@ -132,6 +132,12 @@ ++ reg = <0 0x43000000 0 0x30000>; ++ no-map; ++ }; +++ +++ ramoops@50000000 { +++ compatible = "ramoops"; +++ reg = <0 0x50000000 0 0x10000>; +++ record-size = <0x1000>; +++ }; ++ }; ++ ++ thermal-zones { -- 2.25.1 diff --git a/patches/0026-hostapd-add-a-pile-of-new-options.patch b/patches/0026-hostapd-add-a-pile-of-new-options.patch new file mode 100644 index 000000000..6cbf6180c --- /dev/null +++ b/patches/0026-hostapd-add-a-pile-of-new-options.patch @@ -0,0 +1,257 @@ +From 0bdafa77ec675b81d9254cb4ce429e76ca84fcea Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Thu, 1 Apr 2021 09:31:19 +0200 +Subject: [PATCH 1/2] hostapd: add a pile of new options + +Signed-off-by: John Crispin +--- + .../network/services/hostapd/files/hostapd.sh | 84 +++++++++++++------ + 1 file changed, 60 insertions(+), 24 deletions(-) + +diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh +index 45a49b8faa..05b901fb6b 100644 +--- a/package/network/services/hostapd/files/hostapd.sh ++++ b/package/network/services/hostapd/files/hostapd.sh +@@ -311,12 +311,12 @@ hostapd_common_add_bss_config() { + + config_add_string 'owe_transition_bssid:macaddr' 'owe_transition_ssid:string' + +- config_add_boolean iw_enabled iw_internet iw_asra iw_esr iw_uesa ++ config_add_boolean interworking iw_internet iw_asra iw_esr iw_uesa + config_add_int iw_access_network_type iw_venue_group iw_venue_type + config_add_int iw_ipaddr_type_availability iw_gas_address3 + config_add_string iw_hessid iw_network_auth_type iw_qos_map_set + config_add_array iw_roaming_consortium iw_domain_name iw_anqp_3gpp_cell_net iw_nai_realm +- config_add_array iw_anqp_elem ++ config_add_array iw_anqp_elem iw_venue_name iw_venue_url + + config_add_boolean hs20 disable_dgaf osen + config_add_int anqp_domain_id +@@ -327,12 +327,20 @@ hostapd_common_add_bss_config() { + config_add_array hs20_conn_capab + config_add_string osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp + ++ config_add_boolean interworking ++ config_add_string hs20_t_c_server_url ++ + config_add_array airtime_sta_weight + config_add_int airtime_bss_weight airtime_bss_limit + + config_add_boolean multicast_to_unicast per_sta_vif + + config_add_array hostapd_bss_options ++ ++ config_add_boolean request_cui ++ config_add_array radius_auth_req_attr ++ config_add_array radius_acct_req_attr ++ config_add_int rts_threshold + } + + hostapd_set_vlan_file() { +@@ -396,12 +404,20 @@ append_iw_nai_realm() { + [ -n "$1" ] && append bss_conf "nai_realm=$1" "$N" + } + ++append_iw_venue_name() { ++ [ -n "$1" ] && append bss_conf "venue_name=$1" "$N" ++} ++ ++append_iw_venue_url() { ++ [ -n "$1" ] && append bss_conf "venue_url=$1" "$N" ++} ++ + append_hs20_oper_friendly_name() { +- append bss_conf "hs20_oper_friendly_name=$1" "$N" ++ [ -n "$1" ] && append bss_conf "hs20_oper_friendly_name=$1" "$N" + } + + append_osu_provider_service_desc() { +- append bss_conf "osu_service_desc=$1" "$N" ++ [ -n "$1" ] && append bss_conf "osu_service_desc=$1" "$N" + } + + append_hs20_icon() { +@@ -421,15 +437,15 @@ append_hs20_icons() { + } + + append_operator_icon() { +- append bss_conf "operator_icon=$1" "$N" ++ [ -n "$1" ] && append bss_conf "operator_icon=$1" "$N" + } + + append_osu_icon() { +- append bss_conf "osu_icon=$1" "$N" ++ [ -n "$1" ] && append bss_conf "osu_icon=$1" "$N" + } + + append_osu_provider() { +- local cfgtype osu_server_uri osu_friendly_name osu_nai osu_nai2 osu_method_list ++ local cfgtype osu_server_uri osu_nai osu_nai2 osu_method_list + + config_load wireless + config_get cfgtype "$1" TYPE +@@ -441,12 +457,13 @@ append_osu_provider() { + config_get osu_nai2 "$1" osu_nai2 + config_get osu_method_list "$1" osu_method + +- append bss_conf "osu_server_uri=$osu_server_uri" "$N" +- append bss_conf "osu_nai=$osu_nai" "$N" +- append bss_conf "osu_nai2=$osu_nai2" "$N" +- append bss_conf "osu_method_list=$osu_method_list" "$N" ++ [ -n "$osu_server_uri" ] && append bss_conf "osu_server_uri=$osu_server_uri" "$N" ++ [ -n "$osu_nai" ] && append bss_conf "osu_nai=$osu_nai" "$N" ++ [ -n "$osu_nai2" ] && append bss_conf "osu_nai2=$osu_nai2" "$N" ++ [ -n "$osu_method_list" ] && append bss_conf "osu_method_list=$osu_method_list" "$N" + + config_list_foreach "$1" osu_service_desc append_osu_provider_service_desc ++ config_list_foreach "$1" osu_friendly_name append_osu_friendly_name + config_list_foreach "$1" osu_icon append_osu_icon + + append bss_conf "$N" +@@ -456,6 +473,14 @@ append_hs20_conn_capab() { + [ -n "$1" ] && append bss_conf "hs20_conn_capab=$1" "$N" + } + ++append_radius_acct_req_attr() { ++ [ -n "$1" ] && append bss_conf "radius_acct_req_attr=$1" "$N" ++} ++ ++append_radius_auth_req_attr() { ++ [ -n "$1" ] && append bss_conf "radius_auth_req_attr=$1" "$N" ++} ++ + append_airtime_sta_weight() { + [ -n "$1" ] && append bss_conf "airtime_sta_weight=$1" "$N" + } +@@ -482,7 +507,7 @@ hostapd_set_bss_options() { + bss_load_update_period chan_util_avg_period sae_require_mfp \ + multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key skip_inactivity_poll \ + airtime_bss_weight airtime_bss_limit airtime_sta_weight \ +- multicast_to_unicast per_sta_vif ++ multicast_to_unicast per_sta_vif rts_threshold + + set_default isolate 0 + set_default maxassoc 0 +@@ -503,6 +528,7 @@ hostapd_set_bss_options() { + set_default multi_ap 0 + set_default airtime_bss_weight 0 + set_default airtime_bss_limit 0 ++ set_default rts_threshold -1 + + append bss_conf "ctrl_interface=/var/run/hostapd" + if [ "$isolate" -gt 0 ]; then +@@ -529,6 +555,7 @@ hostapd_set_bss_options() { + append bss_conf "uapsd_advertisement_enabled=$uapsd" "$N" + append bss_conf "utf8_ssid=$utf8_ssid" "$N" + append bss_conf "multi_ap=$multi_ap" "$N" ++ append bss_conf "rts_threshold=$rts_threshold" "$N" + + [ "$tdls_prohibit" -gt 0 ] && append bss_conf "tdls_prohibit=$tdls_prohibit" "$N" + +@@ -547,6 +574,7 @@ hostapd_set_bss_options() { + append bss_conf "acct_server_shared_secret=$acct_secret" "$N" + [ -n "$acct_interval" ] && \ + append bss_conf "radius_acct_interim_interval=$acct_interval" "$N" ++ json_for_each_item append_radius_acct_req_attr radius_acct_req_attr + } + + case "$auth_type" in +@@ -601,7 +629,7 @@ hostapd_set_bss_options() { + auth_server auth_secret auth_port \ + dae_client dae_secret dae_port \ + ownip radius_client_addr \ +- eap_reauth_period ++ eap_reauth_period request_cui + + # radius can provide VLAN ID for clients + vlan_possible=1 +@@ -613,18 +641,20 @@ hostapd_set_bss_options() { + + set_default auth_port 1812 + set_default dae_port 3799 +- ++ set_default request_cui 0 + + append bss_conf "auth_server_addr=$auth_server" "$N" + append bss_conf "auth_server_port=$auth_port" "$N" + append bss_conf "auth_server_shared_secret=$auth_secret" "$N" + ++ [ "$request_cui" -gt 0 ] && append bss_conf "radius_request_cui=$request_cui" "$N" + [ -n "$eap_reauth_period" ] && append bss_conf "eap_reauth_period=$eap_reauth_period" "$N" + + [ -n "$dae_client" -a -n "$dae_secret" ] && { + append bss_conf "radius_das_port=$dae_port" "$N" + append bss_conf "radius_das_client=$dae_client $dae_secret" "$N" + } ++ json_for_each_item append_radius_auth_req_attr radius_auth_req_attr + + [ -n "$ownip" ] && append bss_conf "own_ip_addr=$ownip" "$N" + [ -n "$radius_client_addr" ] && append bss_conf "radius_client_addr=$radius_client_addr" "$N" +@@ -871,13 +901,14 @@ hostapd_set_bss_options() { + } + } + +- json_get_vars iw_enabled iw_internet iw_asra iw_esr iw_uesa iw_access_network_type ++ json_get_vars interworking iw_internet iw_asra iw_esr iw_uesa iw_access_network_type + json_get_vars iw_hessid iw_venue_group iw_venue_type iw_network_auth_type + json_get_vars iw_roaming_consortium iw_domain_name iw_anqp_3gpp_cell_net iw_nai_realm + json_get_vars iw_anqp_elem iw_qos_map_set iw_ipaddr_type_availability iw_gas_address3 ++ json_get_vars iw_venue_name iw_venue_url + +- set_default iw_enabled 0 +- if [ "$iw_enabled" = "1" ]; then ++ set_default interworking 0 ++ if [ "$interworking" = "1" ]; then + append bss_conf "interworking=1" "$N" + set_default iw_internet 1 + set_default iw_asra 0 +@@ -903,6 +934,8 @@ hostapd_set_bss_options() { + json_for_each_item append_iw_roaming_consortium iw_roaming_consortium + json_for_each_item append_iw_anqp_elem iw_anqp_elem + json_for_each_item append_iw_nai_realm iw_nai_realm ++ json_for_each_item append_iw_venue_name iw_venue_name ++ json_for_each_item append_iw_venue_url iw_venue_url + + iw_domain_name_conf= + json_for_each_item append_iw_domain_name iw_domain_name +@@ -917,9 +950,11 @@ hostapd_set_bss_options() { + + + local hs20 disable_dgaf osen anqp_domain_id hs20_deauth_req_timeout \ +- osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp ++ osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp \ ++ hs20_t_c_server_url + json_get_vars hs20 disable_dgaf osen anqp_domain_id hs20_deauth_req_timeout \ +- osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp ++ osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp \ ++ hs20_t_c_server_url + + set_default hs20 0 + set_default disable_dgaf $hs20 +@@ -929,17 +964,18 @@ hostapd_set_bss_options() { + if [ "$hs20" = "1" ]; then + append bss_conf "hs20=1" "$N" + append_hs20_icons +- append bss_conf "disable_dgaf=$disable_dgaf" "$N" +- append bss_conf "osen=$osen" "$N" +- append bss_conf "anqp_domain_id=$anqp_domain_id" "$N" +- append bss_conf "hs20_deauth_req_timeout=$hs20_deauth_req_timeout" "$N" ++ [ -n "$disable_dgaf"] && append bss_conf "disable_dgaf=$disable_dgaf" "$N" ++ [ -n "$osen"] && append bss_conf "osen=$osen" "$N" ++ [ "$anqp_domain_id" -gt 0 ] && append bss_conf "anqp_domain_id=$anqp_domain_id" "$N" ++ [ -n "$hs20_deauth_req_timeout"] && append bss_conf "hs20_deauth_req_timeout=$hs20_deauth_req_timeout" "$N" + [ -n "$osu_ssid" ] && append bss_conf "osu_ssid=$osu_ssid" "$N" + [ -n "$hs20_wan_metrics" ] && append bss_conf "hs20_wan_metrics=$hs20_wan_metrics" "$N" + [ -n "$hs20_operating_class" ] && append bss_conf "hs20_operating_class=$hs20_operating_class" "$N" + [ -n "$hs20_t_c_filename" ] && append bss_conf "hs20_t_c_filename=$hs20_t_c_filename" "$N" + [ -n "$hs20_t_c_timestamp" ] && append bss_conf "hs20_t_c_timestamp=$hs20_t_c_timestamp" "$N" +- json_for_each_item append_hs20_conn_capab hs20_conn_capab ++ [ -n "$hs20_t_c_server_url" ] && append bss_conf "hs20_t_c_server_url=$hs20_t_c_server_url" "$N" + json_for_each_item append_hs20_oper_friendly_name hs20_oper_friendly_name ++ json_for_each_item append_hs20_conn_capab hs20_conn_capab + json_for_each_item append_osu_provider osu_provider + json_for_each_item append_operator_icon operator_icon + fi +-- +2.25.1 + diff --git a/patches/0027-hostapd-fix-civic-location-option.patch b/patches/0027-hostapd-fix-civic-location-option.patch new file mode 100644 index 000000000..234137df8 --- /dev/null +++ b/patches/0027-hostapd-fix-civic-location-option.patch @@ -0,0 +1,26 @@ +From f1bb66dbeb148d3da6481a98433cff5b5ee3ef96 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Tue, 6 Apr 2021 13:24:43 +0200 +Subject: [PATCH] hostapd: fix civic location option + +Signed-off-by: John Crispin +--- + package/network/services/hostapd/files/hostapd.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh +index 05b901fb6b..e391aae13b 100644 +--- a/package/network/services/hostapd/files/hostapd.sh ++++ b/package/network/services/hostapd/files/hostapd.sh +@@ -763,7 +763,7 @@ hostapd_set_bss_options() { + append bss_conf "ftm_responder=1" "$N" + [ "$stationary_ap" -eq "1" ] && append bss_conf "stationary_ap=1" "$N" + [ -n "$lci" ] && append bss_conf "lci=$lci" "$N" +- [ -n "$civic" ] && append bss_conf "lci=$civic" "$N" ++ [ -n "$civic" ] && append bss_conf "civic=$civic" "$N" + } + fi + +-- +2.25.1 + diff --git a/patches/0028-hostapd-add-eap_server-support.patch b/patches/0028-hostapd-add-eap_server-support.patch new file mode 100644 index 000000000..196787e5b --- /dev/null +++ b/patches/0028-hostapd-add-eap_server-support.patch @@ -0,0 +1,77 @@ +From 99cffd423352bceb3c2826b4262b575478b0a712 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Tue, 6 Apr 2021 14:59:41 +0200 +Subject: [PATCH] hostapd: add eap_server support + +Signed-off-by: John Crispin +--- + .../network/services/hostapd/files/hostapd.sh | 25 ++++++++++++++++--- + 1 file changed, 21 insertions(+), 4 deletions(-) + +diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh +index e391aae13b..a3263ed036 100644 +--- a/package/network/services/hostapd/files/hostapd.sh ++++ b/package/network/services/hostapd/files/hostapd.sh +@@ -341,6 +341,9 @@ hostapd_common_add_bss_config() { + config_add_array radius_auth_req_attr + config_add_array radius_acct_req_attr + config_add_int rts_threshold ++ ++ config_add_int eap_server ++ config_add_string eap_user_file ca_cert server_cert private_key private_key_passwd server_id + } + + hostapd_set_vlan_file() { +@@ -507,7 +510,8 @@ hostapd_set_bss_options() { + bss_load_update_period chan_util_avg_period sae_require_mfp \ + multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key skip_inactivity_poll \ + airtime_bss_weight airtime_bss_limit airtime_sta_weight \ +- multicast_to_unicast per_sta_vif rts_threshold ++ multicast_to_unicast per_sta_vif rts_threshold \ ++ eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id + + set_default isolate 0 + set_default maxassoc 0 +@@ -529,6 +533,7 @@ hostapd_set_bss_options() { + set_default airtime_bss_weight 0 + set_default airtime_bss_limit 0 + set_default rts_threshold -1 ++ set_default eap_server 0 + + append bss_conf "ctrl_interface=/var/run/hostapd" + if [ "$isolate" -gt 0 ]; then +@@ -643,9 +648,11 @@ hostapd_set_bss_options() { + set_default dae_port 3799 + set_default request_cui 0 + +- append bss_conf "auth_server_addr=$auth_server" "$N" +- append bss_conf "auth_server_port=$auth_port" "$N" +- append bss_conf "auth_server_shared_secret=$auth_secret" "$N" ++ [ "$eap_server" -eq 0 ] && { ++ append bss_conf "auth_server_addr=$auth_server" "$N" ++ append bss_conf "auth_server_port=$auth_port" "$N" ++ append bss_conf "auth_server_shared_secret=$auth_secret" "$N" ++ } + + [ "$request_cui" -gt 0 ] && append bss_conf "radius_request_cui=$request_cui" "$N" + [ -n "$eap_reauth_period" ] && append bss_conf "eap_reauth_period=$eap_reauth_period" "$N" +@@ -980,6 +987,16 @@ hostapd_set_bss_options() { + json_for_each_item append_operator_icon operator_icon + fi + ++ if [ "$eap_server" = "1" ]; then ++ append bss_conf "eap_server=1" "$N" ++ [ -n "$eap_user_file" ] && append bss_conf "eap_user_file=$eap_user_file" "$N" ++ [ -n "$ca_cert" ] && append bss_conf "ca_cert=$ca_cert" "$N" ++ [ -n "$server_cert" ] && append bss_conf "server_cert=$server_cert" "$N" ++ [ -n "$private_key" ] && append bss_conf "private_key=$private_key" "$N" ++ [ -n "$private_key_passwd" ] && append bss_conf "private_key_passwd=$private_key_passwd" "$N" ++ [ -n "$server_id" ] && append bss_conf "server_id=$server_id" "$N" ++ fi ++ + set_default multicast_to_unicast 0 + if [ "$multicast_to_unicast" -gt 0 ]; then + append bss_conf "multicast_to_unicast=$multicast_to_unicast" "$N" +-- +2.25.1 + diff --git a/profiles/wf188n.yml b/profiles/cig_wf188.yml similarity index 100% rename from profiles/wf188n.yml rename to profiles/cig_wf188.yml diff --git a/profiles/wf194c.yml b/profiles/cig_wf194c.yml similarity index 100% rename from profiles/wf194c.yml rename to profiles/cig_wf194c.yml diff --git a/profiles/eap101.yml b/profiles/edgecore_eap101.yml similarity index 100% rename from profiles/eap101.yml rename to profiles/edgecore_eap101.yml diff --git a/profiles/eap102.yml b/profiles/edgecore_eap102.yml similarity index 100% rename from profiles/eap102.yml rename to profiles/edgecore_eap102.yml diff --git a/profiles/edgecore_ecw5211.yml b/profiles/edgecore_ecw5211.yml new file mode 100644 index 000000000..ea35b6b74 --- /dev/null +++ b/profiles/edgecore_ecw5211.yml @@ -0,0 +1,15 @@ +--- +profile: edgecore_ecw5211 +target: ipq40xx +subtarget: generic +description: Build image for the Edgecore ECW5211 +include: + - ucentral-ap +packages: + - ath10k-firmware-qca4019-ct-htt + - ath10k-firmware-qca9888-ct-htt + - ath10k-firmware-qca9984-ct-htt +diffconfig: | + # CONFIG_PACKAGE_ath10k-firmware-qca4019-ct is not set + # CONFIG_PACKAGE_ath10k-firmware-qca9888-ct is not set + # CONFIG_PACKAGE_ath10k-firmware-qca9984-ct is not set diff --git a/profiles/e8450.yml b/profiles/linksys_e8450.yml similarity index 84% rename from profiles/e8450.yml rename to profiles/linksys_e8450.yml index 129ee532a..48315f1a6 100644 --- a/profiles/e8450.yml +++ b/profiles/linksys_e8450.yml @@ -1,5 +1,5 @@ --- -profile: linksys_e8450_ubi +profile: linksys_e8450-ubi target: mediatek subtarget: mt7622 description: Build image for the Linksys E8450 diff --git a/profiles/ea8300.yml b/profiles/linksys_ea8300.yml similarity index 100% rename from profiles/ea8300.yml rename to profiles/linksys_ea8300.yml diff --git a/profiles/ucentral-ap.yml b/profiles/ucentral-ap.yml index f920cabb7..8d5c77f7f 100644 --- a/profiles/ucentral-ap.yml +++ b/profiles/ucentral-ap.yml @@ -12,14 +12,19 @@ packages: - batmand - cJSON - curl + - dnsmasq-full + - igmpproxy + - ip-bridge + - iw-full - libmosquitto-ssl - lldpd - - wlan-ap-config - - wpad-mesh-openssl - - ip-bridge - - dnsmasq-full - firstcontact - gre + - tmate + - opennds + - ratelimit + - rtty-openssl + - tcpdump - ucentral-client - ucentral-jsonschema - ucentral-schema @@ -30,12 +35,9 @@ packages: - uledd - usteer - udevmand - - opennds - - ratelimit - - rtty-openssl - - sqm-scripts - - tcpdump + - umdns - vxlan + - wpad-mesh-openssl diffconfig: | CONFIG_OPENSSL_ENGINE=y CONFIG_OPENSSL_PREFER_CHACHA_OVER_GCM=y @@ -54,3 +56,4 @@ diffconfig: | CONFIG_TARGET_PREINIT_SUPPRESS_STDERR=y CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE=y # CONFIG_BATMAN_ADV_BATMAN_V is not set + # CONFIG_PACKAGE_iw is not set