Re: [PATCH] ath79: increase the rfkill debounce interval for TP-Link Archer C7 v2

2023-07-14 Thread Rosen Penev
On Fri, Jul 14, 2023 at 8:12 AM Shiji Yang  wrote:
>
> From: Shiji Yang 
>
> 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@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 
> ---
>  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 = ;
> linux,input-type = ;
> -   debounce-interval = <60>;
> +   debounce-interval = <1000>;
> };
>  };
>
> --
> 2.30.2
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] ramips: replace "mac-address-ascii" with "mac-base"

2023-07-14 Thread Mikhail Zhilkin

On 7/14/2023 4:11 PM, Rafał Miłecki wrote:
> From: Rafał Miłecki 
> 
> With upstream accepted "mac-base" binding there is no need for a
> downstream "mac-address-ascii" workaround anymore.
> 
> Signed-off-by: Rafał Miłecki 
> ---
>  .../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@8014 {
> - reg = <0x8014 0x11>;
> - };
>  
> - macaddr_config_8036: macaddr@8036 {
> - reg = <0x8036 0x11>;
> + nvmem-layout {
> + compatible = "fixed-layout";
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + macaddr_config_8014: macaddr@8014 {
> + compatible = "mac-base";
> + reg = <0x8014 0x11>;
> + #nvmem-cell-cells = <1>;
> + };
> +
> + macaddr_config_8036: macaddr@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 = <ðphy4>;
>  
> - 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@165 {
> - reg = <0x165 0x11>;
> + nvmem-layout {
> + compatible = "fixed-layout";
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + macaddr_factory_165: macaddr@165 {
> + compatible = "mac-base";
> + reg = <0x165 0x11>;
> + #nvmem-cell-cells = <1>;
> + };
>   };
> +
> +
>   };
>  
>   partition@0_wholeflash {
> @@ -257,8 +265,8 @@
>   mediatek,mtd-eeprom = <&factory 0x8000>;
>   ieee80211-freq-limit = <240 250>;
>  
> - 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 = <500 600>;
>  
> - 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 = <ðphy0>;
>  
> - nvmem-cells = <&macaddr_factory_165>;
> - nvmem-cell-names = "mac-address-ascii";
> -  

Re: [PATCH uci] file: Fix uci -m import command

2023-07-14 Thread Jan Venekamp

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-...@venekamp.net/
https://patchwork.ozlabs.org/project/openwrt/patch/sy4p282mb39395204ae37bc45d35d834cc5...@sy4p282mb3939.ausp282.prod.outlook.com/

Kind regards,
Jan Venekamp


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH uci 2/2] remove internal usage of redundant uci_ptr.last

2023-07-14 Thread Jan Venekamp
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 
---
 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);
   

[PATCH uci 0/2] remove internal usage of redundant uci_ptr.last

2023-07-14 Thread Jan Venekamp
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)


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH uci 1/2] file: Fix uci -m import command

2023-07-14 Thread Jan Venekamp
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 
Signed-off-by: Jan Venekamp 
---
 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)


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] ramips: set Netgear R6220 MAC NVMEM cell directly in the part node

2023-07-14 Thread Rafał Miłecki

On 2023-07-14 11:57, Felix Baumann wrote:
Am 14. Juli 2023 10:26:33 MESZ schrieb "Rafał Miłecki" 
:

On 9.05.2023 18:21, Felix Baumann wrote:
Am 9. Mai 2023 15:29:48 MESZ schrieb "Rafał Miłecki" 
:

From: Rafał Miłecki 

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 
---
.../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@2e0 {


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@4 {
compatible = "mac-base";
reg = <0x04 0x06>;
#nvmem-cell-cells = <0x01>;
phandle = <0x13>;
};


Then my Ethernet controller nodes look like that:

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

mac@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.

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] ath79: increase the rfkill debounce interval for TP-Link Archer C7 v2

2023-07-14 Thread Shiji Yang
From: Shiji Yang 

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@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 
---
 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 = ;
linux,input-type = ;
-   debounce-interval = <60>;
+   debounce-interval = <1000>;
};
 };
 
-- 
2.30.2


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] ramips: replace "mac-address-ascii" with "mac-base"

2023-07-14 Thread Rafał Miłecki
From: Rafał Miłecki 

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

Signed-off-by: Rafał Miłecki 
---
 .../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@8014 {
-   reg = <0x8014 0x11>;
-   };
 
-   macaddr_config_8036: macaddr@8036 {
-   reg = <0x8036 0x11>;
+   nvmem-layout {
+   compatible = "fixed-layout";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   macaddr_config_8014: macaddr@8014 {
+   compatible = "mac-base";
+   reg = <0x8014 0x11>;
+   #nvmem-cell-cells = <1>;
+   };
+
+   macaddr_config_8036: macaddr@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 = <ðphy4>;
 
-   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@165 {
-   reg = <0x165 0x11>;
+   nvmem-layout {
+   compatible = "fixed-layout";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   macaddr_factory_165: macaddr@165 {
+   compatible = "mac-base";
+   reg = <0x165 0x11>;
+   #nvmem-cell-cells = <1>;
+   };
};
+
+
};
 
partition@0_wholeflash {
@@ -257,8 +265,8 @@
mediatek,mtd-eeprom = <&factory 0x8000>;
ieee80211-freq-limit = <240 250>;
 
-   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 = <500 600>;
 
-   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 = <ðphy0>;
 
-   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


__

Re: [PATCH] ramips: set Netgear R6220 MAC NVMEM cell directly in the part node

2023-07-14 Thread Felix Baumann
Am 14. Juli 2023 10:26:33 MESZ schrieb "Rafał Miłecki" :
>On 9.05.2023 18:21, Felix Baumann wrote:
>> Am 9. Mai 2023 15:29:48 MESZ schrieb "Rafał Miłecki" :
>>> From: Rafał Miłecki 
>>> 
>>> 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 
>>> ---
>>> .../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@2e0 {
>> 
>> 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

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] ramips: set Netgear R6220 MAC NVMEM cell directly in the part node

2023-07-14 Thread Rafał Miłecki

On 9.05.2023 18:21, Felix Baumann wrote:

Am 9. Mai 2023 15:29:48 MESZ schrieb "Rafał Miłecki" :

From: Rafał Miłecki 

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 
---
.../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@2e0 {


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 = <0x2e0 0x10>;
read-only;
+
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   macaddr_factory_4: macaddr@4 {
+   reg = <0x4 0x6>;
+   };
};

partition@420 {
@@ -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@4 {
-   reg = <0x4 0x6>;
-   };
-};
--
2.35.3


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel