From 829cc60a281b9da1ede262d32f1359b4d997555f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Thu, 24 Nov 2022 16:39:10 +0100 Subject: [PATCH 001/137] kernel: backport flow_dissect support for tag_brcm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change helps BCM4908 SoC. It was capable of 940 Mb/s masq NAT while using iperf but users reported lower & unstable speeds for HTTP based tests. For LibreSpeed tests this bumps NAT speed from ~930 Mb/s to ~990 Mb/s (not that this value seems real but speed bump definitely is). Signed-off-by: Rafał Miłecki --- ...ement-flow-dissection-for-tag_brcm.c.patch | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 target/linux/generic/backport-5.4/701-v5.7-net-dsa-Implement-flow-dissection-for-tag_brcm.c.patch diff --git a/target/linux/generic/backport-5.4/701-v5.7-net-dsa-Implement-flow-dissection-for-tag_brcm.c.patch b/target/linux/generic/backport-5.4/701-v5.7-net-dsa-Implement-flow-dissection-for-tag_brcm.c.patch new file mode 100644 index 0000000000..5d7b90f699 --- /dev/null +++ b/target/linux/generic/backport-5.4/701-v5.7-net-dsa-Implement-flow-dissection-for-tag_brcm.c.patch @@ -0,0 +1,62 @@ +From 52015366e361a88c569550a285c71f72bb095661 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Sun, 22 Mar 2020 14:09:57 -0700 +Subject: [PATCH] net: dsa: Implement flow dissection for tag_brcm.c + +Provide a flow_dissect callback which returns the network offset and +where to find the skb protocol, given the tags structure a common +function works for both tagging formats that are supported. + +Signed-off-by: Florian Fainelli +Reviewed-by: Vivien Didelot +Signed-off-by: David S. Miller +--- + net/dsa/tag_brcm.c | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +--- a/net/dsa/tag_brcm.c ++++ b/net/dsa/tag_brcm.c +@@ -144,6 +144,27 @@ static struct sk_buff *brcm_tag_rcv_ll(s + + return skb; + } ++ ++static int brcm_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, ++ int *offset) ++{ ++ /* We have been called on the DSA master network device after ++ * eth_type_trans() which pulled the Ethernet header already. ++ * Frames have one of these two layouts: ++ * ----------------------------------- ++ * | MAC DA | MAC SA | 4b tag | Type | DSA_TAG_PROTO_BRCM ++ * ----------------------------------- ++ * ----------------------------------- ++ * | 4b tag | MAC DA | MAC SA | Type | DSA_TAG_PROTO_BRCM_PREPEND ++ * ----------------------------------- ++ * skb->data points 2 bytes before the actual Ethernet type field and ++ * we have an offset of 4bytes between where skb->data and where the ++ * payload starts. ++ */ ++ *offset = BRCM_TAG_LEN; ++ *proto = ((__be16 *)skb->data)[1]; ++ return 0; ++} + #endif + + #if IS_ENABLED(CONFIG_NET_DSA_TAG_BRCM) +@@ -179,6 +200,7 @@ static const struct dsa_device_ops brcm_ + .xmit = brcm_tag_xmit, + .rcv = brcm_tag_rcv, + .overhead = BRCM_TAG_LEN, ++ .flow_dissect = brcm_tag_flow_dissect, + }; + + DSA_TAG_DRIVER(brcm_netdev_ops); +@@ -207,6 +229,7 @@ static const struct dsa_device_ops brcm_ + .xmit = brcm_tag_xmit_prepend, + .rcv = brcm_tag_rcv_prepend, + .overhead = BRCM_TAG_LEN, ++ .flow_dissect = brcm_tag_flow_dissect, + }; + + DSA_TAG_DRIVER(brcm_prepend_netdev_ops); From 5c85a3e607df1f7f9e053946810f46158f29658f Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Sat, 10 Sep 2022 20:13:58 +0200 Subject: [PATCH 002/137] lantiq: enable interrupts on second VPEs This patch is needed to handle interrupts by the second VPE on the Lantiq ARX100, xRX200, xRX300 and xRX330 SoCs. Switching some ICU interrupts to the second VPE results in a hang. Currently, the vsmp_init_secondary() function is responsible for enabling these interrupts. It only enables Malta-specific interrupts (SW0, SW1, HW4 and HW5). The MIPS core has 8 interrupts defined. On Lantiq SoCs, hardware interrupts are wired to an ICU instance. Each VPE has an independent instance of the ICU. The mapping of the ICU interrupts is shown below: SW0(IP0) - IPI call, SW1(IP1) - IPI resched, HW0(IP2) - ICU 0-31, HW1(IP3) - ICU 32-63, HW2(IP4) - ICU 64-95, HW3(IP5) - ICU 96-127, HW4(IP6) - ICU 128-159, HW5(IP7) - timer. This patch enables all interrupt lines on the second VPE. This problem affects multithreaded SoCs with a custom interrupt controller. SOCs with 1004Kc core and newer use the MIPS GIC. At this point, I am aware that the Realtek RTL839x and RTL930x SoCs may need a similar fix. In the future, this may be replaced with some generic solution. Tested on Lantiq xRX200. Signed-off-by: Aleksander Jan Bajkowski (cherry picked from commit fbd33d61648ae8982fbada7ad3b6d8222b367ab5) --- ...le-all-hardware-interrupts-on-second.patch | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 target/linux/lantiq/patches-5.4/0320-MIPS-lantiq-enable-all-hardware-interrupts-on-second.patch diff --git a/target/linux/lantiq/patches-5.4/0320-MIPS-lantiq-enable-all-hardware-interrupts-on-second.patch b/target/linux/lantiq/patches-5.4/0320-MIPS-lantiq-enable-all-hardware-interrupts-on-second.patch new file mode 100644 index 0000000000..0ac9adfb96 --- /dev/null +++ b/target/linux/lantiq/patches-5.4/0320-MIPS-lantiq-enable-all-hardware-interrupts-on-second.patch @@ -0,0 +1,86 @@ +From 2025bc9c3a949b65bfd0601f727678b37962c6c5 Mon Sep 17 00:00:00 2001 +From: Aleksander Jan Bajkowski +Date: Fri, 4 Jun 2021 18:27:58 +0200 +Subject: [PATCH] MIPS: lantiq: enable all hardware interrupts on second VPE + +This patch is needed to handle interrupts by the second VPE on the Lantiq +ARX100, xRX200, xRX300 and xRX330 SoCs. Switching some ICU interrupts to +the second VPE results in a hang. Currently, the vsmp_init_secondary() +function is responsible for enabling these interrupts. It only enables +Malta-specific interrupts (SW0, SW1, HW4 and HW5). + +The MIPS core has 8 interrupts defined. On Lantiq SoCs, hardware +interrupts are wired to an ICU instance. Each VPE has an independent +instance of the ICU. The mapping of the ICU interrupts is shown below: +SW0(IP0) - IPI call, +SW1(IP1) - IPI resched, +HW0(IP2) - ICU 0-31, +HW1(IP3) - ICU 32-63, +HW2(IP4) - ICU 64-95, +HW3(IP5) - ICU 96-127, +HW4(IP6) - ICU 128-159, +HW5(IP7) - timer. + +This patch enables all interrupt lines on the second VPE. + +This problem affects multithreaded SoCs with a custom interrupt controller. +SOCs with 1004Kc core and newer use the MIPS GIC. At this point, I am aware +that the Realtek RTL839x and RTL930x SoCs may need a similar fix. In the +future, this may be replaced with some generic solution. + +Tested on Lantiq xRX200. + +Suggested-by: Thomas Bogendoerfer +Signed-off-by: Aleksander Jan Bajkowski +--- + arch/mips/lantiq/prom.c | 26 ++++++++++++++++++++++++-- + 1 file changed, 24 insertions(+), 2 deletions(-) + +--- a/arch/mips/lantiq/prom.c ++++ b/arch/mips/lantiq/prom.c +@@ -37,6 +37,14 @@ static struct ltq_soc_info soc_info; + /* for Multithreading (APRP), vpe.c will use it */ + unsigned long cp0_memsize; + ++/* ++ * These structs are used to override vsmp_init_secondary() ++ */ ++#if defined(CONFIG_MIPS_MT_SMP) ++extern const struct plat_smp_ops vsmp_smp_ops; ++static struct plat_smp_ops lantiq_smp_ops; ++#endif ++ + const char *get_system_type(void) + { + return soc_info.sys_type; +@@ -100,6 +108,17 @@ void __init device_tree_init(void) + unflatten_and_copy_device_tree(); + } + ++#if defined(CONFIG_MIPS_MT_SMP) ++static void lantiq_init_secondary(void) ++{ ++ /* ++ * MIPS CPU startup function vsmp_init_secondary() will only ++ * enable some of the interrupts for the second CPU/VPE. ++ */ ++ set_c0_status(ST0_IM); ++} ++#endif ++ + void __init prom_init(void) + { + /* call the soc specific detetcion code and get it to fill soc_info */ +@@ -111,7 +130,10 @@ void __init prom_init(void) + prom_init_cmdline(); + + #if defined(CONFIG_MIPS_MT_SMP) +- if (register_vsmp_smp_ops()) +- panic("failed to register_vsmp_smp_ops()"); ++ if (cpu_has_mipsmt) { ++ lantiq_smp_ops = vsmp_smp_ops; ++ lantiq_smp_ops.init_secondary = lantiq_init_secondary; ++ register_smp_ops(&lantiq_smp_ops); ++ } + #endif + } From 206012e252d86e68487e0bce3ef1a10bd611bf77 Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Wed, 5 Oct 2022 23:05:26 +0200 Subject: [PATCH 003/137] lantiq: add 6.1 tag to upstream patch Add 6.1 tag to upstream patch now that 6.1 got tagged. This permits to track patch in a better way and directly drop them on kernel bump. Signed-off-by: Aleksander Jan Bajkowski (cherry picked from commit 802ca492d85e6f6af05676518889d4de50697477) --- ...PS-lantiq-enable-all-hardware-interrupts-on-second.patch} | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) rename target/linux/lantiq/patches-5.4/{0320-MIPS-lantiq-enable-all-hardware-interrupts-on-second.patch => 0320-v6.1-MIPS-lantiq-enable-all-hardware-interrupts-on-second.patch} (94%) diff --git a/target/linux/lantiq/patches-5.4/0320-MIPS-lantiq-enable-all-hardware-interrupts-on-second.patch b/target/linux/lantiq/patches-5.4/0320-v6.1-MIPS-lantiq-enable-all-hardware-interrupts-on-second.patch similarity index 94% rename from target/linux/lantiq/patches-5.4/0320-MIPS-lantiq-enable-all-hardware-interrupts-on-second.patch rename to target/linux/lantiq/patches-5.4/0320-v6.1-MIPS-lantiq-enable-all-hardware-interrupts-on-second.patch index 0ac9adfb96..b7b95d6bfc 100644 --- a/target/linux/lantiq/patches-5.4/0320-MIPS-lantiq-enable-all-hardware-interrupts-on-second.patch +++ b/target/linux/lantiq/patches-5.4/0320-v6.1-MIPS-lantiq-enable-all-hardware-interrupts-on-second.patch @@ -1,6 +1,6 @@ -From 2025bc9c3a949b65bfd0601f727678b37962c6c5 Mon Sep 17 00:00:00 2001 +From 730320fd770d4114a2ecb6fb223dcc8c3cecdc5b Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski -Date: Fri, 4 Jun 2021 18:27:58 +0200 +Date: Wed, 21 Sep 2022 22:59:44 +0200 Subject: [PATCH] MIPS: lantiq: enable all hardware interrupts on second VPE This patch is needed to handle interrupts by the second VPE on the Lantiq @@ -32,6 +32,7 @@ Tested on Lantiq xRX200. Suggested-by: Thomas Bogendoerfer Signed-off-by: Aleksander Jan Bajkowski +Signed-off-by: Thomas Bogendoerfer --- arch/mips/lantiq/prom.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) From 778afce43e26f104ae5af9b16c057b5417055b00 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Wed, 6 Jul 2022 20:32:11 +0200 Subject: [PATCH 004/137] kernel: Add missing mediatek configuration options When building the mediatek/mt7629 target in OpenWrt 22.03 the kernel does not have a configuration option for CONFIG_CRYPTO_DEV_MEDIATEK. Add this option to the generic kernel configuration and also add two other configuration options which are removed when we refresh the mt7629 kernel configuration. Fixes: 2bea35cb55d7 ("mediatek: remove crypto-hw-mtk package") Signed-off-by: Hauke Mehrtens (cherry picked from commit dcc0fe24ea216d32300c0f01c8879e586d89cc1e) (cherry picked from commit bfd070e7fa5ad715fb1a8f8449ab5d7750c59338) --- target/linux/generic/config-5.4 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/generic/config-5.4 b/target/linux/generic/config-5.4 index d793e062b1..73faf7172e 100644 --- a/target/linux/generic/config-5.4 +++ b/target/linux/generic/config-5.4 @@ -1028,6 +1028,7 @@ CONFIG_CRYPTO_BLKCIPHER2=y # CONFIG_CRYPTO_DEV_HISI_ZIP is not set # CONFIG_CRYPTO_DEV_IMGTEC_HASH is not set # CONFIG_CRYPTO_DEV_MARVELL_CESA is not set +# CONFIG_CRYPTO_DEV_MEDIATEK is not set # CONFIG_CRYPTO_DEV_MV_CESA is not set # CONFIG_CRYPTO_DEV_MXC_SCC is not set # CONFIG_CRYPTO_DEV_MXS_DCP is not set From 175a3cb22ab1972ee3364e011b0cce5355fb86fb Mon Sep 17 00:00:00 2001 From: David Bauer Date: Thu, 12 Aug 2021 23:40:32 +0200 Subject: [PATCH 005/137] mediatek: add missing config symbols Signed-off-by: David Bauer (cherry picked from commit 101c0c00a7143a1e50e4c0923f0af88b5176f6ed) --- target/linux/mediatek/mt7629/config-5.4 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/mediatek/mt7629/config-5.4 b/target/linux/mediatek/mt7629/config-5.4 index 46eac73240..8ff33d04cc 100644 --- a/target/linux/mediatek/mt7629/config-5.4 +++ b/target/linux/mediatek/mt7629/config-5.4 @@ -318,6 +318,7 @@ CONFIG_REGMAP_MMIO=y CONFIG_RESET_CONTROLLER=y CONFIG_RFS_ACCEL=y CONFIG_RPS=y +# CONFIG_RTL8367S_GSW is not set CONFIG_RWSEM_SPIN_ON_OWNER=y CONFIG_SCSI=y CONFIG_SERIAL_8250_FSL=y From 04ca5a8678d6fd5b9a79594e0ec3361f1eb68be5 Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 3 Nov 2022 09:27:49 -0400 Subject: [PATCH 006/137] openssl: bump to 1.1.1s Changes between 1.1.1r and 1.1.1s [1 Nov 2022] *) Fixed a regression introduced in 1.1.1r version not refreshing the certificate data to be signed before signing the certificate. [Gibeom Gwon] Changes between 1.1.1q and 1.1.1r [11 Oct 2022] *) Fixed the linux-mips64 Configure target which was missing the SIXTY_FOUR_BIT bn_ops flag. This was causing heap corruption on that platform. [Adam Joseph] *) Fixed a strict aliasing problem in bn_nist. Clang-14 optimisation was causing incorrect results in some cases as a result. [Paul Dale] *) Fixed SSL_pending() and SSL_has_pending() with DTLS which were failing to report correct results in some cases [Matt Caswell] *) Fixed a regression introduced in 1.1.1o for re-signing certificates with different key sizes [Todd Short] *) Added the loongarch64 target [Shi Pujin] *) Fixed a DRBG seed propagation thread safety issue [Bernd Edlinger] *) Fixed a memory leak in tls13_generate_secret [Bernd Edlinger] *) Fixed reported performance degradation on aarch64. Restored the implementation prior to commit 2621751 ("aes/asm/aesv8-armx.pl: avoid 32-bit lane assignment in CTR mode") for 64bit targets only, since it is reportedly 2-17% slower and the silicon errata only affects 32bit targets. The new algorithm is still used for 32 bit targets. [Bernd Edlinger] *) Added a missing header for memcmp that caused compilation failure on some platforms [Gregor Jasny] Build system: x86_64 Build-tested: bcm2711/RPi4B Run-tested: bcm2711/RPi4B Signed-off-by: John Audia (cherry picked from commit a0814f04ed955eb10b25df0ce6666ed91f11ca1b) --- package/libs/openssl/Makefile | 4 +- .../patches/100-Configure-afalg-support.patch | 4 +- .../openssl/patches/110-openwrt_targets.patch | 3 - .../120-strip-cflags-from-binary.patch | 4 +- .../patches/130-dont-build-tests-fuzz.patch | 4 +- .../patches/140-allow-prefer-chacha20.patch | 8 +- ...o-save-ioctl-if-EVP_MD_.FLAG_ONESHOT.patch | 6 +- ..._devcrypto-add-configuration-options.patch | 20 +- ...ypto-add-command-to-dump-driver-info.patch | 16 +- ...o-make-the-dev-crypto-engine-dynamic.patch | 2630 ++++++++++++++++- ...default-to-not-use-digests-in-engine.patch | 4 +- ...to-ignore-error-when-closing-session.patch | 4 +- 12 files changed, 2527 insertions(+), 180 deletions(-) diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile index 99a2afa3a2..04b00e2bf5 100644 --- a/package/libs/openssl/Makefile +++ b/package/libs/openssl/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openssl PKG_BASE:=1.1.1 -PKG_BUGFIX:=q +PKG_BUGFIX:=s PKG_VERSION:=$(PKG_BASE)$(PKG_BUGFIX) PKG_RELEASE:=1 PKG_USE_MIPS16:=0 @@ -26,7 +26,7 @@ PKG_SOURCE_URL:= \ ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/ \ ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/old/$(PKG_BASE)/ -PKG_HASH:=d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca +PKG_HASH:=c5ac01e760ee6ff0dab61d6b2bbd30146724d063eb322180c6f18a6f74e4b6aa PKG_LICENSE:=OpenSSL PKG_LICENSE_FILES:=LICENSE diff --git a/package/libs/openssl/patches/100-Configure-afalg-support.patch b/package/libs/openssl/patches/100-Configure-afalg-support.patch index d8789f4b45..906e1bb4b4 100644 --- a/package/libs/openssl/patches/100-Configure-afalg-support.patch +++ b/package/libs/openssl/patches/100-Configure-afalg-support.patch @@ -8,11 +8,9 @@ version to disable building the AFALG engine on openwrt targets. Signed-off-by: Eneas U de Queiroz -diff --git a/Configure b/Configure -index 5a699836f3..74d057c219 100755 --- a/Configure +++ b/Configure -@@ -1548,7 +1548,9 @@ unless ($disabled{"crypto-mdebug-backtrace"}) +@@ -1548,7 +1548,9 @@ unless ($disabled{"crypto-mdebug-backtra unless ($disabled{afalgeng}) { $config{afalgeng}=""; diff --git a/package/libs/openssl/patches/110-openwrt_targets.patch b/package/libs/openssl/patches/110-openwrt_targets.patch index d0530b4661..b2786e8fee 100644 --- a/package/libs/openssl/patches/110-openwrt_targets.patch +++ b/package/libs/openssl/patches/110-openwrt_targets.patch @@ -7,9 +7,6 @@ Targets are named: linux-$(CONFIG_ARCH)-openwrt Signed-off-by: Eneas U de Queiroz -diff --git a/Configurations/25-openwrt.conf b/Configurations/25-openwrt.conf -new file mode 100644 -index 0000000000..86a86d31e4 --- /dev/null +++ b/Configurations/25-openwrt.conf @@ -0,0 +1,48 @@ diff --git a/package/libs/openssl/patches/120-strip-cflags-from-binary.patch b/package/libs/openssl/patches/120-strip-cflags-from-binary.patch index 7faec9ab88..4a7dce366b 100644 --- a/package/libs/openssl/patches/120-strip-cflags-from-binary.patch +++ b/package/libs/openssl/patches/120-strip-cflags-from-binary.patch @@ -8,11 +8,9 @@ OpenSSL_version(OPENSSL_CFLAGS), or running openssl version -a Signed-off-by: Eneas U de Queiroz -diff --git a/crypto/build.info b/crypto/build.info -index 2c619c62e8..893128345a 100644 --- a/crypto/build.info +++ b/crypto/build.info -@@ -10,7 +10,7 @@ EXTRA= ../ms/uplink-x86.pl ../ms/uplink.c ../ms/applink.c \ +@@ -10,7 +10,7 @@ EXTRA= ../ms/uplink-x86.pl ../ms/uplink ppccpuid.pl pariscid.pl alphacpuid.pl arm64cpuid.pl armv4cpuid.pl DEPEND[cversion.o]=buildinf.h diff --git a/package/libs/openssl/patches/130-dont-build-tests-fuzz.patch b/package/libs/openssl/patches/130-dont-build-tests-fuzz.patch index 7f33cb9dae..1117f7152f 100644 --- a/package/libs/openssl/patches/130-dont-build-tests-fuzz.patch +++ b/package/libs/openssl/patches/130-dont-build-tests-fuzz.patch @@ -7,11 +7,9 @@ This shortens build time. Signed-off-by: Eneas U de Queiroz -diff --git a/Configure b/Configure -index 74d057c219..5813e9f8fe 100755 --- a/Configure +++ b/Configure -@@ -318,7 +318,7 @@ my $auto_threads=1; # enable threads automatically? true by default +@@ -318,7 +318,7 @@ my $auto_threads=1; # enable threads my $default_ranlib; # Top level directories to build diff --git a/package/libs/openssl/patches/140-allow-prefer-chacha20.patch b/package/libs/openssl/patches/140-allow-prefer-chacha20.patch index b293db28f7..582b33a871 100644 --- a/package/libs/openssl/patches/140-allow-prefer-chacha20.patch +++ b/package/libs/openssl/patches/140-allow-prefer-chacha20.patch @@ -14,8 +14,6 @@ when the client has it on top of its ciphersuite preference. Signed-off-by: Eneas U de Queiroz -diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h -index 6724ccf2d2..96d959427e 100644 --- a/include/openssl/ssl.h +++ b/include/openssl/ssl.h @@ -173,9 +173,15 @@ extern "C" { @@ -37,11 +35,9 @@ index 6724ccf2d2..96d959427e 100644 # else # define TLS_DEFAULT_CIPHERSUITES "TLS_AES_256_GCM_SHA384:" \ "TLS_AES_128_GCM_SHA256" -diff --git a/ssl/ssl_ciph.c b/ssl/ssl_ciph.c -index 27a1b2ec68..7039811323 100644 --- a/ssl/ssl_ciph.c +++ b/ssl/ssl_ciph.c -@@ -1467,11 +1467,29 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method, +@@ -1465,11 +1465,29 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_ ssl_cipher_apply_rule(0, SSL_kECDHE, 0, 0, 0, 0, 0, CIPHER_DEL, -1, &head, &tail); @@ -71,7 +67,7 @@ index 27a1b2ec68..7039811323 100644 /* * ...and generally, our preferred cipher is AES. -@@ -1527,7 +1545,7 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method, +@@ -1525,7 +1543,7 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_ * Within each group, ciphers remain sorted by strength and previous * preference, i.e., * 1) ECDHE > DHE diff --git a/package/libs/openssl/patches/400-eng_devcrypto-save-ioctl-if-EVP_MD_.FLAG_ONESHOT.patch b/package/libs/openssl/patches/400-eng_devcrypto-save-ioctl-if-EVP_MD_.FLAG_ONESHOT.patch index 84c68b16a2..57962ec9c7 100644 --- a/package/libs/openssl/patches/400-eng_devcrypto-save-ioctl-if-EVP_MD_.FLAG_ONESHOT.patch +++ b/package/libs/openssl/patches/400-eng_devcrypto-save-ioctl-if-EVP_MD_.FLAG_ONESHOT.patch @@ -14,8 +14,6 @@ Reviewed-by: Matthias St. Pierre Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/7585) -diff --git a/crypto/engine/eng_devcrypto.c b/crypto/engine/eng_devcrypto.c -index a727c6f646..a2c9a966f7 100644 --- a/crypto/engine/eng_devcrypto.c +++ b/crypto/engine/eng_devcrypto.c @@ -461,6 +461,7 @@ struct digest_ctx { @@ -26,7 +24,7 @@ index a727c6f646..a2c9a966f7 100644 }; static const struct digest_data_st { -@@ -564,12 +565,15 @@ static int digest_update(EVP_MD_CTX *ctx, const void *data, size_t count) +@@ -564,12 +565,15 @@ static int digest_update(EVP_MD_CTX *ctx if (digest_ctx == NULL) return 0; @@ -46,7 +44,7 @@ index a727c6f646..a2c9a966f7 100644 } static int digest_final(EVP_MD_CTX *ctx, unsigned char *md) -@@ -579,7 +583,10 @@ static int digest_final(EVP_MD_CTX *ctx, unsigned char *md) +@@ -579,7 +583,10 @@ static int digest_final(EVP_MD_CTX *ctx, if (md == NULL || digest_ctx == NULL) return 0; diff --git a/package/libs/openssl/patches/410-eng_devcrypto-add-configuration-options.patch b/package/libs/openssl/patches/410-eng_devcrypto-add-configuration-options.patch index 6d0fbfc982..bad7a37256 100644 --- a/package/libs/openssl/patches/410-eng_devcrypto-add-configuration-options.patch +++ b/package/libs/openssl/patches/410-eng_devcrypto-add-configuration-options.patch @@ -13,7 +13,6 @@ Reviewed-by: Matthias St. Pierre Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/7585) -diff --git a/crypto/engine/eng_devcrypto.c b/crypto/engine/eng_devcrypto.c --- a/crypto/engine/eng_devcrypto.c +++ b/crypto/engine/eng_devcrypto.c @@ -16,6 +16,7 @@ @@ -79,7 +78,7 @@ diff --git a/crypto/engine/eng_devcrypto.c b/crypto/engine/eng_devcrypto.c /* * Code further down must make sure that only NIDs in the table above -@@ -333,19 +367,40 @@ static int cipher_cleanup(EVP_CIPHER_CTX *ctx) +@@ -333,19 +367,40 @@ static int cipher_cleanup(EVP_CIPHER_CTX } /* @@ -185,7 +184,7 @@ diff --git a/crypto/engine/eng_devcrypto.c b/crypto/engine/eng_devcrypto.c static const EVP_CIPHER *get_cipher_method(int nid) { size_t i = get_cipher_data_index(nid); -@@ -438,6 +520,36 @@ static int devcrypto_ciphers(ENGINE *e, const EVP_CIPHER **cipher, +@@ -438,6 +520,36 @@ static int devcrypto_ciphers(ENGINE *e, return *cipher != NULL; } @@ -246,7 +245,7 @@ diff --git a/crypto/engine/eng_devcrypto.c b/crypto/engine/eng_devcrypto.c /* * Code further down must make sure that only NIDs in the table above -@@ -516,8 +637,8 @@ static const struct digest_data_st *get_digest_data(int nid) +@@ -516,8 +637,8 @@ static const struct digest_data_st *get_ } /* @@ -257,7 +256,7 @@ diff --git a/crypto/engine/eng_devcrypto.c b/crypto/engine/eng_devcrypto.c */ static int digest_init(EVP_MD_CTX *ctx) -@@ -630,52 +751,94 @@ static int digest_cleanup(EVP_MD_CTX *ctx) +@@ -630,52 +751,94 @@ static int digest_cleanup(EVP_MD_CTX *ct return clean_devcrypto_session(&digest_ctx->sess); } @@ -402,7 +401,7 @@ diff --git a/crypto/engine/eng_devcrypto.c b/crypto/engine/eng_devcrypto.c } } -@@ -739,8 +909,154 @@ static int devcrypto_digests(ENGINE *e, const EVP_MD **digest, +@@ -739,7 +909,153 @@ static int devcrypto_digests(ENGINE *e, return *digest != NULL; } @@ -478,8 +477,8 @@ diff --git a/crypto/engine/eng_devcrypto.c b/crypto/engine/eng_devcrypto.c + "DIGESTS", + "either ALL, NONE, or a comma-separated list of digests to enable [default=ALL]", + ENGINE_CMD_FLAG_STRING}, - #endif - ++#endif ++ + {0, NULL, NULL, 0} +}; + @@ -503,7 +502,7 @@ diff --git a/crypto/engine/eng_devcrypto.c b/crypto/engine/eng_devcrypto.c + use_softdrivers = i; +#ifdef IMPLEMENT_DIGEST + rebuild_known_digest_nids(e); -+#endif + #endif + rebuild_known_cipher_nids(e); + return 1; +#endif /* CIOCGSESSINFO */ @@ -553,10 +552,9 @@ diff --git a/crypto/engine/eng_devcrypto.c b/crypto/engine/eng_devcrypto.c + } + return 0; +} -+ + /****************************************************************************** * - * LOAD / UNLOAD @@ -806,6 +1122,8 @@ void engine_load_devcrypto_int() if (!ENGINE_set_id(e, "devcrypto") diff --git a/package/libs/openssl/patches/420-eng_devcrypto-add-command-to-dump-driver-info.patch b/package/libs/openssl/patches/420-eng_devcrypto-add-command-to-dump-driver-info.patch index ad83a51a10..b7e1f6a411 100644 --- a/package/libs/openssl/patches/420-eng_devcrypto-add-command-to-dump-driver-info.patch +++ b/package/libs/openssl/patches/420-eng_devcrypto-add-command-to-dump-driver-info.patch @@ -11,11 +11,9 @@ Reviewed-by: Matthias St. Pierre Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/7585) -diff --git a/crypto/engine/eng_devcrypto.c b/crypto/engine/eng_devcrypto.c -index 5ec38ca8f3..64dc6b891d 100644 --- a/crypto/engine/eng_devcrypto.c +++ b/crypto/engine/eng_devcrypto.c -@@ -50,16 +50,20 @@ static int use_softdrivers = DEVCRYPTO_DEFAULT_USE_SOFDTRIVERS; +@@ -50,16 +50,20 @@ static int use_softdrivers = DEVCRYPTO_D */ struct driver_info_st { enum devcrypto_status_t { @@ -82,7 +80,7 @@ index 5ec38ca8f3..64dc6b891d 100644 #endif /* CIOCGSESSINFO */ } ioctl(cfd, CIOCFSESSION, &sess.ses); -@@ -505,8 +514,11 @@ static void destroy_all_cipher_methods(void) +@@ -505,8 +514,11 @@ static void destroy_all_cipher_methods(v { size_t i; @@ -95,7 +93,7 @@ index 5ec38ca8f3..64dc6b891d 100644 } static int devcrypto_ciphers(ENGINE *e, const EVP_CIPHER **cipher, -@@ -550,6 +562,40 @@ static int cryptodev_select_cipher_cb(const char *str, int len, void *usr) +@@ -550,6 +562,40 @@ static int cryptodev_select_cipher_cb(co return 1; } @@ -190,7 +188,7 @@ index 5ec38ca8f3..64dc6b891d 100644 EVP_MD_meth_free(known_digest_methods[i]); known_digest_methods[i] = NULL; goto finish; -@@ -894,8 +945,11 @@ static void destroy_all_digest_methods(void) +@@ -894,8 +945,11 @@ static void destroy_all_digest_methods(v { size_t i; @@ -203,7 +201,7 @@ index 5ec38ca8f3..64dc6b891d 100644 } static int devcrypto_digests(ENGINE *e, const EVP_MD **digest, -@@ -939,6 +993,43 @@ static int cryptodev_select_digest_cb(const char *str, int len, void *usr) +@@ -939,6 +993,43 @@ static int cryptodev_select_digest_cb(co return 1; } @@ -247,7 +245,7 @@ index 5ec38ca8f3..64dc6b891d 100644 #endif /****************************************************************************** -@@ -983,6 +1074,11 @@ static const ENGINE_CMD_DEFN devcrypto_cmds[] = { +@@ -983,6 +1074,11 @@ static const ENGINE_CMD_DEFN devcrypto_c ENGINE_CMD_FLAG_STRING}, #endif @@ -259,7 +257,7 @@ index 5ec38ca8f3..64dc6b891d 100644 {0, NULL, NULL, 0} }; -@@ -1051,6 +1147,13 @@ static int devcrypto_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void)) +@@ -1051,6 +1147,13 @@ static int devcrypto_ctrl(ENGINE *e, int return 1; #endif /* IMPLEMENT_DIGEST */ diff --git a/package/libs/openssl/patches/430-e_devcrypto-make-the-dev-crypto-engine-dynamic.patch b/package/libs/openssl/patches/430-e_devcrypto-make-the-dev-crypto-engine-dynamic.patch index 0b2f345eef..00c74972ab 100644 --- a/package/libs/openssl/patches/430-e_devcrypto-make-the-dev-crypto-engine-dynamic.patch +++ b/package/libs/openssl/patches/430-e_devcrypto-make-the-dev-crypto-engine-dynamic.patch @@ -8,8 +8,6 @@ engines/e_devcrypto.c. Signed-off-by: Eneas U de Queiroz -diff --git a/crypto/engine/build.info b/crypto/engine/build.info -index e00802a3fd..47fe948966 100644 --- a/crypto/engine/build.info +++ b/crypto/engine/build.info @@ -6,6 +6,3 @@ SOURCE[../../libcrypto]=\ @@ -19,11 +17,9 @@ index e00802a3fd..47fe948966 100644 -IF[{- !$disabled{devcryptoeng} -}] - SOURCE[../../libcrypto]=eng_devcrypto.c -ENDIF -diff --git a/crypto/init.c b/crypto/init.c -index 1b0d523bea..ee3e2eb075 100644 --- a/crypto/init.c +++ b/crypto/init.c -@@ -328,18 +328,6 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_engine_openssl) +@@ -328,18 +328,6 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_engine_ engine_load_openssl_int(); return 1; } @@ -42,7 +38,7 @@ index 1b0d523bea..ee3e2eb075 100644 # ifndef OPENSSL_NO_RDRAND static CRYPTO_ONCE engine_rdrand = CRYPTO_ONCE_STATIC_INIT; -@@ -364,6 +352,18 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_engine_dynamic) +@@ -364,6 +352,18 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_engine_ return 1; } # ifndef OPENSSL_NO_STATIC_ENGINE @@ -61,7 +57,7 @@ index 1b0d523bea..ee3e2eb075 100644 # if !defined(OPENSSL_NO_HW) && !defined(OPENSSL_NO_HW_PADLOCK) static CRYPTO_ONCE engine_padlock = CRYPTO_ONCE_STATIC_INIT; DEFINE_RUN_ONCE_STATIC(ossl_init_engine_padlock) -@@ -704,11 +704,6 @@ int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings) +@@ -704,11 +704,6 @@ int OPENSSL_init_crypto(uint64_t opts, c if ((opts & OPENSSL_INIT_ENGINE_OPENSSL) && !RUN_ONCE(&engine_openssl, ossl_init_engine_openssl)) return 0; @@ -73,7 +69,7 @@ index 1b0d523bea..ee3e2eb075 100644 # ifndef OPENSSL_NO_RDRAND if ((opts & OPENSSL_INIT_ENGINE_RDRAND) && !RUN_ONCE(&engine_rdrand, ossl_init_engine_rdrand)) -@@ -718,6 +713,11 @@ int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings) +@@ -718,6 +713,11 @@ int OPENSSL_init_crypto(uint64_t opts, c && !RUN_ONCE(&engine_dynamic, ossl_init_engine_dynamic)) return 0; # ifndef OPENSSL_NO_STATIC_ENGINE @@ -85,8 +81,6 @@ index 1b0d523bea..ee3e2eb075 100644 # if !defined(OPENSSL_NO_HW) && !defined(OPENSSL_NO_HW_PADLOCK) if ((opts & OPENSSL_INIT_ENGINE_PADLOCK) && !RUN_ONCE(&engine_padlock, ossl_init_engine_padlock)) -diff --git a/engines/build.info b/engines/build.info -index 1db771971c..33a25d7004 100644 --- a/engines/build.info +++ b/engines/build.info @@ -11,6 +11,9 @@ IF[{- !$disabled{"engine"} -}] @@ -112,59 +106,1177 @@ index 1db771971c..33a25d7004 100644 ENGINES_NO_INST=ossltest dasync SOURCE[dasync]=e_dasync.c -diff --git a/crypto/engine/eng_devcrypto.c b/engines/e_devcrypto.c -similarity index 95% -rename from crypto/engine/eng_devcrypto.c -rename to engines/e_devcrypto.c -index 2c1b52d572..eff1ed3a7d 100644 --- a/crypto/engine/eng_devcrypto.c -+++ b/engines/e_devcrypto.c -@@ -7,7 +7,7 @@ - * https://www.openssl.org/source/license.html - */ - ++++ /dev/null +@@ -1,1277 +0,0 @@ +-/* +- * Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved. +- * +- * Licensed under the OpenSSL license (the "License"). You may not use +- * this file except in compliance with the License. You can obtain a copy +- * in the file LICENSE in the source distribution or at +- * https://www.openssl.org/source/license.html +- */ +- -#include "e_os.h" -+#include "../e_os.h" - #include - #include - #include -@@ -31,18 +31,20 @@ - # define CHECK_BSD_STYLE_MACROS - #endif - -+#define engine_devcrypto_id "devcrypto" -+ - /* - * ONE global file descriptor for all sessions. This allows operations - * such as digest session data copying (see digest_copy()), but is also - * saner... why re-open /dev/crypto for every session? - */ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include "crypto/engine.h" +- +-/* #define ENGINE_DEVCRYPTO_DEBUG */ +- +-#if CRYPTO_ALGORITHM_MIN < CRYPTO_ALGORITHM_MAX +-# define CHECK_BSD_STYLE_MACROS +-#endif +- +-/* +- * ONE global file descriptor for all sessions. This allows operations +- * such as digest session data copying (see digest_copy()), but is also +- * saner... why re-open /dev/crypto for every session? +- */ -static int cfd; -+static int cfd = -1; - #define DEVCRYPTO_REQUIRE_ACCELERATED 0 /* require confirmation of acceleration */ - #define DEVCRYPTO_USE_SOFTWARE 1 /* allow software drivers */ - #define DEVCRYPTO_REJECT_SOFTWARE 2 /* only disallow confirmed software drivers */ - +-#define DEVCRYPTO_REQUIRE_ACCELERATED 0 /* require confirmation of acceleration */ +-#define DEVCRYPTO_USE_SOFTWARE 1 /* allow software drivers */ +-#define DEVCRYPTO_REJECT_SOFTWARE 2 /* only disallow confirmed software drivers */ +- -#define DEVCRYPTO_DEFAULT_USE_SOFDTRIVERS DEVCRYPTO_REJECT_SOFTWARE -static int use_softdrivers = DEVCRYPTO_DEFAULT_USE_SOFDTRIVERS; -+#define DEVCRYPTO_DEFAULT_USE_SOFTDRIVERS DEVCRYPTO_REJECT_SOFTWARE -+static int use_softdrivers = DEVCRYPTO_DEFAULT_USE_SOFTDRIVERS; - - /* - * cipher/digest status & acceleration definitions -@@ -1058,7 +1060,7 @@ static const ENGINE_CMD_DEFN devcrypto_cmds[] = { - OPENSSL_MSTR(DEVCRYPTO_USE_SOFTWARE) "=allow all drivers, " - OPENSSL_MSTR(DEVCRYPTO_REJECT_SOFTWARE) - "=use if acceleration can't be determined) [default=" +- +-/* +- * cipher/digest status & acceleration definitions +- * Make sure the defaults are set to 0 +- */ +-struct driver_info_st { +- enum devcrypto_status_t { +- DEVCRYPTO_STATUS_FAILURE = -3, /* unusable for other reason */ +- DEVCRYPTO_STATUS_NO_CIOCCPHASH = -2, /* hash state copy not supported */ +- DEVCRYPTO_STATUS_NO_CIOCGSESSION = -1, /* session open failed */ +- DEVCRYPTO_STATUS_UNKNOWN = 0, /* not tested yet */ +- DEVCRYPTO_STATUS_USABLE = 1 /* algo can be used */ +- } status; +- +- enum devcrypto_accelerated_t { +- DEVCRYPTO_NOT_ACCELERATED = -1, /* software implemented */ +- DEVCRYPTO_ACCELERATION_UNKNOWN = 0, /* acceleration support unkown */ +- DEVCRYPTO_ACCELERATED = 1 /* hardware accelerated */ +- } accelerated; +- +- char *driver_name; +-}; +- +-static int clean_devcrypto_session(struct session_op *sess) { +- if (ioctl(cfd, CIOCFSESSION, &sess->ses) < 0) { +- SYSerr(SYS_F_IOCTL, errno); +- return 0; +- } +- memset(sess, 0, sizeof(struct session_op)); +- return 1; +-} +- +-/****************************************************************************** +- * +- * Ciphers +- * +- * Because they all do the same basic operation, we have only one set of +- * method functions for them all to share, and a mapping table between +- * NIDs and cryptodev IDs, with all the necessary size data. +- * +- *****/ +- +-struct cipher_ctx { +- struct session_op sess; +- int op; /* COP_ENCRYPT or COP_DECRYPT */ +- unsigned long mode; /* EVP_CIPH_*_MODE */ +- +- /* to handle ctr mode being a stream cipher */ +- unsigned char partial[EVP_MAX_BLOCK_LENGTH]; +- unsigned int blocksize, num; +-}; +- +-static const struct cipher_data_st { +- int nid; +- int blocksize; +- int keylen; +- int ivlen; +- int flags; +- int devcryptoid; +-} cipher_data[] = { +-#ifndef OPENSSL_NO_DES +- { NID_des_cbc, 8, 8, 8, EVP_CIPH_CBC_MODE, CRYPTO_DES_CBC }, +- { NID_des_ede3_cbc, 8, 24, 8, EVP_CIPH_CBC_MODE, CRYPTO_3DES_CBC }, +-#endif +-#ifndef OPENSSL_NO_BF +- { NID_bf_cbc, 8, 16, 8, EVP_CIPH_CBC_MODE, CRYPTO_BLF_CBC }, +-#endif +-#ifndef OPENSSL_NO_CAST +- { NID_cast5_cbc, 8, 16, 8, EVP_CIPH_CBC_MODE, CRYPTO_CAST_CBC }, +-#endif +- { NID_aes_128_cbc, 16, 128 / 8, 16, EVP_CIPH_CBC_MODE, CRYPTO_AES_CBC }, +- { NID_aes_192_cbc, 16, 192 / 8, 16, EVP_CIPH_CBC_MODE, CRYPTO_AES_CBC }, +- { NID_aes_256_cbc, 16, 256 / 8, 16, EVP_CIPH_CBC_MODE, CRYPTO_AES_CBC }, +-#ifndef OPENSSL_NO_RC4 +- { NID_rc4, 1, 16, 0, EVP_CIPH_STREAM_CIPHER, CRYPTO_ARC4 }, +-#endif +-#if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_AES_CTR) +- { NID_aes_128_ctr, 16, 128 / 8, 16, EVP_CIPH_CTR_MODE, CRYPTO_AES_CTR }, +- { NID_aes_192_ctr, 16, 192 / 8, 16, EVP_CIPH_CTR_MODE, CRYPTO_AES_CTR }, +- { NID_aes_256_ctr, 16, 256 / 8, 16, EVP_CIPH_CTR_MODE, CRYPTO_AES_CTR }, +-#endif +-#if 0 /* Not yet supported */ +- { NID_aes_128_xts, 16, 128 / 8 * 2, 16, EVP_CIPH_XTS_MODE, CRYPTO_AES_XTS }, +- { NID_aes_256_xts, 16, 256 / 8 * 2, 16, EVP_CIPH_XTS_MODE, CRYPTO_AES_XTS }, +-#endif +-#if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_AES_ECB) +- { NID_aes_128_ecb, 16, 128 / 8, 0, EVP_CIPH_ECB_MODE, CRYPTO_AES_ECB }, +- { NID_aes_192_ecb, 16, 192 / 8, 0, EVP_CIPH_ECB_MODE, CRYPTO_AES_ECB }, +- { NID_aes_256_ecb, 16, 256 / 8, 0, EVP_CIPH_ECB_MODE, CRYPTO_AES_ECB }, +-#endif +-#if 0 /* Not yet supported */ +- { NID_aes_128_gcm, 16, 128 / 8, 16, EVP_CIPH_GCM_MODE, CRYPTO_AES_GCM }, +- { NID_aes_192_gcm, 16, 192 / 8, 16, EVP_CIPH_GCM_MODE, CRYPTO_AES_GCM }, +- { NID_aes_256_gcm, 16, 256 / 8, 16, EVP_CIPH_GCM_MODE, CRYPTO_AES_GCM }, +-#endif +-#ifndef OPENSSL_NO_CAMELLIA +- { NID_camellia_128_cbc, 16, 128 / 8, 16, EVP_CIPH_CBC_MODE, +- CRYPTO_CAMELLIA_CBC }, +- { NID_camellia_192_cbc, 16, 192 / 8, 16, EVP_CIPH_CBC_MODE, +- CRYPTO_CAMELLIA_CBC }, +- { NID_camellia_256_cbc, 16, 256 / 8, 16, EVP_CIPH_CBC_MODE, +- CRYPTO_CAMELLIA_CBC }, +-#endif +-}; +- +-static size_t find_cipher_data_index(int nid) +-{ +- size_t i; +- +- for (i = 0; i < OSSL_NELEM(cipher_data); i++) +- if (nid == cipher_data[i].nid) +- return i; +- return (size_t)-1; +-} +- +-static size_t get_cipher_data_index(int nid) +-{ +- size_t i = find_cipher_data_index(nid); +- +- if (i != (size_t)-1) +- return i; +- +- /* +- * Code further down must make sure that only NIDs in the table above +- * are used. If any other NID reaches this function, there's a grave +- * coding error further down. +- */ +- assert("Code that never should be reached" == NULL); +- return -1; +-} +- +-static const struct cipher_data_st *get_cipher_data(int nid) +-{ +- return &cipher_data[get_cipher_data_index(nid)]; +-} +- +-/* +- * Following are the three necessary functions to map OpenSSL functionality +- * with cryptodev. +- */ +- +-static int cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, +- const unsigned char *iv, int enc) +-{ +- struct cipher_ctx *cipher_ctx = +- (struct cipher_ctx *)EVP_CIPHER_CTX_get_cipher_data(ctx); +- const struct cipher_data_st *cipher_d = +- get_cipher_data(EVP_CIPHER_CTX_nid(ctx)); +- +- /* cleanup a previous session */ +- if (cipher_ctx->sess.ses != 0 && +- clean_devcrypto_session(&cipher_ctx->sess) == 0) +- return 0; +- +- cipher_ctx->sess.cipher = cipher_d->devcryptoid; +- cipher_ctx->sess.keylen = cipher_d->keylen; +- cipher_ctx->sess.key = (void *)key; +- cipher_ctx->op = enc ? COP_ENCRYPT : COP_DECRYPT; +- cipher_ctx->mode = cipher_d->flags & EVP_CIPH_MODE; +- cipher_ctx->blocksize = cipher_d->blocksize; +- if (ioctl(cfd, CIOCGSESSION, &cipher_ctx->sess) < 0) { +- SYSerr(SYS_F_IOCTL, errno); +- return 0; +- } +- +- return 1; +-} +- +-static int cipher_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +- const unsigned char *in, size_t inl) +-{ +- struct cipher_ctx *cipher_ctx = +- (struct cipher_ctx *)EVP_CIPHER_CTX_get_cipher_data(ctx); +- struct crypt_op cryp; +- unsigned char *iv = EVP_CIPHER_CTX_iv_noconst(ctx); +-#if !defined(COP_FLAG_WRITE_IV) +- unsigned char saved_iv[EVP_MAX_IV_LENGTH]; +- const unsigned char *ivptr; +- size_t nblocks, ivlen; +-#endif +- +- memset(&cryp, 0, sizeof(cryp)); +- cryp.ses = cipher_ctx->sess.ses; +- cryp.len = inl; +- cryp.src = (void *)in; +- cryp.dst = (void *)out; +- cryp.iv = (void *)iv; +- cryp.op = cipher_ctx->op; +-#if !defined(COP_FLAG_WRITE_IV) +- cryp.flags = 0; +- +- ivlen = EVP_CIPHER_CTX_iv_length(ctx); +- if (ivlen > 0) +- switch (cipher_ctx->mode) { +- case EVP_CIPH_CBC_MODE: +- assert(inl >= ivlen); +- if (!EVP_CIPHER_CTX_encrypting(ctx)) { +- ivptr = in + inl - ivlen; +- memcpy(saved_iv, ivptr, ivlen); +- } +- break; +- +- case EVP_CIPH_CTR_MODE: +- break; +- +- default: /* should not happen */ +- return 0; +- } +-#else +- cryp.flags = COP_FLAG_WRITE_IV; +-#endif +- +- if (ioctl(cfd, CIOCCRYPT, &cryp) < 0) { +- SYSerr(SYS_F_IOCTL, errno); +- return 0; +- } +- +-#if !defined(COP_FLAG_WRITE_IV) +- if (ivlen > 0) +- switch (cipher_ctx->mode) { +- case EVP_CIPH_CBC_MODE: +- assert(inl >= ivlen); +- if (EVP_CIPHER_CTX_encrypting(ctx)) +- ivptr = out + inl - ivlen; +- else +- ivptr = saved_iv; +- +- memcpy(iv, ivptr, ivlen); +- break; +- +- case EVP_CIPH_CTR_MODE: +- nblocks = (inl + cipher_ctx->blocksize - 1) +- / cipher_ctx->blocksize; +- do { +- ivlen--; +- nblocks += iv[ivlen]; +- iv[ivlen] = (uint8_t) nblocks; +- nblocks >>= 8; +- } while (ivlen); +- break; +- +- default: /* should not happen */ +- return 0; +- } +-#endif +- +- return 1; +-} +- +-static int ctr_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +- const unsigned char *in, size_t inl) +-{ +- struct cipher_ctx *cipher_ctx = +- (struct cipher_ctx *)EVP_CIPHER_CTX_get_cipher_data(ctx); +- size_t nblocks, len; +- +- /* initial partial block */ +- while (cipher_ctx->num && inl) { +- (*out++) = *(in++) ^ cipher_ctx->partial[cipher_ctx->num]; +- --inl; +- cipher_ctx->num = (cipher_ctx->num + 1) % cipher_ctx->blocksize; +- } +- +- /* full blocks */ +- if (inl > (unsigned int) cipher_ctx->blocksize) { +- nblocks = inl/cipher_ctx->blocksize; +- len = nblocks * cipher_ctx->blocksize; +- if (cipher_do_cipher(ctx, out, in, len) < 1) +- return 0; +- inl -= len; +- out += len; +- in += len; +- } +- +- /* final partial block */ +- if (inl) { +- memset(cipher_ctx->partial, 0, cipher_ctx->blocksize); +- if (cipher_do_cipher(ctx, cipher_ctx->partial, cipher_ctx->partial, +- cipher_ctx->blocksize) < 1) +- return 0; +- while (inl--) { +- out[cipher_ctx->num] = in[cipher_ctx->num] +- ^ cipher_ctx->partial[cipher_ctx->num]; +- cipher_ctx->num++; +- } +- } +- +- return 1; +-} +- +-static int cipher_ctrl(EVP_CIPHER_CTX *ctx, int type, int p1, void* p2) +-{ +- struct cipher_ctx *cipher_ctx = +- (struct cipher_ctx *)EVP_CIPHER_CTX_get_cipher_data(ctx); +- EVP_CIPHER_CTX *to_ctx = (EVP_CIPHER_CTX *)p2; +- struct cipher_ctx *to_cipher_ctx; +- +- switch (type) { +- case EVP_CTRL_COPY: +- if (cipher_ctx == NULL) +- return 1; +- /* when copying the context, a new session needs to be initialized */ +- to_cipher_ctx = +- (struct cipher_ctx *)EVP_CIPHER_CTX_get_cipher_data(to_ctx); +- memset(&to_cipher_ctx->sess, 0, sizeof(to_cipher_ctx->sess)); +- return cipher_init(to_ctx, cipher_ctx->sess.key, EVP_CIPHER_CTX_iv(ctx), +- (cipher_ctx->op == COP_ENCRYPT)); +- +- case EVP_CTRL_INIT: +- memset(&cipher_ctx->sess, 0, sizeof(cipher_ctx->sess)); +- return 1; +- +- default: +- break; +- } +- +- return -1; +-} +- +-static int cipher_cleanup(EVP_CIPHER_CTX *ctx) +-{ +- struct cipher_ctx *cipher_ctx = +- (struct cipher_ctx *)EVP_CIPHER_CTX_get_cipher_data(ctx); +- +- return clean_devcrypto_session(&cipher_ctx->sess); +-} +- +-/* +- * Keep tables of known nids, associated methods, selected ciphers, and driver +- * info. +- * Note that known_cipher_nids[] isn't necessarily indexed the same way as +- * cipher_data[] above, which the other tables are. +- */ +-static int known_cipher_nids[OSSL_NELEM(cipher_data)]; +-static int known_cipher_nids_amount = -1; /* -1 indicates not yet initialised */ +-static EVP_CIPHER *known_cipher_methods[OSSL_NELEM(cipher_data)] = { NULL, }; +-static int selected_ciphers[OSSL_NELEM(cipher_data)]; +-static struct driver_info_st cipher_driver_info[OSSL_NELEM(cipher_data)]; +- +- +-static int devcrypto_test_cipher(size_t cipher_data_index) +-{ +- return (cipher_driver_info[cipher_data_index].status == DEVCRYPTO_STATUS_USABLE +- && selected_ciphers[cipher_data_index] == 1 +- && (cipher_driver_info[cipher_data_index].accelerated +- == DEVCRYPTO_ACCELERATED +- || use_softdrivers == DEVCRYPTO_USE_SOFTWARE +- || (cipher_driver_info[cipher_data_index].accelerated +- != DEVCRYPTO_NOT_ACCELERATED +- && use_softdrivers == DEVCRYPTO_REJECT_SOFTWARE))); +-} +- +-static void prepare_cipher_methods(void) +-{ +- size_t i; +- struct session_op sess; +- unsigned long cipher_mode; +-#ifdef CIOCGSESSINFO +- struct session_info_op siop; +-#endif +- +- memset(&cipher_driver_info, 0, sizeof(cipher_driver_info)); +- +- memset(&sess, 0, sizeof(sess)); +- sess.key = (void *)"01234567890123456789012345678901234567890123456789"; +- +- for (i = 0, known_cipher_nids_amount = 0; +- i < OSSL_NELEM(cipher_data); i++) { +- +- selected_ciphers[i] = 1; +- /* +- * Check that the cipher is usable +- */ +- sess.cipher = cipher_data[i].devcryptoid; +- sess.keylen = cipher_data[i].keylen; +- if (ioctl(cfd, CIOCGSESSION, &sess) < 0) { +- cipher_driver_info[i].status = DEVCRYPTO_STATUS_NO_CIOCGSESSION; +- continue; +- } +- +- cipher_mode = cipher_data[i].flags & EVP_CIPH_MODE; +- +- if ((known_cipher_methods[i] = +- EVP_CIPHER_meth_new(cipher_data[i].nid, +- cipher_mode == EVP_CIPH_CTR_MODE ? 1 : +- cipher_data[i].blocksize, +- cipher_data[i].keylen)) == NULL +- || !EVP_CIPHER_meth_set_iv_length(known_cipher_methods[i], +- cipher_data[i].ivlen) +- || !EVP_CIPHER_meth_set_flags(known_cipher_methods[i], +- cipher_data[i].flags +- | EVP_CIPH_CUSTOM_COPY +- | EVP_CIPH_CTRL_INIT +- | EVP_CIPH_FLAG_DEFAULT_ASN1) +- || !EVP_CIPHER_meth_set_init(known_cipher_methods[i], cipher_init) +- || !EVP_CIPHER_meth_set_do_cipher(known_cipher_methods[i], +- cipher_mode == EVP_CIPH_CTR_MODE ? +- ctr_do_cipher : +- cipher_do_cipher) +- || !EVP_CIPHER_meth_set_ctrl(known_cipher_methods[i], cipher_ctrl) +- || !EVP_CIPHER_meth_set_cleanup(known_cipher_methods[i], +- cipher_cleanup) +- || !EVP_CIPHER_meth_set_impl_ctx_size(known_cipher_methods[i], +- sizeof(struct cipher_ctx))) { +- cipher_driver_info[i].status = DEVCRYPTO_STATUS_FAILURE; +- EVP_CIPHER_meth_free(known_cipher_methods[i]); +- known_cipher_methods[i] = NULL; +- } else { +- cipher_driver_info[i].status = DEVCRYPTO_STATUS_USABLE; +-#ifdef CIOCGSESSINFO +- siop.ses = sess.ses; +- if (ioctl(cfd, CIOCGSESSINFO, &siop) < 0) { +- cipher_driver_info[i].accelerated = DEVCRYPTO_ACCELERATION_UNKNOWN; +- } else { +- cipher_driver_info[i].driver_name = +- OPENSSL_strndup(siop.cipher_info.cra_driver_name, +- CRYPTODEV_MAX_ALG_NAME); +- if (!(siop.flags & SIOP_FLAG_KERNEL_DRIVER_ONLY)) +- cipher_driver_info[i].accelerated = DEVCRYPTO_NOT_ACCELERATED; +- else +- cipher_driver_info[i].accelerated = DEVCRYPTO_ACCELERATED; +- } +-#endif /* CIOCGSESSINFO */ +- } +- ioctl(cfd, CIOCFSESSION, &sess.ses); +- if (devcrypto_test_cipher(i)) { +- known_cipher_nids[known_cipher_nids_amount++] = +- cipher_data[i].nid; +- } +- } +-} +- +-static void rebuild_known_cipher_nids(ENGINE *e) +-{ +- size_t i; +- +- for (i = 0, known_cipher_nids_amount = 0; i < OSSL_NELEM(cipher_data); i++) { +- if (devcrypto_test_cipher(i)) +- known_cipher_nids[known_cipher_nids_amount++] = cipher_data[i].nid; +- } +- ENGINE_unregister_ciphers(e); +- ENGINE_register_ciphers(e); +-} +- +-static const EVP_CIPHER *get_cipher_method(int nid) +-{ +- size_t i = get_cipher_data_index(nid); +- +- if (i == (size_t)-1) +- return NULL; +- return known_cipher_methods[i]; +-} +- +-static int get_cipher_nids(const int **nids) +-{ +- *nids = known_cipher_nids; +- return known_cipher_nids_amount; +-} +- +-static void destroy_cipher_method(int nid) +-{ +- size_t i = get_cipher_data_index(nid); +- +- EVP_CIPHER_meth_free(known_cipher_methods[i]); +- known_cipher_methods[i] = NULL; +-} +- +-static void destroy_all_cipher_methods(void) +-{ +- size_t i; +- +- for (i = 0; i < OSSL_NELEM(cipher_data); i++) { +- destroy_cipher_method(cipher_data[i].nid); +- OPENSSL_free(cipher_driver_info[i].driver_name); +- cipher_driver_info[i].driver_name = NULL; +- } +-} +- +-static int devcrypto_ciphers(ENGINE *e, const EVP_CIPHER **cipher, +- const int **nids, int nid) +-{ +- if (cipher == NULL) +- return get_cipher_nids(nids); +- +- *cipher = get_cipher_method(nid); +- +- return *cipher != NULL; +-} +- +-static void devcrypto_select_all_ciphers(int *cipher_list) +-{ +- size_t i; +- +- for (i = 0; i < OSSL_NELEM(cipher_data); i++) +- cipher_list[i] = 1; +-} +- +-static int cryptodev_select_cipher_cb(const char *str, int len, void *usr) +-{ +- int *cipher_list = (int *)usr; +- char *name; +- const EVP_CIPHER *EVP; +- size_t i; +- +- if (len == 0) +- return 1; +- if (usr == NULL || (name = OPENSSL_strndup(str, len)) == NULL) +- return 0; +- EVP = EVP_get_cipherbyname(name); +- if (EVP == NULL) +- fprintf(stderr, "devcrypto: unknown cipher %s\n", name); +- else if ((i = find_cipher_data_index(EVP_CIPHER_nid(EVP))) != (size_t)-1) +- cipher_list[i] = 1; +- else +- fprintf(stderr, "devcrypto: cipher %s not available\n", name); +- OPENSSL_free(name); +- return 1; +-} +- +-static void dump_cipher_info(void) +-{ +- size_t i; +- const char *name; +- +- fprintf (stderr, "Information about ciphers supported by the /dev/crypto" +- " engine:\n"); +-#ifndef CIOCGSESSINFO +- fprintf(stderr, "CIOCGSESSINFO (session info call) unavailable\n"); +-#endif +- for (i = 0; i < OSSL_NELEM(cipher_data); i++) { +- name = OBJ_nid2sn(cipher_data[i].nid); +- fprintf (stderr, "Cipher %s, NID=%d, /dev/crypto info: id=%d, ", +- name ? name : "unknown", cipher_data[i].nid, +- cipher_data[i].devcryptoid); +- if (cipher_driver_info[i].status == DEVCRYPTO_STATUS_NO_CIOCGSESSION ) { +- fprintf (stderr, "CIOCGSESSION (session open call) failed\n"); +- continue; +- } +- fprintf (stderr, "driver=%s ", cipher_driver_info[i].driver_name ? +- cipher_driver_info[i].driver_name : "unknown"); +- if (cipher_driver_info[i].accelerated == DEVCRYPTO_ACCELERATED) +- fprintf(stderr, "(hw accelerated)"); +- else if (cipher_driver_info[i].accelerated == DEVCRYPTO_NOT_ACCELERATED) +- fprintf(stderr, "(software)"); +- else +- fprintf(stderr, "(acceleration status unknown)"); +- if (cipher_driver_info[i].status == DEVCRYPTO_STATUS_FAILURE) +- fprintf (stderr, ". Cipher setup failed"); +- fprintf(stderr, "\n"); +- } +- fprintf(stderr, "\n"); +-} +- +-/* +- * We only support digests if the cryptodev implementation supports multiple +- * data updates and session copying. Otherwise, we would be forced to maintain +- * a cache, which is perilous if there's a lot of data coming in (if someone +- * wants to checksum an OpenSSL tarball, for example). +- */ +-#if defined(CIOCCPHASH) && defined(COP_FLAG_UPDATE) && defined(COP_FLAG_FINAL) +-#define IMPLEMENT_DIGEST +- +-/****************************************************************************** +- * +- * Digests +- * +- * Because they all do the same basic operation, we have only one set of +- * method functions for them all to share, and a mapping table between +- * NIDs and cryptodev IDs, with all the necessary size data. +- * +- *****/ +- +-struct digest_ctx { +- struct session_op sess; +- /* This signals that the init function was called, not that it succeeded. */ +- int init_called; +- unsigned char digest_res[HASH_MAX_LEN]; +-}; +- +-static const struct digest_data_st { +- int nid; +- int blocksize; +- int digestlen; +- int devcryptoid; +-} digest_data[] = { +-#ifndef OPENSSL_NO_MD5 +- { NID_md5, /* MD5_CBLOCK */ 64, 16, CRYPTO_MD5 }, +-#endif +- { NID_sha1, SHA_CBLOCK, 20, CRYPTO_SHA1 }, +-#ifndef OPENSSL_NO_RMD160 +-# if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_RIPEMD160) +- { NID_ripemd160, /* RIPEMD160_CBLOCK */ 64, 20, CRYPTO_RIPEMD160 }, +-# endif +-#endif +-#if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_SHA2_224) +- { NID_sha224, SHA256_CBLOCK, 224 / 8, CRYPTO_SHA2_224 }, +-#endif +-#if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_SHA2_256) +- { NID_sha256, SHA256_CBLOCK, 256 / 8, CRYPTO_SHA2_256 }, +-#endif +-#if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_SHA2_384) +- { NID_sha384, SHA512_CBLOCK, 384 / 8, CRYPTO_SHA2_384 }, +-#endif +-#if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_SHA2_512) +- { NID_sha512, SHA512_CBLOCK, 512 / 8, CRYPTO_SHA2_512 }, +-#endif +-}; +- +-static size_t find_digest_data_index(int nid) +-{ +- size_t i; +- +- for (i = 0; i < OSSL_NELEM(digest_data); i++) +- if (nid == digest_data[i].nid) +- return i; +- return (size_t)-1; +-} +- +-static size_t get_digest_data_index(int nid) +-{ +- size_t i = find_digest_data_index(nid); +- +- if (i != (size_t)-1) +- return i; +- +- /* +- * Code further down must make sure that only NIDs in the table above +- * are used. If any other NID reaches this function, there's a grave +- * coding error further down. +- */ +- assert("Code that never should be reached" == NULL); +- return -1; +-} +- +-static const struct digest_data_st *get_digest_data(int nid) +-{ +- return &digest_data[get_digest_data_index(nid)]; +-} +- +-/* +- * Following are the five necessary functions to map OpenSSL functionality +- * with cryptodev: init, update, final, cleanup, and copy. +- */ +- +-static int digest_init(EVP_MD_CTX *ctx) +-{ +- struct digest_ctx *digest_ctx = +- (struct digest_ctx *)EVP_MD_CTX_md_data(ctx); +- const struct digest_data_st *digest_d = +- get_digest_data(EVP_MD_CTX_type(ctx)); +- +- digest_ctx->init_called = 1; +- +- memset(&digest_ctx->sess, 0, sizeof(digest_ctx->sess)); +- digest_ctx->sess.mac = digest_d->devcryptoid; +- if (ioctl(cfd, CIOCGSESSION, &digest_ctx->sess) < 0) { +- SYSerr(SYS_F_IOCTL, errno); +- return 0; +- } +- +- return 1; +-} +- +-static int digest_op(struct digest_ctx *ctx, const void *src, size_t srclen, +- void *res, unsigned int flags) +-{ +- struct crypt_op cryp; +- +- memset(&cryp, 0, sizeof(cryp)); +- cryp.ses = ctx->sess.ses; +- cryp.len = srclen; +- cryp.src = (void *)src; +- cryp.dst = NULL; +- cryp.mac = res; +- cryp.flags = flags; +- return ioctl(cfd, CIOCCRYPT, &cryp); +-} +- +-static int digest_update(EVP_MD_CTX *ctx, const void *data, size_t count) +-{ +- struct digest_ctx *digest_ctx = +- (struct digest_ctx *)EVP_MD_CTX_md_data(ctx); +- +- if (count == 0) +- return 1; +- +- if (digest_ctx == NULL) +- return 0; +- +- if (EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_ONESHOT)) { +- if (digest_op(digest_ctx, data, count, digest_ctx->digest_res, 0) >= 0) +- return 1; +- } else if (digest_op(digest_ctx, data, count, NULL, COP_FLAG_UPDATE) >= 0) { +- return 1; +- } +- +- SYSerr(SYS_F_IOCTL, errno); +- return 0; +-} +- +-static int digest_final(EVP_MD_CTX *ctx, unsigned char *md) +-{ +- struct digest_ctx *digest_ctx = +- (struct digest_ctx *)EVP_MD_CTX_md_data(ctx); +- +- if (md == NULL || digest_ctx == NULL) +- return 0; +- +- if (EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_ONESHOT)) { +- memcpy(md, digest_ctx->digest_res, EVP_MD_CTX_size(ctx)); +- } else if (digest_op(digest_ctx, NULL, 0, md, COP_FLAG_FINAL) < 0) { +- SYSerr(SYS_F_IOCTL, errno); +- return 0; +- } +- +- return 1; +-} +- +-static int digest_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from) +-{ +- struct digest_ctx *digest_from = +- (struct digest_ctx *)EVP_MD_CTX_md_data(from); +- struct digest_ctx *digest_to = +- (struct digest_ctx *)EVP_MD_CTX_md_data(to); +- struct cphash_op cphash; +- +- if (digest_from == NULL || digest_from->init_called != 1) +- return 1; +- +- if (!digest_init(to)) { +- SYSerr(SYS_F_IOCTL, errno); +- return 0; +- } +- +- cphash.src_ses = digest_from->sess.ses; +- cphash.dst_ses = digest_to->sess.ses; +- if (ioctl(cfd, CIOCCPHASH, &cphash) < 0) { +- SYSerr(SYS_F_IOCTL, errno); +- return 0; +- } +- return 1; +-} +- +-static int digest_cleanup(EVP_MD_CTX *ctx) +-{ +- struct digest_ctx *digest_ctx = +- (struct digest_ctx *)EVP_MD_CTX_md_data(ctx); +- +- if (digest_ctx == NULL) +- return 1; +- +- return clean_devcrypto_session(&digest_ctx->sess); +-} +- +-/* +- * Keep tables of known nids, associated methods, selected digests, and +- * driver info. +- * Note that known_digest_nids[] isn't necessarily indexed the same way as +- * digest_data[] above, which the other tables are. +- */ +-static int known_digest_nids[OSSL_NELEM(digest_data)]; +-static int known_digest_nids_amount = -1; /* -1 indicates not yet initialised */ +-static EVP_MD *known_digest_methods[OSSL_NELEM(digest_data)] = { NULL, }; +-static int selected_digests[OSSL_NELEM(digest_data)]; +-static struct driver_info_st digest_driver_info[OSSL_NELEM(digest_data)]; +- +-static int devcrypto_test_digest(size_t digest_data_index) +-{ +- return (digest_driver_info[digest_data_index].status == DEVCRYPTO_STATUS_USABLE +- && selected_digests[digest_data_index] == 1 +- && (digest_driver_info[digest_data_index].accelerated +- == DEVCRYPTO_ACCELERATED +- || use_softdrivers == DEVCRYPTO_USE_SOFTWARE +- || (digest_driver_info[digest_data_index].accelerated +- != DEVCRYPTO_NOT_ACCELERATED +- && use_softdrivers == DEVCRYPTO_REJECT_SOFTWARE))); +-} +- +-static void rebuild_known_digest_nids(ENGINE *e) +-{ +- size_t i; +- +- for (i = 0, known_digest_nids_amount = 0; i < OSSL_NELEM(digest_data); i++) { +- if (devcrypto_test_digest(i)) +- known_digest_nids[known_digest_nids_amount++] = digest_data[i].nid; +- } +- ENGINE_unregister_digests(e); +- ENGINE_register_digests(e); +-} +- +-static void prepare_digest_methods(void) +-{ +- size_t i; +- struct session_op sess1, sess2; +-#ifdef CIOCGSESSINFO +- struct session_info_op siop; +-#endif +- struct cphash_op cphash; +- +- memset(&digest_driver_info, 0, sizeof(digest_driver_info)); +- +- memset(&sess1, 0, sizeof(sess1)); +- memset(&sess2, 0, sizeof(sess2)); +- +- for (i = 0, known_digest_nids_amount = 0; i < OSSL_NELEM(digest_data); +- i++) { +- +- selected_digests[i] = 1; +- +- /* +- * Check that the digest is usable +- */ +- sess1.mac = digest_data[i].devcryptoid; +- sess2.ses = 0; +- if (ioctl(cfd, CIOCGSESSION, &sess1) < 0) { +- digest_driver_info[i].status = DEVCRYPTO_STATUS_NO_CIOCGSESSION; +- goto finish; +- } +- +-#ifdef CIOCGSESSINFO +- /* gather hardware acceleration info from the driver */ +- siop.ses = sess1.ses; +- if (ioctl(cfd, CIOCGSESSINFO, &siop) < 0) { +- digest_driver_info[i].accelerated = DEVCRYPTO_ACCELERATION_UNKNOWN; +- } else { +- digest_driver_info[i].driver_name = +- OPENSSL_strndup(siop.hash_info.cra_driver_name, +- CRYPTODEV_MAX_ALG_NAME); +- if (siop.flags & SIOP_FLAG_KERNEL_DRIVER_ONLY) +- digest_driver_info[i].accelerated = DEVCRYPTO_ACCELERATED; +- else +- digest_driver_info[i].accelerated = DEVCRYPTO_NOT_ACCELERATED; +- } +-#endif +- +- /* digest must be capable of hash state copy */ +- sess2.mac = sess1.mac; +- if (ioctl(cfd, CIOCGSESSION, &sess2) < 0) { +- digest_driver_info[i].status = DEVCRYPTO_STATUS_FAILURE; +- goto finish; +- } +- cphash.src_ses = sess1.ses; +- cphash.dst_ses = sess2.ses; +- if (ioctl(cfd, CIOCCPHASH, &cphash) < 0) { +- digest_driver_info[i].status = DEVCRYPTO_STATUS_NO_CIOCCPHASH; +- goto finish; +- } +- if ((known_digest_methods[i] = EVP_MD_meth_new(digest_data[i].nid, +- NID_undef)) == NULL +- || !EVP_MD_meth_set_input_blocksize(known_digest_methods[i], +- digest_data[i].blocksize) +- || !EVP_MD_meth_set_result_size(known_digest_methods[i], +- digest_data[i].digestlen) +- || !EVP_MD_meth_set_init(known_digest_methods[i], digest_init) +- || !EVP_MD_meth_set_update(known_digest_methods[i], digest_update) +- || !EVP_MD_meth_set_final(known_digest_methods[i], digest_final) +- || !EVP_MD_meth_set_copy(known_digest_methods[i], digest_copy) +- || !EVP_MD_meth_set_cleanup(known_digest_methods[i], digest_cleanup) +- || !EVP_MD_meth_set_app_datasize(known_digest_methods[i], +- sizeof(struct digest_ctx))) { +- digest_driver_info[i].status = DEVCRYPTO_STATUS_FAILURE; +- EVP_MD_meth_free(known_digest_methods[i]); +- known_digest_methods[i] = NULL; +- goto finish; +- } +- digest_driver_info[i].status = DEVCRYPTO_STATUS_USABLE; +-finish: +- ioctl(cfd, CIOCFSESSION, &sess1.ses); +- if (sess2.ses != 0) +- ioctl(cfd, CIOCFSESSION, &sess2.ses); +- if (devcrypto_test_digest(i)) +- known_digest_nids[known_digest_nids_amount++] = digest_data[i].nid; +- } +-} +- +-static const EVP_MD *get_digest_method(int nid) +-{ +- size_t i = get_digest_data_index(nid); +- +- if (i == (size_t)-1) +- return NULL; +- return known_digest_methods[i]; +-} +- +-static int get_digest_nids(const int **nids) +-{ +- *nids = known_digest_nids; +- return known_digest_nids_amount; +-} +- +-static void destroy_digest_method(int nid) +-{ +- size_t i = get_digest_data_index(nid); +- +- EVP_MD_meth_free(known_digest_methods[i]); +- known_digest_methods[i] = NULL; +-} +- +-static void destroy_all_digest_methods(void) +-{ +- size_t i; +- +- for (i = 0; i < OSSL_NELEM(digest_data); i++) { +- destroy_digest_method(digest_data[i].nid); +- OPENSSL_free(digest_driver_info[i].driver_name); +- digest_driver_info[i].driver_name = NULL; +- } +-} +- +-static int devcrypto_digests(ENGINE *e, const EVP_MD **digest, +- const int **nids, int nid) +-{ +- if (digest == NULL) +- return get_digest_nids(nids); +- +- *digest = get_digest_method(nid); +- +- return *digest != NULL; +-} +- +-static void devcrypto_select_all_digests(int *digest_list) +-{ +- size_t i; +- +- for (i = 0; i < OSSL_NELEM(digest_data); i++) +- digest_list[i] = 1; +-} +- +-static int cryptodev_select_digest_cb(const char *str, int len, void *usr) +-{ +- int *digest_list = (int *)usr; +- char *name; +- const EVP_MD *EVP; +- size_t i; +- +- if (len == 0) +- return 1; +- if (usr == NULL || (name = OPENSSL_strndup(str, len)) == NULL) +- return 0; +- EVP = EVP_get_digestbyname(name); +- if (EVP == NULL) +- fprintf(stderr, "devcrypto: unknown digest %s\n", name); +- else if ((i = find_digest_data_index(EVP_MD_type(EVP))) != (size_t)-1) +- digest_list[i] = 1; +- else +- fprintf(stderr, "devcrypto: digest %s not available\n", name); +- OPENSSL_free(name); +- return 1; +-} +- +-static void dump_digest_info(void) +-{ +- size_t i; +- const char *name; +- +- fprintf (stderr, "Information about digests supported by the /dev/crypto" +- " engine:\n"); +-#ifndef CIOCGSESSINFO +- fprintf(stderr, "CIOCGSESSINFO (session info call) unavailable\n"); +-#endif +- +- for (i = 0; i < OSSL_NELEM(digest_data); i++) { +- name = OBJ_nid2sn(digest_data[i].nid); +- fprintf (stderr, "Digest %s, NID=%d, /dev/crypto info: id=%d, driver=%s", +- name ? name : "unknown", digest_data[i].nid, +- digest_data[i].devcryptoid, +- digest_driver_info[i].driver_name ? digest_driver_info[i].driver_name : "unknown"); +- if (digest_driver_info[i].status == DEVCRYPTO_STATUS_NO_CIOCGSESSION) { +- fprintf (stderr, ". CIOCGSESSION (session open) failed\n"); +- continue; +- } +- if (digest_driver_info[i].accelerated == DEVCRYPTO_ACCELERATED) +- fprintf(stderr, " (hw accelerated)"); +- else if (digest_driver_info[i].accelerated == DEVCRYPTO_NOT_ACCELERATED) +- fprintf(stderr, " (software)"); +- else +- fprintf(stderr, " (acceleration status unknown)"); +- if (cipher_driver_info[i].status == DEVCRYPTO_STATUS_FAILURE) +- fprintf (stderr, ". Cipher setup failed\n"); +- else if (digest_driver_info[i].status == DEVCRYPTO_STATUS_NO_CIOCCPHASH) +- fprintf(stderr, ", CIOCCPHASH failed\n"); +- else +- fprintf(stderr, ", CIOCCPHASH capable\n"); +- } +- fprintf(stderr, "\n"); +-} +- +-#endif +- +-/****************************************************************************** +- * +- * CONTROL COMMANDS +- * +- *****/ +- +-#define DEVCRYPTO_CMD_USE_SOFTDRIVERS ENGINE_CMD_BASE +-#define DEVCRYPTO_CMD_CIPHERS (ENGINE_CMD_BASE + 1) +-#define DEVCRYPTO_CMD_DIGESTS (ENGINE_CMD_BASE + 2) +-#define DEVCRYPTO_CMD_DUMP_INFO (ENGINE_CMD_BASE + 3) +- +-/* Helper macros for CPP string composition */ +-#ifndef OPENSSL_MSTR +-# define OPENSSL_MSTR_HELPER(x) #x +-# define OPENSSL_MSTR(x) OPENSSL_MSTR_HELPER(x) +-#endif +- +-static const ENGINE_CMD_DEFN devcrypto_cmds[] = { +-#ifdef CIOCGSESSINFO +- {DEVCRYPTO_CMD_USE_SOFTDRIVERS, +- "USE_SOFTDRIVERS", +- "specifies whether to use software (not accelerated) drivers (" +- OPENSSL_MSTR(DEVCRYPTO_REQUIRE_ACCELERATED) "=use only accelerated drivers, " +- OPENSSL_MSTR(DEVCRYPTO_USE_SOFTWARE) "=allow all drivers, " +- OPENSSL_MSTR(DEVCRYPTO_REJECT_SOFTWARE) +- "=use if acceleration can't be determined) [default=" - OPENSSL_MSTR(DEVCRYPTO_DEFAULT_USE_SOFDTRIVERS) "]", -+ OPENSSL_MSTR(DEVCRYPTO_DEFAULT_USE_SOFTDRIVERS) "]", - ENGINE_CMD_FLAG_NUMERIC}, - #endif - -@@ -1166,32 +1168,22 @@ static int devcrypto_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void)) - * - *****/ - +- ENGINE_CMD_FLAG_NUMERIC}, +-#endif +- +- {DEVCRYPTO_CMD_CIPHERS, +- "CIPHERS", +- "either ALL, NONE, or a comma-separated list of ciphers to enable [default=ALL]", +- ENGINE_CMD_FLAG_STRING}, +- +-#ifdef IMPLEMENT_DIGEST +- {DEVCRYPTO_CMD_DIGESTS, +- "DIGESTS", +- "either ALL, NONE, or a comma-separated list of digests to enable [default=ALL]", +- ENGINE_CMD_FLAG_STRING}, +-#endif +- +- {DEVCRYPTO_CMD_DUMP_INFO, +- "DUMP_INFO", +- "dump info about each algorithm to stderr; use 'openssl engine -pre DUMP_INFO devcrypto'", +- ENGINE_CMD_FLAG_NO_INPUT}, +- +- {0, NULL, NULL, 0} +-}; +- +-static int devcrypto_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void)) +-{ +- int *new_list; +- switch (cmd) { +-#ifdef CIOCGSESSINFO +- case DEVCRYPTO_CMD_USE_SOFTDRIVERS: +- switch (i) { +- case DEVCRYPTO_REQUIRE_ACCELERATED: +- case DEVCRYPTO_USE_SOFTWARE: +- case DEVCRYPTO_REJECT_SOFTWARE: +- break; +- default: +- fprintf(stderr, "devcrypto: invalid value (%ld) for USE_SOFTDRIVERS\n", i); +- return 0; +- } +- if (use_softdrivers == i) +- return 1; +- use_softdrivers = i; +-#ifdef IMPLEMENT_DIGEST +- rebuild_known_digest_nids(e); +-#endif +- rebuild_known_cipher_nids(e); +- return 1; +-#endif /* CIOCGSESSINFO */ +- +- case DEVCRYPTO_CMD_CIPHERS: +- if (p == NULL) +- return 1; +- if (strcasecmp((const char *)p, "ALL") == 0) { +- devcrypto_select_all_ciphers(selected_ciphers); +- } else if (strcasecmp((const char*)p, "NONE") == 0) { +- memset(selected_ciphers, 0, sizeof(selected_ciphers)); +- } else { +- new_list=OPENSSL_zalloc(sizeof(selected_ciphers)); +- if (!CONF_parse_list(p, ',', 1, cryptodev_select_cipher_cb, new_list)) { +- OPENSSL_free(new_list); +- return 0; +- } +- memcpy(selected_ciphers, new_list, sizeof(selected_ciphers)); +- OPENSSL_free(new_list); +- } +- rebuild_known_cipher_nids(e); +- return 1; +- +-#ifdef IMPLEMENT_DIGEST +- case DEVCRYPTO_CMD_DIGESTS: +- if (p == NULL) +- return 1; +- if (strcasecmp((const char *)p, "ALL") == 0) { +- devcrypto_select_all_digests(selected_digests); +- } else if (strcasecmp((const char*)p, "NONE") == 0) { +- memset(selected_digests, 0, sizeof(selected_digests)); +- } else { +- new_list=OPENSSL_zalloc(sizeof(selected_digests)); +- if (!CONF_parse_list(p, ',', 1, cryptodev_select_digest_cb, new_list)) { +- OPENSSL_free(new_list); +- return 0; +- } +- memcpy(selected_digests, new_list, sizeof(selected_digests)); +- OPENSSL_free(new_list); +- } +- rebuild_known_digest_nids(e); +- return 1; +-#endif /* IMPLEMENT_DIGEST */ +- +- case DEVCRYPTO_CMD_DUMP_INFO: +- dump_cipher_info(); +-#ifdef IMPLEMENT_DIGEST +- dump_digest_info(); +-#endif +- return 1; +- +- default: +- break; +- } +- return 0; +-} +- +-/****************************************************************************** +- * +- * LOAD / UNLOAD +- * +- *****/ +- -static int devcrypto_unload(ENGINE *e) -{ - destroy_all_cipher_methods(); @@ -176,42 +1288,35 @@ index 2c1b52d572..eff1ed3a7d 100644 - - return 1; -} - /* +-/* - * This engine is always built into libcrypto, so it doesn't offer any - * ability to be dynamically loadable. -+ * Opens /dev/crypto - */ +- */ -void engine_load_devcrypto_int() -+static int open_devcrypto(void) - { +-{ - ENGINE *e = NULL; - int fd; - -+ if (cfd >= 0) -+ return 1; -+ - if ((fd = open("/dev/crypto", O_RDWR, 0)) < 0) { - #ifndef ENGINE_DEVCRYPTO_DEBUG - if (errno != ENOENT) - #endif - fprintf(stderr, "Could not open /dev/crypto: %s\n", strerror(errno)); +- int fd; +- +- if ((fd = open("/dev/crypto", O_RDWR, 0)) < 0) { +-#ifndef ENGINE_DEVCRYPTO_DEBUG +- if (errno != ENOENT) +-#endif +- fprintf(stderr, "Could not open /dev/crypto: %s\n", strerror(errno)); - return; -+ return 0; - } - - #ifdef CRIOGET -@@ -1199,35 +1191,61 @@ void engine_load_devcrypto_int() - fprintf(stderr, "Could not create crypto fd: %s\n", strerror(errno)); - close(fd); - cfd = -1; +- } +- +-#ifdef CRIOGET +- if (ioctl(fd, CRIOGET, &cfd) < 0) { +- fprintf(stderr, "Could not create crypto fd: %s\n", strerror(errno)); +- close(fd); +- cfd = -1; - return; -+ return 0; - } - close(fd); - #else - cfd = fd; - #endif - +- } +- close(fd); +-#else +- cfd = fd; +-#endif +- - if ((e = ENGINE_new()) == NULL - || !ENGINE_set_destroy_function(e, devcrypto_unload)) { - ENGINE_free(e); @@ -222,6 +1327,1268 @@ index 2c1b52d572..eff1ed3a7d 100644 - */ - close(cfd); - return; +- } +- +- prepare_cipher_methods(); +-#ifdef IMPLEMENT_DIGEST +- prepare_digest_methods(); +-#endif +- +- if (!ENGINE_set_id(e, "devcrypto") +- || !ENGINE_set_name(e, "/dev/crypto engine") +- || !ENGINE_set_cmd_defns(e, devcrypto_cmds) +- || !ENGINE_set_ctrl_function(e, devcrypto_ctrl) +- +-/* +- * Asymmetric ciphers aren't well supported with /dev/crypto. Among the BSD +- * implementations, it seems to only exist in FreeBSD, and regarding the +- * parameters in its crypt_kop, the manual crypto(4) has this to say: +- * +- * The semantics of these arguments are currently undocumented. +- * +- * Reading through the FreeBSD source code doesn't give much more than +- * their CRK_MOD_EXP implementation for ubsec. +- * +- * It doesn't look much better with cryptodev-linux. They have the crypt_kop +- * structure as well as the command (CRK_*) in cryptodev.h, but no support +- * seems to be implemented at all for the moment. +- * +- * At the time of writing, it seems impossible to write proper support for +- * FreeBSD's asym features without some very deep knowledge and access to +- * specific kernel modules. +- * +- * /Richard Levitte, 2017-05-11 +- */ +-#if 0 +-# ifndef OPENSSL_NO_RSA +- || !ENGINE_set_RSA(e, devcrypto_rsa) +-# endif +-# ifndef OPENSSL_NO_DSA +- || !ENGINE_set_DSA(e, devcrypto_dsa) +-# endif +-# ifndef OPENSSL_NO_DH +- || !ENGINE_set_DH(e, devcrypto_dh) +-# endif +-# ifndef OPENSSL_NO_EC +- || !ENGINE_set_EC(e, devcrypto_ec) +-# endif +-#endif +- || !ENGINE_set_ciphers(e, devcrypto_ciphers) +-#ifdef IMPLEMENT_DIGEST +- || !ENGINE_set_digests(e, devcrypto_digests) +-#endif +- ) { +- ENGINE_free(e); +- return; +- } +- +- ENGINE_add(e); +- ENGINE_free(e); /* Loose our local reference */ +- ERR_clear_error(); +-} +--- /dev/null ++++ b/engines/e_devcrypto.c +@@ -0,0 +1,1327 @@ ++/* ++ * Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved. ++ * ++ * Licensed under the OpenSSL license (the "License"). You may not use ++ * this file except in compliance with the License. You can obtain a copy ++ * in the file LICENSE in the source distribution or at ++ * https://www.openssl.org/source/license.html ++ */ ++ ++#include "../e_os.h" ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "crypto/engine.h" ++ ++/* #define ENGINE_DEVCRYPTO_DEBUG */ ++ ++#if CRYPTO_ALGORITHM_MIN < CRYPTO_ALGORITHM_MAX ++# define CHECK_BSD_STYLE_MACROS ++#endif ++ ++#define engine_devcrypto_id "devcrypto" ++ ++/* ++ * ONE global file descriptor for all sessions. This allows operations ++ * such as digest session data copying (see digest_copy()), but is also ++ * saner... why re-open /dev/crypto for every session? ++ */ ++static int cfd = -1; ++#define DEVCRYPTO_REQUIRE_ACCELERATED 0 /* require confirmation of acceleration */ ++#define DEVCRYPTO_USE_SOFTWARE 1 /* allow software drivers */ ++#define DEVCRYPTO_REJECT_SOFTWARE 2 /* only disallow confirmed software drivers */ ++ ++#define DEVCRYPTO_DEFAULT_USE_SOFTDRIVERS DEVCRYPTO_REJECT_SOFTWARE ++static int use_softdrivers = DEVCRYPTO_DEFAULT_USE_SOFTDRIVERS; ++ ++/* ++ * cipher/digest status & acceleration definitions ++ * Make sure the defaults are set to 0 ++ */ ++struct driver_info_st { ++ enum devcrypto_status_t { ++ DEVCRYPTO_STATUS_FAILURE = -3, /* unusable for other reason */ ++ DEVCRYPTO_STATUS_NO_CIOCCPHASH = -2, /* hash state copy not supported */ ++ DEVCRYPTO_STATUS_NO_CIOCGSESSION = -1, /* session open failed */ ++ DEVCRYPTO_STATUS_UNKNOWN = 0, /* not tested yet */ ++ DEVCRYPTO_STATUS_USABLE = 1 /* algo can be used */ ++ } status; ++ ++ enum devcrypto_accelerated_t { ++ DEVCRYPTO_NOT_ACCELERATED = -1, /* software implemented */ ++ DEVCRYPTO_ACCELERATION_UNKNOWN = 0, /* acceleration support unkown */ ++ DEVCRYPTO_ACCELERATED = 1 /* hardware accelerated */ ++ } accelerated; ++ ++ char *driver_name; ++}; ++ ++static int clean_devcrypto_session(struct session_op *sess) { ++ if (ioctl(cfd, CIOCFSESSION, &sess->ses) < 0) { ++ SYSerr(SYS_F_IOCTL, errno); ++ return 0; ++ } ++ memset(sess, 0, sizeof(struct session_op)); ++ return 1; ++} ++ ++/****************************************************************************** ++ * ++ * Ciphers ++ * ++ * Because they all do the same basic operation, we have only one set of ++ * method functions for them all to share, and a mapping table between ++ * NIDs and cryptodev IDs, with all the necessary size data. ++ * ++ *****/ ++ ++struct cipher_ctx { ++ struct session_op sess; ++ int op; /* COP_ENCRYPT or COP_DECRYPT */ ++ unsigned long mode; /* EVP_CIPH_*_MODE */ ++ ++ /* to handle ctr mode being a stream cipher */ ++ unsigned char partial[EVP_MAX_BLOCK_LENGTH]; ++ unsigned int blocksize, num; ++}; ++ ++static const struct cipher_data_st { ++ int nid; ++ int blocksize; ++ int keylen; ++ int ivlen; ++ int flags; ++ int devcryptoid; ++} cipher_data[] = { ++#ifndef OPENSSL_NO_DES ++ { NID_des_cbc, 8, 8, 8, EVP_CIPH_CBC_MODE, CRYPTO_DES_CBC }, ++ { NID_des_ede3_cbc, 8, 24, 8, EVP_CIPH_CBC_MODE, CRYPTO_3DES_CBC }, ++#endif ++#ifndef OPENSSL_NO_BF ++ { NID_bf_cbc, 8, 16, 8, EVP_CIPH_CBC_MODE, CRYPTO_BLF_CBC }, ++#endif ++#ifndef OPENSSL_NO_CAST ++ { NID_cast5_cbc, 8, 16, 8, EVP_CIPH_CBC_MODE, CRYPTO_CAST_CBC }, ++#endif ++ { NID_aes_128_cbc, 16, 128 / 8, 16, EVP_CIPH_CBC_MODE, CRYPTO_AES_CBC }, ++ { NID_aes_192_cbc, 16, 192 / 8, 16, EVP_CIPH_CBC_MODE, CRYPTO_AES_CBC }, ++ { NID_aes_256_cbc, 16, 256 / 8, 16, EVP_CIPH_CBC_MODE, CRYPTO_AES_CBC }, ++#ifndef OPENSSL_NO_RC4 ++ { NID_rc4, 1, 16, 0, EVP_CIPH_STREAM_CIPHER, CRYPTO_ARC4 }, ++#endif ++#if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_AES_CTR) ++ { NID_aes_128_ctr, 16, 128 / 8, 16, EVP_CIPH_CTR_MODE, CRYPTO_AES_CTR }, ++ { NID_aes_192_ctr, 16, 192 / 8, 16, EVP_CIPH_CTR_MODE, CRYPTO_AES_CTR }, ++ { NID_aes_256_ctr, 16, 256 / 8, 16, EVP_CIPH_CTR_MODE, CRYPTO_AES_CTR }, ++#endif ++#if 0 /* Not yet supported */ ++ { NID_aes_128_xts, 16, 128 / 8 * 2, 16, EVP_CIPH_XTS_MODE, CRYPTO_AES_XTS }, ++ { NID_aes_256_xts, 16, 256 / 8 * 2, 16, EVP_CIPH_XTS_MODE, CRYPTO_AES_XTS }, ++#endif ++#if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_AES_ECB) ++ { NID_aes_128_ecb, 16, 128 / 8, 0, EVP_CIPH_ECB_MODE, CRYPTO_AES_ECB }, ++ { NID_aes_192_ecb, 16, 192 / 8, 0, EVP_CIPH_ECB_MODE, CRYPTO_AES_ECB }, ++ { NID_aes_256_ecb, 16, 256 / 8, 0, EVP_CIPH_ECB_MODE, CRYPTO_AES_ECB }, ++#endif ++#if 0 /* Not yet supported */ ++ { NID_aes_128_gcm, 16, 128 / 8, 16, EVP_CIPH_GCM_MODE, CRYPTO_AES_GCM }, ++ { NID_aes_192_gcm, 16, 192 / 8, 16, EVP_CIPH_GCM_MODE, CRYPTO_AES_GCM }, ++ { NID_aes_256_gcm, 16, 256 / 8, 16, EVP_CIPH_GCM_MODE, CRYPTO_AES_GCM }, ++#endif ++#ifndef OPENSSL_NO_CAMELLIA ++ { NID_camellia_128_cbc, 16, 128 / 8, 16, EVP_CIPH_CBC_MODE, ++ CRYPTO_CAMELLIA_CBC }, ++ { NID_camellia_192_cbc, 16, 192 / 8, 16, EVP_CIPH_CBC_MODE, ++ CRYPTO_CAMELLIA_CBC }, ++ { NID_camellia_256_cbc, 16, 256 / 8, 16, EVP_CIPH_CBC_MODE, ++ CRYPTO_CAMELLIA_CBC }, ++#endif ++}; ++ ++static size_t find_cipher_data_index(int nid) ++{ ++ size_t i; ++ ++ for (i = 0; i < OSSL_NELEM(cipher_data); i++) ++ if (nid == cipher_data[i].nid) ++ return i; ++ return (size_t)-1; ++} ++ ++static size_t get_cipher_data_index(int nid) ++{ ++ size_t i = find_cipher_data_index(nid); ++ ++ if (i != (size_t)-1) ++ return i; ++ ++ /* ++ * Code further down must make sure that only NIDs in the table above ++ * are used. If any other NID reaches this function, there's a grave ++ * coding error further down. ++ */ ++ assert("Code that never should be reached" == NULL); ++ return -1; ++} ++ ++static const struct cipher_data_st *get_cipher_data(int nid) ++{ ++ return &cipher_data[get_cipher_data_index(nid)]; ++} ++ ++/* ++ * Following are the three necessary functions to map OpenSSL functionality ++ * with cryptodev. ++ */ ++ ++static int cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, ++ const unsigned char *iv, int enc) ++{ ++ struct cipher_ctx *cipher_ctx = ++ (struct cipher_ctx *)EVP_CIPHER_CTX_get_cipher_data(ctx); ++ const struct cipher_data_st *cipher_d = ++ get_cipher_data(EVP_CIPHER_CTX_nid(ctx)); ++ ++ /* cleanup a previous session */ ++ if (cipher_ctx->sess.ses != 0 && ++ clean_devcrypto_session(&cipher_ctx->sess) == 0) ++ return 0; ++ ++ cipher_ctx->sess.cipher = cipher_d->devcryptoid; ++ cipher_ctx->sess.keylen = cipher_d->keylen; ++ cipher_ctx->sess.key = (void *)key; ++ cipher_ctx->op = enc ? COP_ENCRYPT : COP_DECRYPT; ++ cipher_ctx->mode = cipher_d->flags & EVP_CIPH_MODE; ++ cipher_ctx->blocksize = cipher_d->blocksize; ++ if (ioctl(cfd, CIOCGSESSION, &cipher_ctx->sess) < 0) { ++ SYSerr(SYS_F_IOCTL, errno); ++ return 0; ++ } ++ ++ return 1; ++} ++ ++static int cipher_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, ++ const unsigned char *in, size_t inl) ++{ ++ struct cipher_ctx *cipher_ctx = ++ (struct cipher_ctx *)EVP_CIPHER_CTX_get_cipher_data(ctx); ++ struct crypt_op cryp; ++ unsigned char *iv = EVP_CIPHER_CTX_iv_noconst(ctx); ++#if !defined(COP_FLAG_WRITE_IV) ++ unsigned char saved_iv[EVP_MAX_IV_LENGTH]; ++ const unsigned char *ivptr; ++ size_t nblocks, ivlen; ++#endif ++ ++ memset(&cryp, 0, sizeof(cryp)); ++ cryp.ses = cipher_ctx->sess.ses; ++ cryp.len = inl; ++ cryp.src = (void *)in; ++ cryp.dst = (void *)out; ++ cryp.iv = (void *)iv; ++ cryp.op = cipher_ctx->op; ++#if !defined(COP_FLAG_WRITE_IV) ++ cryp.flags = 0; ++ ++ ivlen = EVP_CIPHER_CTX_iv_length(ctx); ++ if (ivlen > 0) ++ switch (cipher_ctx->mode) { ++ case EVP_CIPH_CBC_MODE: ++ assert(inl >= ivlen); ++ if (!EVP_CIPHER_CTX_encrypting(ctx)) { ++ ivptr = in + inl - ivlen; ++ memcpy(saved_iv, ivptr, ivlen); ++ } ++ break; ++ ++ case EVP_CIPH_CTR_MODE: ++ break; ++ ++ default: /* should not happen */ ++ return 0; ++ } ++#else ++ cryp.flags = COP_FLAG_WRITE_IV; ++#endif ++ ++ if (ioctl(cfd, CIOCCRYPT, &cryp) < 0) { ++ SYSerr(SYS_F_IOCTL, errno); ++ return 0; ++ } ++ ++#if !defined(COP_FLAG_WRITE_IV) ++ if (ivlen > 0) ++ switch (cipher_ctx->mode) { ++ case EVP_CIPH_CBC_MODE: ++ assert(inl >= ivlen); ++ if (EVP_CIPHER_CTX_encrypting(ctx)) ++ ivptr = out + inl - ivlen; ++ else ++ ivptr = saved_iv; ++ ++ memcpy(iv, ivptr, ivlen); ++ break; ++ ++ case EVP_CIPH_CTR_MODE: ++ nblocks = (inl + cipher_ctx->blocksize - 1) ++ / cipher_ctx->blocksize; ++ do { ++ ivlen--; ++ nblocks += iv[ivlen]; ++ iv[ivlen] = (uint8_t) nblocks; ++ nblocks >>= 8; ++ } while (ivlen); ++ break; ++ ++ default: /* should not happen */ ++ return 0; ++ } ++#endif ++ ++ return 1; ++} ++ ++static int ctr_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, ++ const unsigned char *in, size_t inl) ++{ ++ struct cipher_ctx *cipher_ctx = ++ (struct cipher_ctx *)EVP_CIPHER_CTX_get_cipher_data(ctx); ++ size_t nblocks, len; ++ ++ /* initial partial block */ ++ while (cipher_ctx->num && inl) { ++ (*out++) = *(in++) ^ cipher_ctx->partial[cipher_ctx->num]; ++ --inl; ++ cipher_ctx->num = (cipher_ctx->num + 1) % cipher_ctx->blocksize; ++ } ++ ++ /* full blocks */ ++ if (inl > (unsigned int) cipher_ctx->blocksize) { ++ nblocks = inl/cipher_ctx->blocksize; ++ len = nblocks * cipher_ctx->blocksize; ++ if (cipher_do_cipher(ctx, out, in, len) < 1) ++ return 0; ++ inl -= len; ++ out += len; ++ in += len; ++ } ++ ++ /* final partial block */ ++ if (inl) { ++ memset(cipher_ctx->partial, 0, cipher_ctx->blocksize); ++ if (cipher_do_cipher(ctx, cipher_ctx->partial, cipher_ctx->partial, ++ cipher_ctx->blocksize) < 1) ++ return 0; ++ while (inl--) { ++ out[cipher_ctx->num] = in[cipher_ctx->num] ++ ^ cipher_ctx->partial[cipher_ctx->num]; ++ cipher_ctx->num++; ++ } ++ } ++ ++ return 1; ++} ++ ++static int cipher_ctrl(EVP_CIPHER_CTX *ctx, int type, int p1, void* p2) ++{ ++ struct cipher_ctx *cipher_ctx = ++ (struct cipher_ctx *)EVP_CIPHER_CTX_get_cipher_data(ctx); ++ EVP_CIPHER_CTX *to_ctx = (EVP_CIPHER_CTX *)p2; ++ struct cipher_ctx *to_cipher_ctx; ++ ++ switch (type) { ++ case EVP_CTRL_COPY: ++ if (cipher_ctx == NULL) ++ return 1; ++ /* when copying the context, a new session needs to be initialized */ ++ to_cipher_ctx = ++ (struct cipher_ctx *)EVP_CIPHER_CTX_get_cipher_data(to_ctx); ++ memset(&to_cipher_ctx->sess, 0, sizeof(to_cipher_ctx->sess)); ++ return cipher_init(to_ctx, cipher_ctx->sess.key, EVP_CIPHER_CTX_iv(ctx), ++ (cipher_ctx->op == COP_ENCRYPT)); ++ ++ case EVP_CTRL_INIT: ++ memset(&cipher_ctx->sess, 0, sizeof(cipher_ctx->sess)); ++ return 1; ++ ++ default: ++ break; ++ } ++ ++ return -1; ++} ++ ++static int cipher_cleanup(EVP_CIPHER_CTX *ctx) ++{ ++ struct cipher_ctx *cipher_ctx = ++ (struct cipher_ctx *)EVP_CIPHER_CTX_get_cipher_data(ctx); ++ ++ return clean_devcrypto_session(&cipher_ctx->sess); ++} ++ ++/* ++ * Keep tables of known nids, associated methods, selected ciphers, and driver ++ * info. ++ * Note that known_cipher_nids[] isn't necessarily indexed the same way as ++ * cipher_data[] above, which the other tables are. ++ */ ++static int known_cipher_nids[OSSL_NELEM(cipher_data)]; ++static int known_cipher_nids_amount = -1; /* -1 indicates not yet initialised */ ++static EVP_CIPHER *known_cipher_methods[OSSL_NELEM(cipher_data)] = { NULL, }; ++static int selected_ciphers[OSSL_NELEM(cipher_data)]; ++static struct driver_info_st cipher_driver_info[OSSL_NELEM(cipher_data)]; ++ ++ ++static int devcrypto_test_cipher(size_t cipher_data_index) ++{ ++ return (cipher_driver_info[cipher_data_index].status == DEVCRYPTO_STATUS_USABLE ++ && selected_ciphers[cipher_data_index] == 1 ++ && (cipher_driver_info[cipher_data_index].accelerated ++ == DEVCRYPTO_ACCELERATED ++ || use_softdrivers == DEVCRYPTO_USE_SOFTWARE ++ || (cipher_driver_info[cipher_data_index].accelerated ++ != DEVCRYPTO_NOT_ACCELERATED ++ && use_softdrivers == DEVCRYPTO_REJECT_SOFTWARE))); ++} ++ ++static void prepare_cipher_methods(void) ++{ ++ size_t i; ++ struct session_op sess; ++ unsigned long cipher_mode; ++#ifdef CIOCGSESSINFO ++ struct session_info_op siop; ++#endif ++ ++ memset(&cipher_driver_info, 0, sizeof(cipher_driver_info)); ++ ++ memset(&sess, 0, sizeof(sess)); ++ sess.key = (void *)"01234567890123456789012345678901234567890123456789"; ++ ++ for (i = 0, known_cipher_nids_amount = 0; ++ i < OSSL_NELEM(cipher_data); i++) { ++ ++ selected_ciphers[i] = 1; ++ /* ++ * Check that the cipher is usable ++ */ ++ sess.cipher = cipher_data[i].devcryptoid; ++ sess.keylen = cipher_data[i].keylen; ++ if (ioctl(cfd, CIOCGSESSION, &sess) < 0) { ++ cipher_driver_info[i].status = DEVCRYPTO_STATUS_NO_CIOCGSESSION; ++ continue; ++ } ++ ++ cipher_mode = cipher_data[i].flags & EVP_CIPH_MODE; ++ ++ if ((known_cipher_methods[i] = ++ EVP_CIPHER_meth_new(cipher_data[i].nid, ++ cipher_mode == EVP_CIPH_CTR_MODE ? 1 : ++ cipher_data[i].blocksize, ++ cipher_data[i].keylen)) == NULL ++ || !EVP_CIPHER_meth_set_iv_length(known_cipher_methods[i], ++ cipher_data[i].ivlen) ++ || !EVP_CIPHER_meth_set_flags(known_cipher_methods[i], ++ cipher_data[i].flags ++ | EVP_CIPH_CUSTOM_COPY ++ | EVP_CIPH_CTRL_INIT ++ | EVP_CIPH_FLAG_DEFAULT_ASN1) ++ || !EVP_CIPHER_meth_set_init(known_cipher_methods[i], cipher_init) ++ || !EVP_CIPHER_meth_set_do_cipher(known_cipher_methods[i], ++ cipher_mode == EVP_CIPH_CTR_MODE ? ++ ctr_do_cipher : ++ cipher_do_cipher) ++ || !EVP_CIPHER_meth_set_ctrl(known_cipher_methods[i], cipher_ctrl) ++ || !EVP_CIPHER_meth_set_cleanup(known_cipher_methods[i], ++ cipher_cleanup) ++ || !EVP_CIPHER_meth_set_impl_ctx_size(known_cipher_methods[i], ++ sizeof(struct cipher_ctx))) { ++ cipher_driver_info[i].status = DEVCRYPTO_STATUS_FAILURE; ++ EVP_CIPHER_meth_free(known_cipher_methods[i]); ++ known_cipher_methods[i] = NULL; ++ } else { ++ cipher_driver_info[i].status = DEVCRYPTO_STATUS_USABLE; ++#ifdef CIOCGSESSINFO ++ siop.ses = sess.ses; ++ if (ioctl(cfd, CIOCGSESSINFO, &siop) < 0) { ++ cipher_driver_info[i].accelerated = DEVCRYPTO_ACCELERATION_UNKNOWN; ++ } else { ++ cipher_driver_info[i].driver_name = ++ OPENSSL_strndup(siop.cipher_info.cra_driver_name, ++ CRYPTODEV_MAX_ALG_NAME); ++ if (!(siop.flags & SIOP_FLAG_KERNEL_DRIVER_ONLY)) ++ cipher_driver_info[i].accelerated = DEVCRYPTO_NOT_ACCELERATED; ++ else ++ cipher_driver_info[i].accelerated = DEVCRYPTO_ACCELERATED; ++ } ++#endif /* CIOCGSESSINFO */ ++ } ++ ioctl(cfd, CIOCFSESSION, &sess.ses); ++ if (devcrypto_test_cipher(i)) { ++ known_cipher_nids[known_cipher_nids_amount++] = ++ cipher_data[i].nid; ++ } ++ } ++} ++ ++static void rebuild_known_cipher_nids(ENGINE *e) ++{ ++ size_t i; ++ ++ for (i = 0, known_cipher_nids_amount = 0; i < OSSL_NELEM(cipher_data); i++) { ++ if (devcrypto_test_cipher(i)) ++ known_cipher_nids[known_cipher_nids_amount++] = cipher_data[i].nid; ++ } ++ ENGINE_unregister_ciphers(e); ++ ENGINE_register_ciphers(e); ++} ++ ++static const EVP_CIPHER *get_cipher_method(int nid) ++{ ++ size_t i = get_cipher_data_index(nid); ++ ++ if (i == (size_t)-1) ++ return NULL; ++ return known_cipher_methods[i]; ++} ++ ++static int get_cipher_nids(const int **nids) ++{ ++ *nids = known_cipher_nids; ++ return known_cipher_nids_amount; ++} ++ ++static void destroy_cipher_method(int nid) ++{ ++ size_t i = get_cipher_data_index(nid); ++ ++ EVP_CIPHER_meth_free(known_cipher_methods[i]); ++ known_cipher_methods[i] = NULL; ++} ++ ++static void destroy_all_cipher_methods(void) ++{ ++ size_t i; ++ ++ for (i = 0; i < OSSL_NELEM(cipher_data); i++) { ++ destroy_cipher_method(cipher_data[i].nid); ++ OPENSSL_free(cipher_driver_info[i].driver_name); ++ cipher_driver_info[i].driver_name = NULL; ++ } ++} ++ ++static int devcrypto_ciphers(ENGINE *e, const EVP_CIPHER **cipher, ++ const int **nids, int nid) ++{ ++ if (cipher == NULL) ++ return get_cipher_nids(nids); ++ ++ *cipher = get_cipher_method(nid); ++ ++ return *cipher != NULL; ++} ++ ++static void devcrypto_select_all_ciphers(int *cipher_list) ++{ ++ size_t i; ++ ++ for (i = 0; i < OSSL_NELEM(cipher_data); i++) ++ cipher_list[i] = 1; ++} ++ ++static int cryptodev_select_cipher_cb(const char *str, int len, void *usr) ++{ ++ int *cipher_list = (int *)usr; ++ char *name; ++ const EVP_CIPHER *EVP; ++ size_t i; ++ ++ if (len == 0) ++ return 1; ++ if (usr == NULL || (name = OPENSSL_strndup(str, len)) == NULL) ++ return 0; ++ EVP = EVP_get_cipherbyname(name); ++ if (EVP == NULL) ++ fprintf(stderr, "devcrypto: unknown cipher %s\n", name); ++ else if ((i = find_cipher_data_index(EVP_CIPHER_nid(EVP))) != (size_t)-1) ++ cipher_list[i] = 1; ++ else ++ fprintf(stderr, "devcrypto: cipher %s not available\n", name); ++ OPENSSL_free(name); ++ return 1; ++} ++ ++static void dump_cipher_info(void) ++{ ++ size_t i; ++ const char *name; ++ ++ fprintf (stderr, "Information about ciphers supported by the /dev/crypto" ++ " engine:\n"); ++#ifndef CIOCGSESSINFO ++ fprintf(stderr, "CIOCGSESSINFO (session info call) unavailable\n"); ++#endif ++ for (i = 0; i < OSSL_NELEM(cipher_data); i++) { ++ name = OBJ_nid2sn(cipher_data[i].nid); ++ fprintf (stderr, "Cipher %s, NID=%d, /dev/crypto info: id=%d, ", ++ name ? name : "unknown", cipher_data[i].nid, ++ cipher_data[i].devcryptoid); ++ if (cipher_driver_info[i].status == DEVCRYPTO_STATUS_NO_CIOCGSESSION ) { ++ fprintf (stderr, "CIOCGSESSION (session open call) failed\n"); ++ continue; ++ } ++ fprintf (stderr, "driver=%s ", cipher_driver_info[i].driver_name ? ++ cipher_driver_info[i].driver_name : "unknown"); ++ if (cipher_driver_info[i].accelerated == DEVCRYPTO_ACCELERATED) ++ fprintf(stderr, "(hw accelerated)"); ++ else if (cipher_driver_info[i].accelerated == DEVCRYPTO_NOT_ACCELERATED) ++ fprintf(stderr, "(software)"); ++ else ++ fprintf(stderr, "(acceleration status unknown)"); ++ if (cipher_driver_info[i].status == DEVCRYPTO_STATUS_FAILURE) ++ fprintf (stderr, ". Cipher setup failed"); ++ fprintf(stderr, "\n"); ++ } ++ fprintf(stderr, "\n"); ++} ++ ++/* ++ * We only support digests if the cryptodev implementation supports multiple ++ * data updates and session copying. Otherwise, we would be forced to maintain ++ * a cache, which is perilous if there's a lot of data coming in (if someone ++ * wants to checksum an OpenSSL tarball, for example). ++ */ ++#if defined(CIOCCPHASH) && defined(COP_FLAG_UPDATE) && defined(COP_FLAG_FINAL) ++#define IMPLEMENT_DIGEST ++ ++/****************************************************************************** ++ * ++ * Digests ++ * ++ * Because they all do the same basic operation, we have only one set of ++ * method functions for them all to share, and a mapping table between ++ * NIDs and cryptodev IDs, with all the necessary size data. ++ * ++ *****/ ++ ++struct digest_ctx { ++ struct session_op sess; ++ /* This signals that the init function was called, not that it succeeded. */ ++ int init_called; ++ unsigned char digest_res[HASH_MAX_LEN]; ++}; ++ ++static const struct digest_data_st { ++ int nid; ++ int blocksize; ++ int digestlen; ++ int devcryptoid; ++} digest_data[] = { ++#ifndef OPENSSL_NO_MD5 ++ { NID_md5, /* MD5_CBLOCK */ 64, 16, CRYPTO_MD5 }, ++#endif ++ { NID_sha1, SHA_CBLOCK, 20, CRYPTO_SHA1 }, ++#ifndef OPENSSL_NO_RMD160 ++# if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_RIPEMD160) ++ { NID_ripemd160, /* RIPEMD160_CBLOCK */ 64, 20, CRYPTO_RIPEMD160 }, ++# endif ++#endif ++#if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_SHA2_224) ++ { NID_sha224, SHA256_CBLOCK, 224 / 8, CRYPTO_SHA2_224 }, ++#endif ++#if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_SHA2_256) ++ { NID_sha256, SHA256_CBLOCK, 256 / 8, CRYPTO_SHA2_256 }, ++#endif ++#if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_SHA2_384) ++ { NID_sha384, SHA512_CBLOCK, 384 / 8, CRYPTO_SHA2_384 }, ++#endif ++#if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_SHA2_512) ++ { NID_sha512, SHA512_CBLOCK, 512 / 8, CRYPTO_SHA2_512 }, ++#endif ++}; ++ ++static size_t find_digest_data_index(int nid) ++{ ++ size_t i; ++ ++ for (i = 0; i < OSSL_NELEM(digest_data); i++) ++ if (nid == digest_data[i].nid) ++ return i; ++ return (size_t)-1; ++} ++ ++static size_t get_digest_data_index(int nid) ++{ ++ size_t i = find_digest_data_index(nid); ++ ++ if (i != (size_t)-1) ++ return i; ++ ++ /* ++ * Code further down must make sure that only NIDs in the table above ++ * are used. If any other NID reaches this function, there's a grave ++ * coding error further down. ++ */ ++ assert("Code that never should be reached" == NULL); ++ return -1; ++} ++ ++static const struct digest_data_st *get_digest_data(int nid) ++{ ++ return &digest_data[get_digest_data_index(nid)]; ++} ++ ++/* ++ * Following are the five necessary functions to map OpenSSL functionality ++ * with cryptodev: init, update, final, cleanup, and copy. ++ */ ++ ++static int digest_init(EVP_MD_CTX *ctx) ++{ ++ struct digest_ctx *digest_ctx = ++ (struct digest_ctx *)EVP_MD_CTX_md_data(ctx); ++ const struct digest_data_st *digest_d = ++ get_digest_data(EVP_MD_CTX_type(ctx)); ++ ++ digest_ctx->init_called = 1; ++ ++ memset(&digest_ctx->sess, 0, sizeof(digest_ctx->sess)); ++ digest_ctx->sess.mac = digest_d->devcryptoid; ++ if (ioctl(cfd, CIOCGSESSION, &digest_ctx->sess) < 0) { ++ SYSerr(SYS_F_IOCTL, errno); ++ return 0; ++ } ++ ++ return 1; ++} ++ ++static int digest_op(struct digest_ctx *ctx, const void *src, size_t srclen, ++ void *res, unsigned int flags) ++{ ++ struct crypt_op cryp; ++ ++ memset(&cryp, 0, sizeof(cryp)); ++ cryp.ses = ctx->sess.ses; ++ cryp.len = srclen; ++ cryp.src = (void *)src; ++ cryp.dst = NULL; ++ cryp.mac = res; ++ cryp.flags = flags; ++ return ioctl(cfd, CIOCCRYPT, &cryp); ++} ++ ++static int digest_update(EVP_MD_CTX *ctx, const void *data, size_t count) ++{ ++ struct digest_ctx *digest_ctx = ++ (struct digest_ctx *)EVP_MD_CTX_md_data(ctx); ++ ++ if (count == 0) ++ return 1; ++ ++ if (digest_ctx == NULL) ++ return 0; ++ ++ if (EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_ONESHOT)) { ++ if (digest_op(digest_ctx, data, count, digest_ctx->digest_res, 0) >= 0) ++ return 1; ++ } else if (digest_op(digest_ctx, data, count, NULL, COP_FLAG_UPDATE) >= 0) { ++ return 1; ++ } ++ ++ SYSerr(SYS_F_IOCTL, errno); ++ return 0; ++} ++ ++static int digest_final(EVP_MD_CTX *ctx, unsigned char *md) ++{ ++ struct digest_ctx *digest_ctx = ++ (struct digest_ctx *)EVP_MD_CTX_md_data(ctx); ++ ++ if (md == NULL || digest_ctx == NULL) ++ return 0; ++ ++ if (EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_ONESHOT)) { ++ memcpy(md, digest_ctx->digest_res, EVP_MD_CTX_size(ctx)); ++ } else if (digest_op(digest_ctx, NULL, 0, md, COP_FLAG_FINAL) < 0) { ++ SYSerr(SYS_F_IOCTL, errno); ++ return 0; ++ } ++ ++ return 1; ++} ++ ++static int digest_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from) ++{ ++ struct digest_ctx *digest_from = ++ (struct digest_ctx *)EVP_MD_CTX_md_data(from); ++ struct digest_ctx *digest_to = ++ (struct digest_ctx *)EVP_MD_CTX_md_data(to); ++ struct cphash_op cphash; ++ ++ if (digest_from == NULL || digest_from->init_called != 1) ++ return 1; ++ ++ if (!digest_init(to)) { ++ SYSerr(SYS_F_IOCTL, errno); ++ return 0; ++ } ++ ++ cphash.src_ses = digest_from->sess.ses; ++ cphash.dst_ses = digest_to->sess.ses; ++ if (ioctl(cfd, CIOCCPHASH, &cphash) < 0) { ++ SYSerr(SYS_F_IOCTL, errno); ++ return 0; ++ } ++ return 1; ++} ++ ++static int digest_cleanup(EVP_MD_CTX *ctx) ++{ ++ struct digest_ctx *digest_ctx = ++ (struct digest_ctx *)EVP_MD_CTX_md_data(ctx); ++ ++ if (digest_ctx == NULL) ++ return 1; ++ ++ return clean_devcrypto_session(&digest_ctx->sess); ++} ++ ++/* ++ * Keep tables of known nids, associated methods, selected digests, and ++ * driver info. ++ * Note that known_digest_nids[] isn't necessarily indexed the same way as ++ * digest_data[] above, which the other tables are. ++ */ ++static int known_digest_nids[OSSL_NELEM(digest_data)]; ++static int known_digest_nids_amount = -1; /* -1 indicates not yet initialised */ ++static EVP_MD *known_digest_methods[OSSL_NELEM(digest_data)] = { NULL, }; ++static int selected_digests[OSSL_NELEM(digest_data)]; ++static struct driver_info_st digest_driver_info[OSSL_NELEM(digest_data)]; ++ ++static int devcrypto_test_digest(size_t digest_data_index) ++{ ++ return (digest_driver_info[digest_data_index].status == DEVCRYPTO_STATUS_USABLE ++ && selected_digests[digest_data_index] == 1 ++ && (digest_driver_info[digest_data_index].accelerated ++ == DEVCRYPTO_ACCELERATED ++ || use_softdrivers == DEVCRYPTO_USE_SOFTWARE ++ || (digest_driver_info[digest_data_index].accelerated ++ != DEVCRYPTO_NOT_ACCELERATED ++ && use_softdrivers == DEVCRYPTO_REJECT_SOFTWARE))); ++} ++ ++static void rebuild_known_digest_nids(ENGINE *e) ++{ ++ size_t i; ++ ++ for (i = 0, known_digest_nids_amount = 0; i < OSSL_NELEM(digest_data); i++) { ++ if (devcrypto_test_digest(i)) ++ known_digest_nids[known_digest_nids_amount++] = digest_data[i].nid; ++ } ++ ENGINE_unregister_digests(e); ++ ENGINE_register_digests(e); ++} ++ ++static void prepare_digest_methods(void) ++{ ++ size_t i; ++ struct session_op sess1, sess2; ++#ifdef CIOCGSESSINFO ++ struct session_info_op siop; ++#endif ++ struct cphash_op cphash; ++ ++ memset(&digest_driver_info, 0, sizeof(digest_driver_info)); ++ ++ memset(&sess1, 0, sizeof(sess1)); ++ memset(&sess2, 0, sizeof(sess2)); ++ ++ for (i = 0, known_digest_nids_amount = 0; i < OSSL_NELEM(digest_data); ++ i++) { ++ ++ selected_digests[i] = 1; ++ ++ /* ++ * Check that the digest is usable ++ */ ++ sess1.mac = digest_data[i].devcryptoid; ++ sess2.ses = 0; ++ if (ioctl(cfd, CIOCGSESSION, &sess1) < 0) { ++ digest_driver_info[i].status = DEVCRYPTO_STATUS_NO_CIOCGSESSION; ++ goto finish; ++ } ++ ++#ifdef CIOCGSESSINFO ++ /* gather hardware acceleration info from the driver */ ++ siop.ses = sess1.ses; ++ if (ioctl(cfd, CIOCGSESSINFO, &siop) < 0) { ++ digest_driver_info[i].accelerated = DEVCRYPTO_ACCELERATION_UNKNOWN; ++ } else { ++ digest_driver_info[i].driver_name = ++ OPENSSL_strndup(siop.hash_info.cra_driver_name, ++ CRYPTODEV_MAX_ALG_NAME); ++ if (siop.flags & SIOP_FLAG_KERNEL_DRIVER_ONLY) ++ digest_driver_info[i].accelerated = DEVCRYPTO_ACCELERATED; ++ else ++ digest_driver_info[i].accelerated = DEVCRYPTO_NOT_ACCELERATED; ++ } ++#endif ++ ++ /* digest must be capable of hash state copy */ ++ sess2.mac = sess1.mac; ++ if (ioctl(cfd, CIOCGSESSION, &sess2) < 0) { ++ digest_driver_info[i].status = DEVCRYPTO_STATUS_FAILURE; ++ goto finish; ++ } ++ cphash.src_ses = sess1.ses; ++ cphash.dst_ses = sess2.ses; ++ if (ioctl(cfd, CIOCCPHASH, &cphash) < 0) { ++ digest_driver_info[i].status = DEVCRYPTO_STATUS_NO_CIOCCPHASH; ++ goto finish; ++ } ++ if ((known_digest_methods[i] = EVP_MD_meth_new(digest_data[i].nid, ++ NID_undef)) == NULL ++ || !EVP_MD_meth_set_input_blocksize(known_digest_methods[i], ++ digest_data[i].blocksize) ++ || !EVP_MD_meth_set_result_size(known_digest_methods[i], ++ digest_data[i].digestlen) ++ || !EVP_MD_meth_set_init(known_digest_methods[i], digest_init) ++ || !EVP_MD_meth_set_update(known_digest_methods[i], digest_update) ++ || !EVP_MD_meth_set_final(known_digest_methods[i], digest_final) ++ || !EVP_MD_meth_set_copy(known_digest_methods[i], digest_copy) ++ || !EVP_MD_meth_set_cleanup(known_digest_methods[i], digest_cleanup) ++ || !EVP_MD_meth_set_app_datasize(known_digest_methods[i], ++ sizeof(struct digest_ctx))) { ++ digest_driver_info[i].status = DEVCRYPTO_STATUS_FAILURE; ++ EVP_MD_meth_free(known_digest_methods[i]); ++ known_digest_methods[i] = NULL; ++ goto finish; ++ } ++ digest_driver_info[i].status = DEVCRYPTO_STATUS_USABLE; ++finish: ++ ioctl(cfd, CIOCFSESSION, &sess1.ses); ++ if (sess2.ses != 0) ++ ioctl(cfd, CIOCFSESSION, &sess2.ses); ++ if (devcrypto_test_digest(i)) ++ known_digest_nids[known_digest_nids_amount++] = digest_data[i].nid; ++ } ++} ++ ++static const EVP_MD *get_digest_method(int nid) ++{ ++ size_t i = get_digest_data_index(nid); ++ ++ if (i == (size_t)-1) ++ return NULL; ++ return known_digest_methods[i]; ++} ++ ++static int get_digest_nids(const int **nids) ++{ ++ *nids = known_digest_nids; ++ return known_digest_nids_amount; ++} ++ ++static void destroy_digest_method(int nid) ++{ ++ size_t i = get_digest_data_index(nid); ++ ++ EVP_MD_meth_free(known_digest_methods[i]); ++ known_digest_methods[i] = NULL; ++} ++ ++static void destroy_all_digest_methods(void) ++{ ++ size_t i; ++ ++ for (i = 0; i < OSSL_NELEM(digest_data); i++) { ++ destroy_digest_method(digest_data[i].nid); ++ OPENSSL_free(digest_driver_info[i].driver_name); ++ digest_driver_info[i].driver_name = NULL; ++ } ++} ++ ++static int devcrypto_digests(ENGINE *e, const EVP_MD **digest, ++ const int **nids, int nid) ++{ ++ if (digest == NULL) ++ return get_digest_nids(nids); ++ ++ *digest = get_digest_method(nid); ++ ++ return *digest != NULL; ++} ++ ++static void devcrypto_select_all_digests(int *digest_list) ++{ ++ size_t i; ++ ++ for (i = 0; i < OSSL_NELEM(digest_data); i++) ++ digest_list[i] = 1; ++} ++ ++static int cryptodev_select_digest_cb(const char *str, int len, void *usr) ++{ ++ int *digest_list = (int *)usr; ++ char *name; ++ const EVP_MD *EVP; ++ size_t i; ++ ++ if (len == 0) ++ return 1; ++ if (usr == NULL || (name = OPENSSL_strndup(str, len)) == NULL) ++ return 0; ++ EVP = EVP_get_digestbyname(name); ++ if (EVP == NULL) ++ fprintf(stderr, "devcrypto: unknown digest %s\n", name); ++ else if ((i = find_digest_data_index(EVP_MD_type(EVP))) != (size_t)-1) ++ digest_list[i] = 1; ++ else ++ fprintf(stderr, "devcrypto: digest %s not available\n", name); ++ OPENSSL_free(name); ++ return 1; ++} ++ ++static void dump_digest_info(void) ++{ ++ size_t i; ++ const char *name; ++ ++ fprintf (stderr, "Information about digests supported by the /dev/crypto" ++ " engine:\n"); ++#ifndef CIOCGSESSINFO ++ fprintf(stderr, "CIOCGSESSINFO (session info call) unavailable\n"); ++#endif ++ ++ for (i = 0; i < OSSL_NELEM(digest_data); i++) { ++ name = OBJ_nid2sn(digest_data[i].nid); ++ fprintf (stderr, "Digest %s, NID=%d, /dev/crypto info: id=%d, driver=%s", ++ name ? name : "unknown", digest_data[i].nid, ++ digest_data[i].devcryptoid, ++ digest_driver_info[i].driver_name ? digest_driver_info[i].driver_name : "unknown"); ++ if (digest_driver_info[i].status == DEVCRYPTO_STATUS_NO_CIOCGSESSION) { ++ fprintf (stderr, ". CIOCGSESSION (session open) failed\n"); ++ continue; ++ } ++ if (digest_driver_info[i].accelerated == DEVCRYPTO_ACCELERATED) ++ fprintf(stderr, " (hw accelerated)"); ++ else if (digest_driver_info[i].accelerated == DEVCRYPTO_NOT_ACCELERATED) ++ fprintf(stderr, " (software)"); ++ else ++ fprintf(stderr, " (acceleration status unknown)"); ++ if (cipher_driver_info[i].status == DEVCRYPTO_STATUS_FAILURE) ++ fprintf (stderr, ". Cipher setup failed\n"); ++ else if (digest_driver_info[i].status == DEVCRYPTO_STATUS_NO_CIOCCPHASH) ++ fprintf(stderr, ", CIOCCPHASH failed\n"); ++ else ++ fprintf(stderr, ", CIOCCPHASH capable\n"); ++ } ++ fprintf(stderr, "\n"); ++} ++ ++#endif ++ ++/****************************************************************************** ++ * ++ * CONTROL COMMANDS ++ * ++ *****/ ++ ++#define DEVCRYPTO_CMD_USE_SOFTDRIVERS ENGINE_CMD_BASE ++#define DEVCRYPTO_CMD_CIPHERS (ENGINE_CMD_BASE + 1) ++#define DEVCRYPTO_CMD_DIGESTS (ENGINE_CMD_BASE + 2) ++#define DEVCRYPTO_CMD_DUMP_INFO (ENGINE_CMD_BASE + 3) ++ ++/* Helper macros for CPP string composition */ ++#ifndef OPENSSL_MSTR ++# define OPENSSL_MSTR_HELPER(x) #x ++# define OPENSSL_MSTR(x) OPENSSL_MSTR_HELPER(x) ++#endif ++ ++static const ENGINE_CMD_DEFN devcrypto_cmds[] = { ++#ifdef CIOCGSESSINFO ++ {DEVCRYPTO_CMD_USE_SOFTDRIVERS, ++ "USE_SOFTDRIVERS", ++ "specifies whether to use software (not accelerated) drivers (" ++ OPENSSL_MSTR(DEVCRYPTO_REQUIRE_ACCELERATED) "=use only accelerated drivers, " ++ OPENSSL_MSTR(DEVCRYPTO_USE_SOFTWARE) "=allow all drivers, " ++ OPENSSL_MSTR(DEVCRYPTO_REJECT_SOFTWARE) ++ "=use if acceleration can't be determined) [default=" ++ OPENSSL_MSTR(DEVCRYPTO_DEFAULT_USE_SOFTDRIVERS) "]", ++ ENGINE_CMD_FLAG_NUMERIC}, ++#endif ++ ++ {DEVCRYPTO_CMD_CIPHERS, ++ "CIPHERS", ++ "either ALL, NONE, or a comma-separated list of ciphers to enable [default=ALL]", ++ ENGINE_CMD_FLAG_STRING}, ++ ++#ifdef IMPLEMENT_DIGEST ++ {DEVCRYPTO_CMD_DIGESTS, ++ "DIGESTS", ++ "either ALL, NONE, or a comma-separated list of digests to enable [default=ALL]", ++ ENGINE_CMD_FLAG_STRING}, ++#endif ++ ++ {DEVCRYPTO_CMD_DUMP_INFO, ++ "DUMP_INFO", ++ "dump info about each algorithm to stderr; use 'openssl engine -pre DUMP_INFO devcrypto'", ++ ENGINE_CMD_FLAG_NO_INPUT}, ++ ++ {0, NULL, NULL, 0} ++}; ++ ++static int devcrypto_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void)) ++{ ++ int *new_list; ++ switch (cmd) { ++#ifdef CIOCGSESSINFO ++ case DEVCRYPTO_CMD_USE_SOFTDRIVERS: ++ switch (i) { ++ case DEVCRYPTO_REQUIRE_ACCELERATED: ++ case DEVCRYPTO_USE_SOFTWARE: ++ case DEVCRYPTO_REJECT_SOFTWARE: ++ break; ++ default: ++ fprintf(stderr, "devcrypto: invalid value (%ld) for USE_SOFTDRIVERS\n", i); ++ return 0; ++ } ++ if (use_softdrivers == i) ++ return 1; ++ use_softdrivers = i; ++#ifdef IMPLEMENT_DIGEST ++ rebuild_known_digest_nids(e); ++#endif ++ rebuild_known_cipher_nids(e); ++ return 1; ++#endif /* CIOCGSESSINFO */ ++ ++ case DEVCRYPTO_CMD_CIPHERS: ++ if (p == NULL) ++ return 1; ++ if (strcasecmp((const char *)p, "ALL") == 0) { ++ devcrypto_select_all_ciphers(selected_ciphers); ++ } else if (strcasecmp((const char*)p, "NONE") == 0) { ++ memset(selected_ciphers, 0, sizeof(selected_ciphers)); ++ } else { ++ new_list=OPENSSL_zalloc(sizeof(selected_ciphers)); ++ if (!CONF_parse_list(p, ',', 1, cryptodev_select_cipher_cb, new_list)) { ++ OPENSSL_free(new_list); ++ return 0; ++ } ++ memcpy(selected_ciphers, new_list, sizeof(selected_ciphers)); ++ OPENSSL_free(new_list); ++ } ++ rebuild_known_cipher_nids(e); ++ return 1; ++ ++#ifdef IMPLEMENT_DIGEST ++ case DEVCRYPTO_CMD_DIGESTS: ++ if (p == NULL) ++ return 1; ++ if (strcasecmp((const char *)p, "ALL") == 0) { ++ devcrypto_select_all_digests(selected_digests); ++ } else if (strcasecmp((const char*)p, "NONE") == 0) { ++ memset(selected_digests, 0, sizeof(selected_digests)); ++ } else { ++ new_list=OPENSSL_zalloc(sizeof(selected_digests)); ++ if (!CONF_parse_list(p, ',', 1, cryptodev_select_digest_cb, new_list)) { ++ OPENSSL_free(new_list); ++ return 0; ++ } ++ memcpy(selected_digests, new_list, sizeof(selected_digests)); ++ OPENSSL_free(new_list); ++ } ++ rebuild_known_digest_nids(e); ++ return 1; ++#endif /* IMPLEMENT_DIGEST */ ++ ++ case DEVCRYPTO_CMD_DUMP_INFO: ++ dump_cipher_info(); ++#ifdef IMPLEMENT_DIGEST ++ dump_digest_info(); ++#endif ++ return 1; ++ ++ default: ++ break; ++ } ++ return 0; ++} ++ ++/****************************************************************************** ++ * ++ * LOAD / UNLOAD ++ * ++ *****/ ++ ++/* ++ * Opens /dev/crypto ++ */ ++static int open_devcrypto(void) ++{ ++ int fd; ++ ++ if (cfd >= 0) ++ return 1; ++ ++ if ((fd = open("/dev/crypto", O_RDWR, 0)) < 0) { ++#ifndef ENGINE_DEVCRYPTO_DEBUG ++ if (errno != ENOENT) ++#endif ++ fprintf(stderr, "Could not open /dev/crypto: %s\n", strerror(errno)); ++ return 0; ++ } ++ ++#ifdef CRIOGET ++ if (ioctl(fd, CRIOGET, &cfd) < 0) { ++ fprintf(stderr, "Could not create crypto fd: %s\n", strerror(errno)); ++ close(fd); ++ cfd = -1; ++ return 0; ++ } ++ close(fd); ++#else ++ cfd = fd; ++#endif ++ + return 1; +} + @@ -236,20 +2603,17 @@ index 2c1b52d572..eff1ed3a7d 100644 + if (ret != 0) { + fprintf(stderr, "Error closing /dev/crypto: %s\n", strerror(errno)); + return 0; - } ++ } + return 1; +} - -- prepare_cipher_methods(); ++ +static int devcrypto_unload(ENGINE *e) +{ + destroy_all_cipher_methods(); - #ifdef IMPLEMENT_DIGEST -- prepare_digest_methods(); ++#ifdef IMPLEMENT_DIGEST + destroy_all_digest_methods(); - #endif - -- if (!ENGINE_set_id(e, "devcrypto") ++#endif ++ + close_devcrypto(); + + return 1; @@ -258,13 +2622,12 @@ index 2c1b52d572..eff1ed3a7d 100644 +static int bind_devcrypto(ENGINE *e) { + + if (!ENGINE_set_id(e, engine_devcrypto_id) - || !ENGINE_set_name(e, "/dev/crypto engine") ++ || !ENGINE_set_name(e, "/dev/crypto engine") + || !ENGINE_set_destroy_function(e, devcrypto_unload) - || !ENGINE_set_cmd_defns(e, devcrypto_cmds) -- || !ENGINE_set_ctrl_function(e, devcrypto_ctrl) ++ || !ENGINE_set_cmd_defns(e, devcrypto_cmds) + || !ENGINE_set_ctrl_function(e, devcrypto_ctrl)) + return 0; - ++ + prepare_cipher_methods(); +#ifdef IMPLEMENT_DIGEST + prepare_digest_methods(); @@ -274,34 +2637,40 @@ index 2c1b52d572..eff1ed3a7d 100644 +#ifdef IMPLEMENT_DIGEST + && ENGINE_set_digests(e, devcrypto_digests) +#endif - /* - * Asymmetric ciphers aren't well supported with /dev/crypto. Among the BSD - * implementations, it seems to only exist in FreeBSD, and regarding the -@@ -1250,23 +1268,36 @@ void engine_load_devcrypto_int() - */ - #if 0 - # ifndef OPENSSL_NO_RSA -- || !ENGINE_set_RSA(e, devcrypto_rsa) ++/* ++ * Asymmetric ciphers aren't well supported with /dev/crypto. Among the BSD ++ * implementations, it seems to only exist in FreeBSD, and regarding the ++ * parameters in its crypt_kop, the manual crypto(4) has this to say: ++ * ++ * The semantics of these arguments are currently undocumented. ++ * ++ * Reading through the FreeBSD source code doesn't give much more than ++ * their CRK_MOD_EXP implementation for ubsec. ++ * ++ * It doesn't look much better with cryptodev-linux. They have the crypt_kop ++ * structure as well as the command (CRK_*) in cryptodev.h, but no support ++ * seems to be implemented at all for the moment. ++ * ++ * At the time of writing, it seems impossible to write proper support for ++ * FreeBSD's asym features without some very deep knowledge and access to ++ * specific kernel modules. ++ * ++ * /Richard Levitte, 2017-05-11 ++ */ ++#if 0 ++# ifndef OPENSSL_NO_RSA + && ENGINE_set_RSA(e, devcrypto_rsa) - # endif - # ifndef OPENSSL_NO_DSA -- || !ENGINE_set_DSA(e, devcrypto_dsa) ++# endif ++# ifndef OPENSSL_NO_DSA + && ENGINE_set_DSA(e, devcrypto_dsa) - # endif - # ifndef OPENSSL_NO_DH -- || !ENGINE_set_DH(e, devcrypto_dh) ++# endif ++# ifndef OPENSSL_NO_DH + && ENGINE_set_DH(e, devcrypto_dh) - # endif - # ifndef OPENSSL_NO_EC -- || !ENGINE_set_EC(e, devcrypto_ec) ++# endif ++# ifndef OPENSSL_NO_EC + && ENGINE_set_EC(e, devcrypto_ec) - # endif - #endif -- || !ENGINE_set_ciphers(e, devcrypto_ciphers) --#ifdef IMPLEMENT_DIGEST -- || !ENGINE_set_digests(e, devcrypto_digests) --#endif -- ) { ++# endif ++#endif + ); +} + @@ -320,13 +2689,14 @@ index 2c1b52d572..eff1ed3a7d 100644 + if ((e = ENGINE_new()) == NULL + || !bind_devcrypto(e)) { + close_devcrypto(); - ENGINE_free(e); - return; - } -@@ -1275,3 +1306,22 @@ void engine_load_devcrypto_int() - ENGINE_free(e); /* Loose our local reference */ - ERR_clear_error(); - } ++ ENGINE_free(e); ++ return; ++ } ++ ++ ENGINE_add(e); ++ ENGINE_free(e); /* Loose our local reference */ ++ ERR_clear_error(); ++} + +#else + diff --git a/package/libs/openssl/patches/500-e_devcrypto-default-to-not-use-digests-in-engine.patch b/package/libs/openssl/patches/500-e_devcrypto-default-to-not-use-digests-in-engine.patch index 1f1cd7a582..df5c16d8d2 100644 --- a/package/libs/openssl/patches/500-e_devcrypto-default-to-not-use-digests-in-engine.patch +++ b/package/libs/openssl/patches/500-e_devcrypto-default-to-not-use-digests-in-engine.patch @@ -19,8 +19,6 @@ turn them on if it is safe and fast enough. Signed-off-by: Eneas U de Queiroz -diff --git a/engines/e_devcrypto.c b/engines/e_devcrypto.c -index 3fcd81de7a..d25230d366 100644 --- a/engines/e_devcrypto.c +++ b/engines/e_devcrypto.c @@ -852,7 +852,7 @@ static void prepare_digest_methods(void) @@ -32,7 +30,7 @@ index 3fcd81de7a..d25230d366 100644 /* * Check that the digest is usable -@@ -1072,7 +1072,7 @@ static const ENGINE_CMD_DEFN devcrypto_cmds[] = { +@@ -1072,7 +1072,7 @@ static const ENGINE_CMD_DEFN devcrypto_c #ifdef IMPLEMENT_DIGEST {DEVCRYPTO_CMD_DIGESTS, "DIGESTS", diff --git a/package/libs/openssl/patches/510-e_devcrypto-ignore-error-when-closing-session.patch b/package/libs/openssl/patches/510-e_devcrypto-ignore-error-when-closing-session.patch index bc514b88c9..87792cf9d0 100644 --- a/package/libs/openssl/patches/510-e_devcrypto-ignore-error-when-closing-session.patch +++ b/package/libs/openssl/patches/510-e_devcrypto-ignore-error-when-closing-session.patch @@ -8,11 +8,9 @@ session. It may have been closed by another process after a fork. Signed-off-by: Eneas U de Queiroz -diff --git a/engines/e_devcrypto.c b/engines/e_devcrypto.c -index d25230d366..f4570f1666 100644 --- a/engines/e_devcrypto.c +++ b/engines/e_devcrypto.c -@@ -195,9 +195,8 @@ static int cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, +@@ -195,9 +195,8 @@ static int cipher_init(EVP_CIPHER_CTX *c get_cipher_data(EVP_CIPHER_CTX_nid(ctx)); /* cleanup a previous session */ From c58384be89a3f6666fdb206fa2c161b69630246f Mon Sep 17 00:00:00 2001 From: Tomasz Maciej Nowak Date: Mon, 3 Oct 2022 15:20:10 +0200 Subject: [PATCH 007/137] ipq40xx: luma_wrtq-acn329: swap ethernet MAC addresses Adjust them according to OEM firmware. Fixes: e24635710c7e (" ipq40xx: add support for Luma Home WRTQ-329ACN") Signed-off-by: Tomasz Maciej Nowak --- .../files/arch/arm/boot/dts/qcom-ipq4018-wrtq-329acn.dts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wrtq-329acn.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wrtq-329acn.dts index 2465348a82..1496f145bd 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wrtq-329acn.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wrtq-329acn.dts @@ -9,6 +9,11 @@ model = "Luma Home WRTQ-329ACN"; compatible = "luma,wrtq-329acn"; + aliases { + ethernet0 = &gmac1; + ethernet1 = &gmac0; + }; + i2c-gpio { compatible = "i2c-gpio"; sda-gpios = <&tlmm 1 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; From d604032c2a50fc6228bcaae78baee1048ff9af16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= Date: Wed, 14 Sep 2022 21:31:40 +0300 Subject: [PATCH 008/137] ramips: fix GB-PC1 and GB-PC2 device support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change switch port labels to ethblack & ethblue. Change lan1 & lan2 LEDs to ethblack_act & ethblue_act and fix GPIO pins. Add the external phy with ethyellow label on the GB-PC2 devicetree. Do not claim rgmii2 as gpio, it's used for ethernet with rgmii2 function. Enable ICPlus PHY driver for IP1001 which GB-PC2 has got. Update interface name and change netdev function. Enable lzma compression to make up for the increased size of the kernel. Make spi flash bindings on par with mainline Linux to fix read errors. Tested on GB-PC2 by Petr. Tested-by: Petr Louda Signed-off-by: Arınç ÜNAL (cherry picked from commit 4807bd6a00bcf44dd821047db76a2a799f403cd4) --- .../linux/ramips/dts/mt7621_gnubee_gb-pc1.dts | 47 ++++++------ .../linux/ramips/dts/mt7621_gnubee_gb-pc2.dts | 73 ++++++++++--------- target/linux/ramips/image/mt7621.mk | 2 + .../mt7621/base-files/etc/board.d/01_leds | 4 +- .../mt7621/base-files/etc/board.d/02_network | 6 +- target/linux/ramips/mt7621/config-5.4 | 1 + 6 files changed, 73 insertions(+), 60 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_gnubee_gb-pc1.dts b/target/linux/ramips/dts/mt7621_gnubee_gb-pc1.dts index c218521c03..28601445e5 100644 --- a/target/linux/ramips/dts/mt7621_gnubee_gb-pc1.dts +++ b/target/linux/ramips/dts/mt7621_gnubee_gb-pc1.dts @@ -8,10 +8,10 @@ model = "GB-PC1"; aliases { - led-boot = &led_status; - led-failsafe = &led_status; - led-running = &led_status; - led-upgrade = &led_status; + led-boot = &led_system; + led-failsafe = &led_system; + led-running = &led_system; + led-upgrade = &led_system; }; keys { @@ -27,24 +27,26 @@ leds { compatible = "gpio-leds"; - system { - label = "green:system"; + ethblack_act { + label = "green:ethblack_act"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + + ethblue_act { + label = "green:ethblue_act"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + power { + label = "green:power"; gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; }; - led_status: status { - label = "green:status"; + led_system: system { + label = "green:system"; gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - }; - - lan1 { - label = "green:lan1"; - gpios = <&gpio 24 GPIO_ACTIVE_LOW>; - }; - - lan2 { - label = "green:lan2"; - gpios = <&gpio 25 GPIO_ACTIVE_LOW>; + linux,default-trigger = "disk-activity"; }; }; }; @@ -59,9 +61,8 @@ flash@0 { compatible = "jedec,spi-nor"; reg = <0>; - spi-max-frequency = <80000000>; + spi-max-frequency = <50000000>; broken-flash-reset; - m25p,fast-read; partitions { compatible = "fixed-partitions"; @@ -107,19 +108,19 @@ ports { port@0 { status = "okay"; - label = "lan1"; + label = "ethblack"; }; port@4 { status = "okay"; - label = "lan2"; + label = "ethblue"; }; }; }; &state_default { gpio { - groups = "jtag", "rgmii2", "uart3", "wdt"; + groups = "jtag", "uart3", "wdt"; function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/mt7621_gnubee_gb-pc2.dts b/target/linux/ramips/dts/mt7621_gnubee_gb-pc2.dts index 613524d1da..c25ca886ae 100644 --- a/target/linux/ramips/dts/mt7621_gnubee_gb-pc2.dts +++ b/target/linux/ramips/dts/mt7621_gnubee_gb-pc2.dts @@ -8,10 +8,10 @@ model = "GB-PC2"; aliases { - led-boot = &led_status; - led-failsafe = &led_status; - led-running = &led_status; - led-upgrade = &led_status; + led-boot = &led_system; + led-failsafe = &led_system; + led-running = &led_system; + led-upgrade = &led_system; }; keys { @@ -27,34 +27,26 @@ leds { compatible = "gpio-leds"; - system { - label = "green:system"; + ethblack_act { + label = "green:ethblack_act"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + + ethblue_act { + label = "green:ethblue_act"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + power { + label = "green:power"; gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; }; - led_status: status { - label = "green:status"; + led_system: system { + label = "green:system"; gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - }; - - lan1 { - label = "green:lan1"; - gpios = <&gpio 24 GPIO_ACTIVE_LOW>; - }; - - lan2 { - label = "green:lan2"; - gpios = <&gpio 25 GPIO_ACTIVE_LOW>; - }; - - lan3-yellow { - label = "yellow:lan3"; - gpios = <&gpio 13 GPIO_ACTIVE_LOW>; - }; - - lan3-green { - label = "green:lan3"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + linux,default-trigger = "disk-activity"; }; }; }; @@ -69,9 +61,8 @@ flash@0 { compatible = "jedec,spi-nor"; reg = <0>; - spi-max-frequency = <80000000>; + spi-max-frequency = <50000000>; broken-flash-reset; - m25p,fast-read; partitions { compatible = "fixed-partitions"; @@ -113,23 +104,39 @@ mtd-mac-address = <&factory 0xe000>; }; +&gmac1 { + status = "okay"; + label = "ethyellow"; + phy-handle = <ðphy5>; + + nvmem-cells = <&macaddr_factory_e000>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy5: ethernet-phy@5 { + reg = <5>; + phy-mode = "rgmii-rxid"; + }; +}; + &switch0 { ports { port@0 { status = "okay"; - label = "lan1"; + label = "ethblack"; }; port@4 { status = "okay"; - label = "lan2"; + label = "ethblue"; }; }; }; &state_default { gpio { - groups = "jtag", "rgmii2", "uart3", "wdt"; + groups = "jtag", "uart3", "wdt"; function = "gpio"; }; }; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index c62087d870..36a03e872f 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -594,6 +594,7 @@ TARGET_DEVICES += glinet_gl-mt1300 define Device/gnubee_gb-pc1 $(Device/dsa-migration) + $(Device/uimage-lzma-loader) DEVICE_VENDOR := GnuBee DEVICE_MODEL := Personal Cloud One DEVICE_PACKAGES := kmod-ata-ahci kmod-usb3 kmod-sdhci-mt7620 -wpad-basic-wolfssl @@ -603,6 +604,7 @@ TARGET_DEVICES += gnubee_gb-pc1 define Device/gnubee_gb-pc2 $(Device/dsa-migration) + $(Device/uimage-lzma-loader) DEVICE_VENDOR := GnuBee DEVICE_MODEL := Personal Cloud Two DEVICE_PACKAGES := kmod-ata-ahci kmod-usb3 kmod-sdhci-mt7620 -wpad-basic-wolfssl diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index 95cf120f2d..5234a773ef 100755 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -44,8 +44,8 @@ dlink,dir-882-r1) ;; gnubee,gb-pc1|\ gnubee,gb-pc2) - ucidef_set_led_netdev "lan1" "lan1" "green:lan1" "lan1" - ucidef_set_led_netdev "lan2" "lan2" "green:lan2" "lan2" + ucidef_set_led_netdev "ethblack_act" "ethblack act" "green:ethblack_act" "ethblack" "tx rx" + ucidef_set_led_netdev "ethblue_act" "ethblue act" "green:ethblue_act" "ethblue" "tx rx" ;; linksys,e5600) ucidef_set_led_netdev "wan" "wan link" "blue:wan" "wan" "link" diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index 4d081bed8c..9ebe652f83 100755 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -45,9 +45,11 @@ ramips_setup_interfaces() xiaomi,mi-router-4a-gigabit) ucidef_set_interfaces_lan_wan "lan1 lan2" "wan" ;; - gnubee,gb-pc1|\ + gnubee,gb-pc1) + ucidef_set_interface_lan "ethblack ethblue" + ;; gnubee,gb-pc2) - ucidef_set_interface_lan "lan1 lan2" + ucidef_set_interface_lan "ethblack ethblue ethyellow" ;; linksys,re6500|\ netgear,wac104) diff --git a/target/linux/ramips/mt7621/config-5.4 b/target/linux/ramips/mt7621/config-5.4 index 642543f588..6ff91a9da7 100644 --- a/target/linux/ramips/mt7621/config-5.4 +++ b/target/linux/ramips/mt7621/config-5.4 @@ -107,6 +107,7 @@ CONFIG_HZ_PERIODIC=y CONFIG_I2C=y CONFIG_I2C_BOARDINFO=y CONFIG_I2C_MT7621=y +CONFIG_ICPLUS_PHY=y CONFIG_INITRAMFS_SOURCE="" CONFIG_IRQCHIP=y CONFIG_IRQ_DOMAIN=y From 794ddf5ca2c67af82f22061a617b2c23c65380fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= Date: Wed, 14 Sep 2022 21:31:41 +0300 Subject: [PATCH 009/137] ramips: fix GB-PC1 and GB-PC2 LEDs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add the missing LEDs for GB-PC2. Some of these LEDs don't exist on the device schematics. Tests on a GB-PC2 by me and Petr proved otherwise. Remove ethblack-green and ethblue-green LEDs for GB-PC1. They are not wired to GPIO 3 or 4 and the wiring is currently unknown. Set ethyellow-orange to display link state and activity of the ethyellow interface for GB-PC2. Link: https://github.com/ngiger/GnuBee_Docs/blob/master/GB-PCx/Documents/GB-PC2_V1.1_schematic.pdf Tested-by: Petr Louda Signed-off-by: Arınç ÜNAL (cherry picked from commit 2a6ef7f53d7b96e4ee0200196c28ed6b0a7c8465) --- .../linux/ramips/dts/mt7621_gnubee_gb-pc1.dts | 10 ---------- .../linux/ramips/dts/mt7621_gnubee_gb-pc2.dts | 18 ++++++++++++++---- .../mt7621/base-files/etc/board.d/01_leds | 4 +--- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_gnubee_gb-pc1.dts b/target/linux/ramips/dts/mt7621_gnubee_gb-pc1.dts index 28601445e5..5910f112f6 100644 --- a/target/linux/ramips/dts/mt7621_gnubee_gb-pc1.dts +++ b/target/linux/ramips/dts/mt7621_gnubee_gb-pc1.dts @@ -27,16 +27,6 @@ leds { compatible = "gpio-leds"; - ethblack_act { - label = "green:ethblack_act"; - gpios = <&gpio 3 GPIO_ACTIVE_LOW>; - }; - - ethblue_act { - label = "green:ethblue_act"; - gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - }; - power { label = "green:power"; gpios = <&gpio 6 GPIO_ACTIVE_LOW>; diff --git a/target/linux/ramips/dts/mt7621_gnubee_gb-pc2.dts b/target/linux/ramips/dts/mt7621_gnubee_gb-pc2.dts index c25ca886ae..8d0eaee1d4 100644 --- a/target/linux/ramips/dts/mt7621_gnubee_gb-pc2.dts +++ b/target/linux/ramips/dts/mt7621_gnubee_gb-pc2.dts @@ -27,16 +27,26 @@ leds { compatible = "gpio-leds"; - ethblack_act { - label = "green:ethblack_act"; + ethblack-green { + label = "green:ethblack"; gpios = <&gpio 3 GPIO_ACTIVE_LOW>; }; - ethblue_act { - label = "green:ethblue_act"; + ethblue-green { + label = "green:ethblue"; gpios = <&gpio 4 GPIO_ACTIVE_LOW>; }; + ethyellow-green { + label = "green:ethyellow"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + ethyellow-orange { + label = "orange:ethyellow"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + }; + power { label = "green:power"; gpios = <&gpio 6 GPIO_ACTIVE_LOW>; diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index 5234a773ef..d9df98c63f 100755 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -42,10 +42,8 @@ dlink,dir-882-a1|\ dlink,dir-882-r1) ucidef_set_led_netdev "wan" "wan" "green:net" "wan" ;; -gnubee,gb-pc1|\ gnubee,gb-pc2) - ucidef_set_led_netdev "ethblack_act" "ethblack act" "green:ethblack_act" "ethblack" "tx rx" - ucidef_set_led_netdev "ethblue_act" "ethblue act" "green:ethblue_act" "ethblue" "tx rx" + ucidef_set_led_netdev "ethyellow" "ethyellow" "orange:ethyellow" "ethyellow" "link tx rx" ;; linksys,e5600) ucidef_set_led_netdev "wan" "wan link" "blue:wan" "wan" "link" From e506a0d50fed3d7e3ae2b88682b1d8e94efa9805 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 27 Nov 2022 15:34:18 +0100 Subject: [PATCH 010/137] kernel: bump 5.4 to 5.4.224 Compile-tested: x86/64 Run-tested: x86/64 Signed-off-by: Hauke Mehrtens --- include/kernel-version.mk | 4 ++-- .../950-0043-MMC-added-alternative-MMC-driver.patch | 2 +- target/linux/generic/hack-5.4/221-module_exports.patch | 4 ++-- ...dwc3-Add-workaround-for-host-mode-VBUS-glitch-wh.patch | 8 ++++---- .../mediatek/patches-5.4/0900-bt-mtk-serial-fix.patch | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/kernel-version.mk b/include/kernel-version.mk index 9b8325db0a..7480663923 100644 --- a/include/kernel-version.mk +++ b/include/kernel-version.mk @@ -6,9 +6,9 @@ ifdef CONFIG_TESTING_KERNEL KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER) endif -LINUX_VERSION-5.4 = .224 +LINUX_VERSION-5.4 = .225 -LINUX_KERNEL_HASH-5.4.224 = 8b7df25b5560620eb2776d7b7c67569764b3916ff2f596767f72567b38d13d36 +LINUX_KERNEL_HASH-5.4.225 = 59f596f6714317955cf481590babcf015aff2bc1900bd8e8dc8f7af73bc560aa 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/bcm27xx/patches-5.4/950-0043-MMC-added-alternative-MMC-driver.patch b/target/linux/bcm27xx/patches-5.4/950-0043-MMC-added-alternative-MMC-driver.patch index 34ad1be438..e688302597 100644 --- a/target/linux/bcm27xx/patches-5.4/950-0043-MMC-added-alternative-MMC-driver.patch +++ b/target/linux/bcm27xx/patches-5.4/950-0043-MMC-added-alternative-MMC-driver.patch @@ -267,7 +267,7 @@ Signed-off-by: Yaroslav Rosomakho goto out; --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c -@@ -1925,7 +1925,8 @@ EXPORT_SYMBOL(mmc_erase); +@@ -1931,7 +1931,8 @@ EXPORT_SYMBOL(mmc_erase); int mmc_can_erase(struct mmc_card *card) { if ((card->host->caps & MMC_CAP_ERASE) && diff --git a/target/linux/generic/hack-5.4/221-module_exports.patch b/target/linux/generic/hack-5.4/221-module_exports.patch index 47f40ac5e1..446bf53008 100644 --- a/target/linux/generic/hack-5.4/221-module_exports.patch +++ b/target/linux/generic/hack-5.4/221-module_exports.patch @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau /* Align . to a 8 byte boundary equals to maximum function alignment. */ #define ALIGN_FUNCTION() . = ALIGN(8) -@@ -407,14 +417,14 @@ +@@ -408,14 +418,14 @@ /* Kernel symbol table: Normal symbols */ \ __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \ __start___ksymtab = .; \ @@ -47,7 +47,7 @@ Signed-off-by: Felix Fietkau __stop___ksymtab_gpl = .; \ } \ \ -@@ -476,7 +486,7 @@ +@@ -477,7 +487,7 @@ \ /* Kernel symbol table: strings */ \ __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \ diff --git a/target/linux/layerscape/patches-5.4/820-usb-0009-usb-dwc3-Add-workaround-for-host-mode-VBUS-glitch-wh.patch b/target/linux/layerscape/patches-5.4/820-usb-0009-usb-dwc3-Add-workaround-for-host-mode-VBUS-glitch-wh.patch index a5b84f3db9..0e2942a3bc 100644 --- a/target/linux/layerscape/patches-5.4/820-usb-0009-usb-dwc3-Add-workaround-for-host-mode-VBUS-glitch-wh.patch +++ b/target/linux/layerscape/patches-5.4/820-usb-0009-usb-dwc3-Add-workaround-for-host-mode-VBUS-glitch-wh.patch @@ -64,9 +64,9 @@ Reviewed-by: Peter Chen --- a/drivers/usb/dwc3/host.c +++ b/drivers/usb/dwc3/host.c -@@ -16,6 +16,44 @@ static const struct xhci_plat_priv dwc3_ - .quirks = XHCI_SKIP_PHY_INIT, - }; +@@ -11,6 +11,44 @@ + + #include "core.h" +#define XHCI_HCSPARAMS1 0x4 +#define XHCI_PORTSC_BASE 0x400 @@ -109,7 +109,7 @@ Reviewed-by: Peter Chen static int dwc3_host_get_irq(struct dwc3 *dwc) { struct platform_device *dwc3_pdev = to_platform_device(dwc->dev); -@@ -55,6 +93,13 @@ int dwc3_host_init(struct dwc3 *dwc) +@@ -50,6 +88,13 @@ int dwc3_host_init(struct dwc3 *dwc) struct platform_device *dwc3_pdev = to_platform_device(dwc->dev); int prop_idx = 0; diff --git a/target/linux/mediatek/patches-5.4/0900-bt-mtk-serial-fix.patch b/target/linux/mediatek/patches-5.4/0900-bt-mtk-serial-fix.patch index 64b556088d..a25c845ffc 100644 --- a/target/linux/mediatek/patches-5.4/0900-bt-mtk-serial-fix.patch +++ b/target/linux/mediatek/patches-5.4/0900-bt-mtk-serial-fix.patch @@ -19,7 +19,7 @@ }, [PORT_NPCM] = { .name = "Nuvoton 16550", -@@ -2612,6 +2612,11 @@ serial8250_do_set_termios(struct uart_po +@@ -2615,6 +2615,11 @@ serial8250_do_set_termios(struct uart_po unsigned long flags; unsigned int baud, quot, frac = 0; From b33090a0faf73d5d03e96c132c413776d6ed8b87 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Wed, 16 Nov 2022 08:48:02 +0100 Subject: [PATCH 011/137] wolfssl: update to v5.5.3 Remove "200-ecc-rng.patch" because it was upstramed by: https://github.com/wolfSSL/wolfssl/commit/e2566bab2122949a6a0bb2276d0a52598794d7d0 Refreshed "100-disable-hardening-check.patch". Fixes CVE 2022-42905. Release Notes: - https://github.com/wolfSSL/wolfssl/releases/tag/v5.5.2-stable - https://github.com/wolfSSL/wolfssl/releases/tag/v5.5.3-stable Signed-off-by: Nick Hainke (cherry picked from commit 745f1ca9767716c43864a2b7a43ed60b16c25560) --- package/libs/wolfssl/Makefile | 4 +- .../patches/100-disable-hardening-check.patch | 2 +- .../patches/110-build-with-libtool-2.4.patch | 4 +- .../libs/wolfssl/patches/200-ecc-rng.patch | 50 ------------------- 4 files changed, 4 insertions(+), 56 deletions(-) delete mode 100644 package/libs/wolfssl/patches/200-ecc-rng.patch diff --git a/package/libs/wolfssl/Makefile b/package/libs/wolfssl/Makefile index a1c968b81f..8c59872393 100644 --- a/package/libs/wolfssl/Makefile +++ b/package/libs/wolfssl/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=wolfssl -PKG_VERSION:=5.5.1-stable +PKG_VERSION:=5.5.3-stable PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/wolfSSL/wolfssl/archive/v$(PKG_VERSION) -PKG_HASH:=97339e6956c90e7c881ba5c748dd04f7c30e5dbe0c06da765418c51375a6dee3 +PKG_HASH:=fd3135b8657d09fb96a8aad16585da850b96ea420ae8ce5ac4d5fdfc614c2683 PKG_FIXUP:=libtool libtool-abiver PKG_INSTALL:=1 diff --git a/package/libs/wolfssl/patches/100-disable-hardening-check.patch b/package/libs/wolfssl/patches/100-disable-hardening-check.patch index 01bb5974ba..904b424fa0 100644 --- a/package/libs/wolfssl/patches/100-disable-hardening-check.patch +++ b/package/libs/wolfssl/patches/100-disable-hardening-check.patch @@ -1,6 +1,6 @@ --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h -@@ -2445,7 +2445,7 @@ extern void uITRON4_free(void *p) ; +@@ -2455,7 +2455,7 @@ extern void uITRON4_free(void *p) ; #endif /* warning for not using harden build options (default with ./configure) */ diff --git a/package/libs/wolfssl/patches/110-build-with-libtool-2.4.patch b/package/libs/wolfssl/patches/110-build-with-libtool-2.4.patch index 206c6dac6a..f773df7a89 100644 --- a/package/libs/wolfssl/patches/110-build-with-libtool-2.4.patch +++ b/package/libs/wolfssl/patches/110-build-with-libtool-2.4.patch @@ -1,5 +1,3 @@ -diff --git a/configure.ac b/configure.ac -index 144c857e4..de7f6b45a 100644 --- a/configure.ac +++ b/configure.ac @@ -32,7 +32,7 @@ AC_ARG_PROGRAM @@ -10,4 +8,4 @@ index 144c857e4..de7f6b45a 100644 +LT_PREREQ([2.4]) LT_INIT([disable-static win32-dll]) - #shared library versioning + AC_ARG_VAR(EXTRA_CFLAGS, [Extra CFLAGS to add to autoconf-computed arg list. Can also supply directly to make.]) diff --git a/package/libs/wolfssl/patches/200-ecc-rng.patch b/package/libs/wolfssl/patches/200-ecc-rng.patch deleted file mode 100644 index d68ef7f385..0000000000 --- a/package/libs/wolfssl/patches/200-ecc-rng.patch +++ /dev/null @@ -1,50 +0,0 @@ -Since commit 6467de5a8840 ("Randomize z ordinates in scalar -mult when timing resistant") wolfssl requires a RNG for an EC -key when the hardened built option is selected. - -wc_ecc_set_rng is only available when built hardened, so there -is no safe way to install the RNG to the key regardless whether -or not wolfssl is compiled hardened. - -Always export wc_ecc_set_rng so tools such as hostapd can install -RNG regardless of the built settings for wolfssl. - ---- a/wolfcrypt/src/ecc.c -+++ b/wolfcrypt/src/ecc.c -@@ -12348,21 +12348,21 @@ void wc_ecc_fp_free(void) - - #endif /* FP_ECC */ - --#ifdef ECC_TIMING_RESISTANT - int wc_ecc_set_rng(ecc_key* key, WC_RNG* rng) - { - int err = 0; - -+#ifdef ECC_TIMING_RESISTANT - if (key == NULL) { - err = BAD_FUNC_ARG; - } - else { - key->rng = rng; - } -+#endif - - return err; - } --#endif - - #ifdef HAVE_ECC_ENCRYPT - ---- a/wolfssl/wolfcrypt/ecc.h -+++ b/wolfssl/wolfcrypt/ecc.h -@@ -650,10 +650,8 @@ WOLFSSL_ABI WOLFSSL_API - void wc_ecc_fp_free(void); - WOLFSSL_LOCAL - void wc_ecc_fp_init(void); --#ifdef ECC_TIMING_RESISTANT - WOLFSSL_API - int wc_ecc_set_rng(ecc_key* key, WC_RNG* rng); --#endif - - WOLFSSL_API - int wc_ecc_set_curve(ecc_key* key, int keysize, int curve_id); From 26f2161cafec1e71ae44db58dd6da0b6034694ae Mon Sep 17 00:00:00 2001 From: hanwckf Date: Thu, 1 Dec 2022 02:36:33 +0800 Subject: [PATCH 012/137] kernel: add brcm fullconenat --- .../954-add-bcm-fullconenat-support.patch | 235 ++++++++++++++++++ 1 file changed, 235 insertions(+) create mode 100644 target/linux/generic/hack-5.4/954-add-bcm-fullconenat-support.patch diff --git a/target/linux/generic/hack-5.4/954-add-bcm-fullconenat-support.patch b/target/linux/generic/hack-5.4/954-add-bcm-fullconenat-support.patch new file mode 100644 index 0000000000..41b16c36d6 --- /dev/null +++ b/target/linux/generic/hack-5.4/954-add-bcm-fullconenat-support.patch @@ -0,0 +1,235 @@ +--- a/net/netfilter/nf_nat_masquerade.c ++++ b/net/netfilter/nf_nat_masquerade.c +@@ -8,6 +8,9 @@ + #include + + #include ++#include ++#include ++#include + + struct masq_dev_work { + struct work_struct work; +@@ -23,6 +26,129 @@ static DEFINE_MUTEX(masq_mutex); + static unsigned int masq_refcnt __read_mostly; + static atomic_t masq_worker_count __read_mostly; + ++static void bcm_nat_expect(struct nf_conn *ct, ++ struct nf_conntrack_expect *exp) ++{ ++ struct nf_nat_range2 range; ++ ++ /* This must be a fresh one. */ ++ BUG_ON(ct->status & IPS_NAT_DONE_MASK); ++ ++ /* Change src to where new ct comes from */ ++ range.flags = NF_NAT_RANGE_MAP_IPS; ++ range.min_addr = range.max_addr = ++ ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3; ++ nf_nat_setup_info(ct, &range, NF_NAT_MANIP_SRC); ++ ++ /* For DST manip, map port here to where it's expected. */ ++ range.flags = (NF_NAT_RANGE_MAP_IPS | NF_NAT_RANGE_PROTO_SPECIFIED); ++ range.min_proto = range.max_proto = exp->saved_proto; ++ range.min_addr = range.max_addr = exp->saved_addr; ++ nf_nat_setup_info(ct, &range, NF_NAT_MANIP_DST); ++} ++ ++/****************************************************************************/ ++static int bcm_nat_help(struct sk_buff *skb, unsigned int protoff, ++ struct nf_conn *ct, enum ip_conntrack_info ctinfo) ++{ ++ int dir = CTINFO2DIR(ctinfo); ++ struct nf_conn_help *help = nfct_help(ct); ++ struct nf_conntrack_expect *exp; ++ ++ if (dir != IP_CT_DIR_ORIGINAL || ++ help->expecting[NF_CT_EXPECT_CLASS_DEFAULT]) ++ return NF_ACCEPT; ++ ++ pr_debug("bcm_nat: packet[%d bytes] ", skb->len); ++ nf_ct_dump_tuple(&ct->tuplehash[dir].tuple); ++ pr_debug("reply: "); ++ nf_ct_dump_tuple(&ct->tuplehash[!dir].tuple); ++ ++ /* Create expect */ ++ if ((exp = nf_ct_expect_alloc(ct)) == NULL) ++ return NF_ACCEPT; ++ ++ nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, AF_INET, NULL, ++ &ct->tuplehash[!dir].tuple.dst.u3, IPPROTO_UDP, ++ NULL, &ct->tuplehash[!dir].tuple.dst.u.udp.port); ++ exp->flags = NF_CT_EXPECT_PERMANENT; ++ exp->saved_addr = ct->tuplehash[dir].tuple.src.u3; ++ exp->saved_proto.udp.port = ct->tuplehash[dir].tuple.src.u.udp.port; ++ exp->dir = !dir; ++ exp->expectfn = bcm_nat_expect; ++ ++ /* Setup expect */ ++ nf_ct_expect_related(exp, 0); ++ nf_ct_expect_put(exp); ++ pr_debug("bcm_nat: expect setup\n"); ++ ++ return NF_ACCEPT; ++} ++ ++/****************************************************************************/ ++static struct nf_conntrack_expect_policy bcm_nat_exp_policy __read_mostly = { ++ .max_expected = 1000, ++ .timeout = 240, ++}; ++ ++/****************************************************************************/ ++static struct nf_conntrack_helper nf_conntrack_helper_bcm_nat __read_mostly = { ++ .name = "BCM-NAT", ++ .me = THIS_MODULE, ++ .tuple.src.l3num = AF_INET, ++ .tuple.dst.protonum = IPPROTO_UDP, ++ .expect_policy = &bcm_nat_exp_policy, ++ .expect_class_max = 1, ++ .help = bcm_nat_help, ++}; ++ ++/****************************************************************************/ ++static inline int find_exp(__be32 ip, __be16 port, struct nf_conn *ct) ++{ ++ struct nf_conntrack_tuple tuple; ++ struct nf_conntrack_expect *i = NULL; ++ ++ ++ memset(&tuple, 0, sizeof(tuple)); ++ tuple.src.l3num = AF_INET; ++ tuple.dst.protonum = IPPROTO_UDP; ++ tuple.dst.u3.ip = ip; ++ tuple.dst.u.udp.port = port; ++ ++ rcu_read_lock(); ++ i = __nf_ct_expect_find(nf_ct_net(ct), nf_ct_zone(ct), &tuple); ++ rcu_read_unlock(); ++ ++ return i != NULL; ++} ++ ++/****************************************************************************/ ++static inline struct nf_conntrack_expect *find_fullcone_exp(struct nf_conn *ct) ++{ ++ struct nf_conntrack_tuple * tp = ++ &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple; ++ struct nf_conntrack_expect * exp = NULL; ++ struct nf_conntrack_expect * i; ++ unsigned int h; ++ ++ rcu_read_lock(); ++ for (h = 0; h < nf_ct_expect_hsize; h++) { ++ hlist_for_each_entry_rcu(i, &nf_ct_expect_hash[h], hnode) { ++ if (nf_inet_addr_cmp(&i->saved_addr, &tp->src.u3) && ++ i->saved_proto.all == tp->src.u.all && ++ i->tuple.dst.protonum == tp->dst.protonum && ++ i->tuple.src.u3.ip == 0 && ++ i->tuple.src.u.udp.port == 0) { ++ exp = i; ++ break; ++ } ++ } ++ } ++ rcu_read_unlock(); ++ ++ return exp; ++} ++ + unsigned int + nf_nat_masquerade_ipv4(struct sk_buff *skb, unsigned int hooknum, + const struct nf_nat_range2 *range, +@@ -60,6 +186,72 @@ nf_nat_masquerade_ipv4(struct sk_buff *s + if (nat) + nat->masq_index = out->ifindex; + ++/* RFC 4787 - 4.2.2. Port Parity ++ i.e., an even port will be mapped to an even port, and an odd port will be mapped to an odd port. ++*/ ++#define CHECK_PORT_PARITY(a, b) ((a%2)==(b%2)) ++ if (range->min_addr.ip != 0 /* nat_mode == full cone */ ++ && (nfct_help(ct) == NULL || nfct_help(ct)->helper == NULL) ++ && nf_ct_protonum(ct) == IPPROTO_UDP) { ++ unsigned int ret; ++ u_int16_t minport; ++ u_int16_t maxport; ++ struct nf_conntrack_expect *exp; ++ ++ pr_debug("bcm_nat: need full cone NAT\n"); ++ ++ /* Choose port */ ++ spin_lock_bh(&nf_conntrack_expect_lock); ++ /* Look for existing expectation */ ++ exp = find_fullcone_exp(ct); ++ if (exp) { ++ minport = maxport = exp->tuple.dst.u.udp.port; ++ pr_debug("bcm_nat: existing mapped port = %hu\n", ++ ntohs(minport)); ++ } else { /* no previous expect */ ++ u_int16_t newport, tmpport, orgport; ++ ++ minport = range->min_proto.all == 0? ++ ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src. ++ u.udp.port : range->min_proto.all; ++ maxport = range->max_proto.all == 0? ++ htons(65535) : range->max_proto.all; ++ orgport = ntohs(minport); ++ for (newport = ntohs(minport),tmpport = ntohs(maxport); ++ newport <= tmpport; newport++) { ++ if (CHECK_PORT_PARITY(orgport, newport) && !find_exp(newsrc, htons(newport), ct)) { ++ pr_debug("bcm_nat: new mapped port = " ++ "%hu\n", newport); ++ minport = maxport = htons(newport); ++ break; ++ } ++ } ++ } ++ spin_unlock_bh(&nf_conntrack_expect_lock); ++ ++ ++ memset(&newrange.min_addr, 0, sizeof(newrange.min_addr)); ++ memset(&newrange.max_addr, 0, sizeof(newrange.max_addr)); ++ ++ newrange.flags = range->flags | NF_NAT_RANGE_MAP_IPS | ++ NF_NAT_RANGE_PROTO_SPECIFIED; ++ newrange.max_addr.ip = newrange.min_addr.ip = newsrc; ++ newrange.min_proto.udp.port = newrange.max_proto.udp.port = minport; ++ ++ /* Set ct helper */ ++ ret = nf_nat_setup_info(ct, &newrange, NF_NAT_MANIP_SRC); ++ if (ret == NF_ACCEPT) { ++ struct nf_conn_help *help = nfct_help(ct); ++ if (help == NULL) ++ help = nf_ct_helper_ext_add(ct, GFP_ATOMIC); ++ if (help != NULL) { ++ help->helper = &nf_conntrack_helper_bcm_nat; ++ pr_debug("bcm_nat: helper set\n"); ++ } ++ } ++ return ret; ++ } ++ + /* Transfer from original range. */ + memset(&newrange.min_addr, 0, sizeof(newrange.min_addr)); + memset(&newrange.max_addr, 0, sizeof(newrange.max_addr)); +@@ -347,6 +539,7 @@ EXPORT_SYMBOL_GPL(nf_nat_masquerade_inet + + void nf_nat_masquerade_inet_unregister_notifiers(void) + { ++ nf_conntrack_helper_unregister(&nf_conntrack_helper_bcm_nat); + mutex_lock(&masq_mutex); + /* check if the notifiers still have clients */ + if (--masq_refcnt > 0) +--- a/net/netfilter/xt_MASQUERADE.c ++++ b/net/netfilter/xt_MASQUERADE.c +@@ -42,6 +42,9 @@ masquerade_tg(struct sk_buff *skb, const + range.min_proto = mr->range[0].min; + range.max_proto = mr->range[0].max; + ++ range.min_addr.ip = mr->range[0].min_ip; ++ range.max_addr.ip = mr->range[0].max_ip; ++ + return nf_nat_masquerade_ipv4(skb, xt_hooknum(par), &range, + xt_out(par)); + } From 0a8ebb3c13bc738f811c391ab36ebacbec49fff3 Mon Sep 17 00:00:00 2001 From: hanwckf Date: Thu, 1 Dec 2022 02:37:31 +0800 Subject: [PATCH 013/137] iptables: add support for brcm fullconenat --- package/network/utils/iptables/Makefile | 2 +- .../patches/900-bcm-fullconenat.patch | 73 +++++++++++++++++++ 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 package/network/utils/iptables/patches/900-bcm-fullconenat.patch diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile index b1ac0be4e8..4e63cfdb09 100644 --- a/package/network/utils/iptables/Makefile +++ b/package/network/utils/iptables/Makefile @@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=iptables PKG_VERSION:=1.8.7 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_URL:=https://netfilter.org/projects/iptables/files PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 diff --git a/package/network/utils/iptables/patches/900-bcm-fullconenat.patch b/package/network/utils/iptables/patches/900-bcm-fullconenat.patch new file mode 100644 index 0000000000..2ff8db06a2 --- /dev/null +++ b/package/network/utils/iptables/patches/900-bcm-fullconenat.patch @@ -0,0 +1,73 @@ +--- a/extensions/libipt_MASQUERADE.c ++++ b/extensions/libipt_MASQUERADE.c +@@ -11,6 +11,7 @@ + enum { + O_TO_PORTS = 0, + O_RANDOM, ++ O_MODE, + O_RANDOM_FULLY, + }; + +@@ -23,13 +24,16 @@ static void MASQUERADE_help(void) + " --random\n" + " Randomize source port.\n" + " --random-fully\n" +-" Fully randomize source port.\n"); ++" Fully randomize source port.\n" ++" --mode \n" ++" NAT mode.\n"); + } + + static const struct xt_option_entry MASQUERADE_opts[] = { + {.name = "to-ports", .id = O_TO_PORTS, .type = XTTYPE_STRING}, + {.name = "random", .id = O_RANDOM, .type = XTTYPE_NONE}, + {.name = "random-fully", .id = O_RANDOM_FULLY, .type = XTTYPE_NONE}, ++ {.name = "mode", .id = O_MODE, .type = XTTYPE_STRING}, + XTOPT_TABLEEND, + }; + +@@ -90,6 +94,8 @@ static void MASQUERADE_parse(struct xt_o + else + portok = 0; + ++ mr->range[0].min_ip = 0; ++ + xtables_option_parse(cb); + switch (cb->entry->id) { + case O_TO_PORTS: +@@ -104,6 +110,15 @@ static void MASQUERADE_parse(struct xt_o + case O_RANDOM_FULLY: + mr->range[0].flags |= NF_NAT_RANGE_PROTO_RANDOM_FULLY; + break; ++ case O_MODE: ++ if (strcasecmp(cb->arg, "fullcone") == 0) ++ mr->range[0].min_ip = 1; ++ else if (strcasecmp(cb->arg, "symmetric") == 0) ++ mr->range[0].min_ip = 0; ++ else ++ xtables_error(PARAMETER_PROBLEM, ++ "Unknown mode %s", cb->arg); ++ break; + } + } + +@@ -126,6 +141,9 @@ MASQUERADE_print(const void *ip, const s + + if (r->flags & NF_NAT_RANGE_PROTO_RANDOM_FULLY) + printf(" random-fully"); ++ ++ if (r->min_ip == 1) ++ printf(" mode: fullcone"); + } + + static void +@@ -145,6 +163,9 @@ MASQUERADE_save(const void *ip, const st + + if (r->flags & NF_NAT_RANGE_PROTO_RANDOM_FULLY) + printf(" --random-fully"); ++ ++ if (r->min_ip == 1) ++ printf(" --mode fullcone"); + } + + static int MASQUERADE_xlate(struct xt_xlate *xl, From 956d45fcf26efdb8baf8e1de371affda1fc589a0 Mon Sep 17 00:00:00 2001 From: hanwckf Date: Thu, 1 Dec 2022 02:39:31 +0800 Subject: [PATCH 014/137] firewall: add support for brcm fullconenat --- package/network/config/firewall/Makefile | 2 +- .../patches/101-bcm-fullconenat.patch | 60 +++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 package/network/config/firewall/patches/101-bcm-fullconenat.patch diff --git a/package/network/config/firewall/Makefile b/package/network/config/firewall/Makefile index 23d6007c60..d7470f23b3 100644 --- a/package/network/config/firewall/Makefile +++ b/package/network/config/firewall/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=firewall -PKG_RELEASE:=1.1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firewall3.git diff --git a/package/network/config/firewall/patches/101-bcm-fullconenat.patch b/package/network/config/firewall/patches/101-bcm-fullconenat.patch new file mode 100644 index 0000000000..9cea4a57bf --- /dev/null +++ b/package/network/config/firewall/patches/101-bcm-fullconenat.patch @@ -0,0 +1,60 @@ +--- a/defaults.c ++++ b/defaults.c +@@ -49,7 +49,7 @@ const struct fw3_option fw3_flag_opts[] + FW3_OPT("synflood_rate", limit, defaults, syn_flood_rate), + FW3_OPT("synflood_burst", int, defaults, syn_flood_rate.burst), + +- FW3_OPT("fullcone", bool, defaults, fullcone), ++ FW3_OPT("fullcone", int, defaults, fullcone), + + FW3_OPT("tcp_syncookies", bool, defaults, tcp_syncookies), + FW3_OPT("tcp_ecn", int, defaults, tcp_ecn), +--- a/options.h ++++ b/options.h +@@ -98,6 +98,13 @@ enum fw3_reject_code + __FW3_REJECT_CODE_MAX + }; + ++enum fullcone_code ++{ ++ FULLCONE_DISABLED = 0, ++ FULLCONE_CHION = 1, ++ FULLCONE_BCM = 2, ++}; ++ + extern const char *fw3_flag_names[__FW3_FLAG_MAX]; + + +@@ -297,7 +304,7 @@ struct fw3_defaults + enum fw3_reject_code any_reject_code; + + bool syn_flood; +- bool fullcone; ++ int fullcone; + struct fw3_limit syn_flood_rate; + + bool tcp_syncookies; +--- a/zones.c ++++ b/zones.c +@@ -757,7 +757,7 @@ print_zone_rule(struct fw3_ipt_handle *h + r = fw3_ipt_rule_new(handle); + fw3_ipt_rule_src_dest(r, msrc, mdest); + /*FIXME: Workaround for FULLCONE-NAT*/ +- if(defs->fullcone) ++ if(defs->fullcone == FULLCONE_CHION) + { + warn("%s will enable FULLCONE-NAT", zone->name); + fw3_ipt_rule_target(r, "FULLCONENAT"); +@@ -767,6 +767,12 @@ print_zone_rule(struct fw3_ipt_handle *h + fw3_ipt_rule_target(r, "FULLCONENAT"); + fw3_ipt_rule_append(r, "zone_%s_prerouting", zone->name); + } ++ else if (defs->fullcone == FULLCONE_BCM) ++ { ++ fw3_ipt_rule_target(r, "MASQUERADE"); ++ fw3_ipt_rule_extra(r, "--mode fullcone"); ++ fw3_ipt_rule_append(r, "zone_%s_postrouting", zone->name); ++ } + else + { + fw3_ipt_rule_target(r, "MASQUERADE"); From 017644efa074e14035eaac48b29964191e372576 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Thu, 1 Dec 2022 19:25:07 +0800 Subject: [PATCH 015/137] shortcut-fe: fix install header files Signed-off-by: Tianling Shen --- package/network/utils/shortcut-fe/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/utils/shortcut-fe/Makefile b/package/network/utils/shortcut-fe/Makefile index 27fbdbfbe2..eba327668c 100644 --- a/package/network/utils/shortcut-fe/Makefile +++ b/package/network/utils/shortcut-fe/Makefile @@ -71,7 +71,7 @@ endef define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include/shortcut-fe - $(CP) $(PKG_BUILD_DIR)/sfe.h $(1)/usr/include/shortcut-fe + $(CP) $(PKG_BUILD_DIR)/sfe*.h $(1)/usr/include/shortcut-fe endef define KernelPackage/shortcut-fe/install From 9c46728612371fff32afe12d2b312ec585665f3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= Date: Wed, 30 Nov 2022 11:31:00 +0300 Subject: [PATCH 016/137] ramips: mt7621-dts: revert nvmem implementation to mtd-mac-address MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There's no nvmem implementation on 21.02. Revert to mtd-mac-address. Fixes: d604032c2a50 ("ramips: fix GB-PC1 and GB-PC2 device support") Signed-off-by: Arınç ÜNAL --- target/linux/ramips/dts/mt7621_gnubee_gb-pc2.dts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_gnubee_gb-pc2.dts b/target/linux/ramips/dts/mt7621_gnubee_gb-pc2.dts index 8d0eaee1d4..e27c4e4d47 100644 --- a/target/linux/ramips/dts/mt7621_gnubee_gb-pc2.dts +++ b/target/linux/ramips/dts/mt7621_gnubee_gb-pc2.dts @@ -119,8 +119,7 @@ label = "ethyellow"; phy-handle = <ðphy5>; - nvmem-cells = <&macaddr_factory_e000>; - nvmem-cell-names = "mac-address"; + mtd-mac-address = <&factory 0xe000>; }; &mdio { From a0c1fa13eb04ad6d64c9f43c53a1add0fe1bfc42 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 28 Nov 2022 21:05:54 +0100 Subject: [PATCH 017/137] layerscape: fix compilation error for missing define of dwc quirk Add missing define for dwc quirk patch required to fix compilation error for layerscape target. Signed-off-by: Christian Marangi --- ...karound-for-host-mode-VBUS-glitch-wh.patch | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/target/linux/layerscape/patches-5.4/820-usb-0009-usb-dwc3-Add-workaround-for-host-mode-VBUS-glitch-wh.patch b/target/linux/layerscape/patches-5.4/820-usb-0009-usb-dwc3-Add-workaround-for-host-mode-VBUS-glitch-wh.patch index 0e2942a3bc..b7ff6cd486 100644 --- a/target/linux/layerscape/patches-5.4/820-usb-0009-usb-dwc3-Add-workaround-for-host-mode-VBUS-glitch-wh.patch +++ b/target/linux/layerscape/patches-5.4/820-usb-0009-usb-dwc3-Add-workaround-for-host-mode-VBUS-glitch-wh.patch @@ -44,7 +44,22 @@ Reviewed-by: Peter Chen --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h -@@ -1049,6 +1049,8 @@ struct dwc3_scratchpad_array { +@@ -617,6 +617,14 @@ + #define DWC3_OSTS_VBUSVLD BIT(1) + #define DWC3_OSTS_CONIDSTS BIT(0) + ++/* Partial XHCI Register and Bit fields for quirk */ ++#define XHCI_HCSPARAMS1 0x4 ++#define XHCI_PORTSC_BASE 0x400 ++#define PORT_POWER (1 << 9) ++#define HCS_MAX_PORTS(p) (((p) >> 24) & 0x7f) ++#define XHCI_HC_LENGTH(p) (((p)>>00)&0x00ff) ++#define HC_LENGTH(p) XHCI_HC_LENGTH(p) ++ + /* Structures */ + + struct dwc3_trb; +@@ -1049,6 +1057,8 @@ struct dwc3_scratchpad_array { * 3 - Reserved * @dis_metastability_quirk: set to disable metastability quirk. * @dis_split_quirk: set to disable split boundary. @@ -53,7 +68,7 @@ Reviewed-by: Peter Chen * @imod_interval: set the interrupt moderation interval in 250ns * increments or 0 to disable. */ -@@ -1245,6 +1247,8 @@ struct dwc3 { +@@ -1245,6 +1255,8 @@ struct dwc3 { unsigned dis_split_quirk:1; From 4eefe5893ec8678304d755c580d4edd2d01548b0 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Thu, 1 Dec 2022 21:27:43 +0800 Subject: [PATCH 018/137] README: add clang to dependencies Signed-off-by: Tianling Shen (cherry picked from commit ea04989e6847eb76b4a26c910bc3eae303333548) --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a3214a8ad0..76429a1601 100644 --- a/README.md +++ b/README.md @@ -31,12 +31,12 @@ To build your own firmware you need a GNU/Linux, BSD or MacOSX system (case sens sudo apt update -y sudo apt full-upgrade -y sudo apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \ - bzip2 ccache cmake cpio curl device-tree-compiler ecj fastjar flex gawk gettext gcc-multilib g++-multilib \ - git gperf haveged help2man intltool lib32gcc-s1 libc6-dev-i386 libelf-dev libglib2.0-dev libgmp3-dev libltdl-dev \ - libmpc-dev libmpfr-dev libncurses5-dev libncursesw5 libncursesw5-dev libreadline-dev libssl-dev libtool lrzsz \ - mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 python3-pip python3-ply \ - python-docutils qemu-utils re2c rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip \ - vim wget xmlto xxd zlib1g-dev + bzip2 ccache clang clangd cmake cpio curl device-tree-compiler ecj fastjar flex gawk gettext gcc-multilib \ + g++-multilib git gperf haveged help2man intltool lib32gcc-s1 libc6-dev-i386 libelf-dev libglib2.0-dev \ + libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5 libncursesw5-dev libreadline-dev \ + libssl-dev libtool lld lldb lrzsz mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python2.7 \ + python3 python3-pip python3-ply python-docutils qemu-utils re2c rsync scons squashfs-tools subversion swig \ + texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev ``` - Method 2: From 01b096a64bd69cc96303c3fe99a9d8d0038ba839 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 2 Sep 2022 17:07:40 +0200 Subject: [PATCH 019/137] bcm4908: use upstream patches for Asus GT-AC5300 LEDs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki (cherry picked from commit d51e990ff81ad0335294749e8d2fc8e69ceb9179) --- ...-arm64-dts-broadcom-bcm4908-add-remaining-LED-pins.patch} | 5 ++++- ...m64-dts-broadcom-bcm4908-add-LEDs-controller-block.patch} | 5 ++++- ...arm64-dts-broadcom-bcm4908-add-Asus-GT-AC5300-LEDs.patch} | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) rename target/linux/bcm4908/patches-5.4/{130-0001-arm64-dts-broadcom-bcm4908-add-remaining-LED-pins.patch => 038-v6.1-0001-arm64-dts-broadcom-bcm4908-add-remaining-LED-pins.patch} (91%) rename target/linux/bcm4908/patches-5.4/{130-0002-arm64-dts-broadcom-bcm4908-add-LEDs-controller-block.patch => 038-v6.1-0002-arm64-dts-broadcom-bcm4908-add-LEDs-controller-block.patch} (78%) rename target/linux/bcm4908/patches-5.4/{130-0003-arm64-dts-broadcom-bcm4908-add-Asus-GT-AC5300-LEDs.patch => 038-v6.1-0003-arm64-dts-broadcom-bcm4908-add-Asus-GT-AC5300-LEDs.patch} (88%) diff --git a/target/linux/bcm4908/patches-5.4/130-0001-arm64-dts-broadcom-bcm4908-add-remaining-LED-pins.patch b/target/linux/bcm4908/patches-5.4/038-v6.1-0001-arm64-dts-broadcom-bcm4908-add-remaining-LED-pins.patch similarity index 91% rename from target/linux/bcm4908/patches-5.4/130-0001-arm64-dts-broadcom-bcm4908-add-remaining-LED-pins.patch rename to target/linux/bcm4908/patches-5.4/038-v6.1-0001-arm64-dts-broadcom-bcm4908-add-remaining-LED-pins.patch index be1efcde86..437249f2cb 100644 --- a/target/linux/bcm4908/patches-5.4/130-0001-arm64-dts-broadcom-bcm4908-add-remaining-LED-pins.patch +++ b/target/linux/bcm4908/patches-5.4/038-v6.1-0001-arm64-dts-broadcom-bcm4908-add-remaining-LED-pins.patch @@ -1,5 +1,6 @@ +From 456b6dd1baadd2da10e28ffd1717b06d1fa17a97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 18 Jul 2022 13:16:05 +0200 +Date: Mon, 18 Jul 2022 15:20:58 +0200 Subject: [PATCH] arm64: dts: broadcom: bcm4908: add remaining LED pins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -8,6 +9,8 @@ Content-Transfer-Encoding: 8bit Include all 32 pins. Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20220718132100.13277-1-zajec5@gmail.com +Signed-off-by: Florian Fainelli --- .../boot/dts/broadcom/bcm4908/bcm4908.dtsi | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/target/linux/bcm4908/patches-5.4/130-0002-arm64-dts-broadcom-bcm4908-add-LEDs-controller-block.patch b/target/linux/bcm4908/patches-5.4/038-v6.1-0002-arm64-dts-broadcom-bcm4908-add-LEDs-controller-block.patch similarity index 78% rename from target/linux/bcm4908/patches-5.4/130-0002-arm64-dts-broadcom-bcm4908-add-LEDs-controller-block.patch rename to target/linux/bcm4908/patches-5.4/038-v6.1-0002-arm64-dts-broadcom-bcm4908-add-LEDs-controller-block.patch index 0ba3745798..c890340893 100644 --- a/target/linux/bcm4908/patches-5.4/130-0002-arm64-dts-broadcom-bcm4908-add-LEDs-controller-block.patch +++ b/target/linux/bcm4908/patches-5.4/038-v6.1-0002-arm64-dts-broadcom-bcm4908-add-LEDs-controller-block.patch @@ -1,5 +1,6 @@ +From 7de56b1dc1149c702d4cc1e89ccc251bfb2bc246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 18 Jul 2022 13:17:57 +0200 +Date: Mon, 18 Jul 2022 15:20:59 +0200 Subject: [PATCH] arm64: dts: broadcom: bcm4908: add LEDs controller block MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -9,6 +10,8 @@ BCM4908 includes LEDs controller that supports multiple brightness levels & hardware blinking. Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20220718132100.13277-2-zajec5@gmail.com +Signed-off-by: Florian Fainelli --- arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/target/linux/bcm4908/patches-5.4/130-0003-arm64-dts-broadcom-bcm4908-add-Asus-GT-AC5300-LEDs.patch b/target/linux/bcm4908/patches-5.4/038-v6.1-0003-arm64-dts-broadcom-bcm4908-add-Asus-GT-AC5300-LEDs.patch similarity index 88% rename from target/linux/bcm4908/patches-5.4/130-0003-arm64-dts-broadcom-bcm4908-add-Asus-GT-AC5300-LEDs.patch rename to target/linux/bcm4908/patches-5.4/038-v6.1-0003-arm64-dts-broadcom-bcm4908-add-Asus-GT-AC5300-LEDs.patch index 796395a017..3888efb66b 100644 --- a/target/linux/bcm4908/patches-5.4/130-0003-arm64-dts-broadcom-bcm4908-add-Asus-GT-AC5300-LEDs.patch +++ b/target/linux/bcm4908/patches-5.4/038-v6.1-0003-arm64-dts-broadcom-bcm4908-add-Asus-GT-AC5300-LEDs.patch @@ -1,5 +1,6 @@ +From 3bcae3396e986b4ab97a69e8de517e32f9691a4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 18 Jul 2022 13:21:54 +0200 +Date: Mon, 18 Jul 2022 15:21:00 +0200 Subject: [PATCH] arm64: dts: broadcom: bcm4908: add Asus GT-AC5300 LEDs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -8,6 +9,8 @@ Content-Transfer-Encoding: 8bit There are 5 software-controllable LEDs on PCB. Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20220718132100.13277-3-zajec5@gmail.com +Signed-off-by: Florian Fainelli --- .../bcm4908/bcm4908-asus-gt-ac5300.dts | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) From 940adf4b6725f834e6fade3ed0ddbcf14c4d6ef2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Sat, 3 Sep 2022 20:41:00 +0200 Subject: [PATCH 020/137] bcm4908: fix Asus GT-AX6000 image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Include Linux DTB 2. Add 50991 variant (seems to differ by 1 PHY we don't support yet) Signed-off-by: Rafał Miłecki (cherry picked from commit b8f8c6f2dd8d47216117cb5b78184531ab21dddd) --- target/linux/bcm4908/config-5.4 | 2 +- target/linux/bcm4908/image/Makefile | 2 +- target/linux/bcm4908/image/bootfs-bcm4912.its | 35 +++++++++++++++++-- ...bcmbca-add-arch-bcmbca-machine-entry.patch | 31 ++++++++++++++++ 4 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 target/linux/bcm4908/patches-5.4/037-v5.20-0011-arm64-bcmbca-add-arch-bcmbca-machine-entry.patch diff --git a/target/linux/bcm4908/config-5.4 b/target/linux/bcm4908/config-5.4 index e051e900df..e6e40f96a9 100644 --- a/target/linux/bcm4908/config-5.4 +++ b/target/linux/bcm4908/config-5.4 @@ -1,5 +1,6 @@ CONFIG_64BIT=y CONFIG_ARCH_BCM4908=y +CONFIG_ARCH_BCMBCA=y CONFIG_ARCH_CLOCKSOURCE_DATA=y CONFIG_ARCH_DMA_ADDR_T_64BIT=y CONFIG_ARCH_KEEP_MEMBLOCK=y @@ -203,7 +204,6 @@ CONFIG_QUEUED_SPINLOCKS=y CONFIG_RATIONAL=y CONFIG_RCU_NEED_SEGCBLIST=y CONFIG_RCU_STALL_COMMON=y -CONFIG_REFCOUNT_FULL=y CONFIG_REGMAP=y CONFIG_REGMAP_MMIO=y CONFIG_RFS_ACCEL=y diff --git a/target/linux/bcm4908/image/Makefile b/target/linux/bcm4908/image/Makefile index aba4d377f8..a6c31d50ee 100644 --- a/target/linux/bcm4908/image/Makefile +++ b/target/linux/bcm4908/image/Makefile @@ -90,7 +90,7 @@ TARGET_DEVICES += asus_gt-ac5300 define Device/asus_gt-ax6000 DEVICE_VENDOR := Asus DEVICE_MODEL := GT-AX6000 - DEVICE_DTS := broadcom/bcmbca/bcm4912-asus-gt-ax6000 + KERNEL := kernel-bin | bootfs IMAGES := pkgtb IMAGE/pkgtb := append-rootfs | pkgtb SOC := bcm4912 diff --git a/target/linux/bcm4908/image/bootfs-bcm4912.its b/target/linux/bcm4908/image/bootfs-bcm4912.its index 6f4548956c..3d671f9d00 100644 --- a/target/linux/bcm4908/image/bootfs-bcm4912.its +++ b/target/linux/bcm4908/image/bootfs-bcm4912.its @@ -12,9 +12,22 @@ data = /incbin/("${images_dir}/u-boot/u-boot-bcm4912.dtb"); }; - fdt_GTAX6000 { + fdt_uboot_GTAX6000 { description = "dtb"; data = /incbin/("${images_dir}/u-boot/GTAX6000.dtb"); + arch = "arm64"; + type = "flat_dt"; + compression = "none"; + + hash-1 { + algo = "sha256"; + }; + }; + + fdt_linux_GTAX6000 { + description = "dtb"; + data = /incbin/("${dts_dir}/broadcom/bcmbca/bcm4912-asus-gt-ax6000.dtb"); + arch = "arm64"; type = "flat_dt"; compression = "none"; @@ -27,8 +40,26 @@ configurations { conf_ub_GTAX6000 { description = "GTAX6000"; - fdt = "fdt_GTAX6000"; + fdt = "fdt_uboot_GTAX6000"; loadables = "atf", "uboot"; }; + + conf_lx_GTAX6000 { + description = "BRCM 63xxx linux"; + kernel = "kernel"; + fdt = "fdt_linux_GTAX6000"; + }; + + conf_ub_GTAX6000_50991 { + description = "GTAX6000_50991"; + fdt = "fdt_uboot_GTAX6000"; + loadables = "atf", "uboot"; + }; + + conf_lx_GTAX6000_50991 { + description = "BRCM 63xxx linux"; + kernel = "kernel"; + fdt = "fdt_linux_GTAX6000"; + }; }; }; diff --git a/target/linux/bcm4908/patches-5.4/037-v5.20-0011-arm64-bcmbca-add-arch-bcmbca-machine-entry.patch b/target/linux/bcm4908/patches-5.4/037-v5.20-0011-arm64-bcmbca-add-arch-bcmbca-machine-entry.patch new file mode 100644 index 0000000000..1b9a32e30a --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/037-v5.20-0011-arm64-bcmbca-add-arch-bcmbca-machine-entry.patch @@ -0,0 +1,31 @@ +From fdcd652ce2b6b819f5c4dc3cead5215c84ee6933 Mon Sep 17 00:00:00 2001 +From: William Zhang +Date: Wed, 1 Jun 2022 15:56:50 -0700 +Subject: [PATCH] arm64: bcmbca: add arch bcmbca machine entry + +Add ARCH_BCMBCA config for Broadcom Broadband SoC chipsets + +Signed-off-by: William Zhang +Signed-off-by: Florian Fainelli +--- + arch/arm64/Kconfig.platforms | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/arch/arm64/Kconfig.platforms ++++ b/arch/arm64/Kconfig.platforms +@@ -59,6 +59,15 @@ config ARCH_BCM_IPROC + help + This enables support for Broadcom iProc based SoCs + ++config ARCH_BCMBCA ++ bool "Broadcom Broadband SoC" ++ help ++ Say Y if you intend to run the kernel on a Broadcom Broadband ARM-based ++ BCA chipset. ++ ++ This enables support for Broadcom BCA ARM-based broadband chipsets, ++ including the DSL, PON and Wireless family of chips. ++ + config ARCH_BERLIN + bool "Marvell Berlin SoC Family" + select DW_APB_ICTL From b01b9244b4bf9e95633e706a16a0fd8c309fcadf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Sat, 12 Nov 2022 10:42:51 +0100 Subject: [PATCH 021/137] kernel: update U-Boot nvmem driver to v6.2 release version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport queued patches that 1. Fix CRC32 calculation for redundant images 2. Fix CRC32 on big-endian 3. Fix parting images with Broadcom header Signed-off-by: Rafał Miłecki (cherry picked from commit 797177ad85cbf92b5c1e270751eaca9eb4f34f30) --- ...-fix-crc32_data_offset-on-redundant-.patch | 56 ++++++++++++++++ ...env-align-endianness-of-crc32-values.patch | 47 ++++++++++++++ ...boot-env-add-Broadcom-format-support.patch | 65 +++++++++++++++++++ 3 files changed, 168 insertions(+) create mode 100644 target/linux/generic/backport-5.4/822-v6.2-0001-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch create mode 100644 target/linux/generic/backport-5.4/822-v6.2-0002-nvmem-u-boot-env-align-endianness-of-crc32-values.patch create mode 100644 target/linux/generic/backport-5.4/822-v6.2-0003-nvmem-u-boot-env-add-Broadcom-format-support.patch diff --git a/target/linux/generic/backport-5.4/822-v6.2-0001-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch b/target/linux/generic/backport-5.4/822-v6.2-0001-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch new file mode 100644 index 0000000000..69d5a1b845 --- /dev/null +++ b/target/linux/generic/backport-5.4/822-v6.2-0001-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch @@ -0,0 +1,56 @@ +From 7a69ff9c9bde03a690ea783970f664782fc303d8 Mon Sep 17 00:00:00 2001 +From: Christian Lamparter +Date: Fri, 4 Nov 2022 17:52:03 +0100 +Subject: [PATCH] nvmem: u-boot-env: fix crc32_data_offset on redundant + u-boot-env + +The Western Digital MyBook Live (PowerPC 464/APM82181) +has a set of redundant u-boot-env. Loading up the driver +the following error: + +| u_boot_env: Invalid calculated CRC32: 0x4f8f2c86 (expected: 0x98b14514) +| u_boot_env: probe of partition@1e000 failed with error -22 + +Looking up the userspace libubootenv utilities source [0], +it looks like the "mark" or "flag" is not part of the +crc32 sum... which is unfortunate :( + +|static int libuboot_load(struct uboot_ctx *ctx) +|{ +|[...] +| if (ctx->redundant) { +| [...] +| offsetdata = offsetof(struct uboot_env_redund, data); +| [...] //-----^^ +| } +| usable_envsize = ctx->size - offsetdata; +| buf[0] = malloc(bufsize); +|[...] +| for (i = 0; i < copies; i++) { +| data = (uint8_t *)(buf[i] + offsetdata); +| uint32_t crc; +| +| ret = devread(ctx, i, buf[i]); +| [...] +| crc = *(uint32_t *)(buf[i] + offsetcrc); +| dev->crc = crc32(0, (uint8_t *)data, usable_envsize); +| + +[0] https://github.com/sbabic/libubootenv/blob/master/src/uboot_env.c#L951 +Fixes: d5542923f200 ("nvmem: add driver handling U-Boot environment variables") +Signed-off-by: Christian Lamparter +--- + drivers/nvmem/u-boot-env.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/u-boot-env.c ++++ b/drivers/nvmem/u-boot-env.c +@@ -135,7 +135,7 @@ static int u_boot_env_parse(struct u_boo + break; + case U_BOOT_FORMAT_REDUNDANT: + crc32_offset = offsetof(struct u_boot_env_image_redundant, crc32); +- crc32_data_offset = offsetof(struct u_boot_env_image_redundant, mark); ++ crc32_data_offset = offsetof(struct u_boot_env_image_redundant, data); + data_offset = offsetof(struct u_boot_env_image_redundant, data); + break; + } diff --git a/target/linux/generic/backport-5.4/822-v6.2-0002-nvmem-u-boot-env-align-endianness-of-crc32-values.patch b/target/linux/generic/backport-5.4/822-v6.2-0002-nvmem-u-boot-env-align-endianness-of-crc32-values.patch new file mode 100644 index 0000000000..7d6723bb8e --- /dev/null +++ b/target/linux/generic/backport-5.4/822-v6.2-0002-nvmem-u-boot-env-align-endianness-of-crc32-values.patch @@ -0,0 +1,47 @@ +From 0e71cac033bb7689c4dfa2e6814191337ef770f5 Mon Sep 17 00:00:00 2001 +From: INAGAKI Hiroshi +Date: Thu, 13 Oct 2022 00:51:33 +0900 +Subject: [PATCH] nvmem: u-boot-env: align endianness of crc32 values +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This patch fixes crc32 error on Big-Endianness system by conversion of +calculated crc32 value. + +Little-Endianness system: + + obtained crc32: Little +calculated crc32: Little + +Big-Endianness system: + + obtained crc32: Little +calculated crc32: Big + +log (APRESIA ApresiaLightGS120GT-SS, RTL8382M, Big-Endianness): + +[ 8.570000] u_boot_env 18001200.spi:flash@0:partitions:partition@c0000: Invalid calculated CRC32: 0x88cd6f09 (expected: 0x096fcd88) +[ 8.580000] u_boot_env: probe of 18001200.spi:flash@0:partitions:partition@c0000 failed with error -22 + +Fixes: f955dc1445069 ("nvmem: add driver handling U-Boot environment variables") + +Signed-off-by: INAGAKI Hiroshi +Acked-by: Rafał Miłecki +Tested-by: Christian Lamparter +Signed-off-by: Srinivas Kandagatla +--- + drivers/nvmem/u-boot-env.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/u-boot-env.c ++++ b/drivers/nvmem/u-boot-env.c +@@ -143,7 +143,7 @@ static int u_boot_env_parse(struct u_boo + crc32_data_len = priv->mtd->size - crc32_data_offset; + data_len = priv->mtd->size - data_offset; + +- calc = crc32(~0, buf + crc32_data_offset, crc32_data_len) ^ ~0L; ++ calc = le32_to_cpu((__le32)crc32(~0, buf + crc32_data_offset, crc32_data_len) ^ ~0L); + if (calc != crc32) { + dev_err(dev, "Invalid calculated CRC32: 0x%08x (expected: 0x%08x)\n", calc, crc32); + err = -EINVAL; diff --git a/target/linux/generic/backport-5.4/822-v6.2-0003-nvmem-u-boot-env-add-Broadcom-format-support.patch b/target/linux/generic/backport-5.4/822-v6.2-0003-nvmem-u-boot-env-add-Broadcom-format-support.patch new file mode 100644 index 0000000000..429b24f0f3 --- /dev/null +++ b/target/linux/generic/backport-5.4/822-v6.2-0003-nvmem-u-boot-env-add-Broadcom-format-support.patch @@ -0,0 +1,65 @@ +From 5b4eaafbeac472fc19049152f18e88aecb2b2829 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 17 Oct 2022 09:17:22 +0200 +Subject: [PATCH] nvmem: u-boot-env: add Broadcom format support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Broadcom uses U-Boot for a lot of their bcmbca familiy chipsets. They +decided to store U-Boot environment data inside U-Boot partition and to +use a custom header (with "uEnv" magic and env data length). + +Add support for Broadcom's specific binding and their custom format. + +Ref: 6b0584c19d87 ("dt-bindings: nvmem: u-boot,env: add Broadcom's variant binding") +Signed-off-by: Rafał Miłecki +Signed-off-by: Srinivas Kandagatla +--- + drivers/nvmem/u-boot-env.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +--- a/drivers/nvmem/u-boot-env.c ++++ b/drivers/nvmem/u-boot-env.c +@@ -16,6 +16,7 @@ + enum u_boot_env_format { + U_BOOT_FORMAT_SINGLE, + U_BOOT_FORMAT_REDUNDANT, ++ U_BOOT_FORMAT_BROADCOM, + }; + + struct u_boot_env { +@@ -40,6 +41,13 @@ struct u_boot_env_image_redundant { + uint8_t data[]; + } __packed; + ++struct u_boot_env_image_broadcom { ++ __le32 magic; ++ __le32 len; ++ __le32 crc32; ++ uint8_t data[0]; ++} __packed; ++ + static int u_boot_env_read(void *context, unsigned int offset, void *val, + size_t bytes) + { +@@ -138,6 +146,11 @@ static int u_boot_env_parse(struct u_boo + crc32_data_offset = offsetof(struct u_boot_env_image_redundant, data); + data_offset = offsetof(struct u_boot_env_image_redundant, data); + break; ++ case U_BOOT_FORMAT_BROADCOM: ++ crc32_offset = offsetof(struct u_boot_env_image_broadcom, crc32); ++ crc32_data_offset = offsetof(struct u_boot_env_image_broadcom, data); ++ data_offset = offsetof(struct u_boot_env_image_broadcom, data); ++ break; + } + crc32 = le32_to_cpu(*(__le32 *)(buf + crc32_offset)); + crc32_data_len = priv->mtd->size - crc32_data_offset; +@@ -202,6 +215,7 @@ static const struct of_device_id u_boot_ + { .compatible = "u-boot,env", .data = (void *)U_BOOT_FORMAT_SINGLE, }, + { .compatible = "u-boot,env-redundant-bool", .data = (void *)U_BOOT_FORMAT_REDUNDANT, }, + { .compatible = "u-boot,env-redundant-count", .data = (void *)U_BOOT_FORMAT_REDUNDANT, }, ++ { .compatible = "brcm,env", .data = (void *)U_BOOT_FORMAT_BROADCOM, }, + {}, + }; + From 8a11563b06553118abb870461e07f47368666feb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Sat, 3 Sep 2022 14:31:29 +0200 Subject: [PATCH 022/137] base-files: support "metric" in board.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It allows prepopulating /etc/config/network interface-s with predefined metric. It may be useful for devices with multiple WAN ports. Signed-off-by: Rafał Miłecki (cherry picked from commit 7f443d2d9aa1170d6b68f0dc6d5b5552882ee327) --- package/base-files/files/bin/config_generate | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate index 596fcf41fa..38362813d1 100755 --- a/package/base-files/files/bin/config_generate +++ b/package/base-files/files/bin/config_generate @@ -96,7 +96,7 @@ generate_network() { json_select network json_select "$1" - json_get_vars device macaddr protocol ipaddr netmask vlan + json_get_vars device macaddr metric protocol ipaddr netmask vlan json_get_values ports ports json_select .. json_select .. @@ -154,6 +154,7 @@ generate_network() { set network.$1='interface' set network.$1.type='$type' set network.$1.device='$device' + set network.$1.metric='$metric' set network.$1.proto='none' EOF From 7492906d13f3f7a44ed750d99feebf90a9e353fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 2 Nov 2022 20:26:33 +0100 Subject: [PATCH 023/137] kernel: improve description of NTFS kernel packages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This helps choosing the right NTFS driver from two available options. Signed-off-by: Rafał Miłecki (cherry picked from commit b066ad7d9aa5221bfd334a3017abe9bcd171b33f) --- package/kernel/linux/modules/fs.mk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package/kernel/linux/modules/fs.mk b/package/kernel/linux/modules/fs.mk index d43542b17e..d390e29a25 100644 --- a/package/kernel/linux/modules/fs.mk +++ b/package/kernel/linux/modules/fs.mk @@ -462,7 +462,7 @@ $(eval $(call KernelPackage,fs-nfsd)) define KernelPackage/fs-ntfs SUBMENU:=$(FS_MENU) - TITLE:=NTFS filesystem support + TITLE:=NTFS filesystem read-only (old driver) support KCONFIG:=CONFIG_NTFS_FS FILES:=$(LINUX_DIR)/fs/ntfs/ntfs.ko AUTOLOAD:=$(call AutoLoad,30,ntfs) @@ -470,7 +470,8 @@ define KernelPackage/fs-ntfs endef define KernelPackage/fs-ntfs/description - Kernel module for NTFS filesystem support + Kernel module for limited NTFS filesystem support. Support for writing + is extremely limited and disabled as a result. endef $(eval $(call KernelPackage,fs-ntfs)) From 660d8f40488715e68c2d8f9147d249fbd9a8ff78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 11 Nov 2022 14:54:46 +0100 Subject: [PATCH 024/137] bcm4908: update DTS files with the latest changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The most affecting change is move of files from bcm4908/ to the bcmbca/. That required updating few paths. Signed-off-by: Rafał Miłecki (cherry picked from commit 45ac906c6415cebd12281088da6b06668c057f0a) --- target/linux/bcm4908/image/Makefile | 6 +- target/linux/bcm4908/image/bootfs-bcm4908.its | 2 +- ...cmbca-update-BCM4908-board-dts-files.patch | 66 + ...ts-Move-BCM4908-dts-to-bcmbca-folder.patch | 2491 +++++++++++++++++ ...64-dts-Add-BCM4908-generic-board-dts.patch | 62 + ...om-bcmbca-bcm4908-add-TWD-block-time.patch | 31 + ...roadcom-bcmbca-bcm6858-add-TWD-block.patch | 46 + ...m-bcmbca-bcm4908-limit-amount-of-GP.patch} | 8 +- 8 files changed, 2704 insertions(+), 8 deletions(-) create mode 100644 target/linux/bcm4908/patches-5.4/038-v6.1-0004-arm64-dts-bcmbca-update-BCM4908-board-dts-files.patch create mode 100644 target/linux/bcm4908/patches-5.4/038-v6.1-0005-arm64-dts-Move-BCM4908-dts-to-bcmbca-folder.patch create mode 100644 target/linux/bcm4908/patches-5.4/038-v6.1-0006-arm64-dts-Add-BCM4908-generic-board-dts.patch create mode 100644 target/linux/bcm4908/patches-5.4/039-v6.2-0001-arm64-dts-broadcom-bcmbca-bcm4908-add-TWD-block-time.patch create mode 100644 target/linux/bcm4908/patches-5.4/039-v6.2-0002-arm64-dts-broadcom-bcmbca-bcm6858-add-TWD-block.patch rename target/linux/bcm4908/patches-5.4/{300-arm64-dts-broadcom-bcm4908-limit-amount-of-GPIOs.patch => 300-arm64-dts-broadcom-bcmbca-bcm4908-limit-amount-of-GP.patch} (71%) diff --git a/target/linux/bcm4908/image/Makefile b/target/linux/bcm4908/image/Makefile index a6c31d50ee..cdb6f3ea1f 100644 --- a/target/linux/bcm4908/image/Makefile +++ b/target/linux/bcm4908/image/Makefile @@ -77,7 +77,7 @@ endef define Device/asus_gt-ac5300 DEVICE_VENDOR := Asus DEVICE_MODEL := GT-AC5300 - DEVICE_DTS := broadcom/bcm4908/bcm4908-asus-gt-ac5300 + DEVICE_DTS := broadcom/bcmbca/bcm4908-asus-gt-ac5300 IMAGES := bin IMAGE/bin := append-ubi | bcm4908img | bcm4908asus ASUS_PRODUCTID := GT-AC5300 @@ -100,7 +100,7 @@ endef define Device/netgear_r8000p DEVICE_VENDOR := Netgear DEVICE_MODEL := R8000P - DEVICE_DTS := broadcom/bcm4908/bcm4906-netgear-r8000p + DEVICE_DTS := broadcom/bcmbca/bcm4906-netgear-r8000p IMAGES := bin IMAGE/chk := append-ubi | bcm4908img | netgear-chk NETGEAR_BOARD_ID := U12H359T00_NETGEAR @@ -112,7 +112,7 @@ define Device/tplink_archer-c2300-v1 DEVICE_VENDOR := TP-Link DEVICE_MODEL := Archer C2300 DEVICE_VARIANT := v1 - DEVICE_DTS := broadcom/bcm4908/bcm4906-tplink-archer-c2300-v1 + DEVICE_DTS := broadcom/bcmbca/bcm4906-tplink-archer-c2300-v1 IMAGES := bin IMAGE/bin := append-ubi | bcm4908img BROKEN := y diff --git a/target/linux/bcm4908/image/bootfs-bcm4908.its b/target/linux/bcm4908/image/bootfs-bcm4908.its index d5ac21fd6a..2086fc7ec9 100644 --- a/target/linux/bcm4908/image/bootfs-bcm4908.its +++ b/target/linux/bcm4908/image/bootfs-bcm4908.its @@ -25,7 +25,7 @@ fdt_linux_RAX220 { description = "dtb"; - data = /incbin/("${dts_dir}/broadcom/bcm4908/bcm4908-netgear-raxe500.dtb"); + data = /incbin/("${dts_dir}/broadcom/bcmbca/bcm4908-netgear-raxe500.dtb"); arch = "arm64"; type = "flat_dt"; compression = "none"; diff --git a/target/linux/bcm4908/patches-5.4/038-v6.1-0004-arm64-dts-bcmbca-update-BCM4908-board-dts-files.patch b/target/linux/bcm4908/patches-5.4/038-v6.1-0004-arm64-dts-bcmbca-update-BCM4908-board-dts-files.patch new file mode 100644 index 0000000000..d4b7a983de --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/038-v6.1-0004-arm64-dts-bcmbca-update-BCM4908-board-dts-files.patch @@ -0,0 +1,66 @@ +From 4fdcbde682291fba2c3f45a41decd656d92a314f Mon Sep 17 00:00:00 2001 +From: William Zhang +Date: Wed, 3 Aug 2022 10:54:49 -0700 +Subject: [PATCH] arm64: dts: bcmbca: update BCM4908 board dts files +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Append "brcm,bcmbca" to compatible strings based on the new bcmbca +binding rule for BCM4908 family based boards. + +Signed-off-by: William Zhang +Acked-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20220803175455.47638-4-william.zhang@broadcom.com +Signed-off-by: Florian Fainelli +--- + arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts | 2 +- + .../dts/broadcom/bcm4908/bcm4906-tplink-archer-c2300-v1.dts | 2 +- + arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts | 2 +- + .../arm64/boot/dts/broadcom/bcm4908/bcm4908-netgear-raxe500.dts | 2 +- + 4 files changed, 4 insertions(+), 4 deletions(-) + +--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts ++++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts +@@ -7,7 +7,7 @@ + #include "bcm4906.dtsi" + + / { +- compatible = "netgear,r8000p", "brcm,bcm4906", "brcm,bcm4908"; ++ compatible = "netgear,r8000p", "brcm,bcm4906", "brcm,bcm4908", "brcm,bcmbca"; + model = "Netgear R8000P"; + + memory@0 { +--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-tplink-archer-c2300-v1.dts ++++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-tplink-archer-c2300-v1.dts +@@ -7,7 +7,7 @@ + #include "bcm4906.dtsi" + + / { +- compatible = "tplink,archer-c2300-v1", "brcm,bcm4906", "brcm,bcm4908"; ++ compatible = "tplink,archer-c2300-v1", "brcm,bcm4906", "brcm,bcm4908", "brcm,bcmbca"; + model = "TP-Link Archer C2300 V1"; + + memory@0 { +--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts ++++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts +@@ -7,7 +7,7 @@ + #include "bcm4908.dtsi" + + / { +- compatible = "asus,gt-ac5300", "brcm,bcm4908"; ++ compatible = "asus,gt-ac5300", "brcm,bcm4908", "brcm,bcmbca"; + model = "Asus GT-AC5300"; + + memory@0 { +--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-netgear-raxe500.dts ++++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-netgear-raxe500.dts +@@ -3,7 +3,7 @@ + #include "bcm4908.dtsi" + + / { +- compatible = "netgear,raxe500", "brcm,bcm4908"; ++ compatible = "netgear,raxe500", "brcm,bcm4908", "brcm,bcmbca"; + model = "Netgear RAXE500"; + + memory@0 { diff --git a/target/linux/bcm4908/patches-5.4/038-v6.1-0005-arm64-dts-Move-BCM4908-dts-to-bcmbca-folder.patch b/target/linux/bcm4908/patches-5.4/038-v6.1-0005-arm64-dts-Move-BCM4908-dts-to-bcmbca-folder.patch new file mode 100644 index 0000000000..8363b2984c --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/038-v6.1-0005-arm64-dts-Move-BCM4908-dts-to-bcmbca-folder.patch @@ -0,0 +1,2491 @@ +From ded8f22945899f4e87dd6d952bbc4abce6e64b7e Mon Sep 17 00:00:00 2001 +From: William Zhang +Date: Wed, 3 Aug 2022 10:54:50 -0700 +Subject: [PATCH] arm64: dts: Move BCM4908 dts to bcmbca folder + +As part of ARCH_BCM4908 to ARCH_BCMBCA migration, move the BCM4908 dts +files to bcmbca folder and use CONFIG_ARCH_BCMBCA to build all the +BCM4908 board dts. Delete bcm4908 folder and its makefile as well. + +Signed-off-by: William Zhang +Link: https://lore.kernel.org/r/20220803175455.47638-5-william.zhang@broadcom.com +Signed-off-by: Florian Fainelli +--- + arch/arm64/boot/dts/broadcom/Makefile | 1 - + arch/arm64/boot/dts/broadcom/bcm4908/Makefile | 5 ----- + arch/arm64/boot/dts/broadcom/bcmbca/Makefile | 4 ++++ + .../broadcom/{bcm4908 => bcmbca}/bcm4906-netgear-r8000p.dts | 0 + .../{bcm4908 => bcmbca}/bcm4906-tplink-archer-c2300-v1.dts | 0 + .../arm64/boot/dts/broadcom/{bcm4908 => bcmbca}/bcm4906.dtsi | 0 + .../broadcom/{bcm4908 => bcmbca}/bcm4908-asus-gt-ac5300.dts | 0 + .../broadcom/{bcm4908 => bcmbca}/bcm4908-netgear-raxe500.dts | 0 + .../arm64/boot/dts/broadcom/{bcm4908 => bcmbca}/bcm4908.dtsi | 0 + 9 files changed, 4 insertions(+), 6 deletions(-) + delete mode 100644 arch/arm64/boot/dts/broadcom/bcm4908/Makefile + rename arch/arm64/boot/dts/broadcom/{bcm4908 => bcmbca}/bcm4906-netgear-r8000p.dts (100%) + rename arch/arm64/boot/dts/broadcom/{bcm4908 => bcmbca}/bcm4906-tplink-archer-c2300-v1.dts (100%) + rename arch/arm64/boot/dts/broadcom/{bcm4908 => bcmbca}/bcm4906.dtsi (100%) + rename arch/arm64/boot/dts/broadcom/{bcm4908 => bcmbca}/bcm4908-asus-gt-ac5300.dts (100%) + rename arch/arm64/boot/dts/broadcom/{bcm4908 => bcmbca}/bcm4908-netgear-raxe500.dts (100%) + rename arch/arm64/boot/dts/broadcom/{bcm4908 => bcmbca}/bcm4908.dtsi (100%) + +--- a/arch/arm64/boot/dts/broadcom/Makefile ++++ b/arch/arm64/boot/dts/broadcom/Makefile +@@ -4,7 +4,6 @@ dtb-$(CONFIG_ARCH_BCM2835) += bcm2837-rp + bcm2837-rpi-3-b-plus.dtb \ + bcm2837-rpi-cm3-io3.dtb + +-subdir-y += bcm4908 + subdir-y += bcmbca + subdir-y += northstar2 + subdir-y += stingray +--- a/arch/arm64/boot/dts/broadcom/bcm4908/Makefile ++++ /dev/null +@@ -1,5 +0,0 @@ +-# SPDX-License-Identifier: GPL-2.0 +-dtb-$(CONFIG_ARCH_BCM4908) += bcm4906-netgear-r8000p.dtb +-dtb-$(CONFIG_ARCH_BCM4908) += bcm4906-tplink-archer-c2300-v1.dtb +-dtb-$(CONFIG_ARCH_BCM4908) += bcm4908-asus-gt-ac5300.dtb +-dtb-$(CONFIG_ARCH_BCM4908) += bcm4908-netgear-raxe500.dtb +--- a/arch/arm64/boot/dts/broadcom/bcmbca/Makefile ++++ b/arch/arm64/boot/dts/broadcom/bcmbca/Makefile +@@ -1,5 +1,9 @@ + # SPDX-License-Identifier: GPL-2.0 + dtb-$(CONFIG_ARCH_BCMBCA) += \ ++ bcm4906-netgear-r8000p.dtb \ ++ bcm4906-tplink-archer-c2300-v1.dtb \ ++ bcm4908-asus-gt-ac5300.dtb \ ++ bcm4908-netgear-raxe500.dtb \ + bcm4912-asus-gt-ax6000.dtb \ + bcm94912.dtb \ + bcm963158.dtb \ +--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-netgear-r8000p.dts ++++ /dev/null +@@ -1,157 +0,0 @@ +-// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +- +-#include +-#include +-#include +- +-#include "bcm4906.dtsi" +- +-/ { +- compatible = "netgear,r8000p", "brcm,bcm4906", "brcm,bcm4908", "brcm,bcmbca"; +- model = "Netgear R8000P"; +- +- memory@0 { +- device_type = "memory"; +- reg = <0x00 0x00 0x00 0x20000000>; +- }; +- +- leds { +- compatible = "gpio-leds"; +- +- led-power-white { +- function = LED_FUNCTION_POWER; +- color = ; +- gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; +- }; +- +- led-power-amber { +- function = LED_FUNCTION_POWER; +- color = ; +- gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; +- }; +- +- led-wps { +- function = LED_FUNCTION_WPS; +- color = ; +- gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; +- }; +- +- led-2ghz { +- function = "2ghz"; +- color = ; +- gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; +- }; +- +- led-5ghz-1 { +- function = "5ghz-1"; +- color = ; +- gpios = <&gpio0 15 GPIO_ACTIVE_LOW>; +- }; +- +- led-5ghz-2 { +- function = "5ghz-2"; +- color = ; +- gpios = <&gpio0 16 GPIO_ACTIVE_LOW>; +- }; +- +- led-usb2 { +- function = "usb2"; +- color = ; +- gpios = <&gpio0 17 GPIO_ACTIVE_LOW>; +- }; +- +- led-usb3 { +- function = "usb3"; +- color = ; +- gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; +- }; +- +- led-wifi { +- function = "wifi"; +- color = ; +- gpios = <&gpio0 56 GPIO_ACTIVE_LOW>; +- }; +- }; +-}; +- +-&enet { +- nvmem-cells = <&base_mac_addr>; +- nvmem-cell-names = "mac-address"; +-}; +- +-&usb_phy { +- brcm,ioc = <1>; +- status = "okay"; +-}; +- +-&ehci { +- status = "okay"; +-}; +- +-&ohci { +- status = "okay"; +-}; +- +-&xhci { +- status = "okay"; +-}; +- +-&ports { +- port@0 { +- label = "lan4"; +- }; +- +- port@1 { +- label = "lan3"; +- }; +- +- port@2 { +- label = "lan2"; +- }; +- +- port@3 { +- label = "lan1"; +- }; +- +- port@7 { +- reg = <7>; +- phy-mode = "internal"; +- phy-handle = <&phy12>; +- label = "wan"; +- }; +-}; +- +-&nandcs { +- nand-ecc-strength = <4>; +- nand-ecc-step-size = <512>; +- nand-on-flash-bbt; +- +- #address-cells = <1>; +- #size-cells = <0>; +- +- partitions { +- compatible = "fixed-partitions"; +- #address-cells = <1>; +- #size-cells = <1>; +- +- partition@0 { +- compatible = "nvmem-cells"; +- label = "cferom"; +- reg = <0x0 0x100000>; +- +- #address-cells = <1>; +- #size-cells = <1>; +- ranges = <0 0x0 0x100000>; +- +- base_mac_addr: mac@106a0 { +- reg = <0x106a0 0x6>; +- }; +- }; +- +- partition@100000 { +- compatible = "brcm,bcm4908-firmware"; +- label = "firmware"; +- reg = <0x100000 0x4400000>; +- }; +- }; +-}; +--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906-tplink-archer-c2300-v1.dts ++++ /dev/null +@@ -1,182 +0,0 @@ +-// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +- +-#include +-#include +-#include +- +-#include "bcm4906.dtsi" +- +-/ { +- compatible = "tplink,archer-c2300-v1", "brcm,bcm4906", "brcm,bcm4908", "brcm,bcmbca"; +- model = "TP-Link Archer C2300 V1"; +- +- memory@0 { +- device_type = "memory"; +- reg = <0x00 0x00 0x00 0x20000000>; +- }; +- +- leds { +- compatible = "gpio-leds"; +- +- led-power { +- function = LED_FUNCTION_POWER; +- color = ; +- gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; +- }; +- +- led-2ghz { +- function = "2ghz"; +- color = ; +- gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; +- }; +- +- led-5ghz { +- function = "5ghz"; +- color = ; +- gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; +- }; +- +- led-wan-amber { +- function = LED_FUNCTION_WAN; +- color = ; +- gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>; +- }; +- +- led-wan-blue { +- function = LED_FUNCTION_WAN; +- color = ; +- gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; +- }; +- +- led-lan { +- function = LED_FUNCTION_LAN; +- color = ; +- gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; +- }; +- +- led-wps { +- function = LED_FUNCTION_WPS; +- color = ; +- gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; +- }; +- +- led-usb2 { +- function = "usb2"; +- color = ; +- gpios = <&gpio0 15 GPIO_ACTIVE_LOW>; +- }; +- +- led-usb3 { +- function = "usbd3"; +- color = ; +- gpios = <&gpio0 17 GPIO_ACTIVE_LOW>; +- }; +- +- led-brightness { +- function = LED_FUNCTION_BACKLIGHT; +- color = ; +- gpios = <&gpio0 19 GPIO_ACTIVE_LOW>; +- }; +- }; +- +- gpio-keys-polled { +- compatible = "gpio-keys-polled"; +- poll-interval = <100>; +- +- key-brightness { +- label = "LEDs"; +- linux,code = ; +- gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; +- }; +- +- key-wps { +- label = "WPS"; +- linux,code = ; +- gpios = <&gpio0 21 GPIO_ACTIVE_LOW>; +- }; +- +- key-wifi { +- label = "WiFi"; +- linux,code = ; +- gpios = <&gpio0 22 GPIO_ACTIVE_LOW>; +- }; +- +- key-restart { +- label = "Reset"; +- linux,code = ; +- gpios = <&gpio0 23 GPIO_ACTIVE_LOW>; +- }; +- }; +-}; +- +-&usb_phy { +- brcm,ioc = <1>; +- status = "okay"; +-}; +- +-&ehci { +- status = "okay"; +-}; +- +-&ohci { +- status = "okay"; +-}; +- +-&xhci { +- status = "okay"; +-}; +- +-&ports { +- port@0 { +- label = "lan4"; +- }; +- +- port@1 { +- label = "lan3"; +- }; +- +- port@2 { +- label = "lan2"; +- }; +- +- port@3 { +- label = "lan1"; +- }; +- +- port@7 { +- reg = <7>; +- phy-mode = "internal"; +- phy-handle = <&phy12>; +- label = "wan"; +- }; +-}; +- +-&nandcs { +- nand-ecc-strength = <4>; +- nand-ecc-step-size = <512>; +- nand-on-flash-bbt; +- +- #address-cells = <1>; +- #size-cells = <0>; +- +- 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 0x3900000>; +- }; +- +- partition@5800000 { +- compatible = "brcm,bcm4908-firmware"; +- reg = <0x3a00000 0x3900000>; +- }; +- }; +-}; +--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4906.dtsi ++++ /dev/null +@@ -1,26 +0,0 @@ +-// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +- +-#include "bcm4908.dtsi" +- +-/ { +- cpus { +- /delete-node/ cpu@2; +- +- /delete-node/ cpu@3; +- }; +- +- timer { +- compatible = "arm,armv8-timer"; +- interrupts = , +- , +- , +- ; +- }; +- +- pmu { +- compatible = "arm,cortex-a53-pmu"; +- interrupts = , +- ; +- interrupt-affinity = <&cpu0>, <&cpu1>; +- }; +-}; +--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts ++++ /dev/null +@@ -1,207 +0,0 @@ +-// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +- +-#include +-#include +-#include +- +-#include "bcm4908.dtsi" +- +-/ { +- compatible = "asus,gt-ac5300", "brcm,bcm4908", "brcm,bcmbca"; +- model = "Asus GT-AC5300"; +- +- memory@0 { +- device_type = "memory"; +- reg = <0x00 0x00 0x00 0x40000000>; +- }; +- +- gpio-keys-polled { +- compatible = "gpio-keys-polled"; +- poll-interval = <100>; +- +- key-wifi { +- label = "WiFi"; +- linux,code = ; +- gpios = <&gpio0 28 GPIO_ACTIVE_LOW>; +- }; +- +- key-wps { +- label = "WPS"; +- linux,code = ; +- gpios = <&gpio0 29 GPIO_ACTIVE_LOW>; +- }; +- +- key-restart { +- label = "Reset"; +- linux,code = ; +- gpios = <&gpio0 30 GPIO_ACTIVE_LOW>; +- }; +- +- key-brightness { +- label = "LEDs"; +- linux,code = ; +- gpios = <&gpio0 31 GPIO_ACTIVE_LOW>; +- }; +- }; +-}; +- +-&enet { +- nvmem-cells = <&base_mac_addr>; +- nvmem-cell-names = "mac-address"; +-}; +- +-&usb_phy { +- brcm,ioc = <1>; +- status = "okay"; +-}; +- +-&ehci { +- status = "okay"; +-}; +- +-&ohci { +- status = "okay"; +-}; +- +-&xhci { +- status = "okay"; +-}; +- +-&ports { +- port@0 { +- label = "lan2"; +- }; +- +- port@1 { +- label = "lan1"; +- }; +- +- port@2 { +- label = "lan6"; +- }; +- +- port@3 { +- label = "lan5"; +- }; +- +- /* External BCM53134S switch */ +- port@7 { +- label = "sw"; +- reg = <7>; +- phy-mode = "rgmii"; +- +- fixed-link { +- speed = <1000>; +- full-duplex; +- }; +- }; +-}; +- +-&mdio { +- /* lan8 */ +- ethernet-phy@0 { +- reg = <0>; +- }; +- +- /* lan7 */ +- ethernet-phy@1 { +- reg = <1>; +- }; +- +- /* lan4 */ +- ethernet-phy@2 { +- reg = <2>; +- }; +- +- /* lan3 */ +- ethernet-phy@3 { +- reg = <3>; +- }; +-}; +- +-&leds { +- led-power@11 { +- reg = <0x11>; +- function = LED_FUNCTION_POWER; +- color = ; +- default-state = "on"; +- active-low; +- pinctrl-names = "default"; +- pinctrl-0 = <&pins_led_17_a>; +- }; +- +- led-wan-red@12 { +- reg = <0x12>; +- function = LED_FUNCTION_WAN; +- color = ; +- active-low; +- pinctrl-names = "default"; +- pinctrl-0 = <&pins_led_18_a>; +- }; +- +- led-wps@14 { +- reg = <0x14>; +- function = LED_FUNCTION_WPS; +- color = ; +- active-low; +- pinctrl-names = "default"; +- pinctrl-0 = <&pins_led_20_a>; +- }; +- +- led-wan-white@15 { +- reg = <0x15>; +- function = LED_FUNCTION_WAN; +- color = ; +- active-low; +- pinctrl-names = "default"; +- pinctrl-0 = <&pins_led_21_a>; +- }; +- +- led-lan@19 { +- reg = <0x19>; +- function = LED_FUNCTION_LAN; +- color = ; +- pinctrl-names = "default"; +- pinctrl-0 = <&pins_led_25_a>; +- }; +-}; +- +-&nandcs { +- nand-ecc-strength = <4>; +- nand-ecc-step-size = <512>; +- nand-on-flash-bbt; +- brcm,nand-has-wp; +- +- #address-cells = <1>; +- #size-cells = <0>; +- +- partitions { +- compatible = "brcm,bcm4908-partitions"; +- #address-cells = <1>; +- #size-cells = <1>; +- +- partition@0 { +- compatible = "nvmem-cells"; +- label = "cferom"; +- reg = <0x0 0x100000>; +- +- #address-cells = <1>; +- #size-cells = <1>; +- ranges = <0 0x0 0x100000>; +- +- base_mac_addr: mac@106a0 { +- reg = <0x106a0 0x6>; +- }; +- }; +- +- partition@100000 { +- compatible = "brcm,bcm4908-firmware"; +- reg = <0x100000 0x5700000>; +- }; +- +- partition@5800000 { +- compatible = "brcm,bcm4908-firmware"; +- reg = <0x5800000 0x5700000>; +- }; +- }; +-}; +--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-netgear-raxe500.dts ++++ /dev/null +@@ -1,50 +0,0 @@ +-// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +- +-#include "bcm4908.dtsi" +- +-/ { +- compatible = "netgear,raxe500", "brcm,bcm4908", "brcm,bcmbca"; +- model = "Netgear RAXE500"; +- +- memory@0 { +- device_type = "memory"; +- reg = <0x00 0x00 0x00 0x40000000>; +- }; +-}; +- +-&ehci { +- status = "okay"; +-}; +- +-&ohci { +- status = "okay"; +-}; +- +-&xhci { +- status = "okay"; +-}; +- +-&ports { +- port@0 { +- label = "lan4"; +- }; +- +- port@1 { +- label = "lan3"; +- }; +- +- port@2 { +- label = "lan2"; +- }; +- +- port@3 { +- label = "lan1"; +- }; +- +- port@7 { +- reg = <7>; +- phy-mode = "internal"; +- phy-handle = <&phy12>; +- label = "wan"; +- }; +-}; +--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi ++++ /dev/null +@@ -1,575 +0,0 @@ +-// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +- +-#include +-#include +-#include +-#include +- +-/dts-v1/; +- +-/ { +- interrupt-parent = <&gic>; +- +- #address-cells = <2>; +- #size-cells = <2>; +- +- aliases { +- serial0 = &uart0; +- }; +- +- chosen { +- stdout-path = "serial0:115200n8"; +- }; +- +- cpus { +- #address-cells = <1>; +- #size-cells = <0>; +- +- cpu0: cpu@0 { +- device_type = "cpu"; +- compatible = "brcm,brahma-b53"; +- reg = <0x0>; +- enable-method = "spin-table"; +- cpu-release-addr = <0x0 0xfff8>; +- next-level-cache = <&l2>; +- }; +- +- cpu1: cpu@1 { +- device_type = "cpu"; +- compatible = "brcm,brahma-b53"; +- reg = <0x1>; +- enable-method = "spin-table"; +- cpu-release-addr = <0x0 0xfff8>; +- next-level-cache = <&l2>; +- }; +- +- cpu2: cpu@2 { +- device_type = "cpu"; +- compatible = "brcm,brahma-b53"; +- reg = <0x2>; +- enable-method = "spin-table"; +- cpu-release-addr = <0x0 0xfff8>; +- next-level-cache = <&l2>; +- }; +- +- cpu3: cpu@3 { +- device_type = "cpu"; +- compatible = "brcm,brahma-b53"; +- reg = <0x3>; +- enable-method = "spin-table"; +- cpu-release-addr = <0x0 0xfff8>; +- next-level-cache = <&l2>; +- }; +- +- l2: l2-cache0 { +- compatible = "cache"; +- }; +- }; +- +- axi@81000000 { +- compatible = "simple-bus"; +- #address-cells = <1>; +- #size-cells = <1>; +- ranges = <0x00 0x00 0x81000000 0x4000>; +- +- gic: interrupt-controller@1000 { +- compatible = "arm,gic-400"; +- #interrupt-cells = <3>; +- #address-cells = <0>; +- interrupt-controller; +- reg = <0x1000 0x1000>, +- <0x2000 0x2000>; +- }; +- }; +- +- timer { +- compatible = "arm,armv8-timer"; +- interrupts = , +- , +- , +- ; +- }; +- +- pmu { +- compatible = "arm,cortex-a53-pmu"; +- interrupts = , +- , +- , +- ; +- interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>; +- }; +- +- clocks { +- periph_clk: periph_clk { +- compatible = "fixed-clock"; +- #clock-cells = <0>; +- clock-frequency = <50000000>; +- clock-output-names = "periph"; +- }; +- }; +- +- soc { +- compatible = "simple-bus"; +- #address-cells = <1>; +- #size-cells = <1>; +- ranges = <0x00 0x00 0x80000000 0x281000>; +- +- enet: ethernet@2000 { +- compatible = "brcm,bcm4908-enet"; +- reg = <0x2000 0x1000>; +- +- interrupts = , +- ; +- interrupt-names = "rx", "tx"; +- }; +- +- usb_phy: usb-phy@c200 { +- compatible = "brcm,bcm4908-usb-phy"; +- reg = <0xc200 0x100>; +- reg-names = "ctrl"; +- power-domains = <&pmb BCM_PMB_HOST_USB>; +- dr_mode = "host"; +- brcm,has-xhci; +- brcm,has-eohci; +- #phy-cells = <1>; +- status = "disabled"; +- }; +- +- ehci: usb@c300 { +- compatible = "generic-ehci"; +- reg = <0xc300 0x100>; +- interrupts = ; +- phys = <&usb_phy PHY_TYPE_USB2>; +- status = "disabled"; +- }; +- +- ohci: usb@c400 { +- compatible = "generic-ohci"; +- reg = <0xc400 0x100>; +- interrupts = ; +- phys = <&usb_phy PHY_TYPE_USB2>; +- status = "disabled"; +- }; +- +- xhci: usb@d000 { +- compatible = "generic-xhci"; +- reg = <0xd000 0x8c8>; +- interrupts = ; +- phys = <&usb_phy PHY_TYPE_USB3>; +- status = "disabled"; +- }; +- +- bus@80000 { +- compatible = "simple-bus"; +- #size-cells = <1>; +- #address-cells = <1>; +- ranges = <0 0x80000 0x50000>; +- +- ethernet-switch@0 { +- compatible = "brcm,bcm4908-switch"; +- reg = <0x0 0x40000>, +- <0x40000 0x110>, +- <0x40340 0x30>, +- <0x40380 0x30>, +- <0x40600 0x34>, +- <0x40800 0x208>; +- reg-names = "core", "reg", "intrl2_0", +- "intrl2_1", "fcb", "acb"; +- interrupts = , +- ; +- brcm,num-gphy = <5>; +- brcm,num-rgmii-ports = <2>; +- +- #address-cells = <1>; +- #size-cells = <0>; +- +- ports: ports { +- #address-cells = <1>; +- #size-cells = <0>; +- +- port@0 { +- reg = <0>; +- phy-mode = "internal"; +- phy-handle = <&phy8>; +- }; +- +- port@1 { +- reg = <1>; +- phy-mode = "internal"; +- phy-handle = <&phy9>; +- }; +- +- port@2 { +- reg = <2>; +- phy-mode = "internal"; +- phy-handle = <&phy10>; +- }; +- +- port@3 { +- reg = <3>; +- phy-mode = "internal"; +- phy-handle = <&phy11>; +- }; +- +- port@8 { +- reg = <8>; +- phy-mode = "internal"; +- ethernet = <&enet>; +- +- fixed-link { +- speed = <1000>; +- full-duplex; +- }; +- }; +- }; +- }; +- +- mdio: mdio@405c0 { +- compatible = "brcm,unimac-mdio"; +- reg = <0x405c0 0x8>; +- reg-names = "mdio"; +- #size-cells = <0>; +- #address-cells = <1>; +- +- phy8: ethernet-phy@8 { +- reg = <8>; +- }; +- +- phy9: ethernet-phy@9 { +- reg = <9>; +- }; +- +- phy10: ethernet-phy@a { +- reg = <10>; +- }; +- +- phy11: ethernet-phy@b { +- reg = <11>; +- }; +- +- phy12: ethernet-phy@c { +- reg = <12>; +- }; +- }; +- }; +- +- procmon: syscon@280000 { +- compatible = "simple-bus"; +- reg = <0x280000 0x1000>; +- ranges; +- +- #address-cells = <1>; +- #size-cells = <1>; +- +- pmb: power-controller@2800c0 { +- compatible = "brcm,bcm4908-pmb"; +- reg = <0x2800c0 0x40>; +- #power-domain-cells = <1>; +- }; +- }; +- }; +- +- bus@ff800000 { +- compatible = "simple-bus"; +- #address-cells = <1>; +- #size-cells = <1>; +- ranges = <0x00 0x00 0xff800000 0x3000>; +- +- twd: timer-mfd@400 { +- compatible = "brcm,bcm4908-twd", "simple-mfd", "syscon"; +- reg = <0x400 0x4c>; +- ranges = <0x0 0x400 0x4c>; +- +- #address-cells = <1>; +- #size-cells = <1>; +- +- watchdog@28 { +- compatible = "brcm,bcm6345-wdt"; +- reg = <0x28 0x8>; +- }; +- }; +- +- gpio0: gpio-controller@500 { +- compatible = "brcm,bcm6345-gpio"; +- reg-names = "dirout", "dat"; +- reg = <0x500 0x28>, <0x528 0x28>; +- +- #gpio-cells = <2>; +- gpio-controller; +- }; +- +- pinctrl@560 { +- compatible = "brcm,bcm4908-pinctrl"; +- reg = <0x560 0x10>; +- +- pins_led_0_a: led_0-a-pins { +- function = "led_0"; +- groups = "led_0_grp_a"; +- }; +- +- pins_led_1_a: led_1-a-pins { +- function = "led_1"; +- groups = "led_1_grp_a"; +- }; +- +- pins_led_2_a: led_2-a-pins { +- function = "led_2"; +- groups = "led_2_grp_a"; +- }; +- +- pins_led_3_a: led_3-a-pins { +- function = "led_3"; +- groups = "led_3_grp_a"; +- }; +- +- pins_led_4_a: led_4-a-pins { +- function = "led_4"; +- groups = "led_4_grp_a"; +- }; +- +- pins_led_5_a: led_5-a-pins { +- function = "led_5"; +- groups = "led_5_grp_a"; +- }; +- +- pins_led_6_a: led_6-a-pins { +- function = "led_6"; +- groups = "led_6_grp_a"; +- }; +- +- pins_led_7_a: led_7-a-pins { +- function = "led_7"; +- groups = "led_7_grp_a"; +- }; +- +- pins_led_8_a: led_8-a-pins { +- function = "led_8"; +- groups = "led_8_grp_a"; +- }; +- +- pins_led_9_a: led_9-a-pins { +- function = "led_9"; +- groups = "led_9_grp_a"; +- }; +- +- pins_led_10_a: led_10-a-pins { +- function = "led_10"; +- groups = "led_10_grp_a"; +- }; +- +- pins_led_11_a: led_11-a-pins { +- function = "led_11"; +- groups = "led_11_grp_a"; +- }; +- +- pins_led_12_a: led_12-a-pins { +- function = "led_12"; +- groups = "led_12_grp_a"; +- }; +- +- pins_led_13_a: led_13-a-pins { +- function = "led_13"; +- groups = "led_13_grp_a"; +- }; +- +- pins_led_14_a: led_14-a-pins { +- function = "led_14"; +- groups = "led_14_grp_a"; +- }; +- +- pins_led_15_a: led_15-a-pins { +- function = "led_15"; +- groups = "led_15_grp_a"; +- }; +- +- pins_led_16_a: led_16-a-pins { +- function = "led_16"; +- groups = "led_16_grp_a"; +- }; +- +- pins_led_17_a: led_17-a-pins { +- function = "led_17"; +- groups = "led_17_grp_a"; +- }; +- +- pins_led_18_a: led_18-a-pins { +- function = "led_18"; +- groups = "led_18_grp_a"; +- }; +- +- pins_led_19_a: led_19-a-pins { +- function = "led_19"; +- groups = "led_19_grp_a"; +- }; +- +- pins_led_20_a: led_20-a-pins { +- function = "led_20"; +- groups = "led_20_grp_a"; +- }; +- +- pins_led_21_a: led_21-a-pins { +- function = "led_21"; +- groups = "led_21_grp_a"; +- }; +- +- pins_led_22_a: led_22-a-pins { +- function = "led_22"; +- groups = "led_22_grp_a"; +- }; +- +- pins_led_23_a: led_23-a-pins { +- function = "led_23"; +- groups = "led_23_grp_a"; +- }; +- +- pins_led_24_a: led_24-a-pins { +- function = "led_24"; +- groups = "led_24_grp_a"; +- }; +- +- pins_led_25_a: led_25-a-pins { +- function = "led_25"; +- groups = "led_25_grp_a"; +- }; +- +- pins_led_26_a: led_26-a-pins { +- function = "led_26"; +- groups = "led_26_grp_a"; +- }; +- +- pins_led_27_a: led_27-a-pins { +- function = "led_27"; +- groups = "led_27_grp_a"; +- }; +- +- pins_led_28_a: led_28-a-pins { +- function = "led_28"; +- groups = "led_28_grp_a"; +- }; +- +- pins_led_29_a: led_29-a-pins { +- function = "led_29"; +- groups = "led_29_grp_a"; +- }; +- +- pins_led_30_a: led_30-a-pins { +- function = "led_30"; +- groups = "led_30_grp_a"; +- }; +- +- pins_led_31_a: led_31-a-pins { +- function = "led_31"; +- groups = "led_31_grp_a"; +- }; +- +- pins_hs_uart: hs_uart-pins { +- function = "hs_uart"; +- groups = "hs_uart_grp"; +- }; +- +- pins_i2c_a: i2c-a-pins { +- function = "i2c"; +- groups = "i2c_grp_a"; +- }; +- +- pins_i2c_b: i2c-b-pins { +- function = "i2c"; +- groups = "i2c_grp_b"; +- }; +- +- pins_i2s: i2s-pins { +- function = "i2s"; +- groups = "i2s_grp"; +- }; +- +- pins_nand_ctrl: nand_ctrl-pins { +- function = "nand_ctrl"; +- groups = "nand_ctrl_grp"; +- }; +- +- pins_nand_data: nand_data-pins { +- function = "nand_data"; +- groups = "nand_data_grp"; +- }; +- +- pins_emmc_ctrl: emmc_ctrl-pins { +- function = "emmc_ctrl"; +- groups = "emmc_ctrl_grp"; +- }; +- +- pins_usb0_pwr: usb0_pwr-pins { +- function = "usb0_pwr"; +- groups = "usb0_pwr_grp"; +- }; +- +- pins_usb1_pwr: usb1_pwr-pins { +- function = "usb1_pwr"; +- groups = "usb1_pwr_grp"; +- }; +- }; +- +- uart0: serial@640 { +- compatible = "brcm,bcm6345-uart"; +- reg = <0x640 0x18>; +- interrupts = ; +- clocks = <&periph_clk>; +- clock-names = "refclk"; +- status = "okay"; +- }; +- +- leds: leds@800 { +- compatible = "brcm,bcm4908-leds", "brcm,bcm63138-leds"; +- reg = <0x800 0xdc>; +- +- #address-cells = <1>; +- #size-cells = <0>; +- }; +- +- nand-controller@1800 { +- #address-cells = <1>; +- #size-cells = <0>; +- compatible = "brcm,nand-bcm63138", "brcm,brcmnand-v7.1", "brcm,brcmnand"; +- reg = <0x1800 0x600>, <0x2000 0x10>; +- reg-names = "nand", "nand-int-base"; +- interrupts = ; +- interrupt-names = "nand"; +- status = "okay"; +- +- nandcs: nand@0 { +- compatible = "brcm,nandcs"; +- reg = <0>; +- }; +- }; +- +- i2c@2100 { +- compatible = "brcm,brcmper-i2c"; +- reg = <0x2100 0x58>; +- clock-frequency = <97500>; +- pinctrl-names = "default"; +- pinctrl-0 = <&pins_i2c_a>; +- status = "disabled"; +- }; +- +- misc@2600 { +- compatible = "brcm,misc", "simple-mfd"; +- reg = <0x2600 0xe4>; +- +- #address-cells = <1>; +- #size-cells = <1>; +- ranges = <0x00 0x2600 0xe4>; +- +- reset-controller@2644 { +- compatible = "brcm,bcm4908-misc-pcie-reset"; +- reg = <0x44 0x04>; +- #reset-cells = <1>; +- }; +- }; +- }; +- +- reboot { +- compatible = "syscon-reboot"; +- regmap = <&twd>; +- offset = <0x34>; +- mask = <1>; +- }; +-}; +--- /dev/null ++++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm4906-netgear-r8000p.dts +@@ -0,0 +1,157 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++ ++#include ++#include ++#include ++ ++#include "bcm4906.dtsi" ++ ++/ { ++ compatible = "netgear,r8000p", "brcm,bcm4906", "brcm,bcm4908", "brcm,bcmbca"; ++ model = "Netgear R8000P"; ++ ++ memory@0 { ++ device_type = "memory"; ++ reg = <0x00 0x00 0x00 0x20000000>; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ led-power-white { ++ function = LED_FUNCTION_POWER; ++ color = ; ++ gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-power-amber { ++ function = LED_FUNCTION_POWER; ++ color = ; ++ gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-wps { ++ function = LED_FUNCTION_WPS; ++ color = ; ++ gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-2ghz { ++ function = "2ghz"; ++ color = ; ++ gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-5ghz-1 { ++ function = "5ghz-1"; ++ color = ; ++ gpios = <&gpio0 15 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-5ghz-2 { ++ function = "5ghz-2"; ++ color = ; ++ gpios = <&gpio0 16 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-usb2 { ++ function = "usb2"; ++ color = ; ++ gpios = <&gpio0 17 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-usb3 { ++ function = "usb3"; ++ color = ; ++ gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-wifi { ++ function = "wifi"; ++ color = ; ++ gpios = <&gpio0 56 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++&enet { ++ nvmem-cells = <&base_mac_addr>; ++ nvmem-cell-names = "mac-address"; ++}; ++ ++&usb_phy { ++ brcm,ioc = <1>; ++ status = "okay"; ++}; ++ ++&ehci { ++ status = "okay"; ++}; ++ ++&ohci { ++ status = "okay"; ++}; ++ ++&xhci { ++ status = "okay"; ++}; ++ ++&ports { ++ port@0 { ++ label = "lan4"; ++ }; ++ ++ port@1 { ++ label = "lan3"; ++ }; ++ ++ port@2 { ++ label = "lan2"; ++ }; ++ ++ port@3 { ++ label = "lan1"; ++ }; ++ ++ port@7 { ++ reg = <7>; ++ phy-mode = "internal"; ++ phy-handle = <&phy12>; ++ label = "wan"; ++ }; ++}; ++ ++&nandcs { ++ nand-ecc-strength = <4>; ++ nand-ecc-step-size = <512>; ++ nand-on-flash-bbt; ++ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ compatible = "nvmem-cells"; ++ label = "cferom"; ++ reg = <0x0 0x100000>; ++ ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ranges = <0 0x0 0x100000>; ++ ++ base_mac_addr: mac@106a0 { ++ reg = <0x106a0 0x6>; ++ }; ++ }; ++ ++ partition@100000 { ++ compatible = "brcm,bcm4908-firmware"; ++ label = "firmware"; ++ reg = <0x100000 0x4400000>; ++ }; ++ }; ++}; +--- /dev/null ++++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm4906-tplink-archer-c2300-v1.dts +@@ -0,0 +1,182 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++ ++#include ++#include ++#include ++ ++#include "bcm4906.dtsi" ++ ++/ { ++ compatible = "tplink,archer-c2300-v1", "brcm,bcm4906", "brcm,bcm4908", "brcm,bcmbca"; ++ model = "TP-Link Archer C2300 V1"; ++ ++ memory@0 { ++ device_type = "memory"; ++ reg = <0x00 0x00 0x00 0x20000000>; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ led-power { ++ function = LED_FUNCTION_POWER; ++ color = ; ++ gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-2ghz { ++ function = "2ghz"; ++ color = ; ++ gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-5ghz { ++ function = "5ghz"; ++ color = ; ++ gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-wan-amber { ++ function = LED_FUNCTION_WAN; ++ color = ; ++ gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ led-wan-blue { ++ function = LED_FUNCTION_WAN; ++ color = ; ++ gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-lan { ++ function = LED_FUNCTION_LAN; ++ color = ; ++ gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-wps { ++ function = LED_FUNCTION_WPS; ++ color = ; ++ gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-usb2 { ++ function = "usb2"; ++ color = ; ++ gpios = <&gpio0 15 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-usb3 { ++ function = "usbd3"; ++ color = ; ++ gpios = <&gpio0 17 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-brightness { ++ function = LED_FUNCTION_BACKLIGHT; ++ color = ; ++ gpios = <&gpio0 19 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ gpio-keys-polled { ++ compatible = "gpio-keys-polled"; ++ poll-interval = <100>; ++ ++ key-brightness { ++ label = "LEDs"; ++ linux,code = ; ++ gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; ++ }; ++ ++ key-wps { ++ label = "WPS"; ++ linux,code = ; ++ gpios = <&gpio0 21 GPIO_ACTIVE_LOW>; ++ }; ++ ++ key-wifi { ++ label = "WiFi"; ++ linux,code = ; ++ gpios = <&gpio0 22 GPIO_ACTIVE_LOW>; ++ }; ++ ++ key-restart { ++ label = "Reset"; ++ linux,code = ; ++ gpios = <&gpio0 23 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++&usb_phy { ++ brcm,ioc = <1>; ++ status = "okay"; ++}; ++ ++&ehci { ++ status = "okay"; ++}; ++ ++&ohci { ++ status = "okay"; ++}; ++ ++&xhci { ++ status = "okay"; ++}; ++ ++&ports { ++ port@0 { ++ label = "lan4"; ++ }; ++ ++ port@1 { ++ label = "lan3"; ++ }; ++ ++ port@2 { ++ label = "lan2"; ++ }; ++ ++ port@3 { ++ label = "lan1"; ++ }; ++ ++ port@7 { ++ reg = <7>; ++ phy-mode = "internal"; ++ phy-handle = <&phy12>; ++ label = "wan"; ++ }; ++}; ++ ++&nandcs { ++ nand-ecc-strength = <4>; ++ nand-ecc-step-size = <512>; ++ nand-on-flash-bbt; ++ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ 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 0x3900000>; ++ }; ++ ++ partition@5800000 { ++ compatible = "brcm,bcm4908-firmware"; ++ reg = <0x3a00000 0x3900000>; ++ }; ++ }; ++}; +--- /dev/null ++++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm4906.dtsi +@@ -0,0 +1,26 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++ ++#include "bcm4908.dtsi" ++ ++/ { ++ cpus { ++ /delete-node/ cpu@2; ++ ++ /delete-node/ cpu@3; ++ }; ++ ++ timer { ++ compatible = "arm,armv8-timer"; ++ interrupts = , ++ , ++ , ++ ; ++ }; ++ ++ pmu { ++ compatible = "arm,cortex-a53-pmu"; ++ interrupts = , ++ ; ++ interrupt-affinity = <&cpu0>, <&cpu1>; ++ }; ++}; +--- /dev/null ++++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908-asus-gt-ac5300.dts +@@ -0,0 +1,207 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++ ++#include ++#include ++#include ++ ++#include "bcm4908.dtsi" ++ ++/ { ++ compatible = "asus,gt-ac5300", "brcm,bcm4908", "brcm,bcmbca"; ++ model = "Asus GT-AC5300"; ++ ++ memory@0 { ++ device_type = "memory"; ++ reg = <0x00 0x00 0x00 0x40000000>; ++ }; ++ ++ gpio-keys-polled { ++ compatible = "gpio-keys-polled"; ++ poll-interval = <100>; ++ ++ key-wifi { ++ label = "WiFi"; ++ linux,code = ; ++ gpios = <&gpio0 28 GPIO_ACTIVE_LOW>; ++ }; ++ ++ key-wps { ++ label = "WPS"; ++ linux,code = ; ++ gpios = <&gpio0 29 GPIO_ACTIVE_LOW>; ++ }; ++ ++ key-restart { ++ label = "Reset"; ++ linux,code = ; ++ gpios = <&gpio0 30 GPIO_ACTIVE_LOW>; ++ }; ++ ++ key-brightness { ++ label = "LEDs"; ++ linux,code = ; ++ gpios = <&gpio0 31 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++&enet { ++ nvmem-cells = <&base_mac_addr>; ++ nvmem-cell-names = "mac-address"; ++}; ++ ++&usb_phy { ++ brcm,ioc = <1>; ++ status = "okay"; ++}; ++ ++&ehci { ++ status = "okay"; ++}; ++ ++&ohci { ++ status = "okay"; ++}; ++ ++&xhci { ++ status = "okay"; ++}; ++ ++&ports { ++ port@0 { ++ label = "lan2"; ++ }; ++ ++ port@1 { ++ label = "lan1"; ++ }; ++ ++ port@2 { ++ label = "lan6"; ++ }; ++ ++ port@3 { ++ label = "lan5"; ++ }; ++ ++ /* External BCM53134S switch */ ++ port@7 { ++ label = "sw"; ++ reg = <7>; ++ phy-mode = "rgmii"; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; ++}; ++ ++&mdio { ++ /* lan8 */ ++ ethernet-phy@0 { ++ reg = <0>; ++ }; ++ ++ /* lan7 */ ++ ethernet-phy@1 { ++ reg = <1>; ++ }; ++ ++ /* lan4 */ ++ ethernet-phy@2 { ++ reg = <2>; ++ }; ++ ++ /* lan3 */ ++ ethernet-phy@3 { ++ reg = <3>; ++ }; ++}; ++ ++&leds { ++ led-power@11 { ++ reg = <0x11>; ++ function = LED_FUNCTION_POWER; ++ color = ; ++ default-state = "on"; ++ active-low; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pins_led_17_a>; ++ }; ++ ++ led-wan-red@12 { ++ reg = <0x12>; ++ function = LED_FUNCTION_WAN; ++ color = ; ++ active-low; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pins_led_18_a>; ++ }; ++ ++ led-wps@14 { ++ reg = <0x14>; ++ function = LED_FUNCTION_WPS; ++ color = ; ++ active-low; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pins_led_20_a>; ++ }; ++ ++ led-wan-white@15 { ++ reg = <0x15>; ++ function = LED_FUNCTION_WAN; ++ color = ; ++ active-low; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pins_led_21_a>; ++ }; ++ ++ led-lan@19 { ++ reg = <0x19>; ++ function = LED_FUNCTION_LAN; ++ color = ; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pins_led_25_a>; ++ }; ++}; ++ ++&nandcs { ++ nand-ecc-strength = <4>; ++ nand-ecc-step-size = <512>; ++ nand-on-flash-bbt; ++ brcm,nand-has-wp; ++ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ partitions { ++ compatible = "brcm,bcm4908-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ compatible = "nvmem-cells"; ++ label = "cferom"; ++ reg = <0x0 0x100000>; ++ ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ranges = <0 0x0 0x100000>; ++ ++ base_mac_addr: mac@106a0 { ++ reg = <0x106a0 0x6>; ++ }; ++ }; ++ ++ partition@100000 { ++ compatible = "brcm,bcm4908-firmware"; ++ reg = <0x100000 0x5700000>; ++ }; ++ ++ partition@5800000 { ++ compatible = "brcm,bcm4908-firmware"; ++ reg = <0x5800000 0x5700000>; ++ }; ++ }; ++}; +--- /dev/null ++++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908-netgear-raxe500.dts +@@ -0,0 +1,50 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++ ++#include "bcm4908.dtsi" ++ ++/ { ++ compatible = "netgear,raxe500", "brcm,bcm4908", "brcm,bcmbca"; ++ model = "Netgear RAXE500"; ++ ++ memory@0 { ++ device_type = "memory"; ++ reg = <0x00 0x00 0x00 0x40000000>; ++ }; ++}; ++ ++&ehci { ++ status = "okay"; ++}; ++ ++&ohci { ++ status = "okay"; ++}; ++ ++&xhci { ++ status = "okay"; ++}; ++ ++&ports { ++ port@0 { ++ label = "lan4"; ++ }; ++ ++ port@1 { ++ label = "lan3"; ++ }; ++ ++ port@2 { ++ label = "lan2"; ++ }; ++ ++ port@3 { ++ label = "lan1"; ++ }; ++ ++ port@7 { ++ reg = <7>; ++ phy-mode = "internal"; ++ phy-handle = <&phy12>; ++ label = "wan"; ++ }; ++}; +--- /dev/null ++++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi +@@ -0,0 +1,575 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++ ++#include ++#include ++#include ++#include ++ ++/dts-v1/; ++ ++/ { ++ interrupt-parent = <&gic>; ++ ++ #address-cells = <2>; ++ #size-cells = <2>; ++ ++ aliases { ++ serial0 = &uart0; ++ }; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ cpus { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ cpu0: cpu@0 { ++ device_type = "cpu"; ++ compatible = "brcm,brahma-b53"; ++ reg = <0x0>; ++ enable-method = "spin-table"; ++ cpu-release-addr = <0x0 0xfff8>; ++ next-level-cache = <&l2>; ++ }; ++ ++ cpu1: cpu@1 { ++ device_type = "cpu"; ++ compatible = "brcm,brahma-b53"; ++ reg = <0x1>; ++ enable-method = "spin-table"; ++ cpu-release-addr = <0x0 0xfff8>; ++ next-level-cache = <&l2>; ++ }; ++ ++ cpu2: cpu@2 { ++ device_type = "cpu"; ++ compatible = "brcm,brahma-b53"; ++ reg = <0x2>; ++ enable-method = "spin-table"; ++ cpu-release-addr = <0x0 0xfff8>; ++ next-level-cache = <&l2>; ++ }; ++ ++ cpu3: cpu@3 { ++ device_type = "cpu"; ++ compatible = "brcm,brahma-b53"; ++ reg = <0x3>; ++ enable-method = "spin-table"; ++ cpu-release-addr = <0x0 0xfff8>; ++ next-level-cache = <&l2>; ++ }; ++ ++ l2: l2-cache0 { ++ compatible = "cache"; ++ }; ++ }; ++ ++ axi@81000000 { ++ compatible = "simple-bus"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ranges = <0x00 0x00 0x81000000 0x4000>; ++ ++ gic: interrupt-controller@1000 { ++ compatible = "arm,gic-400"; ++ #interrupt-cells = <3>; ++ #address-cells = <0>; ++ interrupt-controller; ++ reg = <0x1000 0x1000>, ++ <0x2000 0x2000>; ++ }; ++ }; ++ ++ timer { ++ compatible = "arm,armv8-timer"; ++ interrupts = , ++ , ++ , ++ ; ++ }; ++ ++ pmu { ++ compatible = "arm,cortex-a53-pmu"; ++ interrupts = , ++ , ++ , ++ ; ++ interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>; ++ }; ++ ++ clocks { ++ periph_clk: periph_clk { ++ compatible = "fixed-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <50000000>; ++ clock-output-names = "periph"; ++ }; ++ }; ++ ++ soc { ++ compatible = "simple-bus"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ranges = <0x00 0x00 0x80000000 0x281000>; ++ ++ enet: ethernet@2000 { ++ compatible = "brcm,bcm4908-enet"; ++ reg = <0x2000 0x1000>; ++ ++ interrupts = , ++ ; ++ interrupt-names = "rx", "tx"; ++ }; ++ ++ usb_phy: usb-phy@c200 { ++ compatible = "brcm,bcm4908-usb-phy"; ++ reg = <0xc200 0x100>; ++ reg-names = "ctrl"; ++ power-domains = <&pmb BCM_PMB_HOST_USB>; ++ dr_mode = "host"; ++ brcm,has-xhci; ++ brcm,has-eohci; ++ #phy-cells = <1>; ++ status = "disabled"; ++ }; ++ ++ ehci: usb@c300 { ++ compatible = "generic-ehci"; ++ reg = <0xc300 0x100>; ++ interrupts = ; ++ phys = <&usb_phy PHY_TYPE_USB2>; ++ status = "disabled"; ++ }; ++ ++ ohci: usb@c400 { ++ compatible = "generic-ohci"; ++ reg = <0xc400 0x100>; ++ interrupts = ; ++ phys = <&usb_phy PHY_TYPE_USB2>; ++ status = "disabled"; ++ }; ++ ++ xhci: usb@d000 { ++ compatible = "generic-xhci"; ++ reg = <0xd000 0x8c8>; ++ interrupts = ; ++ phys = <&usb_phy PHY_TYPE_USB3>; ++ status = "disabled"; ++ }; ++ ++ bus@80000 { ++ compatible = "simple-bus"; ++ #size-cells = <1>; ++ #address-cells = <1>; ++ ranges = <0 0x80000 0x50000>; ++ ++ ethernet-switch@0 { ++ compatible = "brcm,bcm4908-switch"; ++ reg = <0x0 0x40000>, ++ <0x40000 0x110>, ++ <0x40340 0x30>, ++ <0x40380 0x30>, ++ <0x40600 0x34>, ++ <0x40800 0x208>; ++ reg-names = "core", "reg", "intrl2_0", ++ "intrl2_1", "fcb", "acb"; ++ interrupts = , ++ ; ++ brcm,num-gphy = <5>; ++ brcm,num-rgmii-ports = <2>; ++ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ ports: ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ port@0 { ++ reg = <0>; ++ phy-mode = "internal"; ++ phy-handle = <&phy8>; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ phy-mode = "internal"; ++ phy-handle = <&phy9>; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ phy-mode = "internal"; ++ phy-handle = <&phy10>; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ phy-mode = "internal"; ++ phy-handle = <&phy11>; ++ }; ++ ++ port@8 { ++ reg = <8>; ++ phy-mode = "internal"; ++ ethernet = <&enet>; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; ++ }; ++ }; ++ ++ mdio: mdio@405c0 { ++ compatible = "brcm,unimac-mdio"; ++ reg = <0x405c0 0x8>; ++ reg-names = "mdio"; ++ #size-cells = <0>; ++ #address-cells = <1>; ++ ++ phy8: ethernet-phy@8 { ++ reg = <8>; ++ }; ++ ++ phy9: ethernet-phy@9 { ++ reg = <9>; ++ }; ++ ++ phy10: ethernet-phy@a { ++ reg = <10>; ++ }; ++ ++ phy11: ethernet-phy@b { ++ reg = <11>; ++ }; ++ ++ phy12: ethernet-phy@c { ++ reg = <12>; ++ }; ++ }; ++ }; ++ ++ procmon: syscon@280000 { ++ compatible = "simple-bus"; ++ reg = <0x280000 0x1000>; ++ ranges; ++ ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ pmb: power-controller@2800c0 { ++ compatible = "brcm,bcm4908-pmb"; ++ reg = <0x2800c0 0x40>; ++ #power-domain-cells = <1>; ++ }; ++ }; ++ }; ++ ++ bus@ff800000 { ++ compatible = "simple-bus"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ranges = <0x00 0x00 0xff800000 0x3000>; ++ ++ twd: timer-mfd@400 { ++ compatible = "brcm,bcm4908-twd", "simple-mfd", "syscon"; ++ reg = <0x400 0x4c>; ++ ranges = <0x0 0x400 0x4c>; ++ ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ watchdog@28 { ++ compatible = "brcm,bcm6345-wdt"; ++ reg = <0x28 0x8>; ++ }; ++ }; ++ ++ gpio0: gpio-controller@500 { ++ compatible = "brcm,bcm6345-gpio"; ++ reg-names = "dirout", "dat"; ++ reg = <0x500 0x28>, <0x528 0x28>; ++ ++ #gpio-cells = <2>; ++ gpio-controller; ++ }; ++ ++ pinctrl@560 { ++ compatible = "brcm,bcm4908-pinctrl"; ++ reg = <0x560 0x10>; ++ ++ pins_led_0_a: led_0-a-pins { ++ function = "led_0"; ++ groups = "led_0_grp_a"; ++ }; ++ ++ pins_led_1_a: led_1-a-pins { ++ function = "led_1"; ++ groups = "led_1_grp_a"; ++ }; ++ ++ pins_led_2_a: led_2-a-pins { ++ function = "led_2"; ++ groups = "led_2_grp_a"; ++ }; ++ ++ pins_led_3_a: led_3-a-pins { ++ function = "led_3"; ++ groups = "led_3_grp_a"; ++ }; ++ ++ pins_led_4_a: led_4-a-pins { ++ function = "led_4"; ++ groups = "led_4_grp_a"; ++ }; ++ ++ pins_led_5_a: led_5-a-pins { ++ function = "led_5"; ++ groups = "led_5_grp_a"; ++ }; ++ ++ pins_led_6_a: led_6-a-pins { ++ function = "led_6"; ++ groups = "led_6_grp_a"; ++ }; ++ ++ pins_led_7_a: led_7-a-pins { ++ function = "led_7"; ++ groups = "led_7_grp_a"; ++ }; ++ ++ pins_led_8_a: led_8-a-pins { ++ function = "led_8"; ++ groups = "led_8_grp_a"; ++ }; ++ ++ pins_led_9_a: led_9-a-pins { ++ function = "led_9"; ++ groups = "led_9_grp_a"; ++ }; ++ ++ pins_led_10_a: led_10-a-pins { ++ function = "led_10"; ++ groups = "led_10_grp_a"; ++ }; ++ ++ pins_led_11_a: led_11-a-pins { ++ function = "led_11"; ++ groups = "led_11_grp_a"; ++ }; ++ ++ pins_led_12_a: led_12-a-pins { ++ function = "led_12"; ++ groups = "led_12_grp_a"; ++ }; ++ ++ pins_led_13_a: led_13-a-pins { ++ function = "led_13"; ++ groups = "led_13_grp_a"; ++ }; ++ ++ pins_led_14_a: led_14-a-pins { ++ function = "led_14"; ++ groups = "led_14_grp_a"; ++ }; ++ ++ pins_led_15_a: led_15-a-pins { ++ function = "led_15"; ++ groups = "led_15_grp_a"; ++ }; ++ ++ pins_led_16_a: led_16-a-pins { ++ function = "led_16"; ++ groups = "led_16_grp_a"; ++ }; ++ ++ pins_led_17_a: led_17-a-pins { ++ function = "led_17"; ++ groups = "led_17_grp_a"; ++ }; ++ ++ pins_led_18_a: led_18-a-pins { ++ function = "led_18"; ++ groups = "led_18_grp_a"; ++ }; ++ ++ pins_led_19_a: led_19-a-pins { ++ function = "led_19"; ++ groups = "led_19_grp_a"; ++ }; ++ ++ pins_led_20_a: led_20-a-pins { ++ function = "led_20"; ++ groups = "led_20_grp_a"; ++ }; ++ ++ pins_led_21_a: led_21-a-pins { ++ function = "led_21"; ++ groups = "led_21_grp_a"; ++ }; ++ ++ pins_led_22_a: led_22-a-pins { ++ function = "led_22"; ++ groups = "led_22_grp_a"; ++ }; ++ ++ pins_led_23_a: led_23-a-pins { ++ function = "led_23"; ++ groups = "led_23_grp_a"; ++ }; ++ ++ pins_led_24_a: led_24-a-pins { ++ function = "led_24"; ++ groups = "led_24_grp_a"; ++ }; ++ ++ pins_led_25_a: led_25-a-pins { ++ function = "led_25"; ++ groups = "led_25_grp_a"; ++ }; ++ ++ pins_led_26_a: led_26-a-pins { ++ function = "led_26"; ++ groups = "led_26_grp_a"; ++ }; ++ ++ pins_led_27_a: led_27-a-pins { ++ function = "led_27"; ++ groups = "led_27_grp_a"; ++ }; ++ ++ pins_led_28_a: led_28-a-pins { ++ function = "led_28"; ++ groups = "led_28_grp_a"; ++ }; ++ ++ pins_led_29_a: led_29-a-pins { ++ function = "led_29"; ++ groups = "led_29_grp_a"; ++ }; ++ ++ pins_led_30_a: led_30-a-pins { ++ function = "led_30"; ++ groups = "led_30_grp_a"; ++ }; ++ ++ pins_led_31_a: led_31-a-pins { ++ function = "led_31"; ++ groups = "led_31_grp_a"; ++ }; ++ ++ pins_hs_uart: hs_uart-pins { ++ function = "hs_uart"; ++ groups = "hs_uart_grp"; ++ }; ++ ++ pins_i2c_a: i2c-a-pins { ++ function = "i2c"; ++ groups = "i2c_grp_a"; ++ }; ++ ++ pins_i2c_b: i2c-b-pins { ++ function = "i2c"; ++ groups = "i2c_grp_b"; ++ }; ++ ++ pins_i2s: i2s-pins { ++ function = "i2s"; ++ groups = "i2s_grp"; ++ }; ++ ++ pins_nand_ctrl: nand_ctrl-pins { ++ function = "nand_ctrl"; ++ groups = "nand_ctrl_grp"; ++ }; ++ ++ pins_nand_data: nand_data-pins { ++ function = "nand_data"; ++ groups = "nand_data_grp"; ++ }; ++ ++ pins_emmc_ctrl: emmc_ctrl-pins { ++ function = "emmc_ctrl"; ++ groups = "emmc_ctrl_grp"; ++ }; ++ ++ pins_usb0_pwr: usb0_pwr-pins { ++ function = "usb0_pwr"; ++ groups = "usb0_pwr_grp"; ++ }; ++ ++ pins_usb1_pwr: usb1_pwr-pins { ++ function = "usb1_pwr"; ++ groups = "usb1_pwr_grp"; ++ }; ++ }; ++ ++ uart0: serial@640 { ++ compatible = "brcm,bcm6345-uart"; ++ reg = <0x640 0x18>; ++ interrupts = ; ++ clocks = <&periph_clk>; ++ clock-names = "refclk"; ++ status = "okay"; ++ }; ++ ++ leds: leds@800 { ++ compatible = "brcm,bcm4908-leds", "brcm,bcm63138-leds"; ++ reg = <0x800 0xdc>; ++ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ }; ++ ++ nand-controller@1800 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ compatible = "brcm,nand-bcm63138", "brcm,brcmnand-v7.1", "brcm,brcmnand"; ++ reg = <0x1800 0x600>, <0x2000 0x10>; ++ reg-names = "nand", "nand-int-base"; ++ interrupts = ; ++ interrupt-names = "nand"; ++ status = "okay"; ++ ++ nandcs: nand@0 { ++ compatible = "brcm,nandcs"; ++ reg = <0>; ++ }; ++ }; ++ ++ i2c@2100 { ++ compatible = "brcm,brcmper-i2c"; ++ reg = <0x2100 0x58>; ++ clock-frequency = <97500>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pins_i2c_a>; ++ status = "disabled"; ++ }; ++ ++ misc@2600 { ++ compatible = "brcm,misc", "simple-mfd"; ++ reg = <0x2600 0xe4>; ++ ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ranges = <0x00 0x2600 0xe4>; ++ ++ reset-controller@2644 { ++ compatible = "brcm,bcm4908-misc-pcie-reset"; ++ reg = <0x44 0x04>; ++ #reset-cells = <1>; ++ }; ++ }; ++ }; ++ ++ reboot { ++ compatible = "syscon-reboot"; ++ regmap = <&twd>; ++ offset = <0x34>; ++ mask = <1>; ++ }; ++}; diff --git a/target/linux/bcm4908/patches-5.4/038-v6.1-0006-arm64-dts-Add-BCM4908-generic-board-dts.patch b/target/linux/bcm4908/patches-5.4/038-v6.1-0006-arm64-dts-Add-BCM4908-generic-board-dts.patch new file mode 100644 index 0000000000..b19c5d33b4 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/038-v6.1-0006-arm64-dts-Add-BCM4908-generic-board-dts.patch @@ -0,0 +1,62 @@ +From 72e0bdb6d7edb1785d58f2e8e7c80e1d2f93a319 Mon Sep 17 00:00:00 2001 +From: William Zhang +Date: Wed, 3 Aug 2022 10:54:51 -0700 +Subject: [PATCH] arm64: dts: Add BCM4908 generic board dts + +Add generic bare bone bcm94908.dts file to support any 4908 based +design. It supports cpu subsystem, memory and an uart console. This can +be useful for board bring-up and cpu subsystem and memory related kernel +test as well. + +Signed-off-by: William Zhang +Link: https://lore.kernel.org/r/20220803175455.47638-6-william.zhang@broadcom.com +Signed-off-by: Florian Fainelli +--- + arch/arm64/boot/dts/broadcom/bcmbca/Makefile | 1 + + .../boot/dts/broadcom/bcmbca/bcm94908.dts | 30 +++++++++++++++++++ + 2 files changed, 31 insertions(+) + create mode 100644 arch/arm64/boot/dts/broadcom/bcmbca/bcm94908.dts + +--- a/arch/arm64/boot/dts/broadcom/bcmbca/Makefile ++++ b/arch/arm64/boot/dts/broadcom/bcmbca/Makefile +@@ -4,6 +4,7 @@ dtb-$(CONFIG_ARCH_BCMBCA) += \ + bcm4906-tplink-archer-c2300-v1.dtb \ + bcm4908-asus-gt-ac5300.dtb \ + bcm4908-netgear-raxe500.dtb \ ++ bcm94908.dtb \ + bcm4912-asus-gt-ax6000.dtb \ + bcm94912.dtb \ + bcm963158.dtb \ +--- /dev/null ++++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm94908.dts +@@ -0,0 +1,30 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright 2022 Broadcom Ltd. ++ */ ++ ++/dts-v1/; ++ ++#include "bcm4908.dtsi" ++ ++/ { ++ model = "Broadcom BCM94908 Reference Board"; ++ compatible = "brcm,bcm94908", "brcm,bcm4908", "brcm,bcmbca"; ++ ++ aliases { ++ serial0 = &uart0; ++ }; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ memory@0 { ++ device_type = "memory"; ++ reg = <0x0 0x0 0x0 0x08000000>; ++ }; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; diff --git a/target/linux/bcm4908/patches-5.4/039-v6.2-0001-arm64-dts-broadcom-bcmbca-bcm4908-add-TWD-block-time.patch b/target/linux/bcm4908/patches-5.4/039-v6.2-0001-arm64-dts-broadcom-bcmbca-bcm4908-add-TWD-block-time.patch new file mode 100644 index 0000000000..a3f49ca440 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/039-v6.2-0001-arm64-dts-broadcom-bcmbca-bcm4908-add-TWD-block-time.patch @@ -0,0 +1,31 @@ +From 68064196cffea33f090bd2e8d81cd5e20107ecf1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 3 Nov 2022 11:53:16 +0100 +Subject: [PATCH] arm64: dts: broadcom: bcmbca: bcm4908: add TWD block timer +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +BCM4908 TWD contains block with 4 timers. Add binding for it. + +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20221103105316.21294-1-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi ++++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi +@@ -283,6 +283,11 @@ + #address-cells = <1>; + #size-cells = <1>; + ++ timer@0 { ++ compatible = "brcm,bcm63138-timer"; ++ reg = <0x0 0x28>; ++ }; ++ + watchdog@28 { + compatible = "brcm,bcm6345-wdt"; + reg = <0x28 0x8>; diff --git a/target/linux/bcm4908/patches-5.4/039-v6.2-0002-arm64-dts-broadcom-bcmbca-bcm6858-add-TWD-block.patch b/target/linux/bcm4908/patches-5.4/039-v6.2-0002-arm64-dts-broadcom-bcmbca-bcm6858-add-TWD-block.patch new file mode 100644 index 0000000000..e8e81ae544 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/039-v6.2-0002-arm64-dts-broadcom-bcmbca-bcm6858-add-TWD-block.patch @@ -0,0 +1,46 @@ +From 4f9fb09175e87a233787a2dee1e5dabb14deb022 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 3 Nov 2022 12:00:15 +0100 +Subject: [PATCH] arm64: dts: broadcom: bcmbca: bcm6858: add TWD block +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +BCM6858 contains TWD block with timers, watchdog, and reset subblocks. +Describe it. + +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20221103110015.21761-1-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + .../boot/dts/broadcom/bcmbca/bcm6858.dtsi | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +--- a/arch/arm64/boot/dts/broadcom/bcmbca/bcm6858.dtsi ++++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm6858.dtsi +@@ -109,6 +109,25 @@ + #size-cells = <1>; + ranges = <0x0 0x0 0xff800000 0x62000>; + ++ twd: timer-mfd@400 { ++ compatible = "brcm,bcm4908-twd", "simple-mfd", "syscon"; ++ reg = <0x400 0x4c>; ++ ranges = <0x0 0x400 0x4c>; ++ ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ timer@0 { ++ compatible = "brcm,bcm63138-timer"; ++ reg = <0x0 0x28>; ++ }; ++ ++ watchdog@28 { ++ compatible = "brcm,bcm6345-wdt"; ++ reg = <0x28 0x8>; ++ }; ++ }; ++ + uart0: serial@640 { + compatible = "brcm,bcm6345-uart"; + reg = <0x640 0x18>; diff --git a/target/linux/bcm4908/patches-5.4/300-arm64-dts-broadcom-bcm4908-limit-amount-of-GPIOs.patch b/target/linux/bcm4908/patches-5.4/300-arm64-dts-broadcom-bcmbca-bcm4908-limit-amount-of-GP.patch similarity index 71% rename from target/linux/bcm4908/patches-5.4/300-arm64-dts-broadcom-bcm4908-limit-amount-of-GPIOs.patch rename to target/linux/bcm4908/patches-5.4/300-arm64-dts-broadcom-bcmbca-bcm4908-limit-amount-of-GP.patch index 93c89ffa30..bc0743c800 100644 --- a/target/linux/bcm4908/patches-5.4/300-arm64-dts-broadcom-bcm4908-limit-amount-of-GPIOs.patch +++ b/target/linux/bcm4908/patches-5.4/300-arm64-dts-broadcom-bcmbca-bcm4908-limit-amount-of-GP.patch @@ -1,6 +1,6 @@ From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Mon, 15 Feb 2021 22:01:03 +0100 -Subject: [PATCH] arm64: dts: broadcom: bcm4908: limit amount of GPIOs +Subject: [PATCH] arm64: dts: broadcom: bcmbca: bcm4908: limit amount of GPIOs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -10,9 +10,9 @@ Linux driver can't handle more than 64 GPIOs Signed-off-by: Rafał Miłecki --- ---- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi -@@ -292,7 +292,7 @@ +--- a/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi ++++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi +@@ -297,7 +297,7 @@ gpio0: gpio-controller@500 { compatible = "brcm,bcm6345-gpio"; reg-names = "dirout", "dat"; From bce80ae12580008bea56bd73b8a177a002c88ac4 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 2 Dec 2022 17:38:26 +0800 Subject: [PATCH 025/137] mt76: refresh patches Signed-off-by: Tianling Shen (cherry picked from commit 488f693b5dd5c09433f2dee993844b0236e0ab5a) --- .../0001-mt76-allow-VHT-rate-on-2.4GHz.patch | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/package/kernel/mt76/patches/0001-mt76-allow-VHT-rate-on-2.4GHz.patch b/package/kernel/mt76/patches/0001-mt76-allow-VHT-rate-on-2.4GHz.patch index 0a40968a98..27110f1870 100644 --- a/package/kernel/mt76/patches/0001-mt76-allow-VHT-rate-on-2.4GHz.patch +++ b/package/kernel/mt76/patches/0001-mt76-allow-VHT-rate-on-2.4GHz.patch @@ -1,4 +1,4 @@ -From ed0b9c38becdbf9379787ca0b4db557f03a31dd7 Mon Sep 17 00:00:00 2001 +From fcddb155b538beb0ca7614260a1323d64bfc656a Mon Sep 17 00:00:00 2001 From: DENG Qingfang Date: Mon, 23 Nov 2020 10:46:37 +0800 Subject: [PATCH] mt76: allow VHT rate on 2.4GHz @@ -7,14 +7,13 @@ Allow chips that support 11ac to use 256QAM on 2.4GHz Signed-off-by: DENG Qingfang --- - mac80211.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) + mac80211.c | 10 +++++----- + mt7615/init.c | 2 ++ + 2 files changed, 7 insertions(+), 5 deletions(-) -diff --git a/mac80211.c b/mac80211.c -index 766681a4..06aa4228 100644 --- a/mac80211.c +++ b/mac80211.c -@@ -264,7 +264,7 @@ static void mt76_init_stream_cap(struct mt76_phy *phy, +@@ -275,7 +275,7 @@ static void mt76_init_stream_cap(struct void mt76_set_stream_caps(struct mt76_phy *phy, bool vht) { if (phy->cap.has_2ghz) @@ -23,7 +22,7 @@ index 766681a4..06aa4228 100644 if (phy->cap.has_5ghz) mt76_init_stream_cap(phy, &phy->sband_5g.sband, vht); if (phy->cap.has_6ghz) -@@ -333,13 +333,13 @@ mt76_init_sband(struct mt76_phy *phy, struct mt76_sband *msband, +@@ -342,13 +342,13 @@ mt76_init_sband(struct mt76_phy *phy, st static int mt76_init_sband_2g(struct mt76_phy *phy, struct ieee80211_rate *rates, @@ -39,8 +38,8 @@ index 766681a4..06aa4228 100644 } static int -@@ -475,7 +475,7 @@ int mt76_register_phy(struct mt76_phy *phy, bool vht, - mt76_phy_init(phy, phy->hw); +@@ -496,7 +496,7 @@ int mt76_register_phy(struct mt76_phy *p + return ret; if (phy->cap.has_2ghz) { - ret = mt76_init_sband_2g(phy, rates, n_rates); @@ -48,8 +47,8 @@ index 766681a4..06aa4228 100644 if (ret) return ret; } -@@ -594,7 +594,7 @@ int mt76_register_device(struct mt76_dev *dev, bool vht, - mt76_phy_init(phy, hw); +@@ -621,7 +621,7 @@ int mt76_register_device(struct mt76_dev + return ret; if (phy->cap.has_2ghz) { - ret = mt76_init_sband_2g(phy, rates, n_rates); @@ -57,3 +56,14 @@ index 766681a4..06aa4228 100644 if (ret) return ret; } +--- a/mt7615/init.c ++++ b/mt7615/init.c +@@ -409,6 +409,8 @@ mt7615_init_wiphy(struct ieee80211_hw *h + hw->max_tx_fragments = MT_HW_TXP_MAX_BUF_NUM; + + phy->mt76->sband_2g.sband.ht_cap.cap |= IEEE80211_HT_CAP_LDPC_CODING; ++ phy->mt76->sband_2g.sband.vht_cap.cap |= ++ IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK; + phy->mt76->sband_5g.sband.ht_cap.cap |= IEEE80211_HT_CAP_LDPC_CODING; + phy->mt76->sband_5g.sband.vht_cap.cap |= + IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK; From ddba2d122ce37d7e54346b65aabedcb94b23eb37 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 11 Nov 2022 20:03:45 +0100 Subject: [PATCH 026/137] mt76: update to the latest version 8cc34bdc9ef0 wifi: mt76: mt7921: set MT_DRV_AMSDU_OFFLOAD for USB/SDIO 2182de50a37c wifi: mt76: fix receiving LLC packets on mt7615/mt7915 269df4b01f27 wifi: mt76: fix rx checksum offload on mt7615/mt7915/mt7921 fa4ace8e3b58 ieee80211: add EHT 1K aggregation definitions 176df35e7e80 wifi: mt76: mt7915: improve accuracy of time_busy calculation 94b335fa88e1 wifi: mt76: mt7915: add ack signal support 3365c129f73c wifi: mt76: mt7915: enable use_cts_prot support ad9bd2ba361e wifi: mt76: mt7615: enable use_cts_prot support 68bdcccb0aa7 wifi: mt76: mt7915: fix reporting of TX AGGR histogram 242fece4323f wifi: mt76: mt7921: fix reporting of TX AGGR histogram 75003c69a9bd wifi: mt76: mt7615: rely on mt7615_phy in mt7615_mac_reset_counters 65c70a32f1cf wifi: mt76: move aggr_stats array in mt76_phy b1ddf8bec058 wifi: mt76: mt7915: rework mt7915_dma_reset() 1ad31c3f76f4 wifi: mt76: mt7915: enable full system reset support 6b0668de7a53 wifi: mt76: mt7915: add full system reset into debugfs a5e48378d2a6 wifi: mt76: mt7915: enable coredump support 1e9060420c92 wifi: mt76: mt7915: fix incorrect tx path number configuration 0263711ba362 wifi: mt76: mt7915: fix antenna selection with bad eeprom. 869815e5ef86 wifi: mt76: mt7915: Fix chainmask calculation on mt7915 DBDC fc410557b7e1 wifi: mt76: mt7915: Fix VHT beamforming capabilities with DBDC daa30a31cf70 wifi: mt76: mt7915: don't claim 160MHz support with mt7915 DBDC 80bcecdbc2ff wifi: mt76: connac: update nss calculation in txs 465219c1f56c wifi: mt76: do not run mt76u_status_worker if the device is not running c7db15903e5c wifi: mt76: connac: add mt76_connac_mcu_uni_set_chctx 7a2b1a13b1b0 wifi: mt76: mt7921: add chanctx parameter to mt76_connac_mcu_uni_add_bss signature dece6921e606 wifi: mt76: mt7921: add unified ROC cmd/event support d4da182389b6 wifi: mt76: mt7921: drop ieee80211_[start, stop]_queues in driver 0c3ef988d8dc wifi: mt76: connac: accept hw scan request at a time c477225fd10e mt7615: update cr4 firmware to 20190415154149 413a4bf39513 mt76: mt7915: fix unused-but-set variable f5034abea899 mt76: mt7915: fix format string a9ac73ed8275 wifi: mt76: mt7615: increase eeprom size for mt7663 4a27f23fc4f2 linux-firmware: update firmware for MT7921 WiFi device Signed-off-by: Felix Fietkau (cherry picked from commit 2403428c75c25301996567cdde57e2230e14d766) --- package/kernel/mt76/Makefile | 6 +++--- .../mt76/patches/100-aggregation-definitions.patch | 13 ------------- 2 files changed, 3 insertions(+), 16 deletions(-) delete mode 100644 package/kernel/mt76/patches/100-aggregation-definitions.patch diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index b85a3dc39a..bf58afbf56 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:=2022-10-01 -PKG_SOURCE_VERSION:=72b87836d368685a093b927229209b61d8272541 -PKG_MIRROR_HASH:=ea4dfe93f7632d5063ac2ccf0f5a3698e2bfeadbbef45910381b5ef07e334cfc +PKG_SOURCE_DATE:=2022-11-11 +PKG_SOURCE_VERSION:=4a27f23fc4f22510db81513680666be7e72ccb61 +PKG_MIRROR_HASH:=2cb9a446c6df7d56efc8ace46227964b492bdc3cae6bdbcc2e03fdd1b836b5a6 PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 diff --git a/package/kernel/mt76/patches/100-aggregation-definitions.patch b/package/kernel/mt76/patches/100-aggregation-definitions.patch deleted file mode 100644 index a88d57133f..0000000000 --- a/package/kernel/mt76/patches/100-aggregation-definitions.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/mt7915/init.c -+++ b/mt7915/init.c -@@ -327,8 +327,8 @@ mt7915_init_wiphy(struct ieee80211_hw *h - struct mt7915_dev *dev = phy->dev; - - hw->queues = 4; -- hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF; -- hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF; -+ hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE; -+ hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE; - hw->netdev_features = NETIF_F_RXCSUM; - - hw->radiotap_timestamp.units_pos = From 6efaeaa6670fa2975a8190b6eaf2de0bf518c612 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 12 Nov 2022 19:18:54 +0100 Subject: [PATCH 027/137] mt76: update to the latest version 4bf2607362fc wifi: mt76: fix dbdc number of spatial streams limit Signed-off-by: Felix Fietkau (cherry picked from commit 9179f484bfcb37e1c59e736b2a64c9583eb00356) --- package/kernel/mt76/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index bf58afbf56..b3efdab23e 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:=2022-11-11 -PKG_SOURCE_VERSION:=4a27f23fc4f22510db81513680666be7e72ccb61 -PKG_MIRROR_HASH:=2cb9a446c6df7d56efc8ace46227964b492bdc3cae6bdbcc2e03fdd1b836b5a6 +PKG_SOURCE_DATE:=2022-11-12 +PKG_SOURCE_VERSION:=4bf2607362fc64fc4cb7d662feb736b7536c0811 +PKG_MIRROR_HASH:=fd4291ac89e14750073cc8c345772883d756bf32cf19fc7205fa344b5b3b91d0 PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 From 53bc278ad6e5df3eca15d4fa2c7084b2e028fc9c Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 2 Dec 2022 17:43:54 +0800 Subject: [PATCH 028/137] kernel: update mtk_wed header for mt76 Signed-off-by: Tianling Shen --- .../{files => files-5.4}/include/linux/soc/mediatek/mtk_wed.h | 3 +++ 1 file changed, 3 insertions(+) rename target/linux/generic/{files => files-5.4}/include/linux/soc/mediatek/mtk_wed.h (89%) diff --git a/target/linux/generic/files/include/linux/soc/mediatek/mtk_wed.h b/target/linux/generic/files-5.4/include/linux/soc/mediatek/mtk_wed.h similarity index 89% rename from target/linux/generic/files/include/linux/soc/mediatek/mtk_wed.h rename to target/linux/generic/files-5.4/include/linux/soc/mediatek/mtk_wed.h index 0a7197f55a..04bc75138d 100644 --- a/target/linux/generic/files/include/linux/soc/mediatek/mtk_wed.h +++ b/target/linux/generic/files-5.4/include/linux/soc/mediatek/mtk_wed.h @@ -64,5 +64,8 @@ static inline bool mtk_wed_device_active(struct mtk_wed_device *dev) #define mtk_wed_device_reg_write(_dev, _reg, _val) do {} while (0) #define mtk_wed_device_irq_get(_dev, _mask) 0 #define mtk_wed_device_irq_set_mask(_dev, _mask) do {} while (0) +#define mtk_wed_device_rx_ring_setup(_dev, _ring, _regs) -ENODEV +#define mtk_wed_device_ppe_check(_dev, _skb, _reason, _hash) do {} while (0) +#define mtk_wed_device_update_msg(_dev, _id, _msg, _len) -ENODEV #endif From 06bec8462570adc81020c3b5dd22fab25eae5060 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 3 Dec 2022 21:34:02 +0100 Subject: [PATCH 029/137] mac80211: Update to version 5.10.157 Signed-off-by: Hauke Mehrtens --- package/kernel/mac80211/Makefile | 6 +++--- .../patches/ath/404-regd_no_assoc_hints.patch | 4 ++-- .../ath/930-ath10k_add_tpt_led_trigger.patch | 4 ++-- .../975-ath10k-use-tpt-trigger-by-default.patch | 2 +- ...st-tx-power-reduction-for-US-regulatory-d.patch | 8 ++++---- .../kernel/mac80211/patches/brcm/998-survey.patch | 4 ++-- ...2x00-define-RF5592-in-init_eeprom-routine.patch | 2 +- .../610-rt2x00-change-led-polarity-from-OF.patch | 2 +- ...x00-add-support-for-external-PA-on-MT7620.patch | 8 ++++---- .../982-rt2x00-add-rf-self-txdc-calibration.patch | 4 ++-- .../rt2x00/983-rt2x00-add-r-calibration.patch | 4 ++-- .../rt2x00/984-rt2x00-add-rxdcoc-calibration.patch | 4 ++-- .../rt2x00/985-rt2x00-add-rxiq-calibration.patch | 4 ++-- .../986-rt2x00-add-TX-LOFT-calibration.patch | 4 ++-- ...t7620-differentiate-based-on-SoC-CHIP_VER.patch | 14 +++++++------- ...x00-save-survey-for-every-channel-visited.patch | 2 +- .../patches/subsys/150-disable_addr_notifier.patch | 2 +- .../385-mac80211-add-ieee80211_set_sar_specs.patch | 4 ++-- ...mac80211-add-support-for-BSS-color-change.patch | 8 ++++---- ...-align-some-HE-capabilities-with-the-spec.patch | 6 +++--- ...fix-spelling-of-A-MSDU-in-HE-capabilities.patch | 8 ++++---- ...ign-HE-capabilities-A-MPDU-Length-Exponen.patch | 8 ++++---- .../patches/subsys/397-disable-mbssid.patch | 8 ++++---- .../500-mac80211_configure_antenna_gain.patch | 2 +- 24 files changed, 61 insertions(+), 61 deletions(-) diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index 014512c67b..e2505924cf 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -10,10 +10,10 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=5.10.149-1 +PKG_VERSION:=5.10.157-1 PKG_RELEASE:=1 -PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.10.149/ -PKG_HASH:=80a68a78c9b18513bad0bbd0cb70907eadbfd9bba44c075a94f0795fd7f7be2a +PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.10.157/ +PKG_HASH:=1ce937c49f2b39be00768fba83e214aad6612d469c92ccd06dc17b14e6cf3a64 PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION) diff --git a/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch b/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch index dfe324caf8..bacaf92b5e 100644 --- a/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch +++ b/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch @@ -1,6 +1,6 @@ --- a/net/wireless/reg.c +++ b/net/wireless/reg.c -@@ -3257,6 +3257,8 @@ void regulatory_hint_country_ie(struct w +@@ -3263,6 +3263,8 @@ void regulatory_hint_country_ie(struct w enum environment_cap env = ENVIRON_ANY; struct regulatory_request *request = NULL, *lr; @@ -9,7 +9,7 @@ /* IE len must be evenly divisible by 2 */ if (country_ie_len & 0x01) return; -@@ -3508,6 +3510,7 @@ static bool is_wiphy_all_set_reg_flag(en +@@ -3514,6 +3516,7 @@ static bool is_wiphy_all_set_reg_flag(en void regulatory_hint_disconnect(void) { diff --git a/package/kernel/mac80211/patches/ath/930-ath10k_add_tpt_led_trigger.patch b/package/kernel/mac80211/patches/ath/930-ath10k_add_tpt_led_trigger.patch index 8da72a4fe1..2fc83182b6 100644 --- a/package/kernel/mac80211/patches/ath/930-ath10k_add_tpt_led_trigger.patch +++ b/package/kernel/mac80211/patches/ath/930-ath10k_add_tpt_led_trigger.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -9748,6 +9748,21 @@ static int ath10k_mac_init_rd(struct ath +@@ -9752,6 +9752,21 @@ static int ath10k_mac_init_rd(struct ath return 0; } @@ -22,7 +22,7 @@ int ath10k_mac_register(struct ath10k *ar) { static const u32 cipher_suites[] = { -@@ -10097,6 +10112,12 @@ int ath10k_mac_register(struct ath10k *a +@@ -10101,6 +10116,12 @@ int ath10k_mac_register(struct ath10k *a ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; diff --git a/package/kernel/mac80211/patches/ath/975-ath10k-use-tpt-trigger-by-default.patch b/package/kernel/mac80211/patches/ath/975-ath10k-use-tpt-trigger-by-default.patch index 005feda798..ef98539f99 100644 --- a/package/kernel/mac80211/patches/ath/975-ath10k-use-tpt-trigger-by-default.patch +++ b/package/kernel/mac80211/patches/ath/975-ath10k-use-tpt-trigger-by-default.patch @@ -42,7 +42,7 @@ Signed-off-by: Mathias Kresin if (ret) --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -10114,7 +10114,7 @@ int ath10k_mac_register(struct ath10k *a +@@ -10118,7 +10118,7 @@ int ath10k_mac_register(struct ath10k *a ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; #ifdef CPTCFG_MAC80211_LEDS diff --git a/package/kernel/mac80211/patches/ath/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch b/package/kernel/mac80211/patches/ath/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch index 1f19765891..f5c1fb2a2b 100644 --- a/package/kernel/mac80211/patches/ath/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch +++ b/package/kernel/mac80211/patches/ath/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch @@ -28,7 +28,7 @@ Forwarded: no --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -1010,6 +1010,40 @@ static inline int ath10k_vdev_setup_sync +@@ -1017,6 +1017,40 @@ static inline int ath10k_vdev_setup_sync return ar->last_wmi_vdev_start_status; } @@ -69,7 +69,7 @@ Forwarded: no static int ath10k_monitor_vdev_start(struct ath10k *ar, int vdev_id) { struct cfg80211_chan_def *chandef = NULL; -@@ -1042,7 +1076,8 @@ static int ath10k_monitor_vdev_start(str +@@ -1049,7 +1083,8 @@ static int ath10k_monitor_vdev_start(str arg.channel.min_power = 0; arg.channel.max_power = channel->max_power * 2; arg.channel.max_reg_power = channel->max_reg_power * 2; @@ -79,7 +79,7 @@ Forwarded: no reinit_completion(&ar->vdev_setup_done); reinit_completion(&ar->vdev_delete_done); -@@ -1488,7 +1523,8 @@ static int ath10k_vdev_start_restart(str +@@ -1495,7 +1530,8 @@ static int ath10k_vdev_start_restart(str arg.channel.min_power = 0; arg.channel.max_power = chandef->chan->max_power * 2; arg.channel.max_reg_power = chandef->chan->max_reg_power * 2; @@ -89,7 +89,7 @@ Forwarded: no if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { arg.ssid = arvif->u.ap.ssid; -@@ -3259,7 +3295,8 @@ static int ath10k_update_channel_list(st +@@ -3266,7 +3302,8 @@ static int ath10k_update_channel_list(st ch->min_power = 0; ch->max_power = channel->max_power * 2; ch->max_reg_power = channel->max_reg_power * 2; diff --git a/package/kernel/mac80211/patches/brcm/998-survey.patch b/package/kernel/mac80211/patches/brcm/998-survey.patch index 25a12c783e..beaf1ac872 100644 --- a/package/kernel/mac80211/patches/brcm/998-survey.patch +++ b/package/kernel/mac80211/patches/brcm/998-survey.patch @@ -100,7 +100,7 @@ .add_key = brcmf_cfg80211_add_key, --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -1356,6 +1356,8 @@ int brcmf_attach(struct device *dev) +@@ -1357,6 +1357,8 @@ int brcmf_attach(struct device *dev) /* Link to bus module */ drvr->hdrlen = 0; @@ -109,7 +109,7 @@ /* Attach and link in the protocol */ ret = brcmf_proto_attach(drvr); -@@ -1438,6 +1440,12 @@ void brcmf_detach(struct device *dev) +@@ -1439,6 +1441,12 @@ void brcmf_detach(struct device *dev) if (drvr == NULL) return; diff --git a/package/kernel/mac80211/patches/rt2x00/002-rt2x00-define-RF5592-in-init_eeprom-routine.patch b/package/kernel/mac80211/patches/rt2x00/002-rt2x00-define-RF5592-in-init_eeprom-routine.patch index a50a195285..13298d3ce8 100644 --- a/package/kernel/mac80211/patches/rt2x00/002-rt2x00-define-RF5592-in-init_eeprom-routine.patch +++ b/package/kernel/mac80211/patches/rt2x00/002-rt2x00-define-RF5592-in-init_eeprom-routine.patch @@ -40,7 +40,7 @@ Signed-off-by: Tomislav Požega --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -9416,6 +9416,8 @@ static int rt2800_init_eeprom(struct rt2 +@@ -9442,6 +9442,8 @@ static int rt2800_init_eeprom(struct rt2 rf = RF3853; else if (rt2x00_rt(rt2x00dev, RT5350)) rf = RF5350; diff --git a/package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch b/package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch index 039c6f6afc..87f1ab4681 100644 --- a/package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch +++ b/package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch @@ -8,7 +8,7 @@ #include "rt2x00.h" #include "rt2800lib.h" -@@ -9530,6 +9531,17 @@ static int rt2800_init_eeprom(struct rt2 +@@ -9556,6 +9557,17 @@ static int rt2800_init_eeprom(struct rt2 rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC); rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY); diff --git a/package/kernel/mac80211/patches/rt2x00/650-rt2x00-add-support-for-external-PA-on-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/650-rt2x00-add-support-for-external-PA-on-MT7620.patch index 20452cd8a7..3de562df8c 100644 --- a/package/kernel/mac80211/patches/rt2x00/650-rt2x00-add-support-for-external-PA-on-MT7620.patch +++ b/package/kernel/mac80211/patches/rt2x00/650-rt2x00-add-support-for-external-PA-on-MT7620.patch @@ -30,8 +30,8 @@ Signed-off-by: Tomislav Po=C5=BEega * EEPROM LNA --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -4356,6 +4356,45 @@ static void rt2800_config_channel(struct - rt2800_iq_calibrate(rt2x00dev, rf->channel); +@@ -4360,6 +4360,45 @@ static void rt2800_config_channel(struct + rt2800_iq_calibrate(rt2x00dev, rf->channel); } + if (rt2x00_rt(rt2x00dev, RT6352)) { @@ -76,7 +76,7 @@ Signed-off-by: Tomislav Po=C5=BEega bbp = rt2800_bbp_read(rt2x00dev, 4); rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * conf_is_ht40(conf)); rt2800_bbp_write(rt2x00dev, 4, bbp); -@@ -9559,7 +9598,8 @@ static int rt2800_init_eeprom(struct rt2 +@@ -9585,7 +9624,8 @@ static int rt2800_init_eeprom(struct rt2 */ eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1); @@ -86,7 +86,7 @@ Signed-off-by: Tomislav Po=C5=BEega if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_EXTERNAL_TX0_PA_3352)) __set_bit(CAPABILITY_EXTERNAL_PA_TX0, -@@ -9570,6 +9610,18 @@ static int rt2800_init_eeprom(struct rt2 +@@ -9596,6 +9636,18 @@ static int rt2800_init_eeprom(struct rt2 &rt2x00dev->cap_flags); } diff --git a/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch b/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch index 6be847478e..8064c4fe3a 100644 --- a/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8419,6 +8419,56 @@ static void rt2800_init_rfcsr_5592(struc +@@ -8445,6 +8445,56 @@ static void rt2800_init_rfcsr_5592(struc rt2800_led_open_drain_enable(rt2x00dev); } @@ -57,7 +57,7 @@ static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9026,6 +9076,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9052,6 +9102,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); diff --git a/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch b/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch index 3ed0ff7ef5..539a1b53b3 100644 --- a/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8469,6 +8469,155 @@ static void rt2800_rf_self_txdc_cal(stru +@@ -8495,6 +8495,155 @@ static void rt2800_rf_self_txdc_cal(stru rt2x00_info(rt2x00dev, "RF Tx self calibration end\n"); } @@ -156,7 +156,7 @@ static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9076,6 +9225,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9102,6 +9251,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); diff --git a/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch b/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch index 77be986d18..a45e7aec32 100644 --- a/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8618,6 +8618,70 @@ static void rt2800_r_calibration(struct +@@ -8644,6 +8644,70 @@ static void rt2800_r_calibration(struct rt2800_register_write(rt2x00dev, PWR_PIN_CFG, MAC_PWR_PIN_CFG); } @@ -71,7 +71,7 @@ static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9227,6 +9291,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9253,6 +9317,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_r_calibration(rt2x00dev); rt2800_rf_self_txdc_cal(rt2x00dev); diff --git a/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch b/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch index 7352ad036c..bc03d720be 100644 --- a/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8682,6 +8682,384 @@ static void rt2800_rxdcoc_calibration(st +@@ -8708,6 +8708,384 @@ static void rt2800_rxdcoc_calibration(st rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, saverfb0r2); } @@ -385,7 +385,7 @@ static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9294,6 +9672,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9320,6 +9698,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rxdcoc_calibration(rt2x00dev); rt2800_bw_filter_calibration(rt2x00dev, true); rt2800_bw_filter_calibration(rt2x00dev, false); diff --git a/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch b/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch index fe0961baa7..bd664d044e 100644 --- a/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -9060,6 +9060,943 @@ restore_value: +@@ -9086,6 +9086,943 @@ restore_value: rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, savemacsysctrl); } @@ -944,7 +944,7 @@ static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9672,6 +10609,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9698,6 +10635,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rxdcoc_calibration(rt2x00dev); rt2800_bw_filter_calibration(rt2x00dev, true); rt2800_bw_filter_calibration(rt2x00dev, false); diff --git a/package/kernel/mac80211/patches/rt2x00/991-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch b/package/kernel/mac80211/patches/rt2x00/991-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch index 3de00b2267..a724232c44 100644 --- a/package/kernel/mac80211/patches/rt2x00/991-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch +++ b/package/kernel/mac80211/patches/rt2x00/991-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch @@ -121,12 +121,12 @@ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, mac_sys_ctrl); rt2800_vco_calibration(rt2x00dev); -@@ -5887,18 +5898,33 @@ static int rt2800_init_registers(struct +@@ -5892,18 +5903,33 @@ static int rt2800_init_registers(struct } else if (rt2x00_rt(rt2x00dev, RT5350)) { rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404); } else if (rt2x00_rt(rt2x00dev, RT6352)) { - rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000401); -- rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x000C0000); +- rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x000C0001); - rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); - rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x00000000); - rt2800_register_write(rt2x00dev, TX0_BB_GAIN_ATTEN, 0x0); @@ -150,7 +150,7 @@ + 0x00550055); + } else { + rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000401); -+ rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x000C0000); ++ rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x000C0001); + rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); + rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x00000000); + rt2800_register_write(rt2x00dev, TX0_BB_GAIN_ATTEN, 0x0); @@ -167,7 +167,7 @@ reg = rt2800_register_read(rt2x00dev, TX_ALC_CFG_1); rt2x00_set_field32(®, TX_ALC_CFG_1_ROS_BUSY_EN, 0); rt2800_register_write(rt2x00dev, TX_ALC_CFG_1, reg); -@@ -7042,14 +7068,16 @@ static void rt2800_init_bbp_6352(struct +@@ -7068,14 +7094,16 @@ static void rt2800_init_bbp_6352(struct rt2800_bbp_write(rt2x00dev, 188, 0x00); rt2800_bbp_write(rt2x00dev, 189, 0x00); @@ -192,7 +192,7 @@ /* BBP for G band GLRT function (BBP_128 ~ BBP_221) */ rt2800_bbp_glrt_write(rt2x00dev, 0, 0x00); -@@ -10388,31 +10416,36 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10414,31 +10442,36 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write(rt2x00dev, 42, 0x5B); rt2800_rfcsr_write(rt2x00dev, 43, 0x00); @@ -254,7 +254,7 @@ /* Initialize RF channel register to default value */ rt2800_rfcsr_write_chanreg(rt2x00dev, 0, 0x03); -@@ -10478,63 +10511,71 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10504,63 +10537,71 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_bank(rt2x00dev, 6, 45, 0xC5); @@ -383,7 +383,7 @@ /* Initialize RF DC calibration register to default value */ rt2800_rfcsr_write_dccal(rt2x00dev, 0, 0x47); -@@ -10597,12 +10638,17 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10623,12 +10664,17 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 62, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 63, 0x00); diff --git a/package/kernel/mac80211/patches/rt2x00/992-rt2x00-save-survey-for-every-channel-visited.patch b/package/kernel/mac80211/patches/rt2x00/992-rt2x00-save-survey-for-every-channel-visited.patch index 31a7baeee7..b73af6e8c6 100644 --- a/package/kernel/mac80211/patches/rt2x00/992-rt2x00-save-survey-for-every-channel-visited.patch +++ b/package/kernel/mac80211/patches/rt2x00/992-rt2x00-save-survey-for-every-channel-visited.patch @@ -28,7 +28,7 @@ static unsigned int rt2800_hw_beacon_base(struct rt2x00_dev *rt2x00dev, unsigned int index) { -@@ -12199,26 +12213,30 @@ int rt2800_get_survey(struct ieee80211_h +@@ -12225,26 +12239,30 @@ int rt2800_get_survey(struct ieee80211_h { struct rt2x00_dev *rt2x00dev = hw->priv; struct ieee80211_conf *conf = &hw->conf; diff --git a/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch index 8d086625e4..27c5048de9 100644 --- a/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch +++ b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch @@ -52,7 +52,7 @@ fail_ifa: #endif wiphy_unregister(local->hw.wiphy); -@@ -1365,10 +1365,10 @@ void ieee80211_unregister_hw(struct ieee +@@ -1367,10 +1367,10 @@ void ieee80211_unregister_hw(struct ieee tasklet_kill(&local->tx_pending_tasklet); tasklet_kill(&local->tasklet); diff --git a/package/kernel/mac80211/patches/subsys/385-mac80211-add-ieee80211_set_sar_specs.patch b/package/kernel/mac80211/patches/subsys/385-mac80211-add-ieee80211_set_sar_specs.patch index c351bc812a..2d93f1e248 100644 --- a/package/kernel/mac80211/patches/subsys/385-mac80211-add-ieee80211_set_sar_specs.patch +++ b/package/kernel/mac80211/patches/subsys/385-mac80211-add-ieee80211_set_sar_specs.patch @@ -25,7 +25,7 @@ Signed-off-by: Johannes Berg struct ieee80211_sta *sta, bool enabled); --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -4136,6 +4136,17 @@ static int ieee80211_reset_tid_config(st +@@ -4133,6 +4133,17 @@ static int ieee80211_reset_tid_config(st return ret; } @@ -43,7 +43,7 @@ Signed-off-by: Johannes Berg const struct cfg80211_ops mac80211_config_ops = { .add_virtual_intf = ieee80211_add_iface, .del_virtual_intf = ieee80211_del_iface, -@@ -4239,4 +4250,5 @@ const struct cfg80211_ops mac80211_confi +@@ -4236,4 +4247,5 @@ const struct cfg80211_ops mac80211_confi .probe_mesh_link = ieee80211_probe_mesh_link, .set_tid_config = ieee80211_set_tid_config, .reset_tid_config = ieee80211_reset_tid_config, diff --git a/package/kernel/mac80211/patches/subsys/388-mac80211-add-support-for-BSS-color-change.patch b/package/kernel/mac80211/patches/subsys/388-mac80211-add-support-for-BSS-color-change.patch index 60e1c8f3c6..efb974ddd6 100644 --- a/package/kernel/mac80211/patches/subsys/388-mac80211-add-support-for-BSS-color-change.patch +++ b/package/kernel/mac80211/patches/subsys/388-mac80211-add-support-for-BSS-color-change.patch @@ -179,7 +179,7 @@ Signed-off-by: Johannes Berg if (err < 0) { kfree(sdata->u.ap.next_beacon); return err; -@@ -3428,6 +3436,15 @@ static int ieee80211_set_csa_beacon(stru +@@ -3425,6 +3433,15 @@ static int ieee80211_set_csa_beacon(stru return 0; } @@ -195,7 +195,7 @@ Signed-off-by: Johannes Berg static int __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_csa_settings *params) -@@ -3496,6 +3513,10 @@ __ieee80211_channel_switch(struct wiphy +@@ -3493,6 +3510,10 @@ __ieee80211_channel_switch(struct wiphy goto out; } @@ -206,7 +206,7 @@ Signed-off-by: Johannes Berg err = ieee80211_set_csa_beacon(sdata, params, &changed); if (err) { ieee80211_vif_unreserve_chanctx(sdata); -@@ -4147,6 +4168,196 @@ static int ieee80211_set_sar_specs(struc +@@ -4144,6 +4165,196 @@ static int ieee80211_set_sar_specs(struc return local->ops->set_sar_specs(&local->hw, sar); } @@ -403,7 +403,7 @@ Signed-off-by: Johannes Berg const struct cfg80211_ops mac80211_config_ops = { .add_virtual_intf = ieee80211_add_iface, .del_virtual_intf = ieee80211_del_iface, -@@ -4251,4 +4462,5 @@ const struct cfg80211_ops mac80211_confi +@@ -4248,4 +4459,5 @@ const struct cfg80211_ops mac80211_confi .set_tid_config = ieee80211_set_tid_config, .reset_tid_config = ieee80211_reset_tid_config, .set_sar_specs = ieee80211_set_sar_specs, diff --git a/package/kernel/mac80211/patches/subsys/391-wireless-align-some-HE-capabilities-with-the-spec.patch b/package/kernel/mac80211/patches/subsys/391-wireless-align-some-HE-capabilities-with-the-spec.patch index 031669b961..1d9416c239 100644 --- a/package/kernel/mac80211/patches/subsys/391-wireless-align-some-HE-capabilities-with-the-spec.patch +++ b/package/kernel/mac80211/patches/subsys/391-wireless-align-some-HE-capabilities-with-the-spec.patch @@ -12,7 +12,7 @@ Signed-off-by: Johannes Berg --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -3633,7 +3633,7 @@ ath11k_mac_filter_he_cap_mesh(struct iee +@@ -3648,7 +3648,7 @@ ath11k_mac_filter_he_cap_mesh(struct iee IEEE80211_HE_MAC_CAP4_BQR; he_cap_elem->mac_cap_info[4] &= ~m; @@ -21,7 +21,7 @@ Signed-off-by: Johannes Berg IEEE80211_HE_MAC_CAP5_UL_2x996_TONE_RU | IEEE80211_HE_MAC_CAP5_PUNCTURED_SOUNDING | IEEE80211_HE_MAC_CAP5_HT_VHT_TRIG_FRAME_RX; -@@ -3643,7 +3643,7 @@ ath11k_mac_filter_he_cap_mesh(struct iee +@@ -3658,7 +3658,7 @@ ath11k_mac_filter_he_cap_mesh(struct iee IEEE80211_HE_PHY_CAP2_UL_MU_PARTIAL_MU_MIMO; he_cap_elem->phy_cap_info[2] &= ~m; @@ -30,7 +30,7 @@ Signed-off-by: Johannes Berg IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_MASK | IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_MASK; he_cap_elem->phy_cap_info[3] &= ~m; -@@ -3655,13 +3655,13 @@ ath11k_mac_filter_he_cap_mesh(struct iee +@@ -3670,13 +3670,13 @@ ath11k_mac_filter_he_cap_mesh(struct iee he_cap_elem->phy_cap_info[5] &= ~m; m = IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU | diff --git a/package/kernel/mac80211/patches/subsys/392-wireless-fix-spelling-of-A-MSDU-in-HE-capabilities.patch b/package/kernel/mac80211/patches/subsys/392-wireless-fix-spelling-of-A-MSDU-in-HE-capabilities.patch index e90177e379..e2811302c6 100644 --- a/package/kernel/mac80211/patches/subsys/392-wireless-fix-spelling-of-A-MSDU-in-HE-capabilities.patch +++ b/package/kernel/mac80211/patches/subsys/392-wireless-fix-spelling-of-A-MSDU-in-HE-capabilities.patch @@ -75,7 +75,7 @@ Signed-off-by: Johannes Berg --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c -@@ -2759,7 +2759,7 @@ static const struct ieee80211_sband_ifty +@@ -2764,7 +2764,7 @@ static const struct ieee80211_sband_ifty .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, @@ -84,7 +84,7 @@ Signed-off-by: Johannes Berg .phy_cap_info[1] = IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK | IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A | -@@ -2803,7 +2803,7 @@ static const struct ieee80211_sband_ifty +@@ -2808,7 +2808,7 @@ static const struct ieee80211_sband_ifty .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, @@ -93,7 +93,7 @@ Signed-off-by: Johannes Berg .phy_cap_info[1] = IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK | IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A | -@@ -2849,7 +2849,7 @@ static const struct ieee80211_sband_ifty +@@ -2854,7 +2854,7 @@ static const struct ieee80211_sband_ifty .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, @@ -102,7 +102,7 @@ Signed-off-by: Johannes Berg .phy_cap_info[0] = IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G | IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G | -@@ -2897,7 +2897,7 @@ static const struct ieee80211_sband_ifty +@@ -2902,7 +2902,7 @@ static const struct ieee80211_sband_ifty .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, diff --git a/package/kernel/mac80211/patches/subsys/393-wireless-align-HE-capabilities-A-MPDU-Length-Exponen.patch b/package/kernel/mac80211/patches/subsys/393-wireless-align-HE-capabilities-A-MPDU-Length-Exponen.patch index ecd544324c..9327fa1173 100644 --- a/package/kernel/mac80211/patches/subsys/393-wireless-align-HE-capabilities-A-MPDU-Length-Exponen.patch +++ b/package/kernel/mac80211/patches/subsys/393-wireless-align-HE-capabilities-A-MPDU-Length-Exponen.patch @@ -47,7 +47,7 @@ Signed-off-by: Johannes Berg .mac_cap_info[5] = --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c -@@ -2758,7 +2758,7 @@ static const struct ieee80211_sband_ifty +@@ -2763,7 +2763,7 @@ static const struct ieee80211_sband_ifty IEEE80211_HE_MAC_CAP2_ACK_EN, .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | @@ -56,7 +56,7 @@ Signed-off-by: Johannes Berg .mac_cap_info[4] = IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU, .phy_cap_info[1] = IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK | -@@ -2802,7 +2802,7 @@ static const struct ieee80211_sband_ifty +@@ -2807,7 +2807,7 @@ static const struct ieee80211_sband_ifty IEEE80211_HE_MAC_CAP2_ACK_EN, .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | @@ -65,7 +65,7 @@ Signed-off-by: Johannes Berg .mac_cap_info[4] = IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU, .phy_cap_info[1] = IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK | -@@ -2848,7 +2848,7 @@ static const struct ieee80211_sband_ifty +@@ -2853,7 +2853,7 @@ static const struct ieee80211_sband_ifty IEEE80211_HE_MAC_CAP2_ACK_EN, .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | @@ -74,7 +74,7 @@ Signed-off-by: Johannes Berg .mac_cap_info[4] = IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU, .phy_cap_info[0] = IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G | -@@ -2896,7 +2896,7 @@ static const struct ieee80211_sband_ifty +@@ -2901,7 +2901,7 @@ static const struct ieee80211_sband_ifty IEEE80211_HE_MAC_CAP2_ACK_EN, .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | diff --git a/package/kernel/mac80211/patches/subsys/397-disable-mbssid.patch b/package/kernel/mac80211/patches/subsys/397-disable-mbssid.patch index c4a8d30d7c..1582be891b 100644 --- a/package/kernel/mac80211/patches/subsys/397-disable-mbssid.patch +++ b/package/kernel/mac80211/patches/subsys/397-disable-mbssid.patch @@ -10,7 +10,7 @@ continue; --- a/net/wireless/scan.c +++ b/net/wireless/scan.c -@@ -2010,6 +2010,7 @@ static const struct element +@@ -2012,6 +2012,7 @@ static const struct element const struct element *next_mbssid; const struct element *next_sub; @@ -18,7 +18,7 @@ next_mbssid = cfg80211_find_elem(WLAN_EID_MULTIPLE_BSSID, mbssid_end, ielen - (mbssid_end - ie)); -@@ -2091,6 +2092,7 @@ static void cfg80211_parse_mbssid_data(s +@@ -2093,6 +2094,7 @@ static void cfg80211_parse_mbssid_data(s u16 capability; struct cfg80211_bss *bss; @@ -26,7 +26,7 @@ if (!non_tx_data) return; if (!cfg80211_find_ie(WLAN_EID_MULTIPLE_BSSID, ie, ielen)) -@@ -2251,6 +2253,7 @@ cfg80211_update_notlisted_nontrans(struc +@@ -2253,6 +2255,7 @@ cfg80211_update_notlisted_nontrans(struc const struct cfg80211_bss_ies *old; size_t cpy_len; @@ -34,7 +34,7 @@ lockdep_assert_held(&wiphy_to_rdev(wiphy)->bss_lock); ie = mgmt->u.probe_resp.variable; -@@ -2468,6 +2471,7 @@ cfg80211_inform_bss_frame_data(struct wi +@@ -2470,6 +2473,7 @@ cfg80211_inform_bss_frame_data(struct wi res = cfg80211_inform_single_bss_frame_data(wiphy, data, mgmt, len, gfp); diff --git a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch index 4a0bb1a933..fe23a289d3 100644 --- a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch +++ b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch @@ -77,7 +77,7 @@ static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev, const u8 *addr) { -@@ -4413,6 +4426,7 @@ const struct cfg80211_ops mac80211_confi +@@ -4410,6 +4423,7 @@ const struct cfg80211_ops mac80211_confi .set_wiphy_params = ieee80211_set_wiphy_params, .set_tx_power = ieee80211_set_tx_power, .get_tx_power = ieee80211_get_tx_power, From 8035ac01950758d96b92085b9f213b12e4039691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Sun, 29 Aug 2021 22:53:55 +0200 Subject: [PATCH 030/137] bcm53xx: backport the latest upstream DT changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This includes: 1. BCM5301X changes from 5.14 and queued 5.15 stuff 2. NSP changes from 5.11 - 5.15 for kernel 5.10 Signed-off-by: Rafał Miłecki (cherry picked from commit bce00f47e5d67e5a33e9d7fa137cbe0a5d3d334b) --- ...NSP-Update-ethernet-switch-node-name.patch | 32 ++ ...-Ethernet-switch-SGMII-register-name.patch | 26 ++ ...a-SRAB-compatible-string-for-each-bo.patch | 77 ++++ ...rovide-defaults-ports-container-node.patch | 99 +++++ ...s-NSP-add-device-names-to-compatible.patch | 97 +++++ ...RM-dts-NSP-enable-DMA-on-bcm988312hr.patch | 29 ++ ...dts-NSP-disable-qspi-node-by-default.patch | 113 +++++ ...dts-NSP-add-MDIO-bus-controller-node.patch | 30 ++ ...P-Move-USB3-PHY-to-internal-MDIO-bus.patch | 85 ++++ ...SP-Add-common-bindings-for-MX64-MX65.patch | 148 +++++++ ...ts-NSP-Add-Ax-stepping-modifications.patch | 90 ++++ ...-Add-DT-files-for-Meraki-MX64-series.patch | 340 +++++++++++++++ ...-Add-DT-files-for-Meraki-MX65-series.patch | 386 ++++++++++++++++++ ...10-ARM-dts-BCM5301X-Fix-nodes-names.patch} | 0 ...M-dts-BCM5301X-Fix-MDIO-mux-binding.patch} | 0 ...dts-BCM5301X-Fix-memory-nodes-names.patch} | 0 16 files changed, 1552 insertions(+) create mode 100644 target/linux/bcm53xx/patches-5.4/034-v5.11-0013-ARM-dts-NSP-Update-ethernet-switch-node-name.patch create mode 100644 target/linux/bcm53xx/patches-5.4/034-v5.11-0014-ARM-dts-NSP-Fix-Ethernet-switch-SGMII-register-name.patch create mode 100644 target/linux/bcm53xx/patches-5.4/034-v5.11-0015-ARM-dts-NSP-Add-a-SRAB-compatible-string-for-each-bo.patch create mode 100644 target/linux/bcm53xx/patches-5.4/034-v5.11-0016-ARM-dts-NSP-Provide-defaults-ports-container-node.patch create mode 100644 target/linux/bcm53xx/patches-5.4/037-v5.15-0001-ARM-dts-NSP-add-device-names-to-compatible.patch create mode 100644 target/linux/bcm53xx/patches-5.4/037-v5.15-0002-ARM-dts-NSP-enable-DMA-on-bcm988312hr.patch create mode 100644 target/linux/bcm53xx/patches-5.4/037-v5.15-0003-ARM-dts-NSP-disable-qspi-node-by-default.patch create mode 100644 target/linux/bcm53xx/patches-5.4/037-v5.15-0004-ARM-dts-NSP-add-MDIO-bus-controller-node.patch create mode 100644 target/linux/bcm53xx/patches-5.4/037-v5.15-0005-ARM-dts-NSP-Move-USB3-PHY-to-internal-MDIO-bus.patch create mode 100644 target/linux/bcm53xx/patches-5.4/037-v5.15-0006-ARM-dts-NSP-Add-common-bindings-for-MX64-MX65.patch create mode 100644 target/linux/bcm53xx/patches-5.4/037-v5.15-0007-ARM-dts-NSP-Add-Ax-stepping-modifications.patch create mode 100644 target/linux/bcm53xx/patches-5.4/037-v5.15-0008-ARM-dts-NSP-Add-DT-files-for-Meraki-MX64-series.patch create mode 100644 target/linux/bcm53xx/patches-5.4/037-v5.15-0009-ARM-dts-NSP-Add-DT-files-for-Meraki-MX65-series.patch rename target/linux/bcm53xx/patches-5.4/{037-v5.15-0001-ARM-dts-BCM5301X-Fix-nodes-names.patch => 037-v5.15-0010-ARM-dts-BCM5301X-Fix-nodes-names.patch} (100%) rename target/linux/bcm53xx/patches-5.4/{037-v5.15-0002-ARM-dts-BCM5301X-Fix-MDIO-mux-binding.patch => 037-v5.15-0011-ARM-dts-BCM5301X-Fix-MDIO-mux-binding.patch} (100%) rename target/linux/bcm53xx/patches-5.4/{037-v5.15-0003-ARM-dts-BCM5301X-Fix-memory-nodes-names.patch => 037-v5.15-0012-ARM-dts-BCM5301X-Fix-memory-nodes-names.patch} (100%) diff --git a/target/linux/bcm53xx/patches-5.4/034-v5.11-0013-ARM-dts-NSP-Update-ethernet-switch-node-name.patch b/target/linux/bcm53xx/patches-5.4/034-v5.11-0013-ARM-dts-NSP-Update-ethernet-switch-node-name.patch new file mode 100644 index 0000000000..3828bb57c4 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/034-v5.11-0013-ARM-dts-NSP-Update-ethernet-switch-node-name.patch @@ -0,0 +1,32 @@ +From fd66cd0d79cb836badecb91fdd19afd32afbb443 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 9 Nov 2020 12:02:08 -0800 +Subject: [PATCH 13/16] ARM: dts: NSP: Update ethernet switch node name + +Update the switch unit name from srab to ethernet-switch, allowing us +to fix warnings such as: + + CHECK arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dt.yaml + arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dt.yaml: + srab@18007000: $nodename:0: 'srab@18007000' does not match + '^(ethernet-)?switch(@.*)?$' + From schema: + Documentation/devicetree/bindings/net/dsa/b53.yaml + +Reviewed-by: Vladimir Oltean +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm-nsp.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/bcm-nsp.dtsi ++++ b/arch/arm/boot/dts/bcm-nsp.dtsi +@@ -383,7 +383,7 @@ + clock-names = "apb_pclk"; + }; + +- srab: srab@36000 { ++ srab: ethernet-switch@36000 { + compatible = "brcm,nsp-srab"; + reg = <0x36000 0x1000>, + <0x3f308 0x8>, diff --git a/target/linux/bcm53xx/patches-5.4/034-v5.11-0014-ARM-dts-NSP-Fix-Ethernet-switch-SGMII-register-name.patch b/target/linux/bcm53xx/patches-5.4/034-v5.11-0014-ARM-dts-NSP-Fix-Ethernet-switch-SGMII-register-name.patch new file mode 100644 index 0000000000..e8313d89b2 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/034-v5.11-0014-ARM-dts-NSP-Fix-Ethernet-switch-SGMII-register-name.patch @@ -0,0 +1,26 @@ +From 8b0235d1deace8f1bd8cdd149d698fee3974fdf4 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 9 Nov 2020 12:06:15 -0800 +Subject: [PATCH 14/16] ARM: dts: NSP: Fix Ethernet switch SGMII register name + +The register name should be "sgmii_config", not "sgmii", this is not a +functional change since no code is currently looking for that register +by name (or at all). + +Reviewed-by: Vladimir Oltean +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm-nsp.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/bcm-nsp.dtsi ++++ b/arch/arm/boot/dts/bcm-nsp.dtsi +@@ -388,7 +388,7 @@ + reg = <0x36000 0x1000>, + <0x3f308 0x8>, + <0x3f410 0xc>; +- reg-names = "srab", "mux_config", "sgmii"; ++ reg-names = "srab", "mux_config", "sgmii_config"; + interrupts = , + , + , diff --git a/target/linux/bcm53xx/patches-5.4/034-v5.11-0015-ARM-dts-NSP-Add-a-SRAB-compatible-string-for-each-bo.patch b/target/linux/bcm53xx/patches-5.4/034-v5.11-0015-ARM-dts-NSP-Add-a-SRAB-compatible-string-for-each-bo.patch new file mode 100644 index 0000000000..a0be53ac28 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/034-v5.11-0015-ARM-dts-NSP-Add-a-SRAB-compatible-string-for-each-bo.patch @@ -0,0 +1,77 @@ +From 42791b317db4cda36751f57bada27857849811d3 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 9 Nov 2020 17:41:32 -0800 +Subject: [PATCH 15/16] ARM: dts: NSP: Add a SRAB compatible string for each + board + +Provide a valid compatible string for the Ethernet switch node based on +the board including the switch. This allows us to have sane defaults and +silences the following warnings: + + arch/arm/boot/dts/bcm958522er.dt.yaml: + ethernet-switch@36000: compatible: 'oneOf' conditional failed, +one + must be fixed: + ['brcm,bcm5301x-srab'] is too short + 'brcm,bcm5325' was expected + 'brcm,bcm53115' was expected + 'brcm,bcm53125' was expected + 'brcm,bcm53128' was expected + 'brcm,bcm5365' was expected + 'brcm,bcm5395' was expected + 'brcm,bcm5389' was expected + 'brcm,bcm5397' was expected + 'brcm,bcm5398' was expected + 'brcm,bcm11360-srab' was expected + 'brcm,bcm5301x-srab' is not one of ['brcm,bcm53010-srab', + 'brcm,bcm53011-srab', 'brcm,bcm53012-srab', 'brcm,bcm53018-srab', + 'brcm,bcm53019-srab'] + 'brcm,bcm5301x-srab' is not one of ['brcm,bcm11404-srab', + 'brcm,bcm11407-srab', 'brcm,bcm11409-srab', 'brcm,bcm58310-srab', + 'brcm,bcm58311-srab', 'brcm,bcm58313-srab'] + 'brcm,bcm5301x-srab' is not one of ['brcm,bcm58522-srab', + 'brcm,bcm58523-srab', 'brcm,bcm58525-srab', 'brcm,bcm58622-srab', + 'brcm,bcm58623-srab', 'brcm,bcm58625-srab', 'brcm,bcm88312-srab'] + 'brcm,bcm5301x-srab' is not one of ['brcm,bcm3384-switch', + 'brcm,bcm6328-switch', 'brcm,bcm6368-switch'] + From schema: + Documentation/devicetree/bindings/net/dsa/b53.yaml + +Reviewed-by: Vladimir Oltean +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm958522er.dts | 4 ++++ + arch/arm/boot/dts/bcm958525er.dts | 4 ++++ + arch/arm/boot/dts/bcm958525xmc.dts | 4 ++++ + 3 files changed, 12 insertions(+) + +--- a/arch/arm/boot/dts/bcm958522er.dts ++++ b/arch/arm/boot/dts/bcm958522er.dts +@@ -174,3 +174,7 @@ + &xhci { + status = "okay"; + }; ++ ++&srab { ++ compatible = "brcm,bcm58522-srab", "brcm,nsp-srab"; ++}; +--- a/arch/arm/boot/dts/bcm958525er.dts ++++ b/arch/arm/boot/dts/bcm958525er.dts +@@ -186,3 +186,7 @@ + &xhci { + status = "okay"; + }; ++ ++&srab { ++ compatible = "brcm,bcm58525-srab", "brcm,nsp-srab"; ++}; +--- a/arch/arm/boot/dts/bcm958525xmc.dts ++++ b/arch/arm/boot/dts/bcm958525xmc.dts +@@ -206,3 +206,7 @@ + &xhci { + status = "okay"; + }; ++ ++&srab { ++ compatible = "brcm,bcm58525-srab", "brcm,nsp-srab"; ++}; diff --git a/target/linux/bcm53xx/patches-5.4/034-v5.11-0016-ARM-dts-NSP-Provide-defaults-ports-container-node.patch b/target/linux/bcm53xx/patches-5.4/034-v5.11-0016-ARM-dts-NSP-Provide-defaults-ports-container-node.patch new file mode 100644 index 0000000000..714e09ed06 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/034-v5.11-0016-ARM-dts-NSP-Provide-defaults-ports-container-node.patch @@ -0,0 +1,99 @@ +From 51e40c25aa18d926a8eb1c07289d01611b21123a Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 9 Nov 2020 17:44:33 -0800 +Subject: [PATCH 16/16] ARM: dts: NSP: Provide defaults ports container node + +Provide an empty 'ports' container node with the correct #address-cells +and #size-cells properties. This silences the following warning: + +arch/arm/boot/dts/bcm958522er.dt.yaml: +ethernet-switch@36000: 'oneOf' conditional failed, one must be fixed: + 'ports' is a required property + 'ethernet-ports' is a required property + From schema: +Documentation/devicetree/bindings/net/dsa/b53.yaml + +Reviewed-by: Vladimir Oltean +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm-nsp.dtsi | 4 ++++ + arch/arm/boot/dts/bcm958622hr.dts | 3 --- + arch/arm/boot/dts/bcm958623hr.dts | 3 --- + arch/arm/boot/dts/bcm958625hr.dts | 3 --- + arch/arm/boot/dts/bcm958625k.dts | 3 --- + arch/arm/boot/dts/bcm988312hr.dts | 3 --- + 6 files changed, 4 insertions(+), 15 deletions(-) + +--- a/arch/arm/boot/dts/bcm-nsp.dtsi ++++ b/arch/arm/boot/dts/bcm-nsp.dtsi +@@ -418,6 +418,10 @@ + status = "disabled"; + + /* ports are defined in board DTS */ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ }; + }; + + i2c0: i2c@38000 { +--- a/arch/arm/boot/dts/bcm958622hr.dts ++++ b/arch/arm/boot/dts/bcm958622hr.dts +@@ -172,9 +172,6 @@ + status = "okay"; + + ports { +- #address-cells = <1>; +- #size-cells = <0>; +- + port@0 { + label = "port0"; + reg = <0>; +--- a/arch/arm/boot/dts/bcm958623hr.dts ++++ b/arch/arm/boot/dts/bcm958623hr.dts +@@ -176,9 +176,6 @@ + status = "okay"; + + ports { +- #address-cells = <1>; +- #size-cells = <0>; +- + port@0 { + label = "port0"; + reg = <0>; +--- a/arch/arm/boot/dts/bcm958625hr.dts ++++ b/arch/arm/boot/dts/bcm958625hr.dts +@@ -196,9 +196,6 @@ + status = "okay"; + + ports { +- #address-cells = <1>; +- #size-cells = <0>; +- + port@0 { + label = "port0"; + reg = <0>; +--- a/arch/arm/boot/dts/bcm958625k.dts ++++ b/arch/arm/boot/dts/bcm958625k.dts +@@ -212,9 +212,6 @@ + status = "okay"; + + ports { +- #address-cells = <1>; +- #size-cells = <0>; +- + port@0 { + label = "port0"; + reg = <0>; +--- a/arch/arm/boot/dts/bcm988312hr.dts ++++ b/arch/arm/boot/dts/bcm988312hr.dts +@@ -184,9 +184,6 @@ + status = "okay"; + + ports { +- #address-cells = <1>; +- #size-cells = <0>; +- + port@0 { + label = "port0"; + reg = <0>; diff --git a/target/linux/bcm53xx/patches-5.4/037-v5.15-0001-ARM-dts-NSP-add-device-names-to-compatible.patch b/target/linux/bcm53xx/patches-5.4/037-v5.15-0001-ARM-dts-NSP-add-device-names-to-compatible.patch new file mode 100644 index 0000000000..c994953d4d --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/037-v5.15-0001-ARM-dts-NSP-add-device-names-to-compatible.patch @@ -0,0 +1,97 @@ +From 465078bfdf5271601f098450ae2fc974865c59fd Mon Sep 17 00:00:00 2001 +From: Matthew Hagan +Date: Thu, 10 Jun 2021 21:35:10 +0100 +Subject: [PATCH] ARM: dts: NSP: add device names to compatible + +Currently only the SoC type and platform are specified for all NSP +devices. This patch adds the device names. + +Signed-off-by: Matthew Hagan +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm958522er.dts | 2 +- + arch/arm/boot/dts/bcm958525er.dts | 2 +- + arch/arm/boot/dts/bcm958525xmc.dts | 2 +- + arch/arm/boot/dts/bcm958622hr.dts | 2 +- + arch/arm/boot/dts/bcm958625hr.dts | 2 +- + arch/arm/boot/dts/bcm958625k.dts | 2 +- + arch/arm/boot/dts/bcm988312hr.dts | 2 +- + 7 files changed, 7 insertions(+), 7 deletions(-) + +--- a/arch/arm/boot/dts/bcm958522er.dts ++++ b/arch/arm/boot/dts/bcm958522er.dts +@@ -37,7 +37,7 @@ + + / { + model = "NorthStar Plus SVK (BCM958522ER)"; +- compatible = "brcm,bcm58522", "brcm,nsp"; ++ compatible = "brcm,bcm958522er", "brcm,bcm58522", "brcm,nsp"; + + chosen { + stdout-path = "serial0:115200n8"; +--- a/arch/arm/boot/dts/bcm958525er.dts ++++ b/arch/arm/boot/dts/bcm958525er.dts +@@ -37,7 +37,7 @@ + + / { + model = "NorthStar Plus SVK (BCM958525ER)"; +- compatible = "brcm,bcm58525", "brcm,nsp"; ++ compatible = "brcm,bcm958525er", "brcm,bcm58525", "brcm,nsp"; + + chosen { + stdout-path = "serial0:115200n8"; +--- a/arch/arm/boot/dts/bcm958525xmc.dts ++++ b/arch/arm/boot/dts/bcm958525xmc.dts +@@ -37,7 +37,7 @@ + + / { + model = "NorthStar Plus XMC (BCM958525xmc)"; +- compatible = "brcm,bcm58525", "brcm,nsp"; ++ compatible = "brcm,bcm958525xmc", "brcm,bcm58525", "brcm,nsp"; + + chosen { + stdout-path = "serial0:115200n8"; +--- a/arch/arm/boot/dts/bcm958622hr.dts ++++ b/arch/arm/boot/dts/bcm958622hr.dts +@@ -37,7 +37,7 @@ + + / { + model = "NorthStar Plus SVK (BCM958622HR)"; +- compatible = "brcm,bcm58622", "brcm,nsp"; ++ compatible = "brcm,bcm958622hr", "brcm,bcm58622", "brcm,nsp"; + + chosen { + stdout-path = "serial0:115200n8"; +--- a/arch/arm/boot/dts/bcm958625hr.dts ++++ b/arch/arm/boot/dts/bcm958625hr.dts +@@ -37,7 +37,7 @@ + + / { + model = "NorthStar Plus SVK (BCM958625HR)"; +- compatible = "brcm,bcm58625", "brcm,nsp"; ++ compatible = "brcm,bcm958625hr", "brcm,bcm58625", "brcm,nsp"; + + chosen { + stdout-path = "serial0:115200n8"; +--- a/arch/arm/boot/dts/bcm958625k.dts ++++ b/arch/arm/boot/dts/bcm958625k.dts +@@ -36,7 +36,7 @@ + + / { + model = "NorthStar Plus SVK (BCM958625K)"; +- compatible = "brcm,bcm58625", "brcm,nsp"; ++ compatible = "brcm,bcm958625k", "brcm,bcm58625", "brcm,nsp"; + + chosen { + stdout-path = "serial0:115200n8"; +--- a/arch/arm/boot/dts/bcm988312hr.dts ++++ b/arch/arm/boot/dts/bcm988312hr.dts +@@ -37,7 +37,7 @@ + + / { + model = "NorthStar Plus SVK (BCM988312HR)"; +- compatible = "brcm,bcm88312", "brcm,nsp"; ++ compatible = "brcm,bcm988312hr", "brcm,bcm88312", "brcm,nsp"; + + chosen { + stdout-path = "serial0:115200n8"; diff --git a/target/linux/bcm53xx/patches-5.4/037-v5.15-0002-ARM-dts-NSP-enable-DMA-on-bcm988312hr.patch b/target/linux/bcm53xx/patches-5.4/037-v5.15-0002-ARM-dts-NSP-enable-DMA-on-bcm988312hr.patch new file mode 100644 index 0000000000..d84124d2dd --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/037-v5.15-0002-ARM-dts-NSP-enable-DMA-on-bcm988312hr.patch @@ -0,0 +1,29 @@ +From 1b90dde4278a7b459979706b572785bc3a10bbb5 Mon Sep 17 00:00:00 2001 +From: Matthew Hagan +Date: Thu, 10 Jun 2021 21:35:12 +0100 +Subject: [PATCH] ARM: dts: NSP: enable DMA on bcm988312hr + +The previous patch "ARM: dts: NSP: Disable PL330 by default, add +dma-coherent property" set the DMAC to disabled by default, requiring it +to be manually enabled on each device. The bcm988312hr was mistakenly +omitted. This patch adds it back. + +Signed-off-by: Matthew Hagan +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm988312hr.dts | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/arch/arm/boot/dts/bcm988312hr.dts ++++ b/arch/arm/boot/dts/bcm988312hr.dts +@@ -58,6 +58,10 @@ + + /* USB 3 support needed to be complete */ + ++&dma { ++ status = "okay"; ++}; ++ + &amac0 { + status = "okay"; + }; diff --git a/target/linux/bcm53xx/patches-5.4/037-v5.15-0003-ARM-dts-NSP-disable-qspi-node-by-default.patch b/target/linux/bcm53xx/patches-5.4/037-v5.15-0003-ARM-dts-NSP-disable-qspi-node-by-default.patch new file mode 100644 index 0000000000..df49700829 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/037-v5.15-0003-ARM-dts-NSP-disable-qspi-node-by-default.patch @@ -0,0 +1,113 @@ +From 091a12b1814142eac16a115dab206f735b5476a9 Mon Sep 17 00:00:00 2001 +From: Matthew Hagan +Date: Sun, 13 Jun 2021 10:46:34 +0100 +Subject: [PATCH] ARM: dts: NSP: disable qspi node by default + +The QSPI bus is enabled by default, however this may not used on all +devices. This patch disables by default, requiring it to be explicitly +enabled where required. + +Signed-off-by: Matthew Hagan +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm-nsp.dtsi | 1 + + arch/arm/boot/dts/bcm958522er.dts | 1 + + arch/arm/boot/dts/bcm958525er.dts | 1 + + arch/arm/boot/dts/bcm958525xmc.dts | 1 + + arch/arm/boot/dts/bcm958622hr.dts | 1 + + arch/arm/boot/dts/bcm958623hr.dts | 1 + + arch/arm/boot/dts/bcm958625hr.dts | 1 + + arch/arm/boot/dts/bcm958625k.dts | 1 + + arch/arm/boot/dts/bcm988312hr.dts | 1 + + 9 files changed, 9 insertions(+) + +--- a/arch/arm/boot/dts/bcm-nsp.dtsi ++++ b/arch/arm/boot/dts/bcm-nsp.dtsi +@@ -308,6 +308,7 @@ + num-cs = <2>; + #address-cells = <1>; + #size-cells = <0>; ++ status = "disabled"; + }; + + xhci: usb@29000 { +--- a/arch/arm/boot/dts/bcm958522er.dts ++++ b/arch/arm/boot/dts/bcm958522er.dts +@@ -130,6 +130,7 @@ + }; + + &qspi { ++ status = "okay"; + bspi-sel = <0>; + flash: m25p80@0 { + #address-cells = <1>; +--- a/arch/arm/boot/dts/bcm958525er.dts ++++ b/arch/arm/boot/dts/bcm958525er.dts +@@ -130,6 +130,7 @@ + }; + + &qspi { ++ status = "okay"; + bspi-sel = <0>; + flash: m25p80@0 { + #address-cells = <1>; +--- a/arch/arm/boot/dts/bcm958525xmc.dts ++++ b/arch/arm/boot/dts/bcm958525xmc.dts +@@ -146,6 +146,7 @@ + }; + + &qspi { ++ status = "okay"; + bspi-sel = <0>; + flash: m25p80@0 { + #address-cells = <1>; +--- a/arch/arm/boot/dts/bcm958622hr.dts ++++ b/arch/arm/boot/dts/bcm958622hr.dts +@@ -134,6 +134,7 @@ + }; + + &qspi { ++ status = "okay"; + bspi-sel = <0>; + flash: m25p80@0 { + #address-cells = <1>; +--- a/arch/arm/boot/dts/bcm958623hr.dts ++++ b/arch/arm/boot/dts/bcm958623hr.dts +@@ -138,6 +138,7 @@ + }; + + &qspi { ++ status = "okay"; + bspi-sel = <0>; + flash: m25p80@0 { + #address-cells = <1>; +--- a/arch/arm/boot/dts/bcm958625hr.dts ++++ b/arch/arm/boot/dts/bcm958625hr.dts +@@ -150,6 +150,7 @@ + }; + + &qspi { ++ status = "okay"; + bspi-sel = <0>; + flash: m25p80@0 { + #address-cells = <1>; +--- a/arch/arm/boot/dts/bcm958625k.dts ++++ b/arch/arm/boot/dts/bcm958625k.dts +@@ -149,6 +149,7 @@ + }; + + &qspi { ++ status = "okay"; + bspi-sel = <0>; + flash: m25p80@0 { + #address-cells = <1>; +--- a/arch/arm/boot/dts/bcm988312hr.dts ++++ b/arch/arm/boot/dts/bcm988312hr.dts +@@ -138,6 +138,7 @@ + }; + + &qspi { ++ status = "okay"; + bspi-sel = <0>; + flash: m25p80@0 { + #address-cells = <1>; diff --git a/target/linux/bcm53xx/patches-5.4/037-v5.15-0004-ARM-dts-NSP-add-MDIO-bus-controller-node.patch b/target/linux/bcm53xx/patches-5.4/037-v5.15-0004-ARM-dts-NSP-add-MDIO-bus-controller-node.patch new file mode 100644 index 0000000000..35f6e801a1 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/037-v5.15-0004-ARM-dts-NSP-add-MDIO-bus-controller-node.patch @@ -0,0 +1,30 @@ +From 236b31b1d84eb0e4f10c5f113a2675529456f919 Mon Sep 17 00:00:00 2001 +From: Matthew Hagan +Date: Sun, 13 Jun 2021 10:46:36 +0100 +Subject: [PATCH] ARM: dts: NSP: add MDIO bus controller node + +This patch adds the node for the MDIO bus controller, present on the NSP +SoC. + +Signed-off-by: Matthew Hagan +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm-nsp.dtsi | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/arch/arm/boot/dts/bcm-nsp.dtsi ++++ b/arch/arm/boot/dts/bcm-nsp.dtsi +@@ -361,6 +361,13 @@ + status = "disabled"; + }; + ++ mdio: mdio@32000 { ++ compatible = "brcm,iproc-mdio"; ++ reg = <0x32000 0x8>; ++ #size-cells = <0>; ++ #address-cells = <1>; ++ }; ++ + rng: rng@33000 { + compatible = "brcm,bcm-nsp-rng"; + reg = <0x33000 0x14>; diff --git a/target/linux/bcm53xx/patches-5.4/037-v5.15-0005-ARM-dts-NSP-Move-USB3-PHY-to-internal-MDIO-bus.patch b/target/linux/bcm53xx/patches-5.4/037-v5.15-0005-ARM-dts-NSP-Move-USB3-PHY-to-internal-MDIO-bus.patch new file mode 100644 index 0000000000..9b62cb3028 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/037-v5.15-0005-ARM-dts-NSP-Move-USB3-PHY-to-internal-MDIO-bus.patch @@ -0,0 +1,85 @@ +From 1c615401bddb1be21e1d375aaa071680f40f1ae2 Mon Sep 17 00:00:00 2001 +From: Matthew Hagan +Date: Sun, 13 Jun 2021 10:46:37 +0100 +Subject: [PATCH] ARM: dts: NSP: Move USB3 PHY to internal MDIO bus + +This patch largely replicates Vivek Unune's patch "ARM: dts: +BCM5301X:Make usb3 phy use mdio phy driver"[1] for the NSP platform, +whereby we need to create an mdio-mux to facilitate switches +configured via external MDIO, in this case on the Meraki MX65. + +However in doing so, we are creating an overlap with usb3_phy's +ccb-mii range. To resolve this, usb3_phy should be moved to a child +node of the internal MDIO bus. The result is heavily based upon Vivek's +patch. This has also been cross-referenced with Yendapally Reddy's +earlier work which utilised the subsequently dropped brcm,nsp-usb3-phy +driver: "[PATCH v2 4/4] arm: dts: nsp: Add USB nodes to device tree" +[2]. Finally, this change provides conformance to the bcm-ns-usb3-phy +documentation, utilising the required usb3-dmp-syscon property. Note +that support for the deprecated ccb-mii bindings has been dropped as of +"phy: phy-bcm-ns-usb3: drop support for deprecated DT binding"[3]. + +[1] https://lore.kernel.org/patchwork/patch/933971/ +[2] https://www.spinics.net/lists/arm-kernel/msg555132.html +[3] https://lore.kernel.org/linux-devicetree/20201113113423.9466-1-zajec5@gmail.com/ + +Signed-off-by: Matthew Hagan +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm-nsp.dtsi | 38 +++++++++++++++++++++++++++------- + 1 file changed, 31 insertions(+), 7 deletions(-) + +--- a/arch/arm/boot/dts/bcm-nsp.dtsi ++++ b/arch/arm/boot/dts/bcm-nsp.dtsi +@@ -368,6 +368,35 @@ + #address-cells = <1>; + }; + ++ mdio-mux@32000 { ++ compatible = "mdio-mux-mmioreg"; ++ reg = <0x32000 0x4>; ++ mux-mask = <0x200>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ mdio-parent-bus = <&mdio>; ++ ++ mdio_int: mdio@0 { ++ reg = <0x0>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ usb3_phy: usb3-phy@10 { ++ compatible = "brcm,ns-bx-usb3-phy"; ++ reg = <0x10>; ++ usb3-dmp-syscon = <&usb3_dmp>; ++ #phy-cells = <0>; ++ status = "disabled"; ++ }; ++ }; ++ ++ mdio_ext: mdio@200 { ++ reg = <0x200>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ }; ++ }; ++ + rng: rng@33000 { + compatible = "brcm,bcm-nsp-rng"; + reg = <0x33000 0x14>; +@@ -526,13 +555,8 @@ + }; + }; + +- usb3_phy: usb3-phy@104000 { +- compatible = "brcm,ns-bx-usb3-phy"; +- reg = <0x104000 0x1000>, +- <0x032000 0x1000>; +- reg-names = "dmp", "ccb-mii"; +- #phy-cells = <0>; +- status = "disabled"; ++ usb3_dmp: syscon@104000 { ++ reg = <0x104000 0x1000>; + }; + }; + diff --git a/target/linux/bcm53xx/patches-5.4/037-v5.15-0006-ARM-dts-NSP-Add-common-bindings-for-MX64-MX65.patch b/target/linux/bcm53xx/patches-5.4/037-v5.15-0006-ARM-dts-NSP-Add-common-bindings-for-MX64-MX65.patch new file mode 100644 index 0000000000..aebf62af9b --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/037-v5.15-0006-ARM-dts-NSP-Add-common-bindings-for-MX64-MX65.patch @@ -0,0 +1,148 @@ +From f111016a8293b968f05450fec83020c94d0f88c2 Mon Sep 17 00:00:00 2001 +From: Matthew Hagan +Date: Fri, 6 Aug 2021 21:44:32 +0100 +Subject: [PATCH] ARM: dts: NSP: Add common bindings for MX64/MX65 + +These bindings are required for all Meraki MX64/MX65 devices. These +common bindings include memory (2GB), PWM LEDs, AMAC, I2C (AT24), NAND +partitions, EHCI, OHCI and pinctrl. + +Signed-off-by: Matthew Hagan +Signed-off-by: Florian Fainelli +--- + .../dts/bcm958625-meraki-mx6x-common.dtsi | 129 ++++++++++++++++++ + 1 file changed, 129 insertions(+) + create mode 100644 arch/arm/boot/dts/bcm958625-meraki-mx6x-common.dtsi + +--- /dev/null ++++ b/arch/arm/boot/dts/bcm958625-meraki-mx6x-common.dtsi +@@ -0,0 +1,129 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++/* ++ * Common Bindings for Cisco Meraki MX64 (Kingpin) and MX65 (Alamo) devices. ++ * ++ * Copyright (C) 2020-2021 Matthew Hagan ++ */ ++ ++#include "bcm-nsp.dtsi" ++#include ++#include ++#include ++ ++/ { ++ pwm-leds { ++ compatible = "pwm-leds"; ++ ++ led-1 { ++ function = LED_FUNCTION_INDICATOR; ++ color = ; ++ pwms = <&pwm 1 50000>; ++ max-brightness = <255>; ++ }; ++ ++ led-2 { ++ function = LED_FUNCTION_INDICATOR; ++ color = ; ++ pwms = <&pwm 2 50000>; ++ max-brightness = <255>; ++ }; ++ ++ led-3 { ++ function = LED_FUNCTION_INDICATOR; ++ color = ; ++ pwms = <&pwm 3 50000>; ++ max-brightness = <255>; ++ }; ++ }; ++}; ++ ++&amac2 { ++ status = "okay"; ++}; ++ ++&ehci0 { ++ status = "okay"; ++}; ++ ++&i2c0 { ++ status = "okay"; ++ ++ at24@50 { ++ compatible = "atmel,24c64"; ++ reg = <0x50>; ++ pagesize = <32>; ++ read-only; ++ }; ++}; ++ ++&nand_controller { ++ nand@0 { ++ compatible = "brcm,nandcs"; ++ reg = <0>; ++ nand-on-flash-bbt; ++ ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ nand-ecc-strength = <24>; ++ nand-ecc-step-size = <1024>; ++ ++ brcm,nand-oob-sector-size = <27>; ++ ++ partition@0 { ++ label = "u-boot"; ++ reg = <0x0 0x80000>; ++ read-only; ++ }; ++ ++ partition@80000 { ++ label = "shmoo"; ++ reg = <0x80000 0x80000>; ++ read-only; ++ }; ++ ++ partition@100000 { ++ label = "bootkernel1"; ++ reg = <0x100000 0x300000>; ++ }; ++ ++ partition@400000 { ++ label = "nvram"; ++ reg = <0x400000 0x100000>; ++ }; ++ ++ partition@500000 { ++ label = "bootkernel2"; ++ reg = <0x500000 0x300000>; ++ }; ++ ++ partition@800000 { ++ label = "ubi"; ++ reg = <0x800000 0x3f700000>; ++ }; ++ }; ++}; ++ ++&ohci0 { ++ status = "okay"; ++}; ++ ++&pinctrl { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pwm_leds>; ++ ++ pwm_leds: pwm_leds { ++ function = "pwm"; ++ groups = "pwm1_grp", "pwm2_grp", "pwm3_grp"; ++ }; ++}; ++ ++&pwm { ++ status = "okay"; ++ #pwm-cells = <2>; ++}; ++ ++&uart0 { ++ clock-frequency = <62500000>; ++ status = "okay"; ++}; diff --git a/target/linux/bcm53xx/patches-5.4/037-v5.15-0007-ARM-dts-NSP-Add-Ax-stepping-modifications.patch b/target/linux/bcm53xx/patches-5.4/037-v5.15-0007-ARM-dts-NSP-Add-Ax-stepping-modifications.patch new file mode 100644 index 0000000000..39a69bd9a8 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/037-v5.15-0007-ARM-dts-NSP-Add-Ax-stepping-modifications.patch @@ -0,0 +1,90 @@ +From 2addf9266a1d0f4ba59c9868b3effcd50de441a4 Mon Sep 17 00:00:00 2001 +From: Matthew Hagan +Date: Fri, 6 Aug 2021 21:44:33 +0100 +Subject: [PATCH] ARM: dts: NSP: Add Ax stepping modifications + +While uncommon, some Ax NSP SoCs exist in the wild. This stepping +requires a modified secondary CPU boot-reg and removal of DMA coherency +properties. Without these modifications, the secondary CPU will be +inactive and many peripherals will exhibit undefined behaviour. + +Signed-off-by: Matthew Hagan +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm-nsp-ax.dtsi | 70 +++++++++++++++++++++++++++++++ + 1 file changed, 70 insertions(+) + create mode 100644 arch/arm/boot/dts/bcm-nsp-ax.dtsi + +--- /dev/null ++++ b/arch/arm/boot/dts/bcm-nsp-ax.dtsi +@@ -0,0 +1,70 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++/* ++ * Broadcom Northstar Plus Ax stepping-specific bindings. ++ * Notable differences from B0+ are the secondary-boot-reg and ++ * lack of DMA coherency. ++ */ ++ ++&cpu1 { ++ secondary-boot-reg = <0xffff042c>; ++}; ++ ++&dma { ++ /delete-property/ dma-coherent; ++}; ++ ++&sdio { ++ /delete-property/ dma-coherent; ++}; ++ ++&amac0 { ++ /delete-property/ dma-coherent; ++}; ++ ++&amac1 { ++ /delete-property/ dma-coherent; ++}; ++ ++&amac2 { ++ /delete-property/ dma-coherent; ++}; ++ ++&ehci0 { ++ /delete-property/ dma-coherent; ++}; ++ ++&mailbox { ++ /delete-property/ dma-coherent; ++}; ++ ++&xhci { ++ /delete-property/ dma-coherent; ++}; ++ ++&ehci0 { ++ /delete-property/ dma-coherent; ++}; ++ ++&ohci0 { ++ /delete-property/ dma-coherent; ++}; ++ ++&i2c0 { ++ /delete-property/ dma-coherent; ++}; ++ ++&sata { ++ /delete-property/ dma-coherent; ++}; ++ ++&pcie0 { ++ /delete-property/ dma-coherent; ++}; ++ ++&pcie1 { ++ /delete-property/ dma-coherent; ++}; ++ ++&pcie2 { ++ /delete-property/ dma-coherent; ++}; diff --git a/target/linux/bcm53xx/patches-5.4/037-v5.15-0008-ARM-dts-NSP-Add-DT-files-for-Meraki-MX64-series.patch b/target/linux/bcm53xx/patches-5.4/037-v5.15-0008-ARM-dts-NSP-Add-DT-files-for-Meraki-MX64-series.patch new file mode 100644 index 0000000000..1960f90c68 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/037-v5.15-0008-ARM-dts-NSP-Add-DT-files-for-Meraki-MX64-series.patch @@ -0,0 +1,340 @@ +From 3f902645280baf0d7dab57c227cc14f43edb45ef Mon Sep 17 00:00:00 2001 +From: Matthew Hagan +Date: Fri, 6 Aug 2021 21:44:34 +0100 +Subject: [PATCH] ARM: dts: NSP: Add DT files for Meraki MX64 series + +MX64 & MX64W Hardware info: + - CPU: Broadcom BCM58625 Cortex A9 @ 1200Mhz + - RAM: 2 GB (4 x 4Gb SK Hynix H5TC4G83CFR) + - Storage: 1 GB (Micron MT29F8G08ABACA) + - Networking: BCM58625 internal switch (5x 1GbE ports) + - USB: 1x USB2.0 + - Serial: Internal header + - WLAN(MX64W only): 2x Broadcom BCM43520KMLG on the PCI bus + +This patch adds the Meraki MX64 series-specific bindings. Since some +devices make use of the older A0 SoC, changes need to be made to +accommodate this case, including removal of coherency options and +modification to the secondary-boot-reg. + +Signed-off-by: Matthew Hagan +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/Makefile | 4 + + .../boot/dts/bcm958625-meraki-kingpin.dtsi | 163 ++++++++++++++++++ + .../arm/boot/dts/bcm958625-meraki-mx64-a0.dts | 25 +++ + arch/arm/boot/dts/bcm958625-meraki-mx64.dts | 24 +++ + .../boot/dts/bcm958625-meraki-mx64w-a0.dts | 33 ++++ + arch/arm/boot/dts/bcm958625-meraki-mx64w.dts | 32 ++++ + 6 files changed, 281 insertions(+) + create mode 100644 arch/arm/boot/dts/bcm958625-meraki-kingpin.dtsi + create mode 100644 arch/arm/boot/dts/bcm958625-meraki-mx64-a0.dts + create mode 100644 arch/arm/boot/dts/bcm958625-meraki-mx64.dts + create mode 100644 arch/arm/boot/dts/bcm958625-meraki-mx64w-a0.dts + create mode 100644 arch/arm/boot/dts/bcm958625-meraki-mx64w.dts + +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -148,6 +148,10 @@ dtb-$(CONFIG_ARCH_BCM_NSP) += \ + bcm958525xmc.dtb \ + bcm958622hr.dtb \ + bcm958623hr.dtb \ ++ bcm958625-meraki-mx64.dtb \ ++ bcm958625-meraki-mx64-a0.dtb \ ++ bcm958625-meraki-mx64w.dtb \ ++ bcm958625-meraki-mx64w-a0.dtb \ + bcm958625hr.dtb \ + bcm988312hr.dtb \ + bcm958625k.dtb +--- /dev/null ++++ b/arch/arm/boot/dts/bcm958625-meraki-kingpin.dtsi +@@ -0,0 +1,163 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++/* ++ * Device Tree Bindings for Cisco Meraki MX64 series (Kingpin). ++ * ++ * Copyright (C) 2020-2021 Matthew Hagan ++ */ ++ ++#include "bcm958625-meraki-mx6x-common.dtsi" ++ ++/ { ++ ++ keys { ++ compatible = "gpio-keys-polled"; ++ autorepeat; ++ poll-interval = <20>; ++ ++ reset { ++ label = "reset"; ++ linux,code = ; ++ gpios = <&gpioa 6 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ led-0 { ++ /* green:lan1-left */ ++ function = LED_FUNCTION_ACTIVITY; ++ function-enumerator = <0>; ++ color = ; ++ gpios = <&gpioa 19 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-1 { ++ /* green:lan1-right */ ++ function = LED_FUNCTION_ACTIVITY; ++ function-enumerator = <1>; ++ color = ; ++ gpios = <&gpioa 18 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-2 { ++ /* green:lan2-left */ ++ function = LED_FUNCTION_ACTIVITY; ++ function-enumerator = <2>; ++ color = ; ++ gpios = <&gpioa 24 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-3 { ++ /* green:lan2-right */ ++ function = LED_FUNCTION_ACTIVITY; ++ function-enumerator = <3>; ++ color = ; ++ gpios = <&gpioa 20 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-4 { ++ /* green:lan3-left */ ++ function = LED_FUNCTION_ACTIVITY; ++ function-enumerator = <4>; ++ color = ; ++ gpios = <&gpioa 26 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-5 { ++ /* green:lan3-right */ ++ function = LED_FUNCTION_ACTIVITY; ++ function-enumerator = <5>; ++ color = ; ++ gpios = <&gpioa 25 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-6 { ++ /* green:lan4-left */ ++ function = LED_FUNCTION_ACTIVITY; ++ function-enumerator = <6>; ++ color = ; ++ gpios = <&gpioa 28 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-7 { ++ /* green:lan4-right */ ++ function = LED_FUNCTION_ACTIVITY; ++ function-enumerator = <7>; ++ color = ; ++ gpios = <&gpioa 27 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-8 { ++ /* green:wan-left */ ++ function = LED_FUNCTION_ACTIVITY; ++ function-enumerator = <8>; ++ color = ; ++ gpios = <&gpioa 30 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-9 { ++ /* green:wan-right */ ++ function = LED_FUNCTION_ACTIVITY; ++ function-enumerator = <9>; ++ color = ; ++ gpios = <&gpioa 29 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-a { ++ /* amber:power */ ++ function = LED_FUNCTION_POWER; ++ color = ; ++ gpios = <&gpioa 0 GPIO_ACTIVE_LOW>; ++ default-state = "on"; ++ }; ++ ++ led-b { ++ /* white:status */ ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ gpios = <&gpioa 31 GPIO_ACTIVE_HIGH>; ++ }; ++ }; ++}; ++ ++&srab { ++ compatible = "brcm,bcm58625-srab", "brcm,nsp-srab"; ++ status = "okay"; ++ ++ ports { ++ port@0 { ++ label = "lan1"; ++ reg = <0>; ++ }; ++ ++ port@1 { ++ label = "lan2"; ++ reg = <1>; ++ }; ++ ++ port@2 { ++ label = "lan3"; ++ reg = <2>; ++ }; ++ ++ port@3 { ++ label = "lan4"; ++ reg = <3>; ++ }; ++ ++ port@4 { ++ label = "wan"; ++ reg = <4>; ++ }; ++ ++ port@8 { ++ ethernet = <&amac2>; ++ reg = <8>; ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; ++ }; ++}; +--- /dev/null ++++ b/arch/arm/boot/dts/bcm958625-meraki-mx64-a0.dts +@@ -0,0 +1,25 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++/* ++ * Device Tree Bindings for Cisco Meraki MX64 with A0 SoC. ++ * ++ * Copyright (C) 2020-2021 Matthew Hagan ++ */ ++ ++/dts-v1/; ++ ++#include "bcm958625-meraki-kingpin.dtsi" ++#include "bcm-nsp-ax.dtsi" ++ ++/ { ++ model = "Cisco Meraki MX64(A0)"; ++ compatible = "meraki,mx64-a0", "brcm,bcm58625", "brcm,nsp"; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ memory@60000000 { ++ device_type = "memory"; ++ reg = <0x60000000 0x80000000>; ++ }; ++}; +--- /dev/null ++++ b/arch/arm/boot/dts/bcm958625-meraki-mx64.dts +@@ -0,0 +1,24 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++/* ++ * Device Tree Bindings for Cisco Meraki MX64 with B0+ SoC. ++ * ++ * Copyright (C) 2020-2021 Matthew Hagan ++ */ ++ ++/dts-v1/; ++ ++#include "bcm958625-meraki-kingpin.dtsi" ++ ++/ { ++ model = "Cisco Meraki MX64"; ++ compatible = "meraki,mx64", "brcm,bcm58625", "brcm,nsp"; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ memory@60000000 { ++ device_type = "memory"; ++ reg = <0x60000000 0x80000000>; ++ }; ++}; +--- /dev/null ++++ b/arch/arm/boot/dts/bcm958625-meraki-mx64w-a0.dts +@@ -0,0 +1,33 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++/* ++ * Device Tree Bindings for Cisco Meraki MX64W with A0 SoC. ++ * ++ * Copyright (C) 2020-2021 Matthew Hagan ++ */ ++ ++/dts-v1/; ++ ++#include "bcm958625-meraki-kingpin.dtsi" ++#include "bcm-nsp-ax.dtsi" ++ ++/ { ++ model = "Cisco Meraki MX64W(A0)"; ++ compatible = "meraki,mx64w-a0", "brcm,bcm58625", "brcm,nsp"; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ memory@60000000 { ++ device_type = "memory"; ++ reg = <0x60000000 0x80000000>; ++ }; ++}; ++ ++&pcie0 { ++ status = "okay"; ++}; ++ ++&pcie1 { ++ status = "okay"; ++}; +--- /dev/null ++++ b/arch/arm/boot/dts/bcm958625-meraki-mx64w.dts +@@ -0,0 +1,32 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++/* ++ * Device Tree Bindings for Cisco Meraki MX64W with B0+ SoC. ++ * ++ * Copyright (C) 2020-2021 Matthew Hagan ++ */ ++ ++/dts-v1/; ++ ++#include "bcm958625-meraki-kingpin.dtsi" ++ ++/ { ++ model = "Cisco Meraki MX64W"; ++ compatible = "meraki,mx64w", "brcm,bcm58625", "brcm,nsp"; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ memory@60000000 { ++ device_type = "memory"; ++ reg = <0x60000000 0x80000000>; ++ }; ++}; ++ ++&pcie0 { ++ status = "okay"; ++}; ++ ++&pcie1 { ++ status = "okay"; ++}; diff --git a/target/linux/bcm53xx/patches-5.4/037-v5.15-0009-ARM-dts-NSP-Add-DT-files-for-Meraki-MX65-series.patch b/target/linux/bcm53xx/patches-5.4/037-v5.15-0009-ARM-dts-NSP-Add-DT-files-for-Meraki-MX65-series.patch new file mode 100644 index 0000000000..aa431b97cc --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/037-v5.15-0009-ARM-dts-NSP-Add-DT-files-for-Meraki-MX65-series.patch @@ -0,0 +1,386 @@ +From 702a8f4744ed5b480f2b2411858184afdb10f9fd Mon Sep 17 00:00:00 2001 +From: Matthew Hagan +Date: Fri, 6 Aug 2021 21:44:35 +0100 +Subject: [PATCH] ARM: dts: NSP: Add DT files for Meraki MX65 series + +MX65 & MX65W Hardware info: + - CPU: Broadcom BCM58625 Cortex A9 @ 1200Mhz + - RAM: 2 GB (4 x 4Gb SK Hynix H5TC4G83CFR) + - Storage: 1 GB (Micron MT29F8G08ABACA) + - Networking: BCM58625 switch (2x 1GbE ports) + 2x Qualcomm QCA8337 switches (10x 1GbE ports total) + - PSE: Broadcom BCM59111KMLG connected to LAN ports 11 & 12 + - USB: 1x USB2.0 + - Serial: Internal header + - WLAN(MX65W Only): 2x Broadcom BCM43520KMLG on the PCI bus. + +Note that a driver and firmware image for the BCM59111 PSE has been +released under GPL, but this is not present in the kernel. + +Signed-off-by: Matthew Hagan +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/Makefile | 2 + + arch/arm/boot/dts/bcm958625-meraki-alamo.dtsi | 279 ++++++++++++++++++ + arch/arm/boot/dts/bcm958625-meraki-mx65.dts | 24 ++ + arch/arm/boot/dts/bcm958625-meraki-mx65w.dts | 32 ++ + 4 files changed, 337 insertions(+) + create mode 100644 arch/arm/boot/dts/bcm958625-meraki-alamo.dtsi + create mode 100644 arch/arm/boot/dts/bcm958625-meraki-mx65.dts + create mode 100644 arch/arm/boot/dts/bcm958625-meraki-mx65w.dts + +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -152,6 +152,8 @@ dtb-$(CONFIG_ARCH_BCM_NSP) += \ + bcm958625-meraki-mx64-a0.dtb \ + bcm958625-meraki-mx64w.dtb \ + bcm958625-meraki-mx64w-a0.dtb \ ++ bcm958625-meraki-mx65.dtb \ ++ bcm958625-meraki-mx65w.dtb \ + bcm958625hr.dtb \ + bcm988312hr.dtb \ + bcm958625k.dtb +--- /dev/null ++++ b/arch/arm/boot/dts/bcm958625-meraki-alamo.dtsi +@@ -0,0 +1,279 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++/* ++ * Device Tree Bindings for Cisco Meraki MX65 series (Alamo). ++ * ++ * Copyright (C) 2020-2021 Matthew Hagan ++ */ ++ ++#include "bcm958625-meraki-mx6x-common.dtsi" ++ ++/ { ++ keys { ++ compatible = "gpio-keys-polled"; ++ autorepeat; ++ poll-interval = <20>; ++ ++ reset { ++ label = "reset"; ++ linux,code = ; ++ gpios = <&gpioa 8 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ led-0 { ++ /* green:wan1-left */ ++ function = LED_FUNCTION_ACTIVITY; ++ function-enumerator = <0>; ++ color = ; ++ gpios = <&gpioa 25 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-1 { ++ /* green:wan1-right */ ++ function = LED_FUNCTION_ACTIVITY; ++ function-enumerator = <1>; ++ color = ; ++ gpios = <&gpioa 24 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-2 { ++ /* green:wan2-left */ ++ function = LED_FUNCTION_ACTIVITY; ++ function-enumerator = <2>; ++ color = ; ++ gpios = <&gpioa 27 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-3 { ++ /* green:wan2-right */ ++ function = LED_FUNCTION_ACTIVITY; ++ function-enumerator = <3>; ++ color = ; ++ gpios = <&gpioa 26 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-4 { ++ /* amber:power */ ++ function = LED_FUNCTION_POWER; ++ color = ; ++ gpios = <&gpioa 3 GPIO_ACTIVE_HIGH>; ++ default-state = "on"; ++ }; ++ ++ led-5 { ++ /* white:status */ ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ gpios = <&gpioa 31 GPIO_ACTIVE_HIGH>; ++ }; ++ }; ++ ++ mdio-mii-mux { ++ compatible = "mdio-mux-mmioreg"; ++ reg = <0x1803f1c0 0x4>; ++ mux-mask = <0x2000>; ++ mdio-parent-bus = <&mdio_ext>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ mdio@0 { ++ reg = <0x0>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ phy_port6: phy@0 { ++ reg = <0>; ++ }; ++ ++ phy_port7: phy@1 { ++ reg = <1>; ++ }; ++ ++ phy_port8: phy@2 { ++ reg = <2>; ++ }; ++ ++ phy_port9: phy@3 { ++ reg = <3>; ++ }; ++ ++ phy_port10: phy@4 { ++ reg = <4>; ++ }; ++ ++ switch@10 { ++ compatible = "qca,qca8337"; ++ reg = <0x10>; ++ dsa,member = <1 0>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ port@0 { ++ reg = <0>; ++ ethernet = <&sgmii1>; ++ phy-mode = "sgmii"; ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ label = "lan8"; ++ phy-handle = <&phy_port6>; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ label = "lan9"; ++ phy-handle = <&phy_port7>; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ label = "lan10"; ++ phy-handle = <&phy_port8>; ++ }; ++ ++ port@4 { ++ reg = <4>; ++ label = "lan11"; ++ phy-handle = <&phy_port9>; ++ }; ++ ++ port@5 { ++ reg = <5>; ++ label = "lan12"; ++ phy-handle = <&phy_port10>; ++ }; ++ }; ++ }; ++ }; ++ ++ mdio-mii@2000 { ++ reg = <0x2000>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ phy_port1: phy@0 { ++ reg = <0>; ++ }; ++ ++ phy_port2: phy@1 { ++ reg = <1>; ++ }; ++ ++ phy_port3: phy@2 { ++ reg = <2>; ++ }; ++ ++ phy_port4: phy@3 { ++ reg = <3>; ++ }; ++ ++ phy_port5: phy@4 { ++ reg = <4>; ++ }; ++ ++ switch@10 { ++ compatible = "qca,qca8337"; ++ reg = <0x10>; ++ dsa,member = <2 0>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ port@0 { ++ reg = <0>; ++ ethernet = <&sgmii0>; ++ phy-mode = "sgmii"; ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ label = "lan3"; ++ phy-handle = <&phy_port1>; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ label = "lan4"; ++ phy-handle = <&phy_port2>; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ label = "lan5"; ++ phy-handle = <&phy_port3>; ++ }; ++ ++ port@4 { ++ reg = <4>; ++ label = "lan6"; ++ phy-handle = <&phy_port4>; ++ }; ++ ++ port@5 { ++ reg = <5>; ++ label = "lan7"; ++ phy-handle = <&phy_port5>; ++ }; ++ }; ++ }; ++ }; ++ }; ++}; ++ ++&srab { ++ compatible = "brcm,bcm58625-srab", "brcm,nsp-srab"; ++ status = "okay"; ++ dsa,member = <0 0>; ++ ++ ports { ++ port@0 { ++ label = "wan1"; ++ reg = <0>; ++ }; ++ ++ port@1 { ++ label = "wan2"; ++ reg = <1>; ++ }; ++ ++ sgmii0: port@4 { ++ label = "sw0"; ++ reg = <4>; ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; ++ ++ sgmii1: port@5 { ++ label = "sw1"; ++ reg = <5>; ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; ++ ++ port@8 { ++ ethernet = <&amac2>; ++ reg = <8>; ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; ++ }; ++}; +--- /dev/null ++++ b/arch/arm/boot/dts/bcm958625-meraki-mx65.dts +@@ -0,0 +1,24 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++/* ++ * Device Tree Bindings for Cisco Meraki MX65. ++ * ++ * Copyright (C) 2020-2021 Matthew Hagan ++ */ ++ ++/dts-v1/; ++ ++#include "bcm958625-meraki-alamo.dtsi" ++ ++/ { ++ model = "Cisco Meraki MX65"; ++ compatible = "meraki,mx65", "brcm,bcm58625", "brcm,nsp"; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ memory@60000000 { ++ device_type = "memory"; ++ reg = <0x60000000 0x80000000>; ++ }; ++}; +--- /dev/null ++++ b/arch/arm/boot/dts/bcm958625-meraki-mx65w.dts +@@ -0,0 +1,32 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++/* ++ * Device Tree Bindings for Cisco Meraki MX65W. ++ * ++ * Copyright (C) 2020-2021 Matthew Hagan ++ */ ++ ++/dts-v1/; ++ ++#include "bcm958625-meraki-alamo.dtsi" ++ ++/ { ++ model = "Cisco Meraki MX65W"; ++ compatible = "meraki,mx65w", "brcm,bcm58625", "brcm,nsp"; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ memory@60000000 { ++ device_type = "memory"; ++ reg = <0x60000000 0x80000000>; ++ }; ++}; ++ ++&pcie0 { ++ status = "okay"; ++}; ++ ++&pcie1 { ++ status = "okay"; ++}; diff --git a/target/linux/bcm53xx/patches-5.4/037-v5.15-0001-ARM-dts-BCM5301X-Fix-nodes-names.patch b/target/linux/bcm53xx/patches-5.4/037-v5.15-0010-ARM-dts-BCM5301X-Fix-nodes-names.patch similarity index 100% rename from target/linux/bcm53xx/patches-5.4/037-v5.15-0001-ARM-dts-BCM5301X-Fix-nodes-names.patch rename to target/linux/bcm53xx/patches-5.4/037-v5.15-0010-ARM-dts-BCM5301X-Fix-nodes-names.patch diff --git a/target/linux/bcm53xx/patches-5.4/037-v5.15-0002-ARM-dts-BCM5301X-Fix-MDIO-mux-binding.patch b/target/linux/bcm53xx/patches-5.4/037-v5.15-0011-ARM-dts-BCM5301X-Fix-MDIO-mux-binding.patch similarity index 100% rename from target/linux/bcm53xx/patches-5.4/037-v5.15-0002-ARM-dts-BCM5301X-Fix-MDIO-mux-binding.patch rename to target/linux/bcm53xx/patches-5.4/037-v5.15-0011-ARM-dts-BCM5301X-Fix-MDIO-mux-binding.patch diff --git a/target/linux/bcm53xx/patches-5.4/037-v5.15-0003-ARM-dts-BCM5301X-Fix-memory-nodes-names.patch b/target/linux/bcm53xx/patches-5.4/037-v5.15-0012-ARM-dts-BCM5301X-Fix-memory-nodes-names.patch similarity index 100% rename from target/linux/bcm53xx/patches-5.4/037-v5.15-0003-ARM-dts-BCM5301X-Fix-memory-nodes-names.patch rename to target/linux/bcm53xx/patches-5.4/037-v5.15-0012-ARM-dts-BCM5301X-Fix-memory-nodes-names.patch From 1ba74c168b79a14a4e9b0be7c2f145b8febfbc30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Mon, 30 Aug 2021 08:54:29 +0200 Subject: [PATCH 031/137] bcm53xx: backport missed DT patch cleaning up CRU block MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki (cherry picked from commit 8a4d4d4243357b28722e3327e2c7c7b4ceb288ec) --- ...01X-Move-CRU-devices-to-the-CRU-node.patch | 85 +++++++++++++++++++ ...01X-Update-Ethernet-switch-node-name.patch | 4 +- ...-Add-a-default-compatible-for-switch.patch | 2 +- ...-Provide-defaults-ports-container-no.patch | 2 +- ...RM-dts-BCM5301X-Fix-NAND-nodes-names.patch | 2 +- ...s-BCM5301X-Fix-pinmux-subnodes-names.patch | 2 +- 6 files changed, 91 insertions(+), 6 deletions(-) create mode 100644 target/linux/bcm53xx/patches-5.4/034-v5.11-0007-ARM-dts-BCM5301X-Move-CRU-devices-to-the-CRU-node.patch diff --git a/target/linux/bcm53xx/patches-5.4/034-v5.11-0007-ARM-dts-BCM5301X-Move-CRU-devices-to-the-CRU-node.patch b/target/linux/bcm53xx/patches-5.4/034-v5.11-0007-ARM-dts-BCM5301X-Move-CRU-devices-to-the-CRU-node.patch new file mode 100644 index 0000000000..3c3db540d0 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/034-v5.11-0007-ARM-dts-BCM5301X-Move-CRU-devices-to-the-CRU-node.patch @@ -0,0 +1,85 @@ +From 776461b1795b4dc4084894cf53399044aafa1d21 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 11 Nov 2020 15:55:38 +0100 +Subject: [PATCH] ARM: dts: BCM5301X: Move CRU devices to the CRU node +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Clocks and thermal blocks are part of the CRU ("Clock and Reset Unit" or +"Central Resource Unit"). + +Signed-off-by: Rafał Miłecki +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm5301x.dtsi | 51 +++++++++++++++++---------------- + 1 file changed, 26 insertions(+), 25 deletions(-) + +--- a/arch/arm/boot/dts/bcm5301x.dtsi ++++ b/arch/arm/boot/dts/bcm5301x.dtsi +@@ -430,6 +430,26 @@ + #address-cells = <1>; + #size-cells = <1>; + ++ lcpll0: lcpll0@100 { ++ #clock-cells = <1>; ++ compatible = "brcm,nsp-lcpll0"; ++ reg = <0x100 0x14>; ++ clocks = <&osc>; ++ clock-output-names = "lcpll0", "pcie_phy", ++ "sdio", "ddr_phy"; ++ }; ++ ++ genpll: genpll@140 { ++ #clock-cells = <1>; ++ compatible = "brcm,nsp-genpll"; ++ reg = <0x140 0x24>; ++ clocks = <&osc>; ++ clock-output-names = "genpll", "phy", ++ "ethernetclk", ++ "usbclk", "iprocfast", ++ "sata1", "sata2"; ++ }; ++ + pinctrl: pin-controller@1c0 { + compatible = "brcm,bcm4708-pinmux"; + reg = <0x1c0 0x24>; +@@ -456,32 +476,13 @@ + function = "uart1"; + }; + }; +- }; +- }; + +- lcpll0: lcpll0@1800c100 { +- #clock-cells = <1>; +- compatible = "brcm,nsp-lcpll0"; +- reg = <0x1800c100 0x14>; +- clocks = <&osc>; +- clock-output-names = "lcpll0", "pcie_phy", "sdio", +- "ddr_phy"; +- }; +- +- genpll: genpll@1800c140 { +- #clock-cells = <1>; +- compatible = "brcm,nsp-genpll"; +- reg = <0x1800c140 0x24>; +- clocks = <&osc>; +- clock-output-names = "genpll", "phy", "ethernetclk", +- "usbclk", "iprocfast", "sata1", +- "sata2"; +- }; +- +- thermal: thermal@1800c2c0 { +- compatible = "brcm,ns-thermal"; +- reg = <0x1800c2c0 0x10>; +- #thermal-sensor-cells = <0>; ++ thermal: thermal@2c0 { ++ compatible = "brcm,ns-thermal"; ++ reg = <0x2c0 0x10>; ++ #thermal-sensor-cells = <0>; ++ }; ++ }; + }; + + srab: srab@18007000 { diff --git a/target/linux/bcm53xx/patches-5.4/034-v5.11-0010-ARM-dts-BCM5301X-Update-Ethernet-switch-node-name.patch b/target/linux/bcm53xx/patches-5.4/034-v5.11-0010-ARM-dts-BCM5301X-Update-Ethernet-switch-node-name.patch index 00a5d08f0d..b3a774e340 100644 --- a/target/linux/bcm53xx/patches-5.4/034-v5.11-0010-ARM-dts-BCM5301X-Update-Ethernet-switch-node-name.patch +++ b/target/linux/bcm53xx/patches-5.4/034-v5.11-0010-ARM-dts-BCM5301X-Update-Ethernet-switch-node-name.patch @@ -21,8 +21,8 @@ Signed-off-by: Florian Fainelli --- a/arch/arm/boot/dts/bcm5301x.dtsi +++ b/arch/arm/boot/dts/bcm5301x.dtsi -@@ -484,7 +484,7 @@ - #thermal-sensor-cells = <0>; +@@ -485,7 +485,7 @@ + }; }; - srab: srab@18007000 { diff --git a/target/linux/bcm53xx/patches-5.4/034-v5.11-0011-ARM-dts-BCM5301X-Add-a-default-compatible-for-switch.patch b/target/linux/bcm53xx/patches-5.4/034-v5.11-0011-ARM-dts-BCM5301X-Add-a-default-compatible-for-switch.patch index 044504796c..677e94f271 100644 --- a/target/linux/bcm53xx/patches-5.4/034-v5.11-0011-ARM-dts-BCM5301X-Add-a-default-compatible-for-switch.patch +++ b/target/linux/bcm53xx/patches-5.4/034-v5.11-0011-ARM-dts-BCM5301X-Add-a-default-compatible-for-switch.patch @@ -71,7 +71,7 @@ Signed-off-by: Florian Fainelli +}; --- a/arch/arm/boot/dts/bcm5301x.dtsi +++ b/arch/arm/boot/dts/bcm5301x.dtsi -@@ -485,7 +485,7 @@ +@@ -486,7 +486,7 @@ }; srab: ethernet-switch@18007000 { diff --git a/target/linux/bcm53xx/patches-5.4/034-v5.11-0012-ARM-dts-BCM5301X-Provide-defaults-ports-container-no.patch b/target/linux/bcm53xx/patches-5.4/034-v5.11-0012-ARM-dts-BCM5301X-Provide-defaults-ports-container-no.patch index e05ce88304..6e4f5f7bb8 100644 --- a/target/linux/bcm53xx/patches-5.4/034-v5.11-0012-ARM-dts-BCM5301X-Provide-defaults-ports-container-no.patch +++ b/target/linux/bcm53xx/patches-5.4/034-v5.11-0012-ARM-dts-BCM5301X-Provide-defaults-ports-container-no.patch @@ -155,7 +155,7 @@ Signed-off-by: Florian Fainelli label = "lan4"; --- a/arch/arm/boot/dts/bcm5301x.dtsi +++ b/arch/arm/boot/dts/bcm5301x.dtsi -@@ -491,6 +491,10 @@ +@@ -492,6 +492,10 @@ status = "disabled"; /* ports are defined in board DTS */ diff --git a/target/linux/bcm53xx/patches-5.4/036-v5.14-0001-ARM-dts-BCM5301X-Fix-NAND-nodes-names.patch b/target/linux/bcm53xx/patches-5.4/036-v5.14-0001-ARM-dts-BCM5301X-Fix-NAND-nodes-names.patch index ac45409c63..48cceee743 100644 --- a/target/linux/bcm53xx/patches-5.4/036-v5.14-0001-ARM-dts-BCM5301X-Fix-NAND-nodes-names.patch +++ b/target/linux/bcm53xx/patches-5.4/036-v5.14-0001-ARM-dts-BCM5301X-Fix-NAND-nodes-names.patch @@ -53,7 +53,7 @@ Signed-off-by: Florian Fainelli #address-cells = <1>; --- a/arch/arm/boot/dts/bcm5301x.dtsi +++ b/arch/arm/boot/dts/bcm5301x.dtsi -@@ -502,7 +502,7 @@ +@@ -503,7 +503,7 @@ reg = <0x18004000 0x14>; }; diff --git a/target/linux/bcm53xx/patches-5.4/036-v5.14-0002-ARM-dts-BCM5301X-Fix-pinmux-subnodes-names.patch b/target/linux/bcm53xx/patches-5.4/036-v5.14-0002-ARM-dts-BCM5301X-Fix-pinmux-subnodes-names.patch index aad9aef4a3..d8a4f87c38 100644 --- a/target/linux/bcm53xx/patches-5.4/036-v5.14-0002-ARM-dts-BCM5301X-Fix-pinmux-subnodes-names.patch +++ b/target/linux/bcm53xx/patches-5.4/036-v5.14-0002-ARM-dts-BCM5301X-Fix-pinmux-subnodes-names.patch @@ -28,7 +28,7 @@ Signed-off-by: Florian Fainelli }; --- a/arch/arm/boot/dts/bcm5301x.dtsi +++ b/arch/arm/boot/dts/bcm5301x.dtsi -@@ -440,18 +440,18 @@ +@@ -460,18 +460,18 @@ function = "spi"; }; From 94c2ceed9e9ffaca875f696ff721f947258ba831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Tue, 7 Sep 2021 13:22:41 +0200 Subject: [PATCH 032/137] bcm53xx: specify switch ports for more devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki (cherry picked from commit ae33ce2af2b273332017d0b49e37c4224e40a62a) --- ...-Specify-switch-ports-for-more-devic.patch | 289 +++++++++ ...-Specify-switch-ports-for-remaining-.patch | 575 ++++++++++++++++++ 2 files changed, 864 insertions(+) create mode 100644 target/linux/bcm53xx/patches-5.4/130-ARM-dts-BCM5301X-Specify-switch-ports-for-more-devic.patch create mode 100644 target/linux/bcm53xx/patches-5.4/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch diff --git a/target/linux/bcm53xx/patches-5.4/130-ARM-dts-BCM5301X-Specify-switch-ports-for-more-devic.patch b/target/linux/bcm53xx/patches-5.4/130-ARM-dts-BCM5301X-Specify-switch-ports-for-more-devic.patch new file mode 100644 index 0000000000..211de34af7 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/130-ARM-dts-BCM5301X-Specify-switch-ports-for-more-devic.patch @@ -0,0 +1,289 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 7 Sep 2021 07:51:17 +0200 +Subject: [PATCH next] ARM: dts: BCM5301X: Specify switch ports for more + devices +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Those are remaining models I have that didn't have ports yet. All +tested. + +Signed-off-by: Rafał Miłecki +--- + arch/arm/boot/dts/bcm4708-netgear-r6250.dts | 37 ++++++++++++++++ + .../boot/dts/bcm47081-buffalo-wzr-600dhp2.dts | 37 ++++++++++++++++ + arch/arm/boot/dts/bcm4709-netgear-r8000.dts | 42 +++++++++++++++++++ + arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts | 42 +++++++++++++++++++ + arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts | 37 ++++++++++++++++ + arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts | 37 ++++++++++++++++ + 6 files changed, 232 insertions(+) + +--- a/arch/arm/boot/dts/bcm4708-netgear-r6250.dts ++++ b/arch/arm/boot/dts/bcm4708-netgear-r6250.dts +@@ -94,3 +94,40 @@ + &usb3_phy { + status = "okay"; + }; ++ ++&srab { ++ status = "okay"; ++ ++ ports { ++ port@0 { ++ reg = <0>; ++ label = "lan4"; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ label = "lan3"; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ label = "lan2"; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ label = "lan1"; ++ }; ++ ++ port@4 { ++ reg = <4>; ++ label = "wan"; ++ }; ++ ++ port@5 { ++ reg = <5>; ++ label = "cpu"; ++ ethernet = <&gmac0>; ++ }; ++ }; ++}; +--- a/arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts ++++ b/arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts +@@ -117,3 +117,40 @@ + }; + }; + }; ++ ++&srab { ++ status = "okay"; ++ ++ ports { ++ 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@5 { ++ reg = <5>; ++ label = "cpu"; ++ ethernet = <&gmac0>; ++ }; ++ }; ++}; +--- a/arch/arm/boot/dts/bcm4709-netgear-r8000.dts ++++ b/arch/arm/boot/dts/bcm4709-netgear-r8000.dts +@@ -187,3 +187,45 @@ + &usb3_phy { + status = "okay"; + }; ++ ++&srab { ++ status = "okay"; ++ ++ ports { ++ 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@8 { ++ reg = <8>; ++ label = "cpu"; ++ ethernet = <&gmac2>; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; ++ }; ++}; +--- a/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts ++++ b/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts +@@ -118,3 +118,45 @@ + &usb3_phy { + status = "okay"; + }; ++ ++&srab { ++ status = "okay"; ++ ++ ports { ++ port@0 { ++ reg = <0>; ++ label = "lan4"; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ label = "lan3"; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ label = "lan2"; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ label = "lan1"; ++ }; ++ ++ port@4 { ++ reg = <4>; ++ label = "wan"; ++ }; ++ ++ port@8 { ++ reg = <8>; ++ label = "cpu"; ++ ethernet = <&gmac2>; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; ++ }; ++}; +--- a/arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts +@@ -68,3 +68,40 @@ + &usb3_phy { + status = "okay"; + }; ++ ++&srab { ++ status = "okay"; ++ ++ ports { ++ port@0 { ++ reg = <0>; ++ label = "wan"; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ label = "lan4"; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ label = "lan3"; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ label = "lan2"; ++ }; ++ ++ port@4 { ++ reg = <4>; ++ label = "lan1"; ++ }; ++ ++ port@5 { ++ reg = <5>; ++ label = "cpu"; ++ ethernet = <&gmac0>; ++ }; ++ }; ++}; +--- a/arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts +@@ -68,3 +68,40 @@ + &usb3_phy { + status = "okay"; + }; ++ ++&srab { ++ status = "okay"; ++ ++ ports { ++ port@0 { ++ reg = <0>; ++ label = "wan"; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ label = "lan4"; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ label = "lan3"; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ label = "lan2"; ++ }; ++ ++ port@4 { ++ reg = <4>; ++ label = "lan1"; ++ }; ++ ++ port@5 { ++ reg = <5>; ++ label = "cpu"; ++ ethernet = <&gmac0>; ++ }; ++ }; ++}; diff --git a/target/linux/bcm53xx/patches-5.4/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch b/target/linux/bcm53xx/patches-5.4/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch new file mode 100644 index 0000000000..0c8a5c63cd --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch @@ -0,0 +1,575 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Subject: [PATCH] ARM: dts: BCM5301X: Specify switch ports for remaining + devices +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Rafał Miłecki +--- + +--- a/arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dts ++++ b/arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dts +@@ -93,3 +93,40 @@ + &usb3_phy { + status = "okay"; + }; ++ ++&srab { ++ status = "okay"; ++ ++ ports { ++ 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@5 { ++ reg = <5>; ++ label = "cpu"; ++ ethernet = <&gmac0>; ++ }; ++ }; ++}; +--- a/arch/arm/boot/dts/bcm4708-asus-rt-ac68u.dts ++++ b/arch/arm/boot/dts/bcm4708-asus-rt-ac68u.dts +@@ -83,3 +83,40 @@ + &usb3_phy { + status = "okay"; + }; ++ ++&srab { ++ status = "okay"; ++ ++ ports { ++ port@0 { ++ reg = <0>; ++ label = "wan"; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ label = "lan1"; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ label = "lan2"; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ label = "lan3"; ++ }; ++ ++ port@4 { ++ reg = <4>; ++ label = "lan4"; ++ }; ++ ++ port@5 { ++ reg = <5>; ++ label = "cpu"; ++ ethernet = <&gmac0>; ++ }; ++ }; ++}; +--- a/arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts ++++ b/arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts +@@ -149,3 +149,40 @@ + &usb3_phy { + status = "okay"; + }; ++ ++&srab { ++ status = "okay"; ++ ++ ports { ++ 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@5 { ++ reg = <5>; ++ label = "cpu"; ++ ethernet = <&gmac0>; ++ }; ++ }; ++}; +--- a/arch/arm/boot/dts/bcm4708-linksys-ea6300-v1.dts ++++ b/arch/arm/boot/dts/bcm4708-linksys-ea6300-v1.dts +@@ -46,3 +46,40 @@ + &usb3_phy { + status = "okay"; + }; ++ ++&srab { ++ status = "okay"; ++ ++ ports { ++ 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@5 { ++ reg = <5>; ++ label = "cpu"; ++ ethernet = <&gmac0>; ++ }; ++ }; ++}; +--- a/arch/arm/boot/dts/bcm4708-linksys-ea6500-v2.dts ++++ b/arch/arm/boot/dts/bcm4708-linksys-ea6500-v2.dts +@@ -42,3 +42,40 @@ + &usb3_phy { + status = "okay"; + }; ++ ++&srab { ++ status = "okay"; ++ ++ ports { ++ 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@5 { ++ reg = <5>; ++ label = "cpu"; ++ ethernet = <&gmac0>; ++ }; ++ }; ++}; +--- a/arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts ++++ b/arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts +@@ -86,3 +86,40 @@ + &usb3_phy { + status = "okay"; + }; ++ ++&srab { ++ status = "okay"; ++ ++ ports { ++ 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@5 { ++ reg = <5>; ++ label = "cpu"; ++ ethernet = <&gmac0>; ++ }; ++ }; ++}; +--- a/arch/arm/boot/dts/bcm47081-asus-rt-n18u.dts ++++ b/arch/arm/boot/dts/bcm47081-asus-rt-n18u.dts +@@ -77,3 +77,40 @@ + &usb3_phy { + status = "okay"; + }; ++ ++&srab { ++ status = "okay"; ++ ++ ports { ++ port@0 { ++ reg = <0>; ++ label = "wan"; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ label = "lan1"; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ label = "lan2"; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ label = "lan3"; ++ }; ++ ++ port@4 { ++ reg = <4>; ++ label = "lan4"; ++ }; ++ ++ port@5 { ++ reg = <5>; ++ label = "cpu"; ++ ethernet = <&gmac0>; ++ }; ++ }; ++}; +--- a/arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts ++++ b/arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts +@@ -68,6 +68,38 @@ + status = "okay"; + }; + ++&srab { ++ status = "okay"; ++ ++ ports { ++ port@0 { ++ reg = <0>; ++ label = "wan"; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ label = "lan1"; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ label = "lan2"; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ label = "lan3"; ++ }; ++ ++ port@7 { ++ reg = <7>; ++ label = "cpu"; ++ ethernet = <&gmac1>; ++ }; ++ }; ++}; ++ + &nandcs { + partitions { + compatible = "fixed-partitions"; +--- a/arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dts ++++ b/arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dts +@@ -132,3 +132,40 @@ + &usb3_phy { + status = "okay"; + }; ++ ++&srab { ++ status = "okay"; ++ ++ ports { ++ 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@5 { ++ reg = <5>; ++ label = "cpu"; ++ ethernet = <&gmac0>; ++ }; ++ }; ++}; +--- a/arch/arm/boot/dts/bcm4709-linksys-ea9200.dts ++++ b/arch/arm/boot/dts/bcm4709-linksys-ea9200.dts +@@ -49,3 +49,45 @@ + &usb3_phy { + status = "okay"; + }; ++ ++&srab { ++ status = "okay"; ++ ++ ports { ++ 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@8 { ++ reg = <8>; ++ label = "cpu"; ++ ethernet = <&gmac2>; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; ++ }; ++}; +--- a/arch/arm/boot/dts/bcm4709-netgear-r7000.dts ++++ b/arch/arm/boot/dts/bcm4709-netgear-r7000.dts +@@ -106,3 +106,40 @@ + &usb3_phy { + status = "okay"; + }; ++ ++&srab { ++ status = "okay"; ++ ++ ports { ++ port@0 { ++ reg = <0>; ++ label = "wan"; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ label = "lan1"; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ label = "lan2"; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ label = "lan3"; ++ }; ++ ++ port@4 { ++ reg = <4>; ++ label = "lan4"; ++ }; ++ ++ port@5 { ++ reg = <5>; ++ label = "cpu"; ++ ethernet = <&gmac0>; ++ }; ++ }; ++}; +--- a/arch/arm/boot/dts/bcm47094-netgear-r8500.dts ++++ b/arch/arm/boot/dts/bcm47094-netgear-r8500.dts +@@ -94,3 +94,45 @@ + &usb3_phy { + status = "okay"; + }; ++ ++&srab { ++ status = "okay"; ++ ++ ports { ++ port@0 { ++ reg = <0>; ++ label = "wan"; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ label = "lan1"; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ label = "lan2"; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ label = "lan3"; ++ }; ++ ++ port@4 { ++ reg = <4>; ++ label = "lan4"; ++ }; ++ ++ port@8 { ++ reg = <8>; ++ label = "cpu"; ++ ethernet = <&gmac2>; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; ++ }; ++}; +--- a/arch/arm/boot/dts/bcm47094-phicomm-k3.dts ++++ b/arch/arm/boot/dts/bcm47094-phicomm-k3.dts +@@ -38,6 +38,38 @@ + status = "okay"; + }; + ++&srab { ++ status = "okay"; ++ ++ ports { ++ port@0 { ++ reg = <0>; ++ label = "lan1"; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ label = "lan2"; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ label = "lan3"; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ label = "wan"; ++ }; ++ ++ port@5 { ++ reg = <5>; ++ label = "cpu"; ++ ethernet = <&gmac0>; ++ }; ++ }; ++}; ++ + &nandcs { + partitions { + compatible = "fixed-partitions"; From 494b889af8e374a33748a03404bb990faaa889f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 22 Sep 2021 22:01:10 +0200 Subject: [PATCH 033/137] bcm53xx: backport early DT patches queued for 5.16 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki (cherry picked from commit 366be2183e90b6ea8110d7236f8a93c8028573f8) --- ...SP-Add-bcm958623hr-board-name-to-dts.patch | 27 ++ ...-ARM-dts-NSP-Fix-MDIO-mux-node-names.patch | 47 ++++ ...s-NSP-Fix-MX64-MX65-eeprom-node-name.patch | 28 ++ ...M-dts-NSP-Fix-MX65-MDIO-mux-warnings.patch | 52 ++++ ...Specify-switch-ports-for-more-devic.patch} | 7 +- ...-Describe-on-SoC-BCM53125-rev-4-swit.patch | 44 ++++ ...-BCM53573-Add-Tenda-AC9-switch-ports.patch | 59 +++++ ...Specify-switch-ports-for-Meraki-MR32.patch | 57 +++++ ...3016-MR32-get-mac-address-from-nvmem.patch | 41 +++ ...ts-BCM5301X-Add-DT-for-Asus-RT-AC88U.patch | 242 ++++++++++++++++++ ...RM-BCM5301X-Add-DT-for-Netgear-R7900.patch | 2 +- 11 files changed, 602 insertions(+), 4 deletions(-) create mode 100644 target/linux/bcm53xx/patches-5.4/037-v5.16-0013-ARM-dts-NSP-Add-bcm958623hr-board-name-to-dts.patch create mode 100644 target/linux/bcm53xx/patches-5.4/037-v5.16-0015-ARM-dts-NSP-Fix-MDIO-mux-node-names.patch create mode 100644 target/linux/bcm53xx/patches-5.4/037-v5.16-0016-ARM-dts-NSP-Fix-MX64-MX65-eeprom-node-name.patch create mode 100644 target/linux/bcm53xx/patches-5.4/037-v5.16-0017-ARM-dts-NSP-Fix-MX65-MDIO-mux-warnings.patch rename target/linux/bcm53xx/patches-5.4/{130-ARM-dts-BCM5301X-Specify-switch-ports-for-more-devic.patch => 037-v5.16-0018-ARM-dts-BCM5301X-Specify-switch-ports-for-more-devic.patch} (94%) create mode 100644 target/linux/bcm53xx/patches-5.4/037-v5.16-0019-ARM-dts-BCM53573-Describe-on-SoC-BCM53125-rev-4-swit.patch create mode 100644 target/linux/bcm53xx/patches-5.4/037-v5.16-0020-ARM-dts-BCM53573-Add-Tenda-AC9-switch-ports.patch create mode 100644 target/linux/bcm53xx/patches-5.4/037-v5.16-0021-ARM-BCM53016-Specify-switch-ports-for-Meraki-MR32.patch create mode 100644 target/linux/bcm53xx/patches-5.4/037-v5.16-0022-ARM-BCM53016-MR32-get-mac-address-from-nvmem.patch create mode 100644 target/linux/bcm53xx/patches-5.4/037-v5.16-0023-ARM-dts-BCM5301X-Add-DT-for-Asus-RT-AC88U.patch diff --git a/target/linux/bcm53xx/patches-5.4/037-v5.16-0013-ARM-dts-NSP-Add-bcm958623hr-board-name-to-dts.patch b/target/linux/bcm53xx/patches-5.4/037-v5.16-0013-ARM-dts-NSP-Add-bcm958623hr-board-name-to-dts.patch new file mode 100644 index 0000000000..c5f28474e3 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/037-v5.16-0013-ARM-dts-NSP-Add-bcm958623hr-board-name-to-dts.patch @@ -0,0 +1,27 @@ +From 695717eb4c61173d05a277e37132b5e2c6531bf1 Mon Sep 17 00:00:00 2001 +From: Matthew Hagan +Date: Sun, 29 Aug 2021 22:37:47 +0000 +Subject: [PATCH] ARM: dts: NSP: Add bcm958623hr board name to dts + +This board was previously added to +Documentation/devicetree/bindings/arm/bcm/brcm,nsp.yaml +however the dts file was not updated to reflect this change. This patch +corrects bcm958623hr.dts by adding the board name to the compatible. + +Signed-off-by: Matthew Hagan +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm958623hr.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/bcm958623hr.dts ++++ b/arch/arm/boot/dts/bcm958623hr.dts +@@ -37,7 +37,7 @@ + + / { + model = "NorthStar Plus SVK (BCM958623HR)"; +- compatible = "brcm,bcm58623", "brcm,nsp"; ++ compatible = "brcm,bcm958623hr", "brcm,bcm58623", "brcm,nsp"; + + chosen { + stdout-path = "serial0:115200n8"; diff --git a/target/linux/bcm53xx/patches-5.4/037-v5.16-0015-ARM-dts-NSP-Fix-MDIO-mux-node-names.patch b/target/linux/bcm53xx/patches-5.4/037-v5.16-0015-ARM-dts-NSP-Fix-MDIO-mux-node-names.patch new file mode 100644 index 0000000000..0d9311114f --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/037-v5.16-0015-ARM-dts-NSP-Fix-MDIO-mux-node-names.patch @@ -0,0 +1,47 @@ +From 38f8111369f318a538e9d4d89d8e48030c22fb40 Mon Sep 17 00:00:00 2001 +From: Matthew Hagan +Date: Sun, 29 Aug 2021 22:37:49 +0000 +Subject: [PATCH] ARM: dts: NSP: Fix MDIO mux node names + +While functional, the mdio-mux-mmioreg binding does not conform to +Documentation/devicetree/bindings/net/mdio-mux-mmioreg.yaml in that an +mdio-mux compatible is also required. Without this the following output +is observed when running dtbs_check: + +mdio-mux@32000: compatible: ['mdio-mux-mmioreg'] is too short + +This change brings conformance to this requirement and corresponds +likewise to Rafal Milecki's change to the BCM5301x platform[1]. + +[1] https://lore.kernel.org/linux-arm-kernel/20210822191256.3715003-1-f.fainelli@gmail.com/T/ + +Signed-off-by: Matthew Hagan +Reviewed-by: Andrew Lunn +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm-nsp.dtsi | 2 +- + arch/arm/boot/dts/bcm958625-meraki-alamo.dtsi | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/arm/boot/dts/bcm-nsp.dtsi ++++ b/arch/arm/boot/dts/bcm-nsp.dtsi +@@ -369,7 +369,7 @@ + }; + + mdio-mux@32000 { +- compatible = "mdio-mux-mmioreg"; ++ compatible = "mdio-mux-mmioreg", "mdio-mux"; + reg = <0x32000 0x4>; + mux-mask = <0x200>; + #address-cells = <1>; +--- a/arch/arm/boot/dts/bcm958625-meraki-alamo.dtsi ++++ b/arch/arm/boot/dts/bcm958625-meraki-alamo.dtsi +@@ -72,7 +72,7 @@ + }; + + mdio-mii-mux { +- compatible = "mdio-mux-mmioreg"; ++ compatible = "mdio-mux-mmioreg", "mdio-mux"; + reg = <0x1803f1c0 0x4>; + mux-mask = <0x2000>; + mdio-parent-bus = <&mdio_ext>; diff --git a/target/linux/bcm53xx/patches-5.4/037-v5.16-0016-ARM-dts-NSP-Fix-MX64-MX65-eeprom-node-name.patch b/target/linux/bcm53xx/patches-5.4/037-v5.16-0016-ARM-dts-NSP-Fix-MX64-MX65-eeprom-node-name.patch new file mode 100644 index 0000000000..4cffad1f4e --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/037-v5.16-0016-ARM-dts-NSP-Fix-MX64-MX65-eeprom-node-name.patch @@ -0,0 +1,28 @@ +From 56e4e548427240d85fd220460d0ab5987e1dec00 Mon Sep 17 00:00:00 2001 +From: Matthew Hagan +Date: Sun, 29 Aug 2021 22:37:50 +0000 +Subject: [PATCH] ARM: dts: NSP: Fix MX64/MX65 eeprom node name + +Running dtbs_check yields the following message when checking the +MX64/MX65 devicetree: +at24@50: $nodename:0: 'at24@50' does not match '^eeprom@[0-9a-f]{1,2}$' + +This patch fixes the issue by renaming the at24 node appropriately. + +Signed-off-by: Matthew Hagan +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm958625-meraki-mx6x-common.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/bcm958625-meraki-mx6x-common.dtsi ++++ b/arch/arm/boot/dts/bcm958625-meraki-mx6x-common.dtsi +@@ -48,7 +48,7 @@ + &i2c0 { + status = "okay"; + +- at24@50 { ++ eeprom@50 { + compatible = "atmel,24c64"; + reg = <0x50>; + pagesize = <32>; diff --git a/target/linux/bcm53xx/patches-5.4/037-v5.16-0017-ARM-dts-NSP-Fix-MX65-MDIO-mux-warnings.patch b/target/linux/bcm53xx/patches-5.4/037-v5.16-0017-ARM-dts-NSP-Fix-MX65-MDIO-mux-warnings.patch new file mode 100644 index 0000000000..cad7388685 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/037-v5.16-0017-ARM-dts-NSP-Fix-MX65-MDIO-mux-warnings.patch @@ -0,0 +1,52 @@ +From f5fc9044e5d45a4d97b5240c8723f4677f647c9f Mon Sep 17 00:00:00 2001 +From: Matthew Hagan +Date: Sun, 29 Aug 2021 22:37:51 +0000 +Subject: [PATCH] ARM: dts: NSP: Fix MX65 MDIO mux warnings + +The naming of this node is based upon that of the initial EA9500 dts[1]. +However this does not conform with the mdio-mux format, yielding the +following message when running dtbs_check: +mdio-mii-mux: $nodename:0: 'mdio-mii-mux' does not match '^mdio-mux[\\-@]?' + +Secondly, this node should be moved to within the axi node and given the +appropriate unit address. This also requires exposing the axi node via a +label in bcm-nsp.dtsi. This fixes the following warning: +Warning (unit_address_vs_reg): /mdio-mii-mux: node has a reg or ranges property, but no unit name + +[1]https://patchwork.ozlabs.org/project/linux-imx/patch/20180618174159.86150-1-npcomplete13@gmail.com/#1941353 + +Signed-off-by: Matthew Hagan +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm-nsp.dtsi | 2 +- + arch/arm/boot/dts/bcm958625-meraki-alamo.dtsi | 6 ++++-- + 2 files changed, 5 insertions(+), 3 deletions(-) + +--- a/arch/arm/boot/dts/bcm-nsp.dtsi ++++ b/arch/arm/boot/dts/bcm-nsp.dtsi +@@ -166,7 +166,7 @@ + }; + }; + +- axi@18000000 { ++ axi: axi@18000000 { + compatible = "simple-bus"; + ranges = <0x00000000 0x18000000 0x0011c40c>; + #address-cells = <1>; +--- a/arch/arm/boot/dts/bcm958625-meraki-alamo.dtsi ++++ b/arch/arm/boot/dts/bcm958625-meraki-alamo.dtsi +@@ -70,10 +70,12 @@ + gpios = <&gpioa 31 GPIO_ACTIVE_HIGH>; + }; + }; ++}; + +- mdio-mii-mux { ++&axi { ++ mdio-mux@3f1c0 { + compatible = "mdio-mux-mmioreg", "mdio-mux"; +- reg = <0x1803f1c0 0x4>; ++ reg = <0x3f1c0 0x4>; + mux-mask = <0x2000>; + mdio-parent-bus = <&mdio_ext>; + #address-cells = <1>; diff --git a/target/linux/bcm53xx/patches-5.4/130-ARM-dts-BCM5301X-Specify-switch-ports-for-more-devic.patch b/target/linux/bcm53xx/patches-5.4/037-v5.16-0018-ARM-dts-BCM5301X-Specify-switch-ports-for-more-devic.patch similarity index 94% rename from target/linux/bcm53xx/patches-5.4/130-ARM-dts-BCM5301X-Specify-switch-ports-for-more-devic.patch rename to target/linux/bcm53xx/patches-5.4/037-v5.16-0018-ARM-dts-BCM5301X-Specify-switch-ports-for-more-devic.patch index 211de34af7..b309771369 100644 --- a/target/linux/bcm53xx/patches-5.4/130-ARM-dts-BCM5301X-Specify-switch-ports-for-more-devic.patch +++ b/target/linux/bcm53xx/patches-5.4/037-v5.16-0018-ARM-dts-BCM5301X-Specify-switch-ports-for-more-devic.patch @@ -1,7 +1,7 @@ +From 225ffaf3d0e00daa2d0c7b68e8fd731ebbde3c03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 7 Sep 2021 07:51:17 +0200 -Subject: [PATCH next] ARM: dts: BCM5301X: Specify switch ports for more - devices +Date: Tue, 7 Sep 2021 08:00:48 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: Specify switch ports for more devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -10,6 +10,7 @@ Those are remaining models I have that didn't have ports yet. All tested. Signed-off-by: Rafał Miłecki +Signed-off-by: Florian Fainelli --- arch/arm/boot/dts/bcm4708-netgear-r6250.dts | 37 ++++++++++++++++ .../boot/dts/bcm47081-buffalo-wzr-600dhp2.dts | 37 ++++++++++++++++ diff --git a/target/linux/bcm53xx/patches-5.4/037-v5.16-0019-ARM-dts-BCM53573-Describe-on-SoC-BCM53125-rev-4-swit.patch b/target/linux/bcm53xx/patches-5.4/037-v5.16-0019-ARM-dts-BCM53573-Describe-on-SoC-BCM53125-rev-4-swit.patch new file mode 100644 index 0000000000..3a5438c228 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/037-v5.16-0019-ARM-dts-BCM53573-Describe-on-SoC-BCM53125-rev-4-swit.patch @@ -0,0 +1,44 @@ +From 9fb90ae6cae7f8fe4fbf626945f32cd9da2c3892 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 20 Sep 2021 16:10:23 +0200 +Subject: [PATCH] ARM: dts: BCM53573: Describe on-SoC BCM53125 rev 4 switch +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +BCM53573 family SoC have Ethernet switch connected to the first Ethernet +controller (accessible over MDIO). + +Signed-off-by: Rafał Miłecki +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm53573.dtsi | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +--- a/arch/arm/boot/dts/bcm53573.dtsi ++++ b/arch/arm/boot/dts/bcm53573.dtsi +@@ -180,6 +180,24 @@ + + gmac0: ethernet@5000 { + reg = <0x5000 0x1000>; ++ ++ mdio { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ switch: switch@1e { ++ compatible = "brcm,bcm53125"; ++ reg = <0x1e>; ++ ++ status = "disabled"; ++ ++ /* ports are defined in board DTS */ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ }; ++ }; ++ }; + }; + + gmac1: ethernet@b000 { diff --git a/target/linux/bcm53xx/patches-5.4/037-v5.16-0020-ARM-dts-BCM53573-Add-Tenda-AC9-switch-ports.patch b/target/linux/bcm53xx/patches-5.4/037-v5.16-0020-ARM-dts-BCM53573-Add-Tenda-AC9-switch-ports.patch new file mode 100644 index 0000000000..c6d995723c --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/037-v5.16-0020-ARM-dts-BCM53573-Add-Tenda-AC9-switch-ports.patch @@ -0,0 +1,59 @@ +From 64612828628cca6e3992e421f45c242dc6625647 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 20 Sep 2021 16:10:24 +0200 +Subject: [PATCH] ARM: dts: BCM53573: Add Tenda AC9 switch ports +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This router has 1 WAN and 4 LAN ports. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm47189-tenda-ac9.dts | 37 ++++++++++++++++++++++++ + 1 file changed, 37 insertions(+) + +--- a/arch/arm/boot/dts/bcm47189-tenda-ac9.dts ++++ b/arch/arm/boot/dts/bcm47189-tenda-ac9.dts +@@ -105,3 +105,40 @@ + }; + }; + }; ++ ++&switch { ++ status = "okay"; ++ ++ ports { ++ port@0 { ++ reg = <0>; ++ label = "wan"; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ label = "lan1"; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ label = "lan2"; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ label = "lan3"; ++ }; ++ ++ port@4 { ++ reg = <4>; ++ label = "lan4"; ++ }; ++ ++ port@5 { ++ reg = <5>; ++ label = "cpu"; ++ ethernet = <&gmac0>; ++ }; ++ }; ++}; diff --git a/target/linux/bcm53xx/patches-5.4/037-v5.16-0021-ARM-BCM53016-Specify-switch-ports-for-Meraki-MR32.patch b/target/linux/bcm53xx/patches-5.4/037-v5.16-0021-ARM-BCM53016-Specify-switch-ports-for-Meraki-MR32.patch new file mode 100644 index 0000000000..a65b1992ea --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/037-v5.16-0021-ARM-BCM53016-Specify-switch-ports-for-Meraki-MR32.patch @@ -0,0 +1,57 @@ +From 6abc4ca5a28070945e0d68cb4160b309bfbf4b8b Mon Sep 17 00:00:00 2001 +From: Christian Lamparter +Date: Sat, 18 Sep 2021 19:29:30 +0200 +Subject: [PATCH] ARM: BCM53016: Specify switch ports for Meraki MR32 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +the switch identifies itself as a BCM53012 (rev 5)... +This patch has been tested & verified on OpenWrt's +snapshot with Linux 5.10 (didn't test any older kernels). +The MR32 is able to "talk to the network" as before with +OpenWrt's SWITCHDEV b53 driver. + +| b53-srab-switch 18007000.ethernet-switch: found switch: BCM53012, rev 5 +| libphy: dsa slave smi: probed +| b53-srab-switch 18007000.ethernet-switch poe (uninitialized): +| PHY [dsa-0.0:00] driver [Generic PHY] (irq=POLL) +| b53-srab-switch 18007000.ethernet-switch: Using legacy PHYLIB callbacks. +| Please migrate to PHYLINK! +| DSA: tree 0 setup + +Reported-by: Rafał Miłecki +Signed-off-by: Christian Lamparter +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm53016-meraki-mr32.dts | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +--- a/arch/arm/boot/dts/bcm53016-meraki-mr32.dts ++++ b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts +@@ -195,3 +195,25 @@ + }; + }; + }; ++ ++&srab { ++ status = "okay"; ++ ++ ports { ++ port@0 { ++ reg = <0>; ++ label = "poe"; ++ }; ++ ++ port@5 { ++ reg = <5>; ++ label = "cpu"; ++ ethernet = <&gmac0>; ++ ++ fixed-link { ++ speed = <1000>; ++ duplex-full; ++ }; ++ }; ++ }; ++}; diff --git a/target/linux/bcm53xx/patches-5.4/037-v5.16-0022-ARM-BCM53016-MR32-get-mac-address-from-nvmem.patch b/target/linux/bcm53xx/patches-5.4/037-v5.16-0022-ARM-BCM53016-MR32-get-mac-address-from-nvmem.patch new file mode 100644 index 0000000000..70a18822a9 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/037-v5.16-0022-ARM-BCM53016-MR32-get-mac-address-from-nvmem.patch @@ -0,0 +1,41 @@ +From 477ffdbdf389cc91294d66e251cc6f856da5820c Mon Sep 17 00:00:00 2001 +From: Christian Lamparter +Date: Sat, 18 Sep 2021 19:29:31 +0200 +Subject: [PATCH] ARM: BCM53016: MR32: get mac-address from nvmem + +The MAC-Address of the MR32's sole ethernet port is +located in offset 0x66 of the attached AT24C64 eeprom. + +Signed-off-by: Christian Lamparter +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm53016-meraki-mr32.dts | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/arch/arm/boot/dts/bcm53016-meraki-mr32.dts ++++ b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts +@@ -110,6 +110,12 @@ + reg = <0x50>; + pagesize = <32>; + read-only; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ mac_address: mac-address@66 { ++ reg = <0x66 0x6>; ++ }; + }; + }; + }; +@@ -133,6 +139,11 @@ + */ + }; + ++&gmac0 { ++ nvmem-cell-names = "mac-address"; ++ nvmem-cells = <&mac_address>; ++}; ++ + &gmac1 { + status = "disabled"; + }; diff --git a/target/linux/bcm53xx/patches-5.4/037-v5.16-0023-ARM-dts-BCM5301X-Add-DT-for-Asus-RT-AC88U.patch b/target/linux/bcm53xx/patches-5.4/037-v5.16-0023-ARM-dts-BCM5301X-Add-DT-for-Asus-RT-AC88U.patch new file mode 100644 index 0000000000..6fc447b602 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/037-v5.16-0023-ARM-dts-BCM5301X-Add-DT-for-Asus-RT-AC88U.patch @@ -0,0 +1,242 @@ +From beff77b93452cd2057c859694709dd34a181488f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= +Date: Tue, 21 Sep 2021 20:19:01 +0800 +Subject: [PATCH] ARM: dts: BCM5301X: Add DT for Asus RT-AC88U +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Hardware Info +------------- + +Processor - Broadcom BCM4709C0KFEBG dual-core @ 1.4 GHz +Switch - BCM53012 in BCM4709C0KFEBG & external RTL8365MB +DDR3 RAM - 512 MB +Flash - 128 MB (ESMT F59L1G81LA-25T) +2.4GHz - BCM4366 4×4 2.4/5G single chip 802.11ac SoC +5GHz - BCM4366 4×4 2.4/5G single chip 802.11ac SoC +Ports - 8 Ports, 1 WAN Ports + +Tested on OpenWrt on kernel 5.10 built with DSA driver. + +Signed-off-by: Arınç ÜNAL +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/Makefile | 1 + + arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts | 200 +++++++++++++++++++ + 2 files changed, 201 insertions(+) + create mode 100644 arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts + +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -108,6 +108,7 @@ dtb-$(CONFIG_ARCH_BCM_5301X) += \ + bcm4709-netgear-r7000.dtb \ + bcm4709-netgear-r8000.dtb \ + bcm4709-tplink-archer-c9-v1.dtb \ ++ bcm47094-asus-rt-ac88u.dtb \ + bcm47094-dlink-dir-885l.dtb \ + bcm47094-linksys-panamera.dtb \ + bcm47094-luxul-abr-4500.dtb \ +--- /dev/null ++++ b/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts +@@ -0,0 +1,200 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++/* ++ * Copyright (C) 2021 Arınç ÜNAL ++ */ ++ ++/dts-v1/; ++ ++#include "bcm47094.dtsi" ++#include "bcm5301x-nand-cs0-bch8.dtsi" ++ ++/ { ++ compatible = "asus,rt-ac88u", "brcm,bcm47094", "brcm,bcm4708"; ++ model = "Asus RT-AC88U"; ++ ++ chosen { ++ bootargs = "earlycon"; ++ }; ++ ++ memory@0 { ++ device_type = "memory"; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x18000000>; ++ }; ++ ++ nvram@1c080000 { ++ compatible = "brcm,nvram"; ++ reg = <0x1c080000 0x00180000>; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ power { ++ label = "white:power"; ++ gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>; ++ linux,default-trigger = "default-on"; ++ }; ++ ++ wan-red { ++ label = "red:wan"; ++ gpios = <&chipcommon 5 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ lan { ++ label = "white:lan"; ++ gpios = <&chipcommon 21 GPIO_ACTIVE_LOW>; ++ }; ++ ++ usb2 { ++ label = "white:usb2"; ++ gpios = <&chipcommon 16 GPIO_ACTIVE_LOW>; ++ trigger-sources = <&ehci_port2>; ++ linux,default-trigger = "usbport"; ++ }; ++ ++ usb3 { ++ label = "white:usb3"; ++ gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; ++ trigger-sources = <&ehci_port1>, <&xhci_port1>; ++ linux,default-trigger = "usbport"; ++ }; ++ ++ wps { ++ label = "white:wps"; ++ gpios = <&chipcommon 19 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ wps { ++ label = "WPS"; ++ linux,code = ; ++ gpios = <&chipcommon 20 GPIO_ACTIVE_LOW>; ++ }; ++ ++ reset { ++ label = "Reset"; ++ linux,code = ; ++ gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; ++ }; ++ ++ wifi { ++ label = "Wi-Fi"; ++ linux,code = ; ++ gpios = <&chipcommon 18 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led { ++ label = "Backlight"; ++ linux,code = ; ++ gpios = <&chipcommon 4 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++&srab { ++ compatible = "brcm,bcm53012-srab", "brcm,bcm5301x-srab"; ++ status = "okay"; ++ dsa,member = <0 0>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ port@0 { ++ reg = <0>; ++ label = "lan4"; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ label = "lan3"; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ label = "lan2"; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ label = "lan1"; ++ }; ++ ++ port@4 { ++ reg = <4>; ++ label = "wan"; ++ }; ++ ++ sw0_p5: port@5 { ++ reg = <5>; ++ label = "extsw"; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; ++ ++ port@7 { ++ reg = <7>; ++ ethernet = <&gmac1>; ++ label = "cpu"; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; ++ ++ port@8 { ++ reg = <8>; ++ ethernet = <&gmac2>; ++ label = "cpu"; ++ status = "disabled"; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; ++ }; ++}; ++ ++&usb2 { ++ vcc-gpio = <&chipcommon 9 GPIO_ACTIVE_HIGH>; ++}; ++ ++&usb3_phy { ++ status = "okay"; ++}; ++ ++&nandcs { ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "boot"; ++ reg = <0x00000000 0x00080000>; ++ read-only; ++ }; ++ ++ partition@80000 { ++ label = "nvram"; ++ reg = <0x00080000 0x00180000>; ++ }; ++ ++ partition@200000 { ++ label = "firmware"; ++ reg = <0x00200000 0x07e00000>; ++ compatible = "brcm,trx"; ++ }; ++ }; ++}; diff --git a/target/linux/bcm53xx/patches-5.4/310-ARM-BCM5301X-Add-DT-for-Netgear-R7900.patch b/target/linux/bcm53xx/patches-5.4/310-ARM-BCM5301X-Add-DT-for-Netgear-R7900.patch index b0800e50ae..7c67605a88 100644 --- a/target/linux/bcm53xx/patches-5.4/310-ARM-BCM5301X-Add-DT-for-Netgear-R7900.patch +++ b/target/linux/bcm53xx/patches-5.4/310-ARM-BCM5301X-Add-DT-for-Netgear-R7900.patch @@ -16,7 +16,7 @@ Signed-off-by: Rafał Miłecki + bcm4709-netgear-r7900.dtb \ bcm4709-netgear-r8000.dtb \ bcm4709-tplink-archer-c9-v1.dtb \ - bcm47094-dlink-dir-885l.dtb \ + bcm47094-asus-rt-ac88u.dtb \ --- /dev/null +++ b/arch/arm/boot/dts/bcm4709-netgear-r7900.dts @@ -0,0 +1,42 @@ From 37d535129be0244c11a4f61ef6beb3eadd9dc161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Thu, 4 Nov 2021 07:00:21 +0100 Subject: [PATCH 034/137] bcm53xx: add first 5.17 DTS changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki (cherry picked from commit 1ee6d3d24e328e29fcf068e90953c760305462d4) --- ...-add-qca8k-falling-edge-PLL-properti.patch | 42 +++++++ ...-remove-unnecessary-address-size-cel.patch | 29 +++++ ...-define-RTL8365MB-switch-on-Asus-RT-.patch | 104 ++++++++++++++++++ 3 files changed, 175 insertions(+) create mode 100644 target/linux/bcm53xx/patches-5.4/038-v5.17-0001-ARM-dts-NSP-MX65-add-qca8k-falling-edge-PLL-properti.patch create mode 100644 target/linux/bcm53xx/patches-5.4/038-v5.17-0002-ARM-dts-BCM5301X-remove-unnecessary-address-size-cel.patch create mode 100644 target/linux/bcm53xx/patches-5.4/038-v5.17-0003-ARM-dts-BCM5301X-define-RTL8365MB-switch-on-Asus-RT-.patch diff --git a/target/linux/bcm53xx/patches-5.4/038-v5.17-0001-ARM-dts-NSP-MX65-add-qca8k-falling-edge-PLL-properti.patch b/target/linux/bcm53xx/patches-5.4/038-v5.17-0001-ARM-dts-NSP-MX65-add-qca8k-falling-edge-PLL-properti.patch new file mode 100644 index 0000000000..a0be1eda4d --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/038-v5.17-0001-ARM-dts-NSP-MX65-add-qca8k-falling-edge-PLL-properti.patch @@ -0,0 +1,42 @@ +From 58d3d07985c1adab31a3ed76360d016bb1c5b358 Mon Sep 17 00:00:00 2001 +From: Matthew Hagan +Date: Fri, 15 Oct 2021 23:50:22 +0100 +Subject: [PATCH] ARM: dts: NSP: MX65: add qca8k falling-edge, PLL properties + +This patch enables two properties for the QCA8337 switches on the MX65. + +Set the SGMII transmit clock to falling edge +"qca,sgmii-txclk-falling-edge" to conform to the OEM configuration [1]. + +The new explicit PLL enable option "qca,sgmii-enable-pll" is required +[2]. + +[1] https://git.kernel.org/netdev/net-next/c/6c43809bf1be +[2] https://git.kernel.org/netdev/net-next/c/bbc4799e8bb6 + +Signed-off-by: Matthew Hagan +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm958625-meraki-alamo.dtsi | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/arch/arm/boot/dts/bcm958625-meraki-alamo.dtsi ++++ b/arch/arm/boot/dts/bcm958625-meraki-alamo.dtsi +@@ -118,6 +118,8 @@ + reg = <0>; + ethernet = <&sgmii1>; + phy-mode = "sgmii"; ++ qca,sgmii-enable-pll; ++ qca,sgmii-txclk-falling-edge; + fixed-link { + speed = <1000>; + full-duplex; +@@ -194,6 +196,8 @@ + reg = <0>; + ethernet = <&sgmii0>; + phy-mode = "sgmii"; ++ qca,sgmii-enable-pll; ++ qca,sgmii-txclk-falling-edge; + fixed-link { + speed = <1000>; + full-duplex; diff --git a/target/linux/bcm53xx/patches-5.4/038-v5.17-0002-ARM-dts-BCM5301X-remove-unnecessary-address-size-cel.patch b/target/linux/bcm53xx/patches-5.4/038-v5.17-0002-ARM-dts-BCM5301X-remove-unnecessary-address-size-cel.patch new file mode 100644 index 0000000000..3c3725adec --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/038-v5.17-0002-ARM-dts-BCM5301X-remove-unnecessary-address-size-cel.patch @@ -0,0 +1,29 @@ +From 835992e7eca4b29a87c204cefff2f7863fd087f3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= +Date: Wed, 27 Oct 2021 00:57:03 +0800 +Subject: [PATCH] ARM: dts: BCM5301X: remove unnecessary address & size cells + from Asus RT-AC88U +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Remove the unnecessary #address-cells & #size-cells in the gpio-keys node +from the device tree of Asus RT-AC88U. + +Signed-off-by: Arınç ÜNAL +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts | 2 -- + 1 file changed, 2 deletions(-) + +--- a/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts ++++ b/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts +@@ -68,8 +68,6 @@ + + gpio-keys { + compatible = "gpio-keys"; +- #address-cells = <1>; +- #size-cells = <0>; + + wps { + label = "WPS"; diff --git a/target/linux/bcm53xx/patches-5.4/038-v5.17-0003-ARM-dts-BCM5301X-define-RTL8365MB-switch-on-Asus-RT-.patch b/target/linux/bcm53xx/patches-5.4/038-v5.17-0003-ARM-dts-BCM5301X-define-RTL8365MB-switch-on-Asus-RT-.patch new file mode 100644 index 0000000000..562d5a22c7 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/038-v5.17-0003-ARM-dts-BCM5301X-define-RTL8365MB-switch-on-Asus-RT-.patch @@ -0,0 +1,104 @@ +From b6c99228c8edc5e67d8229ba1c5f76cce210ddfc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= +Date: Wed, 27 Oct 2021 00:57:06 +0800 +Subject: [PATCH] ARM: dts: BCM5301X: define RTL8365MB switch on Asus RT-AC88U +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Define the Realtek RTL8365MB switch without interrupt support on the device +tree of Asus RT-AC88U. + +Signed-off-by: Arınç ÜNAL +Acked-by: Alvin Šipraga +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts | 77 ++++++++++++++++++++ + 1 file changed, 77 insertions(+) + +--- a/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts ++++ b/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts +@@ -93,6 +93,83 @@ + gpios = <&chipcommon 4 GPIO_ACTIVE_LOW>; + }; + }; ++ ++ switch { ++ compatible = "realtek,rtl8365mb"; ++ /* 7 = MDIO (has input reads), 6 = MDC (clock, output only) */ ++ mdc-gpios = <&chipcommon 6 GPIO_ACTIVE_HIGH>; ++ mdio-gpios = <&chipcommon 7 GPIO_ACTIVE_HIGH>; ++ reset-gpios = <&chipcommon 10 GPIO_ACTIVE_LOW>; ++ realtek,disable-leds; ++ dsa,member = <1 0>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0>; ++ ++ port@0 { ++ reg = <0>; ++ label = "lan5"; ++ phy-handle = <ðphy0>; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ label = "lan6"; ++ phy-handle = <ðphy1>; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ label = "lan7"; ++ phy-handle = <ðphy2>; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ label = "lan8"; ++ phy-handle = <ðphy3>; ++ }; ++ ++ port@6 { ++ reg = <6>; ++ label = "cpu"; ++ ethernet = <&sw0_p5>; ++ phy-mode = "rgmii"; ++ tx-internal-delay-ps = <2000>; ++ rx-internal-delay-ps = <2000>; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ pause; ++ }; ++ }; ++ }; ++ ++ mdio { ++ compatible = "realtek,smi-mdio"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ ethphy0: ethernet-phy@0 { ++ reg = <0>; ++ }; ++ ++ ethphy1: ethernet-phy@1 { ++ reg = <1>; ++ }; ++ ++ ethphy2: ethernet-phy@2 { ++ reg = <2>; ++ }; ++ ++ ethphy3: ethernet-phy@3 { ++ reg = <3>; ++ }; ++ }; ++ }; + }; + + &srab { From 35e470ad0a4080f44f1be888bf552441df0f5d50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Thu, 18 Nov 2021 16:34:55 +0100 Subject: [PATCH 035/137] bcm53xx: use more upsteam DT patches from 5.16 / 5.17 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki (cherry picked from commit 5901917b936d93c8facda6dfec4c5d77f666cbac) --- ...2-convert-to-Broadcom-iProc-I2C-Driv.patch | 104 ++++++++++++++++++ ...CM5301X-update-CRU-block-description.patch | 60 ++++++++++ 2 files changed, 164 insertions(+) create mode 100644 target/linux/bcm53xx/patches-5.4/038-v5.17-0004-ARM-BCM53016-MR32-convert-to-Broadcom-iProc-I2C-Driv.patch create mode 100644 target/linux/bcm53xx/patches-5.4/038-v5.17-0005-ARM-dts-BCM5301X-update-CRU-block-description.patch diff --git a/target/linux/bcm53xx/patches-5.4/038-v5.17-0004-ARM-BCM53016-MR32-convert-to-Broadcom-iProc-I2C-Driv.patch b/target/linux/bcm53xx/patches-5.4/038-v5.17-0004-ARM-BCM53016-MR32-convert-to-Broadcom-iProc-I2C-Driv.patch new file mode 100644 index 0000000000..fae0f02cdf --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/038-v5.17-0004-ARM-BCM53016-MR32-convert-to-Broadcom-iProc-I2C-Driv.patch @@ -0,0 +1,104 @@ +From de7880016665afe7fa7d40e1fafa859260d53ba1 Mon Sep 17 00:00:00 2001 +From: Christian Lamparter +Date: Thu, 28 Oct 2021 09:03:44 +0200 +Subject: [PATCH] ARM: BCM53016: MR32: convert to Broadcom iProc I2C Driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +replaces the bit-banged i2c-gpio provided i2c functionality +with the hardware in the SoC. + +During review of the MR32, Florian Fainelli pointed out that the +SoC has a real I2C-controller. Furthermore, the connected pins +(SDA and SCL) would line up perfectly for use. Back then I couldn't +get it working though and I left it with i2c-gpio (which worked). + +Now we know the reason: the interrupt was incorrectly specified. +(Hence, this patch depends on Florian Fainelli's +"ARM: dts: BCM5301X: Fix I2C controller interrupt" patch). + +Cc: Florian Fainelli +Cc: Rafał Miłecki +Cc: Matthew Hagan +Signed-off-by: Christian Lamparter +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm53016-meraki-mr32.dts | 62 ++++++++++------------ + 1 file changed, 28 insertions(+), 34 deletions(-) + +--- a/arch/arm/boot/dts/bcm53016-meraki-mr32.dts ++++ b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts +@@ -84,40 +84,6 @@ + max-brightness = <255>; + }; + }; +- +- i2c { +- /* +- * The platform provided I2C does not budge. +- * This is a replacement until I can figure +- * out what are the missing bits... +- */ +- +- compatible = "i2c-gpio"; +- sda-gpios = <&chipcommon 5 GPIO_ACTIVE_HIGH>; +- scl-gpios = <&chipcommon 4 GPIO_ACTIVE_HIGH>; +- i2c-gpio,delay-us = <10>; /* close to 100 kHz */ +- #address-cells = <1>; +- #size-cells = <0>; +- +- current_sense: ina219@45 { +- compatible = "ti,ina219"; +- reg = <0x45>; +- shunt-resistor = <60000>; /* = 60 mOhms */ +- }; +- +- eeprom: eeprom@50 { +- compatible = "atmel,24c64"; +- reg = <0x50>; +- pagesize = <32>; +- read-only; +- #address-cells = <1>; +- #size-cells = <1>; +- +- mac_address: mac-address@66 { +- reg = <0x66 0x6>; +- }; +- }; +- }; + }; + + &uart0 { +@@ -228,3 +194,31 @@ + }; + }; + }; ++ ++&i2c0 { ++ status = "okay"; ++ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinmux_i2c>; ++ ++ clock-frequency = <100000>; ++ ++ current_sense: ina219@45 { ++ compatible = "ti,ina219"; ++ reg = <0x45>; ++ shunt-resistor = <60000>; /* = 60 mOhms */ ++ }; ++ ++ eeprom: eeprom@50 { ++ compatible = "atmel,24c64"; ++ reg = <0x50>; ++ pagesize = <32>; ++ read-only; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ mac_address: mac-address@66 { ++ reg = <0x66 0x6>; ++ }; ++ }; ++}; diff --git a/target/linux/bcm53xx/patches-5.4/038-v5.17-0005-ARM-dts-BCM5301X-update-CRU-block-description.patch b/target/linux/bcm53xx/patches-5.4/038-v5.17-0005-ARM-dts-BCM5301X-update-CRU-block-description.patch new file mode 100644 index 0000000000..0a817e8fd1 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/038-v5.17-0005-ARM-dts-BCM5301X-update-CRU-block-description.patch @@ -0,0 +1,60 @@ +From 31fd9b79dc580301c53a001482755ba7e88c2809 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 29 Oct 2021 18:05:23 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: update CRU block description +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This describes CRU in a way matching documentation and fixes: + +arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dt.yaml: cru@100: $nodename:0: 'cru@100' does not match '^([a-z][a-z0-9\\-]+-bus|bus|soc|axi|ahb|apb)(@[0-9a-f]+)?$' + From schema: /lib/python3.6/site-packages/dtschema/schemas/simple-bus.yaml + +Signed-off-by: Rafał Miłecki +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm5301x.dtsi | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +--- a/arch/arm/boot/dts/bcm5301x.dtsi ++++ b/arch/arm/boot/dts/bcm5301x.dtsi +@@ -423,14 +423,14 @@ + #address-cells = <1>; + #size-cells = <1>; + +- cru@100 { +- compatible = "simple-bus"; ++ cru-bus@100 { ++ compatible = "brcm,ns-cru", "simple-mfd"; + reg = <0x100 0x1a4>; + ranges; + #address-cells = <1>; + #size-cells = <1>; + +- lcpll0: lcpll0@100 { ++ lcpll0: clock-controller@100 { + #clock-cells = <1>; + compatible = "brcm,nsp-lcpll0"; + reg = <0x100 0x14>; +@@ -439,7 +439,7 @@ + "sdio", "ddr_phy"; + }; + +- genpll: genpll@140 { ++ genpll: clock-controller@140 { + #clock-cells = <1>; + compatible = "brcm,nsp-genpll"; + reg = <0x140 0x24>; +@@ -450,6 +450,11 @@ + "sata1", "sata2"; + }; + ++ syscon@180 { ++ compatible = "brcm,cru-clkset", "syscon"; ++ reg = <0x180 0x4>; ++ }; ++ + pinctrl: pin-controller@1c0 { + compatible = "brcm,bcm4708-pinmux"; + reg = <0x1c0 0x24>; From d0748065daec4d95d7d8fa908d4c7c0c72853731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Tue, 23 Nov 2021 10:14:22 +0100 Subject: [PATCH 036/137] bcm53xx: use new USB 2.0 PHY binding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes: [ 10.440495] bcm_ns_usb2 1800c000.usb2-phy: can't request region for resource [mem 0x1800c000-0x1800cfff] [ 10.450039] bcm_ns_usb2 1800c000.usb2-phy: Failed to map DMU regs [ 10.456183] bcm_ns_usb2: probe of 1800c000.usb2-phy failed with error -16 caused by conflict in allocating resources. Fixes: 44ce70f0e209c ("bcm53xx: drop downstream patch that now breaks pinctrl driver") Signed-off-by: Rafał Miłecki (cherry picked from commit 1d7c1a41987ae463700224c08a3629e4086a8f39) --- ...support-updated-DT-binding-with-PHY-.patch | 131 ++++++++++++++++++ ...-use-non-deprecated-USB-2.0-PHY-bind.patch | 52 +++++++ 2 files changed, 183 insertions(+) create mode 100644 target/linux/bcm53xx/patches-5.4/070-v5.17-phy-bcm-ns-usb2-support-updated-DT-binding-with-PHY-.patch create mode 100644 target/linux/bcm53xx/patches-5.4/130-ARM-dts-BCM5301X-use-non-deprecated-USB-2.0-PHY-bind.patch diff --git a/target/linux/bcm53xx/patches-5.4/070-v5.17-phy-bcm-ns-usb2-support-updated-DT-binding-with-PHY-.patch b/target/linux/bcm53xx/patches-5.4/070-v5.17-phy-bcm-ns-usb2-support-updated-DT-binding-with-PHY-.patch new file mode 100644 index 0000000000..464849bc69 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/070-v5.17-phy-bcm-ns-usb2-support-updated-DT-binding-with-PHY-.patch @@ -0,0 +1,131 @@ +From d3bc6269e21fc474763708e79c7a118740befb94 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 26 Oct 2021 11:37:16 +0200 +Subject: [PATCH] phy: bcm-ns-usb2: support updated DT binding with PHY reg + space +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Updated DT binding maps just a PHY's register space instead of the whole +DMU block. Accessing a common CRU reg is handled using syscon & +regmap. + +The old binding has been deprecated and remains supported as a fallback +method. + +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20211026093716.5567-1-zajec5@gmail.com +Signed-off-by: Vinod Koul +--- + drivers/phy/broadcom/phy-bcm-ns-usb2.c | 52 +++++++++++++++++++++----- + 1 file changed, 43 insertions(+), 9 deletions(-) + +--- a/drivers/phy/broadcom/phy-bcm-ns-usb2.c ++++ b/drivers/phy/broadcom/phy-bcm-ns-usb2.c +@@ -9,17 +9,23 @@ + #include + #include + #include ++#include + #include + #include + #include + #include + #include ++#include + #include + + struct bcm_ns_usb2 { + struct device *dev; + struct clk *ref_clk; + struct phy *phy; ++ struct regmap *clkset; ++ void __iomem *base; ++ ++ /* Deprecated binding */ + void __iomem *dmu; + }; + +@@ -27,7 +33,6 @@ static int bcm_ns_usb2_phy_init(struct p + { + struct bcm_ns_usb2 *usb2 = phy_get_drvdata(phy); + struct device *dev = usb2->dev; +- void __iomem *dmu = usb2->dmu; + u32 ref_clk_rate, usb2ctl, usb_pll_ndiv, usb_pll_pdiv; + int err = 0; + +@@ -44,7 +49,10 @@ static int bcm_ns_usb2_phy_init(struct p + goto err_clk_off; + } + +- usb2ctl = readl(dmu + BCMA_DMU_CRU_USB2_CONTROL); ++ if (usb2->base) ++ usb2ctl = readl(usb2->base); ++ else ++ usb2ctl = readl(usb2->dmu + BCMA_DMU_CRU_USB2_CONTROL); + + if (usb2ctl & BCMA_DMU_CRU_USB2_CONTROL_USB_PLL_PDIV_MASK) { + usb_pll_pdiv = usb2ctl; +@@ -58,15 +66,24 @@ static int bcm_ns_usb2_phy_init(struct p + usb_pll_ndiv = (1920000000 * usb_pll_pdiv) / ref_clk_rate; + + /* Unlock DMU PLL settings with some magic value */ +- writel(0x0000ea68, dmu + BCMA_DMU_CRU_CLKSET_KEY); ++ if (usb2->clkset) ++ regmap_write(usb2->clkset, 0, 0x0000ea68); ++ else ++ writel(0x0000ea68, usb2->dmu + BCMA_DMU_CRU_CLKSET_KEY); + + /* Write USB 2.0 PLL control setting */ + usb2ctl &= ~BCMA_DMU_CRU_USB2_CONTROL_USB_PLL_NDIV_MASK; + usb2ctl |= usb_pll_ndiv << BCMA_DMU_CRU_USB2_CONTROL_USB_PLL_NDIV_SHIFT; +- writel(usb2ctl, dmu + BCMA_DMU_CRU_USB2_CONTROL); ++ if (usb2->base) ++ writel(usb2ctl, usb2->base); ++ else ++ writel(usb2ctl, usb2->dmu + BCMA_DMU_CRU_USB2_CONTROL); + + /* Lock DMU PLL settings */ +- writel(0x00000000, dmu + BCMA_DMU_CRU_CLKSET_KEY); ++ if (usb2->clkset) ++ regmap_write(usb2->clkset, 0, 0x00000000); ++ else ++ writel(0x00000000, usb2->dmu + BCMA_DMU_CRU_CLKSET_KEY); + + err_clk_off: + clk_disable_unprepare(usb2->ref_clk); +@@ -91,11 +108,28 @@ static int bcm_ns_usb2_probe(struct plat + return -ENOMEM; + usb2->dev = dev; + +- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dmu"); +- usb2->dmu = devm_ioremap_resource(dev, res); +- if (IS_ERR(usb2->dmu)) { +- dev_err(dev, "Failed to map DMU regs\n"); +- return PTR_ERR(usb2->dmu); ++ if (of_find_property(dev->of_node, "brcm,syscon-clkset", NULL)) { ++ usb2->base = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(usb2->base)) { ++ dev_err(dev, "Failed to map control reg\n"); ++ return PTR_ERR(usb2->base); ++ } ++ ++ usb2->clkset = syscon_regmap_lookup_by_phandle(dev->of_node, ++ "brcm,syscon-clkset"); ++ if (IS_ERR(usb2->clkset)) { ++ dev_err(dev, "Failed to lookup clkset regmap\n"); ++ return PTR_ERR(usb2->clkset); ++ } ++ } else { ++ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dmu"); ++ usb2->dmu = devm_ioremap_resource(dev, res); ++ if (IS_ERR(usb2->dmu)) { ++ dev_err(dev, "Failed to map DMU regs\n"); ++ return PTR_ERR(usb2->dmu); ++ } ++ ++ dev_warn(dev, "using deprecated DT binding\n"); + } + + usb2->ref_clk = devm_clk_get(dev, "phy-ref-clk"); diff --git a/target/linux/bcm53xx/patches-5.4/130-ARM-dts-BCM5301X-use-non-deprecated-USB-2.0-PHY-bind.patch b/target/linux/bcm53xx/patches-5.4/130-ARM-dts-BCM5301X-use-non-deprecated-USB-2.0-PHY-bind.patch new file mode 100644 index 0000000000..e50bcd9f25 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/130-ARM-dts-BCM5301X-use-non-deprecated-USB-2.0-PHY-bind.patch @@ -0,0 +1,52 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 23 Nov 2021 09:55:06 +0100 +Subject: [PATCH] ARM: dts: BCM5301X: use non-deprecated USB 2.0 PHY binding +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The new binding covers a single reg and uses syscon to reference shared +register. + +References: 55b9b741712d ("dt-bindings: phy: brcm,ns-usb2-phy: bind just a PHY block") +Signed-off-by: Rafał Miłecki +--- + arch/arm/boot/dts/bcm5301x.dtsi | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +--- a/arch/arm/boot/dts/bcm5301x.dtsi ++++ b/arch/arm/boot/dts/bcm5301x.dtsi +@@ -148,15 +148,6 @@ + }; + }; + +- usb2_phy: usb2-phy@1800c000 { +- compatible = "brcm,ns-usb2-phy"; +- reg = <0x1800c000 0x1000>; +- reg-names = "dmu"; +- #phy-cells = <0>; +- clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>; +- clock-names = "phy-ref-clk"; +- }; +- + axi@18000000 { + compatible = "brcm,bus-axi"; + reg = <0x18000000 0x1000>; +@@ -450,7 +441,16 @@ + "sata1", "sata2"; + }; + +- syscon@180 { ++ usb2_phy: phy@164 { ++ compatible = "brcm,ns-usb2-phy"; ++ reg = <0x164 0x4>; ++ brcm,syscon-clkset = <&cru_clkset>; ++ clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>; ++ clock-names = "phy-ref-clk"; ++ #phy-cells = <0>; ++ }; ++ ++ cru_clkset: syscon@180 { + compatible = "brcm,cru-clkset", "syscon"; + reg = <0x180 0x4>; + }; From 93ebd966fee4e459d2ddd897cf6d03b2afdad32d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 30 Mar 2022 16:05:55 +0200 Subject: [PATCH 037/137] bcm53xx: backport DT changes from 5.17 & 5.18 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki (cherry picked from commit a721fb9f839b3ca71da275a1c99620ef9342fb28) --- ...use-non-deprecated-USB-2.0-PHY-bind.patch} | 4 +- ...ts-NSP-Fixed-iProc-PCIe-MSI-sub-node.patch | 42 +++++++ ...08-ARM-dts-NSP-Rename-SATA-unit-name.patch | 25 ++++ ...-correct-RX-delay-and-enable-flow-co.patch | 45 ++++++++ ...CM5301X-define-RTL8365MB-switch-on-A.patch | 109 ++++++++++++++++++ ...-define-RTL8365MB-switch-on-Asus-RT-.patch | 103 +++++++++++++++++ ...NSP-MX6X-get-mac-address-from-eeprom.patch | 40 +++++++ ...-NSP-MX6X-correct-LED-function-types.patch | 62 ++++++++++ ...-Add-Ethernet-MAC-address-to-Luxul-X.patch | 42 +++++++ 9 files changed, 471 insertions(+), 1 deletion(-) rename target/linux/bcm53xx/patches-5.4/{130-ARM-dts-BCM5301X-use-non-deprecated-USB-2.0-PHY-bind.patch => 038-v5.17-0006-ARM-dts-BCM5301X-use-non-deprecated-USB-2.0-PHY-bind.patch} (89%) create mode 100644 target/linux/bcm53xx/patches-5.4/038-v5.17-0007-ARM-dts-NSP-Fixed-iProc-PCIe-MSI-sub-node.patch create mode 100644 target/linux/bcm53xx/patches-5.4/038-v5.17-0008-ARM-dts-NSP-Rename-SATA-unit-name.patch create mode 100644 target/linux/bcm53xx/patches-5.4/038-v5.17-0009-ARM-dts-BCM5301X-correct-RX-delay-and-enable-flow-co.patch create mode 100644 target/linux/bcm53xx/patches-5.4/038-v5.17-0010-Revert-ARM-dts-BCM5301X-define-RTL8365MB-switch-on-A.patch create mode 100644 target/linux/bcm53xx/patches-5.4/039-v5.18-0001-ARM-dts-BCM5301X-define-RTL8365MB-switch-on-Asus-RT-.patch create mode 100644 target/linux/bcm53xx/patches-5.4/039-v5.18-0002-ARM-dts-NSP-MX6X-get-mac-address-from-eeprom.patch create mode 100644 target/linux/bcm53xx/patches-5.4/039-v5.18-0003-ARM-dts-NSP-MX6X-correct-LED-function-types.patch create mode 100644 target/linux/bcm53xx/patches-5.4/039-v5.18-0004-ARM-dts-BCM5301X-Add-Ethernet-MAC-address-to-Luxul-X.patch diff --git a/target/linux/bcm53xx/patches-5.4/130-ARM-dts-BCM5301X-use-non-deprecated-USB-2.0-PHY-bind.patch b/target/linux/bcm53xx/patches-5.4/038-v5.17-0006-ARM-dts-BCM5301X-use-non-deprecated-USB-2.0-PHY-bind.patch similarity index 89% rename from target/linux/bcm53xx/patches-5.4/130-ARM-dts-BCM5301X-use-non-deprecated-USB-2.0-PHY-bind.patch rename to target/linux/bcm53xx/patches-5.4/038-v5.17-0006-ARM-dts-BCM5301X-use-non-deprecated-USB-2.0-PHY-bind.patch index e50bcd9f25..e01927bedf 100644 --- a/target/linux/bcm53xx/patches-5.4/130-ARM-dts-BCM5301X-use-non-deprecated-USB-2.0-PHY-bind.patch +++ b/target/linux/bcm53xx/patches-5.4/038-v5.17-0006-ARM-dts-BCM5301X-use-non-deprecated-USB-2.0-PHY-bind.patch @@ -1,5 +1,6 @@ +From 1a46061a2a4130a08841941ce6dcaa32be2ce312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 23 Nov 2021 09:55:06 +0100 +Date: Tue, 23 Nov 2021 10:03:33 +0100 Subject: [PATCH] ARM: dts: BCM5301X: use non-deprecated USB 2.0 PHY binding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -10,6 +11,7 @@ register. References: 55b9b741712d ("dt-bindings: phy: brcm,ns-usb2-phy: bind just a PHY block") Signed-off-by: Rafał Miłecki +Signed-off-by: Florian Fainelli --- arch/arm/boot/dts/bcm5301x.dtsi | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/target/linux/bcm53xx/patches-5.4/038-v5.17-0007-ARM-dts-NSP-Fixed-iProc-PCIe-MSI-sub-node.patch b/target/linux/bcm53xx/patches-5.4/038-v5.17-0007-ARM-dts-NSP-Fixed-iProc-PCIe-MSI-sub-node.patch new file mode 100644 index 0000000000..730b989808 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/038-v5.17-0007-ARM-dts-NSP-Fixed-iProc-PCIe-MSI-sub-node.patch @@ -0,0 +1,42 @@ +From 69c4e53bdd055ecc27761f6971a50c631ff9072e Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Thu, 2 Dec 2021 15:16:27 -0800 +Subject: [PATCH] ARM: dts: NSP: Fixed iProc PCIe MSI sub-node + +Rename the msi controller unit name to 'msi' to avoid collisions with +the 'msi-controller' boolean property. + +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm-nsp.dtsi | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/arch/arm/boot/dts/bcm-nsp.dtsi ++++ b/arch/arm/boot/dts/bcm-nsp.dtsi +@@ -587,7 +587,7 @@ + status = "disabled"; + + msi-parent = <&msi0>; +- msi0: msi-controller { ++ msi0: msi { + compatible = "brcm,iproc-msi"; + msi-controller; + interrupt-parent = <&gic>; +@@ -624,7 +624,7 @@ + status = "disabled"; + + msi-parent = <&msi1>; +- msi1: msi-controller { ++ msi1: msi { + compatible = "brcm,iproc-msi"; + msi-controller; + interrupt-parent = <&gic>; +@@ -661,7 +661,7 @@ + status = "disabled"; + + msi-parent = <&msi2>; +- msi2: msi-controller { ++ msi2: msi { + compatible = "brcm,iproc-msi"; + msi-controller; + interrupt-parent = <&gic>; diff --git a/target/linux/bcm53xx/patches-5.4/038-v5.17-0008-ARM-dts-NSP-Rename-SATA-unit-name.patch b/target/linux/bcm53xx/patches-5.4/038-v5.17-0008-ARM-dts-NSP-Rename-SATA-unit-name.patch new file mode 100644 index 0000000000..fd90fbf1f6 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/038-v5.17-0008-ARM-dts-NSP-Rename-SATA-unit-name.patch @@ -0,0 +1,25 @@ +From 9a68c53f875e88edd3403c001ad85f4ac0ed3486 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Tue, 7 Dec 2021 10:19:09 -0800 +Subject: [PATCH] ARM: dts: NSP: Rename SATA unit name + +Rename the SATA controller unit name from ahci to sata in preparation +for adding the Broadcom SATA3 controller YAML binding which will bring +validation. + +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm-nsp.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/bcm-nsp.dtsi ++++ b/arch/arm/boot/dts/bcm-nsp.dtsi +@@ -534,7 +534,7 @@ + }; + }; + +- sata: ahci@41000 { ++ sata: sata@41000 { + compatible = "brcm,bcm-nsp-ahci"; + reg-names = "ahci", "top-ctrl"; + reg = <0x41000 0x1000>, <0x40020 0x1c>; diff --git a/target/linux/bcm53xx/patches-5.4/038-v5.17-0009-ARM-dts-BCM5301X-correct-RX-delay-and-enable-flow-co.patch b/target/linux/bcm53xx/patches-5.4/038-v5.17-0009-ARM-dts-BCM5301X-correct-RX-delay-and-enable-flow-co.patch new file mode 100644 index 0000000000..e81ec169b9 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/038-v5.17-0009-ARM-dts-BCM5301X-correct-RX-delay-and-enable-flow-co.patch @@ -0,0 +1,45 @@ +From 5e33f1c4a7cb914a003a304ab8eef705b17aabb7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= +Date: Fri, 17 Dec 2021 00:03:19 +0800 +Subject: [PATCH] ARM: dts: BCM5301X: correct RX delay and enable flow control + on Asus RT-AC88U +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The current 'rx-internal-delay-ps' property value on the Realtek switch +node, 2000, will be divided by 300, resulting in 6.66, which will be +rounded to the closest step value, 7. Change it to 2100 to be accurate. +See ef136837aaf6 ("net: dsa: rtl8365mb: set RGMII RX delay in steps of +0.3 ns") for reference. + +Flow control needs to be enabled on both sides of the internal and +external switch. It is already enabled on the CPU port of the Realtek +switch so we also enable it on the external switch port of the Broadcom +switch as well. + +Signed-off-by: Arınç ÜNAL +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts ++++ b/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts +@@ -138,7 +138,7 @@ + ethernet = <&sw0_p5>; + phy-mode = "rgmii"; + tx-internal-delay-ps = <2000>; +- rx-internal-delay-ps = <2000>; ++ rx-internal-delay-ps = <2100>; + + fixed-link { + speed = <1000>; +@@ -213,6 +213,7 @@ + fixed-link { + speed = <1000>; + full-duplex; ++ pause; + }; + }; + diff --git a/target/linux/bcm53xx/patches-5.4/038-v5.17-0010-Revert-ARM-dts-BCM5301X-define-RTL8365MB-switch-on-A.patch b/target/linux/bcm53xx/patches-5.4/038-v5.17-0010-Revert-ARM-dts-BCM5301X-define-RTL8365MB-switch-on-A.patch new file mode 100644 index 0000000000..3d814b1252 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/038-v5.17-0010-Revert-ARM-dts-BCM5301X-define-RTL8365MB-switch-on-A.patch @@ -0,0 +1,109 @@ +From 8b0c59c622dc4dab970ec63264fb5b152944ac80 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Thu, 23 Dec 2021 00:17:17 +0100 +Subject: [PATCH] Revert "ARM: dts: BCM5301X: define RTL8365MB switch on Asus + RT-AC88U" + +This reverts commit 3d2d52a0d1835b56f6bd67d268f6c39df0e41692, it caused +a build regression: + +arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts:109.4-14: Warning (reg_format): /switch/ports:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1) +arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dtb: Warning (pci_device_reg): Failed prerequisite 'reg_format' +arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dtb: Warning (pci_device_bus_num): Failed prerequisite 'reg_format' +arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dtb: Warning (i2c_bus_reg): Failed prerequisite 'reg_format' +arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dtb: Warning (spi_bus_reg): Failed prerequisite 'reg_format' +arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts:106.9-149.5: Warning (avoid_default_addr_size): /switch/ports: Relying on default #address-cells value +arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts:106.9-149.5: Warning (avoid_default_addr_size): /switch/ports: Relying on default #size-cells value + +Reported-by: Stephen Rothwell +Signed-off-by: Arnd Bergmann +--- + arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts | 77 -------------------- + 1 file changed, 77 deletions(-) + +--- a/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts ++++ b/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts +@@ -93,83 +93,6 @@ + gpios = <&chipcommon 4 GPIO_ACTIVE_LOW>; + }; + }; +- +- switch { +- compatible = "realtek,rtl8365mb"; +- /* 7 = MDIO (has input reads), 6 = MDC (clock, output only) */ +- mdc-gpios = <&chipcommon 6 GPIO_ACTIVE_HIGH>; +- mdio-gpios = <&chipcommon 7 GPIO_ACTIVE_HIGH>; +- reset-gpios = <&chipcommon 10 GPIO_ACTIVE_LOW>; +- realtek,disable-leds; +- dsa,member = <1 0>; +- +- ports { +- #address-cells = <1>; +- #size-cells = <0>; +- reg = <0>; +- +- port@0 { +- reg = <0>; +- label = "lan5"; +- phy-handle = <ðphy0>; +- }; +- +- port@1 { +- reg = <1>; +- label = "lan6"; +- phy-handle = <ðphy1>; +- }; +- +- port@2 { +- reg = <2>; +- label = "lan7"; +- phy-handle = <ðphy2>; +- }; +- +- port@3 { +- reg = <3>; +- label = "lan8"; +- phy-handle = <ðphy3>; +- }; +- +- port@6 { +- reg = <6>; +- label = "cpu"; +- ethernet = <&sw0_p5>; +- phy-mode = "rgmii"; +- tx-internal-delay-ps = <2000>; +- rx-internal-delay-ps = <2100>; +- +- fixed-link { +- speed = <1000>; +- full-duplex; +- pause; +- }; +- }; +- }; +- +- mdio { +- compatible = "realtek,smi-mdio"; +- #address-cells = <1>; +- #size-cells = <0>; +- +- ethphy0: ethernet-phy@0 { +- reg = <0>; +- }; +- +- ethphy1: ethernet-phy@1 { +- reg = <1>; +- }; +- +- ethphy2: ethernet-phy@2 { +- reg = <2>; +- }; +- +- ethphy3: ethernet-phy@3 { +- reg = <3>; +- }; +- }; +- }; + }; + + &srab { diff --git a/target/linux/bcm53xx/patches-5.4/039-v5.18-0001-ARM-dts-BCM5301X-define-RTL8365MB-switch-on-Asus-RT-.patch b/target/linux/bcm53xx/patches-5.4/039-v5.18-0001-ARM-dts-BCM5301X-define-RTL8365MB-switch-on-Asus-RT-.patch new file mode 100644 index 0000000000..77d3420ff8 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/039-v5.18-0001-ARM-dts-BCM5301X-define-RTL8365MB-switch-on-Asus-RT-.patch @@ -0,0 +1,103 @@ +From 441d531ec9b766f49e01c107a3043235daa4493f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= +Date: Sun, 2 Jan 2022 23:33:04 +0300 +Subject: [PATCH] ARM: dts: BCM5301X: define RTL8365MB switch on Asus RT-AC88U +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Define the Realtek RTL8365MB switch without interrupt support on the device +tree of Asus RT-AC88U. + +Signed-off-by: Arınç ÜNAL +Acked-by: Alvin Šipraga +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts | 76 ++++++++++++++++++++ + 1 file changed, 76 insertions(+) + +--- a/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts ++++ b/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts +@@ -93,6 +93,82 @@ + gpios = <&chipcommon 4 GPIO_ACTIVE_LOW>; + }; + }; ++ ++ switch { ++ compatible = "realtek,rtl8365mb"; ++ /* 7 = MDIO (has input reads), 6 = MDC (clock, output only) */ ++ mdc-gpios = <&chipcommon 6 GPIO_ACTIVE_HIGH>; ++ mdio-gpios = <&chipcommon 7 GPIO_ACTIVE_HIGH>; ++ reset-gpios = <&chipcommon 10 GPIO_ACTIVE_LOW>; ++ realtek,disable-leds; ++ dsa,member = <1 0>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ port@0 { ++ reg = <0>; ++ label = "lan5"; ++ phy-handle = <ðphy0>; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ label = "lan6"; ++ phy-handle = <ðphy1>; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ label = "lan7"; ++ phy-handle = <ðphy2>; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ label = "lan8"; ++ phy-handle = <ðphy3>; ++ }; ++ ++ port@6 { ++ reg = <6>; ++ label = "cpu"; ++ ethernet = <&sw0_p5>; ++ phy-mode = "rgmii"; ++ tx-internal-delay-ps = <2000>; ++ rx-internal-delay-ps = <2100>; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ pause; ++ }; ++ }; ++ }; ++ ++ mdio { ++ compatible = "realtek,smi-mdio"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ ethphy0: ethernet-phy@0 { ++ reg = <0>; ++ }; ++ ++ ethphy1: ethernet-phy@1 { ++ reg = <1>; ++ }; ++ ++ ethphy2: ethernet-phy@2 { ++ reg = <2>; ++ }; ++ ++ ethphy3: ethernet-phy@3 { ++ reg = <3>; ++ }; ++ }; ++ }; + }; + + &srab { diff --git a/target/linux/bcm53xx/patches-5.4/039-v5.18-0002-ARM-dts-NSP-MX6X-get-mac-address-from-eeprom.patch b/target/linux/bcm53xx/patches-5.4/039-v5.18-0002-ARM-dts-NSP-MX6X-get-mac-address-from-eeprom.patch new file mode 100644 index 0000000000..19cf1fe952 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/039-v5.18-0002-ARM-dts-NSP-MX6X-get-mac-address-from-eeprom.patch @@ -0,0 +1,40 @@ +From 66848aff05f669e95795b5f3a163f4762781333e Mon Sep 17 00:00:00 2001 +From: Matthew Hagan +Date: Wed, 23 Feb 2022 23:50:39 +0000 +Subject: [PATCH] ARM: dts: NSP: MX6X: get mac-address from eeprom + +The MAC address on the MX64/MX65 series is located on the AT24 EEPROM. +This is the same as other Meraki devices such as the MR32 [1]. + +[1] https://lore.kernel.org/linux-arm-kernel/fa8271d02ef74a687f365cebe5c55ec846963ab7.1631986106.git.chunkeey@gmail.com/ + +Signed-off-by: Matthew Hagan +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm958625-meraki-mx6x-common.dtsi | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/arch/arm/boot/dts/bcm958625-meraki-mx6x-common.dtsi ++++ b/arch/arm/boot/dts/bcm958625-meraki-mx6x-common.dtsi +@@ -39,6 +39,8 @@ + + &amac2 { + status = "okay"; ++ nvmem-cells = <&mac_address>; ++ nvmem-cell-names = "mac-address"; + }; + + &ehci0 { +@@ -53,6 +55,12 @@ + reg = <0x50>; + pagesize = <32>; + read-only; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ mac_address: mac-address@66 { ++ reg = <0x66 0x6>; ++ }; + }; + }; + diff --git a/target/linux/bcm53xx/patches-5.4/039-v5.18-0003-ARM-dts-NSP-MX6X-correct-LED-function-types.patch b/target/linux/bcm53xx/patches-5.4/039-v5.18-0003-ARM-dts-NSP-MX6X-correct-LED-function-types.patch new file mode 100644 index 0000000000..2da45ff9da --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/039-v5.18-0003-ARM-dts-NSP-MX6X-correct-LED-function-types.patch @@ -0,0 +1,62 @@ +From 482c85c7fc95c572d368b2214b9e9d2c4a2e5789 Mon Sep 17 00:00:00 2001 +From: Matthew Hagan +Date: Wed, 23 Feb 2022 23:50:40 +0000 +Subject: [PATCH] ARM: dts: NSP: MX6X: correct LED function types + +Currently, the amber LED will remain always on. This is due to a +misinterpretation of the LED sub-node properties, where-by "default-state" +was used to indicate the initial state when powering on the device. When in +use, however, this resulted in the amber LED always being on. Instead change +this to only indicate a fault state. + +Assign LED_FUNCTION_POWER to the green PWM LED. + +These changes bring the MX64/65 in line with the MR32's devicetree. + +Signed-off-by: Matthew Hagan +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm958625-meraki-alamo.dtsi | 3 +-- + arch/arm/boot/dts/bcm958625-meraki-kingpin.dtsi | 3 +-- + arch/arm/boot/dts/bcm958625-meraki-mx6x-common.dtsi | 2 +- + 3 files changed, 3 insertions(+), 5 deletions(-) + +--- a/arch/arm/boot/dts/bcm958625-meraki-alamo.dtsi ++++ b/arch/arm/boot/dts/bcm958625-meraki-alamo.dtsi +@@ -57,10 +57,9 @@ + + led-4 { + /* amber:power */ +- function = LED_FUNCTION_POWER; ++ function = LED_FUNCTION_FAULT; + color = ; + gpios = <&gpioa 3 GPIO_ACTIVE_HIGH>; +- default-state = "on"; + }; + + led-5 { +--- a/arch/arm/boot/dts/bcm958625-meraki-kingpin.dtsi ++++ b/arch/arm/boot/dts/bcm958625-meraki-kingpin.dtsi +@@ -106,10 +106,9 @@ + + led-a { + /* amber:power */ +- function = LED_FUNCTION_POWER; ++ function = LED_FUNCTION_FAULT; + color = ; + gpios = <&gpioa 0 GPIO_ACTIVE_LOW>; +- default-state = "on"; + }; + + led-b { +--- a/arch/arm/boot/dts/bcm958625-meraki-mx6x-common.dtsi ++++ b/arch/arm/boot/dts/bcm958625-meraki-mx6x-common.dtsi +@@ -22,7 +22,7 @@ + }; + + led-2 { +- function = LED_FUNCTION_INDICATOR; ++ function = LED_FUNCTION_POWER; + color = ; + pwms = <&pwm 2 50000>; + max-brightness = <255>; diff --git a/target/linux/bcm53xx/patches-5.4/039-v5.18-0004-ARM-dts-BCM5301X-Add-Ethernet-MAC-address-to-Luxul-X.patch b/target/linux/bcm53xx/patches-5.4/039-v5.18-0004-ARM-dts-BCM5301X-Add-Ethernet-MAC-address-to-Luxul-X.patch new file mode 100644 index 0000000000..c70fbc398b --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/039-v5.18-0004-ARM-dts-BCM5301X-Add-Ethernet-MAC-address-to-Luxul-X.patch @@ -0,0 +1,42 @@ +From c8442f0fb09ca3d842b9b23d1d0650f649fd10f8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 28 Feb 2022 10:52:07 +0100 +Subject: [PATCH] ARM: dts: BCM5301X: Add Ethernet MAC address to Luxul + XWR-3150 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Luxul XWR-3150 stores MAC as NVRAM variable. Add NVMEM cell for it and +reference it in the Ethernet interface node. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts +@@ -25,6 +25,9 @@ + nvram@1eff0000 { + compatible = "brcm,nvram"; + reg = <0x1eff0000 0x10000>; ++ ++ et0macaddr: et0macaddr { ++ }; + }; + + leds { +@@ -72,6 +75,11 @@ + }; + }; + ++&gmac0 { ++ nvmem-cells = <&et0macaddr>; ++ nvmem-cell-names = "mac-address"; ++}; ++ + &usb3 { + vcc-gpio = <&chipcommon 18 GPIO_ACTIVE_HIGH>; + }; From 40c0d28e84a548212f14749708b5b55ebfcb9b93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Thu, 10 Nov 2022 09:28:23 +0100 Subject: [PATCH 038/137] bcm53xx: update DTS files with the latest changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki (cherry picked from commit 8cdafa149eda4e343905ccf00cad34ff2b52c85b) --- ...ts-NSP-Fixed-iProc-PCIe-MSI-sub-node.patch | 6 +- ...08-ARM-dts-NSP-Rename-SATA-unit-name.patch | 2 +- ...301X-Update-pin-controller-node-name.patch | 32 + ...M5301X-Fix-DTC-warning-for-NAND-node.patch | 31 + ...-Remove-cell-properties-from-srab-po.patch | 40 + ...-Add-rgmii-to-port-5-of-Broadcom-swi.patch | 29 + ...-Retrieve-gmac1-MAC-address-from-NVR.patch | 43 + ...-Fix-compatible-strings-for-BCM53012.patch | 65 ++ ...-Disable-gmac0-and-enable-port-8-on-.patch | 39 + ...BCM5301X-Add-DT-for-WZR-1166DHP-DHP2.patch | 300 ++++++ ...CM5301X-Fix-DTC-warning-for-NAND-nod.patch | 32 + ...-align-gpio-key-node-names-with-dtsc.patch | 912 ++++++++++++++++++ ...roadcom-correct-gpio-keys-properties.patch | 108 +++ ...-Correct-description-of-TP-Link-part.patch | 99 ++ ...4-Add-devicetree-for-D-Link-DIR-890L.patch | 242 +++++ ...-Add-devicetree-for-D-Link-DWL-8610A.patch | 165 ++++ ...-Specify-switch-ports-for-remaining-.patch | 144 ++- ...RM-BCM5301X-Add-DT-for-Netgear-R7900.patch | 2 +- ...power-button-for-Buffalo-WZR-1750DHP.patch | 4 +- .../331-Meraki-MR32-Status-LEDs.patch | 2 +- 20 files changed, 2285 insertions(+), 12 deletions(-) create mode 100644 target/linux/bcm53xx/patches-5.4/040-v5.19-0001-ARM-dts-BCM5301X-Update-pin-controller-node-name.patch create mode 100644 target/linux/bcm53xx/patches-5.4/040-v5.19-0002-ARM-dts-BCM5301X-Fix-DTC-warning-for-NAND-node.patch create mode 100644 target/linux/bcm53xx/patches-5.4/040-v5.19-0003-ARM-dts-BCM5301X-Remove-cell-properties-from-srab-po.patch create mode 100644 target/linux/bcm53xx/patches-5.4/040-v5.19-0004-ARM-dts-BCM5301X-Add-rgmii-to-port-5-of-Broadcom-swi.patch create mode 100644 target/linux/bcm53xx/patches-5.4/040-v5.19-0005-ARM-dts-BCM5301X-Retrieve-gmac1-MAC-address-from-NVR.patch create mode 100644 target/linux/bcm53xx/patches-5.4/040-v5.19-0006-ARM-dts-BCM5301X-Fix-compatible-strings-for-BCM53012.patch create mode 100644 target/linux/bcm53xx/patches-5.4/040-v5.19-0007-ARM-dts-BCM5301X-Disable-gmac0-and-enable-port-8-on-.patch create mode 100644 target/linux/bcm53xx/patches-5.4/040-v5.19-0008-ARM-dts-BCM5301X-Add-DT-for-WZR-1166DHP-DHP2.patch create mode 100644 target/linux/bcm53xx/patches-5.4/040-v5.19-0009-Revert-ARM-dts-BCM5301X-Fix-DTC-warning-for-NAND-nod.patch create mode 100644 target/linux/bcm53xx/patches-5.4/041-v6.0-0001-ARM-dts-broadcom-align-gpio-key-node-names-with-dtsc.patch create mode 100644 target/linux/bcm53xx/patches-5.4/041-v6.0-0002-ARM-dts-broadcom-correct-gpio-keys-properties.patch create mode 100644 target/linux/bcm53xx/patches-5.4/042-v6.1-0001-ARM-dts-BCM5301X-Correct-description-of-TP-Link-part.patch create mode 100644 target/linux/bcm53xx/patches-5.4/042-v6.1-0001-ARM-dts-bcm47094-Add-devicetree-for-D-Link-DIR-890L.patch create mode 100644 target/linux/bcm53xx/patches-5.4/042-v6.1-0001-ARM-dts-bcm53016-Add-devicetree-for-D-Link-DWL-8610A.patch diff --git a/target/linux/bcm53xx/patches-5.4/038-v5.17-0007-ARM-dts-NSP-Fixed-iProc-PCIe-MSI-sub-node.patch b/target/linux/bcm53xx/patches-5.4/038-v5.17-0007-ARM-dts-NSP-Fixed-iProc-PCIe-MSI-sub-node.patch index 730b989808..1d28476bc6 100644 --- a/target/linux/bcm53xx/patches-5.4/038-v5.17-0007-ARM-dts-NSP-Fixed-iProc-PCIe-MSI-sub-node.patch +++ b/target/linux/bcm53xx/patches-5.4/038-v5.17-0007-ARM-dts-NSP-Fixed-iProc-PCIe-MSI-sub-node.patch @@ -13,7 +13,7 @@ Signed-off-by: Florian Fainelli --- a/arch/arm/boot/dts/bcm-nsp.dtsi +++ b/arch/arm/boot/dts/bcm-nsp.dtsi -@@ -587,7 +587,7 @@ +@@ -585,7 +585,7 @@ status = "disabled"; msi-parent = <&msi0>; @@ -22,7 +22,7 @@ Signed-off-by: Florian Fainelli compatible = "brcm,iproc-msi"; msi-controller; interrupt-parent = <&gic>; -@@ -624,7 +624,7 @@ +@@ -622,7 +622,7 @@ status = "disabled"; msi-parent = <&msi1>; @@ -31,7 +31,7 @@ Signed-off-by: Florian Fainelli compatible = "brcm,iproc-msi"; msi-controller; interrupt-parent = <&gic>; -@@ -661,7 +661,7 @@ +@@ -659,7 +659,7 @@ status = "disabled"; msi-parent = <&msi2>; diff --git a/target/linux/bcm53xx/patches-5.4/038-v5.17-0008-ARM-dts-NSP-Rename-SATA-unit-name.patch b/target/linux/bcm53xx/patches-5.4/038-v5.17-0008-ARM-dts-NSP-Rename-SATA-unit-name.patch index fd90fbf1f6..887e0da059 100644 --- a/target/linux/bcm53xx/patches-5.4/038-v5.17-0008-ARM-dts-NSP-Rename-SATA-unit-name.patch +++ b/target/linux/bcm53xx/patches-5.4/038-v5.17-0008-ARM-dts-NSP-Rename-SATA-unit-name.patch @@ -14,7 +14,7 @@ Signed-off-by: Florian Fainelli --- a/arch/arm/boot/dts/bcm-nsp.dtsi +++ b/arch/arm/boot/dts/bcm-nsp.dtsi -@@ -534,7 +534,7 @@ +@@ -532,7 +532,7 @@ }; }; diff --git a/target/linux/bcm53xx/patches-5.4/040-v5.19-0001-ARM-dts-BCM5301X-Update-pin-controller-node-name.patch b/target/linux/bcm53xx/patches-5.4/040-v5.19-0001-ARM-dts-BCM5301X-Update-pin-controller-node-name.patch new file mode 100644 index 0000000000..690abb9270 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/040-v5.19-0001-ARM-dts-BCM5301X-Update-pin-controller-node-name.patch @@ -0,0 +1,32 @@ +From 130b5e32ba9d2d2313e39cf3f6d0729bff02b76a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 30 Mar 2022 14:05:27 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: Update pin controller node name +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This fixes: +arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dtb: cru-bus@100: 'pin-controller@1c0' does not match any of the regexes: '^clock-controller@[a-f0-9]+$', '^phy@[a-f0-9]+$', '^pinctrl@[a-f0-9]+$', '^syscon@[a-f0-9]+$', '^thermal@[a-f0-9]+$' + From schema: Documentation/devicetree/bindings/mfd/brcm,cru.yaml +arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dtb: pin-controller@1c0: $nodename:0: 'pin-controller@1c0' does not match '^(pinctrl|pinmux)(@[0-9a-f]+)?$' + From schema: Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.yaml + +Ref: e7391b021e3f ("dt-bindings: mfd: brcm,cru: Rename pinctrl node") +Signed-off-by: Rafał Miłecki +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm5301x.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/bcm5301x.dtsi ++++ b/arch/arm/boot/dts/bcm5301x.dtsi +@@ -455,7 +455,7 @@ + reg = <0x180 0x4>; + }; + +- pinctrl: pin-controller@1c0 { ++ pinctrl: pinctrl@1c0 { + compatible = "brcm,bcm4708-pinmux"; + reg = <0x1c0 0x24>; + reg-names = "cru_gpio_control"; diff --git a/target/linux/bcm53xx/patches-5.4/040-v5.19-0002-ARM-dts-BCM5301X-Fix-DTC-warning-for-NAND-node.patch b/target/linux/bcm53xx/patches-5.4/040-v5.19-0002-ARM-dts-BCM5301X-Fix-DTC-warning-for-NAND-node.patch new file mode 100644 index 0000000000..e61fef8aab --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/040-v5.19-0002-ARM-dts-BCM5301X-Fix-DTC-warning-for-NAND-node.patch @@ -0,0 +1,31 @@ +From 90103611d573c5c238350f9b1d7cb682c62f5681 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= +Date: Fri, 1 Apr 2022 13:19:58 +0300 +Subject: [PATCH] ARM: dts: BCM5301X: Fix DTC warning for NAND node +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Remove the unnecessary #address-cells and #size-cells properties on the +nand@0 node to fix the warning below. + +Warning (avoid_unnecessary_addr_size): /nand-controller@18028000/nand@0: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property + +Signed-off-by: Arınç ÜNAL +Acked-by: Rafał Miłecki +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm5301x-nand-cs0.dtsi | 2 -- + 1 file changed, 2 deletions(-) + +--- a/arch/arm/boot/dts/bcm5301x-nand-cs0.dtsi ++++ b/arch/arm/boot/dts/bcm5301x-nand-cs0.dtsi +@@ -10,8 +10,6 @@ + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; +- #address-cells = <1>; +- #size-cells = <1>; + + partitions { + compatible = "brcm,bcm947xx-cfe-partitions"; diff --git a/target/linux/bcm53xx/patches-5.4/040-v5.19-0003-ARM-dts-BCM5301X-Remove-cell-properties-from-srab-po.patch b/target/linux/bcm53xx/patches-5.4/040-v5.19-0003-ARM-dts-BCM5301X-Remove-cell-properties-from-srab-po.patch new file mode 100644 index 0000000000..6ef8720b1d --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/040-v5.19-0003-ARM-dts-BCM5301X-Remove-cell-properties-from-srab-po.patch @@ -0,0 +1,40 @@ +From e5ff0a7aab3ef5dd8ec7636b936c95179aa5ddfa Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= +Date: Fri, 1 Apr 2022 13:19:59 +0300 +Subject: [PATCH] ARM: dts: BCM5301X: Remove cell properties from srab ports on + Asus RT-AC88U +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Remove #address-cells and #size-cells properties from the ports node of +&srab. They are already defined on bcm5301x.dtsi, there's no need to define +them again. + +Signed-off-by: Arınç ÜNAL +Acked-by: Rafał Miłecki +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +--- a/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts ++++ b/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0-or-later OR MIT + /* +- * Copyright (C) 2021 Arınç ÜNAL ++ * Copyright (C) 2021-2022 Arınç ÜNAL + */ + + /dts-v1/; +@@ -177,9 +177,6 @@ + dsa,member = <0 0>; + + ports { +- #address-cells = <1>; +- #size-cells = <0>; +- + port@0 { + reg = <0>; + label = "lan4"; diff --git a/target/linux/bcm53xx/patches-5.4/040-v5.19-0004-ARM-dts-BCM5301X-Add-rgmii-to-port-5-of-Broadcom-swi.patch b/target/linux/bcm53xx/patches-5.4/040-v5.19-0004-ARM-dts-BCM5301X-Add-rgmii-to-port-5-of-Broadcom-swi.patch new file mode 100644 index 0000000000..aa192b3a11 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/040-v5.19-0004-ARM-dts-BCM5301X-Add-rgmii-to-port-5-of-Broadcom-swi.patch @@ -0,0 +1,29 @@ +From 4b7a67420a34ebd8fbf0111221a8bfd8001d418d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= +Date: Fri, 1 Apr 2022 13:20:00 +0300 +Subject: [PATCH] ARM: dts: BCM5301X: Add rgmii to port@5 of Broadcom switch on + Asus RT-AC88U +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Define phy-mode of the Broadcom switch's port@5 as rgmii. This doesn't seem +to matter but let's explicitly define it since phy-mode as rgmii is defined +on the other side which is port@6 of the Realtek switch. + +Signed-off-by: Arınç ÜNAL +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts ++++ b/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts +@@ -205,6 +205,7 @@ + sw0_p5: port@5 { + reg = <5>; + label = "extsw"; ++ phy-mode = "rgmii"; + + fixed-link { + speed = <1000>; diff --git a/target/linux/bcm53xx/patches-5.4/040-v5.19-0005-ARM-dts-BCM5301X-Retrieve-gmac1-MAC-address-from-NVR.patch b/target/linux/bcm53xx/patches-5.4/040-v5.19-0005-ARM-dts-BCM5301X-Retrieve-gmac1-MAC-address-from-NVR.patch new file mode 100644 index 0000000000..4c0858be0a --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/040-v5.19-0005-ARM-dts-BCM5301X-Retrieve-gmac1-MAC-address-from-NVR.patch @@ -0,0 +1,43 @@ +From 7f7f8c7b9f3cbae1355fb3b0ce4ea9d6f1552521 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= +Date: Fri, 1 Apr 2022 13:20:01 +0300 +Subject: [PATCH] ARM: dts: BCM5301X: Retrieve gmac1 MAC address from NVRAM on + Asus RT-AC88U +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The et1macaddr NVRAM variable contains a MAC address for gmac1 on Asus +RT-AC88U. Add NVMEM cell for it and reference it in the gmac1 node. + +Signed-off-by: Arınç ÜNAL +Acked-by: Rafał Miłecki +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts ++++ b/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts +@@ -25,6 +25,9 @@ + nvram@1c080000 { + compatible = "brcm,nvram"; + reg = <0x1c080000 0x00180000>; ++ ++ et1macaddr: et1macaddr { ++ }; + }; + + leds { +@@ -239,6 +242,11 @@ + }; + }; + ++&gmac1 { ++ nvmem-cells = <&et1macaddr>; ++ nvmem-cell-names = "mac-address"; ++}; ++ + &usb2 { + vcc-gpio = <&chipcommon 9 GPIO_ACTIVE_HIGH>; + }; diff --git a/target/linux/bcm53xx/patches-5.4/040-v5.19-0006-ARM-dts-BCM5301X-Fix-compatible-strings-for-BCM53012.patch b/target/linux/bcm53xx/patches-5.4/040-v5.19-0006-ARM-dts-BCM5301X-Fix-compatible-strings-for-BCM53012.patch new file mode 100644 index 0000000000..59e99dae62 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/040-v5.19-0006-ARM-dts-BCM5301X-Fix-compatible-strings-for-BCM53012.patch @@ -0,0 +1,65 @@ +From 69bb5c6f3f41fe6baa86a775c8a3e69dd27f85d6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= +Date: Sat, 2 Apr 2022 23:46:21 +0300 +Subject: [PATCH] ARM: dts: BCM5301X: Fix compatible strings for BCM53012 and + BCM53016 SoC +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Fix compatible strings for devicetrees using the BCM53012 and BCM53016 SoC. + +Signed-off-by: Arınç ÜNAL +Acked-by: Krzysztof Kozlowski +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm53016-meraki-mr32.dts | 2 +- + arch/arm/boot/dts/bcm953012er.dts | 2 +- + arch/arm/boot/dts/bcm953012hr.dts | 2 +- + arch/arm/boot/dts/bcm953012k.dts | 2 +- + 4 files changed, 4 insertions(+), 4 deletions(-) + +--- a/arch/arm/boot/dts/bcm53016-meraki-mr32.dts ++++ b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts +@@ -13,7 +13,7 @@ + #include + + / { +- compatible = "meraki,mr32", "brcm,brcm53016", "brcm,bcm4708"; ++ compatible = "meraki,mr32", "brcm,bcm53016", "brcm,bcm4708"; + model = "Meraki MR32"; + + chosen { +--- a/arch/arm/boot/dts/bcm953012er.dts ++++ b/arch/arm/boot/dts/bcm953012er.dts +@@ -37,7 +37,7 @@ + + / { + model = "NorthStar Enterprise Router (BCM953012ER)"; +- compatible = "brcm,bcm953012er", "brcm,brcm53012", "brcm,bcm4708"; ++ compatible = "brcm,bcm953012er", "brcm,bcm53012", "brcm,bcm4708"; + + memory@0 { + device_type = "memory"; +--- a/arch/arm/boot/dts/bcm953012hr.dts ++++ b/arch/arm/boot/dts/bcm953012hr.dts +@@ -37,7 +37,7 @@ + + / { + model = "NorthStar HR (BCM953012HR)"; +- compatible = "brcm,bcm953012hr", "brcm,brcm53012", "brcm,bcm4708"; ++ compatible = "brcm,bcm953012hr", "brcm,bcm53012", "brcm,bcm4708"; + + aliases { + ethernet0 = &gmac0; +--- a/arch/arm/boot/dts/bcm953012k.dts ++++ b/arch/arm/boot/dts/bcm953012k.dts +@@ -36,7 +36,7 @@ + + / { + model = "NorthStar SVK (BCM953012K)"; +- compatible = "brcm,bcm953012k", "brcm,brcm53012", "brcm,bcm4708"; ++ compatible = "brcm,bcm953012k", "brcm,bcm53012", "brcm,bcm4708"; + + aliases { + serial0 = &uart0; diff --git a/target/linux/bcm53xx/patches-5.4/040-v5.19-0007-ARM-dts-BCM5301X-Disable-gmac0-and-enable-port-8-on-.patch b/target/linux/bcm53xx/patches-5.4/040-v5.19-0007-ARM-dts-BCM5301X-Disable-gmac0-and-enable-port-8-on-.patch new file mode 100644 index 0000000000..f75a53777f --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/040-v5.19-0007-ARM-dts-BCM5301X-Disable-gmac0-and-enable-port-8-on-.patch @@ -0,0 +1,39 @@ +From b9cff8783439ff1803709128af3a0e04c5f5f047 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= +Date: Sun, 10 Apr 2022 12:44:55 +0300 +Subject: [PATCH] ARM: dts: BCM5301X: Disable gmac0 and enable port@8 on Asus + RT-AC88U +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Disable gmac0 which is not connected to any switch MAC. Enable port@8 of +the Broadcom switch which is connected to gmac2. + +Signed-off-by: Arınç ÜNAL +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts ++++ b/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts +@@ -232,7 +232,6 @@ + reg = <8>; + ethernet = <&gmac2>; + label = "cpu"; +- status = "disabled"; + + fixed-link { + speed = <1000>; +@@ -242,6 +241,10 @@ + }; + }; + ++&gmac0 { ++ status = "disabled"; ++}; ++ + &gmac1 { + nvmem-cells = <&et1macaddr>; + nvmem-cell-names = "mac-address"; diff --git a/target/linux/bcm53xx/patches-5.4/040-v5.19-0008-ARM-dts-BCM5301X-Add-DT-for-WZR-1166DHP-DHP2.patch b/target/linux/bcm53xx/patches-5.4/040-v5.19-0008-ARM-dts-BCM5301X-Add-DT-for-WZR-1166DHP-DHP2.patch new file mode 100644 index 0000000000..959dda35b8 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/040-v5.19-0008-ARM-dts-BCM5301X-Add-DT-for-WZR-1166DHP-DHP2.patch @@ -0,0 +1,300 @@ +From 417aea4436bb658d8c5c4dcd0e3c255931d0ee96 Mon Sep 17 00:00:00 2001 +From: SHIMAMOTO Takayoshi +Date: Fri, 22 Apr 2022 00:10:54 +0900 +Subject: [PATCH] ARM: dts: BCM5301X: Add DT for WZR-1166DHP,DHP2 + +Buffalo WZR-1166DHP/WZR-1166DHP2 wireless router with + + - BCM4708A0 + - 128MiB NAND flash + - 2T2R 11ac/a/b/g/n Wi-Fi + - 4x 10/100/1000M ethernet switch + - 1x USB 3.0 port + + WZR-1166DHP and WZR-1166DHP2 have different memory capacity. + + WZR-1166DHP + - 512 MiB DDR2 SDRAM + + WZR-1166DHP2 + - 256 MiB DDR2 SDRAM + + These hardware components are very similar to the WZR-1750DHP + except for the number of antennas. + +Signed-off-by: SHIMAMOTO Takayoshi +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/Makefile | 2 + + .../bcm4708-buffalo-wzr-1166dhp-common.dtsi | 192 ++++++++++++++++++ + .../boot/dts/bcm4708-buffalo-wzr-1166dhp.dts | 26 +++ + .../boot/dts/bcm4708-buffalo-wzr-1166dhp2.dts | 26 +++ + 4 files changed, 246 insertions(+) + create mode 100644 arch/arm/boot/dts/bcm4708-buffalo-wzr-1166dhp-common.dtsi + create mode 100644 arch/arm/boot/dts/bcm4708-buffalo-wzr-1166dhp.dts + create mode 100644 arch/arm/boot/dts/bcm4708-buffalo-wzr-1166dhp2.dts + +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -89,6 +89,8 @@ dtb-$(CONFIG_ARCH_BCM_5301X) += \ + bcm4708-asus-rt-ac56u.dtb \ + bcm4708-asus-rt-ac68u.dtb \ + bcm4708-buffalo-wzr-1750dhp.dtb \ ++ bcm4708-buffalo-wzr-1166dhp.dtb \ ++ bcm4708-buffalo-wzr-1166dhp2.dtb \ + bcm4708-linksys-ea6300-v1.dtb \ + bcm4708-linksys-ea6500-v2.dtb \ + bcm4708-luxul-xap-1510.dtb \ +--- /dev/null ++++ b/arch/arm/boot/dts/bcm4708-buffalo-wzr-1166dhp-common.dtsi +@@ -0,0 +1,192 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++/* ++ * Broadcom BCM470X / BCM5301X ARM platform code. ++ * DTS for Buffalo WZR-1166DHP and WZR-1166DHP2 ++ * ++ * Copyright (C) 2014 Rafał Miłecki ++ * Copyright (C) 2022 SHIMAMOTO Takayoshi ++ */ ++ ++ ++#include "bcm4708.dtsi" ++#include "bcm5301x-nand-cs0-bch8.dtsi" ++#include ++ ++/ { ++ spi { ++ compatible = "spi-gpio"; ++ num-chipselects = <1>; ++ gpio-sck = <&chipcommon 7 0>; ++ gpio-mosi = <&chipcommon 4 0>; ++ cs-gpios = <&chipcommon 6 0>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ hc595: gpio_spi@0 { ++ compatible = "fairchild,74hc595"; ++ reg = <0>; ++ registers-number = <1>; ++ spi-max-frequency = <100000>; ++ ++ gpio-controller; ++ #gpio-cells = <2>; ++ ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ usb { ++ /* label = "bcm53xx:blue:usb"; */ ++ function = LED_FUNCTION_USB; ++ color = ; ++ gpios = <&hc595 0 GPIO_ACTIVE_HIGH>; ++ trigger-sources = <&ohci_port1>, <&ehci_port1>, ++ <&xhci_port1>, <&ohci_port2>, ++ <&ehci_port2>; ++ linux,default-trigger = "usbport"; ++ }; ++ ++ power0 { ++ /* label = "bcm53xx:red:power"; */ ++ function = LED_FUNCTION_FAULT; ++ color = ; ++ gpios = <&hc595 1 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ power1 { ++ /* label = "bcm53xx:white:power"; */ ++ function = LED_FUNCTION_POWER; ++ color = ; ++ gpios = <&hc595 2 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "default-on"; ++ }; ++ ++ router0 { ++ /* label = "bcm53xx:blue:router"; */ ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ gpios = <&hc595 3 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "default-on"; ++ }; ++ ++ router1 { ++ /* label = "bcm53xx:amber:router"; */ ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ gpios = <&hc595 4 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ wan { ++ /* label = "bcm53xx:blue:wan"; */ ++ function = LED_FUNCTION_WAN; ++ color = ; ++ gpios = <&hc595 5 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "default-on"; ++ }; ++ ++ wireless0 { ++ /* label = "bcm53xx:blue:wireless"; */ ++ function = LED_FUNCTION_WLAN; ++ color = ; ++ gpios = <&hc595 6 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ wireless1 { ++ /* label = "bcm53xx:amber:wireless"; */ ++ function = LED_FUNCTION_WLAN; ++ color = ; ++ gpios = <&hc595 7 GPIO_ACTIVE_HIGH>; ++ }; ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ ++ restart { ++ label = "Reset"; ++ linux,code = ; ++ gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; ++ }; ++ ++ aoss { ++ label = "AOSS"; ++ linux,code = ; ++ gpios = <&chipcommon 12 GPIO_ACTIVE_LOW>; ++ }; ++ ++ /* Commit mode set by switch? */ ++ mode { ++ label = "Mode"; ++ linux,code = ; ++ gpios = <&chipcommon 13 GPIO_ACTIVE_LOW>; ++ }; ++ ++ /* Switch: AP mode */ ++ sw_ap { ++ label = "AP"; ++ linux,code = ; ++ gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>; ++ }; ++ ++ eject { ++ label = "USB eject"; ++ linux,code = ; ++ gpios = <&chipcommon 15 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++&usb2 { ++ vcc-gpio = <&chipcommon 9 GPIO_ACTIVE_HIGH>; ++}; ++ ++&usb3 { ++ vcc-gpio = <&chipcommon 10 GPIO_ACTIVE_LOW>; ++}; ++ ++&spi_nor { ++ status = "okay"; ++}; ++ ++&usb3_phy { ++ status = "okay"; ++}; ++ ++&srab { ++ status = "okay"; ++ ++ ports { ++ 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@5 { ++ reg = <5>; ++ label = "cpu"; ++ ethernet = <&gmac0>; ++ }; ++ }; ++}; +--- /dev/null ++++ b/arch/arm/boot/dts/bcm4708-buffalo-wzr-1166dhp.dts +@@ -0,0 +1,26 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++/* ++ * Device Tree Bindigs for Buffalo WZR-1166DHP ++ * ++ * Copyright (C) 2022 SHIMAMOTO Takayoshi ++ */ ++ ++/dts-v1/; ++ ++#include "bcm4708-buffalo-wzr-1166dhp-common.dtsi" ++ ++/ { ++ compatible = "buffalo,wzr-1166dhp", "brcm,bcm4708"; ++ model = "Buffalo WZR-1166DHP"; ++ ++ chosen { ++ bootargs = "console=ttyS0,115200"; ++ }; ++ ++ memory@0 { ++ device_type = "memory"; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x18000000>; ++ }; ++ ++}; +--- /dev/null ++++ b/arch/arm/boot/dts/bcm4708-buffalo-wzr-1166dhp2.dts +@@ -0,0 +1,26 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++/* ++ * Device Tree Bindigs for Buffalo WZR-1166DHP2 ++ * ++ * Copyright (C) 2022 SHIMAMOTO Takayoshi ++ */ ++ ++/dts-v1/; ++ ++#include "bcm4708-buffalo-wzr-1166dhp-common.dtsi" ++ ++/ { ++ compatible = "buffalo,wzr-1166dhp2", "brcm,bcm4708"; ++ model = "Buffalo WZR-1166DHP2"; ++ ++ chosen { ++ bootargs = "console=ttyS0,115200"; ++ }; ++ ++ memory@0 { ++ device_type = "memory"; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x08000000>; ++ }; ++ ++}; diff --git a/target/linux/bcm53xx/patches-5.4/040-v5.19-0009-Revert-ARM-dts-BCM5301X-Fix-DTC-warning-for-NAND-nod.patch b/target/linux/bcm53xx/patches-5.4/040-v5.19-0009-Revert-ARM-dts-BCM5301X-Fix-DTC-warning-for-NAND-nod.patch new file mode 100644 index 0000000000..cc7e9741a7 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/040-v5.19-0009-Revert-ARM-dts-BCM5301X-Fix-DTC-warning-for-NAND-nod.patch @@ -0,0 +1,32 @@ +From 18176b9d82eebaf4408dc0440f54d57a8cbced83 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Fri, 13 May 2022 11:11:07 +0200 +Subject: [PATCH] Revert "ARM: dts: BCM5301X: Fix DTC warning for NAND node" + +This reverts commit 90103611d573, which caused a new DTC warning + +arch/arm/boot/dts/bcm953012hr.dts:57.3-33: Warning (reg_format): /nand-controller@18028000/nand@0/partition@0:reg: property has invalid length (8 bytes) (#address-cells == 2, #size-cells == 1) +arch/arm/boot/dts/bcm953012hr.dts:62.3-33: Warning (reg_format): /nand-controller@18028000/nand@0/partition@200000:reg: property has invalid length (8 bytes) (#address-cells == 2, #size-cells == 1) +arch/arm/boot/dts/bcm953012hr.dts:66.3-33: Warning (reg_format): /nand-controller@18028000/nand@0/partition@600000:reg: property has invalid length (8 bytes) (#address-cells == 2, #size-cells == 1) +arch/arm/boot/dts/bcm953012hr.dts:70.3-33: Warning (reg_format): /nand-controller@18028000/nand@0/partition@1000000:reg: property has invalid length (8 bytes) (#address-cells == 2, #size-cells == 1) +arch/arm/boot/dts/bcm953012hr.dtb: Warning (pci_device_reg): Failed prerequisite 'reg_format' +arch/arm/boot/dts/bcm953012hr.dtb: Warning (pci_device_bus_num): Failed prerequisite 'reg_format' +arch/arm/boot/dts/bcm953012hr.dtb: Warning (i2c_bus_reg): Failed prerequisite 'reg_format' +arch/arm/boot/dts/bcm953012hr.dtb: Warning (spi_bus_reg): Failed prerequisite 'reg_format' + +Signed-off-by: Arnd Bergmann +--- + arch/arm/boot/dts/bcm5301x-nand-cs0.dtsi | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/arch/arm/boot/dts/bcm5301x-nand-cs0.dtsi ++++ b/arch/arm/boot/dts/bcm5301x-nand-cs0.dtsi +@@ -10,6 +10,8 @@ + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; ++ #address-cells = <1>; ++ #size-cells = <1>; + + partitions { + compatible = "brcm,bcm947xx-cfe-partitions"; diff --git a/target/linux/bcm53xx/patches-5.4/041-v6.0-0001-ARM-dts-broadcom-align-gpio-key-node-names-with-dtsc.patch b/target/linux/bcm53xx/patches-5.4/041-v6.0-0001-ARM-dts-broadcom-align-gpio-key-node-names-with-dtsc.patch new file mode 100644 index 0000000000..33d675297e --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/041-v6.0-0001-ARM-dts-broadcom-align-gpio-key-node-names-with-dtsc.patch @@ -0,0 +1,912 @@ +From c5aec5611aec8fb1ca68f68e41acaefccfc93c16 Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Thu, 9 Jun 2022 13:39:30 +0200 +Subject: [PATCH] ARM: dts: broadcom: align gpio-key node names with dtschema + +The node names should be generic and DT schema expects certain pattern +(e.g. with key/button/switch). + +Signed-off-by: Krzysztof Kozlowski +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dts | 6 +++--- + arch/arm/boot/dts/bcm4708-asus-rt-ac68u.dts | 8 ++++---- + .../boot/dts/bcm4708-buffalo-wzr-1166dhp-common.dtsi | 10 +++++----- + arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts | 10 +++++----- + arch/arm/boot/dts/bcm4708-linksys-ea6300-v1.dts | 4 ++-- + arch/arm/boot/dts/bcm4708-linksys-ea6500-v2.dts | 4 ++-- + arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts | 2 +- + arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts | 2 +- + arch/arm/boot/dts/bcm4708-netgear-r6250.dts | 6 +++--- + arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts | 6 +++--- + arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts | 6 +++--- + arch/arm/boot/dts/bcm47081-asus-rt-n18u.dts | 4 ++-- + arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts | 8 ++++---- + arch/arm/boot/dts/bcm47081-buffalo-wzr-900dhp.dts | 2 +- + arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts | 2 +- + arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts | 2 +- + arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts | 4 ++-- + arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts | 4 ++-- + arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dts | 12 ++++++------ + arch/arm/boot/dts/bcm4709-linksys-ea9200.dts | 4 ++-- + arch/arm/boot/dts/bcm4709-netgear-r7000.dts | 6 +++--- + arch/arm/boot/dts/bcm4709-netgear-r8000.dts | 8 ++++---- + arch/arm/boot/dts/bcm4709-tplink-archer-c9-v1.dts | 4 ++-- + arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts | 8 ++++---- + arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts | 6 +++--- + arch/arm/boot/dts/bcm47094-linksys-panamera.dts | 6 +++--- + arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts | 2 +- + arch/arm/boot/dts/bcm47094-luxul-xap-1610.dts | 2 +- + arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts | 2 +- + arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts | 2 +- + arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts | 2 +- + arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts | 2 +- + arch/arm/boot/dts/bcm47094-netgear-r8500.dts | 8 ++++---- + arch/arm/boot/dts/bcm47094-phicomm-k3.dts | 2 +- + arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts | 2 +- + arch/arm/boot/dts/bcm47189-luxul-xap-810.dts | 2 +- + arch/arm/boot/dts/bcm47189-tenda-ac9.dts | 6 +++--- + arch/arm/boot/dts/bcm53016-meraki-mr32.dts | 2 +- + arch/arm/boot/dts/bcm911360_entphn.dts | 4 ++-- + arch/arm/boot/dts/bcm947189acdbmr.dts | 4 ++-- + arch/arm/boot/dts/bcm953012er.dts | 4 ++-- + arch/arm/boot/dts/bcm958625-meraki-alamo.dtsi | 2 +- + arch/arm/boot/dts/bcm958625-meraki-kingpin.dtsi | 2 +- + 43 files changed, 97 insertions(+), 97 deletions(-) + +--- a/arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dts ++++ b/arch/arm/boot/dts/bcm4708-asus-rt-ac56u.dts +@@ -70,19 +70,19 @@ + gpio-keys { + compatible = "gpio-keys"; + +- rfkill { ++ button-rfkill { + label = "WiFi"; + linux,code = ; + gpios = <&chipcommon 7 GPIO_ACTIVE_LOW>; + }; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; + }; + +- wps { ++ button-wps { + label = "WPS"; + linux,code = ; + gpios = <&chipcommon 15 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm4708-asus-rt-ac68u.dts ++++ b/arch/arm/boot/dts/bcm4708-asus-rt-ac68u.dts +@@ -54,25 +54,25 @@ + gpio-keys { + compatible = "gpio-keys"; + +- brightness { ++ button-brightness { + label = "Backlight"; + linux,code = ; + gpios = <&chipcommon 5 GPIO_ACTIVE_LOW>; + }; + +- wps { ++ button-wps { + label = "WPS"; + linux,code = ; + gpios = <&chipcommon 7 GPIO_ACTIVE_LOW>; + }; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; + }; + +- rfkill { ++ button-rfkill { + label = "WiFi"; + linux,code = ; + gpios = <&chipcommon 15 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm4708-buffalo-wzr-1166dhp-common.dtsi ++++ b/arch/arm/boot/dts/bcm4708-buffalo-wzr-1166dhp-common.dtsi +@@ -104,33 +104,33 @@ + gpio-keys { + compatible = "gpio-keys"; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; + }; + +- aoss { ++ button-aoss { + label = "AOSS"; + linux,code = ; + gpios = <&chipcommon 12 GPIO_ACTIVE_LOW>; + }; + + /* Commit mode set by switch? */ +- mode { ++ button-mode { + label = "Mode"; + linux,code = ; + gpios = <&chipcommon 13 GPIO_ACTIVE_LOW>; + }; + + /* Switch: AP mode */ +- sw_ap { ++ button-sw-ap { + label = "AP"; + linux,code = ; + gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>; + }; + +- eject { ++ button-eject { + label = "USB eject"; + linux,code = ; + gpios = <&chipcommon 15 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts ++++ b/arch/arm/boot/dts/bcm4708-buffalo-wzr-1750dhp.dts +@@ -100,33 +100,33 @@ + gpio-keys { + compatible = "gpio-keys"; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; + }; + +- aoss { ++ button-aoss { + label = "AOSS"; + linux,code = ; + gpios = <&chipcommon 12 GPIO_ACTIVE_LOW>; + }; + + /* Commit mode set by switch? */ +- mode { ++ button-mode { + label = "Mode"; + linux,code = ; + gpios = <&chipcommon 13 GPIO_ACTIVE_LOW>; + }; + + /* Switch: AP mode */ +- sw_ap { ++ button-sw-ap { + label = "AP"; + linux,code = ; + gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>; + }; + +- eject { ++ button-eject { + label = "USB eject"; + linux,code = ; + gpios = <&chipcommon 15 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm4708-linksys-ea6300-v1.dts ++++ b/arch/arm/boot/dts/bcm4708-linksys-ea6300-v1.dts +@@ -29,13 +29,13 @@ + gpio-keys { + compatible = "gpio-keys"; + +- wps { ++ button-wps { + label = "WPS"; + linux,code = ; + gpios = <&chipcommon 7 GPIO_ACTIVE_LOW>; + }; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm4708-linksys-ea6500-v2.dts ++++ b/arch/arm/boot/dts/bcm4708-linksys-ea6500-v2.dts +@@ -25,13 +25,13 @@ + gpio-keys { + compatible = "gpio-keys"; + +- wps { ++ button-wps { + label = "WPS"; + linux,code = ; + gpios = <&chipcommon 7 GPIO_ACTIVE_LOW>; + }; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts ++++ b/arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts +@@ -45,7 +45,7 @@ + gpio-keys { + compatible = "gpio-keys"; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts ++++ b/arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts +@@ -52,7 +52,7 @@ + gpio-keys { + compatible = "gpio-keys"; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 7 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm4708-netgear-r6250.dts ++++ b/arch/arm/boot/dts/bcm4708-netgear-r6250.dts +@@ -63,19 +63,19 @@ + gpio-keys { + compatible = "gpio-keys"; + +- wps { ++ button-wps { + label = "WPS"; + linux,code = ; + gpios = <&chipcommon 4 GPIO_ACTIVE_LOW>; + }; + +- rfkill { ++ button-rfkill { + label = "WiFi"; + linux,code = ; + gpios = <&chipcommon 5 GPIO_ACTIVE_LOW>; + }; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 6 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts ++++ b/arch/arm/boot/dts/bcm4708-netgear-r6300-v2.dts +@@ -59,19 +59,19 @@ + gpio-keys { + compatible = "gpio-keys"; + +- wps { ++ button-wps { + label = "WPS"; + linux,code = ; + gpios = <&chipcommon 4 GPIO_ACTIVE_LOW>; + }; + +- rfkill { ++ button-rfkill { + label = "WiFi"; + linux,code = ; + gpios = <&chipcommon 5 GPIO_ACTIVE_LOW>; + }; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 6 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts ++++ b/arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts +@@ -94,19 +94,19 @@ + gpio-keys { + compatible = "gpio-keys"; + +- rfkill { ++ button-rfkill { + label = "WiFi"; + linux,code = ; + gpios = <&chipcommon 0 GPIO_ACTIVE_LOW>; + }; + +- wps { ++ button-wps { + label = "WPS"; + linux,code = ; + gpios = <&chipcommon 7 GPIO_ACTIVE_LOW>; + }; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm47081-asus-rt-n18u.dts ++++ b/arch/arm/boot/dts/bcm47081-asus-rt-n18u.dts +@@ -60,13 +60,13 @@ + gpio-keys { + compatible = "gpio-keys"; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 7 GPIO_ACTIVE_LOW>; + }; + +- wps { ++ button-wps { + label = "WPS"; + linux,code = ; + gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts ++++ b/arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts +@@ -91,26 +91,26 @@ + gpio-keys { + compatible = "gpio-keys"; + +- aoss { ++ button-aoss { + label = "AOSS"; + linux,code = ; + gpios = <&chipcommon 9 GPIO_ACTIVE_LOW>; + }; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; + }; + + /* Switch device mode? */ +- mode { ++ button-mode { + label = "Mode"; + linux,code = ; + gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>; + }; + +- eject { ++ button-eject { + label = "USB eject"; + linux,code = ; + gpios = <&chipcommon 15 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm47081-buffalo-wzr-900dhp.dts ++++ b/arch/arm/boot/dts/bcm47081-buffalo-wzr-900dhp.dts +@@ -96,7 +96,7 @@ + gpio-keys { + compatible = "gpio-keys"; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts ++++ b/arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts +@@ -45,7 +45,7 @@ + gpio-keys { + compatible = "gpio-keys"; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts ++++ b/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts +@@ -94,7 +94,7 @@ + gpio-keys { + compatible = "gpio-keys"; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts ++++ b/arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts +@@ -77,13 +77,13 @@ + gpio-keys { + compatible = "gpio-keys"; + +- rfkill { ++ button-rfkill { + label = "WiFi"; + linux,code = ; + gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>; + }; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 7 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts ++++ b/arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts +@@ -50,13 +50,13 @@ + #address-cells = <1>; + #size-cells = <0>; + +- wps { ++ button-wps { + label = "WPS"; + linux,code = ; + gpios = <&chipcommon 2 GPIO_ACTIVE_LOW>; + }; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dts ++++ b/arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dts +@@ -80,39 +80,39 @@ + #address-cells = <1>; + #size-cells = <0>; + +- power { ++ button-power { + label = "Power"; + linux,code = ; + gpios = <&chipcommon 1 GPIO_ACTIVE_LOW>; + }; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 15 GPIO_ACTIVE_LOW>; + }; + +- aoss { ++ button-aoss { + label = "AOSS"; + linux,code = ; + gpios = <&chipcommon 16 GPIO_ACTIVE_LOW>; + }; + + /* Commit mode set by switch? */ +- mode { ++ button-mode { + label = "Mode"; + linux,code = ; + gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; + }; + + /* Switch: AP mode */ +- sw_ap { ++ button-sw-ap { + label = "AP"; + linux,code = ; + gpios = <&chipcommon 18 GPIO_ACTIVE_LOW>; + }; + +- eject { ++ button-eject { + label = "USB eject"; + linux,code = ; + gpios = <&chipcommon 20 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm4709-linksys-ea9200.dts ++++ b/arch/arm/boot/dts/bcm4709-linksys-ea9200.dts +@@ -32,13 +32,13 @@ + #address-cells = <1>; + #size-cells = <0>; + +- wps { ++ button-wps { + label = "WPS"; + linux,code = ; + gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>; + }; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm4709-netgear-r7000.dts ++++ b/arch/arm/boot/dts/bcm4709-netgear-r7000.dts +@@ -75,19 +75,19 @@ + #address-cells = <1>; + #size-cells = <0>; + +- wps { ++ button-wps { + label = "WPS"; + linux,code = ; + gpios = <&chipcommon 4 GPIO_ACTIVE_LOW>; + }; + +- rfkill { ++ button-rfkill { + label = "WiFi"; + linux,code = ; + gpios = <&chipcommon 5 GPIO_ACTIVE_LOW>; + }; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 6 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm4709-netgear-r8000.dts ++++ b/arch/arm/boot/dts/bcm4709-netgear-r8000.dts +@@ -102,25 +102,25 @@ + #address-cells = <1>; + #size-cells = <0>; + +- rfkill { ++ button-rfkill { + label = "WiFi"; + linux,code = ; + gpios = <&chipcommon 4 GPIO_ACTIVE_LOW>; + }; + +- wps { ++ button-wps { + label = "WPS"; + linux,code = ; + gpios = <&chipcommon 5 GPIO_ACTIVE_LOW>; + }; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 6 GPIO_ACTIVE_LOW>; + }; + +- brightness { ++ button-brightness { + label = "Backlight"; + linux,code = ; + gpios = <&chipcommon 19 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm4709-tplink-archer-c9-v1.dts ++++ b/arch/arm/boot/dts/bcm4709-tplink-archer-c9-v1.dts +@@ -80,13 +80,13 @@ + #address-cells = <1>; + #size-cells = <0>; + +- wps { ++ button-wps { + label = "WPS"; + linux,code = ; + gpios = <&chipcommon 0 GPIO_ACTIVE_LOW>; + }; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts ++++ b/arch/arm/boot/dts/bcm47094-asus-rt-ac88u.dts +@@ -72,25 +72,25 @@ + gpio-keys { + compatible = "gpio-keys"; + +- wps { ++ button-wps { + label = "WPS"; + linux,code = ; + gpios = <&chipcommon 20 GPIO_ACTIVE_LOW>; + }; + +- reset { ++ button-reset { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; + }; + +- wifi { ++ button-wifi { + label = "Wi-Fi"; + linux,code = ; + gpios = <&chipcommon 18 GPIO_ACTIVE_LOW>; + }; + +- led { ++ button-led { + label = "Backlight"; + linux,code = ; + gpios = <&chipcommon 4 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts ++++ b/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts +@@ -86,20 +86,20 @@ + gpio-keys { + compatible = "gpio-keys"; + +- wps { ++ button-wps { + label = "WPS"; + linux,code = ; + gpios = <&chipcommon 7 GPIO_ACTIVE_LOW>; + }; + + /* Switch: router / extender */ +- extender { ++ button-extender { + label = "Extender"; + linux,code = ; + gpios = <&chipcommon 10 GPIO_ACTIVE_LOW>; + }; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm47094-linksys-panamera.dts ++++ b/arch/arm/boot/dts/bcm47094-linksys-panamera.dts +@@ -30,19 +30,19 @@ + gpio-keys { + compatible = "gpio-keys"; + +- wps { ++ button-wps { + label = "WPS"; + linux,code = ; + gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>; + }; + +- rfkill { ++ button-rfkill { + label = "WiFi"; + linux,code = ; + gpios = <&chipcommon 16 GPIO_ACTIVE_LOW>; + }; + +- reset { ++ button-reset { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts +@@ -49,7 +49,7 @@ + gpio-keys { + compatible = "gpio-keys"; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm47094-luxul-xap-1610.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xap-1610.dts +@@ -43,7 +43,7 @@ + gpio-keys { + compatible = "gpio-keys"; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts +@@ -49,7 +49,7 @@ + gpio-keys { + compatible = "gpio-keys"; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts +@@ -37,7 +37,7 @@ + #address-cells = <1>; + #size-cells = <0>; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 19 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwr-3100.dts +@@ -89,7 +89,7 @@ + gpio-keys { + compatible = "gpio-keys"; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts +@@ -67,7 +67,7 @@ + gpio-keys { + compatible = "gpio-keys"; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm47094-netgear-r8500.dts ++++ b/arch/arm/boot/dts/bcm47094-netgear-r8500.dts +@@ -65,25 +65,25 @@ + gpio-keys { + compatible = "gpio-keys"; + +- brightness { ++ button-brightness { + label = "Backlight"; + linux,code = ; + gpios = <&chipcommon 1 GPIO_ACTIVE_LOW>; + }; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 10 GPIO_ACTIVE_LOW>; + }; + +- wps { ++ button-wps { + label = "WPS"; + linux,code = ; + gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>; + }; + +- rfkill { ++ button-rfkill { + label = "WiFi"; + linux,code = ; + gpios = <&chipcommon 20 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm47094-phicomm-k3.dts ++++ b/arch/arm/boot/dts/bcm47094-phicomm-k3.dts +@@ -22,7 +22,7 @@ + gpio-keys { + compatible = "gpio-keys"; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts ++++ b/arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts +@@ -39,7 +39,7 @@ + gpio-keys { + compatible = "gpio-keys"; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 7 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm47189-luxul-xap-810.dts ++++ b/arch/arm/boot/dts/bcm47189-luxul-xap-810.dts +@@ -49,7 +49,7 @@ + gpio-keys { + compatible = "gpio-keys"; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 7 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm47189-tenda-ac9.dts ++++ b/arch/arm/boot/dts/bcm47189-tenda-ac9.dts +@@ -59,19 +59,19 @@ + gpio-keys { + compatible = "gpio-keys"; + +- rfkill { ++ button-rfkill { + label = "WiFi"; + linux,code = ; + gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>; + }; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 7 GPIO_ACTIVE_LOW>; + }; + +- wps { ++ button-wps { + label = "WPS"; + linux,code = ; + gpios = <&chipcommon 9 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm53016-meraki-mr32.dts ++++ b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts +@@ -50,7 +50,7 @@ + #address-cells = <1>; + #size-cells = <0>; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 21 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm911360_entphn.dts ++++ b/arch/arm/boot/dts/bcm911360_entphn.dts +@@ -47,10 +47,10 @@ + stdout-path = "serial0:115200n8"; + }; + +- gpio_keys { ++ gpio-keys { + compatible = "gpio-keys"; + +- hook { ++ button-hook { + label = "HOOK"; + linux,code = ; + gpios = <&gpio_asiu 48 0>; +--- a/arch/arm/boot/dts/bcm947189acdbmr.dts ++++ b/arch/arm/boot/dts/bcm947189acdbmr.dts +@@ -44,13 +44,13 @@ + gpio-keys { + compatible = "gpio-keys"; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 7 GPIO_ACTIVE_HIGH>; + }; + +- wps { ++ button-wps { + label = "WPS"; + linux,code = ; + gpios = <&chipcommon 9 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm953012er.dts ++++ b/arch/arm/boot/dts/bcm953012er.dts +@@ -47,13 +47,13 @@ + gpio-keys { + compatible = "gpio-keys"; + +- wps { ++ button-wps { + label = "WPS"; + linux,code = ; + gpios = <&chipcommon 6 GPIO_ACTIVE_LOW>; + }; + +- restart { ++ button-restart { + label = "Reset"; + linux,code = ; + gpios = <&chipcommon 15 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm958625-meraki-alamo.dtsi ++++ b/arch/arm/boot/dts/bcm958625-meraki-alamo.dtsi +@@ -13,7 +13,7 @@ + autorepeat; + poll-interval = <20>; + +- reset { ++ button-reset { + label = "reset"; + linux,code = ; + gpios = <&gpioa 8 GPIO_ACTIVE_LOW>; +--- a/arch/arm/boot/dts/bcm958625-meraki-kingpin.dtsi ++++ b/arch/arm/boot/dts/bcm958625-meraki-kingpin.dtsi +@@ -14,7 +14,7 @@ + autorepeat; + poll-interval = <20>; + +- reset { ++ button-reset { + label = "reset"; + linux,code = ; + gpios = <&gpioa 6 GPIO_ACTIVE_LOW>; diff --git a/target/linux/bcm53xx/patches-5.4/041-v6.0-0002-ARM-dts-broadcom-correct-gpio-keys-properties.patch b/target/linux/bcm53xx/patches-5.4/041-v6.0-0002-ARM-dts-broadcom-correct-gpio-keys-properties.patch new file mode 100644 index 0000000000..7bded431b0 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/041-v6.0-0002-ARM-dts-broadcom-correct-gpio-keys-properties.patch @@ -0,0 +1,108 @@ +From d634a6969c03803a945fdc2bccbe7d813420e569 Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Thu, 9 Jun 2022 13:39:31 +0200 +Subject: [PATCH] ARM: dts: broadcom: correct gpio-keys properties + +gpio-keys children do not use unit addresses. + +Signed-off-by: Krzysztof Kozlowski +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts | 2 -- + arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dts | 2 -- + arch/arm/boot/dts/bcm4709-linksys-ea9200.dts | 2 -- + arch/arm/boot/dts/bcm4709-netgear-r7000.dts | 2 -- + arch/arm/boot/dts/bcm4709-netgear-r8000.dts | 2 -- + arch/arm/boot/dts/bcm4709-tplink-archer-c9-v1.dts | 2 -- + arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts | 2 -- + arch/arm/boot/dts/bcm53016-meraki-mr32.dts | 2 -- + 8 files changed, 16 deletions(-) + +--- a/arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts ++++ b/arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts +@@ -47,8 +47,6 @@ + + gpio-keys { + compatible = "gpio-keys"; +- #address-cells = <1>; +- #size-cells = <0>; + + button-wps { + label = "WPS"; +--- a/arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dts ++++ b/arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dts +@@ -77,8 +77,6 @@ + + gpio-keys { + compatible = "gpio-keys"; +- #address-cells = <1>; +- #size-cells = <0>; + + button-power { + label = "Power"; +--- a/arch/arm/boot/dts/bcm4709-linksys-ea9200.dts ++++ b/arch/arm/boot/dts/bcm4709-linksys-ea9200.dts +@@ -29,8 +29,6 @@ + + gpio-keys { + compatible = "gpio-keys"; +- #address-cells = <1>; +- #size-cells = <0>; + + button-wps { + label = "WPS"; +--- a/arch/arm/boot/dts/bcm4709-netgear-r7000.dts ++++ b/arch/arm/boot/dts/bcm4709-netgear-r7000.dts +@@ -72,8 +72,6 @@ + + gpio-keys { + compatible = "gpio-keys"; +- #address-cells = <1>; +- #size-cells = <0>; + + button-wps { + label = "WPS"; +--- a/arch/arm/boot/dts/bcm4709-netgear-r8000.dts ++++ b/arch/arm/boot/dts/bcm4709-netgear-r8000.dts +@@ -99,8 +99,6 @@ + + gpio-keys { + compatible = "gpio-keys"; +- #address-cells = <1>; +- #size-cells = <0>; + + button-rfkill { + label = "WiFi"; +--- a/arch/arm/boot/dts/bcm4709-tplink-archer-c9-v1.dts ++++ b/arch/arm/boot/dts/bcm4709-tplink-archer-c9-v1.dts +@@ -77,8 +77,6 @@ + + gpio-keys { + compatible = "gpio-keys"; +- #address-cells = <1>; +- #size-cells = <0>; + + button-wps { + label = "WPS"; +--- a/arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts ++++ b/arch/arm/boot/dts/bcm47094-luxul-xwc-2000.dts +@@ -34,8 +34,6 @@ + + gpio-keys { + compatible = "gpio-keys"; +- #address-cells = <1>; +- #size-cells = <0>; + + button-restart { + label = "Reset"; +--- a/arch/arm/boot/dts/bcm53016-meraki-mr32.dts ++++ b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts +@@ -47,8 +47,6 @@ + + keys { + compatible = "gpio-keys"; +- #address-cells = <1>; +- #size-cells = <0>; + + button-restart { + label = "Reset"; diff --git a/target/linux/bcm53xx/patches-5.4/042-v6.1-0001-ARM-dts-BCM5301X-Correct-description-of-TP-Link-part.patch b/target/linux/bcm53xx/patches-5.4/042-v6.1-0001-ARM-dts-BCM5301X-Correct-description-of-TP-Link-part.patch new file mode 100644 index 0000000000..4c4ed036b9 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/042-v6.1-0001-ARM-dts-BCM5301X-Correct-description-of-TP-Link-part.patch @@ -0,0 +1,99 @@ +From c8ee9f119bfb4244f76c9971c341ec06b49332cd Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 8 Nov 2022 12:07:08 +0100 +Subject: [PATCH] ARM: dts: BCM5301X: Correct description of TP-Link partitions +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +TP-Link routers have flash space partitioned according to the partitions +table. It may look like fixed partitioning but those partitions can be +actually reorganized. New can be added (or some removed), offsets and +sizes may change. + +Fix DT to use binding for the TP-Link SafeLoader partitioning method. + +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20221108110708.13693-1-zajec5@gmail.com +Signed-off-by: Florian Fainelli +--- + .../boot/dts/bcm47081-tplink-archer-c5-v2.dts | 25 ++++--------------- + .../boot/dts/bcm4709-tplink-archer-c9-v1.dts | 25 ++++--------------- + 2 files changed, 10 insertions(+), 40 deletions(-) + +--- a/arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts ++++ b/arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts +@@ -95,30 +95,15 @@ + status = "okay"; + + partitions { +- compatible = "fixed-partitions"; +- #address-cells = <1>; +- #size-cells = <1>; ++ compatible = "tplink,safeloader-partitions"; ++ partitions-table-offset = <0xe50000>; + +- boot@0 { +- label = "boot"; +- reg = <0x000000 0x040000>; +- read-only; +- }; +- +- os-image@100000 { +- label = "os-image"; +- reg = <0x040000 0x200000>; ++ partition-os-image { + compatible = "brcm,trx"; + }; + +- rootfs@240000 { +- label = "rootfs"; +- reg = <0x240000 0xc00000>; +- }; +- +- nvram@ff0000 { +- label = "nvram"; +- reg = <0xff0000 0x010000>; ++ partition-file-system { ++ linux,rootfs; + }; + }; + }; +--- a/arch/arm/boot/dts/bcm4709-tplink-archer-c9-v1.dts ++++ b/arch/arm/boot/dts/bcm4709-tplink-archer-c9-v1.dts +@@ -104,30 +104,15 @@ + status = "okay"; + + partitions { +- compatible = "fixed-partitions"; +- #address-cells = <1>; +- #size-cells = <1>; ++ compatible = "tplink,safeloader-partitions"; ++ partitions-table-offset = <0xe50000>; + +- boot@0 { +- label = "boot"; +- reg = <0x000000 0x040000>; +- read-only; +- }; +- +- os-image@100000 { +- label = "os-image"; +- reg = <0x040000 0x200000>; ++ partition-os-image { + compatible = "brcm,trx"; + }; + +- rootfs@240000 { +- label = "rootfs"; +- reg = <0x240000 0xc00000>; +- }; +- +- nvram@ff0000 { +- label = "nvram"; +- reg = <0xff0000 0x010000>; ++ partition-file-system { ++ linux,rootfs; + }; + }; + }; diff --git a/target/linux/bcm53xx/patches-5.4/042-v6.1-0001-ARM-dts-bcm47094-Add-devicetree-for-D-Link-DIR-890L.patch b/target/linux/bcm53xx/patches-5.4/042-v6.1-0001-ARM-dts-bcm47094-Add-devicetree-for-D-Link-DIR-890L.patch new file mode 100644 index 0000000000..3e3b4f84f6 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/042-v6.1-0001-ARM-dts-bcm47094-Add-devicetree-for-D-Link-DIR-890L.patch @@ -0,0 +1,242 @@ +From b1ba87897ceda8e49a47aa92832dd7bff8583e21 Mon Sep 17 00:00:00 2001 +From: Linus Walleij +Date: Mon, 7 Nov 2022 14:41:04 +0100 +Subject: [PATCH] ARM: dts: bcm47094: Add devicetree for D-Link DIR-890L + +This adds a device tree for the D-Link DIR-890L. This device +is very similar to D-Link DIR-885L, the differences are detailed +as a comment in the DTS file. + +Signed-off-by: Linus Walleij +Link: https://lore.kernel.org/r/20221107134104.1422169-2-linus.walleij@linaro.org +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/Makefile | 1 + + arch/arm/boot/dts/bcm47094-dlink-dir-890l.dts | 211 ++++++++++++++++++ + 2 files changed, 212 insertions(+) + create mode 100644 arch/arm/boot/dts/bcm47094-dlink-dir-890l.dts + +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -112,6 +112,7 @@ dtb-$(CONFIG_ARCH_BCM_5301X) += \ + bcm4709-tplink-archer-c9-v1.dtb \ + bcm47094-asus-rt-ac88u.dtb \ + bcm47094-dlink-dir-885l.dtb \ ++ bcm47094-dlink-dir-890l.dtb \ + bcm47094-linksys-panamera.dtb \ + bcm47094-luxul-abr-4500.dtb \ + bcm47094-luxul-xap-1610.dtb \ +--- /dev/null ++++ b/arch/arm/boot/dts/bcm47094-dlink-dir-890l.dts +@@ -0,0 +1,211 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++/* ++ * Device tree for D-Link DIR-890L ++ * D-Link calls this board "WRGAC36" ++ * this router has the same looks and form factor as D-Link DIR-885L. ++ * ++ * Some differences from DIR-885L include a separate USB2 port, separate LEDs ++ * for USB2 and USB3, a separate VCC supply for the USB2 slot and no ++ * router/extender switch is mounted (there is an empty mount point on the ++ * PCB) so this device is a pure router. Also the LAN ports are in the right ++ * order. ++ * ++ * Based on the device tree for DIR-885L ++ * Copyright (C) 2016 Rafał Miłecki ++ * Copyright (C) 2022 Linus Walleij ++ */ ++ ++/dts-v1/; ++ ++#include "bcm47094.dtsi" ++#include "bcm5301x-nand-cs0-bch1.dtsi" ++ ++/ { ++ compatible = "dlink,dir-890l", "brcm,bcm47094", "brcm,bcm4708"; ++ model = "D-Link DIR-890L"; ++ ++ chosen { ++ bootargs = "console=ttyS0,115200 earlycon"; ++ }; ++ ++ memory@0 { ++ device_type = "memory"; ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x08000000>; ++ }; ++ ++ leds { ++ /* ++ * LED information is derived from the boot log which ++ * conveniently lists all the LEDs. ++ */ ++ compatible = "gpio-leds"; ++ ++ power-white { ++ label = "bcm53xx:white:power"; ++ gpios = <&chipcommon 0 GPIO_ACTIVE_LOW>; ++ linux,default-trigger = "default-on"; ++ }; ++ ++ wan-white { ++ label = "bcm53xx:white:wan"; ++ gpios = <&chipcommon 1 GPIO_ACTIVE_LOW>; ++ }; ++ ++ power-amber { ++ label = "bcm53xx:amber:power"; ++ gpios = <&chipcommon 2 GPIO_ACTIVE_LOW>; ++ }; ++ ++ wan-amber { ++ label = "bcm53xx:amber:wan"; ++ gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>; ++ }; ++ ++ usb3-white { ++ label = "bcm53xx:white:usb3"; ++ gpios = <&chipcommon 8 GPIO_ACTIVE_LOW>; ++ trigger-sources = <&xhci_port1>; ++ linux,default-trigger = "usbport"; ++ }; ++ ++ usb2-white { ++ label = "bcm53xx:white:usb2"; ++ gpios = <&chipcommon 15 GPIO_ACTIVE_LOW>; ++ trigger-sources = <&ohci_port1>, <&ehci_port1>; ++ linux,default-trigger = "usbport"; ++ }; ++ ++ 2ghz { ++ label = "bcm53xx:white:2ghz"; ++ gpios = <&chipcommon 13 GPIO_ACTIVE_LOW>; ++ }; ++ ++ 5ghz { ++ label = "bcm53xx:white:5ghz"; ++ gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ ++ button-wps { ++ label = "WPS"; ++ linux,code = ; ++ gpios = <&chipcommon 7 GPIO_ACTIVE_LOW>; ++ }; ++ ++ /* Called "factory reset" in the vendor dmesg */ ++ button-restart { ++ label = "Reset"; ++ linux,code = ; ++ gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ /* ++ * The flash memory is memory mapped at 0x1e000000-0x1fffffff ++ * 64KB blocks; total size 2MB, same that can be ++ * found attached to the spi_nor SPI controller. ++ */ ++ nvram@1e1f0000 { ++ compatible = "brcm,nvram"; ++ reg = <0x1e1f0000 0x00010000>; ++ ++ et0macaddr: et0macaddr { ++ }; ++ }; ++}; ++ ++&gmac2 { ++ /* ++ * The NVRAM curiously does not contain a MAC address ++ * for et2 so since that is the only ethernet interface ++ * actually in use on the platform, we use this et0 MAC ++ * address for et2. ++ */ ++ nvmem-cells = <&et0macaddr>; ++ nvmem-cell-names = "mac-address"; ++}; ++ ++&spi_nor { ++ status = "okay"; ++}; ++ ++&nandcs { ++ /* Spansion S34ML01G2, 128MB with 128KB erase blocks */ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ /* ++ * This is called "nflash" in the vendor kernel with ++ * "upgrade" and "rootfs" (probably using OpenWrt ++ * splitpart). We call it "firmware" like standard tools ++ * assume. The CFE loader contains incorrect information ++ * about TRX partitions, ignore this, there are no TRX ++ * partitions: this device uses SEAMA. ++ */ ++ firmware@0 { ++ label = "firmware"; ++ reg = <0x00000000 0x08000000>; ++ }; ++ }; ++}; ++ ++&usb2 { ++ vcc-gpios = <&chipcommon 21 GPIO_ACTIVE_HIGH>; ++}; ++ ++&usb3 { ++ vcc-gpios = <&chipcommon 18 GPIO_ACTIVE_HIGH>; ++}; ++ ++&usb3_phy { ++ status = "okay"; ++}; ++ ++&srab { ++ status = "okay"; ++ ++ ports { ++ 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@8 { ++ reg = <8>; ++ label = "cpu"; ++ ethernet = <&gmac2>; ++ phy-mode = "rgmii"; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; ++ }; ++}; diff --git a/target/linux/bcm53xx/patches-5.4/042-v6.1-0001-ARM-dts-bcm53016-Add-devicetree-for-D-Link-DWL-8610A.patch b/target/linux/bcm53xx/patches-5.4/042-v6.1-0001-ARM-dts-bcm53016-Add-devicetree-for-D-Link-DWL-8610A.patch new file mode 100644 index 0000000000..6102963f82 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/042-v6.1-0001-ARM-dts-bcm53016-Add-devicetree-for-D-Link-DWL-8610A.patch @@ -0,0 +1,165 @@ +From 9f66e1dd82e3186aee95282657512ca2aef1afe0 Mon Sep 17 00:00:00 2001 +From: Linus Walleij +Date: Wed, 19 Oct 2022 21:34:49 +0200 +Subject: [PATCH] ARM: dts: bcm53016: Add devicetree for D-Link DWL-8610AP + +This adds a device tree for the BCM53016-based D-Link DWL-8610AP +access point wireless router. + +The TRX-format partitions had to be named "firmware" due to +an OpenWrt patch that only accepts parting such nodes if they +are named "firmware". + +Signed-off-by: Linus Walleij +Link: https://lore.kernel.org/r/20221019193449.3036010-2-linus.walleij@linaro.org +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/Makefile | 1 + + .../boot/dts/bcm53016-dlink-dwl-8610ap.dts | 131 ++++++++++++++++++ + 2 files changed, 132 insertions(+) + create mode 100644 arch/arm/boot/dts/bcm53016-dlink-dwl-8610ap.dts + +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -122,6 +122,7 @@ dtb-$(CONFIG_ARCH_BCM_5301X) += \ + bcm47094-luxul-xwr-3150-v1.dtb \ + bcm47094-netgear-r8500.dtb \ + bcm47094-phicomm-k3.dtb \ ++ bcm53016-dlink-dwl-8610ap.dtb \ + bcm53016-meraki-mr32.dtb \ + bcm94708.dtb \ + bcm94709.dtb \ +--- /dev/null ++++ b/arch/arm/boot/dts/bcm53016-dlink-dwl-8610ap.dts +@@ -0,0 +1,131 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++/dts-v1/; ++ ++#include "bcm4709.dtsi" ++#include "bcm5301x-nand-cs0-bch8.dtsi" ++#include ++#include ++ ++/ { ++ model = "D-Link DWL-8610AP"; ++ compatible = "dlink,dwl-8610ap", "brcm,bcm53016", "brcm,bcm4708"; ++ ++ memory@0 { ++ device_type = "memory"; ++ /* 512 MB RAM in 2 x Macronix D9PSH chips */ ++ reg = <0x00000000 0x08000000>, ++ <0x88000000 0x08000000>; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ power { ++ function = LED_FUNCTION_POWER; ++ color = ; ++ gpios = <&chipcommon 0 GPIO_ACTIVE_LOW>; ++ default-state = "on"; ++ }; ++ ++ diag { ++ /* Actually "diag" unclear what this means */ ++ function = LED_FUNCTION_INDICATOR; ++ color = ; ++ gpios = <&chipcommon 1 GPIO_ACTIVE_LOW>; ++ default-state = "on"; ++ linux,default-trigger = "heartbeat"; ++ }; ++ ++ wlan-2g { ++ function = LED_FUNCTION_WLAN; ++ color = ; ++ gpios = <&chipcommon 5 GPIO_ACTIVE_LOW>; ++ }; ++ ++ wlan-5g { ++ function = LED_FUNCTION_WLAN; ++ color = ; ++ gpios = <&chipcommon 8 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ gpio_keys { ++ compatible = "gpio-keys"; ++ ++ button-reset { ++ debounce-interval = <100>; ++ wakeup-source; ++ linux,code = ; ++ label = "reset"; ++ /* This GPIO is actually stored in NVRAM, but it's not gonna change */ ++ gpios = <&chipcommon 4 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ /* ++ * Flash memory at 0x1e000000-0x1fffffff ++ * Macronix 32 64KB blocks; total size 2MB, same that can be ++ * found attached to the spi_nor SPI controller. ++ */ ++ nvram@1e080000 { ++ compatible = "brcm,nvram"; ++ reg = <0x1e080000 0x00020000>; ++ ++ et0macaddr: et0macaddr { ++ }; ++ ++ et1macaddr: et1macaddr { ++ }; ++ }; ++}; ++ ++&gmac0 { ++ nvmem-cells = <&et0macaddr>; ++ nvmem-cell-names = "mac-address"; ++}; ++ ++&gmac1 { ++ nvmem-cells = <&et1macaddr>; ++ nvmem-cell-names = "mac-address"; ++}; ++ ++&spi_nor { ++ /* Serial SPI NOR Flash MX 25L1606E */ ++ status = "okay"; ++}; ++ ++&nandcs { ++ /* ++ * Spansion S34ML01G100TFI00 128 MB NAND Flash memory ++ * ++ * This ECC is a bit unorthodox but it is what the stock firmware ++ * is using, so to be able to mount the original partitions ++ * this is necessary. ++ */ ++ nand-ecc-strength = <5>; ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ /* This is named nflash1.trx in CFE */ ++ trx@0 { ++ label = "firmware"; ++ reg = <0x00000000 0x02800000>; ++ compatible = "brcm,trx"; ++ }; ++ ++ /* This is named nflash1.trx2 in CFE */ ++ trx2@2800000 { ++ label = "firmware2"; ++ reg = <0x02800000 0x02800000>; ++ compatible = "brcm,trx"; ++ }; ++ ++ /* This is named nflash1.rwfs in CFE */ ++ free@5000000 { ++ label = "free"; ++ reg = <0x05000000 0x03000000>; ++ }; ++ }; ++}; diff --git a/target/linux/bcm53xx/patches-5.4/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch b/target/linux/bcm53xx/patches-5.4/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch index 0c8a5c63cd..0fb29e99d3 100644 --- a/target/linux/bcm53xx/patches-5.4/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch +++ b/target/linux/bcm53xx/patches-5.4/304-ARM-dts-BCM5301X-Specify-switch-ports-for-remaining-.patch @@ -311,7 +311,7 @@ Signed-off-by: Rafał Miłecki +}; --- a/arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts +++ b/arch/arm/boot/dts/bcm4709-asus-rt-ac87u.dts -@@ -68,6 +68,38 @@ +@@ -66,6 +66,38 @@ status = "okay"; }; @@ -352,7 +352,7 @@ Signed-off-by: Rafał Miłecki compatible = "fixed-partitions"; --- a/arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dts +++ b/arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dts -@@ -132,3 +132,40 @@ +@@ -130,3 +130,40 @@ &usb3_phy { status = "okay"; }; @@ -395,7 +395,7 @@ Signed-off-by: Rafał Miłecki +}; --- a/arch/arm/boot/dts/bcm4709-linksys-ea9200.dts +++ b/arch/arm/boot/dts/bcm4709-linksys-ea9200.dts -@@ -49,3 +49,45 @@ +@@ -47,3 +47,45 @@ &usb3_phy { status = "okay"; }; @@ -443,7 +443,7 @@ Signed-off-by: Rafał Miłecki +}; --- a/arch/arm/boot/dts/bcm4709-netgear-r7000.dts +++ b/arch/arm/boot/dts/bcm4709-netgear-r7000.dts -@@ -106,3 +106,40 @@ +@@ -104,3 +104,40 @@ &usb3_phy { status = "okay"; }; @@ -573,3 +573,139 @@ Signed-off-by: Rafał Miłecki &nandcs { partitions { compatible = "fixed-partitions"; +--- a/arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts ++++ b/arch/arm/boot/dts/bcm47081-tplink-archer-c5-v2.dts +@@ -91,6 +91,43 @@ + }; + }; + ++&srab { ++ status = "okay"; ++ ++ ports { ++ port@0 { ++ reg = <0>; ++ label = "wan"; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ label = "lan1"; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ label = "lan2"; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ label = "lan3"; ++ }; ++ ++ port@4 { ++ reg = <4>; ++ label = "lan4"; ++ }; ++ ++ port@5 { ++ reg = <5>; ++ label = "cpu"; ++ ethernet = <&gmac0>; ++ }; ++ }; ++}; ++ + &spi_nor { + status = "okay"; + +--- a/arch/arm/boot/dts/bcm4709-tplink-archer-c9-v1.dts ++++ b/arch/arm/boot/dts/bcm4709-tplink-archer-c9-v1.dts +@@ -100,6 +100,43 @@ + vcc-gpio = <&chipcommon 12 GPIO_ACTIVE_HIGH>; + }; + ++&srab { ++ status = "okay"; ++ ++ ports { ++ port@0 { ++ reg = <0>; ++ label = "wan"; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ label = "lan1"; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ label = "lan2"; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ label = "lan3"; ++ }; ++ ++ port@4 { ++ reg = <4>; ++ label = "lan4"; ++ }; ++ ++ port@5 { ++ reg = <5>; ++ label = "cpu"; ++ ethernet = <&gmac0>; ++ }; ++ }; ++}; ++ + &spi_nor { + status = "okay"; + +--- a/arch/arm/boot/dts/bcm47081-buffalo-wzr-900dhp.dts ++++ b/arch/arm/boot/dts/bcm47081-buffalo-wzr-900dhp.dts +@@ -107,3 +107,41 @@ + &usb3_phy { + status = "okay"; + }; ++ ++&srab { ++ status = "okay"; ++ ++ ports { ++ 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@5 { ++ reg = <5>; ++ label = "cpu"; ++ ethernet = <&gmac0>; ++ }; ++ }; ++}; ++ diff --git a/target/linux/bcm53xx/patches-5.4/310-ARM-BCM5301X-Add-DT-for-Netgear-R7900.patch b/target/linux/bcm53xx/patches-5.4/310-ARM-BCM5301X-Add-DT-for-Netgear-R7900.patch index 7c67605a88..60fc630a49 100644 --- a/target/linux/bcm53xx/patches-5.4/310-ARM-BCM5301X-Add-DT-for-Netgear-R7900.patch +++ b/target/linux/bcm53xx/patches-5.4/310-ARM-BCM5301X-Add-DT-for-Netgear-R7900.patch @@ -9,7 +9,7 @@ Signed-off-by: Rafał Miłecki --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile -@@ -106,6 +106,7 @@ dtb-$(CONFIG_ARCH_BCM_5301X) += \ +@@ -108,6 +108,7 @@ dtb-$(CONFIG_ARCH_BCM_5301X) += \ bcm4709-buffalo-wxr-1900dhp.dtb \ bcm4709-linksys-ea9200.dtb \ bcm4709-netgear-r7000.dtb \ diff --git a/target/linux/bcm53xx/patches-5.4/311-ARM-BCM5301X-Add-power-button-for-Buffalo-WZR-1750DHP.patch b/target/linux/bcm53xx/patches-5.4/311-ARM-BCM5301X-Add-power-button-for-Buffalo-WZR-1750DHP.patch index b3cb5de048..9e7398c66d 100644 --- a/target/linux/bcm53xx/patches-5.4/311-ARM-BCM5301X-Add-power-button-for-Buffalo-WZR-1750DHP.patch +++ b/target/linux/bcm53xx/patches-5.4/311-ARM-BCM5301X-Add-power-button-for-Buffalo-WZR-1750DHP.patch @@ -9,12 +9,12 @@ Signed-off-by: Felix Fietkau gpio-keys { compatible = "gpio-keys"; -+ power { ++ button-power { + label = "Power"; + linux,code = ; + gpios = <&chipcommon 1 GPIO_ACTIVE_LOW>; + }; + - restart { + button-restart { label = "Reset"; linux,code = ; diff --git a/target/linux/bcm53xx/patches-5.4/331-Meraki-MR32-Status-LEDs.patch b/target/linux/bcm53xx/patches-5.4/331-Meraki-MR32-Status-LEDs.patch index fb78ee93c4..92a71e58fe 100644 --- a/target/linux/bcm53xx/patches-5.4/331-Meraki-MR32-Status-LEDs.patch +++ b/target/linux/bcm53xx/patches-5.4/331-Meraki-MR32-Status-LEDs.patch @@ -17,7 +17,7 @@ Signed-off-by: Christian Lamparter }; leds { -@@ -68,7 +69,7 @@ +@@ -66,7 +67,7 @@ max-brightness = <255>; }; From 88e8ca256bc92765fcd34c7e371163ac38b623f6 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 28 Nov 2022 21:05:54 +0100 Subject: [PATCH 039/137] layerscape: fix compilation error for missing define of dwc quirk Add missing define for dwc quirk patch required to fix compilation error for layerscape target. This was wrongly dropped in a kernel bump. Fixes: 8e5de897691a ("kernel: bump 5.4 to 5.4.213") Signed-off-by: Christian Marangi --- ...dwc3-Add-workaround-for-host-mode-VBUS-glitch-wh.patch | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/target/linux/layerscape/patches-5.4/820-usb-0009-usb-dwc3-Add-workaround-for-host-mode-VBUS-glitch-wh.patch b/target/linux/layerscape/patches-5.4/820-usb-0009-usb-dwc3-Add-workaround-for-host-mode-VBUS-glitch-wh.patch index 0e2942a3bc..be6b077e0b 100644 --- a/target/linux/layerscape/patches-5.4/820-usb-0009-usb-dwc3-Add-workaround-for-host-mode-VBUS-glitch-wh.patch +++ b/target/linux/layerscape/patches-5.4/820-usb-0009-usb-dwc3-Add-workaround-for-host-mode-VBUS-glitch-wh.patch @@ -64,8 +64,12 @@ Reviewed-by: Peter Chen --- a/drivers/usb/dwc3/host.c +++ b/drivers/usb/dwc3/host.c -@@ -11,6 +11,44 @@ +@@ -9,8 +9,48 @@ + #include + ++#include "../host/xhci.h" ++ #include "core.h" +#define XHCI_HCSPARAMS1 0x4 @@ -109,7 +113,7 @@ Reviewed-by: Peter Chen static int dwc3_host_get_irq(struct dwc3 *dwc) { struct platform_device *dwc3_pdev = to_platform_device(dwc->dev); -@@ -50,6 +88,13 @@ int dwc3_host_init(struct dwc3 *dwc) +@@ -50,6 +90,13 @@ int dwc3_host_init(struct dwc3 *dwc) struct platform_device *dwc3_pdev = to_platform_device(dwc->dev); int prop_idx = 0; From 1392bec7de92888af06d98d11d306241b2e1f68f Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Tue, 29 Nov 2022 16:35:48 +0100 Subject: [PATCH 040/137] procd: add patch to fix compilation error procd complain for an unused verbose variable causing compilation error. Fix this by setting the variable static following upstream procd changes. This is a variant of 0ee73b2c86a853ae3274c7080e2dcd36b81aa1fa that introduced major change and fixed the verbose variable to static. Signed-off-by: Christian Marangi --- ...tion-error-caused-by-unused-variable.patch | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 package/system/procd/patches/0001-uxc-fix-compilation-error-caused-by-unused-variable.patch diff --git a/package/system/procd/patches/0001-uxc-fix-compilation-error-caused-by-unused-variable.patch b/package/system/procd/patches/0001-uxc-fix-compilation-error-caused-by-unused-variable.patch new file mode 100644 index 0000000000..6c1a21ebea --- /dev/null +++ b/package/system/procd/patches/0001-uxc-fix-compilation-error-caused-by-unused-variable.patch @@ -0,0 +1,36 @@ +From 2ddf0005298e08ba1e358d95be6b826c56a7d1fc Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Tue, 29 Nov 2022 16:33:23 +0100 +Subject: [PATCH] uxc: fix compilation error caused by unused variable + +Fix compilation error caused by unused verbose variable. + +Signed-off-by: Christian Marangi +--- + uxc.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/uxc.c b/uxc.c +index eb40eb2..b22d838 100644 +--- a/uxc.c ++++ b/uxc.c +@@ -80,6 +80,8 @@ static struct blob_buf conf; + static struct blob_buf state; + static struct ubus_context *ctx; + ++static bool verbose = false; ++ + static int usage(void) { + printf("syntax: uxc [parameters ...]\n"); + printf("commands:\n"); +@@ -724,7 +726,6 @@ int main(int argc, char **argv) + char *pidfile = NULL; + bool autostart = false; + bool force = false; +- bool verbose = false; + int signal = SIGTERM; + int c; + +-- +2.37.2 + From 360d756fbf01e0a051ff47223523deffae647afa Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Tue, 6 Sep 2022 16:48:37 +0200 Subject: [PATCH 041/137] build: make find_md5 reproducible with AUTOREMOVE While experimenting with the AUTOREMOVE option in search of a way to use prebuilt host tools in different buildroot, it was discovered that the md5 generated by find_md5 in depends.mk is not reproducible. Currently the hash is generated by the path of the file in addition to the file mod time. Out of confusion, probably, there was an idea that such command was used on the package build_dir. Reality is that this command is run on the package files. (Makefile, patches, src) This is problematic because the package Makefile (for example) change at each git clone and base the hash on the Makefile mtime doesn't really reflect if the Makefile actually changes across a buildroot or not. A better approach is to generate an hash of each file and then generate an hash on the sort hash list. This way we remove the problem of git clone setting a wrong mtime while keeping the integrity of checking if a file changed for the package as any change will result in a different hash. Introduce a new kind of find_md5 function, find_md5_reproducible that apply this new logic and limit it only with AUTOREMOVE option set to prevent any kind of slowdown due to additional hash generation. (cherry picked from commit 53a08e37437972ba0a8fbf953a93a70a6b784ef4) [ reworked mkhash to old implementation ] Signed-off-by: Christian Marangi --- include/depends.mk | 1 + include/host-build.mk | 2 +- include/kernel-build.mk | 2 +- include/package.mk | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/depends.mk b/include/depends.mk index 0080b97876..7b87f2643f 100644 --- a/include/depends.mk +++ b/include/depends.mk @@ -12,6 +12,7 @@ DEP_FINDPARAMS := -x "*/.svn*" -x ".*" -x "*:*" -x "*\!*" -x "* *" -x "*\\\#*" -x "*/.*_check" -x "*/.*.swp" -x "*/.pkgdir*" find_md5=find $(wildcard $(1)) -type f $(patsubst -x,-and -not -path,$(DEP_FINDPARAMS) $(2)) -printf "%p%T@\n" | sort | mkhash md5 +find_md5_reproducible=find $(wildcard $(1)) -type f $(patsubst -x,-and -not -path,$(DEP_FINDPARAMS) $(2)) -print0 | xargs -0 mkhash md5 | sort | mkhash md5 define rdep .PRECIOUS: $(2) diff --git a/include/host-build.mk b/include/host-build.mk index e4a5c48e72..36b3fed1f3 100644 --- a/include/host-build.mk +++ b/include/host-build.mk @@ -21,7 +21,7 @@ include $(INCLUDE_DIR)/depends.mk include $(INCLUDE_DIR)/quilt.mk BUILD_TYPES += host -HOST_STAMP_PREPARED=$(HOST_BUILD_DIR)/.prepared$(if $(HOST_QUILT)$(DUMP),,$(shell $(call find_md5,${CURDIR} $(PKG_FILE_DEPENDS),))_$(call confvar,CONFIG_AUTOREMOVE $(HOST_PREPARED_DEPENDS))) +HOST_STAMP_PREPARED=$(HOST_BUILD_DIR)/.prepared$(if $(HOST_QUILT)$(DUMP),,$(shell $(call $(if $(CONFIG_AUTOREMOVE),find_md5_reproducible,find_md5),${CURDIR} $(PKG_FILE_DEPENDS),))_$(call confvar,CONFIG_AUTOREMOVE $(HOST_PREPARED_DEPENDS))) HOST_STAMP_CONFIGURED:=$(HOST_BUILD_DIR)/.configured HOST_STAMP_BUILT:=$(HOST_BUILD_DIR)/.built HOST_BUILD_PREFIX?=$(if $(IS_PACKAGE_BUILD),$(STAGING_DIR_HOSTPKG),$(STAGING_DIR_HOST)) diff --git a/include/kernel-build.mk b/include/kernel-build.mk index 66a9f64c80..1f440f9ee0 100644 --- a/include/kernel-build.mk +++ b/include/kernel-build.mk @@ -10,7 +10,7 @@ ifneq ($(DUMP),1) endif KERNEL_FILE_DEPENDS=$(GENERIC_BACKPORT_DIR) $(GENERIC_PATCH_DIR) $(GENERIC_HACK_DIR) $(PATCH_DIR) $(GENERIC_FILES_DIR) $(FILES_DIR) -STAMP_PREPARED=$(LINUX_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call find_md5,$(KERNEL_FILE_DEPENDS),))) +STAMP_PREPARED=$(LINUX_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call $(if $(CONFIG_AUTOREMOVE),find_md5_reproducible,find_md5),$(KERNEL_FILE_DEPENDS),))) STAMP_CONFIGURED:=$(LINUX_DIR)/.configured include $(INCLUDE_DIR)/download.mk include $(INCLUDE_DIR)/quilt.mk diff --git a/include/package.mk b/include/package.mk index db0a869dab..389ba4243b 100644 --- a/include/package.mk +++ b/include/package.mk @@ -84,7 +84,7 @@ ifneq ($(PREV_STAMP_PREPARED),) STAMP_PREPARED:=$(PREV_STAMP_PREPARED) CONFIG_AUTOREBUILD:= else - STAMP_PREPARED=$(PKG_BUILD_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call find_md5,${CURDIR} $(PKG_FILE_DEPENDS),))_$(call confvar,CONFIG_AUTOREMOVE $(PKG_PREPARED_DEPENDS))) + STAMP_PREPARED=$(PKG_BUILD_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call $(if $(CONFIG_AUTOREMOVE),find_md5_reproducible,find_md5),${CURDIR} $(PKG_FILE_DEPENDS),))_$(call confvar,CONFIG_AUTOREMOVE $(PKG_PREPARED_DEPENDS))) endif STAMP_CONFIGURED=$(PKG_BUILD_DIR)/.configured$(if $(DUMP),,_$(call confvar,$(PKG_CONFIG_DEPENDS))) STAMP_CONFIGURED_WILDCARD=$(PKG_BUILD_DIR)/.configured_* From 654e0242e426423409a704bfc5f72b64ebd8d283 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 3 Jul 2022 02:06:21 +0200 Subject: [PATCH 042/137] rules_mk: don't include wrapped bin with external toolchains Don't add wrapped bin to the TARGET_PATH as it does cause compilation error. cmake.mk will use the "command -v" and will use the wrapped bin instead of the external toolchain bin as they have the same name and command will select the first result. Signed-off-by: Christian Marangi (cherry picked from commit a90eabf60255773231ed0259e5da5eb6a36fe9ce) --- rules.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/rules.mk b/rules.mk index 7c83d90eda..9c694e17ce 100644 --- a/rules.mk +++ b/rules.mk @@ -212,7 +212,6 @@ ifndef DUMP ifneq ($(TOOLCHAIN_LIB_DIRS),) TARGET_LDFLAGS+= $(patsubst %,-L%,$(TOOLCHAIN_LIB_DIRS)) endif - TARGET_PATH:=$(TOOLCHAIN_DIR)/bin:$(TARGET_PATH) endif endif endif From 56fd8355b078d8c9e1eb0bc0ea20900e7b46fe93 Mon Sep 17 00:00:00 2001 From: Vincent Wiemann Date: Mon, 28 Dec 2020 16:00:13 +0100 Subject: [PATCH 043/137] rules_mk: use gcc versions for external toolchain When using the OpenWrt toolchain as an external toolchain the build failed due to missing LTO support. By choosing the GCC wrappers of the tools this commit makes sure that the LTO-enabled executables are being used. Signed-off-by: Vincent Wiemann [ wrap the commit description to 72 char ] Signed-off-by: Christian Marangi (cherry picked from commit 2555ffb4536e2727465e9a0d426ad3c4f1ef003a) --- rules.mk | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/rules.mk b/rules.mk index 9c694e17ce..631e07af00 100644 --- a/rules.mk +++ b/rules.mk @@ -245,20 +245,13 @@ HOST_CPPFLAGS:=-I$(STAGING_DIR_HOST)/include $(if $(IS_PACKAGE_BUILD),-I$(STAGIN HOST_CFLAGS:=-O2 $(HOST_CPPFLAGS) HOST_LDFLAGS:=-L$(STAGING_DIR_HOST)/lib $(if $(IS_PACKAGE_BUILD),-L$(STAGING_DIR_HOSTPKG)/lib -L$(STAGING_DIR)/host/lib) -ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) - TARGET_AR:=$(TARGET_CROSS)gcc-ar - TARGET_RANLIB:=$(TARGET_CROSS)gcc-ranlib - TARGET_NM:=$(TARGET_CROSS)gcc-nm -else - TARGET_AR:=$(TARGET_CROSS)ar - TARGET_RANLIB:=$(TARGET_CROSS)ranlib - TARGET_NM:=$(TARGET_CROSS)nm -endif - BUILD_KEY=$(TOPDIR)/key-build FAKEROOT:=$(STAGING_DIR_HOST)/bin/fakeroot +TARGET_AR:=$(TARGET_CROSS)gcc-ar +TARGET_RANLIB:=$(TARGET_CROSS)gcc-ranlib +TARGET_NM:=$(TARGET_CROSS)gcc-nm TARGET_CC:=$(TARGET_CROSS)gcc TARGET_CXX:=$(TARGET_CROSS)g++ KPATCH:=$(SCRIPT_DIR)/patch-kernel.sh From 629199f6c8e0dc36484dd17e971f8c1c88b705b1 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 12 Sep 2022 00:31:43 +0200 Subject: [PATCH 044/137] toolchain: Include ./include/fortify for external musl toolchain When building with an external toolcahin with musl also include ./include/fortify by default. This is also done when we build with the internal toolchain using musl libc. Without this extra include the fortify source feature is not working when using an external musl toolchain. All binaries were compiled without fortify source when an external musl toolchain was used. All binaries release done by the OpenWrt project use the internal toolcahin where fortify source is working. Signed-off-by: Hauke Mehrtens (cherry picked from commit 3053045093a5c89dad970b7db3ed9f2a5be993f6) Signed-off-by: Christian Marangi --- toolchain/Config.in | 1 + 1 file changed, 1 insertion(+) diff --git a/toolchain/Config.in b/toolchain/Config.in index 6dda9af92d..c30928854b 100644 --- a/toolchain/Config.in +++ b/toolchain/Config.in @@ -135,6 +135,7 @@ menuconfig EXTERNAL_TOOLCHAIN string prompt "Toolchain include path" if DEVEL depends on EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN + default "./usr/include ./include/fortify ./include" if EXTERNAL_TOOLCHAIN_LIBC_USE_MUSL default "./usr/include ./include" help Specify additional directories searched for header files (override From fd7e8e4e7520ac7531c1008a83557c7a04860da5 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 30 Sep 2022 19:36:06 +0200 Subject: [PATCH 045/137] scripts/ext-tools: introduce new script to install prebuilt tools Add a simple script to make it easier to install a prebuilt tools tar. Currently it will be used by our tools container and kernel workflow on github. Simple script that take a tar that contains prebuilt host tools, extract them and refresh the timestamps to skip recompilation of such host tools. By default it refresh timestamps of build_dir/host and staging_dir/host/stamp. Signed-off-by: Christian Marangi (cherry picked from commit 5428bdc2dfaa45bc7adc89c3b9224da7d21961d0) --- scripts/ext-tools.sh | 98 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100755 scripts/ext-tools.sh diff --git a/scripts/ext-tools.sh b/scripts/ext-tools.sh new file mode 100755 index 0000000000..bf56f4d9ed --- /dev/null +++ b/scripts/ext-tools.sh @@ -0,0 +1,98 @@ +#!/usr/bin/env bash + +TOOLS_TAR="" +HOST_BUILD_DIR=$(pwd)/"build_dir/host" +HOST_STAGING_DIR_STAMP=$(pwd)/"staging_dir/host/stamp" + +refresh_timestamps() { + find "$1" -not -type l -print0 | xargs -0 touch +} + +extract_prebuilt_tar() { + tar -xf "$1" +} + +install_prebuilt_tools() { + extract_prebuilt_tar "$TOOLS_TAR" + + if [ ! -d "$HOST_BUILD_DIR" ]; then + echo "Can't find Host Build Dir "$HOST_BUILD_DIR"" >&2 + exit 1 + fi + + refresh_timestamps "$HOST_BUILD_DIR" + sleep 1 + + if [ ! -d "$HOST_STAGING_DIR_STAMP" ]; then + echo "Can't find Host Staging Dir Stamp "$HOST_STAGING_DIR_STAMP"" >&2 + exit 1 + fi + + refresh_timestamps "$HOST_STAGING_DIR_STAMP" + + return 0 +} + +while [ -n "$1" ]; do + arg="$1"; shift + case "$arg" in + --host-build-dir) + [ -d "$1" ] || { + echo "Directory '$1' does not exist." >&2 + exit 1 + } + HOST_BUILD_DIR="$(cd "$1"; pwd)"; shift + ;; + + --host-staging-dir-stamp) + [ -d "$1" ] || { + echo "Directory '$1' does not exist." >&2 + exit 1 + } + HOST_STAGING_DIR_STAMP="$(cd "$1"; pwd)"; shift + ;; + + --tools) + [ -f "$1" ] || { + echo "Tools tar file '$1' does not exist." >&2 + exit 1 + } + TOOLS_TAR="$1"; shift + install_prebuilt_tools + + exit $? + ;; + + -h|--help) + me="$(basename "$0")" + echo -e "\nUsage:\n" >&2 + echo -e " $me --host-build-dir {directory}" >&2 + echo -e " Set to refresh timestamp of this build directory" >&2 + echo -e " with --tools." >&2 + echo -e " THIS OPTION MUST BE SET BEFORE --tools." >&2 + echo -e " If not provided the default directory is:" >&2 + echo -e " $(pwd)/build_dir/host\n" >&2 + echo -e " $me --host-staging-dir-stamp {directory}" >&2 + echo -e " Set to refresh staging timestamp present in this" >&2 + echo -e " directory with --tools." >&2 + echo -e " THIS OPTION MUST BE SET BEFORE --tools." >&2 + echo -e " If not provided the default directory is:" >&2 + echo -e " $(pwd)/staging_dir/host/stamp\n" >&2 + echo -e " $me --tools {tar}" >&2 + echo -e " Install the prebuilt tools present in the passed" >&2 + echo -e " tar and prepare them." >&2 + echo -e " To correctly use them it's needed to update the." >&2 + echo -e " timestamp of each tools to skip recompilation.\n" >&2 + echo -e " $me --help" >&2 + echo -e " Display this help text and exit.\n\n" >&2 + exit 1 + ;; + + *) + echo "Unknown argument '$arg'" >&2 + exec $0 --help + ;; + esac +done + +exec $0 --help From 997ab5437386493aab1ffa9a9e99061a6a4cba4b Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sun, 26 Sep 2021 17:58:59 -0400 Subject: [PATCH 046/137] scripts: fix various typos This only affects typos in comments or user-facing output. Signed-off-by: Josh Soref [only picks changes to scripts, drop "commandline" replacement, fix case for "arbitrary", improve commit message] Signed-off-by: Adrian Schmutzler (cherry picked from commit 08622de7d66eb90038de54f34ab2fe2308424fd0) Signed-off-by: Christian Marangi --- scripts/checkpatch.pl | 2 +- scripts/dl_github_archive.py | 4 ++-- scripts/ext-toolchain.sh | 2 +- scripts/json_overview_image_info.py | 2 +- scripts/linksys-image.sh | 4 ++-- scripts/pad_image | 2 +- scripts/sign_images.sh | 4 ++-- scripts/size_compare.sh | 4 ++-- scripts/slugimage.pl | 4 ++-- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 81b1ffcb56..2adc5efec5 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -4697,7 +4697,7 @@ sub process { ## $line !~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Type\s*$Ident.*/) { ## ## # Remove any bracketed sections to ensure we do not -## # falsly report the parameters of functions. +## # falsely report the parameters of functions. ## my $ln = $line; ## while ($ln =~ s/\([^\(\)]*\)//g) { ## } diff --git a/scripts/dl_github_archive.py b/scripts/dl_github_archive.py index 59fd7067be..b992227dc9 100755 --- a/scripts/dl_github_archive.py +++ b/scripts/dl_github_archive.py @@ -207,7 +207,7 @@ class GitHubCommitTsCache(object): class DownloadGitHubTarball(object): - """Download and repack archive tarabll from GitHub. + """Download and repack archive tarball from GitHub. Compared with the method of packing after cloning the whole repo, this method is more friendly to users with fragile internet connection. @@ -220,7 +220,7 @@ class DownloadGitHubTarball(object): - GitHub archives do not contain source codes for submodules. - - GitHub archives seem to respect .gitattributes and ignore pathes with + - GitHub archives seem to respect .gitattributes and ignore paths with export-ignore attributes. For the first two issues, the method will fail loudly to allow fallback to diff --git a/scripts/ext-toolchain.sh b/scripts/ext-toolchain.sh index ee7d9532f5..4da287591a 100755 --- a/scripts/ext-toolchain.sh +++ b/scripts/ext-toolchain.sh @@ -569,7 +569,7 @@ while [ -n "$1" ]; do echo -e " Most commands also take a --cflags parameter which " >&2 echo -e " is used to specify C flags to be passed to the " >&2 echo -e " cross compiler when performing tests." >&2 - echo -e " This paremter may be repeated multiple times." >&2 + echo -e " This parameter may be repeated multiple times." >&2 exit 1 ;; diff --git a/scripts/json_overview_image_info.py b/scripts/json_overview_image_info.py index db47fd9e42..89b7d4fe20 100755 --- a/scripts/json_overview_image_info.py +++ b/scripts/json_overview_image_info.py @@ -7,7 +7,7 @@ from sys import argv import json if len(argv) != 2: - print("JSON info files script requires ouput file as argument") + print("JSON info files script requires output file as argument") exit(1) output_path = Path(argv[1]) diff --git a/scripts/linksys-image.sh b/scripts/linksys-image.sh index 36a676d964..c3baf44844 100755 --- a/scripts/linksys-image.sh +++ b/scripts/linksys-image.sh @@ -11,11 +11,11 @@ # This is appended to the factory image and is tested by the Linksys Upgrader - as observed in civic. # The footer is 256 bytes. The format is: # .LINKSYS. This is detected by the Linksys upgrader before continuing with upgrade. (9 bytes) -# The version number of upgrade. Not checked so use arbitary value (8 bytes) +# The version number of upgrade. Not checked so use arbitrary value (8 bytes) # Model of target device, padded (0x20) to (15 bytes) # CRC checksum of the image to flash (8 byte) # Padding (0x20) (7 bytes) -# Signature of signer. Not checked so use Arbitary value (16 bytes) +# Signature of signer. Not checked so use arbitrary value (16 bytes) # Padding (0x00) (192 bytes) # 0x0A (1 byte) diff --git a/scripts/pad_image b/scripts/pad_image index b1941a28d8..871063af34 100755 --- a/scripts/pad_image +++ b/scripts/pad_image @@ -2,7 +2,7 @@ function usage { echo "Usage: prepare_image image_type kernel_image rootfs_image header_size" - echo "Padd root and kernel image to the correct size and append the jffs2 start marker as needed" + echo "Pad root and kernel image to the correct size and append the jffs2 start marker as needed" exit 1 } diff --git a/scripts/sign_images.sh b/scripts/sign_images.sh index c41b21e091..f37c2f5016 100755 --- a/scripts/sign_images.sh +++ b/scripts/sign_images.sh @@ -3,12 +3,12 @@ # directory where search for images TOP_DIR="${TOP_DIR:-./bin/targets}" # key to sign images -BUILD_KEY="${BUILD_KEY:-key-build}" # TODO unifiy naming? +BUILD_KEY="${BUILD_KEY:-key-build}" # TODO unify naming? # remove other signatures (added e.g. by buildbot) REMOVE_OTER_SIGNATURES="${REMOVE_OTER_SIGNATURES:-1}" # find all sysupgrade images in TOP_DIR -# factory images don't need signatures as non OpenWrt system doen't check them anyway +# factory images don't need signatures as non OpenWrt system doesn't check them anyway for image in $(find $TOP_DIR -type f -name "*-sysupgrade.bin"); do # check if image actually support metadata if fwtool -i /dev/null "$image"; then diff --git a/scripts/size_compare.sh b/scripts/size_compare.sh index 8b047a451e..a5cc3337c7 100755 --- a/scripts/size_compare.sh +++ b/scripts/size_compare.sh @@ -7,9 +7,9 @@ ### ### The script compares locally compiled package with the package indexes ### available upstream. This way the storage impact of optimizations or -### feature modifiactions is easy to see. +### feature modifications is easy to see. ### -### If no environmental variables are set the scritp reads the current +### If no environmental variables are set the script reads the current ### .config file. The evaluated env variables are the following: ### ### TARGET SUBTARGET ARCH PACKAGES BIN_DIR BASE_URL CHECK_INSTALLED diff --git a/scripts/slugimage.pl b/scripts/slugimage.pl index 8c0654d4f6..366b239e96 100755 --- a/scripts/slugimage.pl +++ b/scripts/slugimage.pl @@ -772,7 +772,7 @@ sub writeOutFirmware { $_->{'name'}, $filename); } - # If the next parition is before the end of the current image, then rewind. + # If the next partition is before the end of the current image, then rewind. elsif ($_->{'offset'} < $end_point) { $debug and printf("Rewound %s before <%s> in \"%s\"\n", (($end_point - $_->{'offset'}) >= $block_size ? @@ -971,7 +971,7 @@ if (!GetOptions("d|debug" => \$debug, print " [-b|--redboot] Input/Output RedBoot filename\n"; print " [-s|--sysconf] Input/Output SysConf filename\n"; print " [-L|--loader] Second stage boot loader filename\n"; - print " [-k|--kernel] Input/Ouptut Kernel filename\n"; + print " [-k|--kernel] Input/Output Kernel filename\n"; print " [-r|--ramdisk] Input/Output Ramdisk filename(s)\n"; print " [-f|--fisdir] Input/Output FIS directory filename\n"; print " [-m|--microcode] Input/Output Microcode filename\n"; From 1e764ea7df11e1d51e60336f420ca73480b8c055 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 3 Jul 2022 02:20:11 +0200 Subject: [PATCH 047/137] scripts: ext-toolchain: fix wrong prefix in print_config generation The parsed prefix in print_config is wrong and this produce broken generated .config that won't work with any external toolchain. Currently the prefix from a CC of 'arm-openwrt-linux-muslgnueabi-gcc-12.1.0' produce a prefix 'arm-openwrt-linux-muslgnueabi-gcc-' This is wrong as the real prefix should be 'arm-openwrt-linux-muslgnueabi-' This is probably caused by a change in how the toolchain is now handled that now append also the gcc version. Probably in ancient days the version wasn't part of the name and the prefix generation stripped the '-gcc' instead of the gcc version. Fix this and correctly strip the gcc version and the gcc suffix to correctly call toolchain bins. Signed-off-by: Christian Marangi (cherry picked from commit 53c293262fce844c8291ab82e6726a8489d3c57b) --- scripts/ext-toolchain.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/ext-toolchain.sh b/scripts/ext-toolchain.sh index 4da287591a..b52f170b32 100755 --- a/scripts/ext-toolchain.sh +++ b/scripts/ext-toolchain.sh @@ -281,8 +281,11 @@ print_config() { local mksubtarget local target="$("$CC" $CFLAGS -dumpmachine)" + local version="$("$CC" $CFLAGS -dumpversion)" local cpuarch="${target%%-*}" - local prefix="${CC##*/}"; prefix="${prefix%-*}-" + + # get CC; strip version; strip gcc and add - suffix + local prefix="${CC##*/}"; prefix="${prefix%-$version}"; prefix="${prefix%-*}-" local config="${0%/scripts/*}/.config" # if no target specified, print choice list and exit From ed785589ea9a11d526a01067b79af4fe1b5dd5b7 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 4 Jul 2022 18:22:18 +0200 Subject: [PATCH 048/137] scripts: ext-toolchain: add option to overwrite config It can be useful to overwrite an already generated config. Option are simply added at the end of the config and make defconfig will overwrite the relevant option with the new one. Signed-off-by: Christian Marangi (cherry picked from commit f4dd18ca39c42a324e34633c8ee553717531bc3b) --- scripts/ext-toolchain.sh | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/scripts/ext-toolchain.sh b/scripts/ext-toolchain.sh index b52f170b32..c9ceb150c1 100755 --- a/scripts/ext-toolchain.sh +++ b/scripts/ext-toolchain.sh @@ -50,6 +50,7 @@ BIN_SPECS=" gdbserver: gdbserver " +OVERWRITE_CONFIG="" test_c() { cat <<-EOT | "${CC:-false}" $CFLAGS -o /dev/null -x c - 2>/dev/null @@ -320,9 +321,13 @@ print_config() { fi # bail out if there is a .config already - if [ -f "${0%/scripts/*}/.config" ]; then - echo "There already is a .config file, refusing to overwrite!" >&2 - return 1 + if [ -f "$config" ]; then + if [ "$OVERWRITE_CONFIG" == "" ]; then + echo "There already is a .config file, refusing to overwrite!" >&2 + return 1 + else + echo "There already is a .config file, trying to overwrite!" + fi fi case "$mktarget" in */*) @@ -330,8 +335,11 @@ print_config() { mktarget="${mktarget%/*}" ;; esac + if [ ! -f "$config" ]; then + touch "$config" + fi - echo "CONFIG_TARGET_${mktarget}=y" > "$config" + echo "CONFIG_TARGET_${mktarget}=y" >> "$config" if [ -n "$mksubtarget" ]; then echo "CONFIG_TARGET_${mktarget}_${mksubtarget}=y" >> "$config" @@ -532,6 +540,10 @@ while [ -n "$1" ]; do exit $? ;; + --overwrite-config) + OVERWRITE_CONFIG=y + ;; + --config) if probe_cc; then print_config "$1" @@ -573,6 +585,8 @@ while [ -n "$1" ]; do echo -e " is used to specify C flags to be passed to the " >&2 echo -e " cross compiler when performing tests." >&2 echo -e " This parameter may be repeated multiple times." >&2 + echo -e " Use --overwrite-config before --config to overwrite" >&2 + echo -e " an already present config with the required changes.">&2 exit 1 ;; From 1f5b8a32e4a07b5ca55b0fce73ade5e026d4e584 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 17 Jul 2022 17:53:58 +0200 Subject: [PATCH 049/137] scripts: ext-toolchain: actually probe libc type on config generation Currently we never call probe_cc before config generation, this cause the script to never actually detect the correct libc type. Call probe_cc before config generation to correctl set the .config file. Signed-off-by: Christian Marangi (cherry picked from commit ddeabc75ebe3151ff7da302cb1aae702b3ad7eba) --- scripts/ext-toolchain.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/ext-toolchain.sh b/scripts/ext-toolchain.sh index c9ceb150c1..1ef3f42c50 100755 --- a/scripts/ext-toolchain.sh +++ b/scripts/ext-toolchain.sh @@ -546,6 +546,7 @@ while [ -n "$1" ]; do --config) if probe_cc; then + probe_libc print_config "$1" exit $? fi From 462c5653e18f0bd2c9ec66a2b154bf26d8f4aa1d Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 17 Jul 2022 17:56:36 +0200 Subject: [PATCH 050/137] scripts: ext-toolchain: add support for info.mk in probe_cc Openwrt generate info.mk that contains the libc type. For probe_cc check if the file exist and parse directly it for LIBC type. Signed-off-by: Christian Marangi (cherry picked from commit 75311977f5ff64b491cb57ac713d75e0e410d786) --- scripts/ext-toolchain.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/ext-toolchain.sh b/scripts/ext-toolchain.sh index 1ef3f42c50..1f8eca3076 100755 --- a/scripts/ext-toolchain.sh +++ b/scripts/ext-toolchain.sh @@ -463,6 +463,13 @@ probe_cpp() { } probe_libc() { + if [ -f $TOOLCHAIN/info.mk ]; then + LIBC_TYPE=$(grep LIBC_TYPE $TOOLCHAIN/info.mk | sed 's/LIBC_TYPE=//') + return 0 + fi + + echo "Warning! Can't find info.mk, trying to detect with alternative way." + if [ -z "$LIBC_TYPE" ]; then if test_uclibc; then LIBC_TYPE="uclibc" From fd90eed40ce6828a1bbd11d1a394e7c6368d0577 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 17 Jul 2022 17:56:59 +0200 Subject: [PATCH 051/137] scripts: ext-toolchain: add support for musl Openwrt now supports only glibc and musl. Add support for musl and rework the libc check to handle the new config flags and correctly compile package basend on that. Signed-off-by: Christian Marangi (cherry picked from commit 7be01fe13b4517e5edb8a4818f437d60144cdcb4) --- scripts/ext-toolchain.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/ext-toolchain.sh b/scripts/ext-toolchain.sh index 1f8eca3076..fe1024c18e 100755 --- a/scripts/ext-toolchain.sh +++ b/scripts/ext-toolchain.sh @@ -369,8 +369,18 @@ print_config() { echo "CONFIG_TOOLCHAIN_PREFIX=\"$prefix\"" >> "$config" echo "CONFIG_TARGET_NAME=\"$target\"" >> "$config" - if [ "$LIBC_TYPE" != glibc ]; then - echo "CONFIG_TOOLCHAIN_LIBC=\"$LIBC_TYPE\"" >> "$config" + if [ -f "$config" ]; then + sed -i '/CONFIG_EXTERNAL_TOOLCHAIN_LIBC_USE_MUSL/d' "$config" + sed -i '/CONFIG_EXTERNAL_TOOLCHAIN_LIBC_USE_GLIBC/d' "$config" + fi + + if [ "$LIBC_TYPE" == glibc ]; then + echo "CONFIG_EXTERNAL_TOOLCHAIN_LIBC_USE_GLIBC=y" >> "$config" + elif [ "$LIBC_TYPE" == musl ]; then + echo "CONFIG_EXTERNAL_TOOLCHAIN_LIBC_USE_MUSL=y" >> "$config" + else + echo "Can't detect LIBC type. Aborting!" >&2 + return 1 fi local lib From 09f4533d6d07eb7afd922ced0f4461e61d07a999 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Thu, 27 Jan 2022 10:25:19 +0100 Subject: [PATCH 052/137] CI: add formal checks The formal checks verify the following things: - Commits does not contain any merge commits - Signed by a real name - Commit titles starts with an `:` - Author name matches signed of name - Commit message is not empty Signed-off-by: Paul Spooren (cherry picked from commit 3dc38823a2994639500ca201ac16928b7bf0bd8a) --- .github/workflows/ci_helpers.sh | 26 ++++++++++++ .github/workflows/formal.yml | 70 +++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 .github/workflows/ci_helpers.sh create mode 100644 .github/workflows/formal.yml diff --git a/.github/workflows/ci_helpers.sh b/.github/workflows/ci_helpers.sh new file mode 100644 index 0000000000..2f9daf81e2 --- /dev/null +++ b/.github/workflows/ci_helpers.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +color_out() { + printf "\e[0;$1m%s\e[0;0m\n" "$2" +} + +success() { + color_out 32 "$1" +} + +info() { + color_out 36 "$1" +} + +err() { + color_out 31 "$1" +} + +warn() { + color_out 33 "$1" +} + +err_die() { + err "$1" + exit 1 +} diff --git a/.github/workflows/formal.yml b/.github/workflows/formal.yml new file mode 100644 index 0000000000..74e8fd6942 --- /dev/null +++ b/.github/workflows/formal.yml @@ -0,0 +1,70 @@ +name: Test Formalities + +on: + pull_request: + +jobs: + build: + name: Test Formalities + runs-on: ubuntu-latest + strategy: + fail-fast: false + + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + + - name: Determine branch name + run: | + BRANCH="${GITHUB_BASE_REF#refs/heads/}" + echo "Building for $BRANCH" + echo "BRANCH=$BRANCH" >> $GITHUB_ENV + + - name: Test formalities + run: | + source .github/workflows/ci_helpers.sh + + RET=0 + for commit in $(git rev-list HEAD ^origin/$BRANCH); do + info "=== Checking commit '$commit'" + if git show --format='%P' -s $commit | grep -qF ' '; then + err "Pull request should not include merge commits" + RET=1 + fi + + author="$(git show -s --format=%aN $commit)" + if echo $author | grep -q '\S\+\s\+\S\+'; then + success "Author name ($author) seems ok" + else + err "Author name ($author) need to be your real name 'firstname lastname'" + RET=1 + fi + + subject="$(git show -s --format=%s $commit)" + if echo "$subject" | grep -q -e '^[0-9A-Za-z,+/_-]\+: ' -e '^Revert '; then + success "Commit subject line seems ok ($subject)" + else + err "Commit subject line MUST start with ': ' ($subject)" + RET=1 + fi + + body="$(git show -s --format=%b $commit)" + sob="$(git show -s --format='Signed-off-by: %aN <%aE>' $commit)" + if echo "$body" | grep -qF "$sob"; then + success "Signed-off-by match author" + else + err "Signed-off-by is missing or doesn't match author (should be '$sob')" + RET=1 + fi + + if echo "$body" | grep -v "Signed-off-by:"; then + success "A commit message exists" + else + err "Missing commit message. Please describe your changes" + RET=1 + fi + done + + exit $RET From 6d4d665147b2e9628494a64612c510f641d11337 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Wed, 23 Feb 2022 19:51:43 +0100 Subject: [PATCH 053/137] CI: allow dots in commit subject area Due to a limited grep pattern, subjects containing dots like `image.mk` were falsely reported as problematic. Extend pattern to allow dots. Signed-off-by: Paul Spooren (cherry picked from commit fb5d0dc362e5206dbedb694dbe27953582eb887b) --- .github/workflows/formal.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/formal.yml b/.github/workflows/formal.yml index 74e8fd6942..5046b5a180 100644 --- a/.github/workflows/formal.yml +++ b/.github/workflows/formal.yml @@ -43,7 +43,7 @@ jobs: fi subject="$(git show -s --format=%s $commit)" - if echo "$subject" | grep -q -e '^[0-9A-Za-z,+/_-]\+: ' -e '^Revert '; then + if echo "$subject" | grep -q -e '^[0-9A-Za-z,+/_\.-]\+: ' -e '^Revert '; then success "Commit subject line seems ok ($subject)" else err "Commit subject line MUST start with ': ' ($subject)" From 9c4d81ec5e7340be08f4a0bae031bfee4e64bc14 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Fri, 25 Feb 2022 12:28:46 +0100 Subject: [PATCH 054/137] CI: build changes in tools/ on ubuntu/macos This commits adds GitHub CI to check that all tools compile on both Ubuntu and macOS. Since running in parrallel this should also detect badly set depdendencies within tools/Makefile. Signed-off-by: Paul Spooren (cherry picked from commit fb830fd894f7ae5ad23f712ebf50808f8be2a1f7) --- .github/workflows/tools.yml | 129 ++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 .github/workflows/tools.yml diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml new file mode 100644 index 0000000000..153db73625 --- /dev/null +++ b/.github/workflows/tools.yml @@ -0,0 +1,129 @@ +name: Build host tools + +on: + pull_request: + paths: + - 'tools/**' + +jobs: + build: + name: Build tools on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: False + matrix: + os: + - ubuntu-latest + - macos-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + path: openwrt + + - name: Setup MacOS + if: ${{ matrix.os == 'macos-latest' }} + run: | + echo "WORKPATH=/Volumes/OpenWrt/openwrt/" >> "$GITHUB_ENV" + hdiutil create -size 20g -type SPARSE -fs "Case-sensitive HFS+" -volname OpenWrt OpenWrt.sparseimage + hdiutil attach OpenWrt.sparseimage + mv "$GITHUB_WORKSPACE/openwrt" /Volumes/OpenWrt/ + cd "$WORKPATH" + + brew install \ + autoconf \ + automake \ + coreutils \ + diffutils \ + findutils \ + gawk \ + gettext \ + git-extras \ + gmp \ + gnu-getopt \ + gnu-sed \ + gnu-tar \ + grep \ + libidn2 \ + libunistring \ + m4 \ + make \ + mpfr \ + ncurses \ + openssl@1.1 \ + pcre \ + pkg-config \ + quilt \ + readline \ + wget \ + zstd + + echo "/bin" >> "$GITHUB_PATH" + echo "/sbin/Library/Apple/usr/bin" >> "$GITHUB_PATH" + echo "/usr/bin" >> "$GITHUB_PATH" + echo "/usr/local/bin" >> "$GITHUB_PATH" + echo "/usr/local/opt/coreutils/bin" >> "$GITHUB_PATH" + echo "/usr/local/opt/findutils/libexec/gnubin" >> "$GITHUB_PATH" + echo "/usr/local/opt/gettext/bin" >> "$GITHUB_PATH" + echo "/usr/local/opt/gnu-getopt/bin" >> "$GITHUB_PATH" + echo "/usr/local/opt/make/libexec/gnubin" >> "$GITHUB_PATH" + echo "/usr/local/opt/make/libexec/gnubin" >> "$GITHUB_PATH" + echo "/usr/sbin" >> "$GITHUB_PATH" + pwd + + - name: Setup Ubuntu + if: ${{ matrix.os == 'ubuntu-latest' }} + env: + DEBIAN_FRONTEND: noninteractive + run: | + sudo apt-get update + sudo apt-get -y install \ + build-essential \ + ccache \ + clang-12 \ + ecj \ + fastjar \ + file \ + g++ \ + gawk \ + gettext \ + git \ + java-propose-classpath \ + libelf-dev \ + libncurses-dev \ + libssl-dev \ + mkisofs \ + python3 \ + python3-dev \ + python3-distutils \ + python3-setuptools \ + qemu-utils \ + rsync \ + subversion \ + swig \ + unzip \ + wget \ + xsltproc \ + zlib1g-dev + echo "WORKPATH=$GITHUB_WORKSPACE/openwrt/" >> "$GITHUB_ENV" + cd "$WORKPATH" + pwd + + - name: Make prereq + run: | + cd "$WORKPATH" + pwd + make defconfig + + - name: Build tools + run: | + cd "$WORKPATH" + make tools/install -j$(nproc) BUILD_LOG=1 + + - name: Upload logs + if: failure() + uses: actions/upload-artifact@v2 + with: + name: ${{ matrix.os }}-logs + path: "$WORKPATH/logs" From d3a8cacfcc893b507450495375715b3f4244ef8b Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Wed, 9 Mar 2022 13:30:21 +0100 Subject: [PATCH 055/137] CI: move logs/ to GITHUB_WORKSPACE Artifacts can only be uploaded from inside the GITHUB_WORKSPACE. While the Linux CI jobs run inside that per default, a special case-sensitive mount outside the GITHUB_WORKSPACE is used for macOS builds. To make log artifacts work for both macOS and Linux, move logs/ folder to GITHUB_WORKSPACE on failures. Signed-off-by: Paul Spooren (cherry picked from commit a5eeac8033786a7a04b7569175e41e415b6579c0) --- .github/workflows/tools.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 153db73625..76cbd30db7 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -121,9 +121,14 @@ jobs: cd "$WORKPATH" make tools/install -j$(nproc) BUILD_LOG=1 + - name: Move logs to GITHUB_WORKSPACE + if: failure() + run: | + cp -r "$WORKPATH/logs" "$GITHUB_WORKSPACE" + - name: Upload logs if: failure() uses: actions/upload-artifact@v2 with: name: ${{ matrix.os }}-logs - path: "$WORKPATH/logs" + path: "logs" From cf2b72ed7fc608495a9b0d4fa4d557665760477b Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Wed, 30 Mar 2022 01:43:17 +0100 Subject: [PATCH 056/137] CI: usability improvements for tools * Always store build logs * Store .config as an artifact * Rename job to `tools-{ os }` for log archive without spaces * Run CI job on changes to the CI file itself Signed-off-by: Paul Spooren (cherry picked from commit 80f79beb952dcb87d967a130d326cb1dd5a077ed) --- .github/workflows/tools.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 76cbd30db7..be967833cb 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -4,10 +4,11 @@ on: pull_request: paths: - 'tools/**' + - '.github/workflows/tools.yml' jobs: build: - name: Build tools on ${{ matrix.os }} + name: tools-${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: False @@ -122,13 +123,22 @@ jobs: make tools/install -j$(nproc) BUILD_LOG=1 - name: Move logs to GITHUB_WORKSPACE - if: failure() + if: always() run: | cp -r "$WORKPATH/logs" "$GITHUB_WORKSPACE" + cp -r "$WORKPATH/.config" "$GITHUB_WORKSPACE/config" + - name: Upload logs - if: failure() + if: always() uses: actions/upload-artifact@v2 with: name: ${{ matrix.os }}-logs path: "logs" + + - name: Upload config + if: always() + uses: actions/upload-artifact@v2 + with: + name: ${{ matrix.os }}-config + path: "config" From e1e47d598415493d4e3636f8329008fd2997a96f Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Wed, 9 Mar 2022 18:22:22 +0100 Subject: [PATCH 057/137] CI: add Kernel compile tests Add Github Actions yaml script to build test kernel PR changes for each target. Signed-off-by: Paul Spooren [ add commit description ] Signed-off-by: Christian Marangi (cherry picked from commit c17c931a90e5cb9613875a42ef8eace46be539f3) --- .github/workflows/kernel.yml | 143 +++++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 .github/workflows/kernel.yml diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml new file mode 100644 index 0000000000..268c703baf --- /dev/null +++ b/.github/workflows/kernel.yml @@ -0,0 +1,143 @@ +name: Build Kernel + +on: + pull_request: + paths: + - 'include/kernel-*' + - 'package/kernel/**' +jobs: + determine_targets: + name: Set targets + runs-on: ubuntu-latest + outputs: + target: ${{ steps.find_targets.outputs.target }} + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set targets + id: find_targets + run: | + export TARGETS="$(perl ./scripts/dump-target-info.pl targets 2>/dev/null \ + | sort -u -t '/' -k1,1 \ + | awk '{ print $1 }')" + + JSON='[' + FIRST=1 + for TARGET in $TARGETS; do + [[ $FIRST -ne 1 ]] && JSON="$JSON"',' + JSON="$JSON"'"'"${TARGET}"'"' + FIRST=0 + done + JSON="$JSON"']' + + echo -e "\n---- targets ----\n" + echo "$JSON" + echo -e "\n---- targets ----\n" + + echo "::set-output name=target::$JSON" + + build: + name: Build Kernel with external toolchain + needs: determine_targets + runs-on: ubuntu-latest + strategy: + fail-fast: False + matrix: + target: ${{fromJson(needs.determine_targets.outputs.target)}} + + steps: + - name: Checkout master directory + uses: actions/checkout@v2 + with: + path: openwrt + + - name: Setup Ubuntu + env: + DEBIAN_FRONTEND: noninteractive + run: | + sudo apt-get update + sudo apt-get -y install \ + build-essential \ + ccache \ + clang-12 \ + ecj \ + fastjar \ + file \ + g++ \ + gawk \ + gettext \ + git \ + java-propose-classpath \ + libelf-dev \ + libncurses-dev \ + libssl-dev \ + mkisofs \ + python3 \ + python3-dev \ + python3-distutils \ + python3-setuptools \ + qemu-utils \ + rsync \ + subversion \ + swig \ + unzip \ + wget \ + xsltproc \ + zlib1g-dev + + - name: Initialization environment + run: | + TARGET=$(echo ${{ matrix.target }} | cut -d "/" -f 1) + SUBTARGET=$(echo ${{ matrix.target }} | cut -d "/" -f 2) + echo "TARGET=$TARGET" >> "$GITHUB_ENV" + echo "SUBTARGET=$SUBTARGET" >> "$GITHUB_ENV" + + - name: Update & Install feeds + run: | + cd openwrt + ./scripts/feeds update -a + ./scripts/feeds install -a + + - name: Setup external toolchain + run: | + cd openwrt + TOOLCHAIN_FILE=$(curl "https://downloads.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/sha256sums" \ + | sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p') + + echo "TOOLCHAIN_FILE=$TOOLCHAIN_FILE" >> "$GITHUB_ENV" + + wget -O - https://downloads.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/${TOOLCHAIN_FILE}.tar.xz \ + | tar --xz -xf - + + - name: Configure external toolchain + run: | + cd openwrt + ./scripts/ext-toolchain.sh \ + --toolchain ${{ env.TOOLCHAIN_FILE }}/toolchain-* \ + --config ${{ env.TARGET }}/${{ env.SUBTARGET }} + + make defconfig + + - name: Build tools + run: | + cd openwrt + make tools/install -j$(nproc) BUILD_LOG=1 + + - name: Build toolchain + run: | + cd openwrt + make toolchain/install -j$(nproc) BUILD_LOG=1 + + - name: Build Kernel + run: | + cd openwrt + make target/compile -j$(nproc) BUILD_LOG=1 + + - name: Upload logs + if: failure() + uses: actions/upload-artifact@v2 + with: + name: ${{ env.TARGET }}-${{ env.SUBTARGET }}-logs + path: "openwrt/logs" From 73e37f276354ec7dfd15b29c7ae0ecb7c817f80d Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Sun, 20 Mar 2022 15:31:24 +0000 Subject: [PATCH 058/137] CI: run inside the buildbot docker container Run github actions insider buildbot docker container. Signed-off-by: Paul Spooren [ run container under buildbot user ] Signed-off-by: Christian Marangi (cherry picked from commit 8a77adb0485aeb40f6550eb7fcdb461b3eaffe58) --- .github/workflows/kernel.yml | 70 +++++++++++++----------------------- 1 file changed, 24 insertions(+), 46 deletions(-) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 268c703baf..f7e5d542b4 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -47,45 +47,17 @@ jobs: matrix: target: ${{fromJson(needs.determine_targets.outputs.target)}} + container: registry.gitlab.com/openwrt/buildbot/buildworker-3.4.1 + steps: - name: Checkout master directory uses: actions/checkout@v2 with: path: openwrt - - name: Setup Ubuntu - env: - DEBIAN_FRONTEND: noninteractive + - name: Fix permission run: | - sudo apt-get update - sudo apt-get -y install \ - build-essential \ - ccache \ - clang-12 \ - ecj \ - fastjar \ - file \ - g++ \ - gawk \ - gettext \ - git \ - java-propose-classpath \ - libelf-dev \ - libncurses-dev \ - libssl-dev \ - mkisofs \ - python3 \ - python3-dev \ - python3-distutils \ - python3-setuptools \ - qemu-utils \ - rsync \ - subversion \ - swig \ - unzip \ - wget \ - xsltproc \ - zlib1g-dev + chown -R buildbot:buildbot openwrt - name: Initialization environment run: | @@ -95,25 +67,31 @@ jobs: echo "SUBTARGET=$SUBTARGET" >> "$GITHUB_ENV" - name: Update & Install feeds + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt run: | - cd openwrt ./scripts/feeds update -a ./scripts/feeds install -a - - name: Setup external toolchain + - name: Parse toolchain file + working-directory: openwrt run: | - cd openwrt TOOLCHAIN_FILE=$(curl "https://downloads.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/sha256sums" \ | sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p') echo "TOOLCHAIN_FILE=$TOOLCHAIN_FILE" >> "$GITHUB_ENV" - + + - name: Download external toolchain + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | wget -O - https://downloads.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/${TOOLCHAIN_FILE}.tar.xz \ | tar --xz -xf - - name: Configure external toolchain + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt run: | - cd openwrt ./scripts/ext-toolchain.sh \ --toolchain ${{ env.TOOLCHAIN_FILE }}/toolchain-* \ --config ${{ env.TARGET }}/${{ env.SUBTARGET }} @@ -121,19 +99,19 @@ jobs: make defconfig - name: Build tools - run: | - cd openwrt - make tools/install -j$(nproc) BUILD_LOG=1 + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: make tools/install -j$(nproc) BUILD_LOG=1 - name: Build toolchain - run: | - cd openwrt - make toolchain/install -j$(nproc) BUILD_LOG=1 + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: make toolchain/install -j$(nproc) BUILD_LOG=1 - name: Build Kernel - run: | - cd openwrt - make target/compile -j$(nproc) BUILD_LOG=1 + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: make target/compile -j$(nproc) BUILD_LOG=1 - name: Upload logs if: failure() From 1cf24edac7eae8a26cc58c1d21588d8e69d533fb Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 7 Aug 2022 18:18:40 +0200 Subject: [PATCH 059/137] CI: kernel: Trigger workflow for more directories Trigger the kernel build workflow also for more directories. Signed-off-by: Hauke Mehrtens (cherry picked from commit 546822775cd988360964687c0cb430d67bd5c617) --- .github/workflows/kernel.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index f7e5d542b4..bffa1f04b8 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -3,8 +3,10 @@ name: Build Kernel on: pull_request: paths: + - '.github/workflows/kernel.yml' - 'include/kernel-*' - 'package/kernel/**' + - 'target/linux/generic/**' jobs: determine_targets: name: Set targets From ae63723f0ad5392378d06b29cb800266c3ed6858 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 7 Aug 2022 18:21:44 +0200 Subject: [PATCH 060/137] CI: kernel: Use downloads.cdn.openwrt.org Use downloads.cdn.openwrt.org to download the toolchain. This should reduce the load on the servers. Signed-off-by: Hauke Mehrtens (cherry picked from commit 7b4daf00766620faac8212b46259064ca6e2c716) --- .github/workflows/kernel.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index bffa1f04b8..108edf2460 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -78,7 +78,7 @@ jobs: - name: Parse toolchain file working-directory: openwrt run: | - TOOLCHAIN_FILE=$(curl "https://downloads.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/sha256sums" \ + TOOLCHAIN_FILE=$(curl "https://downloads.cdn.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/sha256sums" \ | sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p') echo "TOOLCHAIN_FILE=$TOOLCHAIN_FILE" >> "$GITHUB_ENV" @@ -87,7 +87,7 @@ jobs: shell: su buildbot -c "sh -e {0}" working-directory: openwrt run: | - wget -O - https://downloads.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/${TOOLCHAIN_FILE}.tar.xz \ + wget -O - https://downloads.cdn.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/${TOOLCHAIN_FILE}.tar.xz \ | tar --xz -xf - - name: Configure external toolchain From fde584a3ec82cad9f9d04f99220d30d7a01bfde7 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 7 Aug 2022 18:22:52 +0200 Subject: [PATCH 061/137] CI: kernel: Show used OpenWrt configuration Show the configuration used to build OpenWrt before starting the build. This should make it easier for people to reproduce problems when it fails. Signed-off-by: Hauke Mehrtens (cherry picked from commit 43afaf6149129a72a8f3e5d3d0d545e54ac81b3a) --- .github/workflows/kernel.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 108edf2460..37fba2f4ec 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -100,6 +100,11 @@ jobs: make defconfig + - name: Show configuration + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: ./scripts/diffconfig.sh + - name: Build tools shell: su buildbot -c "sh -e {0}" working-directory: openwrt From 93d67c96a6c0e9a2280fea9859853d73816fe49b Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 8 Aug 2022 20:26:18 +0200 Subject: [PATCH 062/137] CI: kernel: Checkout feeds from github Instead of cloning the feeds from the default location at git.openwrt.org use the github action to clone them directly from github. We saw some error messages when cloning from git.openwrt.org, probably related to some rate limiting applied. Cloning from github within a github action should work more stable. The "./scripts/feeds update -a" script will use the already checked out feed repositories and not clone them again from git.openwrt.org, but it will also not change the branch name. Signed-off-by: Hauke Mehrtens (cherry picked from commit b120e78917099d46a25cc521998b917fdf08e388) --- .github/workflows/kernel.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 37fba2f4ec..addedb91fe 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -57,6 +57,30 @@ jobs: with: path: openwrt + - name: Checkout packages feed + uses: actions/checkout@v2 + with: + repository: openwrt/packages + path: openwrt/feeds/packages + + - name: Checkout luci feed + uses: actions/checkout@v2 + with: + repository: openwrt/luci + path: openwrt/feeds/luci + + - name: Checkout routing feed + uses: actions/checkout@v2 + with: + repository: openwrt/routing + path: openwrt/feeds/routing + + - name: Checkout telephony feed + uses: actions/checkout@v2 + with: + repository: openwrt/telephony + path: openwrt/feeds/telephony + - name: Fix permission run: | chown -R buildbot:buildbot openwrt From 5978ab409c6be3190f4d1c053dfe31cdea387754 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 8 Aug 2022 22:57:59 +0200 Subject: [PATCH 063/137] CI: kernel: Build all kernel modules Activate building all kernel modules. This builds all kernel modules from the core packages and the feeds. Signed-off-by: Hauke Mehrtens (cherry picked from commit fed325f4633cb302a5f43c42285e8ab0fd144262) --- .github/workflows/kernel.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index addedb91fe..05bc6ed8ee 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -118,8 +118,11 @@ jobs: shell: su buildbot -c "sh -e {0}" working-directory: openwrt run: | + echo CONFIG_ALL_KMODS=y >> .config + ./scripts/ext-toolchain.sh \ --toolchain ${{ env.TOOLCHAIN_FILE }}/toolchain-* \ + --overwrite-config \ --config ${{ env.TARGET }}/${{ env.SUBTARGET }} make defconfig From 8dc0a963a80b94bc53251202f5deafdbfcab575a Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 9 Sep 2022 21:09:30 +0200 Subject: [PATCH 064/137] CI: kernel: Cache external toolchain Cache external toolchain for each target to remove load from openwrt cdn server and make the external toolchain setup quicker. Signed-off-by: Christian Marangi (cherry picked from commit f522c27385d6f94e5dbcc3e84968f0e38609ff1c) --- .github/workflows/kernel.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 05bc6ed8ee..43f843b256 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -102,12 +102,23 @@ jobs: - name: Parse toolchain file working-directory: openwrt run: | - TOOLCHAIN_FILE=$(curl "https://downloads.cdn.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/sha256sums" \ - | sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p') + TOOLCHAIN_STRING="$(curl "https://downloads.cdn.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/sha256sums" \ + | grep ".*openwrt-toolchain.*tar.xz")" + TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p') + TOOLCHAIN_SHA256=$(echo "$TOOLCHAIN_STRING" | cut -d ' ' -f 1) echo "TOOLCHAIN_FILE=$TOOLCHAIN_FILE" >> "$GITHUB_ENV" + echo "TOOLCHAIN_SHA256=$TOOLCHAIN_SHA256" >> "$GITHUB_ENV" + + - name: Cache external toolchain + id: cache-external-toolchain + uses: actions/cache@v3 + with: + path: openwrt/${{ env.TOOLCHAIN_FILE }} + key: ${{ env.TOOLCHAIN_FILE }}-${{ env.TOOLCHAIN_SHA256 }} - name: Download external toolchain + if: ${{ steps.cache-external-toolchain.outputs.cache-hit != 'true' }} shell: su buildbot -c "sh -e {0}" working-directory: openwrt run: | From 3082e83596df58f3c95dd9628c32959eb1cb0f8a Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sat, 10 Sep 2022 21:18:10 +0200 Subject: [PATCH 065/137] CI: package kmods in kernel workflow Actually package kmods in kernel workflow to catch dependency error and other problem that may arise from kmods packaging. Signed-off-by: Christian Marangi (cherry picked from commit 0c45db5560df47a0344a21c2443a4f2889c42ac8) --- .github/workflows/kernel.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 43f843b256..4f8c6b9317 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -158,6 +158,11 @@ jobs: working-directory: openwrt run: make target/compile -j$(nproc) BUILD_LOG=1 + - name: Build Kernel Kmods + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: make package/linux/compile -j$(nproc) BUILD_LOG=1 + - name: Upload logs if: failure() uses: actions/upload-artifact@v2 From 8496275f83fda227f9b9c8d706ca18d1d3733c77 Mon Sep 17 00:00:00 2001 From: Piotr Dymacz Date: Mon, 20 Jun 2022 13:13:30 +0200 Subject: [PATCH 066/137] CI: include automatic Pull Request Labeler This adds GitHub CI action which makes use of 'Labeler', allowing automatic labeling of new PRs, based on the modified files paths. Below labels are supported and more can be added later: - 'target/*' - 'target/imagebuilder' - 'kernel' - 'core packages' - 'build/scripts/tools' - 'toolchain' - 'GitHub/CI' For more information: https://github.com/marketplace/actions/labeler Signed-off-by: Piotr Dymacz (cherry picked from commit 4f42566d47999c392c8ea41dc27215b43ed9ee40) --- .github/labeler.yml | 103 ++++++++++++++++++++++++++++++++++ .github/workflows/labeler.yml | 12 ++++ 2 files changed, 115 insertions(+) create mode 100644 .github/labeler.yml create mode 100644 .github/workflows/labeler.yml diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000000..0910d37bd5 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,103 @@ +# target/* +"target/airoha": + - "target/linux/airoha/**" +"target/apm821xx": + - "target/linux/apm821xx/**" +"target/archs38": + - "target/linux/archs38/**" +"target/armvirt": + - "target/linux/armvirt/**" +"target/at91": + - "target/linux/at91/**" +"target/ath25": + - "target/linux/ath25/**" +"target/ath79": + - "target/linux/ath79/**" +"target/bcm27xx": + - "target/linux/bcm27xx/**" +"target/bcm47xx": + - "target/linux/bcm47xx/**" +"target/bcm4908": + - "target/linux/bcm4908/**" +"target/bcm53xx": + - "target/linux/bcm53xx/**" +"target/bcm63xx": + - "target/linux/bcm63xx/**" +"target/bmips": + - "target/linux/bmips/**" +"target/gemini": + - "target/linux/gemini/**" +"target/imx": + - "target/linux/imx/**" +"target/ipq40xx": + - "target/linux/ipq40xx/**" +"target/ipq806x": + - "target/linux/ipq806x/**" +"target/kirkwood": + - "target/linux/kirkwood/**" +"target/lantiq": + - "target/linux/lantiq/**" +"target/layerscape": + - "target/linux/layerscape/**" +"target/malta": + - "target/linux/malta/**" +"target/mediatek": + - "target/linux/mediatek/**" +"target/mpc85xx": + - "target/linux/mpc85xx/**" +"target/mvebu": + - "target/linux/mvebu/**" +"target/mxs": + - "target/linux/mxs/**" +"target/octeon": + - "target/linux/octeon/**" +"target/octeontx": + - "target/linux/octeontx/**" +"target/omap": + - "target/linux/omap/**" +"target/oxnas": + - "target/linux/oxnas/**" +"target/pistachio": + - "target/linux/pistachio/**" +"target/qoriq": + - "target/linux/qoriq/**" +"target/ramips": + - "target/linux/ramips/**" +"target/realtek": + - "target/linux/realtek/**" +"target/rockchip": + - "target/linux/rockchip/**" +"target/sunxi": + - "target/linux/sunxi/**" +"target/tegra": + - "target/linux/tegra/**" +"target/uml": + - "target/linux/uml/**" +"target/x86": + - "target/linux/x86/**" +"target/zynq": + - "target/linux/zynq/**" +# target/imagebuilder +"target/imagebuilder": + - "target/imagebuilder/**" +# kernel +"kernel": + - "target/linux/generic/**" + - "target/linux/**/config-*" + - "target/linux/**/patches-*" + - "target/linux/**/files/**" + - "package/kernel/linux/**" +# core packages +"core packages": + - "package/**" +# build/scripts/tools +"build/scripts/tools": + - "include/**" + - "scripts/**" + - "tools/**" +# toolchain +"toolchain": + - "toolchain/**" +# GitHub/CI +"GitHub/CI": + - ".github/**" diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 0000000000..6bcdf51a89 --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,12 @@ +name: 'Pull Request Labeler' +on: + - pull_request_target + +jobs: + labeler: + name: Pull Request Labeler + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v4.0.1 + with: + repo-token: '${{ secrets.GITHUB_TOKEN }}' From 3a9f927c2f74bce2f8b6c1fe654db3ef2cabae0a Mon Sep 17 00:00:00 2001 From: Alex Low Date: Mon, 19 Sep 2022 12:20:37 +0200 Subject: [PATCH 067/137] build: harden GitHub workflow permissions Grant pull-requests write permission to the labeler workflow and read-only to everything else. Signed-off-by: Alex Low [ wrap to 80 columns and fix wrong author as requested by author itself ] Signed-off-by: Christian Marangi (cherry picked from commit 715259940776843d8799bc39de8eb50eb764189b) --- .github/workflows/formal.yml | 3 +++ .github/workflows/kernel.yml | 4 ++++ .github/workflows/labeler.yml | 7 +++++++ .github/workflows/tools.yml | 3 +++ 4 files changed, 17 insertions(+) diff --git a/.github/workflows/formal.yml b/.github/workflows/formal.yml index 5046b5a180..1256481637 100644 --- a/.github/workflows/formal.yml +++ b/.github/workflows/formal.yml @@ -3,6 +3,9 @@ name: Test Formalities on: pull_request: +permissions: + contents: read + jobs: build: name: Test Formalities diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 4f8c6b9317..62e0952f19 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -7,6 +7,10 @@ on: - 'include/kernel-*' - 'package/kernel/**' - 'target/linux/generic/**' + +permissions: + contents: read + jobs: determine_targets: name: Set targets diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 6bcdf51a89..420617809b 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -2,8 +2,15 @@ name: 'Pull Request Labeler' on: - pull_request_target +permissions: + contents: read + jobs: labeler: + permissions: + contents: read # to determine modified files (actions/labeler) + pull-requests: write # to add labels to PRs (actions/labeler) + name: Pull Request Labeler runs-on: ubuntu-latest steps: diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index be967833cb..4e423fdd62 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -6,6 +6,9 @@ on: - 'tools/**' - '.github/workflows/tools.yml' +permissions: + contents: read + jobs: build: name: tools-${{ matrix.os }} From 2e298230340d038a8738e6b9e263dcf9f3aa662f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Mon, 5 Sep 2022 09:04:27 +0200 Subject: [PATCH 068/137] ci: move scripts into separate directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So it's clean and tidy. Signed-off-by: Petr Štetiar (cherry picked from commit 63ed733d30153667d7d645ab0ee3f5614089c759) --- .github/workflows/formal.yml | 2 +- .github/workflows/{ => scripts}/ci_helpers.sh | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{ => scripts}/ci_helpers.sh (100%) diff --git a/.github/workflows/formal.yml b/.github/workflows/formal.yml index 1256481637..8df31d1751 100644 --- a/.github/workflows/formal.yml +++ b/.github/workflows/formal.yml @@ -27,7 +27,7 @@ jobs: - name: Test formalities run: | - source .github/workflows/ci_helpers.sh + source .github/workflows/scripts/ci_helpers.sh RET=0 for commit in $(git rev-list HEAD ^origin/$BRANCH); do diff --git a/.github/workflows/ci_helpers.sh b/.github/workflows/scripts/ci_helpers.sh similarity index 100% rename from .github/workflows/ci_helpers.sh rename to .github/workflows/scripts/ci_helpers.sh From 01000b0cece7eb9fd84a56d696b9fccdddecae8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Mon, 22 Aug 2022 15:05:01 +0200 Subject: [PATCH 069/137] ci: show build failures directly in job log output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of waiting for complete workflow finish, then downloading the artifacts, unpacking them and inspecting them, lets try to make the build failure immediately visible in the log output: ====== Make errors from logs/target/linux/compile.txt ====== * Legacy (non-UHI/non-FIT) Boards * Support MIPS SEAD-3 boards (LEGACY_BOARD_SEAD3) [N/y/?] (NEW) Error in reading or end of file. make[6]: *** [scripts/kconfig/Makefile:77: syncconfig] Error 1 make[5]: *** [Makefile:616: syncconfig] Error 2 make[4]: *** [Makefile:736: include/config/auto.conf.cmd] Error 2 make[3]: *** [Makefile:24: build_dir/target-mipsel-openwrt-linux-musl_musl/linux-ramips_mt7620/linux-5.15.62/.modules] Error 2 make[2]: *** [Makefile:11: compile] Error 2 time: target/linux/compile#30.09#11.30#37.92 Signed-off-by: Petr Štetiar (cherry picked from commit f4ca4187cde01a3e412f10657bec0790d3a4cd94) --- .github/workflows/kernel.yml | 8 ++++---- .github/workflows/scripts/show_build_failures.sh | 15 +++++++++++++++ .github/workflows/tools.yml | 2 +- 3 files changed, 20 insertions(+), 5 deletions(-) create mode 100755 .github/workflows/scripts/show_build_failures.sh diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 62e0952f19..5afd546394 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -150,22 +150,22 @@ jobs: - name: Build tools shell: su buildbot -c "sh -e {0}" working-directory: openwrt - run: make tools/install -j$(nproc) BUILD_LOG=1 + run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - name: Build toolchain shell: su buildbot -c "sh -e {0}" working-directory: openwrt - run: make toolchain/install -j$(nproc) BUILD_LOG=1 + run: make toolchain/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - name: Build Kernel shell: su buildbot -c "sh -e {0}" working-directory: openwrt - run: make target/compile -j$(nproc) BUILD_LOG=1 + run: make target/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - name: Build Kernel Kmods shell: su buildbot -c "sh -e {0}" working-directory: openwrt - run: make package/linux/compile -j$(nproc) BUILD_LOG=1 + run: make package/linux/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - name: Upload logs if: failure() diff --git a/.github/workflows/scripts/show_build_failures.sh b/.github/workflows/scripts/show_build_failures.sh new file mode 100755 index 0000000000..14f699c93d --- /dev/null +++ b/.github/workflows/scripts/show_build_failures.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +original_exit_code="${ret:-1}" +log_dir_path="${1:-logs}" +context="${2:-10}" + +show_make_build_errors() { + grep -slr 'make\[[[:digit:]]\].*Error [[:digit:]]$' "$log_dir_path" | while IFS= read -r log_file; do + printf "====== Make errors from %s ======\n" "$log_file"; + grep -r -C"$context" 'make\[[[:digit:]]\].*Error [[:digit:]]$' "$log_file" ; + done +} + +show_make_build_errors +exit "$original_exit_code" diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 4e423fdd62..b97f0599e2 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -123,7 +123,7 @@ jobs: - name: Build tools run: | cd "$WORKPATH" - make tools/install -j$(nproc) BUILD_LOG=1 + make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - name: Move logs to GITHUB_WORKSPACE if: always() From 6f9067e9d472c7cbda4acb16da88313450302de8 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Sun, 20 Mar 2022 20:02:08 +0000 Subject: [PATCH 070/137] CI: use buildbot container for building Instead of using a fresh Linux installation which is setup every time use the Buildbot container which is used for our own Buildbot infrastructure, too. While at it also tidy up the workflow to make it more consistent with other workflow. Signed-off-by: Paul Spooren Co-Developed-by: Christian Marangi Signed-off-by: Christian Marangi (cherry picked from commit 3b23227d43ec720f810e6e261945530f7bc549f0) --- .github/workflows/tools.yml | 125 ++++++++++++++++-------------------- 1 file changed, 54 insertions(+), 71 deletions(-) diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index b97f0599e2..52999758cf 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -10,31 +10,25 @@ permissions: contents: read jobs: - build: - name: tools-${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: False - matrix: - os: - - ubuntu-latest - - macos-latest + build-macos-latest: + runs-on: macos-latest + steps: - name: Checkout uses: actions/checkout@v2 with: - fetch-depth: 0 path: openwrt - name: Setup MacOS - if: ${{ matrix.os == 'macos-latest' }} run: | - echo "WORKPATH=/Volumes/OpenWrt/openwrt/" >> "$GITHUB_ENV" + echo "WORKPATH=/Volumes/OpenWrt" >> "$GITHUB_ENV" hdiutil create -size 20g -type SPARSE -fs "Case-sensitive HFS+" -volname OpenWrt OpenWrt.sparseimage hdiutil attach OpenWrt.sparseimage mv "$GITHUB_WORKSPACE/openwrt" /Volumes/OpenWrt/ - cd "$WORKPATH" + - name: Install required prereq on MacOS + working-directory: ${{ env.WORKPATH }}/openwrt + run: | brew install \ autoconf \ automake \ @@ -74,74 +68,63 @@ jobs: echo "/usr/local/opt/make/libexec/gnubin" >> "$GITHUB_PATH" echo "/usr/local/opt/make/libexec/gnubin" >> "$GITHUB_PATH" echo "/usr/sbin" >> "$GITHUB_PATH" - pwd - - - name: Setup Ubuntu - if: ${{ matrix.os == 'ubuntu-latest' }} - env: - DEBIAN_FRONTEND: noninteractive - run: | - sudo apt-get update - sudo apt-get -y install \ - build-essential \ - ccache \ - clang-12 \ - ecj \ - fastjar \ - file \ - g++ \ - gawk \ - gettext \ - git \ - java-propose-classpath \ - libelf-dev \ - libncurses-dev \ - libssl-dev \ - mkisofs \ - python3 \ - python3-dev \ - python3-distutils \ - python3-setuptools \ - qemu-utils \ - rsync \ - subversion \ - swig \ - unzip \ - wget \ - xsltproc \ - zlib1g-dev - echo "WORKPATH=$GITHUB_WORKSPACE/openwrt/" >> "$GITHUB_ENV" - cd "$WORKPATH" - pwd - name: Make prereq - run: | - cd "$WORKPATH" - pwd - make defconfig - - - name: Build tools - run: | - cd "$WORKPATH" - make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Move logs to GITHUB_WORKSPACE - if: always() - run: | - cp -r "$WORKPATH/logs" "$GITHUB_WORKSPACE" - cp -r "$WORKPATH/.config" "$GITHUB_WORKSPACE/config" + working-directory: ${{ env.WORKPATH }}/openwrt + run: make defconfig + - name: Build tools MacOS + working-directory: ${{ env.WORKPATH }}/openwrt + run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - name: Upload logs if: always() uses: actions/upload-artifact@v2 with: - name: ${{ matrix.os }}-logs - path: "logs" + name: macos-latest-logs + path: ${{ env.WORKPATH }}/openwrt/logs - name: Upload config if: always() uses: actions/upload-artifact@v2 with: - name: ${{ matrix.os }}-config - path: "config" + name: macos-latest-config + path: ${{ env.WORKPATH }}/openwrt/.config + + build-linux-buildbot: + runs-on: ubuntu-latest + container: registry.gitlab.com/openwrt/buildbot/buildworker-3.4.1 + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + path: 'openwrt' + + - name: Fix permission + run: | + chown -R buildbot:buildbot openwrt + + - name: Make prereq + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: make defconfig + + - name: Build tools BuildBot Container + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh + + - name: Upload logs + if: always() + uses: actions/upload-artifact@v2 + with: + name: linux-buildbot-logs + path: openwrt/logs + + - name: Upload config + if: always() + uses: actions/upload-artifact@v2 + with: + name: linux-buildbot-config + path: openwrt/.config From ec55b1217a14a32c99f5209b625c32df0e40970f Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Mon, 8 Aug 2022 23:37:54 +0200 Subject: [PATCH 071/137] CI: create Docker container containing compiled tools Currently each Kernel compilation takes about 30 minutes of which 20 minutes are used to compile our tools. While the toolchain is downloaded and instantly ready the tools are missing. This commit starts uploading a Docker container including compiled tools which are ready to use. It is automatically updated whenever any tools are changed. Signed-off-by: Paul Spooren Co-Developed-by: Christian Marangi Signed-off-by: Christian Marangi (cherry picked from commit 25b65f548dfd93cae87781276bfff9a27cd3ebd4) --- .github/workflows/Dockerfile.tools | 3 ++ .github/workflows/tools.yml | 64 ++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 .github/workflows/Dockerfile.tools diff --git a/.github/workflows/Dockerfile.tools b/.github/workflows/Dockerfile.tools new file mode 100644 index 0000000000..c2ae7dc896 --- /dev/null +++ b/.github/workflows/Dockerfile.tools @@ -0,0 +1,3 @@ +FROM registry.gitlab.com/openwrt/buildbot/buildworker-3.4.1 + +COPY --chown=buildbot:buildbot tools.tar /tools.tar diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 52999758cf..54b7a01fe5 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -5,12 +5,17 @@ on: paths: - 'tools/**' - '.github/workflows/tools.yml' + push: + paths: + - 'tools/**' + - '.github/workflows/tools.yml' permissions: contents: read jobs: build-macos-latest: + if: github.event_name != 'push' runs-on: macos-latest steps: @@ -105,6 +110,15 @@ jobs: run: | chown -R buildbot:buildbot openwrt + - name: Set AUTOREMOVE config for tools container + if: github.event_name == 'push' + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + touch .config + echo CONFIG_DEVEL=y >> .config + echo CONFIG_AUTOREMOVE=y >> .config + - name: Make prereq shell: su buildbot -c "sh -e {0}" working-directory: openwrt @@ -128,3 +142,53 @@ jobs: with: name: linux-buildbot-config path: openwrt/.config + + - name: Archive prebuilt tools + if: github.event_name == 'push' + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: tar --mtime=now -cf tools.tar staging_dir/host build_dir/host dl + + - name: Upload prebuilt tools + if: github.event_name == 'push' + uses: actions/upload-artifact@v2 + with: + name: linux-buildbot-prebuilt-tools + path: openwrt/tools.tar + retention-days: 1 + + push-tools-container: + needs: build-linux-buildbot + runs-on: ubuntu-latest + if: github.event_name == 'push' + + permissions: + contents: read + packages: write + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + path: 'openwrt' + + - name: Download prebuilt tools from build job + uses: actions/download-artifact@v2 + with: + name: linux-buildbot-prebuilt-tools + path: openwrt + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v3 + with: + context: openwrt + push: true + tags: ghcr.io/${{ github.repository_owner }}/tools:latest + file: openwrt/.github/workflows/Dockerfile.tools From f4db2752500bb4fcc8a1bad586b192dc186d30a1 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 5 Sep 2022 23:18:00 +0200 Subject: [PATCH 072/137] CI: use tools:latest container to speedup kernel workflow Use tools:latest container with prebuilt host tools to speedup kernel compilation in kernel workflow. Signed-off-by: Christian Marangi (cherry picked from commit 5d09118f8e60fa151e03916f255f5511e197af68) --- .github/workflows/kernel.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 5afd546394..5589610d08 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -53,7 +53,11 @@ jobs: matrix: target: ${{fromJson(needs.determine_targets.outputs.target)}} - container: registry.gitlab.com/openwrt/buildbot/buildworker-3.4.1 + container: ghcr.io/${{ github.repository_owner }}/tools:latest + + permissions: + contents: read + packages: read steps: - name: Checkout master directory @@ -129,19 +133,24 @@ jobs: wget -O - https://downloads.cdn.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/${TOOLCHAIN_FILE}.tar.xz \ | tar --xz -xf - + - name: Extract prebuilt tools + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: ./scripts/ext-tools.sh --tools /tools.tar + - name: Configure external toolchain shell: su buildbot -c "sh -e {0}" working-directory: openwrt run: | echo CONFIG_ALL_KMODS=y >> .config + echo CONFIG_DEVEL=y >> .config + echo CONFIG_AUTOREMOVE=y >> .config ./scripts/ext-toolchain.sh \ --toolchain ${{ env.TOOLCHAIN_FILE }}/toolchain-* \ --overwrite-config \ --config ${{ env.TARGET }}/${{ env.SUBTARGET }} - make defconfig - - name: Show configuration shell: su buildbot -c "sh -e {0}" working-directory: openwrt From 3ba78a839a1cd8ab140896c6c6efc55fbc09948f Mon Sep 17 00:00:00 2001 From: Edward Chow Date: Mon, 3 Oct 2022 19:39:58 +0800 Subject: [PATCH 073/137] CI: Add workaround for github uppercase usernames The workflow defined in tools.yml and kernel.yml used to fail on forked repositories of contributers whose github username contains uppercase letters. A workaround mentioned in https://github.com/orgs/community/discussions/27086 and https://stackoverflow.com/questions/70326569/ is applied. Signed-off-by: Edward Chow (cherry picked from commit c27b43956407f3adc3cc2693792acd6b40a01877) --- .github/workflows/kernel.yml | 10 +++++++++- .github/workflows/tools.yml | 8 +++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 5589610d08..6c8ad68438 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -17,11 +17,19 @@ jobs: runs-on: ubuntu-latest outputs: target: ${{ steps.find_targets.outputs.target }} + owner_lc: ${{ steps.lower_owner.outputs.owner_lc }} steps: - name: Checkout uses: actions/checkout@v2 + - name: Set lower case owner name + id: lower_owner + run: | + OWNER_LC=$(echo "${{ github.repository_owner }}" \ + | tr '[:upper:]' '[:lower:]') + echo "::set-output name=owner_lc::$OWNER_LC" + - name: Set targets id: find_targets run: | @@ -53,7 +61,7 @@ jobs: matrix: target: ${{fromJson(needs.determine_targets.outputs.target)}} - container: ghcr.io/${{ github.repository_owner }}/tools:latest + container: ghcr.io/${{ needs.determine_targets.outputs.owner_lc }}/tools:latest permissions: contents: read diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 54b7a01fe5..573bb468b9 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -167,6 +167,12 @@ jobs: packages: write steps: + - name: Set lower case owner name + env: + OWNER: ${{ github.repository_owner }} + run: | + echo "OWNER_LC=${OWNER,,}" >> "$GITHUB_ENV" + - name: Checkout uses: actions/checkout@v2 with: @@ -190,5 +196,5 @@ jobs: with: context: openwrt push: true - tags: ghcr.io/${{ github.repository_owner }}/tools:latest + tags: ghcr.io/${{ env.OWNER_LC }}/tools:latest file: openwrt/.github/workflows/Dockerfile.tools From c95622ac6ef071361d32a79d05e10a155f0f75c0 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Tue, 4 Oct 2022 18:38:57 +0200 Subject: [PATCH 074/137] CI: tools: compile tools with ccache support for tools container Enable ccache support for tools container, useful to speedup other workflow even more. Signed-off-by: Christian Marangi (cherry picked from commit 2781e3839e7f4f6132a2737ee9f988f40fa58d99) --- .github/workflows/tools.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 573bb468b9..f483615363 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -110,7 +110,7 @@ jobs: run: | chown -R buildbot:buildbot openwrt - - name: Set AUTOREMOVE config for tools container + - name: Set configs for tools container if: github.event_name == 'push' shell: su buildbot -c "sh -e {0}" working-directory: openwrt @@ -118,6 +118,7 @@ jobs: touch .config echo CONFIG_DEVEL=y >> .config echo CONFIG_AUTOREMOVE=y >> .config + echo CONFIG_CCACHE=y >> .config - name: Make prereq shell: su buildbot -c "sh -e {0}" From 9718dffd27ea9c15d30958eafef593aab929b7e8 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Tue, 4 Oct 2022 18:43:38 +0200 Subject: [PATCH 075/137] CI: kernel: use ccache to speedup workflow Use ccache to speedup kernel compilation. Ccache dir is cached across each build test. To refresh ccache directory we generate an hash of the kernel include files, that includes the kernel versions of every kernel supported and the kernel compile includes. Signed-off-by: Christian Marangi (cherry picked from commit 137ba15e6ef31534a2002a02e69b774232f0b040) --- .github/workflows/kernel.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 6c8ad68438..0ba8c27e2e 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -18,6 +18,7 @@ jobs: outputs: target: ${{ steps.find_targets.outputs.target }} owner_lc: ${{ steps.lower_owner.outputs.owner_lc }} + ccache_hash: ${{ steps.ccache_hash.outputs.ccache_hash }} steps: - name: Checkout @@ -30,6 +31,13 @@ jobs: | tr '[:upper:]' '[:lower:]') echo "::set-output name=owner_lc::$OWNER_LC" + - name: Generate ccache hash + id: ccache_hash + run: | + CCACHE_HASH=$(md5sum include/kernel-* | awk '{ print $1 }' \ + | md5sum | awk '{ print $1 }') + echo "::set-output name=ccache_hash::$CCACHE_HASH" + - name: Set targets id: find_targets run: | @@ -133,6 +141,14 @@ jobs: path: openwrt/${{ env.TOOLCHAIN_FILE }} key: ${{ env.TOOLCHAIN_FILE }}-${{ env.TOOLCHAIN_SHA256 }} + - name: Cache ccache + uses: actions/cache@v3 + with: + path: openwrt/.ccache + key: ccache-kernel-${{ env.TARGET }}/${{ env.SUBTARGET }}-${{ needs.determine_targets.outputs.ccache_hash }} + restore-keys: | + ccache-kernel-${{ env.TARGET }}/${{ env.SUBTARGET }}- + - name: Download external toolchain if: ${{ steps.cache-external-toolchain.outputs.cache-hit != 'true' }} shell: su buildbot -c "sh -e {0}" @@ -153,6 +169,7 @@ jobs: echo CONFIG_ALL_KMODS=y >> .config echo CONFIG_DEVEL=y >> .config echo CONFIG_AUTOREMOVE=y >> .config + echo CONFIG_CCACHE=y >> .config ./scripts/ext-toolchain.sh \ --toolchain ${{ env.TOOLCHAIN_FILE }}/toolchain-* \ From 305688f5372b0e884b5a479cf151d746617db32b Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sat, 8 Oct 2022 19:25:54 +0200 Subject: [PATCH 076/137] CI: kernel: generate ccache cache on kernel push To actually use ccache cache on kernel test from pr, the kernel workflow has to be run first from a push action. This will permit as a side effect to test merged commits and catch commit that may cause regression in kernel compilation even outside the github system. Signed-off-by: Christian Marangi (cherry picked from commit 23e946d1aded1fc21125704c0819146d5772d72b) --- .github/workflows/kernel.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 0ba8c27e2e..25d6d265eb 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -7,6 +7,12 @@ on: - 'include/kernel-*' - 'package/kernel/**' - 'target/linux/generic/**' + push: + paths: + - '.github/workflows/kernel.yml' + - 'include/kernel-*' + - 'package/kernel/**' + - 'target/linux/generic/**' permissions: contents: read From 2454da3d5e0e2ac02f206923e09019e4ec74d60e Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 12 Oct 2022 15:24:11 +0200 Subject: [PATCH 077/137] CI: bump actions/checkout action to v3 Bump actions/checkout action to v3 on every workflow to mute node deprecation warning. Signed-off-by: Christian Marangi (cherry picked from commit 87c69d73bb4021bf3a26217b3a652ce262637b1e) --- .github/workflows/formal.yml | 2 +- .github/workflows/kernel.yml | 12 ++++++------ .github/workflows/tools.yml | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/formal.yml b/.github/workflows/formal.yml index 8df31d1751..8083c5832c 100644 --- a/.github/workflows/formal.yml +++ b/.github/workflows/formal.yml @@ -14,7 +14,7 @@ jobs: fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} fetch-depth: 0 diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 25d6d265eb..f29b18d910 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -28,7 +28,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set lower case owner name id: lower_owner @@ -83,30 +83,30 @@ jobs: steps: - name: Checkout master directory - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: openwrt - name: Checkout packages feed - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: openwrt/packages path: openwrt/feeds/packages - name: Checkout luci feed - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: openwrt/luci path: openwrt/feeds/luci - name: Checkout routing feed - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: openwrt/routing path: openwrt/feeds/routing - name: Checkout telephony feed - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: openwrt/telephony path: openwrt/feeds/telephony diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index f483615363..2661782f42 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: openwrt @@ -102,7 +102,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: 'openwrt' @@ -175,7 +175,7 @@ jobs: echo "OWNER_LC=${OWNER,,}" >> "$GITHUB_ENV" - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: 'openwrt' From c4345c7a7d3cb64f4b07a9b2cb3a7c959c54052b Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 12 Oct 2022 16:48:46 +0200 Subject: [PATCH 078/137] CI: bump actions/download,upload-artifact action to v3 Bump actions/download,upload-artifact action to v3 on every workflow to mute node deprecation warning. Signed-off-by: Christian Marangi (cherry picked from commit 77b24012db1d696ca87c03fa1bb8bdf2606119e7) --- .github/workflows/kernel.yml | 2 +- .github/workflows/tools.yml | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index f29b18d910..d8f98c531d 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -209,7 +209,7 @@ jobs: - name: Upload logs if: failure() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: ${{ env.TARGET }}-${{ env.SUBTARGET }}-logs path: "openwrt/logs" diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 2661782f42..def01678c6 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -84,14 +84,14 @@ jobs: - name: Upload logs if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: macos-latest-logs path: ${{ env.WORKPATH }}/openwrt/logs - name: Upload config if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: macos-latest-config path: ${{ env.WORKPATH }}/openwrt/.config @@ -132,14 +132,14 @@ jobs: - name: Upload logs if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: linux-buildbot-logs path: openwrt/logs - name: Upload config if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: linux-buildbot-config path: openwrt/.config @@ -152,7 +152,7 @@ jobs: - name: Upload prebuilt tools if: github.event_name == 'push' - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: linux-buildbot-prebuilt-tools path: openwrt/tools.tar @@ -180,7 +180,7 @@ jobs: path: 'openwrt' - name: Download prebuilt tools from build job - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: linux-buildbot-prebuilt-tools path: openwrt From 3e41081eff490ef12cd00c4a5b06292947ac25a1 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 12 Oct 2022 16:49:46 +0200 Subject: [PATCH 079/137] CI: labeler: target major version of labeler action Target major version of labeler to include minor fixes and use always the latest major version with included fixes. Signed-off-by: Christian Marangi (cherry picked from commit 5fb7232bc0592cb2e1818fa47dfaecc291c8514e) --- .github/workflows/labeler.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 420617809b..b67265ca80 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -14,6 +14,6 @@ jobs: name: Pull Request Labeler runs-on: ubuntu-latest steps: - - uses: actions/labeler@v4.0.1 + - uses: actions/labeler@v4 with: repo-token: '${{ secrets.GITHUB_TOKEN }}' From 5872b1bfd09b7a43b8fa1ca0e977d20818192cbe Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sat, 15 Oct 2022 10:56:46 +0200 Subject: [PATCH 080/137] CI: kernel: check if patch are refreshed for each target Enforce refreshed patch for each target with kernel pr tests. Signed-off-by: Christian Marangi (cherry picked from commit 689cfaeb7c37d7199f6e552bf32b0f996ea3040a) --- .github/workflows/kernel.yml | 71 ++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index d8f98c531d..b9605b0deb 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -213,3 +213,74 @@ jobs: with: name: ${{ env.TARGET }}-${{ env.SUBTARGET }}-logs path: "openwrt/logs" + + check-patch: + name: Check Kernel patches + needs: determine_targets + runs-on: ubuntu-latest + strategy: + fail-fast: False + matrix: + target: ${{fromJson(needs.determine_targets.outputs.target)}} + + container: ghcr.io/${{ needs.determine_targets.outputs.owner_lc }}/tools:latest + + permissions: + contents: read + packages: read + + steps: + - name: Checkout master directory + uses: actions/checkout@v3 + with: + path: openwrt + + - name: Fix permission + run: | + chown -R buildbot:buildbot openwrt + + - name: Initialization environment + run: | + TARGET=$(echo ${{ matrix.target }} | cut -d "/" -f 1) + SUBTARGET=$(echo ${{ matrix.target }} | cut -d "/" -f 2) + echo "TARGET=$TARGET" >> "$GITHUB_ENV" + echo "SUBTARGET=$SUBTARGET" >> "$GITHUB_ENV" + + - name: Extract prebuilt tools + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: ./scripts/ext-tools.sh --tools /tools.tar + + - name: Setup Config + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + echo CONFIG_ALL_KMODS=y >> .config + echo CONFIG_DEVEL=y >> .config + echo CONFIG_AUTOREMOVE=y >> .config + echo CONFIG_CCACHE=y >> .config + + echo "CONFIG_TARGET_${{ env.TARGET }}=y" >> .config + echo "CONFIG_TARGET_${{ env.TARGET }}_${{ env.SUBTARGET }}=y" >> .config + + make defconfig + + - name: Build tools + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: make tools/quilt/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh + + - name: Refresh Kernel patches + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + make target/linux/refresh V=s + + . .github/workflows/scripts/ci_helpers.sh + + if git diff --name-only --exit-code; then + success "Kernel patches for ${{ env.TARGET }}/${{ env.SUBTARGET }} seems ok" + else + err "Kernel patches for ${{ env.TARGET }}/${{ env.SUBTARGET }} require refresh. (run 'make target/linux/refresh' and force push this pr)" + exit 1 + fi From 44609906109fae04b33ff67c5fbe651f566ef7b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Wed, 19 Oct 2022 23:02:43 +0200 Subject: [PATCH 081/137] ci: kernel: trigger build check on changes in kernel.mk as well MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So we can QA more parts of kernel build process. Signed-off-by: Petr Štetiar (cherry picked from commit 5e31c82bb506bff9c60c4d01791bea7a29e4a020) --- .github/workflows/kernel.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index b9605b0deb..c8d30c0758 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -4,13 +4,13 @@ on: pull_request: paths: - '.github/workflows/kernel.yml' - - 'include/kernel-*' + - 'include/kernel*' - 'package/kernel/**' - 'target/linux/generic/**' push: paths: - '.github/workflows/kernel.yml' - - 'include/kernel-*' + - 'include/kernel*' - 'package/kernel/**' - 'target/linux/generic/**' From 1ae19596b88c452a53a43c3e325102755e87278e Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 21 Oct 2022 16:09:19 +0200 Subject: [PATCH 082/137] CI: kernel: fix deprecation of set-output From [0], github deprecated set-output with a better approach of appending variables to $GITHUB_OUTPUT [0] https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ Signed-off-by: Christian Marangi (cherry picked from commit 6d4bcadaa343cb969f370631a5ed5338306c056e) --- .github/workflows/kernel.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index c8d30c0758..773e843bfd 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -35,14 +35,14 @@ jobs: run: | OWNER_LC=$(echo "${{ github.repository_owner }}" \ | tr '[:upper:]' '[:lower:]') - echo "::set-output name=owner_lc::$OWNER_LC" + echo "owner_lc=$OWNER_LC" >> $GITHUB_OUTPUT - name: Generate ccache hash id: ccache_hash run: | CCACHE_HASH=$(md5sum include/kernel-* | awk '{ print $1 }' \ | md5sum | awk '{ print $1 }') - echo "::set-output name=ccache_hash::$CCACHE_HASH" + echo "ccache_hash=$CCACHE_HASH" >> $GITHUB_OUTPUT - name: Set targets id: find_targets @@ -64,7 +64,7 @@ jobs: echo "$JSON" echo -e "\n---- targets ----\n" - echo "::set-output name=target::$JSON" + echo "target=$JSON" >> $GITHUB_OUTPUT build: name: Build Kernel with external toolchain From c14030c6bfed692cc173e2f6893cf54298417ea7 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 7 Aug 2022 18:46:11 +0200 Subject: [PATCH 083/137] CI: packages: Add github CI job to build all packages This will build OpenWrt for MIPS malta BE and x86 64 Bit with all packages and kernel modules activated. It is triggered when something changes in the build system or when a package definition is changed. This task probably needs 90 minutes to execute, but I hope that it will find build problems in pull requests early. This intentionally does not activate the feeds, because building them too would take too long. We only build x86/64 and malta/be to save resources. I would like to detect build problems when a package is changed. We often had build breaks when a package version was increased sometime even in other packages which used it as a dependency. This is based on the .github/workflows/packages.yml workflow. Signed-off-by: Hauke Mehrtens (cherry picked from commit b99d3778863d6ba67ee1ebda6fd42413062c6480) --- .github/workflows/packages.yml | 151 +++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 .github/workflows/packages.yml diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml new file mode 100644 index 0000000000..bf918fe562 --- /dev/null +++ b/.github/workflows/packages.yml @@ -0,0 +1,151 @@ +name: Build all core packages + +on: + pull_request: + paths: + - '.github/workflows/packages.yml' + - 'config/**' + - 'include/**' + - 'package/**' + - 'target/linux/generic/**' + - 'toolchain/**' + push: + paths: + - '.github/workflows/packages.yml' + - 'config/**' + - 'include/**' + - 'package/**' + - 'target/linux/generic/**' + - 'toolchain/**' + +permissions: + contents: read + +jobs: + setup_build: + name: Setup build + runs-on: ubuntu-latest + outputs: + owner_lc: ${{ steps.lower_owner.outputs.owner_lc }} + + steps: + - name: Set lower case owner name + id: lower_owner + run: | + OWNER_LC=$(echo "${{ github.repository_owner }}" \ + | tr '[:upper:]' '[:lower:]') + echo "owner_lc=$OWNER_LC" >> $GITHUB_OUTPUT + + build: + name: Build all core packages + needs: setup_build + runs-on: ubuntu-latest + strategy: + fail-fast: False + matrix: + include: + - name: malta-be + target: malta + subtarget: be + - name: x86-64 + target: x86 + subtarget: 64 + + container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/tools:latest + + permissions: + contents: read + packages: read + + steps: + - name: Checkout master directory + uses: actions/checkout@v3 + with: + path: openwrt + + - name: Fix permission + run: | + chown -R buildbot:buildbot openwrt + + - name: Initialization environment + run: | + TARGET=$(echo ${{ matrix.target }}) + SUBTARGET=$(echo ${{ matrix.subtarget }}) + echo "TARGET=$TARGET" >> "$GITHUB_ENV" + echo "SUBTARGET=$SUBTARGET" >> "$GITHUB_ENV" + + - name: Parse toolchain file + working-directory: openwrt + run: | + TOOLCHAIN_STRING="$(curl "https://downloads.cdn.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/sha256sums" \ + | grep ".*openwrt-toolchain.*tar.xz")" + TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p') + TOOLCHAIN_SHA256=$(echo "$TOOLCHAIN_STRING" | cut -d ' ' -f 1) + + echo "TOOLCHAIN_FILE=$TOOLCHAIN_FILE" >> "$GITHUB_ENV" + echo "TOOLCHAIN_SHA256=$TOOLCHAIN_SHA256" >> "$GITHUB_ENV" + + - name: Cache external toolchain + id: cache-external-toolchain + uses: actions/cache@v3 + with: + path: openwrt/${{ env.TOOLCHAIN_FILE }} + key: ${{ env.TOOLCHAIN_FILE }}-${{ env.TOOLCHAIN_SHA256 }} + + - name: Download external toolchain + if: ${{ steps.cache-external-toolchain.outputs.cache-hit != 'true' }} + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + wget -O - https://downloads.cdn.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/${TOOLCHAIN_FILE}.tar.xz \ + | tar --xz -xf - + + - name: Extract prebuilt tools + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: ./scripts/ext-tools.sh --tools /tools.tar + + - name: Create configuration + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + echo CONFIG_ALL=y >> .config + echo CONFIG_ALL_KMODS=y >> .config + echo CONFIG_ALL_NONSHARED=y >> .config + + ./scripts/ext-toolchain.sh \ + --toolchain ${{ env.TOOLCHAIN_FILE }}/toolchain-* \ + --overwrite-config \ + --config ${{ env.TARGET }}/${{ env.SUBTARGET }} + + - name: Show configuration + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: ./scripts/diffconfig.sh + + - name: Build tools + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh + + - name: Build toolchain + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: make toolchain/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh + + - name: Build Kernel + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: make target/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh + + - name: Build everything + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: make -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh + + - name: Upload logs + if: failure() + uses: actions/upload-artifact@v3 + with: + name: ${{ env.TARGET }}-${{ env.SUBTARGET }}-logs + path: "openwrt/logs" From 1b34fc20ccad1adb493d8f343bd9b1916ff69d5c Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Wed, 2 Nov 2022 22:17:51 +0100 Subject: [PATCH 084/137] CI: packages.yml: Fix usage of pre-build tools Activate CONFIG_AUTOREMOVE to match the settings used to build the pre-build tools. This has to match the pre-build tools to not rebuild them. This prevents the tools being rebuild in packages.yml. Signed-off-by: Hauke Mehrtens (cherry picked from commit 6645a019f88e2e6930fe63d1a51046a8e72445a0) --- .github/workflows/packages.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index bf918fe562..49d795c122 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -112,6 +112,8 @@ jobs: echo CONFIG_ALL=y >> .config echo CONFIG_ALL_KMODS=y >> .config echo CONFIG_ALL_NONSHARED=y >> .config + echo CONFIG_DEVEL=y >> .config + echo CONFIG_AUTOREMOVE=y >> .config ./scripts/ext-toolchain.sh \ --toolchain ${{ env.TOOLCHAIN_FILE }}/toolchain-* \ From 6ca1d74ac1732fd9c0c20b6a58fb77f1f2e1d808 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 9 Feb 2022 17:26:58 +0100 Subject: [PATCH 085/137] meta: drop issue_template The contents do not apply anymore now that the switch to Github issue has been decided. Signed-off-by: Jo-Philipp Wich (cherry picked from commit 64125ed1d0067f0648f2669b29b59a77ece3bf10) --- .github/issue_template | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 .github/issue_template diff --git a/.github/issue_template b/.github/issue_template deleted file mode 100644 index dc2b2da70c..0000000000 --- a/.github/issue_template +++ /dev/null @@ -1,13 +0,0 @@ -This repository is a mirror of our main repo at https://git.openwrt.org/openwrt/openwrt.git -It is for reference only and is not active for checkins or for reporting issues. - -All issues should be reported at: https://bugs.openwrt.org - -Please do not open any NEW issue here - we will be closing the Github issues -capability in the near future. - -We will continue to accept Pull Requests here as described in the repo description. - -Close this now and click here: https://bugs.openwrt.org - -Thankyou for your co-operation. From 43980bfbf08365b2c92a51d1d82b2489106a8e12 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 5 Nov 2022 14:38:35 +0100 Subject: [PATCH 086/137] CI: Simplify if conditions There is no need to put a ${{ }} around the if conditions. Signed-off-by: Hauke Mehrtens (cherry picked from commit ce343653c2618e1d335662b924c382c0192b7b46) --- .github/workflows/kernel.yml | 2 +- .github/workflows/packages.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 773e843bfd..a204be3395 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -156,7 +156,7 @@ jobs: ccache-kernel-${{ env.TARGET }}/${{ env.SUBTARGET }}- - name: Download external toolchain - if: ${{ steps.cache-external-toolchain.outputs.cache-hit != 'true' }} + if: steps.cache-external-toolchain.outputs.cache-hit != 'true' shell: su buildbot -c "sh -e {0}" working-directory: openwrt run: | diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 49d795c122..05f089e66e 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -93,7 +93,7 @@ jobs: key: ${{ env.TOOLCHAIN_FILE }}-${{ env.TOOLCHAIN_SHA256 }} - name: Download external toolchain - if: ${{ steps.cache-external-toolchain.outputs.cache-hit != 'true' }} + if: steps.cache-external-toolchain.outputs.cache-hit != 'true' shell: su buildbot -c "sh -e {0}" working-directory: openwrt run: | From 02391a5e5afb17378d4d9b67adef89c4c18fc558 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Tue, 1 Nov 2022 19:10:01 +0100 Subject: [PATCH 087/137] CI: Extract the OpenWrt building to own sub workflow Extract the building of OpenWrt into an own workflow which is then triggered by the kernel.yml and packages.yml workflow with different inputs. This allows us to share much of the code of the workflow. Signed-off-by: Hauke Mehrtens (cherry picked from commit 7c406a5f0837b0bfc293b723932695176a8ef6fe) --- .github/workflows/build.yml | 213 +++++++++++++++++++ .github/workflows/check-kernel-patches.yml | 93 ++++++++ .github/workflows/kernel.yml | 234 ++------------------- .github/workflows/packages.yml | 134 +----------- 4 files changed, 332 insertions(+), 342 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/check-kernel-patches.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..4cc1116d58 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,213 @@ +name: Build sub target + +on: + workflow_call: + inputs: + target: + required: true + type: string + include_feeds: + type: boolean + build_full: + type: boolean + build_all_modules: + type: boolean + build_all_kmods: + type: boolean + +permissions: + contents: read + +jobs: + setup_build: + name: Setup build + runs-on: ubuntu-latest + outputs: + owner_lc: ${{ steps.lower_owner.outputs.owner_lc }} + ccache_hash: ${{ steps.ccache_hash.outputs.ccache_hash }} + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set lower case owner name + id: lower_owner + run: | + OWNER_LC=$(echo "${{ github.repository_owner }}" \ + | tr '[:upper:]' '[:lower:]') + echo "owner_lc=$OWNER_LC" >> $GITHUB_OUTPUT + + - name: Generate ccache hash + id: ccache_hash + run: | + CCACHE_HASH=$(md5sum include/kernel-* | awk '{ print $1 }' \ + | md5sum | awk '{ print $1 }') + echo "ccache_hash=$CCACHE_HASH" >> $GITHUB_OUTPUT + + build: + name: Build with external toolchain + needs: setup_build + runs-on: ubuntu-latest + + container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/tools:latest + + permissions: + contents: read + packages: read + + steps: + - name: Checkout master directory + uses: actions/checkout@v3 + with: + path: openwrt + + - name: Checkout packages feed + if: inputs.include_feeds == true + uses: actions/checkout@v3 + with: + repository: openwrt/packages + path: openwrt/feeds/packages + + - name: Checkout luci feed + if: inputs.include_feeds == true + uses: actions/checkout@v3 + with: + repository: openwrt/luci + path: openwrt/feeds/luci + + - name: Checkout routing feed + if: inputs.include_feeds == true + uses: actions/checkout@v3 + with: + repository: openwrt/routing + path: openwrt/feeds/routing + + - name: Checkout telephony feed + if: inputs.include_feeds == true + uses: actions/checkout@v3 + with: + repository: openwrt/telephony + path: openwrt/feeds/telephony + + - name: Fix permission + run: | + chown -R buildbot:buildbot openwrt + + - name: Initialization environment + run: | + TARGET=$(echo ${{ inputs.target }} | cut -d "/" -f 1) + SUBTARGET=$(echo ${{ inputs.target }} | cut -d "/" -f 2) + echo "TARGET=$TARGET" >> "$GITHUB_ENV" + echo "SUBTARGET=$SUBTARGET" >> "$GITHUB_ENV" + + - name: Update & Install feeds + if: inputs.include_feeds == true + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + ./scripts/feeds update -a + ./scripts/feeds install -a + + - name: Parse toolchain file + working-directory: openwrt + run: | + TOOLCHAIN_STRING="$(curl "https://downloads.cdn.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/sha256sums" \ + | grep ".*openwrt-toolchain.*tar.xz")" + TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p') + TOOLCHAIN_SHA256=$(echo "$TOOLCHAIN_STRING" | cut -d ' ' -f 1) + + echo "TOOLCHAIN_FILE=$TOOLCHAIN_FILE" >> "$GITHUB_ENV" + echo "TOOLCHAIN_SHA256=$TOOLCHAIN_SHA256" >> "$GITHUB_ENV" + + - name: Cache external toolchain + id: cache-external-toolchain + uses: actions/cache@v3 + with: + path: openwrt/${{ env.TOOLCHAIN_FILE }} + key: ${{ env.TOOLCHAIN_FILE }}-${{ env.TOOLCHAIN_SHA256 }} + + - name: Cache ccache + uses: actions/cache@v3 + with: + path: openwrt/.ccache + key: ccache-kernel-${{ env.TARGET }}/${{ env.SUBTARGET }}-${{ needs.setup_build.outputs.ccache_hash }} + restore-keys: | + ccache-kernel-${{ env.TARGET }}/${{ env.SUBTARGET }}- + + - name: Download external toolchain + if: steps.cache-external-toolchain.outputs.cache-hit != 'true' + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + wget -O - https://downloads.cdn.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/${TOOLCHAIN_FILE}.tar.xz \ + | tar --xz -xf - + + - name: Extract prebuilt tools + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: ./scripts/ext-tools.sh --tools /tools.tar + + - name: Configure all kernel modules + if: inputs.build_all_kmods == true + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + echo CONFIG_ALL_KMODS=y >> .config + + - name: Configure all modules + if: inputs.build_all_modules == true + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + echo CONFIG_ALL=y >> .config + + - name: Configure external toolchain + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + echo CONFIG_DEVEL=y >> .config + echo CONFIG_AUTOREMOVE=y >> .config + echo CONFIG_CCACHE=y >> .config + + ./scripts/ext-toolchain.sh \ + --toolchain ${{ env.TOOLCHAIN_FILE }}/toolchain-* \ + --overwrite-config \ + --config ${{ env.TARGET }}/${{ env.SUBTARGET }} + + - name: Show configuration + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: ./scripts/diffconfig.sh + + - name: Build tools + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh + + - name: Build toolchain + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: make toolchain/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh + + - name: Build Kernel + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: make target/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh + + - name: Build Kernel Kmods + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: make package/linux/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh + + - name: Build everything + if: inputs.build_full == true + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: make -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh + + - name: Upload logs + if: failure() + uses: actions/upload-artifact@v3 + with: + name: ${{ env.TARGET }}-${{ env.SUBTARGET }}-logs + path: "openwrt/logs" diff --git a/.github/workflows/check-kernel-patches.yml b/.github/workflows/check-kernel-patches.yml new file mode 100644 index 0000000000..3608b5a3cc --- /dev/null +++ b/.github/workflows/check-kernel-patches.yml @@ -0,0 +1,93 @@ +name: Refresh kernel for target + +on: + workflow_call: + inputs: + target: + required: true + type: string + +permissions: + contents: read + +jobs: + setup_build: + name: Setup build + runs-on: ubuntu-latest + outputs: + owner_lc: ${{ steps.lower_owner.outputs.owner_lc }} + + steps: + - name: Set lower case owner name + id: lower_owner + run: | + OWNER_LC=$(echo "${{ github.repository_owner }}" \ + | tr '[:upper:]' '[:lower:]') + echo "owner_lc=$OWNER_LC" >> $GITHUB_OUTPUT + + check-patch: + name: Check Kernel patches + needs: setup_build + runs-on: ubuntu-latest + + container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/tools:latest + + permissions: + contents: read + packages: read + + steps: + - name: Checkout master directory + uses: actions/checkout@v3 + with: + path: openwrt + + - name: Fix permission + run: | + chown -R buildbot:buildbot openwrt + + - name: Initialization environment + run: | + TARGET=$(echo ${{ inputs.target }} | cut -d "/" -f 1) + SUBTARGET=$(echo ${{ inputs.target }} | cut -d "/" -f 2) + echo "TARGET=$TARGET" >> "$GITHUB_ENV" + echo "SUBTARGET=$SUBTARGET" >> "$GITHUB_ENV" + + - name: Extract prebuilt tools + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: ./scripts/ext-tools.sh --tools /tools.tar + + - name: Configure system + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + echo CONFIG_ALL_KMODS=y >> .config + echo CONFIG_DEVEL=y >> .config + echo CONFIG_AUTOREMOVE=y >> .config + echo CONFIG_CCACHE=y >> .config + + echo "CONFIG_TARGET_${{ env.TARGET }}=y" >> .config + echo "CONFIG_TARGET_${{ env.TARGET }}_${{ env.SUBTARGET }}=y" >> .config + + make defconfig + + - name: Build tools + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: make tools/quilt/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh + + - name: Refresh Kernel patches + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + make target/linux/refresh V=s + + . .github/workflows/scripts/ci_helpers.sh + + if git diff --name-only --exit-code; then + success "Kernel patches for ${{ env.TARGET }}/${{ env.SUBTARGET }} seems ok" + else + err "Kernel patches for ${{ env.TARGET }}/${{ env.SUBTARGET }} require refresh. (run 'make target/linux/refresh' and force push this pr)" + exit 1 + fi diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index a204be3395..06efe14d5c 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -23,27 +23,11 @@ jobs: runs-on: ubuntu-latest outputs: target: ${{ steps.find_targets.outputs.target }} - owner_lc: ${{ steps.lower_owner.outputs.owner_lc }} - ccache_hash: ${{ steps.ccache_hash.outputs.ccache_hash }} steps: - name: Checkout uses: actions/checkout@v3 - - name: Set lower case owner name - id: lower_owner - run: | - OWNER_LC=$(echo "${{ github.repository_owner }}" \ - | tr '[:upper:]' '[:lower:]') - echo "owner_lc=$OWNER_LC" >> $GITHUB_OUTPUT - - - name: Generate ccache hash - id: ccache_hash - run: | - CCACHE_HASH=$(md5sum include/kernel-* | awk '{ print $1 }' \ - | md5sum | awk '{ print $1 }') - echo "ccache_hash=$CCACHE_HASH" >> $GITHUB_OUTPUT - - name: Set targets id: find_targets run: | @@ -69,218 +53,30 @@ jobs: build: name: Build Kernel with external toolchain needs: determine_targets - runs-on: ubuntu-latest + permissions: + contents: read + packages: read strategy: fail-fast: False matrix: target: ${{fromJson(needs.determine_targets.outputs.target)}} + uses: ./.github/workflows/build.yml + with: + target: ${{ matrix.target }} + build_all_kmods: true + include_feeds: true - container: ghcr.io/${{ needs.determine_targets.outputs.owner_lc }}/tools:latest - - permissions: - contents: read - packages: read - - steps: - - name: Checkout master directory - uses: actions/checkout@v3 - with: - path: openwrt - - - name: Checkout packages feed - uses: actions/checkout@v3 - with: - repository: openwrt/packages - path: openwrt/feeds/packages - - - name: Checkout luci feed - uses: actions/checkout@v3 - with: - repository: openwrt/luci - path: openwrt/feeds/luci - - - name: Checkout routing feed - uses: actions/checkout@v3 - with: - repository: openwrt/routing - path: openwrt/feeds/routing - - - name: Checkout telephony feed - uses: actions/checkout@v3 - with: - repository: openwrt/telephony - path: openwrt/feeds/telephony - - - name: Fix permission - run: | - chown -R buildbot:buildbot openwrt - - - name: Initialization environment - run: | - TARGET=$(echo ${{ matrix.target }} | cut -d "/" -f 1) - SUBTARGET=$(echo ${{ matrix.target }} | cut -d "/" -f 2) - echo "TARGET=$TARGET" >> "$GITHUB_ENV" - echo "SUBTARGET=$SUBTARGET" >> "$GITHUB_ENV" - - - name: Update & Install feeds - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - ./scripts/feeds update -a - ./scripts/feeds install -a - - - name: Parse toolchain file - working-directory: openwrt - run: | - TOOLCHAIN_STRING="$(curl "https://downloads.cdn.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/sha256sums" \ - | grep ".*openwrt-toolchain.*tar.xz")" - TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p') - TOOLCHAIN_SHA256=$(echo "$TOOLCHAIN_STRING" | cut -d ' ' -f 1) - - echo "TOOLCHAIN_FILE=$TOOLCHAIN_FILE" >> "$GITHUB_ENV" - echo "TOOLCHAIN_SHA256=$TOOLCHAIN_SHA256" >> "$GITHUB_ENV" - - - name: Cache external toolchain - id: cache-external-toolchain - uses: actions/cache@v3 - with: - path: openwrt/${{ env.TOOLCHAIN_FILE }} - key: ${{ env.TOOLCHAIN_FILE }}-${{ env.TOOLCHAIN_SHA256 }} - - - name: Cache ccache - uses: actions/cache@v3 - with: - path: openwrt/.ccache - key: ccache-kernel-${{ env.TARGET }}/${{ env.SUBTARGET }}-${{ needs.determine_targets.outputs.ccache_hash }} - restore-keys: | - ccache-kernel-${{ env.TARGET }}/${{ env.SUBTARGET }}- - - - name: Download external toolchain - if: steps.cache-external-toolchain.outputs.cache-hit != 'true' - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - wget -O - https://downloads.cdn.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/${TOOLCHAIN_FILE}.tar.xz \ - | tar --xz -xf - - - - name: Extract prebuilt tools - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: ./scripts/ext-tools.sh --tools /tools.tar - - - name: Configure external toolchain - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_ALL_KMODS=y >> .config - echo CONFIG_DEVEL=y >> .config - echo CONFIG_AUTOREMOVE=y >> .config - echo CONFIG_CCACHE=y >> .config - - ./scripts/ext-toolchain.sh \ - --toolchain ${{ env.TOOLCHAIN_FILE }}/toolchain-* \ - --overwrite-config \ - --config ${{ env.TARGET }}/${{ env.SUBTARGET }} - - - name: Show configuration - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: ./scripts/diffconfig.sh - - - name: Build tools - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Build toolchain - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make toolchain/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Build Kernel - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make target/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Build Kernel Kmods - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make package/linux/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Upload logs - if: failure() - uses: actions/upload-artifact@v3 - with: - name: ${{ env.TARGET }}-${{ env.SUBTARGET }}-logs - path: "openwrt/logs" - - check-patch: + check-kernel-patches: name: Check Kernel patches needs: determine_targets - runs-on: ubuntu-latest + permissions: + contents: read + packages: read strategy: fail-fast: False matrix: target: ${{fromJson(needs.determine_targets.outputs.target)}} + uses: ./.github/workflows/check-kernel-patches.yml + with: + target: ${{ matrix.target }} - container: ghcr.io/${{ needs.determine_targets.outputs.owner_lc }}/tools:latest - - permissions: - contents: read - packages: read - - steps: - - name: Checkout master directory - uses: actions/checkout@v3 - with: - path: openwrt - - - name: Fix permission - run: | - chown -R buildbot:buildbot openwrt - - - name: Initialization environment - run: | - TARGET=$(echo ${{ matrix.target }} | cut -d "/" -f 1) - SUBTARGET=$(echo ${{ matrix.target }} | cut -d "/" -f 2) - echo "TARGET=$TARGET" >> "$GITHUB_ENV" - echo "SUBTARGET=$SUBTARGET" >> "$GITHUB_ENV" - - - name: Extract prebuilt tools - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: ./scripts/ext-tools.sh --tools /tools.tar - - - name: Setup Config - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_ALL_KMODS=y >> .config - echo CONFIG_DEVEL=y >> .config - echo CONFIG_AUTOREMOVE=y >> .config - echo CONFIG_CCACHE=y >> .config - - echo "CONFIG_TARGET_${{ env.TARGET }}=y" >> .config - echo "CONFIG_TARGET_${{ env.TARGET }}_${{ env.SUBTARGET }}=y" >> .config - - make defconfig - - - name: Build tools - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make tools/quilt/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Refresh Kernel patches - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - make target/linux/refresh V=s - - . .github/workflows/scripts/ci_helpers.sh - - if git diff --name-only --exit-code; then - success "Kernel patches for ${{ env.TARGET }}/${{ env.SUBTARGET }} seems ok" - else - err "Kernel patches for ${{ env.TARGET }}/${{ env.SUBTARGET }} require refresh. (run 'make target/linux/refresh' and force push this pr)" - exit 1 - fi diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 05f089e66e..a374b37023 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -22,132 +22,20 @@ permissions: contents: read jobs: - setup_build: - name: Setup build - runs-on: ubuntu-latest - outputs: - owner_lc: ${{ steps.lower_owner.outputs.owner_lc }} - - steps: - - name: Set lower case owner name - id: lower_owner - run: | - OWNER_LC=$(echo "${{ github.repository_owner }}" \ - | tr '[:upper:]' '[:lower:]') - echo "owner_lc=$OWNER_LC" >> $GITHUB_OUTPUT - build: - name: Build all core packages - needs: setup_build - runs-on: ubuntu-latest + permissions: + contents: read + packages: read strategy: fail-fast: False matrix: include: - - name: malta-be - target: malta - subtarget: be - - name: x86-64 - target: x86 - subtarget: 64 + - target: malta/be + - target: x86/64 + uses: ./.github/workflows/build.yml + with: + target: ${{ matrix.target }} + build_all_kmods: true + build_all_modules: true + build_full: true - container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/tools:latest - - permissions: - contents: read - packages: read - - steps: - - name: Checkout master directory - uses: actions/checkout@v3 - with: - path: openwrt - - - name: Fix permission - run: | - chown -R buildbot:buildbot openwrt - - - name: Initialization environment - run: | - TARGET=$(echo ${{ matrix.target }}) - SUBTARGET=$(echo ${{ matrix.subtarget }}) - echo "TARGET=$TARGET" >> "$GITHUB_ENV" - echo "SUBTARGET=$SUBTARGET" >> "$GITHUB_ENV" - - - name: Parse toolchain file - working-directory: openwrt - run: | - TOOLCHAIN_STRING="$(curl "https://downloads.cdn.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/sha256sums" \ - | grep ".*openwrt-toolchain.*tar.xz")" - TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p') - TOOLCHAIN_SHA256=$(echo "$TOOLCHAIN_STRING" | cut -d ' ' -f 1) - - echo "TOOLCHAIN_FILE=$TOOLCHAIN_FILE" >> "$GITHUB_ENV" - echo "TOOLCHAIN_SHA256=$TOOLCHAIN_SHA256" >> "$GITHUB_ENV" - - - name: Cache external toolchain - id: cache-external-toolchain - uses: actions/cache@v3 - with: - path: openwrt/${{ env.TOOLCHAIN_FILE }} - key: ${{ env.TOOLCHAIN_FILE }}-${{ env.TOOLCHAIN_SHA256 }} - - - name: Download external toolchain - if: steps.cache-external-toolchain.outputs.cache-hit != 'true' - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - wget -O - https://downloads.cdn.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/${TOOLCHAIN_FILE}.tar.xz \ - | tar --xz -xf - - - - name: Extract prebuilt tools - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: ./scripts/ext-tools.sh --tools /tools.tar - - - name: Create configuration - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_ALL=y >> .config - echo CONFIG_ALL_KMODS=y >> .config - echo CONFIG_ALL_NONSHARED=y >> .config - echo CONFIG_DEVEL=y >> .config - echo CONFIG_AUTOREMOVE=y >> .config - - ./scripts/ext-toolchain.sh \ - --toolchain ${{ env.TOOLCHAIN_FILE }}/toolchain-* \ - --overwrite-config \ - --config ${{ env.TARGET }}/${{ env.SUBTARGET }} - - - name: Show configuration - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: ./scripts/diffconfig.sh - - - name: Build tools - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Build toolchain - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make toolchain/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Build Kernel - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make target/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Build everything - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Upload logs - if: failure() - uses: actions/upload-artifact@v3 - with: - name: ${{ env.TARGET }}-${{ env.SUBTARGET }}-logs - path: "openwrt/logs" From b0e6bce6347936d208eb60ce17f972407c7fe440 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 5 Nov 2022 14:27:11 +0100 Subject: [PATCH 088/137] CI: Allow building with internal toolchain This adds an option to build with internal toolchain. This can be used to build targets which are currently not build by the OpenWrt build bots and which needs their own toolchain build for every build. Building the toolchain takes about 30 minutes compared to using the external toolchain which takes some seconds. Signed-off-by: Hauke Mehrtens (cherry picked from commit 08f5283392674fe874c7f441128319263ce0d171) --- .github/workflows/build.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4cc1116d58..b29698a774 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,6 +6,8 @@ on: target: required: true type: string + build_toolchain: + type: boolean include_feeds: type: boolean build_full: @@ -109,6 +111,7 @@ jobs: ./scripts/feeds install -a - name: Parse toolchain file + if: inputs.build_toolchain == false working-directory: openwrt run: | TOOLCHAIN_STRING="$(curl "https://downloads.cdn.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/sha256sums" \ @@ -120,6 +123,7 @@ jobs: echo "TOOLCHAIN_SHA256=$TOOLCHAIN_SHA256" >> "$GITHUB_ENV" - name: Cache external toolchain + if: inputs.build_toolchain == false id: cache-external-toolchain uses: actions/cache@v3 with: @@ -135,7 +139,7 @@ jobs: ccache-kernel-${{ env.TARGET }}/${{ env.SUBTARGET }}- - name: Download external toolchain - if: steps.cache-external-toolchain.outputs.cache-hit != 'true' + if: inputs.build_toolchain == false && steps.cache-external-toolchain.outputs.cache-hit != 'true' shell: su buildbot -c "sh -e {0}" working-directory: openwrt run: | @@ -162,6 +166,7 @@ jobs: echo CONFIG_ALL=y >> .config - name: Configure external toolchain + if: inputs.build_toolchain == false shell: su buildbot -c "sh -e {0}" working-directory: openwrt run: | @@ -174,6 +179,20 @@ jobs: --overwrite-config \ --config ${{ env.TARGET }}/${{ env.SUBTARGET }} + - name: Configure internal toolchain + if: inputs.build_toolchain == true + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + echo CONFIG_DEVEL=y >> .config + echo CONFIG_AUTOREMOVE=y >> .config + echo CONFIG_CCACHE=y >> .config + + echo "CONFIG_TARGET_${{ env.TARGET }}=y" >> .config + echo "CONFIG_TARGET_${{ env.TARGET }}_${{ env.SUBTARGET }}=y" >> .config + + make defconfig + - name: Show configuration shell: su buildbot -c "sh -e {0}" working-directory: openwrt From 0943f4dc99f3e6498415f7700023c61ee3880eee Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 3 Dec 2022 03:04:40 +0100 Subject: [PATCH 089/137] CI: Build all boards and testing kernel This adds options to build all boards of a selected target and an additional option to build the testing kernel instead of the normal kernel. This can be used by other trigger work flows. Signed-off-by: Hauke Mehrtens (cherry picked from commit cf361b85097216538dfac5ad7b22050390b0bc67) --- .github/workflows/build.yml | 20 ++++++++++++++++++++ .github/workflows/check-kernel-patches.yml | 9 +++++++++ 2 files changed, 29 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b29698a774..347eb5a90c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,6 +6,8 @@ on: target: required: true type: string + testing: + type: boolean build_toolchain: type: boolean include_feeds: @@ -16,6 +18,8 @@ on: type: boolean build_all_kmods: type: boolean + build_all_boards: + type: boolean permissions: contents: read @@ -151,6 +155,13 @@ jobs: working-directory: openwrt run: ./scripts/ext-tools.sh --tools /tools.tar + - name: Configure testing kernel + if: inputs.testing == true + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + echo CONFIG_TESTING_KERNEL=y >> .config + - name: Configure all kernel modules if: inputs.build_all_kmods == true shell: su buildbot -c "sh -e {0}" @@ -165,6 +176,15 @@ jobs: run: | echo CONFIG_ALL=y >> .config + - name: Configure all boards + if: inputs.build_all_boards == true + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + echo CONFIG_TARGET_MULTI_PROFILE=y >> .config + echo CONFIG_TARGET_PER_DEVICE_ROOTFS=y >> .config + echo CONFIG_TARGET_ALL_PROFILES=y >> .config + - name: Configure external toolchain if: inputs.build_toolchain == false shell: su buildbot -c "sh -e {0}" diff --git a/.github/workflows/check-kernel-patches.yml b/.github/workflows/check-kernel-patches.yml index 3608b5a3cc..c04cb27b37 100644 --- a/.github/workflows/check-kernel-patches.yml +++ b/.github/workflows/check-kernel-patches.yml @@ -6,6 +6,8 @@ on: target: required: true type: string + testing: + type: boolean permissions: contents: read @@ -58,6 +60,13 @@ jobs: working-directory: openwrt run: ./scripts/ext-tools.sh --tools /tools.tar + - name: Configure testing kernel + if: inputs.testing == true + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + echo CONFIG_TESTING_KERNEL=y >> .config + - name: Configure system shell: su buildbot -c "sh -e {0}" working-directory: openwrt From 5bc5df10d813b26b0ce5a816cfcfc501320229c6 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 27 Nov 2022 19:45:38 +0100 Subject: [PATCH 090/137] CI: tools: support per branch tools container Add support to push per branch container tools. For anything not official stick to latest tag that correspond to test run from master. If we are testing something for one of the openwrt stable branch, parse the branch name or the tag and push dedicated tools containers. To use the stable container for local testing the branch needs to have the prefix openwrt-[0-9][0-9].[0-9][0-9] (example openwrt-21.02-fixup) Any branch that will match this pattern openwrt-[0-9][0-9].[0-9][0-9] will refresh the tools container with the matching tag. (example branch openwrt-22.03 -> tools:openwrt-22.03) (example branch openwrt-22.03-test -> tools:openwrt-22.03) Signed-off-by: Christian Marangi (cherry picked from commit 75550771ae76fbcab4160e10b73287f918727384) --- .github/workflows/tools.yml | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index def01678c6..304b5f7d62 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -174,6 +174,31 @@ jobs: run: | echo "OWNER_LC=${OWNER,,}" >> "$GITHUB_ENV" + # Per branch tools container tag + # By default stick to latest + # For official test targetting openwrt stable branch + # Get the branch or parse the tag and push dedicated tools containers + # Any branch that will match this pattern openwrt-[0-9][0-9].[0-9][0-9] + # will refresh the tools container with the matching tag. + # (example branch openwrt-22.03 -> tools:openwrt-22.03) + # (example branch openwrt-22.03-test -> tools:openwrt-22.03) + - name: Determine tools container tag + run: | + CONTAINER_TAG=latest + + if [ ${{ github.ref_type }} == "branch" ]; then + if echo "${{ github.ref_name }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]'; then + CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\).*/\1/')" + fi + elif [ ${{ github.ref_type }} == "tag" ]; then + if echo "${{ github.ref_name }}" | grep -q -E 'v[0-9][0-9]\.[0-9][0-9]\..+'; then + CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" + fi + fi + + echo "Tools container to push tools:$CONTAINER_TAG" + echo "CONTAINER_TAG=$CONTAINER_TAG" >> "$GITHUB_ENV" + - name: Checkout uses: actions/checkout@v3 with: @@ -197,5 +222,5 @@ jobs: with: context: openwrt push: true - tags: ghcr.io/${{ env.OWNER_LC }}/tools:latest + tags: ghcr.io/${{ env.OWNER_LC }}/tools:${{ env.CONTAINER_TAG }} file: openwrt/.github/workflows/Dockerfile.tools From 40536320ef2f30e3872ba2e1748efc3c8cb0e06d Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 27 Nov 2022 19:53:08 +0100 Subject: [PATCH 091/137] CI: build: add support for per branch tools container Add support in build shared workflow for per branch tools container. With pr the target branch is parsed and the right container is used. To use the stable container for local testing the branch needs to have the prefix openwrt-[0-9][0-9].[0-9][0-9]- (example openwrt-21.02-fixup) Signed-off-by: Christian Marangi (cherry picked from commit abe8a4824210966e0899724bf4561a89216a1e36) --- .github/workflows/build.yml | 29 +++++++++++++++++++++- .github/workflows/check-kernel-patches.yml | 29 +++++++++++++++++++++- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 347eb5a90c..510ff6a879 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,6 +31,7 @@ jobs: outputs: owner_lc: ${{ steps.lower_owner.outputs.owner_lc }} ccache_hash: ${{ steps.ccache_hash.outputs.ccache_hash }} + container_tag: ${{ steps.determine_tools_container.outputs.container_tag }} steps: - name: Checkout @@ -50,12 +51,38 @@ jobs: | md5sum | awk '{ print $1 }') echo "ccache_hash=$CCACHE_HASH" >> $GITHUB_OUTPUT + # Per branch tools container tag + # By default stick to latest + # For official test targetting openwrt stable branch + # Get the branch or parse the tag and push dedicated tools containers + # For local test to use the correct container for stable release testing + # you need to use for the branch name a prefix of openwrt-[0-9][0-9].[0-9][0-9]- + - name: Determine tools container tag + id: determine_tools_container + run: | + CONTAINER_TAG=latest + if [ -n "${{ github.base_ref }}" ]; then + if echo "${{ github.base_ref }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]'; then + CONTAINER_TAG="${{ github.base_ref }}" + fi + elif [ ${{ github.ref_type }} == "branch" ]; then + if echo "${{ github.ref_name }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]-'; then + CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\)-.*/\1/')" + fi + elif [ ${{ github.ref_type }} == "tag" ]; then + if echo "${{ github.ref_name }}" | grep -q -E 'v[0-9][0-9]\.[0-9][0-9]\..+'; then + CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" + fi + fi + echo "Tools container to use tools:$CONTAINER_TAG" + echo "container_tag=$CONTAINER_TAG" >> $GITHUB_OUTPUT + build: name: Build with external toolchain needs: setup_build runs-on: ubuntu-latest - container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/tools:latest + container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/tools:${{ needs.setup_build.outputs.container_tag }} permissions: contents: read diff --git a/.github/workflows/check-kernel-patches.yml b/.github/workflows/check-kernel-patches.yml index c04cb27b37..f01782d5da 100644 --- a/.github/workflows/check-kernel-patches.yml +++ b/.github/workflows/check-kernel-patches.yml @@ -18,6 +18,7 @@ jobs: runs-on: ubuntu-latest outputs: owner_lc: ${{ steps.lower_owner.outputs.owner_lc }} + container_tag: ${{ steps.determine_tools_container.outputs.container_tag }} steps: - name: Set lower case owner name @@ -27,12 +28,38 @@ jobs: | tr '[:upper:]' '[:lower:]') echo "owner_lc=$OWNER_LC" >> $GITHUB_OUTPUT + # Per branch tools container tag + # By default stick to latest + # For official test targetting openwrt stable branch + # Get the branch or parse the tag and push dedicated tools containers + # For local test to use the correct container for stable release testing + # you need to use for the branch name a prefix of openwrt-[0-9][0-9].[0-9][0-9]- + - name: Determine tools container tag + id: determine_tools_container + run: | + CONTAINER_TAG=latest + if [ -n "${{ github.base_ref }}" ]; then + if echo "${{ github.base_ref }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]'; then + CONTAINER_TAG="${{ github.base_ref }}" + fi + elif [ ${{ github.ref_type }} == "branch" ]; then + if echo "${{ github.ref_name }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]-'; then + CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\)-.*/\1/')" + fi + elif [ ${{ github.ref_type }} == "tag" ]; then + if echo "${{ github.ref_name }}" | grep -q -E 'v[0-9][0-9]\.[0-9][0-9]\..+'; then + CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" + fi + fi + echo "Tools container to use tools:$CONTAINER_TAG" + echo "container_tag=$CONTAINER_TAG" >> $GITHUB_OUTPUT + check-patch: name: Check Kernel patches needs: setup_build runs-on: ubuntu-latest - container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/tools:latest + container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/tools:${{ needs.setup_build.outputs.container_tag }} permissions: contents: read From 69c0c3c2f904279d1c687cd7a42d82987c99b3e7 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 28 Nov 2022 12:44:01 +0100 Subject: [PATCH 092/137] CI: build: add support for external toolchains from stable branch Add support to use external toolchains from stable branch if we are testing commit targeting stable openwrt branch in kernel and packages workflow. With pr the target branch is parsed and the right toolchain is used. To use the stable toolchain for local testing the branch needs to have the prefix openwrt-[0-9][0-9].[0-9][0-9]- (example openwrt-21.02-fixup) Signed-off-by: Christian Marangi (cherry picked from commit e24a1e6f6d7f08fb766eb11b8008f8fc5b72d072) --- .github/workflows/build.yml | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 510ff6a879..909b849731 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -145,13 +145,38 @@ jobs: if: inputs.build_toolchain == false working-directory: openwrt run: | - TOOLCHAIN_STRING="$(curl "https://downloads.cdn.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/sha256sums" \ + TOOLCHAIN_PATH=snapshots + + if [ -n "${{ github.base_ref }}" ]; then + if echo "${{ github.base_ref }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]'; then + major_ver="$(echo ${{ github.base_ref }} | sed 's/openwrt-/v/')" + fi + elif [ "${{ github.ref_type }}" = "branch" ]; then + if echo "${{ github.ref_name }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]-'; then + major_ver="$(echo ${{ github.ref_name }} | sed 's/openwrt-\([0-9][0-9]\.[0-9][0-9]\)-.*/v\1/')" + fi + elif [ "${{ github.ref_type }}" = "tag" ]; then + if echo "${{ github.ref_name }}" | grep -q -E 'v[0-9][0-9]\.[0-9][0-9]\..+'; then + major_ver="$(sed 's/\(v[0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" + fi + fi + + if [ -n "$major_ver" ]; then + git fetch --tags + latest_tag="$(git tag --sort=-creatordate -l $major_ver* | head -n1)" + if [ -n "$latest_tag" ]; then + TOOLCHAIN_PATH=releases/$(echo $latest_tag | sed 's/^v//') + fi + fi + + TOOLCHAIN_STRING="$(curl "https://downloads.cdn.openwrt.org/$TOOLCHAIN_PATH/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/sha256sums" \ | grep ".*openwrt-toolchain.*tar.xz")" TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p') TOOLCHAIN_SHA256=$(echo "$TOOLCHAIN_STRING" | cut -d ' ' -f 1) echo "TOOLCHAIN_FILE=$TOOLCHAIN_FILE" >> "$GITHUB_ENV" echo "TOOLCHAIN_SHA256=$TOOLCHAIN_SHA256" >> "$GITHUB_ENV" + echo "TOOLCHAIN_PATH=$TOOLCHAIN_PATH" >> "$GITHUB_ENV" - name: Cache external toolchain if: inputs.build_toolchain == false @@ -174,7 +199,7 @@ jobs: shell: su buildbot -c "sh -e {0}" working-directory: openwrt run: | - wget -O - https://downloads.cdn.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/${TOOLCHAIN_FILE}.tar.xz \ + wget -O - https://downloads.cdn.openwrt.org/${{ env.TOOLCHAIN_PATH }}/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/${{ env.TOOLCHAIN_FILE }}.tar.xz \ | tar --xz -xf - - name: Extract prebuilt tools From 006e52545d1421affba9c993c70996e0f9f6e596 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 28 Nov 2022 16:12:13 +0100 Subject: [PATCH 093/137] CI: build: add support to fallback to sdk for external toolchain Add support to use sdk as external toolchain if the packaged external toolchain tar is not found on openwrt servers for build shared workflow. Signed-off-by: Christian Marangi (cherry picked from commit b59ac2a7d0ff427419e86bd38dea3d8910dd7926) --- .github/workflows/build.yml | 41 +++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 909b849731..511d9596fa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -143,6 +143,7 @@ jobs: - name: Parse toolchain file if: inputs.build_toolchain == false + id: parse-toolchain working-directory: openwrt run: | TOOLCHAIN_PATH=snapshots @@ -169,22 +170,32 @@ jobs: fi fi - TOOLCHAIN_STRING="$(curl "https://downloads.cdn.openwrt.org/$TOOLCHAIN_PATH/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/sha256sums" \ - | grep ".*openwrt-toolchain.*tar.xz")" - TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p') - TOOLCHAIN_SHA256=$(echo "$TOOLCHAIN_STRING" | cut -d ' ' -f 1) + SUMS_FILE="https://downloads.cdn.openwrt.org/$TOOLCHAIN_PATH/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/sha256sums" + if curl $SUMS_FILE | grep -q ".*openwrt-toolchain.*tar.xz"; then + TOOLCHAIN_STRING="$( curl $SUMS_FILE | grep ".*openwrt-toolchain.*tar.xz")" + TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p') + TOOLCHAIN_SHA256=$(echo "$TOOLCHAIN_STRING" | cut -d ' ' -f 1) + + echo "toolchain-type=external_toolchain" >> $GITHUB_OUTPUT + elif curl $SUMS_FILE | grep -q ".*openwrt-sdk.*tar.xz"; then + TOOLCHAIN_STRING="$( curl $SUMS_FILE | grep ".*openwrt-sdk.*tar.xz")" + TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-sdk.*\).tar.xz/\1/p') + TOOLCHAIN_SHA256=$(echo "$TOOLCHAIN_STRING" | cut -d ' ' -f 1) + + echo "toolchain-type=external_sdk" >> $GITHUB_OUTPUT + fi echo "TOOLCHAIN_FILE=$TOOLCHAIN_FILE" >> "$GITHUB_ENV" echo "TOOLCHAIN_SHA256=$TOOLCHAIN_SHA256" >> "$GITHUB_ENV" echo "TOOLCHAIN_PATH=$TOOLCHAIN_PATH" >> "$GITHUB_ENV" - - name: Cache external toolchain + - name: Cache external toolchain/sdk if: inputs.build_toolchain == false id: cache-external-toolchain uses: actions/cache@v3 with: path: openwrt/${{ env.TOOLCHAIN_FILE }} - key: ${{ env.TOOLCHAIN_FILE }}-${{ env.TOOLCHAIN_SHA256 }} + key: ${{ env.TOOLCHAIN_FILE }}-${{ steps.parse-toolchain.outputs.toolchain-type }}-${{ env.TOOLCHAIN_SHA256 }} - name: Cache ccache uses: actions/cache@v3 @@ -194,7 +205,7 @@ jobs: restore-keys: | ccache-kernel-${{ env.TARGET }}/${{ env.SUBTARGET }}- - - name: Download external toolchain + - name: Download external toolchain/sdk if: inputs.build_toolchain == false && steps.cache-external-toolchain.outputs.cache-hit != 'true' shell: su buildbot -c "sh -e {0}" working-directory: openwrt @@ -238,7 +249,7 @@ jobs: echo CONFIG_TARGET_ALL_PROFILES=y >> .config - name: Configure external toolchain - if: inputs.build_toolchain == false + if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_toolchain' shell: su buildbot -c "sh -e {0}" working-directory: openwrt run: | @@ -251,6 +262,20 @@ jobs: --overwrite-config \ --config ${{ env.TARGET }}/${{ env.SUBTARGET }} + - name: Configure external toolchain with sdk + if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk' + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + echo CONFIG_DEVEL=y >> .config + echo CONFIG_AUTOREMOVE=y >> .config + echo CONFIG_CCACHE=y >> .config + + ./scripts/ext-toolchain.sh \ + --toolchain ${{ env.TOOLCHAIN_FILE }}/staging_dir/toolchain-* \ + --overwrite-config \ + --config ${{ env.TARGET }}/${{ env.SUBTARGET }} + - name: Configure internal toolchain if: inputs.build_toolchain == true shell: su buildbot -c "sh -e {0}" From 12b1d2f700188e7f6fbb9761510c83e36079ddc6 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 7 Sep 2022 23:50:36 +0200 Subject: [PATCH 094/137] build: handle directory with whitespace in AUTOREMOVE clean Package with whitespace in their build directory are not correctly removed when CONFIG_AUTOREMOVE is enabled. This is caused by xargs that use whitespace as delimiters. To handle this use \0 as the delimiter and set find to use \0 as the delimiter. Signed-off-by: Christian Marangi (cherry picked from commit dccee21792b89031bcd801030de403f195d80278) --- include/host-build.mk | 4 ++-- include/package.mk | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/host-build.mk b/include/host-build.mk index 36b3fed1f3..c3e0c26e6a 100644 --- a/include/host-build.mk +++ b/include/host-build.mk @@ -197,8 +197,8 @@ ifndef DUMP ifneq ($(CONFIG_AUTOREMOVE),) host-compile: - $(FIND) $(HOST_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' | \ - $(XARGS) rm -rf + $(FIND) $(HOST_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -print0 | \ + $(XARGS) -0 rm -rf endif endef endif diff --git a/include/package.mk b/include/package.mk index 389ba4243b..225fdfc771 100644 --- a/include/package.mk +++ b/include/package.mk @@ -258,8 +258,8 @@ define Build/CoreTargets ifneq ($(CONFIG_AUTOREMOVE),) compile: -touch -r $(PKG_BUILD_DIR)/.built $(PKG_BUILD_DIR)/.autoremove 2>/dev/null >/dev/null - $(FIND) $(PKG_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -and -not -name '.pkgdir' | \ - $(XARGS) rm -rf + $(FIND) $(PKG_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -and -not -name '.pkgdir' -print0 | \ + $(XARGS) -0 rm -rf endif endef From cbce6c6d9519ab86e11c9752910a4c72dd52cb58 Mon Sep 17 00:00:00 2001 From: Ansuel Smith Date: Mon, 10 Jan 2022 17:02:30 +0100 Subject: [PATCH 095/137] kernel: split kernel version to dedicated files Move the kernel versions and hash to dedicated files. This makes kernel bump quicker and fix some annoying problem with rebasing when multiple kernel bump are proposed. Signed-off-by: Ansuel Smith [Rebased on top of current master] Signed-off-by: Rui Salvaterra (cherry picked from commit 0765466a42f46f7357e260866a4284ed567bb7ad) Signed-off-by: Josef Schlehofer [Rebased on top of current openwrt-21.02] --- include/kernel-5.4 | 2 ++ include/kernel-version.mk | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 include/kernel-5.4 diff --git a/include/kernel-5.4 b/include/kernel-5.4 new file mode 100644 index 0000000000..cd7de7b8fc --- /dev/null +++ b/include/kernel-5.4 @@ -0,0 +1,2 @@ +LINUX_VERSION-5.4 = .225 +LINUX_KERNEL_HASH-5.4.225 = 59f596f6714317955cf481590babcf015aff2bc1900bd8e8dc8f7af73bc560aa diff --git a/include/kernel-version.mk b/include/kernel-version.mk index 7480663923..1edb01df27 100644 --- a/include/kernel-version.mk +++ b/include/kernel-version.mk @@ -6,9 +6,12 @@ ifdef CONFIG_TESTING_KERNEL KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER) endif -LINUX_VERSION-5.4 = .225 +KERNEL_DETAILS_FILE=$(INCLUDE_DIR)/kernel-$(KERNEL_PATCHVER) +ifeq ($(wildcard $(KERNEL_DETAILS_FILE)),) + $(error Missing kernel version/hash file for $(KERNEL_PATCHVER). Please create $(KERNEL_DETAILS_FILE)) +endif -LINUX_KERNEL_HASH-5.4.225 = 59f596f6714317955cf481590babcf015aff2bc1900bd8e8dc8f7af73bc560aa +include $(KERNEL_DETAILS_FILE) remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1)))) sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1))))))) From ee05f20e9717669d979a8666d74b70fd3eb0e7a9 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Tue, 29 Nov 2022 19:53:23 +0100 Subject: [PATCH 096/137] CI: add support to tag pr targeting stable branch Add support to tag pr targeting stable branch matching the simple regex of openwrt-[0-9][0-9].[0-9][0-9]. The tag that will be added will match the pr target branch. Signed-off-by: Christian Marangi (cherry picked from commit b67d284e93ee052e3ea3abb5d3dae55723ce0353) --- .github/workflows/labeler.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index b67265ca80..62a895a68b 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -17,3 +17,17 @@ jobs: - uses: actions/labeler@v4 with: repo-token: '${{ secrets.GITHUB_TOKEN }}' + + - name: Check Branch + id: check-branch + run: | + if echo "${{ github.base_ref }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]'; then + echo "apply-tag=yes" >> $GITHUB_OUTPUT + fi + + - uses: buildsville/add-remove-label@v2.0.0 + if: ${{ steps.check-branch.outputs.apply-tag }} + with: + token: ${{secrets.GITHUB_TOKEN}} + labels: ${{ github.base_ref }} + type: add From 26f35c40b624600b07292951c0ced58db500ce66 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Thu, 1 Dec 2022 01:46:03 +0100 Subject: [PATCH 097/137] CI: labeler: fix wrong label for pr targeting stable branch The label used for stable branch is in the form of release/[0-9][0-9].[0-9][0-9] Currently we apply the name of the target branch as the label, fix this and correctly use the current label. Signed-off-by: Christian Marangi (cherry picked from commit af8bc8e51b6daef65c497522b67a1dd9d0cdab84) --- .github/workflows/labeler.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 62a895a68b..5f82b88a50 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -22,12 +22,12 @@ jobs: id: check-branch run: | if echo "${{ github.base_ref }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]'; then - echo "apply-tag=yes" >> $GITHUB_OUTPUT + echo "release-tag=$(echo ${{ github.base_ref }} | sed 's/openwrt-/release\//')" >> $GITHUB_OUTPUT fi - uses: buildsville/add-remove-label@v2.0.0 - if: ${{ steps.check-branch.outputs.apply-tag }} + if: ${{ steps.check-branch.outputs.release-tag }} with: token: ${{secrets.GITHUB_TOKEN}} - labels: ${{ github.base_ref }} + labels: ${{ steps.check-branch.outputs.release-tag }} type: add From 907d94bd61bcd6a44b989bb09806a9ab5b5d584f Mon Sep 17 00:00:00 2001 From: hanwckf Date: Sat, 19 Nov 2022 14:32:05 +0800 Subject: [PATCH 098/137] kernel: sysctl: update nf_ct settings for fullcone nat Signed-off-by: Tianling Shen --- package/kernel/linux/files/sysctl-nf-conntrack.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/kernel/linux/files/sysctl-nf-conntrack.conf b/package/kernel/linux/files/sysctl-nf-conntrack.conf index c962257997..8ef32893f4 100644 --- a/package/kernel/linux/files/sysctl-nf-conntrack.conf +++ b/package/kernel/linux/files/sysctl-nf-conntrack.conf @@ -8,3 +8,5 @@ net.netfilter.nf_conntrack_tcp_timeout_established=7440 net.netfilter.nf_conntrack_udp_timeout=60 net.netfilter.nf_conntrack_udp_timeout_stream=180 net.netfilter.nf_conntrack_helper=1 +net.netfilter.nf_conntrack_buckets=16384 +net.netfilter.nf_conntrack_expect_max=512 From 5014dc07ea17f45d5a5d366d4e9960b9e24a277c Mon Sep 17 00:00:00 2001 From: hanwckf Date: Tue, 22 Nov 2022 10:36:13 +0800 Subject: [PATCH 099/137] kernel: sysctl: update nf_ct_expect settings for fullcone nat Signed-off-by: Tianling Shen --- package/kernel/linux/files/sysctl-nf-conntrack.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/linux/files/sysctl-nf-conntrack.conf b/package/kernel/linux/files/sysctl-nf-conntrack.conf index 8ef32893f4..45fa5381bf 100644 --- a/package/kernel/linux/files/sysctl-nf-conntrack.conf +++ b/package/kernel/linux/files/sysctl-nf-conntrack.conf @@ -9,4 +9,4 @@ net.netfilter.nf_conntrack_udp_timeout=60 net.netfilter.nf_conntrack_udp_timeout_stream=180 net.netfilter.nf_conntrack_helper=1 net.netfilter.nf_conntrack_buckets=16384 -net.netfilter.nf_conntrack_expect_max=512 +net.netfilter.nf_conntrack_expect_max=16384 From a3c5c14c8bb68938d90e61eb1696052c1f80d7e1 Mon Sep 17 00:00:00 2001 From: ntlf9t <31321865+ntlf9t@users.noreply.github.com> Date: Thu, 2 Dec 2021 22:24:37 +0800 Subject: [PATCH 100/137] x86: bypassing the HH3K up to 2.5Gbps using a BCM578xx https://www.dslreports.com/forum/r32230041-Internet-Bypassing-the-HH3K-up-to-2-5Gbps-using-a-BCM57810S-NIC --- ...x2x_warpcore_8727_2_5g_sgmii_txfault.patch | 216 ++++++++++++++++++ 1 file changed, 216 insertions(+) create mode 100644 target/linux/x86/patches-5.4/993-bnx2x_warpcore_8727_2_5g_sgmii_txfault.patch diff --git a/target/linux/x86/patches-5.4/993-bnx2x_warpcore_8727_2_5g_sgmii_txfault.patch b/target/linux/x86/patches-5.4/993-bnx2x_warpcore_8727_2_5g_sgmii_txfault.patch new file mode 100644 index 0000000000..edb9838f7b --- /dev/null +++ b/target/linux/x86/patches-5.4/993-bnx2x_warpcore_8727_2_5g_sgmii_txfault.patch @@ -0,0 +1,216 @@ +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +@@ -1592,6 +1592,7 @@ struct bnx2x { + uint num_ethernet_queues; + uint num_cnic_queues; + int disable_tpa; ++ int mask_tx_fault; + + u32 rx_mode; + #define BNX2X_RX_MODE_NONE 0 +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +@@ -151,6 +151,7 @@ typedef int (*read_sfp_module_eeprom_fun + + #define SFP_EEPROM_CON_TYPE_ADDR 0x2 + #define SFP_EEPROM_CON_TYPE_VAL_UNKNOWN 0x0 ++ #define SFP_EEPROM_CON_TYPE_VAL_SC 0x1 + #define SFP_EEPROM_CON_TYPE_VAL_LC 0x7 + #define SFP_EEPROM_CON_TYPE_VAL_COPPER 0x21 + #define SFP_EEPROM_CON_TYPE_VAL_RJ45 0x22 +@@ -4206,6 +4207,16 @@ static void bnx2x_warpcore_set_sgmii_spe + 0x1000); + DP(NETIF_MSG_LINK, "set SGMII AUTONEG\n"); + } else { ++ /* Note that 2.5G works only when used with 1G advertisment */ ++ if (fiber_mode && (phy->req_line_speed == SPEED_2500) && ++ (phy->speed_cap_mask & ++ (PORT_HW_CFG_SPEED_CAPABILITY_D0_1G | ++ PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G))) { ++ bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, ++ MDIO_WC_REG_SERDESDIGITAL_MISC1, ++ 0x6010); ++ } ++ + bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, + MDIO_WC_REG_COMBO_IEEE0_MIICTRL, &val16); + val16 &= 0xcebf; +@@ -4216,6 +4227,7 @@ static void bnx2x_warpcore_set_sgmii_spe + val16 |= 0x2000; + break; + case SPEED_1000: ++ case SPEED_2500: + val16 |= 0x0040; + break; + default: +@@ -8169,6 +8181,7 @@ static int bnx2x_get_edc_mode(struct bnx + break; + } + case SFP_EEPROM_CON_TYPE_VAL_UNKNOWN: ++ case SFP_EEPROM_CON_TYPE_VAL_SC: + case SFP_EEPROM_CON_TYPE_VAL_LC: + case SFP_EEPROM_CON_TYPE_VAL_RJ45: + check_limiting_mode = 1; +@@ -8179,7 +8192,8 @@ static int bnx2x_get_edc_mode(struct bnx + (val[SFP_EEPROM_1G_COMP_CODE_ADDR] != 0)) { + DP(NETIF_MSG_LINK, "1G SFP module detected\n"); + phy->media_type = ETH_PHY_SFP_1G_FIBER; +- if (phy->req_line_speed != SPEED_1000) { ++ if ((phy->req_line_speed != SPEED_1000) && ++ (phy->req_line_speed != SPEED_2500)) { + u8 gport = params->port; + phy->req_line_speed = SPEED_1000; + if (!CHIP_IS_E1x(bp)) { +@@ -8339,7 +8353,7 @@ static int bnx2x_wait_for_sfp_module_ini + * some phys type ( e.g. JDSU ) + */ + +- for (timeout = 0; timeout < 60; timeout++) { ++ for (timeout = 0; timeout < 1800; timeout++) { + if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) + rc = bnx2x_warpcore_read_sfp_module_eeprom( + phy, params, I2C_DEV_ADDR_A0, 1, 1, &val, +@@ -9238,6 +9252,7 @@ static void bnx2x_8727_config_speed(stru + u16 tmp1, val; + /* Set option 1G speed */ + if ((phy->req_line_speed == SPEED_1000) || ++ (phy->req_line_speed == SPEED_2500) || + (phy->media_type == ETH_PHY_SFP_1G_FIBER)) { + DP(NETIF_MSG_LINK, "Setting 1G force\n"); + bnx2x_cl45_write(bp, phy, +@@ -9247,6 +9262,22 @@ static void bnx2x_8727_config_speed(stru + bnx2x_cl45_read(bp, phy, + MDIO_PMA_DEVAD, MDIO_PMA_REG_10G_CTRL2, &tmp1); + DP(NETIF_MSG_LINK, "1.7 = 0x%x\n", tmp1); ++ if ((phy->req_line_speed == SPEED_2500) && ++ (phy->speed_cap_mask & ++ (PORT_HW_CFG_SPEED_CAPABILITY_D0_1G | ++ PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G))) { ++ bnx2x_cl45_read_and_write(bp, phy, ++ MDIO_AN_DEVAD, ++ MDIO_AN_REG_8727_MISC_CTRL2, ++ ~(1<<5)); ++ bnx2x_cl45_write(bp, phy, ++ MDIO_AN_DEVAD, ++ MDIO_AN_REG_8727_MISC_CTRL1, 0x0010); ++ } else { ++ bnx2x_cl45_write(bp, phy, ++ MDIO_AN_DEVAD, ++ MDIO_AN_REG_8727_MISC_CTRL1, 0x001C); ++ } + /* Power down the XAUI until link is up in case of dual-media + * and 1G + */ +@@ -9268,7 +9299,7 @@ static void bnx2x_8727_config_speed(stru + + DP(NETIF_MSG_LINK, "Setting 1G clause37\n"); + bnx2x_cl45_write(bp, phy, +- MDIO_AN_DEVAD, MDIO_AN_REG_8727_MISC_CTRL, 0); ++ MDIO_AN_DEVAD, MDIO_AN_REG_8727_MISC_CTRL2, 0); + bnx2x_cl45_write(bp, phy, + MDIO_AN_DEVAD, MDIO_AN_REG_CL37_AN, 0x1300); + } else { +@@ -9276,9 +9307,12 @@ static void bnx2x_8727_config_speed(stru + * registers although it is default + */ + bnx2x_cl45_write(bp, phy, +- MDIO_AN_DEVAD, MDIO_AN_REG_8727_MISC_CTRL, ++ MDIO_AN_DEVAD, MDIO_AN_REG_8727_MISC_CTRL2, + 0x0020); + bnx2x_cl45_write(bp, phy, ++ MDIO_AN_DEVAD, MDIO_AN_REG_8727_MISC_CTRL1, ++ 0x001C); ++ bnx2x_cl45_write(bp, phy, + MDIO_AN_DEVAD, MDIO_AN_REG_CL37_AN, 0x0100); + bnx2x_cl45_write(bp, phy, + MDIO_PMA_DEVAD, MDIO_PMA_REG_CTRL, 0x2040); +@@ -9569,6 +9603,11 @@ static u8 bnx2x_8727_read_status(struct + vars->line_speed = SPEED_10000; + DP(NETIF_MSG_LINK, "port %x: External link up in 10G\n", + params->port); ++ } else if ((link_status & (1<<1)) && (!(link_status & (1<<14)))) { ++ link_up = 1; ++ vars->line_speed = SPEED_2500; ++ DP(NETIF_MSG_LINK, "port %x: External link up in 2.5G\n", ++ params->port); + } else if ((link_status & (1<<0)) && (!(link_status & (1<<13)))) { + link_up = 1; + vars->line_speed = SPEED_1000; +@@ -9600,7 +9639,8 @@ static u8 bnx2x_8727_read_status(struct + } + + if ((DUAL_MEDIA(params)) && +- (phy->req_line_speed == SPEED_1000)) { ++ ((phy->req_line_speed == SPEED_1000) || ++ (phy->req_line_speed == SPEED_2500))) { + bnx2x_cl45_read(bp, phy, + MDIO_PMA_DEVAD, + MDIO_PMA_REG_8727_PCS_GP, &val1); +@@ -11730,6 +11770,7 @@ static const struct bnx2x_phy phy_warpco + SUPPORTED_100baseT_Full | + SUPPORTED_1000baseT_Full | + SUPPORTED_1000baseKX_Full | ++ SUPPORTED_2500baseX_Full | + SUPPORTED_10000baseT_Full | + SUPPORTED_10000baseKR_Full | + SUPPORTED_20000baseKR2_Full | +@@ -11916,6 +11957,7 @@ static const struct bnx2x_phy phy_8727 = + .tx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, + .mdio_ctrl = 0, + .supported = (SUPPORTED_10000baseT_Full | ++ SUPPORTED_2500baseX_Full | + SUPPORTED_1000baseT_Full | + SUPPORTED_FIBRE | + SUPPORTED_Pause | +@@ -12263,6 +12305,7 @@ static int bnx2x_populate_int_phy(struct + break; + case PORT_HW_CFG_NET_SERDES_IF_SFI: + phy->supported &= (SUPPORTED_1000baseT_Full | ++ SUPPORTED_2500baseX_Full | + SUPPORTED_10000baseT_Full | + SUPPORTED_FIBRE | + SUPPORTED_Pause | +@@ -13947,7 +13990,8 @@ void bnx2x_period_func(struct link_param + & PORT_HW_CFG_NET_SERDES_IF_MASK) == + PORT_HW_CFG_NET_SERDES_IF_SFI) { + if (bnx2x_is_sfp_module_plugged(phy, params)) { +- bnx2x_sfp_tx_fault_detection(phy, params, vars); ++ if(!((params->port + 1) & bp->mask_tx_fault)) ++ bnx2x_sfp_tx_fault_detection(phy, params, vars); + } else if (vars->link_status & + LINK_STATUS_SFP_TX_FAULT) { + /* Clean trail, interrupt corrects the leds */ +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +@@ -105,6 +105,10 @@ static int disable_tpa; + module_param(disable_tpa, int, 0444); + MODULE_PARM_DESC(disable_tpa, " Disable the TPA (LRO) feature"); + ++static int mask_tx_fault; ++module_param(mask_tx_fault, int, 0444); ++MODULE_PARM_DESC(mask_tx_fault, " Mask SFP TX fault detection"); ++ + static int int_mode; + module_param(int_mode, int, 0444); + MODULE_PARM_DESC(int_mode, " Force interrupt mode other than MSI-X " +@@ -12455,6 +12459,8 @@ static int bnx2x_init_bp(struct bnx2x *b + if (BP_NOMCP(bp) && (func == 0)) + dev_err(&bp->pdev->dev, "MCP disabled, must load devices in order!\n"); + ++ bp->mask_tx_fault = mask_tx_fault; ++ + bp->disable_tpa = disable_tpa; + bp->disable_tpa |= !!IS_MF_STORAGE_ONLY(bp); + /* Reduce memory usage in kdump environment by disabling TPA */ +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h +@@ -7169,7 +7169,8 @@ Theotherbitsarereservedandshouldbezero*/ + #define MDIO_PMA_REG_8727_PCS_GP 0xc842 + #define MDIO_PMA_REG_8727_OPT_CFG_REG 0xc8e4 + +-#define MDIO_AN_REG_8727_MISC_CTRL 0x8309 ++#define MDIO_AN_REG_8727_MISC_CTRL1 0x8308 ++#define MDIO_AN_REG_8727_MISC_CTRL2 0x8309 + + #define MDIO_PMA_REG_8073_CHIP_REV 0xc801 + #define MDIO_PMA_REG_8073_SPEED_LINK_STATUS 0xc820 From 9cb5203ef2b074bc2c60e97b014a57cab18094d4 Mon Sep 17 00:00:00 2001 From: lean Date: Fri, 31 Dec 2021 10:29:05 +0800 Subject: [PATCH 101/137] kernel: netdevices: add bnxt-en support Signed-off-by: Tianling Shen --- package/kernel/linux/modules/netdevices.mk | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index d2e0f0fe36..975d639816 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -1083,6 +1083,26 @@ endef $(eval $(call KernelPackage,bnx2x)) +define KernelPackage/bnxt-en + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=BCM 574xx/575xx 10/25/50-Gigabit ethernet adapter driver + DEPENDS:=@PCI_SUPPORT +kmod-lib-crc32c +kmod-mdio +kmod-ptp +kmod-lib-zlib-inflate +kmod-hwmon-core + FILES:=$(LINUX_DIR)/drivers/net/ethernet/broadcom/bnxt/bnxt_en.ko + KCONFIG:= \ + CONFIG_BNXT \ + CONFIG_BNXT_SRIOV=y \ + CONFIG_BNXT_FLOWER_OFFLOAD=y \ + CONFIG_BNXT_DCB=n \ + CONFIG_BNXT_HWMON=y + AUTOLOAD:=$(call AutoProbe,bnxt_en) +endef + +define KernelPackage/bnxt-en/description + Broadcom 573xx/574xx/575xx 10/25/40/50-Gigabit ethernet adapter Driver +endef + +$(eval $(call KernelPackage,bnxt-en)) + define KernelPackage/be2net SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Broadcom Emulex OneConnect 10Gbps NIC From d48f38c30f7c3d8458d86fec238b5153f78df297 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 4 Dec 2022 20:28:28 +0100 Subject: [PATCH 102/137] CI: fix matching for openwrt release branch for container selection The current match logic doesn't handle test for push events related to stable release (example openwrt-22.03) but only fork with the related prefix (example openwrt-22.03-fixup) Fix wrong matching and while at it also add extra checks to other matching (check if the branch name actually start with the requested prefix) Fixes: abe8a4824210 ("CI: build: add support for per branch tools container") Signed-off-by: Christian Marangi (cherry picked from commit 65c3d19c4b28ccac0d08d916de0ffa4c0e7b3dc2) --- .github/workflows/build.yml | 10 ++++++---- .github/workflows/check-kernel-patches.yml | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 511d9596fa..f35a70d8f9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,16 +62,18 @@ jobs: run: | CONTAINER_TAG=latest if [ -n "${{ github.base_ref }}" ]; then - if echo "${{ github.base_ref }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]'; then + if echo "${{ github.base_ref }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then CONTAINER_TAG="${{ github.base_ref }}" fi elif [ ${{ github.ref_type }} == "branch" ]; then - if echo "${{ github.ref_name }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]-'; then + if echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then + CONTAINER_TAG=${{ github.ref_name }} + elif echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]-'; then CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\)-.*/\1/')" fi elif [ ${{ github.ref_type }} == "tag" ]; then - if echo "${{ github.ref_name }}" | grep -q -E 'v[0-9][0-9]\.[0-9][0-9]\..+'; then - CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" + if echo "${{ github.ref_name }}" | grep -q -E '^v[0-9][0-9]\.[0-9][0-9]\..+'; then + CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/^v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" fi fi echo "Tools container to use tools:$CONTAINER_TAG" diff --git a/.github/workflows/check-kernel-patches.yml b/.github/workflows/check-kernel-patches.yml index f01782d5da..e5b619064f 100644 --- a/.github/workflows/check-kernel-patches.yml +++ b/.github/workflows/check-kernel-patches.yml @@ -39,16 +39,18 @@ jobs: run: | CONTAINER_TAG=latest if [ -n "${{ github.base_ref }}" ]; then - if echo "${{ github.base_ref }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]'; then + if echo "${{ github.base_ref }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then CONTAINER_TAG="${{ github.base_ref }}" fi elif [ ${{ github.ref_type }} == "branch" ]; then - if echo "${{ github.ref_name }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]-'; then + if echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then + CONTAINER_TAG=${{ github.ref_name }} + elif echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]-'; then CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\)-.*/\1/')" fi elif [ ${{ github.ref_type }} == "tag" ]; then - if echo "${{ github.ref_name }}" | grep -q -E 'v[0-9][0-9]\.[0-9][0-9]\..+'; then - CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" + if echo "${{ github.ref_name }}" | grep -q -E '^v[0-9][0-9]\.[0-9][0-9]\..+'; then + CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/^v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" fi fi echo "Tools container to use tools:$CONTAINER_TAG" From 8df40b136a172db2d65745695a60515395339413 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 4 Dec 2022 20:36:11 +0100 Subject: [PATCH 103/137] CI: build: fix matching for openwrt release branch for toolchain parsing The current match logic doesn't handle test for push events related to stable release (example openwrt-22.03) but only fork with the related prefix (example openwrt-22.03-fixup) Fix wrong matching and while at it also add extra checks to other matching (check if the branch name actually start with the requested prefix) Fixes: e24a1e6f6d7f ("CI: build: add support for external toolchains from stable branch") Signed-off-by: Christian Marangi (cherry picked from commit e3cf2b84e5f8708ca17d931ef60746516c8a2fe4) --- .github/workflows/build.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f35a70d8f9..115bf2c654 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -151,16 +151,18 @@ jobs: TOOLCHAIN_PATH=snapshots if [ -n "${{ github.base_ref }}" ]; then - if echo "${{ github.base_ref }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]'; then - major_ver="$(echo ${{ github.base_ref }} | sed 's/openwrt-/v/')" + if echo "${{ github.base_ref }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then + major_ver="$(echo ${{ github.base_ref }} | sed 's/^openwrt-/v/')" fi elif [ "${{ github.ref_type }}" = "branch" ]; then - if echo "${{ github.ref_name }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]-'; then - major_ver="$(echo ${{ github.ref_name }} | sed 's/openwrt-\([0-9][0-9]\.[0-9][0-9]\)-.*/v\1/')" + if echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then + major_ver="$(echo ${{ github.ref_name }} | sed 's/^openwrt-/v/')" + elif echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]-'; then + major_ver="$(echo ${{ github.ref_name }} | sed 's/^openwrt-\([0-9][0-9]\.[0-9][0-9]\)-.*/v\1/')" fi elif [ "${{ github.ref_type }}" = "tag" ]; then - if echo "${{ github.ref_name }}" | grep -q -E 'v[0-9][0-9]\.[0-9][0-9]\..+'; then - major_ver="$(sed 's/\(v[0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" + if echo "${{ github.ref_name }}" | grep -q -E '^v[0-9][0-9]\.[0-9][0-9]\..+'; then + major_ver="$(echo ${{ github.ref_name }} | sed 's/^\(v[0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" fi fi From be3b061d7bbf425c95ef9108a37c51747c0025e9 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 4 Dec 2022 20:58:11 +0100 Subject: [PATCH 104/137] CI: trigger check also on build and check-kernel-patches workflow change Since kernel and packages workflow now use a shared build workflow, they also need to react on changes on these shared workflow. Fix this and add these shared workflow to the event paths to check. Signed-off-by: Christian Marangi (cherry picked from commit 644175c29ca11e0a008c58c82986045f738f5c6f) --- .github/workflows/kernel.yml | 4 ++++ .github/workflows/packages.yml | 2 ++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 06efe14d5c..5a8c1123af 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -3,12 +3,16 @@ name: Build Kernel on: pull_request: paths: + - '.github/workflows/check-kernel-patches.yml' + - '.github/workflows/build.yml' - '.github/workflows/kernel.yml' - 'include/kernel*' - 'package/kernel/**' - 'target/linux/generic/**' push: paths: + - '.github/workflows/check-kernel-patches.yml' + - '.github/workflows/build.yml' - '.github/workflows/kernel.yml' - 'include/kernel*' - 'package/kernel/**' diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index a374b37023..94982ba65b 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -3,6 +3,7 @@ name: Build all core packages on: pull_request: paths: + - '.github/workflows/build.yml' - '.github/workflows/packages.yml' - 'config/**' - 'include/**' @@ -11,6 +12,7 @@ on: - 'toolchain/**' push: paths: + - '.github/workflows/build.yml' - '.github/workflows/packages.yml' - 'config/**' - 'include/**' From 5411500caa3055f13acc00f9164ede4db8c59cc4 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Sun, 6 Nov 2022 16:05:44 +0100 Subject: [PATCH 105/137] mac80211: rt2x00: add tags to upstreamed patches Some patches are already upstreamed. Signed-off-by: Nick Hainke (cherry picked from commit b2272c6194666a299210a0ee1bf307c83abc278b) --- ...=> 001-v6.1-rt2x00-define-RF5592-in-init_eeprom-routine.patch} | 0 ...ger.patch => 002-v6.1-rt2x00-add-throughput-LED-trigger.patch} | 0 ...> 003-v6.1-rt2x00-add-support-for-external-PA-on-MT7620.patch} | 0 ...> 004-v6.1-rt2x00-move-up-and-reuse-busy-wait-functions.patch} | 0 ...005-v6.1-rt2x00-add-RF-self-TXDC-calibration-for-MT7620.patch} | 0 ...0.patch => 006-v6.1-rt2x00-add-r-calibration-for-MT7620.patch} | 0 ...ch => 007-v6.1-rt2x00-add-RXDCOC-calibration-for-MT7620.patch} | 0 ...atch => 008-v6.1-rt2x00-add-RXIQ-calibration-for-MT7620.patch} | 0 ...9-v6.1-rt2x00-don-t-run-Rt5592-IQ-calibration-on-MT7620.patch} | 0 ...h => 010-v6.1-rt2x00-add-TX-LOFT-calibration-for-MT7620.patch} | 0 ...tch => 011-v6.1-rt2x00-move-helper-functions-up-in-file.patch} | 0 ...12-v6.1-rt2x00-fix-HT20-HT40-bandwidth-switch-on-MT7620.patch} | 0 ...1-rt2x00-set-correct-TX_SW_CFG1-MAC-register-for-MT7620.patch} | 0 ... 014-v6.1-rt2x00-set-VGC-gain-for-both-chains-of-MT7620.patch} | 0 ...er.patch => 015-v6.1-rt2x00-set-SoC-wmac-clock-register.patch} | 0 ...16-v6.1-rt2x00-correctly-set-BBP-register-86-for-MT7620.patch} | 0 16 files changed, 0 insertions(+), 0 deletions(-) rename package/kernel/mac80211/patches/rt2x00/{001-rt2x00-define-RF5592-in-init_eeprom-routine.patch => 001-v6.1-rt2x00-define-RF5592-in-init_eeprom-routine.patch} (100%) rename package/kernel/mac80211/patches/rt2x00/{002-rt2x00-add-throughput-LED-trigger.patch => 002-v6.1-rt2x00-add-throughput-LED-trigger.patch} (100%) rename package/kernel/mac80211/patches/rt2x00/{003-rt2x00-add-support-for-external-PA-on-MT7620.patch => 003-v6.1-rt2x00-add-support-for-external-PA-on-MT7620.patch} (100%) rename package/kernel/mac80211/patches/rt2x00/{004-rt2x00-move-up-and-reuse-busy-wait-functions.patch => 004-v6.1-rt2x00-move-up-and-reuse-busy-wait-functions.patch} (100%) rename package/kernel/mac80211/patches/rt2x00/{005-rt2x00-add-RF-self-TXDC-calibration-for-MT7620.patch => 005-v6.1-rt2x00-add-RF-self-TXDC-calibration-for-MT7620.patch} (100%) rename package/kernel/mac80211/patches/rt2x00/{006-rt2x00-add-r-calibration-for-MT7620.patch => 006-v6.1-rt2x00-add-r-calibration-for-MT7620.patch} (100%) rename package/kernel/mac80211/patches/rt2x00/{007-rt2x00-add-RXDCOC-calibration-for-MT7620.patch => 007-v6.1-rt2x00-add-RXDCOC-calibration-for-MT7620.patch} (100%) rename package/kernel/mac80211/patches/rt2x00/{008-rt2x00-add-RXIQ-calibration-for-MT7620.patch => 008-v6.1-rt2x00-add-RXIQ-calibration-for-MT7620.patch} (100%) rename package/kernel/mac80211/patches/rt2x00/{009-rt2x00-don-t-run-Rt5592-IQ-calibration-on-MT7620.patch => 009-v6.1-rt2x00-don-t-run-Rt5592-IQ-calibration-on-MT7620.patch} (100%) rename package/kernel/mac80211/patches/rt2x00/{010-rt2x00-add-TX-LOFT-calibration-for-MT7620.patch => 010-v6.1-rt2x00-add-TX-LOFT-calibration-for-MT7620.patch} (100%) rename package/kernel/mac80211/patches/rt2x00/{011-rt2x00-move-helper-functions-up-in-file.patch => 011-v6.1-rt2x00-move-helper-functions-up-in-file.patch} (100%) rename package/kernel/mac80211/patches/rt2x00/{012-rt2x00-fix-HT20-HT40-bandwidth-switch-on-MT7620.patch => 012-v6.1-rt2x00-fix-HT20-HT40-bandwidth-switch-on-MT7620.patch} (100%) rename package/kernel/mac80211/patches/rt2x00/{013-rt2x00-set-correct-TX_SW_CFG1-MAC-register-for-MT7620.patch => 013-v6.1-rt2x00-set-correct-TX_SW_CFG1-MAC-register-for-MT7620.patch} (100%) rename package/kernel/mac80211/patches/rt2x00/{014-rt2x00-set-VGC-gain-for-both-chains-of-MT7620.patch => 014-v6.1-rt2x00-set-VGC-gain-for-both-chains-of-MT7620.patch} (100%) rename package/kernel/mac80211/patches/rt2x00/{015-rt2x00-set-SoC-wmac-clock-register.patch => 015-v6.1-rt2x00-set-SoC-wmac-clock-register.patch} (100%) rename package/kernel/mac80211/patches/rt2x00/{016-rt2x00-correctly-set-BBP-register-86-for-MT7620.patch => 016-v6.1-rt2x00-correctly-set-BBP-register-86-for-MT7620.patch} (100%) diff --git a/package/kernel/mac80211/patches/rt2x00/001-rt2x00-define-RF5592-in-init_eeprom-routine.patch b/package/kernel/mac80211/patches/rt2x00/001-v6.1-rt2x00-define-RF5592-in-init_eeprom-routine.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/001-rt2x00-define-RF5592-in-init_eeprom-routine.patch rename to package/kernel/mac80211/patches/rt2x00/001-v6.1-rt2x00-define-RF5592-in-init_eeprom-routine.patch diff --git a/package/kernel/mac80211/patches/rt2x00/002-rt2x00-add-throughput-LED-trigger.patch b/package/kernel/mac80211/patches/rt2x00/002-v6.1-rt2x00-add-throughput-LED-trigger.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/002-rt2x00-add-throughput-LED-trigger.patch rename to package/kernel/mac80211/patches/rt2x00/002-v6.1-rt2x00-add-throughput-LED-trigger.patch diff --git a/package/kernel/mac80211/patches/rt2x00/003-rt2x00-add-support-for-external-PA-on-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/003-v6.1-rt2x00-add-support-for-external-PA-on-MT7620.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/003-rt2x00-add-support-for-external-PA-on-MT7620.patch rename to package/kernel/mac80211/patches/rt2x00/003-v6.1-rt2x00-add-support-for-external-PA-on-MT7620.patch diff --git a/package/kernel/mac80211/patches/rt2x00/004-rt2x00-move-up-and-reuse-busy-wait-functions.patch b/package/kernel/mac80211/patches/rt2x00/004-v6.1-rt2x00-move-up-and-reuse-busy-wait-functions.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/004-rt2x00-move-up-and-reuse-busy-wait-functions.patch rename to package/kernel/mac80211/patches/rt2x00/004-v6.1-rt2x00-move-up-and-reuse-busy-wait-functions.patch diff --git a/package/kernel/mac80211/patches/rt2x00/005-rt2x00-add-RF-self-TXDC-calibration-for-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/005-v6.1-rt2x00-add-RF-self-TXDC-calibration-for-MT7620.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/005-rt2x00-add-RF-self-TXDC-calibration-for-MT7620.patch rename to package/kernel/mac80211/patches/rt2x00/005-v6.1-rt2x00-add-RF-self-TXDC-calibration-for-MT7620.patch diff --git a/package/kernel/mac80211/patches/rt2x00/006-rt2x00-add-r-calibration-for-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/006-v6.1-rt2x00-add-r-calibration-for-MT7620.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/006-rt2x00-add-r-calibration-for-MT7620.patch rename to package/kernel/mac80211/patches/rt2x00/006-v6.1-rt2x00-add-r-calibration-for-MT7620.patch diff --git a/package/kernel/mac80211/patches/rt2x00/007-rt2x00-add-RXDCOC-calibration-for-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/007-v6.1-rt2x00-add-RXDCOC-calibration-for-MT7620.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/007-rt2x00-add-RXDCOC-calibration-for-MT7620.patch rename to package/kernel/mac80211/patches/rt2x00/007-v6.1-rt2x00-add-RXDCOC-calibration-for-MT7620.patch diff --git a/package/kernel/mac80211/patches/rt2x00/008-rt2x00-add-RXIQ-calibration-for-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/008-v6.1-rt2x00-add-RXIQ-calibration-for-MT7620.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/008-rt2x00-add-RXIQ-calibration-for-MT7620.patch rename to package/kernel/mac80211/patches/rt2x00/008-v6.1-rt2x00-add-RXIQ-calibration-for-MT7620.patch diff --git a/package/kernel/mac80211/patches/rt2x00/009-rt2x00-don-t-run-Rt5592-IQ-calibration-on-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/009-v6.1-rt2x00-don-t-run-Rt5592-IQ-calibration-on-MT7620.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/009-rt2x00-don-t-run-Rt5592-IQ-calibration-on-MT7620.patch rename to package/kernel/mac80211/patches/rt2x00/009-v6.1-rt2x00-don-t-run-Rt5592-IQ-calibration-on-MT7620.patch diff --git a/package/kernel/mac80211/patches/rt2x00/010-rt2x00-add-TX-LOFT-calibration-for-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/010-v6.1-rt2x00-add-TX-LOFT-calibration-for-MT7620.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/010-rt2x00-add-TX-LOFT-calibration-for-MT7620.patch rename to package/kernel/mac80211/patches/rt2x00/010-v6.1-rt2x00-add-TX-LOFT-calibration-for-MT7620.patch diff --git a/package/kernel/mac80211/patches/rt2x00/011-rt2x00-move-helper-functions-up-in-file.patch b/package/kernel/mac80211/patches/rt2x00/011-v6.1-rt2x00-move-helper-functions-up-in-file.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/011-rt2x00-move-helper-functions-up-in-file.patch rename to package/kernel/mac80211/patches/rt2x00/011-v6.1-rt2x00-move-helper-functions-up-in-file.patch diff --git a/package/kernel/mac80211/patches/rt2x00/012-rt2x00-fix-HT20-HT40-bandwidth-switch-on-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/012-v6.1-rt2x00-fix-HT20-HT40-bandwidth-switch-on-MT7620.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/012-rt2x00-fix-HT20-HT40-bandwidth-switch-on-MT7620.patch rename to package/kernel/mac80211/patches/rt2x00/012-v6.1-rt2x00-fix-HT20-HT40-bandwidth-switch-on-MT7620.patch diff --git a/package/kernel/mac80211/patches/rt2x00/013-rt2x00-set-correct-TX_SW_CFG1-MAC-register-for-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/013-v6.1-rt2x00-set-correct-TX_SW_CFG1-MAC-register-for-MT7620.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/013-rt2x00-set-correct-TX_SW_CFG1-MAC-register-for-MT7620.patch rename to package/kernel/mac80211/patches/rt2x00/013-v6.1-rt2x00-set-correct-TX_SW_CFG1-MAC-register-for-MT7620.patch diff --git a/package/kernel/mac80211/patches/rt2x00/014-rt2x00-set-VGC-gain-for-both-chains-of-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/014-v6.1-rt2x00-set-VGC-gain-for-both-chains-of-MT7620.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/014-rt2x00-set-VGC-gain-for-both-chains-of-MT7620.patch rename to package/kernel/mac80211/patches/rt2x00/014-v6.1-rt2x00-set-VGC-gain-for-both-chains-of-MT7620.patch diff --git a/package/kernel/mac80211/patches/rt2x00/015-rt2x00-set-SoC-wmac-clock-register.patch b/package/kernel/mac80211/patches/rt2x00/015-v6.1-rt2x00-set-SoC-wmac-clock-register.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/015-rt2x00-set-SoC-wmac-clock-register.patch rename to package/kernel/mac80211/patches/rt2x00/015-v6.1-rt2x00-set-SoC-wmac-clock-register.patch diff --git a/package/kernel/mac80211/patches/rt2x00/016-rt2x00-correctly-set-BBP-register-86-for-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/016-v6.1-rt2x00-correctly-set-BBP-register-86-for-MT7620.patch similarity index 100% rename from package/kernel/mac80211/patches/rt2x00/016-rt2x00-correctly-set-BBP-register-86-for-MT7620.patch rename to package/kernel/mac80211/patches/rt2x00/016-v6.1-rt2x00-correctly-set-BBP-register-86-for-MT7620.patch From a571b805cb852ea7f6bf4c44c40ae5b913042df2 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 27 Nov 2022 19:51:44 +0100 Subject: [PATCH 106/137] mac80211: Update to version 5.15.81 The removed patches were applied upstream. Signed-off-by: Hauke Mehrtens (cherry picked from commit 077622a198039f9f3d907b5cf4d77a52d7592c49) --- package/kernel/mac80211/Makefile | 6 +- .../patches/ath/404-regd_no_assoc_hints.patch | 4 +- ...add-encapsulation-offloading-support.patch | 20 ++--- .../930-ath10k_add_tpt_led_trigger.patch | 4 +- ...75-ath10k-use-tpt-trigger-by-default.patch | 2 +- ...-power-reduction-for-US-regulatory-d.patch | 8 +- ...etting-wlan-MAC-address-using-device.patch | 2 +- .../mac80211/patches/brcm/998-survey.patch | 4 +- ...define-RF5592-in-init_eeprom-routine.patch | 2 +- ...dd-support-for-external-PA-on-MT7620.patch | 8 +- ...ove-up-and-reuse-busy-wait-functions.patch | 4 +- ...-RF-self-TXDC-calibration-for-MT7620.patch | 4 +- ...-rt2x00-add-r-calibration-for-MT7620.patch | 4 +- ...00-add-RXDCOC-calibration-for-MT7620.patch | 4 +- ...2x00-add-RXIQ-calibration-for-MT7620.patch | 4 +- ...-run-Rt5592-IQ-calibration-on-MT7620.patch | 52 ------------ ...0-add-TX-LOFT-calibration-for-MT7620.patch | 4 +- ...x00-move-helper-functions-up-in-file.patch | 2 +- ...t-TX_SW_CFG1-MAC-register-for-MT7620.patch | 52 ------------ ...t-VGC-gain-for-both-chains-of-MT7620.patch | 50 ------------ ...1-rt2x00-set-SoC-wmac-clock-register.patch | 70 ---------------- ...ectly-set-BBP-register-86-for-MT7620.patch | 79 ------------------- .../subsys/150-disable_addr_notifier.patch | 2 +- ...211_hwsim-make-6-GHz-channels-usable.patch | 8 +- ...introduce-set_radar_offchan-callback.patch | 4 +- ...offchannel_chain-structs-to-backgrou.patch | 4 +- ...11-MBSSID-beacon-handling-in-AP-mode.patch | 6 +- .../500-mac80211_configure_antenna_gain.patch | 2 +- 28 files changed, 56 insertions(+), 359 deletions(-) delete mode 100644 package/kernel/mac80211/patches/rt2x00/009-v6.1-rt2x00-don-t-run-Rt5592-IQ-calibration-on-MT7620.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/013-v6.1-rt2x00-set-correct-TX_SW_CFG1-MAC-register-for-MT7620.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/014-v6.1-rt2x00-set-VGC-gain-for-both-chains-of-MT7620.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/015-v6.1-rt2x00-set-SoC-wmac-clock-register.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/016-v6.1-rt2x00-correctly-set-BBP-register-86-for-MT7620.patch diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index d188962c81..61d04544a4 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -10,10 +10,10 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=5.15.74-1 +PKG_VERSION:=5.15.81-1 PKG_RELEASE:=1 -PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.15.74/ -PKG_HASH:=98098d0cab24cc76a04db738dc746a0c8d38d180398805481224f141cca06423 +PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.15.81/ +PKG_HASH:=5227d3c35ccebacfaee6b8180b3a87b9910f3c94ee768ebc5c0fef3c86b6146d PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION) diff --git a/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch b/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch index 02281adf4a..c66301efa7 100644 --- a/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch +++ b/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch @@ -1,6 +1,6 @@ --- a/net/wireless/reg.c +++ b/net/wireless/reg.c -@@ -3309,6 +3309,8 @@ void regulatory_hint_country_ie(struct w +@@ -3315,6 +3315,8 @@ void regulatory_hint_country_ie(struct w enum environment_cap env = ENVIRON_ANY; struct regulatory_request *request = NULL, *lr; @@ -9,7 +9,7 @@ /* IE len must be evenly divisible by 2 */ if (country_ie_len & 0x01) return; -@@ -3560,6 +3562,7 @@ static bool is_wiphy_all_set_reg_flag(en +@@ -3566,6 +3568,7 @@ static bool is_wiphy_all_set_reg_flag(en void regulatory_hint_disconnect(void) { diff --git a/package/kernel/mac80211/patches/ath10k/081-04-ath10k-add-encapsulation-offloading-support.patch b/package/kernel/mac80211/patches/ath10k/081-04-ath10k-add-encapsulation-offloading-support.patch index abca7aac9e..e45a3ba860 100644 --- a/package/kernel/mac80211/patches/ath10k/081-04-ath10k-add-encapsulation-offloading-support.patch +++ b/package/kernel/mac80211/patches/ath10k/081-04-ath10k-add-encapsulation-offloading-support.patch @@ -50,7 +50,7 @@ Link: https://lore.kernel.org/r/20220516032519.29831-5-ryazanov.s.a@gmail.com --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -3710,6 +3710,9 @@ ath10k_mac_tx_h_get_txmode(struct ath10k +@@ -3717,6 +3717,9 @@ ath10k_mac_tx_h_get_txmode(struct ath10k const struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb); __le16 fc = hdr->frame_control; @@ -60,7 +60,7 @@ Link: https://lore.kernel.org/r/20220516032519.29831-5-ryazanov.s.a@gmail.com if (!vif || vif->type == NL80211_IFTYPE_MONITOR) return ATH10K_HW_TXRX_RAW; -@@ -3870,6 +3873,12 @@ static void ath10k_mac_tx_h_fill_cb(stru +@@ -3877,6 +3880,12 @@ static void ath10k_mac_tx_h_fill_cb(stru bool noack = false; cb->flags = 0; @@ -73,7 +73,7 @@ Link: https://lore.kernel.org/r/20220516032519.29831-5-ryazanov.s.a@gmail.com if (!ath10k_tx_h_use_hwcrypto(vif, skb)) cb->flags |= ATH10K_SKB_F_NO_HWCRYPT; -@@ -3908,6 +3917,7 @@ static void ath10k_mac_tx_h_fill_cb(stru +@@ -3915,6 +3924,7 @@ static void ath10k_mac_tx_h_fill_cb(stru cb->flags |= ATH10K_SKB_F_RAW_TX; } @@ -81,7 +81,7 @@ Link: https://lore.kernel.org/r/20220516032519.29831-5-ryazanov.s.a@gmail.com cb->vif = vif; cb->txq = txq; cb->airtime_est = airtime; -@@ -4031,7 +4041,11 @@ static int ath10k_mac_tx(struct ath10k * +@@ -4038,7 +4048,11 @@ static int ath10k_mac_tx(struct ath10k * ath10k_tx_h_seq_no(vif, skb); break; case ATH10K_HW_TXRX_ETHERNET: @@ -94,7 +94,7 @@ Link: https://lore.kernel.org/r/20220516032519.29831-5-ryazanov.s.a@gmail.com break; case ATH10K_HW_TXRX_RAW: if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags) && -@@ -4643,12 +4657,10 @@ static void ath10k_mac_op_tx(struct ieee +@@ -4650,12 +4664,10 @@ static void ath10k_mac_op_tx(struct ieee struct ieee80211_vif *vif = info->control.vif; struct ieee80211_sta *sta = control->sta; struct ieee80211_txq *txq = NULL; @@ -107,7 +107,7 @@ Link: https://lore.kernel.org/r/20220516032519.29831-5-ryazanov.s.a@gmail.com int ret; u16 airtime; -@@ -4662,8 +4674,14 @@ static void ath10k_mac_op_tx(struct ieee +@@ -4669,8 +4681,14 @@ static void ath10k_mac_op_tx(struct ieee is_mgmt = (txpath == ATH10K_MAC_TX_HTT_MGMT); if (is_htt) { @@ -123,7 +123,7 @@ Link: https://lore.kernel.org/r/20220516032519.29831-5-ryazanov.s.a@gmail.com ret = ath10k_htt_tx_inc_pending(htt); if (ret) { -@@ -5463,6 +5481,30 @@ static int ath10k_mac_set_txbf_conf(stru +@@ -5470,6 +5488,30 @@ static int ath10k_mac_set_txbf_conf(stru ar->wmi.vdev_param->txbf, value); } @@ -154,7 +154,7 @@ Link: https://lore.kernel.org/r/20220516032519.29831-5-ryazanov.s.a@gmail.com /* * TODO: * Figure out how to handle WMI_VDEV_SUBTYPE_P2P_DEVICE, -@@ -5672,15 +5714,7 @@ static int ath10k_add_interface(struct i +@@ -5679,15 +5721,7 @@ static int ath10k_add_interface(struct i arvif->def_wep_key_idx = -1; @@ -171,7 +171,7 @@ Link: https://lore.kernel.org/r/20220516032519.29831-5-ryazanov.s.a@gmail.com /* Configuring number of spatial stream for monitor interface is causing * target assert in qca9888 and qca6174. -@@ -9368,6 +9402,7 @@ static const struct ieee80211_ops ath10k +@@ -9372,6 +9406,7 @@ static const struct ieee80211_ops ath10k .stop = ath10k_stop, .config = ath10k_config, .add_interface = ath10k_add_interface, @@ -179,7 +179,7 @@ Link: https://lore.kernel.org/r/20220516032519.29831-5-ryazanov.s.a@gmail.com .remove_interface = ath10k_remove_interface, .configure_filter = ath10k_configure_filter, .bss_info_changed = ath10k_bss_info_changed, -@@ -10037,6 +10072,12 @@ int ath10k_mac_register(struct ath10k *a +@@ -10041,6 +10076,12 @@ int ath10k_mac_register(struct ath10k *a if (test_bit(WMI_SERVICE_TDLS_UAPSD_BUFFER_STA, ar->wmi.svc_map)) ieee80211_hw_set(ar->hw, SUPPORTS_TDLS_BUFFER_STA); diff --git a/package/kernel/mac80211/patches/ath10k/930-ath10k_add_tpt_led_trigger.patch b/package/kernel/mac80211/patches/ath10k/930-ath10k_add_tpt_led_trigger.patch index 9dfde4385e..bc6f5dbc5c 100644 --- a/package/kernel/mac80211/patches/ath10k/930-ath10k_add_tpt_led_trigger.patch +++ b/package/kernel/mac80211/patches/ath10k/930-ath10k_add_tpt_led_trigger.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -9894,6 +9894,21 @@ static int ath10k_mac_init_rd(struct ath +@@ -9898,6 +9898,21 @@ static int ath10k_mac_init_rd(struct ath return 0; } @@ -22,7 +22,7 @@ int ath10k_mac_register(struct ath10k *ar) { static const u32 cipher_suites[] = { -@@ -10252,6 +10267,12 @@ int ath10k_mac_register(struct ath10k *a +@@ -10256,6 +10271,12 @@ int ath10k_mac_register(struct ath10k *a ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; diff --git a/package/kernel/mac80211/patches/ath10k/975-ath10k-use-tpt-trigger-by-default.patch b/package/kernel/mac80211/patches/ath10k/975-ath10k-use-tpt-trigger-by-default.patch index 842853ddf4..253fe96ddf 100644 --- a/package/kernel/mac80211/patches/ath10k/975-ath10k-use-tpt-trigger-by-default.patch +++ b/package/kernel/mac80211/patches/ath10k/975-ath10k-use-tpt-trigger-by-default.patch @@ -42,7 +42,7 @@ Signed-off-by: Mathias Kresin if (ret) --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -10269,7 +10269,7 @@ int ath10k_mac_register(struct ath10k *a +@@ -10273,7 +10273,7 @@ int ath10k_mac_register(struct ath10k *a ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; #ifdef CPTCFG_MAC80211_LEDS diff --git a/package/kernel/mac80211/patches/ath10k/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch b/package/kernel/mac80211/patches/ath10k/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch index a45addf119..424985f114 100644 --- a/package/kernel/mac80211/patches/ath10k/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch +++ b/package/kernel/mac80211/patches/ath10k/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch @@ -28,7 +28,7 @@ Forwarded: no --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -1021,6 +1021,40 @@ static inline int ath10k_vdev_setup_sync +@@ -1028,6 +1028,40 @@ static inline int ath10k_vdev_setup_sync return ar->last_wmi_vdev_start_status; } @@ -69,7 +69,7 @@ Forwarded: no static int ath10k_monitor_vdev_start(struct ath10k *ar, int vdev_id) { struct cfg80211_chan_def *chandef = NULL; -@@ -1053,7 +1087,8 @@ static int ath10k_monitor_vdev_start(str +@@ -1060,7 +1094,8 @@ static int ath10k_monitor_vdev_start(str arg.channel.min_power = 0; arg.channel.max_power = channel->max_power * 2; arg.channel.max_reg_power = channel->max_reg_power * 2; @@ -79,7 +79,7 @@ Forwarded: no reinit_completion(&ar->vdev_setup_done); reinit_completion(&ar->vdev_delete_done); -@@ -1499,7 +1534,8 @@ static int ath10k_vdev_start_restart(str +@@ -1506,7 +1541,8 @@ static int ath10k_vdev_start_restart(str arg.channel.min_power = 0; arg.channel.max_power = chandef->chan->max_power * 2; arg.channel.max_reg_power = chandef->chan->max_reg_power * 2; @@ -89,7 +89,7 @@ Forwarded: no if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { arg.ssid = arvif->u.ap.ssid; -@@ -3427,7 +3463,8 @@ static int ath10k_update_channel_list(st +@@ -3434,7 +3470,8 @@ static int ath10k_update_channel_list(st ch->min_power = 0; ch->max_power = channel->max_power * 2; ch->max_reg_power = channel->max_reg_power * 2; diff --git a/package/kernel/mac80211/patches/brcm/001-brcmfmac-allow-setting-wlan-MAC-address-using-device.patch b/package/kernel/mac80211/patches/brcm/001-brcmfmac-allow-setting-wlan-MAC-address-using-device.patch index 03d9f8ecd8..e06e350b62 100644 --- a/package/kernel/mac80211/patches/brcm/001-brcmfmac-allow-setting-wlan-MAC-address-using-device.patch +++ b/package/kernel/mac80211/patches/brcm/001-brcmfmac-allow-setting-wlan-MAC-address-using-device.patch @@ -72,7 +72,7 @@ Link: https://lore.kernel.org/r/20220506044246.67146-1-pavel@loebl.cz #include #include #include -@@ -1226,7 +1227,8 @@ static int brcmf_bus_started(struct brcm +@@ -1227,7 +1228,8 @@ static int brcmf_bus_started(struct brcm brcmf_dbg(TRACE, "\n"); /* add primary networking interface */ diff --git a/package/kernel/mac80211/patches/brcm/998-survey.patch b/package/kernel/mac80211/patches/brcm/998-survey.patch index d194e25177..234a97b7bf 100644 --- a/package/kernel/mac80211/patches/brcm/998-survey.patch +++ b/package/kernel/mac80211/patches/brcm/998-survey.patch @@ -100,7 +100,7 @@ .add_key = brcmf_cfg80211_add_key, --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -1363,6 +1363,8 @@ int brcmf_attach(struct device *dev) +@@ -1364,6 +1364,8 @@ int brcmf_attach(struct device *dev) /* Link to bus module */ drvr->hdrlen = 0; @@ -109,7 +109,7 @@ /* Attach and link in the protocol */ ret = brcmf_proto_attach(drvr); -@@ -1445,6 +1447,12 @@ void brcmf_detach(struct device *dev) +@@ -1446,6 +1448,12 @@ void brcmf_detach(struct device *dev) if (drvr == NULL) return; diff --git a/package/kernel/mac80211/patches/rt2x00/001-v6.1-rt2x00-define-RF5592-in-init_eeprom-routine.patch b/package/kernel/mac80211/patches/rt2x00/001-v6.1-rt2x00-define-RF5592-in-init_eeprom-routine.patch index 351e24a4d5..4d5b670279 100644 --- a/package/kernel/mac80211/patches/rt2x00/001-v6.1-rt2x00-define-RF5592-in-init_eeprom-routine.patch +++ b/package/kernel/mac80211/patches/rt2x00/001-v6.1-rt2x00-define-RF5592-in-init_eeprom-routine.patch @@ -41,7 +41,7 @@ Acked-by: Stanislaw Gruszka --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -9435,6 +9435,8 @@ static int rt2800_init_eeprom(struct rt2 +@@ -9461,6 +9461,8 @@ static int rt2800_init_eeprom(struct rt2 rf = RF3853; else if (rt2x00_rt(rt2x00dev, RT5350)) rf = RF5350; diff --git a/package/kernel/mac80211/patches/rt2x00/003-v6.1-rt2x00-add-support-for-external-PA-on-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/003-v6.1-rt2x00-add-support-for-external-PA-on-MT7620.patch index 216f583063..26c2020918 100644 --- a/package/kernel/mac80211/patches/rt2x00/003-v6.1-rt2x00-add-support-for-external-PA-on-MT7620.patch +++ b/package/kernel/mac80211/patches/rt2x00/003-v6.1-rt2x00-add-support-for-external-PA-on-MT7620.patch @@ -50,8 +50,8 @@ Acked-by: Stanislaw Gruszka * EEPROM LNA --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -4368,6 +4368,43 @@ static void rt2800_config_channel(struct - rt2800_iq_calibrate(rt2x00dev, rf->channel); +@@ -4372,6 +4372,43 @@ static void rt2800_config_channel(struct + rt2800_iq_calibrate(rt2x00dev, rf->channel); } + if (rt2x00_rt(rt2x00dev, RT6352)) { @@ -94,7 +94,7 @@ Acked-by: Stanislaw Gruszka bbp = rt2800_bbp_read(rt2x00dev, 4); rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * conf_is_ht40(conf)); rt2800_bbp_write(rt2x00dev, 4, bbp); -@@ -9566,7 +9603,8 @@ static int rt2800_init_eeprom(struct rt2 +@@ -9592,7 +9629,8 @@ static int rt2800_init_eeprom(struct rt2 */ eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1); @@ -104,7 +104,7 @@ Acked-by: Stanislaw Gruszka if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_EXTERNAL_TX0_PA_3352)) __set_bit(CAPABILITY_EXTERNAL_PA_TX0, -@@ -9577,6 +9615,18 @@ static int rt2800_init_eeprom(struct rt2 +@@ -9603,6 +9641,18 @@ static int rt2800_init_eeprom(struct rt2 &rt2x00dev->cap_flags); } diff --git a/package/kernel/mac80211/patches/rt2x00/004-v6.1-rt2x00-move-up-and-reuse-busy-wait-functions.patch b/package/kernel/mac80211/patches/rt2x00/004-v6.1-rt2x00-move-up-and-reuse-busy-wait-functions.patch index da453074a1..c9b0d82b64 100644 --- a/package/kernel/mac80211/patches/rt2x00/004-v6.1-rt2x00-move-up-and-reuse-busy-wait-functions.patch +++ b/package/kernel/mac80211/patches/rt2x00/004-v6.1-rt2x00-move-up-and-reuse-busy-wait-functions.patch @@ -120,7 +120,7 @@ Acked-by: Stanislaw Gruszka if (chan->center_freq > 2457) { bbp = rt2800_bbp_read(rt2x00dev, 30); -@@ -6249,46 +6282,6 @@ static int rt2800_init_registers(struct +@@ -6275,46 +6308,6 @@ static int rt2800_init_registers(struct return 0; } @@ -167,7 +167,7 @@ Acked-by: Stanislaw Gruszka static void rt2800_bbp4_mac_if_ctrl(struct rt2x00_dev *rt2x00dev) { -@@ -9110,7 +9103,7 @@ int rt2800_enable_radio(struct rt2x00_de +@@ -9136,7 +9129,7 @@ int rt2800_enable_radio(struct rt2x00_de /* * Wait BBP/RF to wake up. */ diff --git a/package/kernel/mac80211/patches/rt2x00/005-v6.1-rt2x00-add-RF-self-TXDC-calibration-for-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/005-v6.1-rt2x00-add-RF-self-TXDC-calibration-for-MT7620.patch index 4e98d6a375..9ba16bee12 100644 --- a/package/kernel/mac80211/patches/rt2x00/005-v6.1-rt2x00-add-RF-self-TXDC-calibration-for-MT7620.patch +++ b/package/kernel/mac80211/patches/rt2x00/005-v6.1-rt2x00-add-RF-self-TXDC-calibration-for-MT7620.patch @@ -42,7 +42,7 @@ v2: use ++i instead of i = i + 1 in loops --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8428,6 +8428,53 @@ static void rt2800_init_rfcsr_5592(struc +@@ -8454,6 +8454,53 @@ static void rt2800_init_rfcsr_5592(struc rt2800_led_open_drain_enable(rt2x00dev); } @@ -96,7 +96,7 @@ v2: use ++i instead of i = i + 1 in loops static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9035,6 +9082,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9061,6 +9108,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); diff --git a/package/kernel/mac80211/patches/rt2x00/006-v6.1-rt2x00-add-r-calibration-for-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/006-v6.1-rt2x00-add-r-calibration-for-MT7620.patch index 7c69970166..e15de28ea0 100644 --- a/package/kernel/mac80211/patches/rt2x00/006-v6.1-rt2x00-add-r-calibration-for-MT7620.patch +++ b/package/kernel/mac80211/patches/rt2x00/006-v6.1-rt2x00-add-r-calibration-for-MT7620.patch @@ -54,7 +54,7 @@ v2: use rt2800_wait_bbp_rf_ready() * PWR_PIN_CFG: --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8475,6 +8475,138 @@ static void rt2800_rf_self_txdc_cal(stru +@@ -8501,6 +8501,138 @@ static void rt2800_rf_self_txdc_cal(stru rt2800_register_write(rt2x00dev, RF_BYPASS2, mac052c); } @@ -193,7 +193,7 @@ v2: use rt2800_wait_bbp_rf_ready() static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9082,6 +9214,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9108,6 +9240,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); diff --git a/package/kernel/mac80211/patches/rt2x00/007-v6.1-rt2x00-add-RXDCOC-calibration-for-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/007-v6.1-rt2x00-add-RXDCOC-calibration-for-MT7620.patch index 8da41e875a..a09d0abed0 100644 --- a/package/kernel/mac80211/patches/rt2x00/007-v6.1-rt2x00-add-RXDCOC-calibration-for-MT7620.patch +++ b/package/kernel/mac80211/patches/rt2x00/007-v6.1-rt2x00-add-RXDCOC-calibration-for-MT7620.patch @@ -41,7 +41,7 @@ Acked-by: Stanislaw Gruszka --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8607,6 +8607,65 @@ static void rt2800_r_calibration(struct +@@ -8633,6 +8633,65 @@ static void rt2800_r_calibration(struct rt2800_register_write(rt2x00dev, PWR_PIN_CFG, MAC_PWR_PIN_CFG); } @@ -107,7 +107,7 @@ Acked-by: Stanislaw Gruszka static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9216,6 +9275,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9242,6 +9301,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_r_calibration(rt2x00dev); rt2800_rf_self_txdc_cal(rt2x00dev); diff --git a/package/kernel/mac80211/patches/rt2x00/008-v6.1-rt2x00-add-RXIQ-calibration-for-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/008-v6.1-rt2x00-add-RXIQ-calibration-for-MT7620.patch index dc516da43a..c532ba512b 100644 --- a/package/kernel/mac80211/patches/rt2x00/008-v6.1-rt2x00-add-RXIQ-calibration-for-MT7620.patch +++ b/package/kernel/mac80211/patches/rt2x00/008-v6.1-rt2x00-add-RXIQ-calibration-for-MT7620.patch @@ -43,7 +43,7 @@ v2: use rt2800_wait_bbp_rf_ready(), fix indentation --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8666,6 +8666,380 @@ static void rt2800_rxdcoc_calibration(st +@@ -8692,6 +8692,380 @@ static void rt2800_rxdcoc_calibration(st rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, saverfb0r2); } @@ -424,7 +424,7 @@ v2: use rt2800_wait_bbp_rf_ready(), fix indentation static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9278,6 +9652,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9304,6 +9678,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rxdcoc_calibration(rt2x00dev); rt2800_bw_filter_calibration(rt2x00dev, true); rt2800_bw_filter_calibration(rt2x00dev, false); diff --git a/package/kernel/mac80211/patches/rt2x00/009-v6.1-rt2x00-don-t-run-Rt5592-IQ-calibration-on-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/009-v6.1-rt2x00-don-t-run-Rt5592-IQ-calibration-on-MT7620.patch deleted file mode 100644 index 6b27f6a705..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/009-v6.1-rt2x00-don-t-run-Rt5592-IQ-calibration-on-MT7620.patch +++ /dev/null @@ -1,52 +0,0 @@ -From patchwork Sat Sep 17 20:28:29 2022 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Daniel Golle -X-Patchwork-Id: 12979250 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: -Date: Sat, 17 Sep 2022 21:28:29 +0100 -From: Daniel Golle -To: linux-wireless@vger.kernel.org, Stanislaw Gruszka , - Helmut Schaa -Cc: Kalle Valo , - "David S. Miller" , - Eric Dumazet , - Jakub Kicinski , - Paolo Abeni , - Johannes Berg -Subject: [PATCH v3 09/16] rt2x00: don't run Rt5592 IQ calibration on MT7620 -Message-ID: - <31a1c34ddbd296b82f38c18c9ae7339059215fdc.1663445157.git.daniel@makrotopia.org> -References: -MIME-Version: 1.0 -Content-Disposition: inline -In-Reply-To: -Precedence: bulk -List-ID: -X-Mailing-List: linux-wireless@vger.kernel.org - -The function rt2800_iq_calibrate is intended for Rt5592 only. -Don't call it for MT7620 which has it's own calibration functions. - -Reported-by: Serge Vasilugin -Signed-off-by: Daniel Golle ---- -v2: test for RT5592 instead of !RT6352 - - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -4398,7 +4398,8 @@ static void rt2800_config_channel(struct - reg = (rf->channel <= 14 ? 0x1c : 0x24) + 2*rt2x00dev->lna_gain; - rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg); - -- rt2800_iq_calibrate(rt2x00dev, rf->channel); -+ if (rt2x00_rt(rt2x00dev, RT5592)) -+ rt2800_iq_calibrate(rt2x00dev, rf->channel); - } - - if (rt2x00_rt(rt2x00dev, RT6352)) { diff --git a/package/kernel/mac80211/patches/rt2x00/010-v6.1-rt2x00-add-TX-LOFT-calibration-for-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/010-v6.1-rt2x00-add-TX-LOFT-calibration-for-MT7620.patch index bb01ff1dca..092d91afb6 100644 --- a/package/kernel/mac80211/patches/rt2x00/010-v6.1-rt2x00-add-TX-LOFT-calibration-for-MT7620.patch +++ b/package/kernel/mac80211/patches/rt2x00/010-v6.1-rt2x00-add-TX-LOFT-calibration-for-MT7620.patch @@ -45,7 +45,7 @@ Reported-by: kernel test robot --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -9041,6 +9041,907 @@ restore_value: +@@ -9066,6 +9066,907 @@ restore_value: rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, savemacsysctrl); } @@ -953,7 +953,7 @@ Reported-by: kernel test robot static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9653,6 +10554,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9678,6 +10579,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rxdcoc_calibration(rt2x00dev); rt2800_bw_filter_calibration(rt2x00dev, true); rt2800_bw_filter_calibration(rt2x00dev, false); diff --git a/package/kernel/mac80211/patches/rt2x00/011-v6.1-rt2x00-move-helper-functions-up-in-file.patch b/package/kernel/mac80211/patches/rt2x00/011-v6.1-rt2x00-move-helper-functions-up-in-file.patch index 07a32b17be..b07d449d6d 100644 --- a/package/kernel/mac80211/patches/rt2x00/011-v6.1-rt2x00-move-helper-functions-up-in-file.patch +++ b/package/kernel/mac80211/patches/rt2x00/011-v6.1-rt2x00-move-helper-functions-up-in-file.patch @@ -65,7 +65,7 @@ Acked-by: Stanislaw Gruszka static u8 rt2800_rfcsr_read(struct rt2x00_dev *rt2x00dev, const unsigned int word) { -@@ -6947,26 +6967,6 @@ static void rt2800_init_bbp_5592(struct +@@ -6972,26 +6992,6 @@ static void rt2800_init_bbp_5592(struct rt2800_bbp_write(rt2x00dev, 103, 0xc0); } diff --git a/package/kernel/mac80211/patches/rt2x00/013-v6.1-rt2x00-set-correct-TX_SW_CFG1-MAC-register-for-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/013-v6.1-rt2x00-set-correct-TX_SW_CFG1-MAC-register-for-MT7620.patch deleted file mode 100644 index 3d7af17b16..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/013-v6.1-rt2x00-set-correct-TX_SW_CFG1-MAC-register-for-MT7620.patch +++ /dev/null @@ -1,52 +0,0 @@ -From patchwork Sat Sep 17 20:29:26 2022 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Daniel Golle -X-Patchwork-Id: 12979254 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: -Date: Sat, 17 Sep 2022 21:29:26 +0100 -From: Daniel Golle -To: linux-wireless@vger.kernel.org, Stanislaw Gruszka , - Helmut Schaa -Cc: Kalle Valo , - "David S. Miller" , - Eric Dumazet , - Jakub Kicinski , - Paolo Abeni , - Johannes Berg -Subject: [PATCH v3 13/16] rt2x00: set correct TX_SW_CFG1 MAC register for - MT7620 -Message-ID: - <4be38975ce600a34249e12d09a3cb758c6e71071.1663445157.git.daniel@makrotopia.org> -References: -MIME-Version: 1.0 -Content-Disposition: inline -In-Reply-To: -Precedence: bulk -List-ID: -X-Mailing-List: linux-wireless@vger.kernel.org - -Set correct TX_SW_CFG1 MAC register as it is done also in v3 of the -vendor driver[1]. - -[1]: https://gitlab.com/dm38/padavan-ng/-/blob/master/trunk/proprietary/rt_wifi/rtpci/3.0.X.X/mt76x2/chips/rt6352.c#L531 -Reported-by: Serge Vasilugin -Signed-off-by: Daniel Golle -Acked-by: Stanislaw Gruszka ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -5966,7 +5966,7 @@ static int rt2800_init_registers(struct - rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404); - } else if (rt2x00_rt(rt2x00dev, RT6352)) { - rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000401); -- rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x000C0000); -+ rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x000C0001); - rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); - rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x00000000); - rt2800_register_write(rt2x00dev, TX0_BB_GAIN_ATTEN, 0x0); diff --git a/package/kernel/mac80211/patches/rt2x00/014-v6.1-rt2x00-set-VGC-gain-for-both-chains-of-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/014-v6.1-rt2x00-set-VGC-gain-for-both-chains-of-MT7620.patch deleted file mode 100644 index 27b8d92cd2..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/014-v6.1-rt2x00-set-VGC-gain-for-both-chains-of-MT7620.patch +++ /dev/null @@ -1,50 +0,0 @@ -From patchwork Sat Sep 17 20:29:40 2022 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Daniel Golle -X-Patchwork-Id: 12979255 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: -Date: Sat, 17 Sep 2022 21:29:40 +0100 -From: Daniel Golle -To: linux-wireless@vger.kernel.org, Stanislaw Gruszka , - Helmut Schaa -Cc: Kalle Valo , - "David S. Miller" , - Eric Dumazet , - Jakub Kicinski , - Paolo Abeni , - Johannes Berg -Subject: [PATCH v3 14/16] rt2x00: set VGC gain for both chains of MT7620 -Message-ID: - <29e161397e5c9d9399da0fe87d44458aa2b90a78.1663445157.git.daniel@makrotopia.org> -References: -MIME-Version: 1.0 -Content-Disposition: inline -In-Reply-To: -Precedence: bulk -List-ID: -X-Mailing-List: linux-wireless@vger.kernel.org - -Set bbp66 for all chains of the MT7620. - -Reported-by: Serge Vasilugin -Signed-off-by: Daniel Golle -Acked-by: Stanislaw Gruszka ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -5743,7 +5743,8 @@ static inline void rt2800_set_vgc(struct - if (qual->vgc_level != vgc_level) { - if (rt2x00_rt(rt2x00dev, RT3572) || - rt2x00_rt(rt2x00dev, RT3593) || -- rt2x00_rt(rt2x00dev, RT3883)) { -+ rt2x00_rt(rt2x00dev, RT3883) || -+ rt2x00_rt(rt2x00dev, RT6352)) { - rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, - vgc_level); - } else if (rt2x00_rt(rt2x00dev, RT5592)) { diff --git a/package/kernel/mac80211/patches/rt2x00/015-v6.1-rt2x00-set-SoC-wmac-clock-register.patch b/package/kernel/mac80211/patches/rt2x00/015-v6.1-rt2x00-set-SoC-wmac-clock-register.patch deleted file mode 100644 index 3cadc91da6..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/015-v6.1-rt2x00-set-SoC-wmac-clock-register.patch +++ /dev/null @@ -1,70 +0,0 @@ -From patchwork Sat Sep 17 20:29:55 2022 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Daniel Golle -X-Patchwork-Id: 12979256 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: -Date: Sat, 17 Sep 2022 21:29:55 +0100 -From: Daniel Golle -To: linux-wireless@vger.kernel.org, Stanislaw Gruszka , - Helmut Schaa -Cc: Kalle Valo , - "David S. Miller" , - Eric Dumazet , - Jakub Kicinski , - Paolo Abeni , - Johannes Berg -Subject: [PATCH v3 15/16] rt2x00: set SoC wmac clock register -Message-ID: - <3e275d259f476f597dab91a9c395015ef3fe3284.1663445157.git.daniel@makrotopia.org> -References: -MIME-Version: 1.0 -Content-Disposition: inline -In-Reply-To: -Precedence: bulk -List-ID: -X-Mailing-List: linux-wireless@vger.kernel.org - -Instead of using the default value 33 (pci), set US_CYC_CNT init based -on Programming guide: -If available, set chipset bus clock with fallback to cpu clock/3. - -Reported-by: Serge Vasilugin -Signed-off-by: Daniel Golle -Acked-by: Stanislaw Gruszka ---- - .../net/wireless/ralink/rt2x00/rt2800lib.c | 21 +++++++++++++++++++ - 1 file changed, 21 insertions(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -6229,6 +6229,27 @@ static int rt2800_init_registers(struct - reg = rt2800_register_read(rt2x00dev, US_CYC_CNT); - rt2x00_set_field32(®, US_CYC_CNT_CLOCK_CYCLE, 125); - rt2800_register_write(rt2x00dev, US_CYC_CNT, reg); -+ } else if (rt2x00_is_soc(rt2x00dev)) { -+ struct clk *clk = clk_get_sys("bus", NULL); -+ int rate; -+ -+ if (IS_ERR(clk)) { -+ clk = clk_get_sys("cpu", NULL); -+ -+ if (IS_ERR(clk)) { -+ rate = 125; -+ } else { -+ rate = clk_get_rate(clk) / 3000000; -+ clk_put(clk); -+ } -+ } else { -+ rate = clk_get_rate(clk) / 1000000; -+ clk_put(clk); -+ } -+ -+ reg = rt2800_register_read(rt2x00dev, US_CYC_CNT); -+ rt2x00_set_field32(®, US_CYC_CNT_CLOCK_CYCLE, rate); -+ rt2800_register_write(rt2x00dev, US_CYC_CNT, reg); - } - - reg = rt2800_register_read(rt2x00dev, HT_FBK_CFG0); diff --git a/package/kernel/mac80211/patches/rt2x00/016-v6.1-rt2x00-correctly-set-BBP-register-86-for-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/016-v6.1-rt2x00-correctly-set-BBP-register-86-for-MT7620.patch deleted file mode 100644 index 5ddbbf1dd6..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/016-v6.1-rt2x00-correctly-set-BBP-register-86-for-MT7620.patch +++ /dev/null @@ -1,79 +0,0 @@ -From patchwork Sat Sep 17 20:30:09 2022 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Daniel Golle -X-Patchwork-Id: 12979257 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: -X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on - aws-us-west-2-korg-lkml-1.web.codeaurora.org -Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) - by smtp.lore.kernel.org (Postfix) with ESMTP id E9118ECAAA1 - for ; - Sat, 17 Sep 2022 20:30:22 +0000 (UTC) -Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand - id S229639AbiIQUaV (ORCPT - ); - Sat, 17 Sep 2022 16:30:21 -0400 -Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53912 "EHLO - lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org - with ESMTP id S229628AbiIQUaT (ORCPT - ); - Sat, 17 Sep 2022 16:30:19 -0400 -Received: from fudo.makrotopia.org (fudo.makrotopia.org - [IPv6:2a07:2ec0:3002::71]) - by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AEA822B27 - for ; - Sat, 17 Sep 2022 13:30:16 -0700 (PDT) -Received: from local - by fudo.makrotopia.org with esmtpsa - (TLS1.3:TLS_AES_256_GCM_SHA384:256) - (Exim 4.96) - (envelope-from ) - id 1oZeS7-0003ra-0k; - Sat, 17 Sep 2022 22:30:15 +0200 -Date: Sat, 17 Sep 2022 21:30:09 +0100 -From: Daniel Golle -To: linux-wireless@vger.kernel.org, Stanislaw Gruszka , - Helmut Schaa -Cc: Kalle Valo , - "David S. Miller" , - Eric Dumazet , - Jakub Kicinski , - Paolo Abeni , - Johannes Berg -Subject: [PATCH v3 16/16] rt2x00: correctly set BBP register 86 for MT7620 -Message-ID: - <257267247ee4fa7ebc6a5d0c4948b3f8119c0d77.1663445157.git.daniel@makrotopia.org> -References: -MIME-Version: 1.0 -Content-Disposition: inline -In-Reply-To: -Precedence: bulk -List-ID: -X-Mailing-List: linux-wireless@vger.kernel.org - -Instead of 0 set the correct value for BBP register 86 for MT7620. - -Reported-by: Serge Vasilugin -Signed-off-by: Daniel Golle -Acked-by: Stanislaw Gruszka ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -4225,7 +4225,10 @@ static void rt2800_config_channel(struct - rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); - rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); - rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain); -- rt2800_bbp_write(rt2x00dev, 86, 0); -+ if (rt2x00_rt(rt2x00dev, RT6352)) -+ rt2800_bbp_write(rt2x00dev, 86, 0x38); -+ else -+ rt2800_bbp_write(rt2x00dev, 86, 0); - } - - if (rf->channel <= 14) { diff --git a/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch index 2dc6ab3601..5a7da84506 100644 --- a/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch +++ b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch @@ -52,7 +52,7 @@ fail_ifa: #endif wiphy_unregister(local->hw.wiphy); -@@ -1371,10 +1371,10 @@ void ieee80211_unregister_hw(struct ieee +@@ -1373,10 +1373,10 @@ void ieee80211_unregister_hw(struct ieee tasklet_kill(&local->tx_pending_tasklet); tasklet_kill(&local->tasklet); diff --git a/package/kernel/mac80211/patches/subsys/307-mac80211_hwsim-make-6-GHz-channels-usable.patch b/package/kernel/mac80211/patches/subsys/307-mac80211_hwsim-make-6-GHz-channels-usable.patch index 80c86e3d92..9c3b38adbf 100644 --- a/package/kernel/mac80211/patches/subsys/307-mac80211_hwsim-make-6-GHz-channels-usable.patch +++ b/package/kernel/mac80211/patches/subsys/307-mac80211_hwsim-make-6-GHz-channels-usable.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c -@@ -3003,15 +3003,19 @@ static void mac80211_hwsim_he_capab(stru +@@ -3008,15 +3008,19 @@ static void mac80211_hwsim_he_capab(stru { u16 n_iftype_data; @@ -34,7 +34,7 @@ Signed-off-by: Felix Fietkau return; } -@@ -3301,6 +3305,12 @@ static int mac80211_hwsim_new_radio(stru +@@ -3306,6 +3310,12 @@ static int mac80211_hwsim_new_radio(stru sband->vht_cap.vht_mcs.tx_mcs_map = sband->vht_cap.vht_mcs.rx_mcs_map; break; @@ -47,7 +47,7 @@ Signed-off-by: Felix Fietkau case NL80211_BAND_S1GHZ: memcpy(&sband->s1g_cap, &hwsim_s1g_cap, sizeof(sband->s1g_cap)); -@@ -3311,6 +3321,13 @@ static int mac80211_hwsim_new_radio(stru +@@ -3316,6 +3326,13 @@ static int mac80211_hwsim_new_radio(stru continue; } @@ -61,7 +61,7 @@ Signed-off-by: Felix Fietkau sband->ht_cap.ht_supported = true; sband->ht_cap.cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 | IEEE80211_HT_CAP_GRN_FLD | -@@ -3324,10 +3341,6 @@ static int mac80211_hwsim_new_radio(stru +@@ -3329,10 +3346,6 @@ static int mac80211_hwsim_new_radio(stru sband->ht_cap.mcs.rx_mask[0] = 0xff; sband->ht_cap.mcs.rx_mask[1] = 0xff; sband->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; diff --git a/package/kernel/mac80211/patches/subsys/319-mac80211-introduce-set_radar_offchan-callback.patch b/package/kernel/mac80211/patches/subsys/319-mac80211-introduce-set_radar_offchan-callback.patch index eb80afbccb..6197abda56 100644 --- a/package/kernel/mac80211/patches/subsys/319-mac80211-introduce-set_radar_offchan-callback.patch +++ b/package/kernel/mac80211/patches/subsys/319-mac80211-introduce-set_radar_offchan-callback.patch @@ -40,7 +40,7 @@ Signed-off-by: Johannes Berg struct ieee80211_vif *vif, --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -4344,6 +4344,18 @@ out: +@@ -4341,6 +4341,18 @@ out: return err; } @@ -59,7 +59,7 @@ Signed-off-by: Johannes Berg const struct cfg80211_ops mac80211_config_ops = { .add_virtual_intf = ieee80211_add_iface, .del_virtual_intf = ieee80211_del_iface, -@@ -4448,4 +4460,5 @@ const struct cfg80211_ops mac80211_confi +@@ -4445,4 +4457,5 @@ const struct cfg80211_ops mac80211_confi .reset_tid_config = ieee80211_reset_tid_config, .set_sar_specs = ieee80211_set_sar_specs, .color_change = ieee80211_color_change, diff --git a/package/kernel/mac80211/patches/subsys/320-cfg80211-rename-offchannel_chain-structs-to-backgrou.patch b/package/kernel/mac80211/patches/subsys/320-cfg80211-rename-offchannel_chain-structs-to-backgrou.patch index 483b87cd88..608e72468d 100644 --- a/package/kernel/mac80211/patches/subsys/320-cfg80211-rename-offchannel_chain-structs-to-backgrou.patch +++ b/package/kernel/mac80211/patches/subsys/320-cfg80211-rename-offchannel_chain-structs-to-backgrou.patch @@ -156,7 +156,7 @@ Signed-off-by: Johannes Berg NUM_NL80211_EXT_FEATURES, --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -4345,15 +4345,15 @@ out: +@@ -4342,15 +4342,15 @@ out: } static int @@ -176,7 +176,7 @@ Signed-off-by: Johannes Berg } const struct cfg80211_ops mac80211_config_ops = { -@@ -4460,5 +4460,5 @@ const struct cfg80211_ops mac80211_confi +@@ -4457,5 +4457,5 @@ const struct cfg80211_ops mac80211_confi .reset_tid_config = ieee80211_reset_tid_config, .set_sar_specs = ieee80211_set_sar_specs, .color_change = ieee80211_color_change, diff --git a/package/kernel/mac80211/patches/subsys/324-mac80211-MBSSID-beacon-handling-in-AP-mode.patch b/package/kernel/mac80211/patches/subsys/324-mac80211-MBSSID-beacon-handling-in-AP-mode.patch index e2b05719db..a8fc02f92d 100644 --- a/package/kernel/mac80211/patches/subsys/324-mac80211-MBSSID-beacon-handling-in-AP-mode.patch +++ b/package/kernel/mac80211/patches/subsys/324-mac80211-MBSSID-beacon-handling-in-AP-mode.patch @@ -195,7 +195,7 @@ Signed-off-by: Johannes Berg return err; } *changed |= err; -@@ -3463,8 +3528,11 @@ static int ieee80211_set_csa_beacon(stru +@@ -3460,8 +3525,11 @@ static int ieee80211_set_csa_beacon(stru static void ieee80211_color_change_abort(struct ieee80211_sub_if_data *sdata) { sdata->vif.color_change_active = false; @@ -209,7 +209,7 @@ Signed-off-by: Johannes Berg cfg80211_color_change_aborted_notify(sdata->dev); } -@@ -4202,8 +4270,11 @@ ieee80211_set_after_color_change_beacon( +@@ -4199,8 +4267,11 @@ ieee80211_set_after_color_change_beacon( ret = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon, NULL, NULL); @@ -223,7 +223,7 @@ Signed-off-by: Johannes Berg if (ret < 0) return ret; -@@ -4246,7 +4317,11 @@ ieee80211_set_color_change_beacon(struct +@@ -4243,7 +4314,11 @@ ieee80211_set_color_change_beacon(struct err = ieee80211_assign_beacon(sdata, ¶ms->beacon_color_change, NULL, &color_change); if (err < 0) { diff --git a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch index 0e83e9bd8e..962ae93cc7 100644 --- a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch +++ b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch @@ -77,7 +77,7 @@ static void ieee80211_rfkill_poll(struct wiphy *wiphy) { struct ieee80211_local *local = wiphy_priv(wiphy); -@@ -4516,6 +4529,7 @@ const struct cfg80211_ops mac80211_confi +@@ -4513,6 +4526,7 @@ const struct cfg80211_ops mac80211_confi .set_wiphy_params = ieee80211_set_wiphy_params, .set_tx_power = ieee80211_set_tx_power, .get_tx_power = ieee80211_get_tx_power, From 206b60a00301350981c0cc2bd2566e03b868e92e Mon Sep 17 00:00:00 2001 From: Vincent Pelletier Date: Sat, 19 Feb 2022 02:06:23 +0000 Subject: [PATCH 107/137] kernel: scale nf_conntrack_max more reasonably Use the kernel's built-in formula for computing this value. The value applied by OpenWRT's sysctl configuration file does not scale with the available memory, under-using hardware capabilities. Also, that formula also influences net.netfilter.nf_conntrack_buckets, which should improve conntrack performance in average (fewer connections per hashtable bucket). Backport upstream commit for its effect on the number of connections per hashtable bucket. Apply a hack patch to set the RAM size divisor to a more reasonable value (2048, down from 16384) for our use case, a typical router handling several thousands of connections. Signed-off-by: Vincent Pelletier Signed-off-by: Rui Salvaterra (cherry picked from commit 15fbb916669dcdfcc706e9e75263ab63f9f27c00) --- .../linux/files/sysctl-nf-conntrack.conf | 1 - ...ack-sanitize-table-size-default-sett.patch | 100 ++++++++++++++++++ ...t-size-the-hashtable-more-adequately.patch | 25 +++++ 3 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 target/linux/generic/backport-5.4/612-v5.15-netfilter-conntrack-sanitize-table-size-default-sett.patch create mode 100644 target/linux/generic/hack-5.4/661-kernel-ct-size-the-hashtable-more-adequately.patch diff --git a/package/kernel/linux/files/sysctl-nf-conntrack.conf b/package/kernel/linux/files/sysctl-nf-conntrack.conf index 45fa5381bf..13738655a1 100644 --- a/package/kernel/linux/files/sysctl-nf-conntrack.conf +++ b/package/kernel/linux/files/sysctl-nf-conntrack.conf @@ -3,7 +3,6 @@ net.netfilter.nf_conntrack_acct=1 net.netfilter.nf_conntrack_checksum=0 -net.netfilter.nf_conntrack_max=65536 net.netfilter.nf_conntrack_tcp_timeout_established=7440 net.netfilter.nf_conntrack_udp_timeout=60 net.netfilter.nf_conntrack_udp_timeout_stream=180 diff --git a/target/linux/generic/backport-5.4/612-v5.15-netfilter-conntrack-sanitize-table-size-default-sett.patch b/target/linux/generic/backport-5.4/612-v5.15-netfilter-conntrack-sanitize-table-size-default-sett.patch new file mode 100644 index 0000000000..1e7773c193 --- /dev/null +++ b/target/linux/generic/backport-5.4/612-v5.15-netfilter-conntrack-sanitize-table-size-default-sett.patch @@ -0,0 +1,100 @@ +From d532bcd0b2699d84d71a0c71d37157ac6eb3be25 Mon Sep 17 00:00:00 2001 +Message-Id: +From: Florian Westphal +Date: Thu, 26 Aug 2021 15:54:19 +0200 +Subject: [PATCH] netfilter: conntrack: sanitize table size default settings + +conntrack has two distinct table size settings: +nf_conntrack_max and nf_conntrack_buckets. + +The former limits how many conntrack objects are allowed to exist +in each namespace. + +The second sets the size of the hashtable. + +As all entries are inserted twice (once for original direction, once for +reply), there should be at least twice as many buckets in the table than +the maximum number of conntrack objects that can exist at the same time. + +Change the default multiplier to 1 and increase the chosen bucket sizes. +This results in the same nf_conntrack_max settings as before but reduces +the average bucket list length. + +Signed-off-by: Florian Westphal +Signed-off-by: Pablo Neira Ayuso +--- + .../networking/nf_conntrack-sysctl.rst | 13 ++++---- + net/netfilter/nf_conntrack_core.c | 30 +++++++++---------- + 2 files changed, 22 insertions(+), 21 deletions(-) + +--- a/Documentation/networking/nf_conntrack-sysctl.txt ++++ b/Documentation/networking/nf_conntrack-sysctl.txt +@@ -10,9 +10,8 @@ nf_conntrack_acct - BOOLEAN + nf_conntrack_buckets - INTEGER + Size of hash table. If not specified as parameter during module + loading, the default size is calculated by dividing total memory +- by 16384 to determine the number of buckets but the hash table will +- never have fewer than 32 and limited to 16384 buckets. For systems +- with more than 4GB of memory it will be 65536 buckets. ++ by 16384 to determine the number of buckets. The hash table will ++ never have fewer than 1024 and never more than 262144 buckets. + This sysctl is only writeable in the initial net namespace. + + nf_conntrack_checksum - BOOLEAN +@@ -93,8 +92,12 @@ nf_conntrack_log_invalid - INTEGER + Log invalid packets of a type specified by value. + + nf_conntrack_max - INTEGER +- Size of connection tracking table. Default value is +- nf_conntrack_buckets value * 4. ++ Maximum number of allowed connection tracking entries. This value is set ++ to nf_conntrack_buckets by default. ++ Note that connection tracking entries are added to the table twice -- once ++ for the original direction and once for the reply direction (i.e., with ++ the reversed address). This means that with default settings a maxed-out ++ table will have a average hash chain length of 2, not 1. + + nf_conntrack_tcp_be_liberal - BOOLEAN + 0 - disabled (default) +--- a/net/netfilter/nf_conntrack_core.c ++++ b/net/netfilter/nf_conntrack_core.c +@@ -2418,26 +2418,24 @@ int nf_conntrack_init_start(void) + spin_lock_init(&nf_conntrack_locks[i]); + + if (!nf_conntrack_htable_size) { +- /* Idea from tcp.c: use 1/16384 of memory. +- * On i386: 32MB machine has 512 buckets. +- * >= 1GB machines have 16384 buckets. +- * >= 4GB machines have 65536 buckets. +- */ + nf_conntrack_htable_size + = (((nr_pages << PAGE_SHIFT) / 16384) + / sizeof(struct hlist_head)); +- if (nr_pages > (4 * (1024 * 1024 * 1024 / PAGE_SIZE))) +- nf_conntrack_htable_size = 65536; ++ if (BITS_PER_LONG >= 64 && ++ nr_pages > (4 * (1024 * 1024 * 1024 / PAGE_SIZE))) ++ nf_conntrack_htable_size = 262144; + else if (nr_pages > (1024 * 1024 * 1024 / PAGE_SIZE)) +- nf_conntrack_htable_size = 16384; +- if (nf_conntrack_htable_size < 32) +- nf_conntrack_htable_size = 32; ++ nf_conntrack_htable_size = 65536; + +- /* Use a max. factor of four by default to get the same max as +- * with the old struct list_heads. When a table size is given +- * we use the old value of 8 to avoid reducing the max. +- * entries. */ +- max_factor = 4; ++ if (nf_conntrack_htable_size < 1024) ++ nf_conntrack_htable_size = 1024; ++ /* Use a max. factor of one by default to keep the average ++ * hash chain length at 2 entries. Each entry has to be added ++ * twice (once for original direction, once for reply). ++ * When a table size is given we use the old value of 8 to ++ * avoid implicit reduction of the max entries setting. ++ */ ++ max_factor = 1; + } + + nf_conntrack_hash = nf_ct_alloc_hashtable(&nf_conntrack_htable_size, 1); diff --git a/target/linux/generic/hack-5.4/661-kernel-ct-size-the-hashtable-more-adequately.patch b/target/linux/generic/hack-5.4/661-kernel-ct-size-the-hashtable-more-adequately.patch new file mode 100644 index 0000000000..b1bb1bc2e5 --- /dev/null +++ b/target/linux/generic/hack-5.4/661-kernel-ct-size-the-hashtable-more-adequately.patch @@ -0,0 +1,25 @@ +From 804fbb3f2ec9283f7b778e057a68bfff440a0be6 Mon Sep 17 00:00:00 2001 +From: Rui Salvaterra +Date: Wed, 30 Mar 2022 22:51:55 +0100 +Subject: [PATCH] kernel: ct: size the hashtable more adequately + +To set the default size of the connection tracking hash table, a divider of +16384 becomes inadequate for a router handling lots of connections. Divide by +2048 instead, making the default size scale better with the available RAM. + +Signed-off-by: Rui Salvaterra +--- + net/netfilter/nf_conntrack_core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/net/netfilter/nf_conntrack_core.c ++++ b/net/netfilter/nf_conntrack_core.c +@@ -2419,7 +2419,7 @@ int nf_conntrack_init_start(void) + + if (!nf_conntrack_htable_size) { + nf_conntrack_htable_size +- = (((nr_pages << PAGE_SHIFT) / 16384) ++ = (((nr_pages << PAGE_SHIFT) / 2048) + / sizeof(struct hlist_head)); + if (BITS_PER_LONG >= 64 && + nr_pages > (4 * (1024 * 1024 * 1024 / PAGE_SIZE))) From 024a34436d87491140fce86d8fcd3ff256d7cc66 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Tue, 6 Dec 2022 05:26:54 +0800 Subject: [PATCH 108/137] kernel: refresh hack patches Signed-off-by: Tianling Shen --- ...2-net-conntrack-events-support-multiple-registrant.patch | 2 +- .../generic/hack-5.4/993-usb-serial-option-add-u9300.patch | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/target/linux/generic/hack-5.4/952-net-conntrack-events-support-multiple-registrant.patch b/target/linux/generic/hack-5.4/952-net-conntrack-events-support-multiple-registrant.patch index e01728fc68..d09b367194 100644 --- a/target/linux/generic/hack-5.4/952-net-conntrack-events-support-multiple-registrant.patch +++ b/target/linux/generic/hack-5.4/952-net-conntrack-events-support-multiple-registrant.patch @@ -115,7 +115,7 @@ Signed-off-by: Zhi Chen depends on NETFILTER_ADVANCED --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c -@@ -2572,6 +2572,9 @@ int nf_conntrack_init_net(struct net *ne +@@ -2570,6 +2570,9 @@ int nf_conntrack_init_net(struct net *ne nf_conntrack_helper_pernet_init(net); nf_conntrack_proto_pernet_init(net); diff --git a/target/linux/generic/hack-5.4/993-usb-serial-option-add-u9300.patch b/target/linux/generic/hack-5.4/993-usb-serial-option-add-u9300.patch index ce59eb16f8..047949eb3d 100644 --- a/target/linux/generic/hack-5.4/993-usb-serial-option-add-u9300.patch +++ b/target/linux/generic/hack-5.4/993-usb-serial-option-add-u9300.patch @@ -10,7 +10,7 @@ {QMI_QUIRK_SET_DTR(0x2c7c, 0x0195, 4)}, /* Quectel EG95 */ --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c -@@ -392,6 +392,7 @@ static void option_instat_callback(struc +@@ -393,6 +393,7 @@ static void option_instat_callback(struc * Mobidata, etc sell under their own brand names. */ #define LONGCHEER_VENDOR_ID 0x1c9e @@ -18,7 +18,7 @@ /* 4G Systems products */ /* This is the 4G XS Stick W14 a.k.a. Mobilcom Debitel Surf-Stick * -@@ -599,6 +600,16 @@ static void option_instat_callback(struc +@@ -603,6 +604,16 @@ static void option_instat_callback(struc /* Device needs ZLP */ #define ZLP BIT(17) @@ -35,7 +35,7 @@ static const struct usb_device_id option_ids[] = { { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, -@@ -633,6 +644,8 @@ static const struct usb_device_id option +@@ -637,6 +648,8 @@ static const struct usb_device_id option { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLE) }, { USB_DEVICE(QUANTA_VENDOR_ID, 0xea42), .driver_info = RSVD(4) }, From d84d34e6e077f27bb20aafd5b9f639b297a077ab Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 20 Nov 2020 03:03:54 +0100 Subject: [PATCH 109/137] sdk: expose binary strip settings Expose the SDK options for binary stripping to the menuconfig. This way, packages can easily be built with debug symbols using the SDK. Signed-off-by: David Bauer (cherry picked from commit bb817bb4b8b0b546a70e45bd907ebfeea2370dcd) --- target/sdk/files/Config.in | 46 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/target/sdk/files/Config.in b/target/sdk/files/Config.in index 4393daab5b..f687992497 100644 --- a/target/sdk/files/Config.in +++ b/target/sdk/files/Config.in @@ -18,6 +18,52 @@ menu "Global build settings" bool "Cryptographically sign package lists" default y + comment "Package build options" + + config DEBUG + bool + prompt "Compile packages with debugging info" + default n + help + Adds -g3 to the CFLAGS. + + comment "Stripping options" + + choice + prompt "Binary stripping method" + default USE_STRIP if EXTERNAL_TOOLCHAIN + default USE_STRIP if USE_GLIBC + default USE_SSTRIP + help + Select the binary stripping method you wish to use. + + config NO_STRIP + bool "none" + help + This will install unstripped binaries (useful for native + compiling/debugging). + + config USE_STRIP + bool "strip" + help + This will install binaries stripped using strip from binutils. + + config USE_SSTRIP + bool "sstrip" + depends on !USE_GLIBC + help + This will install binaries stripped using sstrip. + endchoice + + config STRIP_ARGS + string + prompt "Strip arguments" + depends on USE_STRIP + default "--strip-unneeded --remove-section=.comment --remove-section=.note" if DEBUG + default "--strip-all" + help + Specifies arguments passed to the strip command when stripping binaries. + endmenu menu "Advanced configuration options (for developers)" From 904581c59e0c326a865b0ebf802db8ae5fec95f0 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 12 Sep 2022 00:29:00 +0200 Subject: [PATCH 110/137] toolchain: Select USE_SSTRIP with external musl toolchain When we use the internal toolchain USE_SSTRIP will be selected by default for musl libc and USE_STRIP when glibc is used. Do the same when an external toolchain is used. USE_GLIBC will also be set for external toolchain builds based on the EXTERNAL_TOOLCHAIN_LIBC_USE_GLIBC setting. Signed-off-by: Hauke Mehrtens (cherry picked from commit 9403810c020cca136149973a3929bf77a1f501aa) --- config/Config-build.in | 1 - target/sdk/files/Config.in | 1 - 2 files changed, 2 deletions(-) diff --git a/config/Config-build.in b/config/Config-build.in index 196d4e67a0..a43f218c89 100644 --- a/config/Config-build.in +++ b/config/Config-build.in @@ -164,7 +164,6 @@ menu "Global build settings" choice prompt "Binary stripping method" - default USE_STRIP if EXTERNAL_TOOLCHAIN default USE_STRIP if USE_GLIBC default USE_SSTRIP help diff --git a/target/sdk/files/Config.in b/target/sdk/files/Config.in index f687992497..b1e18949f6 100644 --- a/target/sdk/files/Config.in +++ b/target/sdk/files/Config.in @@ -31,7 +31,6 @@ menu "Global build settings" choice prompt "Binary stripping method" - default USE_STRIP if EXTERNAL_TOOLCHAIN default USE_STRIP if USE_GLIBC default USE_SSTRIP help From d03c520e75ec0a744483a3f57eea35d01fcd298f Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 5 Dec 2022 23:23:04 +0100 Subject: [PATCH 111/137] CI: build: fix use of sdk as toolchain The toolchain included in a sdk have a different format than an external toolchain tar. Since sdk is a more integrated setup doesn't use and include wrapper bin that use the external toolchain config and use an alternative and more standard way to include all the toolchain headers. External toolchain use wrapper.sh to append the configured include header when each tool is called. Fix the sdk toolchain by reverting their own sdk wrapper scripts and to simulate an external toolchain build copying what is done in the toolchain target makefile. This handle compilation error and warning caused by not using fortify header on building packages. Fixes: 006e52545d14 ("CI: build: add support to fallback to sdk for external toolchain") Signed-off-by: Christian Marangi (cherry picked from commit 42f0ab028e2eae0d4e7acf9db7fd68b256f23503) --- .github/workflows/build.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 115bf2c654..43f30617d8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -266,6 +266,34 @@ jobs: --overwrite-config \ --config ${{ env.TARGET }}/${{ env.SUBTARGET }} + - name: Adapt external sdk to external toolchain format + if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk' + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + TOOLCHAIN_DIR=${{ env.TOOLCHAIN_FILE }}/staging_dir/$(ls ${{ env.TOOLCHAIN_FILE }}/staging_dir | grep toolchain) + TOOLCHAIN_BIN=$TOOLCHAIN_DIR/bin + OPENWRT_DIR=$(pwd) + + # Find target name from toolchain info.mk + GNU_TARGET_NAME=$(cat $TOOLCHAIN_DIR/info.mk | grep TARGET_CROSS | sed 's/^TARGET_CROSS=\(.*\)-$/\1/') + + cd $TOOLCHAIN_BIN + + # Revert sdk wrapper scripts applied to all the bins + for app in $(find . -name "*.bin"); do + TARGET_APP=$(echo $app | sed 's/\.\/\.\(.*\)\.bin/\1/') + rm $TARGET_APP + mv .$TARGET_APP.bin $TARGET_APP + done + + # Setup the wrapper script in the sdk toolchain dir simulating an external toolchain build + cp $OPENWRT_DIR/target/toolchain/files/wrapper.sh $GNU_TARGET_NAME-wrapper.sh + for app in cc gcc g++ c++ cpp ld as ; do + [ -f $GNU_TARGET_NAME-$app ] && mv $GNU_TARGET_NAME-$app $GNU_TARGET_NAME-$app.bin + ln -sf $GNU_TARGET_NAME-wrapper.sh $GNU_TARGET_NAME-$app + done + - name: Configure external toolchain with sdk if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk' shell: su buildbot -c "sh -e {0}" From 202d404f743a49a50e253c54f43ebd47fd028496 Mon Sep 17 00:00:00 2001 From: Adam Konrad Date: Sat, 26 Nov 2022 22:23:20 -0600 Subject: [PATCH 112/137] cmake: update to version 3.19.8 Updating CMake to latest patched version 3.19.8 which is fixing issue with ccache. Related issue: https://github.com/openwrt/openwrt/issues/8555 Compile-tested: arm64 Signed-off-by: Adam Konrad --- tools/cmake/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/cmake/Makefile b/tools/cmake/Makefile index 006934466a..54ac6891a7 100644 --- a/tools/cmake/Makefile +++ b/tools/cmake/Makefile @@ -7,14 +7,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=cmake -PKG_VERSION:=3.19.1 +PKG_VERSION:=3.19.8 PKG_RELEASE:=1 PKG_CPE_ID:=cpe:/a:kitware:cmake PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/Kitware/CMake/releases/download/v$(PKG_VERSION)/ \ https://cmake.org/files/v3.19/ -PKG_HASH:=1d266ea3a76ef650cdcf16c782a317cb4a7aa461617ee941e389cb48738a3aba +PKG_HASH:=09b4fa4837aae55c75fb170f6a6e2b44818deba48335d1969deddfbb34e30369 HOST_BUILD_PARALLEL:=1 HOST_CONFIGURE_PARALLEL:=1 From 067d7e9f90abcbabc5be5a38c4dedbcdab6c96ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 7 Dec 2022 09:26:11 +0100 Subject: [PATCH 113/137] kernel: backport b53/bcm_sf2 changes from v5.5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki --- ...b53-Use-dev_-err-info-instead-of-pr_.patch | 4 +- ...-support-BCM4908-s-integrated-switch.patch | 8 +- ...store-PHY-interface-mode-in-port-str.patch | 6 +- ..._sf2-setup-BCM4908-internal-crossbar.patch | 18 +-- ...-bcm_sf2-Fill-in-BCM4908-CFP-entries.patch | 2 +- ...-add-function-finding-RGMII-register.patch | 10 +- ...-dsa-bcm_sf2-fix-BCM4908-RGMII-reg-s.patch | 2 +- ...dsa-bcm_sf2-refactor-LED-regs-access.patch | 4 +- ...m_sf2-enable-GPHY-for-switch-probing.patch | 2 +- ...sf2-keep-GPHY-enabled-on-the-BCM4908.patch | 2 +- ...53-Fix-valid-setting-for-MDB-entries.patch | 31 +++++ ...0001-net-dsa-b53-Add-support-for-MDB.patch | 130 ++++++++++++++++++ ...t-dsa-bcm_sf2-Wire-up-MDB-operations.patch | 27 ++++ ...Add-support-for-optional-reset-contr.patch | 81 +++++++++++ ...53-Fix-valid-setting-for-MDB-entries.patch | 30 ++++ ...e-resolved-link-config-via-mac_link_.patch | 2 +- 16 files changed, 329 insertions(+), 30 deletions(-) create mode 100644 target/linux/generic/backport-5.4/702-Revert-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch create mode 100644 target/linux/generic/backport-5.4/703-v5.5-0001-net-dsa-b53-Add-support-for-MDB.patch create mode 100644 target/linux/generic/backport-5.4/703-v5.5-0002-net-dsa-bcm_sf2-Wire-up-MDB-operations.patch create mode 100644 target/linux/generic/backport-5.4/703-v5.5-0003-net-dsa-bcm_sf2-Add-support-for-optional-reset-contr.patch create mode 100644 target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch diff --git a/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch b/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch index be09ab9e7d..0b2ebbe1f8 100644 --- a/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch +++ b/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch @@ -26,7 +26,7 @@ Signed-off-by: David S. Miller #include #include #include -@@ -2475,8 +2473,9 @@ int b53_switch_detect(struct b53_device +@@ -2533,8 +2531,9 @@ int b53_switch_detect(struct b53_device dev->chip_id = id32; break; default: @@ -38,7 +38,7 @@ Signed-off-by: David S. Miller return -ENODEV; } } -@@ -2506,7 +2505,8 @@ int b53_switch_register(struct b53_devic +@@ -2564,7 +2563,8 @@ int b53_switch_register(struct b53_devic if (ret) return ret; diff --git a/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch b/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch index 766db3e641..bd8bb1e51e 100644 --- a/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch +++ b/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch @@ -23,7 +23,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c -@@ -2271,6 +2271,22 @@ static const struct b53_chip_data b53_sw +@@ -2329,6 +2329,22 @@ static const struct b53_chip_data b53_sw .jumbo_pm_reg = B53_JUMBO_PORT_MASK, .jumbo_size_reg = B53_JUMBO_MAX_SIZE, }, @@ -68,7 +68,7 @@ Signed-off-by: Jakub Kicinski offset = CORE_STS_OVERRIDE_IMP; else offset = CORE_STS_OVERRIDE_IMP2; -@@ -543,7 +544,8 @@ static void bcm_sf2_sw_mac_config(struct +@@ -555,7 +556,8 @@ static void bcm_sf2_sw_mac_config(struct if (port == core_readl(priv, CORE_IMP0_PRT_ID)) return; @@ -78,7 +78,7 @@ Signed-off-by: Jakub Kicinski offset = CORE_STS_OVERRIDE_GMIIP_PORT(port); else offset = CORE_STS_OVERRIDE_GMIIP2_PORT(port); -@@ -990,6 +992,30 @@ struct bcm_sf2_of_data { +@@ -1005,6 +1007,30 @@ struct bcm_sf2_of_data { unsigned int num_cfp_rules; }; @@ -109,7 +109,7 @@ Signed-off-by: Jakub Kicinski /* Register offsets for the SWITCH_REG_* block */ static const u16 bcm_sf2_7445_reg_offsets[] = { [REG_SWITCH_CNTRL] = 0x00, -@@ -1038,6 +1064,9 @@ static const struct bcm_sf2_of_data bcm_ +@@ -1053,6 +1079,9 @@ static const struct bcm_sf2_of_data bcm_ }; static const struct of_device_id bcm_sf2_of_match[] = { diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0001-net-dsa-bcm_sf2-store-PHY-interface-mode-in-port-str.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0001-net-dsa-bcm_sf2-store-PHY-interface-mode-in-port-str.patch index 69bf2d0d2f..9590327649 100644 --- a/target/linux/bcm4908/patches-5.4/075-v5.13-0001-net-dsa-bcm_sf2-store-PHY-interface-mode-in-port-str.patch +++ b/target/linux/bcm4908/patches-5.4/075-v5.13-0001-net-dsa-bcm_sf2-store-PHY-interface-mode-in-port-str.patch @@ -18,7 +18,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -380,8 +380,9 @@ static void bcm_sf2_intr_disable(struct +@@ -392,8 +392,9 @@ static void bcm_sf2_intr_disable(struct static void bcm_sf2_identify_ports(struct bcm_sf2_priv *priv, struct device_node *dn) { @@ -29,7 +29,7 @@ Signed-off-by: David S. Miller unsigned int port_num; priv->moca_port = -1; -@@ -390,19 +391,26 @@ static void bcm_sf2_identify_ports(struc +@@ -402,19 +403,26 @@ static void bcm_sf2_identify_ports(struc if (of_property_read_u32(port, "reg", &port_num)) continue; @@ -62,7 +62,7 @@ Signed-off-by: David S. Miller if (of_property_read_bool(port, "brcm,use-bcm-hdr")) --- a/drivers/net/dsa/bcm_sf2.h +++ b/drivers/net/dsa/bcm_sf2.h -@@ -43,6 +43,7 @@ struct bcm_sf2_hw_params { +@@ -44,6 +44,7 @@ struct bcm_sf2_hw_params { #define BCM_SF2_REGS_NUM 6 struct bcm_sf2_port_status { diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0002-net-dsa-bcm_sf2-setup-BCM4908-internal-crossbar.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0002-net-dsa-bcm_sf2-setup-BCM4908-internal-crossbar.patch index 09fb5dbd15..21717ffc3c 100644 --- a/target/linux/bcm4908/patches-5.4/075-v5.13-0002-net-dsa-bcm_sf2-setup-BCM4908-internal-crossbar.patch +++ b/target/linux/bcm4908/patches-5.4/075-v5.13-0002-net-dsa-bcm_sf2-setup-BCM4908-internal-crossbar.patch @@ -37,7 +37,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -369,6 +369,44 @@ static int bcm_sf2_sw_rst(struct bcm_sf2 +@@ -381,6 +381,44 @@ static int bcm_sf2_sw_rst(struct bcm_sf2 return 0; } @@ -82,7 +82,7 @@ Signed-off-by: David S. Miller static void bcm_sf2_intr_disable(struct bcm_sf2_priv *priv) { intrl2_0_mask_set(priv, 0xffffffff); -@@ -739,6 +777,8 @@ static int bcm_sf2_sw_resume(struct dsa_ +@@ -751,6 +789,8 @@ static int bcm_sf2_sw_resume(struct dsa_ return ret; } @@ -91,7 +91,7 @@ Signed-off-by: David S. Miller ret = bcm_sf2_cfp_resume(ds); if (ret) return ret; -@@ -1001,6 +1041,7 @@ struct bcm_sf2_of_data { +@@ -1016,6 +1056,7 @@ struct bcm_sf2_of_data { const u16 *reg_offsets; unsigned int core_reg_align; unsigned int num_cfp_rules; @@ -99,7 +99,7 @@ Signed-off-by: David S. Miller }; static const u16 bcm_sf2_4908_reg_offsets[] = { -@@ -1025,6 +1066,7 @@ static const struct bcm_sf2_of_data bcm_ +@@ -1040,6 +1081,7 @@ static const struct bcm_sf2_of_data bcm_ .core_reg_align = 0, .reg_offsets = bcm_sf2_4908_reg_offsets, .num_cfp_rules = 0, /* FIXME */ @@ -107,15 +107,15 @@ Signed-off-by: David S. Miller }; /* Register offsets for the SWITCH_REG_* block */ -@@ -1135,6 +1177,7 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1150,6 +1192,7 @@ static int bcm_sf2_sw_probe(struct platf priv->reg_offsets = data->reg_offsets; priv->core_reg_align = data->core_reg_align; priv->num_cfp_rules = data->num_cfp_rules; + priv->num_crossbar_int_ports = data->num_crossbar_int_ports; - /* Auto-detection using standard registers will not work, so - * provide an indication of what kind of device we are for -@@ -1189,6 +1232,8 @@ static int bcm_sf2_sw_probe(struct platf + priv->rcdev = devm_reset_control_get_optional_exclusive(&pdev->dev, + "switch"); +@@ -1209,6 +1252,8 @@ static int bcm_sf2_sw_probe(struct platf return ret; } @@ -126,7 +126,7 @@ Signed-off-by: David S. Miller ret = bcm_sf2_mdio_register(ds); --- a/drivers/net/dsa/bcm_sf2.h +++ b/drivers/net/dsa/bcm_sf2.h -@@ -70,6 +70,7 @@ struct bcm_sf2_priv { +@@ -73,6 +73,7 @@ struct bcm_sf2_priv { const u16 *reg_offsets; unsigned int core_reg_align; unsigned int num_cfp_rules; diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0003-net-dsa-bcm_sf2-Fill-in-BCM4908-CFP-entries.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0003-net-dsa-bcm_sf2-Fill-in-BCM4908-CFP-entries.patch index 8b5332cdda..a2aa554a60 100644 --- a/target/linux/bcm4908/patches-5.4/075-v5.13-0003-net-dsa-bcm_sf2-Fill-in-BCM4908-CFP-entries.patch +++ b/target/linux/bcm4908/patches-5.4/075-v5.13-0003-net-dsa-bcm_sf2-Fill-in-BCM4908-CFP-entries.patch @@ -14,7 +14,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -1065,7 +1065,7 @@ static const struct bcm_sf2_of_data bcm_ +@@ -1080,7 +1080,7 @@ static const struct bcm_sf2_of_data bcm_ .type = BCM4908_DEVICE_ID, .core_reg_align = 0, .reg_offsets = bcm_sf2_4908_reg_offsets, diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0004-net-dsa-bcm_sf2-add-function-finding-RGMII-register.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0004-net-dsa-bcm_sf2-add-function-finding-RGMII-register.patch index c6b724215f..162b7ece3b 100644 --- a/target/linux/bcm4908/patches-5.4/075-v5.13-0004-net-dsa-bcm_sf2-add-function-finding-RGMII-register.patch +++ b/target/linux/bcm4908/patches-5.4/075-v5.13-0004-net-dsa-bcm_sf2-add-function-finding-RGMII-register.patch @@ -57,7 +57,7 @@ Signed-off-by: David S. Miller static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port) { struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); -@@ -588,6 +613,7 @@ static void bcm_sf2_sw_mac_config(struct +@@ -600,6 +625,7 @@ static void bcm_sf2_sw_mac_config(struct { struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); u32 id_mode_dis = 0, port_mode; @@ -65,7 +65,7 @@ Signed-off-by: David S. Miller u32 reg, offset; if (port == core_readl(priv, CORE_IMP0_PRT_ID)) -@@ -617,10 +643,12 @@ static void bcm_sf2_sw_mac_config(struct +@@ -629,10 +655,12 @@ static void bcm_sf2_sw_mac_config(struct goto force_link; } @@ -79,7 +79,7 @@ Signed-off-by: David S. Miller reg &= ~ID_MODE_DIS; reg &= ~(PORT_MODE_MASK << PORT_MODE_SHIFT); reg &= ~(RX_PAUSE_EN | TX_PAUSE_EN); -@@ -635,7 +663,7 @@ static void bcm_sf2_sw_mac_config(struct +@@ -647,7 +675,7 @@ static void bcm_sf2_sw_mac_config(struct reg |= RX_PAUSE_EN; } @@ -88,7 +88,7 @@ Signed-off-by: David S. Miller force_link: /* Force link settings detected from the PHY */ -@@ -666,6 +694,7 @@ static void bcm_sf2_sw_mac_link_set(stru +@@ -678,6 +706,7 @@ static void bcm_sf2_sw_mac_link_set(stru phy_interface_t interface, bool link) { struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); @@ -96,7 +96,7 @@ Signed-off-by: David S. Miller u32 reg; if (!phy_interface_mode_is_rgmii(interface) && -@@ -673,13 +702,15 @@ static void bcm_sf2_sw_mac_link_set(stru +@@ -685,13 +714,15 @@ static void bcm_sf2_sw_mac_link_set(stru interface != PHY_INTERFACE_MODE_REVMII) return; diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0005-net-dsa-bcm_sf2-fix-BCM4908-RGMII-reg-s.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0005-net-dsa-bcm_sf2-fix-BCM4908-RGMII-reg-s.patch index 81f3ff5d4d..09e00d5a5f 100644 --- a/target/linux/bcm4908/patches-5.4/075-v5.13-0005-net-dsa-bcm_sf2-fix-BCM4908-RGMII-reg-s.patch +++ b/target/linux/bcm4908/patches-5.4/075-v5.13-0005-net-dsa-bcm_sf2-fix-BCM4908-RGMII-reg-s.patch @@ -33,7 +33,7 @@ Signed-off-by: David S. Miller break; default: switch (port) { -@@ -1084,9 +1089,7 @@ static const u16 bcm_sf2_4908_reg_offset +@@ -1099,9 +1104,7 @@ static const u16 bcm_sf2_4908_reg_offset [REG_PHY_REVISION] = 0x14, [REG_SPHY_CNTRL] = 0x24, [REG_CROSSBAR] = 0xc8, diff --git a/target/linux/bcm4908/patches-5.4/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch b/target/linux/bcm4908/patches-5.4/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch index 9f67fe71c1..12db03ef0c 100644 --- a/target/linux/bcm4908/patches-5.4/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch +++ b/target/linux/bcm4908/patches-5.4/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch @@ -82,7 +82,7 @@ Signed-off-by: Jakub Kicinski } } -@@ -1090,9 +1127,14 @@ static const u16 bcm_sf2_4908_reg_offset +@@ -1105,9 +1142,14 @@ static const u16 bcm_sf2_4908_reg_offset [REG_SPHY_CNTRL] = 0x24, [REG_CROSSBAR] = 0xc8, [REG_RGMII_11_CNTRL] = 0x014c, @@ -102,7 +102,7 @@ Signed-off-by: Jakub Kicinski static const struct bcm_sf2_of_data bcm_sf2_4908_data = { --- a/drivers/net/dsa/bcm_sf2.h +++ b/drivers/net/dsa/bcm_sf2.h -@@ -203,6 +203,16 @@ SF2_IO_MACRO(acb); +@@ -206,6 +206,16 @@ SF2_IO_MACRO(acb); SWITCH_INTR_L2(0); SWITCH_INTR_L2(1); diff --git a/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch b/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch index ea9089e7ed..d7a4c5b1b8 100644 --- a/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch +++ b/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch @@ -29,7 +29,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -1368,10 +1368,14 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1388,10 +1388,14 @@ static int bcm_sf2_sw_probe(struct platf rev = reg_readl(priv, REG_PHY_REVISION); priv->hw_params.gphy_rev = rev & PHY_REVISION_MASK; diff --git a/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch b/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch index 2b860f4ed1..7ddbb44d35 100644 --- a/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch +++ b/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch @@ -15,7 +15,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -1382,6 +1382,12 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1402,6 +1402,12 @@ static int bcm_sf2_sw_probe(struct platf priv->hw_params.core_rev >> 8, priv->hw_params.core_rev & 0xff, priv->irq0, priv->irq1); diff --git a/target/linux/generic/backport-5.4/702-Revert-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch b/target/linux/generic/backport-5.4/702-Revert-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch new file mode 100644 index 0000000000..d9602fab7a --- /dev/null +++ b/target/linux/generic/backport-5.4/702-Revert-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch @@ -0,0 +1,31 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 7 Dec 2022 07:57:58 +0100 +Subject: [PATCH] Revert "net: dsa: b53: Fix valid setting for MDB entries" +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This reverts commit 1fae6eb0fc91d3ecb539e03f9e4dcd1c53ada553. + +Upstream commit was a fix for an overlook of setting "ent.is_valid" +twice after 5d65b64a3d97 ("net: dsa: b53: Add support for MDB"). + +Since MDB support was not backported to stable kernels (it's not a bug +fix) there is nothing to fix there. Backporting this commit resulted in +"env.is_valid" not being set at all. + +Signed-off-by: Rafał Miłecki +--- + drivers/net/dsa/b53/b53_common.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -1551,6 +1551,7 @@ static int b53_arl_op(struct b53_device + + memset(&ent, 0, sizeof(ent)); + ent.port = port; ++ ent.is_valid = is_valid; + ent.vid = vid; + ent.is_static = true; + memcpy(ent.mac, addr, ETH_ALEN); diff --git a/target/linux/generic/backport-5.4/703-v5.5-0001-net-dsa-b53-Add-support-for-MDB.patch b/target/linux/generic/backport-5.4/703-v5.5-0001-net-dsa-b53-Add-support-for-MDB.patch new file mode 100644 index 0000000000..8349d31900 --- /dev/null +++ b/target/linux/generic/backport-5.4/703-v5.5-0001-net-dsa-b53-Add-support-for-MDB.patch @@ -0,0 +1,130 @@ +From 5d65b64a3d97011796b225ce315b3ce0011551e7 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Thu, 24 Oct 2019 12:45:07 -0700 +Subject: [PATCH] net: dsa: b53: Add support for MDB + +In preparation for supporting IGMP snooping with or without the use of +a bridge, add support within b53_common.c to program the ARL entries for +multicast operations. The key difference is that a multicast ARL entry +is comprised of a bitmask of enabled ports, instead of a port number. + +Signed-off-by: Florian Fainelli +Reviewed-by: Vivien Didelot +Signed-off-by: David S. Miller +--- + drivers/net/dsa/b53/b53_common.c | 62 ++++++++++++++++++++++++++++++-- + drivers/net/dsa/b53/b53_priv.h | 8 ++++- + 2 files changed, 67 insertions(+), 3 deletions(-) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -1549,11 +1549,25 @@ static int b53_arl_op(struct b53_device + break; + } + +- memset(&ent, 0, sizeof(ent)); +- ent.port = port; ++ /* For multicast address, the port is a bitmask and the validity ++ * is determined by having at least one port being still active ++ */ ++ if (!is_multicast_ether_addr(addr)) { ++ ent.port = port; ++ ent.is_valid = is_valid; ++ } else { ++ if (is_valid) ++ ent.port |= BIT(port); ++ else ++ ent.port &= ~BIT(port); ++ ++ ent.is_valid = !!(ent.port); ++ } ++ + ent.is_valid = is_valid; + ent.vid = vid; + ent.is_static = true; ++ ent.is_age = false; + memcpy(ent.mac, addr, ETH_ALEN); + b53_arl_from_entry(&mac_vid, &fwd_entry, &ent); + +@@ -1672,6 +1686,47 @@ int b53_fdb_dump(struct dsa_switch *ds, + } + EXPORT_SYMBOL(b53_fdb_dump); + ++int b53_mdb_prepare(struct dsa_switch *ds, int port, ++ const struct switchdev_obj_port_mdb *mdb) ++{ ++ struct b53_device *priv = ds->priv; ++ ++ /* 5325 and 5365 require some more massaging, but could ++ * be supported eventually ++ */ ++ if (is5325(priv) || is5365(priv)) ++ return -EOPNOTSUPP; ++ ++ return 0; ++} ++EXPORT_SYMBOL(b53_mdb_prepare); ++ ++void b53_mdb_add(struct dsa_switch *ds, int port, ++ const struct switchdev_obj_port_mdb *mdb) ++{ ++ struct b53_device *priv = ds->priv; ++ int ret; ++ ++ ret = b53_arl_op(priv, 0, port, mdb->addr, mdb->vid, true); ++ if (ret) ++ dev_err(ds->dev, "failed to add MDB entry\n"); ++} ++EXPORT_SYMBOL(b53_mdb_add); ++ ++int b53_mdb_del(struct dsa_switch *ds, int port, ++ const struct switchdev_obj_port_mdb *mdb) ++{ ++ struct b53_device *priv = ds->priv; ++ int ret; ++ ++ ret = b53_arl_op(priv, 0, port, mdb->addr, mdb->vid, false); ++ if (ret) ++ dev_err(ds->dev, "failed to delete MDB entry\n"); ++ ++ return ret; ++} ++EXPORT_SYMBOL(b53_mdb_del); ++ + int b53_br_join(struct dsa_switch *ds, int port, struct net_device *br) + { + struct b53_device *dev = ds->priv; +@@ -2050,6 +2105,9 @@ static const struct dsa_switch_ops b53_s + .port_fdb_del = b53_fdb_del, + .port_mirror_add = b53_mirror_add, + .port_mirror_del = b53_mirror_del, ++ .port_mdb_prepare = b53_mdb_prepare, ++ .port_mdb_add = b53_mdb_add, ++ .port_mdb_del = b53_mdb_del, + }; + + struct b53_chip_data { +--- a/drivers/net/dsa/b53/b53_priv.h ++++ b/drivers/net/dsa/b53/b53_priv.h +@@ -250,7 +250,7 @@ b53_build_op(write48, u64); + b53_build_op(write64, u64); + + struct b53_arl_entry { +- u8 port; ++ u16 port; + u8 mac[ETH_ALEN]; + u16 vid; + u8 is_valid:1; +@@ -351,6 +351,12 @@ int b53_fdb_del(struct dsa_switch *ds, i + const unsigned char *addr, u16 vid); + int b53_fdb_dump(struct dsa_switch *ds, int port, + dsa_fdb_dump_cb_t *cb, void *data); ++int b53_mdb_prepare(struct dsa_switch *ds, int port, ++ const struct switchdev_obj_port_mdb *mdb); ++void b53_mdb_add(struct dsa_switch *ds, int port, ++ const struct switchdev_obj_port_mdb *mdb); ++int b53_mdb_del(struct dsa_switch *ds, int port, ++ const struct switchdev_obj_port_mdb *mdb); + int b53_mirror_add(struct dsa_switch *ds, int port, + struct dsa_mall_mirror_tc_entry *mirror, bool ingress); + enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port); diff --git a/target/linux/generic/backport-5.4/703-v5.5-0002-net-dsa-bcm_sf2-Wire-up-MDB-operations.patch b/target/linux/generic/backport-5.4/703-v5.5-0002-net-dsa-bcm_sf2-Wire-up-MDB-operations.patch new file mode 100644 index 0000000000..98c69fc51e --- /dev/null +++ b/target/linux/generic/backport-5.4/703-v5.5-0002-net-dsa-bcm_sf2-Wire-up-MDB-operations.patch @@ -0,0 +1,27 @@ +From 29bb5e8337caf2e3d9802ee6a6804561f125bfcf Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Thu, 24 Oct 2019 12:45:08 -0700 +Subject: [PATCH] net: dsa: bcm_sf2: Wire up MDB operations + +Leverage the recently add b53_mdb_{add,del,prepare} functions since they +work as-is for bcm_sf2. + +Signed-off-by: Florian Fainelli +Reviewed-by: Vivien Didelot +Signed-off-by: David S. Miller +--- + drivers/net/dsa/bcm_sf2.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/net/dsa/bcm_sf2.c ++++ b/drivers/net/dsa/bcm_sf2.c +@@ -981,6 +981,9 @@ static const struct dsa_switch_ops bcm_s + .set_rxnfc = bcm_sf2_set_rxnfc, + .port_mirror_add = b53_mirror_add, + .port_mirror_del = b53_mirror_del, ++ .port_mdb_prepare = b53_mdb_prepare, ++ .port_mdb_add = b53_mdb_add, ++ .port_mdb_del = b53_mdb_del, + }; + + struct bcm_sf2_of_data { diff --git a/target/linux/generic/backport-5.4/703-v5.5-0003-net-dsa-bcm_sf2-Add-support-for-optional-reset-contr.patch b/target/linux/generic/backport-5.4/703-v5.5-0003-net-dsa-bcm_sf2-Add-support-for-optional-reset-contr.patch new file mode 100644 index 0000000000..be62e7f077 --- /dev/null +++ b/target/linux/generic/backport-5.4/703-v5.5-0003-net-dsa-bcm_sf2-Add-support-for-optional-reset-contr.patch @@ -0,0 +1,81 @@ +From eee87e4377a4b86dc2eea0ade162b0dc33f40576 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 4 Nov 2019 13:51:39 -0800 +Subject: [PATCH] net: dsa: bcm_sf2: Add support for optional reset controller + line + +Grab an optional and exclusive reset controller line for the switch and +manage it during probe/remove functions accordingly. For 7278 devices we +change bcm_sf2_sw_rst() to use the reset controller line since the +WATCHDOG_CTRL register does not reset the switch contrary to stated +documentation. + +Signed-off-by: Florian Fainelli +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/bcm_sf2.c | 19 +++++++++++++++++++ + drivers/net/dsa/bcm_sf2.h | 3 +++ + 2 files changed, 22 insertions(+) + +--- a/drivers/net/dsa/bcm_sf2.c ++++ b/drivers/net/dsa/bcm_sf2.c +@@ -346,6 +346,18 @@ static int bcm_sf2_sw_rst(struct bcm_sf2 + { + unsigned int timeout = 1000; + u32 reg; ++ int ret; ++ ++ /* The watchdog reset does not work on 7278, we need to hit the ++ * "external" reset line through the reset controller. ++ */ ++ if (priv->type == BCM7278_DEVICE_ID && !IS_ERR(priv->rcdev)) { ++ ret = reset_control_assert(priv->rcdev); ++ if (ret) ++ return ret; ++ ++ return reset_control_deassert(priv->rcdev); ++ } + + reg = core_readl(priv, CORE_WATCHDOG_CTRL); + reg |= SOFTWARE_RESET | EN_CHIP_RST | EN_SW_RESET; +@@ -1099,6 +1111,11 @@ static int bcm_sf2_sw_probe(struct platf + priv->core_reg_align = data->core_reg_align; + priv->num_cfp_rules = data->num_cfp_rules; + ++ priv->rcdev = devm_reset_control_get_optional_exclusive(&pdev->dev, ++ "switch"); ++ if (PTR_ERR(priv->rcdev) == -EPROBE_DEFER) ++ return PTR_ERR(priv->rcdev); ++ + /* Auto-detection using standard registers will not work, so + * provide an indication of what kind of device we are for + * b53_common to work with +@@ -1237,6 +1254,8 @@ static int bcm_sf2_sw_remove(struct plat + dsa_unregister_switch(priv->dev->ds); + bcm_sf2_cfp_exit(priv->dev->ds); + bcm_sf2_mdio_unregister(priv); ++ if (priv->type == BCM7278_DEVICE_ID && !IS_ERR(priv->rcdev)) ++ reset_control_assert(priv->rcdev); + + return 0; + } +--- a/drivers/net/dsa/bcm_sf2.h ++++ b/drivers/net/dsa/bcm_sf2.h +@@ -18,6 +18,7 @@ + #include + #include + #include ++#include + + #include + +@@ -64,6 +65,8 @@ struct bcm_sf2_priv { + void __iomem *fcb; + void __iomem *acb; + ++ struct reset_control *rcdev; ++ + /* Register offsets indirection tables */ + u32 type; + const u16 *reg_offsets; diff --git a/target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch b/target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch new file mode 100644 index 0000000000..cb6497f28a --- /dev/null +++ b/target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch @@ -0,0 +1,30 @@ +From eab167f4851a19c514469dfa81147f77e17b5b20 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 20 Apr 2020 20:26:52 -0700 +Subject: [PATCH] net: dsa: b53: Fix valid setting for MDB entries + +When support for the MDB entries was added, the valid bit was correctly +changed to be assigned depending on the remaining port bitmask, that is, +if there were no more ports added to the entry's port bitmask, the entry +now becomes invalid. There was another assignment a few lines below that +would override this which would invalidate entries even when there were +still multiple ports left in the MDB entry. + +Fixes: 5d65b64a3d97 ("net: dsa: b53: Add support for MDB") +Reviewed-by: Andrew Lunn +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/b53/b53_common.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -1564,7 +1564,6 @@ static int b53_arl_op(struct b53_device + ent.is_valid = !!(ent.port); + } + +- ent.is_valid = is_valid; + ent.vid = vid; + ent.is_static = true; + ent.is_age = false; 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 888d5cb621..22db45aced 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 @@ -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 -@@ -641,7 +641,9 @@ static void bcm_sf2_sw_mac_link_down(str +@@ -653,7 +653,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, From 1f5024aa73fcf3b67bba7785401f9cd7067c88f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 7 Dec 2022 09:37:08 +0100 Subject: [PATCH 114/137] kernel: backport b53/bcm_sf2 changes from v5.6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This b53 backport significantly stabilizes switch traffic performance. Signed-off-by: Rafał Miłecki --- ...b53-Use-dev_-err-info-instead-of-pr_.patch | 4 +- ...-Print-err-message-on-SW_RST-timeout.patch | 2 +- ...-support-BCM4908-s-integrated-switch.patch | 2 +- ...formation-about-stacked-DSA-protocol.patch | 363 ++++++++++++++++++ ...le-Broadcom-tags-for-531x5-539x-fami.patch | 104 +++++ ...53-Fix-valid-setting-for-MDB-entries.patch | 2 +- ...t7530-add-support-for-port-mirroring.patch | 6 +- ...e6xxx-Add-support-for-port-mirroring.patch | 4 +- ...x-fix-broken-if-statement-because-of.patch | 2 +- ...an-option-for-drivers-to-always-rece.patch | 8 +- ...3-v5.8-net-dsa-mt7530-fix-VLAN-setup.patch | 2 +- ...sa-rtl8366rb-Support-the-CPU-DSA-tag.patch | 6 +- ...cally-bring-up-DSA-master-when-openi.patch | 2 +- ...r-when-a-non-legacy-FDB-operation-fa.patch | 4 +- ...e-switchdev_notifier_fdb_info-in-dsa.patch | 8 +- ...tchdev-event-implementation-under-th.patch | 4 +- ...ly-in-dsa_slave_switchdev_event-if-w.patch | 2 +- ...or-SWITCHDEV_-FDB-DEL-_ADD_TO_DEVICE.patch | 6 +- ...-support-hardware-flow-table-offload.patch | 4 +- ...-net-dsa-mt7530-Support-EEE-features.patch | 6 +- ...local-addresses-in-assisted-CPU-port.patch | 2 +- ...bridge-addresses-in-assisted-CPU-por.patch | 2 +- ...tic-FDB-entries-on-foreign-interface.patch | 4 +- ...equest-assisted-learning-on-CPU-port.patch | 2 +- ...lot-add-tsn-support-for-felix-switch.patch | 2 +- ...e-resolved-link-config-via-mac_link_.patch | 10 +- ...se-resolved-link-config-in-mac_link_.patch | 8 +- ...xtend-device-data-ready-for-adding-a.patch | 12 +- ...530-Add-the-support-of-MT7531-switch.patch | 34 +- 29 files changed, 542 insertions(+), 75 deletions(-) create mode 100644 target/linux/generic/backport-5.4/704-v5.6-net-dsa-Get-information-about-stacked-DSA-protocol.patch create mode 100644 target/linux/generic/backport-5.4/705-v5.6-0001-net-dsa-b53-Enable-Broadcom-tags-for-531x5-539x-fami.patch diff --git a/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch b/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch index 0b2ebbe1f8..04e506f6fe 100644 --- a/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch +++ b/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch @@ -26,7 +26,7 @@ Signed-off-by: David S. Miller #include #include #include -@@ -2533,8 +2531,9 @@ int b53_switch_detect(struct b53_device +@@ -2567,8 +2565,9 @@ int b53_switch_detect(struct b53_device dev->chip_id = id32; break; default: @@ -38,7 +38,7 @@ Signed-off-by: David S. Miller return -ENODEV; } } -@@ -2564,7 +2563,8 @@ int b53_switch_register(struct b53_devic +@@ -2598,7 +2597,8 @@ int b53_switch_register(struct b53_devic if (ret) return ret; diff --git a/target/linux/bcm4908/patches-5.4/070-v5.10-0002-net-dsa-b53-Print-err-message-on-SW_RST-timeout.patch b/target/linux/bcm4908/patches-5.4/070-v5.10-0002-net-dsa-b53-Print-err-message-on-SW_RST-timeout.patch index 2661b0918e..d619aa45b7 100644 --- a/target/linux/bcm4908/patches-5.4/070-v5.10-0002-net-dsa-b53-Print-err-message-on-SW_RST-timeout.patch +++ b/target/linux/bcm4908/patches-5.4/070-v5.10-0002-net-dsa-b53-Print-err-message-on-SW_RST-timeout.patch @@ -15,7 +15,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c -@@ -755,8 +755,11 @@ static int b53_switch_reset(struct b53_d +@@ -768,8 +768,11 @@ static int b53_switch_reset(struct b53_d usleep_range(1000, 2000); } while (timeout-- > 0); diff --git a/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch b/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch index bd8bb1e51e..e27ecc3498 100644 --- a/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch +++ b/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch @@ -23,7 +23,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c -@@ -2329,6 +2329,22 @@ static const struct b53_chip_data b53_sw +@@ -2363,6 +2363,22 @@ static const struct b53_chip_data b53_sw .jumbo_pm_reg = B53_JUMBO_PORT_MASK, .jumbo_size_reg = B53_JUMBO_MAX_SIZE, }, diff --git a/target/linux/generic/backport-5.4/704-v5.6-net-dsa-Get-information-about-stacked-DSA-protocol.patch b/target/linux/generic/backport-5.4/704-v5.6-net-dsa-Get-information-about-stacked-DSA-protocol.patch new file mode 100644 index 0000000000..0a05721864 --- /dev/null +++ b/target/linux/generic/backport-5.4/704-v5.6-net-dsa-Get-information-about-stacked-DSA-protocol.patch @@ -0,0 +1,363 @@ +From 4d776482ecc689bdd68627985ac4cb5a6f325953 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Tue, 7 Jan 2020 21:06:05 -0800 +Subject: [PATCH] net: dsa: Get information about stacked DSA protocol + +It is possible to stack multiple DSA switches in a way that they are not +part of the tree (disjoint) but the DSA master of a switch is a DSA +slave of another. When that happens switch drivers may have to know this +is the case so as to determine whether their tagging protocol has a +remove chance of working. + +This is useful for specific switch drivers such as b53 where devices +have been known to be stacked in the wild without the Broadcom tag +protocol supporting that feature. This allows b53 to continue supporting +those devices by forcing the disabling of Broadcom tags on the outermost +switches if necessary. + +The get_tag_protocol() function is therefore updated to gain an +additional enum dsa_tag_protocol argument which denotes the current +tagging protocol used by the DSA master we are attached to, else +DSA_TAG_PROTO_NONE for the top of the dsa_switch_tree. + +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/b53/b53_common.c | 22 +++++++++++------- + drivers/net/dsa/b53/b53_priv.h | 4 +++- + drivers/net/dsa/dsa_loop.c | 3 ++- + drivers/net/dsa/lan9303-core.c | 3 ++- + drivers/net/dsa/lantiq_gswip.c | 3 ++- + drivers/net/dsa/microchip/ksz8795.c | 3 ++- + drivers/net/dsa/microchip/ksz9477.c | 3 ++- + drivers/net/dsa/mt7530.c | 3 ++- + drivers/net/dsa/mv88e6060.c | 3 ++- + drivers/net/dsa/mv88e6xxx/chip.c | 3 ++- + drivers/net/dsa/ocelot/felix.c | 3 ++- + drivers/net/dsa/qca/ar9331.c | 3 ++- + drivers/net/dsa/qca8k.c | 3 ++- + drivers/net/dsa/rtl8366rb.c | 3 ++- + drivers/net/dsa/sja1105/sja1105_main.c | 3 ++- + drivers/net/dsa/vitesse-vsc73xx-core.c | 3 ++- + include/net/dsa.h | 3 ++- + net/dsa/dsa2.c | 31 ++++++++++++++++++++++++-- + net/dsa/dsa_priv.h | 1 + + net/dsa/slave.c | 4 +--- + 20 files changed, 78 insertions(+), 29 deletions(-) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -587,9 +587,8 @@ EXPORT_SYMBOL(b53_disable_port); + + void b53_brcm_hdr_setup(struct dsa_switch *ds, int port) + { +- bool tag_en = !(ds->ops->get_tag_protocol(ds, port) == +- DSA_TAG_PROTO_NONE); + struct b53_device *dev = ds->priv; ++ bool tag_en = !(dev->tag_protocol == DSA_TAG_PROTO_NONE); + u8 hdr_ctl, val; + u16 reg; + +@@ -1921,7 +1920,8 @@ static bool b53_can_enable_brcm_tags(str + return ret; + } + +-enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port) ++enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port, ++ enum dsa_tag_protocol mprot) + { + struct b53_device *dev = ds->priv; + +@@ -1931,16 +1931,22 @@ enum dsa_tag_protocol b53_get_tag_protoc + * misses on multicast addresses (TBD). + */ + if (is5325(dev) || is5365(dev) || is539x(dev) || is531x5(dev) || +- !b53_can_enable_brcm_tags(ds, port)) +- return DSA_TAG_PROTO_NONE; ++ !b53_can_enable_brcm_tags(ds, port)) { ++ dev->tag_protocol = DSA_TAG_PROTO_NONE; ++ goto out; ++ } + + /* Broadcom BCM58xx chips have a flow accelerator on Port 8 + * which requires us to use the prepended Broadcom tag type + */ +- if (dev->chip_id == BCM58XX_DEVICE_ID && port == B53_CPU_PORT) +- return DSA_TAG_PROTO_BRCM_PREPEND; ++ if (dev->chip_id == BCM58XX_DEVICE_ID && port == B53_CPU_PORT) { ++ dev->tag_protocol = DSA_TAG_PROTO_BRCM_PREPEND; ++ goto out; ++ } + +- return DSA_TAG_PROTO_BRCM; ++ dev->tag_protocol = DSA_TAG_PROTO_BRCM; ++out: ++ return dev->tag_protocol; + } + EXPORT_SYMBOL(b53_get_tag_protocol); + +--- a/drivers/net/dsa/b53/b53_priv.h ++++ b/drivers/net/dsa/b53/b53_priv.h +@@ -118,6 +118,7 @@ struct b53_device { + u8 jumbo_size_reg; + int reset_gpio; + u8 num_arl_entries; ++ enum dsa_tag_protocol tag_protocol; + + /* used ports mask */ + u16 enabled_ports; +@@ -359,7 +360,8 @@ int b53_mdb_del(struct dsa_switch *ds, i + const struct switchdev_obj_port_mdb *mdb); + int b53_mirror_add(struct dsa_switch *ds, int port, + struct dsa_mall_mirror_tc_entry *mirror, bool ingress); +-enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port); ++enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port, ++ enum dsa_tag_protocol mprot); + void b53_mirror_del(struct dsa_switch *ds, int port, + struct dsa_mall_mirror_tc_entry *mirror); + int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy); +--- a/drivers/net/dsa/dsa_loop.c ++++ b/drivers/net/dsa/dsa_loop.c +@@ -61,7 +61,8 @@ struct dsa_loop_priv { + static struct phy_device *phydevs[PHY_MAX_ADDR]; + + static enum dsa_tag_protocol dsa_loop_get_protocol(struct dsa_switch *ds, +- int port) ++ int port, ++ enum dsa_tag_protocol mp) + { + dev_dbg(ds->dev, "%s: port: %d\n", __func__, port); + +--- a/drivers/net/dsa/lan9303-core.c ++++ b/drivers/net/dsa/lan9303-core.c +@@ -889,7 +889,8 @@ static int lan9303_check_device(struct l + /* ---------------------------- DSA -----------------------------------*/ + + static enum dsa_tag_protocol lan9303_get_tag_protocol(struct dsa_switch *ds, +- int port) ++ int port, ++ enum dsa_tag_protocol mp) + { + return DSA_TAG_PROTO_LAN9303; + } +--- a/drivers/net/dsa/lantiq_gswip.c ++++ b/drivers/net/dsa/lantiq_gswip.c +@@ -860,7 +860,8 @@ static int gswip_setup(struct dsa_switch + } + + static enum dsa_tag_protocol gswip_get_tag_protocol(struct dsa_switch *ds, +- int port) ++ int port, ++ enum dsa_tag_protocol mp) + { + return DSA_TAG_PROTO_GSWIP; + } +--- a/drivers/net/dsa/microchip/ksz8795.c ++++ b/drivers/net/dsa/microchip/ksz8795.c +@@ -645,7 +645,8 @@ static void ksz8795_w_phy(struct ksz_dev + } + + static enum dsa_tag_protocol ksz8795_get_tag_protocol(struct dsa_switch *ds, +- int port) ++ int port, ++ enum dsa_tag_protocol mp) + { + return DSA_TAG_PROTO_KSZ8795; + } +--- a/drivers/net/dsa/microchip/ksz9477.c ++++ b/drivers/net/dsa/microchip/ksz9477.c +@@ -295,7 +295,8 @@ static void ksz9477_port_init_cnt(struct + } + + static enum dsa_tag_protocol ksz9477_get_tag_protocol(struct dsa_switch *ds, +- int port) ++ int port, ++ enum dsa_tag_protocol mp) + { + enum dsa_tag_protocol proto = DSA_TAG_PROTO_KSZ9477; + struct ksz_device *dev = ds->priv; +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -1144,7 +1144,8 @@ mt7530_port_vlan_del(struct dsa_switch * + } + + static enum dsa_tag_protocol +-mtk_get_tag_protocol(struct dsa_switch *ds, int port) ++mtk_get_tag_protocol(struct dsa_switch *ds, int port, ++ enum dsa_tag_protocol mp) + { + struct mt7530_priv *priv = ds->priv; + +--- a/drivers/net/dsa/mv88e6060.c ++++ b/drivers/net/dsa/mv88e6060.c +@@ -43,7 +43,8 @@ static const char *mv88e6060_get_name(st + } + + static enum dsa_tag_protocol mv88e6060_get_tag_protocol(struct dsa_switch *ds, +- int port) ++ int port, ++ enum dsa_tag_protocol m) + { + return DSA_TAG_PROTO_TRAILER; + } +--- a/drivers/net/dsa/mv88e6xxx/chip.c ++++ b/drivers/net/dsa/mv88e6xxx/chip.c +@@ -4878,7 +4878,8 @@ static struct mv88e6xxx_chip *mv88e6xxx_ + } + + static enum dsa_tag_protocol mv88e6xxx_get_tag_protocol(struct dsa_switch *ds, +- int port) ++ int port, ++ enum dsa_tag_protocol m) + { + struct mv88e6xxx_chip *chip = ds->priv; + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -1016,7 +1016,8 @@ qca8k_port_fdb_dump(struct dsa_switch *d + } + + static enum dsa_tag_protocol +-qca8k_get_tag_protocol(struct dsa_switch *ds, int port) ++qca8k_get_tag_protocol(struct dsa_switch *ds, int port, ++ enum dsa_tag_protocol mp) + { + return DSA_TAG_PROTO_QCA; + } +--- a/drivers/net/dsa/rtl8366rb.c ++++ b/drivers/net/dsa/rtl8366rb.c +@@ -964,7 +964,8 @@ static int rtl8366rb_setup(struct dsa_sw + } + + static enum dsa_tag_protocol rtl8366_get_tag_protocol(struct dsa_switch *ds, +- int port) ++ int port, ++ enum dsa_tag_protocol mp) + { + /* For now, the RTL switches are handled without any custom tags. + * +--- a/drivers/net/dsa/sja1105/sja1105_main.c ++++ b/drivers/net/dsa/sja1105/sja1105_main.c +@@ -1591,7 +1591,8 @@ static int sja1105_setup_8021q_tagging(s + } + + static enum dsa_tag_protocol +-sja1105_get_tag_protocol(struct dsa_switch *ds, int port) ++sja1105_get_tag_protocol(struct dsa_switch *ds, int port, ++ enum dsa_tag_protocol mp) + { + return DSA_TAG_PROTO_SJA1105; + } +--- a/drivers/net/dsa/vitesse-vsc73xx-core.c ++++ b/drivers/net/dsa/vitesse-vsc73xx-core.c +@@ -542,7 +542,8 @@ static int vsc73xx_phy_write(struct dsa_ + } + + static enum dsa_tag_protocol vsc73xx_get_tag_protocol(struct dsa_switch *ds, +- int port) ++ int port, ++ enum dsa_tag_protocol mp) + { + /* The switch internally uses a 8 byte header with length, + * source port, tag, LPA and priority. This is supposedly +--- a/include/net/dsa.h ++++ b/include/net/dsa.h +@@ -353,7 +353,8 @@ typedef int dsa_fdb_dump_cb_t(const unsi + bool is_static, void *data); + struct dsa_switch_ops { + enum dsa_tag_protocol (*get_tag_protocol)(struct dsa_switch *ds, +- int port); ++ int port, ++ enum dsa_tag_protocol mprot); + + int (*setup)(struct dsa_switch *ds); + void (*teardown)(struct dsa_switch *ds); +--- a/net/dsa/dsa2.c ++++ b/net/dsa/dsa2.c +@@ -631,6 +631,32 @@ static int dsa_port_parse_dsa(struct dsa + return 0; + } + ++static enum dsa_tag_protocol dsa_get_tag_protocol(struct dsa_port *dp, ++ struct net_device *master) ++{ ++ enum dsa_tag_protocol tag_protocol = DSA_TAG_PROTO_NONE; ++ struct dsa_switch *mds, *ds = dp->ds; ++ unsigned int mdp_upstream; ++ struct dsa_port *mdp; ++ ++ /* It is possible to stack DSA switches onto one another when that ++ * happens the switch driver may want to know if its tagging protocol ++ * is going to work in such a configuration. ++ */ ++ if (dsa_slave_dev_check(master)) { ++ mdp = dsa_slave_to_port(master); ++ mds = mdp->ds; ++ mdp_upstream = dsa_upstream_port(mds, mdp->index); ++ tag_protocol = mds->ops->get_tag_protocol(mds, mdp_upstream, ++ DSA_TAG_PROTO_NONE); ++ } ++ ++ /* If the master device is not itself a DSA slave in a disjoint DSA ++ * tree, then return immediately. ++ */ ++ return ds->ops->get_tag_protocol(ds, dp->index, tag_protocol); ++} ++ + static int dsa_port_parse_cpu(struct dsa_port *dp, struct net_device *master) + { + struct dsa_switch *ds = dp->ds; +@@ -638,20 +664,21 @@ static int dsa_port_parse_cpu(struct dsa + const struct dsa_device_ops *tag_ops; + enum dsa_tag_protocol tag_protocol; + +- tag_protocol = ds->ops->get_tag_protocol(ds, dp->index); ++ tag_protocol = dsa_get_tag_protocol(dp, master); + tag_ops = dsa_tag_driver_get(tag_protocol); + if (IS_ERR(tag_ops)) { + if (PTR_ERR(tag_ops) == -ENOPROTOOPT) + return -EPROBE_DEFER; + dev_warn(ds->dev, "No tagger for this switch\n"); ++ dp->master = NULL; + return PTR_ERR(tag_ops); + } + ++ dp->master = master; + dp->type = DSA_PORT_TYPE_CPU; + dp->filter = tag_ops->filter; + dp->rcv = tag_ops->rcv; + dp->tag_ops = tag_ops; +- dp->master = master; + dp->dst = dst; + + return 0; +--- a/net/dsa/dsa_priv.h ++++ b/net/dsa/dsa_priv.h +@@ -189,6 +189,7 @@ extern const struct dsa_device_ops notag + void dsa_slave_mii_bus_init(struct dsa_switch *ds); + int dsa_slave_create(struct dsa_port *dp); + void dsa_slave_destroy(struct net_device *slave_dev); ++bool dsa_slave_dev_check(const struct net_device *dev); + int dsa_slave_suspend(struct net_device *slave_dev); + int dsa_slave_resume(struct net_device *slave_dev); + int dsa_slave_register_notifier(void); +--- a/net/dsa/slave.c ++++ b/net/dsa/slave.c +@@ -22,8 +22,6 @@ + + #include "dsa_priv.h" + +-static bool dsa_slave_dev_check(const struct net_device *dev); +- + /* slave mii_bus handling ***************************************************/ + static int dsa_slave_phy_read(struct mii_bus *bus, int addr, int reg) + { +@@ -1494,7 +1492,7 @@ void dsa_slave_destroy(struct net_device + free_netdev(slave_dev); + } + +-static bool dsa_slave_dev_check(const struct net_device *dev) ++bool dsa_slave_dev_check(const struct net_device *dev) + { + return dev->netdev_ops == &dsa_slave_netdev_ops; + } diff --git a/target/linux/generic/backport-5.4/705-v5.6-0001-net-dsa-b53-Enable-Broadcom-tags-for-531x5-539x-fami.patch b/target/linux/generic/backport-5.4/705-v5.6-0001-net-dsa-b53-Enable-Broadcom-tags-for-531x5-539x-fami.patch new file mode 100644 index 0000000000..abc2dc836a --- /dev/null +++ b/target/linux/generic/backport-5.4/705-v5.6-0001-net-dsa-b53-Enable-Broadcom-tags-for-531x5-539x-fami.patch @@ -0,0 +1,104 @@ +From 8fab459e69abfd04a66d76423d18ba853fced4ab Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Tue, 7 Jan 2020 21:06:06 -0800 +Subject: [PATCH] net: dsa: b53: Enable Broadcom tags for 531x5/539x families + +The BCM531x5 and BCM539x families require that the IMP port be enabled +within the management page and that management mode (SM_SW_FWD_MODE) be +turned on. Once this is done, everything works as expected, including +multicast with standalone DSA devices or bridge devices. + +Because such switches are frequencly cascaded with other internal +Broadcom switches on which we want to enable Broadcom tags, update +b53_can_enable_brcm_tags() to check the kind of DSA master tagging +protocol being used, if it is one of the two supported Broadcom tagging +protocols, force DSA_TAG_PROTO_NONE. + +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/b53/b53_common.c | 46 +++++++++++++++++++++++++------- + 1 file changed, 37 insertions(+), 9 deletions(-) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -371,8 +371,6 @@ static void b53_enable_vlan(struct b53_d + b53_read8(dev, B53_VLAN_PAGE, B53_VLAN_CTRL5, &vc5); + } + +- mgmt &= ~SM_SW_FWD_MODE; +- + if (enable) { + vc0 |= VC0_VLAN_EN | VC0_VID_CHK_EN | VC0_VID_HASH_VID; + vc1 |= VC1_RX_MCST_UNTAG_EN | VC1_RX_MCST_FWD_EN; +@@ -608,6 +606,22 @@ void b53_brcm_hdr_setup(struct dsa_switc + break; + } + ++ /* Enable management mode if tagging is requested */ ++ b53_read8(dev, B53_CTRL_PAGE, B53_SWITCH_MODE, &hdr_ctl); ++ if (tag_en) ++ hdr_ctl |= SM_SW_FWD_MODE; ++ else ++ hdr_ctl &= ~SM_SW_FWD_MODE; ++ b53_write8(dev, B53_CTRL_PAGE, B53_SWITCH_MODE, hdr_ctl); ++ ++ /* Configure the appropriate IMP port */ ++ b53_read8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, &hdr_ctl); ++ if (port == 8) ++ hdr_ctl |= GC_FRM_MGMT_PORT_MII; ++ else if (port == 5) ++ hdr_ctl |= GC_FRM_MGMT_PORT_M; ++ b53_write8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, hdr_ctl); ++ + /* Enable Broadcom tags for IMP port */ + b53_read8(dev, B53_MGMT_PAGE, B53_BRCM_HDR, &hdr_ctl); + if (tag_en) +@@ -1910,13 +1924,29 @@ static bool b53_possible_cpu_port(struct + return false; + } + +-static bool b53_can_enable_brcm_tags(struct dsa_switch *ds, int port) ++static bool b53_can_enable_brcm_tags(struct dsa_switch *ds, int port, ++ enum dsa_tag_protocol tag_protocol) + { + bool ret = b53_possible_cpu_port(ds, port); + +- if (!ret) ++ if (!ret) { + dev_warn(ds->dev, "Port %d is not Broadcom tag capable\n", + port); ++ return ret; ++ } ++ ++ switch (tag_protocol) { ++ case DSA_TAG_PROTO_BRCM: ++ case DSA_TAG_PROTO_BRCM_PREPEND: ++ dev_warn(ds->dev, ++ "Port %d is stacked to Broadcom tag switch\n", port); ++ ret = false; ++ break; ++ default: ++ ret = true; ++ break; ++ } ++ + return ret; + } + +@@ -1926,12 +1956,10 @@ enum dsa_tag_protocol b53_get_tag_protoc + struct b53_device *dev = ds->priv; + + /* Older models (5325, 5365) support a different tag format that we do +- * not support in net/dsa/tag_brcm.c yet. 539x and 531x5 require managed +- * mode to be turned on which means we need to specifically manage ARL +- * misses on multicast addresses (TBD). ++ * not support in net/dsa/tag_brcm.c yet. + */ +- if (is5325(dev) || is5365(dev) || is539x(dev) || is531x5(dev) || +- !b53_can_enable_brcm_tags(ds, port)) { ++ if (is5325(dev) || is5365(dev) || ++ !b53_can_enable_brcm_tags(ds, port, mprot)) { + dev->tag_protocol = DSA_TAG_PROTO_NONE; + goto out; + } diff --git a/target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch b/target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch index cb6497f28a..8225ca1d29 100644 --- a/target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch +++ b/target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch @@ -20,7 +20,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c -@@ -1564,7 +1564,6 @@ static int b53_arl_op(struct b53_device +@@ -1577,7 +1577,6 @@ static int b53_arl_op(struct b53_device ent.is_valid = !!(ent.port); } diff --git a/target/linux/generic/backport-5.4/745-v5.7-net-dsa-mt7530-add-support-for-port-mirroring.patch b/target/linux/generic/backport-5.4/745-v5.7-net-dsa-mt7530-add-support-for-port-mirroring.patch index 71a06997c3..566dfce5ca 100644 --- a/target/linux/generic/backport-5.4/745-v5.7-net-dsa-mt7530-add-support-for-port-mirroring.patch +++ b/target/linux/generic/backport-5.4/745-v5.7-net-dsa-mt7530-add-support-for-port-mirroring.patch @@ -80,9 +80,9 @@ Signed-off-by: David S. Miller +} + static enum dsa_tag_protocol - mtk_get_tag_protocol(struct dsa_switch *ds, int port) - { -@@ -1520,6 +1578,8 @@ static const struct dsa_switch_ops mt753 + mtk_get_tag_protocol(struct dsa_switch *ds, int port, + enum dsa_tag_protocol mp) +@@ -1521,6 +1579,8 @@ 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, diff --git a/target/linux/generic/backport-5.4/747-v5.5-net-dsa-mv88e6xxx-Add-support-for-port-mirroring.patch b/target/linux/generic/backport-5.4/747-v5.5-net-dsa-mv88e6xxx-Add-support-for-port-mirroring.patch index a45a22e485..81acdaecd2 100644 --- a/target/linux/generic/backport-5.4/747-v5.5-net-dsa-mv88e6xxx-Add-support-for-port-mirroring.patch +++ b/target/linux/generic/backport-5.4/747-v5.5-net-dsa-mv88e6xxx-Add-support-for-port-mirroring.patch @@ -25,7 +25,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c -@@ -4928,6 +4928,80 @@ static int mv88e6xxx_port_mdb_del(struct +@@ -4929,6 +4929,80 @@ static int mv88e6xxx_port_mdb_del(struct return err; } @@ -106,7 +106,7 @@ Signed-off-by: David S. Miller static int mv88e6xxx_port_egress_floods(struct dsa_switch *ds, int port, bool unicast, bool multicast) { -@@ -4982,6 +5056,8 @@ static const struct dsa_switch_ops mv88e +@@ -4983,6 +5057,8 @@ static const struct dsa_switch_ops mv88e .port_mdb_prepare = mv88e6xxx_port_mdb_prepare, .port_mdb_add = mv88e6xxx_port_mdb_add, .port_mdb_del = mv88e6xxx_port_mdb_del, diff --git a/target/linux/generic/backport-5.4/748-v5.5-net-dsa-mv88e6xxx-fix-broken-if-statement-because-of.patch b/target/linux/generic/backport-5.4/748-v5.5-net-dsa-mv88e6xxx-fix-broken-if-statement-because-of.patch index 837126a336..9985e1cf56 100644 --- a/target/linux/generic/backport-5.4/748-v5.5-net-dsa-mv88e6xxx-fix-broken-if-statement-because-of.patch +++ b/target/linux/generic/backport-5.4/748-v5.5-net-dsa-mv88e6xxx-fix-broken-if-statement-because-of.patch @@ -19,7 +19,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c -@@ -4995,7 +4995,7 @@ static void mv88e6xxx_port_mirror_del(st +@@ -4996,7 +4996,7 @@ static void mv88e6xxx_port_mirror_del(st if (chip->info->ops->set_egress_port(chip, direction, dsa_upstream_port(ds, diff --git a/target/linux/generic/backport-5.4/752-v5.8-net-dsa-provide-an-option-for-drivers-to-always-rece.patch b/target/linux/generic/backport-5.4/752-v5.8-net-dsa-provide-an-option-for-drivers-to-always-rece.patch index 52d9351b70..86f1f8300e 100644 --- a/target/linux/generic/backport-5.4/752-v5.8-net-dsa-provide-an-option-for-drivers-to-always-rece.patch +++ b/target/linux/generic/backport-5.4/752-v5.8-net-dsa-provide-an-option-for-drivers-to-always-rece.patch @@ -83,7 +83,7 @@ Signed-off-by: David S. Miller { --- a/net/dsa/slave.c +++ b/net/dsa/slave.c -@@ -319,7 +319,7 @@ static int dsa_slave_vlan_add(struct net +@@ -317,7 +317,7 @@ static int dsa_slave_vlan_add(struct net if (obj->orig_dev != dev) return -EOPNOTSUPP; @@ -92,7 +92,7 @@ Signed-off-by: David S. Miller return 0; vlan = *SWITCHDEV_OBJ_PORT_VLAN(obj); -@@ -386,7 +386,7 @@ static int dsa_slave_vlan_del(struct net +@@ -384,7 +384,7 @@ static int dsa_slave_vlan_del(struct net if (obj->orig_dev != dev) return -EOPNOTSUPP; @@ -101,7 +101,7 @@ Signed-off-by: David S. Miller return 0; /* Do not deprogram the CPU port as it may be shared with other user -@@ -1120,7 +1120,7 @@ static int dsa_slave_vlan_rx_add_vid(str +@@ -1118,7 +1118,7 @@ static int dsa_slave_vlan_rx_add_vid(str * need to emulate the switchdev prepare + commit phase. */ if (dp->bridge_dev) { @@ -110,7 +110,7 @@ Signed-off-by: David S. Miller return 0; /* br_vlan_get_info() returns -EINVAL or -ENOENT if the -@@ -1154,7 +1154,7 @@ static int dsa_slave_vlan_rx_kill_vid(st +@@ -1152,7 +1152,7 @@ static int dsa_slave_vlan_rx_kill_vid(st * need to emulate the switchdev prepare + commit phase. */ if (dp->bridge_dev) { diff --git a/target/linux/generic/backport-5.4/753-v5.8-net-dsa-mt7530-fix-VLAN-setup.patch b/target/linux/generic/backport-5.4/753-v5.8-net-dsa-mt7530-fix-VLAN-setup.patch index 0804cea9f7..e26829ee60 100644 --- a/target/linux/generic/backport-5.4/753-v5.8-net-dsa-mt7530-fix-VLAN-setup.patch +++ b/target/linux/generic/backport-5.4/753-v5.8-net-dsa-mt7530-fix-VLAN-setup.patch @@ -41,7 +41,7 @@ Signed-off-by: David S. Miller mutex_lock(&priv->reg_mutex); pvid = priv->ports[port].pvid; -@@ -1232,6 +1220,7 @@ mt7530_setup(struct dsa_switch *ds) +@@ -1233,6 +1221,7 @@ mt7530_setup(struct dsa_switch *ds) * as two netdev instances. */ dn = ds->ports[MT7530_CPU_PORT].master->dev.of_node->parent; diff --git a/target/linux/generic/backport-5.4/758-v5.8-net-dsa-rtl8366rb-Support-the-CPU-DSA-tag.patch b/target/linux/generic/backport-5.4/758-v5.8-net-dsa-rtl8366rb-Support-the-CPU-DSA-tag.patch index b68c033bbe..cabb9d9a92 100644 --- a/target/linux/generic/backport-5.4/758-v5.8-net-dsa-rtl8366rb-Support-the-CPU-DSA-tag.patch +++ b/target/linux/generic/backport-5.4/758-v5.8-net-dsa-rtl8366rb-Support-the-CPU-DSA-tag.patch @@ -74,9 +74,9 @@ Signed-off-by: David S. Miller if (ret) return ret; -@@ -966,21 +964,8 @@ static int rtl8366rb_setup(struct dsa_sw - static enum dsa_tag_protocol rtl8366_get_tag_protocol(struct dsa_switch *ds, - int port) +@@ -967,21 +965,8 @@ static enum dsa_tag_protocol rtl8366_get + int port, + enum dsa_tag_protocol mp) { - /* For now, the RTL switches are handled without any custom tags. - * diff --git a/target/linux/generic/backport-5.4/765-v5.12-net-dsa-automatically-bring-up-DSA-master-when-openi.patch b/target/linux/generic/backport-5.4/765-v5.12-net-dsa-automatically-bring-up-DSA-master-when-openi.patch index 7ec26899f9..3b630377f9 100644 --- a/target/linux/generic/backport-5.4/765-v5.12-net-dsa-automatically-bring-up-DSA-master-when-openi.patch +++ b/target/linux/generic/backport-5.4/765-v5.12-net-dsa-automatically-bring-up-DSA-master-when-openi.patch @@ -69,7 +69,7 @@ Signed-off-by: Jakub Kicinski --- a/net/dsa/slave.c +++ b/net/dsa/slave.c -@@ -70,8 +70,11 @@ static int dsa_slave_open(struct net_dev +@@ -68,8 +68,11 @@ static int dsa_slave_open(struct net_dev struct dsa_port *dp = dsa_slave_to_port(dev); int err; diff --git a/target/linux/generic/backport-5.4/771-v5.12-net-dsa-be-louder-when-a-non-legacy-FDB-operation-fa.patch b/target/linux/generic/backport-5.4/771-v5.12-net-dsa-be-louder-when-a-non-legacy-FDB-operation-fa.patch index 893eb719ca..f889489915 100644 --- a/target/linux/generic/backport-5.4/771-v5.12-net-dsa-be-louder-when-a-non-legacy-FDB-operation-fa.patch +++ b/target/linux/generic/backport-5.4/771-v5.12-net-dsa-be-louder-when-a-non-legacy-FDB-operation-fa.patch @@ -25,7 +25,7 @@ Signed-off-by: Jakub Kicinski --- a/net/dsa/slave.c +++ b/net/dsa/slave.c -@@ -1593,7 +1593,9 @@ static void dsa_slave_switchdev_event_wo +@@ -1591,7 +1591,9 @@ static void dsa_slave_switchdev_event_wo err = dsa_port_fdb_add(dp, fdb_info->addr, fdb_info->vid); if (err) { @@ -36,7 +36,7 @@ Signed-off-by: Jakub Kicinski break; } fdb_info->offloaded = true; -@@ -1608,9 +1610,11 @@ static void dsa_slave_switchdev_event_wo +@@ -1606,9 +1608,11 @@ static void dsa_slave_switchdev_event_wo err = dsa_port_fdb_del(dp, fdb_info->addr, fdb_info->vid); if (err) { diff --git a/target/linux/generic/backport-5.4/772-v5.12-net-dsa-don-t-use-switchdev_notifier_fdb_info-in-dsa.patch b/target/linux/generic/backport-5.4/772-v5.12-net-dsa-don-t-use-switchdev_notifier_fdb_info-in-dsa.patch index 275870d19f..bd1685a16a 100644 --- a/target/linux/generic/backport-5.4/772-v5.12-net-dsa-don-t-use-switchdev_notifier_fdb_info-in-dsa.patch +++ b/target/linux/generic/backport-5.4/772-v5.12-net-dsa-don-t-use-switchdev_notifier_fdb_info-in-dsa.patch @@ -54,7 +54,7 @@ Signed-off-by: Jakub Kicinski struct sk_buff * (*xmit)(struct sk_buff *skb, --- a/net/dsa/slave.c +++ b/net/dsa/slave.c -@@ -1568,76 +1568,66 @@ static int dsa_slave_netdevice_event(str +@@ -1566,76 +1566,66 @@ static int dsa_slave_netdevice_event(str return NOTIFY_DONE; } @@ -167,7 +167,7 @@ Signed-off-by: Jakub Kicinski } /* Called under rcu_read_lock() */ -@@ -1645,7 +1635,9 @@ static int dsa_slave_switchdev_event(str +@@ -1643,7 +1633,9 @@ static int dsa_slave_switchdev_event(str unsigned long event, void *ptr) { struct net_device *dev = switchdev_notifier_info_to_dev(ptr); @@ -177,7 +177,7 @@ Signed-off-by: Jakub Kicinski int err; if (event == SWITCHDEV_PORT_ATTR_SET) { -@@ -1658,20 +1650,32 @@ static int dsa_slave_switchdev_event(str +@@ -1656,20 +1648,32 @@ static int dsa_slave_switchdev_event(str if (!dsa_slave_dev_check(dev)) return NOTIFY_DONE; @@ -213,7 +213,7 @@ Signed-off-by: Jakub Kicinski dev_hold(dev); break; default: -@@ -1681,10 +1685,6 @@ static int dsa_slave_switchdev_event(str +@@ -1679,10 +1683,6 @@ static int dsa_slave_switchdev_event(str dsa_schedule_work(&switchdev_work->work); return NOTIFY_OK; diff --git a/target/linux/generic/backport-5.4/773-v5.12-net-dsa-move-switchdev-event-implementation-under-th.patch b/target/linux/generic/backport-5.4/773-v5.12-net-dsa-move-switchdev-event-implementation-under-th.patch index b70986fcc1..acc6e16117 100644 --- a/target/linux/generic/backport-5.4/773-v5.12-net-dsa-move-switchdev-event-implementation-under-th.patch +++ b/target/linux/generic/backport-5.4/773-v5.12-net-dsa-move-switchdev-event-implementation-under-th.patch @@ -20,7 +20,7 @@ Signed-off-by: Jakub Kicinski --- a/net/dsa/slave.c +++ b/net/dsa/slave.c -@@ -1640,31 +1640,29 @@ static int dsa_slave_switchdev_event(str +@@ -1638,31 +1638,29 @@ static int dsa_slave_switchdev_event(str struct dsa_port *dp; int err; @@ -68,7 +68,7 @@ Signed-off-by: Jakub Kicinski fdb_info = ptr; if (!fdb_info->added_by_user) { -@@ -1677,13 +1675,12 @@ static int dsa_slave_switchdev_event(str +@@ -1675,13 +1673,12 @@ static int dsa_slave_switchdev_event(str switchdev_work->vid = fdb_info->vid; dev_hold(dev); diff --git a/target/linux/generic/backport-5.4/774-v5.12-net-dsa-exit-early-in-dsa_slave_switchdev_event-if-w.patch b/target/linux/generic/backport-5.4/774-v5.12-net-dsa-exit-early-in-dsa_slave_switchdev_event-if-w.patch index c7ed4064e8..35266b71bc 100644 --- a/target/linux/generic/backport-5.4/774-v5.12-net-dsa-exit-early-in-dsa_slave_switchdev_event-if-w.patch +++ b/target/linux/generic/backport-5.4/774-v5.12-net-dsa-exit-early-in-dsa_slave_switchdev_event-if-w.patch @@ -30,7 +30,7 @@ Signed-off-by: Jakub Kicinski --- a/net/dsa/slave.c +++ b/net/dsa/slave.c -@@ -1653,6 +1653,9 @@ static int dsa_slave_switchdev_event(str +@@ -1651,6 +1651,9 @@ static int dsa_slave_switchdev_event(str dp = dsa_slave_to_port(dev); diff --git a/target/linux/generic/backport-5.4/775-v5.12-net-dsa-listen-for-SWITCHDEV_-FDB-DEL-_ADD_TO_DEVICE.patch b/target/linux/generic/backport-5.4/775-v5.12-net-dsa-listen-for-SWITCHDEV_-FDB-DEL-_ADD_TO_DEVICE.patch index e4ed6e808f..e49a97c81d 100644 --- a/target/linux/generic/backport-5.4/775-v5.12-net-dsa-listen-for-SWITCHDEV_-FDB-DEL-_ADD_TO_DEVICE.patch +++ b/target/linux/generic/backport-5.4/775-v5.12-net-dsa-listen-for-SWITCHDEV_-FDB-DEL-_ADD_TO_DEVICE.patch @@ -172,7 +172,7 @@ Signed-off-by: DENG Qingfang */ --- a/net/dsa/slave.c +++ b/net/dsa/slave.c -@@ -1630,6 +1630,25 @@ static void dsa_slave_switchdev_event_wo +@@ -1628,6 +1628,25 @@ static void dsa_slave_switchdev_event_wo dev_put(dp->slave); } @@ -198,7 +198,7 @@ Signed-off-by: DENG Qingfang /* Called under rcu_read_lock() */ static int dsa_slave_switchdev_event(struct notifier_block *unused, unsigned long event, void *ptr) -@@ -1648,10 +1667,37 @@ static int dsa_slave_switchdev_event(str +@@ -1646,10 +1665,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: @@ -239,7 +239,7 @@ Signed-off-by: DENG Qingfang if (!dp->ds->ops->port_fdb_add || !dp->ds->ops->port_fdb_del) return NOTIFY_DONE; -@@ -1666,18 +1712,13 @@ static int dsa_slave_switchdev_event(str +@@ -1664,18 +1710,13 @@ static int dsa_slave_switchdev_event(str switchdev_work->port = dp->index; switchdev_work->event = event; diff --git a/target/linux/generic/pending-5.4/647-net-dsa-support-hardware-flow-table-offload.patch b/target/linux/generic/pending-5.4/647-net-dsa-support-hardware-flow-table-offload.patch index 369a09caac..ff41a17c62 100644 --- a/target/linux/generic/pending-5.4/647-net-dsa-support-hardware-flow-table-offload.patch +++ b/target/linux/generic/pending-5.4/647-net-dsa-support-hardware-flow-table-offload.patch @@ -38,7 +38,7 @@ Signed-off-by: Felix Fietkau #include "dsa_priv.h" -@@ -1226,6 +1230,27 @@ static struct devlink_port *dsa_slave_ge +@@ -1224,6 +1228,27 @@ static struct devlink_port *dsa_slave_ge return dp->ds->devlink ? &dp->devlink_port : NULL; } @@ -66,7 +66,7 @@ Signed-off-by: Felix Fietkau static const struct net_device_ops dsa_slave_netdev_ops = { .ndo_open = dsa_slave_open, .ndo_stop = dsa_slave_close, -@@ -1250,6 +1275,9 @@ static const struct net_device_ops dsa_s +@@ -1248,6 +1273,9 @@ static const struct net_device_ops dsa_s .ndo_vlan_rx_add_vid = dsa_slave_vlan_rx_add_vid, .ndo_vlan_rx_kill_vid = dsa_slave_vlan_rx_kill_vid, .ndo_get_devlink_port = dsa_slave_get_devlink_port, diff --git a/target/linux/generic/pending-5.4/761-net-dsa-mt7530-Support-EEE-features.patch b/target/linux/generic/pending-5.4/761-net-dsa-mt7530-Support-EEE-features.patch index c2dc35d134..93ed193747 100644 --- a/target/linux/generic/pending-5.4/761-net-dsa-mt7530-Support-EEE-features.patch +++ b/target/linux/generic/pending-5.4/761-net-dsa-mt7530-Support-EEE-features.patch @@ -9,7 +9,7 @@ Content-Transfer-Encoding: 8bit Signed-off-by: René van Dorst --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -1407,9 +1407,13 @@ static void mt7530_phylink_mac_config(st +@@ -1408,9 +1408,13 @@ static void mt7530_phylink_mac_config(st switch (state->speed) { case SPEED_1000: mcr_new |= PMCR_FORCE_SPEED_1000; @@ -23,7 +23,7 @@ Signed-off-by: René van Dorst break; } if (state->duplex == DUPLEX_FULL) { -@@ -1545,6 +1549,54 @@ mt7530_phylink_mac_link_state(struct dsa +@@ -1546,6 +1550,54 @@ mt7530_phylink_mac_link_state(struct dsa return 1; } @@ -78,7 +78,7 @@ Signed-off-by: René van Dorst static const struct dsa_switch_ops mt7530_switch_ops = { .get_tag_protocol = mtk_get_tag_protocol, .setup = mt7530_setup, -@@ -1572,6 +1624,8 @@ static const struct dsa_switch_ops mt753 +@@ -1573,6 +1625,8 @@ static const struct dsa_switch_ops mt753 .phylink_mac_config = mt7530_phylink_mac_config, .phylink_mac_link_down = mt7530_phylink_mac_link_down, .phylink_mac_link_up = mt7530_phylink_mac_link_up, diff --git a/target/linux/generic/pending-5.4/765-net-dsa-Include-local-addresses-in-assisted-CPU-port.patch b/target/linux/generic/pending-5.4/765-net-dsa-Include-local-addresses-in-assisted-CPU-port.patch index d951246260..4c0c4391a3 100644 --- a/target/linux/generic/pending-5.4/765-net-dsa-Include-local-addresses-in-assisted-CPU-port.patch +++ b/target/linux/generic/pending-5.4/765-net-dsa-Include-local-addresses-in-assisted-CPU-port.patch @@ -18,7 +18,7 @@ Signed-off-by: Tobias Waldekranz --- a/net/dsa/slave.c +++ b/net/dsa/slave.c -@@ -1698,10 +1698,12 @@ static int dsa_slave_switchdev_event(str +@@ -1696,10 +1696,12 @@ static int dsa_slave_switchdev_event(str fdb_info = ptr; if (dsa_slave_dev_check(dev)) { diff --git a/target/linux/generic/pending-5.4/766-net-dsa-Include-bridge-addresses-in-assisted-CPU-por.patch b/target/linux/generic/pending-5.4/766-net-dsa-Include-bridge-addresses-in-assisted-CPU-por.patch index 46504aeeff..14f62ec19a 100644 --- a/target/linux/generic/pending-5.4/766-net-dsa-Include-bridge-addresses-in-assisted-CPU-por.patch +++ b/target/linux/generic/pending-5.4/766-net-dsa-Include-bridge-addresses-in-assisted-CPU-por.patch @@ -15,7 +15,7 @@ Signed-off-by: Tobias Waldekranz --- a/net/dsa/slave.c +++ b/net/dsa/slave.c -@@ -1712,7 +1712,11 @@ static int dsa_slave_switchdev_event(str +@@ -1710,7 +1710,11 @@ static int dsa_slave_switchdev_event(str struct net_device *br_dev; struct dsa_slave_priv *p; diff --git a/target/linux/generic/pending-5.4/767-net-dsa-Sync-static-FDB-entries-on-foreign-interface.patch b/target/linux/generic/pending-5.4/767-net-dsa-Sync-static-FDB-entries-on-foreign-interface.patch index e626086bc1..33f49685bf 100644 --- a/target/linux/generic/pending-5.4/767-net-dsa-Sync-static-FDB-entries-on-foreign-interface.patch +++ b/target/linux/generic/pending-5.4/767-net-dsa-Sync-static-FDB-entries-on-foreign-interface.patch @@ -28,7 +28,7 @@ Signed-off-by: Tobias Waldekranz --- a/net/dsa/slave.c +++ b/net/dsa/slave.c -@@ -1705,9 +1705,12 @@ static int dsa_slave_switchdev_event(str +@@ -1703,9 +1703,12 @@ static int dsa_slave_switchdev_event(str else if (!fdb_info->added_by_user) return NOTIFY_OK; } else { @@ -44,7 +44,7 @@ Signed-off-by: Tobias Waldekranz */ struct net_device *br_dev; struct dsa_slave_priv *p; -@@ -1729,7 +1732,8 @@ static int dsa_slave_switchdev_event(str +@@ -1727,7 +1730,8 @@ static int dsa_slave_switchdev_event(str dp = p->dp->cpu_dp; diff --git a/target/linux/generic/pending-5.4/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch b/target/linux/generic/pending-5.4/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch index 65b0e1084e..dc9e61eb9d 100644 --- a/target/linux/generic/pending-5.4/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch +++ b/target/linux/generic/pending-5.4/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch @@ -17,7 +17,7 @@ Signed-off-by: Tobias Waldekranz --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c -@@ -5082,6 +5082,7 @@ static int mv88e6xxx_register_switch(str +@@ -5083,6 +5083,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; diff --git a/target/linux/layerscape/patches-5.4/701-net-0273-net-dsa-ocelot-add-tsn-support-for-felix-switch.patch b/target/linux/layerscape/patches-5.4/701-net-0273-net-dsa-ocelot-add-tsn-support-for-felix-switch.patch index 72b101bfb0..8214e1a310 100644 --- a/target/linux/layerscape/patches-5.4/701-net-0273-net-dsa-ocelot-add-tsn-support-for-felix-switch.patch +++ b/target/linux/layerscape/patches-5.4/701-net-0273-net-dsa-ocelot-add-tsn-support-for-felix-switch.patch @@ -648,7 +648,7 @@ Signed-off-by: Xiaoliang Yang static const u32 vsc9959_gcb_regmap[] = { --- a/include/net/dsa.h +++ b/include/net/dsa.h -@@ -559,6 +559,7 @@ struct dsa_switch_ops { +@@ -560,6 +560,7 @@ struct dsa_switch_ops { */ netdev_tx_t (*port_deferred_xmit)(struct dsa_switch *ds, int port, struct sk_buff *skb); 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 22db45aced..6fc9a1643e 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 -@@ -1284,7 +1284,9 @@ EXPORT_SYMBOL(b53_phylink_mac_link_down) +@@ -1297,7 +1297,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, @@ -25,7 +25,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/b53/b53_priv.h +++ b/drivers/net/dsa/b53/b53_priv.h -@@ -337,7 +337,9 @@ void b53_phylink_mac_link_down(struct ds +@@ -338,7 +338,9 @@ void b53_phylink_mac_link_down(struct ds void b53_phylink_mac_link_up(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface, @@ -51,7 +51,7 @@ Signed-off-by: David S. Miller struct ethtool_eee *p = &priv->dev->ports[port].eee; --- a/drivers/net/dsa/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq_gswip.c -@@ -1661,7 +1661,9 @@ static void gswip_phylink_mac_link_down( +@@ -1662,7 +1662,9 @@ static void gswip_phylink_mac_link_down( static void gswip_phylink_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 -@@ -1440,7 +1440,9 @@ static void mt7530_phylink_mac_link_down +@@ -1441,7 +1441,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 -@@ -406,7 +406,9 @@ struct dsa_switch_ops { +@@ -407,7 +407,9 @@ struct dsa_switch_ops { void (*phylink_mac_link_up)(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface, 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 23fba85252..57066a3607 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 @@ -51,7 +51,7 @@ Signed-off-by: David S. Miller mutex_unlock(&priv->reg_mutex); } -@@ -1395,8 +1384,7 @@ static void mt7530_phylink_mac_config(st +@@ -1396,8 +1385,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; -@@ -1404,26 +1392,6 @@ static void mt7530_phylink_mac_config(st +@@ -1405,26 +1393,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); } -@@ -1434,7 +1402,7 @@ static void mt7530_phylink_mac_link_down +@@ -1435,7 +1403,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, -@@ -1445,8 +1413,31 @@ static void mt7530_phylink_mac_link_up(s +@@ -1446,8 +1414,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 718ed8ea2d..84579ac2c5 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; } -@@ -1332,12 +1334,11 @@ mt7530_setup(struct dsa_switch *ds) +@@ -1333,12 +1335,11 @@ mt7530_setup(struct dsa_switch *ds) return 0; } @@ -63,7 +63,7 @@ Signed-off-by: Sean Wang switch (port) { case 0: /* Internal phy */ -@@ -1346,33 +1347,114 @@ static void mt7530_phylink_mac_config(st +@@ -1347,33 +1348,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; } -@@ -1440,61 +1522,44 @@ static void mt7530_phylink_mac_link_up(s +@@ -1441,61 +1523,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); -@@ -1590,12 +1655,45 @@ static int mt7530_set_mac_eee(struct dsa +@@ -1591,12 +1656,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, -@@ -1612,18 +1710,43 @@ static const struct dsa_switch_ops mt753 +@@ -1613,18 +1711,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); -@@ -1661,8 +1784,21 @@ mt7530_probe(struct mdio_device *mdiodev +@@ -1662,8 +1785,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 8ede862204..95dddf68b0 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 @@ -466,7 +466,7 @@ Signed-off-by: Sean Wang } } -@@ -1280,7 +1619,7 @@ mt7530_setup(struct dsa_switch *ds) +@@ -1281,7 +1620,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); -@@ -1334,6 +1673,118 @@ mt7530_setup(struct dsa_switch *ds) +@@ -1335,6 +1674,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) -@@ -1372,6 +1823,47 @@ unsupported: +@@ -1373,6 +1824,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) -@@ -1404,6 +1896,227 @@ mt7530_mac_config(struct dsa_switch *ds, +@@ -1405,6 +1897,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) -@@ -1439,6 +2152,8 @@ mt753x_phylink_mac_config(struct dsa_swi +@@ -1440,6 +2153,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) -@@ -1458,7 +2173,8 @@ unsupported: +@@ -1459,7 +2174,8 @@ unsupported: return; } @@ -889,7 +889,7 @@ Signed-off-by: Sean Wang dev_err(ds->dev, "%s: in-band negotiation unsupported\n", __func__); return; -@@ -1468,7 +2184,7 @@ unsupported: +@@ -1469,7 +2185,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)) -@@ -1478,7 +2194,18 @@ unsupported: +@@ -1479,7 +2195,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) { -@@ -1487,7 +2214,19 @@ static void mt7530_phylink_mac_link_down +@@ -1488,7 +2215,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, -@@ -1497,18 +2236,29 @@ static void mt7530_phylink_mac_link_up(s +@@ -1498,18 +2237,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) { -@@ -1522,6 +2272,45 @@ static void mt7530_phylink_mac_link_up(s +@@ -1523,6 +2273,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) -@@ -1530,6 +2319,14 @@ mt7530_mac_port_validate(struct dsa_swit +@@ -1531,6 +2320,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, -@@ -1546,7 +2343,8 @@ mt753x_phylink_validate(struct dsa_switc +@@ -1547,7 +2344,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); -@@ -1565,6 +2363,11 @@ mt753x_phylink_validate(struct dsa_switc +@@ -1566,6 +2364,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 -@@ -1655,6 +2458,63 @@ static int mt7530_set_mac_eee(struct dsa +@@ -1656,6 +2459,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) -@@ -1708,13 +2568,14 @@ static const struct dsa_switch_ops mt753 +@@ -1709,13 +2569,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, }; -@@ -1742,11 +2603,26 @@ static const struct mt753x_info mt753x_t +@@ -1743,11 +2604,26 @@ static const struct mt753x_info mt753x_t .mac_port_get_state = mt7530_phylink_mac_link_state, .mac_port_config = mt7530_mac_config, }, From 88a71fbe774b048457bfca3721098f6da0b167d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 7 Dec 2022 09:48:32 +0100 Subject: [PATCH 115/137] kernel: backport b53/bcm_sf2 changes from v5.7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki --- ...b53-Use-dev_-err-info-instead-of-pr_.patch | 4 +- ...-Print-err-message-on-SW_RST-timeout.patch | 2 +- ...-support-BCM4908-s-integrated-switch.patch | 8 +- ...store-PHY-interface-mode-in-port-str.patch | 4 +- ..._sf2-setup-BCM4908-internal-crossbar.patch | 12 +- ...-bcm_sf2-Fill-in-BCM4908-CFP-entries.patch | 2 +- ...-add-function-finding-RGMII-register.patch | 10 +- ...-dsa-bcm_sf2-fix-BCM4908-RGMII-reg-s.patch | 2 +- ...dsa-bcm_sf2-refactor-LED-regs-access.patch | 2 +- ...m_sf2-enable-GPHY-for-switch-probing.patch | 2 +- ...sf2-keep-GPHY-enabled-on-the-BCM4908.patch | 2 +- ...Also-configure-Port-5-for-2Gb-sec-on.patch | 37 ++++ ...cm_sf2-Also-configure-Port-5-for-2Gb.patch | 43 +++++ ...ore-VLAN-entries-upon-re-configurati.patch | 48 +++++ ...event-tagged-VLAN-on-port-7-for-7278.patch | 33 ++++ ...-enslaving-port-7-for-7278-into-a-br.patch | 31 +++ ...cm_sf2-Disable-learning-for-ASP-port.patch | 36 ++++ ...Check-earlier-for-FLOW_EXT-and-FLOW_.patch | 33 ++++ ...Move-writing-of-CFP_DATA-5-into-slic.patch | 131 +++++++++++++ ...f2-Add-support-for-matching-VLAN-TCI.patch | 181 ++++++++++++++++++ ...Support-specifying-VLAN-tag-egress-r.patch | 94 +++++++++ ...53-Fix-valid-setting-for-MDB-entries.patch | 2 +- ...e-resolved-link-config-via-mac_link_.patch | 4 +- 23 files changed, 695 insertions(+), 28 deletions(-) create mode 100644 target/linux/generic/backport-5.4/707-v5.7-0001-net-dsa-bcm_sf2-Also-configure-Port-5-for-2Gb-sec-on.patch create mode 100644 target/linux/generic/backport-5.4/707-v5.7-0002-Revert-net-dsa-bcm_sf2-Also-configure-Port-5-for-2Gb.patch create mode 100644 target/linux/generic/backport-5.4/707-v5.7-0005-net-dsa-b53-Restore-VLAN-entries-upon-re-configurati.patch create mode 100644 target/linux/generic/backport-5.4/707-v5.7-0006-net-dsa-b53-Prevent-tagged-VLAN-on-port-7-for-7278.patch create mode 100644 target/linux/generic/backport-5.4/707-v5.7-0007-net-dsa-b53-Deny-enslaving-port-7-for-7278-into-a-br.patch create mode 100644 target/linux/generic/backport-5.4/707-v5.7-0008-net-dsa-bcm_sf2-Disable-learning-for-ASP-port.patch create mode 100644 target/linux/generic/backport-5.4/707-v5.7-0009-net-dsa-bcm_sf2-Check-earlier-for-FLOW_EXT-and-FLOW_.patch create mode 100644 target/linux/generic/backport-5.4/707-v5.7-0010-net-dsa-bcm_sf2-Move-writing-of-CFP_DATA-5-into-slic.patch create mode 100644 target/linux/generic/backport-5.4/707-v5.7-0011-net-dsa-bcm_sf2-Add-support-for-matching-VLAN-TCI.patch create mode 100644 target/linux/generic/backport-5.4/707-v5.7-0012-net-dsa-bcm_sf2-Support-specifying-VLAN-tag-egress-r.patch diff --git a/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch b/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch index 04e506f6fe..776cf4a1f2 100644 --- a/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch +++ b/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch @@ -26,7 +26,7 @@ Signed-off-by: David S. Miller #include #include #include -@@ -2567,8 +2565,9 @@ int b53_switch_detect(struct b53_device +@@ -2596,8 +2594,9 @@ int b53_switch_detect(struct b53_device dev->chip_id = id32; break; default: @@ -38,7 +38,7 @@ Signed-off-by: David S. Miller return -ENODEV; } } -@@ -2598,7 +2597,8 @@ int b53_switch_register(struct b53_devic +@@ -2627,7 +2626,8 @@ int b53_switch_register(struct b53_devic if (ret) return ret; diff --git a/target/linux/bcm4908/patches-5.4/070-v5.10-0002-net-dsa-b53-Print-err-message-on-SW_RST-timeout.patch b/target/linux/bcm4908/patches-5.4/070-v5.10-0002-net-dsa-b53-Print-err-message-on-SW_RST-timeout.patch index d619aa45b7..a83cec3950 100644 --- a/target/linux/bcm4908/patches-5.4/070-v5.10-0002-net-dsa-b53-Print-err-message-on-SW_RST-timeout.patch +++ b/target/linux/bcm4908/patches-5.4/070-v5.10-0002-net-dsa-b53-Print-err-message-on-SW_RST-timeout.patch @@ -15,7 +15,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c -@@ -768,8 +768,11 @@ static int b53_switch_reset(struct b53_d +@@ -783,8 +783,11 @@ static int b53_switch_reset(struct b53_d usleep_range(1000, 2000); } while (timeout-- > 0); diff --git a/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch b/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch index e27ecc3498..531388da70 100644 --- a/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch +++ b/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch @@ -23,7 +23,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c -@@ -2363,6 +2363,22 @@ static const struct b53_chip_data b53_sw +@@ -2392,6 +2392,22 @@ static const struct b53_chip_data b53_sw .jumbo_pm_reg = B53_JUMBO_PORT_MASK, .jumbo_size_reg = B53_JUMBO_MAX_SIZE, }, @@ -68,7 +68,7 @@ Signed-off-by: Jakub Kicinski offset = CORE_STS_OVERRIDE_IMP; else offset = CORE_STS_OVERRIDE_IMP2; -@@ -555,7 +556,8 @@ static void bcm_sf2_sw_mac_config(struct +@@ -563,7 +564,8 @@ static void bcm_sf2_sw_mac_config(struct if (port == core_readl(priv, CORE_IMP0_PRT_ID)) return; @@ -78,7 +78,7 @@ Signed-off-by: Jakub Kicinski offset = CORE_STS_OVERRIDE_GMIIP_PORT(port); else offset = CORE_STS_OVERRIDE_GMIIP2_PORT(port); -@@ -1005,6 +1007,30 @@ struct bcm_sf2_of_data { +@@ -1013,6 +1015,30 @@ struct bcm_sf2_of_data { unsigned int num_cfp_rules; }; @@ -109,7 +109,7 @@ Signed-off-by: Jakub Kicinski /* Register offsets for the SWITCH_REG_* block */ static const u16 bcm_sf2_7445_reg_offsets[] = { [REG_SWITCH_CNTRL] = 0x00, -@@ -1053,6 +1079,9 @@ static const struct bcm_sf2_of_data bcm_ +@@ -1061,6 +1087,9 @@ static const struct bcm_sf2_of_data bcm_ }; static const struct of_device_id bcm_sf2_of_match[] = { diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0001-net-dsa-bcm_sf2-store-PHY-interface-mode-in-port-str.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0001-net-dsa-bcm_sf2-store-PHY-interface-mode-in-port-str.patch index 9590327649..a4bab32f95 100644 --- a/target/linux/bcm4908/patches-5.4/075-v5.13-0001-net-dsa-bcm_sf2-store-PHY-interface-mode-in-port-str.patch +++ b/target/linux/bcm4908/patches-5.4/075-v5.13-0001-net-dsa-bcm_sf2-store-PHY-interface-mode-in-port-str.patch @@ -18,7 +18,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -392,8 +392,9 @@ static void bcm_sf2_intr_disable(struct +@@ -400,8 +400,9 @@ static void bcm_sf2_intr_disable(struct static void bcm_sf2_identify_ports(struct bcm_sf2_priv *priv, struct device_node *dn) { @@ -29,7 +29,7 @@ Signed-off-by: David S. Miller unsigned int port_num; priv->moca_port = -1; -@@ -402,19 +403,26 @@ static void bcm_sf2_identify_ports(struc +@@ -410,19 +411,26 @@ static void bcm_sf2_identify_ports(struc if (of_property_read_u32(port, "reg", &port_num)) continue; diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0002-net-dsa-bcm_sf2-setup-BCM4908-internal-crossbar.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0002-net-dsa-bcm_sf2-setup-BCM4908-internal-crossbar.patch index 21717ffc3c..e13be23a65 100644 --- a/target/linux/bcm4908/patches-5.4/075-v5.13-0002-net-dsa-bcm_sf2-setup-BCM4908-internal-crossbar.patch +++ b/target/linux/bcm4908/patches-5.4/075-v5.13-0002-net-dsa-bcm_sf2-setup-BCM4908-internal-crossbar.patch @@ -37,7 +37,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -381,6 +381,44 @@ static int bcm_sf2_sw_rst(struct bcm_sf2 +@@ -389,6 +389,44 @@ static int bcm_sf2_sw_rst(struct bcm_sf2 return 0; } @@ -82,7 +82,7 @@ Signed-off-by: David S. Miller static void bcm_sf2_intr_disable(struct bcm_sf2_priv *priv) { intrl2_0_mask_set(priv, 0xffffffff); -@@ -751,6 +789,8 @@ static int bcm_sf2_sw_resume(struct dsa_ +@@ -759,6 +797,8 @@ static int bcm_sf2_sw_resume(struct dsa_ return ret; } @@ -91,7 +91,7 @@ Signed-off-by: David S. Miller ret = bcm_sf2_cfp_resume(ds); if (ret) return ret; -@@ -1016,6 +1056,7 @@ struct bcm_sf2_of_data { +@@ -1024,6 +1064,7 @@ struct bcm_sf2_of_data { const u16 *reg_offsets; unsigned int core_reg_align; unsigned int num_cfp_rules; @@ -99,7 +99,7 @@ Signed-off-by: David S. Miller }; static const u16 bcm_sf2_4908_reg_offsets[] = { -@@ -1040,6 +1081,7 @@ static const struct bcm_sf2_of_data bcm_ +@@ -1048,6 +1089,7 @@ static const struct bcm_sf2_of_data bcm_ .core_reg_align = 0, .reg_offsets = bcm_sf2_4908_reg_offsets, .num_cfp_rules = 0, /* FIXME */ @@ -107,7 +107,7 @@ Signed-off-by: David S. Miller }; /* Register offsets for the SWITCH_REG_* block */ -@@ -1150,6 +1192,7 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1158,6 +1200,7 @@ static int bcm_sf2_sw_probe(struct platf priv->reg_offsets = data->reg_offsets; priv->core_reg_align = data->core_reg_align; priv->num_cfp_rules = data->num_cfp_rules; @@ -115,7 +115,7 @@ Signed-off-by: David S. Miller priv->rcdev = devm_reset_control_get_optional_exclusive(&pdev->dev, "switch"); -@@ -1209,6 +1252,8 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1217,6 +1260,8 @@ static int bcm_sf2_sw_probe(struct platf return ret; } diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0003-net-dsa-bcm_sf2-Fill-in-BCM4908-CFP-entries.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0003-net-dsa-bcm_sf2-Fill-in-BCM4908-CFP-entries.patch index a2aa554a60..da27963bf8 100644 --- a/target/linux/bcm4908/patches-5.4/075-v5.13-0003-net-dsa-bcm_sf2-Fill-in-BCM4908-CFP-entries.patch +++ b/target/linux/bcm4908/patches-5.4/075-v5.13-0003-net-dsa-bcm_sf2-Fill-in-BCM4908-CFP-entries.patch @@ -14,7 +14,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -1080,7 +1080,7 @@ static const struct bcm_sf2_of_data bcm_ +@@ -1088,7 +1088,7 @@ static const struct bcm_sf2_of_data bcm_ .type = BCM4908_DEVICE_ID, .core_reg_align = 0, .reg_offsets = bcm_sf2_4908_reg_offsets, diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0004-net-dsa-bcm_sf2-add-function-finding-RGMII-register.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0004-net-dsa-bcm_sf2-add-function-finding-RGMII-register.patch index 162b7ece3b..442e35ad98 100644 --- a/target/linux/bcm4908/patches-5.4/075-v5.13-0004-net-dsa-bcm_sf2-add-function-finding-RGMII-register.patch +++ b/target/linux/bcm4908/patches-5.4/075-v5.13-0004-net-dsa-bcm_sf2-add-function-finding-RGMII-register.patch @@ -57,7 +57,7 @@ Signed-off-by: David S. Miller static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port) { struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); -@@ -600,6 +625,7 @@ static void bcm_sf2_sw_mac_config(struct +@@ -608,6 +633,7 @@ static void bcm_sf2_sw_mac_config(struct { struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); u32 id_mode_dis = 0, port_mode; @@ -65,7 +65,7 @@ Signed-off-by: David S. Miller u32 reg, offset; if (port == core_readl(priv, CORE_IMP0_PRT_ID)) -@@ -629,10 +655,12 @@ static void bcm_sf2_sw_mac_config(struct +@@ -637,10 +663,12 @@ static void bcm_sf2_sw_mac_config(struct goto force_link; } @@ -79,7 +79,7 @@ Signed-off-by: David S. Miller reg &= ~ID_MODE_DIS; reg &= ~(PORT_MODE_MASK << PORT_MODE_SHIFT); reg &= ~(RX_PAUSE_EN | TX_PAUSE_EN); -@@ -647,7 +675,7 @@ static void bcm_sf2_sw_mac_config(struct +@@ -655,7 +683,7 @@ static void bcm_sf2_sw_mac_config(struct reg |= RX_PAUSE_EN; } @@ -88,7 +88,7 @@ Signed-off-by: David S. Miller force_link: /* Force link settings detected from the PHY */ -@@ -678,6 +706,7 @@ static void bcm_sf2_sw_mac_link_set(stru +@@ -686,6 +714,7 @@ static void bcm_sf2_sw_mac_link_set(stru phy_interface_t interface, bool link) { struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); @@ -96,7 +96,7 @@ Signed-off-by: David S. Miller u32 reg; if (!phy_interface_mode_is_rgmii(interface) && -@@ -685,13 +714,15 @@ static void bcm_sf2_sw_mac_link_set(stru +@@ -693,13 +722,15 @@ static void bcm_sf2_sw_mac_link_set(stru interface != PHY_INTERFACE_MODE_REVMII) return; diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0005-net-dsa-bcm_sf2-fix-BCM4908-RGMII-reg-s.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0005-net-dsa-bcm_sf2-fix-BCM4908-RGMII-reg-s.patch index 09e00d5a5f..1abec90243 100644 --- a/target/linux/bcm4908/patches-5.4/075-v5.13-0005-net-dsa-bcm_sf2-fix-BCM4908-RGMII-reg-s.patch +++ b/target/linux/bcm4908/patches-5.4/075-v5.13-0005-net-dsa-bcm_sf2-fix-BCM4908-RGMII-reg-s.patch @@ -33,7 +33,7 @@ Signed-off-by: David S. Miller break; default: switch (port) { -@@ -1099,9 +1104,7 @@ static const u16 bcm_sf2_4908_reg_offset +@@ -1107,9 +1112,7 @@ static const u16 bcm_sf2_4908_reg_offset [REG_PHY_REVISION] = 0x14, [REG_SPHY_CNTRL] = 0x24, [REG_CROSSBAR] = 0xc8, diff --git a/target/linux/bcm4908/patches-5.4/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch b/target/linux/bcm4908/patches-5.4/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch index 12db03ef0c..00ea23005b 100644 --- a/target/linux/bcm4908/patches-5.4/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch +++ b/target/linux/bcm4908/patches-5.4/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch @@ -82,7 +82,7 @@ Signed-off-by: Jakub Kicinski } } -@@ -1105,9 +1142,14 @@ static const u16 bcm_sf2_4908_reg_offset +@@ -1113,9 +1150,14 @@ static const u16 bcm_sf2_4908_reg_offset [REG_SPHY_CNTRL] = 0x24, [REG_CROSSBAR] = 0xc8, [REG_RGMII_11_CNTRL] = 0x014c, diff --git a/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch b/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch index d7a4c5b1b8..39efb11d81 100644 --- a/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch +++ b/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch @@ -29,7 +29,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -1388,10 +1388,14 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1396,10 +1396,14 @@ static int bcm_sf2_sw_probe(struct platf rev = reg_readl(priv, REG_PHY_REVISION); priv->hw_params.gphy_rev = rev & PHY_REVISION_MASK; diff --git a/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch b/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch index 7ddbb44d35..d18bfc0dea 100644 --- a/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch +++ b/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch @@ -15,7 +15,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -1402,6 +1402,12 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1410,6 +1410,12 @@ static int bcm_sf2_sw_probe(struct platf priv->hw_params.core_rev >> 8, priv->hw_params.core_rev & 0xff, priv->irq0, priv->irq1); diff --git a/target/linux/generic/backport-5.4/707-v5.7-0001-net-dsa-bcm_sf2-Also-configure-Port-5-for-2Gb-sec-on.patch b/target/linux/generic/backport-5.4/707-v5.7-0001-net-dsa-bcm_sf2-Also-configure-Port-5-for-2Gb-sec-on.patch new file mode 100644 index 0000000000..61a037b361 --- /dev/null +++ b/target/linux/generic/backport-5.4/707-v5.7-0001-net-dsa-bcm_sf2-Also-configure-Port-5-for-2Gb-sec-on.patch @@ -0,0 +1,37 @@ +From 7458bd540fa0a90220b9e8c349d910d9dde9caf8 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Fri, 14 Feb 2020 16:32:29 -0800 +Subject: [PATCH] net: dsa: bcm_sf2: Also configure Port 5 for 2Gb/sec on 7278 + +Either port 5 or port 8 can be used on a 7278 device, make sure that +port 5 also gets configured properly for 2Gb/sec in that case. + +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/bcm_sf2.c | 3 +++ + drivers/net/dsa/bcm_sf2_regs.h | 1 + + 2 files changed, 4 insertions(+) + +--- a/drivers/net/dsa/bcm_sf2.c ++++ b/drivers/net/dsa/bcm_sf2.c +@@ -620,6 +620,9 @@ force_link: + reg |= RXFLOW_CNTL; + } + ++ if (priv->type == BCM7278_DEVICE_ID && dsa_is_cpu_port(ds, port)) ++ reg |= GMIIP_SPEED_UP_2G; ++ + core_writel(priv, reg, offset); + } + +--- a/drivers/net/dsa/bcm_sf2_regs.h ++++ b/drivers/net/dsa/bcm_sf2_regs.h +@@ -178,6 +178,7 @@ enum bcm_sf2_reg_offs { + #define RXFLOW_CNTL (1 << 4) + #define TXFLOW_CNTL (1 << 5) + #define SW_OVERRIDE (1 << 6) ++#define GMIIP_SPEED_UP_2G (1 << 7) + + #define CORE_WATCHDOG_CTRL 0x001e4 + #define SOFTWARE_RESET (1 << 7) diff --git a/target/linux/generic/backport-5.4/707-v5.7-0002-Revert-net-dsa-bcm_sf2-Also-configure-Port-5-for-2Gb.patch b/target/linux/generic/backport-5.4/707-v5.7-0002-Revert-net-dsa-bcm_sf2-Also-configure-Port-5-for-2Gb.patch new file mode 100644 index 0000000000..2b99f47436 --- /dev/null +++ b/target/linux/generic/backport-5.4/707-v5.7-0002-Revert-net-dsa-bcm_sf2-Also-configure-Port-5-for-2Gb.patch @@ -0,0 +1,43 @@ +From 3f02735e5da5367e4cd563ce6e5c21ce27922248 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 24 Feb 2020 15:44:26 -0800 +Subject: [PATCH] Revert "net: dsa: bcm_sf2: Also configure Port 5 for 2Gb/sec + on 7278" + +This reverts commit 7458bd540fa0a90220b9e8c349d910d9dde9caf8 ("net: dsa: +bcm_sf2: Also configure Port 5 for 2Gb/sec on 7278") as it causes +advanced congestion buffering issues with 7278 switch devices when using +their internal Giabit PHY. While this is being debugged, continue with +conservative defaults that work and do not cause packet loss. + +Fixes: 7458bd540fa0 ("net: dsa: bcm_sf2: Also configure Port 5 for 2Gb/sec on 7278") +Signed-off-by: Florian Fainelli +Reviewed-by: Vivien Didelot +Signed-off-by: David S. Miller +--- + drivers/net/dsa/bcm_sf2.c | 3 --- + drivers/net/dsa/bcm_sf2_regs.h | 1 - + 2 files changed, 4 deletions(-) + +--- a/drivers/net/dsa/bcm_sf2.c ++++ b/drivers/net/dsa/bcm_sf2.c +@@ -620,9 +620,6 @@ force_link: + reg |= RXFLOW_CNTL; + } + +- if (priv->type == BCM7278_DEVICE_ID && dsa_is_cpu_port(ds, port)) +- reg |= GMIIP_SPEED_UP_2G; +- + core_writel(priv, reg, offset); + } + +--- a/drivers/net/dsa/bcm_sf2_regs.h ++++ b/drivers/net/dsa/bcm_sf2_regs.h +@@ -178,7 +178,6 @@ enum bcm_sf2_reg_offs { + #define RXFLOW_CNTL (1 << 4) + #define TXFLOW_CNTL (1 << 5) + #define SW_OVERRIDE (1 << 6) +-#define GMIIP_SPEED_UP_2G (1 << 7) + + #define CORE_WATCHDOG_CTRL 0x001e4 + #define SOFTWARE_RESET (1 << 7) diff --git a/target/linux/generic/backport-5.4/707-v5.7-0005-net-dsa-b53-Restore-VLAN-entries-upon-re-configurati.patch b/target/linux/generic/backport-5.4/707-v5.7-0005-net-dsa-b53-Restore-VLAN-entries-upon-re-configurati.patch new file mode 100644 index 0000000000..cf8be49075 --- /dev/null +++ b/target/linux/generic/backport-5.4/707-v5.7-0005-net-dsa-b53-Restore-VLAN-entries-upon-re-configurati.patch @@ -0,0 +1,48 @@ +From d7a0b1f7652f9f6b7ba0c9d8ad8edd6b8c0c1511 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 30 Mar 2020 14:38:47 -0700 +Subject: [PATCH] net: dsa: b53: Restore VLAN entries upon (re)configuration + +The first time b53_configure_vlan() is called we have not configured any +VLAN entries yet, since that happens later when interfaces get brought +up. When b53_configure_vlan() is called again from suspend/resume we +need to restore all VLAN entries though. + +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/b53/b53_common.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -696,7 +696,9 @@ int b53_configure_vlan(struct dsa_switch + { + struct b53_device *dev = ds->priv; + struct b53_vlan vl = { 0 }; ++ struct b53_vlan *v; + int i, def_vid; ++ u16 vid; + + def_vid = b53_default_pvid(dev); + +@@ -717,6 +719,19 @@ int b53_configure_vlan(struct dsa_switch + if (!is5325(dev) && !is5365(dev)) + b53_set_jumbo(dev, dev->enable_jumbo, false); + ++ /* Upon initial call we have not set-up any VLANs, but upon ++ * system resume, we need to restore all VLAN entries. ++ */ ++ for (vid = def_vid; vid < dev->num_vlans; vid++) { ++ v = &dev->vlans[vid]; ++ ++ if (!v->members) ++ continue; ++ ++ b53_set_vlan_entry(dev, vid, v); ++ b53_fast_age_vlan(dev, vid); ++ } ++ + return 0; + } + EXPORT_SYMBOL(b53_configure_vlan); diff --git a/target/linux/generic/backport-5.4/707-v5.7-0006-net-dsa-b53-Prevent-tagged-VLAN-on-port-7-for-7278.patch b/target/linux/generic/backport-5.4/707-v5.7-0006-net-dsa-b53-Prevent-tagged-VLAN-on-port-7-for-7278.patch new file mode 100644 index 0000000000..12c9546f7b --- /dev/null +++ b/target/linux/generic/backport-5.4/707-v5.7-0006-net-dsa-b53-Prevent-tagged-VLAN-on-port-7-for-7278.patch @@ -0,0 +1,33 @@ +From 88631864da093377ce6d5e60b5639328622a8e5c Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 30 Mar 2020 14:38:48 -0700 +Subject: [PATCH] net: dsa: b53: Prevent tagged VLAN on port 7 for 7278 + +On 7278, port 7 of the switch connects to the ASP UniMAC which is not +capable of processing VLAN tagged frames. We can still allow the port to +be part of a VLAN entry, and we may want it to be untagged on egress on +that VLAN because of that limitation. + +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/b53/b53_common.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -1366,6 +1366,14 @@ int b53_vlan_prepare(struct dsa_switch * + if ((is5325(dev) || is5365(dev)) && vlan->vid_begin == 0) + return -EOPNOTSUPP; + ++ /* Port 7 on 7278 connects to the ASP's UniMAC which is not capable of ++ * receiving VLAN tagged frames at all, we can still allow the port to ++ * be configured for egress untagged. ++ */ ++ if (dev->chip_id == BCM7278_DEVICE_ID && port == 7 && ++ !(vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED)) ++ return -EINVAL; ++ + if (vlan->vid_end >= dev->num_vlans) + return -ERANGE; + diff --git a/target/linux/generic/backport-5.4/707-v5.7-0007-net-dsa-b53-Deny-enslaving-port-7-for-7278-into-a-br.patch b/target/linux/generic/backport-5.4/707-v5.7-0007-net-dsa-b53-Deny-enslaving-port-7-for-7278-into-a-br.patch new file mode 100644 index 0000000000..0cddffa363 --- /dev/null +++ b/target/linux/generic/backport-5.4/707-v5.7-0007-net-dsa-b53-Deny-enslaving-port-7-for-7278-into-a-br.patch @@ -0,0 +1,31 @@ +From 31bfc2d42cae6e8b1440fc5db3f0aba6c5d7e602 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 30 Mar 2020 14:38:49 -0700 +Subject: [PATCH] net: dsa: b53: Deny enslaving port 7 for 7278 into a bridge + +On 7278, port 7 connects to the ASP which should only receive frames +through the use of CFP rules, it is not desirable to have it be part of +a bridge at all since that would make it pick up unwanted traffic that +it may not even be able to filter or sustain. + +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/b53/b53_common.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -1770,6 +1770,12 @@ int b53_br_join(struct dsa_switch *ds, i + u16 pvlan, reg; + unsigned int i; + ++ /* On 7278, port 7 which connects to the ASP should only receive ++ * traffic from matching CFP rules. ++ */ ++ if (dev->chip_id == BCM7278_DEVICE_ID && port == 7) ++ return -EINVAL; ++ + /* Make this port leave the all VLANs join since we will have proper + * VLAN entries from now on + */ diff --git a/target/linux/generic/backport-5.4/707-v5.7-0008-net-dsa-bcm_sf2-Disable-learning-for-ASP-port.patch b/target/linux/generic/backport-5.4/707-v5.7-0008-net-dsa-bcm_sf2-Disable-learning-for-ASP-port.patch new file mode 100644 index 0000000000..c3ba9ae37a --- /dev/null +++ b/target/linux/generic/backport-5.4/707-v5.7-0008-net-dsa-bcm_sf2-Disable-learning-for-ASP-port.patch @@ -0,0 +1,36 @@ +From 8b6b208b69917d88bb3e087f8c9e61c6b05ed571 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 30 Mar 2020 14:38:50 -0700 +Subject: [PATCH] net: dsa: bcm_sf2: Disable learning for ASP port + +We don't want to enable learning for the ASP port since it only receives +directed traffic, this allows us to bypass ARL-driven forwarding rules +which could conflict with Broadcom tags and/or CFP forwarding. + +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/bcm_sf2.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +--- a/drivers/net/dsa/bcm_sf2.c ++++ b/drivers/net/dsa/bcm_sf2.c +@@ -173,9 +173,17 @@ static int bcm_sf2_port_setup(struct dsa + core_writel(priv, reg, CORE_MEM_PSM_VDD_CTRL); + + /* Enable Broadcom tags for that port if requested */ +- if (priv->brcm_tag_mask & BIT(port)) ++ if (priv->brcm_tag_mask & BIT(port)) { + b53_brcm_hdr_setup(ds, port); + ++ /* Disable learning on ASP port */ ++ if (port == 7) { ++ reg = core_readl(priv, CORE_DIS_LEARN); ++ reg |= BIT(port); ++ core_writel(priv, reg, CORE_DIS_LEARN); ++ } ++ } ++ + /* Configure Traffic Class to QoS mapping, allow each priority to map + * to a different queue number + */ diff --git a/target/linux/generic/backport-5.4/707-v5.7-0009-net-dsa-bcm_sf2-Check-earlier-for-FLOW_EXT-and-FLOW_.patch b/target/linux/generic/backport-5.4/707-v5.7-0009-net-dsa-bcm_sf2-Check-earlier-for-FLOW_EXT-and-FLOW_.patch new file mode 100644 index 0000000000..5c445ee9b9 --- /dev/null +++ b/target/linux/generic/backport-5.4/707-v5.7-0009-net-dsa-bcm_sf2-Check-earlier-for-FLOW_EXT-and-FLOW_.patch @@ -0,0 +1,33 @@ +From 5ae8c0d51ace3bdbfb89c27e7661f081cc9287de Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 30 Mar 2020 14:38:51 -0700 +Subject: [PATCH] net: dsa: bcm_sf2: Check earlier for FLOW_EXT and + FLOW_MAC_EXT + +We do not currently support matching on FLOW_EXT or FLOW_MAC_EXT, but we +were not checking for those bits being set in the flow specification. + +The check for FLOW_EXT and FLOW_MAC_EXT are separated out because a +subsequent commit will add support for matching VLAN TCI which are +covered by FLOW_EXT. + +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/bcm_sf2_cfp.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/net/dsa/bcm_sf2_cfp.c ++++ b/drivers/net/dsa/bcm_sf2_cfp.c +@@ -878,8 +878,9 @@ static int bcm_sf2_cfp_rule_set(struct d + int ret = -EINVAL; + + /* Check for unsupported extensions */ +- if ((fs->flow_type & FLOW_EXT) && (fs->m_ext.vlan_etype || +- fs->m_ext.data[1])) ++ if ((fs->flow_type & FLOW_EXT) || ++ (fs->flow_type & FLOW_MAC_EXT) || ++ fs->m_ext.data[1]) + return -EINVAL; + + if (fs->location != RX_CLS_LOC_ANY && diff --git a/target/linux/generic/backport-5.4/707-v5.7-0010-net-dsa-bcm_sf2-Move-writing-of-CFP_DATA-5-into-slic.patch b/target/linux/generic/backport-5.4/707-v5.7-0010-net-dsa-bcm_sf2-Move-writing-of-CFP_DATA-5-into-slic.patch new file mode 100644 index 0000000000..93b47aff71 --- /dev/null +++ b/target/linux/generic/backport-5.4/707-v5.7-0010-net-dsa-bcm_sf2-Move-writing-of-CFP_DATA-5-into-slic.patch @@ -0,0 +1,131 @@ +From c2d639d118d27d6419f5848675ed5c112a86910f Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 30 Mar 2020 14:38:52 -0700 +Subject: [PATCH] net: dsa: bcm_sf2: Move writing of CFP_DATA(5) into slicing + functions + +In preparation for matching VLANs, move the writing of CFP_DATA(5) into +the IPv4 and IPv6 slicing logic since they are part of the per-flow +configuration. + +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/bcm_sf2_cfp.c | 64 +++++++++++++++++------------------ + 1 file changed, 32 insertions(+), 32 deletions(-) + +--- a/drivers/net/dsa/bcm_sf2_cfp.c ++++ b/drivers/net/dsa/bcm_sf2_cfp.c +@@ -261,11 +261,20 @@ static int bcm_sf2_cfp_act_pol_set(struc + static void bcm_sf2_cfp_slice_ipv4(struct bcm_sf2_priv *priv, + struct flow_dissector_key_ipv4_addrs *addrs, + struct flow_dissector_key_ports *ports, +- unsigned int slice_num, ++ unsigned int slice_num, u8 num_udf, + bool mask) + { + u32 reg, offset; + ++ /* UDF_Valid[7:0] [31:24] ++ * S-Tag [23:8] ++ * C-Tag [7:0] ++ */ ++ if (mask) ++ core_writel(priv, udf_lower_bits(num_udf) << 24, CORE_CFP_MASK_PORT(5)); ++ else ++ core_writel(priv, udf_lower_bits(num_udf) << 24, CORE_CFP_DATA_PORT(5)); ++ + /* C-Tag [31:24] + * UDF_n_A8 [23:8] + * UDF_n_A7 [7:0] +@@ -421,18 +430,11 @@ static int bcm_sf2_cfp_ipv4_rule_set(str + core_writel(priv, layout->udfs[slice_num].mask_value | + udf_upper_bits(num_udf), CORE_CFP_MASK_PORT(6)); + +- /* UDF_Valid[7:0] [31:24] +- * S-Tag [23:8] +- * C-Tag [7:0] +- */ +- core_writel(priv, udf_lower_bits(num_udf) << 24, CORE_CFP_DATA_PORT(5)); +- +- /* Mask all but valid UDFs */ +- core_writel(priv, udf_lower_bits(num_udf) << 24, CORE_CFP_MASK_PORT(5)); +- + /* Program the match and the mask */ +- bcm_sf2_cfp_slice_ipv4(priv, ipv4.key, ports.key, slice_num, false); +- bcm_sf2_cfp_slice_ipv4(priv, ipv4.mask, ports.mask, SLICE_NUM_MASK, true); ++ bcm_sf2_cfp_slice_ipv4(priv, ipv4.key, ports.key, slice_num, ++ num_udf, false); ++ bcm_sf2_cfp_slice_ipv4(priv, ipv4.mask, ports.mask, SLICE_NUM_MASK, ++ num_udf, true); + + /* Insert into TCAM now */ + bcm_sf2_cfp_rule_addr_set(priv, rule_index); +@@ -468,11 +470,20 @@ out_err_flow_rule: + + static void bcm_sf2_cfp_slice_ipv6(struct bcm_sf2_priv *priv, + const __be32 *ip6_addr, const __be16 port, +- unsigned int slice_num, ++ unsigned int slice_num, u32 udf_bits, + bool mask) + { + u32 reg, tmp, val, offset; + ++ /* UDF_Valid[7:0] [31:24] ++ * S-Tag [23:8] ++ * C-Tag [7:0] ++ */ ++ if (mask) ++ core_writel(priv, udf_bits << 24, CORE_CFP_MASK_PORT(5)); ++ else ++ core_writel(priv, udf_bits << 24, CORE_CFP_DATA_PORT(5)); ++ + /* C-Tag [31:24] + * UDF_n_B8 [23:8] (port) + * UDF_n_B7 (upper) [7:0] (addr[15:8]) +@@ -704,20 +715,13 @@ static int bcm_sf2_cfp_ipv6_rule_set(str + reg = layout->udfs[slice_num].mask_value | udf_upper_bits(num_udf); + core_writel(priv, reg, CORE_CFP_MASK_PORT(6)); + +- /* UDF_Valid[7:0] [31:24] +- * S-Tag [23:8] +- * C-Tag [7:0] +- */ +- core_writel(priv, udf_lower_bits(num_udf) << 24, CORE_CFP_DATA_PORT(5)); +- +- /* Mask all but valid UDFs */ +- core_writel(priv, udf_lower_bits(num_udf) << 24, CORE_CFP_MASK_PORT(5)); +- + /* Slice the IPv6 source address and port */ + bcm_sf2_cfp_slice_ipv6(priv, ipv6.key->src.in6_u.u6_addr32, +- ports.key->src, slice_num, false); ++ ports.key->src, slice_num, ++ udf_lower_bits(num_udf), false); + bcm_sf2_cfp_slice_ipv6(priv, ipv6.mask->src.in6_u.u6_addr32, +- ports.mask->src, SLICE_NUM_MASK, true); ++ ports.mask->src, SLICE_NUM_MASK, ++ udf_lower_bits(num_udf), true); + + /* Insert into TCAM now because we need to insert a second rule */ + bcm_sf2_cfp_rule_addr_set(priv, rule_index[0]); +@@ -768,16 +772,12 @@ static int bcm_sf2_cfp_ipv6_rule_set(str + udf_lower_bits(num_udf) << 8; + core_writel(priv, reg, CORE_CFP_MASK_PORT(6)); + +- /* Don't care */ +- core_writel(priv, 0, CORE_CFP_DATA_PORT(5)); +- +- /* Mask all */ +- core_writel(priv, 0, CORE_CFP_MASK_PORT(5)); +- + bcm_sf2_cfp_slice_ipv6(priv, ipv6.key->dst.in6_u.u6_addr32, +- ports.key->dst, slice_num, false); ++ ports.key->dst, slice_num, ++ 0, false); + bcm_sf2_cfp_slice_ipv6(priv, ipv6.mask->dst.in6_u.u6_addr32, +- ports.key->dst, SLICE_NUM_MASK, true); ++ ports.key->dst, SLICE_NUM_MASK, ++ 0, true); + + /* Insert into TCAM now */ + bcm_sf2_cfp_rule_addr_set(priv, rule_index[1]); diff --git a/target/linux/generic/backport-5.4/707-v5.7-0011-net-dsa-bcm_sf2-Add-support-for-matching-VLAN-TCI.patch b/target/linux/generic/backport-5.4/707-v5.7-0011-net-dsa-bcm_sf2-Add-support-for-matching-VLAN-TCI.patch new file mode 100644 index 0000000000..71de609870 --- /dev/null +++ b/target/linux/generic/backport-5.4/707-v5.7-0011-net-dsa-bcm_sf2-Add-support-for-matching-VLAN-TCI.patch @@ -0,0 +1,181 @@ +From 7555020c44db75a0d934dffc0aa6c678b52b2a13 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 30 Mar 2020 14:38:53 -0700 +Subject: [PATCH] net: dsa: bcm_sf2: Add support for matching VLAN TCI + +Update relevant code paths to support the programming and matching of +VLAN TCI, this is the only member of the ethtool_flow_ext that we can +match, the switch does not permit matching the VLAN Ethernet Type field. + +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/bcm_sf2_cfp.c | 53 +++++++++++++++++++++++++---------- + 1 file changed, 38 insertions(+), 15 deletions(-) + +--- a/drivers/net/dsa/bcm_sf2_cfp.c ++++ b/drivers/net/dsa/bcm_sf2_cfp.c +@@ -261,6 +261,7 @@ static int bcm_sf2_cfp_act_pol_set(struc + static void bcm_sf2_cfp_slice_ipv4(struct bcm_sf2_priv *priv, + struct flow_dissector_key_ipv4_addrs *addrs, + struct flow_dissector_key_ports *ports, ++ const __be16 vlan_tci, + unsigned int slice_num, u8 num_udf, + bool mask) + { +@@ -270,16 +271,17 @@ static void bcm_sf2_cfp_slice_ipv4(struc + * S-Tag [23:8] + * C-Tag [7:0] + */ ++ reg = udf_lower_bits(num_udf) << 24 | be16_to_cpu(vlan_tci) >> 8; + if (mask) +- core_writel(priv, udf_lower_bits(num_udf) << 24, CORE_CFP_MASK_PORT(5)); ++ core_writel(priv, reg, CORE_CFP_MASK_PORT(5)); + else +- core_writel(priv, udf_lower_bits(num_udf) << 24, CORE_CFP_DATA_PORT(5)); ++ core_writel(priv, reg, CORE_CFP_DATA_PORT(5)); + + /* C-Tag [31:24] + * UDF_n_A8 [23:8] + * UDF_n_A7 [7:0] + */ +- reg = 0; ++ reg = (u32)(be16_to_cpu(vlan_tci) & 0xff) << 24; + if (mask) + offset = CORE_CFP_MASK_PORT(4); + else +@@ -345,6 +347,7 @@ static int bcm_sf2_cfp_ipv4_rule_set(str + struct ethtool_rx_flow_spec *fs) + { + struct ethtool_rx_flow_spec_input input = {}; ++ __be16 vlan_tci = 0 , vlan_m_tci = 0xffff; + const struct cfp_udf_layout *layout; + unsigned int slice_num, rule_index; + struct ethtool_rx_flow_rule *flow; +@@ -369,6 +372,12 @@ static int bcm_sf2_cfp_ipv4_rule_set(str + + ip_frag = !!(be32_to_cpu(fs->h_ext.data[0]) & 1); + ++ /* Extract VLAN TCI */ ++ if (fs->flow_type & FLOW_EXT) { ++ vlan_tci = fs->h_ext.vlan_tci; ++ vlan_m_tci = fs->m_ext.vlan_tci; ++ } ++ + /* Locate the first rule available */ + if (fs->location == RX_CLS_LOC_ANY) + rule_index = find_first_zero_bit(priv->cfp.used, +@@ -431,10 +440,10 @@ static int bcm_sf2_cfp_ipv4_rule_set(str + udf_upper_bits(num_udf), CORE_CFP_MASK_PORT(6)); + + /* Program the match and the mask */ +- bcm_sf2_cfp_slice_ipv4(priv, ipv4.key, ports.key, slice_num, +- num_udf, false); +- bcm_sf2_cfp_slice_ipv4(priv, ipv4.mask, ports.mask, SLICE_NUM_MASK, +- num_udf, true); ++ bcm_sf2_cfp_slice_ipv4(priv, ipv4.key, ports.key, vlan_tci, ++ slice_num, num_udf, false); ++ bcm_sf2_cfp_slice_ipv4(priv, ipv4.mask, ports.mask, vlan_m_tci, ++ SLICE_NUM_MASK, num_udf, true); + + /* Insert into TCAM now */ + bcm_sf2_cfp_rule_addr_set(priv, rule_index); +@@ -470,6 +479,7 @@ out_err_flow_rule: + + static void bcm_sf2_cfp_slice_ipv6(struct bcm_sf2_priv *priv, + const __be32 *ip6_addr, const __be16 port, ++ const __be16 vlan_tci, + unsigned int slice_num, u32 udf_bits, + bool mask) + { +@@ -479,10 +489,11 @@ static void bcm_sf2_cfp_slice_ipv6(struc + * S-Tag [23:8] + * C-Tag [7:0] + */ ++ reg = udf_bits << 24 | be16_to_cpu(vlan_tci) >> 8; + if (mask) +- core_writel(priv, udf_bits << 24, CORE_CFP_MASK_PORT(5)); ++ core_writel(priv, reg, CORE_CFP_MASK_PORT(5)); + else +- core_writel(priv, udf_bits << 24, CORE_CFP_DATA_PORT(5)); ++ core_writel(priv, reg, CORE_CFP_DATA_PORT(5)); + + /* C-Tag [31:24] + * UDF_n_B8 [23:8] (port) +@@ -490,6 +501,7 @@ static void bcm_sf2_cfp_slice_ipv6(struc + */ + reg = be32_to_cpu(ip6_addr[3]); + val = (u32)be16_to_cpu(port) << 8 | ((reg >> 8) & 0xff); ++ val |= (u32)(be16_to_cpu(vlan_tci) & 0xff) << 24; + if (mask) + offset = CORE_CFP_MASK_PORT(4); + else +@@ -598,6 +610,11 @@ static int bcm_sf2_cfp_rule_cmp(struct b + + ret = memcmp(&rule->fs.h_u, &fs->h_u, fs_size); + ret |= memcmp(&rule->fs.m_u, &fs->m_u, fs_size); ++ /* Compare VLAN TCI values as well */ ++ if (rule->fs.flow_type & FLOW_EXT) { ++ ret |= rule->fs.h_ext.vlan_tci != fs->h_ext.vlan_tci; ++ ret |= rule->fs.m_ext.vlan_tci != fs->m_ext.vlan_tci; ++ } + if (ret == 0) + break; + } +@@ -611,6 +628,7 @@ static int bcm_sf2_cfp_ipv6_rule_set(str + struct ethtool_rx_flow_spec *fs) + { + struct ethtool_rx_flow_spec_input input = {}; ++ __be16 vlan_tci = 0, vlan_m_tci = 0xffff; + unsigned int slice_num, rule_index[2]; + const struct cfp_udf_layout *layout; + struct ethtool_rx_flow_rule *flow; +@@ -634,6 +652,12 @@ static int bcm_sf2_cfp_ipv6_rule_set(str + + ip_frag = !!(be32_to_cpu(fs->h_ext.data[0]) & 1); + ++ /* Extract VLAN TCI */ ++ if (fs->flow_type & FLOW_EXT) { ++ vlan_tci = fs->h_ext.vlan_tci; ++ vlan_m_tci = fs->m_ext.vlan_tci; ++ } ++ + layout = &udf_tcpip6_layout; + slice_num = bcm_sf2_get_slice_number(layout, 0); + if (slice_num == UDF_NUM_SLICES) +@@ -717,10 +741,10 @@ static int bcm_sf2_cfp_ipv6_rule_set(str + + /* Slice the IPv6 source address and port */ + bcm_sf2_cfp_slice_ipv6(priv, ipv6.key->src.in6_u.u6_addr32, +- ports.key->src, slice_num, ++ ports.key->src, vlan_tci, slice_num, + udf_lower_bits(num_udf), false); + bcm_sf2_cfp_slice_ipv6(priv, ipv6.mask->src.in6_u.u6_addr32, +- ports.mask->src, SLICE_NUM_MASK, ++ ports.mask->src, vlan_m_tci, SLICE_NUM_MASK, + udf_lower_bits(num_udf), true); + + /* Insert into TCAM now because we need to insert a second rule */ +@@ -773,10 +797,10 @@ static int bcm_sf2_cfp_ipv6_rule_set(str + core_writel(priv, reg, CORE_CFP_MASK_PORT(6)); + + bcm_sf2_cfp_slice_ipv6(priv, ipv6.key->dst.in6_u.u6_addr32, +- ports.key->dst, slice_num, ++ ports.key->dst, 0, slice_num, + 0, false); + bcm_sf2_cfp_slice_ipv6(priv, ipv6.mask->dst.in6_u.u6_addr32, +- ports.key->dst, SLICE_NUM_MASK, ++ ports.key->dst, 0, SLICE_NUM_MASK, + 0, true); + + /* Insert into TCAM now */ +@@ -878,8 +902,7 @@ static int bcm_sf2_cfp_rule_set(struct d + int ret = -EINVAL; + + /* Check for unsupported extensions */ +- if ((fs->flow_type & FLOW_EXT) || +- (fs->flow_type & FLOW_MAC_EXT) || ++ if ((fs->flow_type & FLOW_MAC_EXT) || + fs->m_ext.data[1]) + return -EINVAL; + diff --git a/target/linux/generic/backport-5.4/707-v5.7-0012-net-dsa-bcm_sf2-Support-specifying-VLAN-tag-egress-r.patch b/target/linux/generic/backport-5.4/707-v5.7-0012-net-dsa-bcm_sf2-Support-specifying-VLAN-tag-egress-r.patch new file mode 100644 index 0000000000..174d76c7e6 --- /dev/null +++ b/target/linux/generic/backport-5.4/707-v5.7-0012-net-dsa-bcm_sf2-Support-specifying-VLAN-tag-egress-r.patch @@ -0,0 +1,94 @@ +From 8b3abe304c5f1057b7bac70fd5576dfa67e3e2b3 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 30 Mar 2020 14:38:54 -0700 +Subject: [PATCH] net: dsa: bcm_sf2: Support specifying VLAN tag egress rule + +The port to which the ASP is connected on 7278 is not capable of +processing VLAN tags as part of the Ethernet frame, so allow an user to +configure the egress VLAN policy they want to see applied by purposing +the h_ext.data[1] field. Bit 0 is used to indicate that 0=tagged, +1=untagged. + +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/bcm_sf2_cfp.c | 40 +++++++++++++++++++++++++++++++++-- + 1 file changed, 38 insertions(+), 2 deletions(-) + +--- a/drivers/net/dsa/bcm_sf2_cfp.c ++++ b/drivers/net/dsa/bcm_sf2_cfp.c +@@ -13,6 +13,8 @@ + #include + #include + #include ++#include ++#include + + #include "bcm_sf2.h" + #include "bcm_sf2_regs.h" +@@ -847,7 +849,9 @@ static int bcm_sf2_cfp_rule_insert(struc + struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); + s8 cpu_port = ds->ports[port].cpu_dp->index; + __u64 ring_cookie = fs->ring_cookie; ++ struct switchdev_obj_port_vlan vlan; + unsigned int queue_num, port_num; ++ u16 vid; + int ret; + + /* This rule is a Wake-on-LAN filter and we must specifically +@@ -867,6 +871,34 @@ static int bcm_sf2_cfp_rule_insert(struc + dsa_is_cpu_port(ds, port_num)) || + port_num >= priv->hw_params.num_ports) + return -EINVAL; ++ ++ /* If the rule is matching a particular VLAN, make sure that we honor ++ * the matching and have it tagged or untagged on the destination port, ++ * we do this on egress with a VLAN entry. The egress tagging attribute ++ * is expected to be provided in h_ext.data[1] bit 0. A 1 means untagged, ++ * a 0 means tagged. ++ */ ++ if (fs->flow_type & FLOW_EXT) { ++ /* We cannot support matching multiple VLAN IDs yet */ ++ if ((be16_to_cpu(fs->m_ext.vlan_tci) & VLAN_VID_MASK) != ++ VLAN_VID_MASK) ++ return -EINVAL; ++ ++ vid = be16_to_cpu(fs->h_ext.vlan_tci) & VLAN_VID_MASK; ++ vlan.vid_begin = vid; ++ vlan.vid_end = vid; ++ if (cpu_to_be32(fs->h_ext.data[1]) & 1) ++ vlan.flags = BRIDGE_VLAN_INFO_UNTAGGED; ++ else ++ vlan.flags = 0; ++ ++ ret = ds->ops->port_vlan_prepare(ds, port_num, &vlan); ++ if (ret) ++ return ret; ++ ++ ds->ops->port_vlan_add(ds, port_num, &vlan); ++ } ++ + /* + * We have a small oddity where Port 6 just does not have a + * valid bit here (so we substract by one). +@@ -902,14 +934,18 @@ static int bcm_sf2_cfp_rule_set(struct d + int ret = -EINVAL; + + /* Check for unsupported extensions */ +- if ((fs->flow_type & FLOW_MAC_EXT) || +- fs->m_ext.data[1]) ++ if (fs->flow_type & FLOW_MAC_EXT) + return -EINVAL; + + if (fs->location != RX_CLS_LOC_ANY && + fs->location > bcm_sf2_cfp_rule_size(priv)) + return -EINVAL; + ++ if ((fs->flow_type & FLOW_EXT) && ++ !(ds->ops->port_vlan_prepare || ds->ops->port_vlan_add || ++ ds->ops->port_vlan_del)) ++ return -EOPNOTSUPP; ++ + if (fs->location != RX_CLS_LOC_ANY && + test_bit(fs->location, priv->cfp.used)) + return -EBUSY; diff --git a/target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch b/target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch index 8225ca1d29..f77aee1a87 100644 --- a/target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch +++ b/target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch @@ -20,7 +20,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c -@@ -1577,7 +1577,6 @@ static int b53_arl_op(struct b53_device +@@ -1600,7 +1600,6 @@ static int b53_arl_op(struct b53_device ent.is_valid = !!(ent.port); } 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 6fc9a1643e..b25f3c0d11 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 -@@ -1297,7 +1297,9 @@ EXPORT_SYMBOL(b53_phylink_mac_link_down) +@@ -1312,7 +1312,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 -@@ -653,7 +653,9 @@ static void bcm_sf2_sw_mac_link_down(str +@@ -661,7 +661,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, From 50d255d4a8e8a89ce4b593b3c6b5c4484798553b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 7 Dec 2022 09:57:47 +0100 Subject: [PATCH 116/137] kernel: backport b53/bcm_sf2 changes from v5.8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki --- ...b53-Use-dev_-err-info-instead-of-pr_.patch | 4 +- ...-support-BCM4908-s-integrated-switch.patch | 2 +- ...b53-per-port-interrupts-are-optional.patch | 25 ++ ...name-num_arl_entries-to-num_arl_bins.patch | 255 ++++++++++++++++++ ...sa-b53-Provide-number-of-ARL-buckets.patch | 198 ++++++++++++++ ...net-dsa-b53-Bound-check-ARL-searches.patch | 43 +++ ...ve-is_static-argument-to-b53_read_op.patch | 36 +++ ...ve-redundant-premature-assignment-to.patch | 28 ++ ...e-resolved-link-config-via-mac_link_.patch | 2 +- 9 files changed, 589 insertions(+), 4 deletions(-) create mode 100644 target/linux/generic/backport-5.4/709-v5.8-0001-net-dsa-b53-per-port-interrupts-are-optional.patch create mode 100644 target/linux/generic/backport-5.4/709-v5.8-0002-net-dsa-b53-Rename-num_arl_entries-to-num_arl_bins.patch create mode 100644 target/linux/generic/backport-5.4/709-v5.8-0003-net-dsa-b53-Provide-number-of-ARL-buckets.patch create mode 100644 target/linux/generic/backport-5.4/709-v5.8-0004-net-dsa-b53-Bound-check-ARL-searches.patch create mode 100644 target/linux/generic/backport-5.4/709-v5.8-0005-net-dsa-b53-Remove-is_static-argument-to-b53_read_op.patch create mode 100644 target/linux/generic/backport-5.4/709-v5.8-0006-net-dsa-b53-remove-redundant-premature-assignment-to.patch diff --git a/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch b/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch index 776cf4a1f2..83a9b9345f 100644 --- a/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch +++ b/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch @@ -26,7 +26,7 @@ Signed-off-by: David S. Miller #include #include #include -@@ -2596,8 +2594,9 @@ int b53_switch_detect(struct b53_device +@@ -2616,8 +2614,9 @@ int b53_switch_detect(struct b53_device dev->chip_id = id32; break; default: @@ -38,7 +38,7 @@ Signed-off-by: David S. Miller return -ENODEV; } } -@@ -2627,7 +2626,8 @@ int b53_switch_register(struct b53_devic +@@ -2647,7 +2646,8 @@ int b53_switch_register(struct b53_devic if (ret) return ret; diff --git a/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch b/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch index 531388da70..5c698a342f 100644 --- a/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch +++ b/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch @@ -23,7 +23,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c -@@ -2392,6 +2392,22 @@ static const struct b53_chip_data b53_sw +@@ -2409,6 +2409,22 @@ static const struct b53_chip_data b53_sw .jumbo_pm_reg = B53_JUMBO_PORT_MASK, .jumbo_size_reg = B53_JUMBO_MAX_SIZE, }, diff --git a/target/linux/generic/backport-5.4/709-v5.8-0001-net-dsa-b53-per-port-interrupts-are-optional.patch b/target/linux/generic/backport-5.4/709-v5.8-0001-net-dsa-b53-per-port-interrupts-are-optional.patch new file mode 100644 index 0000000000..ee1c883585 --- /dev/null +++ b/target/linux/generic/backport-5.4/709-v5.8-0001-net-dsa-b53-per-port-interrupts-are-optional.patch @@ -0,0 +1,25 @@ +From 007fc3c0ca478f3a8ad687cf9ecbe672d3a64700 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Fri, 17 Apr 2020 11:33:41 -0700 +Subject: [PATCH] net: dsa: b53: per-port interrupts are optional + +Make use of platform_get_irq_byname_optional() to avoid printing +messages on the kernel console that interrupts cannot be found. + +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/b53/b53_srab.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/dsa/b53/b53_srab.c ++++ b/drivers/net/dsa/b53/b53_srab.c +@@ -524,7 +524,7 @@ static void b53_srab_prepare_irq(struct + + port->num = i; + port->dev = dev; +- port->irq = platform_get_irq_byname(pdev, name); ++ port->irq = platform_get_irq_byname_optional(pdev, name); + kfree(name); + } + diff --git a/target/linux/generic/backport-5.4/709-v5.8-0002-net-dsa-b53-Rename-num_arl_entries-to-num_arl_bins.patch b/target/linux/generic/backport-5.4/709-v5.8-0002-net-dsa-b53-Rename-num_arl_entries-to-num_arl_bins.patch new file mode 100644 index 0000000000..7b566ddb6c --- /dev/null +++ b/target/linux/generic/backport-5.4/709-v5.8-0002-net-dsa-b53-Rename-num_arl_entries-to-num_arl_bins.patch @@ -0,0 +1,255 @@ +From 673e69a67dd63fc3b40f109d1677a5dc72185fbb Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Thu, 30 Apr 2020 11:49:08 -0700 +Subject: [PATCH] net: dsa: b53: Rename num_arl_entries to num_arl_bins + +The variable currently holds the number of ARL bins per ARL buckets, +which is different from the number of ARL entries which would be bins +times buckets. We will be adding a num_arl_buckets in a subsequent patch +so get variables straight now. + +Signed-off-by: Florian Fainelli +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/b53/b53_common.c | 52 ++++++++++++++++---------------- + drivers/net/dsa/b53/b53_priv.h | 2 +- + 2 files changed, 27 insertions(+), 27 deletions(-) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -1506,10 +1506,10 @@ static int b53_arl_read(struct b53_devic + if (ret) + return ret; + +- bitmap_zero(free_bins, dev->num_arl_entries); ++ bitmap_zero(free_bins, dev->num_arl_bins); + + /* Read the bins */ +- for (i = 0; i < dev->num_arl_entries; i++) { ++ for (i = 0; i < dev->num_arl_bins; i++) { + u64 mac_vid; + u32 fwd_entry; + +@@ -1532,10 +1532,10 @@ static int b53_arl_read(struct b53_devic + return 0; + } + +- if (bitmap_weight(free_bins, dev->num_arl_entries) == 0) ++ if (bitmap_weight(free_bins, dev->num_arl_bins) == 0) + return -ENOSPC; + +- *idx = find_first_bit(free_bins, dev->num_arl_entries); ++ *idx = find_first_bit(free_bins, dev->num_arl_bins); + + return -ENOENT; + } +@@ -1705,7 +1705,7 @@ int b53_fdb_dump(struct dsa_switch *ds, + if (ret) + return ret; + +- if (priv->num_arl_entries > 2) { ++ if (priv->num_arl_bins > 2) { + b53_arl_search_rd(priv, 1, &results[1]); + ret = b53_fdb_copy(port, &results[1], cb, data); + if (ret) +@@ -2179,7 +2179,7 @@ struct b53_chip_data { + u16 enabled_ports; + u8 cpu_port; + u8 vta_regs[3]; +- u8 arl_entries; ++ u8 arl_bins; + u8 duplex_reg; + u8 jumbo_pm_reg; + u8 jumbo_size_reg; +@@ -2198,7 +2198,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM5325", + .vlans = 16, + .enabled_ports = 0x1f, +- .arl_entries = 2, ++ .arl_bins = 2, + .cpu_port = B53_CPU_PORT_25, + .duplex_reg = B53_DUPLEX_STAT_FE, + }, +@@ -2207,7 +2207,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM5365", + .vlans = 256, + .enabled_ports = 0x1f, +- .arl_entries = 2, ++ .arl_bins = 2, + .cpu_port = B53_CPU_PORT_25, + .duplex_reg = B53_DUPLEX_STAT_FE, + }, +@@ -2216,7 +2216,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM5389", + .vlans = 4096, + .enabled_ports = 0x1f, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2228,7 +2228,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM5395", + .vlans = 4096, + .enabled_ports = 0x1f, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2240,7 +2240,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM5397", + .vlans = 4096, + .enabled_ports = 0x1f, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS_9798, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2252,7 +2252,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM5398", + .vlans = 4096, + .enabled_ports = 0x7f, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS_9798, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2264,7 +2264,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM53115", + .vlans = 4096, + .enabled_ports = 0x1f, +- .arl_entries = 4, ++ .arl_bins = 4, + .vta_regs = B53_VTA_REGS, + .cpu_port = B53_CPU_PORT, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2276,7 +2276,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM53125", + .vlans = 4096, + .enabled_ports = 0xff, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2288,7 +2288,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM53128", + .vlans = 4096, + .enabled_ports = 0x1ff, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2300,7 +2300,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM63xx", + .vlans = 4096, + .enabled_ports = 0, /* pdata must provide them */ +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS_63XX, + .duplex_reg = B53_DUPLEX_STAT_63XX, +@@ -2312,7 +2312,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM53010", + .vlans = 4096, + .enabled_ports = 0x1f, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */ + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2324,7 +2324,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM53011", + .vlans = 4096, + .enabled_ports = 0x1bf, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */ + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2336,7 +2336,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM53012", + .vlans = 4096, + .enabled_ports = 0x1bf, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */ + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2348,7 +2348,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM53018", + .vlans = 4096, + .enabled_ports = 0x1f, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */ + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2360,7 +2360,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM53019", + .vlans = 4096, + .enabled_ports = 0x1f, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */ + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2372,7 +2372,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM585xx/586xx/88312", + .vlans = 4096, + .enabled_ports = 0x1ff, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2384,7 +2384,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM583xx/11360", + .vlans = 4096, + .enabled_ports = 0x103, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2396,7 +2396,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM7445", + .vlans = 4096, + .enabled_ports = 0x1ff, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2408,7 +2408,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM7278", + .vlans = 4096, + .enabled_ports = 0x1ff, +- .arl_entries= 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2436,7 +2436,7 @@ static int b53_switch_init(struct b53_de + dev->jumbo_pm_reg = chip->jumbo_pm_reg; + dev->cpu_port = chip->cpu_port; + dev->num_vlans = chip->vlans; +- dev->num_arl_entries = chip->arl_entries; ++ dev->num_arl_bins = chip->arl_bins; + break; + } + } +--- a/drivers/net/dsa/b53/b53_priv.h ++++ b/drivers/net/dsa/b53/b53_priv.h +@@ -117,7 +117,7 @@ struct b53_device { + u8 jumbo_pm_reg; + u8 jumbo_size_reg; + int reset_gpio; +- u8 num_arl_entries; ++ u8 num_arl_bins; + enum dsa_tag_protocol tag_protocol; + + /* used ports mask */ diff --git a/target/linux/generic/backport-5.4/709-v5.8-0003-net-dsa-b53-Provide-number-of-ARL-buckets.patch b/target/linux/generic/backport-5.4/709-v5.8-0003-net-dsa-b53-Provide-number-of-ARL-buckets.patch new file mode 100644 index 0000000000..3c278d4a54 --- /dev/null +++ b/target/linux/generic/backport-5.4/709-v5.8-0003-net-dsa-b53-Provide-number-of-ARL-buckets.patch @@ -0,0 +1,198 @@ +From e3da4038f4ca1094596a7604c6edac4a6a4f6ee9 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Thu, 30 Apr 2020 11:49:09 -0700 +Subject: [PATCH] net: dsa: b53: Provide number of ARL buckets + +In preparation for doing proper upper bound checking of FDB/MDB entries +being added to the ARL, provide the number of ARL buckets for each +switch chip we support. All chips have 1024 buckets, except 7278 which +has only 256. + +Signed-off-by: Florian Fainelli +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/b53/b53_common.c | 21 +++++++++++++++++++++ + drivers/net/dsa/b53/b53_priv.h | 1 + + 2 files changed, 22 insertions(+) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -2180,6 +2180,7 @@ struct b53_chip_data { + u8 cpu_port; + u8 vta_regs[3]; + u8 arl_bins; ++ u16 arl_buckets; + u8 duplex_reg; + u8 jumbo_pm_reg; + u8 jumbo_size_reg; +@@ -2199,6 +2200,7 @@ static const struct b53_chip_data b53_sw + .vlans = 16, + .enabled_ports = 0x1f, + .arl_bins = 2, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT_25, + .duplex_reg = B53_DUPLEX_STAT_FE, + }, +@@ -2208,6 +2210,7 @@ static const struct b53_chip_data b53_sw + .vlans = 256, + .enabled_ports = 0x1f, + .arl_bins = 2, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT_25, + .duplex_reg = B53_DUPLEX_STAT_FE, + }, +@@ -2217,6 +2220,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x1f, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2229,6 +2233,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x1f, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2241,6 +2246,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x1f, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS_9798, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2253,6 +2259,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x7f, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS_9798, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2265,6 +2272,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x1f, + .arl_bins = 4, ++ .arl_buckets = 1024, + .vta_regs = B53_VTA_REGS, + .cpu_port = B53_CPU_PORT, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2277,6 +2285,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0xff, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2289,6 +2298,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x1ff, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2301,6 +2311,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0, /* pdata must provide them */ + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS_63XX, + .duplex_reg = B53_DUPLEX_STAT_63XX, +@@ -2313,6 +2324,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x1f, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */ + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2325,6 +2337,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x1bf, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */ + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2337,6 +2350,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x1bf, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */ + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2349,6 +2363,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x1f, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */ + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2361,6 +2376,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x1f, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */ + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2373,6 +2389,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x1ff, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2385,6 +2402,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x103, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2397,6 +2415,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x1ff, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2409,6 +2428,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x1ff, + .arl_bins = 4, ++ .arl_buckets = 256, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2437,6 +2457,7 @@ static int b53_switch_init(struct b53_de + dev->cpu_port = chip->cpu_port; + dev->num_vlans = chip->vlans; + dev->num_arl_bins = chip->arl_bins; ++ dev->num_arl_buckets = chip->arl_buckets; + break; + } + } +--- a/drivers/net/dsa/b53/b53_priv.h ++++ b/drivers/net/dsa/b53/b53_priv.h +@@ -118,6 +118,7 @@ struct b53_device { + u8 jumbo_size_reg; + int reset_gpio; + u8 num_arl_bins; ++ u16 num_arl_buckets; + enum dsa_tag_protocol tag_protocol; + + /* used ports mask */ diff --git a/target/linux/generic/backport-5.4/709-v5.8-0004-net-dsa-b53-Bound-check-ARL-searches.patch b/target/linux/generic/backport-5.4/709-v5.8-0004-net-dsa-b53-Bound-check-ARL-searches.patch new file mode 100644 index 0000000000..8faf2ace82 --- /dev/null +++ b/target/linux/generic/backport-5.4/709-v5.8-0004-net-dsa-b53-Bound-check-ARL-searches.patch @@ -0,0 +1,43 @@ +From cd169d799beeb738fa2d3e891960924cdcaf8414 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Thu, 30 Apr 2020 11:49:10 -0700 +Subject: [PATCH] net: dsa: b53: Bound check ARL searches + +ARL searches are done by reading two ARL entries at a time, do not cap +the search at 1024 which would only limit us to half of the possible ARL +capacity, but use b53_max_arl_entries() instead which does the right +multiplication between bins and indexes. + +Signed-off-by: Florian Fainelli +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/b53/b53_common.c | 2 +- + drivers/net/dsa/b53/b53_priv.h | 5 +++++ + 2 files changed, 6 insertions(+), 1 deletion(-) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -1715,7 +1715,7 @@ int b53_fdb_dump(struct dsa_switch *ds, + break; + } + +- } while (count++ < 1024); ++ } while (count++ < b53_max_arl_entries(priv) / 2); + + return 0; + } +--- a/drivers/net/dsa/b53/b53_priv.h ++++ b/drivers/net/dsa/b53/b53_priv.h +@@ -213,6 +213,11 @@ static inline int is58xx(struct b53_devi + #define B53_CPU_PORT_25 5 + #define B53_CPU_PORT 8 + ++static inline unsigned int b53_max_arl_entries(struct b53_device *dev) ++{ ++ return dev->num_arl_buckets * dev->num_arl_bins; ++} ++ + struct b53_device *b53_switch_alloc(struct device *base, + const struct b53_io_ops *ops, + void *priv); diff --git a/target/linux/generic/backport-5.4/709-v5.8-0005-net-dsa-b53-Remove-is_static-argument-to-b53_read_op.patch b/target/linux/generic/backport-5.4/709-v5.8-0005-net-dsa-b53-Remove-is_static-argument-to-b53_read_op.patch new file mode 100644 index 0000000000..e4dad7d924 --- /dev/null +++ b/target/linux/generic/backport-5.4/709-v5.8-0005-net-dsa-b53-Remove-is_static-argument-to-b53_read_op.patch @@ -0,0 +1,36 @@ +From ef2a0bd99b1549a3a4253355be247d5dff25d720 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Thu, 30 Apr 2020 11:49:11 -0700 +Subject: [PATCH] net: dsa: b53: Remove is_static argument to b53_read_op() + +This argument is not used. + +Signed-off-by: Florian Fainelli +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/b53/b53_common.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -1495,8 +1495,7 @@ static int b53_arl_rw_op(struct b53_devi + } + + static int b53_arl_read(struct b53_device *dev, u64 mac, +- u16 vid, struct b53_arl_entry *ent, u8 *idx, +- bool is_valid) ++ u16 vid, struct b53_arl_entry *ent, u8 *idx) + { + DECLARE_BITMAP(free_bins, B53_ARLTBL_MAX_BIN_ENTRIES); + unsigned int i; +@@ -1561,7 +1560,8 @@ static int b53_arl_op(struct b53_device + if (ret) + return ret; + +- ret = b53_arl_read(dev, mac, vid, &ent, &idx, is_valid); ++ ret = b53_arl_read(dev, mac, vid, &ent, &idx); ++ + /* If this is a read, just finish now */ + if (op) + return ret; diff --git a/target/linux/generic/backport-5.4/709-v5.8-0006-net-dsa-b53-remove-redundant-premature-assignment-to.patch b/target/linux/generic/backport-5.4/709-v5.8-0006-net-dsa-b53-remove-redundant-premature-assignment-to.patch new file mode 100644 index 0000000000..1360aa4631 --- /dev/null +++ b/target/linux/generic/backport-5.4/709-v5.8-0006-net-dsa-b53-remove-redundant-premature-assignment-to.patch @@ -0,0 +1,28 @@ +From 9f01a71c5cbec10b851588457089d17c20dc5a40 Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Wed, 27 May 2020 13:01:29 +0100 +Subject: [PATCH] net: dsa: b53: remove redundant premature assignment to + new_pvid + +Variable new_pvid is being assigned with a value that is never read, +the following if statement updates new_pvid with a new value in both +of the if paths. The assignment is redundant and can be removed. + +Addresses-Coverity: ("Unused value") +Signed-off-by: Colin Ian King +Acked-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/b53/b53_common.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -1336,7 +1336,6 @@ int b53_vlan_filtering(struct dsa_switch + u16 pvid, new_pvid; + + b53_read16(dev, B53_VLAN_PAGE, B53_VLAN_PORT_DEF_TAG(port), &pvid); +- new_pvid = pvid; + if (!vlan_filtering) { + /* Filtering is currently enabled, use the default PVID since + * the bridge does not expect tagging anymore 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 b25f3c0d11..dbba2f65a2 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 @@ -25,7 +25,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/b53/b53_priv.h +++ b/drivers/net/dsa/b53/b53_priv.h -@@ -338,7 +338,9 @@ void b53_phylink_mac_link_down(struct ds +@@ -344,7 +344,9 @@ void b53_phylink_mac_link_down(struct ds void b53_phylink_mac_link_up(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface, From 50ad1e5619b7c28b6bda96b67d4cc14091e9e4db Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 7 Dec 2022 18:09:18 +0100 Subject: [PATCH 117/137] CI: build: skip sdk adapt to external toolchain on cache hit On cache hit, skip sdk adapt to external toolchain. This is needed because we cache the already extracted sdk and that is already adapted to be used as external toolchain. Rerunning the adap step will result in the test to fail for missing file as the file are already got wrapped to the external toolchain format. Fixes: 42f0ab028e2e ("CI: build: fix use of sdk as toolchain") Signed-off-by: Christian Marangi (cherry picked from commit 99eaedfe3966b1ca812e8a962197cf91286247f7) --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 43f30617d8..1c665cb869 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -267,7 +267,7 @@ jobs: --config ${{ env.TARGET }}/${{ env.SUBTARGET }} - name: Adapt external sdk to external toolchain format - if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk' + if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk' && steps.cache-external-toolchain.outputs.cache-hit != 'true' shell: su buildbot -c "sh -e {0}" working-directory: openwrt run: | From 295c612a4a76e9f0860e2efdb609a38bc74d3e4a Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 7 Dec 2022 18:12:31 +0100 Subject: [PATCH 118/137] CI: kernel: don't checkout and install feeds We don't need to checkout feed and install feeds for kernel tests. This saves up to 2 minutes for each target kernel build test. Signed-off-by: Christian Marangi (cherry picked from commit 925e2a155ee4d4cc792fbf68aa9666e32a1f649b) --- .github/workflows/kernel.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 5a8c1123af..0fd03749f3 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -68,7 +68,6 @@ jobs: with: target: ${{ matrix.target }} build_all_kmods: true - include_feeds: true check-kernel-patches: name: Check Kernel patches From 64d46c7404b9434371d6ab41699cbea2b3042d4a Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 9 Dec 2022 00:29:18 +0800 Subject: [PATCH 119/137] layerscape: armv8_64b: refresh crypto Kconfigs Signed-off-by: Tianling Shen --- target/linux/layerscape/armv8_64b/config-5.4 | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/target/linux/layerscape/armv8_64b/config-5.4 b/target/linux/layerscape/armv8_64b/config-5.4 index 5dec1b986d..9ca2b7f512 100644 --- a/target/linux/layerscape/armv8_64b/config-5.4 +++ b/target/linux/layerscape/armv8_64b/config-5.4 @@ -203,8 +203,9 @@ CONFIG_CRYPTO_AES_ARM64=y CONFIG_CRYPTO_AES_ARM64_CE=y CONFIG_CRYPTO_AES_ARM64_CE_BLK=y CONFIG_CRYPTO_AES_ARM64_CE_CCM=y +CONFIG_CRYPTO_AKCIPHER=y +CONFIG_CRYPTO_AKCIPHER2=y CONFIG_CRYPTO_AUTHENC=y -CONFIG_CRYPTO_BLAKE2B=y CONFIG_CRYPTO_CRC32=y CONFIG_CRYPTO_CRC32C=y CONFIG_CRYPTO_CRCT10DIF=y @@ -220,16 +221,23 @@ CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API=y CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API_DESC=y CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API_QI=y # CONFIG_CRYPTO_DEV_FSL_CAAM_DEBUG is not set +CONFIG_CRYPTO_DEV_FSL_CAAM_DMA=y # CONFIG_CRYPTO_DEV_FSL_CAAM_INTC is not set CONFIG_CRYPTO_DEV_FSL_CAAM_JR=y +CONFIG_CRYPTO_DEV_FSL_CAAM_JR_UIO=y CONFIG_CRYPTO_DEV_FSL_CAAM_PKC_API=y CONFIG_CRYPTO_DEV_FSL_CAAM_RINGSIZE=9 CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_API=y +# CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_TEST is not set +CONFIG_CRYPTO_DEV_FSL_CAAM_SECVIO=y +CONFIG_CRYPTO_DEV_FSL_CAAM_SM=y +CONFIG_CRYPTO_DEV_FSL_CAAM_SM_SLOTSIZE=7 +# CONFIG_CRYPTO_DEV_FSL_CAAM_SM_TEST is not set +CONFIG_CRYPTO_DEV_FSL_CAAM_TK_API=y CONFIG_CRYPTO_DEV_FSL_DPAA2_CAAM=y CONFIG_CRYPTO_ECB=y -CONFIG_CRYPTO_ENGINE=y -CONFIG_CRYPTO_GHASH_ARM64_CE=y CONFIG_CRYPTO_GF128MUL=y +CONFIG_CRYPTO_GHASH_ARM64_CE=y CONFIG_CRYPTO_HASH=y CONFIG_CRYPTO_HASH2=y CONFIG_CRYPTO_HASH_INFO=y @@ -239,6 +247,7 @@ CONFIG_CRYPTO_LIB_SHA256=y CONFIG_CRYPTO_LZO=y CONFIG_CRYPTO_MANAGER=y CONFIG_CRYPTO_MANAGER2=y +CONFIG_CRYPTO_NULL=y CONFIG_CRYPTO_NULL2=y CONFIG_CRYPTO_RNG=y CONFIG_CRYPTO_RNG2=y @@ -247,6 +256,7 @@ CONFIG_CRYPTO_SHA256=y CONFIG_CRYPTO_SHA256_ARM64=y CONFIG_CRYPTO_SHA2_ARM64_CE=y CONFIG_CRYPTO_SIMD=y +# CONFIG_CRYPTO_TLS is not set CONFIG_CRYPTO_XTS=y CONFIG_CRYPTO_XXHASH=y CONFIG_CRYPTO_ZSTD=y @@ -854,6 +864,7 @@ CONFIG_SCSI_SAS_HOST_SMP=y CONFIG_SCSI_SAS_LIBSAS=y CONFIG_SECCOMP=y CONFIG_SECCOMP_FILTER=y +CONFIG_SECURE_KEYS=y CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y CONFIG_SERIAL_8250_DW=y CONFIG_SERIAL_8250_DWLIB=y From d4696574387deebc2913dc18893867790ba9c67d Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 9 Dec 2022 00:36:10 +0800 Subject: [PATCH 120/137] rtl_eth: fix package description Signed-off-by: Tianling Shen (cherry picked from commit abed583dc6c1c8b03d6f62181c14250234ac56e8) --- package/kernel/r8101/Makefile | 2 +- package/kernel/r8125/Makefile | 2 +- package/kernel/r8168/Makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package/kernel/r8101/Makefile b/package/kernel/r8101/Makefile index 2f09117a9f..2f0ecd14a0 100644 --- a/package/kernel/r8101/Makefile +++ b/package/kernel/r8101/Makefile @@ -28,7 +28,7 @@ define KernelPackage/r8101 AUTOLOAD:=$(call AutoProbe,r8101) endef -define Package/r8101/description +define KernelPackage/r8101/description This package contains a driver for Realtek r8101 chipsets. endef diff --git a/package/kernel/r8125/Makefile b/package/kernel/r8125/Makefile index 082ba4038b..08adf34913 100644 --- a/package/kernel/r8125/Makefile +++ b/package/kernel/r8125/Makefile @@ -29,7 +29,7 @@ define KernelPackage/r8125 AUTOLOAD:=$(call AutoProbe,r8125) endef -define Package/r8125/description +define KernelPackage/r8125/description This package contains a driver for Realtek r8125 chipsets. endef diff --git a/package/kernel/r8168/Makefile b/package/kernel/r8168/Makefile index 8440202eaa..1c1bf84b87 100644 --- a/package/kernel/r8168/Makefile +++ b/package/kernel/r8168/Makefile @@ -29,7 +29,7 @@ define KernelPackage/r8168 CONFLICTS:=kmod-r8169 endef -define Package/r8168/description +define KernelPackage/r8168/description This package contains a driver for Realtek r8168 chipsets. endef From 34679f23fcb1807c18d3953f2d24be4c5951e1fb Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 9 Dec 2022 01:15:14 +0800 Subject: [PATCH 121/137] i40e: add vendor driver from Intel Signed-off-by: Tianling Shen --- package/kernel/i40e/Makefile | 48 ++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 package/kernel/i40e/Makefile diff --git a/package/kernel/i40e/Makefile b/package/kernel/i40e/Makefile new file mode 100644 index 0000000000..4075872740 --- /dev/null +++ b/package/kernel/i40e/Makefile @@ -0,0 +1,48 @@ +# SPDX-License-Identifier: GPL-3.0-only +# +# Copyright (C) 2022 ImmortalWrt.org + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=i40e +PKG_VERSION:=2.22.8 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@IMMORTALWRT +PKG_HASH:=938eac24067e385d6e7e47788c7a1c47987bbe0ed36f3360809cbaa8caf85c6b +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) + +PKG_MAINTAINER:=Tianling Shen +PKG_LICENSE:=GPL-2.0-only +PKG_LICENSE_FILES:=COPYING + +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/i40e-vendor + SUBMENU:=Network Devices + TITLE:=Intel(R) Ethernet Controller XL710 Family support (vendor driver) + VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE) + DEPENDS:=@PCI_SUPPORT + CONFLICTS:=kmod-i40e + FILES:= \ + $(PKG_BUILD_DIR)/src/intel_auxiliary.ko \ + $(PKG_BUILD_DIR)/src/i40e.ko + AUTOLOAD:=$(call AutoProbe,i40e) +endef + +define KernelPackage/i40e-vendor/description + Kernel modules for Intel(R) Ethernet Controller XL710 Family 40 Gigabit Ethernet adapters. +endef + +define Build/Compile + +$(KERNEL_MAKE) $(PKG_JOBS) \ + M=$(PKG_BUILD_DIR)/src \ + NEED_AUX_BUS=2 \ + modules +endef + +$(eval $(call KernelPackage,i40e-vendor)) From 31c41f321faf97ca2ed7d8d2f53210741047a9bb Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 9 Dec 2022 08:33:26 +0800 Subject: [PATCH 122/137] i40e: add missing dependencies Signed-off-by: Tianling Shen --- package/kernel/i40e/Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/package/kernel/i40e/Makefile b/package/kernel/i40e/Makefile index 4075872740..113fd1ef9d 100644 --- a/package/kernel/i40e/Makefile +++ b/package/kernel/i40e/Makefile @@ -7,12 +7,11 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=i40e PKG_VERSION:=2.22.8 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@IMMORTALWRT PKG_HASH:=938eac24067e385d6e7e47788c7a1c47987bbe0ed36f3360809cbaa8caf85c6b -PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) PKG_MAINTAINER:=Tianling Shen PKG_LICENSE:=GPL-2.0-only @@ -26,7 +25,7 @@ define KernelPackage/i40e-vendor SUBMENU:=Network Devices TITLE:=Intel(R) Ethernet Controller XL710 Family support (vendor driver) VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE) - DEPENDS:=@PCI_SUPPORT + DEPENDS:=@PCI_SUPPORT +kmod-mdio +kmod-ptp +kmod-libphy CONFLICTS:=kmod-i40e FILES:= \ $(PKG_BUILD_DIR)/src/intel_auxiliary.ko \ From 9bc0ecebfa32caeef9de3a24e196a6091828c581 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sat, 10 Dec 2022 10:25:38 +0800 Subject: [PATCH 123/137] r8152: Update to 2.16.3.20221209 Signed-off-by: Tianling Shen (cherry picked from commit bc39bbdfba9e350e48ec956732cca0a1388f0b22) --- package/kernel/r8152/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/kernel/r8152/Makefile b/package/kernel/r8152/Makefile index 394200b77d..4e5e16081a 100644 --- a/package/kernel/r8152/Makefile +++ b/package/kernel/r8152/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=r8152 -PKG_VERSION:=2.16.3.20220914 +PKG_VERSION:=2.16.3.20221209 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/wget/realtek-r8152-linux/tar.gz/v$(PKG_VERSION)? -PKG_HASH:=61ed7af34c8882c6028ddd1a27bb78fb5bfba41211f84dd7a06e4dc84dbe9a9a +PKG_HASH:=82f0a86519e6e185623009190bb85f3a8f3de2bf9e67222c43c1265e773c9f9c PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/realtek-$(PKG_NAME)-linux-$(PKG_VERSION) PKG_LICENSE:=GPL-2.0-only From f9cdd61a8ea95f4f9333e1a171ac819ef5d24320 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= Date: Fri, 12 Nov 2021 18:56:15 +0800 Subject: [PATCH 124/137] bcm53xx: add support for Asus RT-AC88U MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Asus RT-AC88U is an AC3100 router featuring 9 Ethernet ports over the integrated Broadcom and the external Realtek switch. Hardware info: * Processor: Broadcom BCM4709C0KFEBG dual-core @ 1.4 GHz * Switch: BCM53012 in BCM4709C0KFEBG & external RTL8365MB * DDR3 RAM: 512 MB * Flash: 128 MB (ESMT F59L1G81LA-25T) * 2.4GHz: BCM4366 4×4 2.4/5G single chip 802.11ac SoC * 5GHz: BCM4366 4×4 2.4/5G single chip 802.11ac SoC * Ports: 8 Ports, 1 WAN Ports Flashing instructions: * Boot to CFE Recovery Mode by holding the reset button while power-on. * Connect to the router with an ethernet cable. * Set IPv4 address of the computer to 192.168.1.2 subnet 255.255.255.0. * Head to http://192.168.1.1. * Reset NVRAM. * Upload the OpenWrt image. CFE bootloader may reject flashing the image due to image integrity check. In that case, follow the instructions below. * Rename the OpenWrt image as firmware.trx. * Run a TFTP server and make it serve the firmware.trx file. * Run the URL below on a browser or curl. http://192.168.1.1/do.htm?cmd=flash+-noheader+192.168.1.2:firmware.trx+flash0.trx Signed-off-by: Arınç ÜNAL [rmilecki: mark BROKEN until we sort out nvram & CFE recovery] Signed-off-by: Rafał Miłecki (cherry picked from commit 72b9b721d707b7f70109eb70b2a9f22449ceba08) --- target/linux/bcm53xx/base-files/etc/board.d/02_network | 3 +++ target/linux/bcm53xx/image/Makefile | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/target/linux/bcm53xx/base-files/etc/board.d/02_network b/target/linux/bcm53xx/base-files/etc/board.d/02_network index 317e8a5b7c..039b5fe95f 100755 --- a/target/linux/bcm53xx/base-files/etc/board.d/02_network +++ b/target/linux/bcm53xx/base-files/etc/board.d/02_network @@ -31,6 +31,9 @@ bcm53xx_setup_interfaces() ucidef_add_switch "switch0" \ "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5t@eth0" ;; + asus,rt-ac88u) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 extsw" "wan" + ;; linksys,panamera) ucidef_add_switch "switch1" \ "0:lan" "1:lan:7" "2:lan:4" "3:lan:8" "4:wan" "5t@eth0" diff --git a/target/linux/bcm53xx/image/Makefile b/target/linux/bcm53xx/image/Makefile index 9c3a7a9e6f..32018fe58d 100644 --- a/target/linux/bcm53xx/image/Makefile +++ b/target/linux/bcm53xx/image/Makefile @@ -167,6 +167,15 @@ define Device/asus_rt-ac87u endef TARGET_DEVICES += asus_rt-ac87u +define Device/asus_rt-ac88u + $(call Device/asus) + DEVICE_MODEL := RT-AC88U + DEVICE_PACKAGES := $(BRCMFMAC_4366C0) $(USB3_PACKAGES) + ASUS_PRODUCTID := RT-AC88U + BROKEN := y +endef +TARGET_DEVICES += asus_rt-ac88u + define Device/asus_rt-n18u $(call Device/asus) DEVICE_MODEL := RT-N18U From 33bb581295d402b9fd166aa4cdd27a53b65b02ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= Date: Wed, 4 May 2022 11:34:29 +0300 Subject: [PATCH 125/137] packages: nvram: add NVRAM quirks for bcm53xx target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add NVRAM quirks script for the bcm53xx target. Split NVRAM quirks for the bcm47xx and bcm53xx targets. Move clear partialboot NVRAM quirk for Linksys EA9500 here. Add set wireless LED behaviour quirk for Asus RT-AC88U. Use boot() instead of start() as nvram commands are meant to be executed only once, at boot. Signed-off-by: Arınç ÜNAL (cherry picked from commit f4e219fd5e6cfa33d234dad134fb105cc1620f54) --- package/utils/nvram/Makefile | 8 +++- .../files/{nvram.init => nvram-bcm47xx.init} | 4 +- package/utils/nvram/files/nvram-bcm53xx.init | 40 +++++++++++++++++++ .../base-files/etc/init.d/clear_partialboot | 13 ------ 4 files changed, 48 insertions(+), 17 deletions(-) rename package/utils/nvram/files/{nvram.init => nvram-bcm47xx.init} (97%) create mode 100755 package/utils/nvram/files/nvram-bcm53xx.init delete mode 100755 target/linux/bcm53xx/base-files/etc/init.d/clear_partialboot diff --git a/package/utils/nvram/Makefile b/package/utils/nvram/Makefile index 863b304d0d..b957211283 100644 --- a/package/utils/nvram/Makefile +++ b/package/utils/nvram/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nvram -PKG_RELEASE:=10 +PKG_RELEASE:=11 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) @@ -44,7 +44,11 @@ define Package/nvram/install $(INSTALL_BIN) $(PKG_BUILD_DIR)/nvram $(1)/usr/sbin/ ifneq ($(CONFIG_TARGET_bcm47xx),) $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) ./files/nvram.init $(1)/etc/init.d/nvram + $(INSTALL_BIN) ./files/nvram-bcm47xx.init $(1)/etc/init.d/nvram +endif +ifneq ($(CONFIG_TARGET_bcm53xx),) + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/nvram-bcm53xx.init $(1)/etc/init.d/nvram endif endef diff --git a/package/utils/nvram/files/nvram.init b/package/utils/nvram/files/nvram-bcm47xx.init similarity index 97% rename from package/utils/nvram/files/nvram.init rename to package/utils/nvram/files/nvram-bcm47xx.init index 467ab28195..4a2bcd16fe 100755 --- a/package/utils/nvram/files/nvram.init +++ b/package/utils/nvram/files/nvram-bcm47xx.init @@ -1,7 +1,7 @@ #!/bin/sh /etc/rc.common # NVRAM setup # -# This file handles the NVRAM quirks of various hardware. +# This file handles the NVRAM quirks of various hardware of the bcm47xx target. START=02 alias debug=${DEBUG:-:} @@ -71,7 +71,7 @@ fixup_linksys() { esac } -start() { +boot() { # Don't do any fixups on the WGT634U [ "$(cat /proc/diag/model)" = "Netgear WGT634U" ] && return diff --git a/package/utils/nvram/files/nvram-bcm53xx.init b/package/utils/nvram/files/nvram-bcm53xx.init new file mode 100755 index 0000000000..0502cd28b6 --- /dev/null +++ b/package/utils/nvram/files/nvram-bcm53xx.init @@ -0,0 +1,40 @@ +#!/bin/sh /etc/rc.common +# NVRAM setup +# +# This file handles the NVRAM quirks of various hardware of the bcm53xx target. + +START=02 + +clear_partialboots() { + # clear partialboots + + case $(board_name) in + linksys,panamera) + COMMIT=1 + nvram set partialboots=0 + ;; + esac +} + +set_wireless_led_behaviour() { + # set Broadcom wireless LED behaviour for both radios + # 0:ledbh9 -> Behaviour of 2.4GHz LED + # 1:ledbh9 -> Behaviour of 5GHz LED + # 0x7 makes the wireless LEDs on, when radios are enabled, and blink when there's activity + + case $(board_name) in + asus,rt-ac88u) + COMMIT=1 + nvram set 0:ledbh9=0x7 set 1:ledbh9=0x7 + ;; + esac +} + +boot() { + . /lib/functions.sh + + clear_partialboots + set_wireless_led_behaviour + + [ "$COMMIT" = "1" ] && nvram commit +} diff --git a/target/linux/bcm53xx/base-files/etc/init.d/clear_partialboot b/target/linux/bcm53xx/base-files/etc/init.d/clear_partialboot deleted file mode 100755 index b3eddf4af0..0000000000 --- a/target/linux/bcm53xx/base-files/etc/init.d/clear_partialboot +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh /etc/rc.common - -START=97 -boot() { - . /lib/functions.sh - - case $(board_name) in - linksys,panamera) - # clear partialboots - nvram set partialboots=0 && nvram commit - ;; - esac -} From a252fc748bf4a15de9dc7efb4a94c77b4f2614e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= Date: Wed, 1 Jun 2022 10:42:33 +0300 Subject: [PATCH 126/137] bcm53xx: remove BROKEN flag from Asus RT-AC88U MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The image builds and works fine on Asus RT-AC88U. Therefore, remove the BROKEN flag from the makefile. Signed-off-by: Arınç ÜNAL (cherry picked from commit 5c1b1918abf853c95976daf7fea58fb1355eae6d) --- target/linux/bcm53xx/image/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/target/linux/bcm53xx/image/Makefile b/target/linux/bcm53xx/image/Makefile index 32018fe58d..372cbe8a7a 100644 --- a/target/linux/bcm53xx/image/Makefile +++ b/target/linux/bcm53xx/image/Makefile @@ -172,7 +172,6 @@ define Device/asus_rt-ac88u DEVICE_MODEL := RT-AC88U DEVICE_PACKAGES := $(BRCMFMAC_4366C0) $(USB3_PACKAGES) ASUS_PRODUCTID := RT-AC88U - BROKEN := y endef TARGET_DEVICES += asus_rt-ac88u From 1a80b55f1349a6679e92936f6185722c66d30fea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= Date: Tue, 18 Oct 2022 11:54:20 +0300 Subject: [PATCH 127/137] bcm53xx: enable Broadcom 4366b1 firmware for Asus RT-AC88U MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On some of the hardware revisions of Asus RT-AC88U, brcmfmac detects the 4366b1 wireless chip and tries to load the firmware file which doesn't exist because it's not included in the image. Therefore, include firmware for 4366b1 along with 4366c0. This way, all hardware revisions of the router will be supported by having brcmfmac use the firmware file for the wireless chip it detects. Signed-off-by: Arınç ÜNAL (cherry picked from commit 2b9bb5b187022f8b64c84781c071d6c2b0ce3e45) --- target/linux/bcm53xx/image/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/bcm53xx/image/Makefile b/target/linux/bcm53xx/image/Makefile index 372cbe8a7a..01a59a7fca 100644 --- a/target/linux/bcm53xx/image/Makefile +++ b/target/linux/bcm53xx/image/Makefile @@ -170,7 +170,7 @@ TARGET_DEVICES += asus_rt-ac87u define Device/asus_rt-ac88u $(call Device/asus) DEVICE_MODEL := RT-AC88U - DEVICE_PACKAGES := $(BRCMFMAC_4366C0) $(USB3_PACKAGES) + DEVICE_PACKAGES := $(BRCMFMAC_4366B1) $(BRCMFMAC_4366C0) $(USB3_PACKAGES) ASUS_PRODUCTID := RT-AC88U endef TARGET_DEVICES += asus_rt-ac88u From fb16e01fc9811ca97b052e09df53893e09a2a0ac Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sun, 11 Dec 2022 12:51:49 +0800 Subject: [PATCH 128/137] Revert "download.pl: remove broken mirror" mirror2 now points to mirrors.gigenet.com. This reverts commit 9fbf1751eced799a4320fed8095b78fbde2d5116. Signed-off-by: Tianling Shen (cherry picked from commit 4fb0bd80d53566ac918d6391b032639aad6ce84c) --- scripts/download.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/download.pl b/scripts/download.pl index 9ec6d1a869..86e9950f05 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -286,6 +286,7 @@ foreach my $mirror (@ARGV) { } # push @mirrors, 'https://mirror01.download.immortalwrt.eu.org'; +push @mirrors, 'https://mirror2.immortalwrt.org/sources'; push @mirrors, 'https://mirror.immortalwrt.org/sources'; push @mirrors, 'https://sources.immortalwrt.org'; push @mirrors, 'https://sources.cdn.immortalwrt.org'; From cd25afbc7e718cdaceabb38d536d76ce8507c98c Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sun, 11 Dec 2022 13:44:25 +0800 Subject: [PATCH 129/137] scripts/download.pl: update mirrors Signed-off-by: Tianling Shen (cherry picked from commit 3d37d7b1c0c823feea90c4cf632710ff83d87ce6) --- include/download.mk | 2 +- scripts/download.pl | 28 +++++++++++++++++++++------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/include/download.mk b/include/download.mk index 4b419851d0..99a3e0140d 100644 --- a/include/download.mk +++ b/include/download.mk @@ -27,7 +27,7 @@ define dl_method $(strip \ $(if $(filter git,$(2)),$(call dl_method_git,$(1),$(2)), $(if $(2),$(2), \ - $(if $(filter @OPENWRT @IMMORTALWRT @APACHE/% @GITHUB/% @GNOME/% @GNU/% @KERNEL/% @SF/% @SAVANNAH/% ftp://% http://% https://% file://%,$(1)),default, \ + $(if $(filter @OPENWRT @IMMORTALWRT @APACHE/% @DEBIAN/% @GITHUB/% @GNOME/% @GNU/% @KERNEL/% @SF/% @SAVANNAH/% ftp://% http://% https://% file://%,$(1)),default, \ $(if $(filter git://%,$(1)),$(call dl_method_git,$(1),$(2)), \ $(if $(filter svn://%,$(1)),svn, \ $(if $(filter cvs://%,$(1)),cvs, \ diff --git a/scripts/download.pl b/scripts/download.pl index 86e9950f05..e27265eb6d 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -206,11 +206,21 @@ foreach my $mirror (@ARGV) { # use OpenWrt source server directly } elsif ($mirror =~ /^\@IMMORTALWRT$/) { # use ImmortalWrt source server directly + } elsif ($mirror =~ /^\@DEBIAN\/(.+)$/) { + push @mirrors, "https://mirrors.tencent.com/debian/$1"; + push @mirrors, "https://mirrors.aliyun.com/debian/$1"; + push @mirrors, "https://mirrors.tuna.tsinghua.edu.cn/debian/$1"; + push @mirrors, "https://mirrors.ustc.edu.cn/debian/$1"; + push @mirrors, "https://ftp.debian.org/debian/$1"; + push @mirrors, "https://mirror.leaseweb.com/debian/$1"; + push @mirrors, "https://mirror.netcologne.de/debian/$1"; + push @mirrors, "https://mirrors.tuna.tsinghua.edu.cn/debian/$1"; + push @mirrors, "https://mirrors.ustc.edu.cn/debian/$1" } elsif ($mirror =~ /^\@APACHE\/(.+)$/) { push @mirrors, "https://mirrors.tencent.com/apache/$1"; push @mirrors, "https://mirrors.aliyun.com/apache/$1"; - # push @mirrors, "https://mirrors.tuna.tsinghua.edu.cn/apache/$1"; - # push @mirrors, "https://mirrors.ustc.edu.cn/apache/$1"; + push @mirrors, "https://mirrors.tuna.tsinghua.edu.cn/apache/$1"; + push @mirrors, "https://mirrors.ustc.edu.cn/apache/$1"; push @mirrors, "https://mirror.netcologne.de/apache.org/$1"; push @mirrors, "https://mirror.aarnet.edu.au/pub/apache/$1"; push @mirrors, "https://mirror.csclub.uwaterloo.ca/apache/$1"; @@ -234,9 +244,8 @@ foreach my $mirror (@ARGV) { } elsif ($mirror =~ /^\@GNU\/(.+)$/) { push @mirrors, "https://mirrors.tencent.com/gnu/$1"; push @mirrors, "https://mirrors.aliyun.com/gnu/$1"; - # push @mirrors, "https://mirrors.tuna.tsinghua.edu.cn/gnu/$1"; - # push @mirrors, "https://mirrors.cqu.edu.cn/gnu/$1"; - # push @mirrors, "https://mirrors.ustc.edu.cn/gnu/$1"; + push @mirrors, "https://mirrors.tuna.tsinghua.edu.cn/gnu/$1"; + push @mirrors, "https://mirrors.ustc.edu.cn/gnu/$1"; push @mirrors, "https://mirror.csclub.uwaterloo.ca/gnu/$1"; push @mirrors, "https://mirror.netcologne.de/gnu/$1"; push @mirrors, "http://ftp.kddilabs.jp/GNU/gnu/$1"; @@ -261,8 +270,11 @@ foreach my $mirror (@ARGV) { push @extra, "$extra[0]/longterm/v$1"; } foreach my $dir (@extra) { - # push @mirrors, "https://mirrors.ustc.edu.cn/kernel.org/$dir"; + push @mirrors, "https://mirror.iscas.ac.cn/kernel.org/$dir"; + push @mirrors, "https://mirrors.ustc.edu.cn/kernel.org/$dir"; + push @mirrors, "https://mirror.nju.edu.cn/kernel.org/$dir"; push @mirrors, "https://cdn.kernel.org/pub/$dir"; + push @mrirors, "https://ftp.jaist.ac.jp/pub/Linux/kernel.org/$dir"; push @mirrors, "https://download.xs4all.nl/ftp.kernel.org/pub/$dir"; push @mirrors, "https://mirrors.mit.edu/kernel/$dir"; push @mirrors, "http://ftp.nara.wide.ad.jp/pub/kernel.org/$dir"; @@ -271,7 +283,9 @@ foreach my $mirror (@ARGV) { push @mirrors, "ftp://www.mirrorservice.org/sites/ftp.kernel.org/pub/$dir"; } } elsif ($mirror =~ /^\@GNOME\/(.+)$/) { - push @mirrors, "https://mirrors.ustc.edu.cn/gnome/sources/$1"; + push @mirrors, "https://mirrors.ustc.edu.cn/gnome/sources/$1"; + push @mirrors, "https://mirror.nju.edu.cn/gnome/$1"; + push @mirrors, "https://download.gnome.org/sources/$1"; push @mirrors, "https://mirror.csclub.uwaterloo.ca/gnome/sources/$1"; push @mirrors, "http://ftp.acc.umu.se/pub/GNOME/sources/$1"; push @mirrors, "http://ftp.kaist.ac.kr/gnome/sources/$1"; From 243cb791ed5f4bb424186164d70f95270203c927 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sun, 11 Dec 2022 22:37:35 +0800 Subject: [PATCH 130/137] download.pl: fix typo error Signed-off-by: Tianling Shen (cherry picked from commit 9b3db09fe3a28af0bae0d972b2234cbf6a99a6c8) --- scripts/download.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/download.pl b/scripts/download.pl index e27265eb6d..a7865f285c 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -274,7 +274,7 @@ foreach my $mirror (@ARGV) { push @mirrors, "https://mirrors.ustc.edu.cn/kernel.org/$dir"; push @mirrors, "https://mirror.nju.edu.cn/kernel.org/$dir"; push @mirrors, "https://cdn.kernel.org/pub/$dir"; - push @mrirors, "https://ftp.jaist.ac.jp/pub/Linux/kernel.org/$dir"; + push @mirrors, "https://ftp.jaist.ac.jp/pub/Linux/kernel.org/$dir"; push @mirrors, "https://download.xs4all.nl/ftp.kernel.org/pub/$dir"; push @mirrors, "https://mirrors.mit.edu/kernel/$dir"; push @mirrors, "http://ftp.nara.wide.ad.jp/pub/kernel.org/$dir"; From 2da375f0dccdfe4b3b03e9f3581f28c607fd8f3a Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Thu, 1 Dec 2022 23:28:38 +0800 Subject: [PATCH 131/137] wolfssl: fix build with /dev/crypto Backport upstream patch to fix build error when /dev/crypto enabled. https://github.com/wolfSSL/wolfssl/commit/dc9f46a3be00b5e82684a158605189d1278e324c Fixes: #10944 Signed-off-by: Chukun Pan (cherry picked from commit 171691500eca0737c59d4fff50578b74a90583be) --- package/libs/wolfssl/Config.in | 2 +- ...001-Fix-enable-devcrypto-build-error.patch | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 package/libs/wolfssl/patches/001-Fix-enable-devcrypto-build-error.patch diff --git a/package/libs/wolfssl/Config.in b/package/libs/wolfssl/Config.in index a212d1fb8a..7c154ccb31 100644 --- a/package/libs/wolfssl/Config.in +++ b/package/libs/wolfssl/Config.in @@ -81,7 +81,7 @@ if PACKAGE_libwolfssl bool "AF_ALG" config WOLFSSL_HAS_DEVCRYPTO_CBC - bool "/dev/crytpo - AES-CBC-only" + bool "/dev/crypto - AES-CBC-only" select WOLFSSL_HAS_DEVCRYPTO config WOLFSSL_HAS_DEVCRYPTO_AES diff --git a/package/libs/wolfssl/patches/001-Fix-enable-devcrypto-build-error.patch b/package/libs/wolfssl/patches/001-Fix-enable-devcrypto-build-error.patch new file mode 100644 index 0000000000..bcdaf2b7a2 --- /dev/null +++ b/package/libs/wolfssl/patches/001-Fix-enable-devcrypto-build-error.patch @@ -0,0 +1,33 @@ +From dc9f46a3be00b5e82684a158605189d1278e324c Mon Sep 17 00:00:00 2001 +From: Eric Blankenhorn +Date: Wed, 12 Oct 2022 16:05:17 -0500 +Subject: [PATCH] Fix --enable-devcrypto build error for sys without u_int8_t + type + +--- + wolfcrypt/src/port/devcrypto/README.md | 2 +- + wolfcrypt/src/port/devcrypto/wc_devcrypto.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/wolfcrypt/src/port/devcrypto/README.md ++++ b/wolfcrypt/src/port/devcrypto/README.md +@@ -22,7 +22,7 @@ modprobe cryptodev + For default build with all supported features use: + + ``` +-./configure --enable-cryptodev ++./configure --enable-devcrypto + ``` + + Or for more control over features used: +--- a/wolfcrypt/src/port/devcrypto/wc_devcrypto.c ++++ b/wolfcrypt/src/port/devcrypto/wc_devcrypto.c +@@ -122,7 +122,7 @@ int wc_DevCryptoCreate(WC_CRYPTODEV* ctx + case CRYPTO_SHA2_512_HMAC: + ctx->sess.cipher = 0; + ctx->sess.mac = type; +- ctx->sess.mackey = (u_int8_t*)key; ++ ctx->sess.mackey = (byte*)key; + ctx->sess.mackeylen = keySz; + break; + From feb2f4f0fe9df8fda784564ed53722463f73960c Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 8 Dec 2022 01:15:11 +0100 Subject: [PATCH 132/137] ustream-ssl: update to Git version 2022-12-07 9217ab4 ustream-openssl: Disable renegotiation in TLSv1.2 and earlier 2ce1d48 ci: fix building with i.MX6 SDK 584f1f6 ustream-openssl: wolfSSL: provide detailed information in debug builds aa8c48e cmake: add a possibility to set library version Signed-off-by: Hauke Mehrtens (cherry picked from commit 69f0c29b8b3339ef93c04f6c7f92481e8e223e2f) --- package/libs/ustream-ssl/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/libs/ustream-ssl/Makefile b/package/libs/ustream-ssl/Makefile index 4f474978db..c2f046318f 100644 --- a/package/libs/ustream-ssl/Makefile +++ b/package/libs/ustream-ssl/Makefile @@ -1,13 +1,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ustream-ssl -PKG_RELEASE:=2 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/ustream-ssl.git -PKG_SOURCE_DATE:=2022-01-16 -PKG_SOURCE_VERSION:=868fd8812f477c110f9c6c5252c0bd172167b94c -PKG_MIRROR_HASH:=dd28d5e846b391917cf83d66176653bdfa4e8a0d5b11144b65a012fe7693ddeb +PKG_SOURCE_DATE:=2022-12-08 +PKG_SOURCE_VERSION:=9217ab46536353c7c792951b57163063f5ec7a3b +PKG_MIRROR_HASH:=cd4dc6a6c18290348b1f8b1c01df3320e4954dc46d714c797bef066f7a91248d CMAKE_INSTALL:=1 PKG_LICENSE:=ISC From b410c843896552ea83a877b03f2e4fd13a95d637 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 7 Aug 2022 14:42:01 +0200 Subject: [PATCH 133/137] kenrel: kmod-rtc-pt7c4338: Remove package The rtc-pt7c4338.ko was never upstream under this name, the driver was removed from OpenWrt some years ago, remove the kmod-rtc-pt7c4338 package too. Fixes: 74d00a8c3849 ("kernel: split patches folder up into backport, pending and hack folders") Signed-off-by: Hauke Mehrtens (cherry picked from commit 5ccf4dcf8864c1d940b65067d8c6f7c4e5858ae2) --- package/kernel/linux/modules/other.mk | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/package/kernel/linux/modules/other.mk b/package/kernel/linux/modules/other.mk index 83d998c83a..1b7e382a15 100644 --- a/package/kernel/linux/modules/other.mk +++ b/package/kernel/linux/modules/other.mk @@ -665,22 +665,6 @@ endef $(eval $(call KernelPackage,rtc-pcf2127)) -define KernelPackage/rtc-pt7c4338 - SUBMENU:=$(OTHER_MENU) - TITLE:=Pericom PT7C4338 RTC support - DEFAULT:=m if ALL_KMODS && RTC_SUPPORT - DEPENDS:=+kmod-i2c-core - KCONFIG:=CONFIG_RTC_DRV_PT7C4338 \ - CONFIG_RTC_CLASS=y - FILES:=$(LINUX_DIR)/drivers/rtc/rtc-pt7c4338.ko - AUTOLOAD:=$(call AutoProbe,rtc-pt7c4338) -endef - -define KernelPackage/rtc-pt7c4338/description - Kernel module for Pericom PT7C4338 i2c RTC chip -endef - -$(eval $(call KernelPackage,rtc-pt7c4338)) define KernelPackage/rtc-rs5c372a SUBMENU:=$(OTHER_MENU) From fdbd5472e2254ddd960cb4d9193a57edabf5baa3 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 7 Aug 2022 13:32:31 +0200 Subject: [PATCH 134/137] kernel: kmod-w1-slave-ds2760: Remove package The w1_ds2760.ko driver was merged into the ds2760_battery.ko driver. The driver was removed and this package was never build any more. This happened with kernel 4.19. Remove this unused package. Signed-off-by: Hauke Mehrtens (cherry picked from commit 5808973d141f488e06efe4749dbf651565fd5510) --- package/kernel/linux/modules/w1.mk | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/package/kernel/linux/modules/w1.mk b/package/kernel/linux/modules/w1.mk index 6ac7458e42..dba2898e47 100644 --- a/package/kernel/linux/modules/w1.mk +++ b/package/kernel/linux/modules/w1.mk @@ -160,23 +160,6 @@ endef $(eval $(call KernelPackage,w1-slave-ds2433)) -define KernelPackage/w1-slave-ds2760 - TITLE:=Dallas 2760 battery monitor chip (HP iPAQ & others) - KCONFIG:= \ - CONFIG_W1_SLAVE_DS2760 \ - CONFIG_W1_SLAVE_DS2433_CRC=n - FILES:=$(W1_SLAVES_DIR)/w1_ds2760.ko - AUTOLOAD:=$(call AutoProbe,w1_ds2760) - $(call AddDepends/w1) -endef - -define KernelPackage/w1-slave-ds2760/description - Kernel module for 1-wire DS2760 battery monitor chip support -endef - -$(eval $(call KernelPackage,w1-slave-ds2760)) - - define KernelPackage/w1-slave-ds2413 TITLE:=DS2413 2 Ch. Addressable Switch KCONFIG:= \ From ee0e1a3da44f1378f745c0db0a65602063786112 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 7 Aug 2022 15:13:36 +0200 Subject: [PATCH 135/137] kernel: kmod-isdn4linux: Remove package The isdn4linux drivers and subsystem was removed in kernel 5.3, remove the kernel package also from OpenWrt. Signed-off-by: Hauke Mehrtens (cherry picked from commit db55dea5fc047190af188f07018e99b0c7a4bdde) --- package/kernel/linux/modules/netsupport.mk | 32 ---------------------- 1 file changed, 32 deletions(-) diff --git a/package/kernel/linux/modules/netsupport.mk b/package/kernel/linux/modules/netsupport.mk index a94a696fc5..d1376a3fb9 100644 --- a/package/kernel/linux/modules/netsupport.mk +++ b/package/kernel/linux/modules/netsupport.mk @@ -162,38 +162,6 @@ endef $(eval $(call KernelPackage,misdn)) -define KernelPackage/isdn4linux - SUBMENU:=$(NETWORK_SUPPORT_MENU) - TITLE:=Old ISDN4Linux (deprecated) - DEPENDS:=+kmod-ppp - KCONFIG:= \ - CONFIG_ISDN=y \ - CONFIG_ISDN_I4L \ - CONFIG_ISDN_PPP=y \ - CONFIG_ISDN_PPP_VJ=y \ - CONFIG_ISDN_MPP=y \ - CONFIG_IPPP_FILTER=y \ - CONFIG_ISDN_PPP_BSDCOMP \ - CONFIG_ISDN_CAPI_MIDDLEWARE=y \ - CONFIG_ISDN_CAPI_CAPIFS_BOOL=y \ - CONFIG_ISDN_AUDIO=y \ - CONFIG_ISDN_TTY_FAX=y \ - CONFIG_ISDN_X25=y \ - CONFIG_ISDN_DIVERSION - FILES:= \ - $(LINUX_DIR)/drivers/isdn/divert/dss1_divert.ko \ - $(LINUX_DIR)/drivers/isdn/i4l/isdn.ko \ - $(LINUX_DIR)/drivers/isdn/i4l/isdn_bsdcomp.ko - AUTOLOAD:=$(call AutoLoad,40,isdn isdn_bsdcomp dss1_divert) -endef - -define KernelPackage/isdn4linux/description - This driver allows you to use an ISDN adapter for networking -endef - -$(eval $(call KernelPackage,isdn4linux)) - - define KernelPackage/ipip SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=IP-in-IP encapsulation From 4987ac2cead0391c97066fde08350230b4069665 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Mon, 12 Dec 2022 06:57:07 +0800 Subject: [PATCH 136/137] igb: add vendor driver from Intel Signed-off-by: Tianling Shen --- package/kernel/igb/Makefile | 45 ++++++++++++++++++++ package/kernel/igb/patches/100-headers.patch | 10 +++++ 2 files changed, 55 insertions(+) create mode 100644 package/kernel/igb/Makefile create mode 100644 package/kernel/igb/patches/100-headers.patch diff --git a/package/kernel/igb/Makefile b/package/kernel/igb/Makefile new file mode 100644 index 0000000000..42321305ec --- /dev/null +++ b/package/kernel/igb/Makefile @@ -0,0 +1,45 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2022 ImmortalWrt.org + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=igb +PKG_VERSION:=5.13.7 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@IMMORTALWRT +PKG_HASH:=4ccae73110f3c871a17b7cc6df7dbdf6295fc90f4941e8b2978a471c2fec83cb + +PKG_MAINTAINER:=Tianling Shen +PKG_LICENSE:=GPL-2.0-only +PKG_LICENSE_FILES:=COPYING + +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/igb-vendor + SUBMENU:=Network Devices + TITLE:=Intel(R) 82575/82576 PCI-Express Gigabit Ethernet support (vendor driver) + VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE) + DEPENDS:=@PCI_SUPPORT +kmod-i2c-core +kmod-i2c-algo-bit +kmod-ptp +kmod-hwmon-core + CONFLICTS:=kmod-igb + FILES:=$(PKG_BUILD_DIR)/src/igb.ko + AUTOLOAD:=$(call AutoProbe,igb) +endef + +define KernelPackage/igb-vendor/description + Kernel modules for Intel(R) 82575/82576 PCI-Express Gigabit Ethernet adapters. +endef + +define Build/Compile + +$(KERNEL_MAKE) $(PKG_JOBS) \ + M=$(PKG_BUILD_DIR)/src \ + CONFIG_IGB=m \ + modules +endef + +$(eval $(call KernelPackage,igb-vendor)) diff --git a/package/kernel/igb/patches/100-headers.patch b/package/kernel/igb/patches/100-headers.patch new file mode 100644 index 0000000000..af2114b978 --- /dev/null +++ b/package/kernel/igb/patches/100-headers.patch @@ -0,0 +1,10 @@ +--- a/src/igb_main.c ++++ b/src/igb_main.c +@@ -25,6 +25,7 @@ + #ifdef CONFIG_PM_RUNTIME + #include + #endif /* CONFIG_PM_RUNTIME */ ++#include + + #include + #include "igb.h" From 849e4c7eed28691dd42fbc5d8d7d97a88bb82f20 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Mon, 12 Dec 2022 07:01:33 +0800 Subject: [PATCH 137/137] exfat: Update to 6.0.0 Signed-off-by: Tianling Shen --- package/kernel/exfat/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/kernel/exfat/Makefile b/package/kernel/exfat/Makefile index d8f451a35a..31bf49df33 100644 --- a/package/kernel/exfat/Makefile +++ b/package/kernel/exfat/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=exfat -PKG_VERSION:=5.19.1 -PKG_RELEASE:=$(AUTORELEASE) +PKG_VERSION:=6.0.0 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/namjaejeon/linux-exfat-oot/tar.gz/$(PKG_VERSION)? -PKG_HASH:=80750bfa3bcdf743ca0d027be8244cc7b6ccd78f20304c2cabbb4011c88e4f0a +PKG_HASH:=08513c4ad7bceda6570435f54e76fc91369cbf404968838bdd3f566495f20f36 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/linux-exfat-oot-$(PKG_VERSION) PKG_MAINTAINER:=