From a69367933dfefe1b72d949c70d7f1080db896d58 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sat, 11 Nov 2023 23:38:30 +0100 Subject: [PATCH 01/50] netifd: update to Git HEAD (2023-11-11) c739dee0a37b system-linux: refresh MAC address on DSA port conduit change Signed-off-by: Christian Marangi --- package/network/config/netifd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index 826889aca6c..eb4363e9c69 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git -PKG_SOURCE_DATE:=2023-11-10 -PKG_SOURCE_VERSION:=35facc8306f590a7330789ab6d5785c0d43073ef -PKG_MIRROR_HASH:=4f73591ae1873e18df235349e478f2196ca0d3123c313a04149dc9d5e2bfb403 +PKG_SOURCE_DATE:=2023-11-11 +PKG_SOURCE_VERSION:=c739dee0a37bc593aaed7ae3f0a61e3d7c1fb1ac +PKG_MIRROR_HASH:=5e3dc0ce4774cd738b2d6363b642ee0501bd6b7f8061d5d82151af2069e7fbfd PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 From 8cce00bc9dddc3fc47d63625b0f512693c27ce2f Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sat, 11 Nov 2023 18:34:27 +0100 Subject: [PATCH 02/50] qca-ssdk: fix unsupported scenario with PORT1 not declared in switch bmp Commit 947b44d9ae17 ("ipq807x: fix wrong define for LAN and WAN ess mask") started fixing wrong switch_lan_bmp that defined lan there weren't actually present. This displayed a fragility in the malibu phy init code in qca-ssdk. Add patch to fix this. Quoting the patch detailed description: I'm very confused by this and to me it's not clear the real usage of this logic. From what I can see the usage of this is EXTREMELY FRAGILE and results in dangerous results if the OEM (or anyone that by chance try to implement things in a logical manner) deviates from the default values from the "magical template". To be in more details. With QSDK 12.4, some tweaks were done to improve autoneg and now on every call of port status, the phydev is tried to add. This resulted in the call and log spam of an error with ports that are actually not present on the system with qsdk reporting phydev is NULL. This itself is not an error and printing the error is correct. What is actually an error from ages is setting generic bitmap reporting presence of port that are actually not present. This is very common on OEM where the switch_lan_bmp is always a variant of 0x1e (that on bitmap results in PORT1 PORT2 PORT3 PORT4 present) or 0x3e (PORT1 PORT2 PORT3 PORT4 PORT5). Reality is that many device are used as AP with one LAN port or one WAN port. (or even exotic configuration with PORT1 not present and PORT2 PORT3 PORT4 present (Xiaomi 3600) With this finding one can say... ok nice, then lets update the DT and set the correct bitmap... Again world is a bad place and reality is that this cause wonderful regression in some case of by extreme luck the first ever connected port working and the rest of the switch dead. The problem has been bisected to all the device that doesn't have the PORT1 declared in any of the bitmap. With this perfection in mind, on to the REAL problem. malibu_phy_hw_init FOR SOME REASON, set a global variable first_phy_addr to the first detected PHY addr that coincidentally is always PORT1. PORT1 addr is 0x0. The entire code in malibu_phy use this variable to derive the phy addrs in some function. Declaring a bitmap where the PORT1 is missing (or worse PORT4 the only one connected) result in first_phy_addr set to 1 or whatever phy addr is detected first setting wrong value all over the init stage. To fix this, just drop this variable and hardcode everything to assume the first phy adrr is ALWAYS 0 and remove calculation and use define for special case. With the following change normal switch traffic is restored and ports function is recovered. Fixes: #13945 Fixes: 947b44d9ae17 ("ipq807x: fix wrong define for LAN and WAN ess mask") Signed-off-by: Christian Marangi --- package/kernel/qca-ssdk/Makefile | 2 +- ...ibu-phy-drop-usage-of-first_phy_addr.patch | 264 ++++++++++++++++++ 2 files changed, 265 insertions(+), 1 deletion(-) create mode 100644 package/kernel/qca-ssdk/patches/100-malibu-phy-drop-usage-of-first_phy_addr.patch diff --git a/package/kernel/qca-ssdk/Makefile b/package/kernel/qca-ssdk/Makefile index f5d82605034..4107208c0eb 100644 --- a/package/kernel/qca-ssdk/Makefile +++ b/package/kernel/qca-ssdk/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=qca-ssdk -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/qca-ssdk.git PKG_SOURCE_PROTO:=git diff --git a/package/kernel/qca-ssdk/patches/100-malibu-phy-drop-usage-of-first_phy_addr.patch b/package/kernel/qca-ssdk/patches/100-malibu-phy-drop-usage-of-first_phy_addr.patch new file mode 100644 index 00000000000..905f1cde011 --- /dev/null +++ b/package/kernel/qca-ssdk/patches/100-malibu-phy-drop-usage-of-first_phy_addr.patch @@ -0,0 +1,264 @@ +From 46ed8163ac0d9a11a629f1c446e8c5e711cf35d6 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Sat, 11 Nov 2023 18:13:02 +0100 +Subject: [PATCH] malibu-phy: drop usage of first_phy_addr + +I'm very confused by this and to me it's not clear the real usage of +this logic. + +From what I can see the usage of this is EXTREMELY FRAGILE and results +in dangerous results if the OEM (or anyone that by chance try to +implement things in a logical manner) deviates from the default values +from the "magical template". + +To be in more details. With QSDK 12.4, some tweaks were done to improve +autoneg and now on every call of port status, the phydev is tried to +add. This resulted in the call and log spam of an error with ports that +are actually not present on the system with qsdk reporting phydev is +NULL. This itself is not an error and printing the error is correct. + +What is actually an error from ages is setting generic bitmap reporting +presence of port that are actually not present. This is very common on +OEM where the switch_lan_bmp is always a variant of 0x1e (that on bitmap +results in PORT1 PORT2 PORT3 PORT4 present) or 0x3e (PORT1 PORT2 PORT3 +PORT4 PORT5). Reality is that many device are used as AP with one LAN +port or one WAN port. (or even exotic configuration with PORT1 not +present and PORT2 PORT3 PORT4 present (Xiaomi 3600) + +With this finding one can say... ok nice, then lets update the DT and +set the correct bitmap... + +Again world is a bad place and reality is that this cause wonderful +regression in some case of by extreme luck the first ever connected +port working and the rest of the switch dead. + +The problem has been bisected to all the device that doesn't have the +PORT1 declared in any of the bitmap. + +With this perfection in mind, on to the REAL problem. + +malibu_phy_hw_init FOR SOME REASON, set a global variable first_phy_addr +to the first detected PHY addr that coincidentally is always PORT1. +PORT1 addr is 0x0. The entire code in malibu_phy use this variable to +derive the phy addrs in some function. + +Declaring a bitmap where the PORT1 is missing (or worse PORT4 the only +one connected) result in first_phy_addr set to 1 or whatever phy addr is +detected first setting wrong value all over the init stage. + +To fix this, just drop this variable and hardcode everything to assume +the first phy adrr is ALWAYS 0 and remove calculation and use define for +special case. + +With the following change normal switch traffic is restored and ports +function is recovered. + +Signed-off-by: Christian Marangi +--- + src/hsl/phy/malibu_phy.c | 63 +++++++++++++++++----------------------- + 1 file changed, 26 insertions(+), 37 deletions(-) + +--- a/src/hsl/phy/malibu_phy.c ++++ b/src/hsl/phy/malibu_phy.c +@@ -26,8 +26,9 @@ + #include "qcaphy_common.h" + #include "ssdk_plat.h" + +-static a_uint32_t first_phy_addr = MAX_PHY_ADDR; + static a_uint32_t combo_phy_addr = MAX_PHY_ADDR; ++#define PORT4_PHY_ID 0x4 ++#define PORT5_PHY_ID 0x5 + #define COMBO_PHY_ID combo_phy_addr + + /****************************************************************************** +@@ -1250,10 +1251,10 @@ sw_error_t + malibu_phy_serdes_reset(a_uint32_t dev_id) + { + +- hsl_phy_mii_reg_write(dev_id, first_phy_addr + MALIBU_PHY_PSGMII_ADDR_INC, ++ hsl_phy_mii_reg_write(dev_id, MALIBU_PHY_PSGMII_ADDR_INC, + MALIBU_MODE_RESET_REG, MALIBU_MODE_CHANAGE_RESET); + mdelay(100); +- hsl_phy_mii_reg_write(dev_id, first_phy_addr + MALIBU_PHY_PSGMII_ADDR_INC, ++ hsl_phy_mii_reg_write(dev_id, MALIBU_PHY_PSGMII_ADDR_INC, + MALIBU_MODE_RESET_REG, MALIBU_MODE_RESET_DEFAULT_VALUE); + + return SW_OK; +@@ -1271,8 +1272,7 @@ malibu_phy_interface_set_mode(a_uint32_t + a_uint16_t phy_data = 0; + static fal_port_interface_mode_t phy_mode = PORT_INTERFACE_MODE_MAX; + +- if ((phy_addr < first_phy_addr) || +- (phy_addr > (first_phy_addr + MALIBU_PHY_MAX_ADDR_INC))) ++ if (phy_addr > MALIBU_PHY_MAX_ADDR_INC) + return SW_NOT_SUPPORTED; + /*if interface_mode have been configured, then no need to configure again*/ + if(phy_mode == interface_mode) +@@ -1295,20 +1295,19 @@ malibu_phy_interface_set_mode(a_uint32_t + return SW_BAD_PARAM; + } + +- hsl_phy_modify_mii(dev_id, +- first_phy_addr + MALIBU_PHY_MAX_ADDR_INC, MALIBU_PHY_CHIP_CONFIG, ++ hsl_phy_modify_mii(dev_id, MALIBU_PHY_MAX_ADDR_INC, MALIBU_PHY_CHIP_CONFIG, + BITS(0, 4), phy_data); + + /* reset operation */ + malibu_phy_serdes_reset(dev_id); + + if (interface_mode == PHY_PSGMII_FIBER) { +- hsl_phy_mii_reg_write(dev_id, first_phy_addr + MALIBU_PHY_MAX_ADDR_INC, ++ hsl_phy_mii_reg_write(dev_id, MALIBU_PHY_MAX_ADDR_INC, + MALIBU_PHY_CHIP_CONFIG, MALIBU_MODECTRL_DFLT); +- hsl_phy_mii_reg_write(dev_id, first_phy_addr + MALIBU_PHY_MAX_ADDR_INC, ++ hsl_phy_mii_reg_write(dev_id, MALIBU_PHY_MAX_ADDR_INC, + MALIBU_PHY_CONTROL, MALIBU_MIICTRL_DFLT); + hsl_phy_phydev_autoneg_update(dev_id, +- first_phy_addr + MALIBU_PHY_MAX_ADDR_INC, A_FALSE, 0); ++ MALIBU_PHY_MAX_ADDR_INC, A_FALSE, 0); + } + phy_mode = interface_mode; + SSDK_DEBUG("malibu phy is configured as phy_mode:0x%x\n", phy_mode); +@@ -1329,13 +1328,12 @@ malibu_phy_interface_get_mode(a_uint32_t + a_uint16_t phy_data; + a_uint16_t copper_mode; + +- if ((phy_addr < first_phy_addr) || +- (phy_addr > (first_phy_addr + MALIBU_PHY_MAX_ADDR_INC))) { ++ if (phy_addr > MALIBU_PHY_MAX_ADDR_INC) { + return SW_NOT_SUPPORTED; + } + + phy_data = hsl_phy_mii_reg_read(dev_id, +- first_phy_addr + MALIBU_PHY_MAX_ADDR_INC, MALIBU_PHY_CHIP_CONFIG); ++ MALIBU_PHY_MAX_ADDR_INC, MALIBU_PHY_CHIP_CONFIG); + copper_mode = ((phy_data & MALIBU_PHY_COPPER_MODE) >> 0xf); + phy_data &= 0x000f; + +@@ -1344,13 +1342,13 @@ malibu_phy_interface_get_mode(a_uint32_t + *interface_mode = PHY_PSGMII_BASET; + break; + case MALIBU_PHY_PSGMII_BX1000: +- if (phy_addr == first_phy_addr + MALIBU_PHY_MAX_ADDR_INC) ++ if (phy_addr == MALIBU_PHY_MAX_ADDR_INC) + *interface_mode = PHY_PSGMII_BX1000; + else + *interface_mode = PHY_PSGMII_BASET; + break; + case MALIBU_PHY_PSGMII_FX100: +- if (phy_addr == first_phy_addr + MALIBU_PHY_MAX_ADDR_INC) ++ if (phy_addr == MALIBU_PHY_MAX_ADDR_INC) + *interface_mode = PHY_PSGMII_FX100; + else + *interface_mode = PHY_PSGMII_BASET; +@@ -1359,14 +1357,14 @@ malibu_phy_interface_get_mode(a_uint32_t + if (copper_mode) { + *interface_mode = PHY_PSGMII_BASET; + } else { +- if (phy_addr == first_phy_addr + MALIBU_PHY_MAX_ADDR_INC) ++ if (phy_addr == MALIBU_PHY_MAX_ADDR_INC) + *interface_mode = PHY_PSGMII_FIBER; + else + *interface_mode = PHY_PSGMII_BASET; + } + break; + case MALIBU_PHY_SGMII_BASET: +- if (phy_addr == first_phy_addr + MALIBU_PHY_MAX_ADDR_INC) ++ if (phy_addr == MALIBU_PHY_MAX_ADDR_INC) + *interface_mode = PHY_SGMII_BASET; + else + *interface_mode = PORT_QSGMII; +@@ -1392,13 +1390,12 @@ malibu_phy_interface_get_mode_status(a_u + a_uint16_t phy_data, phy_mode, phy_mode_status; + a_uint16_t copper_mode; + +- if ((phy_addr < first_phy_addr) || +- (phy_addr > (first_phy_addr + MALIBU_PHY_MAX_ADDR_INC))) { ++ if (phy_addr > MALIBU_PHY_MAX_ADDR_INC) { + return SW_NOT_SUPPORTED; + } + + phy_data = hsl_phy_mii_reg_read(dev_id, +- first_phy_addr + MALIBU_PHY_MAX_ADDR_INC, MALIBU_PHY_CHIP_CONFIG); ++ MALIBU_PHY_MAX_ADDR_INC, MALIBU_PHY_CHIP_CONFIG); + copper_mode = ((phy_data & MALIBU_PHY_COPPER_MODE) >> 0xf); + phy_mode = phy_data & 0x000f; + phy_mode_status = (phy_data & 0x00f0) >> 0x4; +@@ -1407,7 +1404,7 @@ malibu_phy_interface_get_mode_status(a_u + if (copper_mode) { + *interface_mode_status = PHY_PSGMII_BASET; + } else { +- if (phy_addr == first_phy_addr + MALIBU_PHY_MAX_ADDR_INC) ++ if (phy_addr == MALIBU_PHY_MAX_ADDR_INC) + *interface_mode_status = PHY_PSGMII_FIBER; + else + *interface_mode_status = PHY_PSGMII_BASET; +@@ -1418,19 +1415,19 @@ malibu_phy_interface_get_mode_status(a_u + *interface_mode_status = PHY_PSGMII_BASET; + break; + case MALIBU_PHY_PSGMII_BX1000: +- if (phy_addr == first_phy_addr + MALIBU_PHY_MAX_ADDR_INC) ++ if (phy_addr == MALIBU_PHY_MAX_ADDR_INC) + *interface_mode_status = PHY_PSGMII_BX1000; + else + *interface_mode_status = PHY_PSGMII_BASET; + break; + case MALIBU_PHY_PSGMII_FX100: +- if (phy_addr == first_phy_addr + MALIBU_PHY_MAX_ADDR_INC) ++ if (phy_addr == MALIBU_PHY_MAX_ADDR_INC) + *interface_mode_status = PHY_PSGMII_FX100; + else + *interface_mode_status = PHY_PSGMII_BASET; + break; + case MALIBU_PHY_SGMII_BASET: +- if (phy_addr == first_phy_addr + MALIBU_PHY_MAX_ADDR_INC) ++ if (phy_addr == MALIBU_PHY_MAX_ADDR_INC) + *interface_mode_status = PHY_SGMII_BASET; + else + *interface_mode_status = PORT_QSGMII; +@@ -1795,10 +1792,6 @@ malibu_phy_hw_init(a_uint32_t dev_id, a_ + { + phy_cnt ++; + phy_addr = qca_ssdk_port_to_phy_addr(dev_id, port_id); +- if (phy_addr < first_phy_addr) +- { +- first_phy_addr = phy_addr; +- } + /*enable phy power saving function by default */ + malibu_phy_set_8023az(dev_id, phy_addr, A_TRUE); + malibu_phy_set_powersave(dev_id, phy_addr, A_TRUE); +@@ -1824,29 +1817,25 @@ malibu_phy_hw_init(a_uint32_t dev_id, a_ + MALIBU_EXTENDED_NEXT_PAGE_EN, 0); + } + } +- /* qca 8072 two ports phy chip's firstly address to init phy chip */ +- if ((phy_cnt == QCA8072_PHY_NUM) && (first_phy_addr >= 0x3)) { +- first_phy_addr = first_phy_addr - 0x3; +- } + + /*workaround to enable AZ transmitting ability*/ +- hsl_phy_mmd_reg_write(dev_id, first_phy_addr + 5, A_FALSE, MALIBU_PHY_MMD1_NUM, ++ hsl_phy_mmd_reg_write(dev_id, PORT5_PHY_ID, A_FALSE, MALIBU_PHY_MMD1_NUM, + MALIBU_PSGMII_MODE_CTRL, MALIBU_PHY_PSGMII_MODE_CTRL_ADJUST_VALUE); + + /* adjust psgmii serdes tx amp */ +- hsl_phy_mii_reg_write(dev_id, first_phy_addr + 5, ++ hsl_phy_mii_reg_write(dev_id, PORT5_PHY_ID, + MALIBU_PSGMII_TX_DRIVER_1_CTRL, MALIBU_PHY_PSGMII_REDUCE_SERDES_TX_AMP); + + /* to avoid psgmii module goes into hibernation, work with psgmii self test*/ +- hsl_phy_modify_mmd(dev_id, first_phy_addr + 4, A_FALSE, MALIBU_PHY_MMD3_NUM, ++ hsl_phy_modify_mmd(dev_id, PORT4_PHY_ID, A_FALSE, MALIBU_PHY_MMD3_NUM, + MALIBU_PHY_MMD3_ADDR_REMOTE_LOOPBACK_CTRL, BIT(1), 0); + + mode = ssdk_dt_global_get_mac_mode(dev_id, 0); + if (mode == PORT_WRAPPER_PSGMII_FIBER) +- malibu_phy_interface_set_mode(dev_id, first_phy_addr, PHY_PSGMII_FIBER); ++ malibu_phy_interface_set_mode(dev_id, 0x0, PHY_PSGMII_FIBER); + + /*init combo phy address*/ +- combo_phy_addr = first_phy_addr+4; ++ combo_phy_addr = PORT4_PHY_ID; + + return SW_OK; + } From 36b1dd75fd9da1ea13f1ce1ee679c6b3c9c402cc Mon Sep 17 00:00:00 2001 From: Hannu Nyman Date: Sat, 11 Nov 2023 19:03:57 +0200 Subject: [PATCH 03/50] ath10k-ct: Restore functionality after switch to 6.4 version Adjust our local ath10k-ct patches to the change from the -ct 6.2 version to 6.4. This restores e.g. the LED functionality. Fixes: 7d3651f1b9b ("ath10k-ct: switch to 6.4") Signed-off-by: Hannu Nyman --- ...k-read-qcom-coexist-support-as-a-u32.patch | 4 +- ...rolling-support-for-various-chipsets.patch | 72 +++++++++---------- ...02-ath10k-use-tpt-trigger-by-default.patch | 20 +++--- ...0-0010-ath10k-limit-htt-rx-ring-size.patch | 4 +- ...60-0011-ath10k-limit-pci-buffer-size.patch | 4 +- ...k-always-use-mac80211-loss-detection.patch | 8 +-- 6 files changed, 56 insertions(+), 56 deletions(-) diff --git a/package/kernel/ath10k-ct/patches/130-ath10k-read-qcom-coexist-support-as-a-u32.patch b/package/kernel/ath10k-ct/patches/130-ath10k-read-qcom-coexist-support-as-a-u32.patch index 77e2724991e..891973f38db 100644 --- a/package/kernel/ath10k-ct/patches/130-ath10k-read-qcom-coexist-support-as-a-u32.patch +++ b/package/kernel/ath10k-ct/patches/130-ath10k-read-qcom-coexist-support-as-a-u32.patch @@ -39,8 +39,8 @@ that the feature is properly initialized: Signed-off-by: Vincent Tremblay ---- a/ath10k-6.2/core.c -+++ b/ath10k-6.2/core.c +--- a/ath10k-6.4/core.c ++++ b/ath10k-6.4/core.c @@ -2869,14 +2869,14 @@ done: static void ath10k_core_fetch_btcoex_dt(struct ath10k *ar) { diff --git a/package/kernel/ath10k-ct/patches/201-ath10k-add-LED-and-GPIO-controlling-support-for-various-chipsets.patch b/package/kernel/ath10k-ct/patches/201-ath10k-add-LED-and-GPIO-controlling-support-for-various-chipsets.patch index 844c089e888..8eb587b877b 100644 --- a/package/kernel/ath10k-ct/patches/201-ath10k-add-LED-and-GPIO-controlling-support-for-various-chipsets.patch +++ b/package/kernel/ath10k-ct/patches/201-ath10k-add-LED-and-GPIO-controlling-support-for-various-chipsets.patch @@ -66,24 +66,24 @@ v13: * cleanup includes - ath10k-6.2/Kconfig | 10 +++ - ath10k-6.2/Makefile | 1 + - ath10k-6.2/core.c | 22 +++++++ - ath10k-6.2/core.h | 9 ++- - ath10k-6.2/hw.h | 1 + - ath10k-6.2/leds.c | 103 ++++++++++++++++++++++++++++++ - ath10k-6.2/leds.h | 45 +++++++++++++ - ath10k-6.2/mac.c | 1 + - ath10k-6.2/wmi-ops.h | 32 ++++++++++ - ath10k-6.2/wmi-tlv.c | 2 + - ath10k-6.2/wmi.c | 54 ++++++++++++++++ - ath10k-6.2/wmi.h | 35 ++++++++++ + ath10k-6.4/Kconfig | 10 +++ + ath10k-6.4/Makefile | 1 + + ath10k-6.4/core.c | 22 +++++++ + ath10k-6.4/core.h | 9 ++- + ath10k-6.4/hw.h | 1 + + ath10k-6.4/leds.c | 103 ++++++++++++++++++++++++++++++ + ath10k-6.4/leds.h | 45 +++++++++++++ + ath10k-6.4/mac.c | 1 + + ath10k-6.4/wmi-ops.h | 32 ++++++++++ + ath10k-6.4/wmi-tlv.c | 2 + + ath10k-6.4/wmi.c | 54 ++++++++++++++++ + ath10k-6.4/wmi.h | 35 ++++++++++ 12 files changed, 314 insertions(+), 1 deletion(-) - create mode 100644 ath10k-6.2/leds.c - create mode 100644 ath10k-6.2/leds.h + create mode 100644 ath10k-6.4/leds.c + create mode 100644 ath10k-6.4/leds.h ---- a/ath10k-6.2/Kconfig -+++ b/ath10k-6.2/Kconfig +--- a/ath10k-6.4/Kconfig ++++ b/ath10k-6.4/Kconfig @@ -67,6 +67,16 @@ config ATH10K_DEBUGFS If unsure, say Y to make it easier to debug problems. @@ -101,8 +101,8 @@ v13: config ATH10K_SPECTRAL bool "Atheros ath10k spectral scan support" depends on ATH10K_DEBUGFS ---- a/ath10k-6.2/Makefile -+++ b/ath10k-6.2/Makefile +--- a/ath10k-6.4/Makefile ++++ b/ath10k-6.4/Makefile @@ -20,6 +20,7 @@ ath10k_core-$(CONFIG_ATH10K_SPECTRAL) += ath10k_core-$(CONFIG_NL80211_TESTMODE) += testmode.o ath10k_core-$(CONFIG_ATH10K_TRACING) += trace.o @@ -111,8 +111,8 @@ v13: ath10k_core-$(CONFIG_MAC80211_DEBUGFS) += debugfs_sta.o ath10k_core-$(CONFIG_PM) += wow.o ath10k_core-$(CONFIG_ATH10K_CE) += ce.o ---- a/ath10k-6.2/core.c -+++ b/ath10k-6.2/core.c +--- a/ath10k-6.4/core.c ++++ b/ath10k-6.4/core.c @@ -28,6 +28,7 @@ #include "testmode.h" #include "wmi-ops.h" @@ -200,8 +200,8 @@ v13: ath10k_thermal_unregister(ar); /* Stop spectral before unregistering from mac80211 to remove the * relayfs debugfs file cleanly. Otherwise the parent debugfs tree ---- a/ath10k-6.2/core.h -+++ b/ath10k-6.2/core.h +--- a/ath10k-6.4/core.h ++++ b/ath10k-6.4/core.h @@ -14,6 +14,7 @@ #include #include @@ -224,8 +224,8 @@ v13: /* protected by data_lock */ u32 rx_crc_err_drop; u32 fw_crash_counter; ---- a/ath10k-6.2/hw.h -+++ b/ath10k-6.2/hw.h +--- a/ath10k-6.4/hw.h ++++ b/ath10k-6.4/hw.h @@ -523,6 +523,7 @@ struct ath10k_hw_params { const char *name; u32 patch_load_addr; @@ -235,7 +235,7 @@ v13: /* Type of hw cycle counter wraparound logic, for more info --- /dev/null -+++ b/ath10k-6.2/leds.c ++++ b/ath10k-6.4/leds.c @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2005-2011 Atheros Communications Inc. @@ -341,7 +341,7 @@ v13: +} + --- /dev/null -+++ b/ath10k-6.2/leds.h ++++ b/ath10k-6.4/leds.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2018, The Linux Foundation. All rights reserved. @@ -384,8 +384,8 @@ v13: + +#endif +#endif /* _LEDS_H_ */ ---- a/ath10k-6.2/mac.c -+++ b/ath10k-6.2/mac.c +--- a/ath10k-6.4/mac.c ++++ b/ath10k-6.4/mac.c @@ -25,6 +25,7 @@ #include "wmi-tlv.h" #include "wmi-ops.h" @@ -394,8 +394,8 @@ v13: /*********/ /* Rates */ ---- a/ath10k-6.2/wmi-ops.h -+++ b/ath10k-6.2/wmi-ops.h +--- a/ath10k-6.4/wmi-ops.h ++++ b/ath10k-6.4/wmi-ops.h @@ -228,7 +228,10 @@ struct wmi_ops { const struct wmi_bb_timing_cfg_arg *arg); struct sk_buff *(*gen_per_peer_per_tid_cfg)(struct ath10k *ar, @@ -443,8 +443,8 @@ v13: static inline int ath10k_wmi_dbglog_cfg(struct ath10k *ar, u64 module_enable, u32 log_level) { ---- a/ath10k-6.2/wmi-tlv.c -+++ b/ath10k-6.2/wmi-tlv.c +--- a/ath10k-6.4/wmi-tlv.c ++++ b/ath10k-6.4/wmi-tlv.c @@ -4601,6 +4601,8 @@ static const struct wmi_ops wmi_tlv_ops .gen_echo = ath10k_wmi_tlv_op_gen_echo, .gen_vdev_spectral_conf = ath10k_wmi_tlv_op_gen_vdev_spectral_conf, @@ -454,8 +454,8 @@ v13: }; static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map = { ---- a/ath10k-6.2/wmi.c -+++ b/ath10k-6.2/wmi.c +--- a/ath10k-6.4/wmi.c ++++ b/ath10k-6.4/wmi.c @@ -8438,6 +8438,49 @@ ath10k_wmi_op_gen_peer_set_param(struct return skb; } @@ -552,8 +552,8 @@ v13: }; int ath10k_wmi_attach(struct ath10k *ar) ---- a/ath10k-6.2/wmi.h -+++ b/ath10k-6.2/wmi.h +--- a/ath10k-6.4/wmi.h ++++ b/ath10k-6.4/wmi.h @@ -3133,6 +3133,41 @@ enum wmi_10_4_feature_mask { }; diff --git a/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch b/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch index 8ac2776f922..4f9cf83c488 100644 --- a/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch +++ b/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch @@ -9,13 +9,13 @@ traffic. Signed-off-by: Mathias Kresin --- - ath10k-6.2/core.h | 4 ++++ - ath10k-6.2/leds.c | 4 +--- - ath10k-6.2/mac.c | 2 +- + ath10k-6.4/core.h | 4 ++++ + ath10k-6.4/leds.c | 4 +--- + ath10k-6.4/mac.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) ---- a/ath10k-6.2/core.h -+++ b/ath10k-6.2/core.h +--- a/ath10k-6.4/core.h ++++ b/ath10k-6.4/core.h @@ -1701,6 +1701,10 @@ struct ath10k { u8 csi_data[4096]; u16 csi_data_len; @@ -27,8 +27,8 @@ Signed-off-by: Mathias Kresin /* must be last */ u8 drv_priv[] __aligned(sizeof(void *)); }; ---- a/ath10k-6.2/leds.c -+++ b/ath10k-6.2/leds.c +--- a/ath10k-6.4/leds.c ++++ b/ath10k-6.4/leds.c @@ -81,9 +81,7 @@ int ath10k_leds_register(struct ath10k * ar->leds.cdev.name = ar->leds.label; @@ -40,9 +40,9 @@ Signed-off-by: Mathias Kresin ret = led_classdev_register(wiphy_dev(ar->hw->wiphy), &ar->leds.cdev); if (ret) ---- a/ath10k-6.2/mac.c -+++ b/ath10k-6.2/mac.c -@@ -11617,7 +11617,7 @@ int ath10k_mac_register(struct ath10k *a +--- a/ath10k-6.4/mac.c ++++ b/ath10k-6.4/mac.c +@@ -11616,7 +11616,7 @@ int ath10k_mac_register(struct ath10k *a ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; #ifdef CPTCFG_MAC80211_LEDS diff --git a/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch b/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch index 1471902be3b..b0e6ef76fa4 100644 --- a/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch +++ b/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch @@ -1,5 +1,5 @@ ---- a/ath10k-6.2/htt.h -+++ b/ath10k-6.2/htt.h +--- a/ath10k-6.4/htt.h ++++ b/ath10k-6.4/htt.h @@ -237,7 +237,11 @@ enum htt_rx_ring_flags { }; diff --git a/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch b/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch index 145b2e7c358..82109995d99 100644 --- a/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch +++ b/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch @@ -1,5 +1,5 @@ ---- a/ath10k-6.2/pci.c -+++ b/ath10k-6.2/pci.c +--- a/ath10k-6.4/pci.c ++++ b/ath10k-6.4/pci.c @@ -131,7 +131,11 @@ static const struct ce_attr pci_host_ce_ .flags = CE_ATTR_FLAGS, .src_nentries = 0, diff --git a/package/kernel/ath10k-ct/patches/988-ath10k-always-use-mac80211-loss-detection.patch b/package/kernel/ath10k-ct/patches/988-ath10k-always-use-mac80211-loss-detection.patch index 40f262464b1..8aef577debc 100644 --- a/package/kernel/ath10k-ct/patches/988-ath10k-always-use-mac80211-loss-detection.patch +++ b/package/kernel/ath10k-ct/patches/988-ath10k-always-use-mac80211-loss-detection.patch @@ -13,12 +13,12 @@ own loss detection mechanism. Signed-off-by: David Bauer --- - ath10k-6.2/mac.c | 1 - + ath10k-6.4/mac.c | 1 - 1 file changed, 1 deletion(-) ---- a/ath10k-6.2/mac.c -+++ b/ath10k-6.2/mac.c -@@ -11306,7 +11306,6 @@ int ath10k_mac_register(struct ath10k *a +--- a/ath10k-6.4/mac.c ++++ b/ath10k-6.4/mac.c +@@ -11305,7 +11305,6 @@ int ath10k_mac_register(struct ath10k *a ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA); ieee80211_hw_set(ar->hw, QUEUE_CONTROL); ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG); From 7ceb76ca3a37ba6b722df39ba0838909fa7cf7b4 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Thu, 9 Nov 2023 10:53:02 -0800 Subject: [PATCH 04/50] prereq-build: add Python 3.12 support Fixes build on Fedora 39. Signed-off-by: Rosen Penev --- include/prereq-build.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/prereq-build.mk b/include/prereq-build.mk index 49340ce3e44..2378f5ad90c 100644 --- a/include/prereq-build.mk +++ b/include/prereq-build.mk @@ -182,6 +182,7 @@ $(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \ perl --version | grep "perl.*v5")) $(eval $(call SetupHostCommand,python,Please install Python >= 3.7, \ + python3.12 -V 2>&1 | grep 'Python 3', \ python3.11 -V 2>&1 | grep 'Python 3', \ python3.10 -V 2>&1 | grep 'Python 3', \ python3.9 -V 2>&1 | grep 'Python 3', \ @@ -190,6 +191,7 @@ $(eval $(call SetupHostCommand,python,Please install Python >= 3.7, \ python3 -V 2>&1 | grep -E 'Python 3\.([7-9]|[0-9][0-9])\.?')) $(eval $(call SetupHostCommand,python3,Please install Python >= 3.7, \ + python3.12 -V 2>&1 | grep 'Python 3', \ python3.11 -V 2>&1 | grep 'Python 3', \ python3.10 -V 2>&1 | grep 'Python 3', \ python3.9 -V 2>&1 | grep 'Python 3', \ From 3d6b89c5140acb9228ec89bde09b53dafdead070 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 12 Nov 2023 14:10:23 +0100 Subject: [PATCH 05/50] iptables: backport patch fixing bug with string module Backport patch fixing critical bug with string module merged upstream. Fixes: #13812 Signed-off-by: Christian Marangi --- package/network/utils/iptables/Makefile | 2 +- ...-string-Review-parse_string-function.patch | 40 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 package/network/utils/iptables/patches/070-extensions-string-Review-parse_string-function.patch diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile index aded1b7b1fd..45a2b49070e 100644 --- a/package/network/utils/iptables/Makefile +++ b/package/network/utils/iptables/Makefile @@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=iptables PKG_VERSION:=1.8.8 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_URL:=https://netfilter.org/projects/iptables/files PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 diff --git a/package/network/utils/iptables/patches/070-extensions-string-Review-parse_string-function.patch b/package/network/utils/iptables/patches/070-extensions-string-Review-parse_string-function.patch new file mode 100644 index 00000000000..cfcb6c77f38 --- /dev/null +++ b/package/network/utils/iptables/patches/070-extensions-string-Review-parse_string-function.patch @@ -0,0 +1,40 @@ +From da5b32fb4656ab69fe1156eb7e36c7c961839e8a Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Wed, 8 Jun 2022 13:45:13 +0200 +Subject: [PATCH] extensions: string: Review parse_string() function + +* Compare against sizeof(info->pattern) which is more clear than having + to know that this buffer is of size XT_STRING_MAX_PATTERN_SIZE + +* Invert the check and error early to reduce indenting + +* Pass info->patlen to memcpy() to avoid reading past end of 's' + +Signed-off-by: Phil Sutter +--- + extensions/libxt_string.c | 13 ++++++------- + 1 file changed, 6 insertions(+), 7 deletions(-) + +--- a/extensions/libxt_string.c ++++ b/extensions/libxt_string.c +@@ -78,14 +78,13 @@ static void string_init(struct xt_entry_ + + static void + parse_string(const char *s, struct xt_string_info *info) +-{ ++{ + /* xt_string does not need \0 at the end of the pattern */ +- if (strlen(s) <= XT_STRING_MAX_PATTERN_SIZE) { +- memcpy(info->pattern, s, XT_STRING_MAX_PATTERN_SIZE); +- info->patlen = strnlen(s, XT_STRING_MAX_PATTERN_SIZE); +- return; +- } +- xtables_error(PARAMETER_PROBLEM, "STRING too long \"%s\"", s); ++ if (strlen(s) > sizeof(info->pattern)) ++ xtables_error(PARAMETER_PROBLEM, "STRING too long \"%s\"", s); ++ ++ info->patlen = strnlen(s, sizeof(info->pattern)); ++ memcpy(info->pattern, s, info->patlen); + } + + static void From f74f5b29948aa9303bf94045cf938cee49897944 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Fri, 10 Nov 2023 13:42:34 +0100 Subject: [PATCH 06/50] mvebu: fix PXA I2C bus with recovery Since kernel 5.11, the PXA I2C driver has been converted to generic I2C recovery, which makes the I2C bus completely lock up if recovery pinctrl is present in the DT and I2C recovery is enabled. This effectively completely broke I2C on Methode uDPU and eDPU boards as both of them rely on I2C recovery. After a discussion upstream, it was concluded that there is no simple fix and that the blamed upstream commit: 0b01392c18b9993a584f36ace1d61118772ad0ca ("i2c: pxa: move to generic GPIO recovery") should be reverted. I have sent the revert upstream, it should be merged soon so lets "fix" OpenWrt as well. Signed-off-by: Robert Marko --- ...2c-pxa-move-to-generic-GPIO-recovery.patch | 139 ++++++++++++++++++ ...2c-pxa-move-to-generic-GPIO-recovery.patch | 139 ++++++++++++++++++ 2 files changed, 278 insertions(+) create mode 100644 target/linux/mvebu/patches-5.15/106-Revert-i2c-pxa-move-to-generic-GPIO-recovery.patch create mode 100644 target/linux/mvebu/patches-6.1/106-Revert-i2c-pxa-move-to-generic-GPIO-recovery.patch diff --git a/target/linux/mvebu/patches-5.15/106-Revert-i2c-pxa-move-to-generic-GPIO-recovery.patch b/target/linux/mvebu/patches-5.15/106-Revert-i2c-pxa-move-to-generic-GPIO-recovery.patch new file mode 100644 index 00000000000..7a0dc15ff68 --- /dev/null +++ b/target/linux/mvebu/patches-5.15/106-Revert-i2c-pxa-move-to-generic-GPIO-recovery.patch @@ -0,0 +1,139 @@ +From ea8444b6fa5955c16b713dc83310882b93b44e62 Mon Sep 17 00:00:00 2001 +From: Robert Marko +Date: Fri, 10 Nov 2023 10:10:29 +0100 +Subject: [PATCH] Revert "i2c: pxa: move to generic GPIO recovery" + +This reverts commit 0b01392c18b9993a584f36ace1d61118772ad0ca. + +Conversion of PXA to generic I2C recovery, makes the I2C bus completely +lock up if recovery pinctrl is present in the DT and I2C recovery is +enabled. + +So, until the generic I2C recovery can also work with PXA lets revert +to have working I2C and I2C recovery again. + +Signed-off-by: Robert Marko +Cc: stable@vger.kernel.org # 5.11+ +--- + drivers/i2c/busses/i2c-pxa.c | 76 ++++++++++++++++++++++++++++++++---- + 1 file changed, 68 insertions(+), 8 deletions(-) + +--- a/drivers/i2c/busses/i2c-pxa.c ++++ b/drivers/i2c/busses/i2c-pxa.c +@@ -264,6 +264,9 @@ struct pxa_i2c { + u32 hs_mask; + + struct i2c_bus_recovery_info recovery; ++ struct pinctrl *pinctrl; ++ struct pinctrl_state *pinctrl_default; ++ struct pinctrl_state *pinctrl_recovery; + }; + + #define _IBMR(i2c) ((i2c)->reg_ibmr) +@@ -1302,12 +1305,13 @@ static void i2c_pxa_prepare_recovery(str + */ + gpiod_set_value(i2c->recovery.scl_gpiod, ibmr & IBMR_SCLS); + gpiod_set_value(i2c->recovery.sda_gpiod, ibmr & IBMR_SDAS); ++ ++ WARN_ON(pinctrl_select_state(i2c->pinctrl, i2c->pinctrl_recovery)); + } + + static void i2c_pxa_unprepare_recovery(struct i2c_adapter *adap) + { + struct pxa_i2c *i2c = adap->algo_data; +- struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; + u32 isr; + + /* +@@ -1321,7 +1325,7 @@ static void i2c_pxa_unprepare_recovery(s + i2c_pxa_do_reset(i2c); + } + +- WARN_ON(pinctrl_select_state(bri->pinctrl, bri->pins_default)); ++ WARN_ON(pinctrl_select_state(i2c->pinctrl, i2c->pinctrl_default)); + + dev_dbg(&i2c->adap.dev, "recovery: IBMR 0x%08x ISR 0x%08x\n", + readl(_IBMR(i2c)), readl(_ISR(i2c))); +@@ -1343,20 +1347,76 @@ static int i2c_pxa_init_recovery(struct + if (IS_ENABLED(CONFIG_I2C_PXA_SLAVE)) + return 0; + +- bri->pinctrl = devm_pinctrl_get(dev); +- if (PTR_ERR(bri->pinctrl) == -ENODEV) { +- bri->pinctrl = NULL; ++ i2c->pinctrl = devm_pinctrl_get(dev); ++ if (PTR_ERR(i2c->pinctrl) == -ENODEV) ++ i2c->pinctrl = NULL; ++ if (IS_ERR(i2c->pinctrl)) ++ return PTR_ERR(i2c->pinctrl); ++ ++ if (!i2c->pinctrl) ++ return 0; ++ ++ i2c->pinctrl_default = pinctrl_lookup_state(i2c->pinctrl, ++ PINCTRL_STATE_DEFAULT); ++ i2c->pinctrl_recovery = pinctrl_lookup_state(i2c->pinctrl, "recovery"); ++ ++ if (IS_ERR(i2c->pinctrl_default) || IS_ERR(i2c->pinctrl_recovery)) { ++ dev_info(dev, "missing pinmux recovery information: %ld %ld\n", ++ PTR_ERR(i2c->pinctrl_default), ++ PTR_ERR(i2c->pinctrl_recovery)); ++ return 0; ++ } ++ ++ /* ++ * Claiming GPIOs can influence the pinmux state, and may glitch the ++ * I2C bus. Do this carefully. ++ */ ++ bri->scl_gpiod = devm_gpiod_get(dev, "scl", GPIOD_OUT_HIGH_OPEN_DRAIN); ++ if (bri->scl_gpiod == ERR_PTR(-EPROBE_DEFER)) ++ return -EPROBE_DEFER; ++ if (IS_ERR(bri->scl_gpiod)) { ++ dev_info(dev, "missing scl gpio recovery information: %pe\n", ++ bri->scl_gpiod); ++ return 0; ++ } ++ ++ /* ++ * We have SCL. Pull SCL low and wait a bit so that SDA glitches ++ * have no effect. ++ */ ++ gpiod_direction_output(bri->scl_gpiod, 0); ++ udelay(10); ++ bri->sda_gpiod = devm_gpiod_get(dev, "sda", GPIOD_OUT_HIGH_OPEN_DRAIN); ++ ++ /* Wait a bit in case of a SDA glitch, and then release SCL. */ ++ udelay(10); ++ gpiod_direction_output(bri->scl_gpiod, 1); ++ ++ if (bri->sda_gpiod == ERR_PTR(-EPROBE_DEFER)) ++ return -EPROBE_DEFER; ++ ++ if (IS_ERR(bri->sda_gpiod)) { ++ dev_info(dev, "missing sda gpio recovery information: %pe\n", ++ bri->sda_gpiod); + return 0; + } +- if (IS_ERR(bri->pinctrl)) +- return PTR_ERR(bri->pinctrl); + + bri->prepare_recovery = i2c_pxa_prepare_recovery; + bri->unprepare_recovery = i2c_pxa_unprepare_recovery; ++ bri->recover_bus = i2c_generic_scl_recovery; + + i2c->adap.bus_recovery_info = bri; + +- return 0; ++ /* ++ * Claiming GPIOs can change the pinmux state, which confuses the ++ * pinctrl since pinctrl's idea of the current setting is unaffected ++ * by the pinmux change caused by claiming the GPIO. Work around that ++ * by switching pinctrl to the GPIO state here. We do it this way to ++ * avoid glitching the I2C bus. ++ */ ++ pinctrl_select_state(i2c->pinctrl, i2c->pinctrl_recovery); ++ ++ return pinctrl_select_state(i2c->pinctrl, i2c->pinctrl_default); + } + + static int i2c_pxa_probe(struct platform_device *dev) diff --git a/target/linux/mvebu/patches-6.1/106-Revert-i2c-pxa-move-to-generic-GPIO-recovery.patch b/target/linux/mvebu/patches-6.1/106-Revert-i2c-pxa-move-to-generic-GPIO-recovery.patch new file mode 100644 index 00000000000..7a0dc15ff68 --- /dev/null +++ b/target/linux/mvebu/patches-6.1/106-Revert-i2c-pxa-move-to-generic-GPIO-recovery.patch @@ -0,0 +1,139 @@ +From ea8444b6fa5955c16b713dc83310882b93b44e62 Mon Sep 17 00:00:00 2001 +From: Robert Marko +Date: Fri, 10 Nov 2023 10:10:29 +0100 +Subject: [PATCH] Revert "i2c: pxa: move to generic GPIO recovery" + +This reverts commit 0b01392c18b9993a584f36ace1d61118772ad0ca. + +Conversion of PXA to generic I2C recovery, makes the I2C bus completely +lock up if recovery pinctrl is present in the DT and I2C recovery is +enabled. + +So, until the generic I2C recovery can also work with PXA lets revert +to have working I2C and I2C recovery again. + +Signed-off-by: Robert Marko +Cc: stable@vger.kernel.org # 5.11+ +--- + drivers/i2c/busses/i2c-pxa.c | 76 ++++++++++++++++++++++++++++++++---- + 1 file changed, 68 insertions(+), 8 deletions(-) + +--- a/drivers/i2c/busses/i2c-pxa.c ++++ b/drivers/i2c/busses/i2c-pxa.c +@@ -264,6 +264,9 @@ struct pxa_i2c { + u32 hs_mask; + + struct i2c_bus_recovery_info recovery; ++ struct pinctrl *pinctrl; ++ struct pinctrl_state *pinctrl_default; ++ struct pinctrl_state *pinctrl_recovery; + }; + + #define _IBMR(i2c) ((i2c)->reg_ibmr) +@@ -1302,12 +1305,13 @@ static void i2c_pxa_prepare_recovery(str + */ + gpiod_set_value(i2c->recovery.scl_gpiod, ibmr & IBMR_SCLS); + gpiod_set_value(i2c->recovery.sda_gpiod, ibmr & IBMR_SDAS); ++ ++ WARN_ON(pinctrl_select_state(i2c->pinctrl, i2c->pinctrl_recovery)); + } + + static void i2c_pxa_unprepare_recovery(struct i2c_adapter *adap) + { + struct pxa_i2c *i2c = adap->algo_data; +- struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; + u32 isr; + + /* +@@ -1321,7 +1325,7 @@ static void i2c_pxa_unprepare_recovery(s + i2c_pxa_do_reset(i2c); + } + +- WARN_ON(pinctrl_select_state(bri->pinctrl, bri->pins_default)); ++ WARN_ON(pinctrl_select_state(i2c->pinctrl, i2c->pinctrl_default)); + + dev_dbg(&i2c->adap.dev, "recovery: IBMR 0x%08x ISR 0x%08x\n", + readl(_IBMR(i2c)), readl(_ISR(i2c))); +@@ -1343,20 +1347,76 @@ static int i2c_pxa_init_recovery(struct + if (IS_ENABLED(CONFIG_I2C_PXA_SLAVE)) + return 0; + +- bri->pinctrl = devm_pinctrl_get(dev); +- if (PTR_ERR(bri->pinctrl) == -ENODEV) { +- bri->pinctrl = NULL; ++ i2c->pinctrl = devm_pinctrl_get(dev); ++ if (PTR_ERR(i2c->pinctrl) == -ENODEV) ++ i2c->pinctrl = NULL; ++ if (IS_ERR(i2c->pinctrl)) ++ return PTR_ERR(i2c->pinctrl); ++ ++ if (!i2c->pinctrl) ++ return 0; ++ ++ i2c->pinctrl_default = pinctrl_lookup_state(i2c->pinctrl, ++ PINCTRL_STATE_DEFAULT); ++ i2c->pinctrl_recovery = pinctrl_lookup_state(i2c->pinctrl, "recovery"); ++ ++ if (IS_ERR(i2c->pinctrl_default) || IS_ERR(i2c->pinctrl_recovery)) { ++ dev_info(dev, "missing pinmux recovery information: %ld %ld\n", ++ PTR_ERR(i2c->pinctrl_default), ++ PTR_ERR(i2c->pinctrl_recovery)); ++ return 0; ++ } ++ ++ /* ++ * Claiming GPIOs can influence the pinmux state, and may glitch the ++ * I2C bus. Do this carefully. ++ */ ++ bri->scl_gpiod = devm_gpiod_get(dev, "scl", GPIOD_OUT_HIGH_OPEN_DRAIN); ++ if (bri->scl_gpiod == ERR_PTR(-EPROBE_DEFER)) ++ return -EPROBE_DEFER; ++ if (IS_ERR(bri->scl_gpiod)) { ++ dev_info(dev, "missing scl gpio recovery information: %pe\n", ++ bri->scl_gpiod); ++ return 0; ++ } ++ ++ /* ++ * We have SCL. Pull SCL low and wait a bit so that SDA glitches ++ * have no effect. ++ */ ++ gpiod_direction_output(bri->scl_gpiod, 0); ++ udelay(10); ++ bri->sda_gpiod = devm_gpiod_get(dev, "sda", GPIOD_OUT_HIGH_OPEN_DRAIN); ++ ++ /* Wait a bit in case of a SDA glitch, and then release SCL. */ ++ udelay(10); ++ gpiod_direction_output(bri->scl_gpiod, 1); ++ ++ if (bri->sda_gpiod == ERR_PTR(-EPROBE_DEFER)) ++ return -EPROBE_DEFER; ++ ++ if (IS_ERR(bri->sda_gpiod)) { ++ dev_info(dev, "missing sda gpio recovery information: %pe\n", ++ bri->sda_gpiod); + return 0; + } +- if (IS_ERR(bri->pinctrl)) +- return PTR_ERR(bri->pinctrl); + + bri->prepare_recovery = i2c_pxa_prepare_recovery; + bri->unprepare_recovery = i2c_pxa_unprepare_recovery; ++ bri->recover_bus = i2c_generic_scl_recovery; + + i2c->adap.bus_recovery_info = bri; + +- return 0; ++ /* ++ * Claiming GPIOs can change the pinmux state, which confuses the ++ * pinctrl since pinctrl's idea of the current setting is unaffected ++ * by the pinmux change caused by claiming the GPIO. Work around that ++ * by switching pinctrl to the GPIO state here. We do it this way to ++ * avoid glitching the I2C bus. ++ */ ++ pinctrl_select_state(i2c->pinctrl, i2c->pinctrl_recovery); ++ ++ return pinctrl_select_state(i2c->pinctrl, i2c->pinctrl_default); + } + + static int i2c_pxa_probe(struct platform_device *dev) From 4c0dc68f466588bb2ef60b29a4d8052b34112ca6 Mon Sep 17 00:00:00 2001 From: Alan Luck Date: Wed, 8 Nov 2023 09:10:35 +1100 Subject: [PATCH 07/50] ramips: add encrypted SGE factory image for D-Link devices creates SGE encrypted factory images to use via the D-Link web interface rename the old factory unencrypted images to recovery for use in the recovery console when recovery is needed DIR-1935-A1 , DIR-853-A1 , DIR-853-A3 , DIR-867-A1 , DIR-878-A1 and DIR-882-A1 Signed-off-by: Alan Luck --- include/image-commands.mk | 5 +++++ target/linux/ramips/image/mt7621.mk | 13 +++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/include/image-commands.mk b/include/image-commands.mk index 77a35f3eec0..d07c8827619 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -226,6 +226,11 @@ define Build/copy-file cat "$(1)" > "$@" endef +define Build/dlink-sge-image + $(STAGING_DIR_HOST)/bin/dlink-sge-image $(1) $@ $@.enc + mv $@.enc $@ +endef + define Build/edimax-header $(STAGING_DIR_HOST)/bin/mkedimaximg -i $@ -o $@.new $(1) @mv $@.new $@ diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index b9c94342b04..16794c4f50e 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -684,10 +684,9 @@ define Device/dlink_dir-8xx-a1 DEVICE_VENDOR := D-Link DEVICE_PACKAGES := kmod-mt7615-firmware -uboot-envtools KERNEL := $$(KERNEL) | uimage-sgehdr - IMAGES += factory.bin - IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \ - check-size | append-metadata - IMAGE/factory.bin := append-kernel | append-rootfs | check-size + IMAGES += recovery.bin factory.bin + IMAGE/recovery.bin := append-kernel | append-rootfs | check-size + IMAGE/factory.bin := $$(IMAGE/recovery.bin) | dlink-sge-image $$$$(DEVICE_MODEL) endef define Device/dlink_dir-8xx-r1 @@ -707,8 +706,8 @@ define Device/dlink_dir-xx60-a1 DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 \ kmod-usb-ledtrig-usbport -uboot-envtools KERNEL := $$(KERNEL) | uimage-sgehdr - IMAGES += factory.bin - IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ + IMAGES += recovery.bin + IMAGE/recovery.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ check-size endef @@ -760,6 +759,8 @@ define Device/dlink_dir-853-a3 $(Device/dlink_dir-xx60-a1) DEVICE_MODEL := DIR-853 DEVICE_VARIANT := A3 + IMAGES += factory.bin + IMAGE/factory.bin := $$(IMAGE/recovery.bin) | dlink-sge-image $$(DEVICE_MODEL) endef TARGET_DEVICES += dlink_dir-853-a3 From d41b8a570f209c352571f209c2c8f2b52b8d27af Mon Sep 17 00:00:00 2001 From: Szabolcs Hubai Date: Wed, 8 Nov 2023 13:50:55 +0100 Subject: [PATCH 08/50] ramips: mt7621: use lzma-loader for Sercomm NA502 This fixes a well known "LZMA ERROR 1" error on Sercomm NA502, reported on the OpenWrt forum. [1] [1]: https://forum.openwrt.org/t/176942 Signed-off-by: Szabolcs Hubai --- target/linux/ramips/image/mt7621.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 16794c4f50e..3dd6574bf1f 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -2064,6 +2064,7 @@ TARGET_DEVICES += samknows_whitebox-v8 define Device/sercomm_na502 $(Device/nand) + $(Device/uimage-lzma-loader) IMAGE_SIZE := 20480k DEVICE_VENDOR := SERCOMM DEVICE_MODEL := NA502 From 10b130161d19ac839c6fae55bb376ac91d1ea211 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sun, 27 Oct 2019 14:31:30 +0100 Subject: [PATCH 09/50] kernel: kmod-usb-serial-mos7720: support parallel port in MCS7715 In-kernel driver for MCS7715 USB-serial bridge has a bool option, enabling support for parallel port on that chip - which is tied to the same kernel module. Enable it and select kmod-ppdev, as the image size increase is minimal and the package isn't bundled in the images by default. Signed-off-by: Lech Perczak --- package/kernel/linux/modules/usb.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk index 0a5f5a8993c..6218ec994c8 100644 --- a/package/kernel/linux/modules/usb.mk +++ b/package/kernel/linux/modules/usb.mk @@ -750,8 +750,9 @@ $(eval $(call KernelPackage,usb-serial-mct)) define KernelPackage/usb-serial-mos7720 TITLE:=Support for Moschip MOS7720 devices - KCONFIG:=CONFIG_USB_SERIAL_MOS7720 + KCONFIG:=CONFIG_USB_SERIAL_MOS7720 CONFIG_USB_SERIAL_MOS7715_PARPORT=y FILES:=$(LINUX_DIR)/drivers/usb/serial/mos7720.ko + DEPENDS:=+kmod-ppdev AUTOLOAD:=$(call AutoProbe,mos7720) $(call AddDepends/usb-serial) endef From 9e49e0a6c4535d345084cc62c594be5cad23b911 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 12 Nov 2023 16:15:07 +0100 Subject: [PATCH 10/50] scripts/getver.sh: prevent asking for negative rev-parse With the case of asking an invalid version that is too big, getver.sh might return an invalid output in the form of HEAD~-2260475641. This is caused by BASE_REV - GET_REV using a negative number. Prevent this by checking if BASE_REV - GET_REV actually return 0 or a positive number and set REV variable accordingly. With the following change, invalid revision number will result in unknown printed instead of the invalid HEAD~-NUMBERS output. Signed-off-by: Christian Marangi --- scripts/getver.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/getver.sh b/scripts/getver.sh index 49260a22603..61906040b18 100755 --- a/scripts/getver.sh +++ b/scripts/getver.sh @@ -21,7 +21,7 @@ try_git() { r*) GET_REV="$(echo $GET_REV | tr -d 'r')" BASE_REV="$(git rev-list ${REBOOT}..HEAD 2>/dev/null | wc -l | awk '{print $1}')" - REV="$(git rev-parse HEAD~$((BASE_REV - GET_REV)))" + [ $((BASE_REV - GET_REV)) -ge 0 ] && REV="$(git rev-parse HEAD~$((BASE_REV - GET_REV)))" ;; *) BRANCH="$(git rev-parse --abbrev-ref HEAD)" From bd6dc4bffa0e58bdd6205817c704fad1ff88a414 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Tue, 7 Nov 2023 01:02:11 +0100 Subject: [PATCH 11/50] mac80211: ath9k-htc: support "eeprom" in debugfs ath9k-htc USB-based adapterssupport 5/10MHz channel bandwidth, the same as standard ath9k ones. Move the code handling the features in debugfs to common-debug.c, and create proper registration functions to use in debug.c and htc_drv_debug.c, leaving only debugfs registration there. While at that, refresh one patch that would conflict otherwise. Tested on TP-Link Archer C7v2 (ath79) and TP-Link WN722Nv1 (AR9287) and WN822Nv2 (AR7010+AR9287). Signed-off-by: Lech Perczak --- .../ath9k/500-ath9k_eeprom_debugfs.patch | 58 ++++++++++++++----- .../ath9k/512-ath9k_channelbw_debugfs.patch | 14 ++--- 2 files changed, 49 insertions(+), 23 deletions(-) diff --git a/package/kernel/mac80211/patches/ath9k/500-ath9k_eeprom_debugfs.patch b/package/kernel/mac80211/patches/ath9k/500-ath9k_eeprom_debugfs.patch index 2f5e75be8a3..d23d70b2ce7 100644 --- a/package/kernel/mac80211/patches/ath9k/500-ath9k_eeprom_debugfs.patch +++ b/package/kernel/mac80211/patches/ath9k/500-ath9k_eeprom_debugfs.patch @@ -1,14 +1,24 @@ --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -1413,6 +1413,54 @@ void ath9k_deinit_debug(struct ath_softc - ath9k_cmn_spectral_deinit_debug(&sc->spec_priv); - } +@@ -1471,6 +1471,7 @@ int ath9k_init_debug(struct ath_hw *ah) + ath9k_cmn_debug_base_eeprom(sc->debug.debugfs_phy, sc->sc_ah); + ath9k_cmn_debug_modal_eeprom(sc->debug.debugfs_phy, sc->sc_ah); ++ ath9k_cmn_debug_eeprom(sc->debug.debugfs_phy, sc->sc_ah); + + debugfs_create_u32("gpio_mask", 0600, + sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask); +--- a/drivers/net/wireless/ath/ath9k/common-debug.c ++++ b/drivers/net/wireless/ath/ath9k/common-debug.c +@@ -260,3 +260,58 @@ void ath9k_cmn_debug_phy_err(struct dent + &fops_phy_err); + } + EXPORT_SYMBOL(ath9k_cmn_debug_phy_err); ++ +static ssize_t read_file_eeprom(struct file *file, char __user *user_buf, + size_t count, loff_t *ppos) +{ -+ struct ath_softc *sc = file->private_data; -+ struct ath_hw *ah = sc->sc_ah; ++ struct ath_hw *ah = file->private_data; + struct ath_common *common = ath9k_hw_common(ah); + int bytes = 0; + int pos = *ppos; @@ -52,15 +62,31 @@ + .owner = THIS_MODULE +}; + - int ath9k_init_debug(struct ath_hw *ah) - { - struct ath_common *common = ath9k_hw_common(ah); -@@ -1432,6 +1480,8 @@ int ath9k_init_debug(struct ath_hw *ah) - ath9k_tx99_init_debug(sc); - ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy); - -+ debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc, ++void ath9k_cmn_debug_eeprom(struct dentry *debugfs_phy, ++ struct ath_hw *ah) ++{ ++ debugfs_create_file("eeprom", S_IRUSR, debugfs_phy, ah, + &fops_eeprom); - debugfs_create_devm_seqfile(sc->dev, "dma", sc->debug.debugfs_phy, - read_file_dma); - debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy, ++} ++EXPORT_SYMBOL(ath9k_cmn_debug_eeprom); +--- a/drivers/net/wireless/ath/ath9k/common-debug.h ++++ b/drivers/net/wireless/ath/ath9k/common-debug.h +@@ -69,6 +69,8 @@ void ath9k_cmn_debug_modal_eeprom(struct + struct ath_hw *ah); + void ath9k_cmn_debug_base_eeprom(struct dentry *debugfs_phy, + struct ath_hw *ah); ++void ath9k_cmn_debug_eeprom(struct dentry *debugfs_phy, ++ struct ath_hw *ah); + void ath9k_cmn_debug_stat_rx(struct ath_rx_stats *rxstats, + struct ath_rx_status *rs); + void ath9k_cmn_debug_recv(struct dentry *debugfs_phy, +--- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c +@@ -519,6 +519,7 @@ int ath9k_htc_init_debug(struct ath_hw * + + ath9k_cmn_debug_base_eeprom(priv->debug.debugfs_phy, priv->ah); + ath9k_cmn_debug_modal_eeprom(priv->debug.debugfs_phy, priv->ah); ++ ath9k_cmn_debug_eeprom(priv->debug.debugfs_phy, priv->ah); + + return 0; + } diff --git a/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch b/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch index 94a191e0d80..941a330fce4 100644 --- a/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch +++ b/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch @@ -1,8 +1,8 @@ --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -1461,6 +1461,52 @@ static const struct file_operations fops - .owner = THIS_MODULE - }; +@@ -1413,6 +1413,52 @@ void ath9k_deinit_debug(struct ath_softc + ath9k_cmn_spectral_deinit_debug(&sc->spec_priv); + } + +static ssize_t read_file_chan_bw(struct file *file, char __user *user_buf, @@ -53,10 +53,10 @@ int ath9k_init_debug(struct ath_hw *ah) { struct ath_common *common = ath9k_hw_common(ah); -@@ -1482,6 +1528,8 @@ int ath9k_init_debug(struct ath_hw *ah) +@@ -1432,6 +1478,8 @@ int ath9k_init_debug(struct ath_hw *ah) + ath9k_tx99_init_debug(sc); + ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy); - debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc, - &fops_eeprom); + debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, + sc, &fops_chanbw); debugfs_create_devm_seqfile(sc->dev, "dma", sc->debug.debugfs_phy, @@ -64,7 +64,7 @@ debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy, --- a/drivers/net/wireless/ath/ath.h +++ b/drivers/net/wireless/ath/ath.h -@@ -151,6 +151,7 @@ struct ath_common { +@@ -153,6 +153,7 @@ struct ath_common { int debug_mask; enum ath_device_state state; unsigned long op_flags; From a5ba28454b52024ca40ccf9ef3bde390bf9500c7 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Tue, 7 Nov 2023 01:29:57 +0100 Subject: [PATCH 12/50] mac80211: ath9k-htc: support "chanbw" in debugfs ath9k-htc USB-based adapters also support 5/10MHz channel bandwidth. Move the code handling the features in debugfs to common-debug.c, and create proper registration functions to use in debug.c and htc_drv_debug.c, leaving only debugfs registration there. While at that, refresh one patch that would conflict otherwise. Tested on TP-Link Archer C7v2 (ath79) and TP-Link WN722Nv1 (AR9287) and WN822Nv2 (AR7010+AR9287). Signed-off-by: Lech Perczak --- .../ath9k/512-ath9k_channelbw_debugfs.patch | 188 ++++++++++++------ .../patches/ath9k/530-ath9k_extra_leds.patch | 20 +- 2 files changed, 137 insertions(+), 71 deletions(-) diff --git a/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch b/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch index 941a330fce4..54abb4d4254 100644 --- a/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch +++ b/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch @@ -1,67 +1,13 @@ --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -1413,6 +1413,52 @@ void ath9k_deinit_debug(struct ath_softc - ath9k_cmn_spectral_deinit_debug(&sc->spec_priv); - } +@@ -1472,6 +1472,7 @@ int ath9k_init_debug(struct ath_hw *ah) + ath9k_cmn_debug_base_eeprom(sc->debug.debugfs_phy, sc->sc_ah); + ath9k_cmn_debug_modal_eeprom(sc->debug.debugfs_phy, sc->sc_ah); + ath9k_cmn_debug_eeprom(sc->debug.debugfs_phy, sc->sc_ah); ++ ath9k_cmn_debug_chanbw(sc->debug.debugfs_phy, sc->sc_ah); -+ -+static ssize_t read_file_chan_bw(struct file *file, char __user *user_buf, -+ size_t count, loff_t *ppos) -+{ -+ struct ath_softc *sc = file->private_data; -+ struct ath_common *common = ath9k_hw_common(sc->sc_ah); -+ char buf[32]; -+ unsigned int len; -+ -+ len = sprintf(buf, "0x%08x\n", common->chan_bw); -+ return simple_read_from_buffer(user_buf, count, ppos, buf, len); -+} -+ -+static ssize_t write_file_chan_bw(struct file *file, const char __user *user_buf, -+ size_t count, loff_t *ppos) -+{ -+ struct ath_softc *sc = file->private_data; -+ struct ath_common *common = ath9k_hw_common(sc->sc_ah); -+ unsigned long chan_bw; -+ char buf[32]; -+ ssize_t len; -+ -+ len = min(count, sizeof(buf) - 1); -+ if (copy_from_user(buf, user_buf, len)) -+ return -EFAULT; -+ -+ buf[len] = '\0'; -+ if (kstrtoul(buf, 0, &chan_bw)) -+ return -EINVAL; -+ -+ common->chan_bw = chan_bw; -+ if (!test_bit(ATH_OP_INVALID, &common->op_flags)) -+ ath9k_ops.config(sc->hw, IEEE80211_CONF_CHANGE_CHANNEL); -+ -+ return count; -+} -+ -+static const struct file_operations fops_chanbw = { -+ .read = read_file_chan_bw, -+ .write = write_file_chan_bw, -+ .open = simple_open, -+ .owner = THIS_MODULE, -+ .llseek = default_llseek, -+}; -+ -+ - int ath9k_init_debug(struct ath_hw *ah) - { - struct ath_common *common = ath9k_hw_common(ah); -@@ -1432,6 +1478,8 @@ int ath9k_init_debug(struct ath_hw *ah) - ath9k_tx99_init_debug(sc); - ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy); - -+ debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, -+ sc, &fops_chanbw); - debugfs_create_devm_seqfile(sc->dev, "dma", sc->debug.debugfs_phy, - read_file_dma); - debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy, + debugfs_create_u32("gpio_mask", 0600, + sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask); --- a/drivers/net/wireless/ath/ath.h +++ b/drivers/net/wireless/ath/ath.h @@ -153,6 +153,7 @@ struct ath_common { @@ -72,6 +18,14 @@ struct ath_ani ani; +@@ -181,6 +182,7 @@ struct ath_common { + const struct ath_ops *ops; + const struct ath_bus_ops *bus_ops; + const struct ath_ps_ops *ps_ops; ++ const struct ieee80211_ops *ieee_ops; + + bool btcoex_enabled; + bool disable_ani; --- a/drivers/net/wireless/ath/ath9k/common.c +++ b/drivers/net/wireless/ath/ath9k/common.c @@ -297,11 +297,13 @@ EXPORT_SYMBOL(ath9k_cmn_get_hw_crypto_ke @@ -123,3 +77,115 @@ return channel; } +--- a/drivers/net/wireless/ath/ath9k/common-debug.c ++++ b/drivers/net/wireless/ath/ath9k/common-debug.c +@@ -316,3 +316,55 @@ void ath9k_cmn_debug_eeprom(struct dentr + &fops_eeprom); + } + EXPORT_SYMBOL(ath9k_cmn_debug_eeprom); ++ ++static ssize_t read_file_chan_bw(struct file *file, char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ struct ath_hw *ah = file->private_data; ++ struct ath_common *common = ath9k_hw_common(ah); ++ char buf[32]; ++ unsigned int len; ++ ++ len = sprintf(buf, "0x%08x\n", common->chan_bw); ++ return simple_read_from_buffer(user_buf, count, ppos, buf, len); ++} ++ ++static ssize_t write_file_chan_bw(struct file *file, const char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ struct ath_hw *ah = file->private_data; ++ struct ath_common *common = ath9k_hw_common(ah); ++ unsigned long chan_bw; ++ char buf[32]; ++ ssize_t len; ++ ++ len = min(count, sizeof(buf) - 1); ++ if (copy_from_user(buf, user_buf, len)) ++ return -EFAULT; ++ ++ buf[len] = '\0'; ++ if (kstrtoul(buf, 0, &chan_bw)) ++ return -EINVAL; ++ ++ common->chan_bw = chan_bw; ++ if (!test_bit(ATH_OP_INVALID, &common->op_flags)) ++ common->ieee_ops->config(ah->hw, IEEE80211_CONF_CHANGE_CHANNEL); ++ ++ return count; ++} ++ ++static const struct file_operations fops_chanbw = { ++ .read = read_file_chan_bw, ++ .write = write_file_chan_bw, ++ .open = simple_open, ++ .owner = THIS_MODULE, ++ .llseek = default_llseek, ++}; ++ ++void ath9k_cmn_debug_chanbw(struct dentry *debugfs_phy, ++ struct ath_hw *ah) ++{ ++ debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, debugfs_phy, ah, ++ &fops_chanbw); ++} ++EXPORT_SYMBOL(ath9k_cmn_debug_chanbw); +--- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c +@@ -520,6 +520,7 @@ int ath9k_htc_init_debug(struct ath_hw * + ath9k_cmn_debug_base_eeprom(priv->debug.debugfs_phy, priv->ah); + ath9k_cmn_debug_modal_eeprom(priv->debug.debugfs_phy, priv->ah); + ath9k_cmn_debug_eeprom(priv->debug.debugfs_phy, priv->ah); ++ ath9k_cmn_debug_chanbw(priv->debug.debugfs_phy, priv->ah); + + return 0; + } +--- a/drivers/net/wireless/ath/ath9k/common-debug.h ++++ b/drivers/net/wireless/ath/ath9k/common-debug.h +@@ -71,6 +71,8 @@ void ath9k_cmn_debug_base_eeprom(struct + struct ath_hw *ah); + void ath9k_cmn_debug_eeprom(struct dentry *debugfs_phy, + struct ath_hw *ah); ++void ath9k_cmn_debug_chanbw(struct dentry *debugfs_phy, ++ struct ath_hw *ah); + void ath9k_cmn_debug_stat_rx(struct ath_rx_stats *rxstats, + struct ath_rx_status *rs); + void ath9k_cmn_debug_recv(struct dentry *debugfs_phy, +--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c +@@ -631,6 +631,7 @@ static int ath9k_init_priv(struct ath9k_ + priv->ah = ah; + + common = ath9k_hw_common(ah); ++ common->ieee_ops = &ath9k_htc_ops; + common->ops = &ah->reg_ops; + common->ps_ops = &ath9k_htc_ps_ops; + common->bus_ops = &ath9k_usb_bus_ops; +@@ -746,9 +747,9 @@ static void ath9k_set_hw_capab(struct at + + hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN | + WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL | +- WIPHY_FLAG_HAS_CHANNEL_SWITCH; +- +- hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS; ++ WIPHY_FLAG_HAS_CHANNEL_SWITCH | ++ WIPHY_FLAG_SUPPORTS_5_10_MHZ | ++ WIPHY_FLAG_SUPPORTS_TDLS; + + hw->queues = 4; + hw->max_listen_interval = 1; +--- a/drivers/net/wireless/ath/ath9k/init.c ++++ b/drivers/net/wireless/ath/ath9k/init.c +@@ -733,6 +733,7 @@ static int ath9k_init_softc(u16 devid, s + if (!ath9k_is_chanctx_enabled()) + sc->cur_chan->hw_queue_base = 0; + ++ common->ieee_ops = &ath9k_ops; + common->ops = &ah->reg_ops; + common->bus_ops = bus_ops; + common->ps_ops = &ath9k_ps_ops; diff --git a/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch index af656b832ee..9568b091de3 100644 --- a/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch +++ b/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch @@ -181,7 +181,7 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -1088,7 +1088,7 @@ int ath9k_init_device(u16 devid, struct +@@ -1089,7 +1089,7 @@ int ath9k_init_device(u16 devid, struct #ifdef CPTCFG_MAC80211_LEDS /* must be initialized before ieee80211_register_hw */ @@ -192,9 +192,9 @@ #endif --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -1506,6 +1506,61 @@ static const struct file_operations fops - .llseek = default_llseek, - }; +@@ -128,6 +128,61 @@ static const struct file_operations fops + + #define DMA_BUF_LEN 1024 +#ifdef CONFIG_MAC80211_LEDS + @@ -252,12 +252,12 @@ +#endif + - int ath9k_init_debug(struct ath_hw *ah) - { -@@ -1530,6 +1585,10 @@ int ath9k_init_debug(struct ath_hw *ah) - &fops_eeprom); - debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, - sc, &fops_chanbw); + static ssize_t read_file_ani(struct file *file, char __user *user_buf, + size_t count, loff_t *ppos) +@@ -1432,6 +1487,10 @@ int ath9k_init_debug(struct ath_hw *ah) + ath9k_tx99_init_debug(sc); + ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy); + +#ifdef CONFIG_MAC80211_LEDS + debugfs_create_file("gpio_led", S_IWUSR, + sc->debug.debugfs_phy, sc, &fops_gpio_led); From 516a3176a671c4b8f344db39dbc0e003fbb841b8 Mon Sep 17 00:00:00 2001 From: Philip Prindeville Date: Wed, 13 Sep 2023 09:10:32 -0600 Subject: [PATCH 13/50] base-files: Create /root w/ appropriate permissions If /root is created with too permissive permissions, then sshd won't trust the contents of /root/.ssh as being adequately protected. Signed-off-by: Philip Prindeville --- package/base-files/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/base-files/Makefile b/package/base-files/Makefile index bb369a82d9b..67fc5d29c1d 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -199,7 +199,8 @@ define Package/base-files/install $(1)/usr/lib \ $(1)/usr/bin \ $(1)/sys \ - $(1)/www \ + $(1)/www + mkdir -p -m 750 \ $(1)/root $(LN) /proc/mounts $(1)/etc/mtab From e3a6945b58daf0cda1db1b356bed304404cb77f5 Mon Sep 17 00:00:00 2001 From: Roland Reinl Date: Thu, 20 Jul 2023 16:00:50 +0200 Subject: [PATCH 14/50] mediatek: Add support for D-Link EAGLE PRO AI M32 Specification: - MT7622BV SoC with 2.4GHz wifi - MT7975AN + MT7915AN for 5GHz - MT7531BE Switch - 512MB RAM - 128 MB flash - 3 LEDs (red, orange, white) - 2 buttons (WPS and Reset) MAC addresses: - WAN MAC is stored in partition "Odm" at offset 0x83 - LAN (as printed on the device) is WAN MAC + 1 - WLAN MAC (2.4 GHz) is WAN MAC + 2 - WLAN MAC (5GHz) is WAN MAC + 3 Disassembly: Remove 4 screws in the bottom and 2 screws in the top (after removing the blue cover on the top), then the board can be pulled out. The pins for the serial console are already labeled on the board (VCC, TX, RX, GND). Serial settings: 3.3V, 115200,8n1 Flashing via Recovery Web Interface: - Set your IP address to 192.168.0.10, subnetmask 255.255.255.25 - Press the reset button while powering on the deivce - Keep the reset button pressed until the status LED blinks fast - Open a Chromium based and goto http://192.168.0.1 - Download openwrt-mediatek-mt7622-dlink_eagle-pro-ai-m32-a1-squashfs-recovery.bin Flashing via uBoot: - Open the case, connect to the UART console - Set your IP address to 10.10.10.3, subnet mask 255.255.255.0. Connect to one of the LAN interfaces of the router - Run a tftp server which provides openwrt-mediatek-mt7622-dlink_eagle-pro-ai-m32-initramfs-kernel.bin. You can rename the file to iverson_uImage (no extension), then you don't have to enter the whole file name in uboot later. - Power on the device and select "1. System Load Linux to SDRAM via TFTP." in the boot menu - Enter image file, tftp server IP and device IP (if they differ from the default). - TFTP download to RAM will start. After a few seconds OpenWrt initramfs should start - The initramfs is accessible via 192.168.1.1, change your IP address accordingly (or use multiple IP addresses on your interface) - Create a backup of the Kernel1 partition, this file is required if a revert to stock should be done later - Perform a sysupgrade using openwrt-mediatek-mt7622-dlink_eagle-pro-ai-m32-squashfs-sysupgrade.bin - Reboot the device. OpenWrt should start from flash now Revert back to stock using the Recovery Web Interface: - Set your IP address to 192.168.0.10, subnetmask 255.255.255.25 - Press the reset button while powering on the deivce - Keep the reset button pressed until the status LED blinks fast - Open a Chromium based and goto http://192.168.0.1 - Flash a decrypted firmware image from D-Link. Decrypting an firmware image is described below. Decrypting a D-Link firmware image: - Download https://github.com/RolandoMagico/firmware-utils/blob/M32/src/m32-firmware-util.c - Compile a binary from the downloaded file, e.g. gcc m32-firmware-util.c -lcrypto -o m32-firmware-util - Run ./m32-firmware-util M32 --DecryptFactoryImage - Example for firmware 1.03.01_HOTFIX: ./m32-firmware-util M32 --DecryptFactoryImage M32-REVA_1.03.01_HOTFIX.enc.bin M32-REVA_1.03.01_HOTFIX.decrypted.bin Revert back to stock using uBoot: - Open the case, connect to the UART console - Set your IP address to 10.10.10.3, subnet mask 255.255.255.0. Connect to one of the LAN interfaces of the router - Run a tftp server which provides the previously created backup of the Kernel1 partition. You can rename the file to iverson_uImage (no extension), then you don't have to enter the whole file name in uboot later. - Power on the device and select "2. System Load Linux Kernel then write to Flash via TFTP." in the boot menu - Enter image file, tftp server IP and device IP (if they differ from the default). - TFTP download to FLASH will start. After a few seconds the stock firmware should start again There is also an image openwrt-mediatek-mt7622-dlink_eagle-pro-ai-m32-a1-squashfs-tftp.bin which can directly be flashed via U-Boot and TFTP. It can be used if no backup of the Kernel1 partition is reuqired. Flahsing via OEM web interface is currently not possible, the OEM images are encrypted and require a specific memory layout which is not compatible to the partition layout of OpenWrt. Signed-off-by: Roland Reinl --- .../dts/mt7622-dlink-eagle-pro-ai-m32-a1.dts | 399 ++++++++++++++++++ target/linux/mediatek/image/mt7622.mk | 38 ++ .../mt7622/base-files/etc/board.d/02_network | 7 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 4 + .../mt7622/base-files/lib/upgrade/platform.sh | 2 + 5 files changed, 450 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7622-dlink-eagle-pro-ai-m32-a1.dts diff --git a/target/linux/mediatek/dts/mt7622-dlink-eagle-pro-ai-m32-a1.dts b/target/linux/mediatek/dts/mt7622-dlink-eagle-pro-ai-m32-a1.dts new file mode 100644 index 00000000000..ca680e4c29f --- /dev/null +++ b/target/linux/mediatek/dts/mt7622-dlink-eagle-pro-ai-m32-a1.dts @@ -0,0 +1,399 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include "mt7622.dtsi" +#include "mt6380.dtsi" +#include +#include + +/ { + model = "D-Link EAGLE PRO AI M32 A1"; + compatible = "dlink,eagle-pro-ai-m32-a1", "mediatek,mt7622"; + + aliases { + led-boot = &status_orange; + led-failsafe = &status_red; + led-running = &status_white; + led-upgrade = &status_red; + serial0 = &uart0; + label-mac-device = &gmac0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs = "earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n8 swiotlb=512"; + }; + + cpus { + cpu@0 { + proc-supply = <&mt6380_vcpu_reg>; + sram-supply = <&mt6380_vm_reg>; + }; + + cpu@1 { + proc-supply = <&mt6380_vcpu_reg>; + sram-supply = <&mt6380_vm_reg>; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + label = "reset"; + linux,code = ; + }; + + wps { + gpios = <&pio 102 GPIO_ACTIVE_LOW>; + label = "wps"; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + status_white: status_white { + label = "white:status"; + gpios = <&pio 85 GPIO_ACTIVE_LOW>; + }; + + status_orange: status_orange { + label = "orange:status"; + gpios = <&pio 20 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + status_red: status_red { + label = "red:status"; + gpios = <&pio 17 GPIO_ACTIVE_LOW>; + }; + }; + + memory { + reg = <0 0x40000000 0 0x40000000>; + }; +}; + +&bch { + status = "okay"; +}; + +&btif { + status = "okay"; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <ð_pins>; + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + nvmem-cells = <&macaddr_odm_83>; + nvmem-cell-names = "mac-address"; + phy-mode = "2500base-x"; + reg = <0>; + + fixed-link { + full-duplex; + pause; + speed = <2500>; + }; + }; + + mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + switch@0 { + compatible = "mediatek,mt7531"; + reg = <0>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <53 IRQ_TYPE_LEVEL_HIGH>; + reset-gpios = <&pio 54 0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@2 { + reg = <2>; + label = "lan2"; + }; + + port@3 { + reg = <3>; + label = "lan1"; + }; + + wan: port@4 { + reg = <4>; + label = "wan"; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; + }; + }; +}; + +&pcie0 { + pinctrl-names = "default"; + pinctrl-0 = <&pcie0_pins>; + status = "okay"; +}; + +&pcie1 { + pinctrl-names = "default"; + pinctrl-0 = <&pcie1_pins>; + status = "okay"; +}; + +&pio { + epa_elna_pins: epa-elna-pins { + mux { + function = "antsel"; + groups = "antsel0", "antsel1", "antsel2", "antsel3", + "antsel4", "antsel5", "antsel6", "antsel7", + "antsel8", "antsel9", "antsel12", "antsel13", + "antsel14", "antsel15", "antsel16", "antsel17"; + }; + }; + + eth_pins: eth-pins { + mux { + function = "eth"; + groups = "mdc_mdio", "rgmii_via_gmac2"; + }; + }; + + pcie0_pins: pcie0-pins { + mux { + function = "pcie"; + groups = "pcie0_pad_perst", + "pcie0_1_waken", + "pcie0_1_clkreq"; + }; + }; + + pcie1_pins: pcie1-pins { + mux { + function = "pcie"; + groups = "pcie1_pad_perst", + "pcie1_0_waken", + "pcie1_0_clkreq"; + }; + }; + + pmic_bus_pins: pmic-bus-pins { + mux { + function = "pmic"; + groups = "pmic_bus"; + }; + }; + + /* Serial NAND is shared pin with SPI-NOR */ + serial_nand_pins: serial-nand-pins { + mux { + function = "flash"; + groups = "snfi"; + }; + }; + + uart0_pins: uart0-pins { + mux { + function = "uart"; + groups = "uart0_0_tx_rx"; + }; + }; + + watchdog_pins: watchdog-pins { + mux { + function = "watchdog"; + groups = "watchdog"; + }; + }; +}; + +&pwrap { + pinctrl-names = "default"; + pinctrl-0 = <&pmic_bus_pins>; + status = "okay"; +}; + +&rtc { + status = "disabled"; +}; + +&sata { + status = "disabled"; +}; + +&sata_phy { + status = "disabled"; +}; + +&slot0 { + wmac1: mt7915@0,0 { + reg = <0x0000 0 0 0 0>; + ieee80211-freq-limit = <5000000 6000000>; + mediatek,mtd-eeprom = <&factory 0x05000>; + }; +}; + +&snfi { + pinctrl-names = "default"; + pinctrl-0 = <&serial_nand_pins>; + status = "okay"; + + snand: flash@0 { + compatible = "spi-nand"; + mediatek,bmt-table-size = <0x1000>; + mediatek,bmt-v2; + nand-ecc-engine = <&snfi>; + reg = <0>; + spi-rx-bus-width = <4>; + spi-tx-bus-width = <4>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Preloader"; + reg = <0x00000000 0x00080000>; + read-only; + }; + + partition@80000 { + label = "ATF"; + reg = <0x00080000 0x00040000>; + read-only; + }; + + partition@C0000 { + label = "Bootloader"; + reg = <0x000C0000 0x00080000>; + read-only; + }; + + partition@140000 { + label = "BootConfig"; + reg = <0x00140000 0x00040000>; + read-only; + }; + + odm: partition@180000 { + compatible = "nvmem-cells"; + label = "Odm"; + reg = <0x00180000 0x00040000>; + read-only; + + macaddr_odm_83: macaddr@83 { + reg = <0x83 0x6>; + }; + }; + + config1: partition@1C0000 { + compatible = "nvmem-cells"; + label = "Config1"; + reg = <0x001C0000 0x00080000>; + #address-cells = <1>; + #size-cells = <1>; + read-only; + }; + + partition@240000 { + label = "Config2"; + reg = <0x00240000 0x00080000>; + read-only; + }; + + partition@2C0000 { + label = "Kernel1"; + reg = <0x002C0000 0x02D00000>; + + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + partition@0 { + label = "kernel"; + reg = <0x00000000 0x00800000>; + }; + + partition@800000 { + label = "ubi"; + reg = <0x00800000 0x02500000>; + }; + }; + + partition@2FC0000 { + label = "Kernel2"; + reg = <0x02FC0000 0x02D00000>; + read-only; + }; + + factory: partition@5CC0000 { + label = "Factory"; + reg = <0x05CC0000 0x00100000>; + read-only; + }; + + partition@5DC0000 { + label = "Mydlink"; + reg = <0x05DC0000 0x00200000>; + read-only; + }; + + partition@5FC0000 { + label = "Storage"; + reg = <0x05FC0000 0x00300000>; + read-only; + }; + }; + }; +}; + +&ssusb { + status = "disabled"; +}; + +&u3phy { + status = "disabled"; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pins>; + status = "okay"; +}; + +&watchdog { + pinctrl-names = "default"; + pinctrl-0 = <&watchdog_pins>; + status = "okay"; +}; + +&wmac { + pinctrl-names = "default"; + pinctrl-0 = <&epa_elna_pins>; + mediatek,mtd-eeprom = <&factory 0x0000>; + status = "okay"; +}; + diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk index 65db1ebe2e3..85776ef6d95 100644 --- a/target/linux/mediatek/image/mt7622.mk +++ b/target/linux/mediatek/image/mt7622.mk @@ -37,6 +37,25 @@ define Build/bl31-uboot cat $(STAGING_DIR_IMAGE)/mt7622_$1-u-boot.fip >> $@ endef +# Append header to a D-Link M32 Kernel 1 partition +define Build/m32-recovery-header-kernel1 + echo -en "DLK6E6010001\x00\x00\xCF\x33" > "$@.header" + echo -en "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x8D\x57\x30\x0B" >> "$@.header" +# Byte 0-3: Erase Start 0x002C0000 +# Byte 4-7: Erase Length 0x02D00000 +# Byte 8-11: Data offset: 0x002C0000 +# Byte 12-15: Data Length: 0x02D00000 + echo -en "\x00\x00\x2C\x00\x00\x00\xD0\x02\x00\x00\x2C\x00\x00\x00\xD0\x02" >> "$@.header" +# Only zeros + echo -en "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" >> "$@.header" +# Note: The last 2 bytes of the following line are the checksum of the header +# If any data in the header will be changed, the checksum must be re-calculated + echo -en "\x42\x48\x02\x00\x00\x00\x08\x00\x00\x00\x00\x00\x60\x6E\x68\x61" >> "$@.header" + cat "$@.header" "$@" > "$@.new" + mv "$@.new" "$@" + rm "$@.header" +endef + define Build/mt7622-gpt cp $@ $@.tmp 2>/dev/null || true ptgen -g -o $@.tmp -a 1 -l 1024 \ @@ -147,6 +166,25 @@ define Device/buffalo_wsr-3200ax4s endef TARGET_DEVICES += buffalo_wsr-3200ax4s +define Device/dlink_eagle-pro-ai-m32-a1 + IMAGE_SIZE := 46080k + DEVICE_VENDOR := D-Link + DEVICE_MODEL := EAGLE PRO AI M32 + DEVICE_VARIANT := A1 + DEVICE_DTS := mt7622-dlink-eagle-pro-ai-m32-a1 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915-firmware + KERNEL_SIZE := 8192k + BLOCKSIZE := 128k + PAGESIZE := 2048 + UBINIZE_OPTS := -E 5 + IMAGES += tftp.bin recovery.bin + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + IMAGE/tftp.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | check-size + IMAGE/recovery.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | pad-to $$(IMAGE_SIZE) | m32-recovery-header-kernel1 +endef +TARGET_DEVICES += dlink_eagle-pro-ai-m32-a1 + define Device/elecom_wrc-2533gent DEVICE_VENDOR := Elecom DEVICE_MODEL := WRC-2533GENT diff --git a/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network index d1341099bc8..75c5e37be14 100644 --- a/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network @@ -24,6 +24,9 @@ mediatek_setup_interfaces() ucidef_add_switch "switch0" \ "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0" ;; + dlink,eagle-pro-ai-m32-a1) + ucidef_set_interfaces_lan_wan "lan1 lan2" wan + ;; ubnt,unifi-6-lr*) ucidef_set_interface_lan "eth0" ;; @@ -61,6 +64,10 @@ mediatek_setup_macs() wan_mac=$lan_mac label_mac=$lan_mac ;; + dlink,eagle-pro-ai-m32-a1) + wan_mac=$(get_mac_label) + lan_mac=$(macaddr_add $(get_mac_label) 1) + ;; reyee,ax3200-e5|\ ruijie,rg-ew3200gx-pro) lan_mac=$(macaddr_add $(get_mac_label) 1) diff --git a/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index 7ee9f24071c..e9cc5922375 100644 --- a/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -18,6 +18,10 @@ case "$board" in [ "$PHYNBR" = "0" ] && macaddr_add $basemac 1 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $basemac 8 > /sys${DEVPATH}/macaddress ;; + dlink,eagle-pro-ai-m32-a1) + [ "$PHYNBR" = "0" ] && macaddr_add $(cat /sys/class/net/eth0/address) 2 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $(cat /sys/class/net/eth0/address) 3 > /sys${DEVPATH}/macaddress + ;; reyee,ax3200-e5|\ ruijie,rg-ew3200gx-pro) [ "$PHYNBR" = "0" ] && macaddr_add $(get_mac_label) 3 > /sys${DEVPATH}/macaddress diff --git a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh index ea3176d2d1e..e256d2b5332 100755 --- a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh @@ -34,6 +34,7 @@ platform_do_upgrade() { nand_do_upgrade "$1" fi ;; + dlink,eagle-pro-ai-m32-a1|\ elecom,wrc-x3200gst3|\ mediatek,mt7622-rfb1-ubi|\ netgear,wax206|\ @@ -72,6 +73,7 @@ platform_check_image() { buffalo,wsr-3200ax4s) buffalo_check_image "$board" "$magic" "$1" || return 1 ;; + dlink,eagle-pro-ai-m32-a1|\ elecom,wrc-x3200gst3|\ mediatek,mt7622-rfb1-ubi|\ netgear,wax206|\ From 44cd32d764fe1daed3b6d0595530df0c4d1c3464 Mon Sep 17 00:00:00 2001 From: Roland Reinl Date: Sun, 1 Oct 2023 11:25:40 +0200 Subject: [PATCH 15/50] mediatek: Add support for TP-Link EAP225v5 Device specification: - MT7629 with 16MB NOR flash W25Q128 and 128 MB DDR3 RAM. - MT7761N and MT7762N wireless chips (currenlty no driver in OpenWrt available) - WiFi is NOT working on this device - Dual core but second CPU doesn't seem to work (Error message during boot: "CPU1: failed to come online") There are two similar merge requests for similar devices with the same issues: - https://github.com/openwrt/openwrt/pull/12286 - https://github.com/openwrt/openwrt/pull/5084 UART interface is next to the reset button, pinout: - 1: TX (the pin with the arrow marker) - 2: RX - 3: GND - 4: VCC UART settings: 115200,8n1, 3.3V U-Boot menu can be entered by pressing Ctrl+B during startup. Booting initramfs: - Set your computers IP adress to 192.168.1.110 - Run a TFTP server providing the initramfs image - Power on the AP, press Ctrl+B to get to the U-Boot menu - Select "1. System Load Linux to SDRAM via TFTP" - Update kernel file name, input server IP and input device IP (if they deviate from the defaults) - After booting, create a backup of all partitions, especially for kernel and root_fs. They are required for reverting back to stock firmware - The sysupgrade image can be flashed now MAC adresses: - LAN and 2.4GHz use the same MAC (the one printed on the device) - 5GHz WiFi MAC is LAN MAC + 1 GPIOs: - GPIO 21 is the reset pin (low active) - GPIO 55 is for the green LED (active high) - GPIO 56 is for the yellow/amber LED (active high) Signed-off-by: Roland Reinl --- .../mediatek/dts/mt7629-tplink_eap225-v5.dts | 188 ++++++++++++++++++ target/linux/mediatek/image/mt7629.mk | 9 + .../mt7629/base-files/etc/board.d/02_network | 3 +- 3 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 target/linux/mediatek/dts/mt7629-tplink_eap225-v5.dts diff --git a/target/linux/mediatek/dts/mt7629-tplink_eap225-v5.dts b/target/linux/mediatek/dts/mt7629-tplink_eap225-v5.dts new file mode 100644 index 00000000000..52e22541faf --- /dev/null +++ b/target/linux/mediatek/dts/mt7629-tplink_eap225-v5.dts @@ -0,0 +1,188 @@ +// SPDX-License-Identifier: GPL-2.0 + +/dts-v1/; +#include +#include "mt7629.dtsi" + +/ { + model = "TP-Link EAP225 v5"; + compatible = "tplink,eap225-v5", "mediatek,mt7629"; + + aliases { + led-boot = &led_status_green; + led-failsafe = &led_status_amber; + led-running = &led_status_green; + led-upgrade = &led_status_amber; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs-override = "console=ttyS0,115200n8"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&pio 21 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_green: status_green { + label = "green:status"; + gpios = <&pio 55 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + led_status_amber: status_amber { + label = "amber:status"; + gpios = <&pio 56 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <ð_pins>; + pinctrl-1 = <&ephy_leds_pins>; + status = "okay"; + + mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "gmii"; + phy-handle = <&phy0>; + nvmem-cells = <&macaddr_factory_8>; + nvmem-cell-names = "mac-address"; + }; + + mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + phy0: ethernet-phy@0 { + reg = <0>; + }; + }; +}; + +&qspi { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&qspi_pins>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Bootloader"; + reg = <0x0 0x00080000>; + read-only; + }; + + partition@80000 { + label = "Partition"; + reg = <0x00080000 0x00010000>; + read-only; + }; + + partition@90000 { + label = "Factory"; + reg = <0x00090000 0x00010000>; + compatible = "nvmem-cells"; + read-only; + + macaddr_factory_8: macaddr@8 { + reg = <0x8 0x6>; + }; + }; + + partition@A0000 { + label = "Radio"; + reg = <0x000A0000 0x00010000>; + read-only; + }; + + partition@B0000 { + label = "Extra"; + reg = <0x000B0000 0x00010000>; + read-only; + }; + + /* Vendor layout: kernel (0x000C0000 0x001A0000) - rootfs (0x00260000 0x00BE0000) */ + /* OpenWrt flash layout: combine kernel and rootfs from OEM layout */ + partition@C0000 { + label = "firmware"; + reg = <0x000C0000 0x00D80000>; + }; + + partition@E40000 { + label = "Config"; + reg = <0x00E40000 0x0001B0000>; + read-only; + }; + }; + }; +}; + +&pio { + eth_pins: eth-pins { + mux { + function = "eth"; + groups = "mdc_mdio"; + }; + }; + + ephy_leds_pins: ephy-leds-pins { + mux { + function = "led"; + groups = "ephy_leds"; + }; + }; + + qspi_pins: qspi-pins { + mux { + function = "flash"; + groups = "spi_nor"; + }; + }; + + uart0_pins: uart0-pins { + mux { + function = "uart"; + groups = "uart0_txd_rxd" ; + }; + }; + + watchdog_pins: watchdog-pins { + mux { + function = "watchdog"; + groups = "watchdog"; + }; + }; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pins>; + status = "okay"; +}; + +&watchdog { + pinctrl-names = "default"; + pinctrl-0 = <&watchdog_pins>; + status = "okay"; +}; diff --git a/target/linux/mediatek/image/mt7629.mk b/target/linux/mediatek/image/mt7629.mk index 33c557190f6..9374228808c 100644 --- a/target/linux/mediatek/image/mt7629.mk +++ b/target/linux/mediatek/image/mt7629.mk @@ -48,3 +48,12 @@ define Device/netgear_ex6250-v2 pad-rootfs | check-size | netgear-encrypted-factory endef TARGET_DEVICES += netgear_ex6250-v2 + +define Device/tplink_eap225-v5 + DEVICE_VENDOR := TP-Link + DEVICE_MODEL := EAP225 + DEVICE_VARIANT := v5 + DEVICE_DTS := mt7629-tplink_eap225-v5 + DEVICE_DTS_DIR := ../dts +endef +TARGET_DEVICES += tplink_eap225-v5 diff --git a/target/linux/mediatek/mt7629/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7629/base-files/etc/board.d/02_network index db931c8334e..df042f8ad27 100644 --- a/target/linux/mediatek/mt7629/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/mt7629/base-files/etc/board.d/02_network @@ -16,7 +16,8 @@ mediatek_setup_interfaces() ucidef_add_switch "switch0" \ "0:lan" "1:lan" "2:lan" "3:lan" "6@eth0" ;; - netgear,ex6250-v2) + netgear,ex6250-v2|\ + tplink,eap225-v5) ucidef_set_interface_lan "eth0" ;; esac From 3538a19c6e3169fa20512a7dd07e7174922e367e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20Lothor=C3=A9?= Date: Fri, 3 Nov 2023 21:48:41 -0700 Subject: [PATCH 16/50] mac80211: split rtw88 configuration for each supported chip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Current rtw88 build configuration builds modules for all chips supported by rtw88 driver family. This brings the following issues: - adding a chip with a different bus is not convenient (all chips currently depends on PCI) - some features requirements are not relevant for all chips in family (eg 802.11AC is enforced but RTW88-8723DE is only a 802.11b/g/n chip) Remove those constraints/issues by adding one module build option per supported chip, and add intermediate options to properly cascade dependencies. Signed-off-by: Alexis Lothoré --- package/kernel/mac80211/realtek.mk | 90 +++++++++++++++++++++++++----- 1 file changed, 75 insertions(+), 15 deletions(-) diff --git a/package/kernel/mac80211/realtek.mk b/package/kernel/mac80211/realtek.mk index 9c143583265..06cb4de03c3 100644 --- a/package/kernel/mac80211/realtek.mk +++ b/package/kernel/mac80211/realtek.mk @@ -1,7 +1,8 @@ PKG_DRIVERS += \ rtlwifi rtlwifi-pci rtlwifi-btcoexist rtlwifi-usb rtl8192c-common \ rtl8192ce rtl8192se rtl8192de rtl8192cu rtl8723bs rtl8821ae \ - rtl8xxxu rtw88 + rtl8xxxu rtw88 rtw88-pci rtw88-8822b rtw88-8822c rtw88-8723d \ + rtw88-8822be rtw88-8822ce rtw88-8723de config-$(call config_package,rtlwifi) += RTL_CARDS RTLWIFI config-$(call config_package,rtlwifi-pci) += RTLWIFI_PCI @@ -21,8 +22,14 @@ config-y += RTL8XXXU_UNTESTED config-$(call config_package,rtl8723bs) += RTL8723BS config-y += STAGING -config-$(call config_package,rtw88) += RTW88 RTW88_CORE RTW88_PCI -config-y += RTW88_8822BE RTW88_8822CE RTW88_8723DE +config-$(call config_package,rtw88) += RTW88 RTW88_CORE +config-$(call config_package,rtw88-pci) += RTW88_PCI +config-$(call config_package,rtw88-8822b) += RTW88_8822B +config-$(call config_package,rtw88-8822be) += RTW88_8822BE +config-$(call config_package,rtw88-8822c) += RTW88_8822C +config-$(call config_package,rtw88-8822ce) += RTW88_8822CE +config-$(call config_package,rtw88-8723d) += RTW88_8723D +config-$(call config_package,rtw88-8723de) += RTW88_8723DE config-$(CONFIG_PACKAGE_RTW88_DEBUG) += RTW88_DEBUG config-$(CONFIG_PACKAGE_RTW88_DEBUGFS) += RTW88_DEBUGFS @@ -168,18 +175,71 @@ endef define KernelPackage/rtw88 $(call KernelPackage/mac80211/Default) - TITLE:=Realtek RTL8822BE/RTL8822CE/RTL8723DE - DEPENDS+= @(PCI_SUPPORT) +kmod-mac80211 +@DRIVER_11AC_SUPPORT - FILES:=\ - $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822be.ko \ - $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822b.ko \ - $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822ce.ko \ - $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822c.ko \ - $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8723de.ko \ - $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8723d.ko \ - $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_core.ko \ - $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_pci.ko - AUTOLOAD:=$(call AutoProbe,rtw88_8822be rtw88_8822ce rtw88_8723de) + TITLE:=Realtek RTW88 common part + DEPENDS+= @PCI_SUPPORT +kmod-mac80211 + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_core.ko + AUTOLOAD:=$(call AutoProbe,rtw88_core) + HIDDEN:=1 +endef + +define KernelPackage/rtw88-pci + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTW88 PCI chips support + DEPENDS+= @PCI_SUPPORT +kmod-rtw88 + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_pci.ko + AUTOLOAD:=$(call AutoProbe,rtw88_pci) + HIDDEN:=1 +endef + +define KernelPackage/rtw88-8822b + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8822B family support + DEPENDS+= +kmod-rtw88 +@DRIVER_11AC_SUPPORT + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822b.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8822b) + HIDDEN:=1 +endef + +define KernelPackage/rtw88-8822c + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8822C family support + DEPENDS+= +kmod-rtw88 +@DRIVER_11AC_SUPPORT + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822c.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8822c) + HIDDEN:=1 +endef + +define KernelPackage/rtw88-8723d + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8723D family support + DEPENDS+= +kmod-rtw88 + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8723d.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8723d) + HIDDEN:=1 +endef + +define KernelPackage/rtw88-8822be + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8822BE support + DEPENDS+= +kmod-rtw88-pci +kmod-rtw88-8822b + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822be.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8822be) +endef + +define KernelPackage/rtw88-8822ce + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8822CE support + DEPENDS+= +kmod-rtw88-pci +kmod-rtw88-8822c + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822ce.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8822ce) +endef + +define KernelPackage/rtw88-8723de + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8723DE support + DEPENDS+= +kmod-rtw88-pci +kmod-rtw88-8723d + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8723de.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8723) endef define KernelPackage/rtl8723bs From 12ef0be4fe76324de1ca3ee103c7027dae9c7985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20Lothor=C3=A9?= Date: Fri, 3 Nov 2023 21:48:42 -0700 Subject: [PATCH 17/50] mac80211: add support for rtw88_8822bu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Kernel 6.1 has introduced support for RTW8822BU network adapter, which is an USB variant of the rtw8822b 802.11ac chipset family. Build and install the corresponding module in the rtw88 package Signed-off-by: Alexis Lothoré --- package/kernel/mac80211/realtek.mk | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/package/kernel/mac80211/realtek.mk b/package/kernel/mac80211/realtek.mk index 06cb4de03c3..48109b94b2a 100644 --- a/package/kernel/mac80211/realtek.mk +++ b/package/kernel/mac80211/realtek.mk @@ -1,8 +1,8 @@ PKG_DRIVERS += \ rtlwifi rtlwifi-pci rtlwifi-btcoexist rtlwifi-usb rtl8192c-common \ rtl8192ce rtl8192se rtl8192de rtl8192cu rtl8723bs rtl8821ae \ - rtl8xxxu rtw88 rtw88-pci rtw88-8822b rtw88-8822c rtw88-8723d \ - rtw88-8822be rtw88-8822ce rtw88-8723de + rtl8xxxu rtw88 rtw88-pci rtw88-usb rtw88-8822b rtw88-8822c rtw88-8723d \ + rtw88-8822be rtw88-8822bu rtw88-8822ce rtw88-8723de config-$(call config_package,rtlwifi) += RTL_CARDS RTLWIFI config-$(call config_package,rtlwifi-pci) += RTLWIFI_PCI @@ -24,8 +24,10 @@ config-y += STAGING config-$(call config_package,rtw88) += RTW88 RTW88_CORE config-$(call config_package,rtw88-pci) += RTW88_PCI +config-$(call config_package,rtw88-usb) += RTW88_USB config-$(call config_package,rtw88-8822b) += RTW88_8822B config-$(call config_package,rtw88-8822be) += RTW88_8822BE +config-$(call config_package,rtw88-8822bu) += RTW88_8822BU config-$(call config_package,rtw88-8822c) += RTW88_8822C config-$(call config_package,rtw88-8822ce) += RTW88_8822CE config-$(call config_package,rtw88-8723d) += RTW88_8723D @@ -176,7 +178,7 @@ endef define KernelPackage/rtw88 $(call KernelPackage/mac80211/Default) TITLE:=Realtek RTW88 common part - DEPENDS+= @PCI_SUPPORT +kmod-mac80211 + DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT) +kmod-mac80211 FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_core.ko AUTOLOAD:=$(call AutoProbe,rtw88_core) HIDDEN:=1 @@ -191,6 +193,15 @@ define KernelPackage/rtw88-pci HIDDEN:=1 endef +define KernelPackage/rtw88-usb + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTW88 USB chips support + DEPENDS+= @USB_SUPPORT +kmod-rtw88 + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_usb.ko + AUTOLOAD:=$(call AutoProbe,rtw88_usb) + HIDDEN:=1 +endef + define KernelPackage/rtw88-8822b $(call KernelPackage/mac80211/Default) TITLE:=Realtek RTL8822B family support @@ -226,6 +237,14 @@ define KernelPackage/rtw88-8822be AUTOLOAD:=$(call AutoProbe,rtw88_8822be) endef +define KernelPackage/rtw88-8822bu + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8822BU support + DEPENDS+= +kmod-rtw88-usb +rtl8822be-firmware +kmod-rtw88-8822b + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822bu.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8822bu) +endef + define KernelPackage/rtw88-8822ce $(call KernelPackage/mac80211/Default) TITLE:=Realtek RTL8822CE support From 6bcd1c2501b521fa6da7e4f7c55c3fe4b373a16d Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 25 Oct 2023 20:09:23 +0800 Subject: [PATCH 18/50] mac80211: sync some rt2x00 patches with wireless-next Some local patches have been sent to upstream and they are slightly different from the upstream version. So it's better to replace them to avoid conflicts with the new mac80211 backport driver. The different parts have been merged into patch 996. This commit also includes some additional fixes: * Fix watchdog function. * Improve MT7620 register initialization. * Introduce DMA busy watchdog for rt2800. P.S. Sometimes rt2800 series chips may fall into a DMA busy state. The tx queues become very slow and the client cannot connect to the AP. Usually, We can see a lot of hostapd warnings at this point: 'hostapd: IEEE 802.11: did not acknowledge authentication response' The DMA busy watchdog can help the driver automatically recover from this abnormal state. By the way, setting higer 'cell_density' and disabling 'disassoc_low_ack' can significantly reduce the probability of the DMA busy. Signed-off-by: Shiji Yang --- .../patches/ath/400-ath_move_debug_code.patch | 2 +- ...rect-MAC_SYS_CTRL-register-RX-mask-i.patch | 28 ++ ...mit-MT7620-TX-power-based-on-eeprom.patch} | 47 +- ...fi-rt2x00-fix-MT7620-low-RSSI-issue.patch} | 12 +- ...-rt2x00-fix-rt2800-watchdog-function.patch | 78 ++++ ...prove-MT7620-register-initialization.patch | 124 ++++++ ...ework-MT7620-channel-config-function.patch | 146 +++++++ ...-rework-MT7620-PA-LNA-RF-calibration.patch | 241 ++++++++++ ...oduce-DMA-busy-check-watchdog-for-rt.patch | 177 ++++++++ ...ble-RTS-threshold-for-rt2800-by-defa.patch | 43 ++ ...art-beacon-queue-when-hardware-reset.patch | 67 +++ ...-support-for-loading-EEPROM-from-MTD.patch | 3 +- ...port-loading-eeprom-from-NVMEM-cells.patch | 3 +- ...isabling_bands_through_platform_data.patch | 2 +- ...07-rt2x00-add_platform_data_mac_addr.patch | 2 +- ...00-allow_disabling_bands_through_dts.patch | 2 +- ...0-rt2x00-change-led-polarity-from-OF.patch | 2 +- .../611-rt2x00-add-AP+STA-support.patch | 2 +- ...t-support-for-external-LNA-on-MT7620.patch | 74 +--- ...-differentiate-based-on-SoC-CHIP_VER.patch | 108 +++-- ...-rework-MT7620-PA-LNA-RF-calibration.patch | 413 ------------------ 21 files changed, 1035 insertions(+), 541 deletions(-) create mode 100644 package/kernel/mac80211/patches/rt2x00/000-v6.6-wifi-rt2x00-correct-MAC_SYS_CTRL-register-RX-mask-i.patch rename package/kernel/mac80211/patches/rt2x00/{997-wifi-rt2x00-limit-MT7620-TX-power-based-on-eeprom-ca.patch => 001-v6.6-wifi-rt2x00-limit-MT7620-TX-power-based-on-eeprom.patch} (73%) rename package/kernel/mac80211/patches/rt2x00/{999-wifi-rt2x00-fix-MT7620-low-RSSI-issue.patch => 002-v6.7-wifi-rt2x00-fix-MT7620-low-RSSI-issue.patch} (76%) create mode 100644 package/kernel/mac80211/patches/rt2x00/003-v6.7-wifi-rt2x00-fix-rt2800-watchdog-function.patch create mode 100644 package/kernel/mac80211/patches/rt2x00/004-1-v6.7-wifi-rt2x00-improve-MT7620-register-initialization.patch create mode 100644 package/kernel/mac80211/patches/rt2x00/004-2-v6.7-wifi-rt2x00-rework-MT7620-channel-config-function.patch create mode 100644 package/kernel/mac80211/patches/rt2x00/004-3-v6.7-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch create mode 100644 package/kernel/mac80211/patches/rt2x00/005-1-v6.8-wifi-rt2x00-introduce-DMA-busy-check-watchdog-for-rt.patch create mode 100644 package/kernel/mac80211/patches/rt2x00/005-2-v6.8-wifi-rt2x00-disable-RTS-threshold-for-rt2800-by-defa.patch create mode 100644 package/kernel/mac80211/patches/rt2x00/005-3-v6.8-wifi-rt2x00-restart-beacon-queue-when-hardware-reset.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch diff --git a/package/kernel/mac80211/patches/ath/400-ath_move_debug_code.patch b/package/kernel/mac80211/patches/ath/400-ath_move_debug_code.patch index 4c6b175ebe2..23b7340e25c 100644 --- a/package/kernel/mac80211/patches/ath/400-ath_move_debug_code.patch +++ b/package/kernel/mac80211/patches/ath/400-ath_move_debug_code.patch @@ -14,7 +14,7 @@ CFLAGS_trace.o := -I$(src) --- a/drivers/net/wireless/ath/ath.h +++ b/drivers/net/wireless/ath/ath.h -@@ -319,14 +319,7 @@ void _ath_dbg(struct ath_common *common, +@@ -321,14 +321,7 @@ void _ath_dbg(struct ath_common *common, #endif /* CPTCFG_ATH_DEBUG */ /** Returns string describing opmode, or NULL if unknown mode. */ diff --git a/package/kernel/mac80211/patches/rt2x00/000-v6.6-wifi-rt2x00-correct-MAC_SYS_CTRL-register-RX-mask-i.patch b/package/kernel/mac80211/patches/rt2x00/000-v6.6-wifi-rt2x00-correct-MAC_SYS_CTRL-register-RX-mask-i.patch new file mode 100644 index 00000000000..c84b5a14084 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/000-v6.6-wifi-rt2x00-correct-MAC_SYS_CTRL-register-RX-mask-i.patch @@ -0,0 +1,28 @@ +From 186f2432741f6d28d86ff723ac7830446affddfc Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sat, 5 Aug 2023 17:17:28 +0800 +Subject: wifi: rt2x00: correct MAC_SYS_CTRL register RX mask in R-Calibration + +For MAC_SYS_CTRL register, Bit[2] controls MAC_TX_EN and Bit[3] +controls MAC_RX_EN (Bit index starts from 0). Therefore, 0x08 is +the correct mask for RX. + +Signed-off-by: Shiji Yang +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/TYAP286MB03150B571B67B896A504AC34BC0EA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -8561,7 +8561,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))) 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/001-v6.6-wifi-rt2x00-limit-MT7620-TX-power-based-on-eeprom.patch similarity index 73% rename from package/kernel/mac80211/patches/rt2x00/997-wifi-rt2x00-limit-MT7620-TX-power-based-on-eeprom-ca.patch rename to package/kernel/mac80211/patches/rt2x00/001-v6.6-wifi-rt2x00-limit-MT7620-TX-power-based-on-eeprom.patch index fd1b3d8bf3b..aa843d42198 100644 --- a/package/kernel/mac80211/patches/rt2x00/997-wifi-rt2x00-limit-MT7620-TX-power-based-on-eeprom-ca.patch +++ b/package/kernel/mac80211/patches/rt2x00/001-v6.6-wifi-rt2x00-limit-MT7620-TX-power-based-on-eeprom.patch @@ -1,7 +1,7 @@ +From 821b5192c955144bd2f0aeea6cd153e1aedd16e1 Mon Sep 17 00:00:00 2001 From: Shiji Yang -Date: Sat, 22 Jul 2023 21:56:30 +0800 -Subject: [PATCH] wifi: rt2x00: limit MT7620 TX power based on eeprom - calibration +Date: Fri, 11 Aug 2023 14:34:54 +0800 +Subject: 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 @@ -18,29 +18,36 @@ 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). +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 +interface. This part is missing from the rt2x00 driver framework. If we set the power exceed the calibration value, it won't take effect. Signed-off-by: Shiji Yang +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/TYAP286MB03159090ED14044215E59FD6BC10A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM --- - .../net/wireless/ralink/rt2x00/rt2800lib.c | 49 +++++++++++++------ - 1 file changed, 34 insertions(+), 15 deletions(-) + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 57 ++++++++++++++++++-------- + 1 file changed, 40 insertions(+), 17 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 +@@ -3865,28 +3865,51 @@ 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) { +- struct ieee80211_channel *chan, +- int power_level) { - u16 eeprom, target_power, max_power; ++static void rt2800_config_alc_rt6352(struct rt2x00_dev *rt2x00dev, ++ struct ieee80211_channel *chan, ++ int power_level) ++{ ++ int cur_channel = rt2x00dev->rf_channel; + u16 eeprom, chan_power, rate_power, target_power; + u16 tx_power[2]; + s8 *power_group[2]; @@ -57,27 +64,29 @@ Signed-off-by: Shiji Yang - 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 */ ++ if (WARN_ON(cur_channel < 1 || cur_channel > 14)) ++ return; ++ ++ /* get per chain power, 2 chains 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 ++ ++ /* 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; ++ EEPROM_TXPOWER_BYRATE, 1); ++ rate_power &= 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]; ++ chan_power = power_group[cnt][cur_channel - 1]; + if (chan_power >= 0x20 || chan_power == 0) + chan_power = 0x10; + tx_power[cnt] = power_level < chan_power ? power_level : chan_power; @@ -95,7 +104,7 @@ Signed-off-by: Shiji Yang 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 +@@ -5268,7 +5291,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); diff --git a/package/kernel/mac80211/patches/rt2x00/999-wifi-rt2x00-fix-MT7620-low-RSSI-issue.patch b/package/kernel/mac80211/patches/rt2x00/002-v6.7-wifi-rt2x00-fix-MT7620-low-RSSI-issue.patch similarity index 76% rename from package/kernel/mac80211/patches/rt2x00/999-wifi-rt2x00-fix-MT7620-low-RSSI-issue.patch rename to package/kernel/mac80211/patches/rt2x00/002-v6.7-wifi-rt2x00-fix-MT7620-low-RSSI-issue.patch index 8f7343d14e3..ffb66559d17 100644 --- a/package/kernel/mac80211/patches/rt2x00/999-wifi-rt2x00-fix-MT7620-low-RSSI-issue.patch +++ b/package/kernel/mac80211/patches/rt2x00/002-v6.7-wifi-rt2x00-fix-MT7620-low-RSSI-issue.patch @@ -1,6 +1,7 @@ +From 2ecfe6f07e8e6257cad3d3290c5aec2102120041 Mon Sep 17 00:00:00 2001 From: Shiji Yang -Date: Sat, 23 Sep 2023 07:51:39 +0800 -Subject: [PATCH] wifi: rt2x00: fix MT7620 low RSSI issue +Date: Sat, 23 Sep 2023 09:01:01 +0800 +Subject: wifi: rt2x00: fix MT7620 low RSSI issue On Mediatek vendor driver[1], MT7620 (RT6352) uses different RSSI base value '-2' compared to the other RT2x00 chips. This patch @@ -10,13 +11,16 @@ reports on MT7620. [1] Found on MT76x2E_MT7620_LinuxAP_V3.0.4.0_P3 ConvertToRssi(). Signed-off-by: Shiji Yang +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/TYAP286MB031571CDB146C414A908A66DBCFEA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM --- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -875,6 +875,7 @@ static int rt2800_agc_to_rssi(struct rt2 +@@ -856,6 +856,7 @@ static int rt2800_agc_to_rssi(struct rt2 s8 rssi0 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI0); s8 rssi1 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI1); s8 rssi2 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI2); @@ -24,7 +28,7 @@ Signed-off-by: Shiji Yang u16 eeprom; u8 offset0; u8 offset1; -@@ -899,9 +900,9 @@ static int rt2800_agc_to_rssi(struct rt2 +@@ -880,9 +881,9 @@ static int rt2800_agc_to_rssi(struct rt2 * If the value in the descriptor is 0, it is considered invalid * and the default (extremely low) rssi value is assumed */ diff --git a/package/kernel/mac80211/patches/rt2x00/003-v6.7-wifi-rt2x00-fix-rt2800-watchdog-function.patch b/package/kernel/mac80211/patches/rt2x00/003-v6.7-wifi-rt2x00-fix-rt2800-watchdog-function.patch new file mode 100644 index 00000000000..f253dacf2b2 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/003-v6.7-wifi-rt2x00-fix-rt2800-watchdog-function.patch @@ -0,0 +1,78 @@ +From 69708fbb2c698f262e03360d064c7066e0679953 Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sat, 14 Oct 2023 14:55:01 +0800 +Subject: wifi: rt2x00: fix rt2800 watchdog function + +The watchdog function is broken on rt2800 series SoCs. This patch +fixes the incorrect watchdog logic to make it work again. + +1. Update current wdt queue index if it's not equal to the previous + index. Watchdog compares the current and previous queue index to + judge if the queue hung. +2. Make sure hung_{rx,tx} 'true' status won't be override by the + normal queue. Any queue hangs should trigger a reset action. +3. Clear the watchdog counter of all queues before resetting the + hardware. This change may help to avoid the reset loop. +4. Change hang check function return type to bool as we only need + to return two status, yes or no. + +Signed-off-by: Shiji Yang +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/TYAP286MB0315BC1D83D31154924F0D39BCD1A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 17 +++++++++++------ + 1 file changed, 11 insertions(+), 6 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -1237,13 +1237,14 @@ void rt2800_txdone_nostatus(struct rt2x0 + } + EXPORT_SYMBOL_GPL(rt2800_txdone_nostatus); + +-static int rt2800_check_hung(struct data_queue *queue) ++static bool rt2800_check_hung(struct data_queue *queue) + { + unsigned int cur_idx = rt2800_drv_get_dma_done(queue); + +- if (queue->wd_idx != cur_idx) ++ if (queue->wd_idx != cur_idx) { ++ queue->wd_idx = cur_idx; + queue->wd_count = 0; +- else ++ } else + queue->wd_count++; + + return queue->wd_count > 16; +@@ -1280,7 +1281,7 @@ void rt2800_watchdog(struct rt2x00_dev * + case QID_MGMT: + if (rt2x00queue_empty(queue)) + continue; +- hung_tx = rt2800_check_hung(queue); ++ hung_tx = hung_tx || rt2800_check_hung(queue); + break; + case QID_RX: + /* For station mode we should reactive at least +@@ -1289,7 +1290,7 @@ void rt2800_watchdog(struct rt2x00_dev * + */ + if (rt2x00dev->intf_sta_count == 0) + continue; +- hung_rx = rt2800_check_hung(queue); ++ hung_rx = hung_rx || rt2800_check_hung(queue); + break; + default: + break; +@@ -1302,8 +1303,12 @@ void rt2800_watchdog(struct rt2x00_dev * + if (hung_rx) + rt2x00_warn(rt2x00dev, "Watchdog RX hung detected\n"); + +- if (hung_tx || hung_rx) ++ if (hung_tx || hung_rx) { ++ queue_for_each(rt2x00dev, queue) ++ queue->wd_count = 0; ++ + ieee80211_restart_hw(rt2x00dev->hw); ++ } + } + EXPORT_SYMBOL_GPL(rt2800_watchdog); + diff --git a/package/kernel/mac80211/patches/rt2x00/004-1-v6.7-wifi-rt2x00-improve-MT7620-register-initialization.patch b/package/kernel/mac80211/patches/rt2x00/004-1-v6.7-wifi-rt2x00-improve-MT7620-register-initialization.patch new file mode 100644 index 00000000000..9f4dbb8346e --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/004-1-v6.7-wifi-rt2x00-improve-MT7620-register-initialization.patch @@ -0,0 +1,124 @@ +From 1ffe76d5ae78553948d67a978acd9945c2f0a175 Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Thu, 19 Oct 2023 19:58:56 +0800 +Subject: wifi: rt2x00: improve MT7620 register initialization + +1. Do not hard reset the BBP. We can use soft reset instead. This + change has some help to the calibration failure issue. +2. Enable falling back to legacy rate from the HT/RTS rate by + setting the HT_FBK_TO_LEGACY register. +3. Implement MCS rate specific maximum PSDU size. It can improve + the transmission quality under the low RSSI condition. +4. Set BBP_84 register value to 0x19. This is used for extension + channel overlapping IOT. + +Signed-off-by: Shiji Yang +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/TYAP286MB031553CCD4B7A3B89C85935DBCD4A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM +--- + drivers/net/wireless/ralink/rt2x00/rt2800.h | 18 ++++++++++++++++++ + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 24 ++++++++++++++++++++++++ + drivers/net/wireless/ralink/rt2x00/rt2800mmio.c | 3 +++ + 3 files changed, 45 insertions(+) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h +@@ -871,6 +871,18 @@ + #define LED_CFG_LED_POLAR FIELD32(0x40000000) + + /* ++ * AMPDU_MAX_LEN_20M1S: Per MCS max A-MPDU length, 20 MHz, MCS 0-7 ++ * AMPDU_MAX_LEN_20M2S: Per MCS max A-MPDU length, 20 MHz, MCS 8-15 ++ * AMPDU_MAX_LEN_40M1S: Per MCS max A-MPDU length, 40 MHz, MCS 0-7 ++ * AMPDU_MAX_LEN_40M2S: Per MCS max A-MPDU length, 40 MHz, MCS 8-15 ++ * Maximum A-MPDU length = 2^(AMPDU_MAX - 5) kilobytes ++ */ ++#define AMPDU_MAX_LEN_20M1S 0x1030 ++#define AMPDU_MAX_LEN_20M2S 0x1034 ++#define AMPDU_MAX_LEN_40M1S 0x1038 ++#define AMPDU_MAX_LEN_40M2S 0x103C ++ ++/* + * AMPDU_BA_WINSIZE: Force BlockAck window size + * FORCE_WINSIZE_ENABLE: + * 0: Disable forcing of BlockAck window size +@@ -1545,6 +1557,12 @@ + */ + #define EXP_ACK_TIME 0x1380 + ++/* ++ * HT_FBK_TO_LEGACY: Enable/Disable HT/RTS fallback to OFDM/CCK rate ++ * Not available for legacy SoCs ++ */ ++#define HT_FBK_TO_LEGACY 0x1384 ++ + /* TX_PWR_CFG_5 */ + #define TX_PWR_CFG_5 0x1384 + #define TX_PWR_CFG_5_MCS16_CH0 FIELD32(0x0000000f) +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -5851,6 +5851,7 @@ static int rt2800_init_registers(struct + struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; + u32 reg; + u16 eeprom; ++ u8 bbp; + unsigned int i; + int ret; + +@@ -5860,6 +5861,19 @@ static int rt2800_init_registers(struct + if (ret) + return ret; + ++ if (rt2x00_rt(rt2x00dev, RT6352)) { ++ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0x01); ++ ++ bbp = rt2800_bbp_read(rt2x00dev, 21); ++ bbp |= 0x01; ++ rt2800_bbp_write(rt2x00dev, 21, bbp); ++ bbp = rt2800_bbp_read(rt2x00dev, 21); ++ bbp &= (~0x01); ++ rt2800_bbp_write(rt2x00dev, 21, bbp); ++ ++ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0x00); ++ } ++ + rt2800_register_write(rt2x00dev, LEGACY_BASIC_RATE, 0x0000013f); + rt2800_register_write(rt2x00dev, HT_BASIC_RATE, 0x00008003); + +@@ -6013,6 +6027,14 @@ static int rt2800_init_registers(struct + reg = rt2800_register_read(rt2x00dev, TX_ALC_CFG_1); + rt2x00_set_field32(®, TX_ALC_CFG_1_ROS_BUSY_EN, 0); + rt2800_register_write(rt2x00dev, TX_ALC_CFG_1, reg); ++ ++ rt2800_register_write(rt2x00dev, AMPDU_MAX_LEN_20M1S, 0x77754433); ++ rt2800_register_write(rt2x00dev, AMPDU_MAX_LEN_20M2S, 0x77765543); ++ rt2800_register_write(rt2x00dev, AMPDU_MAX_LEN_40M1S, 0x77765544); ++ rt2800_register_write(rt2x00dev, AMPDU_MAX_LEN_40M2S, 0x77765544); ++ ++ rt2800_register_write(rt2x00dev, HT_FBK_TO_LEGACY, 0x1010); ++ + } else { + rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000000); + rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606); +@@ -7231,6 +7253,8 @@ static void rt2800_init_bbp_6352(struct + rt2800_bbp_dcoc_write(rt2x00dev, 159, 0x64); + + rt2800_bbp4_mac_if_ctrl(rt2x00dev); ++ ++ rt2800_bbp_write(rt2x00dev, 84, 0x19); + } + + static void rt2800_init_bbp(struct rt2x00_dev *rt2x00dev) +--- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c +@@ -760,6 +760,9 @@ int rt2800mmio_init_registers(struct rt2 + + rt2x00mmio_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003); + ++ if (rt2x00_rt(rt2x00dev, RT6352)) ++ return 0; ++ + reg = 0; + rt2x00_set_field32(®, MAC_SYS_CTRL_RESET_CSR, 1); + rt2x00_set_field32(®, MAC_SYS_CTRL_RESET_BBP, 1); diff --git a/package/kernel/mac80211/patches/rt2x00/004-2-v6.7-wifi-rt2x00-rework-MT7620-channel-config-function.patch b/package/kernel/mac80211/patches/rt2x00/004-2-v6.7-wifi-rt2x00-rework-MT7620-channel-config-function.patch new file mode 100644 index 00000000000..1aec73d7622 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/004-2-v6.7-wifi-rt2x00-rework-MT7620-channel-config-function.patch @@ -0,0 +1,146 @@ +From a28533c6be1711584bf3ec978309d5c590029821 Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Thu, 19 Oct 2023 19:58:57 +0800 +Subject: wifi: rt2x00: rework MT7620 channel config function + +1. Move the channel configuration code from rt2800_vco_calibration() + to the rt2800_config_channel(). +2. Use MT7620 SoC specific AGC initial LNA value instead of the + RT5592's value. +3. BBP{195,196} pairing write has been replaced with + rt2800_bbp_glrt_write() to reduce redundant code. + +Signed-off-by: Shiji Yang +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/TYAP286MB0315622A4340BFFA530B1B86BCD4A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 91 ++++++++++---------------- + 1 file changed, 35 insertions(+), 56 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -3861,14 +3861,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, +@@ -4437,32 +4429,46 @@ static void rt2800_config_channel(struct + usleep_range(1000, 1500); + } + +- if (rt2x00_rt(rt2x00dev, RT5592) || rt2x00_rt(rt2x00dev, RT6352)) { +- reg = 0x10; +- if (!conf_is_ht40(conf)) { +- if (rt2x00_rt(rt2x00dev, RT6352) && +- rt2x00_has_cap_external_lna_bg(rt2x00dev)) { +- reg |= 0x5; +- } else { +- reg |= 0xa; +- } +- } +- rt2800_bbp_write(rt2x00dev, 195, 141); +- rt2800_bbp_write(rt2x00dev, 196, reg); ++ if (rt2x00_rt(rt2x00dev, RT5592)) { ++ bbp = conf_is_ht40(conf) ? 0x10 : 0x1a; ++ rt2800_bbp_glrt_write(rt2x00dev, 141, bbp); + +- /* 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); ++ bbp = (rf->channel <= 14 ? 0x1c : 0x24) + 2 * rt2x00dev->lna_gain; ++ rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, bbp); + +- if (rt2x00_rt(rt2x00dev, RT5592)) +- rt2800_iq_calibrate(rt2x00dev, rf->channel); ++ rt2800_iq_calibrate(rt2x00dev, rf->channel); + } + + if (rt2x00_rt(rt2x00dev, RT6352)) { ++ /* BBP for GLRT BW */ ++ bbp = conf_is_ht40(conf) ? ++ 0x10 : rt2x00_has_cap_external_lna_bg(rt2x00dev) ? ++ 0x15 : 0x1a; ++ rt2800_bbp_glrt_write(rt2x00dev, 141, bbp); ++ ++ bbp = conf_is_ht40(conf) ? 0x2f : 0x40; ++ rt2800_bbp_glrt_write(rt2x00dev, 157, bbp); ++ ++ if (rt2x00dev->default_ant.rx_chain_num == 1) { ++ rt2800_bbp_write(rt2x00dev, 91, 0x07); ++ rt2800_bbp_write(rt2x00dev, 95, 0x1a); ++ rt2800_bbp_glrt_write(rt2x00dev, 128, 0xa0); ++ rt2800_bbp_glrt_write(rt2x00dev, 170, 0x12); ++ rt2800_bbp_glrt_write(rt2x00dev, 171, 0x10); ++ } else { ++ rt2800_bbp_write(rt2x00dev, 91, 0x06); ++ rt2800_bbp_write(rt2x00dev, 95, 0x9a); ++ rt2800_bbp_glrt_write(rt2x00dev, 128, 0xe0); ++ rt2800_bbp_glrt_write(rt2x00dev, 170, 0x30); ++ rt2800_bbp_glrt_write(rt2x00dev, 171, 0x30); ++ } ++ ++ /* AGC init */ ++ bbp = rf->channel <= 14 ? 0x04 + 2 * rt2x00dev->lna_gain : 0; ++ rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, bbp); ++ ++ usleep_range(1000, 1500); ++ + if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, + &rt2x00dev->cap_flags)) { + reg = rt2800_register_read(rt2x00dev, RF_CONTROL3); +@@ -5608,26 +5614,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); +@@ -5635,13 +5621,6 @@ void rt2800_vco_calibration(struct rt2x0 + 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); diff --git a/package/kernel/mac80211/patches/rt2x00/004-3-v6.7-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch b/package/kernel/mac80211/patches/rt2x00/004-3-v6.7-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch new file mode 100644 index 00000000000..64cd599c02b --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/004-3-v6.7-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch @@ -0,0 +1,241 @@ +From cca74bed37af1c8217bcd8282d9b384efdbf73bd Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Thu, 19 Oct 2023 19:58:58 +0800 +Subject: wifi: rt2x00: rework MT7620 PA/LNA RF calibration + +1. Move MT7620 PA/LNA calibration code to dedicated functions. +2. For external PA/LNA devices, restore RF and BBP registers before + R-Calibration. +3. Do Rx DCOC calibration again before RXIQ calibration. +4. Add some missing LNA related registers' initialization. + +Signed-off-by: Shiji Yang +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/TYAP286MB0315979F92DC563019B8F238BCD4A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 176 +++++++++++++++++-------- + drivers/net/wireless/ralink/rt2x00/rt2x00.h | 6 + + 2 files changed, 130 insertions(+), 52 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -4468,41 +4468,6 @@ static void rt2800_config_channel(struct + rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, bbp); + + usleep_range(1000, 1500); +- +- 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); +- } + } + + bbp = rt2800_bbp_read(rt2x00dev, 4); +@@ -5612,16 +5577,6 @@ void rt2800_vco_calibration(struct rt2x0 + } + } + rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin); +- +- if (rt2x00_rt(rt2x00dev, RT6352)) { +- 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); +- } +- } + } + EXPORT_SYMBOL_GPL(rt2800_vco_calibration); + +@@ -10348,6 +10303,128 @@ do_cal: + rt2800_register_write(rt2x00dev, RF_BYPASS0, MAC_RF_BYPASS0); + } + ++static void rt2800_restore_rf_bbp_rt6352(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 (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 (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 (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 (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); ++ } ++} ++ ++static void rt2800_calibration_rt6352(struct rt2x00_dev *rt2x00dev) ++{ ++ u32 reg; ++ ++ if (rt2x00_has_cap_external_pa(rt2x00dev) || ++ rt2x00_has_cap_external_lna_bg(rt2x00dev)) ++ rt2800_restore_rf_bbp_rt6352(rt2x00dev); ++ ++ 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); ++ ++ /* missing DPD calibration for internal PA devices */ ++ ++ rt2800_rxdcoc_calibration(rt2x00dev); ++ rt2800_rxiq_calibration(rt2x00dev); ++ ++ if (!rt2x00_has_cap_external_pa(rt2x00dev) && ++ !rt2x00_has_cap_external_lna_bg(rt2x00dev)) ++ return; ++ ++ 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)) { ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x42); ++ } ++ ++ if (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 (rt2x00_has_cap_external_pa(rt2x00dev)) ++ rt2800_rfcsr_write_dccal(rt2x00dev, 05, 0x00); ++ ++ 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); ++ } ++ ++ if (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 rt2800_init_rfcsr_6352(struct rt2x00_dev *rt2x00dev) + { + /* Initialize RF central register to default value */ +@@ -10612,13 +10689,8 @@ static void rt2800_init_rfcsr_6352(struc + rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); + rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); + +- 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); ++ /* Do calibration and init PA/LNA */ ++ rt2800_calibration_rt6352(rt2x00dev); + } + + static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +@@ -1263,6 +1263,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); diff --git a/package/kernel/mac80211/patches/rt2x00/005-1-v6.8-wifi-rt2x00-introduce-DMA-busy-check-watchdog-for-rt.patch b/package/kernel/mac80211/patches/rt2x00/005-1-v6.8-wifi-rt2x00-introduce-DMA-busy-check-watchdog-for-rt.patch new file mode 100644 index 00000000000..c1c32257330 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/005-1-v6.8-wifi-rt2x00-introduce-DMA-busy-check-watchdog-for-rt.patch @@ -0,0 +1,177 @@ +From b1275cdd7456ef811747dfb4f3c46310ddd300cd Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sat, 4 Nov 2023 16:57:58 +0800 +Subject: wifi: rt2x00: introduce DMA busy check watchdog for rt2800 + +When I tried to fix the watchdog of rt2800, I found that sometimes +the watchdog can not reset the hung device. This is because the +queue is not completely stuck, it just becomes very slow. The MTK +vendor driver for the new chip MT7603/MT7612 has a DMA busy watchdog +to detect device hangs by checking DMA busy status. This watchdog +implementation is something similar to it. To reduce unnecessary +reset, we can check the INT_SOURCE_CSR register together as I found +that when the radio hung, the RX/TX coherent interrupt will always +stuck at triggered state. + +The 'watchdog' module parameter has been extended to control all +watchdogs(0=disabled, 1=hang watchdog, 2=DMA watchdog, 3=both). This +new watchdog function is a slight schedule and it won't affect the +transmission speed. So we can turn on it by default. Due to the +INT_SOURCE_CSR register is invalid on rt2800 USB NICs, the DMA busy +watchdog will be automatically disabled for them. + +Tested on MT7620 and RT5350. + +Signed-off-by: Shiji Yang +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/TYAP286MB0315D7462CE08A119A99DE34BCA4A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM +--- + drivers/net/wireless/ralink/rt2x00/rt2800.h | 4 ++ + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 77 ++++++++++++++++++++++---- + drivers/net/wireless/ralink/rt2x00/rt2x00.h | 3 + + 3 files changed, 73 insertions(+), 11 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h +@@ -3194,4 +3194,8 @@ enum rt2800_eeprom_word { + */ + #define BCN_TBTT_OFFSET 64 + ++/* Watchdog type mask */ ++#define RT2800_WATCHDOG_HANG BIT(0) ++#define RT2800_WATCHDOG_DMA_BUSY BIT(1) ++ + #endif /* RT2800_H */ +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -30,9 +30,10 @@ + #include "rt2800lib.h" + #include "rt2800.h" + +-static bool modparam_watchdog; +-module_param_named(watchdog, modparam_watchdog, bool, S_IRUGO); +-MODULE_PARM_DESC(watchdog, "Enable watchdog to detect tx/rx hangs and reset hardware if detected"); ++static unsigned int modparam_watchdog = RT2800_WATCHDOG_DMA_BUSY; ++module_param_named(watchdog, modparam_watchdog, uint, 0444); ++MODULE_PARM_DESC(watchdog, "Enable watchdog to recover tx/rx hangs.\n" ++ "\t\t(0=disabled, 1=hang watchdog, 2=DMA watchdog(default), 3=both)"); + + /* + * Register access. +@@ -1261,15 +1262,12 @@ static void rt2800_update_survey(struct + chan_survey->time_ext_busy += rt2800_register_read(rt2x00dev, CH_BUSY_STA_SEC); + } + +-void rt2800_watchdog(struct rt2x00_dev *rt2x00dev) ++static bool rt2800_watchdog_hung(struct rt2x00_dev *rt2x00dev) + { + struct data_queue *queue; + bool hung_tx = false; + bool hung_rx = false; + +- if (test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) +- return; +- + rt2800_update_survey(rt2x00dev); + + queue_for_each(rt2x00dev, queue) { +@@ -1297,18 +1295,72 @@ void rt2800_watchdog(struct rt2x00_dev * + } + } + ++ if (!hung_tx && !hung_rx) ++ return false; ++ + if (hung_tx) + rt2x00_warn(rt2x00dev, "Watchdog TX hung detected\n"); + + if (hung_rx) + rt2x00_warn(rt2x00dev, "Watchdog RX hung detected\n"); + +- if (hung_tx || hung_rx) { +- queue_for_each(rt2x00dev, queue) +- queue->wd_count = 0; ++ queue_for_each(rt2x00dev, queue) ++ queue->wd_count = 0; ++ ++ return true; ++} ++ ++static bool rt2800_watchdog_dma_busy(struct rt2x00_dev *rt2x00dev) ++{ ++ bool busy_rx, busy_tx; ++ u32 reg_cfg = rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG); ++ u32 reg_int = rt2800_register_read(rt2x00dev, INT_SOURCE_CSR); ++ ++ if (rt2x00_get_field32(reg_cfg, WPDMA_GLO_CFG_RX_DMA_BUSY) && ++ rt2x00_get_field32(reg_int, INT_SOURCE_CSR_RX_COHERENT)) ++ rt2x00dev->rxdma_busy++; ++ else ++ rt2x00dev->rxdma_busy = 0; + ++ if (rt2x00_get_field32(reg_cfg, WPDMA_GLO_CFG_TX_DMA_BUSY) && ++ rt2x00_get_field32(reg_int, INT_SOURCE_CSR_TX_COHERENT)) ++ rt2x00dev->txdma_busy++; ++ else ++ rt2x00dev->txdma_busy = 0; ++ ++ busy_rx = rt2x00dev->rxdma_busy > 30 ? true : false; ++ busy_tx = rt2x00dev->txdma_busy > 30 ? true : false; ++ ++ if (!busy_rx && !busy_tx) ++ return false; ++ ++ if (busy_rx) ++ rt2x00_warn(rt2x00dev, "Watchdog RX DMA busy detected\n"); ++ ++ if (busy_tx) ++ rt2x00_warn(rt2x00dev, "Watchdog TX DMA busy detected\n"); ++ ++ rt2x00dev->rxdma_busy = 0; ++ rt2x00dev->txdma_busy = 0; ++ ++ return true; ++} ++ ++void rt2800_watchdog(struct rt2x00_dev *rt2x00dev) ++{ ++ bool reset = false; ++ ++ if (test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) ++ return; ++ ++ if (modparam_watchdog & RT2800_WATCHDOG_DMA_BUSY) ++ reset = rt2800_watchdog_dma_busy(rt2x00dev); ++ ++ if (modparam_watchdog & RT2800_WATCHDOG_HANG) ++ reset = rt2800_watchdog_hung(rt2x00dev) || reset; ++ ++ if (reset) + ieee80211_restart_hw(rt2x00dev->hw); +- } + } + EXPORT_SYMBOL_GPL(rt2800_watchdog); + +@@ -12016,6 +12068,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r + __set_bit(REQUIRE_TASKLET_CONTEXT, &rt2x00dev->cap_flags); + } + ++ /* USB NICs don't support DMA watchdog as INT_SOURCE_CSR is invalid */ ++ if (rt2x00_is_usb(rt2x00dev)) ++ modparam_watchdog &= ~RT2800_WATCHDOG_DMA_BUSY; + if (modparam_watchdog) { + __set_bit(CAPABILITY_RESTART_HW, &rt2x00dev->cap_flags); + rt2x00dev->link.watchdog_interval = msecs_to_jiffies(100); +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +@@ -926,6 +926,9 @@ struct rt2x00_dev { + */ + u16 beacon_int; + ++ /* Rx/Tx DMA busy watchdog counter */ ++ u16 rxdma_busy, txdma_busy; ++ + /** + * Timestamp of last received beacon + */ diff --git a/package/kernel/mac80211/patches/rt2x00/005-2-v6.8-wifi-rt2x00-disable-RTS-threshold-for-rt2800-by-defa.patch b/package/kernel/mac80211/patches/rt2x00/005-2-v6.8-wifi-rt2x00-disable-RTS-threshold-for-rt2800-by-defa.patch new file mode 100644 index 00000000000..b3e95da5a60 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/005-2-v6.8-wifi-rt2x00-disable-RTS-threshold-for-rt2800-by-defa.patch @@ -0,0 +1,43 @@ +From 570beb6285fd355904b22625da20809f477096c5 Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sat, 4 Nov 2023 16:57:59 +0800 +Subject: wifi: rt2x00: disable RTS threshold for rt2800 by default + +rt2800 has a lot of registers to control the RTS enable/disable +status for different rates. And the driver control them via +rt2800_set_rts_threshold(). When RTS was disabled in user +interface, this function won't be called at all. This means that +the RTS is still 'on' for CCK and OFDM rates. So we'd better to +disable them by default because it should be like this. The RTS +for HT20 and HT40 is already default off so we don't need to +touch them. If we toggle the RTS status, these register bits +will be enable/disable again by rt2800_set_rts_threshold(). + +Signed-off-by: Shiji Yang +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/TYAP286MB03155DDB953155B7A2DE849ABCA4A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -6100,7 +6100,7 @@ static int rt2800_init_registers(struct + rt2x00_set_field32(®, CCK_PROT_CFG_TX_OP_ALLOW_MM40, 0); + rt2x00_set_field32(®, CCK_PROT_CFG_TX_OP_ALLOW_GF20, 1); + rt2x00_set_field32(®, CCK_PROT_CFG_TX_OP_ALLOW_GF40, 0); +- rt2x00_set_field32(®, CCK_PROT_CFG_RTS_TH_EN, 1); ++ rt2x00_set_field32(®, CCK_PROT_CFG_RTS_TH_EN, 0); + rt2800_register_write(rt2x00dev, CCK_PROT_CFG, reg); + + reg = rt2800_register_read(rt2x00dev, OFDM_PROT_CFG); +@@ -6113,7 +6113,7 @@ static int rt2800_init_registers(struct + rt2x00_set_field32(®, OFDM_PROT_CFG_TX_OP_ALLOW_MM40, 0); + rt2x00_set_field32(®, OFDM_PROT_CFG_TX_OP_ALLOW_GF20, 1); + rt2x00_set_field32(®, OFDM_PROT_CFG_TX_OP_ALLOW_GF40, 0); +- rt2x00_set_field32(®, OFDM_PROT_CFG_RTS_TH_EN, 1); ++ rt2x00_set_field32(®, OFDM_PROT_CFG_RTS_TH_EN, 0); + rt2800_register_write(rt2x00dev, OFDM_PROT_CFG, reg); + + reg = rt2800_register_read(rt2x00dev, MM20_PROT_CFG); diff --git a/package/kernel/mac80211/patches/rt2x00/005-3-v6.8-wifi-rt2x00-restart-beacon-queue-when-hardware-reset.patch b/package/kernel/mac80211/patches/rt2x00/005-3-v6.8-wifi-rt2x00-restart-beacon-queue-when-hardware-reset.patch new file mode 100644 index 00000000000..1fa7b8b0fb9 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/005-3-v6.8-wifi-rt2x00-restart-beacon-queue-when-hardware-reset.patch @@ -0,0 +1,67 @@ +From a11d965a218f0cd95b13fe44d0bcd8a20ce134a8 Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sat, 4 Nov 2023 16:58:00 +0800 +Subject: wifi: rt2x00: restart beacon queue when hardware reset + +When a hardware reset is triggered, all registers are reset, so all +queues are forced to stop in hardware interface. However, mac80211 +will not automatically stop the queue. If we don't manually stop the +beacon queue, the queue will be deadlocked and unable to start again. +This patch fixes the issue where Apple devices cannot connect to the +AP after calling ieee80211_restart_hw(). + +Signed-off-by: Shiji Yang +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/TYAP286MB031530EB6D98DCE4DF20766CBCA4A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM +--- + drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 3 +++ + drivers/net/wireless/ralink/rt2x00/rt2x00mac.c | 11 +++++++++++ + 2 files changed, 14 insertions(+) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +@@ -101,6 +101,7 @@ void rt2x00lib_disable_radio(struct rt2x + rt2x00link_stop_tuner(rt2x00dev); + rt2x00queue_stop_queues(rt2x00dev); + rt2x00queue_flush_queues(rt2x00dev, true); ++ rt2x00queue_stop_queue(rt2x00dev->bcn); + + /* + * Disable radio. +@@ -1286,6 +1287,7 @@ int rt2x00lib_start(struct rt2x00_dev *r + rt2x00dev->intf_ap_count = 0; + rt2x00dev->intf_sta_count = 0; + rt2x00dev->intf_associated = 0; ++ rt2x00dev->intf_beaconing = 0; + + /* Enable the radio */ + retval = rt2x00lib_enable_radio(rt2x00dev); +@@ -1312,6 +1314,7 @@ void rt2x00lib_stop(struct rt2x00_dev *r + rt2x00dev->intf_ap_count = 0; + rt2x00dev->intf_sta_count = 0; + rt2x00dev->intf_associated = 0; ++ rt2x00dev->intf_beaconing = 0; + } + + static inline void rt2x00lib_set_if_combinations(struct rt2x00_dev *rt2x00dev) +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c +@@ -598,6 +598,17 @@ void rt2x00mac_bss_info_changed(struct i + */ + if (changes & BSS_CHANGED_BEACON_ENABLED) { + mutex_lock(&intf->beacon_skb_mutex); ++ ++ /* ++ * Clear the 'enable_beacon' flag and clear beacon because ++ * the beacon queue has been stopped after hardware reset. ++ */ ++ if (test_bit(DEVICE_STATE_RESET, &rt2x00dev->flags) && ++ intf->enable_beacon) { ++ intf->enable_beacon = false; ++ rt2x00queue_clear_beacon(rt2x00dev, vif); ++ } ++ + if (!bss_conf->enable_beacon && intf->enable_beacon) { + rt2x00dev->intf_beaconing--; + intf->enable_beacon = false; diff --git a/package/kernel/mac80211/patches/rt2x00/602-03-wifi-rt2x00-Add-support-for-loading-EEPROM-from-MTD.patch b/package/kernel/mac80211/patches/rt2x00/602-03-wifi-rt2x00-Add-support-for-loading-EEPROM-from-MTD.patch index 6a343db9c72..fab4bf39c05 100644 --- a/package/kernel/mac80211/patches/rt2x00/602-03-wifi-rt2x00-Add-support-for-loading-EEPROM-from-MTD.patch +++ b/package/kernel/mac80211/patches/rt2x00/602-03-wifi-rt2x00-Add-support-for-loading-EEPROM-from-MTD.patch @@ -94,7 +94,7 @@ Signed-off-by: Christian Marangi static const char * rt2x00lib_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev) { -@@ -83,5 +141,13 @@ err_exit: +@@ -83,6 +141,14 @@ err_exit: int rt2x00lib_read_eeprom(struct rt2x00_dev *rt2x00dev) { @@ -108,3 +108,4 @@ Signed-off-by: Christian Marangi + return rt2x00lib_read_eeprom_file(rt2x00dev); } + EXPORT_SYMBOL_GPL(rt2x00lib_read_eeprom); diff --git a/package/kernel/mac80211/patches/rt2x00/602-05-wifi-rt2x00-support-loading-eeprom-from-NVMEM-cells.patch b/package/kernel/mac80211/patches/rt2x00/602-05-wifi-rt2x00-support-loading-eeprom-from-NVMEM-cells.patch index efe6e52720a..e6633363bd3 100644 --- a/package/kernel/mac80211/patches/rt2x00/602-05-wifi-rt2x00-support-loading-eeprom-from-NVMEM-cells.patch +++ b/package/kernel/mac80211/patches/rt2x00/602-05-wifi-rt2x00-support-loading-eeprom-from-NVMEM-cells.patch @@ -84,7 +84,7 @@ Signed-off-by: Christian Marangi static const char * rt2x00lib_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev) { -@@ -164,5 +199,9 @@ int rt2x00lib_read_eeprom(struct rt2x00_ +@@ -164,6 +199,10 @@ int rt2x00lib_read_eeprom(struct rt2x00_ return 0; #endif @@ -94,3 +94,4 @@ Signed-off-by: Christian Marangi + return rt2x00lib_read_eeprom_file(rt2x00dev); } + EXPORT_SYMBOL_GPL(rt2x00lib_read_eeprom); diff --git a/package/kernel/mac80211/patches/rt2x00/606-rt2x00-allow_disabling_bands_through_platform_data.patch b/package/kernel/mac80211/patches/rt2x00/606-rt2x00-allow_disabling_bands_through_platform_data.patch index ffee2189d2d..ab09a68297f 100644 --- a/package/kernel/mac80211/patches/rt2x00/606-rt2x00-allow_disabling_bands_through_platform_data.patch +++ b/package/kernel/mac80211/patches/rt2x00/606-rt2x00-allow_disabling_bands_through_platform_data.patch @@ -12,7 +12,7 @@ #endif /* _RT2X00_PLATFORM_H */ --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -1007,6 +1007,22 @@ static int rt2x00lib_probe_hw_modes(stru +@@ -1008,6 +1008,22 @@ static int rt2x00lib_probe_hw_modes(stru unsigned int num_rates; unsigned int i; diff --git a/package/kernel/mac80211/patches/rt2x00/607-rt2x00-add_platform_data_mac_addr.patch b/package/kernel/mac80211/patches/rt2x00/607-rt2x00-add_platform_data_mac_addr.patch index 37553bb80a0..79f99ffdf4a 100644 --- a/package/kernel/mac80211/patches/rt2x00/607-rt2x00-add_platform_data_mac_addr.patch +++ b/package/kernel/mac80211/patches/rt2x00/607-rt2x00-add_platform_data_mac_addr.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -989,6 +989,12 @@ static void rt2x00lib_rate(struct ieee80 +@@ -990,6 +990,12 @@ static void rt2x00lib_rate(struct ieee80 void rt2x00lib_set_mac_address(struct rt2x00_dev *rt2x00dev, u8 *eeprom_mac_addr) { diff --git a/package/kernel/mac80211/patches/rt2x00/608-rt2x00-allow_disabling_bands_through_dts.patch b/package/kernel/mac80211/patches/rt2x00/608-rt2x00-allow_disabling_bands_through_dts.patch index 6211809c0a0..31f2f0261fd 100644 --- a/package/kernel/mac80211/patches/rt2x00/608-rt2x00-allow_disabling_bands_through_dts.patch +++ b/package/kernel/mac80211/patches/rt2x00/608-rt2x00-allow_disabling_bands_through_dts.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -1012,6 +1012,16 @@ static int rt2x00lib_probe_hw_modes(stru +@@ -1013,6 +1013,16 @@ static int rt2x00lib_probe_hw_modes(stru struct ieee80211_rate *rates; unsigned int num_rates; unsigned int i; diff --git a/package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch b/package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch index 7b50bc275e2..8ee4e6cafa6 100644 --- a/package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch +++ b/package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch @@ -8,7 +8,7 @@ #include "rt2x00.h" #include "rt2800lib.h" -@@ -11129,6 +11130,17 @@ static int rt2800_init_eeprom(struct rt2 +@@ -11285,6 +11286,17 @@ static int rt2800_init_eeprom(struct rt2 rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC); rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY); diff --git a/package/kernel/mac80211/patches/rt2x00/611-rt2x00-add-AP+STA-support.patch b/package/kernel/mac80211/patches/rt2x00/611-rt2x00-add-AP+STA-support.patch index aa2b25ba7f5..9564f02edde 100644 --- a/package/kernel/mac80211/patches/rt2x00/611-rt2x00-add-AP+STA-support.patch +++ b/package/kernel/mac80211/patches/rt2x00/611-rt2x00-add-AP+STA-support.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -1359,7 +1359,7 @@ static inline void rt2x00lib_set_if_comb +@@ -1362,7 +1362,7 @@ static inline void rt2x00lib_set_if_comb */ if_limit = &rt2x00dev->if_limits_ap; if_limit->max = rt2x00dev->ops->max_ap_intf; diff --git a/package/kernel/mac80211/patches/rt2x00/994-rt2x00-import-support-for-external-LNA-on-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/994-rt2x00-import-support-for-external-LNA-on-MT7620.patch index 634b677722f..3e48eab5d20 100644 --- a/package/kernel/mac80211/patches/rt2x00/994-rt2x00-import-support-for-external-LNA-on-MT7620.patch +++ b/package/kernel/mac80211/patches/rt2x00/994-rt2x00-import-support-for-external-LNA-on-MT7620.patch @@ -27,7 +27,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -304,6 +304,24 @@ static void rt2800_rf_write(struct rt2x0 +@@ -305,6 +305,24 @@ static void rt2800_rf_write(struct rt2x0 mutex_unlock(&rt2x00dev->csr_mutex); } @@ -52,67 +52,27 @@ Signed-off-by: Daniel Golle static const unsigned int rt2800_eeprom_map[EEPROM_WORD_COUNT] = { [EEPROM_CHIP_ID] = 0x0000, [EEPROM_VERSION] = 0x0001, -@@ -4469,6 +4487,29 @@ static void rt2800_config_channel(struct - 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 -+ */ -+ } - } +@@ -10407,8 +10425,10 @@ static void rt2800_calibration_rt6352(st + u32 reg; - bbp = rt2800_bbp_read(rt2x00dev, 4); -@@ -10581,6 +10622,7 @@ static void rt2800_init_rfcsr_6352(struc - rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); - rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); + if (rt2x00_has_cap_external_pa(rt2x00dev) || +- rt2x00_has_cap_external_lna_bg(rt2x00dev)) ++ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { ++ rt6352_enable_pa_pin(rt2x00dev, 0); + rt2800_restore_rf_bbp_rt6352(rt2x00dev); ++ } -+ rt6352_enable_pa_pin(rt2x00dev, 0); rt2800_r_calibration(rt2x00dev); rt2800_rf_self_txdc_cal(rt2x00dev); - rt2800_rxdcoc_calibration(rt2x00dev); -@@ -10588,6 +10630,22 @@ static void rt2800_init_rfcsr_6352(struc - rt2800_bw_filter_calibration(rt2x00dev, false); - rt2800_loft_iq_calibration(rt2x00dev); - rt2800_rxiq_calibration(rt2x00dev); +@@ -10426,6 +10446,8 @@ static void rt2800_calibration_rt6352(st + !rt2x00_has_cap_external_lna_bg(rt2x00dev)) + return; + + rt6352_enable_pa_pin(rt2x00dev, 1); + -+ if (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); -+ 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. -+ */ -+ } - } - - static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) + if (rt2x00_has_cap_external_pa(rt2x00dev)) { + reg = rt2800_register_read(rt2x00dev, RF_CONTROL3); + reg |= 0x00000101; --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h @@ -28,6 +28,7 @@ @@ -123,7 +83,7 @@ Signed-off-by: Daniel Golle #include #include -@@ -1024,6 +1025,11 @@ struct rt2x00_dev { +@@ -1027,6 +1028,11 @@ struct rt2x00_dev { /* Clock for System On Chip devices. */ struct clk *clk; diff --git a/package/kernel/mac80211/patches/rt2x00/996-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch b/package/kernel/mac80211/patches/rt2x00/996-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch index 4b3e549109d..0f699f5e18b 100644 --- a/package/kernel/mac80211/patches/rt2x00/996-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch +++ b/package/kernel/mac80211/patches/rt2x00/996-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800.h +++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h -@@ -1044,6 +1044,11 @@ +@@ -1056,6 +1056,11 @@ #define MIMO_PS_CFG_RX_STBY_POL FIELD32(0x00000010) #define MIMO_PS_CFG_RX_RX_STBY0 FIELD32(0x00000020) @@ -14,7 +14,7 @@ */ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -3778,14 +3778,16 @@ static void rt2800_config_channel_rf7620 +@@ -3836,14 +3836,16 @@ static void rt2800_config_channel_rf7620 rt2x00_set_field8(&rfcsr, RFCSR19_K, rf->rf4); rt2800_rfcsr_write(rt2x00dev, 19, rfcsr); @@ -39,7 +39,7 @@ rfcsr = rt2800_rfcsr_read(rt2x00dev, 1); rt2x00_set_field8(&rfcsr, RFCSR1_TX2_EN_MT7620, -@@ -3819,18 +3821,23 @@ static void rt2800_config_channel_rf7620 +@@ -3877,18 +3879,23 @@ static void rt2800_config_channel_rf7620 rt2800_rfcsr_write_dccal(rt2x00dev, 59, 0x20); } @@ -73,7 +73,7 @@ if (!test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) { if (conf_is_ht40(conf)) { -@@ -3929,25 +3936,29 @@ static void rt2800_config_alc(struct rt2 +@@ -4002,25 +4009,29 @@ static void rt2800_config_alc_rt6352(str if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY))) rt2x00_warn(rt2x00dev, "RF busy while configuring ALC\n"); @@ -121,7 +121,17 @@ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, mac_sys_ctrl); rt2800_vco_calibration(rt2x00dev); -@@ -6011,18 +6022,33 @@ static int rt2800_init_registers(struct +@@ -4513,7 +4524,8 @@ static void rt2800_config_channel(struct + if (rt2x00_rt(rt2x00dev, RT6352)) { + /* BBP for GLRT BW */ + bbp = conf_is_ht40(conf) ? +- 0x10 : rt2x00_has_cap_external_lna_bg(rt2x00dev) ? ++ 0x10 : !rt2x00_has_cap_external_lna_bg(rt2x00dev) ? ++ 0x1a : rt2800_hw_get_chippkg(rt2x00dev) == 1 ? + 0x15 : 0x1a; + rt2800_bbp_glrt_write(rt2x00dev, 141, bbp); + +@@ -6017,18 +6029,33 @@ static int rt2800_init_registers(struct } else if (rt2x00_rt(rt2x00dev, RT5350)) { rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404); } else if (rt2x00_rt(rt2x00dev, RT6352)) { @@ -167,7 +177,7 @@ reg = rt2800_register_read(rt2x00dev, TX_ALC_CFG_1); rt2x00_set_field32(®, TX_ALC_CFG_1_ROS_BUSY_EN, 0); rt2800_register_write(rt2x00dev, TX_ALC_CFG_1, reg); -@@ -7127,14 +7153,16 @@ static void rt2800_init_bbp_6352(struct +@@ -7141,14 +7168,16 @@ static void rt2800_init_bbp_6352(struct rt2800_bbp_write(rt2x00dev, 188, 0x00); rt2800_bbp_write(rt2x00dev, 189, 0x00); @@ -192,7 +202,27 @@ /* BBP for G band GLRT function (BBP_128 ~ BBP_221) */ rt2800_bbp_glrt_write(rt2x00dev, 0, 0x00); -@@ -10406,31 +10434,36 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10381,6 +10410,9 @@ static void rt2800_restore_rf_bbp_rt6352 + rt2800_register_write(rt2x00dev, RF_BYPASS3, 0x0); + } + ++ if (rt2800_hw_get_chippkg(rt2x00dev) != 1) ++ return; ++ + if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { + rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16); + rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x23); +@@ -10458,6 +10490,9 @@ static void rt2800_calibration_rt6352(st + rt2800_register_write(rt2x00dev, RF_BYPASS3, reg); + } + ++ if (rt2800_hw_get_chippkg(rt2x00dev) != 1) ++ return; ++ + if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { + rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66); + rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20); +@@ -10548,31 +10583,36 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write(rt2x00dev, 42, 0x5B); rt2800_rfcsr_write(rt2x00dev, 43, 0x00); @@ -254,7 +284,7 @@ /* Initialize RF channel register to default value */ rt2800_rfcsr_write_chanreg(rt2x00dev, 0, 0x03); -@@ -10496,63 +10529,71 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10638,63 +10678,71 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_bank(rt2x00dev, 6, 45, 0xC5); @@ -288,33 +318,6 @@ - rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6B); - rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xF7); - rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x09); -- -- rt2800_rfcsr_write_chanreg(rt2x00dev, 10, 0x51); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x06); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 19, 0xA7); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 28, 0x2C); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x64); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 8, 0x51); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 9, 0x36); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 11, 0x53); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16); -- -- 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, 59, 0x6B); -- -- /* Initialize RF channel register for DRQFN */ -- rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0xD3); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0xE3); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0xE5); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x28); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x68); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xF7); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x02); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xC7); + if (rt2800_hw_get_chipver(rt2x00dev) > 1) { + rt2800_rfcsr_write_chanreg(rt2x00dev, 9, 0x47); + rt2800_rfcsr_write_chanreg(rt2x00dev, 10, 0x71); @@ -347,7 +350,16 @@ + rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xF7); + rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x09); + } -+ + +- rt2800_rfcsr_write_chanreg(rt2x00dev, 10, 0x51); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x06); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 19, 0xA7); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 28, 0x2C); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x64); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 8, 0x51); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 9, 0x36); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 11, 0x53); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16); + if (rt2800_hw_get_chipver(rt2x00dev) > 1 && + rt2800_hw_get_chipeco(rt2x00dev) >= 2) { + rt2800_rfcsr_write_chanreg(rt2x00dev, 10, 0x51); @@ -367,7 +379,23 @@ + rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x66); + rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6B); + } -+ + +- 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, 59, 0x6B); +- +- /* Initialize RF channel register for DRQFN */ +- rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0xD3); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0xE3); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0xE5); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x28); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x68); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xF7); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x02); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xC7); + if (rt2800_hw_get_chippkg(rt2x00dev) == 0 && + rt2800_hw_get_chipver(rt2x00dev) == 1) { + /* Initialize RF channel register for DRQFN */ @@ -383,7 +411,7 @@ /* Initialize RF DC calibration register to default value */ rt2800_rfcsr_write_dccal(rt2x00dev, 0, 0x47); -@@ -10615,12 +10656,17 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10757,12 +10805,17 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 62, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 63, 0x00); @@ -404,5 +432,5 @@ + rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); + } - rt6352_enable_pa_pin(rt2x00dev, 0); - rt2800_r_calibration(rt2x00dev); + /* Do calibration and init PA/LNA */ + rt2800_calibration_rt6352(rt2x00dev); 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 deleted file mode 100644 index 1eb5ee8aa0f..00000000000 --- a/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch +++ /dev/null @@ -1,413 +0,0 @@ -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. -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 | 306 ++++++++++-------- - drivers/net/wireless/ralink/rt2x00/rt2x00.h | 6 + - 2 files changed, 182 insertions(+), 130 deletions(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -3881,14 +3881,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, -@@ -4457,89 +4449,63 @@ 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); - } - - bbp = rt2800_bbp_read(rt2x00dev, 4); -@@ -5649,43 +5615,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 +8579,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))) -@@ -10686,30 +10615,143 @@ 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 rt2800_init_palna_rt6352(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 rt2800_restore_rf_bbp_rt6352(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); -+ } -+} -+ -+static void rt2800_calibration_rt6352(struct rt2x00_dev *rt2x00dev) -+{ -+ if (rt2x00_has_cap_external_pa(rt2x00dev) || -+ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { -+ rt6352_enable_pa_pin(rt2x00dev, 0); -+ rt2800_restore_rf_bbp_rt6352(rt2x00dev); -+ } -+ -+ 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); -+ -+ /* 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); -+ rt2800_init_palna_rt6352(rt2x00dev); - } - } - -@@ -10802,6 +10844,10 @@ int rt2800_enable_radio(struct rt2x00_de - rt2800_init_bbp(rt2x00dev); - rt2800_init_rfcsr(rt2x00dev); - -+ /* Do calibration and init PA/LNA for RT6352 */ -+ if (rt2x00_rt(rt2x00dev, RT6352)) -+ rt2800_calibration_rt6352(rt2x00dev); -+ - if (rt2x00_is_usb(rt2x00dev) && - (rt2x00_rt(rt2x00dev, RT3070) || - rt2x00_rt(rt2x00dev, RT3071) || ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h -@@ -1272,6 +1272,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); From fbe48e99bdfd076d0355f2cbf400548031be03dc Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Thu, 9 Nov 2023 12:42:09 +0800 Subject: [PATCH 19/50] mac80211: rt2x00: correct wrong BBP register in RxDCOC calibration This fix can reduce the total calibration time from 6 seconds to 1 second. Signed-off-by: Shiji Yang --- ...ect-wrong-BBP-register-in-RxDCOC-cal.patch | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 package/kernel/mac80211/patches/rt2x00/101-wifi-rt2x00-correct-wrong-BBP-register-in-RxDCOC-cal.patch diff --git a/package/kernel/mac80211/patches/rt2x00/101-wifi-rt2x00-correct-wrong-BBP-register-in-RxDCOC-cal.patch b/package/kernel/mac80211/patches/rt2x00/101-wifi-rt2x00-correct-wrong-BBP-register-in-RxDCOC-cal.patch new file mode 100644 index 00000000000..253d1d9c196 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/101-wifi-rt2x00-correct-wrong-BBP-register-in-RxDCOC-cal.patch @@ -0,0 +1,26 @@ +From: Shiji Yang +Date: Thu, 9 Nov 2023 12:01:18 +0800 +Subject: [PATCH] wifi: rt2x00: correct wrong BBP register in RxDCOC + calibration + +Refer to Mediatek vendor driver RxDCOC_Calibration() function, when +performing gainfreeze calibration, we should write register 140 +instead of 141. This fix can reduce the total calibration time from +6 seconds to 1 second. + +Signed-off-by: Shiji Yang +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -8711,7 +8711,7 @@ static void rt2800_rxdcoc_calibration(st + rt2800_rfcsr_write_bank(rt2x00dev, 5, 4, saverfb5r4); + rt2800_rfcsr_write_bank(rt2x00dev, 7, 4, saverfb7r4); + +- rt2800_bbp_write(rt2x00dev, 158, 141); ++ rt2800_bbp_write(rt2x00dev, 158, 140); + bbpreg = rt2800_bbp_read(rt2x00dev, 159); + bbpreg = bbpreg & (~0x40); + rt2800_bbp_write(rt2x00dev, 159, bbpreg); From b522da5b16c7e5952d364b933b921786198f9fe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Thu, 15 Jun 2023 16:11:26 +0200 Subject: [PATCH 20/50] scan.mk: do not silence output of dump phase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make it easier to spot currently hidden issues: $ make defconfig V=sc ... Collecting target info: target/linux/airohabash: -c: line 1: syntax error near unexpected token `|' bash: -c: line 1: `echo 1686815253 | staging_dir/host/bin/mkhash md5 | cut -b1-8' bash: -c: line 1: syntax error near unexpected token `|' bash: -c: line 1: `echo 1686815253 | staging_dir/host/bin/mkhash md5 | sed -E 's/(.{8})(.{4})(.{4})(.{4})(.{10})../\1-\2-\3-\4-\500/'' ... Signed-off-by: Petr Štetiar --- include/scan.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/scan.mk b/include/scan.mk index 33a5832ff5f..2e0ee0c9609 100644 --- a/include/scan.mk +++ b/include/scan.mk @@ -50,7 +50,8 @@ define PackageDir $$(call progress,Collecting $(SCAN_NAME) info: $(SCAN_DIR)/$(2)) \ echo Source-Makefile: $(SCAN_DIR)/$(2)/Makefile; \ $(if $(3),echo Override: $(3),true); \ - $(NO_TRACE_MAKE) --no-print-dir -r DUMP=1 FEED="$(call feedname,$(2))" -C $(SCAN_DIR)/$(2) $(SCAN_MAKEOPTS) 2>/dev/null || { \ + $(if $(findstring c,$(OPENWRT_VERBOSE)),$(MAKE),$(NO_TRACE_MAKE) --no-print-dir) -r DUMP=1 FEED="$(call feedname,$(2))" -C $(SCAN_DIR)/$(2) $(SCAN_MAKEOPTS) \ + $(if $(findstring c,$(OPENWRT_VERBOSE)),,2>/dev/null) || { \ mkdir -p "$(TOPDIR)/logs/$(SCAN_DIR)/$(2)"; \ $(NO_TRACE_MAKE) --no-print-dir -r DUMP=1 FEED="$(call feedname,$(2))" -C $(SCAN_DIR)/$(2) $(SCAN_MAKEOPTS) > $(TOPDIR)/logs/$(SCAN_DIR)/$(2)/dump.txt 2>&1; \ $$(call progress,ERROR: please fix $(SCAN_DIR)/$(2)/Makefile - see logs/$(SCAN_DIR)/$(2)/dump.txt for details\n) \ From 8fc496be860192f8bd1f16913657626014c8863f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Thu, 15 Jun 2023 16:11:27 +0200 Subject: [PATCH 21/50] treewide: fix shell errors during dump stage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes following issues: bash: -c: line 1: `echo 1686820180 | /staging_dir/host/bin/mkhash md5 | cut -b1-8' bash: -c: line 1: `echo 1686820180 | /staging_dir/host/bin/mkhash md5 | sed -E 's/(.{8})(.{4})(.{4})(.{4})(.{10})../\1-\2-\3-\4-\500/'' bash: -c: line 1: syntax error near unexpected token `|' bash: line 1: *1024*1024: syntax error: operand expected (error token is "*1024*1024") bash: line 1: (64 + ): syntax error: operand expected (error token is ")") expr: syntax error: missing argument after '+' Signed-off-by: Petr Štetiar --- include/image.mk | 4 ++++ target/linux/layerscape/image/Makefile | 3 +++ target/linux/mediatek/image/filogic.mk | 2 ++ target/linux/mediatek/image/mt7622.mk | 2 ++ target/linux/mediatek/image/mt7623.mk | 4 ++++ 5 files changed, 15 insertions(+) diff --git a/include/image.mk b/include/image.mk index 9736e4e1642..4ebff2e9ae0 100644 --- a/include/image.mk +++ b/include/image.mk @@ -40,8 +40,10 @@ IMG_PREFIX_VERCODE:=$(if $(CONFIG_VERSION_CODE_FILENAMES),$(call sanitize,$(VERS IMG_PREFIX:=$(VERSION_DIST_SANITIZED)-$(IMG_PREFIX_VERNUM)$(IMG_PREFIX_VERCODE)$(IMG_PREFIX_EXTRA)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET)) IMG_ROOTFS:=$(IMG_PREFIX)-rootfs IMG_COMBINED:=$(IMG_PREFIX)-combined +ifeq ($(DUMP),) IMG_PART_SIGNATURE:=$(shell echo $(SOURCE_DATE_EPOCH)$(LINUX_VERMAGIC) | $(MKHASH) md5 | cut -b1-8) IMG_PART_DISKGUID:=$(shell echo $(SOURCE_DATE_EPOCH)$(LINUX_VERMAGIC) | $(MKHASH) md5 | sed -E 's/(.{8})(.{4})(.{4})(.{4})(.{10})../\1-\2-\3-\4-\500/') +endif MKFS_DEVTABLE_OPT := -D $(INCLUDE_DIR)/device_table.txt @@ -167,7 +169,9 @@ define Image/pad-to mv $(1).new $(1) endef +ifeq ($(DUMP),) ROOTFS_PARTSIZE=$(shell echo $$(($(CONFIG_TARGET_ROOTFS_PARTSIZE)*1024*1024))) +endif define Image/pad-root-squashfs $(call Image/pad-to,$(KDIR)/root.squashfs,$(if $(1),$(1),$(ROOTFS_PARTSIZE))) diff --git a/target/linux/layerscape/image/Makefile b/target/linux/layerscape/image/Makefile index dfbda85b365..f2ac9b6f048 100644 --- a/target/linux/layerscape/image/Makefile +++ b/target/linux/layerscape/image/Makefile @@ -8,8 +8,11 @@ include $(INCLUDE_DIR)/image.mk LS_SD_KERNELPART_SIZE = 40 LS_SD_KERNELPART_OFFSET = 16 LS_SD_ROOTFSPART_OFFSET = 64 + +ifeq ($(DUMP),) LS_SD_IMAGE_SIZE = $(shell echo $$((($(LS_SD_ROOTFSPART_OFFSET) + \ $(CONFIG_TARGET_ROOTFS_PARTSIZE))))) +endif # The limitation of flash sysupgrade.bin is 1MB dtb + 16MB kernel + 32MB rootfs LS_SYSUPGRADE_IMAGE_SIZE = 49m diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 4ce9b7f2ba1..0ef3e945756 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -192,7 +192,9 @@ define Device/bananapi_bpi-r3 pad-to 64M | append-image squashfs-sysupgrade.itb | check-size |\ ) \ gzip +ifeq ($(DUMP),) IMAGE_SIZE := $$(shell expr 64 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m +endif KERNEL := kernel-bin | gzip KERNEL_INITRAMFS := kernel-bin | lzma | \ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk index 85776ef6d95..e362e7428bd 100644 --- a/target/linux/mediatek/image/mt7622.mk +++ b/target/linux/mediatek/image/mt7622.mk @@ -107,7 +107,9 @@ define Device/bananapi_bpi-r64 pad-to 46080k | append-image squashfs-sysupgrade.itb | check-size |\ ) \ gzip +ifeq ($(DUMP),) IMAGE_SIZE := $$(shell expr 45 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m +endif KERNEL := kernel-bin | gzip KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb with-initrd | pad-to 128k IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb external-static-with-rootfs | append-metadata diff --git a/target/linux/mediatek/image/mt7623.mk b/target/linux/mediatek/image/mt7623.mk index 5828c4d763d..2c4402da661 100644 --- a/target/linux/mediatek/image/mt7623.mk +++ b/target/linux/mediatek/image/mt7623.mk @@ -96,7 +96,9 @@ define Device/bananapi_bpi-r2 KERNEL := kernel-bin | gzip KERNEL_INITRAMFS_SUFFIX := -recovery.itb KERNEL_INITRAMFS := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb with-initrd +ifeq ($(DUMP),) IMAGE_SIZE := $$(shell expr 48 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m +endif IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb external-static-with-rootfs | append-metadata ARTIFACT/preloader.bin := mt7623-mbr emmc |\ pad-to 2k | append-preloader $$(UBOOT_TARGET) @@ -130,7 +132,9 @@ define Device/unielec_u7623-02 UBOOT_TARGET := mt7623a_unielec_u7623 UBOOT_IMAGE := u-boot-mtk.bin UBOOT_PATH := $(STAGING_DIR_IMAGE)/$$(UBOOT_TARGET)-$$(UBOOT_IMAGE) +ifeq ($(DUMP),) IMAGE_SIZE := $$(shell expr 48 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m +endif IMAGES := sysupgrade.itb KERNEL := kernel-bin | gzip KERNEL_INITRAMFS_SUFFIX := -recovery.itb From 9b4628eaee74632120a3647f49cee3b7cc047ee7 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 12 Nov 2023 20:23:19 +0100 Subject: [PATCH 22/50] Revert "qca-ssdk: fix unsupported scenario with PORT1 not declared in switch bmp" This reverts commit 8cce00bc9dddc3fc47d63625b0f512693c27ce2f. The confusion was real and this change cause regression on other advanced devices that makes actual use of the first_phy_addr value. Signed-off-by: Christian Marangi --- package/kernel/qca-ssdk/Makefile | 2 +- ...ibu-phy-drop-usage-of-first_phy_addr.patch | 264 ------------------ 2 files changed, 1 insertion(+), 265 deletions(-) delete mode 100644 package/kernel/qca-ssdk/patches/100-malibu-phy-drop-usage-of-first_phy_addr.patch diff --git a/package/kernel/qca-ssdk/Makefile b/package/kernel/qca-ssdk/Makefile index 4107208c0eb..f5d82605034 100644 --- a/package/kernel/qca-ssdk/Makefile +++ b/package/kernel/qca-ssdk/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=qca-ssdk -PKG_RELEASE:=2 +PKG_RELEASE:=1 PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/qca-ssdk.git PKG_SOURCE_PROTO:=git diff --git a/package/kernel/qca-ssdk/patches/100-malibu-phy-drop-usage-of-first_phy_addr.patch b/package/kernel/qca-ssdk/patches/100-malibu-phy-drop-usage-of-first_phy_addr.patch deleted file mode 100644 index 905f1cde011..00000000000 --- a/package/kernel/qca-ssdk/patches/100-malibu-phy-drop-usage-of-first_phy_addr.patch +++ /dev/null @@ -1,264 +0,0 @@ -From 46ed8163ac0d9a11a629f1c446e8c5e711cf35d6 Mon Sep 17 00:00:00 2001 -From: Christian Marangi -Date: Sat, 11 Nov 2023 18:13:02 +0100 -Subject: [PATCH] malibu-phy: drop usage of first_phy_addr - -I'm very confused by this and to me it's not clear the real usage of -this logic. - -From what I can see the usage of this is EXTREMELY FRAGILE and results -in dangerous results if the OEM (or anyone that by chance try to -implement things in a logical manner) deviates from the default values -from the "magical template". - -To be in more details. With QSDK 12.4, some tweaks were done to improve -autoneg and now on every call of port status, the phydev is tried to -add. This resulted in the call and log spam of an error with ports that -are actually not present on the system with qsdk reporting phydev is -NULL. This itself is not an error and printing the error is correct. - -What is actually an error from ages is setting generic bitmap reporting -presence of port that are actually not present. This is very common on -OEM where the switch_lan_bmp is always a variant of 0x1e (that on bitmap -results in PORT1 PORT2 PORT3 PORT4 present) or 0x3e (PORT1 PORT2 PORT3 -PORT4 PORT5). Reality is that many device are used as AP with one LAN -port or one WAN port. (or even exotic configuration with PORT1 not -present and PORT2 PORT3 PORT4 present (Xiaomi 3600) - -With this finding one can say... ok nice, then lets update the DT and -set the correct bitmap... - -Again world is a bad place and reality is that this cause wonderful -regression in some case of by extreme luck the first ever connected -port working and the rest of the switch dead. - -The problem has been bisected to all the device that doesn't have the -PORT1 declared in any of the bitmap. - -With this perfection in mind, on to the REAL problem. - -malibu_phy_hw_init FOR SOME REASON, set a global variable first_phy_addr -to the first detected PHY addr that coincidentally is always PORT1. -PORT1 addr is 0x0. The entire code in malibu_phy use this variable to -derive the phy addrs in some function. - -Declaring a bitmap where the PORT1 is missing (or worse PORT4 the only -one connected) result in first_phy_addr set to 1 or whatever phy addr is -detected first setting wrong value all over the init stage. - -To fix this, just drop this variable and hardcode everything to assume -the first phy adrr is ALWAYS 0 and remove calculation and use define for -special case. - -With the following change normal switch traffic is restored and ports -function is recovered. - -Signed-off-by: Christian Marangi ---- - src/hsl/phy/malibu_phy.c | 63 +++++++++++++++++----------------------- - 1 file changed, 26 insertions(+), 37 deletions(-) - ---- a/src/hsl/phy/malibu_phy.c -+++ b/src/hsl/phy/malibu_phy.c -@@ -26,8 +26,9 @@ - #include "qcaphy_common.h" - #include "ssdk_plat.h" - --static a_uint32_t first_phy_addr = MAX_PHY_ADDR; - static a_uint32_t combo_phy_addr = MAX_PHY_ADDR; -+#define PORT4_PHY_ID 0x4 -+#define PORT5_PHY_ID 0x5 - #define COMBO_PHY_ID combo_phy_addr - - /****************************************************************************** -@@ -1250,10 +1251,10 @@ sw_error_t - malibu_phy_serdes_reset(a_uint32_t dev_id) - { - -- hsl_phy_mii_reg_write(dev_id, first_phy_addr + MALIBU_PHY_PSGMII_ADDR_INC, -+ hsl_phy_mii_reg_write(dev_id, MALIBU_PHY_PSGMII_ADDR_INC, - MALIBU_MODE_RESET_REG, MALIBU_MODE_CHANAGE_RESET); - mdelay(100); -- hsl_phy_mii_reg_write(dev_id, first_phy_addr + MALIBU_PHY_PSGMII_ADDR_INC, -+ hsl_phy_mii_reg_write(dev_id, MALIBU_PHY_PSGMII_ADDR_INC, - MALIBU_MODE_RESET_REG, MALIBU_MODE_RESET_DEFAULT_VALUE); - - return SW_OK; -@@ -1271,8 +1272,7 @@ malibu_phy_interface_set_mode(a_uint32_t - a_uint16_t phy_data = 0; - static fal_port_interface_mode_t phy_mode = PORT_INTERFACE_MODE_MAX; - -- if ((phy_addr < first_phy_addr) || -- (phy_addr > (first_phy_addr + MALIBU_PHY_MAX_ADDR_INC))) -+ if (phy_addr > MALIBU_PHY_MAX_ADDR_INC) - return SW_NOT_SUPPORTED; - /*if interface_mode have been configured, then no need to configure again*/ - if(phy_mode == interface_mode) -@@ -1295,20 +1295,19 @@ malibu_phy_interface_set_mode(a_uint32_t - return SW_BAD_PARAM; - } - -- hsl_phy_modify_mii(dev_id, -- first_phy_addr + MALIBU_PHY_MAX_ADDR_INC, MALIBU_PHY_CHIP_CONFIG, -+ hsl_phy_modify_mii(dev_id, MALIBU_PHY_MAX_ADDR_INC, MALIBU_PHY_CHIP_CONFIG, - BITS(0, 4), phy_data); - - /* reset operation */ - malibu_phy_serdes_reset(dev_id); - - if (interface_mode == PHY_PSGMII_FIBER) { -- hsl_phy_mii_reg_write(dev_id, first_phy_addr + MALIBU_PHY_MAX_ADDR_INC, -+ hsl_phy_mii_reg_write(dev_id, MALIBU_PHY_MAX_ADDR_INC, - MALIBU_PHY_CHIP_CONFIG, MALIBU_MODECTRL_DFLT); -- hsl_phy_mii_reg_write(dev_id, first_phy_addr + MALIBU_PHY_MAX_ADDR_INC, -+ hsl_phy_mii_reg_write(dev_id, MALIBU_PHY_MAX_ADDR_INC, - MALIBU_PHY_CONTROL, MALIBU_MIICTRL_DFLT); - hsl_phy_phydev_autoneg_update(dev_id, -- first_phy_addr + MALIBU_PHY_MAX_ADDR_INC, A_FALSE, 0); -+ MALIBU_PHY_MAX_ADDR_INC, A_FALSE, 0); - } - phy_mode = interface_mode; - SSDK_DEBUG("malibu phy is configured as phy_mode:0x%x\n", phy_mode); -@@ -1329,13 +1328,12 @@ malibu_phy_interface_get_mode(a_uint32_t - a_uint16_t phy_data; - a_uint16_t copper_mode; - -- if ((phy_addr < first_phy_addr) || -- (phy_addr > (first_phy_addr + MALIBU_PHY_MAX_ADDR_INC))) { -+ if (phy_addr > MALIBU_PHY_MAX_ADDR_INC) { - return SW_NOT_SUPPORTED; - } - - phy_data = hsl_phy_mii_reg_read(dev_id, -- first_phy_addr + MALIBU_PHY_MAX_ADDR_INC, MALIBU_PHY_CHIP_CONFIG); -+ MALIBU_PHY_MAX_ADDR_INC, MALIBU_PHY_CHIP_CONFIG); - copper_mode = ((phy_data & MALIBU_PHY_COPPER_MODE) >> 0xf); - phy_data &= 0x000f; - -@@ -1344,13 +1342,13 @@ malibu_phy_interface_get_mode(a_uint32_t - *interface_mode = PHY_PSGMII_BASET; - break; - case MALIBU_PHY_PSGMII_BX1000: -- if (phy_addr == first_phy_addr + MALIBU_PHY_MAX_ADDR_INC) -+ if (phy_addr == MALIBU_PHY_MAX_ADDR_INC) - *interface_mode = PHY_PSGMII_BX1000; - else - *interface_mode = PHY_PSGMII_BASET; - break; - case MALIBU_PHY_PSGMII_FX100: -- if (phy_addr == first_phy_addr + MALIBU_PHY_MAX_ADDR_INC) -+ if (phy_addr == MALIBU_PHY_MAX_ADDR_INC) - *interface_mode = PHY_PSGMII_FX100; - else - *interface_mode = PHY_PSGMII_BASET; -@@ -1359,14 +1357,14 @@ malibu_phy_interface_get_mode(a_uint32_t - if (copper_mode) { - *interface_mode = PHY_PSGMII_BASET; - } else { -- if (phy_addr == first_phy_addr + MALIBU_PHY_MAX_ADDR_INC) -+ if (phy_addr == MALIBU_PHY_MAX_ADDR_INC) - *interface_mode = PHY_PSGMII_FIBER; - else - *interface_mode = PHY_PSGMII_BASET; - } - break; - case MALIBU_PHY_SGMII_BASET: -- if (phy_addr == first_phy_addr + MALIBU_PHY_MAX_ADDR_INC) -+ if (phy_addr == MALIBU_PHY_MAX_ADDR_INC) - *interface_mode = PHY_SGMII_BASET; - else - *interface_mode = PORT_QSGMII; -@@ -1392,13 +1390,12 @@ malibu_phy_interface_get_mode_status(a_u - a_uint16_t phy_data, phy_mode, phy_mode_status; - a_uint16_t copper_mode; - -- if ((phy_addr < first_phy_addr) || -- (phy_addr > (first_phy_addr + MALIBU_PHY_MAX_ADDR_INC))) { -+ if (phy_addr > MALIBU_PHY_MAX_ADDR_INC) { - return SW_NOT_SUPPORTED; - } - - phy_data = hsl_phy_mii_reg_read(dev_id, -- first_phy_addr + MALIBU_PHY_MAX_ADDR_INC, MALIBU_PHY_CHIP_CONFIG); -+ MALIBU_PHY_MAX_ADDR_INC, MALIBU_PHY_CHIP_CONFIG); - copper_mode = ((phy_data & MALIBU_PHY_COPPER_MODE) >> 0xf); - phy_mode = phy_data & 0x000f; - phy_mode_status = (phy_data & 0x00f0) >> 0x4; -@@ -1407,7 +1404,7 @@ malibu_phy_interface_get_mode_status(a_u - if (copper_mode) { - *interface_mode_status = PHY_PSGMII_BASET; - } else { -- if (phy_addr == first_phy_addr + MALIBU_PHY_MAX_ADDR_INC) -+ if (phy_addr == MALIBU_PHY_MAX_ADDR_INC) - *interface_mode_status = PHY_PSGMII_FIBER; - else - *interface_mode_status = PHY_PSGMII_BASET; -@@ -1418,19 +1415,19 @@ malibu_phy_interface_get_mode_status(a_u - *interface_mode_status = PHY_PSGMII_BASET; - break; - case MALIBU_PHY_PSGMII_BX1000: -- if (phy_addr == first_phy_addr + MALIBU_PHY_MAX_ADDR_INC) -+ if (phy_addr == MALIBU_PHY_MAX_ADDR_INC) - *interface_mode_status = PHY_PSGMII_BX1000; - else - *interface_mode_status = PHY_PSGMII_BASET; - break; - case MALIBU_PHY_PSGMII_FX100: -- if (phy_addr == first_phy_addr + MALIBU_PHY_MAX_ADDR_INC) -+ if (phy_addr == MALIBU_PHY_MAX_ADDR_INC) - *interface_mode_status = PHY_PSGMII_FX100; - else - *interface_mode_status = PHY_PSGMII_BASET; - break; - case MALIBU_PHY_SGMII_BASET: -- if (phy_addr == first_phy_addr + MALIBU_PHY_MAX_ADDR_INC) -+ if (phy_addr == MALIBU_PHY_MAX_ADDR_INC) - *interface_mode_status = PHY_SGMII_BASET; - else - *interface_mode_status = PORT_QSGMII; -@@ -1795,10 +1792,6 @@ malibu_phy_hw_init(a_uint32_t dev_id, a_ - { - phy_cnt ++; - phy_addr = qca_ssdk_port_to_phy_addr(dev_id, port_id); -- if (phy_addr < first_phy_addr) -- { -- first_phy_addr = phy_addr; -- } - /*enable phy power saving function by default */ - malibu_phy_set_8023az(dev_id, phy_addr, A_TRUE); - malibu_phy_set_powersave(dev_id, phy_addr, A_TRUE); -@@ -1824,29 +1817,25 @@ malibu_phy_hw_init(a_uint32_t dev_id, a_ - MALIBU_EXTENDED_NEXT_PAGE_EN, 0); - } - } -- /* qca 8072 two ports phy chip's firstly address to init phy chip */ -- if ((phy_cnt == QCA8072_PHY_NUM) && (first_phy_addr >= 0x3)) { -- first_phy_addr = first_phy_addr - 0x3; -- } - - /*workaround to enable AZ transmitting ability*/ -- hsl_phy_mmd_reg_write(dev_id, first_phy_addr + 5, A_FALSE, MALIBU_PHY_MMD1_NUM, -+ hsl_phy_mmd_reg_write(dev_id, PORT5_PHY_ID, A_FALSE, MALIBU_PHY_MMD1_NUM, - MALIBU_PSGMII_MODE_CTRL, MALIBU_PHY_PSGMII_MODE_CTRL_ADJUST_VALUE); - - /* adjust psgmii serdes tx amp */ -- hsl_phy_mii_reg_write(dev_id, first_phy_addr + 5, -+ hsl_phy_mii_reg_write(dev_id, PORT5_PHY_ID, - MALIBU_PSGMII_TX_DRIVER_1_CTRL, MALIBU_PHY_PSGMII_REDUCE_SERDES_TX_AMP); - - /* to avoid psgmii module goes into hibernation, work with psgmii self test*/ -- hsl_phy_modify_mmd(dev_id, first_phy_addr + 4, A_FALSE, MALIBU_PHY_MMD3_NUM, -+ hsl_phy_modify_mmd(dev_id, PORT4_PHY_ID, A_FALSE, MALIBU_PHY_MMD3_NUM, - MALIBU_PHY_MMD3_ADDR_REMOTE_LOOPBACK_CTRL, BIT(1), 0); - - mode = ssdk_dt_global_get_mac_mode(dev_id, 0); - if (mode == PORT_WRAPPER_PSGMII_FIBER) -- malibu_phy_interface_set_mode(dev_id, first_phy_addr, PHY_PSGMII_FIBER); -+ malibu_phy_interface_set_mode(dev_id, 0x0, PHY_PSGMII_FIBER); - - /*init combo phy address*/ -- combo_phy_addr = first_phy_addr+4; -+ combo_phy_addr = PORT4_PHY_ID; - - return SW_OK; - } From e927456ec3d9cd7e92ba884a3065ecc303564720 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 12 Nov 2023 20:25:24 +0100 Subject: [PATCH 23/50] qca-ssdk: fix unsupported scenario with PORT1 not declared in switch bmp Commit 947b44d ("ipq807x: fix wrong define for LAN and WAN ess mask") started fixing wrong switch_lan_bmp that defined lan there weren't actually present. This displayed a fragility in the malibu phy init code in qca-ssdk. Add patch to fix this. Also update each DTS with the new required property if needed. The new binding malibu_phy_start_addr is required with devices that place the malibu first PHY referring port1 on a different PHY addres than 0. The most common configuration is 0 but some device (for example Qnap 301W) place the malibu PHY at an offset to address 16. Refer to ipq8074-ess dtsi for extensive description on how to derive this value. Quoting the patch detailed description: The usage of first_phy_addr is EXTREMELY FRAGILE and results in dangerous results if the OEM (or anyone that by chance try to implement things in a logical manner) deviates from the default values from the "magical template". To be in more details. With QSDK 12.4, some tweaks were done to improve autoneg and now on every call of port status, the phydev is tried to add. This resulted in the call and log spam of an error with ports that are actually not present on the system with qsdk reporting phydev is NULL. This itself is not an error and printing the error is correct. What is actually an error from ages is setting generic bitmap reporting presence of port that are actually not present. This is very common on OEM where the switch_lan_bmp is always a variant of 0x1e (that on bitmap results in PORT1 PORT2 PORT3 PORT4 present) or 0x3e (PORT1 PORT2 PORT3 PORT4 PORT5). Reality is that many device are used as AP with one LAN port or one WAN port. (or even exotic configuration with PORT1 not present and PORT2 PORT3 PORT4 present (Xiaomi 3600) With this finding one can say... ok nice, then lets update the DT and set the correct bitmap... Again world is a bad place and reality is that this cause wonderful regression in some case of by extreme luck the first ever connected port working and the rest of the switch dead. The problem has been bisected to all the device that doesn't have the PORT1 declared in any of the bitmap. With this prefaction in mind, on to the REAL problem. malibu_phy_hw_init FOR SOME REASON, set a global variable first_phy_addr to the first detected PHY addr that coincidentally is always PORT1. PORT1 addr is 0x0. The entire code in malibu_phy use this variable to derive the phy addrs in some function. Declaring a bitmap where the PORT1 is missing (or worse PORT4 the only one connected) result in first_phy_addr set to 1 or whatever phy addr is detected first setting wrong value all over the init stage. To fix this, introduce a new binding malibu_first_phy_addr to manually declare the first phy that the malibu PHY driver should use and permit to detach it from port bmp detection. The legacy detection is kept for compatibility reason. Fixes: #13945 Fixes: 947b44d9ae17 ("ipq807x: fix wrong define for LAN and WAN ess mask") Signed-off-by: Christian Marangi Tested-by: Robert Marko # Qnap 301W Reviewed-by: Robert Marko Signed-off-by: Christian Marangi --- package/kernel/qca-ssdk/Makefile | 2 +- ...upport-for-manual-define-of-first-ph.patch | 131 ++++++++++++++++++ .../arch/arm64/boot/dts/qcom/ipq8072-301w.dts | 1 + .../arch/arm64/boot/dts/qcom/ipq8074-ess.dtsi | 18 +++ 4 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 package/kernel/qca-ssdk/patches/100-malibu-phy-add-support-for-manual-define-of-first-ph.patch diff --git a/package/kernel/qca-ssdk/Makefile b/package/kernel/qca-ssdk/Makefile index f5d82605034..4107208c0eb 100644 --- a/package/kernel/qca-ssdk/Makefile +++ b/package/kernel/qca-ssdk/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=qca-ssdk -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/qca-ssdk.git PKG_SOURCE_PROTO:=git diff --git a/package/kernel/qca-ssdk/patches/100-malibu-phy-add-support-for-manual-define-of-first-ph.patch b/package/kernel/qca-ssdk/patches/100-malibu-phy-add-support-for-manual-define-of-first-ph.patch new file mode 100644 index 00000000000..6aaa579c09e --- /dev/null +++ b/package/kernel/qca-ssdk/patches/100-malibu-phy-add-support-for-manual-define-of-first-ph.patch @@ -0,0 +1,131 @@ +From a651d10fbd880098d7b98dee27dfd1eb15146fb2 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Sun, 12 Nov 2023 18:40:22 +0100 +Subject: [PATCH] malibu-phy: add support for manual define of first phy addr + +The usage of first_phy_addr is EXTREMELY FRAGILE and results +in dangerous results if the OEM (or anyone that by chance try to +implement things in a logical manner) deviates from the default values +from the "magical template". + +To be in more details. With QSDK 12.4, some tweaks were done to improve +autoneg and now on every call of port status, the phydev is tried to +add. This resulted in the call and log spam of an error with ports that +are actually not present on the system with qsdk reporting phydev is +NULL. This itself is not an error and printing the error is correct. + +What is actually an error from ages is setting generic bitmap reporting +presence of port that are actually not present. This is very common on +OEM where the switch_lan_bmp is always a variant of 0x1e (that on bitmap +results in PORT1 PORT2 PORT3 PORT4 present) or 0x3e (PORT1 PORT2 PORT3 +PORT4 PORT5). Reality is that many device are used as AP with one LAN +port or one WAN port. (or even exotic configuration with PORT1 not +present and PORT2 PORT3 PORT4 present (Xiaomi 3600) + +With this finding one can say... ok nice, then lets update the DT and +set the correct bitmap... + +Again world is a bad place and reality is that this cause wonderful +regression in some case of by extreme luck the first ever connected +port working and the rest of the switch dead. + +The problem has been bisected to all the device that doesn't have the +PORT1 declared in any of the bitmap. + +With this prefaction in mind, on to the REAL problem. + +malibu_phy_hw_init FOR SOME REASON, set a global variable first_phy_addr +to the first detected PHY addr that coincidentally is always PORT1. +PORT1 addr is 0x0. The entire code in malibu_phy use this variable to +derive the phy addrs in some function. + +Declaring a bitmap where the PORT1 is missing (or worse PORT4 the only +one connected) result in first_phy_addr set to 1 or whatever phy addr is +detected first setting wrong value all over the init stage. + +To fix this, introduce a new binding malibu_first_phy_addr to manually +declare the first phy that the malibu PHY driver should use and permit +to detach it from port bmp detection. The legacy detection is kept for +compatibility reason. + +Signed-off-by: Christian Marangi +--- + include/init/ssdk_dts.h | 1 + + include/init/ssdk_init.h | 2 ++ + src/hsl/phy/malibu_phy.c | 5 +++++ + src/init/ssdk_dts.c | 15 +++++++++++++++ + 4 files changed, 23 insertions(+) + +--- a/include/init/ssdk_dts.h ++++ b/include/init/ssdk_dts.h +@@ -146,6 +146,7 @@ a_uint32_t ssdk_wan_bmp_get(a_uint32_t d + sw_error_t ssdk_lan_bmp_set(a_uint32_t dev_id, a_uint32_t lan_bmp); + sw_error_t ssdk_wan_bmp_set(a_uint32_t dev_id, a_uint32_t wan_bmp); + a_uint32_t ssdk_inner_bmp_get(a_uint32_t dev_id); ++a_uint32_t ssdk_malibu_first_phy_addr_get(a_uint32_t dev_id); + hsl_reg_mode ssdk_switch_reg_access_mode_get(a_uint32_t dev_id); + void ssdk_switch_reg_map_info_get(a_uint32_t dev_id, ssdk_reg_map_info *info); + a_uint32_t ssdk_switch_pcie_base_get(a_uint32_t dev_id); +--- a/include/init/ssdk_init.h ++++ b/include/init/ssdk_init.h +@@ -194,6 +194,7 @@ enum ssdk_port_wrapper_cfg { + a_uint32_t lan_bmp; + a_uint32_t wan_bmp; + a_uint32_t inner_bmp; ++ a_uint32_t malibu_first_phy_addr; + } ssdk_port_cfg; + + typedef struct +@@ -384,6 +385,7 @@ ssdk_hsl_access_mode_set(a_uint32_t dev_ + + a_uint32_t ssdk_dt_global_get_mac_mode(a_uint32_t dev_id, a_uint32_t index); + a_uint32_t ssdk_dt_global_set_mac_mode(a_uint32_t dev_id, a_uint32_t index, a_uint32_t mode); ++a_uint32_t ssdk_malibu_first_phy_addr_get(a_uint32_t dev_id); + + a_uint32_t + qca_hppe_port_mac_type_get(a_uint32_t dev_id, a_uint32_t port_id); +--- a/src/hsl/phy/malibu_phy.c ++++ b/src/hsl/phy/malibu_phy.c +@@ -1945,6 +1945,11 @@ static int malibu_phy_api_ops_init(void) + int malibu_phy_init(a_uint32_t dev_id, a_uint32_t port_bmp) + { + static a_uint32_t phy_ops_flag = 0; ++ a_uint32_t malibu_first_phy_addr; ++ ++ malibu_first_phy_addr = ssdk_malibu_first_phy_addr_get(dev_id); ++ if (malibu_first_phy_addr != MAX_PHY_ADDR) ++ first_phy_addr = malibu_first_phy_addr; + + if(phy_ops_flag == 0) { + malibu_phy_api_ops_init(); +--- a/src/init/ssdk_dts.c ++++ b/src/init/ssdk_dts.c +@@ -186,6 +186,13 @@ a_uint32_t ssdk_inner_bmp_get(a_uint32_t + return cfg->port_cfg.inner_bmp; + } + ++a_uint32_t ssdk_malibu_first_phy_addr_get(a_uint32_t dev_id) ++{ ++ ssdk_dt_cfg* cfg = ssdk_dt_global.ssdk_dt_switch_nodes[dev_id]; ++ ++ return cfg->port_cfg.malibu_first_phy_addr; ++} ++ + hsl_reg_mode ssdk_switch_reg_access_mode_get(a_uint32_t dev_id) + { + ssdk_dt_cfg* cfg = ssdk_dt_global.ssdk_dt_switch_nodes[dev_id]; +@@ -1039,6 +1046,14 @@ static void ssdk_dt_parse_port_bmp(a_uin + cfg->port_cfg.inner_bmp; + } + ++ /* Permit to manually declare start phy addr for malibu PHY. If not found set to legacy detection. */ ++ if (!of_property_read_u32(switch_node, "malibu_first_phy_addr", &cfg->port_cfg.malibu_first_phy_addr)) { ++ ssdk_dt_global.ssdk_dt_switch_nodes[dev_id]->port_cfg.malibu_first_phy_addr = ++ cfg->port_cfg.malibu_first_phy_addr; ++ } else { ++ ssdk_dt_global.ssdk_dt_switch_nodes[dev_id]->port_cfg.malibu_first_phy_addr = MAX_PHY_ADDR; ++ } ++ + ssdk_dt_global.ssdk_dt_switch_nodes[dev_id]->port_cfg.cpu_bmp = cfg->port_cfg.cpu_bmp; + ssdk_dt_global.ssdk_dt_switch_nodes[dev_id]->port_cfg.lan_bmp = cfg->port_cfg.lan_bmp; + ssdk_dt_global.ssdk_dt_switch_nodes[dev_id]->port_cfg.wan_bmp = cfg->port_cfg.wan_bmp; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts index ce82f24ae8a..6c7ec2e588f 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts @@ -323,6 +323,7 @@ switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4 | ESS_PORT5)>; /* lan port bitmap */ switch_wan_bmp = ; /* wan port bitmap */ + malibu_first_phy_addr = <16>; /* PHY addr of the first malibu PHY */ switch_mac_mode = <0xb>; /* mac mode for uniphy instance0*/ switch_mac_mode1 = <0xd>; /* mac mode for uniphy instance1*/ switch_mac_mode2 = <0xd>; /* mac mode for uniphy instance2*/ diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-ess.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-ess.dtsi index 597f7f1ff98..f0c1efce9ed 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-ess.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-ess.dtsi @@ -23,6 +23,24 @@ switch_access_mode = "local bus"; switch_cpu_bmp = ; /* cpu port bitmap */ switch_inner_bmp = ; /*inner port bitmap*/ + /* This is a special binding that controls how the malibu PHY are + * init. This value reflect the PHY addr of the first malibu PHY. + * Malibu PHY are in a bundle of 5 PHY. + * Some device might have some port not connected. + * SSDK still needs the addrs of the first PHY (even if not connected) + * to correctly setup the malibu PHY. + * + * This is needed as previously SSDK based this on the port bmp, but + * this can be problematic now that we specify correct bmp. + * + * Most common configuration have the malibu PHY placed at 0. + * But some device might have it placed at address 16. + * To drive the correct value, check the port id of the malibu PHY + * and try to understand what is the first one in devices where some + * port are missing. port_phyinfo is normally the way to go to derive + * this value in the few special cases. + */ + malibu_first_phy_addr = <0>; clocks = <&gcc GCC_CMN_12GPLL_AHB_CLK>, <&gcc GCC_CMN_12GPLL_SYS_CLK>, <&gcc GCC_UNIPHY0_AHB_CLK>, From 5ddebb5fd9aa94a70629ff3708a281cf039f7eea Mon Sep 17 00:00:00 2001 From: Hannu Nyman Date: Sun, 12 Nov 2023 20:34:45 +0200 Subject: [PATCH 24/50] devel/gdb: Disable libzstd explicitly New gdb has got libzstd support, and libzstd gets detected at buildbot build. Explicitly disable it to avoid dependency. Fixes: f79de8ec65 ("gdb: Update to 13.2") Signed-off-by: Hannu Nyman --- package/devel/gdb/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/devel/gdb/Makefile b/package/devel/gdb/Makefile index 20a40eb8bbe..3efbce28f40 100644 --- a/package/devel/gdb/Makefile +++ b/package/devel/gdb/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gdb PKG_VERSION:=13.2 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/gdb @@ -58,6 +58,7 @@ CONFIGURE_ARGS+= \ --with-system-zlib \ --without-expat \ --without-lzma \ + --without-zstd \ --disable-unit-tests \ --disable-ubsan \ --disable-sim \ From 4e268803d0d82b3b67946e77d6bd361a91c1fd82 Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Mon, 25 Sep 2023 23:40:02 +0800 Subject: [PATCH 25/50] linux-firmware: add Realtek RTL8723DE/RTL8821CE firmware This adds packages for the Realtek RTL8723DE/RTL8821CE firmware to be used with the rtw88 driver. Signed-off-by: Chukun Pan --- package/firmware/linux-firmware/realtek.mk | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/package/firmware/linux-firmware/realtek.mk b/package/firmware/linux-firmware/realtek.mk index 6d9238b8a43..4a3b6cd28a3 100644 --- a/package/firmware/linux-firmware/realtek.mk +++ b/package/firmware/linux-firmware/realtek.mk @@ -86,6 +86,13 @@ define Package/rtl8723bu-firmware/install endef $(eval $(call BuildPackage,rtl8723bu-firmware)) +Package/rtl8723de-firmware = $(call Package/firmware-default,RealTek RTL8723DE firmware) +define Package/rtl8723de-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/rtw88 + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtw88/rtw8723d_fw.bin $(1)/lib/firmware/rtw88 +endef +$(eval $(call BuildPackage,rtl8723de-firmware)) + Package/rtl8761a-firmware = $(call Package/firmware-default,RealTek RTL8761A firmware) define Package/rtl8761a-firmware/install $(INSTALL_DIR) $(1)/lib/firmware/rtl_bt @@ -117,6 +124,13 @@ define Package/rtl8821ae-firmware/install endef $(eval $(call BuildPackage,rtl8821ae-firmware)) +Package/rtl8821ce-firmware = $(call Package/firmware-default,RealTek RTL8821CE firmware) +define Package/rtl8821ce-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/rtw88 + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtw88/rtw8821c_fw.bin $(1)/lib/firmware/rtw88 +endef +$(eval $(call BuildPackage,rtl8821ce-firmware)) + Package/rtl8822be-firmware = $(call Package/firmware-default,RealTek RTL8822BE firmware) define Package/rtl8822be-firmware/install $(INSTALL_DIR) $(1)/lib/firmware/rtw88 From 083a096390b36b295aa71de84e8c957eb3d0e2ca Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Tue, 26 Sep 2023 23:03:28 +0800 Subject: [PATCH 26/50] linux-firmware: add Realtek RTW89 firmware This is the firmware required for the rtw89 driver. Signed-off-by: Chukun Pan --- package/firmware/linux-firmware/realtek.mk | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/package/firmware/linux-firmware/realtek.mk b/package/firmware/linux-firmware/realtek.mk index 4a3b6cd28a3..b4880b6a7f2 100644 --- a/package/firmware/linux-firmware/realtek.mk +++ b/package/firmware/linux-firmware/realtek.mk @@ -145,3 +145,32 @@ define Package/rtl8822ce-firmware/install $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtw88/rtw8822c_wow_fw.bin $(1)/lib/firmware/rtw88 endef $(eval $(call BuildPackage,rtl8822ce-firmware)) + +Package/rtl8851be-firmware = $(call Package/firmware-default,RealTek RTL8851BE firmware) +define Package/rtl8851be-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/rtw89 + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtw89/rtw8851b_fw.bin $(1)/lib/firmware/rtw89 +endef +$(eval $(call BuildPackage,rtl8851be-firmware)) + +Package/rtl8852ae-firmware = $(call Package/firmware-default,RealTek RTL8852AE firmware) +define Package/rtl8852ae-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/rtw89 + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtw89/rtw8852a_fw.bin $(1)/lib/firmware/rtw89 +endef +$(eval $(call BuildPackage,rtl8852ae-firmware)) + +Package/rtl8852be-firmware = $(call Package/firmware-default,RealTek RTL8852BE firmware) +define Package/rtl8852be-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/rtw89 + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtw89/rtw8852b_fw.bin $(1)/lib/firmware/rtw89 + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtw89/rtw8852b_fw-1.bin $(1)/lib/firmware/rtw89 +endef +$(eval $(call BuildPackage,rtl8852be-firmware)) + +Package/rtl8852ce-firmware = $(call Package/firmware-default,RealTek RTL8852CE firmware) +define Package/rtl8852ce-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/rtw89 + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtw89/rtw8852c_fw.bin $(1)/lib/firmware/rtw89 +endef +$(eval $(call BuildPackage,rtl8852ce-firmware)) From 16cff054f108f7c7747a0bf9da1d3fb9211012b8 Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Mon, 13 Nov 2023 22:18:06 +0800 Subject: [PATCH 27/50] mac80211: realtek: fix rtw88 driver dependencies The RTW88 PCI/USB driver uses the same firmware, so add firmware dependencies. Also CI report that: Package kmod-rtw88-usb is missing dependencies for the following libraries: usbcore.ko This commit fixes it. Fixes: 3538a19 ("mac80211: split rtw88 configuration for each supported chip") Signed-off-by: Chukun Pan --- package/kernel/mac80211/realtek.mk | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package/kernel/mac80211/realtek.mk b/package/kernel/mac80211/realtek.mk index 48109b94b2a..0fc9fb0e6da 100644 --- a/package/kernel/mac80211/realtek.mk +++ b/package/kernel/mac80211/realtek.mk @@ -196,7 +196,7 @@ endef define KernelPackage/rtw88-usb $(call KernelPackage/mac80211/Default) TITLE:=Realtek RTW88 USB chips support - DEPENDS+= @USB_SUPPORT +kmod-rtw88 + DEPENDS+= @USB_SUPPORT +kmod-rtw88 +kmod-usb-core FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_usb.ko AUTOLOAD:=$(call AutoProbe,rtw88_usb) HIDDEN:=1 @@ -205,7 +205,7 @@ endef define KernelPackage/rtw88-8822b $(call KernelPackage/mac80211/Default) TITLE:=Realtek RTL8822B family support - DEPENDS+= +kmod-rtw88 +@DRIVER_11AC_SUPPORT + DEPENDS+= +kmod-rtw88 +rtl8822be-firmware +@DRIVER_11AC_SUPPORT FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822b.ko AUTOLOAD:=$(call AutoProbe,rtw88_8822b) HIDDEN:=1 @@ -214,7 +214,7 @@ endef define KernelPackage/rtw88-8822c $(call KernelPackage/mac80211/Default) TITLE:=Realtek RTL8822C family support - DEPENDS+= +kmod-rtw88 +@DRIVER_11AC_SUPPORT + DEPENDS+= +kmod-rtw88 +rtl8822ce-firmware +@DRIVER_11AC_SUPPORT FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822c.ko AUTOLOAD:=$(call AutoProbe,rtw88_8822c) HIDDEN:=1 @@ -223,7 +223,7 @@ endef define KernelPackage/rtw88-8723d $(call KernelPackage/mac80211/Default) TITLE:=Realtek RTL8723D family support - DEPENDS+= +kmod-rtw88 + DEPENDS+= +kmod-rtw88 +rtl8723de-firmware FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8723d.ko AUTOLOAD:=$(call AutoProbe,rtw88_8723d) HIDDEN:=1 @@ -240,7 +240,7 @@ endef define KernelPackage/rtw88-8822bu $(call KernelPackage/mac80211/Default) TITLE:=Realtek RTL8822BU support - DEPENDS+= +kmod-rtw88-usb +rtl8822be-firmware +kmod-rtw88-8822b + DEPENDS+= +kmod-rtw88-usb +kmod-rtw88-8822b FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822bu.ko AUTOLOAD:=$(call AutoProbe,rtw88_8822bu) endef From 1418d9568a3ae2a17785c15ce90e505f2357fa76 Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Wed, 27 Sep 2023 23:01:50 +0800 Subject: [PATCH 28/50] mac80211: realtek: rtw88: add RTL8821CE support Add the Realtek RTL8821CE support to rtw88 package. Signed-off-by: Chukun Pan --- package/kernel/mac80211/realtek.mk | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/package/kernel/mac80211/realtek.mk b/package/kernel/mac80211/realtek.mk index 0fc9fb0e6da..5e04f9d5e1b 100644 --- a/package/kernel/mac80211/realtek.mk +++ b/package/kernel/mac80211/realtek.mk @@ -1,8 +1,8 @@ PKG_DRIVERS += \ rtlwifi rtlwifi-pci rtlwifi-btcoexist rtlwifi-usb rtl8192c-common \ rtl8192ce rtl8192se rtl8192de rtl8192cu rtl8723bs rtl8821ae \ - rtl8xxxu rtw88 rtw88-pci rtw88-usb rtw88-8822b rtw88-8822c rtw88-8723d \ - rtw88-8822be rtw88-8822bu rtw88-8822ce rtw88-8723de + rtl8xxxu rtw88 rtw88-pci rtw88-usb rtw88-8821c rtw88-8822b rtw88-8822c \ + rtw88-8723d rtw88-8821ce rtw88-8822be rtw88-8822bu rtw88-8822ce rtw88-8723de config-$(call config_package,rtlwifi) += RTL_CARDS RTLWIFI config-$(call config_package,rtlwifi-pci) += RTLWIFI_PCI @@ -25,6 +25,8 @@ config-y += STAGING config-$(call config_package,rtw88) += RTW88 RTW88_CORE config-$(call config_package,rtw88-pci) += RTW88_PCI config-$(call config_package,rtw88-usb) += RTW88_USB +config-$(call config_package,rtw88-8821c) += RTW88_8821C +config-$(call config_package,rtw88-8821ce) += RTW88_8821CE config-$(call config_package,rtw88-8822b) += RTW88_8822B config-$(call config_package,rtw88-8822be) += RTW88_8822BE config-$(call config_package,rtw88-8822bu) += RTW88_8822BU @@ -202,6 +204,15 @@ define KernelPackage/rtw88-usb HIDDEN:=1 endef +define KernelPackage/rtw88-8821c + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8821C family support + DEPENDS+= +kmod-rtw88 +rtl8821ce-firmware +@DRIVER_11AC_SUPPORT + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8821c.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8821c) + HIDDEN:=1 +endef + define KernelPackage/rtw88-8822b $(call KernelPackage/mac80211/Default) TITLE:=Realtek RTL8822B family support @@ -229,6 +240,14 @@ define KernelPackage/rtw88-8723d HIDDEN:=1 endef +define KernelPackage/rtw88-8821ce + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8821CE support + DEPENDS+= +kmod-rtw88-pci +kmod-rtw88-8821c + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8821ce.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8821ce) +endef + define KernelPackage/rtw88-8822be $(call KernelPackage/mac80211/Default) TITLE:=Realtek RTL8822BE support From 055f6dd6f29ba715912a4c8ee1e4ada110f7ac79 Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Thu, 28 Sep 2023 23:09:20 +0800 Subject: [PATCH 29/50] mac80211: realtek: rtw88: add RTL8821CU support Add the Realtek RTL8821CU support to rtw88 package. Signed-off-by: Chukun Pan --- package/kernel/mac80211/realtek.mk | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/package/kernel/mac80211/realtek.mk b/package/kernel/mac80211/realtek.mk index 5e04f9d5e1b..322bbd49868 100644 --- a/package/kernel/mac80211/realtek.mk +++ b/package/kernel/mac80211/realtek.mk @@ -2,7 +2,8 @@ PKG_DRIVERS += \ rtlwifi rtlwifi-pci rtlwifi-btcoexist rtlwifi-usb rtl8192c-common \ rtl8192ce rtl8192se rtl8192de rtl8192cu rtl8723bs rtl8821ae \ rtl8xxxu rtw88 rtw88-pci rtw88-usb rtw88-8821c rtw88-8822b rtw88-8822c \ - rtw88-8723d rtw88-8821ce rtw88-8822be rtw88-8822bu rtw88-8822ce rtw88-8723de + rtw88-8723d rtw88-8821ce rtw88-8821cu rtw88-8822be rtw88-8822bu \ + rtw88-8822ce rtw88-8723de config-$(call config_package,rtlwifi) += RTL_CARDS RTLWIFI config-$(call config_package,rtlwifi-pci) += RTLWIFI_PCI @@ -27,6 +28,7 @@ config-$(call config_package,rtw88-pci) += RTW88_PCI config-$(call config_package,rtw88-usb) += RTW88_USB config-$(call config_package,rtw88-8821c) += RTW88_8821C config-$(call config_package,rtw88-8821ce) += RTW88_8821CE +config-$(call config_package,rtw88-8821cu) += RTW88_8821CU config-$(call config_package,rtw88-8822b) += RTW88_8822B config-$(call config_package,rtw88-8822be) += RTW88_8822BE config-$(call config_package,rtw88-8822bu) += RTW88_8822BU @@ -248,6 +250,14 @@ define KernelPackage/rtw88-8821ce AUTOLOAD:=$(call AutoProbe,rtw88_8821ce) endef +define KernelPackage/rtw88-8821cu + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8821CU support + DEPENDS+= +kmod-rtw88-usb +kmod-rtw88-8821c + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8821cu.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8821cu) +endef + define KernelPackage/rtw88-8822be $(call KernelPackage/mac80211/Default) TITLE:=Realtek RTL8822BE support From 3f5e0fb66f45a0509698d17c406623b9c0ef0fad Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Fri, 29 Sep 2023 23:05:26 +0800 Subject: [PATCH 30/50] mac80211: realtek: rtw88: add RTL8822CU support Add the Realtek RTL8822CU support to rtw88 package. Signed-off-by: Chukun Pan --- package/kernel/mac80211/realtek.mk | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/package/kernel/mac80211/realtek.mk b/package/kernel/mac80211/realtek.mk index 322bbd49868..04057b31069 100644 --- a/package/kernel/mac80211/realtek.mk +++ b/package/kernel/mac80211/realtek.mk @@ -3,7 +3,7 @@ PKG_DRIVERS += \ rtl8192ce rtl8192se rtl8192de rtl8192cu rtl8723bs rtl8821ae \ rtl8xxxu rtw88 rtw88-pci rtw88-usb rtw88-8821c rtw88-8822b rtw88-8822c \ rtw88-8723d rtw88-8821ce rtw88-8821cu rtw88-8822be rtw88-8822bu \ - rtw88-8822ce rtw88-8723de + rtw88-8822ce rtw88-8822cu rtw88-8723de config-$(call config_package,rtlwifi) += RTL_CARDS RTLWIFI config-$(call config_package,rtlwifi-pci) += RTLWIFI_PCI @@ -34,6 +34,7 @@ config-$(call config_package,rtw88-8822be) += RTW88_8822BE config-$(call config_package,rtw88-8822bu) += RTW88_8822BU config-$(call config_package,rtw88-8822c) += RTW88_8822C config-$(call config_package,rtw88-8822ce) += RTW88_8822CE +config-$(call config_package,rtw88-8822cu) += RTW88_8822CU config-$(call config_package,rtw88-8723d) += RTW88_8723D config-$(call config_package,rtw88-8723de) += RTW88_8723DE config-$(CONFIG_PACKAGE_RTW88_DEBUG) += RTW88_DEBUG @@ -282,6 +283,14 @@ define KernelPackage/rtw88-8822ce AUTOLOAD:=$(call AutoProbe,rtw88_8822ce) endef +define KernelPackage/rtw88-8822cu + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8822CU support + DEPENDS+= +kmod-rtw88-usb +kmod-rtw88-8822c + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822cu.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8822cu) +endef + define KernelPackage/rtw88-8723de $(call KernelPackage/mac80211/Default) TITLE:=Realtek RTL8723DE support From 09b7e1955c92e0b05197174b7bd4aef2c4073a35 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Mon, 13 Nov 2023 23:32:12 +0100 Subject: [PATCH 31/50] Revert "prereq-build: add Python 3.12 support" This reverts commit 7ceb76ca3a37ba6b722df39ba0838909fa7cf7b4. Python 3.12 removes the distutils package and is therefore not compatible. We have to check downstream what relies on distutils before adding actual support for Python 3.12. Sorry for the noise. With this in-place, the macOS CI job fails and turns things red, revert for now. Signed-off-by: Paul Spooren --- include/prereq-build.mk | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/prereq-build.mk b/include/prereq-build.mk index 2378f5ad90c..49340ce3e44 100644 --- a/include/prereq-build.mk +++ b/include/prereq-build.mk @@ -182,7 +182,6 @@ $(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \ perl --version | grep "perl.*v5")) $(eval $(call SetupHostCommand,python,Please install Python >= 3.7, \ - python3.12 -V 2>&1 | grep 'Python 3', \ python3.11 -V 2>&1 | grep 'Python 3', \ python3.10 -V 2>&1 | grep 'Python 3', \ python3.9 -V 2>&1 | grep 'Python 3', \ @@ -191,7 +190,6 @@ $(eval $(call SetupHostCommand,python,Please install Python >= 3.7, \ python3 -V 2>&1 | grep -E 'Python 3\.([7-9]|[0-9][0-9])\.?')) $(eval $(call SetupHostCommand,python3,Please install Python >= 3.7, \ - python3.12 -V 2>&1 | grep 'Python 3', \ python3.11 -V 2>&1 | grep 'Python 3', \ python3.10 -V 2>&1 | grep 'Python 3', \ python3.9 -V 2>&1 | grep 'Python 3', \ From 878ef51b012e911788b5210631f8af2707327344 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Sat, 11 Nov 2023 21:44:59 +0100 Subject: [PATCH 32/50] qualcommax: add bindings for MAC modes Since every board needs to define the correct MAC modes, it makes sense to document the allowed hex values with a humanly readable name. So, lets document all of the allowed MAC modes from SSDK 12.4 as bindings, so later we can replace all of the hex values in DTS-es with these. Signed-off-by: Robert Marko --- .../include/dt-bindings/net/qcom-ipq-ess.h | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/target/linux/qualcommax/files/include/dt-bindings/net/qcom-ipq-ess.h b/target/linux/qualcommax/files/include/dt-bindings/net/qcom-ipq-ess.h index 0ecadb35c6d..5b44620de54 100644 --- a/target/linux/qualcommax/files/include/dt-bindings/net/qcom-ipq-ess.h +++ b/target/linux/qualcommax/files/include/dt-bindings/net/qcom-ipq-ess.h @@ -12,4 +12,31 @@ #define ESS_PORT6 0x40 #define ESS_PORT7 0x80 +/* SSDK MAC/UNIPHY modes */ +#define MAC_MODE_PSGMII 0x0 +#define MAC_MODE_PSGMII_RGMII5 0x1 +#define MAC_MODE_SGMII0_RGMII5 0x2 +#define MAC_MODE_SGMII1_RGMII5 0x3 +#define MAC_MODE_PSGMII_RMII0 0x4 +#define MAC_MODE_PSGMII_RMII1 0x5 +#define MAC_MODE_PSGMII_RMII0_RMII1 0x6 +#define MAC_MODE_PSGMII_RGMII4 0x7 +#define MAC_MODE_SGMII0_RGMII4 0x8 +#define MAC_MODE_SGMII1_RGMII4 0x9 +#define MAC_MODE_SGMII4_RGMII4 0xa +#define MAC_MODE_QSGMII 0xb +#define MAC_MODE_SGMII_PLUS 0xc +#define MAC_MODE_USXGMII 0xd +#define MAC_MODE_10GBASE_R 0xe +#define MAC_MODE_SGMII_CHANNEL0 0xf +#define MAC_MODE_SGMII_CHANNEL1 0x10 +#define MAC_MODE_SGMII_CHANNEL4 0x11 +#define MAC_MODE_RGMII 0x12 +#define MAC_MODE_PSGMII_FIBER 0x13 +#define MAC_MODE_SGMII_FIBER 0x14 +#define MAC_MODE_UQXGMII 0x15 +#define MAC_MODE_UDXGMII 0x16 +#define MAC_MODE_UQXGMII_3CHANNELS 0x17 +#define MAC_MODE_DISABLED 0xff + #endif /* _DT_BINDINGS_NET_QCOM_IPQ_ESS_H */ From 8e162868abf0fc2356b54fcf0b5ec86a282d1387 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Sat, 11 Nov 2023 21:50:15 +0100 Subject: [PATCH 33/50] qualcommax: set default switch MAC modes Every board that has the switch enabled needs to have MAC modes defined for all 3 UNIPHY instances. So, instead of having to at least put the disabled MAC mode for UNIPHY-s let disable them by default and then boards can override it. Signed-off-by: Robert Marko --- .../files/arch/arm64/boot/dts/qcom/ipq8074-ess.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-ess.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-ess.dtsi index f0c1efce9ed..5cfd75664f2 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-ess.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-ess.dtsi @@ -158,6 +158,11 @@ "nss_port4_rst", "nss_port5_rst", "nss_port6_rst"; mdio-bus = <&mdio>; + + switch_mac_mode = ; /* MAC mode for UNIPHY instance 0 */ + switch_mac_mode1 = ; /* MAC mode for UNIPHY instance 1 */ + switch_mac_mode2 = ; /* MAC mode for UNIPHY instance 2 */ + status = "disabled"; port_scheduler_resource { From cb1702041f8ccfa902b6e525b2268313aeaf1eb0 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Sun, 12 Nov 2023 17:24:43 +0100 Subject: [PATCH 34/50] qualcommax: use defines for MAC mode setting Now that we have the MAC modes defined in DT bindings, lets replace all of the raw hex values with defines. While we are here, we can drop the disabled UNIPHY-s as that is the default value in the ESS DTSI. Signed-off-by: Robert Marko --- .../files/arch/arm64/boot/dts/qcom/ipq8070-cax1800.dts | 4 +--- .../files/arch/arm64/boot/dts/qcom/ipq8071-ax3600.dtsi | 4 +--- .../files/arch/arm64/boot/dts/qcom/ipq8071-eap102.dts | 5 ++--- .../files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts | 6 +++--- .../files/arch/arm64/boot/dts/qcom/ipq8072-ax880.dts | 5 ++--- .../files/arch/arm64/boot/dts/qcom/ipq8072-ax9000.dts | 5 ++--- .../files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts | 5 ++--- .../files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts | 6 +++--- .../files/arch/arm64/boot/dts/qcom/ipq8072-wax218.dts | 5 ++--- .../files/arch/arm64/boot/dts/qcom/ipq8072-wax620.dts | 5 ++--- .../files/arch/arm64/boot/dts/qcom/ipq8072-wpq873.dts | 6 +++--- .../files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts | 6 +++--- .../files/arch/arm64/boot/dts/qcom/ipq8074-rax120v2.dts | 5 ++--- .../files/arch/arm64/boot/dts/qcom/ipq8074-wax630.dts | 7 +++---- .../arch/arm64/boot/dts/qcom/ipq8074-wxr-5950ax12.dts | 6 +++--- 15 files changed, 34 insertions(+), 46 deletions(-) diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8070-cax1800.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8070-cax1800.dts index 3f19e4fee99..5b3a56fdd0d 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8070-cax1800.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8070-cax1800.dts @@ -273,9 +273,7 @@ switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; /* lan port bitmap */ switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode = <0x0>; /* mac mode for uniphy instance0*/ - switch_mac_mode1 = <0xff>; /* mac mode for uniphy instance1*/ - switch_mac_mode2 = <0xff>; /* mac mode for uniphy instance2*/ + switch_mac_mode = ; /* mac mode for uniphy instance0*/ bm_tick_mode = <0>; /* bm tick mode */ tm_tick_mode = <0>; /* tm tick mode */ diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600.dtsi index 82a981b5faa..5c28862fc4f 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600.dtsi @@ -237,9 +237,7 @@ switch_lan_bmp = <(ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; /* lan port bitmap */ switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode = <0x0>; /* mac mode for uniphy instance0*/ - switch_mac_mode1 = <0xff>; /* mac mode for uniphy instance1*/ - switch_mac_mode2 = <0xff>; /* mac mode for uniphy instance2*/ + switch_mac_mode = ; /* mac mode for uniphy instance0*/ bm_tick_mode = <0>; /* bm tick mode */ tm_tick_mode = <0>; /* tm tick mode */ diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-eap102.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-eap102.dts index e373af1ba82..0da58757121 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-eap102.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-eap102.dts @@ -345,9 +345,8 @@ switch_lan_bmp = ; /* lan port bitmap */ switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode = <0xff>; /* mac mode for uniphy instance0*/ - switch_mac_mode1 = <0xf>; /* mac mode for uniphy instance1*/ - switch_mac_mode2 = <0xf>; /* mac mode for uniphy instance2*/ + switch_mac_mode1 = ; /* mac mode for uniphy instance1*/ + switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ bm_tick_mode = <0>; /* bm tick mode */ tm_tick_mode = <0>; /* tm tick mode */ diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts index 6c7ec2e588f..f92291e6b24 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts @@ -324,9 +324,9 @@ switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4 | ESS_PORT5)>; /* lan port bitmap */ switch_wan_bmp = ; /* wan port bitmap */ malibu_first_phy_addr = <16>; /* PHY addr of the first malibu PHY */ - switch_mac_mode = <0xb>; /* mac mode for uniphy instance0*/ - switch_mac_mode1 = <0xd>; /* mac mode for uniphy instance1*/ - switch_mac_mode2 = <0xd>; /* mac mode for uniphy instance2*/ + switch_mac_mode = ; /* mac mode for uniphy instance0*/ + switch_mac_mode1 = ; /* mac mode for uniphy instance1*/ + switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ bm_tick_mode = <0>; /* bm tick mode */ tm_tick_mode = <0>; /* tm tick mode */ diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax880.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax880.dts index 4551e7b6b3c..f8eb9c9fe82 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax880.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax880.dts @@ -327,9 +327,8 @@ switch_lan_bmp = ; /* lan port bitmap */ switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode = <0xff>; /* mac mode for uniphy instance0*/ - switch_mac_mode1 = <0xf>; /* mac mode for uniphy instance1*/ - switch_mac_mode2 = <0xf>; /* mac mode for uniphy instance2*/ + switch_mac_mode1 = ; /* mac mode for uniphy instance1*/ + switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ bm_tick_mode = <0>; /* bm tick mode */ tm_tick_mode = <0>; /* tm tick mode */ diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax9000.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax9000.dts index 338051ef48a..3b175ec1624 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax9000.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax9000.dts @@ -384,9 +384,8 @@ switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; /* lan port bitmap */ switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode = <0xb>; /* mac mode for uniphy instance0*/ - switch_mac_mode1 = <0xc>; /* mac mode for uniphy instance1*/ - switch_mac_mode2 = <0xff>; /* mac mode for uniphy instance2*/ + switch_mac_mode = ; /* mac mode for uniphy instance0*/ + switch_mac_mode1 = ; /* mac mode for uniphy instance1*/ bm_tick_mode = <0>; /* bm tick mode */ tm_tick_mode = <0>; /* tm tick mode */ diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts index 165d788a4f6..8ae5924c63b 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts @@ -171,9 +171,8 @@ switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; /* lan port bitmap */ switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode = <0xb>; /* mac mode for uniphy instance0*/ - switch_mac_mode1 = <0xff>; /* mac mode for uniphy instance1*/ - switch_mac_mode2 = <0xc>; /* mac mode for uniphy instance2*/ + switch_mac_mode = ; /* mac mode for uniphy instance0*/ + switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ bm_tick_mode = <0>; /* bm tick mode */ tm_tick_mode = <0>; /* tm tick mode */ diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts index 81e647582ac..2e92a18cc75 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts @@ -188,9 +188,9 @@ switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; /* lan port bitmap */ switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode = <0x0>; /* mac mode for uniphy instance0*/ - switch_mac_mode1 = <0xe>; /* mac mode for uniphy instance1*/ - switch_mac_mode2 = <0xd>; /* mac mode for uniphy instance2*/ + switch_mac_mode = ; /* mac mode for uniphy instance0*/ + switch_mac_mode1 = ; /* mac mode for uniphy instance1*/ + switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ bm_tick_mode = <0>; /* bm tick mode */ tm_tick_mode = <0>; /* tm tick mode */ diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax218.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax218.dts index 68be7b27783..59835a7059d 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax218.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax218.dts @@ -90,9 +90,8 @@ status = "okay"; switch_wan_bmp = ; - switch_mac_mode = <0x00>; - switch_mac_mode1 = <0xff>; - switch_mac_mode2 = <0x0f>; + switch_mac_mode = ; + switch_mac_mode2 = ; bm_tick_mode = <0>; tm_tick_mode = <0>; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax620.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax620.dts index 6adf3933883..2175f0e69e1 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax620.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax620.dts @@ -118,9 +118,8 @@ status = "okay"; switch_wan_bmp = ; - switch_mac_mode = <0x00>; - switch_mac_mode1 = <0xff>; - switch_mac_mode2 = <0x0f>; + switch_mac_mode = ; + switch_mac_mode2 = ; bm_tick_mode = <0x00>; tm_tick_mode = <0x00>; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wpq873.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wpq873.dts index 8d1c3725a18..7b47a0d97ef 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wpq873.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wpq873.dts @@ -390,9 +390,9 @@ switch_lan_bmp = <(ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; /* lan port bitmap */ switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode = <0x0>; /* mac mode for uniphy instance0*/ - switch_mac_mode1 = <0x0f>; /* mac mode for uniphy instance1*/ - switch_mac_mode2 = <0x0f>; /* mac mode for uniphy instance2*/ + switch_mac_mode = ; /* mac mode for uniphy instance0*/ + switch_mac_mode1 = ; /* mac mode for uniphy instance1*/ + switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ bm_tick_mode = <0>; /* bm tick mode */ tm_tick_mode = <0>; /* tm tick mode */ diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts index 62e256b4252..b32bc318174 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts @@ -300,9 +300,9 @@ switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4 | ESS_PORT5)>; switch_wan_bmp = ; - switch_mac_mode = <0x0>; - switch_mac_mode1 = <0xf>; - switch_mac_mode2 = <0xd>; + switch_mac_mode = ; + switch_mac_mode1 = ; + switch_mac_mode2 = ; bm_tick_mode = <0>; tm_tick_mode = <0>; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-rax120v2.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-rax120v2.dts index 4e756867f29..30b08eee321 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-rax120v2.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-rax120v2.dts @@ -197,9 +197,8 @@ switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4 | ESS_PORT5)>; /* lan port bitmap */ switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode = <0x0>; /* mac mode for uniphy instance0*/ - switch_mac_mode1 = <0xff>; /* mac mode for uniphy instance1*/ - switch_mac_mode2 = <0xd>; /* mac mode for uniphy instance2*/ + switch_mac_mode = ; /* mac mode for uniphy instance0*/ + switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ bm_tick_mode = <0>; /* bm tick mode */ tm_tick_mode = <0>; /* tm tick mode */ diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wax630.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wax630.dts index e28810fa3dc..b8beec6bcc3 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wax630.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wax630.dts @@ -150,12 +150,11 @@ &switch { status = "okay"; - + switch_lan_bmp = ; switch_wan_bmp = ; - switch_mac_mode = <0x00>; - switch_mac_mode1 = <0xff>; - switch_mac_mode2 = <0x0d>; + switch_mac_mode = ; + switch_mac_mode2 = ; bm_tick_mode = <0x00>; tm_tick_mode = <0x00>; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wxr-5950ax12.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wxr-5950ax12.dts index 51af034c344..be9429ea394 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wxr-5950ax12.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wxr-5950ax12.dts @@ -269,9 +269,9 @@ switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4 | ESS_PORT5)>; switch_wan_bmp = ; - switch_mac_mode = <0xb>; - switch_mac_mode1 = <0xd>; - switch_mac_mode2 = <0xd>; + switch_mac_mode = ; + switch_mac_mode1 = ; + switch_mac_mode2 = ; bm_tick_mode = <0>; tm_tick_mode = <0>; From c885169e02a56a889f706b7734599ac42dcf9886 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Mon, 13 Nov 2023 21:54:06 +0100 Subject: [PATCH 35/50] qualcommax: move switch tick mode setting to ESS DTSI Every board in qualcommax is using the same BM and TM switch tick modes, so instead of specifying them in each board lets just set them in the ESS DTSI directly. Signed-off-by: Robert Marko --- .../files/arch/arm64/boot/dts/qcom/ipq8070-cax1800.dts | 2 -- .../files/arch/arm64/boot/dts/qcom/ipq8071-ax3600.dtsi | 2 -- .../files/arch/arm64/boot/dts/qcom/ipq8071-eap102.dts | 2 -- .../qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts | 2 -- .../files/arch/arm64/boot/dts/qcom/ipq8072-ax880.dts | 2 -- .../files/arch/arm64/boot/dts/qcom/ipq8072-ax9000.dts | 2 -- .../files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts | 2 -- .../qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts | 2 -- .../files/arch/arm64/boot/dts/qcom/ipq8072-wax218.dts | 2 -- .../files/arch/arm64/boot/dts/qcom/ipq8072-wax620.dts | 2 -- .../files/arch/arm64/boot/dts/qcom/ipq8072-wpq873.dts | 2 -- .../qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-ess.dtsi | 3 +++ .../files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts | 2 -- .../files/arch/arm64/boot/dts/qcom/ipq8074-rax120v2.dts | 2 -- .../files/arch/arm64/boot/dts/qcom/ipq8074-wax630.dts | 2 -- .../files/arch/arm64/boot/dts/qcom/ipq8074-wxr-5950ax12.dts | 2 -- 16 files changed, 3 insertions(+), 30 deletions(-) diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8070-cax1800.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8070-cax1800.dts index 5b3a56fdd0d..6dbd0e95f51 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8070-cax1800.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8070-cax1800.dts @@ -274,8 +274,6 @@ switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; /* lan port bitmap */ switch_wan_bmp = ; /* wan port bitmap */ switch_mac_mode = ; /* mac mode for uniphy instance0*/ - bm_tick_mode = <0>; /* bm tick mode */ - tm_tick_mode = <0>; /* tm tick mode */ qcom,port_phyinfo { port@0 { diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600.dtsi index 5c28862fc4f..0494fff0e36 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600.dtsi @@ -238,8 +238,6 @@ switch_lan_bmp = <(ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; /* lan port bitmap */ switch_wan_bmp = ; /* wan port bitmap */ switch_mac_mode = ; /* mac mode for uniphy instance0*/ - bm_tick_mode = <0>; /* bm tick mode */ - tm_tick_mode = <0>; /* tm tick mode */ qcom,port_phyinfo { port@1 { diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-eap102.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-eap102.dts index 0da58757121..d76c9a12eb6 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-eap102.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-eap102.dts @@ -347,8 +347,6 @@ switch_wan_bmp = ; /* wan port bitmap */ switch_mac_mode1 = ; /* mac mode for uniphy instance1*/ switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ - bm_tick_mode = <0>; /* bm tick mode */ - tm_tick_mode = <0>; /* tm tick mode */ qcom,port_phyinfo { port@4 { diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts index f92291e6b24..683cf775b3e 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts @@ -327,8 +327,6 @@ switch_mac_mode = ; /* mac mode for uniphy instance0*/ switch_mac_mode1 = ; /* mac mode for uniphy instance1*/ switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ - bm_tick_mode = <0>; /* bm tick mode */ - tm_tick_mode = <0>; /* tm tick mode */ qcom,port_phyinfo { port@0 { diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax880.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax880.dts index f8eb9c9fe82..81affdc3d0d 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax880.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax880.dts @@ -329,8 +329,6 @@ switch_wan_bmp = ; /* wan port bitmap */ switch_mac_mode1 = ; /* mac mode for uniphy instance1*/ switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ - bm_tick_mode = <0>; /* bm tick mode */ - tm_tick_mode = <0>; /* tm tick mode */ qcom,port_phyinfo { port@4 { diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax9000.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax9000.dts index 3b175ec1624..9e97e4e066b 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax9000.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax9000.dts @@ -386,8 +386,6 @@ switch_wan_bmp = ; /* wan port bitmap */ switch_mac_mode = ; /* mac mode for uniphy instance0*/ switch_mac_mode1 = ; /* mac mode for uniphy instance1*/ - bm_tick_mode = <0>; /* bm tick mode */ - tm_tick_mode = <0>; /* tm tick mode */ qcom,port_phyinfo { port@0 { diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts index 8ae5924c63b..e2971103c84 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts @@ -173,8 +173,6 @@ switch_wan_bmp = ; /* wan port bitmap */ switch_mac_mode = ; /* mac mode for uniphy instance0*/ switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ - bm_tick_mode = <0>; /* bm tick mode */ - tm_tick_mode = <0>; /* tm tick mode */ qcom,port_phyinfo { port@0 { diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts index 2e92a18cc75..ba22d16c0a6 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts @@ -191,8 +191,6 @@ switch_mac_mode = ; /* mac mode for uniphy instance0*/ switch_mac_mode1 = ; /* mac mode for uniphy instance1*/ switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ - bm_tick_mode = <0>; /* bm tick mode */ - tm_tick_mode = <0>; /* tm tick mode */ qcom,port_phyinfo { port@0 { diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax218.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax218.dts index 59835a7059d..9da475c5e70 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax218.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax218.dts @@ -92,8 +92,6 @@ switch_wan_bmp = ; switch_mac_mode = ; switch_mac_mode2 = ; - bm_tick_mode = <0>; - tm_tick_mode = <0>; qcom,port_phyinfo { port@5 { diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax620.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax620.dts index 2175f0e69e1..c4cc8c0b97a 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax620.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax620.dts @@ -120,8 +120,6 @@ switch_wan_bmp = ; switch_mac_mode = ; switch_mac_mode2 = ; - bm_tick_mode = <0x00>; - tm_tick_mode = <0x00>; qcom,port_phyinfo { port@5 { diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wpq873.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wpq873.dts index 7b47a0d97ef..b9a882f1dba 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wpq873.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wpq873.dts @@ -393,8 +393,6 @@ switch_mac_mode = ; /* mac mode for uniphy instance0*/ switch_mac_mode1 = ; /* mac mode for uniphy instance1*/ switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ - bm_tick_mode = <0>; /* bm tick mode */ - tm_tick_mode = <0>; /* tm tick mode */ qcom,port_phyinfo { port@2 { diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-ess.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-ess.dtsi index 5cfd75664f2..a4ed3ce38cd 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-ess.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-ess.dtsi @@ -163,6 +163,9 @@ switch_mac_mode1 = ; /* MAC mode for UNIPHY instance 1 */ switch_mac_mode2 = ; /* MAC mode for UNIPHY instance 2 */ + bm_tick_mode = <0>; /* bm tick mode */ + tm_tick_mode = <0>; /* tm tick mode */ + status = "disabled"; port_scheduler_resource { diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts index b32bc318174..0931c8ca326 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts @@ -303,8 +303,6 @@ switch_mac_mode = ; switch_mac_mode1 = ; switch_mac_mode2 = ; - bm_tick_mode = <0>; - tm_tick_mode = <0>; qcom,port_phyinfo { port@0 { diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-rax120v2.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-rax120v2.dts index 30b08eee321..501b53982cb 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-rax120v2.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-rax120v2.dts @@ -199,8 +199,6 @@ switch_wan_bmp = ; /* wan port bitmap */ switch_mac_mode = ; /* mac mode for uniphy instance0*/ switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ - bm_tick_mode = <0>; /* bm tick mode */ - tm_tick_mode = <0>; /* tm tick mode */ qcom,port_phyinfo { port@1 { diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wax630.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wax630.dts index b8beec6bcc3..af06fac3a46 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wax630.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wax630.dts @@ -155,8 +155,6 @@ switch_wan_bmp = ; switch_mac_mode = ; switch_mac_mode2 = ; - bm_tick_mode = <0x00>; - tm_tick_mode = <0x00>; qcom,port_phyinfo { port@3 { diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wxr-5950ax12.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wxr-5950ax12.dts index be9429ea394..88ae3831173 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wxr-5950ax12.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wxr-5950ax12.dts @@ -272,8 +272,6 @@ switch_mac_mode = ; switch_mac_mode1 = ; switch_mac_mode2 = ; - bm_tick_mode = <0>; - tm_tick_mode = <0>; qcom,port_phyinfo { port@0 { From 853db7be9521e67588acaf15e5600d911e5f8253 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Tue, 14 Nov 2023 09:22:40 +0100 Subject: [PATCH 36/50] qca-ssdk: pass SoC to build Recent SSDK versions started also parsing the "SoC" variable to identify the SoC along with the "CHIP_TYPE". We are not passing "SoC" currently and this leads to components we dont need like MHT (New 2.5G quad port switch) being compiled and then unused, so lets just pass the "SoC" as well. Signed-off-by: Robert Marko --- package/kernel/qca-ssdk/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/kernel/qca-ssdk/Makefile b/package/kernel/qca-ssdk/Makefile index 4107208c0eb..ab978f3b49b 100644 --- a/package/kernel/qca-ssdk/Makefile +++ b/package/kernel/qca-ssdk/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=qca-ssdk -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/qca-ssdk.git PKG_SOURCE_PROTO:=git @@ -43,6 +43,7 @@ MAKE_FLAGS+= \ TARGET_SUFFIX=$(CONFIG_TARGET_SUFFIX) \ GCC_VERSION=$(GCC_VERSION) \ EXTRA_CFLAGS=-fno-stack-protector -I$(STAGING_DIR)/usr/include \ + SoC=$(CONFIG_TARGET_SUBTARGET) \ $(LNX_CONFIG_OPTS) ifeq ($(CONFIG_TARGET_SUBTARGET), "ipq807x") From 14aeb471f2b3bbb8095e8f9e9625caee594b58e7 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Tue, 14 Nov 2023 09:47:38 +0100 Subject: [PATCH 37/50] qca-ssdk: disable PTP and swconfig by default PTP and swconfig support in SSDK require kernel modifications we dont need nor we want to support for now, so move the PTP and swconfig disablement into general build options as they are not ipq807x specific. Signed-off-by: Robert Marko --- package/kernel/qca-ssdk/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/kernel/qca-ssdk/Makefile b/package/kernel/qca-ssdk/Makefile index ab978f3b49b..3770d29e8c5 100644 --- a/package/kernel/qca-ssdk/Makefile +++ b/package/kernel/qca-ssdk/Makefile @@ -44,10 +44,11 @@ MAKE_FLAGS+= \ GCC_VERSION=$(GCC_VERSION) \ EXTRA_CFLAGS=-fno-stack-protector -I$(STAGING_DIR)/usr/include \ SoC=$(CONFIG_TARGET_SUBTARGET) \ + PTP_FEATURE=disable SWCONFIG_FEATURE=disable \ $(LNX_CONFIG_OPTS) ifeq ($(CONFIG_TARGET_SUBTARGET), "ipq807x") - MAKE_FLAGS+= CHIP_TYPE=HPPE PTP_FEATURE=disable SWCONFIG_FEATURE=disable + MAKE_FLAGS+= CHIP_TYPE=HPPE endif define Build/InstallDev From c23b509d72f3a50e4417345a02aea48ef9c451aa Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 14 Nov 2023 15:35:03 +0100 Subject: [PATCH 38/50] netifd: update to Git HEAD (2023-11-14) 8587c074f1eb interface-ip: fix IPv4 route target masking Fixes: https://github.com/openwrt/netifd/issues/17 Signed-off-by: Jo-Philipp Wich --- package/network/config/netifd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index eb4363e9c69..2e70994e51b 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git -PKG_SOURCE_DATE:=2023-11-11 -PKG_SOURCE_VERSION:=c739dee0a37bc593aaed7ae3f0a61e3d7c1fb1ac -PKG_MIRROR_HASH:=5e3dc0ce4774cd738b2d6363b642ee0501bd6b7f8061d5d82151af2069e7fbfd +PKG_SOURCE_DATE:=2023-11-14 +PKG_SOURCE_VERSION:=8587c074f1eb2064c42adb0a6aa5073f695ab89d +PKG_MIRROR_HASH:=f5ceb771badd7a23cceb53537299580d4b483e2b3ec5de09b9c3c54692893dd9 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 From 4d9108e0bfcac0380cfa9379f906b0a8f9842762 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 15 Nov 2023 01:20:56 +0100 Subject: [PATCH 39/50] ipq806x: fix wrong LEDs mode for non-standard qca8k LEDs There was a typo in the LED definition for the mode of non-standard qca8k LEDs. Mode for link speed was wrongly set to link-10 link-100 link-1000 while the real mode in sysfs is link_10 link_100 and link_1000. Fix the entry to the correct mode. Fixes: c707cff6c94b ("ipq806x: add LEDs definition for non-standard qca8k LEDs") Signed-off-by: Christian Marangi --- .../ipq806x/base-files/etc/board.d/01_leds | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/target/linux/ipq806x/base-files/etc/board.d/01_leds b/target/linux/ipq806x/base-files/etc/board.d/01_leds index 511adc5a50f..0b2ce2b7d55 100644 --- a/target/linux/ipq806x/base-files/etc/board.d/01_leds +++ b/target/linux/ipq806x/base-files/etc/board.d/01_leds @@ -10,15 +10,15 @@ board=$(board_name) case "$board" in askey,rt4230w-rev6) - ucidef_set_led_netdev "wan-port-link" "WAN-PORT-LINK" "qca8k-0.0:00:green:wan" "wan" "link-10 link-100 link-1000" + ucidef_set_led_netdev "wan-port-link" "WAN-PORT-LINK" "qca8k-0.0:00:green:wan" "wan" "link_10 link_100 link_1000" ucidef_set_led_netdev "wan-port-activity" "WAN-PORT-ACTIVITY" "qca8k-0.0:00:amber:wan" "wan" "tx rx" - ucidef_set_led_netdev "lan1-port-link" "LAN1-PORT-LINK" "qca8k-0.0:01:green:lan" "lan1" "link-10 link-100 link-1000" + ucidef_set_led_netdev "lan1-port-link" "LAN1-PORT-LINK" "qca8k-0.0:01:green:lan" "lan1" "link_10 link_100 link_1000" ucidef_set_led_netdev "lan1-port-activity" "LAN1-PORT-ACTIVITY" "qca8k-0.0:01:amber:lan" "lan1" "tx rx" - ucidef_set_led_netdev "lan2-port-link" "LAN2-PORT-LINK" "qca8k-0.0:02:green:lan" "lan2" "link-10 link-100 link-1000" + ucidef_set_led_netdev "lan2-port-link" "LAN2-PORT-LINK" "qca8k-0.0:02:green:lan" "lan2" "link_10 link_100 link_1000" ucidef_set_led_netdev "lan2-port-activity" "LAN2-PORT-ACTIVITY" "qca8k-0.0:02:amber:lan" "lan2" "tx rx" - ucidef_set_led_netdev "lan3-port-link" "LAN3-PORT-LINK" "qca8k-0.0:03:green:lan" "lan3" "link-10 link-100 link-1000" + ucidef_set_led_netdev "lan3-port-link" "LAN3-PORT-LINK" "qca8k-0.0:03:green:lan" "lan3" "link_10 link_100 link_1000" ucidef_set_led_netdev "lan3-port-activity" "LAN3-PORT-ACTIVITY" "qca8k-0.0:03:amber:lan" "lan3" "tx rx" - ucidef_set_led_netdev "lan4-port-link" "LAN4-PORT-LINK" "qca8k-0.0:04:green:lan" "lan4" "link-10 link-100 link-1000" + ucidef_set_led_netdev "lan4-port-link" "LAN4-PORT-LINK" "qca8k-0.0:04:green:lan" "lan4" "link_10 link_100 link_1000" ucidef_set_led_netdev "lan4-port-activity" "LAN4-PORT-ACTIVITY" "qca8k-0.0:04:amber:lan" "lan4" "tx rx" ;; buffalo,wxr-2533dhp) @@ -48,21 +48,21 @@ nec,wg2600hp) ;; nec,wg2600hp3) ucidef_set_led_netdev "wan" "WAN" "green:active" "wan" - ucidef_set_led_netdev "wan-port-10" "WAN-PORT-10" "qca8k-0.0:00:green:wan-1" "wan" "tx rx link-10" - ucidef_set_led_netdev "wan-port-100" "WAN-PORT-100" "qca8k-0.0:00:green:wan-2" "wan" "tx rx link-100" - ucidef_set_led_netdev "wan-port-1000" "WAN-PORT-1000" "qca8k-0.0:00:green:wan-3" "wan" "tx rx link-1000" - ucidef_set_led_netdev "lan1-port-10" "LAN1-PORT-10" "qca8k-0.0:01:green:lan-1" "lan1" "tx rx link-10" - ucidef_set_led_netdev "lan1-port-100" "LAN1-PORT-100" "qca8k-0.0:01:green:lan-2" "lan1" "tx rx link-100" - ucidef_set_led_netdev "lan1-port-1000" "LAN1-PORT-1000" "qca8k-0.0:01:green:lan-3" "lan1" "tx rx link-1000" - ucidef_set_led_netdev "lan2-port-10" "LAN2-PORT-10" "qca8k-0.0:02:green:lan-1" "lan2" "tx rx link-10" - ucidef_set_led_netdev "lan2-port-100" "LAN2-PORT-100" "qca8k-0.0:02:green:lan-2" "lan2" "tx rx link-100" - ucidef_set_led_netdev "lan2-port-1000" "LAN2-PORT-1000" "qca8k-0.0:02:green:lan-3" "lan2" "tx rx link-1000" - ucidef_set_led_netdev "lan3-port-10" "LAN3-PORT-10" "qca8k-0.0:03:green:lan-1" "lan3" "tx rx link-10" - ucidef_set_led_netdev "lan3-port-100" "LAN3-PORT-100" "qca8k-0.0:03:green:lan-2" "lan3" "tx rx link-100" - ucidef_set_led_netdev "lan3-port-1000" "LAN3-PORT-1000" "qca8k-0.0:03:green:lan-3" "lan3" "tx rx link-1000" - ucidef_set_led_netdev "lan4-port-10" "LAN4-PORT-10" "qca8k-0.0:04:green:lan-1" "lan4" "tx rx link-10" - ucidef_set_led_netdev "lan4-port-100" "LAN4-PORT-100" "qca8k-0.0:04:green:lan-2" "lan4" "tx rx link-100" - ucidef_set_led_netdev "lan4-port-1000" "LAN4-PORT-1000" "qca8k-0.0:04:green:lan-3" "lan4" "tx rx link-1000" + ucidef_set_led_netdev "wan-port-10" "WAN-PORT-10" "qca8k-0.0:00:green:wan-1" "wan" "tx rx link_10" + ucidef_set_led_netdev "wan-port-100" "WAN-PORT-100" "qca8k-0.0:00:green:wan-2" "wan" "tx rx link_100" + ucidef_set_led_netdev "wan-port-1000" "WAN-PORT-1000" "qca8k-0.0:00:green:wan-3" "wan" "tx rx link_1000" + ucidef_set_led_netdev "lan1-port-10" "LAN1-PORT-10" "qca8k-0.0:01:green:lan-1" "lan1" "tx rx link_10" + ucidef_set_led_netdev "lan1-port-100" "LAN1-PORT-100" "qca8k-0.0:01:green:lan-2" "lan1" "tx rx link_100" + ucidef_set_led_netdev "lan1-port-1000" "LAN1-PORT-1000" "qca8k-0.0:01:green:lan-3" "lan1" "tx rx link_1000" + ucidef_set_led_netdev "lan2-port-10" "LAN2-PORT-10" "qca8k-0.0:02:green:lan-1" "lan2" "tx rx link_10" + ucidef_set_led_netdev "lan2-port-100" "LAN2-PORT-100" "qca8k-0.0:02:green:lan-2" "lan2" "tx rx link_100" + ucidef_set_led_netdev "lan2-port-1000" "LAN2-PORT-1000" "qca8k-0.0:02:green:lan-3" "lan2" "tx rx link_1000" + ucidef_set_led_netdev "lan3-port-10" "LAN3-PORT-10" "qca8k-0.0:03:green:lan-1" "lan3" "tx rx link_10" + ucidef_set_led_netdev "lan3-port-100" "LAN3-PORT-100" "qca8k-0.0:03:green:lan-2" "lan3" "tx rx link_100" + ucidef_set_led_netdev "lan3-port-1000" "LAN3-PORT-1000" "qca8k-0.0:03:green:lan-3" "lan3" "tx rx link_1000" + ucidef_set_led_netdev "lan4-port-10" "LAN4-PORT-10" "qca8k-0.0:04:green:lan-1" "lan4" "tx rx link_10" + ucidef_set_led_netdev "lan4-port-100" "LAN4-PORT-100" "qca8k-0.0:04:green:lan-2" "lan4" "tx rx link_100" + ucidef_set_led_netdev "lan4-port-1000" "LAN4-PORT-1000" "qca8k-0.0:04:green:lan-3" "lan4" "tx rx link_1000" ;; netgear,d7800 |\ netgear,r7500 |\ From c60e9d183995823a52669ecae40669154614abe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 10 Nov 2023 11:25:05 +0100 Subject: [PATCH 40/50] ath79: use "fixed-layout" for Embedded Wireless devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Those devices have Ethernet interfaces using base MAC address increased by 0x40 in the 3rd indexed byte (00:00:00:FF:00:00). To describe that we were using a custom (downstream) "mac-address-increment-byte" property. The same result can be achieved by using "mac-base" with a properly adjusted offset value (0x40 << 16). It may be not pretty but it should work without custom property or downstream kernel patch to support it. Cc: Ansuel Smith Cc: Catrinel Catrinescu Cc: Felix Fietkau Signed-off-by: Rafał Miłecki Reviewed-by: Rosen Penev --- .../dts/ar9331_embeddedwireless_dorin.dts | 26 +++++++++---------- .../dts/ar9344_embeddedwireless_balin.dts | 26 ++++++++++--------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts b/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts index de6b709b5cb..6286f203efc 100644 --- a/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts +++ b/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts @@ -85,6 +85,18 @@ label = "art"; reg = <0xff0000 0x010000>; read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_1002: macaddr@1002 { + compatible = "mac-base"; + reg = <0x1002 0x6>; + #nvmem-cell-cells = <1>; + }; + }; }; }; }; @@ -93,10 +105,8 @@ ð1 { status = "okay"; - nvmem-cells = <&macaddr_art_1002>; + nvmem-cells = <&macaddr_art_1002 0x400000>; nvmem-cell-names = "mac-address"; - mac-address-increment-byte = <3>; - mac-address-increment = <0x40>; }; &mdio1 { @@ -108,13 +118,3 @@ mtd-cal-data = <&art 0x1000>; }; - -&art { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_art_1002: macaddr@1002 { - reg = <0x1002 0x6>; - }; -}; diff --git a/target/linux/ath79/dts/ar9344_embeddedwireless_balin.dts b/target/linux/ath79/dts/ar9344_embeddedwireless_balin.dts index a84c273f862..de138658180 100644 --- a/target/linux/ath79/dts/ar9344_embeddedwireless_balin.dts +++ b/target/linux/ath79/dts/ar9344_embeddedwireless_balin.dts @@ -83,16 +83,20 @@ reg = <0xff0000 0x010000>; read-only; - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; - calibration_art_1000: calibration_data@1000 { - reg = <0x1000 0x440>; - }; + calibration_art_1000: calibration_data@1000 { + reg = <0x1000 0x440>; + }; - macaddr_art_1002: macaddr@1002 { - reg = <0x1002 0x6>; + macaddr_art_1002: macaddr@1002 { + compatible = "mac-base"; + reg = <0x1002 0x6>; + #nvmem-cell-cells = <1>; + }; }; }; }; @@ -106,10 +110,8 @@ ð1 { status = "okay"; - nvmem-cells = <&macaddr_art_1002>; + nvmem-cells = <&macaddr_art_1002 0x400000>; nvmem-cell-names = "mac-address"; - mac-address-increment-byte = <3>; - mac-address-increment = <0x40>; gmac-config { device = <&gmac>; @@ -121,7 +123,7 @@ &wmac { status = "okay"; - nvmem-cells = <&macaddr_art_1002>, <&calibration_art_1000>; + nvmem-cells = <&macaddr_art_1002 0>, <&calibration_art_1000>; nvmem-cell-names = "mac-address", "calibration"; }; From 943c153cdd695904b9b7fe44800fc3546644973e Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 12 Nov 2023 19:14:46 +0100 Subject: [PATCH 41/50] scripts/dump-target-info.pl: add new function to DUMP devices Add new function to dump-targer-info.pl to DUMP devices provided a matching target/subtarget. Example: ./scripts/dump-targer-info.pl devices ipq806x/generic will produce the sorted list of devices defined in the following format: device_id device_name Devices may have alternative names, the script will dump each alternative name in the same line of device_id. Following the pattern: device_id "PRIMARY DEVICE NAME" "ALT0 DEVICE NAME" "ALT1 DEVICE NAME" ... Example: tplink_ad7200 "TP-Link AD7200 v1/v2" "TP-Link Talon AD7200 v1/v2" Signed-off-by: Christian Marangi --- scripts/dump-target-info.pl | 80 ++++++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-) diff --git a/scripts/dump-target-info.pl b/scripts/dump-target-info.pl index 0e4af17fe04..eec06ed6c49 100755 --- a/scripts/dump-target-info.pl +++ b/scripts/dump-target-info.pl @@ -4,7 +4,7 @@ use strict; use warnings; use Cwd; -my (%targets, %architectures, %kernels); +my (%targets, %architectures, %kernels, %devices); $ENV{'TOPDIR'} = Cwd::getcwd(); @@ -56,6 +56,68 @@ sub parse_targetinfo { } } +sub parse_devices { + my ($target_dir, $subtarget) = @_; + + if (open M, "make -C '$target_dir' --no-print-directory DUMP=1 TARGET_BUILD=1 SUBTARGET='$subtarget' V=s |") { + my ($device_profile, $device_name, @device_alt_names, $device_is_alt); + while (defined(my $line = readline M)) { + chomp $line; + + if ($line =~ /^Target-Profile-Name: (.+)$/) { + $device_name = $1; + } + elsif ($line =~ /^Target-Profile: DEVICE_(.+)$/) { + $device_profile = $1; + } + # Logic behind this. + # DUMP duplicate info for each alternative device name and + # the alternative device name are printed first before the + # primary device name + # Alternative device titles always have the full list of + # all the alternative device name. + # The device name pattern for an alternative device name is + # Target-Profile-Name: ALT_NAME (PRIMARY_NAME) + # We compare the detected device name and check if it does + # match the alternative device name pattern with one of + # the alternative device name in Alternative device titles: + # If an alternative device name is detected, + # alternative device is skipped. + elsif ($line =~ /^Alternative device titles:$/) { + while (defined($line = readline M)) { + if ($line =~ /^- (.+)$/) { + if ($device_name =~ /^\Q$1\E \((.+)\)$/) { + $device_is_alt = 1; + last; + } + push @device_alt_names, $1; + } + else { + last; + } + } + } + if ($line =~ /^@\@$/) { + if ($device_name && $device_profile && ! $device_is_alt) { + push @{$devices{$device_profile}}, $device_name; + + if (scalar @device_alt_names) { + foreach my $device_alt_name (sort values @device_alt_names) { + push @{$devices{$device_profile}}, $device_alt_name; + } + } + } + + undef $device_name; + undef $device_profile; + undef $device_is_alt; + @device_alt_names = (); + } + } + close M; + } +} + sub get_targetinfo { foreach my $target_makefile (glob "target/linux/*/Makefile") { my ($target_dir) = $target_makefile =~ m!^(.+)/Makefile$!; @@ -86,6 +148,15 @@ sub get_targetinfo { } } +sub get_devices { + my ($target_subtarget) = @_; + my ($target, $subtarget) = split /\//, $target_subtarget; + + my ($target_dir) = "target/linux/" . $target; + + parse_devices($target_dir, $subtarget) +} + if (@ARGV == 1 && $ARGV[0] eq 'targets') { get_targetinfo(); foreach my $target_name (sort keys %targets) { @@ -104,8 +175,15 @@ elsif (@ARGV == 1 && $ARGV[0] eq 'kernels') { printf "%s %s\n", $target_name, join ' ', @{$kernels{$target_name}}; } } +elsif (@ARGV == 2 && $ARGV[0] eq 'devices') { + get_devices($ARGV[1]); + foreach my $device (sort keys %devices) { + printf "%s \"%s\"\n", $device, join '" "', @{$devices{$device}}; + } +} else { print "Usage: $0 targets\n"; print "Usage: $0 architectures\n"; print "Usage: $0 kernels\n"; + print "Usage: $0 devices \n"; } From a4735359aa6d8238bdbeef75b40e98432ef70f0d Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 13 Nov 2023 02:01:01 +0100 Subject: [PATCH 42/50] github: add release info to BUG template Add release info to BUG template. Having the reported release is an additional info to better bisect the bug and what release is affected. This is also useful in preparation for action that will parse BUG template and add tag and do validations. Signed-off-by: Christian Marangi --- .github/ISSUE_TEMPLATE/bug-report.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index fed2b8de7c9..2ec7b7d7d88 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -19,6 +19,15 @@ body: ```. /etc/openwrt_release && echo $DISTRIB_REVISION``` validations: required: true + - type: input + id: release + attributes: + label: OpenWrt release + description: | + The OpenWrt release or commit hash where this bug occurs (use command below). + ```. /etc/openwrt_release && echo $DISTRIB_RELEASE``` + validations: + required: true - type: input id: target attributes: From e3a0476d1bdcbf5692e97135d3e653b4cdd84cda Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 13 Nov 2023 02:09:57 +0100 Subject: [PATCH 43/50] CI: add issue labeller action Add issue labeler action. This action will parse BUG issue from the template and will make validation on the insert data. The action will: - Tag the issue with SNAPSHOT or release based on the provided release - Tag the issue with the reported tag - Tag the issue with the image kind (Official or Self Built) - Validate the reported version exist - Validate the reported release exist - Validate the reported device exist Will also tag the issue with useful tag or flag the issue as invalid. Will also comment the issue with the invalid info provided. Signed-off-by: Christian Marangi --- .github/workflows/issue-labeller.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/workflows/issue-labeller.yml diff --git a/.github/workflows/issue-labeller.yml b/.github/workflows/issue-labeller.yml new file mode 100644 index 00000000000..585bd279e04 --- /dev/null +++ b/.github/workflows/issue-labeller.yml @@ -0,0 +1,11 @@ +name: Issue Labeller +on: + issues: + types: [ opened ] + +jobs: + label-component: + name: Validate and Tag Bug Report + permissions: + issues: write + uses: openwrt/actions-shared-workflows/.github/workflows/issue-labeller.yml@main From 17feb04ad4d06460a6d33a13e65dfdd2fdebaada Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Tue, 14 Nov 2023 14:51:14 +0100 Subject: [PATCH 44/50] qca-ssdk: disable building ISISC ISISC is the QCA codename for their Atheros switch family including AR237, QCA8337 etc. Since we have qca8k support in OpenWrt, there is no need to have SSDK support for these switches, and boards that also have external switches can just use qca8k. Disable QCA803x PHY support as well, since all of those are supportable via at803x driver. Signed-off-by: Robert Marko --- package/kernel/qca-ssdk/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/kernel/qca-ssdk/Makefile b/package/kernel/qca-ssdk/Makefile index 3770d29e8c5..d8c8d6cb167 100644 --- a/package/kernel/qca-ssdk/Makefile +++ b/package/kernel/qca-ssdk/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=qca-ssdk -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/qca-ssdk.git PKG_SOURCE_PROTO:=git @@ -45,6 +45,7 @@ MAKE_FLAGS+= \ EXTRA_CFLAGS=-fno-stack-protector -I$(STAGING_DIR)/usr/include \ SoC=$(CONFIG_TARGET_SUBTARGET) \ PTP_FEATURE=disable SWCONFIG_FEATURE=disable \ + ISISC_ENABLE=disable IN_QCA803X_PHY=FALSE \ $(LNX_CONFIG_OPTS) ifeq ($(CONFIG_TARGET_SUBTARGET), "ipq807x") From f3cd4bfb7f697bb885e976627ac2ecbb99e80c60 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Tue, 14 Nov 2023 22:35:31 +0100 Subject: [PATCH 45/50] ipq807x: fix multiple error on ESS switch port define Fix multiple error on ESS switch port define. - Fix wrong switch CPU and WAN bmp define. (many times wan port are actually set in lan mask and lan port in wan mask) - Renumber phyinfo port, use port_id instead of phy_address as it doesn't make sense using that for port enumeration - Drop additional port for devices that have them not connected. Signed-off-by: Christian Marangi --- .../arm64/boot/dts/qcom/ipq8070-cax1800.dts | 21 ++----------------- .../arm64/boot/dts/qcom/ipq8071-ax3600.dtsi | 12 +++++------ .../arm64/boot/dts/qcom/ipq8071-eap102.dts | 8 +++---- .../arch/arm64/boot/dts/qcom/ipq8072-301w.dts | 4 ++-- .../arm64/boot/dts/qcom/ipq8072-ax880.dts | 8 +++---- .../arm64/boot/dts/qcom/ipq8072-ax9000.dts | 10 ++++----- .../arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts | 10 ++++----- .../arch/arm64/boot/dts/qcom/ipq8072-haze.dts | 10 ++++----- .../arm64/boot/dts/qcom/ipq8072-wax218.dts | 4 ++-- .../arm64/boot/dts/qcom/ipq8072-wax620.dts | 4 ++-- .../arm64/boot/dts/qcom/ipq8072-wpq873.dts | 2 +- .../arm64/boot/dts/qcom/ipq8074-nbg7815.dts | 16 +++++++------- .../arm64/boot/dts/qcom/ipq8074-rax120v2.dts | 4 ++-- .../arm64/boot/dts/qcom/ipq8074-wax630.dts | 7 +++---- .../boot/dts/qcom/ipq8074-wxr-5950ax12.dts | 16 +++++++------- 15 files changed, 59 insertions(+), 77 deletions(-) diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8070-cax1800.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8070-cax1800.dts index 6dbd0e95f51..622b8662fa9 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8070-cax1800.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8070-cax1800.dts @@ -271,28 +271,11 @@ &switch { status = "okay"; - switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; /* lan port bitmap */ - switch_wan_bmp = ; /* wan port bitmap */ + switch_lan_bmp = ; /* lan port bitmap */ switch_mac_mode = ; /* mac mode for uniphy instance0*/ qcom,port_phyinfo { - port@0 { - port_id = <1>; - phy_address = <0>; - }; - port@1 { - port_id = <2>; - phy_address = <1>; - }; - port@2 { - port_id = <3>; - phy_address = <2>; - }; - port@3 { - port_id = <4>; - phy_address = <3>; - }; - port@4 { + port@5 { port_id = <5>; phy_address = <4>; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600.dtsi index 0494fff0e36..23b9121d5fc 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600.dtsi @@ -235,24 +235,24 @@ &switch { status = "okay"; - switch_lan_bmp = <(ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; /* lan port bitmap */ - switch_wan_bmp = ; /* wan port bitmap */ + switch_lan_bmp = <(ESS_PORT3 | ESS_PORT4 | ESS_PORT5)>; /* lan port bitmap */ + switch_wan_bmp = ; /* wan port bitmap */ switch_mac_mode = ; /* mac mode for uniphy instance0*/ qcom,port_phyinfo { - port@1 { + port@2 { port_id = <2>; phy_address = <1>; }; - port@2 { + port@3 { port_id = <3>; phy_address = <2>; }; - port@3 { + port@4 { port_id = <4>; phy_address = <3>; }; - port@4 { + port@5 { port_id = <5>; phy_address = <4>; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-eap102.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-eap102.dts index d76c9a12eb6..7067f929687 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-eap102.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-eap102.dts @@ -343,18 +343,18 @@ &switch { status = "okay"; - switch_lan_bmp = ; /* lan port bitmap */ - switch_wan_bmp = ; /* wan port bitmap */ + switch_lan_bmp = ; /* lan port bitmap */ + switch_wan_bmp = ; /* wan port bitmap */ switch_mac_mode1 = ; /* mac mode for uniphy instance1*/ switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ qcom,port_phyinfo { - port@4 { + port@5 { port_id = <5>; phy_address = <24>; port_mac_sel = "QGMAC_PORT"; }; - port@5 { + port@6 { port_id = <6>; phy_address = <28>; port_mac_sel = "QGMAC_PORT"; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts index 683cf775b3e..a7d398ee0f1 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts @@ -321,8 +321,8 @@ &switch { status = "okay"; - switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4 | ESS_PORT5)>; /* lan port bitmap */ - switch_wan_bmp = ; /* wan port bitmap */ + switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4 | ESS_PORT6)>; /* lan port bitmap */ + switch_wan_bmp = ; /* wan port bitmap */ malibu_first_phy_addr = <16>; /* PHY addr of the first malibu PHY */ switch_mac_mode = ; /* mac mode for uniphy instance0*/ switch_mac_mode1 = ; /* mac mode for uniphy instance1*/ diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax880.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax880.dts index 81affdc3d0d..73bc13cf320 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax880.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax880.dts @@ -325,18 +325,18 @@ &switch { status = "okay"; - switch_lan_bmp = ; /* lan port bitmap */ - switch_wan_bmp = ; /* wan port bitmap */ + switch_lan_bmp = ; /* lan port bitmap */ + switch_wan_bmp = ; /* wan port bitmap */ switch_mac_mode1 = ; /* mac mode for uniphy instance1*/ switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ qcom,port_phyinfo { - port@4 { + port@5 { port_id = <5>; phy_address = <24>; port_mac_sel = "QGMAC_PORT"; }; - port@5 { + port@6 { port_id = <6>; phy_address = <28>; port_mac_sel = "QGMAC_PORT"; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax9000.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax9000.dts index 9e97e4e066b..fbf5b41d85f 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax9000.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax9000.dts @@ -388,23 +388,23 @@ switch_mac_mode1 = ; /* mac mode for uniphy instance1*/ qcom,port_phyinfo { - port@0 { + port@1 { port_id = <1>; phy_address = <0>; }; - port@1 { + port@2 { port_id = <2>; phy_address = <1>; }; - port@2 { + port@3 { port_id = <3>; phy_address = <2>; }; - port@3 { + port@4 { port_id = <4>; phy_address = <3>; }; - port@4 { + port@5 { port_id = <5>; phy_address = <24>; port_mac_sel = "QGMAC_PORT"; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts index e2971103c84..a4548a77831 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts @@ -175,23 +175,23 @@ switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ qcom,port_phyinfo { - port@0 { + port@1 { port_id = <1>; phy_address = <0>; }; - port@1 { + port@2 { port_id = <2>; phy_address = <1>; }; - port@2 { + port@3 { port_id = <3>; phy_address = <2>; }; - port@3 { + port@4 { port_id = <4>; phy_address = <3>; }; - port@5 { + port@6 { port_id = <6>; phy_address = <28>; port_mac_sel = "QGMAC_PORT"; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts index ba22d16c0a6..34499641596 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts @@ -193,23 +193,23 @@ switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ qcom,port_phyinfo { - port@0 { + port@1 { port_id = <1>; phy_address = <0>; }; - port@1 { + port@2 { port_id = <2>; phy_address = <1>; }; - port@2 { + port@3 { port_id = <3>; phy_address = <2>; }; - port@3 { + port@4 { port_id = <4>; phy_address = <3>; }; - port@4 { + port@6 { port_id = <6>; phy_address = <8>; compatible = "ethernet-phy-ieee802.3-c45"; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax218.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax218.dts index 9da475c5e70..33a618851c7 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax218.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax218.dts @@ -89,12 +89,12 @@ &switch { status = "okay"; - switch_wan_bmp = ; + switch_lan_bmp = ; switch_mac_mode = ; switch_mac_mode2 = ; qcom,port_phyinfo { - port@5 { + port@6 { port_id = <6>; phy_address = <28>; port_mac_sel = "QGMAC_PORT"; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax620.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax620.dts index c4cc8c0b97a..74dae6cbf3d 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax620.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax620.dts @@ -117,12 +117,12 @@ &switch { status = "okay"; - switch_wan_bmp = ; + switch_lan_bmp = ; switch_mac_mode = ; switch_mac_mode2 = ; qcom,port_phyinfo { - port@5 { + port@6 { port_id = <6>; phy_address = <28>; port_mac_sel = "QGMAC_PORT"; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wpq873.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wpq873.dts index b9a882f1dba..a450fbca25c 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wpq873.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wpq873.dts @@ -407,7 +407,7 @@ port_id = <4>; phy_address = <3>; }; - port@5 { + port@6 { port_id = <6>; phy_address = <28>; port_mac_sel = "QGMAC_PORT"; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts index 0931c8ca326..5fb8f3b4de4 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts @@ -298,40 +298,40 @@ &switch { status = "okay"; - switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4 | ESS_PORT5)>; - switch_wan_bmp = ; + switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4 | ESS_PORT6)>; + switch_wan_bmp = ; switch_mac_mode = ; switch_mac_mode1 = ; switch_mac_mode2 = ; qcom,port_phyinfo { - port@0 { + port@1 { port_id = <1>; phy_address = <0>; }; - port@1 { + port@2 { port_id = <2>; phy_address = <1>; }; - port@2 { + port@3 { port_id = <3>; phy_address = <2>; }; - port@3 { + port@4 { port_id = <4>; phy_address = <3>; }; - port@4 { + port@5 { port_id = <5>; phy_address = <28>; port_mac_sel = "QGMAC_PORT"; }; - port@5 { + port@6 { port_id = <6>; ethernet-phy-ieee802.3-c45; phy_address = <8>; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-rax120v2.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-rax120v2.dts index 501b53982cb..0a5bbb4c35d 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-rax120v2.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-rax120v2.dts @@ -195,8 +195,8 @@ &switch { status = "okay"; - switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4 | ESS_PORT5)>; /* lan port bitmap */ - switch_wan_bmp = ; /* wan port bitmap */ + switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4 | ESS_PORT6)>; /* lan port bitmap */ + switch_wan_bmp = ; /* wan port bitmap */ switch_mac_mode = ; /* mac mode for uniphy instance0*/ switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wax630.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wax630.dts index af06fac3a46..9999f112af9 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wax630.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wax630.dts @@ -151,18 +151,17 @@ &switch { status = "okay"; - switch_lan_bmp = ; - switch_wan_bmp = ; + switch_lan_bmp = ; switch_mac_mode = ; switch_mac_mode2 = ; qcom,port_phyinfo { - port@3 { + port@4 { port_id = <4>; phy_address = <3>; }; - port@5 { + port@6 { port_id = <6>; phy_address = <28>; port_mac_sel = "QGMAC_PORT"; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wxr-5950ax12.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wxr-5950ax12.dts index 88ae3831173..18386c766c3 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wxr-5950ax12.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wxr-5950ax12.dts @@ -267,40 +267,40 @@ &switch { status = "okay"; - switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4 | ESS_PORT5)>; - switch_wan_bmp = ; + switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4 | ESS_PORT6)>; + switch_wan_bmp = ; switch_mac_mode = ; switch_mac_mode1 = ; switch_mac_mode2 = ; qcom,port_phyinfo { - port@0 { + port@1 { port_id = <1>; phy_address = <0x18>; }; - port@1 { + port@2 { port_id = <2>; phy_address = <0x19>; }; - port@2 { + port@3 { port_id = <3>; phy_address = <0x1a>; }; - port@3 { + port@4 { port_id = <4>; phy_address = <0x1b>; }; - port@4 { + port@5 { port_id = <5>; ethernet-phy-ieee802.3-c45; phy_address = <0x0>; }; - port@5 { + port@6 { port_id = <6>; ethernet-phy-ieee802.3-c45; phy_address = <0x8>; From 76a981560ae54b93adfc4aa741a4e756489bdd1b Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 15 Nov 2023 11:23:23 +0100 Subject: [PATCH 46/50] ipq807x: fix typo in WAX630 for switch lan bmp In fixing ipq8074 WAX630 dts, there was a typo in the switch lan bmp. Fix it to fix compilarion error. Fixes: f3cd4bfb7f69 ("ipq807x: fix multiple error on ESS switch port define") Signed-off-by: Christian Marangi --- .../files/arch/arm64/boot/dts/qcom/ipq8074-wax630.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wax630.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wax630.dts index 9999f112af9..685e4243ddb 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wax630.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wax630.dts @@ -151,7 +151,7 @@ &switch { status = "okay"; - switch_lan_bmp = ; + switch_lan_bmp = <(ESS_PORT4 | ESS_PORT6)>; switch_mac_mode = ; switch_mac_mode2 = ; From 6647e6d219d6ac460b04ff6b73931a4ae521df3c Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Wed, 15 Nov 2023 17:35:38 +0100 Subject: [PATCH 47/50] qualcommax: fix line endings in ESS dt-bindings It seems that ESS dt-bindings somehow ended up with Windows line endings, this is obviously incorrect, so lets convert it to UNIX endings. Signed-off-by: Robert Marko --- .../include/dt-bindings/net/qcom-ipq-ess.h | 84 +++++++++---------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/target/linux/qualcommax/files/include/dt-bindings/net/qcom-ipq-ess.h b/target/linux/qualcommax/files/include/dt-bindings/net/qcom-ipq-ess.h index 5b44620de54..baa7c895648 100644 --- a/target/linux/qualcommax/files/include/dt-bindings/net/qcom-ipq-ess.h +++ b/target/linux/qualcommax/files/include/dt-bindings/net/qcom-ipq-ess.h @@ -1,42 +1,42 @@ -/* SPDX-License-Identifier: GPL-2.0 */ - -#ifndef _DT_BINDINGS_NET_QCOM_IPQ_ESS_H -#define _DT_BINDINGS_NET_QCOM_IPQ_ESS_H - -#define ESS_PORT0 0x1 -#define ESS_PORT1 0x2 -#define ESS_PORT2 0x4 -#define ESS_PORT3 0x8 -#define ESS_PORT4 0x10 -#define ESS_PORT5 0x20 -#define ESS_PORT6 0x40 -#define ESS_PORT7 0x80 - -/* SSDK MAC/UNIPHY modes */ -#define MAC_MODE_PSGMII 0x0 -#define MAC_MODE_PSGMII_RGMII5 0x1 -#define MAC_MODE_SGMII0_RGMII5 0x2 -#define MAC_MODE_SGMII1_RGMII5 0x3 -#define MAC_MODE_PSGMII_RMII0 0x4 -#define MAC_MODE_PSGMII_RMII1 0x5 -#define MAC_MODE_PSGMII_RMII0_RMII1 0x6 -#define MAC_MODE_PSGMII_RGMII4 0x7 -#define MAC_MODE_SGMII0_RGMII4 0x8 -#define MAC_MODE_SGMII1_RGMII4 0x9 -#define MAC_MODE_SGMII4_RGMII4 0xa -#define MAC_MODE_QSGMII 0xb -#define MAC_MODE_SGMII_PLUS 0xc -#define MAC_MODE_USXGMII 0xd -#define MAC_MODE_10GBASE_R 0xe -#define MAC_MODE_SGMII_CHANNEL0 0xf -#define MAC_MODE_SGMII_CHANNEL1 0x10 -#define MAC_MODE_SGMII_CHANNEL4 0x11 -#define MAC_MODE_RGMII 0x12 -#define MAC_MODE_PSGMII_FIBER 0x13 -#define MAC_MODE_SGMII_FIBER 0x14 -#define MAC_MODE_UQXGMII 0x15 -#define MAC_MODE_UDXGMII 0x16 -#define MAC_MODE_UQXGMII_3CHANNELS 0x17 -#define MAC_MODE_DISABLED 0xff - -#endif /* _DT_BINDINGS_NET_QCOM_IPQ_ESS_H */ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef _DT_BINDINGS_NET_QCOM_IPQ_ESS_H +#define _DT_BINDINGS_NET_QCOM_IPQ_ESS_H + +#define ESS_PORT0 0x1 +#define ESS_PORT1 0x2 +#define ESS_PORT2 0x4 +#define ESS_PORT3 0x8 +#define ESS_PORT4 0x10 +#define ESS_PORT5 0x20 +#define ESS_PORT6 0x40 +#define ESS_PORT7 0x80 + +/* SSDK MAC/UNIPHY modes */ +#define MAC_MODE_PSGMII 0x0 +#define MAC_MODE_PSGMII_RGMII5 0x1 +#define MAC_MODE_SGMII0_RGMII5 0x2 +#define MAC_MODE_SGMII1_RGMII5 0x3 +#define MAC_MODE_PSGMII_RMII0 0x4 +#define MAC_MODE_PSGMII_RMII1 0x5 +#define MAC_MODE_PSGMII_RMII0_RMII1 0x6 +#define MAC_MODE_PSGMII_RGMII4 0x7 +#define MAC_MODE_SGMII0_RGMII4 0x8 +#define MAC_MODE_SGMII1_RGMII4 0x9 +#define MAC_MODE_SGMII4_RGMII4 0xa +#define MAC_MODE_QSGMII 0xb +#define MAC_MODE_SGMII_PLUS 0xc +#define MAC_MODE_USXGMII 0xd +#define MAC_MODE_10GBASE_R 0xe +#define MAC_MODE_SGMII_CHANNEL0 0xf +#define MAC_MODE_SGMII_CHANNEL1 0x10 +#define MAC_MODE_SGMII_CHANNEL4 0x11 +#define MAC_MODE_RGMII 0x12 +#define MAC_MODE_PSGMII_FIBER 0x13 +#define MAC_MODE_SGMII_FIBER 0x14 +#define MAC_MODE_UQXGMII 0x15 +#define MAC_MODE_UDXGMII 0x16 +#define MAC_MODE_UQXGMII_3CHANNELS 0x17 +#define MAC_MODE_DISABLED 0xff + +#endif /* _DT_BINDINGS_NET_QCOM_IPQ_ESS_H */ From af64898c2617babcf27ba2ae8c07dc801c208964 Mon Sep 17 00:00:00 2001 From: Philip Prindeville Date: Sun, 5 Nov 2023 12:23:29 -0700 Subject: [PATCH 48/50] dnsmasq: Invoke new ipcalc with CIDR notation The new rewritten ipcalc.sh understands 3 notations: ipaddr/prefix ... ipaddr/dotted-netmask ... ipaddr dotted-netmask ... meaning that the previous 4th non-standard notation of "ipaddr prefix" will be dropped, alas that's the notation that dnsmasq currently uses. This change has us using the first notation which is the most common. This behavior came in as https://github.com/openwrt/openwrt/commit/eda27e8382f3e5253defab5419e95d4b51f72de3 a long time ago. Signed-off-by: Philip Prindeville --- package/network/services/dnsmasq/Makefile | 2 +- package/network/services/dnsmasq/files/dnsmasq.init | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile index e442d0005b9..241f3463e2f 100644 --- a/package/network/services/dnsmasq/Makefile +++ b/package/network/services/dnsmasq/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dnsmasq PKG_UPSTREAM_VERSION:=2.89 PKG_VERSION:=$(subst test,~~test,$(subst rc,~rc,$(PKG_UPSTREAM_VERSION))) -PKG_RELEASE:=6 +PKG_RELEASE:=7 PKG_SOURCE:=$(PKG_NAME)-$(PKG_UPSTREAM_VERSION).tar.xz PKG_SOURCE_URL:=https://thekelleys.org.uk/dnsmasq/ diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init index d356a21f81f..0c769602366 100755 --- a/package/network/services/dnsmasq/files/dnsmasq.init +++ b/package/network/services/dnsmasq/files/dnsmasq.init @@ -539,8 +539,13 @@ dhcp_add() { # Do not support non-static interfaces for now [ static = "$proto" ] || return 0 + ipaddr="${subnet%%/*}" + prefix_or_netmask="${subnet##*/}" + # Override interface netmask with dhcp config if applicable - config_get netmask "$cfg" netmask "${subnet##*/}" + config_get netmask "$cfg" netmask + + [ -n "$netmask" ] && prefix_or_netmask="$netmask" #check for an already active dhcp server on the interface, unless 'force' is set config_get_bool force "$cfg" force 0 @@ -583,7 +588,7 @@ dhcp_add() { nettag="${networkid:+set:${networkid},}" # make sure the DHCP range is not empty - if [ "$dhcpv4" != "disabled" ] && ipcalc "${subnet%%/*}" "$netmask" "$start" "$limit" ; then + if [ "$dhcpv4" != "disabled" ] && ipcalc "$ipaddr/$prefix_or_netmask" "$start" "$limit" ; then [ "$dynamicdhcpv4" = "0" ] && END="static" xappend "--dhcp-range=$tags$nettag$START,$END,$NETMASK,$leasetime${options:+ $options}" From 255d5c9bf8430bea8ee342b0132be0787b509634 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Thu, 16 Nov 2023 12:36:37 +0100 Subject: [PATCH 49/50] CI: issue-labeller: fix wrong CRLF line-ending Fix wrong CRLF line-ending in issue-labeller workflow. Fixes: e3a0476d1bdc ("CI: add issue labeller action") Signed-off-by: Christian Marangi --- .github/workflows/issue-labeller.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/issue-labeller.yml b/.github/workflows/issue-labeller.yml index 585bd279e04..c94b99b5ecb 100644 --- a/.github/workflows/issue-labeller.yml +++ b/.github/workflows/issue-labeller.yml @@ -1,11 +1,11 @@ -name: Issue Labeller -on: - issues: - types: [ opened ] - -jobs: - label-component: - name: Validate and Tag Bug Report - permissions: - issues: write - uses: openwrt/actions-shared-workflows/.github/workflows/issue-labeller.yml@main +name: Issue Labeller +on: + issues: + types: [ opened ] + +jobs: + label-component: + name: Validate and Tag Bug Report + permissions: + issues: write + uses: openwrt/actions-shared-workflows/.github/workflows/issue-labeller.yml@main From 9062e5faaedc03823ee419fe34de1de73f48babc Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Wed, 15 Nov 2023 23:04:46 +0100 Subject: [PATCH 50/50] qualcommax: add addresses to DP nodes DP nodes live under the soc node, and since soc is a simple bus it requires node adresses to be present. So, simply add the node addreses to avoid the following dtc warning: Warning (unit_address_vs_reg): /soc/dp1: node has a reg or ranges property, but no unit name Warning (unit_address_vs_reg): /soc/dp2: node has a reg or ranges property, but no unit name Warning (unit_address_vs_reg): /soc/dp3: node has a reg or ranges property, but no unit name Warning (unit_address_vs_reg): /soc/dp4: node has a reg or ranges property, but no unit name Warning (unit_address_vs_reg): /soc/dp5: node has a reg or ranges property, but no unit name Warning (unit_address_vs_reg): /soc/dp6: node has a reg or ranges property, but no unit name Warning (unit_address_vs_reg): /soc/dp5-syn: node has a reg or ranges property, but no unit name Warning (unit_address_vs_reg): /soc/dp6-syn: node has a reg or ranges property, but no unit name Signed-off-by: Robert Marko --- .../arch/arm64/boot/dts/qcom/ipq8074-ess.dtsi | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-ess.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-ess.dtsi index a4ed3ce38cd..d3f4211ecf9 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-ess.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-ess.dtsi @@ -469,7 +469,7 @@ status = "disabled"; }; - dp1: dp1 { + dp1: dp1@3a001000 { device_type = "network"; compatible = "qcom,nss-dp"; qcom,id = <1>; @@ -480,7 +480,7 @@ status = "disabled"; }; - dp2: dp2 { + dp2: dp2@3a001200 { device_type = "network"; compatible = "qcom,nss-dp"; qcom,id = <2>; @@ -491,7 +491,7 @@ status = "disabled"; }; - dp3: dp3 { + dp3: dp3@3a001400 { device_type = "network"; compatible = "qcom,nss-dp"; qcom,id = <3>; @@ -502,7 +502,7 @@ status = "disabled"; }; - dp4: dp4 { + dp4: dp4@3a001600 { device_type = "network"; compatible = "qcom,nss-dp"; qcom,id = <4>; @@ -513,7 +513,7 @@ status = "disabled"; }; - dp5: dp5 { + dp5: dp5@3a001800 { device_type = "network"; compatible = "qcom,nss-dp"; qcom,id = <5>; @@ -524,7 +524,7 @@ status = "disabled"; }; - dp6: dp6 { + dp6: dp6@3a001a00 { device_type = "network"; compatible = "qcom,nss-dp"; qcom,id = <6>; @@ -535,7 +535,7 @@ status = "disabled"; }; - dp5_syn: dp5-syn { + dp5_syn: dp5-syn@3a003000 { device_type = "network"; compatible = "qcom,nss-dp"; qcom,id = <5>; @@ -546,7 +546,7 @@ status = "disabled"; }; - dp6_syn: dp6-syn { + dp6_syn: dp6-syn@3a007000 { device_type = "network"; compatible = "qcom,nss-dp"; qcom,id = <6>;