From yangshiji66 at outlook.com  Sat Jul  1 19:57:34 2023
From: yangshiji66 at outlook.com (Shiji Yang)
Date: Sun,  2 Jul 2023 10:57:34 +0800
Subject: [PATCH v2] ramips: mt7620: fix urngd error by disabling CPU frequency scaling feature
Message-ID: <TYAP286MB0315ABFBF338B0CBAC69E110BC28A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>

From: Shiji Yang <yangshiji66 at qq.com>

Frequency scaling enables the MT7620 to reduce CPU frequency when receiving
MIPS SI_Sleep signal. However, the current clock driver can't detect the
change of the frequency and always provides a fixed clock frequency. This
may confuse urngd, making it unable to initialize. On the other hand, 580
MHz MIPS processor is already very weak today. Sleep mode may have negative
impact on performance. And energy saving is not significant since most
energy is consumed by peripherals such as WLAN radio. Therefore, disabling
it shoule be a good choice.

The systick driver determines whether to enable this feature based on the
compatible string "ralink,mt7620a-systick", so removing it can safely
disable the sleep mode. In this way, systick will still work in normal mode
just like other ralink SoCs such as MT7628.

This patch fixes the urngd init error:

user.err kernel: [    9.961576] urngd: jent-rng init failed, err: 2

Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
---
v2:
Apply the fix to another variant mt7620n, too.
---
 target/linux/ramips/dts/mt7620a.dtsi | 2 +-
 target/linux/ramips/dts/mt7620n.dtsi | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/linux/ramips/dts/mt7620a.dtsi b/target/linux/ramips/dts/mt7620a.dtsi
index 4b6fa60dc8..c0fda35366 100644
--- a/target/linux/ramips/dts/mt7620a.dtsi
+++ b/target/linux/ramips/dts/mt7620a.dtsi
@@ -266,7 +266,7 @@
 		};
 
 		systick: systick at d00 {
-			compatible = "ralink,mt7620a-systick", "ralink,cevt-systick";
+			compatible = "ralink,cevt-systick";
 			reg = <0xd00 0x10>;
 
 			resets = <&rstctrl 28>;
diff --git a/target/linux/ramips/dts/mt7620n.dtsi b/target/linux/ramips/dts/mt7620n.dtsi
index 276bc13733..2579b4879e 100644
--- a/target/linux/ramips/dts/mt7620n.dtsi
+++ b/target/linux/ramips/dts/mt7620n.dtsi
@@ -231,7 +231,7 @@
 		};
 
 		systick: systick at d00 {
-			compatible = "ralink,mt7620a-systick", "ralink,cevt-systick";
+			compatible = "ralink,cevt-systick";
 			reg = <0xd00 0x10>;
 
 			resets = <&rstctrl 28>;
-- 
2.30.2



From noreply at github.com  Sun Jul  2 15:32:17 2023
From: noreply at github.com (Stephen Walker)
Date: Sun, 02 Jul 2023 15:32:17 -0700
Subject: [sdwalker/sdwalker.github.io] 24e737: This week's update
Message-ID: <sdwalker/sdwalker.github.io/push/refs/heads/master/ccd55c-24e737@github.com>

  Branch: refs/heads/master
  Home:   https://github.com/sdwalker/sdwalker.github.io
  Commit: 24e7370bc7bbedd082248a437d1fa302f702d3e6
      https://github.com/sdwalker/sdwalker.github.io/commit/24e7370bc7bbedd082248a437d1fa302f702d3e6
  Author: Stephen Walker <stephendwalker+github at gmail.com>
  Date:   2023-07-02 (Sun, 02 Jul 2023)

  Changed paths:
    M uscan/index-21.02.html
    M uscan/index-22.03.html
    M uscan/index.html

  Log Message:
  -----------
  This week's update




From kamil.tralewski at commercesolutions.pl  Wed Jul  5 01:05:54 2023
From: kamil.tralewski at commercesolutions.pl (Kamil Tralewski)
Date: Wed,  5 Jul 2023 08:05:54 GMT
Subject: =?UTF-8?Q?S=C5=82owa_kluczowe_do_wypozycjonowania?=
Message-ID: <20230705064500-0.1.76.177ew.0.2up0hkf702@commercesolutions.pl>

Dzie? dobry,

zapozna?em si? z Pa?stwa ofert? i z przyjemno?ci? przyznaj?, ?e przyci?ga uwag? i zach?ca do dalszych rozm?w. 

Pomy?la?em, ?e mo?e m?g?bym mie? sw?j wk?ad w Pa?stwa rozw?j i pom?c dotrze? z t? ofert? do wi?kszego grona odbiorc?w. Pozycjonuj? strony www, dzi?ki czemu generuj? ?wietny ruch w sieci.

Mo?emy porozmawia? w najbli?szym czasie?

Pozdrawiam
Kamil Tralewski


From xinz.06 at gmail.com  Wed Jul  5 02:27:03 2023
From: xinz.06 at gmail.com (Xin Zhen)
Date: Wed, 5 Jul 2023 09:27:03 +0000
Subject: [PATCH] Adding sw and hw tag-based KASAN support
Message-ID: <DM4PR20MB49184CB1567D8A2DBB61B3AAAD2FA@DM4PR20MB4918.namprd20.prod.outlook.com>

Hi all,
Currently KASAN is supported but only the generic one. SW-tag and HW-tag based KASAN have less impact on memory footprint or performance, and are worth supporting.

The following patch adds a choice menu in the menuconfig, allowing SW-tag or HW-tag to be selected.


commit a1db3ed8ad00a136f815a48e07962c96d777b38d
Author: Zhen XIN <zhen.xin at nokia-sbell.com>
Date:   Tue Jul 4 09:44:01 2023 +0000

    build: Add option KERNEL_KASAN_SW_TAGS and HW_TAGS
    
    Add choice menu for software and hardware Tag-Based KASAN, in addition to the generic one.
    
    Signed-off-by: Zhen XIN <zhen.xin at nokia-sbell.com>

diff --git a/config/Config-kernel.in b/config/Config-kernel.in
index 7de0d17b5e..00276bffb4 100644
--- a/config/Config-kernel.in
+++ b/config/Config-kernel.in
@@ -184,16 +184,73 @@ config KERNEL_KASAN_VMALLOC
 	  will have no effect.
 
 if KERNEL_KASAN
-	config KERNEL_KASAN_GENERIC
-	def_bool y
+choice
+	prompt "KASAN mode"
+	depends on KERNEL_KASAN
+	default KERNEL_KASAN_GENERIC
+	help
+	  KASAN has three modes:
+
+	  1. Generic KASAN (supported by many architectures, enabled with
+	     CONFIG_KASAN_GENERIC, similar to userspace ASan),
+	  2. Software Tag-Based KASAN (arm64 only, based on software memory
+	     tagging, enabled with CONFIG_KASAN_SW_TAGS, similar to userspace
+	     HWASan), and
+	  3. Hardware Tag-Based KASAN (arm64 only, based on hardware memory
+	     tagging, enabled with CONFIG_KASAN_HW_TAGS).
+
+config KERNEL_KASAN_GENERIC
+	bool "Generic KASAN"
+	select KERNEL_SLUB_DEBUG
+	help
+	  Enables Generic KASAN.
+
+	  Consumes about 1/8th of available memory at kernel start and adds an
+	  overhead of ~50% for dynamic allocations.
+	  The performance slowdown is ~x3.
+
+config KERNEL_KASAN_SW_TAGS
+	bool "Software Tag-Based KASAN"
+	depends on aarch64
+	select KERNEL_SLUB_DEBUG
+	help
+	  Enables Software Tag-Based KASAN.
+
+	  Supported only on arm64 CPUs and relies on Top Byte Ignore.
+
+	  Consumes about 1/16th of available memory at kernel start and
+	  add an overhead of ~20% for dynamic allocations.
+
+	  May potentially introduce problems related to pointer casting and
+	  comparison, as it embeds a tag into the top byte of each pointer.
+
+config KERNEL_KASAN_HW_TAGS
+	bool "Hardware Tag-Based KASAN"
+	depends on aarch64
+	select KERNEL_SLUB_DEBUG
+	select KERNEL_ARM64_MTE
+	help
+	  Enables Hardware Tag-Based KASAN.
+
+	  Supported only on arm64 CPUs starting from ARMv8.5 and relies on
+	  Memory Tagging Extension and Top Byte Ignore.
+
+	  Consumes about 1/32nd of available memory.
+
+	  May potentially introduce problems related to pointer casting and
+	  comparison, as it embeds a tag into the top byte of each pointer.
+
+endchoice
+
+	config KERNEL_ARM64_MTE
+		def_bool n
 
-	config KERNEL_KASAN_SW_TAGS
-	def_bool n
 endif
 
 choice
 	prompt "Instrumentation type"
 	depends on KERNEL_KASAN
+	depends on !KERNEL_KASAN_HW_TAGS
 	default KERNEL_KASAN_OUTLINE
 
 config KERNEL_KASAN_OUTLINE


From koen.vandeputte at citymesh.com  Wed Jul  5 05:24:47 2023
From: koen.vandeputte at citymesh.com (Koen Vandeputte)
Date: Wed,  5 Jul 2023 14:24:47 +0200
Subject: [PATCH] libnl: add support for cli
Message-ID: <20230705122447.2825792-1-koen.vandeputte@citymesh.com>

Some packages (like wavemon >= 0.9.4) depend on libnl-cli

Add support for this part of the lib.
libnl-cli itself depends on libnl-genl and libnl-nf
On MIPS, this component adds 81kB

Signed-off-by: Koen Vandeputte <koen.vandeputte at citymesh.com>
---
 package/libs/libnl/Makefile | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/package/libs/libnl/Makefile b/package/libs/libnl/Makefile
index 56549dcc0a..f8c7437668 100644
--- a/package/libs/libnl/Makefile
+++ b/package/libs/libnl/Makefile
@@ -55,10 +55,16 @@ $(call Package/libnl/default)
   DEPENDS:=+libnl-route
 endef
 
+define Package/libnl-cli
+$(call Package/libnl/default)
+  TITLE:=CLI Netlink Library
+  DEPENDS:=+libnl-genl +libnl-nf
+endef
+
 define Package/libnl
 $(call Package/libnl/default)
   TITLE:=Full Netlink Library
-  DEPENDS:=+libnl-genl +libnl-route +libnl-nf
+  DEPENDS:=+libnl-genl +libnl-route +libnl-nf +libnl-cli
 endef
 
 define Package/libnl-core/description
@@ -77,6 +83,10 @@ define Package/libnl-nf/description
  Netfilter Netlink Library Functions
 endef
 
+define Package/libnl-cli/description
+ CLI Netlink Library Functions
+endef
+
 define Package/libnl/description
  Socket handling, connection management, sending and receiving of data,
  message construction and parsing, object caching system, etc.
@@ -98,6 +108,7 @@ define Build/InstallDev
 	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-genl-3.so $(1)/usr/lib/libnl-genl.so
 	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-nf-3.so $(1)/usr/lib/libnl-nf.so
 	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-route-3.so $(1)/usr/lib/libnl-route.so
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-cli-3.so $(1)/usr/lib/libnl-cli.so
 endef
 
 define Package/libnl-core/install
@@ -120,6 +131,11 @@ define Package/libnl-nf/install
 	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-nf-3.so.* $(1)/usr/lib/
 endef
 
+define Package/libnl-cli/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-cli-3.so.* $(1)/usr/lib/
+endef
+
 define Package/libnl/install
 	:
 endef
@@ -128,4 +144,5 @@ $(eval $(call BuildPackage,libnl-core))
 $(eval $(call BuildPackage,libnl-genl))
 $(eval $(call BuildPackage,libnl-route))
 $(eval $(call BuildPackage,libnl-nf))
+$(eval $(call BuildPackage,libnl-cli))
 $(eval $(call BuildPackage,libnl))
-- 
2.34.1



From daniel at dd-wrt.com  Wed Jul  5 06:08:24 2023
From: daniel at dd-wrt.com (Daniel Danzberger)
Date: Wed,  5 Jul 2023 15:08:24 +0200
Subject: [PATCH] umbim: Add mbim message timeout option, -T
Message-ID: <20230705130824.1315847-1-daniel@dd-wrt.com>

Some modems, depending on their state and connection quality can take
longer than 15 seconds to answer mbim message requests.

This commit adds the -T option, allowing the user to specifiy a custom
message timeout in seconds.

Default is still 15.

Signed-off-by: Daniel Danzberger <daniel at dd-wrt.com>
---
 cli.c      | 9 +++++++--
 mbim-dev.c | 2 +-
 mbim.h     | 1 +
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/cli.c b/cli.c
index 3a845d4..b23fc6d 100644
--- a/cli.c
+++ b/cli.c
@@ -35,6 +35,7 @@
 
 int return_code = -1;
 int verbose;
+int msg_timeout_ms = 15 * 1000;
 
 struct mbim_handler *current_handler;
 static uint8_t uuid_context_type_internet[16] = { 0x7E, 0x5E, 0x2A, 0x7E, 0x4E, 0x6F, 0x72, 0x72, 0x73, 0x6B, 0x65, 0x6E, 0x7E, 0x5E, 0x2A, 0x7E };
@@ -533,7 +534,8 @@ usage(void)
 #endif
 		"    -d <device>	the device (/dev/cdc-wdmX)\n"
 		"    -t <transaction>	the transaction id\n"
-		"    -n 		no close\n\n"
+		"    -n 		no close\n"
+		"    -T 		MBIM message timeout in seconds [15]\n\n"
 		"    -v 		verbose\n\n");
 	return 1;
 }
@@ -548,7 +550,7 @@ main(int argc, char **argv)
 	int proxy = 0;
 #endif
 
-	while ((ch = getopt(argc, argv, "pnvd:t:")) != -1) {
+	while ((ch = getopt(argc, argv, "pnvd:t:T:")) != -1) {
 		switch (ch) {
 		case 'v':
 			verbose = 1;
@@ -563,6 +565,9 @@ main(int argc, char **argv)
 			no_open = 1;
 			transaction_id = atoi(optarg);
 			break;
+		case 'T':
+			msg_timeout_ms = atoi(optarg) * 1000;
+			break;
 #ifdef LIBQMI_MBIM_PROXY
 		case 'p':
 			proxy = 1;
diff --git a/mbim-dev.c b/mbim-dev.c
index 2a94d49..12d1189 100644
--- a/mbim-dev.c
+++ b/mbim-dev.c
@@ -78,7 +78,7 @@ mbim_send(void)
 		perror("writing data failed: ");
 	} else {
 		expected = le32toh(hdr->type) | 0x80000000;
-		uloop_timeout_set(&tout, 15000);
+		uloop_timeout_set(&tout, msg_timeout_ms);
 	}
 	return ret;
 }
diff --git a/mbim.h b/mbim.h
index 746257e..28999b5 100644
--- a/mbim.h
+++ b/mbim.h
@@ -20,6 +20,7 @@
 
 extern int return_code;
 extern int verbose;
+extern int msg_timeout_ms;
 
 #include "mbim-type.h"
 #include "mbim-enum.h"
-- 
2.40.1



From evil.function at proton.me  Wed Jul  5 08:03:23 2023
From: evil.function at proton.me (Eric)
Date: Wed, 05 Jul 2023 15:03:23 +0000
Subject: [PATCH] umbim: Add mbim message timeout option, -T
In-Reply-To: <20230705130824.1315847-1-daniel@dd-wrt.com>
References: <20230705130824.1315847-1-daniel@dd-wrt.com>
Message-ID: <-eebQ5klBUWPh3INVXuuu-LmcDQ79sQgIDwclprxraBDuw1aRlnoD7oKDZ8pJtyOqfSlJkxqEwT0RMBMWhFfAj2mDRkkNz7T3OkXBtRU5-Y=@proton.me>

On Wednesday, July 5th, 2023 at 06:08, Daniel Danzberger <daniel at dd-wrt.com> wrote:
> Some modems, depending on their state and connection quality can take
> longer than 15 seconds to answer mbim message requests.
> 
> This commit adds the -T option, allowing the user to specifiy a custom
> message timeout in seconds.
> 
> Default is still 15.
> 
> Signed-off-by: Daniel Danzberger daniel at dd-wrt.com
> 
> ---
> cli.c | 9 +++++++--
> mbim-dev.c | 2 +-
> mbim.h | 1 +
> 3 files changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/cli.c b/cli.c
> index 3a845d4..b23fc6d 100644
> --- a/cli.c
> +++ b/cli.c
> @@ -35,6 +35,7 @@
> 
> int return_code = -1;
> int verbose;
> +int msg_timeout_ms = 15 * 1000;
> 
> struct mbim_handler *current_handler;
> static uint8_t uuid_context_type_internet[16] = { 0x7E, 0x5E, 0x2A, 0x7E, 0x4E, 0x6F, 0x72, 0x72, 0x73, 0x6B, 0x65, 0x6E, 0x7E, 0x5E, 0x2A, 0x7E };
> @@ -533,7 +534,8 @@ usage(void)
> #endif
> " -d <device> the device (/dev/cdc-wdmX)\n"
> 
> " -t <transaction> the transaction id\n"
> 
> - " -n no close\n\n"
> + " -n no close\n"
> + " -T MBIM message timeout in seconds [15]\n\n"

Shouldn't the usage indicate explicitly that it takes a parameter, as do -d and -t?

   " -T <seconds>    MBIM message timeout...

> " -v verbose\n\n");
> return 1;
> }
> @@ -548,7 +550,7 @@ main(int argc, char **argv)
> int proxy = 0;
> #endif
> 
> - while ((ch = getopt(argc, argv, "pnvd:t:")) != -1) {
> + while ((ch = getopt(argc, argv, "pnvd:t:T:")) != -1) {
> switch (ch) {
> case 'v':
> verbose = 1;
> @@ -563,6 +565,9 @@ main(int argc, char **argv)
> no_open = 1;
> transaction_id = atoi(optarg);
> break;
> + case 'T':
> + msg_timeout_ms = atoi(optarg) * 1000;
> + break;
> #ifdef LIBQMI_MBIM_PROXY
> case 'p':
> proxy = 1;
> diff --git a/mbim-dev.c b/mbim-dev.c
> index 2a94d49..12d1189 100644
> --- a/mbim-dev.c
> +++ b/mbim-dev.c
> @@ -78,7 +78,7 @@ mbim_send(void)
> perror("writing data failed: ");
> } else {
> expected = le32toh(hdr->type) | 0x80000000;
> 
> - uloop_timeout_set(&tout, 15000);
> + uloop_timeout_set(&tout, msg_timeout_ms);
> }
> return ret;
> }
> diff --git a/mbim.h b/mbim.h
> index 746257e..28999b5 100644
> --- a/mbim.h
> +++ b/mbim.h
> @@ -20,6 +20,7 @@
> 
> extern int return_code;
> extern int verbose;
> +extern int msg_timeout_ms;
> 
> #include "mbim-type.h"
> #include "mbim-enum.h"
> --
> 2.40.1



From daniel at dd-wrt.com  Wed Jul  5 08:04:55 2023
From: daniel at dd-wrt.com (Daniel Danzberger)
Date: Wed, 05 Jul 2023 17:04:55 +0200
Subject: [PATCH] umbim: Add mbim message timeout option, -T
In-Reply-To: <-eebQ5klBUWPh3INVXuuu-LmcDQ79sQgIDwclprxraBDuw1aRlnoD7oKDZ8pJtyOqfSlJkxqEwT0RMBMWhFfAj2mDRkkNz7T3OkXBtRU5-Y=@proton.me>
References: <20230705130824.1315847-1-daniel@dd-wrt.com>
	 <-eebQ5klBUWPh3INVXuuu-LmcDQ79sQgIDwclprxraBDuw1aRlnoD7oKDZ8pJtyOqfSlJkxqEwT0RMBMWhFfAj2mDRkkNz7T3OkXBtRU5-Y=@proton.me>
Message-ID: <af5e8ad099098f97f5a7c7c8897c0b9d28142268.camel@dd-wrt.com>

On Wed, 2023-07-05 at 15:03 +0000, Eric wrote:
> On Wednesday, July 5th, 2023 at 06:08, Daniel Danzberger <daniel at dd-wrt.com> wrote:
> > Some modems, depending on their state and connection quality can take
> > longer than 15 seconds to answer mbim message requests.
> > 
> > This commit adds the -T option, allowing the user to specifiy a custom
> > message timeout in seconds.
> > 
> > Default is still 15.
> > 
> > Signed-off-by: Daniel Danzberger daniel at dd-wrt.com
> > 
> > ---
> > cli.c | 9 +++++++--
> > mbim-dev.c | 2 +-
> > mbim.h | 1 +
> > 3 files changed, 9 insertions(+), 3 deletions(-)
> > 
> > diff --git a/cli.c b/cli.c
> > index 3a845d4..b23fc6d 100644
> > --- a/cli.c
> > +++ b/cli.c
> > @@ -35,6 +35,7 @@
> > 
> > int return_code = -1;
> > int verbose;
> > +int msg_timeout_ms = 15 * 1000;
> > 
> > struct mbim_handler *current_handler;
> > static uint8_t uuid_context_type_internet[16] = { 0x7E, 0x5E, 0x2A, 0x7E, 0x4E, 0x6F, 0x72, 0x72, 0x73, 0x6B, 0x65, 0x6E, 0x7E, 0x5E, 0x2A, 0x7E
> > };
> > @@ -533,7 +534,8 @@ usage(void)
> > #endif
> > " -d <device> the device (/dev/cdc-wdmX)\n"
> > 
> > " -t <transaction> the transaction id\n"
> > 
> > - " -n no close\n\n"
> > + " -n no close\n"
> > + " -T MBIM message timeout in seconds [15]\n\n"
> 
> Shouldn't the usage indicate explicitly that it takes a parameter, as do -d and -t?
> 
> ?? " -T <seconds>??? MBIM message timeout...
Yes, makes sense.
> 
> > " -v verbose\n\n");
> > return 1;
> > }
> > @@ -548,7 +550,7 @@ main(int argc, char **argv)
> > int proxy = 0;
> > #endif
> > 
> > - while ((ch = getopt(argc, argv, "pnvd:t:")) != -1) {
> > + while ((ch = getopt(argc, argv, "pnvd:t:T:")) != -1) {
> > switch (ch) {
> > case 'v':
> > verbose = 1;
> > @@ -563,6 +565,9 @@ main(int argc, char **argv)
> > no_open = 1;
> > transaction_id = atoi(optarg);
> > break;
> > + case 'T':
> > + msg_timeout_ms = atoi(optarg) * 1000;
> > + break;
> > #ifdef LIBQMI_MBIM_PROXY
> > case 'p':
> > proxy = 1;
> > diff --git a/mbim-dev.c b/mbim-dev.c
> > index 2a94d49..12d1189 100644
> > --- a/mbim-dev.c
> > +++ b/mbim-dev.c
> > @@ -78,7 +78,7 @@ mbim_send(void)
> > perror("writing data failed: ");
> > } else {
> > expected = le32toh(hdr->type) | 0x80000000;
> > 
> > - uloop_timeout_set(&tout, 15000);
> > + uloop_timeout_set(&tout, msg_timeout_ms);
> > }
> > return ret;
> > }
> > diff --git a/mbim.h b/mbim.h
> > index 746257e..28999b5 100644
> > --- a/mbim.h
> > +++ b/mbim.h
> > @@ -20,6 +20,7 @@
> > 
> > extern int return_code;
> > extern int verbose;
> > +extern int msg_timeout_ms;
> > 
> > #include "mbim-type.h"
> > #include "mbim-enum.h"
> > --
> > 2.40.1
> 
> 

-- 
Regards

Daniel Danzberger
embeDD GmbH, Alter Postplatz 2, CH-6370 Stans


From tmn505 at terefe.re  Fri Jul  7 07:23:30 2023
From: tmn505 at terefe.re (Tomasz Maciej Nowak)
Date: Fri,  7 Jul 2023 16:23:30 +0200
Subject: [PATCH 3/3] ipq40xx: pakedge_wr-1: workaround for kernel bigger than 4MiB
In-Reply-To: <20230707144229.23323-1-tmn505@terefe.re>
References: <20230707144229.23323-1-tmn505@terefe.re>
Message-ID: <20230707144229.23323-4-tmn505@terefe.re>

From: Tomasz Maciej Nowak <tmn505 at gmail.com>

Alter command boot sequence in U-Boot on first boot after upgrade to
workaround the kernel size limitation. The kernel size read from flash
will be 8MiB, which should suffice for forseable future. As precaution a
warning interupting upgrade is emited, explaining what to do.

Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
---
 .../etc/uci-defaults/05_fix-compat-version         |  3 ++-
 .../base-files/lib/preinit/81_patch_uboot_env.sh   | 14 ++++++++++++++
 target/linux/ipq40xx/image/generic.mk              | 10 +++++++++-
 3 files changed, 25 insertions(+), 2 deletions(-)
 create mode 100644 target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh

diff --git a/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
index c01192089712..a3f90125c6e5 100644
--- a/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
+++ b/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
@@ -4,7 +4,8 @@ case "$(board_name)" in
 linksys,ea6350v3|\
 linksys,ea8300|\
 linksys,mr8300|\
-ezviz,cs-w3-wd1200g-eup)
+ezviz,cs-w3-wd1200g-eup|\
+pakedge,wr-1)
 	uci set system. at system[0].compat_version="2.0"
 	uci commit system
 	;;
diff --git a/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh b/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh
new file mode 100644
index 000000000000..b5e508aac402
--- /dev/null
+++ b/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh
@@ -0,0 +1,14 @@
+. /lib/functions.sh
+
+preinit_patch_uboot_env() {
+	case $(board_name) in
+	pakedge,wr-1)
+		if ! fw_printenv -n OpenWrt &>/dev/null; then
+			fw_setenv OpenWrt 'sf probe; sf read 0x84000000 0x180000 0x800000; bootm 0x84000000'
+			fw_setenv bootcmd "$(fw_printenv -n bootcmd | sed -e 's,bootipq,run OpenWrt,p')"
+		fi
+		;;
+	esac
+}
+
+boot_hook_add preinit_main preinit_patch_uboot_env
diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
index d9d60a25ff0f..0dadae122a87 100644
--- a/target/linux/ipq40xx/image/generic.mk
+++ b/target/linux/ipq40xx/image/generic.mk
@@ -958,8 +958,16 @@ define Device/pakedge_wr-1
 	SOC := qcom-ipq4018
 	BLOCKSIZE := 64k
 	IMAGE_SIZE := 31232k
-	KERNEL_SIZE := 4096k
+	KERNEL_SIZE := 8192k
 	IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | append-metadata
+	DEVICE_COMPAT_VERSION := 2.0
+	DEVICE_COMPAT_MESSAGE := \n$\
+		Booting command in U-Boot needs to be changed because of kernel \n$\
+		growing beyond 4MiB. If OpenWrt 23.05.0 or later is running on \n$\
+		on the device, it has already been done and You can safely force \n$\
+		upgrade. If that's not the case, first upgrade to 23.05.0 and it \n$\
+		will automatically amend booting command in U-Boot on first boot. \n$\
+		Then proceed with the upgrade to desired version.
 endef
 TARGET_DEVICES += pakedge_wr-1
 
-- 
2.41.0



From tmn505 at terefe.re  Fri Jul  7 07:23:28 2023
From: tmn505 at terefe.re (Tomasz Maciej Nowak)
Date: Fri,  7 Jul 2023 16:23:28 +0200
Subject: [PATCH 1/3] ipq40xx: image: limit kernel size for NOR devices
In-Reply-To: <20230707144229.23323-1-tmn505@terefe.re>
References: <20230707144229.23323-1-tmn505@terefe.re>
Message-ID: <20230707144229.23323-2-tmn505@terefe.re>

From: Tomasz Maciej Nowak <tmn505 at gmail.com>

'bootipq' command, on some devices with kernel on NOR flash chip, read
kernel partition size from Qualcomm proprietary partition table, which
seems to be stored in MIBIB partition. The partition table can be read
by 'smeminfo' command in U-Boot command line interface. Because this
partition table is never updated on sysupgrade (even when the kernel
size changes) kernel size is capped at initial value, usually 4MiB.
Sysupgrading such kernel will soft-brick the device, which will need
serial console for recovery. Some devices already suffer from this,
beacuse its U-Boot does not allow to boot LZMA compressed kernel image
and/or kernel zImage. Even some devices allowing to boot LZMA compressed
kernel will hit this limitation later. Therefore limit the kernel size
to 4MiB for devices not having it specified, so we won't create
soft-bricking images.

Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
---
 target/linux/ipq40xx/image/generic.mk | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
index f15463ae8ca5..d9d60a25ff0f 100644
--- a/target/linux/ipq40xx/image/generic.mk
+++ b/target/linux/ipq40xx/image/generic.mk
@@ -130,6 +130,7 @@ define Device/8dev_habanero-dvk
 	DEVICE_VENDOR := 8devices
 	DEVICE_MODEL := Habanero DVK
 	IMAGE_SIZE := 30976k
+	KERNEL_SIZE := 4096k
 	SOC := qcom-ipq4019
 	IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | append-rootfs | pad-rootfs | check-size | append-metadata
 endef
@@ -400,6 +401,7 @@ define Device/dlink_dap-2610
 	WRGG_DEVNAME := /dev/mtdblock/8
 	WRGG_SIGNATURE := wapac30_dkbs_dap2610
 	IMAGE_SIZE := 14080k
+	KERNEL_SIZE := 4096k
 	IMAGES += factory.bin
 	# Bootloader expects a special 160 byte header which is added by
 	# wrgg-image.
@@ -478,6 +480,7 @@ define Device/engenius_emd1
 	DEVICE_DTS_CONFIG := config at 4
 	SOC := qcom-ipq4018
 	IMAGE_SIZE := 30720k
+	KERNEL_SIZE := 4096k
 	IMAGES += factory.bin
 	IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
 	IMAGE/factory.bin := qsdk-ipq-factory-nor | check-size
@@ -800,6 +803,7 @@ define Device/netgear_ex61x0v2
 	NETGEAR_BOARD_ID := EX6150v2series
 	NETGEAR_HW_ID := 29765285+16+0+128+2x2
 	IMAGE_SIZE := 14400k
+	KERNEL_SIZE := 4096k
 	SOC := qcom-ipq4018
 endef
 
@@ -954,6 +958,7 @@ define Device/pakedge_wr-1
 	SOC := qcom-ipq4018
 	BLOCKSIZE := 64k
 	IMAGE_SIZE := 31232k
+	KERNEL_SIZE := 4096k
 	IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | append-metadata
 endef
 TARGET_DEVICES += pakedge_wr-1
@@ -1030,6 +1035,7 @@ define Device/qxwlan_e2600ac-c1
 	BOARD_NAME := e2600ac-c1
 	SOC := qcom-ipq4019
 	IMAGE_SIZE := 31232k
+	KERNEL_SIZE := 4096k
 	IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
 endef
 TARGET_DEVICES += qxwlan_e2600ac-c1
@@ -1202,6 +1208,7 @@ define Device/zyxel_wre6606
 	DEVICE_DTS_CONFIG := config at 4
 	SOC := qcom-ipq4018
 	IMAGE_SIZE := 13184k
+	KERNEL_SIZE := 4096k
 	IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | check-size | append-metadata
 	DEVICE_PACKAGES := -kmod-ath10k-ct kmod-ath10k-ct-smallbuffers
 endef
-- 
2.41.0



From tmn505 at terefe.re  Fri Jul  7 07:23:29 2023
From: tmn505 at terefe.re (Tomasz Maciej Nowak)
Date: Fri,  7 Jul 2023 16:23:29 +0200
Subject: [PATCH 2/3] ipq40xx: dts: allow writing to U-Boot environment
In-Reply-To: <20230707144229.23323-1-tmn505@terefe.re>
References: <20230707144229.23323-1-tmn505@terefe.re>
Message-ID: <20230707144229.23323-3-tmn505@terefe.re>

From: Tomasz Maciej Nowak <tmn505 at gmail.com>

Devices allowing to boot LZMA compressed kernel or zImage kernel didn't
hit yet the 4MiB boundary for kernel size, thus allowing to prepare
workaround for the issue, without need for serial console attachment.
The workaround is modifying 'bootcmd' variable in U-Boot environment
which will replace 'bootipq' command with equivalent not limited by
imposed partition table.
This commit also touches devices which boot uncompressed kernel, so
even if those are already soft-bricked, it will still allow to alter
U-Boot environment from initramfs booted device.

Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
---
 .../files/arch/arm/boot/dts/qcom-ipq4018-cs-w3-wd1200g-eup.dts   | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-dap-2610.dts    | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-eap1300.dts     | 1 -
 .../linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emd1.dts  | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emr3500.dts     | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ens620ext.dts   | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi   | 1 -
 .../linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wr-1.dts  | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wre6606.dts     | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts  | 1 -
 .../files/arch/arm/boot/dts/qcom-ipq4019-habanero-dvk.dts        | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-u4019-32m.dts   | 1 -
 .../linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-x1pro.dts | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts      | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts    | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts    | 1 -
 16 files changed, 16 deletions(-)

diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-cs-w3-wd1200g-eup.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-cs-w3-wd1200g-eup.dts
index 22a48c12c44e..0772c5ac464a 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-cs-w3-wd1200g-eup.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-cs-w3-wd1200g-eup.dts
@@ -185,7 +185,6 @@
 			partition5 at E0000 {
 				label = "APPSBLENV";
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 
 			partition6 at F0000 {
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-dap-2610.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-dap-2610.dts
index 493905d56d8f..dea90b13e209 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-dap-2610.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-dap-2610.dts
@@ -117,7 +117,6 @@
 			partition at e0000 {
 				label = "APPSBLENV";
 				reg = <0xe0000 0x10000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-eap1300.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-eap1300.dts
index a8f24aa00e60..2e9cb8ecdb68 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-eap1300.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-eap1300.dts
@@ -165,7 +165,6 @@
 			partition5 at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 			partition6 at f0000 {
 				label = "0:APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emd1.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emd1.dts
index 396595ba5185..615c6aaf678f 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emd1.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emd1.dts
@@ -163,7 +163,6 @@
 			partition5 at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 			partition6 at f0000 {
 				label = "0:APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emr3500.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emr3500.dts
index 361614945145..8c038917b668 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emr3500.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emr3500.dts
@@ -164,7 +164,6 @@
 			partition at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "0:APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ens620ext.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ens620ext.dts
index 69275e24b8cd..bba1dd89b7a8 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ens620ext.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ens620ext.dts
@@ -184,7 +184,6 @@
 			partition at e0000 {
 				label = "APPSBLENV"; /* uboot env*/
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "APPSBL"; /* uboot */
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi
index dc5c25c84ab7..b4d9d195c7f4 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi
@@ -228,7 +228,6 @@
 			partition5 at E0000 {
 				label = "APPSBLENV";
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 
 			partition6 at F0000 {
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wr-1.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wr-1.dts
index 16951da47fc0..4c707e73d862 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wr-1.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wr-1.dts
@@ -140,7 +140,6 @@
 			partition at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0x00e0000 0x0010000>;
-				read-only;
 			};
 
 			partition at f0000 {
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wre6606.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wre6606.dts
index efb267ae3692..decd7d5fdcc0 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wre6606.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wre6606.dts
@@ -195,7 +195,6 @@
 			partition5 at E0000 {
 				label = "APPSBLENV";
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 
 			partition6 at F0000 {
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts
index 70e05c7eef3a..eac11b02d144 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts
@@ -57,7 +57,6 @@
 			partition at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0xe0000 0x10000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "0:APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-habanero-dvk.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-habanero-dvk.dts
index 23a654dcff5a..690db0143891 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-habanero-dvk.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-habanero-dvk.dts
@@ -262,7 +262,6 @@
 			partition at e0000 {
 				label = "APPSBLENV"; /* uboot env */
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "APPSBL"; /* uboot */
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-u4019-32m.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-u4019-32m.dts
index 4efcdaf39418..5304870a43fa 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-u4019-32m.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-u4019-32m.dts
@@ -54,7 +54,6 @@
 			partition at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0xe0000 0x10000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "0:APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-x1pro.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-x1pro.dts
index 681300c502bf..aa401892fef3 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-x1pro.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-x1pro.dts
@@ -56,7 +56,6 @@
 			partition at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0xe0000 0x10000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "0:APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts
index 48b5cd53d80b..a1ede1dcbdb1 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts
@@ -205,7 +205,6 @@
 			partition5 at e0000 {
 				label = "0:APPSBLENV"; /* uboot env*/
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 			partition5 at f0000 {
 				label = "0:APPSBL"; /* uboot */
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts
index 7e4519a74661..78d044b67893 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts
@@ -182,7 +182,6 @@
 			APPSBLENV at e0000 {
 				label = "APPSBLENV";
 				reg = <0xe0000 0x10000>;
-				read-only;
 			};
 
 			APPSBL at f0000 {
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts
index 0e7f4c970f47..752397a1752d 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts
@@ -180,7 +180,6 @@
 			APPSBLENV at e0000 {
 				label = "APPSBLENV";
 				reg = <0xe0000 0x10000>;
-				read-only;
 			};
 
 			APPSBL at f0000 {
-- 
2.41.0



From tmn505 at terefe.re  Fri Jul  7 07:23:27 2023
From: tmn505 at terefe.re (Tomasz Maciej Nowak)
Date: Fri,  7 Jul 2023 16:23:27 +0200
Subject: [PATCH 0/3] ipq40xx: remedy potential of producing
Message-ID: <20230707144229.23323-1-tmn505@terefe.re>

From: Tomasz Maciej Nowak <tmn505 at gmail.com>

Some of devices having kernel on NOR flash could reach limit of kernel
partition size at 4MiB and soft-brick them. Unfortunately we don't know
if all of them are affected, thus kernel size limit is added to all of
remaining ones. Later commit allows for some devices to prepare painless
transition, while the last one shows how it can be done for device i
introduced. I tried to make transition for the device as generic as
possible so it coulld be used on others, but unfortunately I own only
one device, which means the owners of the rest device need to verify if
it works for them and add their devices.

Tomasz Maciej Nowak (3):
  ipq40xx: image: limit kernel size for NOR devices
  ipq40xx: dts: allow writing to U-Boot environment
  ipq40xx: pakedge_wr-1: workaround for kernel bigger than 4MiB

 .../etc/uci-defaults/05_fix-compat-version        |  3 ++-
 .../base-files/lib/preinit/81_patch_uboot_env.sh  | 14 ++++++++++++++
 .../boot/dts/qcom-ipq4018-cs-w3-wd1200g-eup.dts   |  1 -
 .../arch/arm/boot/dts/qcom-ipq4018-dap-2610.dts   |  1 -
 .../arch/arm/boot/dts/qcom-ipq4018-eap1300.dts    |  1 -
 .../files/arch/arm/boot/dts/qcom-ipq4018-emd1.dts |  1 -
 .../arch/arm/boot/dts/qcom-ipq4018-emr3500.dts    |  1 -
 .../arch/arm/boot/dts/qcom-ipq4018-ens620ext.dts  |  1 -
 .../arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi  |  1 -
 .../files/arch/arm/boot/dts/qcom-ipq4018-wr-1.dts |  1 -
 .../arch/arm/boot/dts/qcom-ipq4018-wre6606.dts    |  1 -
 .../arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts |  1 -
 .../arm/boot/dts/qcom-ipq4019-habanero-dvk.dts    |  1 -
 .../arch/arm/boot/dts/qcom-ipq4019-u4019-32m.dts  |  1 -
 .../arch/arm/boot/dts/qcom-ipq4019-x1pro.dts      |  1 -
 .../arch/arm/boot/dts/qcom-ipq4028-wpj428.dts     |  1 -
 .../arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts   |  1 -
 .../arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts   |  1 -
 target/linux/ipq40xx/image/generic.mk             | 15 +++++++++++++++
 19 files changed, 31 insertions(+), 17 deletions(-)
 create mode 100644 target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh

-- 
2.41.0



From tmn505 at terefe.re  Fri Jul  7 08:11:41 2023
From: tmn505 at terefe.re (Tomasz Maciej Nowak)
Date: Fri,  7 Jul 2023 17:11:41 +0200
Subject: [PATCH v2 1/3] ipq40xx: image: limit kernel size for NOR devices
In-Reply-To: <20230707151950.25859-1-tmn505@terefe.re>
References: <20230707151950.25859-1-tmn505@terefe.re>
Message-ID: <20230707151950.25859-2-tmn505@terefe.re>

From: Tomasz Maciej Nowak <tmn505 at gmail.com>

'bootipq' command, on some devices with kernel on NOR flash chip, read
kernel partition size from Qualcomm proprietary partition table, which
seems to be stored in MIBIB partition. The partition table can be read
by 'smeminfo' command in U-Boot command line interface. Because this
partition table is never updated on sysupgrade (even when the kernel
size changes) kernel size is capped at initial value, usually 4MiB.
Sysupgrading such kernel will soft-brick the device, which will need
serial console for recovery. Some devices already suffer from this,
beacuse its U-Boot does not allow to boot LZMA compressed kernel image
and/or kernel zImage. Even some devices allowing to boot LZMA compressed
kernel will hit this limitation later. Therefore limit the kernel size
to 4MiB for devices not having it specified, so we won't create
soft-bricking images.

Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
---
 target/linux/ipq40xx/image/generic.mk | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
index f15463ae8ca5..d9d60a25ff0f 100644
--- a/target/linux/ipq40xx/image/generic.mk
+++ b/target/linux/ipq40xx/image/generic.mk
@@ -130,6 +130,7 @@ define Device/8dev_habanero-dvk
 	DEVICE_VENDOR := 8devices
 	DEVICE_MODEL := Habanero DVK
 	IMAGE_SIZE := 30976k
+	KERNEL_SIZE := 4096k
 	SOC := qcom-ipq4019
 	IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | append-rootfs | pad-rootfs | check-size | append-metadata
 endef
@@ -400,6 +401,7 @@ define Device/dlink_dap-2610
 	WRGG_DEVNAME := /dev/mtdblock/8
 	WRGG_SIGNATURE := wapac30_dkbs_dap2610
 	IMAGE_SIZE := 14080k
+	KERNEL_SIZE := 4096k
 	IMAGES += factory.bin
 	# Bootloader expects a special 160 byte header which is added by
 	# wrgg-image.
@@ -478,6 +480,7 @@ define Device/engenius_emd1
 	DEVICE_DTS_CONFIG := config at 4
 	SOC := qcom-ipq4018
 	IMAGE_SIZE := 30720k
+	KERNEL_SIZE := 4096k
 	IMAGES += factory.bin
 	IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
 	IMAGE/factory.bin := qsdk-ipq-factory-nor | check-size
@@ -800,6 +803,7 @@ define Device/netgear_ex61x0v2
 	NETGEAR_BOARD_ID := EX6150v2series
 	NETGEAR_HW_ID := 29765285+16+0+128+2x2
 	IMAGE_SIZE := 14400k
+	KERNEL_SIZE := 4096k
 	SOC := qcom-ipq4018
 endef
 
@@ -954,6 +958,7 @@ define Device/pakedge_wr-1
 	SOC := qcom-ipq4018
 	BLOCKSIZE := 64k
 	IMAGE_SIZE := 31232k
+	KERNEL_SIZE := 4096k
 	IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | append-metadata
 endef
 TARGET_DEVICES += pakedge_wr-1
@@ -1030,6 +1035,7 @@ define Device/qxwlan_e2600ac-c1
 	BOARD_NAME := e2600ac-c1
 	SOC := qcom-ipq4019
 	IMAGE_SIZE := 31232k
+	KERNEL_SIZE := 4096k
 	IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
 endef
 TARGET_DEVICES += qxwlan_e2600ac-c1
@@ -1202,6 +1208,7 @@ define Device/zyxel_wre6606
 	DEVICE_DTS_CONFIG := config at 4
 	SOC := qcom-ipq4018
 	IMAGE_SIZE := 13184k
+	KERNEL_SIZE := 4096k
 	IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | check-size | append-metadata
 	DEVICE_PACKAGES := -kmod-ath10k-ct kmod-ath10k-ct-smallbuffers
 endef
-- 
2.41.0



From tmn505 at terefe.re  Fri Jul  7 08:11:43 2023
From: tmn505 at terefe.re (Tomasz Maciej Nowak)
Date: Fri,  7 Jul 2023 17:11:43 +0200
Subject: [PATCH v2 3/3] ipq40xx: pakedge_wr-1: workaround for kernel bigger than 4MiB
In-Reply-To: <20230707151950.25859-1-tmn505@terefe.re>
References: <20230707151950.25859-1-tmn505@terefe.re>
Message-ID: <20230707151950.25859-4-tmn505@terefe.re>

From: Tomasz Maciej Nowak <tmn505 at gmail.com>

Alter command boot sequence in U-Boot on first boot after upgrade to
workaround the kernel size limitation. The kernel size read from flash
will be 8MiB, which should suffice for forseable future. As precaution a
warning interupting upgrade is emited, explaining what to do.

Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
---
 .../etc/uci-defaults/05_fix-compat-version         |  3 ++-
 .../base-files/lib/preinit/81_patch_uboot_env.sh   | 14 ++++++++++++++
 target/linux/ipq40xx/image/generic.mk              | 10 +++++++++-
 3 files changed, 25 insertions(+), 2 deletions(-)
 create mode 100644 target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh

diff --git a/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
index c01192089712..a3f90125c6e5 100644
--- a/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
+++ b/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
@@ -4,7 +4,8 @@ case "$(board_name)" in
 linksys,ea6350v3|\
 linksys,ea8300|\
 linksys,mr8300|\
-ezviz,cs-w3-wd1200g-eup)
+ezviz,cs-w3-wd1200g-eup|\
+pakedge,wr-1)
 	uci set system. at system[0].compat_version="2.0"
 	uci commit system
 	;;
diff --git a/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh b/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh
new file mode 100644
index 000000000000..0cc0ab0fca6f
--- /dev/null
+++ b/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh
@@ -0,0 +1,14 @@
+. /lib/functions.sh
+
+preinit_patch_uboot_env() {
+	case $(board_name) in
+	pakedge,wr-1)
+		if ! fw_printenv -n OpenWrt &>/dev/null; then
+			fw_setenv OpenWrt 'sf probe; sf read 0x84000000 0x180000 0x800000; bootm 0x84000000'
+			fw_setenv bootcmd "$(fw_printenv -n bootcmd | sed -e 's,bootipq,run OpenWrt,')"
+		fi
+		;;
+	esac
+}
+
+boot_hook_add preinit_main preinit_patch_uboot_env
diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
index d9d60a25ff0f..0dadae122a87 100644
--- a/target/linux/ipq40xx/image/generic.mk
+++ b/target/linux/ipq40xx/image/generic.mk
@@ -958,8 +958,16 @@ define Device/pakedge_wr-1
 	SOC := qcom-ipq4018
 	BLOCKSIZE := 64k
 	IMAGE_SIZE := 31232k
-	KERNEL_SIZE := 4096k
+	KERNEL_SIZE := 8192k
 	IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | append-metadata
+	DEVICE_COMPAT_VERSION := 2.0
+	DEVICE_COMPAT_MESSAGE := \n$\
+		Booting command in U-Boot needs to be changed because of kernel \n$\
+		growing beyond 4MiB. If OpenWrt 23.05.0 or later is running on \n$\
+		on the device, it has already been done and You can safely force \n$\
+		upgrade. If that's not the case, first upgrade to 23.05.0 and it \n$\
+		will automatically amend booting command in U-Boot on first boot. \n$\
+		Then proceed with the upgrade to desired version.
 endef
 TARGET_DEVICES += pakedge_wr-1
 
-- 
2.41.0



From tmn505 at terefe.re  Fri Jul  7 08:11:40 2023
From: tmn505 at terefe.re (Tomasz Maciej Nowak)
Date: Fri,  7 Jul 2023 17:11:40 +0200
Subject: [PATCH v2 0/3] ipq40xx: remedy potential of producing soft-bricking images
Message-ID: <20230707151950.25859-1-tmn505@terefe.re>

From: Tomasz Maciej Nowak <tmn505 at gmail.com>

Some of devices having kernel on NOR flash could reach limit of kernel
partition size at 4MiB and soft-brick them. Unfortunately we don't know
if all of them are affected, thus kernel size limit is added to all of
remaining ones. Later commit allows for some devices to prepare painless
transition, while the last one shows how it can be done for device i
introduced. I tried to make transition for the device as generic as
possible so it coulld be used on others, but unfortunately I own only
one device, which means the owners of the rest device need to verify if
it works for them and add their devices.

Tomasz Maciej Nowak (3):
  ipq40xx: image: limit kernel size for NOR devices
    v1 -> v2: no changes
  ipq40xx: dts: allow writing to U-Boot environment
    v1 -> v2: no changes
  ipq40xx: pakedge_wr-1: workaround for kernel bigger than 4MiB
    v1 -> v2: remove printing command from sed invocation which prints
              double output and breaks future 'bootcmd' modifications

 .../etc/uci-defaults/05_fix-compat-version        |  3 ++-
 .../base-files/lib/preinit/81_patch_uboot_env.sh  | 14 ++++++++++++++
 .../boot/dts/qcom-ipq4018-cs-w3-wd1200g-eup.dts   |  1 -
 .../arch/arm/boot/dts/qcom-ipq4018-dap-2610.dts   |  1 -
 .../arch/arm/boot/dts/qcom-ipq4018-eap1300.dts    |  1 -
 .../files/arch/arm/boot/dts/qcom-ipq4018-emd1.dts |  1 -
 .../arch/arm/boot/dts/qcom-ipq4018-emr3500.dts    |  1 -
 .../arch/arm/boot/dts/qcom-ipq4018-ens620ext.dts  |  1 -
 .../arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi  |  1 -
 .../files/arch/arm/boot/dts/qcom-ipq4018-wr-1.dts |  1 -
 .../arch/arm/boot/dts/qcom-ipq4018-wre6606.dts    |  1 -
 .../arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts |  1 -
 .../arm/boot/dts/qcom-ipq4019-habanero-dvk.dts    |  1 -
 .../arch/arm/boot/dts/qcom-ipq4019-u4019-32m.dts  |  1 -
 .../arch/arm/boot/dts/qcom-ipq4019-x1pro.dts      |  1 -
 .../arch/arm/boot/dts/qcom-ipq4028-wpj428.dts     |  1 -
 .../arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts   |  1 -
 .../arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts   |  1 -
 target/linux/ipq40xx/image/generic.mk             | 15 +++++++++++++++
 19 files changed, 31 insertions(+), 17 deletions(-)
 create mode 100644 target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh

-- 
2.41.0



From tmn505 at terefe.re  Fri Jul  7 08:11:42 2023
From: tmn505 at terefe.re (Tomasz Maciej Nowak)
Date: Fri,  7 Jul 2023 17:11:42 +0200
Subject: [PATCH v2 2/3] ipq40xx: dts: allow writing to U-Boot environment
In-Reply-To: <20230707151950.25859-1-tmn505@terefe.re>
References: <20230707151950.25859-1-tmn505@terefe.re>
Message-ID: <20230707151950.25859-3-tmn505@terefe.re>

From: Tomasz Maciej Nowak <tmn505 at gmail.com>

Devices allowing to boot LZMA compressed kernel or zImage kernel didn't
hit yet the 4MiB boundary for kernel size, thus allowing to prepare
workaround for the issue, without need for serial console attachment.
The workaround is modifying 'bootcmd' variable in U-Boot environment
which will replace 'bootipq' command with equivalent not limited by
imposed partition table.
This commit also touches devices which boot uncompressed kernel, so
even if those are already soft-bricked, it will still allow to alter
U-Boot environment from initramfs booted device.

Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
---
 .../files/arch/arm/boot/dts/qcom-ipq4018-cs-w3-wd1200g-eup.dts   | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-dap-2610.dts    | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-eap1300.dts     | 1 -
 .../linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emd1.dts  | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emr3500.dts     | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ens620ext.dts   | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi   | 1 -
 .../linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wr-1.dts  | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wre6606.dts     | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts  | 1 -
 .../files/arch/arm/boot/dts/qcom-ipq4019-habanero-dvk.dts        | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-u4019-32m.dts   | 1 -
 .../linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-x1pro.dts | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts      | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts    | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts    | 1 -
 16 files changed, 16 deletions(-)

diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-cs-w3-wd1200g-eup.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-cs-w3-wd1200g-eup.dts
index 22a48c12c44e..0772c5ac464a 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-cs-w3-wd1200g-eup.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-cs-w3-wd1200g-eup.dts
@@ -185,7 +185,6 @@
 			partition5 at E0000 {
 				label = "APPSBLENV";
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 
 			partition6 at F0000 {
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-dap-2610.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-dap-2610.dts
index 493905d56d8f..dea90b13e209 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-dap-2610.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-dap-2610.dts
@@ -117,7 +117,6 @@
 			partition at e0000 {
 				label = "APPSBLENV";
 				reg = <0xe0000 0x10000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-eap1300.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-eap1300.dts
index a8f24aa00e60..2e9cb8ecdb68 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-eap1300.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-eap1300.dts
@@ -165,7 +165,6 @@
 			partition5 at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 			partition6 at f0000 {
 				label = "0:APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emd1.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emd1.dts
index 396595ba5185..615c6aaf678f 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emd1.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emd1.dts
@@ -163,7 +163,6 @@
 			partition5 at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 			partition6 at f0000 {
 				label = "0:APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emr3500.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emr3500.dts
index 361614945145..8c038917b668 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emr3500.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emr3500.dts
@@ -164,7 +164,6 @@
 			partition at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "0:APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ens620ext.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ens620ext.dts
index 69275e24b8cd..bba1dd89b7a8 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ens620ext.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ens620ext.dts
@@ -184,7 +184,6 @@
 			partition at e0000 {
 				label = "APPSBLENV"; /* uboot env*/
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "APPSBL"; /* uboot */
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi
index dc5c25c84ab7..b4d9d195c7f4 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi
@@ -228,7 +228,6 @@
 			partition5 at E0000 {
 				label = "APPSBLENV";
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 
 			partition6 at F0000 {
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wr-1.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wr-1.dts
index 16951da47fc0..4c707e73d862 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wr-1.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wr-1.dts
@@ -140,7 +140,6 @@
 			partition at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0x00e0000 0x0010000>;
-				read-only;
 			};
 
 			partition at f0000 {
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wre6606.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wre6606.dts
index efb267ae3692..decd7d5fdcc0 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wre6606.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wre6606.dts
@@ -195,7 +195,6 @@
 			partition5 at E0000 {
 				label = "APPSBLENV";
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 
 			partition6 at F0000 {
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts
index 70e05c7eef3a..eac11b02d144 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts
@@ -57,7 +57,6 @@
 			partition at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0xe0000 0x10000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "0:APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-habanero-dvk.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-habanero-dvk.dts
index 23a654dcff5a..690db0143891 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-habanero-dvk.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-habanero-dvk.dts
@@ -262,7 +262,6 @@
 			partition at e0000 {
 				label = "APPSBLENV"; /* uboot env */
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "APPSBL"; /* uboot */
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-u4019-32m.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-u4019-32m.dts
index 4efcdaf39418..5304870a43fa 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-u4019-32m.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-u4019-32m.dts
@@ -54,7 +54,6 @@
 			partition at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0xe0000 0x10000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "0:APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-x1pro.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-x1pro.dts
index 681300c502bf..aa401892fef3 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-x1pro.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-x1pro.dts
@@ -56,7 +56,6 @@
 			partition at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0xe0000 0x10000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "0:APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts
index 48b5cd53d80b..a1ede1dcbdb1 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts
@@ -205,7 +205,6 @@
 			partition5 at e0000 {
 				label = "0:APPSBLENV"; /* uboot env*/
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 			partition5 at f0000 {
 				label = "0:APPSBL"; /* uboot */
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts
index 7e4519a74661..78d044b67893 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts
@@ -182,7 +182,6 @@
 			APPSBLENV at e0000 {
 				label = "APPSBLENV";
 				reg = <0xe0000 0x10000>;
-				read-only;
 			};
 
 			APPSBL at f0000 {
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts
index 0e7f4c970f47..752397a1752d 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts
@@ -180,7 +180,6 @@
 			APPSBLENV at e0000 {
 				label = "APPSBLENV";
 				reg = <0xe0000 0x10000>;
-				read-only;
 			};
 
 			APPSBL at f0000 {
-- 
2.41.0



From tmn505 at terefe.re  Fri Jul  7 12:13:35 2023
From: tmn505 at terefe.re (Tomasz Maciej Nowak)
Date: Fri,  7 Jul 2023 21:13:35 +0200
Subject: [PATCH] mvebu: mcbin-singleshot: enable hearbeat LED by default
Message-ID: <20230707191459.2424-1-tmn505@terefe.re>

From: Tomasz Maciej Nowak <tmn505 at gmail.com>

This has been a part of modified upstream patch but got lost on major
kernel bump to 5.15, so bring it back.

Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
---

Please backport to 23.05 branch

 ...vell-enable-heartbeat-LED-by-default.patch | 22 +++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 target/linux/mvebu/patches-5.15/314-arm64-dts-marvell-enable-heartbeat-LED-by-default.patch

diff --git a/target/linux/mvebu/patches-5.15/314-arm64-dts-marvell-enable-heartbeat-LED-by-default.patch b/target/linux/mvebu/patches-5.15/314-arm64-dts-marvell-enable-heartbeat-LED-by-default.patch
new file mode 100644
index 000000000000..7221e04de1dd
--- /dev/null
+++ b/target/linux/mvebu/patches-5.15/314-arm64-dts-marvell-enable-heartbeat-LED-by-default.patch
@@ -0,0 +1,22 @@
+From: Tomasz Maciej Nowak <tmn505 at gmail.com>
+Date: Fri, 7 Jul 2023 19:06:05 +0200
+Subject: [PATCH] arm64: dts: marvell: enable heartbeat LED by default
+
+Some boards could be placed in an enclosure, so enable LED18 by default,
+since that'll be the only visible indicator that the board is operating.
+
+Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
+---
+ arch/arm64/boot/dts/marvell/armada-8040-mcbin-singleshot.dts | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/arch/arm64/boot/dts/marvell/armada-8040-mcbin-singleshot.dts
++++ b/arch/arm64/boot/dts/marvell/armada-8040-mcbin-singleshot.dts
+@@ -25,6 +25,7 @@
+ 			function = LED_FUNCTION_HEARTBEAT;
+ 			color = <LED_COLOR_ID_GREEN>;
+ 			linux,default-trigger = "heartbeat";
++			default-state = "on";
+ 		};
+ 	};
+ };
-- 
2.41.0



From daniel at dd-wrt.com  Sat Jul  8 02:37:46 2023
From: daniel at dd-wrt.com (Daniel Danzberger)
Date: Sat,  8 Jul 2023 11:37:46 +0200
Subject: [PATCH] umbim: Add mbim message timeout option, -T
Message-ID: <20230708093746.463343-1-daniel@dd-wrt.com>

Some modems, depending on their state and connection quality can take
longer than 15 seconds to answer mbim message requests.

This commit adds the -T option, allowing the user to specifiy a custom
message timeout in seconds.

Default is still 15.

Signed-off-by: Daniel Danzberger <daniel at dd-wrt.com>
---
 cli.c      | 9 +++++++--
 mbim-dev.c | 2 +-
 mbim.h     | 1 +
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/cli.c b/cli.c
index 3a845d4..6026a67 100644
--- a/cli.c
+++ b/cli.c
@@ -35,6 +35,7 @@
 
 int return_code = -1;
 int verbose;
+int msg_timeout_ms = 15 * 1000;
 
 struct mbim_handler *current_handler;
 static uint8_t uuid_context_type_internet[16] = { 0x7E, 0x5E, 0x2A, 0x7E, 0x4E, 0x6F, 0x72, 0x72, 0x73, 0x6B, 0x65, 0x6E, 0x7E, 0x5E, 0x2A, 0x7E };
@@ -533,7 +534,8 @@ usage(void)
 #endif
 		"    -d <device>	the device (/dev/cdc-wdmX)\n"
 		"    -t <transaction>	the transaction id\n"
-		"    -n 		no close\n\n"
+		"    -n 		no close\n"
+		"    -T <seconds>	MBIM message timeout in seconds [15]\n\n"
 		"    -v 		verbose\n\n");
 	return 1;
 }
@@ -548,7 +550,7 @@ main(int argc, char **argv)
 	int proxy = 0;
 #endif
 
-	while ((ch = getopt(argc, argv, "pnvd:t:")) != -1) {
+	while ((ch = getopt(argc, argv, "pnvd:t:T:")) != -1) {
 		switch (ch) {
 		case 'v':
 			verbose = 1;
@@ -563,6 +565,9 @@ main(int argc, char **argv)
 			no_open = 1;
 			transaction_id = atoi(optarg);
 			break;
+		case 'T':
+			msg_timeout_ms = atoi(optarg) * 1000;
+			break;
 #ifdef LIBQMI_MBIM_PROXY
 		case 'p':
 			proxy = 1;
diff --git a/mbim-dev.c b/mbim-dev.c
index 2a94d49..12d1189 100644
--- a/mbim-dev.c
+++ b/mbim-dev.c
@@ -78,7 +78,7 @@ mbim_send(void)
 		perror("writing data failed: ");
 	} else {
 		expected = le32toh(hdr->type) | 0x80000000;
-		uloop_timeout_set(&tout, 15000);
+		uloop_timeout_set(&tout, msg_timeout_ms);
 	}
 	return ret;
 }
diff --git a/mbim.h b/mbim.h
index 746257e..28999b5 100644
--- a/mbim.h
+++ b/mbim.h
@@ -20,6 +20,7 @@
 
 extern int return_code;
 extern int verbose;
+extern int msg_timeout_ms;
 
 #include "mbim-type.h"
 #include "mbim-enum.h"
-- 
2.40.1



From yangshiji66 at outlook.com  Sat Jul  8 06:46:57 2023
From: yangshiji66 at outlook.com (Shiji Yang)
Date: Sat,  8 Jul 2023 21:46:57 +0800
Subject: [PATCH 0/2] ath79: fix boot failure on Netgear WNDR4300 v2
Message-ID: <OSYP286MB03123DB70BFE74614812EB42BC32A@OSYP286MB0312.JPNP286.PROD.OUTLOOK.COM>

From: Shiji Yang <yangshiji66 at qq.com>

These two patches fix the boot failure issue on Netgear WNDR4300 v2
and WNDR4500 v3:

[1] 23.05-rc bricks WNDR4300v2
link: https://github.com/openwrt/openwrt/issues/13050
[2] ath79: NETGEAR WNDR4300v2 Bricked on Power Cycle After Flash
link: https://github.com/openwrt/openwrt/issues/8878

Shiji Yang (2):
  ath79: rework Netgear nand devices image recipe
  ath79: fix second boot failure issue on Netgear WNDR4300 v2 and
    WNDR4500 v3

 .../linux/ath79/dts/qca9563_netgear_wndr.dtsi | 32 +++++++++++++++++--
 target/linux/ath79/image/nand.mk              | 13 ++++++--
 .../base-files/etc/board.d/05_compat-version  | 15 +++++++++
 3 files changed, 54 insertions(+), 6 deletions(-)
 create mode 100644 target/linux/ath79/nand/base-files/etc/board.d/05_compat-version

-- 
2.30.2



From yangshiji66 at outlook.com  Sat Jul  8 06:46:58 2023
From: yangshiji66 at outlook.com (Shiji Yang)
Date: Sat,  8 Jul 2023 21:46:58 +0800
Subject: [PATCH 1/2] ath79: rework Netgear nand devices image recipe
In-Reply-To: <20230708134659.13623-1-yangshiji66@outlook.com>
References: <20230708134659.13623-1-yangshiji66@outlook.com>
Message-ID: <OSYP286MB0312AE84EA07594488BD85C0BC32A@OSYP286MB0312.JPNP286.PROD.OUTLOOK.COM>

From: Shiji Yang <yangshiji66 at qq.com>

In Netgear u-boot GPL code, nand devices uses this formula to locate the
rootfs offset.

offset = (((128 + KERNEL_SIZE) / BLOCK_SIZE) + 1) * BLOCK_SIZE;

Howerver, WNDR4500 source code incorrectly define the nand block size to
64k. In some cases, it causes u-boot can't get the correct rootfs offset,
which result in boot failure. This patch workaround it by padding kernel
size to (128k * n - 128 - 1). The additional char "0xff" is used to
ensure the kernel size is not divisible.

Fixes: https://github.com/openwrt/openwrt/issues/13050
Fixes: 3c1512a25d92 ("ath79: optimize the firmware recipe for Netgear NAND devices")
Tested-by: Yousaf <yousaf465 at gmail.com>
Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
---
 target/linux/ath79/image/nand.mk | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk
index d06b44d6b3..7a3f478281 100644
--- a/target/linux/ath79/image/nand.mk
+++ b/target/linux/ath79/image/nand.mk
@@ -285,7 +285,7 @@ define Device/meraki_mr18
 endef
 TARGET_DEVICES += meraki_mr18
 
-# fake rootfs is mandatory, pad-offset 64 equals (1 * uimage_header)
+# fake rootfs is mandatory, pad-offset 129 equals (2 * uimage_header + 0xff)
 define Device/netgear_ath79_nand
   DEVICE_VENDOR := NETGEAR
   DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport
@@ -293,8 +293,9 @@ define Device/netgear_ath79_nand
   BLOCKSIZE := 128k
   PAGESIZE := 2048
   IMAGE_SIZE := 25600k
-  KERNEL := kernel-bin | append-dtb | lzma | uImage lzma | \
-	pad-offset $$(BLOCKSIZE) 64 | append-uImage-fakehdr filesystem $$(UIMAGE_MAGIC)
+  KERNEL := kernel-bin | append-dtb | lzma | \
+	pad-offset $$(BLOCKSIZE) 129 | uImage lzma | append-string -e '\xff' | \
+	append-uImage-fakehdr filesystem $$(UIMAGE_MAGIC)
   IMAGES := sysupgrade.bin factory.img
   IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | \
 	append-ubi | check-size | netgear-dni
-- 
2.30.2



From yangshiji66 at outlook.com  Sat Jul  8 06:46:59 2023
From: yangshiji66 at outlook.com (Shiji Yang)
Date: Sat,  8 Jul 2023 21:46:59 +0800
Subject: [PATCH 2/2] ath79: fix second boot failure issue on Netgear WNDR4300 v2 and WNDR4500 v3
In-Reply-To: <20230708134659.13623-1-yangshiji66@outlook.com>
References: <20230708134659.13623-1-yangshiji66@outlook.com>
Message-ID: <OSYP286MB0312844FCADC602A4BA8EBC5BC32A@OSYP286MB0312.JPNP286.PROD.OUTLOOK.COM>

From: Shiji Yang <yangshiji66 at qq.com>

>From the Netgear u-boot GPL code[1]. Bootloader always unconditionally
marks block 768, 1020 - 1023 as bad blocks on each boot. This may lead
to conflicts with the OpenWrt nand driver since these blocks may be good
blocks. In this case, U-boot will override the oob of these blocks so
that break the ubi volume. The system will be damaged on the second boot.
To avoid this issue, manually skip these blocks by using "mtd-concat".

[1] https://www.downloads.netgear.com/files/GPL/EX7300v2series-V1.0.0.146_gpl_src.tar.bz2.zip

Fixes: https://github.com/openwrt/openwrt/issues/8878
Tested-by: Yousaf <yousaf465 at gmail.com>
Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
---
 .../linux/ath79/dts/qca9563_netgear_wndr.dtsi | 32 +++++++++++++++++--
 target/linux/ath79/image/nand.mk              |  6 ++++
 .../base-files/etc/board.d/05_compat-version  | 15 +++++++++
 3 files changed, 50 insertions(+), 3 deletions(-)
 create mode 100644 target/linux/ath79/nand/base-files/etc/board.d/05_compat-version

diff --git a/target/linux/ath79/dts/qca9563_netgear_wndr.dtsi b/target/linux/ath79/dts/qca9563_netgear_wndr.dtsi
index a51fb1964b..9e075e46e0 100644
--- a/target/linux/ath79/dts/qca9563_netgear_wndr.dtsi
+++ b/target/linux/ath79/dts/qca9563_netgear_wndr.dtsi
@@ -90,6 +90,22 @@
 			linux,default-trigger = "phy1tpt";
 		};
 	};
+
+	ubi-concat {
+		compatible = "mtd-concat";
+		devices = <&ubiconcat0 &ubiconcat1>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition at 0 {
+				label = "ubi";
+				reg = <0x0 0x0>;
+			};
+		};
+	};
 };
 
 &spi {
@@ -165,10 +181,20 @@
 				reg = <0x0 0x400000>;
 			};
 
-			partition at 400000 {
-				label = "ubi";
-				reg = <0x400000 0x7c00000>;
+			ubiconcat0: partition at 400000 {
+				label = "ubiconcat0";
+				reg = <0x400000 0x5c00000>;
+			};
+
+			ubiconcat1: partition at 6020000 {
+				label = "ubiconcat1";
+				reg = <0x6020000 0x1f60000>;
 			};
+			/*
+			 * U-boot always unconditionally marks block 768, 1020 - 1023 as
+			 * bad blocks on each boot. To avoid conflicts with the nand
+			 * driver, Manually skip them.
+			 */
 		};
 	};
 };
diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk
index 7a3f478281..160394aa45 100644
--- a/target/linux/ath79/image/nand.mk
+++ b/target/linux/ath79/image/nand.mk
@@ -374,6 +374,9 @@ TARGET_DEVICES += netgear_wndr4300tn
 
 define Device/netgear_wndr4300-v2
   SOC := qca9563
+  DEVICE_COMPAT_VERSION := 1.1
+  DEVICE_COMPAT_MESSAGE := Partition table has changed to fix the first \
+	boot issue. Please reflash factory image with nmrp or tftp.
   DEVICE_MODEL := WNDR4300
   DEVICE_VARIANT := v2
   UIMAGE_MAGIC := 0x27051956
@@ -385,6 +388,9 @@ TARGET_DEVICES += netgear_wndr4300-v2
 
 define Device/netgear_wndr4500-v3
   SOC := qca9563
+  DEVICE_COMPAT_VERSION := 1.1
+  DEVICE_COMPAT_MESSAGE := Partition table has changed to fix the first \
+	boot issue. Please reflash factory image with nmrp or tftp.
   DEVICE_MODEL := WNDR4500
   DEVICE_VARIANT := v3
   UIMAGE_MAGIC := 0x27051956
diff --git a/target/linux/ath79/nand/base-files/etc/board.d/05_compat-version b/target/linux/ath79/nand/base-files/etc/board.d/05_compat-version
new file mode 100644
index 0000000000..238927aa7b
--- /dev/null
+++ b/target/linux/ath79/nand/base-files/etc/board.d/05_compat-version
@@ -0,0 +1,15 @@
+. /lib/functions.sh
+. /lib/functions/uci-defaults.sh
+
+board_config_update
+
+case "$(board_name)" in
+	netgear,wndr4300-v2|\
+	netgear,wndr4500-v3)
+		ucidef_set_compat_version "1.1"
+		;;
+esac
+
+board_config_flush
+
+exit 0
-- 
2.30.2



From felix.baumann at freifunk-aachen.de  Sun Jul  9 03:43:37 2023
From: felix.baumann at freifunk-aachen.de (Felix Baumann)
Date: Sun, 09 Jul 2023 12:43:37 +0200
Subject: =?US-ASCII?Q?Re=3A_=5BPATCH_v2_3/3=5D_ipq40xx=3A_pakedge=5Fwr-1?= =?US-ASCII?Q?=3A_workaround_for_kernel_bigger_than_4MiB?=
In-Reply-To: <20230707151950.25859-4-tmn505@terefe.re>
References: <20230707151950.25859-1-tmn505@terefe.re> <20230707151950.25859-4-tmn505@terefe.re>
Message-ID: <16D90F59-390B-4013-A1B1-A1C26F3BD556@freifunk-aachen.de>

Am 7. Juli 2023 17:11:43 MESZ schrieb Tomasz Maciej Nowak <tmn505 at terefe.re>:
>From: Tomasz Maciej Nowak <tmn505 at gmail.com>
>
>Alter command boot sequence in U-Boot on first boot after upgrade to
>workaround the kernel size limitation. The kernel size read from flash
>will be 8MiB, which should suffice for forseable future. As precaution a
>warning interupting upgrade is emited, explaining what to do.
>
>Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
>---
> .../etc/uci-defaults/05_fix-compat-version         |  3 ++-
> .../base-files/lib/preinit/81_patch_uboot_env.sh   | 14 ++++++++++++++
> target/linux/ipq40xx/image/generic.mk              | 10 +++++++++-
> 3 files changed, 25 insertions(+), 2 deletions(-)
> create mode 100644 target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh
>
>diff --git a/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
>index c01192089712..a3f90125c6e5 100644
>--- a/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
>+++ b/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
>@@ -4,7 +4,8 @@ case "$(board_name)" in
> linksys,ea6350v3|\
> linksys,ea8300|\
> linksys,mr8300|\
>-ezviz,cs-w3-wd1200g-eup)
>+ezviz,cs-w3-wd1200g-eup|\
>+pakedge,wr-1)
> 	uci set system. at system[0].compat_version="2.0"
> 	uci commit system
> 	;;
>diff --git a/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh b/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh
>new file mode 100644
>index 000000000000..0cc0ab0fca6f
>--- /dev/null
>+++ b/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh
>@@ -0,0 +1,14 @@
>+. /lib/functions.sh
>+
>+preinit_patch_uboot_env() {
>+	case $(board_name) in
>+	pakedge,wr-1)
>+		if ! fw_printenv -n OpenWrt &>/dev/null; then
>+			fw_setenv OpenWrt 'sf probe; sf read 0x84000000 0x180000 0x800000; bootm 0x84000000'
>+			fw_setenv bootcmd "$(fw_printenv -n bootcmd | sed -e 's,bootipq,run OpenWrt,')"
>+		fi
>+		;;
>+	esac
>+}
>+
>+boot_hook_add preinit_main preinit_patch_uboot_env
>diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
>index d9d60a25ff0f..0dadae122a87 100644
>--- a/target/linux/ipq40xx/image/generic.mk
>+++ b/target/linux/ipq40xx/image/generic.mk
>@@ -958,8 +958,16 @@ define Device/pakedge_wr-1
> 	SOC := qcom-ipq4018
> 	BLOCKSIZE := 64k
> 	IMAGE_SIZE := 31232k
>-	KERNEL_SIZE := 4096k
>+	KERNEL_SIZE := 8192k
> 	IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | append-metadata
>+	DEVICE_COMPAT_VERSION := 2.0
>+	DEVICE_COMPAT_MESSAGE := \n$\
>+		Booting command in U-Boot needs to be changed because of kernel \n$\
>+		growing beyond 4MiB. If OpenWrt 23.05.0 or later is running on \n$\
>+		on the device, it has already been done and You can safely force \n$\
>+		upgrade. If that's not the case, first upgrade to 23.05.0 and it \n$\
>+		will automatically amend booting command in U-Boot on first boot. \n$\
>+		Then proceed with the upgrade to desired version.
> endef
> TARGET_DEVICES += pakedge_wr-1
> 

This is one way of fixing this. But we could also switch all of these from FitImage to FitzImage. (self-decompressing xz) 
That should suffice for quite a while (kernel was 1/4 smaller for my device afterwards). 3MiB in use leaves us quite some headroom.
Headroom to implement lzma-loader at some point.

What for? To prevent compat increases. Asking people to modify their bootloader environment can work but it's a hassle. Also you have to modify lots of wiki entries so the installation instructions all mention this.


Regards
Felix Baumann / Djfe


From yangshiji66 at outlook.com  Sun Jul  9 07:10:52 2023
From: yangshiji66 at outlook.com (Shiji Yang)
Date: Sun,  9 Jul 2023 22:10:52 +0800
Subject: [PATCH v2 0/2] ath79: fix boot failure on Netgear WNDR4300 v2
Message-ID: <TYAP286MB0315BEFF2638108E3518859ABC33A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>

From: Shiji Yang <yangshiji66 at qq.com>

---
Changes from v1:
use 'pad-extra 1' instead of 'append-string -e '\xff''

---
These two patches fix the boot failure issue on Netgear WNDR4300 v2
and WNDR4500 v3:

[1] 23.05-rc bricks WNDR4300v2
link: https://github.com/openwrt/openwrt/issues/13050
[2] ath79: NETGEAR WNDR4300v2 Bricked on Power Cycle After Flash
link: https://github.com/openwrt/openwrt/issues/8878

Shiji Yang (2):
  ath79: rework Netgear nand devices image recipe
  ath79: fix first reboot failure on Netgear WNDR4300 v2 and WNDR4500 v3

 .../linux/ath79/dts/qca9563_netgear_wndr.dtsi | 32 +++++++++++++++++--
 target/linux/ath79/image/nand.mk              | 13 ++++++--
 .../base-files/etc/board.d/05_compat-version  | 15 +++++++++
 3 files changed, 54 insertions(+), 6 deletions(-)
 create mode 100644 target/linux/ath79/nand/base-files/etc/board.d/05_compat-version

-- 
2.30.2



From yangshiji66 at outlook.com  Sun Jul  9 07:10:53 2023
From: yangshiji66 at outlook.com (Shiji Yang)
Date: Sun,  9 Jul 2023 22:10:53 +0800
Subject: [PATCH v2 1/2] ath79: rework Netgear nand devices image recipe
In-Reply-To: <20230709141054.6111-1-yangshiji66@outlook.com>
References: <20230709141054.6111-1-yangshiji66@outlook.com>
Message-ID: <TYAP286MB0315C957E6E970B1DDA0F8E9BC33A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>

From: Shiji Yang <yangshiji66 at qq.com>

In Netgear u-boot GPL code, nand devices uses this formula to locate the
rootfs offset.

offset = (((128 + KERNEL_SIZE) / BLOCK_SIZE) + 1) * BLOCK_SIZE;

Howerver, WNDR4500 source code incorrectly define the nand block size to
64k. In some cases, it causes u-boot can't get the correct rootfs offset,
which result in boot failure. This patch workaround it by padding kernel
size to (128k * n - 128 - 1). The additional char '\0' is used to ensure
the (128 + KERNEL_SIZE) can't be divided by the BLOCK_SIZE.

Fixes: https://github.com/openwrt/openwrt/issues/13050
Fixes: 3c1512a25d92 ("ath79: optimize the firmware recipe for Netgear NAND devices")
Tested-by: Yousaf <yousaf465 at gmail.com>
Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
---
 target/linux/ath79/image/nand.mk | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk
index 4b0932a100..67690ca1c6 100644
--- a/target/linux/ath79/image/nand.mk
+++ b/target/linux/ath79/image/nand.mk
@@ -285,7 +285,7 @@ define Device/meraki_mr18
 endef
 TARGET_DEVICES += meraki_mr18
 
-# fake rootfs is mandatory, pad-offset 64 equals (1 * uimage_header)
+# fake rootfs is mandatory, pad-offset 129 equals (2 * uimage_header + '\0')
 define Device/netgear_ath79_nand
   DEVICE_VENDOR := NETGEAR
   DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport
@@ -293,8 +293,9 @@ define Device/netgear_ath79_nand
   BLOCKSIZE := 128k
   PAGESIZE := 2048
   IMAGE_SIZE := 25600k
-  KERNEL := kernel-bin | append-dtb | lzma | uImage lzma | \
-	pad-offset $$(BLOCKSIZE) 64 | append-uImage-fakehdr filesystem $$(UIMAGE_MAGIC)
+  KERNEL := kernel-bin | append-dtb | lzma | \
+	pad-offset $$(BLOCKSIZE) 129 | uImage lzma | pad-extra 1 | \
+	append-uImage-fakehdr filesystem $$(UIMAGE_MAGIC)
   IMAGES := sysupgrade.bin factory.img
   IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | \
 	append-ubi | check-size | netgear-dni
-- 
2.30.2



From yangshiji66 at outlook.com  Sun Jul  9 07:10:54 2023
From: yangshiji66 at outlook.com (Shiji Yang)
Date: Sun,  9 Jul 2023 22:10:54 +0800
Subject: [PATCH v2 2/2] ath79: fix first reboot issue on Netgear WNDR4300 v2 and WNDR4500 v3
In-Reply-To: <20230709141054.6111-1-yangshiji66@outlook.com>
References: <20230709141054.6111-1-yangshiji66@outlook.com>
Message-ID: <TYAP286MB03157B791C0171D844F6497BBC33A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>

From: Shiji Yang <yangshiji66 at qq.com>

>From the Netgear u-boot GPL code[1]. Bootloader always unconditionally
marks block 768, 1020 - 1023 as bad blocks on each boot. This may lead
to conflicts with the OpenWrt nand driver since these blocks may be good
blocks. In this case, U-boot will override the oob of these blocks so
that break the ubi volume. The system will be damaged after first reboot.
To avoid this issue, manually skip these blocks by using "mtd-concat".

[1] https://www.downloads.netgear.com/files/GPL/EX7300v2series-V1.0.0.146_gpl_src.tar.bz2.zip

Fixes: https://github.com/openwrt/openwrt/issues/8878
Tested-by: Yousaf <yousaf465 at gmail.com>
Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
---
 .../linux/ath79/dts/qca9563_netgear_wndr.dtsi | 32 +++++++++++++++++--
 target/linux/ath79/image/nand.mk              |  6 ++++
 .../base-files/etc/board.d/05_compat-version  | 15 +++++++++
 3 files changed, 50 insertions(+), 3 deletions(-)
 create mode 100644 target/linux/ath79/nand/base-files/etc/board.d/05_compat-version

diff --git a/target/linux/ath79/dts/qca9563_netgear_wndr.dtsi b/target/linux/ath79/dts/qca9563_netgear_wndr.dtsi
index a51fb1964b..9e075e46e0 100644
--- a/target/linux/ath79/dts/qca9563_netgear_wndr.dtsi
+++ b/target/linux/ath79/dts/qca9563_netgear_wndr.dtsi
@@ -90,6 +90,22 @@
 			linux,default-trigger = "phy1tpt";
 		};
 	};
+
+	ubi-concat {
+		compatible = "mtd-concat";
+		devices = <&ubiconcat0 &ubiconcat1>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition at 0 {
+				label = "ubi";
+				reg = <0x0 0x0>;
+			};
+		};
+	};
 };
 
 &spi {
@@ -165,10 +181,20 @@
 				reg = <0x0 0x400000>;
 			};
 
-			partition at 400000 {
-				label = "ubi";
-				reg = <0x400000 0x7c00000>;
+			ubiconcat0: partition at 400000 {
+				label = "ubiconcat0";
+				reg = <0x400000 0x5c00000>;
+			};
+
+			ubiconcat1: partition at 6020000 {
+				label = "ubiconcat1";
+				reg = <0x6020000 0x1f60000>;
 			};
+			/*
+			 * U-boot always unconditionally marks block 768, 1020 - 1023 as
+			 * bad blocks on each boot. To avoid conflicts with the nand
+			 * driver, manually skip them.
+			 */
 		};
 	};
 };
diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk
index 67690ca1c6..08afc82d41 100644
--- a/target/linux/ath79/image/nand.mk
+++ b/target/linux/ath79/image/nand.mk
@@ -376,6 +376,9 @@ TARGET_DEVICES += netgear_wndr4300tn
 
 define Device/netgear_wndr4300-v2
   SOC := qca9563
+  DEVICE_COMPAT_VERSION := 1.1
+  DEVICE_COMPAT_MESSAGE := Partition table has been changed to fix the \
+	first reboot issue. Please reflash factory image with nmrp or tftp.
   DEVICE_MODEL := WNDR4300
   DEVICE_VARIANT := v2
   UIMAGE_MAGIC := 0x27051956
@@ -387,6 +390,9 @@ TARGET_DEVICES += netgear_wndr4300-v2
 
 define Device/netgear_wndr4500-v3
   SOC := qca9563
+  DEVICE_COMPAT_VERSION := 1.1
+  DEVICE_COMPAT_MESSAGE := Partition table has been changed to fix the \
+	first reboot issue. Please reflash factory image with nmrp or tftp.
   DEVICE_MODEL := WNDR4500
   DEVICE_VARIANT := v3
   UIMAGE_MAGIC := 0x27051956
diff --git a/target/linux/ath79/nand/base-files/etc/board.d/05_compat-version b/target/linux/ath79/nand/base-files/etc/board.d/05_compat-version
new file mode 100644
index 0000000000..238927aa7b
--- /dev/null
+++ b/target/linux/ath79/nand/base-files/etc/board.d/05_compat-version
@@ -0,0 +1,15 @@
+. /lib/functions.sh
+. /lib/functions/uci-defaults.sh
+
+board_config_update
+
+case "$(board_name)" in
+	netgear,wndr4300-v2|\
+	netgear,wndr4500-v3)
+		ucidef_set_compat_version "1.1"
+		;;
+esac
+
+board_config_flush
+
+exit 0
-- 
2.30.2



From noreply at github.com  Sun Jul  9 10:25:40 2023
From: noreply at github.com (Stephen Walker)
Date: Sun, 09 Jul 2023 10:25:40 -0700
Subject: [sdwalker/sdwalker.github.io] ed1ec0: This week's update, stop
 updating 21.02, add 23.05
Message-ID: <sdwalker/sdwalker.github.io/push/refs/heads/master/24e737-ed1ec0@github.com>

  Branch: refs/heads/master
  Home:   https://github.com/sdwalker/sdwalker.github.io
  Commit: ed1ec0019f6f9565351ed0ca4272c04863d0f841
      https://github.com/sdwalker/sdwalker.github.io/commit/ed1ec0019f6f9565351ed0ca4272c04863d0f841
  Author: Stephen Walker <stephendwalker+github at gmail.com>
  Date:   2023-07-09 (Sun, 09 Jul 2023)

  Changed paths:
    M uscan/index-22.03.html
    A uscan/index-23.05.html
    M uscan/index.html
    A uscan/js/sort-23.05.js

  Log Message:
  -----------
  This week's update, stop updating 21.02, add 23.05




From tmn505 at gmail.com  Sun Jul  9 14:26:13 2023
From: tmn505 at gmail.com (Tomasz Maciej Nowak)
Date: Sun, 9 Jul 2023 23:26:13 +0200
Subject: [PATCH v2 3/3] ipq40xx: pakedge_wr-1: workaround for kernel
 bigger than 4MiB
In-Reply-To: <16D90F59-390B-4013-A1B1-A1C26F3BD556@freifunk-aachen.de>
References: <20230707151950.25859-1-tmn505@terefe.re>
 <20230707151950.25859-4-tmn505@terefe.re>
 <16D90F59-390B-4013-A1B1-A1C26F3BD556@freifunk-aachen.de>
Message-ID: <0705eb5d-cb4d-f5be-e481-0305b8bc87b4@gmail.com>

W dniu 9.07.2023 o?12:43, Felix Baumann pisze:
> Am 7. Juli 2023 17:11:43 MESZ schrieb Tomasz Maciej Nowak <tmn505 at terefe.re>:
>> From: Tomasz Maciej Nowak <tmn505 at gmail.com>
>>
>> Alter command boot sequence in U-Boot on first boot after upgrade to
>> workaround the kernel size limitation. The kernel size read from flash
>> will be 8MiB, which should suffice for forseable future. As precaution a
>> warning interupting upgrade is emited, explaining what to do.
>>
>> Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
>> ---
>> .../etc/uci-defaults/05_fix-compat-version         |  3 ++-
>> .../base-files/lib/preinit/81_patch_uboot_env.sh   | 14 ++++++++++++++
>> target/linux/ipq40xx/image/generic.mk              | 10 +++++++++-
>> 3 files changed, 25 insertions(+), 2 deletions(-)
>> create mode 100644 target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh
>>
>> diff --git a/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
>> index c01192089712..a3f90125c6e5 100644
>> --- a/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
>> +++ b/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
>> @@ -4,7 +4,8 @@ case "$(board_name)" in
>> linksys,ea6350v3|\
>> linksys,ea8300|\
>> linksys,mr8300|\
>> -ezviz,cs-w3-wd1200g-eup)
>> +ezviz,cs-w3-wd1200g-eup|\
>> +pakedge,wr-1)
>> 	uci set system. at system[0].compat_version="2.0"
>> 	uci commit system
>> 	;;
>> diff --git a/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh b/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh
>> new file mode 100644
>> index 000000000000..0cc0ab0fca6f
>> --- /dev/null
>> +++ b/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh
>> @@ -0,0 +1,14 @@
>> +. /lib/functions.sh
>> +
>> +preinit_patch_uboot_env() {
>> +	case $(board_name) in
>> +	pakedge,wr-1)
>> +		if ! fw_printenv -n OpenWrt &>/dev/null; then
>> +			fw_setenv OpenWrt 'sf probe; sf read 0x84000000 0x180000 0x800000; bootm 0x84000000'
>> +			fw_setenv bootcmd "$(fw_printenv -n bootcmd | sed -e 's,bootipq,run OpenWrt,')"
>> +		fi
>> +		;;
>> +	esac
>> +}
>> +
>> +boot_hook_add preinit_main preinit_patch_uboot_env
>> diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
>> index d9d60a25ff0f..0dadae122a87 100644
>> --- a/target/linux/ipq40xx/image/generic.mk
>> +++ b/target/linux/ipq40xx/image/generic.mk
>> @@ -958,8 +958,16 @@ define Device/pakedge_wr-1
>> 	SOC := qcom-ipq4018
>> 	BLOCKSIZE := 64k
>> 	IMAGE_SIZE := 31232k
>> -	KERNEL_SIZE := 4096k
>> +	KERNEL_SIZE := 8192k
>> 	IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | append-metadata
>> +	DEVICE_COMPAT_VERSION := 2.0
>> +	DEVICE_COMPAT_MESSAGE := \n$\
>> +		Booting command in U-Boot needs to be changed because of kernel \n$\
>> +		growing beyond 4MiB. If OpenWrt 23.05.0 or later is running on \n$\
>> +		on the device, it has already been done and You can safely force \n$\
>> +		upgrade. If that's not the case, first upgrade to 23.05.0 and it \n$\
>> +		will automatically amend booting command in U-Boot on first boot. \n$\
>> +		Then proceed with the upgrade to desired version.
>> endef
>> TARGET_DEVICES += pakedge_wr-1
>>
> 
> This is one way of fixing this. But we could also switch all of these from FitImage to FitzImage. (self-decompressing xz) 
> That should suffice for quite a while (kernel was 1/4 smaller for my device afterwards). 3MiB in use leaves us quite some headroom.

This device uses FitImageLZMA, so it's not affected, yet.

> Headroom to implement lzma-loader at some point.

That's one way to remedy the problem. The second option would be writing extension
for mtd to update Qualcomm partition table in MIBIB partition with new partition
sizes, similar to devices with RedBoot bootloader. Unfortunately all of devices
have MIBIB partition marked as read-only so that would be a hassle to introduce.
BTW The Qualcomm SMEM flash partition parser is already in kernel tree[1].
Both of options are outside of my capabilities and I'm not inclined to wait for
someone implementing those. Waiting brings only bigger pain later, since usually
it gets forgotten and it is reminded when device breaks down. 

> What for? To prevent compat increases. Asking people to modify their bootloader environment can work but it's a hassle. Also you have to modify lots of wiki entries so the installation instructions all mention this.

User does not have to modify the bootloader environment, since that is done by
first boot automatically after flashing new firmware. Everything needed is
explained in the message when one wants to perform sysupgrade. The only thing user
needs to do, is flash device with firmware version mentioned in the message first.
Nothing too complicated I would say.

1. https://www.kernel.org/doc/Documentation/devicetree/bindings/mtd/partitions/qcom%2Csmem-part.yaml

> Regards
> Felix Baumann / Djfe

Regards

-- 
TMN



From felix.baumann at freifunk-aachen.de  Sun Jul  9 15:16:35 2023
From: felix.baumann at freifunk-aachen.de (Felix Baumann)
Date: Mon, 10 Jul 2023 00:16:35 +0200
Subject: =?US-ASCII?Q?Re=3A_=5BPATCH_v2_3/3=5D_ipq40xx=3A_pakedge=5Fwr-1?= =?US-ASCII?Q?=3A_workaround_for_kernel_bigger_than_4MiB?=
In-Reply-To: <0705eb5d-cb4d-f5be-e481-0305b8bc87b4@gmail.com>
References: <20230707151950.25859-1-tmn505@terefe.re> <20230707151950.25859-4-tmn505@terefe.re> <16D90F59-390B-4013-A1B1-A1C26F3BD556@freifunk-aachen.de> <0705eb5d-cb4d-f5be-e481-0305b8bc87b4@gmail.com>
Message-ID: <7BE40E24-14C8-4525-A77E-7A862C981902@freifunk-aachen.de>

Am 9. Juli 2023 23:26:13 MESZ schrieb Tomasz Maciej Nowak <tmn505 at gmail.com>:
>W dniu 9.07.2023 o?12:43, Felix Baumann pisze:
>> Am 7. Juli 2023 17:11:43 MESZ schrieb Tomasz Maciej Nowak <tmn505 at terefe.re>:
>>> From: Tomasz Maciej Nowak <tmn505 at gmail.com>
>>>
>>> Alter command boot sequence in U-Boot on first boot after upgrade to
>>> workaround the kernel size limitation. The kernel size read from flash
>>> will be 8MiB, which should suffice for forseable future. As precaution a
>>> warning interupting upgrade is emited, explaining what to do.
>>>
>>> Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
>>> ---
>>> .../etc/uci-defaults/05_fix-compat-version         |  3 ++-
>>> .../base-files/lib/preinit/81_patch_uboot_env.sh   | 14 ++++++++++++++
>>> target/linux/ipq40xx/image/generic.mk              | 10 +++++++++-
>>> 3 files changed, 25 insertions(+), 2 deletions(-)
>>> create mode 100644 target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh
>>>
>>> diff --git a/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
>>> index c01192089712..a3f90125c6e5 100644
>>> --- a/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
>>> +++ b/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
>>> @@ -4,7 +4,8 @@ case "$(board_name)" in
>>> linksys,ea6350v3|\
>>> linksys,ea8300|\
>>> linksys,mr8300|\
>>> -ezviz,cs-w3-wd1200g-eup)
>>> +ezviz,cs-w3-wd1200g-eup|\
>>> +pakedge,wr-1)
>>> 	uci set system. at system[0].compat_version="2.0"
>>> 	uci commit system
>>> 	;;
>>> diff --git a/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh b/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh
>>> new file mode 100644
>>> index 000000000000..0cc0ab0fca6f
>>> --- /dev/null
>>> +++ b/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh
>>> @@ -0,0 +1,14 @@
>>> +. /lib/functions.sh
>>> +
>>> +preinit_patch_uboot_env() {
>>> +	case $(board_name) in
>>> +	pakedge,wr-1)
>>> +		if ! fw_printenv -n OpenWrt &>/dev/null; then
>>> +			fw_setenv OpenWrt 'sf probe; sf read 0x84000000 0x180000 0x800000; bootm 0x84000000'
>>> +			fw_setenv bootcmd "$(fw_printenv -n bootcmd | sed -e 's,bootipq,run OpenWrt,')"
>>> +		fi
>>> +		;;
>>> +	esac
>>> +}
>>> +
>>> +boot_hook_add preinit_main preinit_patch_uboot_env
>>> diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
>>> index d9d60a25ff0f..0dadae122a87 100644
>>> --- a/target/linux/ipq40xx/image/generic.mk
>>> +++ b/target/linux/ipq40xx/image/generic.mk
>>> @@ -958,8 +958,16 @@ define Device/pakedge_wr-1
>>> 	SOC := qcom-ipq4018
>>> 	BLOCKSIZE := 64k
>>> 	IMAGE_SIZE := 31232k
>>> -	KERNEL_SIZE := 4096k
>>> +	KERNEL_SIZE := 8192k
>>> 	IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | append-metadata
>>> +	DEVICE_COMPAT_VERSION := 2.0
>>> +	DEVICE_COMPAT_MESSAGE := \n$\
>>> +		Booting command in U-Boot needs to be changed because of kernel \n$\
>>> +		growing beyond 4MiB. If OpenWrt 23.05.0 or later is running on \n$\
>>> +		on the device, it has already been done and You can safely force \n$\
>>> +		upgrade. If that's not the case, first upgrade to 23.05.0 and it \n$\
>>> +		will automatically amend booting command in U-Boot on first boot. \n$\
>>> +		Then proceed with the upgrade to desired version.
>>> endef
>>> TARGET_DEVICES += pakedge_wr-1
>>>
>> 
>> This is one way of fixing this. But we could also switch all of these from FitImage to FitzImage. (self-decompressing xz) 
>> That should suffice for quite a while (kernel was 1/4 smaller for my device afterwards). 3MiB in use leaves us quite some headroom.
>
>This device uses FitImageLZMA, so it's not affected, yet.
>
>> Headroom to implement lzma-loader at some point.
>
>That's one way to remedy the problem. The second option would be writing extension
>for mtd to update Qualcomm partition table in MIBIB partition with new partition
>sizes, similar to devices with RedBoot bootloader. Unfortunately all of devices
>have MIBIB partition marked as read-only so that would be a hassle to introduce.
>BTW The Qualcomm SMEM flash partition parser is already in kernel tree[1].
>Both of options are outside of my capabilities and I'm not inclined to wait for
>someone implementing those. Waiting brings only bigger pain later, since usually
>it gets forgotten and it is reminded when device breaks down. 
>
>> What for? To prevent compat increases. Asking people to modify their bootloader environment can work but it's a hassle. Also you have to modify lots of wiki entries so the installation instructions all mention this.
>
>User does not have to modify the bootloader environment, since that is done by
>first boot automatically after flashing new firmware. Everything needed is
>explained in the message when one wants to perform sysupgrade. The only thing user
>needs to do, is flash device with firmware version mentioned in the message first.
>Nothing too complicated I would say.
>
>1. https://www.kernel.org/doc/Documentation/devicetree/bindings/mtd/partitions/qcom%2Csmem-part.yaml
>
>> Regards
>> Felix Baumann / Djfe
>
>Regards
>

Sounds to me like a chicken and egg problem.
If it doesn't boot, then it won't be able to change the bootloader variable (bootcmd) after a factory install.
You would have to do factory installs with older openwrt releases.

smem looks interesting, thx for mentioning it.

Since you are setting a KERNEL_SIZE, we won't have anyone bricking their device anymore. Your workaround could still be implemented when builds error. Devices would literally stop building when a new kernel is reintroduced after branching so we probably have half a year to find a fix before the next release then.

But in the end maintainers will have to decide here :)
I just wanted to represent the opposite opinion in this discussion.

We have some of these devices out in the field (Freifunk, OpenWrt fork called Gluon). Since people install and deploy these routers (just) once we kind of rely on a working sysupgrade which a major compat increase breaks.
Else we end up with certain devices being stuck on OpenWrt 2022.

It's nothing dramatic but an argument why I want to avoid/delay compat increases :)
In the end we can still patch this out for ourselves if necessary.


Regards
Felix Baumann


From tmn505 at gmail.com  Mon Jul 10 10:20:01 2023
From: tmn505 at gmail.com (Tomasz Maciej Nowak)
Date: Mon, 10 Jul 2023 19:20:01 +0200
Subject: [PATCH v2 3/3] ipq40xx: pakedge_wr-1: workaround for kernel
 bigger than 4MiB
In-Reply-To: <7BE40E24-14C8-4525-A77E-7A862C981902@freifunk-aachen.de>
References: <20230707151950.25859-1-tmn505@terefe.re>
 <20230707151950.25859-4-tmn505@terefe.re>
 <16D90F59-390B-4013-A1B1-A1C26F3BD556@freifunk-aachen.de>
 <0705eb5d-cb4d-f5be-e481-0305b8bc87b4@gmail.com>
 <7BE40E24-14C8-4525-A77E-7A862C981902@freifunk-aachen.de>
Message-ID: <167e1fea-33c7-3c4c-d9df-c6d9f0472b7a@gmail.com>

W dniu 10.07.2023 o?00:16, Felix Baumann pisze:
> Am 9. Juli 2023 23:26:13 MESZ schrieb Tomasz Maciej Nowak <tmn505 at gmail.com>:
>> W dniu 9.07.2023 o?12:43, Felix Baumann pisze:
>>> Am 7. Juli 2023 17:11:43 MESZ schrieb Tomasz Maciej Nowak <tmn505 at terefe.re>:
>>>> From: Tomasz Maciej Nowak <tmn505 at gmail.com>
>>>>
>>>> Alter command boot sequence in U-Boot on first boot after upgrade to
>>>> workaround the kernel size limitation. The kernel size read from flash
>>>> will be 8MiB, which should suffice for forseable future. As precaution a
>>>> warning interupting upgrade is emited, explaining what to do.
>>>>
>>>> Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
>>>> ---
>>>> .../etc/uci-defaults/05_fix-compat-version         |  3 ++-
>>>> .../base-files/lib/preinit/81_patch_uboot_env.sh   | 14 ++++++++++++++
>>>> target/linux/ipq40xx/image/generic.mk              | 10 +++++++++-
>>>> 3 files changed, 25 insertions(+), 2 deletions(-)
>>>> create mode 100644 target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh
>>>>
>>>> diff --git a/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
>>>> index c01192089712..a3f90125c6e5 100644
>>>> --- a/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
>>>> +++ b/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
>>>> @@ -4,7 +4,8 @@ case "$(board_name)" in
>>>> linksys,ea6350v3|\
>>>> linksys,ea8300|\
>>>> linksys,mr8300|\
>>>> -ezviz,cs-w3-wd1200g-eup)
>>>> +ezviz,cs-w3-wd1200g-eup|\
>>>> +pakedge,wr-1)
>>>> 	uci set system. at system[0].compat_version="2.0"
>>>> 	uci commit system
>>>> 	;;
>>>> diff --git a/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh b/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh
>>>> new file mode 100644
>>>> index 000000000000..0cc0ab0fca6f
>>>> --- /dev/null
>>>> +++ b/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh
>>>> @@ -0,0 +1,14 @@
>>>> +. /lib/functions.sh
>>>> +
>>>> +preinit_patch_uboot_env() {
>>>> +	case $(board_name) in
>>>> +	pakedge,wr-1)
>>>> +		if ! fw_printenv -n OpenWrt &>/dev/null; then
>>>> +			fw_setenv OpenWrt 'sf probe; sf read 0x84000000 0x180000 0x800000; bootm 0x84000000'
>>>> +			fw_setenv bootcmd "$(fw_printenv -n bootcmd | sed -e 's,bootipq,run OpenWrt,')"
>>>> +		fi
>>>> +		;;
>>>> +	esac
>>>> +}
>>>> +
>>>> +boot_hook_add preinit_main preinit_patch_uboot_env
>>>> diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
>>>> index d9d60a25ff0f..0dadae122a87 100644
>>>> --- a/target/linux/ipq40xx/image/generic.mk
>>>> +++ b/target/linux/ipq40xx/image/generic.mk
>>>> @@ -958,8 +958,16 @@ define Device/pakedge_wr-1
>>>> 	SOC := qcom-ipq4018
>>>> 	BLOCKSIZE := 64k
>>>> 	IMAGE_SIZE := 31232k
>>>> -	KERNEL_SIZE := 4096k
>>>> +	KERNEL_SIZE := 8192k
>>>> 	IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | append-metadata
>>>> +	DEVICE_COMPAT_VERSION := 2.0
>>>> +	DEVICE_COMPAT_MESSAGE := \n$\
>>>> +		Booting command in U-Boot needs to be changed because of kernel \n$\
>>>> +		growing beyond 4MiB. If OpenWrt 23.05.0 or later is running on \n$\
>>>> +		on the device, it has already been done and You can safely force \n$\
>>>> +		upgrade. If that's not the case, first upgrade to 23.05.0 and it \n$\
>>>> +		will automatically amend booting command in U-Boot on first boot. \n$\
>>>> +		Then proceed with the upgrade to desired version.
>>>> endef
>>>> TARGET_DEVICES += pakedge_wr-1
>>>>
>>>
>>> This is one way of fixing this. But we could also switch all of these from FitImage to FitzImage. (self-decompressing xz) 
>>> That should suffice for quite a while (kernel was 1/4 smaller for my device afterwards). 3MiB in use leaves us quite some headroom.
>>
>> This device uses FitImageLZMA, so it's not affected, yet.
>>
>>> Headroom to implement lzma-loader at some point.
>>
>> That's one way to remedy the problem. The second option would be writing extension
>> for mtd to update Qualcomm partition table in MIBIB partition with new partition
>> sizes, similar to devices with RedBoot bootloader. Unfortunately all of devices
>> have MIBIB partition marked as read-only so that would be a hassle to introduce.
>> BTW The Qualcomm SMEM flash partition parser is already in kernel tree[1].
>> Both of options are outside of my capabilities and I'm not inclined to wait for
>> someone implementing those. Waiting brings only bigger pain later, since usually
>> it gets forgotten and it is reminded when device breaks down. 
>>
>>> What for? To prevent compat increases. Asking people to modify their bootloader environment can work but it's a hassle. Also you have to modify lots of wiki entries so the installation instructions all mention this.
>>
>> User does not have to modify the bootloader environment, since that is done by
>> first boot automatically after flashing new firmware. Everything needed is
>> explained in the message when one wants to perform sysupgrade. The only thing user
>> needs to do, is flash device with firmware version mentioned in the message first.
>> Nothing too complicated I would say.
>>
>> 1. https://www.kernel.org/doc/Documentation/devicetree/bindings/mtd/partitions/qcom%2Csmem-part.yaml
>>
>>> Regards
>>> Felix Baumann / Djfe
>>
>> Regards
>>
> 
> Sounds to me like a chicken and egg problem.
> If it doesn't boot, then it won't be able to change the bootloader variable (bootcmd) after a factory install.
> You would have to do factory installs with older openwrt releases.

That's not a problem here, there's no factory image for this device. The initial
installation should be done with a help of initramfs. Even single boot of
initramfs will change the environment, since it's not inhibited there. Even if
someone would use an older initramfs image, the compat message will forbid
accidental usage of improper image version for sysupgrade.

In that regard, maybe I should inhibit the environment change when simply booting
initramfs image and add it to sysupgrade platform code, so booting it won't change
environment without user action.

> smem looks interesting, thx for mentioning it.
> 
> Since you are setting a KERNEL_SIZE, we won't have anyone bricking their device anymore. Your workaround could still be implemented when builds error. Devices would literally stop building when a new kernel is reintroduced after branching so we probably have half a year to find a fix before the next release then.

That's fine, but I don't want to wait for that. Problem is that if the issue
appears between stable version (not the RC phase), there's difficulty pointing
to the right one, and that will really need manual user intervention, which could
go awry. Also I would rather support device continuously, instead of introducing
holes in between (an example being Linksys WRT devices), explaining when it works
and when it doesn't.
If the fix for the problem lands in tree, I'll happily convert it.

> But in the end maintainers will have to decide here :)

That's what I'm expecting :)

> I just wanted to represent the opposite opinion in this discussion.
> 
> We have some of these devices out in the field (Freifunk, OpenWrt fork called Gluon). Since people install and deploy these routers (just) once we kind of rely on a working sysupgrade which a major compat increase breaks.
> Else we end up with certain devices being stuck on OpenWrt 2022.

I would assume there's some kind of newsletter with important announcements, which
users are subscribed to, which explains some issues with major version bump.
Is that not a thing? Anyway, this commit is a workaround for rather unpopular
device, which I don't think has any users in Germany.

> It's nothing dramatic but an argument why I want to avoid/delay compat increases :)
> In the end we can still patch this out for ourselves if necessary.
> 
> 
> Regards
> Felix Baumann

Regards

-- 
TMN



From philipp_subx at redfish-solutions.com  Mon Jul 10 19:39:34 2023
From: philipp_subx at redfish-solutions.com (Philip Prindeville)
Date: Mon, 10 Jul 2023 20:39:34 -0600
Subject: EFI / SystemReady support for OpenWrt on arm64
In-Reply-To: <ZHMMRgz8a0h7QLpi@meh.true.cz>
References: <0e3b6151-2322-4b42-ac21-65fab7ab30cc@app.fastmail.com>
 <ZHMMRgz8a0h7QLpi@meh.true.cz>
Message-ID: <3FE1562D-9792-470A-92CE-316B27345F4C@redfish-solutions.com>



> On May 28, 2023, at 2:09 AM, Petr ?tetiar <ynezz at true.cz> wrote:
> 
> Mathew McBride <matt at traverse.com.au> [2023-05-26 16:16:31]:
> 
> Hi Mathew,
> 
>> I am just wondering if anyone has any significant objections that would
>> stop this pull from being merged? (after I fix any current conflicts)
> 
> we should support it, so we need to merge it.
> 
>> 23.05 has branched and there is already a pull request for kernel 6.1 on
>> master ( https://github.com/openwrt/openwrt/pull/12705 ), which will force
>> a revision of this pull request.
> 
> FYI it was merged.
> 
>> I am willing to do the work for both branches but would like some
>> indication of any required changes first.
> 
> Great, I don't see any such objections in the PR, so feel free to ping me once
> it's ready for 6.1, thanks!
> 
> Cheers,
> 
> Petr


Looks good to me too.

(What have replied sooner but was going through Cyrus mailbox recovery hell...)

-Philip



From philipp_subx at redfish-solutions.com  Mon Jul 10 19:40:55 2023
From: philipp_subx at redfish-solutions.com (Philip Prindeville)
Date: Mon, 10 Jul 2023 20:40:55 -0600
Subject: armvirt -> armsr target rename [Was: Re: EFI / SystemReady
 support for OpenWrt on arm64]
In-Reply-To: <ZILTaZhI1LpSJ6h1@meh.true.cz>
References: <0e3b6151-2322-4b42-ac21-65fab7ab30cc@app.fastmail.com>
 <ZILTaZhI1LpSJ6h1@meh.true.cz>
Message-ID: <15FCD5BA-CEF1-424E-8B51-9974C5238764@redfish-solutions.com>



> On Jun 9, 2023, at 1:23 AM, Petr ?tetiar <ynezz at true.cz> wrote:
> 
> Hi,
> 
> FYI there is an ongoing effort[1] to rename armvirt target to armsr (Arm SystemReady)
> 
> armvirt/32 becomes armsr/armv7 (title: 32-bit (armv7) machines)
> armvirt/64 becomes armsr/armv8 (title: 64-bit (armv8) machines)
> 
> BOARDNAME:=Arm SystemReady compliant (EFI)
> 
> armv7/armv8 subtarget seems like a good fit for possibly upcoming armv9.
> Should you've any objections or better ideas, please speak now otherwise I'm
> going to merge this during a weekend, there is a plan[2] already to backport
> this new naming scheme into the 23.05 as well.
> 
> 
> 1. https://github.com/openwrt/openwrt/pull/12832
> 2. https://github.com/openwrt/openwrt/pull/12817
> 
> 
> Cheers,
> 
> Petr


I'm all in.

-Philip



From tmn505 at terefe.re  Tue Jul 11 07:06:21 2023
From: tmn505 at terefe.re (Tomasz Maciej Nowak)
Date: Tue, 11 Jul 2023 16:06:21 +0200
Subject: [PATCH] ib: split out processing user provided packages
Message-ID: <20230711140927.33375-1-tmn505@terefe.re>

From: Tomasz Maciej Nowak <tmn505 at gmail.com>

Some device recipes remove default target packages. If user tries to add
them back they will be ignored, since packages list is processed in one
go. Process the device recipe packages first and do user ones later, so
additions won't get filtered out.

Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
---

Test case is simple, download ath79 SDK and invoke:
make image PROFILE=ubnt_routerstation PACKAGES=kmod-ath9k
The resulting image won't include kmod-ath9k.

 target/imagebuilder/files/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile
index 502037379245..78ec7e2e94a9 100644
--- a/target/imagebuilder/files/Makefile
+++ b/target/imagebuilder/files/Makefile
@@ -127,9 +127,11 @@ _call_info: FORCE
 	echo 'Available Profiles:'
 	echo; $(PROFILE_LIST)
 
-BUILD_PACKAGES:=$(USER_PACKAGES) $(sort $(DEFAULT_PACKAGES) $($(USER_PROFILE)_PACKAGES) kernel)
+BUILD_PACKAGES:=$(sort $(DEFAULT_PACKAGES) $($(USER_PROFILE)_PACKAGES) kernel)
 # "-pkgname" in the package list means remove "pkgname" from the package list
 BUILD_PACKAGES:=$(filter-out $(filter -%,$(BUILD_PACKAGES)) $(patsubst -%,%,$(filter -%,$(BUILD_PACKAGES))),$(BUILD_PACKAGES))
+BUILD_PACKAGES:=$(USER_PACKAGES) $(BUILD_PACKAGES)
+BUILD_PACKAGES:=$(filter-out $(filter -%,$(BUILD_PACKAGES)) $(patsubst -%,%,$(filter -%,$(BUILD_PACKAGES))),$(BUILD_PACKAGES))
 PACKAGES:=
 
 _call_image: staging_dir/host/.prereq-build
-- 
2.41.0



From tmn505 at terefe.re  Tue Jul 11 07:09:49 2023
From: tmn505 at terefe.re (Tomasz Maciej Nowak)
Date: Tue, 11 Jul 2023 16:09:49 +0200
Subject: [PATCH] sdk: rename README
Message-ID: <20230711141005.33529-1-tmn505@terefe.re>

From: Tomasz Maciej Nowak <tmn505 at gmail.com>

'help' target fails not finding a file, so follow up on a change[2] made
as a fix for main README[1].

1. d0113711a31f ("README: port to 21st century")
2. 751486b31fd9 ("build: fix README.md reference after rename")

Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
---
 target/sdk/files/{README.SDK => README.md} | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename target/sdk/files/{README.SDK => README.md} (100%)

diff --git a/target/sdk/files/README.SDK b/target/sdk/files/README.md
similarity index 100%
rename from target/sdk/files/README.SDK
rename to target/sdk/files/README.md
-- 
2.41.0



From philipp_subx at redfish-solutions.com  Tue Jul 11 22:25:55 2023
From: philipp_subx at redfish-solutions.com (Philip Prindeville)
Date: Tue, 11 Jul 2023 23:25:55 -0600
Subject: Best practice for resetting (iptables) firewall state
Message-ID: <4CA5F7F4-D47E-4807-978A-EA74AE124683@redfish-solutions.com>

Hi,

I'm working on a wrapper for using xt_asn and xt_geoip in xtables-addons, and was wondering about how best to solve certain problems.

Since, for now, I'll be using shell and UCI, I'm not going to maintain state (old/current vs. new/desired state) of the firewall so I won't be able to easily optimize firewall changes.  The best I can do is detect the previous state, unload it, and then apply the new state.

(Yes, in an ideal world, I'd apply any new rules, then unapply any old rules that aren't being used any more...)

An example: I'm blocking the countries AA BB CC, but decide instead to block BB CC DD.

The optimal path would be:

1. Add block DD
2. Remove block AA

But that's more state than can be easily represented in a shell script that doesn't maintain any state beyond the current desired config which would be /etc/config/xyzzy.

So, the easiest/most straightforward solution I can think of is:

1. Run "iptables-save | grep '^-A input_wan_rule .* -j myprefix_.*' to find where my rules are hooked in (ditto for "forwarding_wan_rule");
2. Change '-A' to '-D' and delete the hooks;
3. Extract the rule name (target of -j above) and do "iptables -F rule_name" then "iptables -X rule_name" to remove the rule from the firewall
4. Generate the new rules based on the current contents of /etc/config/xyzzy

And yes, obviously the firewall is most vulnerable while it's being reconfigured, since rules are being non-atomically torn down and built back up again, and depending on the number of rules and the speed of the processor, this can be a non-negligible amount of time.

One observation: for the most part, the rules themselves while numerous are trivial.  I don't have to worry about replacing an old version of a rule with a new but different version of that rule.  If I'm blocking country AA, then the rule is present in a trivial and invariant form like:

-A forwarding_wan_rule -m geoip --src-cc AA -j fwr_AA

So the granularity of optimization would be:

1. If country X was in the old rules but not the new ones, delete it;
2. If country X is in both the old and new rules, don't do anything;
3. If country X wasn't in the old rules but is in the new ones, add it;

With the only complexity being in preserving the ordering (although since countries don't overlap, ordering shouldn't make any difference).

And another caveat: if the country database changes, and the CIDR list for country AA gets updated, then the only way to squirt the update into the kernel again by deletion/reinsertion, which invalidates (2) above because the country X isn't really 'invariant' in that case.  Well, it could be if we were using ipset's and we could just apply the relevant deltas to the ipset, but we're not using ipsets.

So deleting all the rules and adding them back might be unavoidable in any case, without doing a lot more work (which would involve keeping "last" and "next" versions of the country databases, and detecting if they've changed, etc).

For atomicity, I suppose I could use a generational version of the rules, build generation N+1, insert the hook saying "use N+1", then delete the hook for N, then delete the chain for N...  and "iptables -E ..." would help with renaming the new chain to the old chain after the old chain got deleted.

Something like:

# construct new rules for countries BB, CC, DD...
iptables -N cc_BB_
iptables -A cc_BB_ -m limit --limit 1/sec --limit 5 -j LOG --log-level 4 --log-prefix "DROP cc BB: "
iptables -A cc_BB_ -j DROP
...

# create new container for new country rules
iptables -N country_rules_
# hook in the individual new country rules
iptables -A country_rules_ -m geoip --src-cc BB -g cc_BB_
iptables -A country_rules_ -m geoip --src-cc CC -g cc_CC_
..

# add the hook into the new country rules
iptables -A forwarding_wan_rule -j country_rules_

# clean up the old country rules
iptables -D country_rules -m geoip --src-cc AA -g cc_AA
iptables -D country_rules -m geoip --src-cc BB -g cc_BB
...

# remove the hook into the old country rules
iptables -D forwarding_wan_rule -j country_rules

# remove the old country rules
iptables -F cc_AA
iptables -F cc_BB
...

# rename the new rules into the old names
iptables -E country_rules_ country_rules
iptables -E cc_BB_ cc_BB_
iptables -E cc_CC_ cc_CC_
...


Anyone have any suggestions, tips & tricks, etc. to give on how best manage firewall state without too much extra complexity?

Also, how do you write an init.d wrapper that doesn't have a persistent foreground process, but handles "start", "stop", "reload", etc.

Thanks,

-Philip




From erik.r.karlsson at gmail.com  Wed Jul 12 14:39:34 2023
From: erik.r.karlsson at gmail.com (erik.r.karlsson at gmail.com)
Date: Wed, 12 Jul 2023 23:39:34 +0200
Subject: [PATCH netifd] device: restore cleared flags on device down
Message-ID: <20230712213934.586291-1-erik.r.karlsson@gmail.com>

From: Erik Karlsson <erik.karlsson at genexis.eu>

In case flags have been cleared because settings failed to apply,
restore them when the device is brought down so that they will be
re-attempted the next time the device is brought up.

Signed-off-by: Erik Karlsson <erik.karlsson at genexis.eu>
---
 device.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/device.c b/device.c
index 92c814c..720b504 100644
--- a/device.c
+++ b/device.c
@@ -159,6 +159,11 @@ static int set_device_state(struct device *dev, bool state)
 	} else {
 		system_if_down(dev);
 		system_if_apply_settings(dev, &dev->orig_settings, dev->orig_settings.flags);
+
+		/* Restore any settings present in UCI which may have
+		 * failed to apply so that they will be re-attempted
+		 * the next time the device is brought up */
+		dev->settings.flags |= dev->settings.valid_flags;
 	}
 
 	return 0;
@@ -505,6 +510,10 @@ device_init_settings(struct device *dev, struct blob_attr **tb)
 		s->duplex = blobmsg_get_bool(cur);
 		s->flags |= DEV_OPT_DUPLEX;
 	}
+
+	/* Remember the settings present in UCI */
+	s->valid_flags = s->flags;
+
 	device_set_extra_vlans(dev, tb[DEV_ATTR_VLAN]);
 	device_set_disabled(dev, disabled);
 }
-- 
2.25.1



From hmehrtens at maxlinear.com  Thu Jul 13 09:53:22 2023
From: hmehrtens at maxlinear.com (Hauke Mehrtens)
Date: Thu, 13 Jul 2023 18:53:22 +0200
Subject: [PATCH uci] file: Fix uci -m import command
Message-ID: <20230713165322.7614-1-hmehrtens@maxlinear.com>

Without this change we see the following error:
  # uci -m import optic < /etc/optic-db/default
  uci: Parse error (option/list command found before the first section) at line 4, byte 1

ptr.last is still a null pointer in case the uci_lookup_list() call
found a matching section and set ptr.s to it. The code expects that
uci_set() updates the ptr.last pointer, but this is not done any more.
If case uci_lookup_list() did not found a section ptr->s is a null
pointer and then uci_set() will allocate a new section.

Fixes: ae61e1cad4a1 ("uci: optimize update section in uci_set")
Fixes: 7e01d66d7bec ("uci: optimize update option in uci_set")
Signed-off-by: Hauke Mehrtens <hmehrtens at maxlinear.com>
---
 file.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/file.c b/file.c
index 93abfae..b01480c 100644
--- a/file.c
+++ b/file.c
@@ -449,6 +449,7 @@ static void uci_parse_config(struct uci_context *ctx)
 		e = uci_lookup_list(&pctx->package->sections, name);
 		if (e) {
 			ptr.s = uci_to_section(e);
+			ptr.last = &ptr.s->e;
 
 			if ((ctx->flags & UCI_FLAG_STRICT) && strcmp(ptr.s->type, type))
 				uci_parse_error(ctx, "section of different type overwrites prior section with same name");
@@ -490,8 +491,10 @@ static void uci_parse_option(struct uci_context *ctx, bool list)
 
 	uci_fill_ptr(ctx, &ptr, &pctx->section->e);
 	e = uci_lookup_list(&pctx->section->options, name);
-	if (e)
+	if (e) {
 		ptr.o = uci_to_option(e);
+		ptr.last = &ptr.o->e;
+	}
 	ptr.option = name;
 	ptr.value = value;
 
-- 
2.17.1



From zajec5 at gmail.com  Fri Jul 14 01:26:33 2023
From: zajec5 at gmail.com (=?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?=)
Date: Fri, 14 Jul 2023 10:26:33 +0200
Subject: [PATCH] ramips: set Netgear R6220 MAC NVMEM cell directly in the
 part node
In-Reply-To: <5AB3623E-5005-42B3-8196-47A52BC1C607@freifunk-aachen.de>
References: <20230509132948.17808-1-zajec5@gmail.com>
 <5AB3623E-5005-42B3-8196-47A52BC1C607@freifunk-aachen.de>
Message-ID: <033bd8aa-a869-899a-e101-ea00e128d254@gmail.com>

On 9.05.2023 18:21, Felix Baumann wrote:
> Am 9. Mai 2023 15:29:48 MESZ schrieb "Rafa? Mi?ecki" <zajec5 at gmail.com>:
>> From: Rafa? Mi?ecki <rafal at milecki.pl>
>>
>> There is no need to use reference if original node it specified in
>> exactly the same file. This is a minor cleanup simplifying DTS code.
>>
>> Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
>> ---
>> .../linux/ramips/dts/mt7621_netgear_r6220.dts  | 18 ++++++++----------
>> 1 file changed, 8 insertions(+), 10 deletions(-)
>>
>> diff --git a/target/linux/ramips/dts/mt7621_netgear_r6220.dts b/target/linux/ramips/dts/mt7621_netgear_r6220.dts
>> index 0f476ef060..7bb49c15b4 100644
>> --- a/target/linux/ramips/dts/mt7621_netgear_r6220.dts
>> +++ b/target/linux/ramips/dts/mt7621_netgear_r6220.dts
>> @@ -42,9 +42,17 @@
>> 		};
>>
>> 		factory: partition at 2e00000 {
> 
> The "factory" reference could be probably be dropped as well. Proposed changes look good to me.

Actually it can't be dropped. While it's a bit counter-intuitive, that
label is used in a *parent* DTS file mt7621_netgear_sercomm_ayx.dtsi .


>> +			compatible = "nvmem-cells";
>> 			label = "factory";
>> 			reg = <0x2e00000 0x100000>;
>> 			read-only;
>> +
>> +			#address-cells = <1>;
>> +			#size-cells = <1>;
>> +
>> +			macaddr_factory_4: macaddr at 4 {
>> +				reg = <0x4 0x6>;
>> +			};
>> 		};
>>
>> 		partition at 4200000 {
>> @@ -65,13 +73,3 @@
>> 	nvmem-cell-names = "mac-address";
>> 	mac-address-increment = <1>;
>> };
>> -
>> -&factory {
>> -	compatible = "nvmem-cells";
>> -	#address-cells = <1>;
>> -	#size-cells = <1>;
>> -
>> -	macaddr_factory_4: macaddr at 4 {
>> -		reg = <0x4 0x6>;
>> -	};
>> -};
>> -- 
>> 2.35.3


From felix.baumann at freifunk-aachen.de  Fri Jul 14 02:57:01 2023
From: felix.baumann at freifunk-aachen.de (Felix Baumann)
Date: Fri, 14 Jul 2023 11:57:01 +0200
Subject: =?US-ASCII?Q?Re=3A_=5BPATCH=5D_ramips=3A_set_Netgear_R6220_M?= =?US-ASCII?Q?AC_NVMEM_cell_directly_in_the_part_node?=
In-Reply-To: <033bd8aa-a869-899a-e101-ea00e128d254@gmail.com>
References: <20230509132948.17808-1-zajec5@gmail.com> <5AB3623E-5005-42B3-8196-47A52BC1C607@freifunk-aachen.de> <033bd8aa-a869-899a-e101-ea00e128d254@gmail.com>
Message-ID: <94384F9A-843C-43FC-80A9-31D759D689CE@freifunk-aachen.de>

Am 14. Juli 2023 10:26:33 MESZ schrieb "Rafa? Mi?ecki" <zajec5 at gmail.com>:
>On 9.05.2023 18:21, Felix Baumann wrote:
>> Am 9. Mai 2023 15:29:48 MESZ schrieb "Rafa? Mi?ecki" <zajec5 at gmail.com>:
>>> From: Rafa? Mi?ecki <rafal at milecki.pl>
>>> 
>>> There is no need to use reference if original node it specified in
>>> exactly the same file. This is a minor cleanup simplifying DTS code.
>>> 
>>> Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
>>> ---
>>> .../linux/ramips/dts/mt7621_netgear_r6220.dts  | 18 ++++++++----------
>>> 1 file changed, 8 insertions(+), 10 deletions(-)
>>> 
>>> diff --git a/target/linux/ramips/dts/mt7621_netgear_r6220.dts b/target/linux/ramips/dts/mt7621_netgear_r6220.dts
>>> index 0f476ef060..7bb49c15b4 100644
>>> --- a/target/linux/ramips/dts/mt7621_netgear_r6220.dts
>>> +++ b/target/linux/ramips/dts/mt7621_netgear_r6220.dts
>>> @@ -42,9 +42,17 @@
>>> 		};
>>> 
>>> 		factory: partition at 2e00000 {
>> 
>> The "factory" reference could be probably be dropped as well. Proposed changes look good to me.
>
>Actually it can't be dropped. While it's a bit counter-intuitive, that
>label is used in a *parent* DTS file mt7621_netgear_sercomm_ayx.dtsi .

Hello Rafa?,

I was under the strong impression that dts(i) files could only get reference from the same file or parents but not childs. I remember reading a few exchanges by Ansuel, I think, that mentioned this.
I might be mixing two topics here, but was this (intended to be) fixed by dynamic partitions or something like that?

Are you certain the eeprom is loaded successfully?

Aren't dts(i) files read from top to bottom?


Regards
Felix Baumann


From zajec5 at gmail.com  Fri Jul 14 06:11:14 2023
From: zajec5 at gmail.com (=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=)
Date: Fri, 14 Jul 2023 15:11:14 +0200
Subject: [PATCH] ramips: replace "mac-address-ascii" with "mac-base"
Message-ID: <20230714131114.26906-1-zajec5@gmail.com>

From: Rafa? Mi?ecki <rafal at milecki.pl>

With upstream accepted "mac-base" binding there is no need for a
downstream "mac-address-ascii" workaround anymore.

Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
 .../dts/mt7621_raisecom_msg1500-x-00.dts      | 32 ++++++++++-------
 .../ramips/dts/mt7621_tplink_ec330-g5u-v1.dts | 34 +++++++++++--------
 2 files changed, 40 insertions(+), 26 deletions(-)

diff --git a/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts b/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts
index 5d713c0098..07297df083 100644
--- a/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts
+++ b/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts
@@ -82,15 +82,23 @@
 			read-only;
 
 			compatible = "nvmem-cells";
-			#address-cells = <1>;
-			#size-cells = <1>;
-
-			macaddr_config_8014: macaddr at 8014 {
-				reg = <0x8014 0x11>;
-			};
 
-			macaddr_config_8036: macaddr at 8036 {
-				reg = <0x8036 0x11>;
+			nvmem-layout {
+				compatible = "fixed-layout";
+				#address-cells = <1>;
+				#size-cells = <1>;
+
+				macaddr_config_8014: macaddr at 8014 {
+					compatible = "mac-base";
+					reg = <0x8014 0x11>;
+					#nvmem-cell-cells = <1>;
+				};
+
+				macaddr_config_8036: macaddr at 8036 {
+					compatible = "mac-base";
+					reg = <0x8036 0x11>;
+					#nvmem-cell-cells = <1>;
+				};
 			};
 		};
 
@@ -137,8 +145,8 @@
 };
 
 &gmac0 {
-	nvmem-cells = <&macaddr_config_8014>;
-	nvmem-cell-names = "mac-address-ascii";
+	nvmem-cells = <&macaddr_config_8014 0>;
+	nvmem-cell-names = "mac-address";
 };
 
 &gmac1 {
@@ -146,8 +154,8 @@
 	label = "wan";
 	phy-handle = <&ethphy4>;
 
-	nvmem-cells = <&macaddr_config_8036>;
-	nvmem-cell-names = "mac-address-ascii";
+	nvmem-cells = <&macaddr_config_8036 0>;
+	nvmem-cell-names = "mac-address";
 };
 
 &mdio {
diff --git a/target/linux/ramips/dts/mt7621_tplink_ec330-g5u-v1.dts b/target/linux/ramips/dts/mt7621_tplink_ec330-g5u-v1.dts
index 6c9cc40701..537b6f70a7 100644
--- a/target/linux/ramips/dts/mt7621_tplink_ec330-g5u-v1.dts
+++ b/target/linux/ramips/dts/mt7621_tplink_ec330-g5u-v1.dts
@@ -230,12 +230,20 @@
 			read-only;
 
 			compatible = "nvmem-cells";
-			#address-cells = <1>;
-			#size-cells = <1>;
 
-			macaddr_factory_165: macaddr at 165 {
-				reg = <0x165 0x11>;
+			nvmem-layout {
+				compatible = "fixed-layout";
+				#address-cells = <1>;
+				#size-cells = <1>;
+
+				macaddr_factory_165: macaddr at 165 {
+					compatible = "mac-base";
+					reg = <0x165 0x11>;
+					#nvmem-cell-cells = <1>;
+				};
 			};
+
+
 		};
 
 		partition at 0_wholeflash {
@@ -257,8 +265,8 @@
 		mediatek,mtd-eeprom = <&factory 0x8000>;
 		ieee80211-freq-limit = <2400000 2500000>;
 
-		nvmem-cells = <&macaddr_factory_165>;
-		nvmem-cell-names = "mac-address-ascii";
+		nvmem-cells = <&macaddr_factory_165 0>;
+		nvmem-cell-names = "mac-address";
 	};
 };
 
@@ -269,15 +277,14 @@
 		mediatek,mtd-eeprom = <&factory 0x14000>;
 		ieee80211-freq-limit = <5000000 6000000>;
 
-		nvmem-cells = <&macaddr_factory_165>;
-		nvmem-cell-names = "mac-address-ascii";
-		mac-address-increment = <(2)>;
+		nvmem-cells = <&macaddr_factory_165 2>;
+		nvmem-cell-names = "mac-address";
 	};
 };
 
 &gmac0 {
-	nvmem-cells = <&macaddr_factory_165>;
-	nvmem-cell-names = "mac-address-ascii";
+	nvmem-cells = <&macaddr_factory_165 0>;
+	nvmem-cell-names = "mac-address";
 };
 
 &gmac1 {
@@ -285,9 +292,8 @@
 	label = "wan";
 	phy-handle = <&ethphy0>;
 
-	nvmem-cells = <&macaddr_factory_165>;
-	nvmem-cell-names = "mac-address-ascii";
-	mac-address-increment = <(1)>;
+	nvmem-cells = <&macaddr_factory_165 1>;
+	nvmem-cell-names = "mac-address";
 };
 
 &mdio {
-- 
2.35.3



From yangshiji66 at outlook.com  Fri Jul 14 08:09:55 2023
From: yangshiji66 at outlook.com (Shiji Yang)
Date: Fri, 14 Jul 2023 23:09:55 +0800
Subject: [PATCH] ath79: increase the rfkill debounce interval for TP-Link Archer C7 v2
Message-ID: <TYAP286MB0315F6A4041644748C17192ABC34A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>

From: Shiji Yang <yangshiji66 at qq.com>

Due to circuit issue or silicon defect, sometimes the WiFi switch button
of the Archer C7 v2 can be accidentally triggered multiple times in one
second. This will cause WiFi to be unexpectedly shut down and trigger
'irq 23: nobody cared'[1] warning. Increasing the key debounce interval
to 1000 ms can fix this issue. This patch also add the missing rfkill
key label.

[1] Warning Log:
```
[87765.218511] irq 23: nobody cared (try booting with the "irqpoll" option)
[87765.225331] CPU: 0 PID: 317 Comm: irq/23-keys Not tainted 5.15.118 #0
...
[87765.486246] handlers:
[87765.488543] [<85257547>] 0x800c29a0 threaded [<5c6328a2>] 0x80ffe0b8 [gpio_button_hotplug at 4cf73d00+0x1a00]
[87765.498364] Disabling IRQ #23
```

Fixes: https://github.com/openwrt/openwrt/issues/13010
Fixes: https://github.com/openwrt/openwrt/issues/12167
Fixes: https://github.com/openwrt/openwrt/issues/11191
Fixes: https://github.com/openwrt/openwrt/issues/7835

Tested-by: Hans Hasert
Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
---
 target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts b/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts
index b7ac902003..1b860dbf2d 100644
--- a/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts
+++ b/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts
@@ -13,10 +13,11 @@
 
 &keys {
 	rfkill {
+		label = "rfkill";
 		gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
 		linux,code = <KEY_RFKILL>;
 		linux,input-type = <EV_SW>;
-		debounce-interval = <60>;
+		debounce-interval = <1000>;
 	};
 };
 
-- 
2.30.2



From rafal at milecki.pl  Fri Jul 14 09:42:16 2023
From: rafal at milecki.pl (=?UTF-8?Q?Rafa=C5=82_Mi=C5=82ecki?=)
Date: Fri, 14 Jul 2023 18:42:16 +0200
Subject: [PATCH] ramips: set Netgear R6220 MAC NVMEM cell directly in the
 part node
In-Reply-To: <94384F9A-843C-43FC-80A9-31D759D689CE@freifunk-aachen.de>
References: <20230509132948.17808-1-zajec5@gmail.com>
 <5AB3623E-5005-42B3-8196-47A52BC1C607@freifunk-aachen.de>
 <033bd8aa-a869-899a-e101-ea00e128d254@gmail.com>
 <94384F9A-843C-43FC-80A9-31D759D689CE@freifunk-aachen.de>
Message-ID: <ff71831a3a7e2abac8cf339f9202cead@milecki.pl>

On 2023-07-14 11:57, Felix Baumann wrote:
> Am 14. Juli 2023 10:26:33 MESZ schrieb "Rafa? Mi?ecki" 
> <zajec5 at gmail.com>:
>> On 9.05.2023 18:21, Felix Baumann wrote:
>>> Am 9. Mai 2023 15:29:48 MESZ schrieb "Rafa? Mi?ecki" 
>>> <zajec5 at gmail.com>:
>>>> From: Rafa? Mi?ecki <rafal at milecki.pl>
>>>> 
>>>> There is no need to use reference if original node it specified in
>>>> exactly the same file. This is a minor cleanup simplifying DTS code.
>>>> 
>>>> Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
>>>> ---
>>>> .../linux/ramips/dts/mt7621_netgear_r6220.dts  | 18 
>>>> ++++++++----------
>>>> 1 file changed, 8 insertions(+), 10 deletions(-)
>>>> 
>>>> diff --git a/target/linux/ramips/dts/mt7621_netgear_r6220.dts 
>>>> b/target/linux/ramips/dts/mt7621_netgear_r6220.dts
>>>> index 0f476ef060..7bb49c15b4 100644
>>>> --- a/target/linux/ramips/dts/mt7621_netgear_r6220.dts
>>>> +++ b/target/linux/ramips/dts/mt7621_netgear_r6220.dts
>>>> @@ -42,9 +42,17 @@
>>>> 		};
>>>> 
>>>> 		factory: partition at 2e00000 {
>>> 
>>> The "factory" reference could be probably be dropped as well. 
>>> Proposed changes look good to me.
>> 
>> Actually it can't be dropped. While it's a bit counter-intuitive, that
>> label is used in a *parent* DTS file mt7621_netgear_sercomm_ayx.dtsi .
> 
> Hello Rafa?,
> 
> I was under the strong impression that dts(i) files could only get
> reference from the same file or parents but not childs. I remember
> reading a few exchanges by Ansuel, I think, that mentioned this.
> I might be mixing two topics here, but was this (intended to be) fixed
> by dynamic partitions or something like that?
> 
> Are you certain the eeprom is loaded successfully?
> 
> Aren't dts(i) files read from top to bottom?

I just verified that and it works.

First I decompiled .dtb from the latest "master" branch with:
dtc -I dtb -O dts -o r6220.dts 
build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/image-mt7621_netgear_r6220.dtb

Then I opened r6220.dts and analyzed it.

My MAC cell looks like this:

macaddr at 4 {
	compatible = "mac-base";
	reg = <0x04 0x06>;
	#nvmem-cell-cells = <0x01>;
	phandle = <0x13>;
};


Then my Ethernet controller nodes look like that:

mac at 0 {
	compatible = "mediatek,eth-mac";
	reg = <0x00>;
	nvmem-cells = <0x13 0x00>;
	nvmem-cell-names = "mac-address";
	(...)
};

mac at 1 {
	compatible = "mediatek,eth-mac";
	reg = <0x01>;
	status = "okay";
	nvmem-cells = <0x13 0x01>;
	nvmem-cell-names = "mac-address";
	(...)
};

As you can see both reference phandle 0x13 so that looks all good.


From jan at venekamp.net  Fri Jul 14 11:28:09 2023
From: jan at venekamp.net (Jan Venekamp)
Date: Fri, 14 Jul 2023 20:28:09 +0200
Subject: [PATCH uci 0/2] remove internal usage of redundant uci_ptr.last
Message-ID: <20230714182811.20444-1-jan@venekamp.net>

Remove internal usage of redundant uci_ptr.last in order to fix issue
and simplify code.

Jan Venekamp (2):
  file: Fix uci -m import command
  remove internal usage of redundant uci_ptr.last

 cli.c     | 39 +++++++++++----------------------------
 delta.c   | 10 ++++++----
 file.c    |  2 +-
 list.c    |  6 ------
 lua/uci.c | 42 +++++++++++++++---------------------------
 5 files changed, 33 insertions(+), 66 deletions(-)

-- 
2.32.0 (Apple Git-132)



From jan at venekamp.net  Fri Jul 14 11:28:10 2023
From: jan at venekamp.net (Jan Venekamp)
Date: Fri, 14 Jul 2023 20:28:10 +0200
Subject: [PATCH uci 1/2] file: Fix uci -m import command
In-Reply-To: <20230714182811.20444-1-jan@venekamp.net>
References: <20230714182811.20444-1-jan@venekamp.net>
Message-ID: <20230714182811.20444-2-jan@venekamp.net>

Without this change we see the following error:
  # uci -m import optic < /etc/optic-db/default
  uci: Parse error (option/list command found before the first section) at line 4, byte 1

ptr.last is still a null pointer in case the uci_lookup_list() call
found a matching section and set ptr.s to it. The code expects that
uci_set() updates the ptr.last pointer, but this is not done any more.
If case uci_lookup_list() did not found a section ptr->s is a null
pointer and then uci_set() will allocate a new section.

Fixes: ae61e1cad4a1 ("uci: optimize update section in uci_set")
Co-authored-by: Hauke Mehrtens <hmehrtens at maxlinear.com>
Signed-off-by: Jan Venekamp <jan at venekamp.net>
---
 file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/file.c b/file.c
index 93abfae..6610f53 100644
--- a/file.c
+++ b/file.c
@@ -459,7 +459,7 @@ static void uci_parse_config(struct uci_context *ctx)
 
 		ctx->internal = !pctx->merge;
 		UCI_NESTED(uci_set, ctx, &ptr);
-		pctx->section = uci_to_section(ptr.last);
+		pctx->section = ptr.s;
 	}
 }
 
-- 
2.32.0 (Apple Git-132)



From jan at venekamp.net  Fri Jul 14 11:28:11 2023
From: jan at venekamp.net (Jan Venekamp)
Date: Fri, 14 Jul 2023 20:28:11 +0200
Subject: [PATCH uci 2/2] remove internal usage of redundant uci_ptr.last
In-Reply-To: <20230714182811.20444-1-jan@venekamp.net>
References: <20230714182811.20444-1-jan@venekamp.net>
Message-ID: <20230714182811.20444-3-jan@venekamp.net>

In uci_lookup_ptr and uci_set the pointer uci_ptr ptr.last is set to
the element corresponding to the first of: ptr.o, ptr.s, ptr.p.

Thus, ptr.last is redundant and in case of uci_set is (and was) not
always consistently set.

In order to simplify the code this commit removes internal usage
of ptr.last, and remove setting it from uci_set (and from uci_add_list
that was never used anyway).

As it is part of the public C api ptr.last cannot be completely
removed though. A search on lxr.openwrt.org shows that it is used as
the output of uci_lookup_ptr in several packages.

So we leave setting ptr.last in uci_lookup_ptr intact.

Signed-off-by: Jan Venekamp <jan at venekamp.net>
---
 cli.c     | 39 +++++++++++----------------------------
 delta.c   | 10 ++++++----
 list.c    |  6 ------
 lua/uci.c | 42 +++++++++++++++---------------------------
 4 files changed, 32 insertions(+), 65 deletions(-)

diff --git a/cli.c b/cli.c
index b4c4f95..f169e42 100644
--- a/cli.c
+++ b/cli.c
@@ -314,7 +314,6 @@ static void uci_show_changes(struct uci_package *p)
 
 static int package_cmd(int cmd, char *tuple)
 {
-	struct uci_element *e = NULL;
 	struct uci_ptr ptr;
 	int ret = 1;
 
@@ -323,7 +322,6 @@ static int package_cmd(int cmd, char *tuple)
 		return 1;
 	}
 
-	e = ptr.last;
 	switch(cmd) {
 	case CMD_CHANGES:
 		uci_show_changes(ptr.p);
@@ -349,20 +347,14 @@ static int package_cmd(int cmd, char *tuple)
 			cli_perror();
 			goto out;
 		}
-		switch(e->type) {
-			case UCI_TYPE_PACKAGE:
-				uci_show_package(ptr.p);
-				break;
-			case UCI_TYPE_SECTION:
-				uci_show_section(ptr.s);
-				break;
-			case UCI_TYPE_OPTION:
-				uci_show_option(ptr.o, true);
-				break;
-			default:
-				/* should not happen */
-				goto out;
-		}
+		if (ptr.o)
+			uci_show_option(ptr.o, true);
+		else if (ptr.s)
+			uci_show_section(ptr.s);
+		else if (ptr.p)
+			uci_show_package(ptr.p);
+		else
+			goto out; /* should not happen */
 		break;
 	}
 
@@ -475,7 +467,6 @@ done:
 
 static int uci_do_section_cmd(int cmd, int argc, char **argv)
 {
-	struct uci_element *e;
 	struct uci_ptr ptr;
 	int ret = UCI_OK;
 	int dummy;
@@ -493,7 +484,6 @@ static int uci_do_section_cmd(int cmd, int argc, char **argv)
 	    (cmd != CMD_RENAME) && (cmd != CMD_REORDER))
 		return 1;
 
-	e = ptr.last;
 	switch(cmd) {
 	case CMD_GET:
 		if (!(ptr.flags & UCI_LOOKUP_COMPLETE)) {
@@ -501,17 +491,10 @@ static int uci_do_section_cmd(int cmd, int argc, char **argv)
 			cli_perror();
 			return 1;
 		}
-		switch(e->type) {
-		case UCI_TYPE_SECTION:
-			printf("%s\n", ptr.s->type);
-			break;
-		case UCI_TYPE_OPTION:
+		if (ptr.o)
 			uci_show_value(ptr.o, false);
-			break;
-		default:
-			break;
-		}
-		/* throw the value to stdout */
+		else if (ptr.s)
+			printf("%s\n", ptr.s->type);
 		break;
 	case CMD_RENAME:
 		ret = uci_rename(ctx, &ptr);
diff --git a/delta.c b/delta.c
index 85ec970..5437fc1 100644
--- a/delta.c
+++ b/delta.c
@@ -213,7 +213,6 @@ error:
 
 static void uci_parse_delta_line(struct uci_context *ctx, struct uci_package *p)
 {
-	struct uci_element *e = NULL;
 	struct uci_ptr ptr;
 	int cmd;
 
@@ -244,11 +243,14 @@ static void uci_parse_delta_line(struct uci_context *ctx, struct uci_package *p)
 		UCI_INTERNAL(uci_del_list, ctx, &ptr);
 		break;
 	case UCI_CMD_ADD:
+		UCI_INTERNAL(uci_set, ctx, &ptr);
+		if (!ptr.option && ptr.s)
+			ptr.s->anonymous = true;
+		break;
 	case UCI_CMD_CHANGE:
 		UCI_INTERNAL(uci_set, ctx, &ptr);
-		e = ptr.last;
-		if (!ptr.option && e && (cmd == UCI_CMD_ADD))
-			uci_to_section(e)->anonymous = true;
+		break;
+	default:
 		break;
 	}
 	return;
diff --git a/list.c b/list.c
index 1640213..304c9e1 100644
--- a/list.c
+++ b/list.c
@@ -616,7 +616,6 @@ int uci_add_list(struct uci_context *ctx, struct uci_ptr *ptr)
 		UCI_TRAP_SAVE(ctx, error);
 		ptr->o = uci_alloc_list(ptr->s, ptr->option, NULL);
 		UCI_TRAP_RESTORE(ctx);
-		ptr->last = &ptr->o->e;
 	} else if (ptr->o->type == UCI_TYPE_STRING) {
 		/* create new list and add old string value as item to list */
 		struct uci_option *old = ptr->o;
@@ -630,7 +629,6 @@ int uci_add_list(struct uci_context *ctx, struct uci_ptr *ptr)
 		if (ptr->option == old->e.name)
 			ptr->option = ptr->o->e.name;
 		uci_free_option(old);
-		ptr->last = &ptr->o->e;
 	}
 
 	/* add new item to list */
@@ -708,10 +706,8 @@ int uci_set(struct uci_context *ctx, struct uci_ptr *ptr)
 		return uci_delete(ctx, ptr);
 	} else if (!ptr->o && ptr->option) { /* new option */
 		ptr->o = uci_alloc_option(ptr->s, ptr->option, ptr->value, NULL);
-		ptr->last = &ptr->o->e;
 	} else if (!ptr->s && ptr->section) { /* new section */
 		ptr->s = uci_alloc_section(ptr->p, ptr->value, ptr->section, NULL);
-		ptr->last = &ptr->s->e;
 	} else if (ptr->o && ptr->option) { /* update option */
 		if (ptr->o->type == UCI_TYPE_STRING && !strcmp(ptr->o->v.string, ptr->value))
 			return 0;
@@ -724,7 +720,6 @@ int uci_set(struct uci_context *ctx, struct uci_ptr *ptr)
 			if (ptr->option == old->e.name)
 				ptr->option = ptr->o->e.name;
 			uci_free_option(old);
-			ptr->last = &ptr->o->e;
 		}
 	} else if (ptr->s && ptr->section) { /* update section */
 		if (!strcmp(ptr->s->type, ptr->value))
@@ -740,7 +735,6 @@ int uci_set(struct uci_context *ctx, struct uci_ptr *ptr)
 				ptr->section = ptr->s->e.name;
 			uci_free_section(old);
 			ptr->s->package->n_section--;
-			ptr->last = &ptr->s->e;
 		}
 	} else {
 		UCI_THROW(ctx, UCI_ERR_INVAL);
diff --git a/lua/uci.c b/lua/uci.c
index 196a25b..78b5e1f 100644
--- a/lua/uci.c
+++ b/lua/uci.c
@@ -374,19 +374,16 @@ static int
 uci_lua_get_any(lua_State *L, bool all)
 {
 	struct uci_context *ctx;
-	struct uci_element *e = NULL;
 	struct uci_ptr ptr;
 	int offset = 0;
 	int nret = 1;
 	char *s = NULL;
-	int err = UCI_ERR_NOTFOUND;
 
 	ctx = find_context(L, &offset);
 
 	if (lookup_args(L, ctx, offset, &ptr, &s))
 		goto error;
 
-	lookup_ptr(ctx, &ptr, NULL, true);
 	if (!all && !ptr.s) {
 		ctx->err = UCI_ERR_INVAL;
 		goto error;
@@ -396,33 +393,24 @@ uci_lua_get_any(lua_State *L, bool all)
 		goto error;
 	}
 
-	err = UCI_OK;
-	e = ptr.last;
-	switch(e->type) {
-		case UCI_TYPE_PACKAGE:
-			uci_push_package(L, ptr.p);
-			break;
-		case UCI_TYPE_SECTION:
-			if (all) {
-				uci_push_section(L, ptr.s, -1);
-			}
-			else {
-				lua_pushstring(L, ptr.s->type);
-				lua_pushstring(L, ptr.s->e.name);
-				nret++;
-			}
-			break;
-		case UCI_TYPE_OPTION:
-			uci_push_option(L, ptr.o);
-			break;
-		default:
-			ctx->err = UCI_ERR_INVAL;
-			goto error;
+	if (ptr.o) {
+		uci_push_option(L, ptr.o);
+	} else if (ptr.s) {
+		if (all) {
+			uci_push_section(L, ptr.s, -1);
+		}
+		else {
+			lua_pushstring(L, ptr.s->type);
+			lua_pushstring(L, ptr.s->e.name);
+			nret++;
+		}
+	} else {
+		uci_push_package(L, ptr.p);
 	}
+
 	if (s)
 		free(s);
-	if (!err)
-		return nret;
+	return nret;
 
 error:
 	if (s)
-- 
2.32.0 (Apple Git-132)



From jan at venekamp.net  Fri Jul 14 11:35:45 2023
From: jan at venekamp.net (Jan Venekamp)
Date: Fri, 14 Jul 2023 20:35:45 +0200
Subject: [PATCH uci] file: Fix uci -m import command
In-Reply-To: <20230713165322.7614-1-hmehrtens@maxlinear.com>
References: <20230713165322.7614-1-hmehrtens@maxlinear.com>
Message-ID: <a56dc0b2-44f4-f6bd-e05e-f986b438d242@venekamp.net>

On 13/07/2023 18:53, Hauke Mehrtens wrote:
> Without this change we see the following error:
>    # uci -m import optic < /etc/optic-db/default
>    uci: Parse error (option/list command found before the first section) at line 4, byte 1
>
> ptr.last is still a null pointer in case the uci_lookup_list() call
> found a matching section and set ptr.s to it. The code expects that
> uci_set() updates the ptr.last pointer, but this is not done any more

Ah snap, I overlooked that in uci_parse_config while working on uci_set.

A clearer fix might be to just change the last line of uci_parse_config to:
pctx->section = ptr.s;
The change to uci_parse_option does not do anything, ptr->last is never 
read after being set.

However, seeing this made me more convinced that ptr.last just 
complicates the code while being redundant anyway. So I created a patch 
that removes internal usage of ptr.last altogether. Would you please be 
so kind to take a look at it?
https://patchwork.ozlabs.org/project/openwrt/list/?series=363985

While your at it, maybe you could also take a look at these other 
patches for uci?
https://patchwork.ozlabs.org/project/openwrt/patch/20221120010927.23856-2-jan at venekamp.net/
https://patchwork.ozlabs.org/project/openwrt/patch/SY4P282MB39395204AE37BC45D35D834CC57B9 at SY4P282MB3939.AUSP282.PROD.OUTLOOK.COM/

Kind regards,
Jan Venekamp



From csharper2005 at gmail.com  Fri Jul 14 11:36:14 2023
From: csharper2005 at gmail.com (Mikhail Zhilkin)
Date: Fri, 14 Jul 2023 21:36:14 +0300
Subject: [PATCH] ramips: replace "mac-address-ascii" with "mac-base"
In-Reply-To: <20230714131114.26906-1-zajec5@gmail.com>
References: <20230714131114.26906-1-zajec5@gmail.com>
Message-ID: <94aa0ec5-f46a-8549-cbc8-d0cc00876ef6@gmail.com>


On 7/14/2023 4:11 PM, Rafa? Mi?ecki wrote:
> From: Rafa? Mi?ecki <rafal at milecki.pl>
> 
> With upstream accepted "mac-base" binding there is no need for a
> downstream "mac-address-ascii" workaround anymore.
> 
> Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
> ---
>  .../dts/mt7621_raisecom_msg1500-x-00.dts      | 32 ++++++++++-------
>  .../ramips/dts/mt7621_tplink_ec330-g5u-v1.dts | 34 +++++++++++--------
>  2 files changed, 40 insertions(+), 26 deletions(-)
> 
> diff --git a/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts b/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts
> index 5d713c0098..07297df083 100644
> --- a/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts
> +++ b/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts
> @@ -82,15 +82,23 @@
>  			read-only;
>  
>  			compatible = "nvmem-cells";
> -			#address-cells = <1>;
> -			#size-cells = <1>;
> -
> -			macaddr_config_8014: macaddr at 8014 {
> -				reg = <0x8014 0x11>;
> -			};
>  
> -			macaddr_config_8036: macaddr at 8036 {
> -				reg = <0x8036 0x11>;
> +			nvmem-layout {
> +				compatible = "fixed-layout";
> +				#address-cells = <1>;
> +				#size-cells = <1>;
> +
> +				macaddr_config_8014: macaddr at 8014 {
> +					compatible = "mac-base";
> +					reg = <0x8014 0x11>;
> +					#nvmem-cell-cells = <1>;
> +				};
> +
> +				macaddr_config_8036: macaddr at 8036 {
> +					compatible = "mac-base";
> +					reg = <0x8036 0x11>;
> +					#nvmem-cell-cells = <1>;
> +				};
>  			};
>  		};
>  
> @@ -137,8 +145,8 @@
>  };
>  
>  &gmac0 {
> -	nvmem-cells = <&macaddr_config_8014>;
> -	nvmem-cell-names = "mac-address-ascii";
> +	nvmem-cells = <&macaddr_config_8014 0>;
> +	nvmem-cell-names = "mac-address";
>  };
>  
>  &gmac1 {
> @@ -146,8 +154,8 @@
>  	label = "wan";
>  	phy-handle = <&ethphy4>;
>  
> -	nvmem-cells = <&macaddr_config_8036>;
> -	nvmem-cell-names = "mac-address-ascii";
> +	nvmem-cells = <&macaddr_config_8036 0>;
> +	nvmem-cell-names = "mac-address";
>  };
>  
>  &mdio {
> diff --git a/target/linux/ramips/dts/mt7621_tplink_ec330-g5u-v1.dts b/target/linux/ramips/dts/mt7621_tplink_ec330-g5u-v1.dts
> index 6c9cc40701..537b6f70a7 100644
> --- a/target/linux/ramips/dts/mt7621_tplink_ec330-g5u-v1.dts
> +++ b/target/linux/ramips/dts/mt7621_tplink_ec330-g5u-v1.dts
> @@ -230,12 +230,20 @@
>  			read-only;
>  
>  			compatible = "nvmem-cells";
> -			#address-cells = <1>;
> -			#size-cells = <1>;
>  
> -			macaddr_factory_165: macaddr at 165 {
> -				reg = <0x165 0x11>;
> +			nvmem-layout {
> +				compatible = "fixed-layout";
> +				#address-cells = <1>;
> +				#size-cells = <1>;
> +
> +				macaddr_factory_165: macaddr at 165 {
> +					compatible = "mac-base";
> +					reg = <0x165 0x11>;
> +					#nvmem-cell-cells = <1>;
> +				};
>  			};
> +
> +
>  		};
>  
>  		partition at 0_wholeflash {
> @@ -257,8 +265,8 @@
>  		mediatek,mtd-eeprom = <&factory 0x8000>;
>  		ieee80211-freq-limit = <2400000 2500000>;
>  
> -		nvmem-cells = <&macaddr_factory_165>;
> -		nvmem-cell-names = "mac-address-ascii";
> +		nvmem-cells = <&macaddr_factory_165 0>;
> +		nvmem-cell-names = "mac-address";
>  	};
>  };
>  
> @@ -269,15 +277,14 @@
>  		mediatek,mtd-eeprom = <&factory 0x14000>;
>  		ieee80211-freq-limit = <5000000 6000000>;
>  
> -		nvmem-cells = <&macaddr_factory_165>;
> -		nvmem-cell-names = "mac-address-ascii";
> -		mac-address-increment = <(2)>;
> +		nvmem-cells = <&macaddr_factory_165 2>;
> +		nvmem-cell-names = "mac-address";
>  	};
>  };
>  
>  &gmac0 {
> -	nvmem-cells = <&macaddr_factory_165>;
> -	nvmem-cell-names = "mac-address-ascii";
> +	nvmem-cells = <&macaddr_factory_165 0>;
> +	nvmem-cell-names = "mac-address";
>  };
>  
>  &gmac1 {
> @@ -285,9 +292,8 @@
>  	label = "wan";
>  	phy-handle = <&ethphy0>;
>  
> -	nvmem-cells = <&macaddr_factory_165>;
> -	nvmem-cell-names = "mac-address-ascii";
> -	mac-address-increment = <(1)>;
> +	nvmem-cells = <&macaddr_factory_165 1>;
> +	nvmem-cell-names = "mac-address";
>  };
>  
>  &mdio {


[TP-Link EC330-G5u v1 - OK]
Tested-by: Mikhail Zhilkin <csharper2005 at gmail.com>

-- 
Best regards,
Mikhail


From rosenp at gmail.com  Fri Jul 14 13:51:22 2023
From: rosenp at gmail.com (Rosen Penev)
Date: Fri, 14 Jul 2023 13:51:22 -0700
Subject: [PATCH] ath79: increase the rfkill debounce interval for TP-Link
 Archer C7 v2
In-Reply-To: <TYAP286MB0315F6A4041644748C17192ABC34A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>
References: <TYAP286MB0315F6A4041644748C17192ABC34A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>
Message-ID: <CAKxU2N8Y-csseDZPqeURTawWj=qGGUR-+rnym5ZZMpXddRgU+w@mail.gmail.com>

On Fri, Jul 14, 2023 at 8:12?AM Shiji Yang <yangshiji66 at outlook.com> wrote:
>
> From: Shiji Yang <yangshiji66 at qq.com>
>
> Due to circuit issue or silicon defect, sometimes the WiFi switch button
> of the Archer C7 v2 can be accidentally triggered multiple times in one
> second. This will cause WiFi to be unexpectedly shut down and trigger
> 'irq 23: nobody cared'[1] warning. Increasing the key debounce interval
> to 1000 ms can fix this issue. This patch also add the missing rfkill
> key label.
Crazy. I was wondering why 2.4ghz went away. For 5ghz I understand,
ath10k is gartbo, but 2.4ghz I didn't.
>
> [1] Warning Log:
> ```
> [87765.218511] irq 23: nobody cared (try booting with the "irqpoll" option)
> [87765.225331] CPU: 0 PID: 317 Comm: irq/23-keys Not tainted 5.15.118 #0
> ...
> [87765.486246] handlers:
> [87765.488543] [<85257547>] 0x800c29a0 threaded [<5c6328a2>] 0x80ffe0b8 [gpio_button_hotplug at 4cf73d00+0x1a00]
> [87765.498364] Disabling IRQ #23
> ```
>
> Fixes: https://github.com/openwrt/openwrt/issues/13010
> Fixes: https://github.com/openwrt/openwrt/issues/12167
> Fixes: https://github.com/openwrt/openwrt/issues/11191
> Fixes: https://github.com/openwrt/openwrt/issues/7835
>
> Tested-by: Hans Hasert
> Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
> ---
>  target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts b/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts
> index b7ac902003..1b860dbf2d 100644
> --- a/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts
> +++ b/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts
> @@ -13,10 +13,11 @@
>
>  &keys {
>         rfkill {
> +               label = "rfkill";
>                 gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
>                 linux,code = <KEY_RFKILL>;
>                 linux,input-type = <EV_SW>;
> -               debounce-interval = <60>;
> +               debounce-interval = <1000>;
>         };
>  };
>
> --
> 2.30.2
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From tmn505 at gmail.com  Sat Jul 15 12:57:19 2023
From: tmn505 at gmail.com (Tomasz Maciej Nowak)
Date: Sat, 15 Jul 2023 21:57:19 +0200
Subject: [PATCH] sdk: rename README
In-Reply-To: <20230711141005.33529-1-tmn505@terefe.re>
References: <20230711141005.33529-1-tmn505@terefe.re>
Message-ID: <facf153d-4b4c-3855-2319-996bffdf225a@gmail.com>

W dniu 11.07.2023 o?16:09, Tomasz Maciej Nowak pisze:
> From: Tomasz Maciej Nowak <tmn505 at gmail.com>
> 
> 'help' target fails not finding a file, so follow up on a change[2] made
> as a fix for main README[1].
> 
> 1. d0113711a31f ("README: port to 21st century")
> 2. 751486b31fd9 ("build: fix README.md reference after rename")
> 
> Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
> ---
>  target/sdk/files/{README.SDK => README.md} | 0
>  1 file changed, 0 insertions(+), 0 deletions(-)
>  rename target/sdk/files/{README.SDK => README.md} (100%)
> 
> diff --git a/target/sdk/files/README.SDK b/target/sdk/files/README.md
> similarity index 100%
> rename from target/sdk/files/README.SDK
> rename to target/sdk/files/README.md

Sorry for the fallout and thanks for the fix. I had a dirty tree with "sdk: fix
git initialization" commit from https://github.com/openwrt/openwrt/pull/11379
applied which fixes other issue in SDK.

-- 
TMN



From noreply at github.com  Sun Jul 16 13:18:28 2023
From: noreply at github.com (Stephen Walker)
Date: Sun, 16 Jul 2023 13:18:28 -0700
Subject: [sdwalker/sdwalker.github.io] 6485f9: This week's update
Message-ID: <sdwalker/sdwalker.github.io/push/refs/heads/master/ed1ec0-6485f9@github.com>

  Branch: refs/heads/master
  Home:   https://github.com/sdwalker/sdwalker.github.io
  Commit: 6485f912863784630cf20f40e03588de1d37cd1b
      https://github.com/sdwalker/sdwalker.github.io/commit/6485f912863784630cf20f40e03588de1d37cd1b
  Author: Stephen Walker <stephendwalker+github at gmail.com>
  Date:   2023-07-16 (Sun, 16 Jul 2023)

  Changed paths:
    M uscan/index-22.03.html
    M uscan/index-23.05.html
    M uscan/index.html

  Log Message:
  -----------
  This week's update




From zajec5 at gmail.com  Sun Jul 16 23:59:38 2023
From: zajec5 at gmail.com (=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=)
Date: Mon, 17 Jul 2023 08:59:38 +0200
Subject: [PATCH] octeon: use fixed layout cell "mac-base" for Cisco vEdge 1000
Message-ID: <20230717065938.4773-1-zajec5@gmail.com>

From: Rafa? Mi?ecki <rafal at milecki.pl>

This drops a use of downstream "mac-address-increment".

Cc: Christian Svensson <blue at cmd.nu>
Cc: Tommy Nevtelen <tommy at nevtelen.com>
Cc: Viktor Ekmark <viktor at ekmark.se>
Cc: Daniel Wennberg <github at networkninja.se>
Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
I didn't have a chance to try "fixed-layout" with "atmel,24c512". This
is untested.

Can you guys verify if reading MAC still works with this patch, please?
---
 .../cavium-octeon/cn6130_cisco_vedge1000.dts  | 40 +++++++++----------
 1 file changed, 19 insertions(+), 21 deletions(-)

diff --git a/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn6130_cisco_vedge1000.dts b/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn6130_cisco_vedge1000.dts
index e1f308dd52..4680d6ea14 100644
--- a/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn6130_cisco_vedge1000.dts
+++ b/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn6130_cisco_vedge1000.dts
@@ -24,7 +24,7 @@
 			      <0x11800 0xe0002000 0x00 0x08>;
 			cell-index = <0x00>;
 			interrupts = <0x00 0x3e 0x01 0x2e>;
-			nvmem-cells = <&macaddr_eeprom>;
+			nvmem-cells = <&macaddr_eeprom 0>;
 			nvmem-cell-names = "mac-address";
 			phy-handle = <&mgmtphy>;
 		};
@@ -32,25 +32,22 @@
 		pip: pip at 11800a0000000 {
 			interface at 0 {
 				ethernet at 0 {
-					nvmem-cells = <&macaddr_eeprom>;
+					nvmem-cells = <&macaddr_eeprom 3>;
 					nvmem-cell-names = "mac-address";
-					mac-address-increment = <(3)>;
 					label = "lan2";
 					/delete-property/ local-mac-address;
 				};
 
 				ethernet at 1 {
-					nvmem-cells = <&macaddr_eeprom>;
+					nvmem-cells = <&macaddr_eeprom 4>;
 					nvmem-cell-names = "mac-address";
-					mac-address-increment = <(4)>;
 					label = "lan3";
 					/delete-property/ local-mac-address;
 				};
 
 				ethernet at 2 {
-					nvmem-cells = <&macaddr_eeprom>;
+					nvmem-cells = <&macaddr_eeprom 1>;
 					nvmem-cell-names = "mac-address";
-					mac-address-increment = <(1)>;
 					label = "lan0";
 					/delete-property/ local-mac-address;
 				};
@@ -58,9 +55,8 @@
 				ethernet at 3 {
 					compatible = "cavium,octeon-3860-pip-port";
 					reg = <0x3>;
-					nvmem-cells = <&macaddr_eeprom>;
+					nvmem-cells = <&macaddr_eeprom 2>;
 					nvmem-cell-names = "mac-address";
-					mac-address-increment = <(2)>;
 					label = "lan1";
 				};
 			};
@@ -69,36 +65,32 @@
 				ethernet at 0 {
 					compatible = "cavium,octeon-3860-pip-port";
 					reg = <0x0>;
-					nvmem-cells = <&macaddr_eeprom>;
+					nvmem-cells = <&macaddr_eeprom 7>;
 					nvmem-cell-names = "mac-address";
-					mac-address-increment = <(7)>;
 					label = "lan6";
 				};
 
 				ethernet at 1 {
 					compatible = "cavium,octeon-3860-pip-port";
 					reg = <0x1>;
-					nvmem-cells = <&macaddr_eeprom>;
+					nvmem-cells = <&macaddr_eeprom 8>;
 					nvmem-cell-names = "mac-address";
-					mac-address-increment = <(8)>;
 					label = "lan7";
 				};
 
 				ethernet at 2 {
 					compatible = "cavium,octeon-3860-pip-port";
 					reg = <0x2>;
-					nvmem-cells = <&macaddr_eeprom>;
+					nvmem-cells = <&macaddr_eeprom 5>;
 					nvmem-cell-names = "mac-address";
-					mac-address-increment = <(5)>;
 					label = "lan4";
 				};
 
 				ethernet at 3 {
 					compatible = "cavium,octeon-3860-pip-port";
 					reg = <0x3>;
-					nvmem-cells = <&macaddr_eeprom>;
+					nvmem-cells = <&macaddr_eeprom 6>;
 					nvmem-cell-names = "mac-address";
-					mac-address-increment = <(6)>;
 					label = "lan5";
 				};
 			};
@@ -135,11 +127,17 @@
 				compatible = "atmel,24c512";
 				reg = <0x54>;
 				pagesize = <0x80>;
-				#address-cells = <1>;
-				#size-cells = <1>;
 
-				macaddr_eeprom: mac-address at 8 {
-					reg = <0x8 6>;
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					macaddr_eeprom: mac-address at 8 {
+						compatible = "mac-base";
+						reg = <0x8 6>;
+						#nvmem-cell-cells = <1>;
+					};
 				};
 			};
 		};
-- 
2.35.3



From blue at cmd.nu  Tue Jul 18 10:37:49 2023
From: blue at cmd.nu (Christian Svensson)
Date: Tue, 18 Jul 2023 19:37:49 +0200
Subject: [PATCH] octeon: use fixed layout cell "mac-base" for Cisco vEdge 1000
In-Reply-To: <20230717065938.4773-1-zajec5@gmail.com>
References: <20230717065938.4773-1-zajec5@gmail.com>
Message-ID: <CADiuDAQSUeYC0=UD22MJMshVsKskN-x-bS-WKz81o3d2gcbpgw@mail.gmail.com>

On Mon, Jul 17, 2023 at 9:00?AM Rafa? Mi?ecki <zajec5 at gmail.com> wrote:
>
> From: Rafa? Mi?ecki <rafal at milecki.pl>
>
> This drops a use of downstream "mac-address-increment".
>
> Cc: Christian Svensson <blue at cmd.nu>
> Cc: Tommy Nevtelen <tommy at nevtelen.com>
> Cc: Viktor Ekmark <viktor at ekmark.se>
> Cc: Daniel Wennberg <github at networkninja.se>
> Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>

Tested-by: Christian Svensson <blue at cmd.nu>

> ---
> I didn't have a chance to try "fixed-layout" with "atmel,24c512". This
> is untested.
>
> Can you guys verify if reading MAC still works with this patch, please?
> ---
>  .../cavium-octeon/cn6130_cisco_vedge1000.dts  | 40 +++++++++----------
>  1 file changed, 19 insertions(+), 21 deletions(-)
>
> diff --git a/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn6130_cisco_vedge1000.dts b/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn6130_cisco_vedge1000.dts
> index e1f308dd52..4680d6ea14 100644
> --- a/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn6130_cisco_vedge1000.dts
> +++ b/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn6130_cisco_vedge1000.dts
> @@ -24,7 +24,7 @@
>                               <0x11800 0xe0002000 0x00 0x08>;
>                         cell-index = <0x00>;
>                         interrupts = <0x00 0x3e 0x01 0x2e>;
> -                       nvmem-cells = <&macaddr_eeprom>;
> +                       nvmem-cells = <&macaddr_eeprom 0>;
>                         nvmem-cell-names = "mac-address";
>                         phy-handle = <&mgmtphy>;
>                 };
> @@ -32,25 +32,22 @@
>                 pip: pip at 11800a0000000 {
>                         interface at 0 {
>                                 ethernet at 0 {
> -                                       nvmem-cells = <&macaddr_eeprom>;
> +                                       nvmem-cells = <&macaddr_eeprom 3>;
>                                         nvmem-cell-names = "mac-address";
> -                                       mac-address-increment = <(3)>;
>                                         label = "lan2";
>                                         /delete-property/ local-mac-address;
>                                 };
>
>                                 ethernet at 1 {
> -                                       nvmem-cells = <&macaddr_eeprom>;
> +                                       nvmem-cells = <&macaddr_eeprom 4>;
>                                         nvmem-cell-names = "mac-address";
> -                                       mac-address-increment = <(4)>;
>                                         label = "lan3";
>                                         /delete-property/ local-mac-address;
>                                 };
>
>                                 ethernet at 2 {
> -                                       nvmem-cells = <&macaddr_eeprom>;
> +                                       nvmem-cells = <&macaddr_eeprom 1>;
>                                         nvmem-cell-names = "mac-address";
> -                                       mac-address-increment = <(1)>;
>                                         label = "lan0";
>                                         /delete-property/ local-mac-address;
>                                 };
> @@ -58,9 +55,8 @@
>                                 ethernet at 3 {
>                                         compatible = "cavium,octeon-3860-pip-port";
>                                         reg = <0x3>;
> -                                       nvmem-cells = <&macaddr_eeprom>;
> +                                       nvmem-cells = <&macaddr_eeprom 2>;
>                                         nvmem-cell-names = "mac-address";
> -                                       mac-address-increment = <(2)>;
>                                         label = "lan1";
>                                 };
>                         };
> @@ -69,36 +65,32 @@
>                                 ethernet at 0 {
>                                         compatible = "cavium,octeon-3860-pip-port";
>                                         reg = <0x0>;
> -                                       nvmem-cells = <&macaddr_eeprom>;
> +                                       nvmem-cells = <&macaddr_eeprom 7>;
>                                         nvmem-cell-names = "mac-address";
> -                                       mac-address-increment = <(7)>;
>                                         label = "lan6";
>                                 };
>
>                                 ethernet at 1 {
>                                         compatible = "cavium,octeon-3860-pip-port";
>                                         reg = <0x1>;
> -                                       nvmem-cells = <&macaddr_eeprom>;
> +                                       nvmem-cells = <&macaddr_eeprom 8>;
>                                         nvmem-cell-names = "mac-address";
> -                                       mac-address-increment = <(8)>;
>                                         label = "lan7";
>                                 };
>
>                                 ethernet at 2 {
>                                         compatible = "cavium,octeon-3860-pip-port";
>                                         reg = <0x2>;
> -                                       nvmem-cells = <&macaddr_eeprom>;
> +                                       nvmem-cells = <&macaddr_eeprom 5>;
>                                         nvmem-cell-names = "mac-address";
> -                                       mac-address-increment = <(5)>;
>                                         label = "lan4";
>                                 };
>
>                                 ethernet at 3 {
>                                         compatible = "cavium,octeon-3860-pip-port";
>                                         reg = <0x3>;
> -                                       nvmem-cells = <&macaddr_eeprom>;
> +                                       nvmem-cells = <&macaddr_eeprom 6>;
>                                         nvmem-cell-names = "mac-address";
> -                                       mac-address-increment = <(6)>;
>                                         label = "lan5";
>                                 };
>                         };
> @@ -135,11 +127,17 @@
>                                 compatible = "atmel,24c512";
>                                 reg = <0x54>;
>                                 pagesize = <0x80>;
> -                               #address-cells = <1>;
> -                               #size-cells = <1>;
>
> -                               macaddr_eeprom: mac-address at 8 {
> -                                       reg = <0x8 6>;
> +                               nvmem-layout {
> +                                       compatible = "fixed-layout";
> +                                       #address-cells = <1>;
> +                                       #size-cells = <1>;
> +
> +                                       macaddr_eeprom: mac-address at 8 {
> +                                               compatible = "mac-base";
> +                                               reg = <0x8 6>;
> +                                               #nvmem-cell-cells = <1>;
> +                                       };
>                                 };
>                         };
>                 };
> --
> 2.35.3
>


From newtwen at gmail.com  Tue Jul 18 07:56:17 2023
From: newtwen at gmail.com (Paul D)
Date: Tue, 18 Jul 2023 15:56:17 +0100
Subject: [PATCH] ath79: increase the rfkill debounce interval for TP-Link
 Archer C7 v2
In-Reply-To: <CAKxU2N8Y-csseDZPqeURTawWj=qGGUR-+rnym5ZZMpXddRgU+w@mail.gmail.com>
References: <TYAP286MB0315F6A4041644748C17192ABC34A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>
 <CAKxU2N8Y-csseDZPqeURTawWj=qGGUR-+rnym5ZZMpXddRgU+w@mail.gmail.com>
Message-ID: <b9bca5ee-cdc6-29b0-3d44-6b9118a957aa@gmail.com>

Please review/merge


On 2023-07-14 21:51, Rosen Penev wrote:
> On Fri, Jul 14, 2023 at 8:12?AM Shiji Yang <yangshiji66 at outlook.com> wrote:
>>
>> From: Shiji Yang <yangshiji66 at qq.com>
>>
>> Due to circuit issue or silicon defect, sometimes the WiFi switch button
>> of the Archer C7 v2 can be accidentally triggered multiple times in one
>> second. This will cause WiFi to be unexpectedly shut down and trigger
>> 'irq 23: nobody cared'[1] warning. Increasing the key debounce interval
>> to 1000 ms can fix this issue. This patch also add the missing rfkill
>> key label.
> Crazy. I was wondering why 2.4ghz went away. For 5ghz I understand,
> ath10k is gartbo, but 2.4ghz I didn't.
>>
>> [1] Warning Log:
>> ```
>> [87765.218511] irq 23: nobody cared (try booting with the "irqpoll" option)
>> [87765.225331] CPU: 0 PID: 317 Comm: irq/23-keys Not tainted 5.15.118 #0
>> ...
>> [87765.486246] handlers:
>> [87765.488543] [<85257547>] 0x800c29a0 threaded [<5c6328a2>] 0x80ffe0b8 [gpio_button_hotplug at 4cf73d00+0x1a00]
>> [87765.498364] Disabling IRQ #23
>> ```
>>
>> Fixes: https://github.com/openwrt/openwrt/issues/13010
>> Fixes: https://github.com/openwrt/openwrt/issues/12167
>> Fixes: https://github.com/openwrt/openwrt/issues/11191
>> Fixes: https://github.com/openwrt/openwrt/issues/7835
>>
>> Tested-by: Hans Hasert
>> Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
>> ---
>>   target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts b/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts
>> index b7ac902003..1b860dbf2d 100644
>> --- a/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts
>> +++ b/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts
>> @@ -13,10 +13,11 @@
>>
>>   &keys {
>>          rfkill {
>> +               label = "rfkill";
>>                  gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
>>                  linux,code = <KEY_RFKILL>;
>>                  linux,input-type = <EV_SW>;
>> -               debounce-interval = <60>;
>> +               debounce-interval = <1000>;
>>          };
>>   };
>>
>> --
>> 2.30.2
>>
>>
>> _______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel at lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel



From bb at npl.de  Tue Jul 18 02:28:02 2023
From: bb at npl.de (Bastian Bittorf)
Date: Tue, 18 Jul 2023 09:28:02 +0000
Subject: Best practice for resetting (iptables) firewall state
In-Reply-To: <4CA5F7F4-D47E-4807-978A-EA74AE124683@redfish-solutions.com>
References: <4CA5F7F4-D47E-4807-978A-EA74AE124683@redfish-solutions.com>
Message-ID: <20230718092802.oqmfojw4habekjma@email>

On Tue, Jul 11, 2023 at 11:25:55PM -0600, Philip Prindeville wrote:
> I'm working on a wrapper for using xt_asn and xt_geoip in xtables-addons, and was wondering about how best to solve certain problems.
> 

maybe the mechanism for stop/start/update used here is useful:
https://github.com/bittorf/block-TOR-nodes/blob/master/tornodes_block.sh


From jeffery.to at gmail.com  Mon Jul 17 23:36:52 2023
From: jeffery.to at gmail.com (Jeffery To)
Date: Tue, 18 Jul 2023 14:36:52 +0800
Subject: mips: Make mips64 n32/o32 userland possible or remove support completely
Message-ID: <CAJXyS=hWj8OdRUv1W-AcpOFFS7Yz1MFobbs9Qz=1r+s2VSU5iQ@mail.gmail.com>

Hi,

I've been looking into platform triplets for Python and figuring out
the possible combinations. This has led me to trying to compile images
of the possible combinations for testing.

As a result, I've been trying to compile malta/be64 with n32/o32
userland. I haven't been successful so far but before trying to fix
all the issues, I wanted to take a step back and ask a more general
question.

I see there is the option to select mips64 ABI in toolchain/Config.in.
On the other hand, there are commits like 46af22de16b2 ("kernel:
Remove CONFIG_COMPAT") and 38666e8ae42d ("malta: Deactivate MIPS O32
and N32 support") (and also the recent discussion with amd64 x32
support).

Is there a preference to make n32/o32 userland optional/possible, and
so I should continue trying to get it to work? Or is the preference to
remove support completely, so I should submit patches to do so?

Thanks,
Jeff


From fe at dev.tdt.de  Wed Jul 19 02:54:25 2023
From: fe at dev.tdt.de (Florian Eckert)
Date: Wed, 19 Jul 2023 11:54:25 +0200
Subject: [PATCH] .gitignore: ignore link if target is included from feed
Message-ID: <20230719095425.18203-1-fe@dev.tdt.de>

If an out of tree target is included via a feed, then there is a link with
the name 'feed' in the target directory. Do not show this link in git.

Signed-off-by: Florian Eckert <fe at dev.tdt.de>
---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index a80cdbbea3..84cfc99770 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,6 +14,7 @@
 /feeds
 /feeds.conf
 /files
+/target/linux/feeds
 /overlay
 /package/feeds
 /package/openwrt-packages
-- 
2.30.2



From fe at dev.tdt.de  Wed Jul 19 04:20:14 2023
From: fe at dev.tdt.de (Florian Eckert)
Date: Wed, 19 Jul 2023 13:20:14 +0200
Subject: [PATCH] system-notification: initial checkin
Message-ID: <20230719112014.28110-1-fe@dev.tdt.de>

This package provides a ubus backend that can be used to save system
notification. The notifications are not persistent. They are lost after
every reboot.

The following ubus methods are available:

add:
The <add> command adds a notification to the ubus backend.
ubus call system.notification add '{"title":"<string>","description":"<description>"}'
In addition, the following json string could be optional set.
* url: {"url": "<string>"} Additional information are available at this extrenal URL.
* opkg: {"package": "<string>"} Package can be updated.

remove:
The <remove> command removes a notification from the ubus backend.
ubus call system.notification remove '{"uuid": "<string>"}'

list:
The <list> command dumps all staged notification from the ubus backend.
ubus call system.notification list

flush:
The <flush> command removes all stage notification from the ubus backend.
ubus call system.notification flush

Signed-off-by: Florian Eckert <fe at dev.tdt.de>
---
 package/utils/system-notification/Makefile    |  81 +++++++
 .../files/usr/bin/system-notification         | 105 +++++++++
 .../usr/libexec/rpcd/system.notification      | 220 ++++++++++++++++++
 3 files changed, 406 insertions(+)
 create mode 100644 package/utils/system-notification/Makefile
 create mode 100644 package/utils/system-notification/files/usr/bin/system-notification
 create mode 100644 package/utils/system-notification/files/usr/libexec/rpcd/system.notification

diff --git a/package/utils/system-notification/Makefile b/package/utils/system-notification/Makefile
new file mode 100644
index 0000000000..8dcbc190e6
--- /dev/null
+++ b/package/utils/system-notification/Makefile
@@ -0,0 +1,81 @@
+#
+# Copyright (C) 2021 TDT AG <development at tdt.de>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See https://www.gnu.org/licenses/gpl-2.0.txt for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=system-notification
+PKG_VERSION:=0.1
+PKG_RELEASE:=1
+
+PKG_MAINTAINER:=Florian Eckert <fe at dev.tdt.de>
+PKG_LICENSE:=GPL-2.0
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/system-notification
+  SECTION:=base
+  CATEGORY:=Base system
+  TITLE:=System notification
+endef
+
+define Package/system-notification/description
+  This package provides a ubus backend that can be used to save system
+  notification. The notifications are not persistent. They are lost after
+  every reboot.
+
+  The following ubus methods are available:
+
+  add:
+  The <add> command adds a notification to the ubus backend.
+  ubus call system.notification add '{"title":"<string>","description":"<description>"}'
+  In addition, the following json string could be optional set.
+  * url: {"url": "<string>"} Additional information are available at this extrenal URL.
+  * opkg: {"package": "<string>"} Package can be updated.
+
+  remove:
+  The <remove> command removes a notification from the ubus backend.
+  ubus call system.notification remove '{"uuid": "<string>"}'
+
+  list:
+  The <list> command dumps all staged notification from the ubus backend.
+  ubus call system.notification list
+
+  flush:
+  The <flush> command removes all stage notification from the ubus backend.
+  ubus call system.notification flush
+endef
+
+define Build/Compile
+endef
+
+define Package/system-notification/postinst
+#!/bin/sh
+if [ -z "$${IPKG_INSTROOT}" ] && [ -x /etc/init.d/rpcd ]; then
+	/etc/init.d/rpcd restart
+fi
+exit 0
+endef
+
+define Package/system-notification/postrm
+#!/bin/sh
+if [ -z "$${IPKG_INSTROOT}" ] && [ -x /etc/init.d/rpcd ]; then
+	/etc/init.d/rpcd restart
+fi
+exit 0
+endef
+
+define Package/system-notification/install
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) ./files/usr/bin/system-notification \
+		$(1)/usr/bin/system-notification
+
+	$(INSTALL_DIR) $(1)/usr/libexec/rpcd
+	$(INSTALL_BIN) ./files/usr/libexec/rpcd/system.notification \
+		$(1)/usr/libexec/rpcd/
+endef
+
+$(eval $(call BuildPackage,system-notification))
diff --git a/package/utils/system-notification/files/usr/bin/system-notification b/package/utils/system-notification/files/usr/bin/system-notification
new file mode 100644
index 0000000000..7a60985eaf
--- /dev/null
+++ b/package/utils/system-notification/files/usr/bin/system-notification
@@ -0,0 +1,105 @@
+#!/bin/sh
+# Copyright (C) 2021 TDT AG <development at tdt.de>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See https://www.gnu.org/licenses/gpl-2.0.txt for more information.
+#
+
+. /usr/share/libubox/jshn.sh
+
+remove() {
+	local uuid="$1"
+
+	json_init
+	json_add_string "uuid" "$uuid"
+	ubus call system.notification remove "$(json_dump)"
+	json_cleanup
+}
+
+list() {
+	local title description uuid timestamp
+
+	json_init
+	json_load "$(ubus call system.notification list)"
+	json_select "messages" 1>/dev/null 2>&1
+	[ $? -eq 0 ] || {
+		echo "No notifications are available"
+		return
+	}
+
+	json_get_keys notifications
+	for notification in $notifications; do
+		json_select "$notification"
+		json_get_vars title description uuid timestamp
+
+		echo "$title"
+		echo ""
+		echo "$description"
+
+		json_select "actions" 1>/dev/null 2>&1
+		if [ $? -eq 0 ]; then
+			json_get_keys actions
+			for action in $actions; do
+				json_select "$action"
+				local action
+				json_get_var entry action
+				[ "$entry" = "link" ] && {
+					local url
+					json_get_var url url
+					echo "- Check $url for more information"
+				}
+
+				[ "$entry" = "opkg" ] && {
+					local package
+					json_get_var package package
+					echo "- To upgrade, execute \"opkg upgrade $package\""
+				}
+				json_select ..
+			done
+			json_select ..
+		fi
+
+		local dstring
+		echo ""
+		dstring="$(date +"%Y-%m-%d %H:%M:%S" -d "@${timestamp}")"
+		echo "date: $dstring"
+		echo "uuid: $uuid"
+		echo "---"
+		json_select ..
+	done
+	json_select ..
+}
+
+usage() {
+	local msg="$1"
+
+	if [ -n "$msg" ]; then
+		echo "$msg"
+		echo ""
+	fi
+
+	echo "Usage: $(basename "$0") <command>"
+	echo ""
+	echo "commmand:"
+	echo ""
+	echo "remove <uuid>: Remove notification"
+	echo "list         : Show notification"
+}
+
+main() {
+	cmd="$1"
+	uuid="$2"
+
+	case "$cmd" in
+		remove)
+			remove "$uuid"
+			;;
+		list)
+			list
+			;;
+		*)
+			usage "Command not supported"
+	esac
+}
+
+main "$@"
diff --git a/package/utils/system-notification/files/usr/libexec/rpcd/system.notification b/package/utils/system-notification/files/usr/libexec/rpcd/system.notification
new file mode 100644
index 0000000000..aa32b967a1
--- /dev/null
+++ b/package/utils/system-notification/files/usr/libexec/rpcd/system.notification
@@ -0,0 +1,220 @@
+#!/bin/sh
+#
+# Copyright (C) 2021 TDT AG <development at tdt.de>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See https://www.gnu.org/licenses/gpl-2.0.txt for more information.
+#
+
+. /usr/share/libubox/jshn.sh
+
+MESSAGE_DIR="/tmp/notification/messages.d"
+MESSAGE_MAX=20
+
+get_uuid() {
+	local file="$1"
+	local uuid
+
+	uuid="${file##*/}"
+
+	echo "${uuid%*.json}"
+}
+
+gen_uuid() {
+	cat /proc/sys/kernel/random/uuid
+}
+
+list() {
+	json_init
+
+	json_add_object "add"
+	json_add_string "title"
+	json_add_string "description"
+	json_add_string "url"
+	json_add_string "package"
+	json_close_object
+
+	json_add_object "remove"
+	json_add_string "uuid"
+	json_close_object
+
+	json_add_object "list"
+	json_close_object
+
+	json_add_object "flush"
+	json_close_object
+
+	json_dump
+}
+
+notification_add() {
+	local title="$1"
+	local description="$2"
+	local url="$3"
+	local package="$4"
+
+	local timestamp uuid
+
+	local code=-1
+	local msg="Unable to add notification"
+
+	timestamp="$(date +%s)"
+
+	uuid="$(gen_uuid)"
+	if [ -z "$uuid" ]; then
+		json_init
+		json_add_int "code" "-2"
+		json_add_string "message" "Unable to get uuid"
+		json_dump
+		return
+	fi
+
+	json_init
+	json_add_string title "$title"
+	json_add_string description "$description"
+	json_add_int timestamp "$timestamp"
+	[ -z "$url" ] || json_add_string "url" "$url"
+	[ -z "$package" ] || json_add_string "package" "$package"
+	json_dump > "${MESSAGE_DIR}/${uuid}.json"
+
+	if [ -f "${MESSAGE_DIR}/${uuid}.json" ]; then
+		code=0
+		msg="Notification added"
+	fi
+
+	local count=0
+	for file in "${MESSAGE_DIR}"/*.json; do
+		count=$((count + 1))
+		if [ "$count" -gt "$MESSAGE_MAX" ]; then
+			rm "${MESSAGE_DIR}/${file}"
+		fi
+	done
+
+	json_init
+	json_add_int "code" "$code"
+	json_add_string "message" "$msg"
+	json_dump
+}
+
+notification_remove() {
+	local uuid="$1"
+
+	local code=-1
+	local msg="Notification not found"
+
+
+	if [ -f "${MESSAGE_DIR}/${uuid}.json" ]; then
+		rm "${MESSAGE_DIR}/${uuid}.json"
+		code=0
+		msg="Notication removed"
+	fi
+
+	json_init
+	json_add_int "code" "$code"
+	json_add_string "message" "$msg"
+	json_dump
+}
+
+notification_list() {
+	local uuid title description timestamp url package
+
+	json_init
+	if [ -n "$(ls -A "$MESSAGE_DIR")" ]; then
+		json_add_array "messages"
+		for entry in "${MESSAGE_DIR}"/*.json; do
+			uuid="$(get_uuid "$entry")"
+
+			json_set_namespace dump old_cb
+			json_load_file "$entry"
+			json_get_vars title description timestamp url package
+			json_cleanup
+			json_set_namespace "$old_cb"
+
+			json_add_object ""
+			json_add_string uuid "$uuid"
+			json_add_string title "$title"
+			json_add_string description "$description"
+			json_add_int timestamp "$timestamp"
+			json_add_array actions
+			json_add_object
+			json_add_string action dismiss
+			json_close_object
+			[ -z "$url" ] || {
+				json_add_object
+				json_add_string action link
+				json_add_string url "$url"
+				json_close_object
+			}
+			[ -z "$package" ] || {
+				json_add_object
+				json_add_string action opkg
+				json_add_string package "$package"
+				json_close_object
+			}
+			json_close_array
+			json_close_object
+		done
+		json_close_array
+	fi
+	json_dump
+}
+
+notification_flush() {
+	local code=0
+	local msg="All notifications flushed"
+
+	rm "$MESSAGE_DIR"/*.json
+
+	json_init
+	json_add_int "code" "$code"
+	json_add_string "message" "$msg"
+	json_dump
+}
+
+call() {
+	local method="$1"
+
+	local title description url package uuid
+
+	case "$method" in
+		add)
+			read -r input;
+			json_load "${input}"
+			json_get_var title title
+			json_get_var description description
+			json_get_var url url
+			json_get_var package package
+			notification_add "$title" "$description" "$url" "$package"
+		;;
+		remove)
+			read -r input;
+			json_load "${input}"
+			json_get_var uuid uuid
+			notification_remove "$uuid"
+		;;
+		list)
+			notification_list
+		;;
+		flush)
+			notification_flush
+		;;
+	esac
+}
+
+main() {
+	local path="$1"
+	local method="$2"
+
+	mkdir -p "${MESSAGE_DIR}"
+
+	case "$path" in
+		list)
+			list
+		;;
+		call)
+			call "$method"
+		;;
+	esac
+}
+
+main "$@"
-- 
2.30.2



From mrkiko.rs at gmail.com  Thu Jul 20 00:03:45 2023
From: mrkiko.rs at gmail.com (Enrico Mioso)
Date: Thu, 20 Jul 2023 09:03:45 +0200
Subject: [PATCH] system-notification: initial checkin
In-Reply-To: <20230719112014.28110-1-fe@dev.tdt.de>
References: <20230719112014.28110-1-fe@dev.tdt.de>
Message-ID: <ZLjcUTzzvy0mlIlb@rivendell>

Hi!

I think the idea can be nice, however I would like to make sure that thismechanism can be ignored by an admin with no consequences.
Is this the case? In other words - if I store 20 messages with maximum allowed amount of text in all strings, how much data am I storing?

Furthermore, I suggest calling both the rpcd plugin and the user-facing script with the same name.
And - di I miss it or you can not actually create a notification from the user-facing script? Why not implement that as well?
And I didn't look for flushing capability but I would like that as well.

Thanks!

Enrico


From zajec5 at gmail.com  Thu Jul 20 02:12:17 2023
From: zajec5 at gmail.com (=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=)
Date: Thu, 20 Jul 2023 11:12:17 +0200
Subject: [PATCH urngd] jitterentropy-rngd: update to the v1.2.0
Message-ID: <20230720091217.10574-1-zajec5@gmail.com>

From: Rafa? Mi?ecki <rafal at milecki.pl>

74104b2 update copyright date
1b5f34b integrate library v3.0.0
8a43ce4 Fix permissions set by systemd unit file
f995407 force the kernel to reseed the ChaCha20 DRNG
4104015 force reseed after 10 minutes
9d61de7 jitterentropy-rngd.1: spelling
739bcba Add Dockerfile and docker-compose.yaml for easy deployment.
cc8c38c Harden systemd service

Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
 3rdparty/jitterentropy-rngd | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/3rdparty/jitterentropy-rngd b/3rdparty/jitterentropy-rngd
index cb13a8b..74104b2 160000
--- a/3rdparty/jitterentropy-rngd
+++ b/3rdparty/jitterentropy-rngd
@@ -1 +1 @@
-Subproject commit cb13a8b136afe9e1ea1424e9e3fb50c87a6be729
+Subproject commit 74104b218442d9b9049249e6d1b132db564b77da
-- 
2.35.3



From ynezz at true.cz  Thu Jul 20 07:02:50 2023
From: ynezz at true.cz (=?UTF-8?q?Petr=20=C5=A0tetiar?=)
Date: Thu, 20 Jul 2023 16:02:50 +0200
Subject: [PATCH 2/2] toolchain: kernel-headers: remove debugging env dump
In-Reply-To: <20230720140250.1067301-1-ynezz@true.cz>
References: <20230720140250.1067301-1-ynezz@true.cz>
Message-ID: <20230720140250.1067301-2-ynezz@true.cz>

Remove debugging `env` dump left over as build environments might
contain some sensitive information, which then might leak into the build
logs.

Fixes: 2105acbe2804 ("kernel-headers: fix compile error caused by wrong host include path when the toolchain is already built")
Signed-off-by: Petr ?tetiar <ynezz at true.cz>
---
 toolchain/kernel-headers/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/toolchain/kernel-headers/Makefile b/toolchain/kernel-headers/Makefile
index 5e3e459a96f5..8e3324816bfa 100644
--- a/toolchain/kernel-headers/Makefile
+++ b/toolchain/kernel-headers/Makefile
@@ -93,7 +93,6 @@ define Host/Prepare
 endef
 
 define Host/Configure
-	env
 	yes '' | $(HOST_KMAKE) oldconfig
 	$(call Host/Configure/all)
 	$(call Host/Configure/post/$(ARCH))


From ynezz at true.cz  Thu Jul 20 07:02:49 2023
From: ynezz at true.cz (=?UTF-8?q?Petr=20=C5=A0tetiar?=)
Date: Thu, 20 Jul 2023 16:02:49 +0200
Subject: [PATCH 1/2] toolchain: kernel-headers: fix check target for external Git trees
Message-ID: <20230720140250.1067301-1-ynezz@true.cz>

Executing following command currently fails:

 $ make toolchain/kernel-headers/{download,check} V=sc FIXUP=1
 ...
 include/kernel-version.mk:11: *** Missing kernel version/hash file for . Please create include/kernel-.  Stop.

So lets fix it by adding the necessary missing KERNEL_PATCHVER variable.

That additional kernel-build.mk include is needed to add another set of
missing variables:

 $ make toolchain/kernel-headers/{download,check} V=sc FIXUP=1
 ...
 Makefile:115: *** ERROR: Unknown pack format for file tmp/dl/.  Stop.

Fixes: 0765466a42f4 ("kernel: split kernel version to dedicated files")
Signed-off-by: Petr ?tetiar <ynezz at true.cz>
---
 toolchain/kernel-headers/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/toolchain/kernel-headers/Makefile b/toolchain/kernel-headers/Makefile
index c1a8710a4fbe..5e3e459a96f5 100644
--- a/toolchain/kernel-headers/Makefile
+++ b/toolchain/kernel-headers/Makefile
@@ -23,7 +23,10 @@ ifneq ($(call qstrip,$(CONFIG_KERNEL_GIT_CLONE_URI)),)
   PKG_SOURCE_VERSION:=$(call qstrip,$(CONFIG_KERNEL_GIT_REF))
   PKG_MIRROR_HASH:=$(call qstrip,$(CONFIG_KERNEL_GIT_MIRROR_HASH))
 ifdef CHECK
+  PLATFORM_DIR:=$(firstword $(wildcard $(TOPDIR)/target/linux/feeds/$(BOARD) $(TOPDIR)/target/linux/$(BOARD)))
+  include $(PLATFORM_DIR)/Makefile
   include $(INCLUDE_DIR)/kernel-version.mk
+  include $(INCLUDE_DIR)/kernel-build.mk
   PKG_VERSION:=$(LINUX_VERSION)
 else
   PKG_SOURCE:=$(LINUX_SOURCE)


From sebastian_ml at gmx.net  Thu Jul 20 13:54:33 2023
From: sebastian_ml at gmx.net (Sebastian Kemper)
Date: Thu, 20 Jul 2023 20:54:33 +0000
Subject: 22.03 packages not building since 10 days
Message-ID: <50BE028B-4BCE-4E80-9F46-188642B41E78@gmx.net>

Hi all,

Can a kind soul please check the build bots for 22.03 packages? We pushed some security fixes about a week ago for pjsip and were hoping they'd be packaged by now.

Thanks!
Seb


From rosenp at gmail.com  Thu Jul 20 18:41:46 2023
From: rosenp at gmail.com (Rosen Penev)
Date: Thu, 20 Jul 2023 18:41:46 -0700
Subject: mips: Make mips64 n32/o32 userland possible or remove support completely
In-Reply-To: <CAJXyS=hWj8OdRUv1W-AcpOFFS7Yz1MFobbs9Qz=1r+s2VSU5iQ@mail.gmail.com>
References: <CAJXyS=hWj8OdRUv1W-AcpOFFS7Yz1MFobbs9Qz=1r+s2VSU5iQ@mail.gmail.com>
Message-ID: <CAKxU2N-bS3AMZO1L-dOO4Nm44U7wytA1VvSMj3+h-iRoYEr7gQ@mail.gmail.com>

On Wed, Jul 19, 2023 at 1:29?AM Jeffery To <jeffery.to at gmail.com> wrote:
>
> Hi,
>
> I've been looking into platform triplets for Python and figuring out
> the possible combinations. This has led me to trying to compile images
> of the possible combinations for testing.
>
> As a result, I've been trying to compile malta/be64 with n32/o32
> userland. I haven't been successful so far but before trying to fix
> all the issues, I wanted to take a step back and ask a more general
> question.
>
> I see there is the option to select mips64 ABI in toolchain/Config.in.
> On the other hand, there are commits like 46af22de16b2 ("kernel:
> Remove CONFIG_COMPAT") and 38666e8ae42d ("malta: Deactivate MIPS O32
> and N32 support") (and also the recent discussion with amd64 x32
> support).
>
> Is there a preference to make n32/o32 userland optional/possible, and
> so I should continue trying to get it to work? Or is the preference to
> remove support completely, so I should submit patches to do so?
I think remove support.

Ideally some of these mips platforms should use a more common set of
binaries, but there seems to be no one trying that.
>
> Thanks,
> Jeff
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From zajec5 at gmail.com  Thu Jul 20 22:34:25 2023
From: zajec5 at gmail.com (=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=)
Date: Fri, 21 Jul 2023 07:34:25 +0200
Subject: [PATCH RESEND] ath79: replace "mac-address-ascii" with "mac-base"
Message-ID: <20230721053425.825-1-zajec5@gmail.com>

From: Rafa? Mi?ecki <rafal at milecki.pl>

With upstream accepted "mac-base" binding there is no need for a
downstream "mac-address-ascii" workaround anymore.

Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
RESEND: I originally CC-ed 13 people and ML stopped my e-mail
---
 .../ath79/dts/ar7161_dlink_dir-825-b1.dts     | 57 +++++++++++--------
 .../linux/ath79/dts/ar9331_hiwifi_hc6361.dts  | 37 ++++++------
 .../linux/ath79/dts/ar9342_zyxel_nwa11xx.dtsi | 28 +++++----
 .../linux/ath79/dts/ar9344_dlink_dir-8x5.dtsi | 42 ++++++++------
 .../ath79/dts/qca9558_dlink_dir-629-a1.dts    | 32 +++++++----
 .../ath79/dts/qca9563_dlink_dir-8x9-a1.dtsi   | 31 ++++++----
 6 files changed, 134 insertions(+), 93 deletions(-)

diff --git a/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts b/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts
index 0e39be7d0b..bdb678298d 100644
--- a/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts
+++ b/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts
@@ -139,8 +139,8 @@
 	ath9k0: wifi at 0,11 {
 		compatible = "pci168c,0029";
 		reg = <0x8800 0 0 0 0>;
-		nvmem-cells = <&macaddr_lan>, <&cal_art_1000>;
-		nvmem-cell-names = "mac-address-ascii", "calibration";
+		nvmem-cells = <&macaddr_lan 0>, <&cal_art_1000>;
+		nvmem-cell-names = "mac-address", "calibration";
 		#gpio-cells = <2>;
 		gpio-controller;
 	};
@@ -148,9 +148,8 @@
 	ath9k1: wifi at 0,12 {
 		compatible = "pci168c,0029";
 		reg = <0x9000 0 0 0 0>;
-		nvmem-cells = <&macaddr_wan>, <&cal_art_5000>;
-		nvmem-cell-names = "mac-address-ascii", "calibration";
-		mac-address-increment = <1>;
+		nvmem-cells = <&macaddr_wan 1>, <&cal_art_5000>;
+		nvmem-cell-names = "mac-address", "calibration";
 		#gpio-cells = <2>;
 		gpio-controller;
 	};
@@ -191,23 +190,31 @@
 				label = "caldata";
 				reg = <0x660000 0x010000>;
 				read-only;
-				#address-cells = <1>;
-				#size-cells = <1>;
 
-				cal_art_1000: cal at 1000 {
-					reg = <0x1000 0xeb8>;
-				};
-
-				cal_art_5000: cal at 5000 {
-					reg = <0x5000 0xeb8>;
-				};
-
-				macaddr_lan: macaddr at ffa0 {
-					reg = <0xffa0 0x11>;
-				};
-
-				macaddr_wan: macaddr at ffb4 {
-					reg = <0xffb4 0x11>;
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					cal_art_1000: cal at 1000 {
+						reg = <0x1000 0xeb8>;
+					};
+
+					cal_art_5000: cal at 5000 {
+						reg = <0x5000 0xeb8>;
+					};
+
+					macaddr_lan: macaddr at ffa0 {
+						compatible = "mac-base";
+						reg = <0xffa0 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
+
+					macaddr_wan: macaddr at ffb4 {
+						compatible = "mac-base";
+						reg = <0xffb4 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
 				};
 			};
 
@@ -224,8 +231,8 @@
 
 	pll-data = <0x11110000 0x00001099 0x00991099>;
 
-	nvmem-cells = <&macaddr_lan>;
-	nvmem-cell-names = "mac-address-ascii";
+	nvmem-cells = <&macaddr_lan 0>;
+	nvmem-cell-names = "mac-address";
 
 	fixed-link {
 		speed = <1000>;
@@ -238,8 +245,8 @@
 
 	pll-data = <0x11110000 0x00001099 0x00991099>;
 
-	nvmem-cells = <&macaddr_wan>;
-	nvmem-cell-names = "mac-address-ascii";
+	nvmem-cells = <&macaddr_wan 0>;
+	nvmem-cell-names = "mac-address";
 
 	phy-handle = <&phy4>;
 };
diff --git a/target/linux/ath79/dts/ar9331_hiwifi_hc6361.dts b/target/linux/ath79/dts/ar9331_hiwifi_hc6361.dts
index 05d3f6730e..fa000ab90c 100644
--- a/target/linux/ath79/dts/ar9331_hiwifi_hc6361.dts
+++ b/target/linux/ath79/dts/ar9331_hiwifi_hc6361.dts
@@ -77,9 +77,22 @@
 			};
 
 			bdinfo: partition at 10000 {
+				compatible = "nvmem-cells";
 				reg = <0x10000 0x10000>;
 				label = "bdinfo";
 				read-only;
+
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					macaddr_bdinfo_18a: macaddr at 18a {
+						compatible = "mac-base";
+						reg = <0x18a 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
+				};
 			};
 
 			firmware: partition at 20000 {
@@ -124,33 +137,21 @@
 &eth0 {
 	status = "okay";
 
-	nvmem-cells = <&macaddr_bdinfo_18a>;
-	nvmem-cell-names = "mac-address-ascii";
-	mac-address-increment = <1>;
+	nvmem-cells = <&macaddr_bdinfo_18a 1>;
+	nvmem-cell-names = "mac-address";
 };
 
 &eth1 {
 	status = "okay";
 
-	nvmem-cells = <&macaddr_bdinfo_18a>;
-	nvmem-cell-names = "mac-address-ascii";
+	nvmem-cells = <&macaddr_bdinfo_18a 0>;
+	nvmem-cell-names = "mac-address";
 };
 
 &wmac {
 	status = "okay";
 	mtd-cal-data = <&art 0x1000>;
 
-	nvmem-cells = <&macaddr_bdinfo_18a>;
-	nvmem-cell-names = "mac-address-ascii";
-	mac-address-increment = <2>;
-};
-
-&bdinfo {
-	compatible = "nvmem-cells";
-	#address-cells = <1>;
-	#size-cells = <1>;
-
-	macaddr_bdinfo_18a: macaddr at 18a {
-		reg = <0x18a 0x11>;
-	};
+	nvmem-cells = <&macaddr_bdinfo_18a 2>;
+	nvmem-cell-names = "mac-address";
 };
diff --git a/target/linux/ath79/dts/ar9342_zyxel_nwa11xx.dtsi b/target/linux/ath79/dts/ar9342_zyxel_nwa11xx.dtsi
index 7cc1bba3fc..a05cc2e263 100644
--- a/target/linux/ath79/dts/ar9342_zyxel_nwa11xx.dtsi
+++ b/target/linux/ath79/dts/ar9342_zyxel_nwa11xx.dtsi
@@ -93,15 +93,23 @@
 				read-only;
 
 				compatible = "nvmem-cells";
-				#address-cells = <1>;
-				#size-cells = <1>;
-
-				macaddr_mib0_4b: macaddr at 4b {
-					reg = <0x4b 0x11>;
-				};
 
-				macaddr_mib0_66: macaddr at 66 {
-					reg = <0x66 0x11>;
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					macaddr_mib0_4b: macaddr at 4b {
+						compatible = "mac-base";
+						reg = <0x4b 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
+
+					macaddr_mib0_66: macaddr at 66 {
+						compatible = "mac-base";
+						reg = <0x66 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
 				};
 			};
 
@@ -161,6 +169,6 @@
 
 	ieee80211-freq-limit = <2402000 2482000>;
 
-	nvmem-cells = <&macaddr_mib0_4b>, <&calibration_ath9k>;
-	nvmem-cell-names = "mac-address-ascii", "calibration";
+	nvmem-cells = <&macaddr_mib0_4b 0>, <&calibration_ath9k>;
+	nvmem-cell-names = "mac-address", "calibration";
 };
diff --git a/target/linux/ath79/dts/ar9344_dlink_dir-8x5.dtsi b/target/linux/ath79/dts/ar9344_dlink_dir-8x5.dtsi
index 8e21b0dd9e..8db1bf5e0c 100644
--- a/target/linux/ath79/dts/ar9344_dlink_dir-8x5.dtsi
+++ b/target/linux/ath79/dts/ar9344_dlink_dir-8x5.dtsi
@@ -29,8 +29,8 @@
 	/* default for ar934x, except for 1000M */
 	pll-data = <0x06000000 0x00000101 0x00001616>;
 
-	nvmem-cells = <&macaddr_lan>;
-	nvmem-cell-names = "mac-address-ascii";
+	nvmem-cells = <&macaddr_lan 0>;
+	nvmem-cell-names = "mac-address";
 
 	phy-mode = "rgmii";
 	phy-handle = <&phy0>;
@@ -58,13 +58,13 @@
 	ath9k: wifi at 0,0 {
 		compatible = "pci168c,0030";
 		reg = <0x0000 0 0 0 0>;
-		/* "mac-address-ascii" currently does not work for
+		/* "mac-address" currently does not work for
 		   ath9k pci devices. these below are retained for future
 		   improvements. */
-		/* nvmem-cells = <&macaddr_wan>, <&cal_art_5000>;
-		   nvmem-cell-names = "mac-address-ascii", "calibration";
-		   mac-address-increment = <1>; */
-		qca,no-eeprom; /* remove this when "mac-address-ascii" works  */
+		/* nvmem-cells = <&macaddr_wan 1>, <&cal_art_5000>;
+		   nvmem-cell-names = "mac-address", "calibration";
+		 */
+		qca,no-eeprom; /* remove this when "mac-address" works  */
 		gpio-controller;
 		#gpio-cells = <2>;
 	};
@@ -117,15 +117,23 @@
 				read-only;
 
 				compatible = "nvmem-cells";
-				#address-cells = <1>;
-				#size-cells = <1>;
-
-				macaddr_lan: macaddr at 4 {
-					reg = <0x4 0x11>;
-				};
 
-				macaddr_wan: macaddr at 18 {
-					reg = <0x18 0x11>;
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					macaddr_lan: macaddr at 4 {
+						compatible = "mac-base";
+						reg = <0x4 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
+
+					macaddr_wan: macaddr at 18 {
+						compatible = "mac-base";
+						reg = <0x18 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
 				};
 			};
 
@@ -160,6 +168,6 @@
 
 &wmac {
 	status = "okay";
-	nvmem-cells = <&macaddr_lan>, <&cal_art_1000>;
-	nvmem-cell-names = "mac-address-ascii", "calibration";
+	nvmem-cells = <&macaddr_lan 0>, <&cal_art_1000>;
+	nvmem-cell-names = "mac-address", "calibration";
 };
diff --git a/target/linux/ath79/dts/qca9558_dlink_dir-629-a1.dts b/target/linux/ath79/dts/qca9558_dlink_dir-629-a1.dts
index 41b0039e93..d012ae4c50 100644
--- a/target/linux/ath79/dts/qca9558_dlink_dir-629-a1.dts
+++ b/target/linux/ath79/dts/qca9558_dlink_dir-629-a1.dts
@@ -65,8 +65,8 @@
 
 	phy-mode = "mii";
 
-	nvmem-cells = <&macaddr_mfcdata_35>;
-	nvmem-cell-names = "mac-address-ascii";
+	nvmem-cells = <&macaddr_mfcdata_35 0>;
+	nvmem-cell-names = "mac-address";
 
 	fixed-link {
 		speed = <100>;
@@ -115,15 +115,23 @@
 				read-only;
 
 				compatible = "nvmem-cells";
-				#address-cells = <1>;
-				#size-cells = <1>;
-
-				macaddr_mfcdata_35: macaddr at 35 {
-					reg = <0x35 0x11>;
-				};
 
-				macaddr_mfcdata_51: macaddr at 51 {
-					reg = <0x51 0x11>;
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					macaddr_mfcdata_35: macaddr at 35 {
+						compatible = "mac-base";
+						reg = <0x35 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
+
+					macaddr_mfcdata_51: macaddr at 51 {
+						compatible = "mac-base";
+						reg = <0x51 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
 				};
 			};
 
@@ -165,6 +173,6 @@
 &wmac {
 	status = "okay";
 
-	nvmem-cells = <&cal_art_1000>, <&macaddr_mfcdata_51>;
-	nvmem-cell-names = "calibration", "mac-address-ascii";
+	nvmem-cells = <&cal_art_1000>, <&macaddr_mfcdata_51 0>;
+	nvmem-cell-names = "calibration", "mac-address";
 };
diff --git a/target/linux/ath79/dts/qca9563_dlink_dir-8x9-a1.dtsi b/target/linux/ath79/dts/qca9563_dlink_dir-8x9-a1.dtsi
index 3fd9790c4a..616c29a4c1 100644
--- a/target/linux/ath79/dts/qca9563_dlink_dir-8x9-a1.dtsi
+++ b/target/linux/ath79/dts/qca9563_dlink_dir-8x9-a1.dtsi
@@ -32,8 +32,8 @@
 		compatible = "qcom,ath10k";
 		reg = <0x0000 0 0 0 0>;
 
-		nvmem-cells = <&calibration_ath10k>, <&macaddr_devdata_94>;
-		nvmem-cell-names = "calibration", "mac-address-ascii";
+		nvmem-cells = <&calibration_ath10k>, <&macaddr_devdata_94 0>;
+		nvmem-cell-names = "calibration", "mac-address";
 	};
 };
 
@@ -68,16 +68,25 @@
 				read-only;
 
 				compatible = "nvmem-cells";
-				#address-cells = <1>;
-				#size-cells = <1>;
 
-				macaddr_devdata_94: macaddr at 94 {
-					reg = <0x94 0x11>;
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					macaddr_devdata_94: macaddr at 94 {
+						compatible = "mac-base";
+						reg = <0x94 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
+
+					macaddr_devdata_b0: macaddr at b0 {
+						compatible = "mac-base";
+						reg = <0xb0 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
 				};
 
-				macaddr_devdata_b0: macaddr at b0 {
-					reg = <0xb0 0x11>;
-				};
 			};
 
 			partition at 60000 {
@@ -147,6 +156,6 @@
 &wmac {
 	status = "okay";
 
-	nvmem-cells = <&calibration_ath9k>, <&macaddr_devdata_b0>;
-	nvmem-cell-names = "calibration", "mac-address-ascii";
+	nvmem-cells = <&calibration_ath9k>, <&macaddr_devdata_b0 0>;
+	nvmem-cell-names = "calibration", "mac-address";
 };
-- 
2.35.3



From zajec5 at gmail.com  Thu Jul 20 22:43:30 2023
From: zajec5 at gmail.com (=?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?=)
Date: Fri, 21 Jul 2023 07:43:30 +0200
Subject: [PATCH] firmware-utils: add required PKG_BUILD_DEPENDS
In-Reply-To: <20230601154030.10407-1-zajec5@gmail.com>
References: <20230601154030.10407-1-zajec5@gmail.com>
Message-ID: <7dbcd2b7-48fc-b5b3-6309-b99b3e08bfcf@gmail.com>

On 1.06.2023 17:40, Rafa? Mi?ecki wrote:
> From: Rafa? Mi?ecki <rafal at milecki.pl>
> 
> This project provides a lot of independent utils. Most of them don't
> depend on SSL (or zlib). Build process however compiles all of them
> including those few that require SSL/ZLIB.
> 
> To make copmilation step always succeed it's needed to specify build
> time dependencies.
> 
> Runtime dependencies will be handled per-package (if we ever package one
> of those needing SSL/ZLIB).
> 
> This fixes:
> -- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
> -- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR)
> CMake Error at CMakeLists.txt:9 (MESSAGE):
>    Unable to find zlib library.

While I like my own commit description a lot ;) this PATCH been
obsoleted by the

commit 6f607ba043cdc996cd113b8dc25b6965dc1d9a41
Author: Tianling Shen <cnsztl at immortalwrt.org>
Date:   Thu Jun 1 17:35:16 2023 +0800

     firmware-utils: add missing build dependencies


From fe at dev.tdt.de  Thu Jul 20 23:27:19 2023
From: fe at dev.tdt.de (Florian Eckert)
Date: Fri, 21 Jul 2023 08:27:19 +0200
Subject: [PATCH] system-notification: initial checkin
In-Reply-To: <ZLjcUTzzvy0mlIlb@rivendell>
References: <20230719112014.28110-1-fe@dev.tdt.de>
 <ZLjcUTzzvy0mlIlb@rivendell>
Message-ID: <079e6d321eb72755c24ef886212d6e86@dev.tdt.de>

Hello Enrico,

Thanks for your feedback!

> I think the idea can be nice, however I would like to make sure that
> thismechanism can be ignored by an admin with no consequences.

This is only informative. I see this especially in connection with the 
LuCI.
So that events that happens on the system can be displayed.
I already have a small app for this [1].

> Is this the case? In other words - if I store 20 messages with maximum
> allowed amount of text in all strings, how much data am I storing?

There is currently only the restriction that the number of messages is 
limited to 20.
This can be reduced or increased. I can't say how much memory this takes 
up.
I haven't thought about that yet. We can also limit this, so that the 
message
may only have a certain length

> Furthermore, I suggest calling both the rpcd plugin and the
> user-facing script with the same name.

That is indirectly the case. The script is called 'system-notification' 
and the
ubus backend is called 'system.notification'. I didn't want to call it 
only
'notification' now, because it might already be taken. The name 
'notification' is very common.

> And - di I miss it or you can not actually create a notification from
> the user-facing script? Why not implement that as well?

I have deliberately not implemented this, because I am not sure how to 
do it,
as the message can become relatively long. The creation of the 
notification
will probably be the system via a bus call.

--

Florian Eckert

[1] 
https://github.com/TDT-AG/luci/commit/aa4b0425206448f1336dc7a94fe31c4cc089a0c9


From rdunlap at infradead.org  Fri Jul 21 23:43:18 2023
From: rdunlap at infradead.org (Randy Dunlap)
Date: Fri, 21 Jul 2023 23:43:18 -0700
Subject: [PATCH] vlynq: fix typos in Kconfig
Message-ID: <20230722064318.29074-1-rdunlap@infradead.org>

Fix grammar and punctuation in the vlynq Kconfig file.

Fixes: 55e331cf7ebe ("drivers: add support for the TI VLYNQ bus")
Signed-off-by: Randy Dunlap <rdunlap at infradead.org>
Cc: Florian Fainelli <f.fainelli at gmail.com>
Cc: openwrt-devel at lists.openwrt.org
Cc: Andrew Morton <akpm at linux-foundation.org>
---
 drivers/vlynq/Kconfig |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff -- a/drivers/vlynq/Kconfig b/drivers/vlynq/Kconfig
--- a/drivers/vlynq/Kconfig
+++ b/drivers/vlynq/Kconfig
@@ -7,10 +7,10 @@ config VLYNQ
 	help
 	  Support for Texas Instruments(R) VLYNQ bus.
 	  The VLYNQ bus is a high-speed, serial and packetized
-	  data bus which allows external peripherals of a SoC
+	  data bus which allows external peripherals of an SoC
 	  to appear into the system's main memory.
 
-	  If unsure, say N
+	  If unsure, say N.
 
 config VLYNQ_DEBUG
 	bool "VLYNQ bus debug"


From ynezz at true.cz  Sat Jul 22 01:27:53 2023
From: ynezz at true.cz (Petr =?utf-8?Q?=C5=A0tetiar?=)
Date: Sat, 22 Jul 2023 10:27:53 +0200
Subject: 22.03 packages not building since 10 days
In-Reply-To: <50BE028B-4BCE-4E80-9F46-188642B41E78@gmx.net>
References: <50BE028B-4BCE-4E80-9F46-188642B41E78@gmx.net>
Message-ID: <20230722082753.GC26419@meh.true.cz>

Sebastian Kemper <sebastian_ml at gmx.net> [2023-07-20 20:54:33]:

Hi,

> Can a kind soul please check the build bots for 22.03 packages? We pushed
> some security fixes about a week ago for pjsip and were hoping they'd be
> packaged by now.

thanks for the report, should be fixed now.

Cheers,

Petr


From sebastian_ml at gmx.net  Sat Jul 22 02:28:29 2023
From: sebastian_ml at gmx.net (Sebastian Kemper)
Date: Sat, 22 Jul 2023 09:28:29 +0000
Subject: 22.03 packages not building since 10 days
In-Reply-To: <20230722082753.GC26419@meh.true.cz>
References: <50BE028B-4BCE-4E80-9F46-188642B41E78@gmx.net> <20230722082753.GC26419@meh.true.cz>
Message-ID: <58DB5C97-3F58-4C4B-B3BF-04DF492F6D64@gmx.net>

Am 22. Juli 2023 08:27:53 UTC schrieb "Petr ?tetiar" <ynezz at true.cz>:
>Sebastian Kemper <sebastian_ml at gmx.net> [2023-07-20 20:54:33]:
>
>Hi,
>
>> Can a kind soul please check the build bots for 22.03 packages? We pushed
>> some security fixes about a week ago for pjsip and were hoping they'd be
>> packaged by now.
>
>thanks for the report, should be fixed now.
>
>Cheers,
>
>Petr

Than you Petr!


From newtwen at gmail.com  Sat Jul 22 05:04:46 2023
From: newtwen at gmail.com (Paul D)
Date: Sat, 22 Jul 2023 13:04:46 +0100
Subject: [PATCH] vlynq: fix typos in Kconfig
In-Reply-To: <20230722064318.29074-1-rdunlap@infradead.org>
References: <20230722064318.29074-1-rdunlap@infradead.org>
Message-ID: <62eb92f4-c800-825b-c2a0-dd9d46e3d663@gmail.com>

On 2023-07-22 07:43, Randy Dunlap wrote:
> Fix grammar and punctuation in the vlynq Kconfig file.
> 
> Fixes: 55e331cf7ebe ("drivers: add support for the TI VLYNQ bus")
> Signed-off-by: Randy Dunlap <rdunlap at infradead.org>
> Cc: Florian Fainelli <f.fainelli at gmail.com>
> Cc: openwrt-devel at lists.openwrt.org
> Cc: Andrew Morton <akpm at linux-foundation.org>
> ---
>   drivers/vlynq/Kconfig |    4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff -- a/drivers/vlynq/Kconfig b/drivers/vlynq/Kconfig
> --- a/drivers/vlynq/Kconfig
> +++ b/drivers/vlynq/Kconfig
> @@ -7,10 +7,10 @@ config VLYNQ
>   	help
>   	  Support for Texas Instruments(R) VLYNQ bus.
>   	  The VLYNQ bus is a high-speed, serial and packetized
> -	  data bus which allows external peripherals of a SoC
> +	  data bus which allows external peripherals of an SoC


Nitpick:

Usually debatable. But SoC starts with S

In native English, "an" never precedes a consonant, which appears in 
both SoC and System (on a Chip).


>   	  to appear into the system's main memory.
>   
> -	  If unsure, say N
> +	  If unsure, say N.
>   
>   config VLYNQ_DEBUG
>   	bool "VLYNQ bus debug"
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel



From legale.legale at gmail.com  Sat Jul 22 06:40:02 2023
From: legale.legale at gmail.com (Legale Legale)
Date: Sat, 22 Jul 2023 16:40:02 +0300
Subject: [PATCH] ubox: logread add option to filter priority (log level)
Message-ID: <CACDmYyft9wxJm+5a-4qDu-OTSV9rsF9LkvbzcViy_0Ks3opEKQ@mail.gmail.com>

>From 071cfc2853dd7a4f9fb59a1650de8d5c874ce4f2 Mon Sep 17 00:00:00 2001
From:
Date: Sat, 22 Jul 2023 01:28:05 +0300
Subject: [PATCH] logread: add option to filter priority (log level)

This adds an ability to filter log messages priority:
        -v      <log level>     handle only messages with given log
level (0-7), repeatable
        -V      <log level>     ignore messages with given log level
(0-7), repeatable

Signed-off-by: Isaev Ruslan <legale.legale at gmail.com>
---
 log/logread.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/log/logread.c b/log/logread.c
index f48dd4b..91aae00 100644
--- a/log/logread.c
+++ b/log/logread.c
@@ -66,6 +66,8 @@ static int log_type = LOG_STDOUT;
 static int log_size, log_udp, log_follow, log_trailer_null = 0;
 static int log_timestamp;
 static int logd_conn_tries = LOGD_CONNECT_RETRY;
+static int loglevel_include;
+static int loglevel_exclude;
 static int facility_include;
 static int facility_exclude;

@@ -79,6 +81,16 @@ static int check_facility_filter(int f)
        return 1;
 }

+/* check for loglevel filter; return 0 if message shall be dropped */
+static int check_loglevel_filter(int f)
+{
+       if (loglevel_include)
+               return !!(loglevel_include & (1 << f));
+       if (loglevel_exclude)
+               return !(loglevel_exclude & (1 << f));
+       return 1;
+}
+
 static const char* getcodetext(int value, CODE *codetable) {
        CODE *i;

@@ -155,6 +167,9 @@ static int log_notify(struct blob_attr *msg)

        if (!check_facility_filter(LOG_FAC(p)))
                        return 0;
+
+  if (!check_loglevel_filter(LOG_PRI(p)))
+    return 0;

        m = blobmsg_get_string(tb[LOG_MSG]);
        if (regexp_pattern &&
@@ -233,6 +248,8 @@ static int usage(const char *prog)
                "    -p <file>          PID file\n"
                "    -h <hostname>      Add hostname to the message\n"
                "    -P <prefix>        Prefix custom text to streamed
messages\n"
+               "    -v <log level>     handle only messages with
given log level (0-7), repeatable\n"
+               "    -V <log level>     ignore messages with given log
level (0-7), repeatable\n"
                "    -z <facility>      handle only messages with
given facility (0-23), repeatable\n"
                "    -Z <facility>      ignore messages with given
facility (0-23), repeatable\n"
                "    -f                 Follow log messages\n"
@@ -313,7 +330,7 @@ int main(int argc, char **argv)

        signal(SIGPIPE, SIG_IGN);

-       while ((ch = getopt(argc, argv, "u0fcs:l:z:Z:r:F:p:S:P:h:e:t")) != -1) {
+       while ((ch = getopt(argc, argv,
"u0fcs:l:v:V:z:Z:r:F:p:S:P:h:e:t")) != -1) {
                switch (ch) {
                case 'u':
                        log_udp = 1;
@@ -343,6 +360,14 @@ int main(int argc, char **argv)
                case 'l':
                        lines = atoi(optarg);
                        break;
+               case 'v':
+                       id = strtoul(optarg, NULL, 0) & 0x1f;
+                       loglevel_include |= (1 << id);
+                       break;
+               case 'V':
+                       id = strtoul(optarg, NULL, 0) & 0x1f;
+                       loglevel_exclude |= (1 << id);
+                       break;
                case 'z':
                        id = strtoul(optarg, NULL, 0) & 0x1f;
                        facility_include |= (1 << id);
-- 
2.30.2


From yangshiji66 at outlook.com  Sat Jul 22 07:52:02 2023
From: yangshiji66 at outlook.com (Shiji Yang)
Date: Sat, 22 Jul 2023 22:52:02 +0800
Subject: [PATCH] mac80211: limit MT7620 TX power based on eeprom calibration
Message-ID: <TYAP286MB031542007DE86EA4911D4C65BC3CA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>

From: Shiji Yang <yangshiji66 at qq.com>

This patch adds basic TX power control to the MT7620 and limits its
maximum TX power. This can avoid the link speed decrease caused by
chip overheating.

Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
---
 ...t-MT7620-TX-power-based-on-eeprom-ca.patch | 83 +++++++++++++++++++
 1 file changed, 83 insertions(+)
 create mode 100644 package/kernel/mac80211/patches/rt2x00/997-wifi-rt2x00-limit-MT7620-TX-power-based-on-eeprom-ca.patch

diff --git a/package/kernel/mac80211/patches/rt2x00/997-wifi-rt2x00-limit-MT7620-TX-power-based-on-eeprom-ca.patch b/package/kernel/mac80211/patches/rt2x00/997-wifi-rt2x00-limit-MT7620-TX-power-based-on-eeprom-ca.patch
new file mode 100644
index 0000000000..ecb8577752
--- /dev/null
+++ b/package/kernel/mac80211/patches/rt2x00/997-wifi-rt2x00-limit-MT7620-TX-power-based-on-eeprom-ca.patch
@@ -0,0 +1,83 @@
+From: Shiji Yang <yangshiji66 at outlook.com>
+Date: Sat, 22 Jul 2023 21:56:30 +0800
+Subject: [PATCH] wifi: rt2x00: limit MT7620 TX power based on eeprom
+ calibration
+
+In the vendor driver, the current channel power is queried from
+EEPROM_TXPOWER_BG1 and EEPROM_TXPOWER_BG2. And then the mixed value
+will be written into the low half-word of the TX_ALC_CFG_0 register.
+The high half-word of the TX_ALC_CFG_0 is a fixed value 0x2f2f.
+
+We can't get the accurate TX power. Based on my tests and the new
+MediaTek mt76 driver source code, the real TX power is approximately
+equal to channel_power + (max) rate_power. Usually max rate_power is
+the gain of the OFDM 6M rate, which can be readed from the offset
+EEPROM_TXPOWER_BYRATE +1.
+
+Based on these eeprom values, this patch adds basic TX power control
+to the MT7620 and limits its maximum TX power. This can avoid the
+link speed decrease caused by chip overheating.
+
+Signed-off-by: Shiji Yang <yangshiji66 at outlook.com>
+---
+ .../net/wireless/ralink/rt2x00/rt2800lib.c    | 43 +++++++++++++------
+ 1 file changed, 30 insertions(+), 13 deletions(-)
+
+--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+@@ -3894,25 +3894,42 @@ static void rt2800_config_channel_rf7620
+ static void rt2800_config_alc(struct rt2x00_dev *rt2x00dev,
+ 			      struct ieee80211_channel *chan,
+ 			      int power_level) {
+-	u16 eeprom, target_power, max_power;
++	u16 eeprom, chan_power, rate_power, target_power;
++	u16 tx_power[2];
++	s8 *power_group[2];
+ 	u32 mac_sys_ctrl;
+-	u32 reg;
++	u32 cnt, reg;
+ 	u8 bbp;
+ 
+-	/* hardware unit is 0.5dBm, limited to 23.5dBm */
+-	power_level *= 2;
+-	if (power_level > 0x2f)
+-		power_level = 0x2f;
++	/* get per channel power, 2 channels in total, unit is 0.5dBm */
++	power_level = (power_level - 3) * 2;
++	/*
++	 * We can't set the accurate TX power. Based on some tests, the real
++	 * TX power is approximately equal to channel_power + (max)rate_power.
++	 * Usually max rate_power is the gain of the OFDM 6M rate.
++	 */
++	rate_power = rt2800_eeprom_read_from_array(rt2x00dev,
++				EEPROM_TXPOWER_BYRATE, 1) & 0x3f;
++	power_level -= rate_power;
++	if (power_level < 1)
++		power_level = 1;
++	if (power_level > chan->max_power * 2)
++		power_level = chan->max_power * 2;
+ 
+-	max_power = chan->max_power * 2;
+-	if (max_power > 0x2f)
+-		max_power = 0x2f;
++	power_group[0] = rt2800_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1);
++	power_group[1] = rt2800_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2);
++	for (cnt = 0; cnt < 2; cnt++) {
++		chan_power = power_group[cnt][rt2x00dev->rf_channel - 1];
++		if (chan_power >= 0x20 || chan_power == 0)
++			chan_power = 0x10;
++		tx_power[cnt] = power_level < chan_power ? power_level : chan_power;
++	}
+ 
+ 	reg = rt2800_register_read(rt2x00dev, TX_ALC_CFG_0);
+-	rt2x00_set_field32(&reg, TX_ALC_CFG_0_CH_INIT_0, power_level);
+-	rt2x00_set_field32(&reg, TX_ALC_CFG_0_CH_INIT_1, power_level);
+-	rt2x00_set_field32(&reg, TX_ALC_CFG_0_LIMIT_0, max_power);
+-	rt2x00_set_field32(&reg, TX_ALC_CFG_0_LIMIT_1, max_power);
++	rt2x00_set_field32(&reg, TX_ALC_CFG_0_CH_INIT_0, tx_power[0]);
++	rt2x00_set_field32(&reg, TX_ALC_CFG_0_CH_INIT_1, tx_power[1]);
++	rt2x00_set_field32(&reg, TX_ALC_CFG_0_LIMIT_0, 0x2f);
++	rt2x00_set_field32(&reg, TX_ALC_CFG_0_LIMIT_1, 0x2f);
+ 
+ 	eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1);
+ 	if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_INTERNAL_TX_ALC)) {
-- 
2.39.2



From legale.legale at gmail.com  Sat Jul 22 08:43:55 2023
From: legale.legale at gmail.com (Legale Legale)
Date: Sat, 22 Jul 2023 18:43:55 +0300
Subject: [PATCH] ubox: logread add option to filter priority (log level)
Message-ID: <CACDmYyd=oLLuYW0u+eHHkTepzMDRF-Ej7u_0mB5ei8hEm0XRoQ@mail.gmail.com>

This adds an ability to filter log messages priority:
        -v      <log level>     handle only messages with given log
level (0-7), repeatable
        -V      <log level>     ignore messages with given log level
(0-7), repeatable

Signed-off-by: Isaev Ruslan <legale.legale at gmail.com>
---
 log/logread.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/log/logread.c b/log/logread.c
index f48dd4b..91aae00 100644
--- a/log/logread.c
+++ b/log/logread.c
@@ -66,6 +66,8 @@ static int log_type = LOG_STDOUT;
 static int log_size, log_udp, log_follow, log_trailer_null = 0;
 static int log_timestamp;
 static int logd_conn_tries = LOGD_CONNECT_RETRY;
+static int loglevel_include;
+static int loglevel_exclude;
 static int facility_include;
 static int facility_exclude;

@@ -79,6 +81,16 @@ static int check_facility_filter(int f)
        return 1;
 }

+/* check for loglevel filter; return 0 if message shall be dropped */
+static int check_loglevel_filter(int f)
+{
+       if (loglevel_include)
+               return !!(loglevel_include & (1 << f));
+       if (loglevel_exclude)
+               return !(loglevel_exclude & (1 << f));
+       return 1;
+}
+
 static const char* getcodetext(int value, CODE *codetable) {
        CODE *i;

@@ -155,6 +167,9 @@ static int log_notify(struct blob_attr *msg)

        if (!check_facility_filter(LOG_FAC(p)))
                        return 0;
+
+  if (!check_loglevel_filter(LOG_PRI(p)))
+    return 0;

        m = blobmsg_get_string(tb[LOG_MSG]);
        if (regexp_pattern &&
@@ -233,6 +248,8 @@ static int usage(const char *prog)
                "    -p <file>          PID file\n"
                "    -h <hostname>      Add hostname to the message\n"
                "    -P <prefix>        Prefix custom text to streamed
messages\n"
+               "    -v <log level>     handle only messages with
given log level (0-7), repeatable\n"
+               "    -V <log level>     ignore messages with given log
level (0-7), repeatable\n"
                "    -z <facility>      handle only messages with
given facility (0-23), repeatable\n"
                "    -Z <facility>      ignore messages with given
facility (0-23), repeatable\n"
                "    -f                 Follow log messages\n"
@@ -313,7 +330,7 @@ int main(int argc, char **argv)

        signal(SIGPIPE, SIG_IGN);

-       while ((ch = getopt(argc, argv, "u0fcs:l:z:Z:r:F:p:S:P:h:e:t")) != -1) {
+       while ((ch = getopt(argc, argv,
"u0fcs:l:v:V:z:Z:r:F:p:S:P:h:e:t")) != -1) {
                switch (ch) {
                case 'u':
                        log_udp = 1;
@@ -343,6 +360,14 @@ int main(int argc, char **argv)
                case 'l':
                        lines = atoi(optarg);
                        break;
+               case 'v':
+                       id = strtoul(optarg, NULL, 0) & 0x1f;
+                       loglevel_include |= (1 << id);
+                       break;
+               case 'V':
+                       id = strtoul(optarg, NULL, 0) & 0x1f;
+                       loglevel_exclude |= (1 << id);
+                       break;
                case 'z':
                        id = strtoul(optarg, NULL, 0) & 0x1f;
                        facility_include |= (1 << id);
--
2.30.2


From daniel at makrotopia.org  Sat Jul 22 09:36:32 2023
From: daniel at makrotopia.org (Daniel Golle)
Date: Sat, 22 Jul 2023 17:36:32 +0100
Subject: [PATCH] mac80211: limit MT7620 TX power based on eeprom
 calibration
In-Reply-To: <TYAP286MB031542007DE86EA4911D4C65BC3CA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>
References: <TYAP286MB031542007DE86EA4911D4C65BC3CA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>
Message-ID: <ZLwFkD19zqL-4cBo@makrotopia.org>

On Sat, Jul 22, 2023 at 10:52:02PM +0800, Shiji Yang wrote:
> From: Shiji Yang <yangshiji66 at qq.com>
> 
> This patch adds basic TX power control to the MT7620 and limits its
> maximum TX power. This can avoid the link speed decrease caused by
> chip overheating.

Thanks a lot for your patch and analysis of the situation.
As you add code reading values from the EEPROM, we need to make sure
that it doesn't break other chips (Rt5xxx most likely, Rt3xxx could
also be affected). The easiest would be to create a new function
rt2800_config_alc_mt7620 which is called only for MT7620 while keeping
the original codepath for all other rt2800 radios (unless we are 100%
sure that we won't break things).

> 
> Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
> ---
>  ...t-MT7620-TX-power-based-on-eeprom-ca.patch | 83 +++++++++++++++++++
>  1 file changed, 83 insertions(+)
>  create mode 100644 package/kernel/mac80211/patches/rt2x00/997-wifi-rt2x00-limit-MT7620-TX-power-based-on-eeprom-ca.patch
> 
> diff --git a/package/kernel/mac80211/patches/rt2x00/997-wifi-rt2x00-limit-MT7620-TX-power-based-on-eeprom-ca.patch b/package/kernel/mac80211/patches/rt2x00/997-wifi-rt2x00-limit-MT7620-TX-power-based-on-eeprom-ca.patch
> new file mode 100644
> index 0000000000..ecb8577752
> --- /dev/null
> +++ b/package/kernel/mac80211/patches/rt2x00/997-wifi-rt2x00-limit-MT7620-TX-power-based-on-eeprom-ca.patch
> @@ -0,0 +1,83 @@
> +From: Shiji Yang <yangshiji66 at outlook.com>
> +Date: Sat, 22 Jul 2023 21:56:30 +0800
> +Subject: [PATCH] wifi: rt2x00: limit MT7620 TX power based on eeprom
> + calibration
> +
> +In the vendor driver, the current channel power is queried from
> +EEPROM_TXPOWER_BG1 and EEPROM_TXPOWER_BG2. And then the mixed value
> +will be written into the low half-word of the TX_ALC_CFG_0 register.
> +The high half-word of the TX_ALC_CFG_0 is a fixed value 0x2f2f.
> +
> +We can't get the accurate TX power. Based on my tests and the new
> +MediaTek mt76 driver source code, the real TX power is approximately
> +equal to channel_power + (max) rate_power. Usually max rate_power is
> +the gain of the OFDM 6M rate, which can be readed from the offset
> +EEPROM_TXPOWER_BYRATE +1.
> +
> +Based on these eeprom values, this patch adds basic TX power control
> +to the MT7620 and limits its maximum TX power. This can avoid the
> +link speed decrease caused by chip overheating.
> +
> +Signed-off-by: Shiji Yang <yangshiji66 at outlook.com>
> +---
> + .../net/wireless/ralink/rt2x00/rt2800lib.c    | 43 +++++++++++++------
> + 1 file changed, 30 insertions(+), 13 deletions(-)
> +
> +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> +@@ -3894,25 +3894,42 @@ static void rt2800_config_channel_rf7620
> + static void rt2800_config_alc(struct rt2x00_dev *rt2x00dev,
> + 			      struct ieee80211_channel *chan,
> + 			      int power_level) {
> +-	u16 eeprom, target_power, max_power;
> ++	u16 eeprom, chan_power, rate_power, target_power;
> ++	u16 tx_power[2];
> ++	s8 *power_group[2];
> + 	u32 mac_sys_ctrl;
> +-	u32 reg;
> ++	u32 cnt, reg;
> + 	u8 bbp;
> + 
> +-	/* hardware unit is 0.5dBm, limited to 23.5dBm */
> +-	power_level *= 2;
> +-	if (power_level > 0x2f)
> +-		power_level = 0x2f;
> ++	/* get per channel power, 2 channels in total, unit is 0.5dBm */
> ++	power_level = (power_level - 3) * 2;
> ++	/*
> ++	 * We can't set the accurate TX power. Based on some tests, the real
> ++	 * TX power is approximately equal to channel_power + (max)rate_power.
> ++	 * Usually max rate_power is the gain of the OFDM 6M rate.
> ++	 */
> ++	rate_power = rt2800_eeprom_read_from_array(rt2x00dev,
> ++				EEPROM_TXPOWER_BYRATE, 1) & 0x3f;
> ++	power_level -= rate_power;
> ++	if (power_level < 1)
> ++		power_level = 1;
> ++	if (power_level > chan->max_power * 2)
> ++		power_level = chan->max_power * 2;
> + 
> +-	max_power = chan->max_power * 2;
> +-	if (max_power > 0x2f)
> +-		max_power = 0x2f;
> ++	power_group[0] = rt2800_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1);
> ++	power_group[1] = rt2800_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2);
> ++	for (cnt = 0; cnt < 2; cnt++) {
> ++		chan_power = power_group[cnt][rt2x00dev->rf_channel - 1];
> ++		if (chan_power >= 0x20 || chan_power == 0)
> ++			chan_power = 0x10;
> ++		tx_power[cnt] = power_level < chan_power ? power_level : chan_power;
> ++	}
> + 
> + 	reg = rt2800_register_read(rt2x00dev, TX_ALC_CFG_0);
> +-	rt2x00_set_field32(&reg, TX_ALC_CFG_0_CH_INIT_0, power_level);
> +-	rt2x00_set_field32(&reg, TX_ALC_CFG_0_CH_INIT_1, power_level);
> +-	rt2x00_set_field32(&reg, TX_ALC_CFG_0_LIMIT_0, max_power);
> +-	rt2x00_set_field32(&reg, TX_ALC_CFG_0_LIMIT_1, max_power);
> ++	rt2x00_set_field32(&reg, TX_ALC_CFG_0_CH_INIT_0, tx_power[0]);
> ++	rt2x00_set_field32(&reg, TX_ALC_CFG_0_CH_INIT_1, tx_power[1]);
> ++	rt2x00_set_field32(&reg, TX_ALC_CFG_0_LIMIT_0, 0x2f);
> ++	rt2x00_set_field32(&reg, TX_ALC_CFG_0_LIMIT_1, 0x2f);
> + 
> + 	eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1);
> + 	if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_INTERNAL_TX_ALC)) {
> -- 
> 2.39.2
> 


From yangshiji66 at outlook.com  Sat Jul 22 19:13:06 2023
From: yangshiji66 at outlook.com (=?gb2312?B?0e4gysC7+Q==?=)
Date: Sun, 23 Jul 2023 02:13:06 +0000
Subject: [PATCH] mac80211: limit MT7620 TX power based on eeprom
 calibration
In-Reply-To: <ZLwFkD19zqL-4cBo@makrotopia.org>
References: <TYAP286MB031542007DE86EA4911D4C65BC3CA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>
 <ZLwFkD19zqL-4cBo@makrotopia.org>
Message-ID: <TYAP286MB031567A5B5D848FB44D81780BC3DA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>

Hi, 
Thank you for your quick review.

On July 22, 2023, 4:36 p.m. UTC, Daniel Golle wrote:

>On Sat, Jul 22, 2023 at 10:52:02PM +0800, Shiji Yang wrote:
>> From: Shiji Yang <yangshiji66 at qq.com>
>>
>> This patch adds basic TX power control to the MT7620 and limits its
>> maximum TX power. This can avoid the link speed decrease caused by
>> chip overheating.
>
>Thanks a lot for your patch and analysis of the situation.
>As you add code reading values from the EEPROM, we need to make sure
>that it doesn't break other chips (Rt5xxx most likely, Rt3xxx could
>also be affected). The easiest would be to create a new function
>rt2800_config_alc_mt7620 which is called only for MT7620 while keeping
>the original codepath for all other rt2800 radios (unless we are 100%
>sure that we won't break things).
>
>>
>> Signed-off-by: Shiji Yang <yangshiji66 at qq.com>

This rt2800_config_alc() function is only used by RT6352(AKA MT7620),
so these changes are safe. I'll rename it to rt2800_config_alc_rt6352()
on the V2 patch.

ref:
https://elixir.bootlin.com/linux/v6.4.3/A/ident/rt2800_config_alc

From yangshiji66 at outlook.com  Sat Jul 22 19:14:54 2023
From: yangshiji66 at outlook.com (Shiji Yang)
Date: Sun, 23 Jul 2023 10:14:54 +0800
Subject: [PATCH v2] mac80211: limit MT7620 TX power based on eeprom calibration
Message-ID: <TYAP286MB03151B42A74444EA819F62B4BC3DA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>

From: Shiji Yang <yangshiji66 at qq.com>

This patch adds basic TX power control for the MT7620 and limits its
maximum TX power. This can avoid the link speed decrease caused by
chip overheating.

Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
---
Changes since v1:
  * To avoid developers misunderstanding it, rename rt2800_config_alc() to
    rt2800_config_alc_rt6352() since it's only used by RT6352(AKA MT7620).


 ...t-MT7620-TX-power-based-on-eeprom-ca.patch | 106 ++++++++++++++++++
 1 file changed, 106 insertions(+)
 create mode 100644 package/kernel/mac80211/patches/rt2x00/997-wifi-rt2x00-limit-MT7620-TX-power-based-on-eeprom-ca.patch

diff --git a/package/kernel/mac80211/patches/rt2x00/997-wifi-rt2x00-limit-MT7620-TX-power-based-on-eeprom-ca.patch b/package/kernel/mac80211/patches/rt2x00/997-wifi-rt2x00-limit-MT7620-TX-power-based-on-eeprom-ca.patch
new file mode 100644
index 0000000000..fd1b3d8bf3
--- /dev/null
+++ b/package/kernel/mac80211/patches/rt2x00/997-wifi-rt2x00-limit-MT7620-TX-power-based-on-eeprom-ca.patch
@@ -0,0 +1,106 @@
+From: Shiji Yang <yangshiji66 at outlook.com>
+Date: Sat, 22 Jul 2023 21:56:30 +0800
+Subject: [PATCH] wifi: rt2x00: limit MT7620 TX power based on eeprom
+ calibration
+
+In the vendor driver, the current channel power is queried from
+EEPROM_TXPOWER_BG1 and EEPROM_TXPOWER_BG2. And then the mixed value
+will be written into the low half-word of the TX_ALC_CFG_0 register.
+The high half-word of the TX_ALC_CFG_0 is a fixed value 0x2f2f.
+
+We can't get the accurate TX power. Based on my tests and the new
+MediaTek mt76 driver source code, the real TX power is approximately
+equal to channel_power + (max) rate_power. Usually max rate_power is
+the gain of the OFDM 6M rate, which can be readed from the offset
+EEPROM_TXPOWER_BYRATE +1.
+
+Based on these eeprom values, this patch adds basic TX power control
+for the MT7620 and limits its maximum TX power. This can avoid the
+link speed decrease caused by chip overheating. rt2800_config_alc()
+function has also been renamed to rt2800_config_alc_rt6352() because
+it's only used by RT6352(MT7620).
+
+Notice:
+It's still need some work to sync the max channel power to the user
+interface. This part is missing from the rt2x00 driver structure. If
+we set the power exceed the calibration value, it won't take effect.
+
+Signed-off-by: Shiji Yang <yangshiji66 at outlook.com>
+---
+ .../net/wireless/ralink/rt2x00/rt2800lib.c    | 49 +++++++++++++------
+ 1 file changed, 34 insertions(+), 15 deletions(-)
+
+--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+@@ -3891,28 +3891,47 @@ static void rt2800_config_channel_rf7620
+ 	}
+ }
+ 
+-static void rt2800_config_alc(struct rt2x00_dev *rt2x00dev,
++static void rt2800_config_alc_rt6352(struct rt2x00_dev *rt2x00dev,
+ 			      struct ieee80211_channel *chan,
+ 			      int power_level) {
+-	u16 eeprom, target_power, max_power;
++	u16 eeprom, chan_power, rate_power, target_power;
++	u16 tx_power[2];
++	s8 *power_group[2];
+ 	u32 mac_sys_ctrl;
+-	u32 reg;
++	u32 cnt, reg;
+ 	u8 bbp;
+ 
+-	/* hardware unit is 0.5dBm, limited to 23.5dBm */
+-	power_level *= 2;
+-	if (power_level > 0x2f)
+-		power_level = 0x2f;
+-
+-	max_power = chan->max_power * 2;
+-	if (max_power > 0x2f)
+-		max_power = 0x2f;
++	/* get per channel power, 2 channels in total, unit is 0.5dBm */
++	power_level = (power_level - 3) * 2;
++	/*
++	 * We can't get the accurate TX power. Based on some tests, the real
++	 * TX power is approximately equal to channel_power + (max)rate_power.
++	 * Usually max rate_power is the gain of the OFDM 6M rate. The antenna
++	 * gain and externel PA gain are not included as we are unable to
++	 * obtain these values.
++	 */
++	rate_power = rt2800_eeprom_read_from_array(rt2x00dev,
++				EEPROM_TXPOWER_BYRATE, 1) & 0x3f;
++	power_level -= rate_power;
++	if (power_level < 1)
++		power_level = 1;
++	if (power_level > chan->max_power * 2)
++		power_level = chan->max_power * 2;
++
++	power_group[0] = rt2800_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1);
++	power_group[1] = rt2800_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2);
++	for (cnt = 0; cnt < 2; cnt++) {
++		chan_power = power_group[cnt][rt2x00dev->rf_channel - 1];
++		if (chan_power >= 0x20 || chan_power == 0)
++			chan_power = 0x10;
++		tx_power[cnt] = power_level < chan_power ? power_level : chan_power;
++	}
+ 
+ 	reg = rt2800_register_read(rt2x00dev, TX_ALC_CFG_0);
+-	rt2x00_set_field32(&reg, TX_ALC_CFG_0_CH_INIT_0, power_level);
+-	rt2x00_set_field32(&reg, TX_ALC_CFG_0_CH_INIT_1, power_level);
+-	rt2x00_set_field32(&reg, TX_ALC_CFG_0_LIMIT_0, max_power);
+-	rt2x00_set_field32(&reg, TX_ALC_CFG_0_LIMIT_1, max_power);
++	rt2x00_set_field32(&reg, TX_ALC_CFG_0_CH_INIT_0, tx_power[0]);
++	rt2x00_set_field32(&reg, TX_ALC_CFG_0_CH_INIT_1, tx_power[1]);
++	rt2x00_set_field32(&reg, TX_ALC_CFG_0_LIMIT_0, 0x2f);
++	rt2x00_set_field32(&reg, TX_ALC_CFG_0_LIMIT_1, 0x2f);
+ 
+ 	eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1);
+ 	if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_INTERNAL_TX_ALC)) {
+@@ -5321,7 +5340,7 @@ static void rt2800_config_txpower_rt6352
+ 	rt2x00_set_field32(&pwreg, TX_PWR_CFG_9B_STBC_MCS7, t);
+ 	rt2800_register_write(rt2x00dev, TX_PWR_CFG_9, pwreg);
+ 
+-	rt2800_config_alc(rt2x00dev, chan, power_level);
++	rt2800_config_alc_rt6352(rt2x00dev, chan, power_level);
+ 
+ 	/* TODO: temperature compensation code! */
+ }
-- 
2.39.2



From me at shenghaoyang.info  Sun Jul 23 02:26:41 2023
From: me at shenghaoyang.info (Shenghao Yang)
Date: Sun, 23 Jul 2023 17:26:41 +0800
Subject: [PATCH] hostapd: allow PPSK to be enabled for sae, psk-sae
Message-ID: <c655c9d3-3d49-54ba-6eba-827f0a13b1b9@shenghaoyang.info>

Using a RADIUS supplied password for SAE was supported since upstream
hostapd commit fcbdaae8a52e542705a651ee78b39b02935fda20.

Tested on 23.05-rc2 with hostapd-openssl.

Signed-off-by: Shenghao Yang <me at shenghaoyang.info>
---
  package/network/services/hostapd/files/hostapd.sh | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
index bf3625c92d..3606f06f58 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -670,7 +670,7 @@ hostapd_set_bss_options() {
  		;;
  		psk|sae|psk-sae)
  			json_get_vars key wpa_psk_file
-			if [ "$auth_type" = "psk" ] && [ "$ppsk" -ne 0 ] ; then
+			if [ "$ppsk" -ne 0 ] ; then
  				json_get_vars auth_secret auth_port
  				set_default auth_port 1812
  				json_for_each_item append_auth_server auth_server



From daniel at makrotopia.org  Sun Jul 23 04:41:03 2023
From: daniel at makrotopia.org (Daniel Golle)
Date: Sun, 23 Jul 2023 12:41:03 +0100
Subject: [PATCH v2] mac80211: limit MT7620 TX power based on eeprom
 calibration
In-Reply-To: <TYAP286MB03151B42A74444EA819F62B4BC3DA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>
References: <TYAP286MB03151B42A74444EA819F62B4BC3DA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>
Message-ID: <ZL0Rz48qhBNIeSY6@makrotopia.org>

On Sun, Jul 23, 2023 at 10:14:54AM +0800, Shiji Yang wrote:
> From: Shiji Yang <yangshiji66 at qq.com>
> 
> This patch adds basic TX power control for the MT7620 and limits its
> maximum TX power. This can avoid the link speed decrease caused by
> chip overheating.
> 
> Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
> ---
> Changes since v1:
>   * To avoid developers misunderstanding it, rename rt2800_config_alc() to
>     rt2800_config_alc_rt6352() since it's only used by RT6352(AKA MT7620).


Picked to main branch. Thank you!


From noreply at github.com  Sun Jul 23 10:41:46 2023
From: noreply at github.com (Stephen Walker)
Date: Sun, 23 Jul 2023 10:41:46 -0700
Subject: [sdwalker/sdwalker.github.io] 392c12: This week's update
Message-ID: <sdwalker/sdwalker.github.io/push/refs/heads/master/6485f9-392c12@github.com>

  Branch: refs/heads/master
  Home:   https://github.com/sdwalker/sdwalker.github.io
  Commit: 392c121adfe82b0bf89749c5ef9af7aee1d922ce
      https://github.com/sdwalker/sdwalker.github.io/commit/392c121adfe82b0bf89749c5ef9af7aee1d922ce
  Author: Stephen Walker <stephendwalker+github at gmail.com>
  Date:   2023-07-23 (Sun, 23 Jul 2023)

  Changed paths:
    M uscan/index-22.03.html
    M uscan/index-23.05.html
    M uscan/index.html

  Log Message:
  -----------
  This week's update




From newtwen at gmail.com  Mon Jul 24 03:19:02 2023
From: newtwen at gmail.com (Paul D)
Date: Mon, 24 Jul 2023 11:19:02 +0100
Subject: [PATCH] ubox: logread add option to filter priority (log level)
In-Reply-To: <CACDmYyft9wxJm+5a-4qDu-OTSV9rsF9LkvbzcViy_0Ks3opEKQ@mail.gmail.com>
References: <CACDmYyft9wxJm+5a-4qDu-OTSV9rsF9LkvbzcViy_0Ks3opEKQ@mail.gmail.com>
Message-ID: <c685ea66-9038-57f2-7247-1d23bdbd8e8b@gmail.com>

For those executing this at the command line, how does one 'repeat'?

-v 1 -v 2, or -v1 -v2 or -v123 or -v 1,2,3?

I had to think for a bit since it wasn't immediately obvious.

Perhaps a hint string with "(repeatable eg -v 1 -v 2)"?



On 2023-07-22 14:40, Legale Legale wrote:
>  From 071cfc2853dd7a4f9fb59a1650de8d5c874ce4f2 Mon Sep 17 00:00:00 2001
> From:
> Date: Sat, 22 Jul 2023 01:28:05 +0300
> Subject: [PATCH] logread: add option to filter priority (log level)
> 
> This adds an ability to filter log messages priority:
>          -v      <log level>     handle only messages with given log
> level (0-7), repeatable
>          -V      <log level>     ignore messages with given log level
> (0-7), repeatable
> 
> Signed-off-by: Isaev Ruslan <legale.legale at gmail.com>
> ---
>   log/logread.c | 27 ++++++++++++++++++++++++++-
>   1 file changed, 26 insertions(+), 1 deletion(-)
> 
> diff --git a/log/logread.c b/log/logread.c
> index f48dd4b..91aae00 100644
> --- a/log/logread.c
> +++ b/log/logread.c
> @@ -66,6 +66,8 @@ static int log_type = LOG_STDOUT;
>   static int log_size, log_udp, log_follow, log_trailer_null = 0;
>   static int log_timestamp;
>   static int logd_conn_tries = LOGD_CONNECT_RETRY;
> +static int loglevel_include;
> +static int loglevel_exclude;
>   static int facility_include;
>   static int facility_exclude;
> 
> @@ -79,6 +81,16 @@ static int check_facility_filter(int f)
>          return 1;
>   }
> 
> +/* check for loglevel filter; return 0 if message shall be dropped */
> +static int check_loglevel_filter(int f)
> +{
> +       if (loglevel_include)
> +               return !!(loglevel_include & (1 << f));
> +       if (loglevel_exclude)
> +               return !(loglevel_exclude & (1 << f));
> +       return 1;
> +}
> +
>   static const char* getcodetext(int value, CODE *codetable) {
>          CODE *i;
> 
> @@ -155,6 +167,9 @@ static int log_notify(struct blob_attr *msg)
> 
>          if (!check_facility_filter(LOG_FAC(p)))
>                          return 0;
> +
> +  if (!check_loglevel_filter(LOG_PRI(p)))
> +    return 0;
> 
>          m = blobmsg_get_string(tb[LOG_MSG]);
>          if (regexp_pattern &&
> @@ -233,6 +248,8 @@ static int usage(const char *prog)
>                  "    -p <file>          PID file\n"
>                  "    -h <hostname>      Add hostname to the message\n"
>                  "    -P <prefix>        Prefix custom text to streamed
> messages\n"
> +               "    -v <log level>     handle only messages with
> given log level (0-7), repeatable\n"
> +               "    -V <log level>     ignore messages with given log
> level (0-7), repeatable\n"
>                  "    -z <facility>      handle only messages with
> given facility (0-23), repeatable\n"
>                  "    -Z <facility>      ignore messages with given
> facility (0-23), repeatable\n"
>                  "    -f                 Follow log messages\n"
> @@ -313,7 +330,7 @@ int main(int argc, char **argv)
> 
>          signal(SIGPIPE, SIG_IGN);
> 
> -       while ((ch = getopt(argc, argv, "u0fcs:l:z:Z:r:F:p:S:P:h:e:t")) != -1) {
> +       while ((ch = getopt(argc, argv,
> "u0fcs:l:v:V:z:Z:r:F:p:S:P:h:e:t")) != -1) {
>                  switch (ch) {
>                  case 'u':
>                          log_udp = 1;
> @@ -343,6 +360,14 @@ int main(int argc, char **argv)
>                  case 'l':
>                          lines = atoi(optarg);
>                          break;
> +               case 'v':
> +                       id = strtoul(optarg, NULL, 0) & 0x1f;
> +                       loglevel_include |= (1 << id);
> +                       break;
> +               case 'V':
> +                       id = strtoul(optarg, NULL, 0) & 0x1f;
> +                       loglevel_exclude |= (1 << id);
> +                       break;
>                  case 'z':
>                          id = strtoul(optarg, NULL, 0) & 0x1f;
>                          facility_include |= (1 << id);



From tmn505 at terefe.re  Mon Jul 24 06:25:43 2023
From: tmn505 at terefe.re (Tomasz Maciej Nowak)
Date: Mon, 24 Jul 2023 15:25:43 +0200
Subject: [PATCH v3 3/3] ipq40xx: pakedge_wr-1: workaround for kernel bigger than 4MiB
In-Reply-To: <20230724133027.9821-1-tmn505@terefe.re>
References: <20230724133027.9821-1-tmn505@terefe.re>
Message-ID: <20230724133027.9821-4-tmn505@terefe.re>

From: Tomasz Maciej Nowak <tmn505 at gmail.com>

Alter booting command in U-Boot on first boot after upgrade to workaround
the kernel size limitation. The kernel size read from flash will be 8MiB,
which should suffice for forseable future. As precaution a warning
interupting upgrade is emited, explaining what to do.

Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
---
 .../etc/uci-defaults/05_fix-compat-version         |  3 ++-
 .../base-files/lib/preinit/81_patch_uboot_env.sh   | 14 ++++++++++++++
 target/linux/ipq40xx/image/generic.mk              |  8 +++++++-
 3 files changed, 23 insertions(+), 2 deletions(-)
 create mode 100644 target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh

diff --git a/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
index c01192089712..a3f90125c6e5 100644
--- a/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
+++ b/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
@@ -4,7 +4,8 @@ case "$(board_name)" in
 linksys,ea6350v3|\
 linksys,ea8300|\
 linksys,mr8300|\
-ezviz,cs-w3-wd1200g-eup)
+ezviz,cs-w3-wd1200g-eup|\
+pakedge,wr-1)
 	uci set system. at system[0].compat_version="2.0"
 	uci commit system
 	;;
diff --git a/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh b/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh
new file mode 100644
index 000000000000..0cc0ab0fca6f
--- /dev/null
+++ b/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh
@@ -0,0 +1,14 @@
+. /lib/functions.sh
+
+preinit_patch_uboot_env() {
+	case $(board_name) in
+	pakedge,wr-1)
+		if ! fw_printenv -n OpenWrt &>/dev/null; then
+			fw_setenv OpenWrt 'sf probe; sf read 0x84000000 0x180000 0x800000; bootm 0x84000000'
+			fw_setenv bootcmd "$(fw_printenv -n bootcmd | sed -e 's,bootipq,run OpenWrt,')"
+		fi
+		;;
+	esac
+}
+
+boot_hook_add preinit_main preinit_patch_uboot_env
diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
index d9d60a25ff0f..1b4ea8f8648c 100644
--- a/target/linux/ipq40xx/image/generic.mk
+++ b/target/linux/ipq40xx/image/generic.mk
@@ -958,8 +958,14 @@ define Device/pakedge_wr-1
 	SOC := qcom-ipq4018
 	BLOCKSIZE := 64k
 	IMAGE_SIZE := 31232k
-	KERNEL_SIZE := 4096k
+	KERNEL_SIZE := 8192k
 	IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | append-metadata
+	DEVICE_COMPAT_VERSION := 2.0
+	DEVICE_COMPAT_MESSAGE := \n$\
+		Booting command in U-Boot needs to be changed because of kernel \n$\
+		growing beyond 4MiB. Force upgrade to 23.05.0 first and it will \n$\
+		automatically amend booting command in U-Boot on first boot. \n$\
+		Then proceed with the upgrade to desired version.
 endef
 TARGET_DEVICES += pakedge_wr-1
 
-- 
2.41.0



From tmn505 at terefe.re  Mon Jul 24 06:25:42 2023
From: tmn505 at terefe.re (Tomasz Maciej Nowak)
Date: Mon, 24 Jul 2023 15:25:42 +0200
Subject: [PATCH v3 2/3] ipq40xx: dts: allow writing to U-Boot environment
In-Reply-To: <20230724133027.9821-1-tmn505@terefe.re>
References: <20230724133027.9821-1-tmn505@terefe.re>
Message-ID: <20230724133027.9821-3-tmn505@terefe.re>

From: Tomasz Maciej Nowak <tmn505 at gmail.com>

Devices allowing to boot LZMA compressed kernel or zImage kernel didn't
hit yet the 4MiB boundary for kernel size, thus allowing to prepare
workaround for the issue, without need for serial console attachment.
The workaround is modifying 'bootcmd' variable in U-Boot environment
which will replace 'bootipq' command with equivalent not limited by
imposed partition table.
This commit also touches devices which boot uncompressed kernel, so
even if those are already soft-bricked, it will still allow to alter
U-Boot environment from initramfs booted device.

Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
---
 .../files/arch/arm/boot/dts/qcom-ipq4018-cs-w3-wd1200g-eup.dts   | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-dap-2610.dts    | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-eap1300.dts     | 1 -
 .../linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emd1.dts  | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emr3500.dts     | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ens620ext.dts   | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi   | 1 -
 .../linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wr-1.dts  | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wre6606.dts     | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts  | 1 -
 .../files/arch/arm/boot/dts/qcom-ipq4019-habanero-dvk.dts        | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-u4019-32m.dts   | 1 -
 .../linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-x1pro.dts | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts      | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts    | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts    | 1 -
 16 files changed, 16 deletions(-)

diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-cs-w3-wd1200g-eup.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-cs-w3-wd1200g-eup.dts
index 22a48c12c44e..0772c5ac464a 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-cs-w3-wd1200g-eup.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-cs-w3-wd1200g-eup.dts
@@ -185,7 +185,6 @@
 			partition5 at E0000 {
 				label = "APPSBLENV";
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 
 			partition6 at F0000 {
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-dap-2610.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-dap-2610.dts
index 493905d56d8f..dea90b13e209 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-dap-2610.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-dap-2610.dts
@@ -117,7 +117,6 @@
 			partition at e0000 {
 				label = "APPSBLENV";
 				reg = <0xe0000 0x10000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-eap1300.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-eap1300.dts
index a8f24aa00e60..2e9cb8ecdb68 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-eap1300.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-eap1300.dts
@@ -165,7 +165,6 @@
 			partition5 at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 			partition6 at f0000 {
 				label = "0:APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emd1.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emd1.dts
index 396595ba5185..615c6aaf678f 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emd1.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emd1.dts
@@ -163,7 +163,6 @@
 			partition5 at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 			partition6 at f0000 {
 				label = "0:APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emr3500.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emr3500.dts
index 361614945145..8c038917b668 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emr3500.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emr3500.dts
@@ -164,7 +164,6 @@
 			partition at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "0:APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ens620ext.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ens620ext.dts
index 69275e24b8cd..bba1dd89b7a8 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ens620ext.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ens620ext.dts
@@ -184,7 +184,6 @@
 			partition at e0000 {
 				label = "APPSBLENV"; /* uboot env*/
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "APPSBL"; /* uboot */
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi
index dc5c25c84ab7..b4d9d195c7f4 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi
@@ -228,7 +228,6 @@
 			partition5 at E0000 {
 				label = "APPSBLENV";
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 
 			partition6 at F0000 {
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wr-1.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wr-1.dts
index 16951da47fc0..4c707e73d862 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wr-1.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wr-1.dts
@@ -140,7 +140,6 @@
 			partition at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0x00e0000 0x0010000>;
-				read-only;
 			};
 
 			partition at f0000 {
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wre6606.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wre6606.dts
index efb267ae3692..decd7d5fdcc0 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wre6606.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wre6606.dts
@@ -195,7 +195,6 @@
 			partition5 at E0000 {
 				label = "APPSBLENV";
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 
 			partition6 at F0000 {
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts
index 70e05c7eef3a..eac11b02d144 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts
@@ -57,7 +57,6 @@
 			partition at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0xe0000 0x10000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "0:APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-habanero-dvk.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-habanero-dvk.dts
index 23a654dcff5a..690db0143891 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-habanero-dvk.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-habanero-dvk.dts
@@ -262,7 +262,6 @@
 			partition at e0000 {
 				label = "APPSBLENV"; /* uboot env */
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "APPSBL"; /* uboot */
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-u4019-32m.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-u4019-32m.dts
index 4efcdaf39418..5304870a43fa 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-u4019-32m.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-u4019-32m.dts
@@ -54,7 +54,6 @@
 			partition at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0xe0000 0x10000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "0:APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-x1pro.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-x1pro.dts
index 681300c502bf..aa401892fef3 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-x1pro.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-x1pro.dts
@@ -56,7 +56,6 @@
 			partition at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0xe0000 0x10000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "0:APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts
index 48b5cd53d80b..a1ede1dcbdb1 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts
@@ -205,7 +205,6 @@
 			partition5 at e0000 {
 				label = "0:APPSBLENV"; /* uboot env*/
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 			partition5 at f0000 {
 				label = "0:APPSBL"; /* uboot */
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts
index 7e4519a74661..78d044b67893 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts
@@ -182,7 +182,6 @@
 			APPSBLENV at e0000 {
 				label = "APPSBLENV";
 				reg = <0xe0000 0x10000>;
-				read-only;
 			};
 
 			APPSBL at f0000 {
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts
index 0e7f4c970f47..752397a1752d 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts
@@ -180,7 +180,6 @@
 			APPSBLENV at e0000 {
 				label = "APPSBLENV";
 				reg = <0xe0000 0x10000>;
-				read-only;
 			};
 
 			APPSBL at f0000 {
-- 
2.41.0



From tmn505 at terefe.re  Mon Jul 24 06:25:40 2023
From: tmn505 at terefe.re (Tomasz Maciej Nowak)
Date: Mon, 24 Jul 2023 15:25:40 +0200
Subject: [PATCH v3 0/3] ipq40xx: remedy potential of producing soft-bricking images
Message-ID: <20230724133027.9821-1-tmn505@terefe.re>

From: Tomasz Maciej Nowak <tmn505 at gmail.com>

Some of devices having kernel on NOR flash could reach limit of kernel
partition size at 4MiB and soft-brick them. Unfortunately we don't know
if all of them are affected, thus kernel size limit is added to all of
remaining ones. Later commit allows for some devices to prepare painless
transition, while the last one shows how it can be done for device i
introduced. I tried to make transition for the device as generic as
possible so it coulld be used on others, but unfortunately I own only
one device, which means the owners of the rest device need to verify if
it works for them and add their devices.

Tomasz Maciej Nowak (3):
  ipq40xx: image: limit kernel size for NOR devices
    v1 -> v2: no changes
    v2 -> v3: no changes
  ipq40xx: dts: allow writing to U-Boot environment
    v1 -> v2: no changes
    v2 -> v3: no changes
  ipq40xx: pakedge_wr-1: workaround for kernel bigger than 4MiB
    v1 -> v2: remove printing command from sed invocation which prints
              double output and breaks future 'bootcmd' modifications
    v2 -> v3: shortened description of problem presented to user as
              users having firmware 23.05.0 or later won't see the
              message

Tomasz Maciej Nowak (3):
  ipq40xx: image: limit kernel size for NOR devices
  ipq40xx: dts: allow writing to U-Boot environment
  ipq40xx: pakedge_wr-1: workaround for kernel bigger than 4MiB

 .../etc/uci-defaults/05_fix-compat-version         |  3 ++-
 .../base-files/lib/preinit/81_patch_uboot_env.sh   | 14 ++++++++++++++
 .../boot/dts/qcom-ipq4018-cs-w3-wd1200g-eup.dts    |  1 -
 .../arch/arm/boot/dts/qcom-ipq4018-dap-2610.dts    |  1 -
 .../arch/arm/boot/dts/qcom-ipq4018-eap1300.dts     |  1 -
 .../files/arch/arm/boot/dts/qcom-ipq4018-emd1.dts  |  1 -
 .../arch/arm/boot/dts/qcom-ipq4018-emr3500.dts     |  1 -
 .../arch/arm/boot/dts/qcom-ipq4018-ens620ext.dts   |  1 -
 .../arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi   |  1 -
 .../files/arch/arm/boot/dts/qcom-ipq4018-wr-1.dts  |  1 -
 .../arch/arm/boot/dts/qcom-ipq4018-wre6606.dts     |  1 -
 .../arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts  |  1 -
 .../arm/boot/dts/qcom-ipq4019-habanero-dvk.dts     |  1 -
 .../arch/arm/boot/dts/qcom-ipq4019-u4019-32m.dts   |  1 -
 .../files/arch/arm/boot/dts/qcom-ipq4019-x1pro.dts |  1 -
 .../arch/arm/boot/dts/qcom-ipq4028-wpj428.dts      |  1 -
 .../arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts    |  1 -
 .../arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts    |  1 -
 target/linux/ipq40xx/image/generic.mk              | 13 +++++++++++++
 19 files changed, 29 insertions(+), 17 deletions(-)
 create mode 100644 target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh

-- 
2.41.0



From tmn505 at terefe.re  Mon Jul 24 06:25:41 2023
From: tmn505 at terefe.re (Tomasz Maciej Nowak)
Date: Mon, 24 Jul 2023 15:25:41 +0200
Subject: [PATCH v3 1/3] ipq40xx: image: limit kernel size for NOR devices
In-Reply-To: <20230724133027.9821-1-tmn505@terefe.re>
References: <20230724133027.9821-1-tmn505@terefe.re>
Message-ID: <20230724133027.9821-2-tmn505@terefe.re>

From: Tomasz Maciej Nowak <tmn505 at gmail.com>

'bootipq' command on some devices, with kernel on NOR flash chip, read
kernel partition size from Qualcomm proprietary partition table, which
seems to be stored in MIBIB partition. The partition table can be read
by 'smeminfo' command in U-Boot command line interface. Because this
partition table is never updated on sysupgrade (even when the kernel
size changes) kernel size is capped at initial value, usually 4MiB.
Sysupgrading such kernel will soft-brick the device, which will need
serial console for recovery. Some devices already suffer from this,
beacuse its U-Boot does not allow to boot LZMA compressed kernel image
and/or kernel zImage. Even some devices allowing to boot LZMA compressed
kernel will hit this limitation later. Therefore limit the kernel size
to 4MiB for devices not having it specified, so we won't create
soft-bricking images.

Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
---
 target/linux/ipq40xx/image/generic.mk | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
index f15463ae8ca5..d9d60a25ff0f 100644
--- a/target/linux/ipq40xx/image/generic.mk
+++ b/target/linux/ipq40xx/image/generic.mk
@@ -130,6 +130,7 @@ define Device/8dev_habanero-dvk
 	DEVICE_VENDOR := 8devices
 	DEVICE_MODEL := Habanero DVK
 	IMAGE_SIZE := 30976k
+	KERNEL_SIZE := 4096k
 	SOC := qcom-ipq4019
 	IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | append-rootfs | pad-rootfs | check-size | append-metadata
 endef
@@ -400,6 +401,7 @@ define Device/dlink_dap-2610
 	WRGG_DEVNAME := /dev/mtdblock/8
 	WRGG_SIGNATURE := wapac30_dkbs_dap2610
 	IMAGE_SIZE := 14080k
+	KERNEL_SIZE := 4096k
 	IMAGES += factory.bin
 	# Bootloader expects a special 160 byte header which is added by
 	# wrgg-image.
@@ -478,6 +480,7 @@ define Device/engenius_emd1
 	DEVICE_DTS_CONFIG := config at 4
 	SOC := qcom-ipq4018
 	IMAGE_SIZE := 30720k
+	KERNEL_SIZE := 4096k
 	IMAGES += factory.bin
 	IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
 	IMAGE/factory.bin := qsdk-ipq-factory-nor | check-size
@@ -800,6 +803,7 @@ define Device/netgear_ex61x0v2
 	NETGEAR_BOARD_ID := EX6150v2series
 	NETGEAR_HW_ID := 29765285+16+0+128+2x2
 	IMAGE_SIZE := 14400k
+	KERNEL_SIZE := 4096k
 	SOC := qcom-ipq4018
 endef
 
@@ -954,6 +958,7 @@ define Device/pakedge_wr-1
 	SOC := qcom-ipq4018
 	BLOCKSIZE := 64k
 	IMAGE_SIZE := 31232k
+	KERNEL_SIZE := 4096k
 	IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | append-metadata
 endef
 TARGET_DEVICES += pakedge_wr-1
@@ -1030,6 +1035,7 @@ define Device/qxwlan_e2600ac-c1
 	BOARD_NAME := e2600ac-c1
 	SOC := qcom-ipq4019
 	IMAGE_SIZE := 31232k
+	KERNEL_SIZE := 4096k
 	IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
 endef
 TARGET_DEVICES += qxwlan_e2600ac-c1
@@ -1202,6 +1208,7 @@ define Device/zyxel_wre6606
 	DEVICE_DTS_CONFIG := config at 4
 	SOC := qcom-ipq4018
 	IMAGE_SIZE := 13184k
+	KERNEL_SIZE := 4096k
 	IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | check-size | append-metadata
 	DEVICE_PACKAGES := -kmod-ath10k-ct kmod-ath10k-ct-smallbuffers
 endef
-- 
2.41.0



From hannu.nyman at iki.fi  Mon Jul 24 08:20:03 2023
From: hannu.nyman at iki.fi (Hannu Nyman)
Date: Mon, 24 Jul 2023 18:20:03 +0300
Subject: [PATCH] ubox: logread add option to filter priority (log level)
In-Reply-To: <c685ea66-9038-57f2-7247-1d23bdbd8e8b@gmail.com>
References: <CACDmYyft9wxJm+5a-4qDu-OTSV9rsF9LkvbzcViy_0Ks3opEKQ@mail.gmail.com>
 <c685ea66-9038-57f2-7247-1d23bdbd8e8b@gmail.com>
Message-ID: <fd1507bb-4bd8-4299-bbee-8ca724fe2db3@iki.fi>

Paul D kirjoitti 24.7.2023 klo 13.19:
> For those executing this at the command line, how does one 'repeat'?
>
> -v 1 -v 2, or -v1 -v2 or -v123 or -v 1,2,3?
>
> I had to think for a bit since it wasn't immediately obvious.
>
> Perhaps a hint string with "(repeatable eg -v 1 -v 2)"?
>
>
>
> On 2023-07-22 14:40, Legale Legale wrote:
>> ?From 071cfc2853dd7a4f9fb59a1650de8d5c874ce4f2 Mon Sep 17 00:00:00 2001
>> From:
>> Date: Sat, 22 Jul 2023 01:28:05 +0300
>> Subject: [PATCH] logread: add option to filter priority (log level)
>>
>> This adds an ability to filter log messages priority:
>> ???????? -v????? <log level>???? handle only messages with given log
>> level (0-7), repeatable
>> ???????? -V????? <log level>???? ignore messages with given log level
>> (0-7), repeatable


I think that a more normal approach would be same as with kernel log:
defining the minimum seriousness (max level), and printing the items more 
serious than that.

https://www.kernel.org/doc/html/next/core-api/printk-basics.html

 > The log level specifies the importance of a message. The kernel decides 
whether to show the message immediately (printing it to the current console) 
depending on its log level and the current console_loglevel (a kernel 
variable). If the message priority is higher (lower log level value) than the 
console_loglevel the message will be printed to the console.

Simiilar approach of "show log items at least as serious as X" (=loglevel 
0-X) would look more natural to me.

There might be also filtering by individual level (with repeatable options), 
but the use case is not that obvious.




From champetier.etienne at gmail.com  Tue Jul 25 01:10:12 2023
From: champetier.etienne at gmail.com (Etienne Champetier)
Date: Tue, 25 Jul 2023 10:10:12 +0200
Subject: [openwrt/openwrt] urngd: update to the latest master
In-Reply-To: <mailman.21315.1690272303.1880391.lede-commits@lists.infradead.org>
References: <169027229373.1891089.230579637704177444@git-01.infra.openwrt.org> <mailman.21315.1690272303.1880391.lede-commits@lists.infradead.org>
Message-ID: <CAOdf3gpsXm3fioqt2qvOVFVoQxz9q1Kp2kF3Exm8F=4GOY_7kQ@mail.gmail.com>

Hello Rafa?,

Le mar. 25 juil. 2023 ? 10:05, LEDE Commits
<lede-commits at lists.infradead.org> a ?crit :
>
> rmilecki pushed a commit to openwrt/openwrt.git, branch master:
> https://git.openwrt.org/c74b5e09e692839b39c8325b5f8dc5f2a3b3896c
>
> commit c74b5e09e692839b39c8325b5f8dc5f2a3b3896c
> Author: Rafa? Mi?ecki <rafal at milecki.pl>
> AuthorDate: Tue Jul 25 09:51:35 2023 +0200
>
>     urngd: update to the latest master

Is urngd still needed/relevant given the 'recent" improvements in
linux random generator ?

Best
Etienne


From robimarko at gmail.com  Tue Jul 25 03:27:56 2023
From: robimarko at gmail.com (Robert Marko)
Date: Tue, 25 Jul 2023 12:27:56 +0200
Subject: [PATCH v3 1/3] ipq40xx: image: limit kernel size for NOR devices
In-Reply-To: <20230724133027.9821-2-tmn505@terefe.re>
References: <20230724133027.9821-1-tmn505@terefe.re> <20230724133027.9821-2-tmn505@terefe.re>
Message-ID: <CAOX2RU4VU28+2no8H6umX+SzQNdL4Mkq8NnXHOJDQbJnuuhACQ@mail.gmail.com>

On Mon, 24 Jul 2023 at 15:31, Tomasz Maciej Nowak <tmn505 at terefe.re> wrote:
>
> From: Tomasz Maciej Nowak <tmn505 at gmail.com>
>
> 'bootipq' command on some devices, with kernel on NOR flash chip, read
> kernel partition size from Qualcomm proprietary partition table, which
> seems to be stored in MIBIB partition. The partition table can be read
> by 'smeminfo' command in U-Boot command line interface. Because this
> partition table is never updated on sysupgrade (even when the kernel
> size changes) kernel size is capped at initial value, usually 4MiB.
> Sysupgrading such kernel will soft-brick the device, which will need
> serial console for recovery. Some devices already suffer from this,
> beacuse its U-Boot does not allow to boot LZMA compressed kernel image
> and/or kernel zImage. Even some devices allowing to boot LZMA compressed
> kernel will hit this limitation later. Therefore limit the kernel size
> to 4MiB for devices not having it specified, so we won't create
> soft-bricking images.
>
> Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
> ---
>  target/linux/ipq40xx/image/generic.mk | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
> index f15463ae8ca5..d9d60a25ff0f 100644
> --- a/target/linux/ipq40xx/image/generic.mk
> +++ b/target/linux/ipq40xx/image/generic.mk
> @@ -130,6 +130,7 @@ define Device/8dev_habanero-dvk
>         DEVICE_VENDOR := 8devices
>         DEVICE_MODEL := Habanero DVK
>         IMAGE_SIZE := 30976k
> +       KERNEL_SIZE := 4096k

Habanero does not have a kernel size limit as its not using bootipq for booting.

Regards,
Robert
>         SOC := qcom-ipq4019
>         IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | append-rootfs | pad-rootfs | check-size | append-metadata
>  endef
> @@ -400,6 +401,7 @@ define Device/dlink_dap-2610
>         WRGG_DEVNAME := /dev/mtdblock/8
>         WRGG_SIGNATURE := wapac30_dkbs_dap2610
>         IMAGE_SIZE := 14080k
> +       KERNEL_SIZE := 4096k
>         IMAGES += factory.bin
>         # Bootloader expects a special 160 byte header which is added by
>         # wrgg-image.
> @@ -478,6 +480,7 @@ define Device/engenius_emd1
>         DEVICE_DTS_CONFIG := config at 4
>         SOC := qcom-ipq4018
>         IMAGE_SIZE := 30720k
> +       KERNEL_SIZE := 4096k
>         IMAGES += factory.bin
>         IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
>         IMAGE/factory.bin := qsdk-ipq-factory-nor | check-size
> @@ -800,6 +803,7 @@ define Device/netgear_ex61x0v2
>         NETGEAR_BOARD_ID := EX6150v2series
>         NETGEAR_HW_ID := 29765285+16+0+128+2x2
>         IMAGE_SIZE := 14400k
> +       KERNEL_SIZE := 4096k
>         SOC := qcom-ipq4018
>  endef
>
> @@ -954,6 +958,7 @@ define Device/pakedge_wr-1
>         SOC := qcom-ipq4018
>         BLOCKSIZE := 64k
>         IMAGE_SIZE := 31232k
> +       KERNEL_SIZE := 4096k
>         IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | append-metadata
>  endef
>  TARGET_DEVICES += pakedge_wr-1
> @@ -1030,6 +1035,7 @@ define Device/qxwlan_e2600ac-c1
>         BOARD_NAME := e2600ac-c1
>         SOC := qcom-ipq4019
>         IMAGE_SIZE := 31232k
> +       KERNEL_SIZE := 4096k
>         IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
>  endef
>  TARGET_DEVICES += qxwlan_e2600ac-c1
> @@ -1202,6 +1208,7 @@ define Device/zyxel_wre6606
>         DEVICE_DTS_CONFIG := config at 4
>         SOC := qcom-ipq4018
>         IMAGE_SIZE := 13184k
> +       KERNEL_SIZE := 4096k
>         IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | check-size | append-metadata
>         DEVICE_PACKAGES := -kmod-ath10k-ct kmod-ath10k-ct-smallbuffers
>  endef
> --
> 2.41.0
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


From fe at dev.tdt.de  Tue Jul 25 05:26:24 2023
From: fe at dev.tdt.de (Florian Eckert)
Date: Tue, 25 Jul 2023 14:26:24 +0200
Subject: [PATCH] build: replace SourceName with PKG_NAME
In-Reply-To: <20230725122624.3231282-1-fe@dev.tdt.de>
References: <20230725122624.3231282-1-fe@dev.tdt.de>
Message-ID: <20230725122624.3231282-2-fe@dev.tdt.de>

Currently, the same information is stored in the Packages.manifest in
the 'Package:' variable and also additionally in the 'SourceName:' variable.

Packages.manifest for strongswan-charon-cmd (before):
Package: strongswan-charon-cmd
Version: 5.9.11-1
...
SourceName: strongswan-charon-cmd
License: GPL-2.0-or-later
Section: net

This is not correct. Several install packages are built from the
strongswan source. Therefore it makes more sense that the source name is
really the source name. In this case it is 'strongswan' $PKG_NAME.

Packages.manifest for strongswan-charon-cmd (after):
Package: strongswan-charon-cmd
Version: 5.9.11-1
...
SourceName: strongswan
License: GPL-2.0-or-later
Section: net

Signed-off-by: Florian Eckert <fe at dev.tdt.de>
---
 include/package-ipkg.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk
index 0613fb8521eef324e06db338c78a82870079ffba..e3673bc27feb3b609a59c1a5168e78164e50dcb3 100644
--- a/include/package-ipkg.mk
+++ b/include/package-ipkg.mk
@@ -179,7 +179,7 @@ $$(call addfield,Depends,$$(Package/$(1)/DEPENDS)
 )$$(call addfield,Provides,$$(call mergelist,$$(filter-out $(1)$$(ABIV_$(1)),$(PROVIDES)$$(if $$(ABIV_$(1)), $(1) $(foreach provide,$(PROVIDES),$(provide)$$(ABIV_$(1))))))
 )$$(call addfield,Alternatives,$$(call mergelist,$(ALTERNATIVES))
 )$$(call addfield,Source,$(SOURCE)
-)$$(call addfield,SourceName,$(1)
+)$$(call addfield,SourceName,$(PKG_NAME)
 )$$(call addfield,License,$(LICENSE)
 )$$(call addfield,LicenseFiles,$(LICENSE_FILES)
 )$$(call addfield,Section,$(SECTION)
-- 



From fe at dev.tdt.de  Tue Jul 25 05:26:23 2023
From: fe at dev.tdt.de (Florian Eckert)
Date: Tue, 25 Jul 2023 14:26:23 +0200
Subject: [PATCH] build: replace SourceName with PKG_NAME
Message-ID: <20230725122624.3231282-1-fe@dev.tdt.de>

Currently, the same information is stored in the Packages.manifest in
the 'Package:' variable and also additionally in the 'SourceName:' variable.

Packages.manifest for strongswan-charon-cmd (before):

  Package: strongswan-charon-cmd
  Version: 5.9.11-1
  ...
  SourceName: strongswan-charon-cmd
  License: GPL-2.0-or-later
  Section: net

This is not correct. Several install packages are built from the
strongswan source. Therefore it makes more sense that the source name is
really the source name. In this case it is 'strongswan' $PKG_NAME.

Packages.manifest for strongswan-charon-cmd (after):

  Package: strongswan-charon-cmd
  Version: 5.9.11-1
  ...
  SourceName: strongswan
  License: GPL-2.0-or-later
  Section: net

Signed-off-by: Florian Eckert <fe at dev.tdt.de>
---
 include/package-ipkg.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk
index 3063a86a28..afa2b81eb9 100644
--- a/include/package-ipkg.mk
+++ b/include/package-ipkg.mk
@@ -179,7 +179,7 @@ $$(call addfield,Depends,$$(Package/$(1)/DEPENDS)
 )$$(call addfield,Provides,$$(call mergelist,$$(filter-out $(1)$$(ABIV_$(1)),$(PROVIDES)$$(if $$(ABIV_$(1)), $(1) $(foreach provide,$(PROVIDES),$(provide)$$(ABIV_$(1))))))
 )$$(call addfield,Alternatives,$$(call mergelist,$(ALTERNATIVES))
 )$$(call addfield,Source,$(SOURCE)
-)$$(call addfield,SourceName,$(1)
+)$$(call addfield,SourceName,$(PKG_NAME)
 )$$(call addfield,License,$(LICENSE)
 )$$(call addfield,LicenseFiles,$(LICENSE_FILES)
 )$$(call addfield,Section,$(SECTION)
-- 
2.30.2



From tmn505 at gmail.com  Tue Jul 25 10:16:25 2023
From: tmn505 at gmail.com (Tomasz Maciej Nowak)
Date: Tue, 25 Jul 2023 19:16:25 +0200
Subject: [PATCH v3 1/3] ipq40xx: image: limit kernel size for NOR devices
In-Reply-To: <CAOX2RU4VU28+2no8H6umX+SzQNdL4Mkq8NnXHOJDQbJnuuhACQ@mail.gmail.com>
References: <20230724133027.9821-1-tmn505@terefe.re>
 <20230724133027.9821-2-tmn505@terefe.re>
 <CAOX2RU4VU28+2no8H6umX+SzQNdL4Mkq8NnXHOJDQbJnuuhACQ@mail.gmail.com>
Message-ID: <213920f9-89ed-484e-2c25-505cf307a2d1@gmail.com>

W dniu 25.07.2023 o?12:27, Robert Marko pisze:
> On Mon, 24 Jul 2023 at 15:31, Tomasz Maciej Nowak <tmn505 at terefe.re> wrote:
>>
>> From: Tomasz Maciej Nowak <tmn505 at gmail.com>
>>
>> 'bootipq' command on some devices, with kernel on NOR flash chip, read
>> kernel partition size from Qualcomm proprietary partition table, which
>> seems to be stored in MIBIB partition. The partition table can be read
>> by 'smeminfo' command in U-Boot command line interface. Because this
>> partition table is never updated on sysupgrade (even when the kernel
>> size changes) kernel size is capped at initial value, usually 4MiB.
>> Sysupgrading such kernel will soft-brick the device, which will need
>> serial console for recovery. Some devices already suffer from this,
>> beacuse its U-Boot does not allow to boot LZMA compressed kernel image
>> and/or kernel zImage. Even some devices allowing to boot LZMA compressed
>> kernel will hit this limitation later. Therefore limit the kernel size
>> to 4MiB for devices not having it specified, so we won't create
>> soft-bricking images.
>>
>> Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
>> ---
>>  target/linux/ipq40xx/image/generic.mk | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
>> index f15463ae8ca5..d9d60a25ff0f 100644
>> --- a/target/linux/ipq40xx/image/generic.mk
>> +++ b/target/linux/ipq40xx/image/generic.mk
>> @@ -130,6 +130,7 @@ define Device/8dev_habanero-dvk
>>         DEVICE_VENDOR := 8devices
>>         DEVICE_MODEL := Habanero DVK
>>         IMAGE_SIZE := 30976k
>> +       KERNEL_SIZE := 4096k
> 
> Habanero does not have a kernel size limit as its not using bootipq for booting.

Thanks, I'll remove it from the patch in next iteration.

> 
> Regards,
> Robert

Regards

-- 
TMN



From rafal at milecki.pl  Wed Jul 26 01:45:44 2023
From: rafal at milecki.pl (=?UTF-8?Q?Rafa=C5=82_Mi=C5=82ecki?=)
Date: Wed, 26 Jul 2023 10:45:44 +0200
Subject: [openwrt/openwrt] urngd: update to the latest master
In-Reply-To: <CAOdf3gpsXm3fioqt2qvOVFVoQxz9q1Kp2kF3Exm8F=4GOY_7kQ@mail.gmail.com>
References: <169027229373.1891089.230579637704177444@git-01.infra.openwrt.org>
 <mailman.21315.1690272303.1880391.lede-commits@lists.infradead.org>
 <CAOdf3gpsXm3fioqt2qvOVFVoQxz9q1Kp2kF3Exm8F=4GOY_7kQ@mail.gmail.com>
Message-ID: <17dd4a5778352fb499d62d5c887d336e@milecki.pl>

On 2023-07-25 10:10, Etienne Champetier wrote:
>> commit c74b5e09e692839b39c8325b5f8dc5f2a3b3896c
>> Author: Rafa? Mi?ecki <rafal at milecki.pl>
>> AuthorDate: Tue Jul 25 09:51:35 2023 +0200
>> 
>>     urngd: update to the latest master
> 
> Is urngd still needed/relevant given the 'recent" improvements in
> linux random generator ?

Good question. To be honest I hit urng failing to initialize issue while
resolving multiple years-old BCM53753 regressions over last 2-3 weeks.


So before kernel 5.19 I really needed urng for BCM53753. Without urng it
took over 1,5 hour to initialize crng and start dropbear:
[ 6095.816238] crng init done
or:
[ 6158.675813] crng init done

That was related to the 29e170dbaac0 ("dropbear: bump to 2020.79") as
dropbear started using getrandom().


In kernel 5.19 we've received following random subsystem changes:
ac2ab99072cc ("Merge tag 'random-5.19-rc1-for-linus' of
git://git.kernel.org/pub/scm/linux/kernel/git/crng/random"):
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ac2ab99072cce553c78f326ea22d72856f570d88

For BCM53753 the critical change was commit ff8a8f59c99f ("arm: use
fallback for random_get_entropy() instead of zero"):
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ff8a8f59c99f6a7c656387addc4d9f2247d75077


Those random subsystem changes were later backported to stable kernel
releases (e.g. Linux 5.4.200). So for BCM53573 that may make urng
obsolete but I'm not sure about all other cases.


From yangshiji66 at outlook.com  Wed Jul 26 06:22:21 2023
From: yangshiji66 at outlook.com (Shiji Yang)
Date: Wed, 26 Jul 2023 21:22:21 +0800
Subject: [PATCH 0/2] rework MT7620 PA/LNA RF calibration
Message-ID: <TYAP286MB03153618B5F267F22F67F854BC00A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>

From: Shiji Yang <yangshiji66 at qq.com>

This series of patches introduces some fixes to the MT7620 wireless
calibration function:

* rework MT7620 PA/LNA RF calibration
* fix gpio pinmux function during calibration

Shiji Yang (2):
  mac80211: rework MT7620 PA/LNA RF calibration
  ramips: pinctrl: support requesting different functions for same group

 ...-rework-MT7620-PA-LNA-RF-calibration.patch | 312 ++++++++++++++++++
 ...upport-requesting-different-function.patch |  45 +++
 2 files changed, 357 insertions(+)
 create mode 100644 package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch
 create mode 100644 target/linux/ramips/patches-5.15/808-pinctrl-mtmips-support-requesting-different-function.patch

-- 
2.39.2



From yangshiji66 at outlook.com  Wed Jul 26 06:22:22 2023
From: yangshiji66 at outlook.com (Shiji Yang)
Date: Wed, 26 Jul 2023 21:22:22 +0800
Subject: [PATCH 1/2] mac80211: rework MT7620 PA/LNA RF calibration
In-Reply-To: <20230726132223.28294-1-yangshiji66@outlook.com>
References: <20230726132223.28294-1-yangshiji66@outlook.com>
Message-ID: <TYAP286MB031579E1EB23ED9ACF194373BC00A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>

From: Shiji Yang <yangshiji66 at qq.com>

This patch makes some improvements to the MT7620 RF calibration.

1. Move MT7620 PA/LNA calibration code to dedicated functions.
2. Restore RF and BBP registers before R-Calibration.
3. Do Rx DCOC calibration again before RXIQ calibration.
4. Correct MAC_RX_EN mask in rt2800_r_calibration()[1].

[1] This change may fix the "BBP/RF register access failed" error:
ieee80211 phy0: rt2800_wait_bbp_rf_ready: Error - BBP/RF register access failed, aborting

Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
---
 ...-rework-MT7620-PA-LNA-RF-calibration.patch | 312 ++++++++++++++++++
 1 file changed, 312 insertions(+)
 create mode 100644 package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch

diff --git a/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch b/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch
new file mode 100644
index 0000000000..0cf34f3a6c
--- /dev/null
+++ b/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch
@@ -0,0 +1,312 @@
+From: Shiji Yang <yangshiji66 at outlook.com>
+Date: Tue, 25 Jul 2023 20:05:06 +0800
+Subject: [PATCH] wifi: rt2x00: rework MT7620 PA/LNA RF calibration
+
+1. Move MT7620 PA/LNA calibration code to dedicated functions.
+   Calibration stage 1 is executed before configuring channels and
+   stage 2 is executed after configuring channels.
+2. For external PA/LNA devices, restore RF and BBP registers before
+   R-Calibration.
+3. Do Rx DCOC calibration again before RXIQ calibration.
+4. Correct MAC_SYS_CTRL register RX mask to 0x08 in R-Calibration
+   function. For MAC_SYS_CTRL register, Bit[2] controls MAC_TX_EN
+   and Bit[3] controls MAC_RX_EN (Bit index starts from 0).
+5. Adjust the register operation sequence according to the vendor
+   driver code. This may not be useful, but it can make things
+   clearer when developers try to review it.
+
+Signed-off-by: Shiji Yang <yangshiji66 at outlook.com>
+---
+ .../net/wireless/ralink/rt2x00/rt2800lib.c    | 220 ++++++++++++------
+ drivers/net/wireless/ralink/rt2x00/rt2x00.h   |   6 +
+ 2 files changed, 151 insertions(+), 75 deletions(-)
+
+--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+@@ -62,6 +62,9 @@ MODULE_PARM_DESC(watchdog, "Enable watch
+ 	rt2800_regbusy_read((__dev), H2M_MAILBOX_CSR, \
+ 			    H2M_MAILBOX_CSR_OWNER, (__reg))
+ 
++static void rt6352_init_palna_stage1(struct rt2x00_dev *rt2x00dev);
++static void rt6352_init_palna_stage2(struct rt2x00_dev *rt2x00dev);
++
+ static inline bool rt2800_is_305x_soc(struct rt2x00_dev *rt2x00dev)
+ {
+ 	/* check for rt2872 on SoC */
+@@ -4151,6 +4154,9 @@ static void rt2800_config_channel(struct
+ 			rt2800_txpower_to_dev(rt2x00dev, rf->channel,
+ 					      info->default_power3);
+ 
++	if (rt2x00_rt(rt2x00dev, RT6352))
++		rt6352_init_palna_stage1(rt2x00dev);
++
+ 	switch (rt2x00dev->chip.rt) {
+ 	case RT3883:
+ 		rt3883_bbp_adjust(rt2x00dev, rf);
+@@ -4482,66 +4488,6 @@ static void rt2800_config_channel(struct
+ 			rt2800_iq_calibrate(rt2x00dev, rf->channel);
+ 	}
+ 
+-	if (rt2x00_rt(rt2x00dev, RT6352)) {
+-		if (test_bit(CAPABILITY_EXTERNAL_PA_TX0,
+-			     &rt2x00dev->cap_flags)) {
+-			reg = rt2800_register_read(rt2x00dev, RF_CONTROL3);
+-			reg |= 0x00000101;
+-			rt2800_register_write(rt2x00dev, RF_CONTROL3, reg);
+-
+-			reg = rt2800_register_read(rt2x00dev, RF_BYPASS3);
+-			reg |= 0x00000101;
+-			rt2800_register_write(rt2x00dev, RF_BYPASS3, reg);
+-
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0x73);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0x73);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0x73);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0xC8);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xA4);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x05);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0xC8);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xA4);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x05);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x27);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0xC8);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xA4);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x05);
+-			rt2800_rfcsr_write_dccal(rt2x00dev, 05, 0x00);
+-
+-			rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT,
+-					      0x36303636);
+-			rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN,
+-					      0x6C6C6B6C);
+-			rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN,
+-					      0x6C6C6B6C);
+-		}
+-
+-		if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
+-			reg = rt2800_register_read(rt2x00dev, RF_CONTROL3);
+-			reg |= 0x00000101;
+-			rt2800_register_write(rt2x00dev, RF_CONTROL3, reg);
+-
+-			reg = rt2800_register_read(rt2x00dev, RF_BYPASS3);
+-			reg |= 0x00000101;
+-			rt2800_register_write(rt2x00dev, RF_BYPASS3, reg);
+-
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x42);
+-			rt2800_bbp_write(rt2x00dev, 75, 0x68);
+-			rt2800_bbp_write(rt2x00dev, 76, 0x4C);
+-			rt2800_bbp_write(rt2x00dev, 79, 0x1C);
+-			rt2800_bbp_write(rt2x00dev, 80, 0x0C);
+-			rt2800_bbp_write(rt2x00dev, 82, 0xB6);
+-			/* bank 0 RF reg 42 and glrt BBP reg 141 will be set in
+-			 * config channel function in dependence of channel and
+-			 * HT20/HT40 so don't touch it
+-			 */
+-		}
+-	}
+-
+ 	bbp = rt2800_bbp_read(rt2x00dev, 4);
+ 	rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * conf_is_ht40(conf));
+ 	rt2800_bbp_write(rt2x00dev, 4, bbp);
+@@ -4550,6 +4496,9 @@ static void rt2800_config_channel(struct
+ 	rt2x00_set_field8(&bbp, BBP3_HT40_MINUS, conf_is_ht40_minus(conf));
+ 	rt2800_bbp_write(rt2x00dev, 3, bbp);
+ 
++	if (rt2x00_rt(rt2x00dev, RT6352))
++		rt6352_init_palna_stage2(rt2x00dev);
++
+ 	if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860C)) {
+ 		if (conf_is_ht40(conf)) {
+ 			rt2800_bbp_write(rt2x00dev, 69, 0x1a);
+@@ -8650,7 +8599,7 @@ static void rt2800_r_calibration(struct
+ 		rt2x00_warn(rt2x00dev, "Wait MAC Tx Status to MAX !!!\n");
+ 
+ 	maccfg = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL);
+-	maccfg &= (~0x04);
++	maccfg &= (~0x08);
+ 	rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, maccfg);
+ 
+ 	if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY_RX)))
+@@ -10688,30 +10637,151 @@ static void rt2800_init_rfcsr_6352(struc
+ 		rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00);
+ 		rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C);
+ 	}
++}
+ 
+-	rt6352_enable_pa_pin(rt2x00dev, 0);
+-	rt2800_r_calibration(rt2x00dev);
+-	rt2800_rf_self_txdc_cal(rt2x00dev);
+-	rt2800_rxdcoc_calibration(rt2x00dev);
+-	rt2800_bw_filter_calibration(rt2x00dev, true);
+-	rt2800_bw_filter_calibration(rt2x00dev, false);
+-	rt2800_loft_iq_calibration(rt2x00dev);
+-	rt2800_rxiq_calibration(rt2x00dev);
+-	rt6352_enable_pa_pin(rt2x00dev, 1);
++static void rt6352_inint_ext_palna(struct rt2x00_dev *rt2x00dev)
++{
++	u32 reg;
++
++	if (rt2x00_has_cap_external_pa(rt2x00dev)) {
++		reg = rt2800_register_read(rt2x00dev, RF_CONTROL3);
++		reg |= 0x00000101;
++		rt2800_register_write(rt2x00dev, RF_CONTROL3, reg);
++
++		reg = rt2800_register_read(rt2x00dev, RF_BYPASS3);
++		reg |= 0x00000101;
++		rt2800_register_write(rt2x00dev, RF_BYPASS3, reg);
++	}
+ 
+-	if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1 &&
++		rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
+ 		rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66);
+ 		rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20);
+ 		rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x42);
++	}
++
++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1 &&
++		rt2x00_has_cap_external_pa(rt2x00dev)) {
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0x73);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0x73);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0x73);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0xC8);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xA4);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x05);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0xC8);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xA4);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x05);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x27);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0xC8);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xA4);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x05);
++	}
++
++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1 &&
++		rt2x00_has_cap_external_pa(rt2x00dev)) {
++		rt2800_rfcsr_write_dccal(rt2x00dev, 05, 0x00);
++	}
++
++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1 &&
++		rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
+ 		rt2800_bbp_write(rt2x00dev, 75, 0x68);
+ 		rt2800_bbp_write(rt2x00dev, 76, 0x4C);
+ 		rt2800_bbp_write(rt2x00dev, 79, 0x1C);
+ 		rt2800_bbp_write(rt2x00dev, 80, 0x0C);
+ 		rt2800_bbp_write(rt2x00dev, 82, 0xB6);
+-		/* bank 0 RF reg 42 and glrt BBP reg 141 will be set in config
+-		 * channel function in dependence of channel and HT20/HT40,
+-		 * so don't touch them here.
+-		 */
++	}
++
++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1 &&
++		rt2x00_has_cap_external_pa(rt2x00dev)) {
++		rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, 0x36303636);
++		rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6C6C6B6C);
++		rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 0x6C6C6B6C);
++	}
++}
++
++static void rt6352_restore_rf_bbp(struct rt2x00_dev *rt2x00dev)
++{
++	if (rt2x00_has_cap_external_pa(rt2x00dev)) {
++		rt2800_register_write(rt2x00dev, RF_CONTROL3, 0x0);
++		rt2800_register_write(rt2x00dev, RF_BYPASS3, 0x0);
++	}
++
++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1 &&
++		rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x23);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x02);
++	}
++
++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1 &&
++		rt2x00_has_cap_external_pa(rt2x00dev))
++	{
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0xD3);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0xB3);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0xD5);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x6C);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xFC);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x1F);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x66);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xFF);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x1C);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x20);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6B);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xF7);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x09);
++	}
++
++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1 &&
++		rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
++		rt2800_bbp_write(rt2x00dev, 75, 0x60);
++		rt2800_bbp_write(rt2x00dev, 76, 0x44);
++		rt2800_bbp_write(rt2x00dev, 79, 0x1C);
++		rt2800_bbp_write(rt2x00dev, 80, 0x0C);
++		rt2800_bbp_write(rt2x00dev, 82, 0xB6);
++	}
++
++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1
++		&& rt2x00_has_cap_external_pa(rt2x00dev)) {
++		rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, 0x3630363A);
++		rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6C6C666C);
++		rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 0x6C6C666C);
++	}
++}
++
++/* MT7620 PA/LNA initialization before switching channels */
++static void rt6352_init_palna_stage1(struct rt2x00_dev *rt2x00dev)
++{
++	if (rt2x00_has_cap_external_pa(rt2x00dev) ||
++		rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
++		rt6352_enable_pa_pin(rt2x00dev, 0);
++		rt6352_restore_rf_bbp(rt2x00dev);
++	}
++
++	rt2800_r_calibration(rt2x00dev);
++}
++
++/* MT7620 PA/LNA initialization after switching channels */
++static void rt6352_init_palna_stage2(struct rt2x00_dev *rt2x00dev)
++{
++	rt2800_rf_self_txdc_cal(rt2x00dev);
++	rt2800_rxdcoc_calibration(rt2x00dev);
++	rt2800_bw_filter_calibration(rt2x00dev, true);
++	rt2800_bw_filter_calibration(rt2x00dev, false);
++	rt2800_loft_iq_calibration(rt2x00dev);
++
++	/* missing DPD Calibration for devices using internal PA */
++
++	rt2800_rxdcoc_calibration(rt2x00dev);
++	rt2800_rxiq_calibration(rt2x00dev);
++
++	if(rt2x00_has_cap_external_pa(rt2x00dev) ||
++		rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
++		rt6352_enable_pa_pin(rt2x00dev, 1);
++		rt6352_inint_ext_palna(rt2x00dev);
+ 	}
+ }
+ 
+--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
+@@ -1277,6 +1277,12 @@ rt2x00_has_cap_external_lna_bg(struct rt
+ }
+ 
+ static inline bool
++rt2x00_has_cap_external_pa(struct rt2x00_dev *rt2x00dev)
++{
++	return rt2x00_has_cap_flag(rt2x00dev, CAPABILITY_EXTERNAL_PA_TX0);
++}
++
++static inline bool
+ rt2x00_has_cap_double_antenna(struct rt2x00_dev *rt2x00dev)
+ {
+ 	return rt2x00_has_cap_flag(rt2x00dev, CAPABILITY_DOUBLE_ANTENNA);
-- 
2.39.2



From yangshiji66 at outlook.com  Wed Jul 26 06:22:23 2023
From: yangshiji66 at outlook.com (Shiji Yang)
Date: Wed, 26 Jul 2023 21:22:23 +0800
Subject: [PATCH 2/2] ramips: pinctrl: support requesting different functions for same group
In-Reply-To: <20230726132223.28294-1-yangshiji66@outlook.com>
References: <20230726132223.28294-1-yangshiji66@outlook.com>
Message-ID: <TYAP286MB03150FC65F94A5ABA181B829BC00A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>

From: Shiji Yang <yangshiji66 at qq.com>

MT7620 wireless radio needs change the pin group function between
"gpio" and "pa" during the calibration process. However, ralink
pinctrl driver doesn't support requesting different functions for
the same group. This patch enables pinctrl consumers to perform
such operations.

Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
---
 ...upport-requesting-different-function.patch | 45 +++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 target/linux/ramips/patches-5.15/808-pinctrl-mtmips-support-requesting-different-function.patch

diff --git a/target/linux/ramips/patches-5.15/808-pinctrl-mtmips-support-requesting-different-function.patch b/target/linux/ramips/patches-5.15/808-pinctrl-mtmips-support-requesting-different-function.patch
new file mode 100644
index 0000000000..047808f1e6
--- /dev/null
+++ b/target/linux/ramips/patches-5.15/808-pinctrl-mtmips-support-requesting-different-function.patch
@@ -0,0 +1,45 @@
+From: Shiji Yang <yangshiji66 at outlook.com>
+Date: Wed, 26 Jul 2023 01:32:55 +0800
+Subject: [PATCH] pinctrl: mtmips: support requesting different functions for
+ same group
+
+Sometimes pinctrl consumers may request different functions for the
+same pin group in different situations. This patch can help to reset
+the group function flag when requesting a different function.
+
+Signed-off-by: Shiji Yang <yangshiji66 at outlook.com>
+---
+ drivers/pinctrl/ralink/pinctrl-ralink.c | 21 +++++++++++++++++----
+ 1 file changed, 17 insertions(+), 4 deletions(-)
+
+--- a/drivers/pinctrl/ralink/pinctrl-ralink.c
++++ b/drivers/pinctrl/ralink/pinctrl-ralink.c
+@@ -123,11 +123,24 @@ static int ralink_pmx_group_enable(struc
+ 	int i;
+ 	int shift;
+ 
+-	/* dont allow double use */
++	/*
++	 * for the same pin group, if request a different function,
++	 * then clear the group function flag and continue, else exit.
++	 */
+ 	if (p->groups[group].enabled) {
+-		dev_err(p->dev, "%s is already enabled\n",
+-			p->groups[group].name);
+-		return 0;
++		for (i = 0; i < p->groups[group].func_count; i++) {
++			if (p->groups[group].func[i].enabled == 1) {
++				if (!strcmp(p->func[func]->name,
++					p->groups[group].func[i].name))
++					return 0;
++				p->groups[group].func[i].enabled = 0;
++				break;
++			}
++		}
++
++		/* exit if request the "gpio" function again */
++		if (i == p->groups[group].func_count && func == 0)
++			return 0;
+ 	}
+ 
+ 	p->groups[group].enabled = 1;
-- 
2.39.2



From daniel at makrotopia.org  Wed Jul 26 06:49:08 2023
From: daniel at makrotopia.org (Daniel Golle)
Date: Wed, 26 Jul 2023 14:49:08 +0100
Subject: [PATCH 1/2] mac80211: rework MT7620 PA/LNA RF calibration
In-Reply-To: <TYAP286MB031579E1EB23ED9ACF194373BC00A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>
References: <20230726132223.28294-1-yangshiji66@outlook.com>
 <TYAP286MB031579E1EB23ED9ACF194373BC00A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>
Message-ID: <ZMEkVOMmrJctgtiW@makrotopia.org>

Hi!

Thank you for your contribution.
I (probably) found a minor typo, see below:

On Wed, Jul 26, 2023 at 09:22:22PM +0800, Shiji Yang wrote:
> From: Shiji Yang <yangshiji66 at qq.com>
> 
> This patch makes some improvements to the MT7620 RF calibration.
> 
> 1. Move MT7620 PA/LNA calibration code to dedicated functions.
> 2. Restore RF and BBP registers before R-Calibration.
> 3. Do Rx DCOC calibration again before RXIQ calibration.
> 4. Correct MAC_RX_EN mask in rt2800_r_calibration()[1].
> 
> [1] This change may fix the "BBP/RF register access failed" error:
> ieee80211 phy0: rt2800_wait_bbp_rf_ready: Error - BBP/RF register access failed, aborting
> 
> Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
> ---
>  ...-rework-MT7620-PA-LNA-RF-calibration.patch | 312 ++++++++++++++++++
>  1 file changed, 312 insertions(+)
>  create mode 100644 package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch
> 
> diff --git a/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch b/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch
> new file mode 100644
> index 0000000000..0cf34f3a6c
> --- /dev/null
> +++ b/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch
> @@ -0,0 +1,312 @@
> +From: Shiji Yang <yangshiji66 at outlook.com>
> +Date: Tue, 25 Jul 2023 20:05:06 +0800
> +Subject: [PATCH] wifi: rt2x00: rework MT7620 PA/LNA RF calibration
> +
> +1. Move MT7620 PA/LNA calibration code to dedicated functions.
> +   Calibration stage 1 is executed before configuring channels and
> +   stage 2 is executed after configuring channels.
> +2. For external PA/LNA devices, restore RF and BBP registers before
> +   R-Calibration.
> +3. Do Rx DCOC calibration again before RXIQ calibration.
> +4. Correct MAC_SYS_CTRL register RX mask to 0x08 in R-Calibration
> +   function. For MAC_SYS_CTRL register, Bit[2] controls MAC_TX_EN
> +   and Bit[3] controls MAC_RX_EN (Bit index starts from 0).
> +5. Adjust the register operation sequence according to the vendor
> +   driver code. This may not be useful, but it can make things
> +   clearer when developers try to review it.
> +
> +Signed-off-by: Shiji Yang <yangshiji66 at outlook.com>
> +---
> + .../net/wireless/ralink/rt2x00/rt2800lib.c    | 220 ++++++++++++------
> + drivers/net/wireless/ralink/rt2x00/rt2x00.h   |   6 +
> + 2 files changed, 151 insertions(+), 75 deletions(-)
> +
> +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
> +@@ -62,6 +62,9 @@ MODULE_PARM_DESC(watchdog, "Enable watch
> + 	rt2800_regbusy_read((__dev), H2M_MAILBOX_CSR, \
> + 			    H2M_MAILBOX_CSR_OWNER, (__reg))
> + 
> ++static void rt6352_init_palna_stage1(struct rt2x00_dev *rt2x00dev);
> ++static void rt6352_init_palna_stage2(struct rt2x00_dev *rt2x00dev);
> ++
> + static inline bool rt2800_is_305x_soc(struct rt2x00_dev *rt2x00dev)
> + {
> + 	/* check for rt2872 on SoC */
> +@@ -4151,6 +4154,9 @@ static void rt2800_config_channel(struct
> + 			rt2800_txpower_to_dev(rt2x00dev, rf->channel,
> + 					      info->default_power3);
> + 
> ++	if (rt2x00_rt(rt2x00dev, RT6352))
> ++		rt6352_init_palna_stage1(rt2x00dev);
> ++
> + 	switch (rt2x00dev->chip.rt) {
> + 	case RT3883:
> + 		rt3883_bbp_adjust(rt2x00dev, rf);
> +@@ -4482,66 +4488,6 @@ static void rt2800_config_channel(struct
> + 			rt2800_iq_calibrate(rt2x00dev, rf->channel);
> + 	}
> + 
> +-	if (rt2x00_rt(rt2x00dev, RT6352)) {
> +-		if (test_bit(CAPABILITY_EXTERNAL_PA_TX0,
> +-			     &rt2x00dev->cap_flags)) {
> +-			reg = rt2800_register_read(rt2x00dev, RF_CONTROL3);
> +-			reg |= 0x00000101;
> +-			rt2800_register_write(rt2x00dev, RF_CONTROL3, reg);
> +-
> +-			reg = rt2800_register_read(rt2x00dev, RF_BYPASS3);
> +-			reg |= 0x00000101;
> +-			rt2800_register_write(rt2x00dev, RF_BYPASS3, reg);
> +-
> +-			rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0x73);
> +-			rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0x73);
> +-			rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0x73);
> +-			rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27);
> +-			rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0xC8);
> +-			rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xA4);
> +-			rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x05);
> +-			rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27);
> +-			rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0xC8);
> +-			rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xA4);
> +-			rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x05);
> +-			rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x27);
> +-			rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0xC8);
> +-			rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xA4);
> +-			rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x05);
> +-			rt2800_rfcsr_write_dccal(rt2x00dev, 05, 0x00);
> +-
> +-			rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT,
> +-					      0x36303636);
> +-			rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN,
> +-					      0x6C6C6B6C);
> +-			rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN,
> +-					      0x6C6C6B6C);
> +-		}
> +-
> +-		if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
> +-			reg = rt2800_register_read(rt2x00dev, RF_CONTROL3);
> +-			reg |= 0x00000101;
> +-			rt2800_register_write(rt2x00dev, RF_CONTROL3, reg);
> +-
> +-			reg = rt2800_register_read(rt2x00dev, RF_BYPASS3);
> +-			reg |= 0x00000101;
> +-			rt2800_register_write(rt2x00dev, RF_BYPASS3, reg);
> +-
> +-			rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66);
> +-			rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20);
> +-			rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x42);
> +-			rt2800_bbp_write(rt2x00dev, 75, 0x68);
> +-			rt2800_bbp_write(rt2x00dev, 76, 0x4C);
> +-			rt2800_bbp_write(rt2x00dev, 79, 0x1C);
> +-			rt2800_bbp_write(rt2x00dev, 80, 0x0C);
> +-			rt2800_bbp_write(rt2x00dev, 82, 0xB6);
> +-			/* bank 0 RF reg 42 and glrt BBP reg 141 will be set in
> +-			 * config channel function in dependence of channel and
> +-			 * HT20/HT40 so don't touch it
> +-			 */
> +-		}
> +-	}
> +-
> + 	bbp = rt2800_bbp_read(rt2x00dev, 4);
> + 	rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * conf_is_ht40(conf));
> + 	rt2800_bbp_write(rt2x00dev, 4, bbp);
> +@@ -4550,6 +4496,9 @@ static void rt2800_config_channel(struct
> + 	rt2x00_set_field8(&bbp, BBP3_HT40_MINUS, conf_is_ht40_minus(conf));
> + 	rt2800_bbp_write(rt2x00dev, 3, bbp);
> + 
> ++	if (rt2x00_rt(rt2x00dev, RT6352))
> ++		rt6352_init_palna_stage2(rt2x00dev);
> ++
> + 	if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860C)) {
> + 		if (conf_is_ht40(conf)) {
> + 			rt2800_bbp_write(rt2x00dev, 69, 0x1a);
> +@@ -8650,7 +8599,7 @@ static void rt2800_r_calibration(struct
> + 		rt2x00_warn(rt2x00dev, "Wait MAC Tx Status to MAX !!!\n");
> + 
> + 	maccfg = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL);
> +-	maccfg &= (~0x04);
> ++	maccfg &= (~0x08);
> + 	rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, maccfg);
> + 
> + 	if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY_RX)))
> +@@ -10688,30 +10637,151 @@ static void rt2800_init_rfcsr_6352(struc
> + 		rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00);
> + 		rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C);
> + 	}
> ++}
> + 
> +-	rt6352_enable_pa_pin(rt2x00dev, 0);
> +-	rt2800_r_calibration(rt2x00dev);
> +-	rt2800_rf_self_txdc_cal(rt2x00dev);
> +-	rt2800_rxdcoc_calibration(rt2x00dev);
> +-	rt2800_bw_filter_calibration(rt2x00dev, true);
> +-	rt2800_bw_filter_calibration(rt2x00dev, false);
> +-	rt2800_loft_iq_calibration(rt2x00dev);
> +-	rt2800_rxiq_calibration(rt2x00dev);
> +-	rt6352_enable_pa_pin(rt2x00dev, 1);
> ++static void rt6352_inint_ext_palna(struct rt2x00_dev *rt2x00dev)

'inint' should probably be 'init' (?)

> ++{
> ++	u32 reg;
> ++
> ++	if (rt2x00_has_cap_external_pa(rt2x00dev)) {
> ++		reg = rt2800_register_read(rt2x00dev, RF_CONTROL3);
> ++		reg |= 0x00000101;
> ++		rt2800_register_write(rt2x00dev, RF_CONTROL3, reg);
> ++
> ++		reg = rt2800_register_read(rt2x00dev, RF_BYPASS3);
> ++		reg |= 0x00000101;
> ++		rt2800_register_write(rt2x00dev, RF_BYPASS3, reg);
> ++	}
> + 
> +-	if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
> ++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1 &&
> ++		rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
> + 		rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66);
> + 		rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20);
> + 		rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x42);
> ++	}
> ++
> ++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1 &&
> ++		rt2x00_has_cap_external_pa(rt2x00dev)) {
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0x73);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0x73);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0x73);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0xC8);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xA4);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x05);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0xC8);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xA4);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x05);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x27);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0xC8);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xA4);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x05);
> ++	}
> ++
> ++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1 &&
> ++		rt2x00_has_cap_external_pa(rt2x00dev)) {
> ++		rt2800_rfcsr_write_dccal(rt2x00dev, 05, 0x00);
> ++	}
> ++
> ++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1 &&
> ++		rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
> + 		rt2800_bbp_write(rt2x00dev, 75, 0x68);
> + 		rt2800_bbp_write(rt2x00dev, 76, 0x4C);
> + 		rt2800_bbp_write(rt2x00dev, 79, 0x1C);
> + 		rt2800_bbp_write(rt2x00dev, 80, 0x0C);
> + 		rt2800_bbp_write(rt2x00dev, 82, 0xB6);
> +-		/* bank 0 RF reg 42 and glrt BBP reg 141 will be set in config
> +-		 * channel function in dependence of channel and HT20/HT40,
> +-		 * so don't touch them here.
> +-		 */
> ++	}
> ++
> ++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1 &&
> ++		rt2x00_has_cap_external_pa(rt2x00dev)) {
> ++		rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, 0x36303636);
> ++		rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6C6C6B6C);
> ++		rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 0x6C6C6B6C);
> ++	}
> ++}
> ++
> ++static void rt6352_restore_rf_bbp(struct rt2x00_dev *rt2x00dev)
> ++{
> ++	if (rt2x00_has_cap_external_pa(rt2x00dev)) {
> ++		rt2800_register_write(rt2x00dev, RF_CONTROL3, 0x0);
> ++		rt2800_register_write(rt2x00dev, RF_BYPASS3, 0x0);
> ++	}
> ++
> ++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1 &&
> ++		rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x23);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x02);
> ++	}
> ++
> ++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1 &&
> ++		rt2x00_has_cap_external_pa(rt2x00dev))
> ++	{
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0xD3);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0xB3);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0xD5);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x6C);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xFC);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x1F);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x66);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xFF);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x1C);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x20);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6B);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xF7);
> ++		rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x09);
> ++	}
> ++
> ++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1 &&
> ++		rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
> ++		rt2800_bbp_write(rt2x00dev, 75, 0x60);
> ++		rt2800_bbp_write(rt2x00dev, 76, 0x44);
> ++		rt2800_bbp_write(rt2x00dev, 79, 0x1C);
> ++		rt2800_bbp_write(rt2x00dev, 80, 0x0C);
> ++		rt2800_bbp_write(rt2x00dev, 82, 0xB6);
> ++	}
> ++
> ++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1
> ++		&& rt2x00_has_cap_external_pa(rt2x00dev)) {
> ++		rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, 0x3630363A);
> ++		rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6C6C666C);
> ++		rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 0x6C6C666C);
> ++	}
> ++}
> ++
> ++/* MT7620 PA/LNA initialization before switching channels */
> ++static void rt6352_init_palna_stage1(struct rt2x00_dev *rt2x00dev)
> ++{
> ++	if (rt2x00_has_cap_external_pa(rt2x00dev) ||
> ++		rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
> ++		rt6352_enable_pa_pin(rt2x00dev, 0);
> ++		rt6352_restore_rf_bbp(rt2x00dev);
> ++	}
> ++
> ++	rt2800_r_calibration(rt2x00dev);
> ++}
> ++
> ++/* MT7620 PA/LNA initialization after switching channels */
> ++static void rt6352_init_palna_stage2(struct rt2x00_dev *rt2x00dev)
> ++{
> ++	rt2800_rf_self_txdc_cal(rt2x00dev);
> ++	rt2800_rxdcoc_calibration(rt2x00dev);
> ++	rt2800_bw_filter_calibration(rt2x00dev, true);
> ++	rt2800_bw_filter_calibration(rt2x00dev, false);
> ++	rt2800_loft_iq_calibration(rt2x00dev);
> ++
> ++	/* missing DPD Calibration for devices using internal PA */
> ++
> ++	rt2800_rxdcoc_calibration(rt2x00dev);
> ++	rt2800_rxiq_calibration(rt2x00dev);
> ++
> ++	if(rt2x00_has_cap_external_pa(rt2x00dev) ||
> ++		rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
> ++		rt6352_enable_pa_pin(rt2x00dev, 1);
> ++		rt6352_inint_ext_palna(rt2x00dev);
> + 	}
> + }
> + 
> +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
> ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
> +@@ -1277,6 +1277,12 @@ rt2x00_has_cap_external_lna_bg(struct rt
> + }
> + 
> + static inline bool
> ++rt2x00_has_cap_external_pa(struct rt2x00_dev *rt2x00dev)
> ++{
> ++	return rt2x00_has_cap_flag(rt2x00dev, CAPABILITY_EXTERNAL_PA_TX0);
> ++}
> ++
> ++static inline bool
> + rt2x00_has_cap_double_antenna(struct rt2x00_dev *rt2x00dev)
> + {
> + 	return rt2x00_has_cap_flag(rt2x00dev, CAPABILITY_DOUBLE_ANTENNA);
> -- 
> 2.39.2
> 


From yangshiji66 at outlook.com  Wed Jul 26 07:57:08 2023
From: yangshiji66 at outlook.com (=?utf-8?B?5p2oIOS4luWfug==?=)
Date: Wed, 26 Jul 2023 14:57:08 +0000
Subject: =?utf-8?B?5Zue5aSNOiBbUEFUQ0ggMS8yXSBtYWM4MDIxMTogcmV3b3JrIE1UNzYyMCBQ?=
 =?utf-8?Q?A/LNA_RF_calibration?=
In-Reply-To: <ZMEkVOMmrJctgtiW@makrotopia.org>
References: <20230726132223.28294-1-yangshiji66@outlook.com>
 <TYAP286MB031579E1EB23ED9ACF194373BC00A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>
 <ZMEkVOMmrJctgtiW@makrotopia.org>
Message-ID: <TYAP286MB0315D33AE9D7FCF200868F9FBC00A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>

Thanks for your review!

on July 26, 2023, 1:49 p.m. UTC, Daniel Golle wrote:
>Hi!
>
>Thank you for your contribution.
>I (probably) found a minor typo, see below:
>
>On Wed, Jul 26, 2023 at 09:22:22PM +0800, Shiji Yang wrote:
>> From: Shiji Yang <yangshiji66 at qq.com>
>> 
>> This patch makes some improvements to the MT7620 RF calibration.
>> 
>> 1. Move MT7620 PA/LNA calibration code to dedicated functions.
>> 2. Restore RF and BBP registers before R-Calibration.
>> 3. Do Rx DCOC calibration again before RXIQ calibration.
>> 4. Correct MAC_RX_EN mask in rt2800_r_calibration()[1].
>> 
>> [1] This change may fix the "BBP/RF register access failed" error:
>> ieee80211 phy0: rt2800_wait_bbp_rf_ready: Error - BBP/RF register access failed, aborting
>> 
>> Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
>> ---
>>? ...-rework-MT7620-PA-LNA-RF-calibration.patch | 312 ++++++++++++++++++
>>? 1 file changed, 312 insertions(+)
>>? create mode 100644 package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch
>> 
>> diff --git a/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch b/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch
>> new file mode 100644
>> index 0000000000..0cf34f3a6c
>> +@@ -10688,30 +10637,151 @@ static void rt2800_init_rfcsr_6352(struc
>> +????????????? rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00);
>> +????????????? rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C);
>> +????? }
>> ++}
>> + 
>> +-??? rt6352_enable_pa_pin(rt2x00dev, 0);
>> +-??? rt2800_r_calibration(rt2x00dev);
>> +-??? rt2800_rf_self_txdc_cal(rt2x00dev);
>> +-??? rt2800_rxdcoc_calibration(rt2x00dev);
>> +-??? rt2800_bw_filter_calibration(rt2x00dev, true);
>> +-??? rt2800_bw_filter_calibration(rt2x00dev, false);
>> +-??? rt2800_loft_iq_calibration(rt2x00dev);
>> +-??? rt2800_rxiq_calibration(rt2x00dev);
>> +-??? rt6352_enable_pa_pin(rt2x00dev, 1);
>> ++static void rt6352_inint_ext_palna(struct rt2x00_dev *rt2x00dev)
>
>'inint' should probably be 'init' (?)


Yes, you are right. It should be 'init'.


>> ++/* MT7620 PA/LNA initialization after switching channels */
>> ++static void rt6352_init_palna_stage2(struct rt2x00_dev *rt2x00dev)
>> ++{
>> ++??? rt2800_rf_self_txdc_cal(rt2x00dev);
>> ++??? rt2800_rxdcoc_calibration(rt2x00dev);
>> ++??? rt2800_bw_filter_calibration(rt2x00dev, true);
>> ++??? rt2800_bw_filter_calibration(rt2x00dev, false);
>> ++??? rt2800_loft_iq_calibration(rt2x00dev);
>> ++
>> ++??? /* missing DPD Calibration for devices using internal PA */
>> ++
>> ++??? rt2800_rxdcoc_calibration(rt2x00dev);
>> ++??? rt2800_rxiq_calibration(rt2x00dev);
>> ++
>> ++??? if(rt2x00_has_cap_external_pa(rt2x00dev) ||
>> ++??????????? rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
>> ++??????????? rt6352_enable_pa_pin(rt2x00dev, 1);
>> ++??????????? rt6352_inint_ext_palna(rt2x00dev);


And same typo error 'inint' here.

Do I need to send a v2 version to fix it? Or maybe you would like to
manually edit it to avoid too many emails?

Best Regards,
Shiji Yang

From yangshiji66 at outlook.com  Wed Jul 26 08:39:06 2023
From: yangshiji66 at outlook.com (=?gb2312?B?0e4gysC7+Q==?=)
Date: Wed, 26 Jul 2023 15:39:06 +0000
Subject: [PATCH 1/2] mac80211: rework MT7620 PA/LNA RF calibration
In-Reply-To: <ZME2NT5FjwackzQ8@makrotopia.org>
References: <20230726132223.28294-1-yangshiji66@outlook.com>
 <TYAP286MB031579E1EB23ED9ACF194373BC00A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>
 <ZMEkVOMmrJctgtiW@makrotopia.org>
 <TYAP286MB0315D33AE9D7FCF200868F9FBC00A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>
 <ZME2NT5FjwackzQ8@makrotopia.org>
Message-ID: <TYAP286MB031596D2378CFF479C5F3841BC00A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>

>On Wed, Jul 26, 2023 at 02:57:08PM +0000, ? ?? wrote:
>> Thanks for your review!
>>
>> on July 26, 2023, 1:49 p.m. UTC, Daniel Golle wrote:
>> >Hi!
>> >
>> >Thank you for your contribution.
>> >I (probably) found a minor typo, see below:
>> >
>> >On Wed, Jul 26, 2023 at 09:22:22PM +0800, Shiji Yang wrote:
>> >> From: Shiji Yang <yangshiji66 at qq.com>
>> >>
>> >> This patch makes some improvements to the MT7620 RF calibration.
>> >>
>> >> 1. Move MT7620 PA/LNA calibration code to dedicated functions.
>> >> 2. Restore RF and BBP registers before R-Calibration.
>> >> 3. Do Rx DCOC calibration again before RXIQ calibration.
>> >> 4. Correct MAC_RX_EN mask in rt2800_r_calibration()[1].
>> >>
>> >> [1] This change may fix the "BBP/RF register access failed" error:
>> >> ieee80211 phy0: rt2800_wait_bbp_rf_ready: Error - BBP/RF register access failed, aborting
>> >>
>> >> Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
>> >> ---
>> >>  ...-rework-MT7620-PA-LNA-RF-calibration.patch | 312 ++++++++++++++++++
>> >>  1 file changed, 312 insertions(+)
>> >>  create mode 100644 package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch
>> >>
>> >> diff --git a/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch b/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch
>> >> new file mode 100644
>> >> index 0000000000..0cf34f3a6c
>> >> +@@ -10688,30 +10637,151 @@ static void rt2800_init_rfcsr_6352(struc
>> >> +              rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00);
>> >> +              rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C);
>> >> +      }
>> >> ++}
>> >> +
>> >> +-    rt6352_enable_pa_pin(rt2x00dev, 0);
>> >> +-    rt2800_r_calibration(rt2x00dev);
>> >> +-    rt2800_rf_self_txdc_cal(rt2x00dev);
>> >> +-    rt2800_rxdcoc_calibration(rt2x00dev);
>> >> +-    rt2800_bw_filter_calibration(rt2x00dev, true);
>> >> +-    rt2800_bw_filter_calibration(rt2x00dev, false);
>> >> +-    rt2800_loft_iq_calibration(rt2x00dev);
>> >> +-    rt2800_rxiq_calibration(rt2x00dev);
>> >> +-    rt6352_enable_pa_pin(rt2x00dev, 1);
>> >> ++static void rt6352_inint_ext_palna(struct rt2x00_dev *rt2x00dev)
>> >
>> >'inint' should probably be 'init' (?)
>>
>>
>> Yes, you are right. It should be 'init'.
>>
>>
>> >> ++/* MT7620 PA/LNA initialization after switching channels */
>> >> ++static void rt6352_init_palna_stage2(struct rt2x00_dev *rt2x00dev)
>> >> ++{
>> >> ++    rt2800_rf_self_txdc_cal(rt2x00dev);
>> >> ++    rt2800_rxdcoc_calibration(rt2x00dev);
>> >> ++    rt2800_bw_filter_calibration(rt2x00dev, true);
>> >> ++    rt2800_bw_filter_calibration(rt2x00dev, false);
>> >> ++    rt2800_loft_iq_calibration(rt2x00dev);
>> >> ++
>> >> ++    /* missing DPD Calibration for devices using internal PA */
>> >> ++
>> >> ++    rt2800_rxdcoc_calibration(rt2x00dev);
>> >> ++    rt2800_rxiq_calibration(rt2x00dev);
>> >> ++
>> >> ++    if(rt2x00_has_cap_external_pa(rt2x00dev) ||
>> >> ++            rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
>> >> ++            rt6352_enable_pa_pin(rt2x00dev, 1);
>> >> ++            rt6352_inint_ext_palna(rt2x00dev);
>>
>>
>> And same typo error 'inint' here.
>>
>> Do I need to send a v2 version to fix it? Or maybe you would like to
>> manually edit it to avoid too many emails?
>
>The best would be you'd give it a day for further reviews from others,
>and then send v2 with all comments up to this point fixed.
>
>To me this looks good, and I hope you will also send this and your
>previous patch for rt2x00 to the linux-wireless mailing list to have
>it included upstream.
>
>Thank you again for your work!
>
>>
>> Best Regards,
>> Shiji Yang

Thanks, I'll definitely send them to Linux mailing lists later. But
before that, I have to confirm that they are fully compatible with
upstream version, as we have a lot of local patches.

By the way, I have sent the patch[2/2] to the upstream:
https://lore.kernel.org/all/TYAP286MB0315A9671B4BA0347E70D9E0BC00A at TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM/

I will send the v2 version this weekend.

Regards
Shiji Yang

From daniel at makrotopia.org  Wed Jul 26 08:05:25 2023
From: daniel at makrotopia.org (Daniel Golle)
Date: Wed, 26 Jul 2023 16:05:25 +0100
Subject: =?utf-8?B?5Zue5aSN?= =?utf-8?Q?=3A?= [PATCH 1/2] mac80211:
 rework MT7620 PA/LNA RF calibration
In-Reply-To: <TYAP286MB0315D33AE9D7FCF200868F9FBC00A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>
References: <20230726132223.28294-1-yangshiji66@outlook.com>
 <TYAP286MB031579E1EB23ED9ACF194373BC00A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>
 <ZMEkVOMmrJctgtiW@makrotopia.org>
 <TYAP286MB0315D33AE9D7FCF200868F9FBC00A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>
Message-ID: <ZME2NT5FjwackzQ8@makrotopia.org>

On Wed, Jul 26, 2023 at 02:57:08PM +0000, ? ?? wrote:
> Thanks for your review!
> 
> on July 26, 2023, 1:49 p.m. UTC, Daniel Golle wrote:
> >Hi!
> >
> >Thank you for your contribution.
> >I (probably) found a minor typo, see below:
> >
> >On Wed, Jul 26, 2023 at 09:22:22PM +0800, Shiji Yang wrote:
> >> From: Shiji Yang <yangshiji66 at qq.com>
> >> 
> >> This patch makes some improvements to the MT7620 RF calibration.
> >> 
> >> 1. Move MT7620 PA/LNA calibration code to dedicated functions.
> >> 2. Restore RF and BBP registers before R-Calibration.
> >> 3. Do Rx DCOC calibration again before RXIQ calibration.
> >> 4. Correct MAC_RX_EN mask in rt2800_r_calibration()[1].
> >> 
> >> [1] This change may fix the "BBP/RF register access failed" error:
> >> ieee80211 phy0: rt2800_wait_bbp_rf_ready: Error - BBP/RF register access failed, aborting
> >> 
> >> Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
> >> ---
> >>? ...-rework-MT7620-PA-LNA-RF-calibration.patch | 312 ++++++++++++++++++
> >>? 1 file changed, 312 insertions(+)
> >>? create mode 100644 package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch
> >> 
> >> diff --git a/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch b/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch
> >> new file mode 100644
> >> index 0000000000..0cf34f3a6c
> >> +@@ -10688,30 +10637,151 @@ static void rt2800_init_rfcsr_6352(struc
> >> +????????????? rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00);
> >> +????????????? rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C);
> >> +????? }
> >> ++}
> >> + 
> >> +-??? rt6352_enable_pa_pin(rt2x00dev, 0);
> >> +-??? rt2800_r_calibration(rt2x00dev);
> >> +-??? rt2800_rf_self_txdc_cal(rt2x00dev);
> >> +-??? rt2800_rxdcoc_calibration(rt2x00dev);
> >> +-??? rt2800_bw_filter_calibration(rt2x00dev, true);
> >> +-??? rt2800_bw_filter_calibration(rt2x00dev, false);
> >> +-??? rt2800_loft_iq_calibration(rt2x00dev);
> >> +-??? rt2800_rxiq_calibration(rt2x00dev);
> >> +-??? rt6352_enable_pa_pin(rt2x00dev, 1);
> >> ++static void rt6352_inint_ext_palna(struct rt2x00_dev *rt2x00dev)
> >
> >'inint' should probably be 'init' (?)
> 
> 
> Yes, you are right. It should be 'init'.
> 
> 
> >> ++/* MT7620 PA/LNA initialization after switching channels */
> >> ++static void rt6352_init_palna_stage2(struct rt2x00_dev *rt2x00dev)
> >> ++{
> >> ++??? rt2800_rf_self_txdc_cal(rt2x00dev);
> >> ++??? rt2800_rxdcoc_calibration(rt2x00dev);
> >> ++??? rt2800_bw_filter_calibration(rt2x00dev, true);
> >> ++??? rt2800_bw_filter_calibration(rt2x00dev, false);
> >> ++??? rt2800_loft_iq_calibration(rt2x00dev);
> >> ++
> >> ++??? /* missing DPD Calibration for devices using internal PA */
> >> ++
> >> ++??? rt2800_rxdcoc_calibration(rt2x00dev);
> >> ++??? rt2800_rxiq_calibration(rt2x00dev);
> >> ++
> >> ++??? if(rt2x00_has_cap_external_pa(rt2x00dev) ||
> >> ++??????????? rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
> >> ++??????????? rt6352_enable_pa_pin(rt2x00dev, 1);
> >> ++??????????? rt6352_inint_ext_palna(rt2x00dev);
> 
> 
> And same typo error 'inint' here.
> 
> Do I need to send a v2 version to fix it? Or maybe you would like to
> manually edit it to avoid too many emails?

The best would be you'd give it a day for further reviews from others,
and then send v2 with all comments up to this point fixed.

To me this looks good, and I hope you will also send this and your
previous patch for rt2x00 to the linux-wireless mailing list to have
it included upstream.

Thank you again for your work!

> 
> Best Regards,
> Shiji Yang


From janusz.dziedzic at gmail.com  Wed Jul 26 10:24:21 2023
From: janusz.dziedzic at gmail.com (Janusz Dziedzic)
Date: Wed, 26 Jul 2023 19:24:21 +0200
Subject: Wifi MLO UCI config
Message-ID: <CAFED-jmFiX2F-jXoinrn_etyvhyqyUMuTfn=hkViw_QG7Y7KgQ@mail.gmail.com>

Hello,

Do you have some ideas how UCI wifi config should look like for MLO config.
In such case we could see smth like:

root at test:/# iw dev
phy#0
    Interface wlan0
        ifindex 21
        wdev 0x5
        addr 00:03:7f:12:19:19
        ssid TEST-MLO
        type AP
        link 0:
                     addr 00:03:7f:12:19:19
                     channel 11 (2462 MHz), width: 20 MHz, center1: 2462 MHz
                     txpower 29.00 dBm
        link 1:
                     addr 00:03:7f:12:1a:1a
                     channel 36 (5180 MHz), width: 80 MHz, center1: 5210 MHz
                     txpower 28.00 dBm
        link 2:
                     addr 00:03:7f:12:1b:1b
                     channel 49 (6195 MHz), width: 320 MHz, center1: 6265 MHz
                    txpower 22.00 dBm

root at test:/#

Seems for MLO single wiphy (multiband wiphy) will be used and single
netdev wlan0 per ssid with multiple band also.
Curious if someone already work on that and have some ideas how the
wifi UCI config should looks like? Stay with current
wifi-device/wifi-interface sections and add some additional options?
Or introduce smth new - that will be closer to real iw tree?

I just think about:

conifg wifi-device 'radio0'
   option type 'mac80211'
   option path 'some_path'

config wifi-interface 'iface0'
   option device 'radio0'
   option ifname 'wlan0'

config wifi-link
    option band '2g'
    option interface 'iface0'
    option channel '11'
    option mode 'EHT20'

config wifi-link
    option band '5g'
    option interface 'iface0'
    option channel '36'
    option mode 'EHT80'

config wifi-link
    option band '6g'
    option interface 'iface0'
    option channel '49'
    option mode 'EHT320'

If no config wifi-link - then wifi-device config should be used for
interface (band/channel/htmode).
Any idea what is best/better approach here?

BR
Janusz


From philipp_subx at redfish-solutions.com  Wed Jul 26 16:26:56 2023
From: philipp_subx at redfish-solutions.com (Philip Prindeville)
Date: Wed, 26 Jul 2023 17:26:56 -0600
Subject: Towards a unified /etc/config/dhcp
Message-ID: <2CE32C31-63D4-48E0-8418-B8406F077486@redfish-solutions.com>

I'm the maintainer of ISC-DHCP which will be sunsetting soon.  I'd like to take the UCI wrappers that I wrote to handle quite a few configuration options and port those to Kea since this makes the most sense as a migration path for people wishing to retain their configurations.

That said, it strikes me that this is a broader "under-the-covers" implementation issue that we should shield users from.

Would it make sense to try to coordinate with the dnsmasq folks on implementing as much common functionality as possible?

Thanks.



From newtwen at gmail.com  Wed Jul 26 17:35:07 2023
From: newtwen at gmail.com (Paul D)
Date: Thu, 27 Jul 2023 01:35:07 +0100
Subject: Towards a unified /etc/config/dhcp
In-Reply-To: <2CE32C31-63D4-48E0-8418-B8406F077486@redfish-solutions.com>
References: <2CE32C31-63D4-48E0-8418-B8406F077486@redfish-solutions.com>
Message-ID: <0ed38be9-a4f4-93f7-43bb-cf9a1bd8d1a0@gmail.com>

Given that they both cover similar ground, I think this is a good idea.

I am a user of both, on various platforms/OSes, although on owrt, I use 
dnsmasq almost exclusively for its broader functionality which also 
covers DHCP.





On 2023-07-27 00:26, Philip Prindeville wrote:
> I'm the maintainer of ISC-DHCP which will be sunsetting soon.  I'd like to take the UCI wrappers that I wrote to handle quite a few configuration options and port those to Kea since this makes the most sense as a migration path for people wishing to retain their configurations.
> 
> That said, it strikes me that this is a broader "under-the-covers" implementation issue that we should shield users from.
> 
> Would it make sense to try to coordinate with the dnsmasq folks on implementing as much common functionality as possible?
> 
> Thanks.
> 



From ms at dev.tdt.de  Thu Jul 27 04:23:46 2023
From: ms at dev.tdt.de (Martin Schiller)
Date: Thu, 27 Jul 2023 13:23:46 +0200
Subject: kernel-headers: platform/target patches are not applied
Message-ID: <86f925f23687a1cd0216415e6b70bfa2@dev.tdt.de>

When preparing the kernel sources to build the kernel headers, currently 
only the patches from the generic folder are applied, but not from the 
actual selected target.

This is basically understandable if one assumes that one wants to use a 
toolchain for different targets with the same architecture.

But if a target has a kernel patch which also changes the uapi, then 
this is not considered in the toolchain/kernel-headers and thus when 
compiling Userspace applications at the moment.

This is currently already the case for the following targets:
* ath79
* bcm27xx
* bcm63xx
* ipq40xx
* lantiq
* realtek

I am currently working on a new target, have now stumbled across this 
problem and would now like to start a discussion here on how best to 
solve this now.

I am looking forward to your ideas.



From tmn505 at terefe.re  Thu Jul 27 09:45:14 2023
From: tmn505 at terefe.re (Tomasz Maciej Nowak)
Date: Thu, 27 Jul 2023 18:45:14 +0200
Subject: [PATCH v4 1/3] ipq40xx: image: limit kernel size for NOR devices
In-Reply-To: <20230727165809.175714-1-tmn505@terefe.re>
References: <20230727165809.175714-1-tmn505@terefe.re>
Message-ID: <20230727165809.175714-2-tmn505@terefe.re>

From: Tomasz Maciej Nowak <tmn505 at gmail.com>

'bootipq' command on some devices, with kernel on NOR flash chip, read
kernel partition size from Qualcomm proprietary partition table, which
seems to be stored in MIBIB partition. The partition table can be read
by 'smeminfo' command in U-Boot command line interface. Because this
partition table is never updated on sysupgrade (even when the kernel
size changes) kernel size is capped at initial value, usually 4MiB.
Sysupgrading such kernel will soft-brick the device, which will need
serial console for recovery. Some devices already suffer from this,
beacuse its U-Boot does not allow to boot LZMA or GZIP compressed kernel
image. Even some devices allowing to boot LZMA compressed kernel will hit
this limitation later. Therefore limit the kernel size to 4MiB for
devices not having it specified, so we won't create soft-bricking images.

Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
---
 target/linux/ipq40xx/image/generic.mk | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
index a9dd2aa0912f..13b6ce1fee41 100644
--- a/target/linux/ipq40xx/image/generic.mk
+++ b/target/linux/ipq40xx/image/generic.mk
@@ -400,6 +400,7 @@ define Device/dlink_dap-2610
 	WRGG_DEVNAME := /dev/mtdblock/8
 	WRGG_SIGNATURE := wapac30_dkbs_dap2610
 	IMAGE_SIZE := 14080k
+	KERNEL_SIZE := 4096k
 	IMAGES += factory.bin
 	# Bootloader expects a special 160 byte header which is added by
 	# wrgg-image.
@@ -478,6 +479,7 @@ define Device/engenius_emd1
 	DEVICE_DTS_CONFIG := config at 4
 	SOC := qcom-ipq4018
 	IMAGE_SIZE := 30720k
+	KERNEL_SIZE := 4096k
 	IMAGES += factory.bin
 	IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
 	IMAGE/factory.bin := qsdk-ipq-factory-nor | check-size
@@ -800,6 +802,7 @@ define Device/netgear_ex61x0v2
 	NETGEAR_BOARD_ID := EX6150v2series
 	NETGEAR_HW_ID := 29765285+16+0+128+2x2
 	IMAGE_SIZE := 14400k
+	KERNEL_SIZE := 4096k
 	SOC := qcom-ipq4018
 endef
 
@@ -954,6 +957,7 @@ define Device/pakedge_wr-1
 	SOC := qcom-ipq4018
 	BLOCKSIZE := 64k
 	IMAGE_SIZE := 31232k
+	KERNEL_SIZE := 4096k
 	IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | append-metadata
 endef
 TARGET_DEVICES += pakedge_wr-1
@@ -1030,6 +1034,7 @@ define Device/qxwlan_e2600ac-c1
 	BOARD_NAME := e2600ac-c1
 	SOC := qcom-ipq4019
 	IMAGE_SIZE := 31232k
+	KERNEL_SIZE := 4096k
 	IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
 endef
 TARGET_DEVICES += qxwlan_e2600ac-c1
@@ -1218,6 +1223,7 @@ define Device/zyxel_wre6606
 	DEVICE_DTS_CONFIG := config at 4
 	SOC := qcom-ipq4018
 	IMAGE_SIZE := 13184k
+	KERNEL_SIZE := 4096k
 	IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | check-size | append-metadata
 	DEVICE_PACKAGES := -kmod-ath10k-ct kmod-ath10k-ct-smallbuffers
 endef
-- 
2.41.0



From tmn505 at terefe.re  Thu Jul 27 09:45:13 2023
From: tmn505 at terefe.re (Tomasz Maciej Nowak)
Date: Thu, 27 Jul 2023 18:45:13 +0200
Subject: [PATCH v4 0/3] ipq40xx: remedy potential of producing soft-bricking images
Message-ID: <20230727165809.175714-1-tmn505@terefe.re>

From: Tomasz Maciej Nowak <tmn505 at gmail.com>

Some of devices having kernel on NOR flash could reach limit of kernel
partition size at 4MiB and soft-brick them. Unfortunately we don't know
if all of them are affected, thus kernel size limit is added to all of
remaining ones. Later commit allows for some devices to prepare painless
transition, while the last one shows how it can be done for device i
introduced. I tried to make transition for the device as generic as
possible so it coulld be used on others, but unfortunately I own only
one device, which means the owners of the rest device need to verify if
it works for them and add their devices.

Tomasz Maciej Nowak (3):
  ipq40xx: image: limit kernel size for NOR devices
    v1 -> v2: no changes
    v2 -> v3: no changes
    v3 -> v4: remove Habanero board (does not have a limit),
              straighten inaccuracy in commit message (zImage is
              self-extracting which doesn't depend on U-Boot
              capabilities, while GZIPped uImage does) 
  ipq40xx: dts: allow writing to U-Boot environment
    v1 -> v2: no changes
    v2 -> v3: no changes
    v3 -> v4: straighten inaccuracy in commit message (zImage is
              self-extracting which doesn't depend on U-Boot
              capabilities, while GZIPped uImage does)
  ipq40xx: pakedge_wr-1: workaround for kernel bigger than 4MiB
    v1 -> v2: remove printing command from sed invocation which prints
              double output and breaks future 'bootcmd' modifications
    v2 -> v3: shortened description of problem presented to user as
              users having firmware 23.05.0 or later won't see the
              message
    v3 -> v4: no changes


Tomasz Maciej Nowak (3):
  ipq40xx: image: limit kernel size for NOR devices
  ipq40xx: dts: allow writing to U-Boot environment
  ipq40xx: pakedge_wr-1: workaround for kernel bigger than 4MiB

 .../etc/uci-defaults/05_fix-compat-version         |  3 ++-
 .../base-files/lib/preinit/81_patch_uboot_env.sh   | 14 ++++++++++++++
 .../boot/dts/qcom-ipq4018-cs-w3-wd1200g-eup.dts    |  1 -
 .../arch/arm/boot/dts/qcom-ipq4018-dap-2610.dts    |  1 -
 .../arch/arm/boot/dts/qcom-ipq4018-eap1300.dts     |  1 -
 .../files/arch/arm/boot/dts/qcom-ipq4018-emd1.dts  |  1 -
 .../arch/arm/boot/dts/qcom-ipq4018-emr3500.dts     |  1 -
 .../arch/arm/boot/dts/qcom-ipq4018-ens620ext.dts   |  1 -
 .../arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi   |  1 -
 .../files/arch/arm/boot/dts/qcom-ipq4018-wr-1.dts  |  1 -
 .../arch/arm/boot/dts/qcom-ipq4018-wre6606.dts     |  1 -
 .../arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts  |  1 -
 .../arm/boot/dts/qcom-ipq4019-habanero-dvk.dts     |  1 -
 .../arch/arm/boot/dts/qcom-ipq4019-u4019-32m.dts   |  1 -
 .../files/arch/arm/boot/dts/qcom-ipq4019-x1pro.dts |  1 -
 .../arch/arm/boot/dts/qcom-ipq4028-wpj428.dts      |  1 -
 .../arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts    |  1 -
 .../arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts    |  1 -
 target/linux/ipq40xx/image/generic.mk              | 12 ++++++++++++
 19 files changed, 28 insertions(+), 17 deletions(-)
 create mode 100644 target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh

-- 
2.41.0



From tmn505 at terefe.re  Thu Jul 27 09:45:15 2023
From: tmn505 at terefe.re (Tomasz Maciej Nowak)
Date: Thu, 27 Jul 2023 18:45:15 +0200
Subject: [PATCH v4 2/3] ipq40xx: dts: allow writing to U-Boot environment
In-Reply-To: <20230727165809.175714-1-tmn505@terefe.re>
References: <20230727165809.175714-1-tmn505@terefe.re>
Message-ID: <20230727165809.175714-3-tmn505@terefe.re>

From: Tomasz Maciej Nowak <tmn505 at gmail.com>

Devices allowing to boot LZMA or GZIP compressed kernel didn't hit yet
the 4MiB boundary for kernel size, thus allowing to prepare workaround
for the issue, without need for serial console attachment.
The workaround is modifying 'bootcmd' variable in U-Boot environment
which will replace 'bootipq' command with equivalent not limited by
imposed partition table.
This commit also touches devices which boot uncompressed kernel, so
even if those are already soft-bricked, it will still allow to alter
U-Boot environment from initramfs booted device.

Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
---
 .../files/arch/arm/boot/dts/qcom-ipq4018-cs-w3-wd1200g-eup.dts   | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-dap-2610.dts    | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-eap1300.dts     | 1 -
 .../linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emd1.dts  | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emr3500.dts     | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ens620ext.dts   | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi   | 1 -
 .../linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wr-1.dts  | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wre6606.dts     | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts  | 1 -
 .../files/arch/arm/boot/dts/qcom-ipq4019-habanero-dvk.dts        | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-u4019-32m.dts   | 1 -
 .../linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-x1pro.dts | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts      | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts    | 1 -
 .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts    | 1 -
 16 files changed, 16 deletions(-)

diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-cs-w3-wd1200g-eup.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-cs-w3-wd1200g-eup.dts
index 22a48c12c44e..0772c5ac464a 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-cs-w3-wd1200g-eup.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-cs-w3-wd1200g-eup.dts
@@ -185,7 +185,6 @@
 			partition5 at E0000 {
 				label = "APPSBLENV";
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 
 			partition6 at F0000 {
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-dap-2610.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-dap-2610.dts
index 493905d56d8f..dea90b13e209 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-dap-2610.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-dap-2610.dts
@@ -117,7 +117,6 @@
 			partition at e0000 {
 				label = "APPSBLENV";
 				reg = <0xe0000 0x10000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-eap1300.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-eap1300.dts
index a8f24aa00e60..2e9cb8ecdb68 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-eap1300.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-eap1300.dts
@@ -165,7 +165,6 @@
 			partition5 at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 			partition6 at f0000 {
 				label = "0:APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emd1.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emd1.dts
index 396595ba5185..615c6aaf678f 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emd1.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emd1.dts
@@ -163,7 +163,6 @@
 			partition5 at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 			partition6 at f0000 {
 				label = "0:APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emr3500.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emr3500.dts
index 361614945145..8c038917b668 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emr3500.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-emr3500.dts
@@ -164,7 +164,6 @@
 			partition at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "0:APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ens620ext.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ens620ext.dts
index 69275e24b8cd..bba1dd89b7a8 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ens620ext.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ens620ext.dts
@@ -184,7 +184,6 @@
 			partition at e0000 {
 				label = "APPSBLENV"; /* uboot env*/
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "APPSBL"; /* uboot */
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi
index dc5c25c84ab7..b4d9d195c7f4 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi
@@ -228,7 +228,6 @@
 			partition5 at E0000 {
 				label = "APPSBLENV";
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 
 			partition6 at F0000 {
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wr-1.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wr-1.dts
index 16951da47fc0..4c707e73d862 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wr-1.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wr-1.dts
@@ -140,7 +140,6 @@
 			partition at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0x00e0000 0x0010000>;
-				read-only;
 			};
 
 			partition at f0000 {
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wre6606.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wre6606.dts
index efb267ae3692..decd7d5fdcc0 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wre6606.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wre6606.dts
@@ -195,7 +195,6 @@
 			partition5 at E0000 {
 				label = "APPSBLENV";
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 
 			partition6 at F0000 {
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts
index 70e05c7eef3a..eac11b02d144 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-e2600ac-c1.dts
@@ -57,7 +57,6 @@
 			partition at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0xe0000 0x10000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "0:APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-habanero-dvk.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-habanero-dvk.dts
index 23a654dcff5a..690db0143891 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-habanero-dvk.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-habanero-dvk.dts
@@ -262,7 +262,6 @@
 			partition at e0000 {
 				label = "APPSBLENV"; /* uboot env */
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "APPSBL"; /* uboot */
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-u4019-32m.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-u4019-32m.dts
index 4efcdaf39418..5304870a43fa 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-u4019-32m.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-u4019-32m.dts
@@ -54,7 +54,6 @@
 			partition at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0xe0000 0x10000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "0:APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-x1pro.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-x1pro.dts
index 681300c502bf..aa401892fef3 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-x1pro.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-x1pro.dts
@@ -56,7 +56,6 @@
 			partition at e0000 {
 				label = "0:APPSBLENV";
 				reg = <0xe0000 0x10000>;
-				read-only;
 			};
 			partition at f0000 {
 				label = "0:APPSBL";
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts
index 48b5cd53d80b..a1ede1dcbdb1 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts
@@ -205,7 +205,6 @@
 			partition5 at e0000 {
 				label = "0:APPSBLENV"; /* uboot env*/
 				reg = <0x000e0000 0x00010000>;
-				read-only;
 			};
 			partition5 at f0000 {
 				label = "0:APPSBL"; /* uboot */
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts
index 7e4519a74661..78d044b67893 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts
@@ -182,7 +182,6 @@
 			APPSBLENV at e0000 {
 				label = "APPSBLENV";
 				reg = <0xe0000 0x10000>;
-				read-only;
 			};
 
 			APPSBL at f0000 {
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts
index 0e7f4c970f47..752397a1752d 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts
@@ -180,7 +180,6 @@
 			APPSBLENV at e0000 {
 				label = "APPSBLENV";
 				reg = <0xe0000 0x10000>;
-				read-only;
 			};
 
 			APPSBL at f0000 {
-- 
2.41.0



From tmn505 at terefe.re  Thu Jul 27 09:45:16 2023
From: tmn505 at terefe.re (Tomasz Maciej Nowak)
Date: Thu, 27 Jul 2023 18:45:16 +0200
Subject: [PATCH v4 3/3] ipq40xx: pakedge_wr-1: workaround for kernel bigger than 4MiB
In-Reply-To: <20230727165809.175714-1-tmn505@terefe.re>
References: <20230727165809.175714-1-tmn505@terefe.re>
Message-ID: <20230727165809.175714-4-tmn505@terefe.re>

From: Tomasz Maciej Nowak <tmn505 at gmail.com>

Alter booting command in U-Boot on first boot after upgrade to workaround
the kernel size limitation. The kernel size read from flash will be 8MiB,
which should suffice for forseable future. As precaution a warning
interupting upgrade is emited, explaining what to do.

Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
---
 .../etc/uci-defaults/05_fix-compat-version         |  3 ++-
 .../base-files/lib/preinit/81_patch_uboot_env.sh   | 14 ++++++++++++++
 target/linux/ipq40xx/image/generic.mk              |  8 +++++++-
 3 files changed, 23 insertions(+), 2 deletions(-)
 create mode 100644 target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh

diff --git a/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
index c01192089712..a3f90125c6e5 100644
--- a/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
+++ b/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
@@ -4,7 +4,8 @@ case "$(board_name)" in
 linksys,ea6350v3|\
 linksys,ea8300|\
 linksys,mr8300|\
-ezviz,cs-w3-wd1200g-eup)
+ezviz,cs-w3-wd1200g-eup|\
+pakedge,wr-1)
 	uci set system. at system[0].compat_version="2.0"
 	uci commit system
 	;;
diff --git a/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh b/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh
new file mode 100644
index 000000000000..0cc0ab0fca6f
--- /dev/null
+++ b/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh
@@ -0,0 +1,14 @@
+. /lib/functions.sh
+
+preinit_patch_uboot_env() {
+	case $(board_name) in
+	pakedge,wr-1)
+		if ! fw_printenv -n OpenWrt &>/dev/null; then
+			fw_setenv OpenWrt 'sf probe; sf read 0x84000000 0x180000 0x800000; bootm 0x84000000'
+			fw_setenv bootcmd "$(fw_printenv -n bootcmd | sed -e 's,bootipq,run OpenWrt,')"
+		fi
+		;;
+	esac
+}
+
+boot_hook_add preinit_main preinit_patch_uboot_env
diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
index 13b6ce1fee41..742576a29e5e 100644
--- a/target/linux/ipq40xx/image/generic.mk
+++ b/target/linux/ipq40xx/image/generic.mk
@@ -957,8 +957,14 @@ define Device/pakedge_wr-1
 	SOC := qcom-ipq4018
 	BLOCKSIZE := 64k
 	IMAGE_SIZE := 31232k
-	KERNEL_SIZE := 4096k
+	KERNEL_SIZE := 8192k
 	IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | append-metadata
+	DEVICE_COMPAT_VERSION := 2.0
+	DEVICE_COMPAT_MESSAGE := \n$\
+		Booting command in U-Boot needs to be changed because of kernel \n$\
+		growing beyond 4MiB. Force upgrade to 23.05.0 first and it will \n$\
+		automatically amend booting command in U-Boot on first boot. \n$\
+		Then proceed with the upgrade to desired version.
 endef
 TARGET_DEVICES += pakedge_wr-1
 
-- 
2.41.0



From nbd at nbd.name  Thu Jul 27 13:26:51 2023
From: nbd at nbd.name (Felix Fietkau)
Date: Thu, 27 Jul 2023 22:26:51 +0200
Subject: kernel-headers: platform/target patches are not applied
In-Reply-To: <86f925f23687a1cd0216415e6b70bfa2@dev.tdt.de>
References: <86f925f23687a1cd0216415e6b70bfa2@dev.tdt.de>
Message-ID: <9dc30307-b30f-0274-390c-871fa34f7cad@nbd.name>

Hi Martin,

On 27.07.23 13:23, Martin Schiller wrote:
> When preparing the kernel sources to build the kernel headers, currently
> only the patches from the generic folder are applied, but not from the
> actual selected target.
> 
> This is basically understandable if one assumes that one wants to use a
> toolchain for different targets with the same architecture.
> 
> But if a target has a kernel patch which also changes the uapi, then
> this is not considered in the toolchain/kernel-headers and thus when
> compiling Userspace applications at the moment.
> 
> This is currently already the case for the following targets:
> * ath79
> * bcm27xx
> * bcm63xx
> * ipq40xx
> * lantiq
> * realtek
> 
> I am currently working on a new target, have now stumbled across this
> problem and would now like to start a discussion here on how best to
> solve this now.
> 
> I am looking forward to your ideas.

Packages that depend on target specific UAPI changes can always include 
kernel.mk in the package Makefile, make themselves non-shared and pull 
include files from $(LINUX_DIR)/user_headers

The default for all other packages should be to not rely on target 
specific UAPI changes.

- Felix


From tmn505 at terefe.re  Thu Jul 27 13:25:44 2023
From: tmn505 at terefe.re (Tomasz Maciej Nowak)
Date: Thu, 27 Jul 2023 22:25:44 +0200
Subject: [PATCH 0/4] tegra: bump to 6.1
Message-ID: <20230727203216.190578-1-tmn505@terefe.re>

From: Tomasz Maciej Nowak <tmn505 at gmail.com>

Straightforward update and small generic config modification.

Tomasz Maciej Nowak (4):
  kernel: 6.1: move NO_ARRAY_BOUNDS to generic
  tegra: copy patches and config for kernel 6.1
  tegra: initial kernel 6.1 support
  tegra: switch to 6.1 kernel

 package/kernel/linux/modules/video.mk         |   4 +-
 target/linux/bcm27xx/bcm2708/config-6.1       |   2 -
 target/linux/bcm27xx/bcm2709/config-6.1       |   2 -
 target/linux/bcm27xx/bcm2710/config-6.1       |   2 -
 target/linux/bcm27xx/bcm2711/config-6.1       |   2 -
 target/linux/bmips/bcm6318/config-6.1         |   2 -
 target/linux/bmips/bcm63268/config-6.1        |   2 -
 target/linux/bmips/bcm6328/config-6.1         |   2 -
 target/linux/bmips/bcm6358/config-6.1         |   2 -
 target/linux/bmips/bcm6362/config-6.1         |   2 -
 target/linux/bmips/bcm6368/config-6.1         |   2 -
 target/linux/generic/config-6.1               |   2 +
 target/linux/mediatek/filogic/config-6.1      |   2 -
 target/linux/mediatek/mt7622/config-6.1       |   2 -
 target/linux/mediatek/mt7623/config-6.1       |   2 -
 target/linux/mediatek/mt7629/config-6.1       |   2 -
 target/linux/qualcommax/config-6.1            |   2 -
 target/linux/rockchip/armv8/config-6.1        |   2 -
 target/linux/tegra/Makefile                   |   3 +-
 target/linux/tegra/config-6.1                 | 565 ++++++++++++++++++
 ...interrupts-due-to-tegra2-silicon-bug.patch |  77 +++
 ...enable-front-panel-leds-in-TrimSlice.patch |  58 ++
 target/linux/uml/config-6.1                   |   1 -
 23 files changed, 706 insertions(+), 36 deletions(-)
 create mode 100644 target/linux/tegra/config-6.1
 create mode 100644 target/linux/tegra/patches-6.1/100-serial8250-on-tegra-hsuart-recover-from-spurious-interrupts-due-to-tegra2-silicon-bug.patch
 create mode 100644 target/linux/tegra/patches-6.1/101-ARM-dtc-tegra-enable-front-panel-leds-in-TrimSlice.patch

-- 
2.41.0



From tmn505 at terefe.re  Thu Jul 27 13:25:48 2023
From: tmn505 at terefe.re (Tomasz Maciej Nowak)
Date: Thu, 27 Jul 2023 22:25:48 +0200
Subject: [PATCH 4/4] tegra: switch to 6.1 kernel
In-Reply-To: <20230727203216.190578-1-tmn505@terefe.re>
References: <20230727203216.190578-1-tmn505@terefe.re>
Message-ID: <20230727203216.190578-5-tmn505@terefe.re>

From: Tomasz Maciej Nowak <tmn505 at gmail.com>

Testing results were all good, so move target to newer kernel by default.

Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
---
 target/linux/tegra/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/tegra/Makefile b/target/linux/tegra/Makefile
index 95d62cf6b0f5..f289c09c05c0 100644
--- a/target/linux/tegra/Makefile
+++ b/target/linux/tegra/Makefile
@@ -12,7 +12,7 @@ CPU_TYPE := cortex-a9
 CPU_SUBTYPE := vfpv3-d16
 SUBTARGETS := generic
 
-KERNEL_PATCHVER := 5.15
+KERNEL_PATCHVER := 6.1
 KERNEL_TESTING_PATCHVER := 6.1
 
 include $(INCLUDE_DIR)/target.mk
-- 
2.41.0



From tmn505 at terefe.re  Thu Jul 27 13:25:47 2023
From: tmn505 at terefe.re (Tomasz Maciej Nowak)
Date: Thu, 27 Jul 2023 22:25:47 +0200
Subject: [PATCH 3/4] tegra: initial kernel 6.1 support
In-Reply-To: <20230727203216.190578-1-tmn505@terefe.re>
References: <20230727203216.190578-1-tmn505@terefe.re>
Message-ID: <20230727203216.190578-4-tmn505@terefe.re>

From: Tomasz Maciej Nowak <tmn505 at gmail.com>

- refresh patches
- adjust kernel config, with main change enabling VIDEO_TEGRA_VDE,
  necessary for driving power domain responsible for clean reboot
- adjust LED patch to changes in LED drivers

Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
---
 package/kernel/linux/modules/video.mk         |  4 +-
 target/linux/tegra/Makefile                   |  1 +
 target/linux/tegra/config-6.1                 | 77 +++++++++++++++++--
 ...interrupts-due-to-tegra2-silicon-bug.patch |  2 +-
 ...enable-front-panel-leds-in-TrimSlice.patch | 22 ++++--
 5 files changed, 90 insertions(+), 16 deletions(-)

diff --git a/package/kernel/linux/modules/video.mk b/package/kernel/linux/modules/video.mk
index e8a2d479ee03..b0f5c027ed60 100644
--- a/package/kernel/linux/modules/video.mk
+++ b/package/kernel/linux/modules/video.mk
@@ -1058,7 +1058,7 @@ define KernelPackage/video-mem2mem
   SUBMENU:=$(VIDEO_MENU)
   TITLE:=Memory 2 Memory device support
   HIDDEN:=1
-  DEPENDS:=+kmod-video-videobuf2
+  DEPENDS:=@!TARGET_tegra +kmod-video-videobuf2
   KCONFIG:= CONFIG_V4L_MEM2MEM_DRIVERS=y
   FILES:= $(LINUX_DIR)/drivers/media/$(V4L2_DIR)/v4l2-mem2mem.ko
   AUTOLOAD:=$(call AutoLoad,66,v4l2-mem2mem)
@@ -1075,7 +1075,7 @@ define KernelPackage/video-dma
   SUBMENU:=$(VIDEO_MENU)
   TITLE:=Video DMA support
   HIDDEN:=1
-  DEPENDS:=+kmod-video-videobuf2
+  DEPENDS:=@!TARGET_tegra +kmod-video-videobuf2
   KCONFIG:= \
 	CONFIG_VIDEOBUF2_DMA_CONTIG \
 	CONFIG_VIDEOBUF2_DMA_SG
diff --git a/target/linux/tegra/Makefile b/target/linux/tegra/Makefile
index 43ca154e8a08..95d62cf6b0f5 100644
--- a/target/linux/tegra/Makefile
+++ b/target/linux/tegra/Makefile
@@ -13,6 +13,7 @@ CPU_SUBTYPE := vfpv3-d16
 SUBTARGETS := generic
 
 KERNEL_PATCHVER := 5.15
+KERNEL_TESTING_PATCHVER := 6.1
 
 include $(INCLUDE_DIR)/target.mk
 
diff --git a/target/linux/tegra/config-6.1 b/target/linux/tegra/config-6.1
index 257ffda252ad..1f2000044916 100644
--- a/target/linux/tegra/config-6.1
+++ b/target/linux/tegra/config-6.1
@@ -23,12 +23,11 @@ CONFIG_ARCH_TEGRA_2x_SOC=y
 CONFIG_ARM=y
 CONFIG_ARM_AMBA=y
 CONFIG_ARM_CPU_SUSPEND=y
-CONFIG_ARM_CRYPTO=y
 CONFIG_ARM_ERRATA_720789=y
 CONFIG_ARM_ERRATA_754327=y
 CONFIG_ARM_ERRATA_764369=y
 CONFIG_ARM_GIC=y
-CONFIG_ARM_HAS_SG_CHAIN=y
+CONFIG_ARM_HAS_GROUP_RELOCS=y
 CONFIG_ARM_HEAVY_MB=y
 CONFIG_ARM_L1_CACHE_SHIFT=6
 CONFIG_ARM_L1_CACHE_SHIFT_6=y
@@ -55,6 +54,8 @@ CONFIG_BLK_MQ_PCI=y
 CONFIG_BLK_PM=y
 CONFIG_BOUNCE=y
 CONFIG_CACHE_L2X0=y
+CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y
+CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5"
 CONFIG_CLKSRC_MMIO=y
 CONFIG_CLONE_BACKWARDS=y
 CONFIG_CLZ_TAB=y
@@ -70,7 +71,10 @@ CONFIG_CMA_SIZE_SEL_MBYTES=y
 # CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set
 # CONFIG_CMA_SYSFS is not set
 CONFIG_COMMON_CLK=y
+CONFIG_COMPACT_UNEVICTABLE_DEFAULT=1
 CONFIG_COMPAT_32BIT_TIME=y
+CONFIG_CONTEXT_TRACKING=y
+CONFIG_CONTEXT_TRACKING_IDLE=y
 CONFIG_CONTIG_ALLOC=y
 CONFIG_CPUFREQ_DT=y
 CONFIG_CPUFREQ_DT_PLATDEV=y
@@ -97,6 +101,7 @@ CONFIG_CPU_FREQ_GOV_USERSPACE=y
 CONFIG_CPU_HAS_ASID=y
 CONFIG_CPU_IDLE=y
 CONFIG_CPU_IDLE_GOV_LADDER=y
+CONFIG_CPU_LITTLE_ENDIAN=y
 CONFIG_CPU_PABRT_V7=y
 CONFIG_CPU_PM=y
 CONFIG_CPU_RMAP=y
@@ -120,7 +125,9 @@ CONFIG_CRYPTO_ECHAINIV=y
 CONFIG_CRYPTO_HMAC=y
 CONFIG_CRYPTO_JITTERENTROPY=y
 CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y
+CONFIG_CRYPTO_LIB_SHA1=y
 CONFIG_CRYPTO_LIB_SHA256=y
+CONFIG_CRYPTO_LIB_UTILS=y
 CONFIG_CRYPTO_LZ4=y
 CONFIG_CRYPTO_LZ4HC=y
 CONFIG_CRYPTO_LZO=y
@@ -137,30 +144,37 @@ CONFIG_CRYPTO_SHA512=y
 CONFIG_CRYPTO_SHA512_ARM=y
 CONFIG_CRYPTO_TWOFISH=y
 CONFIG_CRYPTO_TWOFISH_COMMON=y
+CONFIG_CURRENT_POINTER_IN_TPIDRURO=y
 CONFIG_DCACHE_WORD_ACCESS=y
+CONFIG_DDR=y
 CONFIG_DEBUG_ALIGN_RODATA=y
+CONFIG_DEBUG_INFO=y
 CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
 # CONFIG_DEVFREQ_GOV_PASSIVE is not set
 # CONFIG_DEVFREQ_GOV_PERFORMANCE is not set
 # CONFIG_DEVFREQ_GOV_POWERSAVE is not set
 CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y
 # CONFIG_DEVFREQ_GOV_USERSPACE is not set
-CONFIG_DEVFREQ_THERMAL=y
+# CONFIG_DEVFREQ_THERMAL is not set
 # CONFIG_DEVPORT is not set
 CONFIG_DMADEVICES=y
 CONFIG_DMA_CMA=y
 CONFIG_DMA_ENGINE=y
 CONFIG_DMA_OF=y
 CONFIG_DMA_OPS=y
-CONFIG_DMA_REMAP=y
 CONFIG_DMA_SHARED_BUFFER=y
 CONFIG_DNOTIFY=y
 CONFIG_DRM=y
 CONFIG_DRM_BRIDGE=y
+CONFIG_DRM_DISPLAY_DP_HELPER=y
+CONFIG_DRM_DISPLAY_HDMI_HELPER=y
+CONFIG_DRM_DISPLAY_HELPER=y
+CONFIG_DRM_DP_AUX_BUS=y
 CONFIG_DRM_FBDEV_EMULATION=y
 CONFIG_DRM_FBDEV_OVERALLOC=100
 CONFIG_DRM_KMS_HELPER=y
 CONFIG_DRM_MIPI_DSI=y
+CONFIG_DRM_NOMODESET=y
 CONFIG_DRM_PANEL=y
 CONFIG_DRM_PANEL_BRIDGE=y
 CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y
@@ -170,6 +184,7 @@ CONFIG_DRM_TEGRA=y
 CONFIG_DTC=y
 CONFIG_EDAC_ATOMIC_SCRUB=y
 CONFIG_EDAC_SUPPORT=y
+CONFIG_EXCLUSIVE_SYSTEM_RAM=y
 CONFIG_EXT4_FS=y
 CONFIG_EXTCON=y
 CONFIG_F2FS_FS=y
@@ -187,6 +202,7 @@ CONFIG_FIX_EARLYCON_MEM=y
 CONFIG_FS_IOMAP=y
 CONFIG_FS_MBCACHE=y
 CONFIG_FW_LOADER_PAGED_BUF=y
+CONFIG_FW_LOADER_SYSFS=y
 CONFIG_GENERIC_ALLOCATOR=y
 CONFIG_GENERIC_ARCH_TOPOLOGY=y
 CONFIG_GENERIC_BUG=y
@@ -220,7 +236,6 @@ CONFIG_GLOB=y
 CONFIG_GPIOLIB_IRQCHIP=y
 CONFIG_GPIO_CDEV=y
 CONFIG_GPIO_TEGRA=y
-CONFIG_HANDLE_DOMAIN_IRQ=y
 CONFIG_HARDEN_BRANCH_PREDICTOR=y
 CONFIG_HARDIRQS_SW_RESEND=y
 CONFIG_HAS_DMA=y
@@ -244,23 +259,24 @@ CONFIG_I2C_COMPAT=y
 CONFIG_I2C_TEGRA=y
 CONFIG_INITRAMFS_SOURCE=""
 CONFIG_INPUT=y
-CONFIG_INPUT_KEYBOARD=y
 CONFIG_INTERCONNECT=y
 CONFIG_IOMMU_API=y
 # CONFIG_IOMMU_DEBUGFS is not set
+# CONFIG_IOMMU_DEFAULT_DMA_LAZY is not set
 CONFIG_IOMMU_DEFAULT_DMA_STRICT=y
+# CONFIG_IOMMU_DEFAULT_PASSTHROUGH is not set
 CONFIG_IOMMU_IOVA=y
 # CONFIG_IOMMU_IO_PGTABLE_ARMV7S is not set
 # CONFIG_IOMMU_IO_PGTABLE_LPAE is not set
 CONFIG_IOMMU_SUPPORT=y
 CONFIG_IRQCHIP=y
+CONFIG_IRQSTACKS=y
 CONFIG_IRQ_DOMAIN=y
 CONFIG_IRQ_DOMAIN_HIERARCHY=y
 CONFIG_IRQ_FORCED_THREADING=y
 CONFIG_IRQ_WORK=y
 CONFIG_JBD2=y
 CONFIG_KCMP=y
-CONFIG_KEYBOARD_ATKBD=y
 CONFIG_KMAP_LOCAL=y
 CONFIG_KMAP_LOCAL_NON_LINEAR_PTE_ARRAY=y
 CONFIG_LIBFDT=y
@@ -271,6 +287,12 @@ CONFIG_LZ4_COMPRESS=y
 CONFIG_LZ4_DECOMPRESS=y
 CONFIG_LZO_COMPRESS=y
 CONFIG_LZO_DECOMPRESS=y
+CONFIG_MEDIA_CONTROLLER=y
+CONFIG_MEDIA_CONTROLLER_REQUEST_API=y
+CONFIG_MEDIA_PLATFORM_DRIVERS=y
+CONFIG_MEDIA_PLATFORM_SUPPORT=y
+CONFIG_MEDIA_SUPPORT=y
+CONFIG_MEDIA_SUPPORT_FILTER=y
 CONFIG_MEMFD_CREATE=y
 CONFIG_MEMORY=y
 CONFIG_MEMORY_ISOLATION=y
@@ -311,6 +333,9 @@ CONFIG_OUTER_CACHE=y
 CONFIG_OUTER_CACHE_SYNC=y
 CONFIG_PADATA=y
 CONFIG_PAGE_OFFSET=0xC0000000
+CONFIG_PAGE_POOL=y
+CONFIG_PAGE_SIZE_LESS_THAN_256KB=y
+CONFIG_PAGE_SIZE_LESS_THAN_64KB=y
 CONFIG_PCI=y
 CONFIG_PCIEAER=y
 CONFIG_PCIEASPM=y
@@ -345,11 +370,13 @@ CONFIG_PM_OPP=y
 CONFIG_POWER_RESET=y
 CONFIG_POWER_RESET_GPIO=y
 CONFIG_POWER_SUPPLY=y
+CONFIG_PREEMPT_NONE_BUILD=y
 CONFIG_PROC_PAGE_MONITOR=y
 CONFIG_PTP_1588_CLOCK_OPTIONAL=y
 CONFIG_PWM=y
 CONFIG_PWM_SYSFS=y
 CONFIG_PWM_TEGRA=y
+CONFIG_RANDSTRUCT_NONE=y
 CONFIG_RAS=y
 CONFIG_RATIONAL=y
 CONFIG_REGMAP=y
@@ -384,6 +411,7 @@ CONFIG_SG_POOL=y
 CONFIG_SMP=y
 CONFIG_SMP_ON_UP=y
 CONFIG_SND=y
+CONFIG_SND_AUDIO_GRAPH_CARD=y
 # CONFIG_SND_COMPRESS_OFFLOAD is not set
 CONFIG_SND_DMAENGINE_PCM=y
 # CONFIG_SND_DRIVERS is not set
@@ -392,26 +420,37 @@ CONFIG_SND_JACK=y
 CONFIG_SND_JACK_INPUT_DEV=y
 # CONFIG_SND_PCI is not set
 CONFIG_SND_PCM=y
+CONFIG_SND_PCM_ELD=y
+CONFIG_SND_PCM_IEC958=y
 # CONFIG_SND_PROC_FS is not set
 CONFIG_SND_SIMPLE_CARD=y
 CONFIG_SND_SIMPLE_CARD_UTILS=y
 CONFIG_SND_SOC=y
 CONFIG_SND_SOC_AC97_BUS=y
 CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y
+CONFIG_SND_SOC_HDMI_CODEC=y
 CONFIG_SND_SOC_I2C_AND_SPI=y
 CONFIG_SND_SOC_TEGRA=y
+# CONFIG_SND_SOC_TEGRA186_ASRC is not set
 # CONFIG_SND_SOC_TEGRA186_DSPK is not set
 CONFIG_SND_SOC_TEGRA20_AC97=y
 CONFIG_SND_SOC_TEGRA20_DAS=y
 CONFIG_SND_SOC_TEGRA20_I2S=y
 CONFIG_SND_SOC_TEGRA20_SPDIF=y
 # CONFIG_SND_SOC_TEGRA210_ADMAIF is not set
+# CONFIG_SND_SOC_TEGRA210_ADX is not set
 # CONFIG_SND_SOC_TEGRA210_AHUB is not set
+# CONFIG_SND_SOC_TEGRA210_AMX is not set
 # CONFIG_SND_SOC_TEGRA210_DMIC is not set
 # CONFIG_SND_SOC_TEGRA210_I2S is not set
+# CONFIG_SND_SOC_TEGRA210_MIXER is not set
+# CONFIG_SND_SOC_TEGRA210_MVC is not set
+# CONFIG_SND_SOC_TEGRA210_OPE is not set
+# CONFIG_SND_SOC_TEGRA210_SFC is not set
 # CONFIG_SND_SOC_TEGRA30_AHUB is not set
 # CONFIG_SND_SOC_TEGRA30_I2S is not set
 # CONFIG_SND_SOC_TEGRA_ALC5632 is not set
+# CONFIG_SND_SOC_TEGRA_AUDIO_GRAPH_CARD is not set
 CONFIG_SND_SOC_TEGRA_MACHINE_DRV=y
 # CONFIG_SND_SOC_TEGRA_MAX98090 is not set
 # CONFIG_SND_SOC_TEGRA_RT5640 is not set
@@ -430,6 +469,7 @@ CONFIG_SOC_TEGRA20_VOLTAGE_COUPLER=y
 CONFIG_SOC_TEGRA_FLOWCTRL=y
 CONFIG_SOC_TEGRA_FUSE=y
 CONFIG_SOC_TEGRA_PMC=y
+CONFIG_SOFTIRQ_ON_OWN_STACK=y
 CONFIG_SOUND=y
 CONFIG_SOUND_OSS_CORE=y
 CONFIG_SOUND_OSS_CORE_PRECLAIM=y
@@ -441,23 +481,33 @@ CONFIG_SPI_MEM=y
 CONFIG_SPI_TEGRA20_SFLASH=y
 CONFIG_SPI_TEGRA20_SLINK=y
 # CONFIG_SPI_TEGRA210_QUAD is not set
+CONFIG_SRAM=y
+CONFIG_SRAM_EXEC=y
 CONFIG_SRCU=y
 CONFIG_SWP_EMULATE=y
 CONFIG_SYNC_FILE=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+# CONFIG_TEGRA186_TIMER is not set
 CONFIG_TEGRA20_APB_DMA=y
 CONFIG_TEGRA20_EMC=y
 CONFIG_TEGRA_AHB=y
 CONFIG_TEGRA_GMI=y
 CONFIG_TEGRA_HOST1X=y
+CONFIG_TEGRA_HOST1X_CONTEXT_BUS=y
 CONFIG_TEGRA_HOST1X_FIREWALL=y
 CONFIG_TEGRA_IOMMU_GART=y
 # CONFIG_TEGRA_IOMMU_SMMU is not set
 # CONFIG_TEGRA_IVC is not set
 CONFIG_TEGRA_MC=y
-# CONFIG_TEGRA_SOCTHERM is not set
+CONFIG_TEGRA_SOCTHERM=y
 CONFIG_TEGRA_TIMER=y
 CONFIG_TEGRA_WATCHDOG=y
+CONFIG_THERMAL=y
+CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y
+CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0
+CONFIG_THERMAL_GOV_STEP_WISE=y
+CONFIG_THERMAL_OF=y
+CONFIG_THREAD_INFO_IN_TASK=y
 CONFIG_TICK_CPU_ACCOUNTING=y
 CONFIG_TIMER_OF=y
 CONFIG_TIMER_PROBE=y
@@ -490,8 +540,19 @@ CONFIG_USB_ULPI_BUS=y
 CONFIG_USB_ULPI_VIEWPORT=y
 # CONFIG_USB_XHCI_TEGRA is not set
 CONFIG_USE_OF=y
+CONFIG_V4L2_H264=y
+CONFIG_V4L2_MEM2MEM_DEV=y
+CONFIG_V4L_MEM2MEM_DRIVERS=y
 CONFIG_VFP=y
 CONFIG_VFPv3=y
+CONFIG_VIDEOBUF2_CORE=y
+CONFIG_VIDEOBUF2_DMA_CONTIG=y
+CONFIG_VIDEOBUF2_DMA_SG=y
+CONFIG_VIDEOBUF2_MEMOPS=y
+CONFIG_VIDEOBUF2_V4L2=y
+CONFIG_VIDEO_DEV=y
+CONFIG_VIDEO_TEGRA_VDE=y
+CONFIG_VIDEO_V4L2_I2C=y
 CONFIG_WATCHDOG_CORE=y
 # CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set
 CONFIG_XPS=y
diff --git a/target/linux/tegra/patches-6.1/100-serial8250-on-tegra-hsuart-recover-from-spurious-interrupts-due-to-tegra2-silicon-bug.patch b/target/linux/tegra/patches-6.1/100-serial8250-on-tegra-hsuart-recover-from-spurious-interrupts-due-to-tegra2-silicon-bug.patch
index 8f01f73eb24a..08ed9d441c5f 100644
--- a/target/linux/tegra/patches-6.1/100-serial8250-on-tegra-hsuart-recover-from-spurious-interrupts-due-to-tegra2-silicon-bug.patch
+++ b/target/linux/tegra/patches-6.1/100-serial8250-on-tegra-hsuart-recover-from-spurious-interrupts-due-to-tegra2-silicon-bug.patch
@@ -36,7 +36,7 @@ David
 
 --- a/drivers/tty/serial/8250/8250_core.c
 +++ b/drivers/tty/serial/8250/8250_core.c
-@@ -134,6 +134,38 @@ static irqreturn_t serial8250_interrupt(
+@@ -133,6 +133,38 @@ static irqreturn_t serial8250_interrupt(
  
  		if (l == i->head && pass_counter++ > PASS_LIMIT)
  			break;
diff --git a/target/linux/tegra/patches-6.1/101-ARM-dtc-tegra-enable-front-panel-leds-in-TrimSlice.patch b/target/linux/tegra/patches-6.1/101-ARM-dtc-tegra-enable-front-panel-leds-in-TrimSlice.patch
index b1e210b212de..e4a17af66fad 100644
--- a/target/linux/tegra/patches-6.1/101-ARM-dtc-tegra-enable-front-panel-leds-in-TrimSlice.patch
+++ b/target/linux/tegra/patches-6.1/101-ARM-dtc-tegra-enable-front-panel-leds-in-TrimSlice.patch
@@ -1,6 +1,14 @@
 --- a/arch/arm/boot/dts/tegra20-trimslice.dts
 +++ b/arch/arm/boot/dts/tegra20-trimslice.dts
-@@ -201,16 +201,17 @@
+@@ -2,6 +2,7 @@
+ /dts-v1/;
+ 
+ #include <dt-bindings/input/input.h>
++#include <dt-bindings/leds/common.h>
+ #include "tegra20.dtsi"
+ #include "tegra20-cpu-opp.dtsi"
+ 
+@@ -201,16 +202,17 @@
  			conf_ata {
  				nvidia,pins = "ata", "atc", "atd", "ate",
  					"crtp", "dap2", "dap3", "dap4", "dta",
@@ -23,20 +31,24 @@
  				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
  				nvidia,tristate = <TEGRA_PIN_DISABLE>;
  			};
-@@ -396,6 +397,20 @@
+@@ -396,6 +398,24 @@
  		};
  	};
  
-+	gpio-leds {
++	leds {
 +		compatible = "gpio-leds";
 +
 +		ds2 {
-+			label = "trimslice:green:right";
++			label = "green:right";
++			color = <LED_COLOR_ID_GREEN>;
++			function = LED_FUNCTION_STATUS;
 +			gpios = <&gpio TEGRA_GPIO(D, 2) GPIO_ACTIVE_LOW>;
 +		};
 +
 +		ds3 {
-+			label = "trimslice:green:left";
++			label = "green:left";
++			color = <LED_COLOR_ID_GREEN>;
++			function = LED_FUNCTION_STATUS;
 +			gpios = <&gpio TEGRA_GPIO(BB, 5) GPIO_ACTIVE_LOW>;
 +		};
 +	};
-- 
2.41.0



From tmn505 at terefe.re  Thu Jul 27 13:25:45 2023
From: tmn505 at terefe.re (Tomasz Maciej Nowak)
Date: Thu, 27 Jul 2023 22:25:45 +0200
Subject: [PATCH 1/4] kernel: 6.1: move NO_ARRAY_BOUNDS to generic
In-Reply-To: <20230727203216.190578-1-tmn505@terefe.re>
References: <20230727203216.190578-1-tmn505@terefe.re>
Message-ID: <20230727203216.190578-2-tmn505@terefe.re>

From: Tomasz Maciej Nowak <tmn505 at gmail.com>

Array bounds are disabled for GCC 11 or later. It's better to track it in
global (generic) config.

Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
---
 target/linux/bcm27xx/bcm2708/config-6.1  | 2 --
 target/linux/bcm27xx/bcm2709/config-6.1  | 2 --
 target/linux/bcm27xx/bcm2710/config-6.1  | 2 --
 target/linux/bcm27xx/bcm2711/config-6.1  | 2 --
 target/linux/bmips/bcm6318/config-6.1    | 2 --
 target/linux/bmips/bcm63268/config-6.1   | 2 --
 target/linux/bmips/bcm6328/config-6.1    | 2 --
 target/linux/bmips/bcm6358/config-6.1    | 2 --
 target/linux/bmips/bcm6362/config-6.1    | 2 --
 target/linux/bmips/bcm6368/config-6.1    | 2 --
 target/linux/generic/config-6.1          | 2 ++
 target/linux/mediatek/filogic/config-6.1 | 2 --
 target/linux/mediatek/mt7622/config-6.1  | 2 --
 target/linux/mediatek/mt7623/config-6.1  | 2 --
 target/linux/mediatek/mt7629/config-6.1  | 2 --
 target/linux/qualcommax/config-6.1       | 2 --
 target/linux/rockchip/armv8/config-6.1   | 2 --
 target/linux/uml/config-6.1              | 1 -
 18 files changed, 2 insertions(+), 33 deletions(-)

diff --git a/target/linux/bcm27xx/bcm2708/config-6.1 b/target/linux/bcm27xx/bcm2708/config-6.1
index c5d604e6bc25..29884c661305 100644
--- a/target/linux/bcm27xx/bcm2708/config-6.1
+++ b/target/linux/bcm27xx/bcm2708/config-6.1
@@ -56,7 +56,6 @@ CONFIG_BRCM_CHAR_DRIVERS=y
 # CONFIG_CACHE_L2X0 is not set
 CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y
 CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5"
-CONFIG_CC_NO_ARRAY_BOUNDS=y
 CONFIG_CLKSRC_MMIO=y
 CONFIG_CLK_BCM2711_DVP=y
 CONFIG_CLK_BCM2835=y
@@ -170,7 +169,6 @@ CONFIG_FWNODE_MDIO=y
 CONFIG_FW_CACHE=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_FW_LOADER_SYSFS=y
-CONFIG_GCC11_NO_ARRAY_BOUNDS=y
 CONFIG_GENERIC_ALLOCATOR=y
 CONFIG_GENERIC_BUG=y
 CONFIG_GENERIC_CLOCKEVENTS=y
diff --git a/target/linux/bcm27xx/bcm2709/config-6.1 b/target/linux/bcm27xx/bcm2709/config-6.1
index ec2e7f3fa610..7479ee37a31f 100644
--- a/target/linux/bcm27xx/bcm2709/config-6.1
+++ b/target/linux/bcm27xx/bcm2709/config-6.1
@@ -70,7 +70,6 @@ CONFIG_BROADCOM_PHY=y
 # CONFIG_CACHE_L2X0 is not set
 CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y
 CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5"
-CONFIG_CC_NO_ARRAY_BOUNDS=y
 CONFIG_CLKSRC_MMIO=y
 CONFIG_CLK_BCM2711_DVP=y
 CONFIG_CLK_BCM2835=y
@@ -207,7 +206,6 @@ CONFIG_FWNODE_MDIO=y
 CONFIG_FW_CACHE=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_FW_LOADER_SYSFS=y
-CONFIG_GCC11_NO_ARRAY_BOUNDS=y
 CONFIG_GENERIC_ALLOCATOR=y
 CONFIG_GENERIC_ARCH_TOPOLOGY=y
 CONFIG_GENERIC_BUG=y
diff --git a/target/linux/bcm27xx/bcm2710/config-6.1 b/target/linux/bcm27xx/bcm2710/config-6.1
index b0abd49c7f12..f0af261f1691 100644
--- a/target/linux/bcm27xx/bcm2710/config-6.1
+++ b/target/linux/bcm27xx/bcm2710/config-6.1
@@ -87,7 +87,6 @@ CONFIG_CAVIUM_ERRATUM_27456=y
 CONFIG_CC_HAVE_SHADOW_CALL_STACK=y
 CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y
 CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5"
-CONFIG_CC_NO_ARRAY_BOUNDS=y
 CONFIG_CLKSRC_MMIO=y
 CONFIG_CLK_BCM2711_DVP=y
 CONFIG_CLK_BCM2835=y
@@ -217,7 +216,6 @@ CONFIG_FWNODE_MDIO=y
 CONFIG_FW_CACHE=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_FW_LOADER_SYSFS=y
-CONFIG_GCC11_NO_ARRAY_BOUNDS=y
 CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_REGS=y
 CONFIG_GENERIC_ALLOCATOR=y
 CONFIG_GENERIC_ARCH_TOPOLOGY=y
diff --git a/target/linux/bcm27xx/bcm2711/config-6.1 b/target/linux/bcm27xx/bcm2711/config-6.1
index ff88926e3df5..f44019cee3f1 100644
--- a/target/linux/bcm27xx/bcm2711/config-6.1
+++ b/target/linux/bcm27xx/bcm2711/config-6.1
@@ -91,7 +91,6 @@ CONFIG_CAVIUM_ERRATUM_27456=y
 CONFIG_CC_HAVE_SHADOW_CALL_STACK=y
 CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y
 CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5"
-CONFIG_CC_NO_ARRAY_BOUNDS=y
 CONFIG_CLKSRC_MMIO=y
 CONFIG_CLK_BCM2711_DVP=y
 CONFIG_CLK_BCM2835=y
@@ -222,7 +221,6 @@ CONFIG_FWNODE_MDIO=y
 CONFIG_FW_CACHE=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_FW_LOADER_SYSFS=y
-CONFIG_GCC11_NO_ARRAY_BOUNDS=y
 CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_REGS=y
 CONFIG_GENERIC_ALLOCATOR=y
 CONFIG_GENERIC_ARCH_TOPOLOGY=y
diff --git a/target/linux/bmips/bcm6318/config-6.1 b/target/linux/bmips/bcm6318/config-6.1
index 526319da33d8..9837bc74458e 100644
--- a/target/linux/bmips/bcm6318/config-6.1
+++ b/target/linux/bmips/bcm6318/config-6.1
@@ -18,7 +18,6 @@ CONFIG_BLK_MQ_PCI=y
 CONFIG_BLK_PM=y
 CONFIG_BMIPS_GENERIC=y
 CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5"
-CONFIG_CC_NO_ARRAY_BOUNDS=y
 CONFIG_CEVT_R4K=y
 # CONFIG_CLK_BCM63268_TIMER is not set
 CONFIG_CLK_BCM_63XX_GATE=y
@@ -82,7 +81,6 @@ CONFIG_FWNODE_MDIO=y
 CONFIG_FW_CFE=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_FW_LOADER_SYSFS=y
-CONFIG_GCC11_NO_ARRAY_BOUNDS=y
 CONFIG_GENERIC_ATOMIC64=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_CMOS_UPDATE=y
diff --git a/target/linux/bmips/bcm63268/config-6.1 b/target/linux/bmips/bcm63268/config-6.1
index 624c00556db9..534307bd3222 100644
--- a/target/linux/bmips/bcm63268/config-6.1
+++ b/target/linux/bmips/bcm63268/config-6.1
@@ -18,7 +18,6 @@ CONFIG_BLK_MQ_PCI=y
 CONFIG_BLK_PM=y
 CONFIG_BMIPS_GENERIC=y
 CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5"
-CONFIG_CC_NO_ARRAY_BOUNDS=y
 CONFIG_CEVT_R4K=y
 CONFIG_CLK_BCM63268_TIMER=y
 CONFIG_CLK_BCM_63XX_GATE=y
@@ -83,7 +82,6 @@ CONFIG_FWNODE_MDIO=y
 CONFIG_FW_CFE=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_FW_LOADER_SYSFS=y
-CONFIG_GCC11_NO_ARRAY_BOUNDS=y
 CONFIG_GENERIC_ATOMIC64=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_CMOS_UPDATE=y
diff --git a/target/linux/bmips/bcm6328/config-6.1 b/target/linux/bmips/bcm6328/config-6.1
index 5b33e932360f..fb01efc7add1 100644
--- a/target/linux/bmips/bcm6328/config-6.1
+++ b/target/linux/bmips/bcm6328/config-6.1
@@ -18,7 +18,6 @@ CONFIG_BLK_MQ_PCI=y
 CONFIG_BLK_PM=y
 CONFIG_BMIPS_GENERIC=y
 CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5"
-CONFIG_CC_NO_ARRAY_BOUNDS=y
 CONFIG_CEVT_R4K=y
 # CONFIG_CLK_BCM63268_TIMER is not set
 CONFIG_CLK_BCM_63XX_GATE=y
@@ -83,7 +82,6 @@ CONFIG_FWNODE_MDIO=y
 CONFIG_FW_CFE=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_FW_LOADER_SYSFS=y
-CONFIG_GCC11_NO_ARRAY_BOUNDS=y
 CONFIG_GENERIC_ATOMIC64=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_CMOS_UPDATE=y
diff --git a/target/linux/bmips/bcm6358/config-6.1 b/target/linux/bmips/bcm6358/config-6.1
index 8ca1ca3af54a..de042e860b89 100644
--- a/target/linux/bmips/bcm6358/config-6.1
+++ b/target/linux/bmips/bcm6358/config-6.1
@@ -16,7 +16,6 @@ CONFIG_BLK_MQ_PCI=y
 CONFIG_BLK_PM=y
 CONFIG_BMIPS_GENERIC=y
 CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5"
-CONFIG_CC_NO_ARRAY_BOUNDS=y
 CONFIG_CEVT_R4K=y
 # CONFIG_CLK_BCM63268_TIMER is not set
 CONFIG_CLK_BCM_63XX_GATE=y
@@ -80,7 +79,6 @@ CONFIG_FWNODE_MDIO=y
 CONFIG_FW_CFE=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_FW_LOADER_SYSFS=y
-CONFIG_GCC11_NO_ARRAY_BOUNDS=y
 CONFIG_GENERIC_ATOMIC64=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_CMOS_UPDATE=y
diff --git a/target/linux/bmips/bcm6362/config-6.1 b/target/linux/bmips/bcm6362/config-6.1
index dba808dfb232..b1b3e9bec229 100644
--- a/target/linux/bmips/bcm6362/config-6.1
+++ b/target/linux/bmips/bcm6362/config-6.1
@@ -18,7 +18,6 @@ CONFIG_BLK_MQ_PCI=y
 CONFIG_BLK_PM=y
 CONFIG_BMIPS_GENERIC=y
 CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5"
-CONFIG_CC_NO_ARRAY_BOUNDS=y
 CONFIG_CEVT_R4K=y
 # CONFIG_CLK_BCM63268_TIMER is not set
 CONFIG_CLK_BCM_63XX_GATE=y
@@ -83,7 +82,6 @@ CONFIG_FWNODE_MDIO=y
 CONFIG_FW_CFE=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_FW_LOADER_SYSFS=y
-CONFIG_GCC11_NO_ARRAY_BOUNDS=y
 CONFIG_GENERIC_ATOMIC64=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_CMOS_UPDATE=y
diff --git a/target/linux/bmips/bcm6368/config-6.1 b/target/linux/bmips/bcm6368/config-6.1
index 13915425d857..eba0f09fda4f 100644
--- a/target/linux/bmips/bcm6368/config-6.1
+++ b/target/linux/bmips/bcm6368/config-6.1
@@ -17,7 +17,6 @@ CONFIG_BLK_MQ_PCI=y
 CONFIG_BLK_PM=y
 CONFIG_BMIPS_GENERIC=y
 CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5"
-CONFIG_CC_NO_ARRAY_BOUNDS=y
 CONFIG_CEVT_R4K=y
 # CONFIG_CLK_BCM63268_TIMER is not set
 CONFIG_CLK_BCM_63XX_GATE=y
@@ -82,7 +81,6 @@ CONFIG_FWNODE_MDIO=y
 CONFIG_FW_CFE=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_FW_LOADER_SYSFS=y
-CONFIG_GCC11_NO_ARRAY_BOUNDS=y
 CONFIG_GENERIC_ATOMIC64=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_CMOS_UPDATE=y
diff --git a/target/linux/generic/config-6.1 b/target/linux/generic/config-6.1
index 8ba82f422278..cc5983782c4a 100644
--- a/target/linux/generic/config-6.1
+++ b/target/linux/generic/config-6.1
@@ -920,6 +920,7 @@ CONFIG_CARDBUS=y
 # CONFIG_CC10001_ADC is not set
 # CONFIG_CCS811 is not set
 CONFIG_CC_CAN_LINK=y
+CONFIG_CC_NO_ARRAY_BOUNDS=y
 CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 # CONFIG_CDROM_PKTCDVD is not set
@@ -2232,6 +2233,7 @@ CONFIG_GACT_PROB=y
 # CONFIG_GADGET_UAC1 is not set
 # CONFIG_GAMEPORT is not set
 # CONFIG_GATEWORKS_GW16083 is not set
+CONFIG_GCC11_NO_ARRAY_BOUNDS=y
 # CONFIG_GCC_PLUGINS is not set
 # CONFIG_GCOV is not set
 # CONFIG_GCOV_KERNEL is not set
diff --git a/target/linux/mediatek/filogic/config-6.1 b/target/linux/mediatek/filogic/config-6.1
index 96a756673543..435bee72ddac 100644
--- a/target/linux/mediatek/filogic/config-6.1
+++ b/target/linux/mediatek/filogic/config-6.1
@@ -51,7 +51,6 @@ CONFIG_BSD_PROCESS_ACCT_V3=y
 CONFIG_CC_HAVE_SHADOW_CALL_STACK=y
 CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y
 CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5"
-CONFIG_CC_NO_ARRAY_BOUNDS=y
 CONFIG_CLKSRC_MMIO=y
 CONFIG_CLONE_BACKWARDS=y
 CONFIG_CMDLINE_OVERRIDE=y
@@ -156,7 +155,6 @@ CONFIG_FS_MBCACHE=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_FW_LOADER_SYSFS=y
-CONFIG_GCC11_NO_ARRAY_BOUNDS=y
 CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_REGS=y
 CONFIG_GENERIC_ALLOCATOR=y
 CONFIG_GENERIC_ARCH_TOPOLOGY=y
diff --git a/target/linux/mediatek/mt7622/config-6.1 b/target/linux/mediatek/mt7622/config-6.1
index 7055e4d7285b..223e32dc7dec 100644
--- a/target/linux/mediatek/mt7622/config-6.1
+++ b/target/linux/mediatek/mt7622/config-6.1
@@ -51,7 +51,6 @@ CONFIG_BSD_PROCESS_ACCT_V3=y
 CONFIG_CC_HAVE_SHADOW_CALL_STACK=y
 CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y
 CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5"
-CONFIG_CC_NO_ARRAY_BOUNDS=y
 CONFIG_CLKSRC_MMIO=y
 CONFIG_CLONE_BACKWARDS=y
 # CONFIG_CMDLINE_OVERRIDE is not set
@@ -161,7 +160,6 @@ CONFIG_FS_MBCACHE=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_FW_LOADER_SYSFS=y
-CONFIG_GCC11_NO_ARRAY_BOUNDS=y
 CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_REGS=y
 CONFIG_GENERIC_ALLOCATOR=y
 CONFIG_GENERIC_ARCH_TOPOLOGY=y
diff --git a/target/linux/mediatek/mt7623/config-6.1 b/target/linux/mediatek/mt7623/config-6.1
index b6a75ab80a63..1777c89a9a3a 100644
--- a/target/linux/mediatek/mt7623/config-6.1
+++ b/target/linux/mediatek/mt7623/config-6.1
@@ -52,7 +52,6 @@ CONFIG_BOUNCE=y
 # CONFIG_CACHE_L2X0 is not set
 CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y
 CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5"
-CONFIG_CC_NO_ARRAY_BOUNDS=y
 CONFIG_CLKSRC_MMIO=y
 CONFIG_CLONE_BACKWARDS=y
 CONFIG_CMDLINE="earlyprintk console=ttyS0,115200 rootfstype=squashfs,jffs2"
@@ -231,7 +230,6 @@ CONFIG_FWNODE_MDIO=y
 CONFIG_FW_CACHE=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_FW_LOADER_SYSFS=y
-CONFIG_GCC11_NO_ARRAY_BOUNDS=y
 CONFIG_GENERIC_ALLOCATOR=y
 CONFIG_GENERIC_BUG=y
 CONFIG_GENERIC_CLOCKEVENTS=y
diff --git a/target/linux/mediatek/mt7629/config-6.1 b/target/linux/mediatek/mt7629/config-6.1
index c0c501e59e14..707e54ba2bea 100644
--- a/target/linux/mediatek/mt7629/config-6.1
+++ b/target/linux/mediatek/mt7629/config-6.1
@@ -38,7 +38,6 @@ CONFIG_BSD_PROCESS_ACCT_V3=y
 CONFIG_CACHE_L2X0=y
 CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y
 CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5"
-CONFIG_CC_NO_ARRAY_BOUNDS=y
 # CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set
 CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_CHR_DEV_SCH=y
@@ -113,7 +112,6 @@ CONFIG_FRAME_WARN=1024
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_FW_LOADER_SYSFS=y
-CONFIG_GCC11_NO_ARRAY_BOUNDS=y
 CONFIG_GENERIC_ALLOCATOR=y
 CONFIG_GENERIC_ARCH_TOPOLOGY=y
 CONFIG_GENERIC_BUG=y
diff --git a/target/linux/qualcommax/config-6.1 b/target/linux/qualcommax/config-6.1
index ec44e936b441..d1fd1b301348 100644
--- a/target/linux/qualcommax/config-6.1
+++ b/target/linux/qualcommax/config-6.1
@@ -66,7 +66,6 @@ CONFIG_CAVIUM_TX2_ERRATUM_219=y
 CONFIG_CC_HAVE_SHADOW_CALL_STACK=y
 CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y
 CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5"
-CONFIG_CC_NO_ARRAY_BOUNDS=y
 CONFIG_CLONE_BACKWARDS=y
 CONFIG_COMMON_CLK=y
 CONFIG_COMMON_CLK_QCOM=y
@@ -149,7 +148,6 @@ CONFIG_FUJITSU_ERRATUM_010001=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_FW_LOADER_SYSFS=y
-CONFIG_GCC11_NO_ARRAY_BOUNDS=y
 CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_REGS=y
 CONFIG_GENERIC_ALLOCATOR=y
 CONFIG_GENERIC_ARCH_TOPOLOGY=y
diff --git a/target/linux/rockchip/armv8/config-6.1 b/target/linux/rockchip/armv8/config-6.1
index e21de9a34849..1df24d5f0ace 100644
--- a/target/linux/rockchip/armv8/config-6.1
+++ b/target/linux/rockchip/armv8/config-6.1
@@ -97,7 +97,6 @@ CONFIG_BSD_PROCESS_ACCT_V3=y
 CONFIG_CC_HAVE_SHADOW_CALL_STACK=y
 CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y
 CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5"
-CONFIG_CC_NO_ARRAY_BOUNDS=y
 CONFIG_CHARGER_GPIO=y
 # CONFIG_CHARGER_RK817 is not set
 CONFIG_CLKSRC_MMIO=y
@@ -232,7 +231,6 @@ CONFIG_FS_POSIX_ACL=y
 CONFIG_FWNODE_MDIO=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_FW_LOADER_SYSFS=y
-CONFIG_GCC11_NO_ARRAY_BOUNDS=y
 CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_REGS=y
 CONFIG_GENERIC_ALLOCATOR=y
 CONFIG_GENERIC_ARCH_TOPOLOGY=y
diff --git a/target/linux/uml/config-6.1 b/target/linux/uml/config-6.1
index da4eaac3ac3b..0eba1006bbfe 100644
--- a/target/linux/uml/config-6.1
+++ b/target/linux/uml/config-6.1
@@ -42,7 +42,6 @@ CONFIG_FS_IOMAP=y
 CONFIG_FS_MBCACHE=y
 CONFIG_FW_LOADER_PAGED_BUF=y
 CONFIG_FW_LOADER_SYSFS=y
-CONFIG_GCC11_NO_ARRAY_BOUNDS=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 # CONFIG_GENERIC_CPU is not set
 CONFIG_GENERIC_CPU_DEVICES=y
-- 
2.41.0



From tmn505 at terefe.re  Thu Jul 27 13:25:46 2023
From: tmn505 at terefe.re (Tomasz Maciej Nowak)
Date: Thu, 27 Jul 2023 22:25:46 +0200
Subject: [PATCH 2/4] tegra: copy patches and config for kernel 6.1
In-Reply-To: <20230727203216.190578-1-tmn505@terefe.re>
References: <20230727203216.190578-1-tmn505@terefe.re>
Message-ID: <20230727203216.190578-3-tmn505@terefe.re>

From: Tomasz Maciej Nowak <tmn505 at gmail.com>

Prepare for addition of kernel 6.1 support.

Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
---
 target/linux/tegra/config-6.1                 | 504 ++++++++++++++++++
 ...interrupts-due-to-tegra2-silicon-bug.patch |  77 +++
 ...enable-front-panel-leds-in-TrimSlice.patch |  46 ++
 3 files changed, 627 insertions(+)
 create mode 100644 target/linux/tegra/config-6.1
 create mode 100644 target/linux/tegra/patches-6.1/100-serial8250-on-tegra-hsuart-recover-from-spurious-interrupts-due-to-tegra2-silicon-bug.patch
 create mode 100644 target/linux/tegra/patches-6.1/101-ARM-dtc-tegra-enable-front-panel-leds-in-TrimSlice.patch

diff --git a/target/linux/tegra/config-6.1 b/target/linux/tegra/config-6.1
new file mode 100644
index 000000000000..257ffda252ad
--- /dev/null
+++ b/target/linux/tegra/config-6.1
@@ -0,0 +1,504 @@
+CONFIG_AC97_BUS=y
+# CONFIG_AHCI_TEGRA is not set
+CONFIG_ALIGNMENT_TRAP=y
+CONFIG_ARCH_32BIT_OFF_T=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_KEEP_MEMBLOCK=y
+CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
+CONFIG_ARCH_MULTIPLATFORM=y
+CONFIG_ARCH_MULTI_V6_V7=y
+CONFIG_ARCH_MULTI_V7=y
+CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED=y
+CONFIG_ARCH_NR_GPIO=1024
+CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y
+CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT=y
+CONFIG_ARCH_SELECT_MEMORY_MODEL=y
+CONFIG_ARCH_SPARSEMEM_ENABLE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARCH_TEGRA=y
+# CONFIG_ARCH_TEGRA_114_SOC is not set
+# CONFIG_ARCH_TEGRA_124_SOC is not set
+CONFIG_ARCH_TEGRA_2x_SOC=y
+# CONFIG_ARCH_TEGRA_3x_SOC is not set
+CONFIG_ARM=y
+CONFIG_ARM_AMBA=y
+CONFIG_ARM_CPU_SUSPEND=y
+CONFIG_ARM_CRYPTO=y
+CONFIG_ARM_ERRATA_720789=y
+CONFIG_ARM_ERRATA_754327=y
+CONFIG_ARM_ERRATA_764369=y
+CONFIG_ARM_GIC=y
+CONFIG_ARM_HAS_SG_CHAIN=y
+CONFIG_ARM_HEAVY_MB=y
+CONFIG_ARM_L1_CACHE_SHIFT=6
+CONFIG_ARM_L1_CACHE_SHIFT_6=y
+CONFIG_ARM_PATCH_IDIV=y
+CONFIG_ARM_PATCH_PHYS_VIRT=y
+# CONFIG_ARM_PL172_MPMC is not set
+# CONFIG_ARM_SMMU is not set
+# CONFIG_ARM_TEGRA124_CPUFREQ is not set
+CONFIG_ARM_TEGRA20_CPUFREQ=y
+CONFIG_ARM_TEGRA_CPUIDLE=y
+CONFIG_ARM_THUMB=y
+CONFIG_ARM_THUMBEE=y
+CONFIG_ARM_UNWIND=y
+CONFIG_ARM_VIRT_EXT=y
+CONFIG_ASN1=y
+CONFIG_ATA=y
+CONFIG_ATAGS=y
+CONFIG_AUTO_ZRELADDR=y
+CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK=y
+CONFIG_BLK_DEV_BSG=y
+CONFIG_BLK_DEV_BSG_COMMON=y
+CONFIG_BLK_DEV_LOOP=y
+CONFIG_BLK_MQ_PCI=y
+CONFIG_BLK_PM=y
+CONFIG_BOUNCE=y
+CONFIG_CACHE_L2X0=y
+CONFIG_CLKSRC_MMIO=y
+CONFIG_CLONE_BACKWARDS=y
+CONFIG_CLZ_TAB=y
+CONFIG_CMA=y
+CONFIG_CMA_ALIGNMENT=8
+CONFIG_CMA_AREAS=7
+# CONFIG_CMA_DEBUG is not set
+# CONFIG_CMA_DEBUGFS is not set
+CONFIG_CMA_SIZE_MBYTES=16
+# CONFIG_CMA_SIZE_SEL_MAX is not set
+CONFIG_CMA_SIZE_SEL_MBYTES=y
+# CONFIG_CMA_SIZE_SEL_MIN is not set
+# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set
+# CONFIG_CMA_SYSFS is not set
+CONFIG_COMMON_CLK=y
+CONFIG_COMPAT_32BIT_TIME=y
+CONFIG_CONTIG_ALLOC=y
+CONFIG_CPUFREQ_DT=y
+CONFIG_CPUFREQ_DT_PLATDEV=y
+CONFIG_CPU_32v6K=y
+CONFIG_CPU_32v7=y
+CONFIG_CPU_ABRT_EV7=y
+CONFIG_CPU_CACHE_V7=y
+CONFIG_CPU_CACHE_VIPT=y
+CONFIG_CPU_COPY_V6=y
+CONFIG_CPU_CP15=y
+CONFIG_CPU_CP15_MMU=y
+CONFIG_CPU_FREQ=y
+CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
+# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
+CONFIG_CPU_FREQ_GOV_ATTR_SET=y
+CONFIG_CPU_FREQ_GOV_COMMON=y
+CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
+CONFIG_CPU_FREQ_GOV_ONDEMAND=y
+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
+CONFIG_CPU_FREQ_GOV_POWERSAVE=y
+CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y
+CONFIG_CPU_FREQ_GOV_USERSPACE=y
+# CONFIG_CPU_FREQ_STAT is not set
+CONFIG_CPU_HAS_ASID=y
+CONFIG_CPU_IDLE=y
+CONFIG_CPU_IDLE_GOV_LADDER=y
+CONFIG_CPU_PABRT_V7=y
+CONFIG_CPU_PM=y
+CONFIG_CPU_RMAP=y
+CONFIG_CPU_SPECTRE=y
+CONFIG_CPU_THUMB_CAPABLE=y
+CONFIG_CPU_TLB_V7=y
+CONFIG_CPU_V7=y
+CONFIG_CRC16=y
+# CONFIG_CRC32_SARWATE is not set
+CONFIG_CRC32_SLICEBY8=y
+CONFIG_CROSS_MEMORY_ATTACH=y
+CONFIG_CRYPTO_AES_ARM=y
+CONFIG_CRYPTO_CRC32=y
+CONFIG_CRYPTO_CRC32C=y
+CONFIG_CRYPTO_CRYPTD=y
+CONFIG_CRYPTO_DEFLATE=y
+CONFIG_CRYPTO_DRBG=y
+CONFIG_CRYPTO_DRBG_HMAC=y
+CONFIG_CRYPTO_DRBG_MENU=y
+CONFIG_CRYPTO_ECHAINIV=y
+CONFIG_CRYPTO_HMAC=y
+CONFIG_CRYPTO_JITTERENTROPY=y
+CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y
+CONFIG_CRYPTO_LIB_SHA256=y
+CONFIG_CRYPTO_LZ4=y
+CONFIG_CRYPTO_LZ4HC=y
+CONFIG_CRYPTO_LZO=y
+CONFIG_CRYPTO_RNG=y
+CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_RNG_DEFAULT=y
+CONFIG_CRYPTO_RSA=y
+CONFIG_CRYPTO_SEQIV=y
+CONFIG_CRYPTO_SHA1=y
+CONFIG_CRYPTO_SHA1_ARM=y
+CONFIG_CRYPTO_SHA256=y
+CONFIG_CRYPTO_SHA256_ARM=y
+CONFIG_CRYPTO_SHA512=y
+CONFIG_CRYPTO_SHA512_ARM=y
+CONFIG_CRYPTO_TWOFISH=y
+CONFIG_CRYPTO_TWOFISH_COMMON=y
+CONFIG_DCACHE_WORD_ACCESS=y
+CONFIG_DEBUG_ALIGN_RODATA=y
+CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
+# CONFIG_DEVFREQ_GOV_PASSIVE is not set
+# CONFIG_DEVFREQ_GOV_PERFORMANCE is not set
+# CONFIG_DEVFREQ_GOV_POWERSAVE is not set
+CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y
+# CONFIG_DEVFREQ_GOV_USERSPACE is not set
+CONFIG_DEVFREQ_THERMAL=y
+# CONFIG_DEVPORT is not set
+CONFIG_DMADEVICES=y
+CONFIG_DMA_CMA=y
+CONFIG_DMA_ENGINE=y
+CONFIG_DMA_OF=y
+CONFIG_DMA_OPS=y
+CONFIG_DMA_REMAP=y
+CONFIG_DMA_SHARED_BUFFER=y
+CONFIG_DNOTIFY=y
+CONFIG_DRM=y
+CONFIG_DRM_BRIDGE=y
+CONFIG_DRM_FBDEV_EMULATION=y
+CONFIG_DRM_FBDEV_OVERALLOC=100
+CONFIG_DRM_KMS_HELPER=y
+CONFIG_DRM_MIPI_DSI=y
+CONFIG_DRM_PANEL=y
+CONFIG_DRM_PANEL_BRIDGE=y
+CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y
+CONFIG_DRM_TEGRA=y
+# CONFIG_DRM_TEGRA_DEBUG is not set
+# CONFIG_DRM_TEGRA_STAGING is not set
+CONFIG_DTC=y
+CONFIG_EDAC_ATOMIC_SCRUB=y
+CONFIG_EDAC_SUPPORT=y
+CONFIG_EXT4_FS=y
+CONFIG_EXTCON=y
+CONFIG_F2FS_FS=y
+CONFIG_FB=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+CONFIG_FB_CMDLINE=y
+CONFIG_FB_DEFERRED_IO=y
+CONFIG_FB_SYS_COPYAREA=y
+CONFIG_FB_SYS_FILLRECT=y
+CONFIG_FB_SYS_FOPS=y
+CONFIG_FB_SYS_IMAGEBLIT=y
+CONFIG_FIX_EARLYCON_MEM=y
+CONFIG_FS_IOMAP=y
+CONFIG_FS_MBCACHE=y
+CONFIG_FW_LOADER_PAGED_BUF=y
+CONFIG_GENERIC_ALLOCATOR=y
+CONFIG_GENERIC_ARCH_TOPOLOGY=y
+CONFIG_GENERIC_BUG=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
+CONFIG_GENERIC_CPU_AUTOPROBE=y
+CONFIG_GENERIC_CPU_VULNERABILITIES=y
+CONFIG_GENERIC_EARLY_IOREMAP=y
+CONFIG_GENERIC_GETTIMEOFDAY=y
+CONFIG_GENERIC_IDLE_POLL_SETUP=y
+CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y
+CONFIG_GENERIC_IRQ_MIGRATION=y
+CONFIG_GENERIC_IRQ_MULTI_HANDLER=y
+CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
+CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED=y
+CONFIG_GENERIC_MSI_IRQ=y
+CONFIG_GENERIC_MSI_IRQ_DOMAIN=y
+CONFIG_GENERIC_PCI_IOMAP=y
+CONFIG_GENERIC_PHY=y
+CONFIG_GENERIC_PINCONF=y
+CONFIG_GENERIC_PINCTRL_GROUPS=y
+CONFIG_GENERIC_PINMUX_FUNCTIONS=y
+CONFIG_GENERIC_SCHED_CLOCK=y
+CONFIG_GENERIC_SMP_IDLE_THREAD=y
+CONFIG_GENERIC_STRNCPY_FROM_USER=y
+CONFIG_GENERIC_STRNLEN_USER=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
+CONFIG_GENERIC_VDSO_32=y
+CONFIG_GLOB=y
+CONFIG_GPIOLIB_IRQCHIP=y
+CONFIG_GPIO_CDEV=y
+CONFIG_GPIO_TEGRA=y
+CONFIG_HANDLE_DOMAIN_IRQ=y
+CONFIG_HARDEN_BRANCH_PREDICTOR=y
+CONFIG_HARDIRQS_SW_RESEND=y
+CONFIG_HAS_DMA=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT_MAP=y
+CONFIG_HAVE_SMP=y
+CONFIG_HDMI=y
+CONFIG_HID=y
+CONFIG_HIDRAW=y
+CONFIG_HID_GENERIC=y
+CONFIG_HIGHMEM=y
+CONFIG_HIGHPTE=y
+CONFIG_HOTPLUG_CPU=y
+CONFIG_HWMON=y
+CONFIG_HZ_FIXED=0
+CONFIG_HZ_PERIODIC=y
+CONFIG_I2C=y
+CONFIG_I2C_ALGOBIT=y
+CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_COMPAT=y
+CONFIG_I2C_TEGRA=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_INPUT=y
+CONFIG_INPUT_KEYBOARD=y
+CONFIG_INTERCONNECT=y
+CONFIG_IOMMU_API=y
+# CONFIG_IOMMU_DEBUGFS is not set
+CONFIG_IOMMU_DEFAULT_DMA_STRICT=y
+CONFIG_IOMMU_IOVA=y
+# CONFIG_IOMMU_IO_PGTABLE_ARMV7S is not set
+# CONFIG_IOMMU_IO_PGTABLE_LPAE is not set
+CONFIG_IOMMU_SUPPORT=y
+CONFIG_IRQCHIP=y
+CONFIG_IRQ_DOMAIN=y
+CONFIG_IRQ_DOMAIN_HIERARCHY=y
+CONFIG_IRQ_FORCED_THREADING=y
+CONFIG_IRQ_WORK=y
+CONFIG_JBD2=y
+CONFIG_KCMP=y
+CONFIG_KEYBOARD_ATKBD=y
+CONFIG_KMAP_LOCAL=y
+CONFIG_KMAP_LOCAL_NON_LINEAR_PTE_ARRAY=y
+CONFIG_LIBFDT=y
+CONFIG_LOCK_DEBUGGING_SUPPORT=y
+CONFIG_LOCK_SPIN_ON_OWNER=y
+CONFIG_LZ4HC_COMPRESS=y
+CONFIG_LZ4_COMPRESS=y
+CONFIG_LZ4_DECOMPRESS=y
+CONFIG_LZO_COMPRESS=y
+CONFIG_LZO_DECOMPRESS=y
+CONFIG_MEMFD_CREATE=y
+CONFIG_MEMORY=y
+CONFIG_MEMORY_ISOLATION=y
+# CONFIG_MFD_ACER_A500_EC is not set
+# CONFIG_MFD_NVEC is not set
+CONFIG_MIGHT_HAVE_CACHE_L2X0=y
+CONFIG_MIGRATION=y
+CONFIG_MMC=y
+CONFIG_MMC_BLOCK=y
+CONFIG_MMC_CQHCI=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_IO_ACCESSORS=y
+# CONFIG_MMC_SDHCI_PCI is not set
+CONFIG_MMC_SDHCI_PLTFM=y
+CONFIG_MMC_SDHCI_TEGRA=y
+CONFIG_MODULES_USE_ELF_REL=y
+CONFIG_MPILIB=y
+CONFIG_MTD_SPI_NOR=y
+CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y
+CONFIG_MUTEX_SPIN_ON_OWNER=y
+CONFIG_NEED_DMA_MAP_STATE=y
+# CONFIG_NEON is not set
+CONFIG_NET_FLOW_LIMIT=y
+CONFIG_NLS=y
+CONFIG_NR_CPUS=4
+CONFIG_NVMEM=y
+CONFIG_OF=y
+CONFIG_OF_ADDRESS=y
+CONFIG_OF_EARLY_FLATTREE=y
+CONFIG_OF_FLATTREE=y
+CONFIG_OF_GPIO=y
+CONFIG_OF_IOMMU=y
+CONFIG_OF_IRQ=y
+CONFIG_OF_KOBJ=y
+CONFIG_OLD_SIGACTION=y
+CONFIG_OLD_SIGSUSPEND3=y
+CONFIG_OUTER_CACHE=y
+CONFIG_OUTER_CACHE_SYNC=y
+CONFIG_PADATA=y
+CONFIG_PAGE_OFFSET=0xC0000000
+CONFIG_PCI=y
+CONFIG_PCIEAER=y
+CONFIG_PCIEASPM=y
+CONFIG_PCIEASPM_DEFAULT=y
+# CONFIG_PCIEASPM_PERFORMANCE is not set
+# CONFIG_PCIEASPM_POWERSAVE is not set
+# CONFIG_PCIEASPM_POWER_SUPERSAVE is not set
+CONFIG_PCIEPORTBUS=y
+CONFIG_PCIE_PME=y
+CONFIG_PCI_DOMAINS=y
+CONFIG_PCI_DOMAINS_GENERIC=y
+CONFIG_PCI_MSI=y
+CONFIG_PCI_MSI_IRQ_DOMAIN=y
+CONFIG_PCI_TEGRA=y
+CONFIG_PERF_USE_VMALLOC=y
+CONFIG_PGTABLE_LEVELS=2
+CONFIG_PHY_TEGRA_XUSB=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_TEGRA=y
+CONFIG_PINCTRL_TEGRA20=y
+CONFIG_PINCTRL_TEGRA_XUSB=y
+CONFIG_PL310_ERRATA_727915=y
+CONFIG_PL310_ERRATA_769419=y
+CONFIG_PL353_SMC=y
+CONFIG_PM=y
+CONFIG_PM_CLK=y
+CONFIG_PM_DEVFREQ=y
+# CONFIG_PM_DEVFREQ_EVENT is not set
+CONFIG_PM_GENERIC_DOMAINS=y
+CONFIG_PM_GENERIC_DOMAINS_OF=y
+CONFIG_PM_OPP=y
+CONFIG_POWER_RESET=y
+CONFIG_POWER_RESET_GPIO=y
+CONFIG_POWER_SUPPLY=y
+CONFIG_PROC_PAGE_MONITOR=y
+CONFIG_PTP_1588_CLOCK_OPTIONAL=y
+CONFIG_PWM=y
+CONFIG_PWM_SYSFS=y
+CONFIG_PWM_TEGRA=y
+CONFIG_RAS=y
+CONFIG_RATIONAL=y
+CONFIG_REGMAP=y
+CONFIG_REGMAP_I2C=y
+CONFIG_REGMAP_MMIO=y
+CONFIG_REGMAP_SPI=y
+CONFIG_REGULATOR=y
+CONFIG_REGULATOR_FIXED_VOLTAGE=y
+CONFIG_REGULATOR_GPIO=y
+CONFIG_RESET_CONTROLLER=y
+CONFIG_RFS_ACCEL=y
+CONFIG_RPS=y
+CONFIG_RTC_CLASS=y
+# CONFIG_RTC_DRV_CMOS is not set
+CONFIG_RTC_DRV_TEGRA=y
+CONFIG_RTC_I2C_AND_SPI=y
+CONFIG_RTC_NVMEM=y
+CONFIG_RWSEM_SPIN_ON_OWNER=y
+CONFIG_SCSI=y
+CONFIG_SCSI_COMMON=y
+# CONFIG_SCSI_LOWLEVEL is not set
+# CONFIG_SCSI_PROC_FS is not set
+CONFIG_SERIAL_8250_FSL=y
+CONFIG_SERIAL_8250_TEGRA=y
+CONFIG_SERIAL_MCTRL_GPIO=y
+CONFIG_SERIAL_OF_PLATFORM=y
+CONFIG_SERIAL_TEGRA=y
+CONFIG_SERIO=y
+CONFIG_SERIO_LIBPS2=y
+CONFIG_SGL_ALLOC=y
+CONFIG_SG_POOL=y
+CONFIG_SMP=y
+CONFIG_SMP_ON_UP=y
+CONFIG_SND=y
+# CONFIG_SND_COMPRESS_OFFLOAD is not set
+CONFIG_SND_DMAENGINE_PCM=y
+# CONFIG_SND_DRIVERS is not set
+# CONFIG_SND_HDA_TEGRA is not set
+CONFIG_SND_JACK=y
+CONFIG_SND_JACK_INPUT_DEV=y
+# CONFIG_SND_PCI is not set
+CONFIG_SND_PCM=y
+# CONFIG_SND_PROC_FS is not set
+CONFIG_SND_SIMPLE_CARD=y
+CONFIG_SND_SIMPLE_CARD_UTILS=y
+CONFIG_SND_SOC=y
+CONFIG_SND_SOC_AC97_BUS=y
+CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y
+CONFIG_SND_SOC_I2C_AND_SPI=y
+CONFIG_SND_SOC_TEGRA=y
+# CONFIG_SND_SOC_TEGRA186_DSPK is not set
+CONFIG_SND_SOC_TEGRA20_AC97=y
+CONFIG_SND_SOC_TEGRA20_DAS=y
+CONFIG_SND_SOC_TEGRA20_I2S=y
+CONFIG_SND_SOC_TEGRA20_SPDIF=y
+# CONFIG_SND_SOC_TEGRA210_ADMAIF is not set
+# CONFIG_SND_SOC_TEGRA210_AHUB is not set
+# CONFIG_SND_SOC_TEGRA210_DMIC is not set
+# CONFIG_SND_SOC_TEGRA210_I2S is not set
+# CONFIG_SND_SOC_TEGRA30_AHUB is not set
+# CONFIG_SND_SOC_TEGRA30_I2S is not set
+# CONFIG_SND_SOC_TEGRA_ALC5632 is not set
+CONFIG_SND_SOC_TEGRA_MACHINE_DRV=y
+# CONFIG_SND_SOC_TEGRA_MAX98090 is not set
+# CONFIG_SND_SOC_TEGRA_RT5640 is not set
+# CONFIG_SND_SOC_TEGRA_RT5677 is not set
+# CONFIG_SND_SOC_TEGRA_SGTL5000 is not set
+CONFIG_SND_SOC_TEGRA_TRIMSLICE=y
+# CONFIG_SND_SOC_TEGRA_WM8753 is not set
+# CONFIG_SND_SOC_TEGRA_WM8903 is not set
+# CONFIG_SND_SOC_TEGRA_WM9712 is not set
+CONFIG_SND_SOC_TLV320AIC23=y
+CONFIG_SND_SOC_TLV320AIC23_I2C=y
+# CONFIG_SND_USB is not set
+CONFIG_SOCK_RX_QUEUE_MAPPING=y
+CONFIG_SOC_BUS=y
+CONFIG_SOC_TEGRA20_VOLTAGE_COUPLER=y
+CONFIG_SOC_TEGRA_FLOWCTRL=y
+CONFIG_SOC_TEGRA_FUSE=y
+CONFIG_SOC_TEGRA_PMC=y
+CONFIG_SOUND=y
+CONFIG_SOUND_OSS_CORE=y
+CONFIG_SOUND_OSS_CORE_PRECLAIM=y
+CONFIG_SPARSE_IRQ=y
+CONFIG_SPI=y
+CONFIG_SPI_MASTER=y
+CONFIG_SPI_MEM=y
+# CONFIG_SPI_TEGRA114 is not set
+CONFIG_SPI_TEGRA20_SFLASH=y
+CONFIG_SPI_TEGRA20_SLINK=y
+# CONFIG_SPI_TEGRA210_QUAD is not set
+CONFIG_SRCU=y
+CONFIG_SWP_EMULATE=y
+CONFIG_SYNC_FILE=y
+CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+CONFIG_TEGRA20_APB_DMA=y
+CONFIG_TEGRA20_EMC=y
+CONFIG_TEGRA_AHB=y
+CONFIG_TEGRA_GMI=y
+CONFIG_TEGRA_HOST1X=y
+CONFIG_TEGRA_HOST1X_FIREWALL=y
+CONFIG_TEGRA_IOMMU_GART=y
+# CONFIG_TEGRA_IOMMU_SMMU is not set
+# CONFIG_TEGRA_IVC is not set
+CONFIG_TEGRA_MC=y
+# CONFIG_TEGRA_SOCTHERM is not set
+CONFIG_TEGRA_TIMER=y
+CONFIG_TEGRA_WATCHDOG=y
+CONFIG_TICK_CPU_ACCOUNTING=y
+CONFIG_TIMER_OF=y
+CONFIG_TIMER_PROBE=y
+CONFIG_TREE_RCU=y
+CONFIG_TREE_SRCU=y
+# CONFIG_UACCE is not set
+# CONFIG_UCLAMP_TASK is not set
+CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
+CONFIG_UNWINDER_ARM=y
+CONFIG_USB=y
+CONFIG_USB_CHIPIDEA=y
+CONFIG_USB_CHIPIDEA_HOST=y
+CONFIG_USB_CHIPIDEA_TEGRA=y
+CONFIG_USB_CHIPIDEA_UDC=y
+CONFIG_USB_COMMON=y
+CONFIG_USB_CONN_GPIO=y
+CONFIG_USB_EHCI_HCD=y
+# CONFIG_USB_EHCI_HCD_PLATFORM is not set
+CONFIG_USB_EHCI_TEGRA=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_HID=y
+CONFIG_USB_HIDDEV=y
+CONFIG_USB_PHY=y
+CONFIG_USB_ROLE_SWITCH=y
+CONFIG_USB_SUPPORT=y
+CONFIG_USB_TEGRA_PHY=y
+# CONFIG_USB_TEGRA_XUDC is not set
+CONFIG_USB_ULPI=y
+CONFIG_USB_ULPI_BUS=y
+CONFIG_USB_ULPI_VIEWPORT=y
+# CONFIG_USB_XHCI_TEGRA is not set
+CONFIG_USE_OF=y
+CONFIG_VFP=y
+CONFIG_VFPv3=y
+CONFIG_WATCHDOG_CORE=y
+# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set
+CONFIG_XPS=y
+CONFIG_XZ_DEC_ARM=y
+CONFIG_XZ_DEC_ARMTHUMB=y
+CONFIG_XZ_DEC_BCJ=y
+CONFIG_ZBOOT_ROM_BSS=0
+CONFIG_ZBOOT_ROM_TEXT=0
+CONFIG_ZLIB_DEFLATE=y
+CONFIG_ZLIB_INFLATE=y
diff --git a/target/linux/tegra/patches-6.1/100-serial8250-on-tegra-hsuart-recover-from-spurious-interrupts-due-to-tegra2-silicon-bug.patch b/target/linux/tegra/patches-6.1/100-serial8250-on-tegra-hsuart-recover-from-spurious-interrupts-due-to-tegra2-silicon-bug.patch
new file mode 100644
index 000000000000..8f01f73eb24a
--- /dev/null
+++ b/target/linux/tegra/patches-6.1/100-serial8250-on-tegra-hsuart-recover-from-spurious-interrupts-due-to-tegra2-silicon-bug.patch
@@ -0,0 +1,77 @@
+From patchwork Fri Jul 13 11:32:42 2018
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: serial8250 on tegra hsuart: recover from spurious interrupts due to
+ tegra2 silicon bug
+X-Patchwork-Submitter: "David R. Piegdon" <lkml at p23q.org>
+X-Patchwork-Id: 943440
+Message-Id: <4676ea34-69ce-5422-1ded-94218b89f7d9 at p23q.org>
+To: linux-tegra at vger.kernel.org
+Date: Fri, 13 Jul 2018 11:32:42 +0000
+From: "David R. Piegdon" <lkml at p23q.org>
+List-Id: <linux-tegra.vger.kernel.org>
+
+Hi,
+a while back I sent a few mails regarding spurious interrupts in the
+UARTA (hsuart) block of the Tegra2 SoC, when using the 8250 driver for
+it instead of the hsuart driver. After going down a pretty deep
+debugging/testing hole, I think I found a patch that fixes the issue. So
+far testing in a reboot-cycle suggests that the error frequency dropped
+from >3% of all reboots to at least <0.05% of all reboots. Tests
+continue to run over the weekend.
+
+The patch below already is a second iteration; the first did not reset
+the MCR or contain the lines below '// clear interrupts'. This resulted
+in no more spurious interrupts, but in a few % of spurious interrupts
+that were recovered the UART block did not receive any characters any
+more. So further resetting was required to fully reacquire operational
+state of the UART block.
+
+I'd love any comments/suggestions on this!
+
+Cheers,
+
+David
+
+--- a/drivers/tty/serial/8250/8250_core.c
++++ b/drivers/tty/serial/8250/8250_core.c
+@@ -134,6 +134,38 @@ static irqreturn_t serial8250_interrupt(
+ 
+ 		if (l == i->head && pass_counter++ > PASS_LIMIT)
+ 			break;
++
++#ifdef CONFIG_ARCH_TEGRA_2x_SOC
++		if (!handled && (port->type == PORT_TEGRA)) {
++			/*
++			 * Fix Tegra 2 CPU silicon bug where sometimes
++			 * "TX holding register empty" interrupts result in a
++			 * bad (metastable?) state in Tegras HSUART IP core.
++			 * Only way to recover seems to be to reset all
++			 * interrupts as well as the TX queue and the MCR.
++			 * But we don't want to loose any outgoing characters,
++			 * so only do it if the RX and TX queues are empty.
++			 */
++			unsigned char lsr = port->serial_in(port, UART_LSR);
++			const unsigned char fifo_empty_mask =
++						(UART_LSR_TEMT | UART_LSR_THRE);
++			if (((lsr & (UART_LSR_DR | fifo_empty_mask)) ==
++							fifo_empty_mask)) {
++				port->serial_out(port, UART_IER, 0);
++				port->serial_out(port, UART_MCR, 0);
++				serial8250_clear_and_reinit_fifos(up);
++				port->serial_out(port, UART_MCR, up->mcr);
++				port->serial_out(port, UART_IER, up->ier);
++				// clear interrupts
++				serial_port_in(port, UART_LSR);
++				serial_port_in(port, UART_RX);
++				serial_port_in(port, UART_IIR);
++				serial_port_in(port, UART_MSR);
++				up->lsr_saved_flags = 0;
++				up->msr_saved_flags = 0;
++			}
++		}
++#endif
+ 	} while (l != end);
+ 
+ 	spin_unlock(&i->lock);
diff --git a/target/linux/tegra/patches-6.1/101-ARM-dtc-tegra-enable-front-panel-leds-in-TrimSlice.patch b/target/linux/tegra/patches-6.1/101-ARM-dtc-tegra-enable-front-panel-leds-in-TrimSlice.patch
new file mode 100644
index 000000000000..b1e210b212de
--- /dev/null
+++ b/target/linux/tegra/patches-6.1/101-ARM-dtc-tegra-enable-front-panel-leds-in-TrimSlice.patch
@@ -0,0 +1,46 @@
+--- a/arch/arm/boot/dts/tegra20-trimslice.dts
++++ b/arch/arm/boot/dts/tegra20-trimslice.dts
+@@ -201,16 +201,17 @@
+ 			conf_ata {
+ 				nvidia,pins = "ata", "atc", "atd", "ate",
+ 					"crtp", "dap2", "dap3", "dap4", "dta",
+-					"dtb", "dtc", "dtd", "dte", "gmb",
+-					"gme", "i2cp", "pta", "slxc", "slxd",
+-					"spdi", "spdo", "uda";
++					"dtb", "dtc", "dtd", "gmb", "gme",
++					"i2cp", "pta", "slxc", "slxd", "spdi",
++					"spdo", "uda";
+ 				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+ 				nvidia,tristate = <TEGRA_PIN_ENABLE>;
+ 			};
+ 			conf_atb {
+ 				nvidia,pins = "atb", "cdev1", "cdev2", "dap1",
+-					"gma", "gmc", "gmd", "gpu", "gpu7",
+-					"gpv", "sdio1", "slxa", "slxk", "uac";
++					"dte", "gma", "gmc", "gmd", "gpu",
++					"gpu7", "gpv", "sdio1", "slxa", "slxk",
++					"uac";
+ 				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+ 				nvidia,tristate = <TEGRA_PIN_DISABLE>;
+ 			};
+@@ -396,6 +397,20 @@
+ 		};
+ 	};
+ 
++	gpio-leds {
++		compatible = "gpio-leds";
++
++		ds2 {
++			label = "trimslice:green:right";
++			gpios = <&gpio TEGRA_GPIO(D, 2) GPIO_ACTIVE_LOW>;
++		};
++
++		ds3 {
++			label = "trimslice:green:left";
++			gpios = <&gpio TEGRA_GPIO(BB, 5) GPIO_ACTIVE_LOW>;
++		};
++	};
++
+ 	poweroff {
+ 		compatible = "gpio-poweroff";
+ 		gpios = <&gpio TEGRA_GPIO(X, 7) GPIO_ACTIVE_LOW>;
-- 
2.41.0



From ksperling at apple.com  Thu Jul 27 14:11:10 2023
From: ksperling at apple.com (Karsten Sperling)
Date: Fri, 28 Jul 2023 09:11:10 +1200
Subject: Matter integration
Message-ID: <5647AE5A-E096-4F33-AE9F-4EE1630DF097@apple.com>

Hello,

I?m part of an effort by the Connectivity Standards Alliance to bring support for routers and access points into Matter.  Matter is an open-source connectivity standard built to enable developers and device manufacturers to build reliable and secure connected home devices [1][2].

In this context we?re working on a reference implementation for Matter-enabled routers / access points, which will be taking the form of an OpenWRT feed.  Development on this has recently started at https://github.com/project-chip/matter-openwrt.  We?re using OpenWRT as a platform because of its open nature and great hardware support.  I wanted to reach out to make the OpenWRT developer community aware of this effort, and to invite you to collaborate with us if you?re interested.

On a more concrete level, I would also like to ask for support for this small PR on OpenWRT I?ve opened here: https://github.com/openwrt/openwrt/pull/13000

The cross-platform nature of the Matter SDK combined with the fact that it uses git sub-modules for dependency management results in the repo having a LOT of sub-modules (about 70 direct, 130 total), only 4 of which are needed when building within OpenWRT. Getting this PR merged would help us to get the Matter SDK and related software to build cleanly under OpenWRT.

Thanks!

[1] https://buildwithmatter.com <https://buildwithmatter.com/>
[2] https://github.com/project-chip/connectedhomeip



From dave.taht at gmail.com  Thu Jul 27 15:33:18 2023
From: dave.taht at gmail.com (Dave Taht)
Date: Thu, 27 Jul 2023 15:33:18 -0700
Subject: Matter integration
In-Reply-To: <mailman.22501.1690492298.1880391.openwrt-devel@lists.openwrt.org>
References: <mailman.22501.1690492298.1880391.openwrt-devel@lists.openwrt.org>
Message-ID: <CAA93jw4KJnMkhUsdDdG114X1BkGhsu+u=QFeFuLaJSBK__0A+A@mail.gmail.com>

So wonderful to see matter begin to matter!

https://forum.openwrt.org/t/cerowrt-ii-would-anyone-care/110554

regrettably I am mostly retired from openwrt now and do not understand
the workflow.

On Thu, Jul 27, 2023 at 2:14?PM Karsten Sperling via openwrt-devel
<openwrt-devel at lists.openwrt.org> wrote:
>
> The sender domain has a DMARC Reject/Quarantine policy which disallows
> sending mailing list messages using the original "From" header.
>
> To mitigate this problem, the original message has been wrapped
> automatically by the mailing list software.
>
>
> ---------- Forwarded message ----------
> From: Karsten Sperling <ksperling at apple.com>
> To: openwrt-devel at lists.openwrt.org
> Cc:
> Bcc:
> Date: Fri, 28 Jul 2023 09:11:10 +1200
> Subject: Matter integration
> Hello,
>
> I?m part of an effort by the Connectivity Standards Alliance to bring support for routers and access points into Matter.  Matter is an open-source connectivity standard built to enable developers and device manufacturers to build reliable and secure connected home devices [1][2].
>
> In this context we?re working on a reference implementation for Matter-enabled routers / access points, which will be taking the form of an OpenWRT feed.  Development on this has recently started at https://github.com/project-chip/matter-openwrt.  We?re using OpenWRT as a platform because of its open nature and great hardware support.  I wanted to reach out to make the OpenWRT developer community aware of this effort, and to invite you to collaborate with us if you?re interested.
>
> On a more concrete level, I would also like to ask for support for this small PR on OpenWRT I?ve opened here: https://github.com/openwrt/openwrt/pull/13000
>
> The cross-platform nature of the Matter SDK combined with the fact that it uses git sub-modules for dependency management results in the repo having a LOT of sub-modules (about 70 direct, 130 total), only 4 of which are needed when building within OpenWRT. Getting this PR merged would help us to get the Matter SDK and related software to build cleanly under OpenWRT.
>
> Thanks!
>
> [1] https://buildwithmatter.com <https://buildwithmatter.com/>
> [2] https://github.com/project-chip/connectedhomeip
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel



-- 
Podcast: https://www.youtube.com/watch?v=bxmoBr4cBKg
Dave T?ht CSO, LibreQos


From ms at dev.tdt.de  Thu Jul 27 23:39:54 2023
From: ms at dev.tdt.de (Martin Schiller)
Date: Fri, 28 Jul 2023 08:39:54 +0200
Subject: kernel-headers: platform/target patches are not applied
In-Reply-To: <9dc30307-b30f-0274-390c-871fa34f7cad@nbd.name>
References: <86f925f23687a1cd0216415e6b70bfa2@dev.tdt.de>
 <9dc30307-b30f-0274-390c-871fa34f7cad@nbd.name>
Message-ID: <b47c6aea5577209dd8ba1ed295b99210@dev.tdt.de>

Hi Felix,

On 2023-07-27 22:26, Felix Fietkau wrote:
> Hi Martin,
> 
> On 27.07.23 13:23, Martin Schiller wrote:
>> When preparing the kernel sources to build the kernel headers, 
>> currently
>> only the patches from the generic folder are applied, but not from the
>> actual selected target.
>> 
>> This is basically understandable if one assumes that one wants to use 
>> a
>> toolchain for different targets with the same architecture.
>> 
>> But if a target has a kernel patch which also changes the uapi, then
>> this is not considered in the toolchain/kernel-headers and thus when
>> compiling Userspace applications at the moment.
>> 
>> This is currently already the case for the following targets:
>> * ath79
>> * bcm27xx
>> * bcm63xx
>> * ipq40xx
>> * lantiq
>> * realtek
>> 
>> I am currently working on a new target, have now stumbled across this
>> problem and would now like to start a discussion here on how best to
>> solve this now.
>> 
>> I am looking forward to your ideas.
> 
> Packages that depend on target specific UAPI changes can always
> include kernel.mk in the package Makefile, make themselves non-shared
> and pull include files from $(LINUX_DIR)/user_headers
> 
> The default for all other packages should be to not rely on target
> specific UAPI changes.
> 
> - Felix

Yes, that is a viable way.

Thanks Felix for the quick answer!

- Martin


From arinc.unal at arinc9.com  Fri Jul 28 00:51:40 2023
From: arinc.unal at arinc9.com (=?UTF-8?B?QXLEsW7DpyDDnE5BTA==?=)
Date: Fri, 28 Jul 2023 10:51:40 +0300
Subject: [PATCH] ramips: replace "mac-address-ascii" with "mac-base"
In-Reply-To: <20230714131114.26906-1-zajec5@gmail.com>
References: <20230714131114.26906-1-zajec5@gmail.com>
Message-ID: <a393b3a2-ed19-378f-2306-f49b3dd871ad@arinc9.com>

Hi Rafa?.

I am late to this so I just wanted to say thanks for doing this. We're 
one step closer to mainlining the DTs of the MT7621 SoC devices.

Ar?n?

On 14.07.2023 16:11, Rafa? Mi?ecki wrote:
> From: Rafa? Mi?ecki <rafal at milecki.pl>
> 
> With upstream accepted "mac-base" binding there is no need for a
> downstream "mac-address-ascii" workaround anymore.
> 
> Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
> ---
>   .../dts/mt7621_raisecom_msg1500-x-00.dts      | 32 ++++++++++-------
>   .../ramips/dts/mt7621_tplink_ec330-g5u-v1.dts | 34 +++++++++++--------
>   2 files changed, 40 insertions(+), 26 deletions(-)
> 
> diff --git a/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts b/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts
> index 5d713c0098..07297df083 100644
> --- a/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts
> +++ b/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts
> @@ -82,15 +82,23 @@
>   			read-only;
>   
>   			compatible = "nvmem-cells";
> -			#address-cells = <1>;
> -			#size-cells = <1>;
> -
> -			macaddr_config_8014: macaddr at 8014 {
> -				reg = <0x8014 0x11>;
> -			};
>   
> -			macaddr_config_8036: macaddr at 8036 {
> -				reg = <0x8036 0x11>;
> +			nvmem-layout {
> +				compatible = "fixed-layout";
> +				#address-cells = <1>;
> +				#size-cells = <1>;
> +
> +				macaddr_config_8014: macaddr at 8014 {
> +					compatible = "mac-base";
> +					reg = <0x8014 0x11>;
> +					#nvmem-cell-cells = <1>;
> +				};
> +
> +				macaddr_config_8036: macaddr at 8036 {
> +					compatible = "mac-base";
> +					reg = <0x8036 0x11>;
> +					#nvmem-cell-cells = <1>;
> +				};
>   			};
>   		};
>   
> @@ -137,8 +145,8 @@
>   };
>   
>   &gmac0 {
> -	nvmem-cells = <&macaddr_config_8014>;
> -	nvmem-cell-names = "mac-address-ascii";
> +	nvmem-cells = <&macaddr_config_8014 0>;
> +	nvmem-cell-names = "mac-address";
>   };
>   
>   &gmac1 {
> @@ -146,8 +154,8 @@
>   	label = "wan";
>   	phy-handle = <&ethphy4>;
>   
> -	nvmem-cells = <&macaddr_config_8036>;
> -	nvmem-cell-names = "mac-address-ascii";
> +	nvmem-cells = <&macaddr_config_8036 0>;
> +	nvmem-cell-names = "mac-address";
>   };
>   
>   &mdio {
> diff --git a/target/linux/ramips/dts/mt7621_tplink_ec330-g5u-v1.dts b/target/linux/ramips/dts/mt7621_tplink_ec330-g5u-v1.dts
> index 6c9cc40701..537b6f70a7 100644
> --- a/target/linux/ramips/dts/mt7621_tplink_ec330-g5u-v1.dts
> +++ b/target/linux/ramips/dts/mt7621_tplink_ec330-g5u-v1.dts
> @@ -230,12 +230,20 @@
>   			read-only;
>   
>   			compatible = "nvmem-cells";
> -			#address-cells = <1>;
> -			#size-cells = <1>;
>   
> -			macaddr_factory_165: macaddr at 165 {
> -				reg = <0x165 0x11>;
> +			nvmem-layout {
> +				compatible = "fixed-layout";
> +				#address-cells = <1>;
> +				#size-cells = <1>;
> +
> +				macaddr_factory_165: macaddr at 165 {
> +					compatible = "mac-base";
> +					reg = <0x165 0x11>;
> +					#nvmem-cell-cells = <1>;
> +				};
>   			};
> +
> +
>   		};
>   
>   		partition at 0_wholeflash {
> @@ -257,8 +265,8 @@
>   		mediatek,mtd-eeprom = <&factory 0x8000>;
>   		ieee80211-freq-limit = <2400000 2500000>;
>   
> -		nvmem-cells = <&macaddr_factory_165>;
> -		nvmem-cell-names = "mac-address-ascii";
> +		nvmem-cells = <&macaddr_factory_165 0>;
> +		nvmem-cell-names = "mac-address";
>   	};
>   };
>   
> @@ -269,15 +277,14 @@
>   		mediatek,mtd-eeprom = <&factory 0x14000>;
>   		ieee80211-freq-limit = <5000000 6000000>;
>   
> -		nvmem-cells = <&macaddr_factory_165>;
> -		nvmem-cell-names = "mac-address-ascii";
> -		mac-address-increment = <(2)>;
> +		nvmem-cells = <&macaddr_factory_165 2>;
> +		nvmem-cell-names = "mac-address";
>   	};
>   };
>   
>   &gmac0 {
> -	nvmem-cells = <&macaddr_factory_165>;
> -	nvmem-cell-names = "mac-address-ascii";
> +	nvmem-cells = <&macaddr_factory_165 0>;
> +	nvmem-cell-names = "mac-address";
>   };
>   
>   &gmac1 {
> @@ -285,9 +292,8 @@
>   	label = "wan";
>   	phy-handle = <&ethphy0>;
>   
> -	nvmem-cells = <&macaddr_factory_165>;
> -	nvmem-cell-names = "mac-address-ascii";
> -	mac-address-increment = <(1)>;
> +	nvmem-cells = <&macaddr_factory_165 1>;
> +	nvmem-cell-names = "mac-address";
>   };
>   
>   &mdio {


From stijn at linux-ipv6.be  Fri Jul 28 03:33:33 2023
From: stijn at linux-ipv6.be (Stijn Tintel)
Date: Fri, 28 Jul 2023 13:33:33 +0300
Subject: Matter integration
In-Reply-To: <mailman.22501.1690492298.1880391.openwrt-devel@lists.openwrt.org>
References: <mailman.22501.1690492298.1880391.openwrt-devel@lists.openwrt.org>
Message-ID: <966d33bb-50f1-a0e1-196a-8221fca20422@linux-ipv6.be>

On 28/07/2023 00:11, Karsten Sperling via openwrt-devel wrote:
> Hello,
Hi!
>
> I?m part of an effort by the Connectivity Standards Alliance to bring support for routers and access points into Matter.  Matter is an open-source connectivity standard built to enable developers and device manufacturers to build reliable and secure connected home devices [1][2].
>
> In this context we?re working on a reference implementation for Matter-enabled routers / access points, which will be taking the form of an OpenWRT feed.  Development on this has recently started athttps://github.com/project-chip/matter-openwrt.  We?re using OpenWRT as a platform because of its open nature and great hardware support.  I wanted to reach out to make the OpenWRT developer community aware of this effort, and to invite you to collaborate with us if you?re interested.
Thanks for letting us know. I, for one, am very interested in Matter 
(and Thread). I will try the matter-openwrt feed soon. Maybe this can 
help me finish the PR to add the OpenThread Border Router to OpenWrt [1].
>
> On a more concrete level, I would also like to ask for support for this small PR on OpenWRT I?ve opened here:https://github.com/openwrt/openwrt/pull/13000
>
> The cross-platform nature of the Matter SDK combined with the fact that it uses git sub-modules for dependency management results in the repo having a LOT of sub-modules (about 70 direct, 130 total), only 4 of which are needed when building within OpenWRT. Getting this PR merged would help us to get the Matter SDK and related software to build cleanly under OpenWRT.
>
> Thanks!
>
> [1]https://buildwithmatter.com  <https://buildwithmatter.com/>
> [2]https://github.com/project-chip/connectedhomeip
>
Stijn

[1] https://github.com/openwrt/packages/pull/19218




From rafal at milecki.pl  Fri Jul 28 03:48:01 2023
From: rafal at milecki.pl (=?UTF-8?Q?Rafa=C5=82_Mi=C5=82ecki?=)
Date: Fri, 28 Jul 2023 12:48:01 +0200
Subject: [PATCH] ramips: replace "mac-address-ascii" with "mac-base"
In-Reply-To: <a393b3a2-ed19-378f-2306-f49b3dd871ad@arinc9.com>
References: <20230714131114.26906-1-zajec5@gmail.com>
 <a393b3a2-ed19-378f-2306-f49b3dd871ad@arinc9.com>
Message-ID: <f67b4ad8fd8e1952face3ae085f4ca91@milecki.pl>

On 2023-07-28 09:51, Ar?n? ?NAL wrote:
> I am late to this so I just wanted to say thanks for doing this. We're
> one step closer to mainlining the DTs of the MT7621 SoC devices.

Thanks for kind words! :)


From zajec5 at gmail.com  Fri Jul 28 04:28:05 2023
From: zajec5 at gmail.com (=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=)
Date: Fri, 28 Jul 2023 13:28:05 +0200
Subject: [PATCH] mediatek: filogic: use fixed layout cell "mac-base" for Xiaomi WR30U
Message-ID: <20230728112805.20769-1-zajec5@gmail.com>

From: Rafa? Mi?ecki <rafal at milecki.pl>

Cc: Hank Moretti <mchank9999 at gmail.com>
Cc: Hauke Mehrtens <hauke at hauke-m.de>
Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
Hank: can you runtime test this, please?
---
 .../dts/mt7981b-xiaomi-mi-router-wr30u.dtsi     | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dtsi b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dtsi
index 9467b18a7e..4f8c3046d2 100644
--- a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dtsi
+++ b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dtsi
@@ -73,9 +73,8 @@
 		reg = <0>;
 		phy-mode = "2500base-x";
 
-		nvmem-cells = <&macaddr_factory_4>;
+		nvmem-cells = <&macaddr_factory_4 (-1)>;
 		nvmem-cell-names = "mac-address";
-		mac-address-increment = <(-1)>;
 
 		fixed-link {
 			speed = <2500>;
@@ -177,12 +176,16 @@
 				reg = <0x180000 0x200000>;
 				read-only;
 
-				compatible = "nvmem-cells";
-				#address-cells = <1>;
-				#size-cells = <1>;
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
 
-				macaddr_factory_4: macaddr at 4 {
-					reg = <0x4 0x6>;
+					macaddr_factory_4: macaddr at 4 {
+						compatible = "mac-base";
+						reg = <0x4 0x6>;
+						#nvmem-cell-cells = <1>;
+					};
 				};
 			};
 
-- 
2.35.3



From stijn at linux-ipv6.be  Sat Jul 29 00:49:31 2023
From: stijn at linux-ipv6.be (stijn at linux-ipv6.be)
Date: Sat, 29 Jul 2023 10:49:31 +0300
Subject: [PATCH] xdp-tools: disable stack protector for BPF programs
Message-ID: <20230729074931.1527472-1-stijn@linux-ipv6.be>

When building xdp-tools with CONFIG_USE_LLVM_HOST=y, on a host that
enabled stack protector by default in Clang, compilation fails with the
following error:

    CLANG    xdp-dispatcher.o
clang-16: error: ignoring '-fstack-protector-strong' option as it is not currently supported for target 'bpfeb' [-Werror,-Woption-ignored]

Add -fno-stack-protector to BPF_CFLAGS to fix this.

Signed-off-by: Stijn Tintel <stijn at linux-ipv6.be>
---
 package/network/utils/xdp-tools/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/utils/xdp-tools/Makefile b/package/network/utils/xdp-tools/Makefile
index 3cc7980cf6..dba775e4ea 100644
--- a/package/network/utils/xdp-tools/Makefile
+++ b/package/network/utils/xdp-tools/Makefile
@@ -94,7 +94,7 @@ MAKE_VARS += \
 
 define Build/Configure
 	$(call Build/Configure/Default)
-	echo "BPF_CFLAGS += -I$(BPF_HEADERS_DIR)/tools/lib" >> $(PKG_BUILD_DIR)/config.mk
+	echo "BPF_CFLAGS += -I$(BPF_HEADERS_DIR)/tools/lib -fno-stack-protector" >> $(PKG_BUILD_DIR)/config.mk
 endef
 
 define Build/InstallDev
-- 
2.41.0



From yangshiji66 at outlook.com  Sat Jul 29 06:24:08 2023
From: yangshiji66 at outlook.com (Shiji Yang)
Date: Sat, 29 Jul 2023 21:24:08 +0800
Subject: [v2 0/2] rework MT7620 PA/LNA RF calibration
Message-ID: <TYAP286MB0315F1E7D03D3D5612C6CEE7BC07A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>

From: Shiji Yang <yangshiji66 at qq.com>

This series of patches introduces some fixes to the MT7620 wireless
calibration function:

* rework MT7620 PA/LNA RF calibration
* fix gpio pinmux function during calibration

Changes since v1:
* fix the typo error "inint" to "init"
* Use MT7620 SoC specific AGC initial LNA value.
* Move some channel configuration code to the rt2800_config_channel()
  to ensure that the register operation sequence is consistent with
  the vendor driver.

Shiji Yang (2):
  mac80211: rework MT7620 PA/LNA RF calibration
  ramips: pinctrl: support requesting different functions for same group

 ...-rework-MT7620-PA-LNA-RF-calibration.patch | 434 ++++++++++++++++++
 ...upport-requesting-different-function.patch |  45 ++
 2 files changed, 479 insertions(+)
 create mode 100644 package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch
 create mode 100644 target/linux/ramips/patches-5.15/808-pinctrl-mtmips-support-requesting-different-function.patch

-- 
2.39.2



From yangshiji66 at outlook.com  Sat Jul 29 06:24:09 2023
From: yangshiji66 at outlook.com (Shiji Yang)
Date: Sat, 29 Jul 2023 21:24:09 +0800
Subject: [v2 1/2] mac80211: rework MT7620 PA/LNA RF calibration
In-Reply-To: <20230729132410.31980-1-yangshiji66@outlook.com>
References: <20230729132410.31980-1-yangshiji66@outlook.com>
Message-ID: <TYAP286MB0315A11AA3D4442D3B0D2C04BC07A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>

From: Shiji Yang <yangshiji66 at qq.com>

This patch makes some improvements to the MT7620 RF calibration.

1. Move MT7620 PA/LNA calibration code to dedicated functions.
2. Restore RF and BBP registers before R-Calibration.
3. Do Rx DCOC calibration again before RXIQ calibration.
4. Use SoC specific AGC initial LNA value.
5. Correct MAC_RX_EN mask in rt2800_r_calibration()[1].

[1] This change may fix the "BBP/RF register access failed" error:
ieee80211 phy0: rt2800_wait_bbp_rf_ready: Error - BBP/RF register access failed, aborting

Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
---
 ...-rework-MT7620-PA-LNA-RF-calibration.patch | 434 ++++++++++++++++++
 1 file changed, 434 insertions(+)
 create mode 100644 package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch

diff --git a/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch b/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch
new file mode 100644
index 0000000000..429d7f24a9
--- /dev/null
+++ b/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch
@@ -0,0 +1,434 @@
+From: Shiji Yang <yangshiji66 at outlook.com>
+Date: Tue, 25 Jul 2023 20:05:06 +0800
+Subject: [PATCH] wifi: rt2x00: rework MT7620 PA/LNA RF calibration
+
+1. Move MT7620 PA/LNA calibration code to dedicated functions.
+   Calibration stage 1 is executed before configuring channels and
+   stage 2 is executed after configuring channels.
+2. For external PA/LNA devices, restore RF and BBP registers before
+   R-Calibration.
+3. Do Rx DCOC calibration again before RXIQ calibration.
+4. Correct MAC_SYS_CTRL register RX mask to 0x08 in R-Calibration
+   function. For MAC_SYS_CTRL register, Bit[2] controls MAC_TX_EN
+   and Bit[3] controls MAC_RX_EN (Bit index starts from 0).
+5. Move the channel configuration code from rt2800_vco_calibration()
+   to the rt2800_config_channel().
+6. Use MT7620 SOC specific AGC initial LNA value instead of the
+   RT5592's value.
+7. Adjust the register operation sequence according to the vendor
+   driver code. This may not be useful, but it can make things
+   clearer when developers try to review it.
+
+Signed-off-by: Shiji Yang <yangshiji66 at outlook.com>
+---
+ .../net/wireless/ralink/rt2x00/rt2800lib.c    | 318 +++++++++++-------
+ drivers/net/wireless/ralink/rt2x00/rt2x00.h   |   6 +
+ 2 files changed, 194 insertions(+), 130 deletions(-)
+
+--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+@@ -62,6 +62,9 @@ MODULE_PARM_DESC(watchdog, "Enable watch
+ 	rt2800_regbusy_read((__dev), H2M_MAILBOX_CSR, \
+ 			    H2M_MAILBOX_CSR_OWNER, (__reg))
+ 
++static void rt6352_init_palna_stage1(struct rt2x00_dev *rt2x00dev);
++static void rt6352_init_palna_stage2(struct rt2x00_dev *rt2x00dev);
++
+ static inline bool rt2800_is_305x_soc(struct rt2x00_dev *rt2x00dev)
+ {
+ 	/* check for rt2872 on SoC */
+@@ -3881,14 +3884,6 @@ static void rt2800_config_channel_rf7620
+ 		rfcsr |= tx_agc_fc;
+ 		rt2800_rfcsr_write_bank(rt2x00dev, 7, 59, rfcsr);
+ 	}
+-
+-	if (conf_is_ht40(conf)) {
+-		rt2800_bbp_glrt_write(rt2x00dev, 141, 0x10);
+-		rt2800_bbp_glrt_write(rt2x00dev, 157, 0x2f);
+-	} else {
+-		rt2800_bbp_glrt_write(rt2x00dev, 141, 0x1a);
+-		rt2800_bbp_glrt_write(rt2x00dev, 157, 0x40);
+-	}
+ }
+ 
+ static void rt2800_config_alc_rt6352(struct rt2x00_dev *rt2x00dev,
+@@ -4151,6 +4146,9 @@ static void rt2800_config_channel(struct
+ 			rt2800_txpower_to_dev(rt2x00dev, rf->channel,
+ 					      info->default_power3);
+ 
++	if (rt2x00_rt(rt2x00dev, RT6352))
++		rt6352_init_palna_stage1(rt2x00dev);
++
+ 	switch (rt2x00dev->chip.rt) {
+ 	case RT3883:
+ 		rt3883_bbp_adjust(rt2x00dev, rf);
+@@ -4457,89 +4455,65 @@ static void rt2800_config_channel(struct
+ 		usleep_range(1000, 1500);
+ 	}
+ 
+-	if (rt2x00_rt(rt2x00dev, RT5592) || rt2x00_rt(rt2x00dev, RT6352)) {
++	if (rt2x00_rt(rt2x00dev, RT5592)) {
+ 		reg = 0x10;
+-		if (!conf_is_ht40(conf)) {
+-			if (rt2x00_rt(rt2x00dev, RT6352) &&
+-			    rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
+-				reg |= 0x5;
+-			} else {
+-				reg |= 0xa;
+-			}
+-		}
++		if (!conf_is_ht40(conf))
++			reg |= 0xa;
+ 		rt2800_bbp_write(rt2x00dev, 195, 141);
+ 		rt2800_bbp_write(rt2x00dev, 196, reg);
+ 
+-		/* AGC init.
+-		 * Despite the vendor driver using different values here for
+-		 * RT6352 chip, we use 0x1c for now. This may have to be changed
+-		 * once TSSI got implemented.
+-		 */
+ 		reg = (rf->channel <= 14 ? 0x1c : 0x24) + 2*rt2x00dev->lna_gain;
+ 		rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg);
+-
+-		if (rt2x00_rt(rt2x00dev, RT5592))
+-			rt2800_iq_calibrate(rt2x00dev, rf->channel);
++	
++		rt2800_iq_calibrate(rt2x00dev, rf->channel);
+ 	}
+ 
+ 	if (rt2x00_rt(rt2x00dev, RT6352)) {
+-		if (test_bit(CAPABILITY_EXTERNAL_PA_TX0,
+-			     &rt2x00dev->cap_flags)) {
+-			reg = rt2800_register_read(rt2x00dev, RF_CONTROL3);
+-			reg |= 0x00000101;
+-			rt2800_register_write(rt2x00dev, RF_CONTROL3, reg);
+-
+-			reg = rt2800_register_read(rt2x00dev, RF_BYPASS3);
+-			reg |= 0x00000101;
+-			rt2800_register_write(rt2x00dev, RF_BYPASS3, reg);
+-
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0x73);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0x73);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0x73);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0xC8);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xA4);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x05);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0xC8);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xA4);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x05);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x27);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0xC8);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xA4);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x05);
+-			rt2800_rfcsr_write_dccal(rt2x00dev, 05, 0x00);
++		/* BBP for GLRT BW */
++		if (conf_is_ht40(conf)) {
++			rt2800_bbp_glrt_write(rt2x00dev, 141, 0x10);
++			rt2800_bbp_glrt_write(rt2x00dev, 157, 0x2f);
++		} else {
++			rt2800_bbp_glrt_write(rt2x00dev, 141, 0x1a);
++			rt2800_bbp_glrt_write(rt2x00dev, 157, 0x40);
+ 
+-			rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT,
+-					      0x36303636);
+-			rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN,
+-					      0x6C6C6B6C);
+-			rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN,
+-					      0x6C6C6B6C);
++			if (rt2800_hw_get_chippkg(rt2x00dev) == 1 &&
++				rt2x00_has_cap_external_lna_bg(rt2x00dev))
++				rt2800_bbp_glrt_write(rt2x00dev, 141, 0x15);
+ 		}
+ 
+-		if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
+-			reg = rt2800_register_read(rt2x00dev, RF_CONTROL3);
+-			reg |= 0x00000101;
+-			rt2800_register_write(rt2x00dev, RF_CONTROL3, reg);
+-
+-			reg = rt2800_register_read(rt2x00dev, RF_BYPASS3);
+-			reg |= 0x00000101;
+-			rt2800_register_write(rt2x00dev, RF_BYPASS3, reg);
+-
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20);
+-			rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x42);
+-			rt2800_bbp_write(rt2x00dev, 75, 0x68);
+-			rt2800_bbp_write(rt2x00dev, 76, 0x4C);
+-			rt2800_bbp_write(rt2x00dev, 79, 0x1C);
+-			rt2800_bbp_write(rt2x00dev, 80, 0x0C);
+-			rt2800_bbp_write(rt2x00dev, 82, 0xB6);
+-			/* bank 0 RF reg 42 and glrt BBP reg 141 will be set in
+-			 * config channel function in dependence of channel and
+-			 * HT20/HT40 so don't touch it
+-			 */
++		if (rt2x00dev->default_ant.rx_chain_num == 1) {
++			rt2800_bbp_write(rt2x00dev, 91, 0x07);
++			rt2800_bbp_write(rt2x00dev, 95, 0x1A);
++			rt2800_bbp_write(rt2x00dev, 195, 128);
++			rt2800_bbp_write(rt2x00dev, 196, 0xA0);
++			rt2800_bbp_write(rt2x00dev, 195, 170);
++			rt2800_bbp_write(rt2x00dev, 196, 0x12);
++			rt2800_bbp_write(rt2x00dev, 195, 171);
++			rt2800_bbp_write(rt2x00dev, 196, 0x10);
++		} else {
++			rt2800_bbp_write(rt2x00dev, 91, 0x06);
++			rt2800_bbp_write(rt2x00dev, 95, 0x9A);
++			rt2800_bbp_write(rt2x00dev, 195, 128);
++			rt2800_bbp_write(rt2x00dev, 196, 0xE0);
++			rt2800_bbp_write(rt2x00dev, 195, 170);
++			rt2800_bbp_write(rt2x00dev, 196, 0x30);
++			rt2800_bbp_write(rt2x00dev, 195, 171);
++			rt2800_bbp_write(rt2x00dev, 196, 0x30);
+ 		}
++
++		/* AGC init */
++		reg = rf->channel <= 14 ? 0x04 + 2 * rt2x00dev->lna_gain : 0;
++		rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg);
++
++		/* On 11A, We should delay and wait RF/BBP to be stable
++		 * and the appropriate time should be 1000 micro seconds
++		 * 2005/06/05 - On 11G, we also need this delay time.
++		 * Otherwise it's difficult to pass the WHQL.
++		 */
++		usleep_range(1000, 1500);
++
++		rt6352_init_palna_stage2(rt2x00dev);
+ 	}
+ 
+ 	bbp = rt2800_bbp_read(rt2x00dev, 4);
+@@ -5649,43 +5623,6 @@ void rt2800_vco_calibration(struct rt2x0
+ 		}
+ 	}
+ 	rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin);
+-
+-	if (rt2x00_rt(rt2x00dev, RT6352)) {
+-		if (rt2x00dev->default_ant.rx_chain_num == 1) {
+-			rt2800_bbp_write(rt2x00dev, 91, 0x07);
+-			rt2800_bbp_write(rt2x00dev, 95, 0x1A);
+-			rt2800_bbp_write(rt2x00dev, 195, 128);
+-			rt2800_bbp_write(rt2x00dev, 196, 0xA0);
+-			rt2800_bbp_write(rt2x00dev, 195, 170);
+-			rt2800_bbp_write(rt2x00dev, 196, 0x12);
+-			rt2800_bbp_write(rt2x00dev, 195, 171);
+-			rt2800_bbp_write(rt2x00dev, 196, 0x10);
+-		} else {
+-			rt2800_bbp_write(rt2x00dev, 91, 0x06);
+-			rt2800_bbp_write(rt2x00dev, 95, 0x9A);
+-			rt2800_bbp_write(rt2x00dev, 195, 128);
+-			rt2800_bbp_write(rt2x00dev, 196, 0xE0);
+-			rt2800_bbp_write(rt2x00dev, 195, 170);
+-			rt2800_bbp_write(rt2x00dev, 196, 0x30);
+-			rt2800_bbp_write(rt2x00dev, 195, 171);
+-			rt2800_bbp_write(rt2x00dev, 196, 0x30);
+-		}
+-
+-		if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
+-			rt2800_bbp_write(rt2x00dev, 75, 0x68);
+-			rt2800_bbp_write(rt2x00dev, 76, 0x4C);
+-			rt2800_bbp_write(rt2x00dev, 79, 0x1C);
+-			rt2800_bbp_write(rt2x00dev, 80, 0x0C);
+-			rt2800_bbp_write(rt2x00dev, 82, 0xB6);
+-		}
+-
+-		/* On 11A, We should delay and wait RF/BBP to be stable
+-		 * and the appropriate time should be 1000 micro seconds
+-		 * 2005/06/05 - On 11G, we also need this delay time.
+-		 * Otherwise it's difficult to pass the WHQL.
+-		 */
+-		usleep_range(1000, 1500);
+-	}
+ }
+ EXPORT_SYMBOL_GPL(rt2800_vco_calibration);
+ 
+@@ -8650,7 +8587,7 @@ static void rt2800_r_calibration(struct
+ 		rt2x00_warn(rt2x00dev, "Wait MAC Tx Status to MAX !!!\n");
+ 
+ 	maccfg = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL);
+-	maccfg &= (~0x04);
++	maccfg &= (~0x08);
+ 	rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, maccfg);
+ 
+ 	if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY_RX)))
+@@ -10688,30 +10625,151 @@ static void rt2800_init_rfcsr_6352(struc
+ 		rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00);
+ 		rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C);
+ 	}
++}
+ 
+-	rt6352_enable_pa_pin(rt2x00dev, 0);
+-	rt2800_r_calibration(rt2x00dev);
+-	rt2800_rf_self_txdc_cal(rt2x00dev);
+-	rt2800_rxdcoc_calibration(rt2x00dev);
+-	rt2800_bw_filter_calibration(rt2x00dev, true);
+-	rt2800_bw_filter_calibration(rt2x00dev, false);
+-	rt2800_loft_iq_calibration(rt2x00dev);
+-	rt2800_rxiq_calibration(rt2x00dev);
+-	rt6352_enable_pa_pin(rt2x00dev, 1);
++static void rt6352_init_ext_palna(struct rt2x00_dev *rt2x00dev)
++{
++	u32 reg;
++
++	if (rt2x00_has_cap_external_pa(rt2x00dev)) {
++		reg = rt2800_register_read(rt2x00dev, RF_CONTROL3);
++		reg |= 0x00000101;
++		rt2800_register_write(rt2x00dev, RF_CONTROL3, reg);
++
++		reg = rt2800_register_read(rt2x00dev, RF_BYPASS3);
++		reg |= 0x00000101;
++		rt2800_register_write(rt2x00dev, RF_BYPASS3, reg);
++	}
+ 
+-	if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1 &&
++		rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
+ 		rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66);
+ 		rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20);
+ 		rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x42);
++	}
++
++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1 &&
++		rt2x00_has_cap_external_pa(rt2x00dev)) {
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0x73);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0x73);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0x73);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0xC8);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xA4);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x05);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0xC8);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xA4);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x05);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x27);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0xC8);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xA4);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x05);
++	}
++
++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1 &&
++		rt2x00_has_cap_external_pa(rt2x00dev)) {
++		rt2800_rfcsr_write_dccal(rt2x00dev, 05, 0x00);
++	}
++
++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1 &&
++		rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
+ 		rt2800_bbp_write(rt2x00dev, 75, 0x68);
+ 		rt2800_bbp_write(rt2x00dev, 76, 0x4C);
+ 		rt2800_bbp_write(rt2x00dev, 79, 0x1C);
+ 		rt2800_bbp_write(rt2x00dev, 80, 0x0C);
+ 		rt2800_bbp_write(rt2x00dev, 82, 0xB6);
+-		/* bank 0 RF reg 42 and glrt BBP reg 141 will be set in config
+-		 * channel function in dependence of channel and HT20/HT40,
+-		 * so don't touch them here.
+-		 */
++	}
++
++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1 &&
++		rt2x00_has_cap_external_pa(rt2x00dev)) {
++		rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, 0x36303636);
++		rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6C6C6B6C);
++		rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 0x6C6C6B6C);
++	}
++}
++
++static void rt6352_restore_rf_bbp(struct rt2x00_dev *rt2x00dev)
++{
++	if (rt2x00_has_cap_external_pa(rt2x00dev)) {
++		rt2800_register_write(rt2x00dev, RF_CONTROL3, 0x0);
++		rt2800_register_write(rt2x00dev, RF_BYPASS3, 0x0);
++	}
++
++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1 &&
++		rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x23);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x02);
++	}
++
++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1 &&
++		rt2x00_has_cap_external_pa(rt2x00dev))
++	{
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0xD3);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0xB3);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0xD5);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x6C);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xFC);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x1F);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x66);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xFF);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x1C);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x20);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6B);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xF7);
++		rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x09);
++	}
++
++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1 &&
++		rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
++		rt2800_bbp_write(rt2x00dev, 75, 0x60);
++		rt2800_bbp_write(rt2x00dev, 76, 0x44);
++		rt2800_bbp_write(rt2x00dev, 79, 0x1C);
++		rt2800_bbp_write(rt2x00dev, 80, 0x0C);
++		rt2800_bbp_write(rt2x00dev, 82, 0xB6);
++	}
++
++	if (rt2800_hw_get_chippkg(rt2x00dev) == 1
++		&& rt2x00_has_cap_external_pa(rt2x00dev)) {
++		rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, 0x3630363A);
++		rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6C6C666C);
++		rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 0x6C6C666C);
++	}
++}
++
++/* MT7620 PA/LNA initialization before switching channels */
++static void rt6352_init_palna_stage1(struct rt2x00_dev *rt2x00dev)
++{
++	if (rt2x00_has_cap_external_pa(rt2x00dev) ||
++		rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
++		rt6352_enable_pa_pin(rt2x00dev, 0);
++		rt6352_restore_rf_bbp(rt2x00dev);
++	}
++
++	rt2800_r_calibration(rt2x00dev);
++}
++
++/* MT7620 PA/LNA initialization after switching channels */
++static void rt6352_init_palna_stage2(struct rt2x00_dev *rt2x00dev)
++{
++	rt2800_rf_self_txdc_cal(rt2x00dev);
++	rt2800_rxdcoc_calibration(rt2x00dev);
++	rt2800_bw_filter_calibration(rt2x00dev, true);
++	rt2800_bw_filter_calibration(rt2x00dev, false);
++	rt2800_loft_iq_calibration(rt2x00dev);
++
++	/* missing DPD Calibration for devices using internal PA */
++
++	rt2800_rxdcoc_calibration(rt2x00dev);
++	rt2800_rxiq_calibration(rt2x00dev);
++
++	if(rt2x00_has_cap_external_pa(rt2x00dev) ||
++		rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
++		rt6352_enable_pa_pin(rt2x00dev, 1);
++		rt6352_init_ext_palna(rt2x00dev);
+ 	}
+ }
+ 
+--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
+@@ -1277,6 +1277,12 @@ rt2x00_has_cap_external_lna_bg(struct rt
+ }
+ 
+ static inline bool
++rt2x00_has_cap_external_pa(struct rt2x00_dev *rt2x00dev)
++{
++	return rt2x00_has_cap_flag(rt2x00dev, CAPABILITY_EXTERNAL_PA_TX0);
++}
++
++static inline bool
+ rt2x00_has_cap_double_antenna(struct rt2x00_dev *rt2x00dev)
+ {
+ 	return rt2x00_has_cap_flag(rt2x00dev, CAPABILITY_DOUBLE_ANTENNA);
-- 
2.39.2



From yangshiji66 at outlook.com  Sat Jul 29 06:24:10 2023
From: yangshiji66 at outlook.com (Shiji Yang)
Date: Sat, 29 Jul 2023 21:24:10 +0800
Subject: [v2 2/2] ramips: pinctrl: support requesting different functions for same group
In-Reply-To: <20230729132410.31980-1-yangshiji66@outlook.com>
References: <20230729132410.31980-1-yangshiji66@outlook.com>
Message-ID: <TYAP286MB0315FFB504BAD83F42A75E39BC07A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>

From: Shiji Yang <yangshiji66 at qq.com>

MT7620 wireless radio needs change the pin group function between
"gpio" and "pa" during the calibration process. However, ralink
pinctrl driver doesn't support requesting different functions for
the same group. This patch enables pinctrl consumers to perform
such operations.

Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
---
 ...upport-requesting-different-function.patch | 45 +++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 target/linux/ramips/patches-5.15/808-pinctrl-mtmips-support-requesting-different-function.patch

diff --git a/target/linux/ramips/patches-5.15/808-pinctrl-mtmips-support-requesting-different-function.patch b/target/linux/ramips/patches-5.15/808-pinctrl-mtmips-support-requesting-different-function.patch
new file mode 100644
index 0000000000..047808f1e6
--- /dev/null
+++ b/target/linux/ramips/patches-5.15/808-pinctrl-mtmips-support-requesting-different-function.patch
@@ -0,0 +1,45 @@
+From: Shiji Yang <yangshiji66 at outlook.com>
+Date: Wed, 26 Jul 2023 01:32:55 +0800
+Subject: [PATCH] pinctrl: mtmips: support requesting different functions for
+ same group
+
+Sometimes pinctrl consumers may request different functions for the
+same pin group in different situations. This patch can help to reset
+the group function flag when requesting a different function.
+
+Signed-off-by: Shiji Yang <yangshiji66 at outlook.com>
+---
+ drivers/pinctrl/ralink/pinctrl-ralink.c | 21 +++++++++++++++++----
+ 1 file changed, 17 insertions(+), 4 deletions(-)
+
+--- a/drivers/pinctrl/ralink/pinctrl-ralink.c
++++ b/drivers/pinctrl/ralink/pinctrl-ralink.c
+@@ -123,11 +123,24 @@ static int ralink_pmx_group_enable(struc
+ 	int i;
+ 	int shift;
+ 
+-	/* dont allow double use */
++	/*
++	 * for the same pin group, if request a different function,
++	 * then clear the group function flag and continue, else exit.
++	 */
+ 	if (p->groups[group].enabled) {
+-		dev_err(p->dev, "%s is already enabled\n",
+-			p->groups[group].name);
+-		return 0;
++		for (i = 0; i < p->groups[group].func_count; i++) {
++			if (p->groups[group].func[i].enabled == 1) {
++				if (!strcmp(p->func[func]->name,
++					p->groups[group].func[i].name))
++					return 0;
++				p->groups[group].func[i].enabled = 0;
++				break;
++			}
++		}
++
++		/* exit if request the "gpio" function again */
++		if (i == p->groups[group].func_count && func == 0)
++			return 0;
+ 	}
+ 
+ 	p->groups[group].enabled = 1;
-- 
2.39.2



From luz at plan44.ch  Sat Jul 29 06:35:02 2023
From: luz at plan44.ch (Lukas Zeller)
Date: Sat, 29 Jul 2023 15:35:02 +0200
Subject: Matter integration
In-Reply-To: <mailman.22501.1690492298.1880391.openwrt-devel@lists.openwrt.org>
References: <mailman.22501.1690492298.1880391.openwrt-devel@lists.openwrt.org>
Message-ID: <2B43E50F-3479-49C5-A32D-14D93F22C62B@plan44.ch>

Hi Karsten,

I am very excited to see matter activity in the openwrt space!

For the past year, I was working on a bridge app for my OpenWrt based SmartHome daemon p44mbrd [1]. To make it work, I already constributed a few things to matter itself, in particular the possibiity to make it use libev [2] for the matter mainloop, and fixing the avahi implementation [3].

Back then I also hacked some openwrt platform compilation into matter [4] to build the daemon with gn externally, as I failed doing so from within the openwrt buildroot. That does not seem to be necessary any more - I am very glad to see the devel/gn package, and will try to build p44mbrd this way and then create an openwrt package for it.

My work in and around Openwrt focuses on using the platform for IoT and SmartHome, and using the matter SDK as a bridge with dynamic endpoints (new PR for that see [6]), not as a router/ap. So I probably cannot help much in the latter field, but still hope I might be able to contribute from general openwrt / matter experience.

Looking forward to see how this moves forward :-)

Lukas

[1] https://github.com/plan44/p44mbrd
[2] https://github.com/project-chip/connectedhomeip/pull/24232
[3] https://github.com/project-chip/connectedhomeip/pull/26397
[4] https://github.com/plan44/connectedhomeip/commit/aabd0ee91bc6dc2906ccf5b73103a538a6dac205
[5] https://github.com/plan44/plan44-feed/tree/main
[6] https://github.com/project-chip/connectedhomeip/pull/28372



> On 27 Jul 2023, at 23:11, Karsten Sperling via openwrt-devel <openwrt-devel at lists.openwrt.org> wrote:
> 
> The sender domain has a DMARC Reject/Quarantine policy which disallows
> sending mailing list messages using the original "From" header.
> 
> To mitigate this problem, the original message has been wrapped
> automatically by the mailing list software.
> From: Karsten Sperling <ksperling at apple.com>
> Subject: Matter integration
> Date: 27 July 2023 at 23:11:10 CEST
> To: openwrt-devel at lists.openwrt.org
> 
> 
> Hello,
> 
> I?m part of an effort by the Connectivity Standards Alliance to bring support for routers and access points into Matter.  Matter is an open-source connectivity standard built to enable developers and device manufacturers to build reliable and secure connected home devices [1][2].
> 
> In this context we?re working on a reference implementation for Matter-enabled routers / access points, which will be taking the form of an OpenWRT feed.  Development on this has recently started at https://github.com/project-chip/matter-openwrt.  We?re using OpenWRT as a platform because of its open nature and great hardware support.  I wanted to reach out to make the OpenWRT developer community aware of this effort, and to invite you to collaborate with us if you?re interested.
> 
> On a more concrete level, I would also like to ask for support for this small PR on OpenWRT I?ve opened here: https://github.com/openwrt/openwrt/pull/13000
> 
> The cross-platform nature of the Matter SDK combined with the fact that it uses git sub-modules for dependency management results in the repo having a LOT of sub-modules (about 70 direct, 130 total), only 4 of which are needed when building within OpenWRT. Getting this PR merged would help us to get the Matter SDK and related software to build cleanly under OpenWRT.
> 
> Thanks!
> 
> [1] https://buildwithmatter.com <https://buildwithmatter.com/>
> [2] https://github.com/project-chip/connectedhomeip
> 
> 
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20230729/173ac244/attachment.sig>

From zajec5 at gmail.com  Sat Jul 29 16:29:18 2023
From: zajec5 at gmail.com (=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=)
Date: Sun, 30 Jul 2023 01:29:18 +0200
Subject: [PATCH] kernel: drop unneeded OpenWrt's fw_devlink hack
Message-ID: <20230729232918.25438-1-zajec5@gmail.com>

From: Rafa? Mi?ecki <rafal at milecki.pl>

It was used to workaround of_platform_populate()-caused issue with
probing devices. It's not needed anymore since we have a proper fix
(code setting OF_POPULATED).

Link: https://github.com/openwrt/openwrt/issues/10232
Ref: 3eebb91317c6 ("kernel: backport proper fix for mtd preventing devices probing")
Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
 ...vert-driver-core-Set-fw_devlink-on-b.patch | 30 -------------------
 ...vert-driver-core-Set-fw_devlink-on-b.patch | 30 -------------------
 2 files changed, 60 deletions(-)
 delete mode 100644 target/linux/generic/hack-5.15/930-Revert-Revert-Revert-driver-core-Set-fw_devlink-on-b.patch
 delete mode 100644 target/linux/generic/hack-6.1/930-Revert-Revert-Revert-driver-core-Set-fw_devlink-on-b.patch

diff --git a/target/linux/generic/hack-5.15/930-Revert-Revert-Revert-driver-core-Set-fw_devlink-on-b.patch b/target/linux/generic/hack-5.15/930-Revert-Revert-Revert-driver-core-Set-fw_devlink-on-b.patch
deleted file mode 100644
index 4f4d6c7509..0000000000
--- a/target/linux/generic/hack-5.15/930-Revert-Revert-Revert-driver-core-Set-fw_devlink-on-b.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal at milecki.pl>
-Date: Tue, 19 Jul 2022 06:17:48 +0200
-Subject: [PATCH] Revert "Revert "Revert "driver core: Set fw_devlink=on by
- default"""
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This reverts commit ea718c699055c8566eb64432388a04974c43b2ea.
-
-With of_platform_populate() called for MTD partitions that commit breaks
-probing devices which reference MTD in device tree.
-
-Link: https://lore.kernel.org/all/696cb2da-20b9-b3dd-46d9-de4bf91a1506 at gmail.com/T/#u
-Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
----
- drivers/base/core.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/base/core.c
-+++ b/drivers/base/core.c
-@@ -1562,7 +1562,7 @@ static void device_links_purge(struct de
- #define FW_DEVLINK_FLAGS_RPM		(FW_DEVLINK_FLAGS_ON | \
- 					 DL_FLAG_PM_RUNTIME)
- 
--static u32 fw_devlink_flags = FW_DEVLINK_FLAGS_ON;
-+static u32 fw_devlink_flags = FW_DEVLINK_FLAGS_PERMISSIVE;
- static int __init fw_devlink_setup(char *arg)
- {
- 	if (!arg)
diff --git a/target/linux/generic/hack-6.1/930-Revert-Revert-Revert-driver-core-Set-fw_devlink-on-b.patch b/target/linux/generic/hack-6.1/930-Revert-Revert-Revert-driver-core-Set-fw_devlink-on-b.patch
deleted file mode 100644
index 98081c4b64..0000000000
--- a/target/linux/generic/hack-6.1/930-Revert-Revert-Revert-driver-core-Set-fw_devlink-on-b.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal at milecki.pl>
-Date: Tue, 19 Jul 2022 06:17:48 +0200
-Subject: [PATCH] Revert "Revert "Revert "driver core: Set fw_devlink=on by
- default"""
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This reverts commit ea718c699055c8566eb64432388a04974c43b2ea.
-
-With of_platform_populate() called for MTD partitions that commit breaks
-probing devices which reference MTD in device tree.
-
-Link: https://lore.kernel.org/all/696cb2da-20b9-b3dd-46d9-de4bf91a1506 at gmail.com/T/#u
-Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
----
- drivers/base/core.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/base/core.c
-+++ b/drivers/base/core.c
-@@ -1700,7 +1700,7 @@ static void device_links_purge(struct de
- #define FW_DEVLINK_FLAGS_RPM		(FW_DEVLINK_FLAGS_ON | \
- 					 DL_FLAG_PM_RUNTIME)
- 
--static u32 fw_devlink_flags = FW_DEVLINK_FLAGS_ON;
-+static u32 fw_devlink_flags = FW_DEVLINK_FLAGS_PERMISSIVE;
- static int __init fw_devlink_setup(char *arg)
- {
- 	if (!arg)
-- 
2.35.3



From noreply at github.com  Sun Jul 30 15:20:49 2023
From: noreply at github.com (Stephen Walker)
Date: Sun, 30 Jul 2023 22:20:49 +0000 (UTC)
Subject: [sdwalker/sdwalker.github.io] 9a78eb: This week's update
Message-ID: <sdwalker/sdwalker.github.io/push/refs/heads/master/392c12-9a78eb@github.com>

  Branch: refs/heads/master
  Home:   https://github.com/sdwalker/sdwalker.github.io
  Commit: 9a78eb2941ccb448f068bb5ac6ebb18b12af12d0
      https://github.com/sdwalker/sdwalker.github.io/commit/9a78eb2941ccb448f068bb5ac6ebb18b12af12d0
  Author: Stephen Walker <stephendwalker+github at gmail.com>
  Date:   2023-07-30 (Sun, 30 Jul 2023)

  Changed paths:
    M uscan/index-22.03.html
    M uscan/index-23.05.html
    M uscan/index.html

  Log Message:
  -----------
  This week's update




From ksperling at apple.com  Sun Jul 30 15:43:32 2023
From: ksperling at apple.com (Karsten Sperling)
Date: Mon, 31 Jul 2023 10:43:32 +1200
Subject: Matter integration
In-Reply-To: <966d33bb-50f1-a0e1-196a-8221fca20422@linux-ipv6.be>
References: <mailman.22501.1690492298.1880391.openwrt-devel@lists.openwrt.org>
 <966d33bb-50f1-a0e1-196a-8221fca20422@linux-ipv6.be>
Message-ID: <C0BCF169-39E5-4EDA-9695-FBBCB66A3C97@apple.com>

Hi Stijn,

Great to hear that integrating the OpnThread BR is already being worked on, that?s definitely going to be of interest to us as well!

Thanks, Karsten

> On 28/07/2023, at 10:33 PM, Stijn Tintel <stijn at linux-ipv6.be> wrote:
> 
> On 28/07/2023 00:11, Karsten Sperling via openwrt-devel wrote:
>> Hello,
> Hi!
>> 
>> I?m part of an effort by the Connectivity Standards Alliance to bring support for routers and access points into Matter.  Matter is an open-source connectivity standard built to enable developers and device manufacturers to build reliable and secure connected home devices [1][2].
>> 
>> In this context we?re working on a reference implementation for Matter-enabled routers / access points, which will be taking the form of an OpenWRT feed.  Development on this has recently started athttps://github.com/project-chip/matter-openwrt.  We?re using OpenWRT as a platform because of its open nature and great hardware support.  I wanted to reach out to make the OpenWRT developer community aware of this effort, and to invite you to collaborate with us if you?re interested.
> Thanks for letting us know. I, for one, am very interested in Matter (and Thread). I will try the matter-openwrt feed soon. Maybe this can help me finish the PR to add the OpenThread Border Router to OpenWrt [1].
>> 
>> On a more concrete level, I would also like to ask for support for this small PR on OpenWRT I?ve opened here:https://github.com/openwrt/openwrt/pull/13000
>> 
>> The cross-platform nature of the Matter SDK combined with the fact that it uses git sub-modules for dependency management results in the repo having a LOT of sub-modules (about 70 direct, 130 total), only 4 of which are needed when building within OpenWRT. Getting this PR merged would help us to get the Matter SDK and related software to build cleanly under OpenWRT.
>> 
>> Thanks!
>> 
>> [1]https://buildwithmatter.com  <https://buildwithmatter.com/>
>> [2]https://github.com/project-chip/connectedhomeip
>> 
> Stijn
> 
> [1] https://github.com/openwrt/packages/pull/19218
> 
> 



From ksperling at apple.com  Sun Jul 30 15:56:42 2023
From: ksperling at apple.com (Karsten Sperling)
Date: Mon, 31 Jul 2023 10:56:42 +1200
Subject: Matter integration
In-Reply-To: <2B43E50F-3479-49C5-A32D-14D93F22C62B@plan44.ch>
References: <mailman.22501.1690492298.1880391.openwrt-devel@lists.openwrt.org>
 <2B43E50F-3479-49C5-A32D-14D93F22C62B@plan44.ch>
Message-ID: <AAA458C7-C7F9-4455-BA21-92F702C2AB41@apple.com>

Hi Lukas,

Exciting to see Matter being picked up and getting contributions in the open source space like this :-)

In terms of the build, I?ve did a bit of work on the Matter SDK side to add a ?configure? script that aims to provide a somewhat cleaner interface to an external build system like OpenWrt than the raw GN / pigweed build provides. Feel free to reach out on the Matter SDK repo if you?re running into issues with it.

Thanks, Karsten

> On 30/07/2023, at 1:35 AM, Lukas Zeller <luz at plan44.ch> wrote:
> 
> Hi Karsten,
> 
> I am very excited to see matter activity in the openwrt space!
> 
> For the past year, I was working on a bridge app for my OpenWrt based SmartHome daemon p44mbrd [1]. To make it work, I already constributed a few things to matter itself, in particular the possibiity to make it use libev [2] for the matter mainloop, and fixing the avahi implementation [3].
> 
> Back then I also hacked some openwrt platform compilation into matter [4] to build the daemon with gn externally, as I failed doing so from within the openwrt buildroot. That does not seem to be necessary any more - I am very glad to see the devel/gn package, and will try to build p44mbrd this way and then create an openwrt package for it.
> 
> My work in and around Openwrt focuses on using the platform for IoT and SmartHome, and using the matter SDK as a bridge with dynamic endpoints (new PR for that see [6]), not as a router/ap. So I probably cannot help much in the latter field, but still hope I might be able to contribute from general openwrt / matter experience.
> 
> Looking forward to see how this moves forward :-)
> 
> Lukas
> 
> [1] https://github.com/plan44/p44mbrd
> [2] https://github.com/project-chip/connectedhomeip/pull/24232
> [3] https://github.com/project-chip/connectedhomeip/pull/26397
> [4] https://github.com/plan44/connectedhomeip/commit/aabd0ee91bc6dc2906ccf5b73103a538a6dac205
> [5] https://github.com/plan44/plan44-feed/tree/main
> [6] https://github.com/project-chip/connectedhomeip/pull/28372
> 
> 
> 
>> On 27 Jul 2023, at 23:11, Karsten Sperling via openwrt-devel <openwrt-devel at lists.openwrt.org> wrote:
>> 
>> The sender domain has a DMARC Reject/Quarantine policy which disallows
>> sending mailing list messages using the original "From" header.
>> 
>> To mitigate this problem, the original message has been wrapped
>> automatically by the mailing list software.
>> From: Karsten Sperling <ksperling at apple.com>
>> Subject: Matter integration
>> Date: 27 July 2023 at 23:11:10 CEST
>> To: openwrt-devel at lists.openwrt.org
>> 
>> 
>> Hello,
>> 
>> I?m part of an effort by the Connectivity Standards Alliance to bring support for routers and access points into Matter.  Matter is an open-source connectivity standard built to enable developers and device manufacturers to build reliable and secure connected home devices [1][2].
>> 
>> In this context we?re working on a reference implementation for Matter-enabled routers / access points, which will be taking the form of an OpenWRT feed.  Development on this has recently started at https://github.com/project-chip/matter-openwrt.  We?re using OpenWRT as a platform because of its open nature and great hardware support.  I wanted to reach out to make the OpenWRT developer community aware of this effort, and to invite you to collaborate with us if you?re interested.
>> 
>> On a more concrete level, I would also like to ask for support for this small PR on OpenWRT I?ve opened here: https://github.com/openwrt/openwrt/pull/13000
>> 
>> The cross-platform nature of the Matter SDK combined with the fact that it uses git sub-modules for dependency management results in the repo having a LOT of sub-modules (about 70 direct, 130 total), only 4 of which are needed when building within OpenWRT. Getting this PR merged would help us to get the Matter SDK and related software to build cleanly under OpenWRT.
>> 
>> Thanks!
>> 
>> [1] https://buildwithmatter.com <https://buildwithmatter.com/>
>> [2] https://github.com/project-chip/connectedhomeip
>> 
>> 
>> 
>> 
>> _______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel at lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 



From linus.walleij at linaro.org  Mon Jul 31 12:13:24 2023
From: linus.walleij at linaro.org (Linus Walleij)
Date: Mon, 31 Jul 2023 21:13:24 +0200
Subject: [PATCH v3 0/5] bcm53xx: Support D-Link DIR-890L
In-Reply-To: <20230619063618.2595217-1-linus.walleij@linaro.org>
References: <20230619063618.2595217-1-linus.walleij@linaro.org>
Message-ID: <CACRpkdZ=RpahMU53B8BJk3WtcP6AsQMcz0UKuHzp1DwNvmcUsQ@mail.gmail.com>

On Mon, Jun 19, 2023 at 8:36?AM Linus Walleij <linus.walleij at linaro.org> wrote:

> This adds support for the D-Link DIR-890L router.
>
> Linus Walleij (5):
>   bcm53xx: Fix kernel v6.1 config
>   uboot-bcm53xx: Add U-Boot for NorthStar BCM53xx
>   bcm53xx: Add support for D-Link DIR-890L
>   bcm53xx: dir885/dir890: Tag both partitions as SEAMA
>   bcm53xx: Add network configuration for DIR-890L

Hints on how to proceed with this?

Any problem with the patches?

I can also create a pull request on github if it helps?

Yours,
Linus Walleij


From bjorn at mork.no  Mon Jul 31 23:51:03 2023
From: bjorn at mork.no (=?utf-8?Q?Bj=C3=B8rn_Mork?=)
Date: Tue, 01 Aug 2023 08:51:03 +0200
Subject: [PATCH v3 0/5] bcm53xx: Support D-Link DIR-890L
In-Reply-To: <CACRpkdZ=RpahMU53B8BJk3WtcP6AsQMcz0UKuHzp1DwNvmcUsQ@mail.gmail.com>
	(Linus Walleij's message of "Mon, 31 Jul 2023 21:13:24 +0200")
References: <20230619063618.2595217-1-linus.walleij@linaro.org>
	<CACRpkdZ=RpahMU53B8BJk3WtcP6AsQMcz0UKuHzp1DwNvmcUsQ@mail.gmail.com>
Message-ID: <873513mf1k.fsf@miraculix.mork.no>

Linus Walleij <linus.walleij at linaro.org> writes:

>  can also create a pull request on github if it helps?

Probably not.  There's a "6 approving reviews" rule on github, and not
even close to that many active reviewers.  Sp adding new devices via
pull requests seems impossible at the moment.


Bj?rn


From zajec5 at gmail.com  Fri Jul 14 06:40:08 2023
From: zajec5 at gmail.com (=?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?=)
Date: Fri, 14 Jul 2023 13:40:08 -0000
Subject: [PATCH] ath79: replace "mac-address-ascii" with "mac-base"
Message-ID: <20230714133951.29193-1-zajec5@gmail.com>

From: Rafa? Mi?ecki <rafal at milecki.pl>

With upstream accepted "mac-base" binding there is no need for a
downstream "mac-address-ascii" workaround anymore.

Signed-off-by: Rafa? Mi?ecki <rafal at milecki.pl>
---
 .../ath79/dts/ar7161_dlink_dir-825-b1.dts     | 57 +++++++++++--------
 .../linux/ath79/dts/ar9331_hiwifi_hc6361.dts  | 37 ++++++------
 .../linux/ath79/dts/ar9342_zyxel_nwa11xx.dtsi | 28 +++++----
 .../linux/ath79/dts/ar9344_dlink_dir-8x5.dtsi | 42 ++++++++------
 .../ath79/dts/qca9558_dlink_dir-629-a1.dts    | 32 +++++++----
 .../ath79/dts/qca9563_dlink_dir-8x9-a1.dtsi   | 31 ++++++----
 6 files changed, 134 insertions(+), 93 deletions(-)

diff --git a/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts b/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts
index 0e39be7d0b..bdb678298d 100644
--- a/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts
+++ b/target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts
@@ -139,8 +139,8 @@
 	ath9k0: wifi at 0,11 {
 		compatible = "pci168c,0029";
 		reg = <0x8800 0 0 0 0>;
-		nvmem-cells = <&macaddr_lan>, <&cal_art_1000>;
-		nvmem-cell-names = "mac-address-ascii", "calibration";
+		nvmem-cells = <&macaddr_lan 0>, <&cal_art_1000>;
+		nvmem-cell-names = "mac-address", "calibration";
 		#gpio-cells = <2>;
 		gpio-controller;
 	};
@@ -148,9 +148,8 @@
 	ath9k1: wifi at 0,12 {
 		compatible = "pci168c,0029";
 		reg = <0x9000 0 0 0 0>;
-		nvmem-cells = <&macaddr_wan>, <&cal_art_5000>;
-		nvmem-cell-names = "mac-address-ascii", "calibration";
-		mac-address-increment = <1>;
+		nvmem-cells = <&macaddr_wan 1>, <&cal_art_5000>;
+		nvmem-cell-names = "mac-address", "calibration";
 		#gpio-cells = <2>;
 		gpio-controller;
 	};
@@ -191,23 +190,31 @@
 				label = "caldata";
 				reg = <0x660000 0x010000>;
 				read-only;
-				#address-cells = <1>;
-				#size-cells = <1>;
 
-				cal_art_1000: cal at 1000 {
-					reg = <0x1000 0xeb8>;
-				};
-
-				cal_art_5000: cal at 5000 {
-					reg = <0x5000 0xeb8>;
-				};
-
-				macaddr_lan: macaddr at ffa0 {
-					reg = <0xffa0 0x11>;
-				};
-
-				macaddr_wan: macaddr at ffb4 {
-					reg = <0xffb4 0x11>;
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					cal_art_1000: cal at 1000 {
+						reg = <0x1000 0xeb8>;
+					};
+
+					cal_art_5000: cal at 5000 {
+						reg = <0x5000 0xeb8>;
+					};
+
+					macaddr_lan: macaddr at ffa0 {
+						compatible = "mac-base";
+						reg = <0xffa0 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
+
+					macaddr_wan: macaddr at ffb4 {
+						compatible = "mac-base";
+						reg = <0xffb4 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
 				};
 			};
 
@@ -224,8 +231,8 @@
 
 	pll-data = <0x11110000 0x00001099 0x00991099>;
 
-	nvmem-cells = <&macaddr_lan>;
-	nvmem-cell-names = "mac-address-ascii";
+	nvmem-cells = <&macaddr_lan 0>;
+	nvmem-cell-names = "mac-address";
 
 	fixed-link {
 		speed = <1000>;
@@ -238,8 +245,8 @@
 
 	pll-data = <0x11110000 0x00001099 0x00991099>;
 
-	nvmem-cells = <&macaddr_wan>;
-	nvmem-cell-names = "mac-address-ascii";
+	nvmem-cells = <&macaddr_wan 0>;
+	nvmem-cell-names = "mac-address";
 
 	phy-handle = <&phy4>;
 };
diff --git a/target/linux/ath79/dts/ar9331_hiwifi_hc6361.dts b/target/linux/ath79/dts/ar9331_hiwifi_hc6361.dts
index 05d3f6730e..fa000ab90c 100644
--- a/target/linux/ath79/dts/ar9331_hiwifi_hc6361.dts
+++ b/target/linux/ath79/dts/ar9331_hiwifi_hc6361.dts
@@ -77,9 +77,22 @@
 			};
 
 			bdinfo: partition at 10000 {
+				compatible = "nvmem-cells";
 				reg = <0x10000 0x10000>;
 				label = "bdinfo";
 				read-only;
+
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					macaddr_bdinfo_18a: macaddr at 18a {
+						compatible = "mac-base";
+						reg = <0x18a 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
+				};
 			};
 
 			firmware: partition at 20000 {
@@ -124,33 +137,21 @@
 &eth0 {
 	status = "okay";
 
-	nvmem-cells = <&macaddr_bdinfo_18a>;
-	nvmem-cell-names = "mac-address-ascii";
-	mac-address-increment = <1>;
+	nvmem-cells = <&macaddr_bdinfo_18a 1>;
+	nvmem-cell-names = "mac-address";
 };
 
 &eth1 {
 	status = "okay";
 
-	nvmem-cells = <&macaddr_bdinfo_18a>;
-	nvmem-cell-names = "mac-address-ascii";
+	nvmem-cells = <&macaddr_bdinfo_18a 0>;
+	nvmem-cell-names = "mac-address";
 };
 
 &wmac {
 	status = "okay";
 	mtd-cal-data = <&art 0x1000>;
 
-	nvmem-cells = <&macaddr_bdinfo_18a>;
-	nvmem-cell-names = "mac-address-ascii";
-	mac-address-increment = <2>;
-};
-
-&bdinfo {
-	compatible = "nvmem-cells";
-	#address-cells = <1>;
-	#size-cells = <1>;
-
-	macaddr_bdinfo_18a: macaddr at 18a {
-		reg = <0x18a 0x11>;
-	};
+	nvmem-cells = <&macaddr_bdinfo_18a 2>;
+	nvmem-cell-names = "mac-address";
 };
diff --git a/target/linux/ath79/dts/ar9342_zyxel_nwa11xx.dtsi b/target/linux/ath79/dts/ar9342_zyxel_nwa11xx.dtsi
index 7cc1bba3fc..a05cc2e263 100644
--- a/target/linux/ath79/dts/ar9342_zyxel_nwa11xx.dtsi
+++ b/target/linux/ath79/dts/ar9342_zyxel_nwa11xx.dtsi
@@ -93,15 +93,23 @@
 				read-only;
 
 				compatible = "nvmem-cells";
-				#address-cells = <1>;
-				#size-cells = <1>;
-
-				macaddr_mib0_4b: macaddr at 4b {
-					reg = <0x4b 0x11>;
-				};
 
-				macaddr_mib0_66: macaddr at 66 {
-					reg = <0x66 0x11>;
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					macaddr_mib0_4b: macaddr at 4b {
+						compatible = "mac-base";
+						reg = <0x4b 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
+
+					macaddr_mib0_66: macaddr at 66 {
+						compatible = "mac-base";
+						reg = <0x66 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
 				};
 			};
 
@@ -161,6 +169,6 @@
 
 	ieee80211-freq-limit = <2402000 2482000>;
 
-	nvmem-cells = <&macaddr_mib0_4b>, <&calibration_ath9k>;
-	nvmem-cell-names = "mac-address-ascii", "calibration";
+	nvmem-cells = <&macaddr_mib0_4b 0>, <&calibration_ath9k>;
+	nvmem-cell-names = "mac-address", "calibration";
 };
diff --git a/target/linux/ath79/dts/ar9344_dlink_dir-8x5.dtsi b/target/linux/ath79/dts/ar9344_dlink_dir-8x5.dtsi
index 8e21b0dd9e..8db1bf5e0c 100644
--- a/target/linux/ath79/dts/ar9344_dlink_dir-8x5.dtsi
+++ b/target/linux/ath79/dts/ar9344_dlink_dir-8x5.dtsi
@@ -29,8 +29,8 @@
 	/* default for ar934x, except for 1000M */
 	pll-data = <0x06000000 0x00000101 0x00001616>;
 
-	nvmem-cells = <&macaddr_lan>;
-	nvmem-cell-names = "mac-address-ascii";
+	nvmem-cells = <&macaddr_lan 0>;
+	nvmem-cell-names = "mac-address";
 
 	phy-mode = "rgmii";
 	phy-handle = <&phy0>;
@@ -58,13 +58,13 @@
 	ath9k: wifi at 0,0 {
 		compatible = "pci168c,0030";
 		reg = <0x0000 0 0 0 0>;
-		/* "mac-address-ascii" currently does not work for
+		/* "mac-address" currently does not work for
 		   ath9k pci devices. these below are retained for future
 		   improvements. */
-		/* nvmem-cells = <&macaddr_wan>, <&cal_art_5000>;
-		   nvmem-cell-names = "mac-address-ascii", "calibration";
-		   mac-address-increment = <1>; */
-		qca,no-eeprom; /* remove this when "mac-address-ascii" works  */
+		/* nvmem-cells = <&macaddr_wan 1>, <&cal_art_5000>;
+		   nvmem-cell-names = "mac-address", "calibration";
+		 */
+		qca,no-eeprom; /* remove this when "mac-address" works  */
 		gpio-controller;
 		#gpio-cells = <2>;
 	};
@@ -117,15 +117,23 @@
 				read-only;
 
 				compatible = "nvmem-cells";
-				#address-cells = <1>;
-				#size-cells = <1>;
-
-				macaddr_lan: macaddr at 4 {
-					reg = <0x4 0x11>;
-				};
 
-				macaddr_wan: macaddr at 18 {
-					reg = <0x18 0x11>;
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					macaddr_lan: macaddr at 4 {
+						compatible = "mac-base";
+						reg = <0x4 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
+
+					macaddr_wan: macaddr at 18 {
+						compatible = "mac-base";
+						reg = <0x18 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
 				};
 			};
 
@@ -160,6 +168,6 @@
 
 &wmac {
 	status = "okay";
-	nvmem-cells = <&macaddr_lan>, <&cal_art_1000>;
-	nvmem-cell-names = "mac-address-ascii", "calibration";
+	nvmem-cells = <&macaddr_lan 0>, <&cal_art_1000>;
+	nvmem-cell-names = "mac-address", "calibration";
 };
diff --git a/target/linux/ath79/dts/qca9558_dlink_dir-629-a1.dts b/target/linux/ath79/dts/qca9558_dlink_dir-629-a1.dts
index 41b0039e93..d012ae4c50 100644
--- a/target/linux/ath79/dts/qca9558_dlink_dir-629-a1.dts
+++ b/target/linux/ath79/dts/qca9558_dlink_dir-629-a1.dts
@@ -65,8 +65,8 @@
 
 	phy-mode = "mii";
 
-	nvmem-cells = <&macaddr_mfcdata_35>;
-	nvmem-cell-names = "mac-address-ascii";
+	nvmem-cells = <&macaddr_mfcdata_35 0>;
+	nvmem-cell-names = "mac-address";
 
 	fixed-link {
 		speed = <100>;
@@ -115,15 +115,23 @@
 				read-only;
 
 				compatible = "nvmem-cells";
-				#address-cells = <1>;
-				#size-cells = <1>;
-
-				macaddr_mfcdata_35: macaddr at 35 {
-					reg = <0x35 0x11>;
-				};
 
-				macaddr_mfcdata_51: macaddr at 51 {
-					reg = <0x51 0x11>;
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					macaddr_mfcdata_35: macaddr at 35 {
+						compatible = "mac-base";
+						reg = <0x35 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
+
+					macaddr_mfcdata_51: macaddr at 51 {
+						compatible = "mac-base";
+						reg = <0x51 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
 				};
 			};
 
@@ -165,6 +173,6 @@
 &wmac {
 	status = "okay";
 
-	nvmem-cells = <&cal_art_1000>, <&macaddr_mfcdata_51>;
-	nvmem-cell-names = "calibration", "mac-address-ascii";
+	nvmem-cells = <&cal_art_1000>, <&macaddr_mfcdata_51 0>;
+	nvmem-cell-names = "calibration", "mac-address";
 };
diff --git a/target/linux/ath79/dts/qca9563_dlink_dir-8x9-a1.dtsi b/target/linux/ath79/dts/qca9563_dlink_dir-8x9-a1.dtsi
index 3fd9790c4a..616c29a4c1 100644
--- a/target/linux/ath79/dts/qca9563_dlink_dir-8x9-a1.dtsi
+++ b/target/linux/ath79/dts/qca9563_dlink_dir-8x9-a1.dtsi
@@ -32,8 +32,8 @@
 		compatible = "qcom,ath10k";
 		reg = <0x0000 0 0 0 0>;
 
-		nvmem-cells = <&calibration_ath10k>, <&macaddr_devdata_94>;
-		nvmem-cell-names = "calibration", "mac-address-ascii";
+		nvmem-cells = <&calibration_ath10k>, <&macaddr_devdata_94 0>;
+		nvmem-cell-names = "calibration", "mac-address";
 	};
 };
 
@@ -68,16 +68,25 @@
 				read-only;
 
 				compatible = "nvmem-cells";
-				#address-cells = <1>;
-				#size-cells = <1>;
 
-				macaddr_devdata_94: macaddr at 94 {
-					reg = <0x94 0x11>;
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					macaddr_devdata_94: macaddr at 94 {
+						compatible = "mac-base";
+						reg = <0x94 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
+
+					macaddr_devdata_b0: macaddr at b0 {
+						compatible = "mac-base";
+						reg = <0xb0 0x11>;
+						#nvmem-cell-cells = <1>;
+					};
 				};
 
-				macaddr_devdata_b0: macaddr at b0 {
-					reg = <0xb0 0x11>;
-				};
 			};
 
 			partition at 60000 {
@@ -147,6 +156,6 @@
 &wmac {
 	status = "okay";
 
-	nvmem-cells = <&calibration_ath9k>, <&macaddr_devdata_b0>;
-	nvmem-cell-names = "calibration", "mac-address-ascii";
+	nvmem-cells = <&calibration_ath9k>, <&macaddr_devdata_b0 0>;
+	nvmem-cell-names = "calibration", "mac-address";
 };
-- 
2.35.3



