[PATCH] kernel: drop unneeded OpenWrt's fw_devlink hack

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

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 
---
 ...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..00
--- 
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?= 
-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-de4bf91a1...@gmail.com/T/#u
-Signed-off-by: Rafał Miłecki 

- 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..00
--- 
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?= 
-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-de4bf91a1...@gmail.com/T/#u
-Signed-off-by: Rafał Miłecki 

- 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


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


Re: Matter integration

2023-07-29 Thread Lukas Zeller
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 
>  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 
> Subject: Matter integration
> Date: 27 July 2023 at 23:11:10 CEST
> To: openwrt-devel@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 
> [2] https://github.com/project-chip/connectedhomeip
> 
> 
> 
> 
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel



signature.asc
Description: Message signed with OpenPGP
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[v2 1/2] mac80211: rework MT7620 PA/LNA RF calibration

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

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 
---
 ...-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 00..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 
+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 
+---
+ .../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.
+-   */
+  

[v2 2/2] ramips: pinctrl: support requesting different functions for same group

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

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 
---
 ...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 00..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 
+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 
+---
+ 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


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


[v2 0/2] rework MT7620 PA/LNA RF calibration

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

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


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


[PATCH] xdp-tools: disable stack protector for BPF programs

2023-07-29 Thread stijn
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:

CLANGxdp-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 
---
 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


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