From 3c5809699df1240d9c7b2dd38578920f87f27150 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Tue, 17 Dec 2024 12:07:20 -0800 Subject: [PATCH 001/173] ath79: add missing compatible for ath9k The fritz 300e has an AR9382, which is atypical for ar7242 platforms. Document it properly. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/17427 Signed-off-by: Nick Hainke --- target/linux/ath79/dts/ar7242_avm_fritz300e.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ath79/dts/ar7242_avm_fritz300e.dts b/target/linux/ath79/dts/ar7242_avm_fritz300e.dts index f8ca3ed5639..3d04b24082b 100644 --- a/target/linux/ath79/dts/ar7242_avm_fritz300e.dts +++ b/target/linux/ath79/dts/ar7242_avm_fritz300e.dts @@ -141,6 +141,7 @@ status = "okay"; ath9k: wifi@0,0 { + compatible = "pci168c,0030"; reg = <0x0000 0 0 0 0>; #gpio-cells = <2>; gpio-controller; From 874e0accae5121534259cc8b1bd3107bd104dd24 Mon Sep 17 00:00:00 2001 From: Mieczyslaw Nalewaj Date: Sun, 29 Dec 2024 14:24:32 +0100 Subject: [PATCH 002/173] loongarch64: remove redundant CONFIG_LIST_HARDENED Delete CONFIG_LIST_HARDENED which you already find in target/generic config. Signed-off-by: Mieczyslaw Nalewaj Link: https://github.com/openwrt/openwrt/pull/17420 Signed-off-by: Nick Hainke --- target/linux/loongarch64/config-6.6 | 1 - 1 file changed, 1 deletion(-) diff --git a/target/linux/loongarch64/config-6.6 b/target/linux/loongarch64/config-6.6 index 57bc7d5691a..5052137b186 100644 --- a/target/linux/loongarch64/config-6.6 +++ b/target/linux/loongarch64/config-6.6 @@ -396,7 +396,6 @@ CONFIG_LEDS_TRIGGER_MTD=y CONFIG_LEDS_TRIGGER_PANIC=y CONFIG_LEGACY_TIOCSTI=y CONFIG_LIBFDT=y -CONFIG_LIST_HARDENED=y CONFIG_LOCKUP_DETECTOR=y CONFIG_LOCK_DEBUGGING_SUPPORT=y CONFIG_LOCK_SPIN_ON_OWNER=y From 12b8d5c83c5235fa7c7be870e979e2de6dd1d3c9 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 30 Dec 2024 18:38:42 +0100 Subject: [PATCH 003/173] wifi-scripts: ucode: iwinfo: skip uninitialized PHYs They show up as null entries in the nl80211 wiphy dump. Fixes the following error: Reference error: left-hand side expression is null In find_phy(), file /usr/share/ucode/iwinfo.uc, line 19, byte 11: called from function get_max_power (/usr/share/ucode/iwinfo.uc:42:32) called from function module (/usr/share/ucode/iwinfo.uc:102:39) called from anonymous function (/usr/bin/iwinfo:5:25) ` if (phy.wiphy == wiphy)` Near here ------^ Signed-off-by: Felix Fietkau --- .../config/wifi-scripts/files-ucode/usr/share/ucode/iwinfo.uc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/iwinfo.uc b/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/iwinfo.uc index a266092bea3..4ce45b21f1c 100644 --- a/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/iwinfo.uc +++ b/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/iwinfo.uc @@ -16,7 +16,7 @@ let wireless_status = ubus.call('network.wireless', 'status'); function find_phy(wiphy) { for (let k, phy in phys) - if (phy.wiphy == wiphy) + if (phy && phy.wiphy == wiphy) return phy; return null; } From bff5260d7b2f706f6d32acbb4fbe5f10d7acca5c Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 30 Dec 2024 21:27:46 +0100 Subject: [PATCH 004/173] mt76: update to Git HEAD (2024-12-30) 109114146f9c mt76: only enable tx worker after setting the channel 5fe42ec88fd1 mt76: mt7915: ensure that only one sta entry is active per mac address 1884f568ba02 wifi: mt76: do not add wcid entries to sta poll list during MCU reset 71fa9124d107 wifi: mt76: mt7996: fix NULL pointer dereference in mt7996_mcu_sta_bfer_he eb85bb3fd5bf wifi: mt76: mt7915: fix eifs value on older chipsets 83e4d4a82e65 wifi: mt76: introduce mt792x_config_mac_addr_list routine b47e20b440ae wifi: mt76: mt7925: fix NULL deref check in mt7925_change_vif_links 3e3c484726f3 wifi: mt76: mt7925: fix wrong band_idx setting when enable sniffer mode 3f1401a0f035 wifi: mt76: mt7925: fix get wrong chip cap from incorrect pointer eede99f524e8 wifi: mt76: mt7925: fix the invalid ip address for arp offload c99e4d51b340 wifi: mt76: mt7996: fix overflows seen when writing limit attributes af983b2543ed wifi: mt76: mt7915: fix overflows seen when writing limit attributes af494e2dcc94 wifi: mt76: mt7915: exclude tx backoff time from airtime 6f6a1f7cb381 wifi: mt76: mt7996: exclude tx backoff time from airtime 7f65b1b28b4c wifi: mt76: connac: Extend mt76_connac_mcu_uni_add_dev for MLO 1b5e6abc2e7a wifi: mt76: mt7925: Fix incorrect MLD address in bss_mld_tlv for MLO support 72b4688b3912 wifi: mt76: mt7925: Fix incorrect WCID assignment for MLO 6bd2c044e67a wifi: mt76: mt7925: Fix incorrect WCID phy_idx assignment 1c04e9693466 wifi: mt76: mt7925: fix wrong parameter for related cmd of chan info 01e02947bdbf wifi: mt76: mt7925: Fix CNM Timeout with Single Active Link in MLO b90b1a1dc71b wifi: mt76: mt7925: Enhance mt7925_mac_link_bss_add to support MLO 53ec7a551f17 wifi: mt76: Enhance mt7925_mac_link_sta_add to support MLO 3c99ef40e0e7 wifi: mt76: mt7925: Update mt7925_mcu_sta_update for BC in ASSOC state 285efc6afaec wifi: mt76: mt7925: Update mt792x_rx_get_wcid for per-link STA e5c0d1289e6c wifi: mt76: mt7925: Update mt7925_unassign_vif_chanctx for per-link BSS 67dcd5c888c4 wifi: mt76: mt7925: Update secondary link PS flow fd4d6f87072f wifi: mt76: mt7925: Init secondary link PM state 6d972b5b9d6a wifi: mt76: mt7925: Update mt7925_mcu_uni_[tx,rx]_ba for MLO 3acc6cbb9556 wifi: mt76: mt7925: Cleanup MLO settings post-disconnection 0aab0c61ce92 wifi: mt76: mt7925: Properly handle responses for commands with events 15bead1b0041 wifi: mt76: do not hold queue lock during initial rx buffer alloc 732044a949d5 wifi: mt76: mt7925: config the dwell time by firmware 9ba311ec6afa wifi: mt76: mt7921: introduce CSA support 5d12c7404c22 wifi: mt76: mt7921: add rfkill_poll for hardware rfkill ef965d408b79 wifi: mt76: mt7925: replace zero-length array with flexible-array member f8563589c72d wifi: mt76: mt7921u: Add VID/PID for TP-Link TXE50UH Signed-off-by: Felix Fietkau --- package/kernel/mt76/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index b5cdc765729..d7fd80d331b 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -8,9 +8,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/openwrt/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2024-10-28 -PKG_SOURCE_VERSION:=c246fa545119abe5097682316700f13c91399042 -PKG_MIRROR_HASH:=ff59d9588e6b114be8fe08013b55da975bc6bb4219b97b6fedb72246e9337c18 +PKG_SOURCE_DATE:=2024-12-30 +PKG_SOURCE_VERSION:=f8563589c72d93c35f9316c65de361061b785699 +PKG_MIRROR_HASH:=aba3906b44d7dc952add8786ab46a27512d04efbd3e6a7a40526707a2ff87445 PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 From 41b49a157ad0162c39ab94529d110aa3a3e3e266 Mon Sep 17 00:00:00 2001 From: Evan Jobling Date: Sat, 14 Sep 2024 02:31:09 +0000 Subject: [PATCH 005/173] realtek: rtl838x: refactor hpe_1920-24g dts The HPE JG924A, JG925A and JG926A share the same base. Prepare base device for adding the PoE enabled switch support. Signed-off-by: Evan Jobling Signed-off-by: Fabian Groffen Link: https://github.com/openwrt/openwrt/pull/17436 Signed-off-by: Sander Vanheule --- .../realtek/dts/rtl8382_hpe_1920-24g.dts | 62 +---------------- .../realtek/dts/rtl8382_hpe_1920-24g.dtsi | 68 +++++++++++++++++++ 2 files changed, 69 insertions(+), 61 deletions(-) create mode 100644 target/linux/realtek/dts/rtl8382_hpe_1920-24g.dtsi diff --git a/target/linux/realtek/dts/rtl8382_hpe_1920-24g.dts b/target/linux/realtek/dts/rtl8382_hpe_1920-24g.dts index 61781c708e2..cc92b144b5e 100644 --- a/target/linux/realtek/dts/rtl8382_hpe_1920-24g.dts +++ b/target/linux/realtek/dts/rtl8382_hpe_1920-24g.dts @@ -1,68 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "rtl8382_hpe_1920.dtsi" +#include "rtl8382_hpe_1920-24g.dtsi" / { compatible = "hpe,1920-24g", "realtek,rtl838x-soc"; model = "HPE 1920-24G (JG924A)"; }; - -&mdio { - EXTERNAL_PHY(0) - EXTERNAL_PHY(1) - EXTERNAL_PHY(2) - EXTERNAL_PHY(3) - EXTERNAL_PHY(4) - EXTERNAL_PHY(5) - EXTERNAL_PHY(6) - EXTERNAL_PHY(7) -}; - -&switch0 { - ports { - #address-cells = <1>; - #size-cells = <0>; - - SWITCH_PORT(0, 1, qsgmii) - SWITCH_PORT(1, 2, qsgmii) - SWITCH_PORT(2, 3, qsgmii) - SWITCH_PORT(3, 4, qsgmii) - SWITCH_PORT(4, 5, qsgmii) - SWITCH_PORT(5, 6, qsgmii) - SWITCH_PORT(6, 7, qsgmii) - SWITCH_PORT(7, 8, qsgmii) - - SWITCH_PORT(8, 9, internal) - SWITCH_PORT(9, 10, internal) - SWITCH_PORT(10, 11, internal) - SWITCH_PORT(11, 12, internal) - SWITCH_PORT(12, 13, internal) - SWITCH_PORT(13, 14, internal) - SWITCH_PORT(14, 15, internal) - SWITCH_PORT(15, 16, internal) - - SWITCH_PORT(16, 17, qsgmii) - SWITCH_PORT(17, 18, qsgmii) - SWITCH_PORT(18, 19, qsgmii) - SWITCH_PORT(19, 20, qsgmii) - SWITCH_PORT(20, 21, qsgmii) - SWITCH_PORT(21, 22, qsgmii) - SWITCH_PORT(22, 23, qsgmii) - SWITCH_PORT(23, 24, qsgmii) - - SWITCH_PORT(24, 25, qsgmii) - SWITCH_PORT(25, 26, qsgmii) - SWITCH_PORT(26, 27, qsgmii) - SWITCH_PORT(27, 28, qsgmii) - - port@28 { - ethernet = <ðernet0>; - reg = <28>; - phy-mode = "internal"; - fixed-link { - speed = <1000>; - full-duplex; - }; - }; - }; -}; diff --git a/target/linux/realtek/dts/rtl8382_hpe_1920-24g.dtsi b/target/linux/realtek/dts/rtl8382_hpe_1920-24g.dtsi new file mode 100644 index 00000000000..61781c708e2 --- /dev/null +++ b/target/linux/realtek/dts/rtl8382_hpe_1920-24g.dtsi @@ -0,0 +1,68 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "rtl8382_hpe_1920.dtsi" + +/ { + compatible = "hpe,1920-24g", "realtek,rtl838x-soc"; + model = "HPE 1920-24G (JG924A)"; +}; + +&mdio { + EXTERNAL_PHY(0) + EXTERNAL_PHY(1) + EXTERNAL_PHY(2) + EXTERNAL_PHY(3) + EXTERNAL_PHY(4) + EXTERNAL_PHY(5) + EXTERNAL_PHY(6) + EXTERNAL_PHY(7) +}; + +&switch0 { + ports { + #address-cells = <1>; + #size-cells = <0>; + + SWITCH_PORT(0, 1, qsgmii) + SWITCH_PORT(1, 2, qsgmii) + SWITCH_PORT(2, 3, qsgmii) + SWITCH_PORT(3, 4, qsgmii) + SWITCH_PORT(4, 5, qsgmii) + SWITCH_PORT(5, 6, qsgmii) + SWITCH_PORT(6, 7, qsgmii) + SWITCH_PORT(7, 8, qsgmii) + + SWITCH_PORT(8, 9, internal) + SWITCH_PORT(9, 10, internal) + SWITCH_PORT(10, 11, internal) + SWITCH_PORT(11, 12, internal) + SWITCH_PORT(12, 13, internal) + SWITCH_PORT(13, 14, internal) + SWITCH_PORT(14, 15, internal) + SWITCH_PORT(15, 16, internal) + + SWITCH_PORT(16, 17, qsgmii) + SWITCH_PORT(17, 18, qsgmii) + SWITCH_PORT(18, 19, qsgmii) + SWITCH_PORT(19, 20, qsgmii) + SWITCH_PORT(20, 21, qsgmii) + SWITCH_PORT(21, 22, qsgmii) + SWITCH_PORT(22, 23, qsgmii) + SWITCH_PORT(23, 24, qsgmii) + + SWITCH_PORT(24, 25, qsgmii) + SWITCH_PORT(25, 26, qsgmii) + SWITCH_PORT(26, 27, qsgmii) + SWITCH_PORT(27, 28, qsgmii) + + port@28 { + ethernet = <ðernet0>; + reg = <28>; + phy-mode = "internal"; + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; +}; From c8ea1aa970bf5a0275e3b0b7da777e804821ddcd Mon Sep 17 00:00:00 2001 From: Evan Jobling Date: Sat, 14 Sep 2024 02:43:35 +0000 Subject: [PATCH 006/173] realtek: add support for HPE 1920-24G-PoE-370w Hardware information: --------------------- The HPE 1920-24G-PoE+ (370W) (JG926A) is a switch that is part of the 1920 family wich 370W nominal PoE+ support. Common with HPE 1920-24G: - RTL8382 SoC - 24 Gigabit RJ45 ports (built-in RTL8218B, 2 external RTL8218D) - 4 SFP ports (external RTL8214FC) - RJ45 RS232 port on front panel - 32 MiB NOR Flash - 128 MiB DDR3 DRAM - PT7A7514 watchdog HPE 1920-24G-PoE+ (370W): - PoE chip - 3 fans (40mm) Known issues: --------------------- - PoE LEDs are uncontrolled. (Manual taken from f2f09bc) Booting initramfs image: ------------------------ - Prepare a FTP or TFTP server serving the OpenWrt initramfs image and connect the server to a switch port. - Connect to the console port of the device and enter the extended boot menu by typing Ctrl+B when prompted. - Choose the menu option "<3> Enter Ethernet SubMenu". - Set network parameters via the option "<5> Modify Ethernet Parameter". Enter the FTP/TFTP filename as "Load File Name" ("Target File Name" can be left blank, it is not required for booting from RAM). Note that the configuration is saved on flash, so it only needs to be done once. - Select "<1> Download Application Program To SDRAM And Run". Initial installation: --------------------- - Boot an initramfs image as described above, then use sysupgrade to install OpenWrt permanently. After initial installation, the bootloader needs to be configured to load the correct image file - Enter the extended boot menu again and choose "<4> File Control", then select "<2> Set Application File type". - Enter the number of the file "openwrt-kernel.bin" (should be 1), and use the option "<1> +Main" to select it as boot image. - Choose "<0> Exit To Main Menu" and then "<1> Boot System". NOTE: The bootloader on these devices can only boot from the VFS filesystem which normally spans most of the flash. With OpenWrt, only the first part of the firmware partition contains a valid filesystem, the rest is used for rootfs. As the bootloader does not know about this, you must not do any file operations in the bootloader, as this may corrupt the OpenWrt installation (selecting the boot image is an exception, as it only stores a flag in the bootloader data, but doesn't write to the filesystem). Example PoE config file (/etc/config/poe): --------------------- config global option budget '370' config port option enable '1' option id '1' option name 'lan8' option poe_plus '1' option priority '2' config port option enable '1' option id '2' option name 'lan7' option poe_plus '1' option priority '2' config port option enable '1' option id '3' option name 'lan6' option poe_plus '1' option priority '2' config port option enable '1' option id '4' option name 'lan5' option poe_plus '1' option priority '2' config port option enable '1' option id '5' option name 'lan4' option poe_plus '1' option priority '2' config port option enable '1' option id '6' option name 'lan3' option poe_plus '1' option priority '2' config port option enable '1' option id '7' option name 'lan2' option poe_plus '1' option priority '2' config port option enable '1' option id '8' option name 'lan1' option poe_plus '1' option priority '2' config port option enable '1' option id '9' option name 'lan16' option poe_plus '1' option priority '2' config port option enable '1' option id '10' option name 'lan15' option poe_plus '1' option priority '2' config port option enable '1' option id '11' option name 'lan14' option poe_plus '1' option priority '2' config port option enable '1' option id '12' option name 'lan13' option poe_plus '1' option priority '2' config port option enable '1' option id '13' option name 'lan12' option poe_plus '1' option priority '2' config port option enable '1' option id '14' option name 'lan11' option poe_plus '1' option priority '2' config port option enable '1' option id '15' option name 'lan10' option poe_plus '1' option priority '2' config port option enable '1' option id '16' option name 'lan9' option poe_plus '1' option priority '2' config port option enable '1' option id '17' option name 'lan24' option poe_plus '1' option priority '2' config port option enable '1' option id '18' option name 'lan23' option poe_plus '1' option priority '2' config port option enable '1' option id '19' option name 'lan22' option poe_plus '1' option priority '2' config port option enable '1' option id '20' option name 'lan21' option poe_plus '1' option priority '2' config port option enable '1' option id '21' option name 'lan20' option poe_plus '1' option priority '2' config port option enable '1' option id '22' option name 'lan19' option poe_plus '1' option priority '2' config port option enable '1' option id '23' option name 'lan18' option poe_plus '1' option priority '2' config port option enable '1' option id '24' option name 'lan17' option poe_plus '1' option priority '2' Signed-off-by: Evan Jobling Signed-off-by: Fabian Groffen Link: https://github.com/openwrt/openwrt/pull/17436 [fix space indentation in DTS] Signed-off-by: Sander Vanheule --- .../linux/realtek/base-files/etc/board.d/02_network | 4 ++++ .../realtek/base-files/etc/board.d/03_gpio_switches | 3 ++- .../realtek/dts/rtl8382_hpe_1920-24g-poe-370w.dts | 12 ++++++++++++ target/linux/realtek/image/rtl838x.mk | 9 +++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-370w.dts diff --git a/target/linux/realtek/base-files/etc/board.d/02_network b/target/linux/realtek/base-files/etc/board.d/02_network index 5073dbcc31e..750a2008149 100644 --- a/target/linux/realtek/base-files/etc/board.d/02_network +++ b/target/linux/realtek/base-files/etc/board.d/02_network @@ -36,6 +36,7 @@ hpe,1920-8g-poe-65w|\ hpe,1920-8g-poe-180w|\ hpe,1920-16g|\ hpe,1920-24g|\ +hpe,1920-24g-poe-370w|\) hpe,1920-48g|\ hpe,1920-48g-poe) label_mac=$(mtd_get_mac_binary factory 0x68) @@ -95,6 +96,9 @@ hpe,1920-8g-poe-65w) hpe,1920-8g-poe-180w) ucidef_set_poe 180 "$(filter_port_list_reverse "$lan_list" "lan9 lan10")" ;; +hpe,1920-24g-poe-370w) + ucidef_set_poe 370 "$(filter_port_list_reverse "$lan_list" "lan25 lan26 lan27 lan28")" + ;; hpe,1920-48g-poe) ucidef_set_poe 370 "lan8 lan7 lan6 lan5 lan4 lan3 lan2 lan1 lan16 lan15 lan14 lan13 lan12 lan11 lan10 lan9 lan24 lan23 lan22 lan21 lan20 lan19 lan18 lan17 lan32 lan31 lan30 lan29 lan28 lan27 lan26 lan25 lan40 lan39 lan38 lan37 diff --git a/target/linux/realtek/base-files/etc/board.d/03_gpio_switches b/target/linux/realtek/base-files/etc/board.d/03_gpio_switches index 1e49d89c64a..684d7f795ea 100644 --- a/target/linux/realtek/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/realtek/base-files/etc/board.d/03_gpio_switches @@ -6,7 +6,8 @@ board_config_update board=$(board_name) case "$board" in -hpe,1920-8g-poe-180w) +hpe,1920-8g-poe-180w|\ +hpe,1920-24g-poe-370w) ucidef_add_gpio_switch "fan_ctrl" "Fan control" "456" "0" ;; esac diff --git a/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-370w.dts b/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-370w.dts new file mode 100644 index 00000000000..ccdcf71d1bd --- /dev/null +++ b/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-370w.dts @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "rtl8382_hpe_1920-24g.dtsi" + +/ { + compatible = "hpe,1920-24g-poe-370w", "realtek,rtl838x-soc"; + model = "HPE 1920-24G-PoE+ 370W (JG926A)"; +}; + +&uart1 { + status = "okay"; +}; diff --git a/target/linux/realtek/image/rtl838x.mk b/target/linux/realtek/image/rtl838x.mk index 01397af9310..d694f5b308f 100644 --- a/target/linux/realtek/image/rtl838x.mk +++ b/target/linux/realtek/image/rtl838x.mk @@ -144,6 +144,15 @@ define Device/hpe_1920-24g endef TARGET_DEVICES += hpe_1920-24g +define Device/hpe_1920-24g-poe-370w + $(Device/hpe_1920) + SOC := rtl8382 + DEVICE_MODEL := 1920-24G-PoE+ 370W (JG926A) + DEVICE_PACKAGES += realtek-poe + H3C_DEVICE_ID := 0x00010029 +endef +TARGET_DEVICES += hpe_1920-24g-poe-370w + define Device/inaba_aml2-17gp SOC := rtl8382 IMAGE_SIZE := 13504k From e0eca57b6e9298c2ea8aebf9cfea86271b77ebd0 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 23 Dec 2024 14:00:02 -0800 Subject: [PATCH 007/173] iproute2: fix GCC14 compilation Missing limits.h. Upstream backport. Add extra backports. Replace Alpine Linux patch with upstream one. Same with patch 400. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/17426 Signed-off-by: Robert Marko --- package/network/utils/iproute2/Makefile | 2 +- ...tlink-fix-build-with-musl-and-gcc-14.patch | 28 --- .../utils/iproute2/patches/013-endian.h.patch | 22 +++ .../utils/iproute2/patches/014-basename.patch | 29 +++ .../utils/iproute2/patches/015-limits.h.patch | 84 +++++++++ .../utils/iproute2/patches/016-limits.h.patch | 26 +++ .../iproute2/patches/017-linux-limits.patch | 178 ++++++++++++++++++ .../iproute2/patches/018-linux-limits.patch | 37 ++++ ...0-rdma-include-libgen.h-for-basename.patch | 10 - 9 files changed, 377 insertions(+), 39 deletions(-) delete mode 100644 package/network/utils/iproute2/patches/012-libnetlink-fix-build-with-musl-and-gcc-14.patch create mode 100644 package/network/utils/iproute2/patches/013-endian.h.patch create mode 100644 package/network/utils/iproute2/patches/014-basename.patch create mode 100644 package/network/utils/iproute2/patches/015-limits.h.patch create mode 100644 package/network/utils/iproute2/patches/016-limits.h.patch create mode 100644 package/network/utils/iproute2/patches/017-linux-limits.patch create mode 100644 package/network/utils/iproute2/patches/018-linux-limits.patch delete mode 100644 package/network/utils/iproute2/patches/400-rdma-include-libgen.h-for-basename.patch diff --git a/package/network/utils/iproute2/Makefile b/package/network/utils/iproute2/Makefile index 73710ae4ef5..ca6793d49bb 100644 --- a/package/network/utils/iproute2/Makefile +++ b/package/network/utils/iproute2/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=iproute2 PKG_VERSION:=6.12.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2 diff --git a/package/network/utils/iproute2/patches/012-libnetlink-fix-build-with-musl-and-gcc-14.patch b/package/network/utils/iproute2/patches/012-libnetlink-fix-build-with-musl-and-gcc-14.patch deleted file mode 100644 index 749176a8dee..00000000000 --- a/package/network/utils/iproute2/patches/012-libnetlink-fix-build-with-musl-and-gcc-14.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Natanael Copa -Date: Thu, 8 Aug 2024 09:19:01 +0200 -Subject: libnetlink: fix build with musl and gcc 14 - -Fixes compilation error with musl libc and gcc 14: - -../include/libnetlink.h: In function 'rta_getattr_be64': -../include/libnetlink.h:280:16: error: implicit declaration of function 'htobe64' [-Wimplicit-function-declaration] - 280 | return htobe64(rta_getattr_u64(rta)); - | ^~~~~~~ - -Reference: https://man7.org/linux/man-pages/man3/endian.3.html -Signed-off-by: Natanael Copa ---- - include/libnetlink.h | 1 + - 1 file changed, 1 insertion(+) - ---- a/include/libnetlink.h -+++ b/include/libnetlink.h -@@ -2,6 +2,7 @@ - #ifndef __LIBNETLINK_H__ - #define __LIBNETLINK_H__ 1 - -+#include - #include - #include - #include diff --git a/package/network/utils/iproute2/patches/013-endian.h.patch b/package/network/utils/iproute2/patches/013-endian.h.patch new file mode 100644 index 00000000000..a81c3b5eece --- /dev/null +++ b/package/network/utils/iproute2/patches/013-endian.h.patch @@ -0,0 +1,22 @@ +From c8b3ecc22ed0edaf0259eaf7d1a5c04f300ad6e4 Mon Sep 17 00:00:00 2001 +From: Stephen Hemminger +Date: Thu, 12 Dec 2024 11:24:18 -0800 +Subject: [PATCH] libnetlink: add missing endian.h + +Need endian.h to get htobe64 with musl. + +Signed-off-by: Stephen Hemminger +--- + include/libnetlink.h | 1 + + 1 file changed, 1 insertion(+) + +--- a/include/libnetlink.h ++++ b/include/libnetlink.h +@@ -4,6 +4,7 @@ + + #include + #include ++#include + #include + #include + #include diff --git a/package/network/utils/iproute2/patches/014-basename.patch b/package/network/utils/iproute2/patches/014-basename.patch new file mode 100644 index 00000000000..f98238ec651 --- /dev/null +++ b/package/network/utils/iproute2/patches/014-basename.patch @@ -0,0 +1,29 @@ +From fa3949b792e275f75d7d6200dc2036ef7fff8816 Mon Sep 17 00:00:00 2001 +From: Stephen Hemminger +Date: Thu, 12 Dec 2024 11:21:56 -0800 +Subject: [PATCH] rdma: add missing header for basename + +The function basename prototype is in libgen.h +Fixes build on musl + +Signed-off-by: Stephen Hemminger +--- + rdma/rdma.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/rdma/rdma.h ++++ b/rdma/rdma.h +@@ -10,11 +10,12 @@ + #include + #include + #include ++#include ++#include + #include + #include + #include + #include +-#include + #include + + #include "list.h" diff --git a/package/network/utils/iproute2/patches/015-limits.h.patch b/package/network/utils/iproute2/patches/015-limits.h.patch new file mode 100644 index 00000000000..e212b88ebde --- /dev/null +++ b/package/network/utils/iproute2/patches/015-limits.h.patch @@ -0,0 +1,84 @@ +From 7e23da91fca6e5dedeb32a7d308cf20982e897c3 Mon Sep 17 00:00:00 2001 +From: Stephen Hemminger +Date: Tue, 10 Dec 2024 13:38:08 -0800 +Subject: [PATCH] ip: rearrange and prune header files + +The recent report of issues with missing limits.h impacting musl +suggested looking at what files are and are not included in ip code. + +The standard practice is to put standard headers first, then system, +then local headers. Used iwyu to get suggestions about missing +and extraneous headers. + +Signed-off-by: Stephen Hemminger +--- + ip/iplink.c | 13 +++++-------- + ip/ipnetns.c | 19 +++++++++---------- + 2 files changed, 14 insertions(+), 18 deletions(-) + +--- a/ip/iplink.c ++++ b/ip/iplink.c +@@ -11,17 +11,14 @@ + #include + #include + #include ++#include ++#include ++#include ++ + #include ++#include + #include +-#include + #include +-#include +-#include +-#include +-#include +-#include +-#include +-#include + + #include "rt_names.h" + #include "utils.h" +--- a/ip/ipnetns.c ++++ b/ip/ipnetns.c +@@ -1,21 +1,21 @@ + /* SPDX-License-Identifier: GPL-2.0 */ + #define _ATFILE_SOURCE +-#include +-#include +-#include +-#include +-#include +-#include +-#include ++ + #include ++#include + #include +-#include + #include + #include + #include + #include + #include +-#include ++#include ++ ++#include ++#include ++#include ++#include ++#include + + #include + +@@ -23,7 +23,6 @@ + #include "list.h" + #include "ip_common.h" + #include "namespace.h" +-#include "json_print.h" + + static int usage(void) + { diff --git a/package/network/utils/iproute2/patches/016-limits.h.patch b/package/network/utils/iproute2/patches/016-limits.h.patch new file mode 100644 index 00000000000..c20404f6fd6 --- /dev/null +++ b/package/network/utils/iproute2/patches/016-limits.h.patch @@ -0,0 +1,26 @@ +From f982f30e166a02e09097de05129449031ba51f76 Mon Sep 17 00:00:00 2001 +From: Stephen Hemminger +Date: Thu, 12 Dec 2024 11:29:44 -0800 +Subject: [PATCH] cg_map: use limits.h + +Prefer limits.h from system headers over linux/limits.h +Fixes build with musl. + +Signed-off-by: Stephen Hemminger +--- + lib/cg_map.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/lib/cg_map.c ++++ b/lib/cg_map.c +@@ -9,8 +9,9 @@ + #include + #include + #include ++#include ++ + #include +-#include + #include + + #include "cg_map.h" diff --git a/package/network/utils/iproute2/patches/017-linux-limits.patch b/package/network/utils/iproute2/patches/017-linux-limits.patch new file mode 100644 index 00000000000..0c5d1384027 --- /dev/null +++ b/package/network/utils/iproute2/patches/017-linux-limits.patch @@ -0,0 +1,178 @@ +From ac547ad027e3d4e283202ecb487cf54707234491 Mon Sep 17 00:00:00 2001 +From: Stephen Hemminger +Date: Thu, 12 Dec 2024 14:15:59 -0800 +Subject: [PATCH] flower: replace XATTR_SIZE_MAX + +The flower tc parser was using XATTR_SIZE_MAX from linux/limits.h, +but this constant is intended to before extended filesystem attributes +not for TC. Replace it with a local define. + +This fixes issue on systems with musl and XATTR_SIZE_MAX is not +defined in limits.h there. + +Signed-off-by: Stephen Hemminger +--- + tc/f_flower.c | 37 ++++++++++++++++++++----------------- + 1 file changed, 20 insertions(+), 17 deletions(-) + +--- a/tc/f_flower.c ++++ b/tc/f_flower.c +@@ -10,7 +10,7 @@ + #include + #include + #include +-#include ++ + #include + #include + #include +@@ -22,6 +22,9 @@ + #include "tc_util.h" + #include "rt_names.h" + ++/* maximum length of options string */ ++#define FLOWER_OPTS_MAX 4096 ++ + #ifndef IPPROTO_L2TP + #define IPPROTO_L2TP 115 + #endif +@@ -1252,7 +1255,7 @@ static int flower_check_enc_opt_key(char + + static int flower_parse_enc_opts_geneve(char *str, struct nlmsghdr *n) + { +- char key[XATTR_SIZE_MAX], mask[XATTR_SIZE_MAX]; ++ char key[FLOWER_OPTS_MAX], mask[FLOWER_OPTS_MAX]; + int data_len, key_len, mask_len, err; + char *token, *slash; + struct rtattr *nest; +@@ -1265,7 +1268,7 @@ static int flower_parse_enc_opts_geneve( + if (slash) + *slash = '\0'; + +- if ((key_len + strlen(token) > XATTR_SIZE_MAX) || ++ if ((key_len + strlen(token) > FLOWER_OPTS_MAX) || + flower_check_enc_opt_key(token)) + return -1; + +@@ -1275,7 +1278,7 @@ static int flower_parse_enc_opts_geneve( + + if (!slash) { + /* Pad out mask when not provided */ +- if (mask_len + strlen(token) > XATTR_SIZE_MAX) ++ if (mask_len + strlen(token) > FLOWER_OPTS_MAX) + return -1; + + data_len = strlen(rindex(token, ':')); +@@ -1288,7 +1291,7 @@ static int flower_parse_enc_opts_geneve( + continue; + } + +- if (mask_len + strlen(slash + 1) > XATTR_SIZE_MAX) ++ if (mask_len + strlen(slash + 1) > FLOWER_OPTS_MAX) + return -1; + + strcpy(&mask[mask_len], slash + 1); +@@ -1318,7 +1321,7 @@ static int flower_parse_enc_opts_geneve( + + static int flower_parse_enc_opts_vxlan(char *str, struct nlmsghdr *n) + { +- char key[XATTR_SIZE_MAX], mask[XATTR_SIZE_MAX]; ++ char key[FLOWER_OPTS_MAX], mask[FLOWER_OPTS_MAX]; + struct rtattr *nest; + char *slash; + int err; +@@ -1326,14 +1329,14 @@ static int flower_parse_enc_opts_vxlan(c + slash = strchr(str, '/'); + if (slash) { + *slash++ = '\0'; +- if (strlen(slash) > XATTR_SIZE_MAX) ++ if (strlen(slash) > FLOWER_OPTS_MAX) + return -1; + strcpy(mask, slash); + } else { + strcpy(mask, "0xffffffff"); + } + +- if (strlen(str) > XATTR_SIZE_MAX) ++ if (strlen(str) > FLOWER_OPTS_MAX) + return -1; + strcpy(key, str); + +@@ -1355,7 +1358,7 @@ static int flower_parse_enc_opts_vxlan(c + + static int flower_parse_enc_opts_erspan(char *str, struct nlmsghdr *n) + { +- char key[XATTR_SIZE_MAX], mask[XATTR_SIZE_MAX]; ++ char key[FLOWER_OPTS_MAX], mask[FLOWER_OPTS_MAX]; + struct rtattr *nest; + char *slash; + int err; +@@ -1364,7 +1367,7 @@ static int flower_parse_enc_opts_erspan( + slash = strchr(str, '/'); + if (slash) { + *slash++ = '\0'; +- if (strlen(slash) > XATTR_SIZE_MAX) ++ if (strlen(slash) > FLOWER_OPTS_MAX) + return -1; + strcpy(mask, slash); + } else { +@@ -1376,7 +1379,7 @@ static int flower_parse_enc_opts_erspan( + strcpy(mask + index, ":0xffffffff:0xff:0xff"); + } + +- if (strlen(str) > XATTR_SIZE_MAX) ++ if (strlen(str) > FLOWER_OPTS_MAX) + return -1; + strcpy(key, str); + +@@ -1398,7 +1401,7 @@ static int flower_parse_enc_opts_erspan( + + static int flower_parse_enc_opts_gtp(char *str, struct nlmsghdr *n) + { +- char key[XATTR_SIZE_MAX], mask[XATTR_SIZE_MAX]; ++ char key[FLOWER_OPTS_MAX], mask[FLOWER_OPTS_MAX]; + struct rtattr *nest; + char *slash; + int err; +@@ -1406,13 +1409,13 @@ static int flower_parse_enc_opts_gtp(cha + slash = strchr(str, '/'); + if (slash) { + *slash++ = '\0'; +- if (strlen(slash) > XATTR_SIZE_MAX) ++ if (strlen(slash) > FLOWER_OPTS_MAX) + return -1; + strcpy(mask, slash); + } else + strcpy(mask, "ff:ff"); + +- if (strlen(str) > XATTR_SIZE_MAX) ++ if (strlen(str) > FLOWER_OPTS_MAX) + return -1; + strcpy(key, str); + +@@ -1433,7 +1436,7 @@ static int flower_parse_enc_opts_gtp(cha + + static int flower_parse_enc_opts_pfcp(char *str, struct nlmsghdr *n) + { +- char key[XATTR_SIZE_MAX], mask[XATTR_SIZE_MAX]; ++ char key[FLOWER_OPTS_MAX], mask[FLOWER_OPTS_MAX]; + struct rtattr *nest; + char *slash; + int err; +@@ -1442,14 +1445,14 @@ static int flower_parse_enc_opts_pfcp(ch + slash = strchr(str, '/'); + if (slash) { + *slash++ = '\0'; +- if (strlen(slash) > XATTR_SIZE_MAX) ++ if (strlen(slash) > FLOWER_OPTS_MAX) + return -1; + strcpy(mask, slash); + } else { + strcpy(mask, "ff:ffffffffffffffff"); + } + +- if (strlen(str) > XATTR_SIZE_MAX) ++ if (strlen(str) > FLOWER_OPTS_MAX) + return -1; + strcpy(key, str); + diff --git a/package/network/utils/iproute2/patches/018-linux-limits.patch b/package/network/utils/iproute2/patches/018-linux-limits.patch new file mode 100644 index 00000000000..8c2669acd97 --- /dev/null +++ b/package/network/utils/iproute2/patches/018-linux-limits.patch @@ -0,0 +1,37 @@ +From 458dce5d0431f0589aca1bc841904b5d1db3bbce Mon Sep 17 00:00:00 2001 +From: Stephen Hemminger +Date: Thu, 12 Dec 2024 14:18:35 -0800 +Subject: [PATCH] uapi: remove no longer used linux/limits.h + +Code is now using limits.h instead. + +Signed-off-by: Stephen Hemminger +--- + include/uapi/linux/limits.h | 21 --------------------- + 1 file changed, 21 deletions(-) + delete mode 100644 include/uapi/linux/limits.h + +--- a/include/uapi/linux/limits.h ++++ /dev/null +@@ -1,21 +0,0 @@ +-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +-#ifndef _LINUX_LIMITS_H +-#define _LINUX_LIMITS_H +- +-#define NR_OPEN 1024 +- +-#define NGROUPS_MAX 65536 /* supplemental group IDs are available */ +-#define ARG_MAX 131072 /* # bytes of args + environ for exec() */ +-#define LINK_MAX 127 /* # links a file may have */ +-#define MAX_CANON 255 /* size of the canonical input queue */ +-#define MAX_INPUT 255 /* size of the type-ahead buffer */ +-#define NAME_MAX 255 /* # chars in a file name */ +-#define PATH_MAX 4096 /* # chars in a path name including nul */ +-#define PIPE_BUF 4096 /* # bytes in atomic write to a pipe */ +-#define XATTR_NAME_MAX 255 /* # chars in an extended attribute name */ +-#define XATTR_SIZE_MAX 65536 /* size of an extended attribute value (64k) */ +-#define XATTR_LIST_MAX 65536 /* size of extended attribute namelist (64k) */ +- +-#define RTSIG_MAX 32 +- +-#endif diff --git a/package/network/utils/iproute2/patches/400-rdma-include-libgen.h-for-basename.patch b/package/network/utils/iproute2/patches/400-rdma-include-libgen.h-for-basename.patch deleted file mode 100644 index 530d2bcffc9..00000000000 --- a/package/network/utils/iproute2/patches/400-rdma-include-libgen.h-for-basename.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/rdma/rdma.h -+++ b/rdma/rdma.h -@@ -16,6 +16,7 @@ - #include - #include - #include -+#include - - #include "list.h" - #include "utils.h" From 738eb514c622cd30a4cd324c5e99bf3af5f5607e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Owoc?= Date: Sun, 4 Aug 2024 01:06:39 +0200 Subject: [PATCH 008/173] qualcommax: ipq807x: remove unnecessary bootargs-append for MX4200 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The default value for the "root" parameter is "/dev/ubiblock0_0" and there is no need to append it to bootargs. Signed-off-by: Paweł Owoc Link: https://github.com/openwrt/openwrt/pull/16070 Signed-off-by: Robert Marko --- .../files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi | 1 - 1 file changed, 1 deletion(-) diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi index 13ce8d16016..3698db73188 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi @@ -29,7 +29,6 @@ chosen { stdout-path = "serial0:115200n8"; - bootargs-append = " root=/dev/ubiblock0_0"; }; keys { From c9b324d3ac084253171ac6233ca12cb4feacf36c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Owoc?= Date: Fri, 26 Jul 2024 22:21:02 +0200 Subject: [PATCH 009/173] qualcommax: ipq807x: create generic Linksys MX4x00 dts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Create a generic Linksys MX4x00 dts file and extract the specific configuration for MX4200v1/v2 to a new file. Signed-off-by: Paweł Owoc Link: https://github.com/openwrt/openwrt/pull/16070 Signed-off-by: Robert Marko --- .../arm64/boot/dts/qcom/ipq8174-mx4200.dtsi | 198 +---------------- .../arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi | 204 ++++++++++++++++++ 2 files changed, 209 insertions(+), 193 deletions(-) create mode 100644 target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi index 3698db73188..5867cd42227 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi @@ -1,79 +1,16 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /* Copyright (c) 2023, Mohammad Sayful Islam */ -#include "ipq8074.dtsi" -#include "ipq8074-ac-cpu.dtsi" -#include "ipq8074-ess.dtsi" -#include -#include -#include +#include "ipq8174-mx4x00.dtsi" / { - aliases { - serial0 = &blsp1_uart5; - serial1 = &blsp1_uart3; - /* - * Aliases as required by u-boot - * to patch MAC addresses - */ - ethernet1 = &dp2; - ethernet2 = &dp3; ethernet3 = &dp4; ethernet4 = &dp5; - led-boot = &led_system_blue; - led-running = &led_system_blue; - led-failsafe = &led_system_red; - led-upgrade = &led_system_green; - }; - - chosen { - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys"; - pinctrl-0 = <&button_pins>; - pinctrl-names = "default"; - - reset-button { - label = "reset"; - gpios = <&tlmm 52 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - wps-button { - label = "wps"; - gpios = <&tlmm 67 GPIO_ACTIVE_LOW>; - linux,code = ; - }; }; }; &tlmm { - button_pins: button-state { - pins = "gpio52", "gpio67"; - function = "gpio"; - drive-strength = <8>; - bias-pull-up; - }; - - mdio_pins: mdio-state { - mdc-pins { - pins = "gpio68"; - function = "mdc"; - drive-strength = <8>; - bias-pull-up; - }; - - mdio-pins { - pins = "gpio69"; - function = "mdio"; - drive-strength = <8>; - bias-pull-up; - }; - }; - iot_pins: iot-state { recovery-pins { pins = "gpio22"; @@ -98,26 +35,6 @@ /* Silicon Labs EFR32MG21 IoT */ }; -&blsp1_uart5 { - status = "okay"; -}; - -&prng { - status = "okay"; -}; - -&cryptobam { - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&qpic_bam { - status = "okay"; -}; - &qpic_nand { status = "okay"; @@ -288,21 +205,25 @@ label = "alt_rootfs"; reg = <0xac80000 0x9000000>; }; + partition@13c80000 { label = "sysdiag"; reg = <0x13c80000 0x200000>; read-only; }; + partition@13e80000 { label = "0:ethphyfw"; reg = <0x13e80000 0x80000>; read-only; }; + partition@13f00000 { label = "syscfg"; reg = <0x13f00000 0xb800000>; read-only; }; + partition@1f700000 { label = "0:wififw"; reg = <0x1f700000 0x900000>; @@ -312,102 +233,6 @@ }; }; -&blsp1_i2c2 { - status = "okay"; - - led-controller@62 { - compatible = "nxp,pca9633"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x62>; - nxp,hw-blink; - - led_system_red: led@0 { - reg = <0>; - color = ; - function = LED_FUNCTION_STATUS; - }; - - led_system_green: led@1 { - reg = <1>; - color = ; - function = LED_FUNCTION_STATUS; - }; - - led_system_blue: led@2 { - reg = <2>; - color = ; - function = LED_FUNCTION_STATUS; - }; - }; -}; - -&mdio { - status = "okay"; - - pinctrl-0 = <&mdio_pins>; - pinctrl-names = "default"; - reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; - - ethernet-phy-package@0 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "qcom,qca8075-package"; - reg = <0>; - - qca8075_1: ethernet-phy@1 { - compatible = "ethernet-phy-ieee802.3-c22"; - reg = <1>; - }; - - qca8075_2: ethernet-phy@2 { - compatible = "ethernet-phy-ieee802.3-c22"; - reg = <2>; - }; - - qca8075_3: ethernet-phy@3 { - compatible = "ethernet-phy-ieee802.3-c22"; - reg = <3>; - }; - - qca8075_4: ethernet-phy@4 { - compatible = "ethernet-phy-ieee802.3-c22"; - reg = <4>; - }; - }; -}; - -&switch { - status = "okay"; - - 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@2 { - port_id = <2>; - phy_address = <1>; - }; - port@3 { - port_id = <3>; - phy_address = <2>; - }; - port@4 { - port_id = <4>; - phy_address = <3>; - }; - port@5 { - port_id = <5>; - phy_address = <4>; - }; - }; -}; - -&edma { - status = "okay"; -}; - &dp2 { status = "okay"; phy-handle = <&qca8075_1>; @@ -431,16 +256,3 @@ phy-handle = <&qca8075_4>; label = "lan3"; }; - -&ssphy_0 { - status = "okay"; -}; - -&qusb_phy_0 { - status = "okay"; -}; - -&usb_0 { - status = "okay"; -}; - diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi new file mode 100644 index 00000000000..84e68dae356 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi @@ -0,0 +1,204 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/* Copyright (c) 2023, Mohammad Sayful Islam */ + +#include "ipq8074.dtsi" +#include "ipq8074-ac-cpu.dtsi" +#include "ipq8074-ess.dtsi" +#include +#include +#include + +/ { + aliases { + serial0 = &blsp1_uart5; + serial1 = &blsp1_uart3; + /* + * Aliases as required by u-boot + * to patch MAC addresses + */ + ethernet1 = &dp2; + ethernet2 = &dp3; + led-boot = &led_system_blue; + led-running = &led_system_blue; + led-failsafe = &led_system_red; + led-upgrade = &led_system_green; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + keys { + compatible = "gpio-keys"; + pinctrl-0 = <&button_pins>; + pinctrl-names = "default"; + + reset-button { + label = "reset"; + gpios = <&tlmm 52 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps-button { + label = "wps"; + gpios = <&tlmm 67 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&tlmm { + button_pins: button-state { + pins = "gpio52", "gpio67"; + function = "gpio"; + drive-strength = <8>; + bias-pull-up; + }; + + mdio_pins: mdio-state { + mdc-pins { + pins = "gpio68"; + function = "mdc"; + drive-strength = <8>; + bias-pull-up; + }; + + mdio-pins { + pins = "gpio69"; + function = "mdio"; + drive-strength = <8>; + bias-pull-up; + }; + }; +}; + +&blsp1_uart5 { + status = "okay"; +}; + +&prng { + status = "okay"; +}; + +&cryptobam { + status = "okay"; +}; + +&crypto { + status = "okay"; +}; + +&qpic_bam { + status = "okay"; +}; + +&blsp1_i2c2 { + status = "okay"; + + led-controller@62 { + compatible = "nxp,pca9633"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x62>; + nxp,hw-blink; + + led_system_red: led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led_system_green: led@1 { + reg = <1>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led_system_blue: led@2 { + reg = <2>; + color = ; + function = LED_FUNCTION_STATUS; + }; + }; +}; + +&mdio { + status = "okay"; + + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; + + ethernet-phy-package@0 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "qcom,qca8075-package"; + reg = <0>; + + qca8075_1: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + }; + + qca8075_2: ethernet-phy@2 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <2>; + }; + + qca8075_3: ethernet-phy@3 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <3>; + }; + + qca8075_4: ethernet-phy@4 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <4>; + }; + }; +}; + +&switch { + status = "okay"; + + 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@2 { + port_id = <2>; + phy_address = <1>; + }; + + port@3 { + port_id = <3>; + phy_address = <2>; + }; + + port@4 { + port_id = <4>; + phy_address = <3>; + }; + + port@5 { + port_id = <5>; + phy_address = <4>; + }; + }; +}; + +&edma { + status = "okay"; +}; + +&ssphy_0 { + status = "okay"; +}; + +&qusb_phy_0 { + status = "okay"; +}; + +&usb_0 { + status = "okay"; +}; From dbafc95cc5f7847a1d3c4524d372405f9144183d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Owoc?= Date: Sat, 27 Jul 2024 23:25:14 +0200 Subject: [PATCH 010/173] qualcommax: ipq807x: define configuration for Linksys MX4x00 devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Define shared configuration for Linksys MX4x00 devices. Signed-off-by: Paweł Owoc Link: https://github.com/openwrt/openwrt/pull/16070 Signed-off-by: Robert Marko --- target/linux/qualcommax/image/ipq807x.mk | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/target/linux/qualcommax/image/ipq807x.mk b/target/linux/qualcommax/image/ipq807x.mk index 4a194c6cb7b..8dacb054a81 100644 --- a/target/linux/qualcommax/image/ipq807x.mk +++ b/target/linux/qualcommax/image/ipq807x.mk @@ -170,12 +170,17 @@ define Device/linksys_mx DEVICE_PACKAGES := kmod-leds-pca963x endef -define Device/linksys_mx4200v1 +define Device/linksys_mx4x00 $(call Device/linksys_mx) + SOC := ipq8174 + DEVICE_PACKAGES += ipq-wifi-linksys_mx4200 +endef + +define Device/linksys_mx4200v1 + $(call Device/linksys_mx4x00) DEVICE_MODEL := MX4200 DEVICE_VARIANT := v1 - SOC := ipq8174 - DEVICE_PACKAGES += ipq-wifi-linksys_mx4200 kmod-bluetooth + DEVICE_PACKAGES += kmod-bluetooth endef TARGET_DEVICES += linksys_mx4200v1 From f96b3383d51f544861b8da4d7192594497d3f0b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Owoc?= Date: Thu, 1 Aug 2024 08:53:14 +0200 Subject: [PATCH 011/173] qualcommax: ipq807x: fix mac setup for Linksys MX4200v2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently for Linksys MX4200v2 all u-boot ethXaddr variables share the same MAC address and there is no need to check them one by one. Signed-off-by: Paweł Owoc Link: https://github.com/openwrt/openwrt/pull/16070 Signed-off-by: Robert Marko --- .../qualcommax/ipq807x/base-files/etc/board.d/02_network | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network index 012288fedc5..e3e1104486e 100644 --- a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network +++ b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network @@ -83,10 +83,8 @@ ipq807x_setup_macs() case "$board" in linksys,mx4200v2) label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) - for i in $(seq 3 5); do - [ "$(mtd_get_mac_ascii u_env eth${i}addr)" != "$label_mac" ] && lan_mac=$label_mac - done - [ "$(mtd_get_mac_ascii u_env eth2addr)" != "$label_mac" ] && wan_mac=$label_mac + [ "$(mtd_get_mac_ascii u_env eth1addr)" != "$label_mac" ] && wan_mac=$label_mac + [ "$(mtd_get_mac_ascii u_env eth2addr)" != "$label_mac" ] && lan_mac=$label_mac ;; linksys,mx8500) label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) From 5b3044e8e3900956d0813f2d600650917e19ec84 Mon Sep 17 00:00:00 2001 From: Qiyuan Zhang Date: Fri, 2 Aug 2024 10:57:51 -0400 Subject: [PATCH 012/173] mtd: fix resetbc on nand w/ min I/O size > 2048 Fix a bug in linksys_bootcount.c that resetbc won't work on nand with min I/O size> 2048. Check the boot-log entry's intergrity with checksum. Signed-off-by: Qiyuan Zhang Link: https://github.com/openwrt/openwrt/pull/16070 Signed-off-by: Robert Marko --- package/system/mtd/src/linksys_bootcount.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/package/system/mtd/src/linksys_bootcount.c b/package/system/mtd/src/linksys_bootcount.c index bd06728696c..d22486203e9 100644 --- a/package/system/mtd/src/linksys_bootcount.c +++ b/package/system/mtd/src/linksys_bootcount.c @@ -69,12 +69,10 @@ struct bootcounter { uint32_t checksum; }; -static char page[2048]; - int mtd_resetbc(const char *mtd) { struct mtd_info_user mtd_info; - struct bootcounter *curr = (struct bootcounter *)page; + struct bootcounter *curr = NULL; unsigned int i; unsigned int bc_offset_increment; int last_count = 0; @@ -108,24 +106,23 @@ int mtd_resetbc(const char *mtd) } num_bc = mtd_info.size / bc_offset_increment; + curr = malloc(bc_offset_increment); for (i = 0; i < num_bc; i++) { - pread(fd, curr, sizeof(*curr), i * bc_offset_increment); + pread(fd, curr, sizeof(struct bootcounter), i * bc_offset_increment); /* Existing code assumes erase is to 0xff; left as-is (2019) */ + if (curr->magic == 0xffffffff) + break; - if (curr->magic != BOOTCOUNT_MAGIC && - curr->magic != 0xffffffff) { - DLOG_ERR("Unexpected magic %08x at offset %08x; aborting.", - curr->magic, i * bc_offset_increment); + if (curr->magic != BOOTCOUNT_MAGIC || curr->checksum != curr->magic + curr->count) { + DLOG_ERR("Unexpected boot-count log at offset %08x: magic %08x boot count %08x checksum %08x; aborting.", + i * bc_offset_increment, curr->magic, curr->count, curr->checksum); retval = -2; goto out; } - if (curr->magic == 0xffffffff) - break; - last_count = curr->count; } @@ -182,6 +179,7 @@ int mtd_resetbc(const char *mtd) } out: + if (curr != NULL) free(curr); close(fd); return retval; } From f7ee30120faf6e667570b94d8695487ace5d2caa Mon Sep 17 00:00:00 2001 From: Qiyuan Zhang Date: Thu, 1 Aug 2024 18:24:55 -0400 Subject: [PATCH 013/173] qualcommax: add kernel cmdline replacement hack Add kernel command line replacement hack to qualcommax. Now we can find and replace arguments in the kernel command line by setting bootargs-find-1, bootargs-replace-1, bootargs-exact-match-1 and bootargs-find-2, bootargs-replace-2, bootargs-exact-match-2 under the chosen node in the device tree. This hack replaces the first occurence of bootargs-find-X with bootargs-replace-X. When bootargs-exact-match-X is set to "y", then the replacement happens only if the kernel command line is identical to bootargs-find-X. Signed-off-by: Qiyuan Zhang Link: https://github.com/openwrt/openwrt/pull/16070 Signed-off-by: Robert Marko --- .../0911-arm64-cmdline-replacement.patch | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 target/linux/qualcommax/patches-6.6/0911-arm64-cmdline-replacement.patch diff --git a/target/linux/qualcommax/patches-6.6/0911-arm64-cmdline-replacement.patch b/target/linux/qualcommax/patches-6.6/0911-arm64-cmdline-replacement.patch new file mode 100644 index 00000000000..afc71bf9955 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/0911-arm64-cmdline-replacement.patch @@ -0,0 +1,105 @@ +Subject: qualcommax: add kernel cmdline replacement hack + +Add kernel command line replacement hack to qualcommax. Now we can +find and replace arguments in the kernel command line by setting +bootargs-find-1, bootargs-replace-1, bootargs-exact-match-1 +and bootargs-find-2, bootargs-replace-2, bootargs-exact-match-2 +under the chosen node in the device tree. + +This hack replaces the first occurence of bootargs-find-X with +bootargs-replace-X. If bootargs-exact-match-X is set to "y", +then the replacement happens only if the kernel command line is +identical to bootargs-find-X. + +Signed-off-by: Qiyuan Zhang +--- + drivers/of/fdt.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 71 insertions(+) + +--- a/drivers/of/fdt.c ++++ b/drivers/of/fdt.c +@@ -1158,6 +1158,14 @@ int __init early_init_dt_scan_chosen(cha + const void *rng_seed; + const void *fdt = initial_boot_params; + ++ int i, cmd_len, f_len, r_len, offset, step; ++ char *s_ptr, *l_end, *r_end, *cur_ptr, *end_ptr; ++ const char *exact_match; ++ const int bootargs_replace_num = 2; ++ const char *bootargs_replace_props[2][3] = ++ { {"bootargs-find-1", "bootargs-replace-1", "bootargs-exact-match-1"}, ++ {"bootargs-find-2", "bootargs-replace-2", "bootargs-exact-match-2"} }; ++ + node = fdt_path_offset(fdt, "/chosen"); + if (node < 0) + node = fdt_path_offset(fdt, "/chosen@0"); +@@ -1186,6 +1194,69 @@ int __init early_init_dt_scan_chosen(cha + p = of_get_flat_dt_prop(node, "bootargs", &l); + if (p != NULL && l > 0) + strscpy(cmdline, p, min(l, COMMAND_LINE_SIZE)); ++ ++ for(i = 0; i < bootargs_replace_num; i++) { ++ p = of_get_flat_dt_prop(node, bootargs_replace_props[i][0], &f_len); ++ ++ if (p == NULL || f_len == 0 ) ++ continue; ++ ++ exact_match = of_get_flat_dt_prop(node, bootargs_replace_props[i][2], &l); ++ ++ if (exact_match != NULL && l > 0 && exact_match[0] == 'y') { ++ if(strncmp(cmdline, p, r_len) == 0) ++ s_ptr = cmdline; ++ else ++ s_ptr = NULL; ++ } else { ++ s_ptr = strstr(cmdline, p); ++ } ++ ++ if(!s_ptr) ++ continue; ++ ++ p = of_get_flat_dt_prop(node, bootargs_replace_props[i][1], &r_len); ++ ++ if (p == NULL || r_len == 0) ++ continue; ++ ++ pr_info("Input kernel commad line: %s\n", cmdline); ++ ++ cmd_len = strlen(cmdline); ++ ++ if (cmd_len - f_len + r_len < COMMAND_LINE_SIZE) { ++ ++ pr_info("Replace kernel command line with %s\n", bootargs_replace_props[i][1]); ++ ++ offset = r_len - f_len; ++ ++ if (offset != 0) { ++ l_end = s_ptr + f_len - 1; ++ r_end = cmdline + cmd_len; ++ ++ if (offset > 0) { ++ step = -1; ++ cur_ptr = r_end; ++ end_ptr = l_end + step; ++ } else { ++ step = 1; ++ cur_ptr = l_end; ++ end_ptr = r_end + step; ++ } ++ ++ for (; cur_ptr != end_ptr; cur_ptr += step) ++ *(cur_ptr + offset) = *cur_ptr; ++ } ++ ++ strncpy(s_ptr, p, r_len - 1); ++ ++ pr_info("Kernel command line after replacement: %s\n", cmdline); ++ } else { ++ pr_err("Replace kernel command line with %s failed\n", bootargs_replace_props[i][1]); ++ } ++ ++ } ++ + p = of_get_flat_dt_prop(node, "bootargs-append", &l); + if (p != NULL && l > 0) + strlcat(cmdline, p, min_t(int, strlen(cmdline) + (int)l, COMMAND_LINE_SIZE)); From d6459091fd262446fcf98ebe7d33c5615ebf8d41 Mon Sep 17 00:00:00 2001 From: Qiyuan Zhang Date: Mon, 5 Aug 2024 06:47:21 -0400 Subject: [PATCH 014/173] mtd: check the return value of malloc and pread Check the return value of malloc and pread in case they fail. Signed-off-by: Qiyuan Zhang Link: https://github.com/openwrt/openwrt/pull/16070 Signed-off-by: Robert Marko --- package/system/mtd/src/linksys_bootcount.c | 24 ++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/package/system/mtd/src/linksys_bootcount.c b/package/system/mtd/src/linksys_bootcount.c index d22486203e9..3ec0b61718c 100644 --- a/package/system/mtd/src/linksys_bootcount.c +++ b/package/system/mtd/src/linksys_bootcount.c @@ -106,17 +106,31 @@ int mtd_resetbc(const char *mtd) } num_bc = mtd_info.size / bc_offset_increment; - curr = malloc(bc_offset_increment); + curr = malloc(bc_offset_increment); + + if(curr == NULL) { + DLOG_ERR("Failed to allocate %u bytes from memory.", bc_offset_increment); + + retval = -6; + goto out; + } for (i = 0; i < num_bc; i++) { - pread(fd, curr, sizeof(struct bootcounter), i * bc_offset_increment); + ret = pread(fd, curr, sizeof(struct bootcounter), i * bc_offset_increment); + + if(ret != sizeof(struct bootcounter)) { + DLOG_ERR("Failed to read boot-count log at offset 0x%08x.", i * bc_offset_increment); + + retval = -5; + goto out; + } /* Existing code assumes erase is to 0xff; left as-is (2019) */ if (curr->magic == 0xffffffff) break; if (curr->magic != BOOTCOUNT_MAGIC || curr->checksum != curr->magic + curr->count) { - DLOG_ERR("Unexpected boot-count log at offset %08x: magic %08x boot count %08x checksum %08x; aborting.", + DLOG_ERR("Unexpected boot-count log at offset 0x%08x: magic 0x%08x boot count 0x%08x checksum 0x%08x; aborting.", i * bc_offset_increment, curr->magic, curr->count, curr->checksum); retval = -2; @@ -179,7 +193,9 @@ int mtd_resetbc(const char *mtd) } out: - if (curr != NULL) free(curr); + if (curr != NULL) + free(curr); + close(fd); return retval; } From adfb1b76969d3919fc40571f67ab9c3e2dec7e16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Owoc?= Date: Fri, 26 Jul 2024 19:00:57 +0200 Subject: [PATCH 015/173] qualcommax: ipq807x: add support for Linksys MX4300 (LN1301) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hardware specification: ======== SoC: Qualcomm IPQ8174 Flash: 1GB (Micron MT29F8G08ABBCAH4 or AMD/Spansion S34MS08G2) RAM: 2GB (2x Kingston B5116ECMDXGJD or ESMT M15T2G16128A DDR3L) Ethernet: 4x 10/100/1000Mbps (Qualcomm QCA8075) WiFi1: 5GHz ax 2x2 (Qualcomm QCN5054 + Skyworks SKY85755-11) - channels 36-64 (low band) WiFi2: 2.4GHz ax 2x2 (Qualcomm QCN5024 + Skyworks SKY85340-11) WiFi3: 5GHz ax 4x4 (Qualcomm QCN5054 + Skyworks SKY85755-11) - channels 100-177 (high band) LED: 1x RGB status (NXP PCA9633) USB: 1x USB 3.0 Button: WPS, Reset Flash instructions: ======== 1. Manually upgrade firmware using openwrt-qualcommax-ipq807x-linksys_mx4300-squashfs-factory.bin image. More details can be found here: https://support.linksys.com/kb/article/6564-en/ After first boot check actual partition: - fw_printenv -n boot_part and install firmware on second partition using command in case of 2: - mtd -r -e kernel -n write openwrt-qualcommax-ipq807x-linksys_mx4300-squashfs-factory.bin kernel and in case of 1: - mtd -r -e alt_kernel -n write openwrt-qualcommax-ipq807x-linksys_mx4300-squashfs-factory.bin alt_kernel 2. Installation using serial connection from OEM firmware (default login: root, password: admin): - fw_printenv -n boot_part In case of 2: - flash_erase /dev/mtd21 0 0 - nandwrite -p /dev/mtd21 openwrt-qualcommax-ipq807x-linksys_mx4300-squashfs-factory.bin or in case of 1: - flash_erase /dev/mtd23 0 0 - nandwrite -p /dev/mtd23 openwrt-qualcommax-ipq807x-linksys_mx4300-squashfs-factory.bin After first boot install firmware on second partition: - mtd -r -e kernel -n write openwrt-qualcommax-ipq807x-linksys_mx4300-squashfs-factory.bin kernel or: - mtd -r -e alt_kernel -n write openwrt-qualcommax-ipq807x-linksys_mx4300-squashfs-factory.bin alt_kernel 3. Installation from initramfs image using USB drive: Put the initramfs image on the USB drive: - dd bs=1M if=openwrt-qualcommax-ipq807x-linksys_mx4300-initramfs-uImage.itb of=/dev/sdX Stop u-boot and run: - usb start && usbboot $loadaddr 0 && bootm $loadaddr Write firmware to the flash from initramfs: - mtd -e kernel -n write openwrt-qualcommax-ipq807x-linksys_mx4300-squashfs-factory.bin kernel and: - mtd -r -e alt_kernel -n write openwrt-qualcommax-ipq807x-linksys_mx4300-squashfs-factory.bin alt_kernel 4. Back to the OEM firmware: - mtd -e kernel -n write FW_MX4300_1.0.4.215382_prod.img kernel and: - mtd -r -e alt_kernel -n write FW_MX4300_1.0.4.215382_prod.img alt_kernel 5. USB recovery: Put the initramfs image on the USB: - dd bs=1M if=openwrt-qualcommax-ipq807x-linksys_mx4300-initramfs-uImage.itb of=/dev/sdX Set u-boot env: - fw_setenv bootusb 'usb start && usbboot $loadaddr 0 && bootm $loadaddr' - fw_setenv bootcmd 'run bootusb; if test $auto_recovery = no; then bootipq; elif test $boot_part = 1; then run bootpart1; else run bootpart2; fi' Co-authored-by: Qiyuan Zhang Signed-off-by: Paweł Owoc Link: https://github.com/openwrt/openwrt/pull/16070 Signed-off-by: Robert Marko --- .../uboot-envtools/files/qualcommax_ipq807x | 5 + .../arm64/boot/dts/qcom/ipq8174-mx4300.dts | 273 ++++++++++++++++++ target/linux/qualcommax/image/ipq807x.mk | 11 + .../ipq807x/base-files/etc/board.d/02_network | 4 +- .../etc/hotplug.d/firmware/11-ath11k-caldata | 8 + .../ipq807x/base-files/etc/init.d/bootcount | 1 + .../base-files/lib/upgrade/platform.sh | 1 + 7 files changed, 302 insertions(+), 1 deletion(-) create mode 100644 target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4300.dts diff --git a/package/boot/uboot-envtools/files/qualcommax_ipq807x b/package/boot/uboot-envtools/files/qualcommax_ipq807x index b0088125c4c..49754338a59 100644 --- a/package/boot/uboot-envtools/files/qualcommax_ipq807x +++ b/package/boot/uboot-envtools/files/qualcommax_ipq807x @@ -37,6 +37,11 @@ linksys,mx8500) [ -n "$idx" ] && \ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2" ;; +linksys,mx4300) + idx="$(find_mtd_index u_env)" + [ -n "$idx" ] && \ + ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x40000" "1" + ;; netgear,sxr80|\ netgear,sxs80|\ tplink,eap620hd-v1|\ diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4300.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4300.dts new file mode 100644 index 00000000000..1477019ab94 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4300.dts @@ -0,0 +1,273 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq8174-mx4x00.dtsi" + +/ { + model = "Linksys MX4300"; + compatible = "linksys,mx4300", "qcom,ipq8074"; + + chosen { + /* + In the kernel command line, replace the first occurence of bootargs-find-X with bootargs-replace-X. + If bootargs-exact-match-X is set to "y", then replacement happens only if the kernel command line + is identical to bootargs-find-X. + */ + bootargs-find-1 = "ubi.mtd=22,2048"; + bootargs-replace-1 = "ubi.mtd=22,4096"; + + bootargs-find-2 = "ubi.mtd=24,2048"; + bootargs-replace-2 = "ubi.mtd=24,4096"; + }; +}; + +&qpic_nand { + status = "okay"; + + /* + * Bootloader will find the NAND DT node by the compatible and + * then "fixup" it by adding the partitions from the SMEM table + * using the legacy bindings thus making it impossible for us + * to change the partition table or utilize NVMEM for calibration. + * So add a dummy partitions node that bootloader will populate + * and set it as disabled so the kernel ignores it instead of + * printing warnings due to the broken way bootloader adds the + * partitions. + */ + partitions { + status = "disabled"; + }; + + nand@0 { + reg = <0>; + /* + * Some devices use Micron NAND with with 8 bit ECC + * other AMD/Spansion NAND with 4 bit ECC + *nand-ecc-strength = <4>; + *nand-ecc-step-size = <512>; + */ + nand-bus-width = <8>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "0:sbl1"; + reg = <0x0 0x100000>; + read-only; + }; + + partition@100000 { + label = "0:mibib"; + reg = <0x100000 0x100000>; + read-only; + }; + + partition@200000 { + label = "0:bootconfig"; + reg = <0x200000 0x80000>; + read-only; + }; + + partition@280000 { + label = "0:bootconfig1"; + reg = <0x280000 0x80000>; + read-only; + }; + + partition@300000 { + label = "0:qsee"; + reg = <0x300000 0x300000>; + read-only; + }; + + partition@600000 { + label = "0:qsee_1"; + reg = <0x600000 0x300000>; + read-only; + }; + + partition@900000 { + label = "0:devcfg"; + reg = <0x900000 0x80000>; + read-only; + }; + + partition@980000 { + label = "0:devcfg_1"; + reg = <0x980000 0x80000>; + read-only; + }; + + partition@a00000 { + label = "0:apdp"; + reg = <0xa00000 0x80000>; + read-only; + }; + + partition@a80000 { + label = "0:apdp_1"; + reg = <0xa80000 0x80000>; + read-only; + }; + + partition@b00000 { + label = "0:rpm"; + reg = <0xb00000 0x80000>; + read-only; + }; + + partition@b80000 { + label = "0:rpm_1"; + reg = <0xb80000 0x80000>; + read-only; + }; + + partition@c00000 { + label = "0:cdt"; + reg = <0xc00000 0x80000>; + read-only; + }; + + partition@c80000 { + label = "0:cdt_1"; + reg = <0xc80000 0x80000>; + read-only; + }; + + partition@d00000 { + label = "0:appsblenv"; + reg = <0xd00000 0x80000>; + }; + + partition@d80000 { + label = "0:appsbl"; + reg = <0xd80000 0x100000>; + read-only; + }; + + partition@e80000 { + label = "0:appsbl_1"; + reg = <0xe80000 0x100000>; + read-only; + }; + + partition@f80000 { + label = "0:art"; + reg = <0xf80000 0x80000>; + read-only; + }; + + partition@1000000 { + label = "u_env"; + reg = <0x1000000 0x100000>; + }; + + partition@1100000 { + label = "s_env"; + reg = <0x1100000 0x100000>; + }; + + partition@1200000 { + label = "devinfo"; + reg = <0x1200000 0x40000>; + read-only; + }; + + partition@1240000 { + label = "kernel"; + reg = <0x1240000 0xaf40000>; + }; + + partition@1a40000 { + label = "rootfs"; + reg = <0x1a40000 0xa740000>; + }; + + partition@c180000 { + label = "alt_kernel"; + reg = <0xc180000 0xaf40000>; + }; + + partition@c980000 { + label = "alt_rootfs"; + reg = <0xc980000 0xa740000>; + }; + + partition@170c0000 { + label = "sysdiag"; + reg = <0x170c0000 0x400000>; + read-only; + }; + + partition@174c0000 { + label = "0:ethphyfw"; + reg = <0x174c0000 0x80000>; + read-only; + }; + + partition@17540000 { + label = "syscfg"; + reg = <0x17540000 0x79c0000>; + read-only; + }; + + partition@1ef00000 { + label = "secured_store"; + reg = <0x1ef00000 0x400000>; + read-only; + }; + + partition@1f300000 { + label = "0:wififw"; + reg = <0x1f300000 0x1900000>; + read-only; + }; + + partition@20c00000 { + label = "app2_data"; + reg = <0x20c00000 0x16180000>; + read-only; + }; + + partition@36d80000 { + label = "app2"; + reg = <0x36d80000 0x9280000>; + read-only; + }; + }; + }; +}; + +&dp2 { + status = "okay"; + phy-handle = <&qca8075_1>; + label = "wan"; +}; + +&dp3 { + status = "okay"; + phy-handle = <&qca8075_2>; + label = "lan3"; +}; + +&dp4 { + status = "okay"; + phy-handle = <&qca8075_3>; + label = "lan2"; +}; + +&dp5 { + status = "okay"; + phy-handle = <&qca8075_4>; + label = "lan1"; +}; + +&wifi { + status = "okay"; + + qcom,ath11k-calibration-variant = "Linksys-MX4200v1"; +}; diff --git a/target/linux/qualcommax/image/ipq807x.mk b/target/linux/qualcommax/image/ipq807x.mk index 8dacb054a81..260b358ce89 100644 --- a/target/linux/qualcommax/image/ipq807x.mk +++ b/target/linux/qualcommax/image/ipq807x.mk @@ -190,6 +190,17 @@ define Device/linksys_mx4200v2 endef TARGET_DEVICES += linksys_mx4200v2 +define Device/linksys_mx4300 + $(call Device/linksys_mx4x00) + DEVICE_MODEL := MX4300 + BLOCKSIZE := 256k + PAGESIZE := 4096 + KERNEL_SIZE := 8192k + IMAGE_SIZE := 171264k + NAND_SIZE := 1024m +endef +TARGET_DEVICES += linksys_mx4300 + define Device/linksys_mx5300 $(call Device/linksys_mx) DEVICE_MODEL := MX5300 diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network index e3e1104486e..5bacbd7dee1 100644 --- a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network +++ b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network @@ -29,6 +29,7 @@ ipq807x_setup_interfaces() compex,wpq873|\ linksys,mx4200v1|\ linksys,mx4200v2|\ + linksys,mx4300|\ prpl,haze|\ redmi,ax6|\ spectrum,sax1v1k|\ @@ -81,7 +82,8 @@ ipq807x_setup_macs() local label_mac="" case "$board" in - linksys,mx4200v2) + linksys,mx4200v2|\ + linksys,mx4300) label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) [ "$(mtd_get_mac_ascii u_env eth1addr)" != "$label_mac" ] && wan_mac=$label_mac [ "$(mtd_get_mac_ascii u_env eth2addr)" != "$label_mac" ] && lan_mac=$label_mac diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata index 7496138a26f..65e064ea4d2 100644 --- a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata +++ b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata @@ -44,6 +44,14 @@ case "$FIRMWARE" in ath11k_remove_regdomain ath11k_set_macflag ;; + linksys,mx4300) + caldata_extract "0:art" 0x1000 0x20000 + label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) + ath11k_patch_mac $(macaddr_add $label_mac 2) 0 + ath11k_patch_mac $(macaddr_add $label_mac 1) 1 + ath11k_patch_mac $(macaddr_add $label_mac 3) 2 + ath11k_remove_regdomain + ;; netgear,rax120v2) caldata_extract "0:art" 0x1000 0x20000 ath11k_patch_mac $(mtd_get_mac_binary boarddata1 0xc) 0 diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/init.d/bootcount b/target/linux/qualcommax/ipq807x/base-files/etc/init.d/bootcount index 26da7cd614e..176a5a144a0 100755 --- a/target/linux/qualcommax/ipq807x/base-files/etc/init.d/bootcount +++ b/target/linux/qualcommax/ipq807x/base-files/etc/init.d/bootcount @@ -12,6 +12,7 @@ boot() { ;; linksys,mx4200v1|\ linksys,mx4200v2|\ + linksys,mx4300|\ linksys,mx5300|\ linksys,mx8500) mtd resetbc s_env || true diff --git a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh index 5e339ae1ecc..b53ec149fe2 100644 --- a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh @@ -168,6 +168,7 @@ platform_do_upgrade() { ;; linksys,mx4200v1|\ linksys,mx4200v2|\ + linksys,mx4300|\ linksys,mx5300|\ linksys,mx8500) boot_part="$(fw_printenv -n boot_part)" From 4357f32d41eb4364841cab831bcaf7848695b5d7 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Wed, 1 Jan 2025 11:01:48 +0100 Subject: [PATCH 016/173] realtek: debounce reset key for Zyxel GS1900 When the reset button is next to the SFP cages, I2C operations on the modules might cause interference on the button's GPIO line. Add a debounce-interval of 5 times the poll-interval to ensure the line is actually stable for some time and not just glitching. Signed-off-by: Sander Vanheule --- target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi | 1 + target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts | 1 + 2 files changed, 2 insertions(+) diff --git a/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi b/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi index b985c4bc8e4..59b44ad1615 100644 --- a/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi +++ b/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi @@ -20,6 +20,7 @@ keys { compatible = "gpio-keys-polled"; + debounce-interval = <100>; poll-interval = <20>; reset { diff --git a/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts b/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts index 9844dc2180f..ad3245fc276 100644 --- a/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts +++ b/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts @@ -41,6 +41,7 @@ keys { compatible = "gpio-keys-polled"; + debounce-interval = <100>; poll-interval = <20>; mode { From 04601004befe75a430696139e50595a54140e750 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Wed, 1 Jan 2025 11:22:30 +0100 Subject: [PATCH 017/173] Revert "mac80211: ath9k: clean up gpiochip" This reverts commit 2af552372d4e0feda947d44eba3775b335d242db. Signed-off-by: Robert Marko --- .../ath9k/548-ath9k_enable_gpio_chip.patch | 111 +++++++++++------- .../ath9k/549-ath9k_enable_gpio_buttons.patch | 22 ++-- 2 files changed, 77 insertions(+), 56 deletions(-) diff --git a/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch index b2aee815a64..0efe23b9dc9 100644 --- a/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch +++ b/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch @@ -10,32 +10,47 @@ Signed-off-by: Felix Fietkau --- --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -25,6 +25,8 @@ +@@ -25,6 +25,7 @@ #include #include #include +#include -+#include #include "common.h" #include "debug.h" -@@ -1046,6 +1048,10 @@ struct ath_softc { +@@ -991,6 +992,14 @@ struct ath_led { + struct led_classdev cdev; + }; + ++#ifdef CONFIG_GPIOLIB ++struct ath9k_gpio_chip { ++ struct ath_softc *sc; ++ char label[32]; ++ struct gpio_chip gchip; ++}; ++#endif ++ + struct ath_softc { + struct ieee80211_hw *hw; + struct device *dev; +@@ -1046,6 +1055,9 @@ struct ath_softc { #ifdef CPTCFG_MAC80211_LEDS const char *led_default_trigger; struct list_head leds; +#ifdef CONFIG_GPIOLIB -+ struct gpio_chip *gpiochip; -+ struct gpio_desc *gpiodesc; ++ struct ath9k_gpio_chip *gpiochip; +#endif #endif #ifdef CPTCFG_ATH9K_DEBUGFS --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c -@@ -16,12 +16,123 @@ +@@ -15,13 +15,131 @@ + */ #include "ath9k.h" - ++#include ++ +#ifdef CPTCFG_MAC80211_LEDS + +#ifdef CONFIG_GPIOLIB @@ -47,9 +62,10 @@ Signed-off-by: Felix Fietkau +/* gpio_chip handler : set GPIO to input */ +static int ath9k_gpio_pin_cfg_input(struct gpio_chip *chip, unsigned offset) +{ -+ struct ath_softc *sc = gpiochip_get_data(chip); ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, ++ gchip); + -+ ath9k_hw_gpio_request_in(sc->sc_ah, offset, "ath9k-gpio"); ++ ath9k_hw_gpio_request_in(gc->sc->sc_ah, offset, "ath9k-gpio"); + + return 0; +} @@ -58,11 +74,12 @@ Signed-off-by: Felix Fietkau +static int ath9k_gpio_pin_cfg_output(struct gpio_chip *chip, unsigned offset, + int value) +{ -+ struct ath_softc *sc = gpiochip_get_data(chip); ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, ++ gchip); + -+ ath9k_hw_gpio_request_out(sc->sc_ah, offset, "ath9k-gpio", ++ ath9k_hw_gpio_request_out(gc->sc->sc_ah, offset, "ath9k-gpio", + AR_GPIO_OUTPUT_MUX_AS_OUTPUT); -+ ath9k_hw_set_gpio(sc->sc_ah, offset, value); ++ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value); + + return 0; +} @@ -70,8 +87,9 @@ Signed-off-by: Felix Fietkau +/* gpio_chip handler : query GPIO direction (0=out, 1=in) */ +static int ath9k_gpio_pin_get_dir(struct gpio_chip *chip, unsigned offset) +{ -+ struct ath_softc *sc = gpiochip_get_data(chip); -+ struct ath_hw *ah = sc->sc_ah; ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, ++ gchip); ++ struct ath_hw *ah = gc->sc->sc_ah; + + return !((REG_READ(ah, AR_GPIO_OE_OUT(ah)) >> (offset * 2)) & 3); +} @@ -79,62 +97,65 @@ Signed-off-by: Felix Fietkau +/* gpio_chip handler : get GPIO pin value */ +static int ath9k_gpio_pin_get(struct gpio_chip *chip, unsigned offset) +{ -+ struct ath_softc *sc = gpiochip_get_data(chip); ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, ++ gchip); + -+ return ath9k_hw_gpio_get(sc->sc_ah, offset); ++ return ath9k_hw_gpio_get(gc->sc->sc_ah, offset); +} + +/* gpio_chip handler : set GPIO pin to value */ +static void ath9k_gpio_pin_set(struct gpio_chip *chip, unsigned offset, + int value) +{ -+ struct ath_softc *sc = gpiochip_get_data(chip); ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, ++ gchip); + -+ ath9k_hw_set_gpio(sc->sc_ah, offset, value); ++ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value); +} + +/* register GPIO chip */ +static void ath9k_register_gpio_chip(struct ath_softc *sc) +{ -+ struct gpio_chip *gc = sc->gpiochip; ++ struct ath9k_gpio_chip *gc; + struct ath_hw *ah = sc->sc_ah; + -+ gc = kzalloc(sizeof(struct gpio_chip), GFP_KERNEL); ++ gc = kzalloc(sizeof(struct ath9k_gpio_chip), GFP_KERNEL); + if (!gc) + return; + -+ gc->label = kasprintf(GFP_KERNEL, "ath9k-%s", -+ wiphy_name(sc->hw->wiphy)); -+ if (!gc->label) -+ return; -+ -+ gc->parent = sc->dev; -+ gc->base = -1; /* determine base automatically */ -+ gc->ngpio = ah->caps.num_gpio_pins; -+ gc->direction_input = ath9k_gpio_pin_cfg_input; -+ gc->direction_output = ath9k_gpio_pin_cfg_output; -+ gc->get_direction = ath9k_gpio_pin_get_dir; -+ gc->get = ath9k_gpio_pin_get; -+ gc->set = ath9k_gpio_pin_set; -+ -+ if (gpiochip_add_data(gc, sc)) { -+ kfree(gc->label); ++ gc->sc = sc; ++ snprintf(gc->label, sizeof(gc->label), "ath9k-%s", ++ wiphy_name(sc->hw->wiphy)); ++ gc->gchip.parent = sc->dev; ++ gc->gchip.label = gc->label; ++ gc->gchip.base = -1; /* determine base automatically */ ++ gc->gchip.ngpio = ah->caps.num_gpio_pins; ++ gc->gchip.direction_input = ath9k_gpio_pin_cfg_input; ++ gc->gchip.direction_output = ath9k_gpio_pin_cfg_output; ++ gc->gchip.get_direction = ath9k_gpio_pin_get_dir; ++ gc->gchip.get = ath9k_gpio_pin_get; ++ gc->gchip.set = ath9k_gpio_pin_set; ++ ++ if (gpiochip_add(&gc->gchip)) { + kfree(gc); + return; + } ++ ++ gc->gchip.owner = NULL; ++ sc->gpiochip = gc; +} + +/* remove GPIO chip */ +static void ath9k_unregister_gpio_chip(struct ath_softc *sc) +{ -+ struct gpio_chip *gc = sc->gpiochip; ++ struct ath9k_gpio_chip *gc = sc->gpiochip; + + if (!gc) + return; + -+ gpiochip_remove(gc); -+ kfree(gc->label); ++ gpiochip_remove(&gc->gchip); + kfree(gc); ++ sc->gpiochip = NULL; +} + +#else /* CONFIG_GPIOLIB */ @@ -148,7 +169,7 @@ Signed-off-by: Felix Fietkau +} + +#endif /* CONFIG_GPIOLIB */ -+ + /********************************/ /* LED functions */ /********************************/ @@ -158,27 +179,27 @@ Signed-off-by: Felix Fietkau static void ath_fill_led_pin(struct ath_softc *sc) { struct ath_hw *ah = sc->sc_ah; -@@ -79,6 +190,12 @@ static int ath_add_led(struct ath_softc +@@ -79,6 +197,12 @@ static int ath_add_led(struct ath_softc else ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low); +#ifdef CONFIG_GPIOLIB + /* If there is GPIO chip configured, reserve LED pin */ + if (sc->gpiochip) -+ sc->gpiodesc = gpiod_get(sc->dev, gpio->name, GPIOD_ASIS); ++ gpio_request(sc->gpiochip->gchip.base + gpio->gpio, gpio->name); +#endif + return 0; } -@@ -117,17 +234,24 @@ void ath_deinit_leds(struct ath_softc *s +@@ -117,17 +241,24 @@ void ath_deinit_leds(struct ath_softc *s while (!list_empty(&sc->leds)) { led = list_first_entry(&sc->leds, struct ath_led, list); +#ifdef CONFIG_GPIOLIB + /* If there is GPIO chip configured, free LED pin */ + if (sc->gpiochip) -+ gpiod_put(sc->gpiodesc); ++ gpio_free(sc->gpiochip->gchip.base + led->gpio->gpio); +#endif list_del(&led->list); ath_led_brightness(&led->cdev, LED_OFF); @@ -196,7 +217,7 @@ Signed-off-by: Felix Fietkau char led_name[32]; const char *trigger; -@@ -136,6 +260,12 @@ void ath_init_leds(struct ath_softc *sc) +@@ -136,6 +267,12 @@ void ath_init_leds(struct ath_softc *sc) if (AR_SREV_9100(sc->sc_ah)) return; diff --git a/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch index 728b6663a2b..78700222a93 100644 --- a/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch +++ b/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch @@ -10,27 +10,27 @@ Signed-off-by: Felix Fietkau --- --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -1051,6 +1051,7 @@ struct ath_softc { +@@ -1057,6 +1057,7 @@ struct ath_softc { + struct list_head leds; #ifdef CONFIG_GPIOLIB - struct gpio_chip *gpiochip; - struct gpio_desc *gpiodesc; + struct ath9k_gpio_chip *gpiochip; + struct platform_device *btnpdev; /* gpio-keys-polled */ #endif #endif --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c -@@ -15,6 +15,8 @@ - */ +@@ -16,6 +16,8 @@ #include "ath9k.h" + #include +#include +#include #ifdef CPTCFG_MAC80211_LEDS -@@ -117,6 +119,67 @@ static void ath9k_unregister_gpio_chip(s - kfree(gc); +@@ -124,6 +126,67 @@ static void ath9k_unregister_gpio_chip(s + sc->gpiochip = NULL; } +/******************/ @@ -64,7 +64,7 @@ Signed-off-by: Felix Fietkau + + ath9k_hw_gpio_request_in(sc->sc_ah, ah->btns[i].gpio, + "ath9k-gpio"); -+ bt[i].gpio = sc->gpiochip->base + ah->btns[i].gpio; ++ bt[i].gpio = sc->gpiochip->gchip.base + ah->btns[i].gpio; + } + + memset(&gkpdata, 0, sizeof(struct gpio_keys_platform_data)); @@ -97,7 +97,7 @@ Signed-off-by: Felix Fietkau #else /* CONFIG_GPIOLIB */ static inline void ath9k_register_gpio_chip(struct ath_softc *sc) -@@ -127,6 +190,14 @@ static inline void ath9k_unregister_gpio +@@ -134,6 +197,14 @@ static inline void ath9k_unregister_gpio { } @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau #endif /* CONFIG_GPIOLIB */ /********************************/ -@@ -232,6 +303,7 @@ void ath_deinit_leds(struct ath_softc *s +@@ -239,6 +310,7 @@ void ath_deinit_leds(struct ath_softc *s { struct ath_led *led; @@ -120,7 +120,7 @@ Signed-off-by: Felix Fietkau while (!list_empty(&sc->leds)) { led = list_first_entry(&sc->leds, struct ath_led, list); #ifdef CONFIG_GPIOLIB -@@ -267,6 +339,7 @@ void ath_init_leds(struct ath_softc *sc) +@@ -274,6 +346,7 @@ void ath_init_leds(struct ath_softc *sc) } ath_fill_led_pin(sc); From caee153f8db57d9994c7d57a9f39fb1767a440f1 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Wed, 1 Jan 2025 11:22:37 +0100 Subject: [PATCH 018/173] Revert "mac80211: ath9k: remove platform leds" This reverts commit ad2e55e02b67701b6af61c9348234987b1217a59. Signed-off-by: Robert Marko --- .../mac80211/patches/ath9k/100-gpio-of.patch | 5 +- .../patches/ath9k/530-ath9k_extra_leds.patch | 24 ++++---- .../ath9k/531-ath9k_extra_platform_leds.patch | 56 +++++++++++++++++++ .../ath9k/542-ath9k_debugfs_diag.patch | 2 +- .../ath9k/548-ath9k_enable_gpio_chip.patch | 16 ++++-- .../ath9k/549-ath9k_enable_gpio_buttons.patch | 8 +-- 6 files changed, 87 insertions(+), 24 deletions(-) create mode 100644 package/kernel/mac80211/patches/ath9k/531-ath9k_extra_platform_leds.patch diff --git a/package/kernel/mac80211/patches/ath9k/100-gpio-of.patch b/package/kernel/mac80211/patches/ath9k/100-gpio-of.patch index 28dcc6cf852..2cddb59fc54 100644 --- a/package/kernel/mac80211/patches/ath9k/100-gpio-of.patch +++ b/package/kernel/mac80211/patches/ath9k/100-gpio-of.patch @@ -1,9 +1,12 @@ --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h -@@ -976,6 +976,10 @@ struct ath_hw { +@@ -976,6 +976,13 @@ struct ath_hw { bool disable_2ghz; bool disable_5ghz; ++ int num_leds; ++ const struct gpio_led *leds; ++ + unsigned num_btns; + const struct gpio_keys_button *btns; + unsigned btn_poll_interval; 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 0377c3f0b69..4bb27d558cc 100644 --- a/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch +++ b/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch @@ -38,7 +38,7 @@ #ifdef CPTCFG_ATH9K_DEBUGFS --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c -@@ -39,61 +39,115 @@ static void ath_fill_led_pin(struct ath_ +@@ -39,61 +39,111 @@ static void ath_fill_led_pin(struct ath_ else ah->led_pin = ATH_LED_PIN_DEF; } @@ -125,11 +125,11 @@ { - if (!sc->led_registered) - return; -- -- ath_led_brightness(&sc->led_cdev, LED_OFF); -- led_classdev_unregister(&sc->led_cdev); + struct ath_led *led; +- ath_led_brightness(&sc->led_cdev, LED_OFF); +- led_classdev_unregister(&sc->led_cdev); +- - ath9k_hw_gpio_free(sc->sc_ah, sc->sc_ah->led_pin); + while (!list_empty(&sc->leds)) { + led = list_first_entry(&sc->leds, struct ath_led, list); @@ -144,7 +144,6 @@ void ath_init_leds(struct ath_softc *sc) { - int ret; -+ struct ath_hw *ah = sc->sc_ah; + char led_name[32]; + const char *trigger; + @@ -163,21 +162,18 @@ - "ath9k-%s", wiphy_name(sc->hw->wiphy)); - sc->led_cdev.name = sc->led_name; - sc->led_cdev.brightness_set = ath_led_brightness; -- -- ret = led_classdev_register(wiphy_dev(sc->hw->wiphy), &sc->led_cdev); -- if (ret < 0) -+ if (ah->led_pin < 0) - return; - -- sc->led_registered = true; + snprintf(led_name, sizeof(led_name), "ath9k-%s", + wiphy_name(sc->hw->wiphy)); -+ + +- ret = led_classdev_register(wiphy_dev(sc->hw->wiphy), &sc->led_cdev); +- if (ret < 0) +- return; + if (ath9k_led_blink) + trigger = sc->led_default_trigger; + else + trigger = ieee80211_get_radio_led_name(sc->hw); -+ + +- sc->led_registered = true; + ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, + !sc->sc_ah->config.led_active_high); } diff --git a/package/kernel/mac80211/patches/ath9k/531-ath9k_extra_platform_leds.patch b/package/kernel/mac80211/patches/ath9k/531-ath9k_extra_platform_leds.patch new file mode 100644 index 00000000000..4f41cd9139a --- /dev/null +++ b/package/kernel/mac80211/patches/ath9k/531-ath9k_extra_platform_leds.patch @@ -0,0 +1,56 @@ +--- a/drivers/net/wireless/ath/ath9k/gpio.c ++++ b/drivers/net/wireless/ath/ath9k/gpio.c +@@ -108,6 +108,24 @@ int ath_create_gpio_led(struct ath_softc + return ret; + } + ++static int ath_create_platform_led(struct ath_softc *sc, ++ const struct gpio_led *gpio) ++{ ++ struct ath_led *led; ++ int ret; ++ ++ led = kzalloc(sizeof(*led), GFP_KERNEL); ++ if (!led) ++ return -ENOMEM; ++ ++ led->gpio = gpio; ++ ret = ath_add_led(sc, led); ++ if (ret < 0) ++ kfree(led); ++ ++ return ret; ++} ++ + void ath_deinit_leds(struct ath_softc *sc) + { + struct ath_led *led; +@@ -124,8 +142,10 @@ void ath_deinit_leds(struct ath_softc *s + + void ath_init_leds(struct ath_softc *sc) + { ++ struct ath_hw *ah = sc->sc_ah; + char led_name[32]; + const char *trigger; ++ int i; + + INIT_LIST_HEAD(&sc->leds); + +@@ -134,6 +154,17 @@ void ath_init_leds(struct ath_softc *sc) + + ath_fill_led_pin(sc); + ++ if (ah->leds && ah->num_leds) ++ for (i = 0; i < ah->num_leds; i++) { ++ if (ah->leds[i].gpio == ah->led_pin) ++ ah->led_pin = -1; ++ ++ ath_create_platform_led(sc, &ah->leds[i]); ++ } ++ ++ if (ah->led_pin < 0) ++ return; ++ + snprintf(led_name, sizeof(led_name), "ath9k-%s", + wiphy_name(sc->hw->wiphy)); + diff --git a/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch index 90a8e4b0fbb..9821716c6a7 100644 --- a/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch +++ b/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch @@ -84,7 +84,7 @@ bool reset_power_on; bool htc_reset_init; -@@ -1083,6 +1091,7 @@ void ath9k_hw_check_nav(struct ath_hw *a +@@ -1086,6 +1094,7 @@ void ath9k_hw_check_nav(struct ath_hw *a bool ath9k_hw_check_alive(struct ath_hw *ah); bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode); diff --git a/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch index 0efe23b9dc9..1c071c46218 100644 --- a/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch +++ b/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch @@ -192,7 +192,7 @@ Signed-off-by: Felix Fietkau return 0; } -@@ -117,17 +241,24 @@ void ath_deinit_leds(struct ath_softc *s +@@ -135,17 +259,24 @@ void ath_deinit_leds(struct ath_softc *s while (!list_empty(&sc->leds)) { led = list_first_entry(&sc->leds, struct ath_led, list); @@ -216,8 +216,8 @@ Signed-off-by: Felix Fietkau + struct device_node *np = sc->dev->of_node; char led_name[32]; const char *trigger; - -@@ -136,6 +267,12 @@ void ath_init_leds(struct ath_softc *sc) + int i; +@@ -155,6 +286,12 @@ void ath_init_leds(struct ath_softc *sc) if (AR_SREV_9100(sc->sc_ah)) return; @@ -229,4 +229,12 @@ Signed-off-by: Felix Fietkau + ath_fill_led_pin(sc); - if (ah->led_pin < 0) + if (ah->leds && ah->num_leds) +@@ -179,6 +316,7 @@ void ath_init_leds(struct ath_softc *sc) + ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, + !sc->sc_ah->config.led_active_high); + } ++ + #endif + + /*******************/ diff --git a/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch index 78700222a93..92f110b95c1 100644 --- a/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch +++ b/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau #endif /* CONFIG_GPIOLIB */ /********************************/ -@@ -239,6 +310,7 @@ void ath_deinit_leds(struct ath_softc *s +@@ -257,6 +328,7 @@ void ath_deinit_leds(struct ath_softc *s { struct ath_led *led; @@ -120,11 +120,11 @@ Signed-off-by: Felix Fietkau while (!list_empty(&sc->leds)) { led = list_first_entry(&sc->leds, struct ath_led, list); #ifdef CONFIG_GPIOLIB -@@ -274,6 +346,7 @@ void ath_init_leds(struct ath_softc *sc) +@@ -293,6 +365,7 @@ void ath_init_leds(struct ath_softc *sc) } ath_fill_led_pin(sc); + ath9k_init_buttons(sc); - if (ah->led_pin < 0) - return; + if (ah->leds && ah->num_leds) + for (i = 0; i < ah->num_leds; i++) { From be3bc3df907b02c5a18b538265d02d8eea860063 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Wed, 1 Jan 2025 11:22:39 +0100 Subject: [PATCH 019/173] Revert "kernel: remove custom ath9k_platform.h" This reverts commit da0016b274008a4792102e72b3d66a84c7db4569. Signed-off-by: Robert Marko --- .../files/include/linux/ath9k_platform.h | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 target/linux/generic/files/include/linux/ath9k_platform.h diff --git a/target/linux/generic/files/include/linux/ath9k_platform.h b/target/linux/generic/files/include/linux/ath9k_platform.h new file mode 100644 index 00000000000..e210108568a --- /dev/null +++ b/target/linux/generic/files/include/linux/ath9k_platform.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2008 Atheros Communications Inc. + * Copyright (c) 2009 Gabor Juhos + * Copyright (c) 2009 Imre Kaloz + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LINUX_ATH9K_PLATFORM_H +#define _LINUX_ATH9K_PLATFORM_H + +#define ATH9K_PLAT_EEP_MAX_WORDS 2048 + +struct ath9k_platform_data { + const char *eeprom_name; + + u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS]; + u8 *macaddr; + + int led_pin; + u32 gpio_mask; + u32 gpio_val; + + u32 bt_active_pin; + u32 bt_priority_pin; + u32 wlan_active_pin; + + bool endian_check; + bool is_clk_25mhz; + bool tx_gain_buffalo; + bool disable_2ghz; + bool disable_5ghz; + bool led_active_high; + + int (*get_mac_revision)(void); + int (*external_reset)(void); + + bool use_eeprom; + + int num_leds; + const struct gpio_led *leds; + + unsigned num_btns; + const struct gpio_keys_button *btns; + unsigned btn_poll_interval; +}; + +#endif /* _LINUX_ATH9K_PLATFORM_H */ From 72b59359565a1e58e62074faebe4111c0ea08140 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Wed, 1 Jan 2025 11:22:40 +0100 Subject: [PATCH 020/173] Revert "mac80211: remove ath9k_platform_data" This reverts commit fdc2c6ab9901ad3e64ec1f93d5ccdc38990243b4. Signed-off-by: Robert Marko --- package/kernel/mac80211/Makefile | 2 +- .../mac80211/patches/ath9k/100-gpio-of.patch | 16 --- .../ath9k/531-ath9k_extra_platform_leds.patch | 28 +++-- .../ath9k/542-ath9k_debugfs_diag.patch | 2 +- .../ath9k/547-ath9k_led_defstate_fix.patch | 2 +- .../ath9k/548-ath9k_enable_gpio_chip.patch | 23 ++-- .../ath9k/549-ath9k_enable_gpio_buttons.patch | 36 +++--- .../patches/ath9k/552-ath9k-ahb_of.patch | 106 +++++++++++++----- 8 files changed, 130 insertions(+), 85 deletions(-) delete mode 100644 package/kernel/mac80211/patches/ath9k/100-gpio-of.patch diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index c3ffb8dc06c..b0de3950b9e 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 PKG_VERSION:=6.12.6 -PKG_RELEASE:=2 +PKG_RELEASE:=1 PKG_LICENSE:=GPL-2.0-only PKG_LICENSE_FILES:=COPYING diff --git a/package/kernel/mac80211/patches/ath9k/100-gpio-of.patch b/package/kernel/mac80211/patches/ath9k/100-gpio-of.patch deleted file mode 100644 index 2cddb59fc54..00000000000 --- a/package/kernel/mac80211/patches/ath9k/100-gpio-of.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/hw.h -+++ b/drivers/net/wireless/ath/ath9k/hw.h -@@ -976,6 +976,13 @@ struct ath_hw { - bool disable_2ghz; - bool disable_5ghz; - -+ int num_leds; -+ const struct gpio_led *leds; -+ -+ unsigned num_btns; -+ const struct gpio_keys_button *btns; -+ unsigned btn_poll_interval; -+ - const struct firmware *eeprom_blob; - u16 *nvmem_blob; /* devres managed */ - size_t nvmem_blob_len; diff --git a/package/kernel/mac80211/patches/ath9k/531-ath9k_extra_platform_leds.patch b/package/kernel/mac80211/patches/ath9k/531-ath9k_extra_platform_leds.patch index 4f41cd9139a..1055bd335c1 100644 --- a/package/kernel/mac80211/patches/ath9k/531-ath9k_extra_platform_leds.patch +++ b/package/kernel/mac80211/patches/ath9k/531-ath9k_extra_platform_leds.patch @@ -1,6 +1,14 @@ --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c -@@ -108,6 +108,24 @@ int ath_create_gpio_led(struct ath_softc +@@ -15,6 +15,7 @@ + */ + + #include "ath9k.h" ++#include + + /********************************/ + /* LED functions */ +@@ -108,6 +109,24 @@ int ath_create_gpio_led(struct ath_softc return ret; } @@ -25,30 +33,30 @@ void ath_deinit_leds(struct ath_softc *sc) { struct ath_led *led; -@@ -124,8 +142,10 @@ void ath_deinit_leds(struct ath_softc *s +@@ -124,8 +143,10 @@ void ath_deinit_leds(struct ath_softc *s void ath_init_leds(struct ath_softc *sc) { -+ struct ath_hw *ah = sc->sc_ah; ++ struct ath9k_platform_data *pdata = sc->dev->platform_data; char led_name[32]; const char *trigger; + int i; INIT_LIST_HEAD(&sc->leds); -@@ -134,6 +154,17 @@ void ath_init_leds(struct ath_softc *sc) +@@ -134,6 +155,17 @@ void ath_init_leds(struct ath_softc *sc) ath_fill_led_pin(sc); -+ if (ah->leds && ah->num_leds) -+ for (i = 0; i < ah->num_leds; i++) { -+ if (ah->leds[i].gpio == ah->led_pin) -+ ah->led_pin = -1; ++ if (pdata && pdata->leds && pdata->num_leds) ++ for (i = 0; i < pdata->num_leds; i++) { ++ if (pdata->leds[i].gpio == sc->sc_ah->led_pin) ++ sc->sc_ah->led_pin = -1; + -+ ath_create_platform_led(sc, &ah->leds[i]); ++ ath_create_platform_led(sc, &pdata->leds[i]); + } + -+ if (ah->led_pin < 0) ++ if (sc->sc_ah->led_pin < 0) + return; + snprintf(led_name, sizeof(led_name), "ath9k-%s", diff --git a/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch index 9821716c6a7..f08301c7f4f 100644 --- a/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch +++ b/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch @@ -84,7 +84,7 @@ bool reset_power_on; bool htc_reset_init; -@@ -1086,6 +1094,7 @@ void ath9k_hw_check_nav(struct ath_hw *a +@@ -1079,6 +1087,7 @@ void ath9k_hw_check_nav(struct ath_hw *a bool ath9k_hw_check_alive(struct ath_hw *ah); bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode); diff --git a/package/kernel/mac80211/patches/ath9k/547-ath9k_led_defstate_fix.patch b/package/kernel/mac80211/patches/ath9k/547-ath9k_led_defstate_fix.patch index d633c051b0d..5d84cf0c423 100644 --- a/package/kernel/mac80211/patches/ath9k/547-ath9k_led_defstate_fix.patch +++ b/package/kernel/mac80211/patches/ath9k/547-ath9k_led_defstate_fix.patch @@ -13,7 +13,7 @@ Signed-off-by: Michal Cieslakiewicz --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c -@@ -73,8 +73,11 @@ static int ath_add_led(struct ath_softc +@@ -74,8 +74,11 @@ static int ath_add_led(struct ath_softc ath9k_hw_gpio_request_out(sc->sc_ah, gpio->gpio, gpio->name, AR_GPIO_OUTPUT_MUX_AS_OUTPUT); diff --git a/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch index 1c071c46218..9fb549cc19b 100644 --- a/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch +++ b/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch @@ -45,10 +45,10 @@ Signed-off-by: Felix Fietkau #ifdef CPTCFG_ATH9K_DEBUGFS --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c -@@ -15,13 +15,131 @@ - */ +@@ -16,13 +16,135 @@ #include "ath9k.h" + #include +#include + +#ifdef CPTCFG_MAC80211_LEDS @@ -126,7 +126,9 @@ Signed-off-by: Felix Fietkau + gc->sc = sc; + snprintf(gc->label, sizeof(gc->label), "ath9k-%s", + wiphy_name(sc->hw->wiphy)); ++#ifdef CONFIG_OF + gc->gchip.parent = sc->dev; ++#endif + gc->gchip.label = gc->label; + gc->gchip.base = -1; /* determine base automatically */ + gc->gchip.ngpio = ah->caps.num_gpio_pins; @@ -141,7 +143,9 @@ Signed-off-by: Felix Fietkau + return; + } + ++#ifdef CONFIG_OF + gc->gchip.owner = NULL; ++#endif + sc->gpiochip = gc; +} + @@ -179,7 +183,7 @@ Signed-off-by: Felix Fietkau static void ath_fill_led_pin(struct ath_softc *sc) { struct ath_hw *ah = sc->sc_ah; -@@ -79,6 +197,12 @@ static int ath_add_led(struct ath_softc +@@ -80,6 +202,12 @@ static int ath_add_led(struct ath_softc else ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low); @@ -192,7 +196,7 @@ Signed-off-by: Felix Fietkau return 0; } -@@ -135,17 +259,24 @@ void ath_deinit_leds(struct ath_softc *s +@@ -136,17 +264,24 @@ void ath_deinit_leds(struct ath_softc *s while (!list_empty(&sc->leds)) { led = list_first_entry(&sc->leds, struct ath_led, list); @@ -212,15 +216,18 @@ Signed-off-by: Felix Fietkau void ath_init_leds(struct ath_softc *sc) { - struct ath_hw *ah = sc->sc_ah; + struct ath9k_platform_data *pdata = sc->dev->platform_data; + struct device_node *np = sc->dev->of_node; char led_name[32]; const char *trigger; int i; -@@ -155,6 +286,12 @@ void ath_init_leds(struct ath_softc *sc) +@@ -156,6 +291,15 @@ void ath_init_leds(struct ath_softc *sc) if (AR_SREV_9100(sc->sc_ah)) return; ++ if (!np) ++ ath9k_register_gpio_chip(sc); ++ + /* setup gpio controller only if requested and skip the led_pin setup */ + if (of_property_read_bool(np, "gpio-controller")) { + ath9k_register_gpio_chip(sc); @@ -229,8 +236,8 @@ Signed-off-by: Felix Fietkau + ath_fill_led_pin(sc); - if (ah->leds && ah->num_leds) -@@ -179,6 +316,7 @@ void ath_init_leds(struct ath_softc *sc) + if (pdata && pdata->leds && pdata->num_leds) +@@ -180,6 +324,7 @@ void ath_init_leds(struct ath_softc *sc) ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, !sc->sc_ah->config.led_active_high); } diff --git a/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch index 92f110b95c1..d164d890314 100644 --- a/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch +++ b/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch @@ -20,16 +20,16 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c -@@ -16,6 +16,8 @@ - +@@ -17,6 +17,8 @@ #include "ath9k.h" + #include #include +#include +#include #ifdef CPTCFG_MAC80211_LEDS -@@ -124,6 +126,67 @@ static void ath9k_unregister_gpio_chip(s +@@ -129,6 +131,67 @@ static void ath9k_unregister_gpio_chip(s sc->gpiochip = NULL; } @@ -40,7 +40,7 @@ Signed-off-by: Felix Fietkau +/* add GPIO buttons */ +static void ath9k_init_buttons(struct ath_softc *sc) +{ -+ struct ath_hw *ah = sc->sc_ah; ++ struct ath9k_platform_data *pdata = sc->dev->platform_data; + struct platform_device *pdev; + struct gpio_keys_platform_data gkpdata; + struct gpio_keys_button *bt; @@ -49,28 +49,28 @@ Signed-off-by: Felix Fietkau + if (!sc->gpiochip) + return; + -+ if (!ah->btns || !ah->num_btns) ++ if (!pdata || !pdata->btns || !pdata->num_btns) + return; + -+ bt = devm_kmemdup(sc->dev, ah->btns, -+ ah->num_btns * sizeof(struct gpio_keys_button), ++ bt = devm_kmemdup(sc->dev, pdata->btns, ++ pdata->num_btns * sizeof(struct gpio_keys_button), + GFP_KERNEL); + if (!bt) + return; + -+ for (i = 0; i < ah->num_btns; i++) { -+ if (ah->btns[i].gpio == sc->sc_ah->led_pin) ++ for (i = 0; i < pdata->num_btns; i++) { ++ if (pdata->btns[i].gpio == sc->sc_ah->led_pin) + sc->sc_ah->led_pin = -1; + -+ ath9k_hw_gpio_request_in(sc->sc_ah, ah->btns[i].gpio, ++ ath9k_hw_gpio_request_in(sc->sc_ah, pdata->btns[i].gpio, + "ath9k-gpio"); -+ bt[i].gpio = sc->gpiochip->gchip.base + ah->btns[i].gpio; ++ bt[i].gpio = sc->gpiochip->gchip.base + pdata->btns[i].gpio; + } + + memset(&gkpdata, 0, sizeof(struct gpio_keys_platform_data)); + gkpdata.buttons = bt; -+ gkpdata.nbuttons = ah->num_btns; -+ gkpdata.poll_interval = ah->btn_poll_interval; ++ gkpdata.nbuttons = pdata->num_btns; ++ gkpdata.poll_interval = pdata->btn_poll_interval; + + pdev = platform_device_register_data(sc->dev, "gpio-keys-polled", + PLATFORM_DEVID_AUTO, &gkpdata, @@ -97,7 +97,7 @@ Signed-off-by: Felix Fietkau #else /* CONFIG_GPIOLIB */ static inline void ath9k_register_gpio_chip(struct ath_softc *sc) -@@ -134,6 +197,14 @@ static inline void ath9k_unregister_gpio +@@ -139,6 +202,14 @@ static inline void ath9k_unregister_gpio { } @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau #endif /* CONFIG_GPIOLIB */ /********************************/ -@@ -257,6 +328,7 @@ void ath_deinit_leds(struct ath_softc *s +@@ -262,6 +333,7 @@ void ath_deinit_leds(struct ath_softc *s { struct ath_led *led; @@ -120,11 +120,11 @@ Signed-off-by: Felix Fietkau while (!list_empty(&sc->leds)) { led = list_first_entry(&sc->leds, struct ath_led, list); #ifdef CONFIG_GPIOLIB -@@ -293,6 +365,7 @@ void ath_init_leds(struct ath_softc *sc) +@@ -301,6 +373,7 @@ void ath_init_leds(struct ath_softc *sc) } ath_fill_led_pin(sc); + ath9k_init_buttons(sc); - if (ah->leds && ah->num_leds) - for (i = 0; i < ah->num_leds; i++) { + if (pdata && pdata->leds && pdata->num_leds) + for (i = 0; i < pdata->num_leds; i++) { diff --git a/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch b/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch index a5ad2bcffbb..3adc8bb8d68 100644 --- a/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch +++ b/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch @@ -1,22 +1,27 @@ --- a/drivers/net/wireless/ath/ath9k/ahb.c +++ b/drivers/net/wireless/ath/ath9k/ahb.c -@@ -20,8 +20,12 @@ +@@ -20,7 +20,15 @@ #include #include #include +#include #include "ath9k.h" - ++#include ++ ++#ifdef CONFIG_OF +#include +#include -+ ++#include ++#endif + static const struct platform_device_id ath9k_platform_id_table[] = { { - .name = "ath9k", -@@ -69,22 +73,198 @@ static const struct ath_bus_ops ath_ahb_ +@@ -69,6 +77,192 @@ static const struct ath_bus_ops ath_ahb_ .eeprom_read = ath_ahb_eeprom_read, }; ++#ifdef CONFIG_OF ++ +#define QCA955X_DDR_CTL_CONFIG 0x108 +#define QCA955X_DDR_CTL_CONFIG_ACT_WMAC BIT(23) + @@ -157,7 +162,7 @@ + +static int of_ath_ahb_probe(struct platform_device *pdev) +{ -+ struct ath_hw *ah = platform_get_drvdata(pdev); ++ struct ath9k_platform_data *pdata; + const struct of_device_id *match; + const struct of_ath_ahb_data *data; + u8 led_pin; @@ -165,17 +170,19 @@ + match = of_match_device(of_ath_ahb_match, &pdev->dev); + data = (const struct of_ath_ahb_data *)match->data; + ++ pdata = dev_get_platdata(&pdev->dev); ++ + if (!of_property_read_u8(pdev->dev.of_node, "qca,led-pin", &led_pin)) -+ ah->led_pin = led_pin; ++ pdata->led_pin = led_pin; + else -+ ah->led_pin = -1; ++ pdata->led_pin = -1; + + if (of_property_read_bool(pdev->dev.of_node, "qca,tx-gain-buffalo")) -+ ah->config.tx_gain_buffalo = true; ++ pdata->tx_gain_buffalo = true; + + if (data->wmac_reset) { + data->wmac_reset(); -+ ah->external_reset = data->wmac_reset; ++ pdata->external_reset = data->wmac_reset; + } + + if (data->dev_id == AR9300_DEVID_AR953X) { @@ -184,55 +191,94 @@ + * Some vendors have an invalid bootstrap option + * set, which would break the WMAC here. + */ -+ ah->is_clk_25mhz = true; ++ pdata->is_clk_25mhz = true; + } else if (data->bootstrap_reg && data->bootstrap_ref) { + u32 t = ath79_reset_rr(data->bootstrap_reg); + if (t & data->bootstrap_ref) -+ ah->is_clk_25mhz = false; ++ pdata->is_clk_25mhz = false; + else -+ ah->is_clk_25mhz = true; ++ pdata->is_clk_25mhz = true; + } + -+ ah->get_mac_revision = data->soc_revision; ++ pdata->get_mac_revision = data->soc_revision; + + return data->dev_id; +} ++#endif + static int ath_ahb_probe(struct platform_device *pdev) { void __iomem *mem; - struct ath_softc *sc; - struct ieee80211_hw *hw; - struct resource *res; -- const struct platform_device_id *id = platform_get_device_id(pdev); - int irq; +@@ -80,6 +274,17 @@ static int ath_ahb_probe(struct platform int ret = 0; struct ath_hw *ah; char hw_name[64]; -- -- if (!dev_get_platdata(&pdev->dev)) { -- dev_err(&pdev->dev, "no platform data specified\n"); -- return -EINVAL; -- } -+ u32 dev_id; ++ u16 dev_id; ++ ++ if (id) ++ dev_id = id->driver_data; ++ ++#ifdef CONFIG_OF ++ if (pdev->dev.of_node) ++ pdev->dev.platform_data = devm_kzalloc(&pdev->dev, ++ sizeof(struct ath9k_platform_data), ++ GFP_KERNEL); ++#endif - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (res == NULL) { -@@ -124,7 +304,8 @@ static int ath_ahb_probe(struct platform + if (!dev_get_platdata(&pdev->dev)) { + dev_err(&pdev->dev, "no platform data specified\n"); +@@ -118,17 +323,23 @@ static int ath_ahb_probe(struct platform + sc->mem = mem; + sc->irq = irq; + ++#ifdef CONFIG_OF ++ dev_id = of_ath_ahb_probe(pdev); ++#endif + ret = request_irq(irq, ath_isr, IRQF_SHARED, "ath9k", sc); + if (ret) { + dev_err(&pdev->dev, "request_irq failed\n"); goto err_free_hw; } - ret = ath9k_init_device(id->driver_data, sc, &ath_ahb_bus_ops); -+ dev_id = of_ath_ahb_probe(pdev); + ret = ath9k_init_device(dev_id, sc, &ath_ahb_bus_ops); if (ret) { dev_err(&pdev->dev, "failed to initialize device\n"); goto err_irq; -@@ -162,6 +343,7 @@ static struct platform_driver ath_ahb_dr + } ++#ifdef CONFIG_OF ++ pdev->dev.platform_data = NULL; ++#endif + + ah = sc->sc_ah; + ath9k_hw_name(ah, hw_name, sizeof(hw_name)); +@@ -162,6 +373,9 @@ static struct platform_driver ath_ahb_dr .remove_new = ath_ahb_remove, .driver = { .name = "ath9k", ++#ifdef CONFIG_OF + .of_match_table = of_ath_ahb_match, ++#endif }, .id_table = ath9k_platform_id_table, }; +--- a/drivers/net/wireless/ath/ath9k/ath9k.h ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + + #include "common.h" + #include "debug.h" +@@ -1013,6 +1014,9 @@ struct ath_softc { + struct ath_hw *sc_ah; + void __iomem *mem; + int irq; ++#ifdef CONFIG_OF ++ struct reset_control *reset; ++#endif + spinlock_t sc_serial_rw; + spinlock_t sc_pm_lock; + spinlock_t sc_pcu_lock; From 8ad02ca2f8477b1cfdc5ea6124fae60c07687aa1 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Mon, 23 Dec 2024 19:07:13 +0800 Subject: [PATCH 021/173] rockchip: backport recent rk3588 clk updates Backport recent rk3588 clk updates from upstream, including one bug fix. Signed-off-by: Tianling Shen Link: https://github.com/openwrt/openwrt/pull/17349 Signed-off-by: Hauke Mehrtens --- ...chip-Add-new-pll-type-pll_rk3588_ddr.patch | 51 +++++++++++++++ ...clk-rockchip-rk3588-drop-unused-code.patch | 65 +++++++++++++++++++ ...chip-fix-finding-of-maximum-clock-ID.patch | 29 +++++++++ 3 files changed, 145 insertions(+) create mode 100644 target/linux/rockchip/patches-6.6/030-09-v6.12-clk-rockchip-Add-new-pll-type-pll_rk3588_ddr.patch create mode 100644 target/linux/rockchip/patches-6.6/030-10-v6.12-clk-rockchip-rk3588-drop-unused-code.patch create mode 100644 target/linux/rockchip/patches-6.6/030-11-v6.13-clk-rockchip-fix-finding-of-maximum-clock-ID.patch diff --git a/target/linux/rockchip/patches-6.6/030-09-v6.12-clk-rockchip-Add-new-pll-type-pll_rk3588_ddr.patch b/target/linux/rockchip/patches-6.6/030-09-v6.12-clk-rockchip-Add-new-pll-type-pll_rk3588_ddr.patch new file mode 100644 index 00000000000..0d68f687faf --- /dev/null +++ b/target/linux/rockchip/patches-6.6/030-09-v6.12-clk-rockchip-Add-new-pll-type-pll_rk3588_ddr.patch @@ -0,0 +1,51 @@ +From e781bffc296766b55dbd048890d558655031e8d1 Mon Sep 17 00:00:00 2001 +From: Elaine Zhang +Date: Wed, 28 Aug 2024 15:42:52 +0000 +Subject: [PATCH] clk: rockchip: Add new pll type pll_rk3588_ddr + +That PLL type is similar to the other rk3588 pll types but the actual +rate is twice the configured rate. +Therefore, the returned calculated rate must be multiplied by two. + +Signed-off-by: Elaine Zhang +Signed-off-by: Detlev Casanova +Acked-by: Dragan Simic +Link: https://lore.kernel.org/r/0102019199a76ec4-9d5846d4-d76a-4e69-a241-c88c2983d607-000000@eu-west-1.amazonses.com +Signed-off-by: Heiko Stuebner +--- + drivers/clk/rockchip/clk-pll.c | 6 +++++- + drivers/clk/rockchip/clk.h | 1 + + 2 files changed, 6 insertions(+), 1 deletion(-) + +--- a/drivers/clk/rockchip/clk-pll.c ++++ b/drivers/clk/rockchip/clk-pll.c +@@ -914,7 +914,10 @@ static unsigned long rockchip_rk3588_pll + } + rate64 = rate64 >> cur.s; + +- return (unsigned long)rate64; ++ if (pll->type == pll_rk3588_ddr) ++ return (unsigned long)rate64 * 2; ++ else ++ return (unsigned long)rate64; + } + + static int rockchip_rk3588_pll_set_params(struct rockchip_clk_pll *pll, +@@ -1167,6 +1170,7 @@ struct clk *rockchip_clk_register_pll(st + break; + case pll_rk3588: + case pll_rk3588_core: ++ case pll_rk3588_ddr: + if (!pll->rate_table) + init.ops = &rockchip_rk3588_pll_clk_norate_ops; + else +--- a/drivers/clk/rockchip/clk.h ++++ b/drivers/clk/rockchip/clk.h +@@ -287,6 +287,7 @@ enum rockchip_pll_type { + pll_rk3399, + pll_rk3588, + pll_rk3588_core, ++ pll_rk3588_ddr, + }; + + #define RK3036_PLL_RATE(_rate, _refdiv, _fbdiv, _postdiv1, \ diff --git a/target/linux/rockchip/patches-6.6/030-10-v6.12-clk-rockchip-rk3588-drop-unused-code.patch b/target/linux/rockchip/patches-6.6/030-10-v6.12-clk-rockchip-rk3588-drop-unused-code.patch new file mode 100644 index 00000000000..0164bf26e57 --- /dev/null +++ b/target/linux/rockchip/patches-6.6/030-10-v6.12-clk-rockchip-rk3588-drop-unused-code.patch @@ -0,0 +1,65 @@ +From 2e7b3daa8cb1ebd17e6a7f417ef5e6553203035c Mon Sep 17 00:00:00 2001 +From: Sebastian Reichel +Date: Mon, 25 Mar 2024 20:33:32 +0100 +Subject: [PATCH] clk: rockchip: rk3588: drop unused code + +All clocks are registered early using CLK_OF_DECLARE(), which marks +the DT node as processed. For the processed DT node the probe routine +is never called. Thus this whole code is never executed. This could +be "fixed" by using CLK_OF_DECLARE_DRIVER, which avoids marking the +DT node as processed. But then the probe routine would re-register +all the clocks by calling rk3588_clk_init() again. + +Signed-off-by: Sebastian Reichel +Link: https://lore.kernel.org/r/20240325193609.237182-2-sebastian.reichel@collabora.com +Signed-off-by: Heiko Stuebner +--- + drivers/clk/rockchip/clk-rk3588.c | 40 ------------------------------- + 1 file changed, 40 deletions(-) + +--- a/drivers/clk/rockchip/clk-rk3588.c ++++ b/drivers/clk/rockchip/clk-rk3588.c +@@ -2502,43 +2502,3 @@ static void __init rk3588_clk_init(struc + } + + CLK_OF_DECLARE(rk3588_cru, "rockchip,rk3588-cru", rk3588_clk_init); +- +-struct clk_rk3588_inits { +- void (*inits)(struct device_node *np); +-}; +- +-static const struct clk_rk3588_inits clk_3588_cru_init = { +- .inits = rk3588_clk_init, +-}; +- +-static const struct of_device_id clk_rk3588_match_table[] = { +- { +- .compatible = "rockchip,rk3588-cru", +- .data = &clk_3588_cru_init, +- }, +- { } +-}; +- +-static int __init clk_rk3588_probe(struct platform_device *pdev) +-{ +- const struct clk_rk3588_inits *init_data; +- struct device *dev = &pdev->dev; +- +- init_data = device_get_match_data(dev); +- if (!init_data) +- return -EINVAL; +- +- if (init_data->inits) +- init_data->inits(dev->of_node); +- +- return 0; +-} +- +-static struct platform_driver clk_rk3588_driver = { +- .driver = { +- .name = "clk-rk3588", +- .of_match_table = clk_rk3588_match_table, +- .suppress_bind_attrs = true, +- }, +-}; +-builtin_platform_driver_probe(clk_rk3588_driver, clk_rk3588_probe); diff --git a/target/linux/rockchip/patches-6.6/030-11-v6.13-clk-rockchip-fix-finding-of-maximum-clock-ID.patch b/target/linux/rockchip/patches-6.6/030-11-v6.13-clk-rockchip-fix-finding-of-maximum-clock-ID.patch new file mode 100644 index 00000000000..912c2c77780 --- /dev/null +++ b/target/linux/rockchip/patches-6.6/030-11-v6.13-clk-rockchip-fix-finding-of-maximum-clock-ID.patch @@ -0,0 +1,29 @@ +From ad1081a0da2744141d12e94ff816ac91feb871ca Mon Sep 17 00:00:00 2001 +From: Yao Zi +Date: Thu, 12 Sep 2024 13:32:05 +0000 +Subject: [PATCH] clk: rockchip: fix finding of maximum clock ID + +If an ID of a branch's child is greater than current maximum, we should +set new maximum to the child's ID, instead of its parent's. + +Fixes: 2dc66a5ab2c6 ("clk: rockchip: rk3588: fix CLK_NR_CLKS usage") +Signed-off-by: Yao Zi +Link: https://lore.kernel.org/r/20240912133204.29089-2-ziyao@disroot.org +Reviewed-by: Sebastian Reichel +Reviewed-by: Heiko Stuebner +Signed-off-by: Stephen Boyd +--- + drivers/clk/rockchip/clk.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/clk/rockchip/clk.c ++++ b/drivers/clk/rockchip/clk.c +@@ -439,7 +439,7 @@ unsigned long rockchip_clk_find_max_clk_ + if (list->id > max) + max = list->id; + if (list->child && list->child->id > max) +- max = list->id; ++ max = list->child->id; + } + + return max; From 6881b48dc603e25320a14e11c5e1797321891b76 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Mon, 23 Dec 2024 21:13:24 +0800 Subject: [PATCH 022/173] rockchip: enable USB3 port on NanoPC T6 Enable the USB3 port on FriendlyELEC NanoPC-T6. Signed-off-by: Tianling Shen Link: https://github.com/openwrt/openwrt/pull/17349 Signed-off-by: Hauke Mehrtens --- ...ts-rockchip-enable-USB3-on-NanoPC-T6.patch | 87 +++++++++++++++++++ ...ckchip-lower-mmc-speed-for-nanopc-t6.patch | 2 +- 2 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 target/linux/rockchip/patches-6.6/055-16-v6.13-arm64-dts-rockchip-enable-USB3-on-NanoPC-T6.patch diff --git a/target/linux/rockchip/patches-6.6/055-16-v6.13-arm64-dts-rockchip-enable-USB3-on-NanoPC-T6.patch b/target/linux/rockchip/patches-6.6/055-16-v6.13-arm64-dts-rockchip-enable-USB3-on-NanoPC-T6.patch new file mode 100644 index 00000000000..d3aa8b9cc3e --- /dev/null +++ b/target/linux/rockchip/patches-6.6/055-16-v6.13-arm64-dts-rockchip-enable-USB3-on-NanoPC-T6.patch @@ -0,0 +1,87 @@ +From a6ae420439dc47a58550a6e61e596e9dd1562caf Mon Sep 17 00:00:00 2001 +From: Rick Wertenbroek +Date: Wed, 6 Nov 2024 14:03:13 +0100 +Subject: [PATCH] arm64: dts: rockchip: enable USB3 on NanoPC-T6 + +Enable the USB3 port on FriendlyELEC NanoPC-T6. + +Signed-off-by: Rick Wertenbroek +Link: https://lore.kernel.org/r/20241106130314.1289055-1-rick.wertenbroek@gmail.com +Signed-off-by: Heiko Stuebner +--- + .../boot/dts/rockchip/rk3588-nanopc-t6.dtsi | 36 +++++++++++++++++++ + 1 file changed, 36 insertions(+) + +--- a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi +@@ -160,6 +160,20 @@ + vin-supply = <&vcc5v0_sys>; + }; + ++ vbus5v0_usb: vbus5v0-usb-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&usb5v_pwren>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-name = "vbus5v0_usb"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ vin-supply = <&vcc5v0_sys>; ++ }; ++ + vcc3v3_pcie2x1l0: vcc3v3-pcie2x1l0-regulator { + compatible = "regulator-fixed"; + enable-active-high; +@@ -577,6 +591,10 @@ + rockchip,pins = <1 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + ++ usb5v_pwren: usb5v_pwren { ++ rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ + usbc0_int: usbc0-int { + rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_up>; + }; +@@ -976,6 +994,14 @@ + status = "okay"; + }; + ++&u2phy1 { ++ status = "okay"; ++}; ++ ++&u2phy1_otg { ++ status = "okay"; ++}; ++ + &u2phy2_host { + status = "okay"; + }; +@@ -1015,6 +1041,11 @@ + }; + }; + ++&usbdp_phy1 { ++ phy-supply = <&vbus5v0_usb>; ++ status = "okay"; ++}; ++ + &usb_host0_ehci { + status = "okay"; + }; +@@ -1035,6 +1066,11 @@ + }; + }; + ++&usb_host1_xhci { ++ dr_mode = "host"; ++ status = "okay"; ++}; ++ + &usb_host1_ehci { + status = "okay"; + }; diff --git a/target/linux/rockchip/patches-6.6/121-arm64-dts-rockchip-lower-mmc-speed-for-nanopc-t6.patch b/target/linux/rockchip/patches-6.6/121-arm64-dts-rockchip-lower-mmc-speed-for-nanopc-t6.patch index bbcff017906..1b76fac103a 100644 --- a/target/linux/rockchip/patches-6.6/121-arm64-dts-rockchip-lower-mmc-speed-for-nanopc-t6.patch +++ b/target/linux/rockchip/patches-6.6/121-arm64-dts-rockchip-lower-mmc-speed-for-nanopc-t6.patch @@ -1,6 +1,6 @@ --- a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi -@@ -616,7 +616,7 @@ +@@ -634,7 +634,7 @@ disable-wp; no-mmc; no-sdio; From 616621120bf2ba460b99d6c814b629a01be8a5d0 Mon Sep 17 00:00:00 2001 From: Roland Reinl Date: Mon, 30 Dec 2024 08:54:56 +0100 Subject: [PATCH 023/173] mediatek: Fix primary MAC of D-Link M60 During port to gluon, I saw that the primary mac is not correct. Updated DTS accordingly. Signed-off-by: Roland Reinl Link: https://github.com/openwrt/openwrt/pull/17429 Signed-off-by: Hauke Mehrtens --- target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts b/target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts index a95c069156e..e805554a134 100644 --- a/target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts +++ b/target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts @@ -17,6 +17,7 @@ led-failsafe = &led_status_red; led-running = &led_status_white; led-upgrade = &led_status_blue; + label-mac-device = &gmac0; }; chosen { From ae0fd926997e789e7244443dba6cb07f6b43053a Mon Sep 17 00:00:00 2001 From: John Audia Date: Sat, 28 Dec 2024 11:59:51 -0500 Subject: [PATCH 024/173] bcm27xx/bcm2712: add RP1 camera front-end Add kmod for RP1 camera front-end for RPi5B Build system: x86/64 Build-tested: bcm2712/RPi5B Run-tested: bcm2712/RPi5B Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17412 Signed-off-by: Hauke Mehrtens --- target/linux/bcm27xx/modules/video.mk | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/target/linux/bcm27xx/modules/video.mk b/target/linux/bcm27xx/modules/video.mk index 8e2b19bd871..dddf13e0f4a 100644 --- a/target/linux/bcm27xx/modules/video.mk +++ b/target/linux/bcm27xx/modules/video.mk @@ -20,6 +20,25 @@ endef $(eval $(call KernelPackage,camera-bcm2835)) +define KernelPackage/rp1-cfe + TITLE:=RP1 Camera Front-End + SUBMENU:=$(VIDEO_MENU) + KCONFIG:= \ + CONFIG_VIDEO_RP1_CFE \ + CONFIG_VIDEO_BCM2835 + FILES:=$(LINUX_DIR)/drivers/media/platform/raspberrypi/rp1_cfe/rp1-cfe.ko + AUTOLOAD:=$(call AutoLoad,67,rp1-cfe) + DEPENDS:=@TARGET_bcm27xx_bcm2712 +kmod-video-core +kmod-video-fwnode +kmod-video-dma-contig +kmod-video-async +endef + +define KernelPackage/rp1-cfe/description + Driver for the Camera Serial Interface (CSI) to capture video + streams from connected cameras. +endef + +$(eval $(call KernelPackage,rp1-cfe)) + + define KernelPackage/codec-bcm2835 TITLE:=BCM2835 Video Codec KCONFIG:= \ From 777c6106ed4e4acdad6f1b094a05a745db8fe396 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Wed, 1 Jan 2025 20:05:20 +0100 Subject: [PATCH 025/173] realtek: move debounce-interval to correct node The debounce-interval of a gpio-keys node should be placed in the key node itself, not in the main node. Move the properties added earlier and fix the key node name while we're here. Fixes: 4357f32d41eb ("realtek: debounce reset key for Zyxel GS1900") Signed-off-by: Sander Vanheule --- target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi | 2 +- target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi b/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi index 59b44ad1615..3889fe8859a 100644 --- a/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi +++ b/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi @@ -20,13 +20,13 @@ keys { compatible = "gpio-keys-polled"; - debounce-interval = <100>; poll-interval = <20>; reset { label = "reset"; gpios = <&gpio1 3 GPIO_ACTIVE_LOW>; linux,code = ; + debounce-interval = <100>; }; }; diff --git a/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts b/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts index ad3245fc276..a1e0a6d06d8 100644 --- a/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts +++ b/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts @@ -41,13 +41,13 @@ keys { compatible = "gpio-keys-polled"; - debounce-interval = <100>; poll-interval = <20>; - mode { + reset { label = "reset"; gpios = <&gpio1 3 GPIO_ACTIVE_LOW>; linux,code = ; + debounce-interval = <100>; }; }; From f8a8a2c5c7ff1efe289d846a890d3361757c231f Mon Sep 17 00:00:00 2001 From: Jonathan Sturges Date: Thu, 26 Dec 2024 21:47:40 -0500 Subject: [PATCH 026/173] ramips: mt7621: enable lzma-loader for Amped Wireless ALLY Switch to using loader-kernel to accommodate larger image sizes that are problematic for many mt7621 uboots. Signed-off-by: Jonathan Sturges Link: https://github.com/openwrt/openwrt/pull/17389 Signed-off-by: Hauke Mehrtens --- target/linux/ramips/image/mt7621.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 2623d890f61..ed0da905287 100755 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -294,11 +294,11 @@ TARGET_DEVICES += alfa-network_quad-e4g define Device/ampedwireless_ally_common $(Device/nand) + $(Device/uimage-lzma-loader) DEVICE_VENDOR := Amped Wireless DEVICE_PACKAGES := kmod-mt7615-firmware IMAGE_SIZE := 32768k - KERNEL_INITRAMFS := $(KERNEL_DTB) | uImage lzma -n 'flashable-initramfs' |\ - edimax-header -s CSYS -m RN68 -f 0x001c0000 -S 0x01100000 + KERNEL_INITRAMFS := $$(KERNEL) | edimax-header -s CSYS -m RN68 -f 0x001c0000 -S 0x01100000 endef define Device/ampedwireless_ally-r1900k From b948c1e39b9e69e26e8caabf86c2d0bb9ac4efa6 Mon Sep 17 00:00:00 2001 From: James Sweeney Date: Wed, 1 Jan 2025 08:47:28 -0500 Subject: [PATCH 027/173] realtek: add support for HPE 1920-24G PoE-180W (JG925A) Hardware information: (largely copied from 11275be) --------------------- The HPE 1920-24G-PoE+ (180W) (JG925A) is a switch that is part of the 1920 family which has 180W nominal PoE+ support. Common with HPE 1920-24G: - RTL8382 SoC - 24 Gigabit RJ45 ports (built-in RTL8218B, 2 external RTL8218D) - 4 SFP ports (external RTL8214FC) - RJ45 RS232 port on front panel - 32 MiB NOR Flash - 128 MiB DDR3 DRAM - PT7A7514 watchdog HPE 1920-24G-PoE+ (180W): - PoE chip - 2 fans (40mm) Known issues: --------------------- - PoE LEDs are uncontrolled. (Manual taken from f2f09bc) Booting initramfs image: ------------------------ - Prepare a FTP or TFTP server serving the OpenWrt initramfs image and connect the server to a switch port. - Connect to the console port of the device and enter the extended boot menu by typing Ctrl+B when prompted. - Choose the menu option "<3> Enter Ethernet SubMenu". - Set network parameters via the option "<5> Modify Ethernet Parameter". Enter the FTP/TFTP filename as "Load File Name" ("Target File Name" can be left blank, it is not required for booting from RAM). Note that the configuration is saved on flash, so it only needs to be done once. - Select "<1> Download Application Program To SDRAM And Run". Initial installation: --------------------- - Boot an initramfs image as described above, then use sysupgrade to install OpenWrt permanently. After initial installation, the bootloader needs to be configured to load the correct image file - Enter the extended boot menu again and choose "<4> File Control", then select "<2> Set Application File type". - Enter the number of the file "openwrt-kernel.bin" (should be 1), and use the option "<1> +Main" to select it as boot image. - Choose "<0> Exit To Main Menu" and then "<1> Boot System". NOTE: The bootloader on these devices can only boot from the VFS filesystem which normally spans most of the flash. With OpenWrt, only the first part of the firmware partition contains a valid filesystem, the rest is used for rootfs. As the bootloader does not know about this, you must not do any file operations in the bootloader, as this may corrupt the OpenWrt installation (selecting the boot image is an exception, as it only stores a flag in the bootloader data, but doesn't write to the filesystem). Example PoE config file (/etc/config/poe): --------------------- config global option budget '180' config port option enable '1' option id '1' option name 'lan8' option poe_plus '1' option priority '2' config port option enable '1' option id '2' option name 'lan7' option poe_plus '1' option priority '2' config port option enable '1' option id '3' option name 'lan6' option poe_plus '1' option priority '2' config port option enable '1' option id '4' option name 'lan5' option poe_plus '1' option priority '2' config port option enable '1' option id '5' option name 'lan4' option poe_plus '1' option priority '2' config port option enable '1' option id '6' option name 'lan3' option poe_plus '1' option priority '2' config port option enable '1' option id '7' option name 'lan2' option poe_plus '1' option priority '2' config port option enable '1' option id '8' option name 'lan1' option poe_plus '1' option priority '2' config port option enable '1' option id '9' option name 'lan16' option poe_plus '1' option priority '2' config port option enable '1' option id '10' option name 'lan15' option poe_plus '1' option priority '2' config port option enable '1' option id '11' option name 'lan14' option poe_plus '1' option priority '2' config port option enable '1' option id '12' option name 'lan13' option poe_plus '1' option priority '2' config port option enable '1' option id '13' option name 'lan12' option poe_plus '1' option priority '2' config port option enable '1' option id '14' option name 'lan11' option poe_plus '1' option priority '2' config port option enable '1' option id '15' option name 'lan10' option poe_plus '1' option priority '2' config port option enable '1' option id '16' option name 'lan9' option poe_plus '1' option priority '2' config port option enable '1' option id '17' option name 'lan24' option poe_plus '1' option priority '2' config port option enable '1' option id '18' option name 'lan23' option poe_plus '1' option priority '2' config port option enable '1' option id '19' option name 'lan22' option poe_plus '1' option priority '2' config port option enable '1' option id '20' option name 'lan21' option poe_plus '1' option priority '2' config port option enable '1' option id '21' option name 'lan20' option poe_plus '1' option priority '2' config port option enable '1' option id '22' option name 'lan19' option poe_plus '1' option priority '2' config port option enable '1' option id '23' option name 'lan18' option poe_plus '1' option priority '2' config port option enable '1' option id '24' option name 'lan17' option poe_plus '1' option priority '2' Signed-off-by: James Sweeney Link: https://github.com/openwrt/openwrt/pull/17444 Signed-off-by: Sander Vanheule --- .../linux/realtek/base-files/etc/board.d/02_network | 3 +++ .../realtek/base-files/etc/board.d/03_gpio_switches | 1 + .../realtek/dts/rtl8382_hpe_1920-24g-poe-180w.dts | 12 ++++++++++++ target/linux/realtek/image/rtl838x.mk | 9 +++++++++ 4 files changed, 25 insertions(+) create mode 100644 target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-180w.dts diff --git a/target/linux/realtek/base-files/etc/board.d/02_network b/target/linux/realtek/base-files/etc/board.d/02_network index 750a2008149..a73944107ae 100644 --- a/target/linux/realtek/base-files/etc/board.d/02_network +++ b/target/linux/realtek/base-files/etc/board.d/02_network @@ -96,6 +96,9 @@ hpe,1920-8g-poe-65w) hpe,1920-8g-poe-180w) ucidef_set_poe 180 "$(filter_port_list_reverse "$lan_list" "lan9 lan10")" ;; +hpe,1920-24g-poe-180w) + ucidef_set_poe 180 "$(filter_port_list_reverse "$lan_list" "lan25 lan26 lan27 lan28")" + ;; hpe,1920-24g-poe-370w) ucidef_set_poe 370 "$(filter_port_list_reverse "$lan_list" "lan25 lan26 lan27 lan28")" ;; diff --git a/target/linux/realtek/base-files/etc/board.d/03_gpio_switches b/target/linux/realtek/base-files/etc/board.d/03_gpio_switches index 684d7f795ea..c869153e4ca 100644 --- a/target/linux/realtek/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/realtek/base-files/etc/board.d/03_gpio_switches @@ -7,6 +7,7 @@ board=$(board_name) case "$board" in hpe,1920-8g-poe-180w|\ +hpe,1920-24g-poe-180w|\ hpe,1920-24g-poe-370w) ucidef_add_gpio_switch "fan_ctrl" "Fan control" "456" "0" ;; diff --git a/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-180w.dts b/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-180w.dts new file mode 100644 index 00000000000..4783cec15ca --- /dev/null +++ b/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-180w.dts @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "rtl8382_hpe_1920-24g.dtsi" + +/ { + compatible = "hpe,1920-24g-poe-180w", "realtek,rtl838x-soc"; + model = "HPE 1920-24G-PoE+ 180W (JG925A)"; +}; + +&uart1 { + status = "okay"; +}; diff --git a/target/linux/realtek/image/rtl838x.mk b/target/linux/realtek/image/rtl838x.mk index d694f5b308f..866659ad141 100644 --- a/target/linux/realtek/image/rtl838x.mk +++ b/target/linux/realtek/image/rtl838x.mk @@ -144,6 +144,15 @@ define Device/hpe_1920-24g endef TARGET_DEVICES += hpe_1920-24g +define Device/hpe_1920-24g-poe-180w + $(Device/hpe_1920) + SOC := rtl8382 + DEVICE_MODEL := 1920-24G-PoE+ 180W (JG925A) + DEVICE_PACKAGES += realtek-poe + H3C_DEVICE_ID := 0x00010028 +endef +TARGET_DEVICES += hpe_1920-24g-poe-180w + define Device/hpe_1920-24g-poe-370w $(Device/hpe_1920) SOC := rtl8382 From 0fda3b14c771c697f98daed39cbba08d69b06b96 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Fri, 20 Dec 2024 00:59:50 +0100 Subject: [PATCH 028/173] ixp4xx: Add back support for Netgear WG302 v1 The WG302 v1 has 32MB of RAM so it can easily run OpenWrt, however it lacks much flash: only 8 MB. By just using the flash for rootfs and booting a kernel over TFTP it works just fine. Signed-off-by: Linus Walleij --- .../ixp4xx/base-files/etc/board.d/02_network | 3 +- target/linux/ixp4xx/image/Makefile | 15 +++++ ...7-ARM-dts-ixp4xx-Fix-up-PCI-on-WG302.patch | 40 +++++++++++++ ...ts-ixp4xx-Add-Netgear-WG302-v1-GPIOs.patch | 59 +++++++++++++++++++ 4 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 target/linux/ixp4xx/patches-6.6/0007-ARM-dts-ixp4xx-Fix-up-PCI-on-WG302.patch create mode 100644 target/linux/ixp4xx/patches-6.6/0008-ARM-dts-ixp4xx-Add-Netgear-WG302-v1-GPIOs.patch diff --git a/target/linux/ixp4xx/base-files/etc/board.d/02_network b/target/linux/ixp4xx/base-files/etc/board.d/02_network index 6a361d4f533..c321e3fb27b 100644 --- a/target/linux/ixp4xx/base-files/etc/board.d/02_network +++ b/target/linux/ixp4xx/base-files/etc/board.d/02_network @@ -11,7 +11,8 @@ gateworks,gw2358) ;; dlink,dsm-g600-a|\ iom,nas-100d|\ -linksys,nslu2) +linksys,nslu2|\ +netgear,wg302v1) ucidef_set_interface_lan "eth0" "dhcp" ;; usr,usr8200) diff --git a/target/linux/ixp4xx/image/Makefile b/target/linux/ixp4xx/image/Makefile index ace533e50f0..f1172ee1234 100644 --- a/target/linux/ixp4xx/image/Makefile +++ b/target/linux/ixp4xx/image/Makefile @@ -124,6 +124,21 @@ define Device/linksys_nslu2 endef TARGET_DEVICES += linksys_nslu2 +define Device/netgear_wg302v1 + DEVICE_VENDOR := Netgear + DEVICE_MODEL := WG302 v1 + DEVICE_PACKAGES := ixp4xx-microcode-ethernet kmod-phy-amd kmod-ath5k \ + wpad-basic-mbedtls kmod-input-gpio-keys-polled + # Only 32 MB of RAM and small flash so not building by default + DEFAULT := n + DEVICE_DTS := intel-ixp42x-netgear-wg302v1 + KERNEL := kernel-bin | append-dtb + IMAGES := kernel.bin rootfs.bin + IMAGE/kernel.bin := append-kernel + IMAGE/rootfs.bin := append-rootfs | pad-rootfs | pad-to 128k +endef +TARGET_DEVICES += netgear_wg302v1 + define Device/usrobotics_usr8200 DEVICE_VENDOR := USRobotics DEVICE_MODEL := USR8200 diff --git a/target/linux/ixp4xx/patches-6.6/0007-ARM-dts-ixp4xx-Fix-up-PCI-on-WG302.patch b/target/linux/ixp4xx/patches-6.6/0007-ARM-dts-ixp4xx-Fix-up-PCI-on-WG302.patch new file mode 100644 index 00000000000..ca0df180715 --- /dev/null +++ b/target/linux/ixp4xx/patches-6.6/0007-ARM-dts-ixp4xx-Fix-up-PCI-on-WG302.patch @@ -0,0 +1,40 @@ +From ed23e07bf7a1896b6eaa85b773bb43b1fad66d4b Mon Sep 17 00:00:00 2001 +From: Linus Walleij +Date: Sat, 21 Dec 2024 00:07:11 +0100 +Subject: [PATCH] ARM: dts: ixp4xx: Fix up PCI on WG302 + +Looking at the board file for WG302 v2 was not a good idea +because the GPIO IRQ for slot 2 differs, and v1 uses GPIO +10 instead of GPIO 9. Fix it up. + +Signed-off-by: Linus Walleij +--- + .../dts/intel/ixp/intel-ixp42x-netgear-wg302v1.dts | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +--- a/arch/arm/boot/dts/intel/ixp/intel-ixp42x-netgear-wg302v1.dts ++++ b/arch/arm/boot/dts/intel/ixp/intel-ixp42x-netgear-wg302v1.dts +@@ -57,7 +57,7 @@ + status = "okay"; + + /* +- * Taken from WG302 v2 PCI boardfile (wg302v2-pci.c) ++ * Taken from WG302 v1 PCI boardfile (wg302v1-pci.c) + * We have slots (IDSEL) 1 and 2 with one assigned IRQ + * each handling all IRQs. + */ +@@ -70,10 +70,10 @@ + <0x0800 0 0 3 &gpio0 8 IRQ_TYPE_LEVEL_LOW>, /* INT C on slot 1 is irq 8 */ + <0x0800 0 0 4 &gpio0 8 IRQ_TYPE_LEVEL_LOW>, /* INT D on slot 1 is irq 8 */ + /* IDSEL 2 */ +- <0x1000 0 0 1 &gpio0 9 IRQ_TYPE_LEVEL_LOW>, /* INT A on slot 2 is irq 9 */ +- <0x1000 0 0 2 &gpio0 9 IRQ_TYPE_LEVEL_LOW>, /* INT B on slot 2 is irq 9 */ +- <0x1000 0 0 3 &gpio0 9 IRQ_TYPE_LEVEL_LOW>, /* INT C on slot 2 is irq 9 */ +- <0x1000 0 0 4 &gpio0 9 IRQ_TYPE_LEVEL_LOW>; /* INT D on slot 2 is irq 9 */ ++ <0x1000 0 0 1 &gpio0 10 IRQ_TYPE_LEVEL_LOW>, /* INT A on slot 2 is irq 10 */ ++ <0x1000 0 0 2 &gpio0 10 IRQ_TYPE_LEVEL_LOW>, /* INT B on slot 2 is irq 10 */ ++ <0x1000 0 0 3 &gpio0 10 IRQ_TYPE_LEVEL_LOW>, /* INT C on slot 2 is irq 10 */ ++ <0x1000 0 0 4 &gpio0 10 IRQ_TYPE_LEVEL_LOW>; /* INT D on slot 2 is irq 10 */ + }; + + ethernet@c8009000 { diff --git a/target/linux/ixp4xx/patches-6.6/0008-ARM-dts-ixp4xx-Add-Netgear-WG302-v1-GPIOs.patch b/target/linux/ixp4xx/patches-6.6/0008-ARM-dts-ixp4xx-Add-Netgear-WG302-v1-GPIOs.patch new file mode 100644 index 00000000000..ef4f21fa036 --- /dev/null +++ b/target/linux/ixp4xx/patches-6.6/0008-ARM-dts-ixp4xx-Add-Netgear-WG302-v1-GPIOs.patch @@ -0,0 +1,59 @@ +From 1d22f422fca8875f6d2cb297f735d41fd5830000 Mon Sep 17 00:00:00 2001 +From: Linus Walleij +Date: Mon, 23 Dec 2024 17:50:52 +0100 +Subject: [PATCH] ARM: dts: ixp4xx: Add Netgear WG302 v1 GPIOs + +This adds GPIO LED indicators, the reset GPIO RESET +button on the Netgear WG302 v1 to the device tree. + +Signed-off-by: Linus Walleij +--- + .../ixp/intel-ixp42x-netgear-wg302v1.dts | 30 +++++++++++++++++++ + 1 file changed, 30 insertions(+) + +--- a/arch/arm/boot/dts/intel/ixp/intel-ixp42x-netgear-wg302v1.dts ++++ b/arch/arm/boot/dts/intel/ixp/intel-ixp42x-netgear-wg302v1.dts +@@ -8,6 +8,7 @@ + + #include "intel-ixp42x.dtsi" + #include ++#include + + / { + model = "Netgear WG302 v1"; +@@ -32,6 +33,35 @@ + serial0 = &uart1; + }; + ++ leds { ++ compatible = "gpio-leds"; ++ test_led: led-test { ++ color = ; ++ function = "test"; ++ gpios = <&gpio0 4 GPIO_ACTIVE_LOW>; ++ default-state = "off"; ++ }; ++ wlan_led: led-wlan { ++ color = ; ++ function = LED_FUNCTION_WLAN; ++ gpios = <&gpio0 5 GPIO_ACTIVE_LOW>; ++ default-state = "off"; ++ linux,default-trigger = "phy0tx"; ++ }; ++ }; ++ ++ gpio_keys { ++ /* RESET is on GPIO13 which can't fire interrupts */ ++ compatible = "gpio-keys-polled"; ++ poll-interval = <100>; ++ ++ button-reset { ++ linux,code = ; ++ label = "reset"; ++ gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ + soc { + bus@c4000000 { + flash@0,0 { From 6e2a842d624ae5a6852232dc860a012c22db2bb9 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Fri, 20 Dec 2024 19:50:26 +0100 Subject: [PATCH 029/173] ixp4xx: Support sysupgrade on WG302 v1 The WG302 v1 have a separate rootfs partition that we simply just upgrade with a new rootfs image. The kernel need to be updated on the TFTP server. Signed-off-by: Linus Walleij --- .../ixp4xx/base-files/lib/upgrade/platform.sh | 27 +++++++++++++++++++ target/linux/ixp4xx/image/Makefile | 1 + 2 files changed, 28 insertions(+) create mode 100644 target/linux/ixp4xx/base-files/lib/upgrade/platform.sh diff --git a/target/linux/ixp4xx/base-files/lib/upgrade/platform.sh b/target/linux/ixp4xx/base-files/lib/upgrade/platform.sh new file mode 100644 index 00000000000..869eab32140 --- /dev/null +++ b/target/linux/ixp4xx/base-files/lib/upgrade/platform.sh @@ -0,0 +1,27 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +REQUIRE_IMAGE_METADATA=1 + +platform_check_image() { + local board=$(board_name) + + case "$board" in + netgear,wg302v1) + return 0 + ;; + esac + + echo "Sysupgrade is not yet supported on $board." + return 1 +} + +platform_do_upgrade() { + local board=$(board_name) + + case "$board" in + netgear,wg302v1) + PART_NAME=rootfs + default_do_upgrade "$1" + ;; + esac +} diff --git a/target/linux/ixp4xx/image/Makefile b/target/linux/ixp4xx/image/Makefile index f1172ee1234..d4b2e5b9627 100644 --- a/target/linux/ixp4xx/image/Makefile +++ b/target/linux/ixp4xx/image/Makefile @@ -136,6 +136,7 @@ define Device/netgear_wg302v1 IMAGES := kernel.bin rootfs.bin IMAGE/kernel.bin := append-kernel IMAGE/rootfs.bin := append-rootfs | pad-rootfs | pad-to 128k + IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 128k | append-metadata endef TARGET_DEVICES += netgear_wg302v1 From d15da125eb14858ff68c33c0dcdf5aaeb7d3a004 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Sat, 21 Dec 2024 00:59:27 +0100 Subject: [PATCH 030/173] ixp4xx: Support single zcom_npe_esa hw address Some ixp4xx platforms with a proper RedBoot config do not contain the per-ethernet interface npe_eth0_esa, but rather a single entry named zcom_npe_esa. Let's use this if fconfig can't find the primary key. This is needed on the Netgear WG302 v1. Signed-off-by: Linus Walleij --- .../ixp4xx/base-files/lib/preinit/05_set_ether_mac_ixp4xx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/target/linux/ixp4xx/base-files/lib/preinit/05_set_ether_mac_ixp4xx b/target/linux/ixp4xx/base-files/lib/preinit/05_set_ether_mac_ixp4xx index 9e7ff462983..c58eb96f2ae 100644 --- a/target/linux/ixp4xx/base-files/lib/preinit/05_set_ether_mac_ixp4xx +++ b/target/linux/ixp4xx/base-files/lib/preinit/05_set_ether_mac_ixp4xx @@ -5,8 +5,12 @@ set_from_redboot () { for npe in eth0 eth1 eth2 do + mac="$(fconfig -s -r -d /dev/$1 -n npe_"$npe"_esa)" + if [ -z $mac ] ; then + mac="$(fconfig -s -r -d /dev/$1 -n zcom_npe_esa)" + fi if ip link show dev $npe > /dev/null 2>&1; then - ip link set dev $npe address $(fconfig -s -r -d /dev/$1 -n npe_"$npe"_esa) + ip link set dev $npe address $mac fi done From 804bc79ed03edc47fad4e60d42fe66c7070aa514 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Wed, 25 Dec 2024 01:11:00 +0100 Subject: [PATCH 031/173] ixp4xx: Add LEDs to supported devices This adds the OpenWrt-only LED aliases to the supported IXP4xx devices. Signed-off-by: Linus Walleij --- ...2-ARM-dts-ixp4xx-OpenWrt-LED-aliases.patch | 228 ++++++++++++++++++ 1 file changed, 228 insertions(+) create mode 100644 target/linux/ixp4xx/patches-6.6/302-ARM-dts-ixp4xx-OpenWrt-LED-aliases.patch diff --git a/target/linux/ixp4xx/patches-6.6/302-ARM-dts-ixp4xx-OpenWrt-LED-aliases.patch b/target/linux/ixp4xx/patches-6.6/302-ARM-dts-ixp4xx-OpenWrt-LED-aliases.patch new file mode 100644 index 00000000000..7fd1854a0e2 --- /dev/null +++ b/target/linux/ixp4xx/patches-6.6/302-ARM-dts-ixp4xx-OpenWrt-LED-aliases.patch @@ -0,0 +1,228 @@ +From d672011e10097e5e61659a5d64ac9cb7b7544b60 Mon Sep 17 00:00:00 2001 +From: Linus Walleij +Date: Wed, 25 Dec 2024 01:09:20 +0100 +Subject: [PATCH] ARM: dts: ixp4xx OpenWrt LED aliases + +This outoftree patch adds OpenWrt LED aliases to the DTS files +of supported devices. + +Signed-off-by: Linus Walleij +--- + .../boot/dts/intel/ixp/intel-ixp42x-dlink-dsm-g600.dts | 9 ++++++--- + .../boot/dts/intel/ixp/intel-ixp42x-freecom-fsg-3.dts | 10 +++++++--- + .../dts/intel/ixp/intel-ixp42x-gateworks-gw2348.dts | 6 +++++- + .../boot/dts/intel/ixp/intel-ixp42x-iomega-nas100d.dts | 9 ++++++--- + .../boot/dts/intel/ixp/intel-ixp42x-linksys-nslu2.dts | 9 ++++++--- + .../dts/intel/ixp/intel-ixp42x-netgear-wg302v1.dts | 3 +++ + .../dts/intel/ixp/intel-ixp42x-usrobotics-usr8200.dts | 5 ++++- + .../dts/intel/ixp/intel-ixp43x-gateworks-gw2358.dts | 6 +++++- + 8 files changed, 42 insertions(+), 15 deletions(-) + +--- a/arch/arm/boot/dts/intel/ixp/intel-ixp42x-dlink-dsm-g600.dts ++++ b/arch/arm/boot/dts/intel/ixp/intel-ixp42x-dlink-dsm-g600.dts +@@ -31,16 +31,19 @@ + }; + + aliases { ++ led-boot = &led_power; ++ led-failsafe = &led_power; ++ led-running = &led_power; ++ led-upgrade = &led_power; + serial0 = &uart0; + }; + + leds { + compatible = "gpio-leds"; +- led-power { ++ led_power: led-power { + label = "dsmg600:green:power"; + gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; + default-state = "on"; +- linux,default-trigger = "heartbeat"; + }; + led-wlan { + label = "dsmg600:green:wlan"; +@@ -48,7 +51,7 @@ + gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; + default-state = "on"; + /* We don't have WLAN trigger in the kernel (yet) */ +- linux,default-trigger = "netdev"; ++ linux,default-trigger = "phy0tx"; + }; + }; + +--- a/arch/arm/boot/dts/intel/ixp/intel-ixp42x-freecom-fsg-3.dts ++++ b/arch/arm/boot/dts/intel/ixp/intel-ixp42x-freecom-fsg-3.dts +@@ -29,6 +29,10 @@ + }; + + aliases { ++ led-boot = &led_ring; ++ led-failsafe = &led_sync; ++ led-running = &led_ring; ++ led-upgrade = &led_sync; + serial0 = &uart0; + }; + +@@ -112,7 +116,7 @@ + reg = <0x00 0x02>; + mask = <0x01>; + label = "fsg:blue:wlan"; +- linux,default-trigger = "wlan"; ++ linux,default-trigger = "phy0tx"; + default-state = "on"; + }; + led@0,1 { +@@ -139,7 +143,7 @@ + linux,default-trigger = ""; + default-state = "on"; + }; +- led@0,4 { ++ led_sync: led@0,4 { + compatible = "register-bit-led"; + reg = <0x00 0x02>; + mask = <0x08>; +@@ -147,7 +151,7 @@ + linux,default-trigger = ""; + default-state = "on"; + }; +- led@0,5 { ++ led_ring: led@0,5 { + compatible = "register-bit-led"; + reg = <0x00 0x02>; + mask = <0x10>; +--- a/arch/arm/boot/dts/intel/ixp/intel-ixp42x-gateworks-gw2348.dts ++++ b/arch/arm/boot/dts/intel/ixp/intel-ixp42x-gateworks-gw2348.dts +@@ -26,12 +26,16 @@ + }; + + aliases { ++ led-boot = &usr_led; ++ led-failsafe = &usr_led; ++ led-running = &usr_led; ++ led-upgrade = &usr_led; + serial0 = &uart0; + }; + + leds { + compatible = "gpio-leds"; +- led-user { ++ usr_led: led-user { + label = "gw2348:green:user"; + gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; + default-state = "on"; +--- a/arch/arm/boot/dts/intel/ixp/intel-ixp42x-iomega-nas100d.dts ++++ b/arch/arm/boot/dts/intel/ixp/intel-ixp42x-iomega-nas100d.dts +@@ -26,6 +26,10 @@ + }; + + aliases { ++ led-boot = &pwr_led; ++ led-failsafe = &pwr_led; ++ led-running = &pwr_led; ++ led-upgrade = &pwr_led; + serial0 = &uart0; + }; + +@@ -36,7 +40,7 @@ + gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; + default-state = "on"; + /* We don't have WLAN trigger in the kernel (yet) */ +- linux,default-trigger = "netdev"; ++ linux,default-trigger = "phy0tx"; + }; + led-disk { + label = "nas100d:red:disk"; +@@ -44,11 +48,10 @@ + default-state = "on"; + linux,default-trigger = "disk-activity"; + }; +- led-power { ++ pwr_led: led-power { + label = "nas100d:red:power"; + gpios = <&gpio0 15 GPIO_ACTIVE_LOW>; + default-state = "on"; +- linux,default-trigger = "heartbeat"; + }; + }; + +--- a/arch/arm/boot/dts/intel/ixp/intel-ixp42x-linksys-nslu2.dts ++++ b/arch/arm/boot/dts/intel/ixp/intel-ixp42x-linksys-nslu2.dts +@@ -26,18 +26,21 @@ + }; + + aliases { ++ led-boot = &led_status; ++ led-failsafe = &led_status; ++ led-running = &led_ready; ++ led-upgrade = &led_status; + serial0 = &uart0; + }; + + leds { + compatible = "gpio-leds"; +- led-status { ++ led_status: led-status { + label = "nslu2:red:status"; + gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; + default-state = "on"; +- linux,default-trigger = "heartbeat"; + }; +- led-ready { ++ led_ready: led-ready { + label = "nslu2:green:ready"; + gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; + default-state = "on"; +--- a/arch/arm/boot/dts/intel/ixp/intel-ixp42x-netgear-wg302v1.dts ++++ b/arch/arm/boot/dts/intel/ixp/intel-ixp42x-netgear-wg302v1.dts +@@ -29,6 +29,9 @@ + }; + + aliases { ++ led-boot = &test_led; ++ led-failsafe = &test_led; ++ led-upgrade = &test_led; + /* These are switched around */ + serial0 = &uart1; + }; +--- a/arch/arm/boot/dts/intel/ixp/intel-ixp42x-usrobotics-usr8200.dts ++++ b/arch/arm/boot/dts/intel/ixp/intel-ixp42x-usrobotics-usr8200.dts +@@ -29,6 +29,10 @@ + }; + + aliases { ++ led-boot = &pwr_led; ++ led-failsafe = &pwr_led; ++ led-running = &pwr_led; ++ led-upgrade = &pwr_led; + /* These are switched around */ + serial0 = &uart1; + serial1 = &uart0; +@@ -67,7 +71,6 @@ + label = "usr8200:green:pwr"; + gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>; + default-state = "on"; +- linux,default-trigger = "heartbeat"; + }; + }; + +--- a/arch/arm/boot/dts/intel/ixp/intel-ixp43x-gateworks-gw2358.dts ++++ b/arch/arm/boot/dts/intel/ixp/intel-ixp43x-gateworks-gw2358.dts +@@ -25,12 +25,16 @@ + }; + + aliases { ++ led-boot = &usr_led; ++ led-failsafe = &usr_led; ++ led-running = &usr_led; ++ led-upgrade = &usr_led; + serial0 = &uart0; + }; + + leds { + compatible = "gpio-leds"; +- led-user { ++ usr_led: led-user { + label = "gw2358:green:LED"; + gpios = <&pld1 0 GPIO_ACTIVE_LOW>; + default-state = "on"; From 2456a2fd7f72d6afcee4ac9c2eccb312d0b1d36d Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Sat, 28 Dec 2024 00:13:37 +0100 Subject: [PATCH 032/173] ixp4xx: Break out mv88e6060 DSA switch to package Just one of the devices uses the Marvell MV88E6060 DSA switch so break this out from the generic kernel config and into a package selected only by that single device and probed at boot instead. The big win is from being able to drop the dsa_core (~600KB) kernel module out of the common kernel on devices with no DSA switch. Signed-off-by: Linus Walleij --- package/kernel/linux/modules/netdevices.mk | 17 +++++++++++++++++ target/linux/ixp4xx/config-6.6 | 3 --- target/linux/ixp4xx/image/Makefile | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index c72bc0e8e63..097bea7f50d 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -575,6 +575,23 @@ endef $(eval $(call KernelPackage,dsa-b53-mdio)) +define KernelPackage/dsa-mv88e6060 + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Marvell MV88E6060 DSA Switch + DEPENDS:=+kmod-dsa +kmod-phy-marvell + KCONFIG:=CONFIG_NET_DSA_TAG_TRAILER \ + CONFIG_NET_DSA_MV88E6060 + FILES:= \ + $(LINUX_DIR)/drivers/net/dsa/mv88e6060.ko \ + $(LINUX_DIR)/net/dsa/tag_trailer.ko + AUTOLOAD:=$(call AutoLoad,41,mv88e6060,1) +endef + +define KernelPackage/dsa-mv88e6060/description + Kernel modules for MV88E6060 DSA switches +endef + +$(eval $(call KernelPackage,dsa-mv88e6060)) define KernelPackage/dsa-tag-dsa SUBMENU:=$(NETWORK_DEVICES_MENU) diff --git a/target/linux/ixp4xx/config-6.6 b/target/linux/ixp4xx/config-6.6 index 84a72c8d5ca..c0211c940b2 100644 --- a/target/linux/ixp4xx/config-6.6 +++ b/target/linux/ixp4xx/config-6.6 @@ -168,9 +168,6 @@ CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_KUSER_HELPERS=y CONFIG_NEED_PER_CPU_KM=y CONFIG_NET_DEVLINK=y -CONFIG_NET_DSA=y -CONFIG_NET_DSA_MV88E6060=y -CONFIG_NET_DSA_TAG_TRAILER=y CONFIG_NET_EGRESS=y CONFIG_NET_INGRESS=y CONFIG_NET_PTP_CLASSIFY=y diff --git a/target/linux/ixp4xx/image/Makefile b/target/linux/ixp4xx/image/Makefile index d4b2e5b9627..32a16fd1355 100644 --- a/target/linux/ixp4xx/image/Makefile +++ b/target/linux/ixp4xx/image/Makefile @@ -144,7 +144,7 @@ define Device/usrobotics_usr8200 DEVICE_VENDOR := USRobotics DEVICE_MODEL := USR8200 # USB2 is compiled in and needs no package - DEVICE_PACKAGES := ixp4xx-microcode-ethernet kmod-rtc-r7301 kmod-firewire kmod-firewire-ohci + DEVICE_PACKAGES := ixp4xx-microcode-ethernet kmod-rtc-r7301 kmod-firewire kmod-firewire-ohci kmod-dsa-mv88e6060 DEVICE_DTS := intel-ixp42x-usrobotics-usr8200 KERNEL := kernel-bin | append-dtb IMAGES := kernel.bin rootfs.bin From a3391d871d3f14f5de2081e23eda08986abc2b9b Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Thu, 2 Jan 2025 09:31:44 +0100 Subject: [PATCH 033/173] realtek: drop extraneous ')' in 02_network The extraneous closing parenthesis inside the case matching breaks syntax of the network initialization script 02_network. /bin/board_detect: /etc/board.d/02_network: line 40: syntax error: unexpected newline (expecting ")") Remove this character so board init is functional again. Fixes: c8ea1aa970bf ("realtek: add support for HPE 1920-24G-PoE-370w") Signed-off-by: Sander Vanheule --- target/linux/realtek/base-files/etc/board.d/02_network | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/realtek/base-files/etc/board.d/02_network b/target/linux/realtek/base-files/etc/board.d/02_network index a73944107ae..12fb33d85e0 100644 --- a/target/linux/realtek/base-files/etc/board.d/02_network +++ b/target/linux/realtek/base-files/etc/board.d/02_network @@ -36,7 +36,7 @@ hpe,1920-8g-poe-65w|\ hpe,1920-8g-poe-180w|\ hpe,1920-16g|\ hpe,1920-24g|\ -hpe,1920-24g-poe-370w|\) +hpe,1920-24g-poe-370w|\ hpe,1920-48g|\ hpe,1920-48g-poe) label_mac=$(mtd_get_mac_binary factory 0x68) From 2cb77be2faeb08e5c10e8be2738cb088a912b91e Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Thu, 2 Jan 2025 16:55:35 +0800 Subject: [PATCH 034/173] mac80211: add missing brcm43752 patches back These patches were added in kernel v6.13, not v6.12. Signed-off-by: Tianling Shen --- ...dd-optional-lpo-clock-enable-support.patch | 272 ++++++++++++++++++ ...flag-for-random-seed-during-firmware.patch | 170 +++++++++++ ...-in-driver-tables-with-country-codes.patch | 14 +- 3 files changed, 449 insertions(+), 7 deletions(-) create mode 100644 package/kernel/mac80211/patches/brcm/060-v6.13-wifi-brcmfmac-Add-optional-lpo-clock-enable-support.patch create mode 100644 package/kernel/mac80211/patches/brcm/061-v6.13-wifi-brcmfmac-add-flag-for-random-seed-during-firmware.patch diff --git a/package/kernel/mac80211/patches/brcm/060-v6.13-wifi-brcmfmac-Add-optional-lpo-clock-enable-support.patch b/package/kernel/mac80211/patches/brcm/060-v6.13-wifi-brcmfmac-Add-optional-lpo-clock-enable-support.patch new file mode 100644 index 00000000000..9c18ce606cb --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/060-v6.13-wifi-brcmfmac-Add-optional-lpo-clock-enable-support.patch @@ -0,0 +1,272 @@ +From 0ff0843310b74e565901d85f849fb308c3b1f220 Mon Sep 17 00:00:00 2001 +From: Jacobe Zang +Date: Tue, 10 Sep 2024 11:04:13 +0800 +Subject: [PATCH] wifi: brcmfmac: Add optional lpo clock enable support + +WiFi modules often require 32kHz clock to function. Add support to +enable the clock to PCIe driver and move "brcm,bcm4329-fmac" check +to the top of brcmf_of_probe. Change function prototypes from void +to int and add appropriate errno's for return values that will be +send to bus when error occurred. + +Co-developed-by: Ondrej Jirman +Signed-off-by: Ondrej Jirman +Co-developed-by: Arend van Spriel +Signed-off-by: Arend van Spriel +Reviewed-by: Sai Krishna +Signed-off-by: Jacobe Zang +Reviewed-by: Sebastian Reichel +Tested-by: Sebastian Reichel # On RK3588 EVB1 +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +Link: https://patch.msgid.link/20240910-wireless-mainline-v14-3-9d80fea5326d@wesion.com +--- + .../broadcom/brcm80211/brcmfmac/bcmsdh.c | 4 +-- + .../broadcom/brcm80211/brcmfmac/common.c | 3 ++- + .../wireless/broadcom/brcm80211/brcmfmac/of.c | 25 +++++++++++++------ + .../wireless/broadcom/brcm80211/brcmfmac/of.h | 9 ++++--- + .../broadcom/brcm80211/brcmfmac/pcie.c | 3 +++ + .../broadcom/brcm80211/brcmfmac/sdio.c | 22 ++++++++++------ + .../broadcom/brcm80211/brcmfmac/usb.c | 3 +++ + 7 files changed, 47 insertions(+), 22 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +@@ -947,8 +947,8 @@ int brcmf_sdiod_probe(struct brcmf_sdio_ + + /* try to attach to the target device */ + sdiodev->bus = brcmf_sdio_probe(sdiodev); +- if (!sdiodev->bus) { +- ret = -ENODEV; ++ if (IS_ERR(sdiodev->bus)) { ++ ret = PTR_ERR(sdiodev->bus); + goto out; + } + brcmf_sdiod_host_fixup(sdiodev->func2->card->host); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +@@ -561,7 +561,8 @@ struct brcmf_mp_device *brcmf_get_module + if (!found) { + /* No platform data for this device, try OF and DMI data */ + brcmf_dmi_probe(settings, chip, chiprev); +- brcmf_of_probe(dev, bus_type, settings); ++ if (brcmf_of_probe(dev, bus_type, settings) == -EPROBE_DEFER) ++ return ERR_PTR(-EPROBE_DEFER); + brcmf_acpi_probe(dev, bus_type, settings); + } + return settings; +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c +@@ -6,6 +6,7 @@ + #include + #include + #include ++#include + + #include + #include "debug.h" +@@ -65,12 +66,13 @@ static int brcmf_of_get_country_codes(st + return 0; + } + +-void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, +- struct brcmf_mp_device *settings) ++int brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, ++ struct brcmf_mp_device *settings) + { + struct brcmfmac_sdio_pd *sdio = &settings->bus.sdio; + struct device_node *root, *np = dev->of_node; + struct of_phandle_args oirq; ++ struct clk *clk; + const char *prop; + int irq; + int err; +@@ -106,15 +108,22 @@ void brcmf_of_probe(struct device *dev, + board_type = devm_kstrdup(dev, tmp, GFP_KERNEL); + if (!board_type) { + of_node_put(root); +- return; ++ return 0; + } + strreplace(board_type, '/', '-'); + settings->board_type = board_type; + } + of_node_put(root); + ++ clk = devm_clk_get_optional_enabled(dev, "lpo"); ++ if (IS_ERR(clk)) ++ return PTR_ERR(clk); ++ ++ brcmf_dbg(INFO, "%s LPO clock\n", clk ? "enable" : "no"); ++ clk_set_rate(clk, 32768); ++ + if (!np || !of_device_is_compatible(np, "brcm,bcm4329-fmac")) +- return; ++ return 0; + + err = brcmf_of_get_country_codes(dev, settings); + if (err) +@@ -123,23 +132,25 @@ void brcmf_of_probe(struct device *dev, + of_get_mac_address(np, settings->mac); + + if (bus_type != BRCMF_BUSTYPE_SDIO) +- return; ++ return 0; + + if (of_property_read_u32(np, "brcm,drive-strength", &val) == 0) + sdio->drive_strength = val; + + /* make sure there are interrupts defined in the node */ + if (of_irq_parse_one(np, 0, &oirq)) +- return; ++ return 0; + + irq = irq_create_of_mapping(&oirq); + if (!irq) { + brcmf_err("interrupt could not be mapped\n"); +- return; ++ return 0; + } + irqf = irqd_get_trigger_type(irq_get_irq_data(irq)); + + sdio->oob_irq_supported = true; + sdio->oob_irq_nr = irq; + sdio->oob_irq_flags = irqf; ++ ++ return 0; + } +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h +@@ -3,11 +3,12 @@ + * Copyright (c) 2014 Broadcom Corporation + */ + #ifdef CONFIG_OF +-void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, +- struct brcmf_mp_device *settings); ++int brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, ++ struct brcmf_mp_device *settings); + #else +-static void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, +- struct brcmf_mp_device *settings) ++static int brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, ++ struct brcmf_mp_device *settings) + { ++ return 0; + } + #endif /* CONFIG_OF */ +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -2452,6 +2452,9 @@ brcmf_pcie_probe(struct pci_dev *pdev, c + ret = -ENOMEM; + goto fail; + } ++ ret = PTR_ERR_OR_ZERO(devinfo->settings); ++ if (ret < 0) ++ goto fail; + + bus = kzalloc(sizeof(*bus), GFP_KERNEL); + if (!bus) { +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -3943,7 +3943,7 @@ static const struct brcmf_buscore_ops br + .write32 = brcmf_sdio_buscore_write32, + }; + +-static bool ++static int + brcmf_sdio_probe_attach(struct brcmf_sdio *bus) + { + struct brcmf_sdio_dev *sdiodev; +@@ -3953,6 +3953,7 @@ brcmf_sdio_probe_attach(struct brcmf_sdi + u32 reg_val; + u32 drivestrength; + u32 enum_base; ++ int ret = -EBADE; + + sdiodev = bus->sdiodev; + sdio_claim_host(sdiodev->func1); +@@ -4001,8 +4002,9 @@ brcmf_sdio_probe_attach(struct brcmf_sdi + BRCMF_BUSTYPE_SDIO, + bus->ci->chip, + bus->ci->chiprev); +- if (!sdiodev->settings) { ++ if (IS_ERR_OR_NULL(sdiodev->settings)) { + brcmf_err("Failed to get device parameters\n"); ++ ret = PTR_ERR_OR_ZERO(sdiodev->settings); + goto fail; + } + /* platform specific configuration: +@@ -4071,7 +4073,7 @@ brcmf_sdio_probe_attach(struct brcmf_sdi + /* allocate header buffer */ + bus->hdrbuf = kzalloc(MAX_HDR_READ + bus->head_align, GFP_KERNEL); + if (!bus->hdrbuf) +- return false; ++ return -ENOMEM; + /* Locate an appropriately-aligned portion of hdrbuf */ + bus->rxhdr = (u8 *) roundup((unsigned long)&bus->hdrbuf[0], + bus->head_align); +@@ -4082,11 +4084,11 @@ brcmf_sdio_probe_attach(struct brcmf_sdi + if (bus->poll) + bus->pollrate = 1; + +- return true; ++ return 0; + + fail: + sdio_release_host(sdiodev->func1); +- return false; ++ return ret; + } + + static int +@@ -4451,8 +4453,10 @@ struct brcmf_sdio *brcmf_sdio_probe(stru + + /* Allocate private bus interface state */ + bus = kzalloc(sizeof(*bus), GFP_ATOMIC); +- if (!bus) ++ if (!bus) { ++ ret = -ENOMEM; + goto fail; ++ } + + bus->sdiodev = sdiodev; + sdiodev->bus = bus; +@@ -4467,6 +4471,7 @@ struct brcmf_sdio *brcmf_sdio_probe(stru + dev_name(&sdiodev->func1->dev)); + if (!wq) { + brcmf_err("insufficient memory to create txworkqueue\n"); ++ ret = -ENOMEM; + goto fail; + } + brcmf_sdiod_freezer_count(sdiodev); +@@ -4474,7 +4479,8 @@ struct brcmf_sdio *brcmf_sdio_probe(stru + bus->brcmf_wq = wq; + + /* attempt to attach to the dongle */ +- if (!(brcmf_sdio_probe_attach(bus))) { ++ ret = brcmf_sdio_probe_attach(bus); ++ if (ret < 0) { + brcmf_err("brcmf_sdio_probe_attach failed\n"); + goto fail; + } +@@ -4546,7 +4552,7 @@ struct brcmf_sdio *brcmf_sdio_probe(stru + + fail: + brcmf_sdio_remove(bus); +- return NULL; ++ return ERR_PTR(ret); + } + + /* Detach and free everything */ +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +@@ -1272,6 +1272,9 @@ static int brcmf_usb_probe_cb(struct brc + ret = -ENOMEM; + goto fail; + } ++ ret = PTR_ERR_OR_ZERO(devinfo->settings); ++ if (ret < 0) ++ goto fail; + + if (!brcmf_usb_dlneeded(devinfo)) { + ret = brcmf_alloc(devinfo->dev, devinfo->settings); diff --git a/package/kernel/mac80211/patches/brcm/061-v6.13-wifi-brcmfmac-add-flag-for-random-seed-during-firmware.patch b/package/kernel/mac80211/patches/brcm/061-v6.13-wifi-brcmfmac-add-flag-for-random-seed-during-firmware.patch new file mode 100644 index 00000000000..63455ba4b33 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/061-v6.13-wifi-brcmfmac-add-flag-for-random-seed-during-firmware.patch @@ -0,0 +1,170 @@ +From ea11a89c3ac64ada9d8b7f7de279cb6385ed194f Mon Sep 17 00:00:00 2001 +From: Jacobe Zang +Date: Tue, 10 Sep 2024 11:04:14 +0800 +Subject: [PATCH] wifi: brcmfmac: add flag for random seed during firmware + download + +Providing the random seed to firmware was tied to the fact that the +device has a valid OTP, which worked for some Apple chips. However, +it turns out the BCM43752 device also needs the random seed in order +to get firmware running. Suspect it is simply tied to the firmware +branch used for the device. Introducing a mechanism to allow setting +it for a device through the device table. + +Co-developed-by: Ondrej Jirman +Signed-off-by: Ondrej Jirman +Co-developed-by: Arend van Spriel +Signed-off-by: Arend van Spriel +Signed-off-by: Jacobe Zang +Reviewed-by: Sebastian Reichel +Tested-by: Sebastian Reichel # On RK3588 EVB1 +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +Link: https://patch.msgid.link/20240910-wireless-mainline-v14-4-9d80fea5326d@wesion.com +--- + .../broadcom/brcm80211/brcmfmac/pcie.c | 52 ++++++++++++++++--- + .../broadcom/brcm80211/include/brcm_hw_ids.h | 2 + + 2 files changed, 46 insertions(+), 8 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -66,6 +66,7 @@ BRCMF_FW_DEF(4365C, "brcmfmac4365c-pcie" + BRCMF_FW_DEF(4366B, "brcmfmac4366b-pcie"); + BRCMF_FW_DEF(4366C, "brcmfmac4366c-pcie"); + BRCMF_FW_DEF(4371, "brcmfmac4371-pcie"); ++BRCMF_FW_CLM_DEF(43752, "brcmfmac43752-pcie"); + BRCMF_FW_CLM_DEF(4377B3, "brcmfmac4377b3-pcie"); + BRCMF_FW_CLM_DEF(4378B1, "brcmfmac4378b1-pcie"); + BRCMF_FW_CLM_DEF(4378B3, "brcmfmac4378b3-pcie"); +@@ -104,6 +105,7 @@ static const struct brcmf_firmware_mappi + BRCMF_FW_ENTRY(BRCM_CC_43664_CHIP_ID, 0xFFFFFFF0, 4366C), + BRCMF_FW_ENTRY(BRCM_CC_43666_CHIP_ID, 0xFFFFFFF0, 4366C), + BRCMF_FW_ENTRY(BRCM_CC_4371_CHIP_ID, 0xFFFFFFFF, 4371), ++ BRCMF_FW_ENTRY(BRCM_CC_43752_CHIP_ID, 0xFFFFFFFF, 43752), + BRCMF_FW_ENTRY(BRCM_CC_4377_CHIP_ID, 0xFFFFFFFF, 4377B3), /* revision ID 4 */ + BRCMF_FW_ENTRY(BRCM_CC_4378_CHIP_ID, 0x0000000F, 4378B1), /* revision ID 3 */ + BRCMF_FW_ENTRY(BRCM_CC_4378_CHIP_ID, 0xFFFFFFE0, 4378B3), /* revision ID 5 */ +@@ -353,6 +355,7 @@ struct brcmf_pciedev_info { + u16 value); + struct brcmf_mp_device *settings; + struct brcmf_otp_params otp; ++ bool fwseed; + #ifdef DEBUG + u32 console_interval; + bool console_active; +@@ -1715,14 +1718,14 @@ static int brcmf_pcie_download_fw_nvram( + memcpy_toio(devinfo->tcm + address, nvram, nvram_len); + brcmf_fw_nvram_free(nvram); + +- if (devinfo->otp.valid) { ++ if (devinfo->fwseed) { + size_t rand_len = BRCMF_RANDOM_SEED_LENGTH; + struct brcmf_random_seed_footer footer = { + .length = cpu_to_le32(rand_len), + .magic = cpu_to_le32(BRCMF_RANDOM_SEED_MAGIC), + }; + +- /* Some Apple chips/firmwares expect a buffer of random ++ /* Some chips/firmwares expect a buffer of random + * data to be present before NVRAM + */ + brcmf_dbg(PCIE, "Download random seed\n"); +@@ -2394,6 +2397,37 @@ static void brcmf_pcie_debugfs_create(st + } + #endif + ++struct brcmf_pcie_drvdata { ++ enum brcmf_fwvendor vendor; ++ bool fw_seed; ++}; ++ ++enum { ++ BRCMF_DRVDATA_CYW, ++ BRCMF_DRVDATA_BCA, ++ BRCMF_DRVDATA_WCC, ++ BRCMF_DRVDATA_WCC_SEED, ++}; ++ ++static const struct brcmf_pcie_drvdata drvdata[] = { ++ [BRCMF_DRVDATA_CYW] = { ++ .vendor = BRCMF_FWVENDOR_CYW, ++ .fw_seed = false, ++ }, ++ [BRCMF_DRVDATA_BCA] = { ++ .vendor = BRCMF_FWVENDOR_BCA, ++ .fw_seed = false, ++ }, ++ [BRCMF_DRVDATA_WCC] = { ++ .vendor = BRCMF_FWVENDOR_WCC, ++ .fw_seed = false, ++ }, ++ [BRCMF_DRVDATA_WCC_SEED] = { ++ .vendor = BRCMF_FWVENDOR_WCC, ++ .fw_seed = true, ++ }, ++}; ++ + /* Forward declaration for pci_match_id() call */ + static const struct pci_device_id brcmf_pcie_devid_table[]; + +@@ -2475,9 +2509,10 @@ brcmf_pcie_probe(struct pci_dev *pdev, c + bus->bus_priv.pcie = pcie_bus_dev; + bus->ops = &brcmf_pcie_bus_ops; + bus->proto_type = BRCMF_PROTO_MSGBUF; +- bus->fwvid = id->driver_data; + bus->chip = devinfo->coreid; + bus->wowl_supported = pci_pme_capable(pdev, PCI_D3hot); ++ bus->fwvid = drvdata[id->driver_data].vendor; ++ devinfo->fwseed = drvdata[id->driver_data].fw_seed; + dev_set_drvdata(&pdev->dev, bus); + + ret = brcmf_alloc(&devinfo->pdev->dev, devinfo->settings); +@@ -2663,14 +2698,14 @@ static const struct dev_pm_ops brcmf_pci + BRCM_PCIE_VENDOR_ID_BROADCOM, (dev_id), \ + PCI_ANY_ID, PCI_ANY_ID, \ + PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, \ +- BRCMF_FWVENDOR_ ## fw_vend \ ++ BRCMF_DRVDATA_ ## fw_vend \ + } + #define BRCMF_PCIE_DEVICE_SUB(dev_id, subvend, subdev, fw_vend) \ + { \ + BRCM_PCIE_VENDOR_ID_BROADCOM, (dev_id), \ + (subvend), (subdev), \ + PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, \ +- BRCMF_FWVENDOR_ ## fw_vend \ ++ BRCMF_DRVDATA_ ## fw_vend \ + } + + static const struct pci_device_id brcmf_pcie_devid_table[] = { +@@ -2698,9 +2733,10 @@ static const struct pci_device_id brcmf_ + BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_5G_DEVICE_ID, BCA), + BRCMF_PCIE_DEVICE(BRCM_PCIE_4371_DEVICE_ID, WCC), + BRCMF_PCIE_DEVICE(BRCM_PCIE_43596_DEVICE_ID, CYW), +- BRCMF_PCIE_DEVICE(BRCM_PCIE_4377_DEVICE_ID, WCC), +- BRCMF_PCIE_DEVICE(BRCM_PCIE_4378_DEVICE_ID, WCC), +- BRCMF_PCIE_DEVICE(BRCM_PCIE_4387_DEVICE_ID, WCC), ++ BRCMF_PCIE_DEVICE(BRCM_PCIE_4377_DEVICE_ID, WCC_SEED), ++ BRCMF_PCIE_DEVICE(BRCM_PCIE_4378_DEVICE_ID, WCC_SEED), ++ BRCMF_PCIE_DEVICE(BRCM_PCIE_4387_DEVICE_ID, WCC_SEED), ++ BRCMF_PCIE_DEVICE(BRCM_PCIE_43752_DEVICE_ID, WCC_SEED), + + { /* end: all zeroes */ } + }; +--- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h ++++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h +@@ -52,6 +52,7 @@ + #define BRCM_CC_43664_CHIP_ID 43664 + #define BRCM_CC_43666_CHIP_ID 43666 + #define BRCM_CC_4371_CHIP_ID 0x4371 ++#define BRCM_CC_43752_CHIP_ID 43752 + #define BRCM_CC_4377_CHIP_ID 0x4377 + #define BRCM_CC_4378_CHIP_ID 0x4378 + #define BRCM_CC_4387_CHIP_ID 0x4387 +@@ -94,6 +95,7 @@ + #define BRCM_PCIE_4366_5G_DEVICE_ID 0x43c5 + #define BRCM_PCIE_4371_DEVICE_ID 0x440d + #define BRCM_PCIE_43596_DEVICE_ID 0x4415 ++#define BRCM_PCIE_43752_DEVICE_ID 0x449d + #define BRCM_PCIE_4377_DEVICE_ID 0x4488 + #define BRCM_PCIE_4378_DEVICE_ID 0x4425 + #define BRCM_PCIE_4387_DEVICE_ID 0x4433 diff --git a/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch b/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch index 1f0609e3488..143542dd739 100644 --- a/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch +++ b/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch @@ -12,7 +12,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c -@@ -65,6 +65,36 @@ static int brcmf_of_get_country_codes(st +@@ -66,6 +66,36 @@ static int brcmf_of_get_country_codes(st return 0; } @@ -46,15 +46,15 @@ Signed-off-by: Rafał Miłecki + } +} + - void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, - struct brcmf_mp_device *settings) + int brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, + struct brcmf_mp_device *settings) { -@@ -113,6 +143,8 @@ void brcmf_of_probe(struct device *dev, - } - of_node_put(root); +@@ -122,6 +152,8 @@ int brcmf_of_probe(struct device *dev, e + brcmf_dbg(INFO, "%s LPO clock\n", clk ? "enable" : "no"); + clk_set_rate(clk, 32768); + brcmf_of_probe_cc(dev, settings); + if (!np || !of_device_is_compatible(np, "brcm,bcm4329-fmac")) - return; + return 0; From f0df6e3a4a4996eca917fa17591b8f1d483dfa30 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 2 Jan 2025 14:08:36 +0100 Subject: [PATCH 035/173] ubus: update to Git HEAD (2025-01-02) d996988ae55b libubus: close file descriptor after sending it from a request afa57cce0aff libubus: add support for using channels Signed-off-by: Felix Fietkau --- package/system/ubus/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/system/ubus/Makefile b/package/system/ubus/Makefile index bef5e622d70..9a807852a25 100644 --- a/package/system/ubus/Makefile +++ b/package/system/ubus/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/ubus.git -PKG_SOURCE_DATE:=2024-10-20 -PKG_SOURCE_VERSION:=252a9b0c1774790fb9c25735d5a09c27dba895db -PKG_MIRROR_HASH:=72c21f02710d2314447670f1f1ea1833d2961f65fea3f9f94c060dda7c9d5914 +PKG_SOURCE_DATE:=2025-01-02 +PKG_SOURCE_VERSION:=afa57cce0aff82f4a7a0e509d4387ebc23dd3be7 +PKG_MIRROR_HASH:=a0b3c1961f5f49d31c34a44576ce44538c3ee97bfce97f86f732d7ecc1df9798 PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE)) CMAKE_INSTALL:=1 From 389dd8dcf6a21b608e6418ec48368f9615afa740 Mon Sep 17 00:00:00 2001 From: Tony Ambardar Date: Thu, 2 Jan 2025 00:47:14 -0800 Subject: [PATCH 036/173] strace: Update to version 6.12 Release Notes: https://github.com/strace/strace/releases/tag/v6.12 Signed-off-by: Tony Ambardar Link: https://github.com/openwrt/openwrt/pull/17457 Signed-off-by: Nick Hainke --- package/devel/strace/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/devel/strace/Makefile b/package/devel/strace/Makefile index f418bea5a72..892c05467e4 100644 --- a/package/devel/strace/Makefile +++ b/package/devel/strace/Makefile @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=strace -PKG_VERSION:=6.11 +PKG_VERSION:=6.12 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://strace.io/files/$(PKG_VERSION) -PKG_HASH:=83262583a3529f02c3501aa8b8ac772b4cbc03dc934e98bab6e4883626e283a5 +PKG_HASH:=c47da93be45b6055f4dc741d7f20efaf50ca10160a5b100c109b294fd9c0bdfe PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=LGPL-2.1-or-later From 89b2356b8c2fd420b49bacaa865fb9bd24173ecc Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 2 Jan 2025 06:34:15 -0500 Subject: [PATCH 037/173] kernel: bump 6.6 to 6.6.69 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.69 All patches automatically rebased. Build system: x86/64 Build-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17459 Signed-off-by: Nick Hainke --- include/kernel-6.6 | 4 ++-- ...dwc3-Set-DMA-and-coherent-masks-early.patch | 8 ++++---- ...chdog-mediatek-mt7988-add-wdt-support.patch | 18 +++++++++--------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index c2805b4540b..6cee9d1e8cb 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .68 -LINUX_KERNEL_HASH-6.6.68 = 283ff410e3f352ceed161ae30c0020301326059db03e86efcb384d46ac5840e2 +LINUX_VERSION-6.6 = .69 +LINUX_KERNEL_HASH-6.6.69 = 9c6305567b75d99514cde6eb9de39973f3d5c857a75bd9dcdfca57041f8d4f34 diff --git a/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch b/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch index fe77f212117..551bfccc750 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch @@ -68,7 +68,7 @@ Signed-off-by: Jonathan Bell select SOC_BRCMSTB if ARCH_BRCMSTB --- a/drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c +++ b/drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c -@@ -335,6 +335,36 @@ static void usb_init_common_7216(struct +@@ -341,6 +341,36 @@ static void usb_init_common_7216(struct usb_init_common(params); } @@ -105,7 +105,7 @@ Signed-off-by: Jonathan Bell static void usb_init_xhci(struct brcm_usb_init_params *params) { pr_debug("%s\n", __func__); -@@ -380,6 +410,18 @@ static void usb_uninit_common_7211b0(str +@@ -386,6 +416,18 @@ static void usb_uninit_common_7211b0(str } @@ -124,7 +124,7 @@ Signed-off-by: Jonathan Bell static void usb_uninit_xhci(struct brcm_usb_init_params *params) { -@@ -434,6 +476,16 @@ static const struct brcm_usb_init_ops bc +@@ -440,6 +482,16 @@ static const struct brcm_usb_init_ops bc .set_dual_select = usb_set_dual_select, }; @@ -141,7 +141,7 @@ Signed-off-by: Jonathan Bell void brcm_usb_dvr_init_7216(struct brcm_usb_init_params *params) { -@@ -451,3 +503,10 @@ void brcm_usb_dvr_init_7211b0(struct brc +@@ -457,3 +509,10 @@ void brcm_usb_dvr_init_7211b0(struct brc params->family_name = "7211"; params->ops = &bcm7211b0_ops; } diff --git a/target/linux/mediatek/patches-6.6/251-v6.8-watchdog-mediatek-mt7988-add-wdt-support.patch b/target/linux/mediatek/patches-6.6/251-v6.8-watchdog-mediatek-mt7988-add-wdt-support.patch index c399b768b00..984034125ca 100644 --- a/target/linux/mediatek/patches-6.6/251-v6.8-watchdog-mediatek-mt7988-add-wdt-support.patch +++ b/target/linux/mediatek/patches-6.6/251-v6.8-watchdog-mediatek-mt7988-add-wdt-support.patch @@ -18,7 +18,7 @@ Signed-off-by: Wim Van Sebroeck --- a/drivers/watchdog/mtk_wdt.c +++ b/drivers/watchdog/mtk_wdt.c -@@ -58,9 +58,13 @@ +@@ -59,9 +59,13 @@ #define WDT_SWSYSRST 0x18U #define WDT_SWSYS_RST_KEY 0x88000000 @@ -32,7 +32,7 @@ Signed-off-by: Wim Van Sebroeck static bool nowayout = WATCHDOG_NOWAYOUT; static unsigned int timeout; -@@ -71,10 +75,12 @@ struct mtk_wdt_dev { +@@ -72,10 +76,12 @@ struct mtk_wdt_dev { struct reset_controller_dev rcdev; bool disable_wdt_extrst; bool reset_by_toprgu; @@ -45,7 +45,7 @@ Signed-off-by: Wim Van Sebroeck }; static const struct mtk_wdt_data mt2712_data = { -@@ -89,6 +95,11 @@ static const struct mtk_wdt_data mt7986_ +@@ -94,6 +100,11 @@ static const struct mtk_wdt_data mt7986_ .toprgu_sw_rst_num = MT7986_TOPRGU_SW_RST_NUM, }; @@ -57,7 +57,7 @@ Signed-off-by: Wim Van Sebroeck static const struct mtk_wdt_data mt8183_data = { .toprgu_sw_rst_num = MT8183_TOPRGU_SW_RST_NUM, }; -@@ -109,6 +120,28 @@ static const struct mtk_wdt_data mt8195_ +@@ -114,6 +125,28 @@ static const struct mtk_wdt_data mt8195_ .toprgu_sw_rst_num = MT8195_TOPRGU_SW_RST_NUM, }; @@ -86,7 +86,7 @@ Signed-off-by: Wim Van Sebroeck static int toprgu_reset_update(struct reset_controller_dev *rcdev, unsigned long id, bool assert) { -@@ -119,6 +152,9 @@ static int toprgu_reset_update(struct re +@@ -124,6 +157,9 @@ static int toprgu_reset_update(struct re spin_lock_irqsave(&data->lock, flags); @@ -96,7 +96,7 @@ Signed-off-by: Wim Van Sebroeck tmp = readl(data->wdt_base + WDT_SWSYSRST); if (assert) tmp |= BIT(id); -@@ -127,6 +163,9 @@ static int toprgu_reset_update(struct re +@@ -132,6 +168,9 @@ static int toprgu_reset_update(struct re tmp |= WDT_SWSYS_RST_KEY; writel(tmp, data->wdt_base + WDT_SWSYSRST); @@ -106,7 +106,7 @@ Signed-off-by: Wim Van Sebroeck spin_unlock_irqrestore(&data->lock, flags); return 0; -@@ -412,6 +451,8 @@ static int mtk_wdt_probe(struct platform +@@ -417,6 +456,8 @@ static int mtk_wdt_probe(struct platform wdt_data->toprgu_sw_rst_num); if (err) return err; @@ -115,8 +115,8 @@ Signed-off-by: Wim Van Sebroeck } mtk_wdt->disable_wdt_extrst = -@@ -450,6 +491,7 @@ static const struct of_device_id mtk_wdt - { .compatible = "mediatek,mt6589-wdt" }, +@@ -456,6 +497,7 @@ static const struct of_device_id mtk_wdt + { .compatible = "mediatek,mt6735-wdt", .data = &mt6735_data }, { .compatible = "mediatek,mt6795-wdt", .data = &mt6795_data }, { .compatible = "mediatek,mt7986-wdt", .data = &mt7986_data }, + { .compatible = "mediatek,mt7988-wdt", .data = &mt7988_data }, From 0b54029a6e96bb2ce484f316be3870cc2617de30 Mon Sep 17 00:00:00 2001 From: James Sweeney Date: Thu, 2 Jan 2025 08:06:09 -0500 Subject: [PATCH 038/173] realtek: add 1920-24g-poe-180w to mac address Add 1920-24g-poe-180w to the mac address retrieval part of 02_network to properly set the device's port MAC addresses. This piece was missed when this device was added. Fixes: b948c1e39b9e ("realtek: add support for HPE 1920-24G PoE-180W (JG925A)") Link: https://github.com/openwrt/openwrt/pull/17460 Signed-off-by: James Sweeney --- target/linux/realtek/base-files/etc/board.d/02_network | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/realtek/base-files/etc/board.d/02_network b/target/linux/realtek/base-files/etc/board.d/02_network index 12fb33d85e0..1255ee8b9e1 100644 --- a/target/linux/realtek/base-files/etc/board.d/02_network +++ b/target/linux/realtek/base-files/etc/board.d/02_network @@ -36,6 +36,7 @@ hpe,1920-8g-poe-65w|\ hpe,1920-8g-poe-180w|\ hpe,1920-16g|\ hpe,1920-24g|\ +hpe,1920-24g-poe-180w|\ hpe,1920-24g-poe-370w|\ hpe,1920-48g|\ hpe,1920-48g-poe) From 65aff89f641f6adccac80ee73b02b99a904739d5 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 3 Jan 2025 11:06:08 +0100 Subject: [PATCH 039/173] mt76: update to Git HEAD (2025-01-03) 46715044ecd2 wifi: mt76: mt7996: implement driver specific get_txpower function 959a2d40007f wifi: mt76: mt7996: initialize phy txpower Signed-off-by: Felix Fietkau --- package/kernel/mt76/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index d7fd80d331b..d603b6215fd 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -8,9 +8,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/openwrt/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2024-12-30 -PKG_SOURCE_VERSION:=f8563589c72d93c35f9316c65de361061b785699 -PKG_MIRROR_HASH:=aba3906b44d7dc952add8786ab46a27512d04efbd3e6a7a40526707a2ff87445 +PKG_SOURCE_DATE:=2025-01-03 +PKG_SOURCE_VERSION:=959a2d40007f502d9465b8aede79e761f875abd3 +PKG_MIRROR_HASH:=a00a26a4685c053a639a95657804b09d0d4a1452744647871070beb6332b7c3a PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 From 1ceaac207b00bea90661c9f17639fa1fdc694ed5 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 3 Jan 2025 20:22:24 +0800 Subject: [PATCH 040/173] rockchip: refresh patches Signed-off-by: Tianling Shen --- ...ockchip-naneng-combphy-fix-phy-reset.patch | 37 ------------------- ...-GPU-scheduler-to-variable-number-of.patch | 2 +- ...d-property-to-disable-VLAN-hw-filter.patch | 2 +- ...ac-add-devname-configuration-from-OF.patch | 4 +- 4 files changed, 4 insertions(+), 41 deletions(-) delete mode 100644 target/linux/rockchip/patches-6.6/032-09-v6.13-phy-rockchip-naneng-combphy-fix-phy-reset.patch diff --git a/target/linux/rockchip/patches-6.6/032-09-v6.13-phy-rockchip-naneng-combphy-fix-phy-reset.patch b/target/linux/rockchip/patches-6.6/032-09-v6.13-phy-rockchip-naneng-combphy-fix-phy-reset.patch deleted file mode 100644 index 893023a24ca..00000000000 --- a/target/linux/rockchip/patches-6.6/032-09-v6.13-phy-rockchip-naneng-combphy-fix-phy-reset.patch +++ /dev/null @@ -1,37 +0,0 @@ -From fbcbffbac994aca1264e3c14da96ac9bfd90466e Mon Sep 17 00:00:00 2001 -From: Chukun Pan -Date: Fri, 22 Nov 2024 15:30:06 +0800 -Subject: [PATCH] phy: rockchip: naneng-combphy: fix phy reset - -Currently, the USB port via combophy on the RK3528/RK3588 SoC is broken. - - usb usb8-port1: Cannot enable. Maybe the USB cable is bad? - -This is due to the combphy of RK3528/RK3588 SoC has multiple resets, but -only "phy resets" need assert and deassert, "apb resets" don't need. -So change the driver to only match the phy resets, which is also what -the vendor kernel does. - -Fixes: 7160820d742a ("phy: rockchip: add naneng combo phy for RK3568") -Cc: FUKAUMI Naoki -Cc: Michael Zimmermann -Signed-off-by: Chukun Pan -Reviewed-by: Heiko Stuebner -Tested-by: FUKAUMI Naoki -Link: https://lore.kernel.org/r/20241122073006.99309-2-amadeus@jmu.edu.cn -Signed-off-by: Vinod Koul ---- - drivers/phy/rockchip/phy-rockchip-naneng-combphy.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c -+++ b/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c -@@ -309,7 +309,7 @@ static int rockchip_combphy_parse_dt(str - - priv->ext_refclk = device_property_present(dev, "rockchip,ext-refclk"); - -- priv->phy_rst = devm_reset_control_array_get_exclusive(dev); -+ priv->phy_rst = devm_reset_control_get(dev, "phy"); - if (IS_ERR(priv->phy_rst)) - return dev_err_probe(dev, PTR_ERR(priv->phy_rst), "failed to get phy reset\n"); - diff --git a/target/linux/rockchip/patches-6.6/034-20-v6.7-drm-sched-Convert-the-GPU-scheduler-to-variable-number-of.patch b/target/linux/rockchip/patches-6.6/034-20-v6.7-drm-sched-Convert-the-GPU-scheduler-to-variable-number-of.patch index 0a64ca42994..3bd04e355bf 100644 --- a/target/linux/rockchip/patches-6.6/034-20-v6.7-drm-sched-Convert-the-GPU-scheduler-to-variable-number-of.patch +++ b/target/linux/rockchip/patches-6.6/034-20-v6.7-drm-sched-Convert-the-GPU-scheduler-to-variable-number-of.patch @@ -63,7 +63,7 @@ Link: https://lore.kernel.org/r/20231023032251.164775-1-luben.tuikov@amd.com ring->sched_score, ring->name, --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c -@@ -327,8 +327,8 @@ void amdgpu_job_stop_all_jobs_on_sched(s +@@ -326,8 +326,8 @@ void amdgpu_job_stop_all_jobs_on_sched(s int i; /* Signal all jobs not yet scheduled */ diff --git a/target/linux/rockchip/patches-6.6/600-ethernet-stmmac-Add-property-to-disable-VLAN-hw-filter.patch b/target/linux/rockchip/patches-6.6/600-ethernet-stmmac-Add-property-to-disable-VLAN-hw-filter.patch index 261256cb51c..f2af29b4027 100644 --- a/target/linux/rockchip/patches-6.6/600-ethernet-stmmac-Add-property-to-disable-VLAN-hw-filter.patch +++ b/target/linux/rockchip/patches-6.6/600-ethernet-stmmac-Add-property-to-disable-VLAN-hw-filter.patch @@ -35,7 +35,7 @@ Signed-off-by: jensen --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -@@ -7541,7 +7541,7 @@ int stmmac_dvr_probe(struct device *devi +@@ -7542,7 +7542,7 @@ int stmmac_dvr_probe(struct device *devi #ifdef STMMAC_VLAN_TAG_USED /* Both mac100 and gmac support receive VLAN tag detection */ ndev->features |= NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX; diff --git a/target/linux/rockchip/patches-6.6/603-net-ethernet-stmmac-add-devname-configuration-from-OF.patch b/target/linux/rockchip/patches-6.6/603-net-ethernet-stmmac-add-devname-configuration-from-OF.patch index 2f16ebf8b43..5a617cca321 100644 --- a/target/linux/rockchip/patches-6.6/603-net-ethernet-stmmac-add-devname-configuration-from-OF.patch +++ b/target/linux/rockchip/patches-6.6/603-net-ethernet-stmmac-add-devname-configuration-from-OF.patch @@ -1,6 +1,6 @@ --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -@@ -7367,6 +7367,7 @@ int stmmac_dvr_probe(struct device *devi +@@ -7368,6 +7368,7 @@ int stmmac_dvr_probe(struct device *devi { struct net_device *ndev = NULL; struct stmmac_priv *priv; @@ -8,7 +8,7 @@ u32 rxq; int i, ret = 0; -@@ -7375,6 +7376,9 @@ int stmmac_dvr_probe(struct device *devi +@@ -7376,6 +7377,9 @@ int stmmac_dvr_probe(struct device *devi if (!ndev) return -ENOMEM; From b2b6955f80d05a8cec69f8497df8bed44cf3c64d Mon Sep 17 00:00:00 2001 From: Florian Maurer Date: Fri, 3 Jan 2025 13:28:42 +0100 Subject: [PATCH 041/173] ipq40xx: fix label MAC address for FritzBox 7520/7530 The MAC address of the GMAC is contained inside the CWMP-Account number on the label. Similar fix as to the 4040 in b22d382ae4eaa1af42930115d91855f402314cac Link #13240 Signed-off-by: Florian Maurer Link: https://github.com/openwrt/openwrt/pull/17467 Signed-off-by: Robert Marko --- .../arch/arm/boot/dts/qcom/qcom-ipq4019-fritzbox-7530.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzbox-7530.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzbox-7530.dts index 2344ae7bf89..4f6cafb8853 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzbox-7530.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzbox-7530.dts @@ -19,6 +19,7 @@ led-failsafe = &info_red; led-running = &power_green; led-upgrade = &info_red; + label-mac-device = &gmac; }; soc { From 8a477bafb4637e3499f69f569133039ce060559e Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 3 Jan 2025 20:37:41 +0800 Subject: [PATCH 042/173] rockchip: fix phy reset on rk356x The commit 7160820d742a ("phy: rockchip: naneng-combphy: fix phy reset") was backported to kernel 6.6 branch by upstream, however the correspond dtsi fixes was not, resulting the following error: ``` [ 0.225521] rockchip-naneng-combphy fe830000.phy: error -ENOENT: failed to get phy reset [ 0.227467] rockchip-naneng-combphy fe840000.phy: error -ENOENT: failed to get phy reset ``` So backport the dtsi fixes here manually. Fixes: 89b2356b8c2f ("kernel: bump 6.6 to 6.6.69") Signed-off-by: Tianling Shen Link: https://github.com/openwrt/openwrt/pull/17468 Signed-off-by: Robert Marko --- ...dd-reset-names-for-combphy-on-rk3568.patch | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 target/linux/rockchip/patches-6.6/016-v6.13-arm64-dts-rockchip-add-reset-names-for-combphy-on-rk3568.patch diff --git a/target/linux/rockchip/patches-6.6/016-v6.13-arm64-dts-rockchip-add-reset-names-for-combphy-on-rk3568.patch b/target/linux/rockchip/patches-6.6/016-v6.13-arm64-dts-rockchip-add-reset-names-for-combphy-on-rk3568.patch new file mode 100644 index 00000000000..7a8f86a46fd --- /dev/null +++ b/target/linux/rockchip/patches-6.6/016-v6.13-arm64-dts-rockchip-add-reset-names-for-combphy-on-rk3568.patch @@ -0,0 +1,44 @@ +From 8b9c12757f919157752646faf3821abf2b7d2a64 Mon Sep 17 00:00:00 2001 +From: Chukun Pan +Date: Fri, 22 Nov 2024 15:30:05 +0800 +Subject: [PATCH] arm64: dts: rockchip: add reset-names for combphy on rk3568 + +The reset-names of combphy are missing, add it. + +Signed-off-by: Chukun Pan +Fixes: fd3ac6e80497 ("dt-bindings: phy: rockchip: rk3588 has two reset lines") +Link: https://lore.kernel.org/r/20241122073006.99309-1-amadeus@jmu.edu.cn +Signed-off-by: Heiko Stuebner +--- + arch/arm64/boot/dts/rockchip/rk3568.dtsi | 1 + + arch/arm64/boot/dts/rockchip/rk356x-base.dtsi | 2 ++ + 2 files changed, 3 insertions(+) + +--- a/arch/arm64/boot/dts/rockchip/rk3568.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3568.dtsi +@@ -223,6 +223,7 @@ + assigned-clocks = <&pmucru CLK_PCIEPHY0_REF>; + assigned-clock-rates = <100000000>; + resets = <&cru SRST_PIPEPHY0>; ++ reset-names = "phy"; + rockchip,pipe-grf = <&pipegrf>; + rockchip,pipe-phy-grf = <&pipe_phy_grf0>; + #phy-cells = <1>; +--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi +@@ -1747,6 +1747,7 @@ + assigned-clocks = <&pmucru CLK_PCIEPHY1_REF>; + assigned-clock-rates = <100000000>; + resets = <&cru SRST_PIPEPHY1>; ++ reset-names = "phy"; + rockchip,pipe-grf = <&pipegrf>; + rockchip,pipe-phy-grf = <&pipe_phy_grf1>; + #phy-cells = <1>; +@@ -1763,6 +1764,7 @@ + assigned-clocks = <&pmucru CLK_PCIEPHY2_REF>; + assigned-clock-rates = <100000000>; + resets = <&cru SRST_PIPEPHY2>; ++ reset-names = "phy"; + rockchip,pipe-grf = <&pipegrf>; + rockchip,pipe-phy-grf = <&pipe_phy_grf2>; + #phy-cells = <1>; From 2b70b32aef9e8e1ff275872d551c610368079911 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 3 Jan 2025 20:22:13 +0100 Subject: [PATCH 043/173] kernel: add workaround for page_pool_release warnings defer_list skbs held by NAPI can block releasing page pools. Work around this by scheduling rx softirq on all CPUs while trying to release a page pool. Signed-off-by: Felix Fietkau --- ...y-to-free-deferred-skbs-while-waitin.patch | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 target/linux/generic/hack-6.6/610-net-page_pool-try-to-free-deferred-skbs-while-waitin.patch diff --git a/target/linux/generic/hack-6.6/610-net-page_pool-try-to-free-deferred-skbs-while-waitin.patch b/target/linux/generic/hack-6.6/610-net-page_pool-try-to-free-deferred-skbs-while-waitin.patch new file mode 100644 index 00000000000..36c28b94f60 --- /dev/null +++ b/target/linux/generic/hack-6.6/610-net-page_pool-try-to-free-deferred-skbs-while-waitin.patch @@ -0,0 +1,43 @@ +From: Felix Fietkau +Date: Fri, 3 Jan 2025 19:29:00 +0100 +Subject: [PATCH] net: page_pool: try to free deferred skbs while waiting for + pool release + +The NAPI defer list can accumulate no longer used skbs, which can be reused +during alloc. If this happens on a CPU that otherwise does not do any +rx softirq processing, skbs can be held indefinitely, causing warnings +on releasing page pools. +Deal with this by scheduling rx softirq on all CPUs. + +Patch by Lorenzo Bianconi + +Signed-off-by: Felix Fietkau +--- + +--- a/net/core/page_pool.c ++++ b/net/core/page_pool.c +@@ -862,12 +862,23 @@ static void page_pool_release_retry(stru + { + struct delayed_work *dwq = to_delayed_work(wq); + struct page_pool *pool = container_of(dwq, typeof(*pool), release_dw); +- int inflight; ++ int cpu, inflight; + + inflight = page_pool_release(pool); + if (!inflight) + return; + ++ /* Run NET_RX_SOFTIRQ in order to free pending skbs in softnet_data ++ * defer_list that can stay in the list until we have enough queued ++ * traffic. ++ */ ++ for_each_online_cpu(cpu) { ++ struct softnet_data *sd = &per_cpu(softnet_data, cpu); ++ ++ if (!cmpxchg(&sd->defer_ipi_scheduled, 0, 1)) ++ smp_call_function_single_async(cpu, &sd->defer_csd); ++ } ++ + /* Periodic warning */ + if (time_after_eq(jiffies, pool->defer_warn)) { + int sec = (s32)((u32)jiffies - (u32)pool->defer_start) / HZ; From fedb1f86b50986a962c899d7406566d991e030ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Mon, 30 Dec 2024 01:01:33 +0100 Subject: [PATCH 044/173] generic: 6.6: backport upstream Realtek PHY patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 8989bad54113 net: phy: realtek: add RTL8125D-internal PHY f87a17ed3b51 net: phy: realtek: merge the drivers for internal NBase-T PHY's Signed-off-by: Álvaro Fernández Rojas --- ...merge-the-drivers-for-internal-NBase.patch | 136 ++++++++++++++++++ ...hy-realtek-add-RTL8125D-internal-PHY.patch | 29 ++++ ...-use-genphy_soft_reset-for-2.5G-PHYs.patch | 18 +-- ...sable-SGMII-in-band-AN-for-2-5G-PHYs.patch | 4 +- ...make-sure-paged-read-is-protected-by.patch | 2 +- ...-phy-realtek-introduce-rtl822x_probe.patch | 14 +- ...tek-detect-early-version-of-RTL8221B.patch | 4 +- ...ealtek-support-interrupt-of-RTL8221B.patch | 10 +- 8 files changed, 191 insertions(+), 26 deletions(-) create mode 100644 target/linux/generic/backport-6.6/781-18-v6.13-net-phy-realtek-merge-the-drivers-for-internal-NBase.patch create mode 100644 target/linux/generic/backport-6.6/781-19-v6.13-net-phy-realtek-add-RTL8125D-internal-PHY.patch diff --git a/target/linux/generic/backport-6.6/781-18-v6.13-net-phy-realtek-merge-the-drivers-for-internal-NBase.patch b/target/linux/generic/backport-6.6/781-18-v6.13-net-phy-realtek-merge-the-drivers-for-internal-NBase.patch new file mode 100644 index 00000000000..771f60df91c --- /dev/null +++ b/target/linux/generic/backport-6.6/781-18-v6.13-net-phy-realtek-merge-the-drivers-for-internal-NBase.patch @@ -0,0 +1,136 @@ +From f87a17ed3b51fba4dfdd8f8b643b5423a85fc551 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Tue, 15 Oct 2024 07:47:14 +0200 +Subject: [PATCH] net: phy: realtek: merge the drivers for internal NBase-T + PHY's + +The Realtek RTL8125/RTL8126 NBase-T MAC/PHY chips have internal PHY's +which are register-compatible, at least for the registers we use here. +So let's use just one PHY driver to support all of them. +These internal PHY's exist also as external C45 PHY's, but on the +internal PHY's no access to MMD registers is possible. This can be +used to differentiate between the internal and external version. + +As a side effect the drivers for two now external-only drivers don't +require read_mmd/write_mmd hooks any longer. + +Signed-off-by: Heiner Kallweit +Link: https://patch.msgid.link/c57081a6-811f-4571-ab35-34f4ca6de9af@gmail.com +Signed-off-by: Paolo Abeni +--- + drivers/net/phy/realtek.c | 53 +++++++++++++++++++++++++++++++-------- + 1 file changed, 43 insertions(+), 10 deletions(-) + +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -95,6 +95,7 @@ + + #define RTL_GENERIC_PHYID 0x001cc800 + #define RTL_8211FVD_PHYID 0x001cc878 ++#define RTL_8221B 0x001cc840 + #define RTL_8221B_VB_CG 0x001cc849 + #define RTL_8221B_VN_CG 0x001cc84a + #define RTL_8251B 0x001cc862 +@@ -1077,6 +1078,23 @@ static bool rtlgen_supports_2_5gbps(stru + return val >= 0 && val & MDIO_PMA_SPEED_2_5G; + } + ++/* On internal PHY's MMD reads over C22 always return 0. ++ * Check a MMD register which is known to be non-zero. ++ */ ++static bool rtlgen_supports_mmd(struct phy_device *phydev) ++{ ++ int val; ++ ++ phy_lock_mdio_bus(phydev); ++ __phy_write(phydev, MII_MMD_CTRL, MDIO_MMD_PCS); ++ __phy_write(phydev, MII_MMD_DATA, MDIO_PCS_EEE_ABLE); ++ __phy_write(phydev, MII_MMD_CTRL, MDIO_MMD_PCS | MII_MMD_CTRL_NOINCR); ++ val = __phy_read(phydev, MII_MMD_DATA); ++ phy_unlock_mdio_bus(phydev); ++ ++ return val > 0; ++} ++ + static int rtlgen_match_phy_device(struct phy_device *phydev) + { + return phydev->phy_id == RTL_GENERIC_PHYID && +@@ -1086,7 +1104,8 @@ static int rtlgen_match_phy_device(struc + static int rtl8226_match_phy_device(struct phy_device *phydev) + { + return phydev->phy_id == RTL_GENERIC_PHYID && +- rtlgen_supports_2_5gbps(phydev); ++ rtlgen_supports_2_5gbps(phydev) && ++ rtlgen_supports_mmd(phydev); + } + + static int rtlgen_is_c45_match(struct phy_device *phydev, unsigned int id, +@@ -1098,6 +1117,11 @@ static int rtlgen_is_c45_match(struct ph + return !is_c45 && (id == phydev->phy_id); + } + ++static int rtl8221b_match_phy_device(struct phy_device *phydev) ++{ ++ return phydev->phy_id == RTL_8221B && rtlgen_supports_mmd(phydev); ++} ++ + static int rtl8221b_vb_cg_c22_match_phy_device(struct phy_device *phydev) + { + return rtlgen_is_c45_match(phydev, RTL_8221B_VB_CG, false); +@@ -1118,9 +1142,21 @@ static int rtl8221b_vn_cg_c45_match_phy_ + return rtlgen_is_c45_match(phydev, RTL_8221B_VN_CG, true); + } + +-static int rtl8251b_c22_match_phy_device(struct phy_device *phydev) ++static int rtl_internal_nbaset_match_phy_device(struct phy_device *phydev) + { +- return rtlgen_is_c45_match(phydev, RTL_8251B, false); ++ if (phydev->is_c45) ++ return false; ++ ++ switch (phydev->phy_id) { ++ case RTL_GENERIC_PHYID: ++ case RTL_8221B: ++ case RTL_8251B: ++ break; ++ default: ++ return false; ++ } ++ ++ return rtlgen_supports_2_5gbps(phydev) && !rtlgen_supports_mmd(phydev); + } + + static int rtl8251b_c45_match_phy_device(struct phy_device *phydev) +@@ -1382,10 +1418,8 @@ static struct phy_driver realtek_drvs[] + .resume = rtlgen_resume, + .read_page = rtl821x_read_page, + .write_page = rtl821x_write_page, +- .read_mmd = rtl822x_read_mmd, +- .write_mmd = rtl822x_write_mmd, + }, { +- PHY_ID_MATCH_EXACT(0x001cc840), ++ .match_phy_device = rtl8221b_match_phy_device, + .name = "RTL8226B_RTL8221B 2.5Gbps PHY", + .get_features = rtl822x_get_features, + .config_aneg = rtl822x_config_aneg, +@@ -1396,8 +1430,6 @@ static struct phy_driver realtek_drvs[] + .resume = rtlgen_resume, + .read_page = rtl821x_read_page, + .write_page = rtl821x_write_page, +- .read_mmd = rtl822x_read_mmd, +- .write_mmd = rtl822x_write_mmd, + }, { + PHY_ID_MATCH_EXACT(0x001cc838), + .name = "RTL8226-CG 2.5Gbps PHY", +@@ -1475,8 +1507,9 @@ static struct phy_driver realtek_drvs[] + .read_page = rtl821x_read_page, + .write_page = rtl821x_write_page, + }, { +- .match_phy_device = rtl8251b_c22_match_phy_device, +- .name = "RTL8126A-internal 5Gbps PHY", ++ .match_phy_device = rtl_internal_nbaset_match_phy_device, ++ .name = "Realtek Internal NBASE-T PHY", ++ .flags = PHY_IS_INTERNAL, + .get_features = rtl822x_get_features, + .config_aneg = rtl822x_config_aneg, + .read_status = rtl822x_read_status, diff --git a/target/linux/generic/backport-6.6/781-19-v6.13-net-phy-realtek-add-RTL8125D-internal-PHY.patch b/target/linux/generic/backport-6.6/781-19-v6.13-net-phy-realtek-add-RTL8125D-internal-PHY.patch new file mode 100644 index 00000000000..4b9b9e8d48b --- /dev/null +++ b/target/linux/generic/backport-6.6/781-19-v6.13-net-phy-realtek-add-RTL8125D-internal-PHY.patch @@ -0,0 +1,29 @@ +From 8989bad541133c43550bff2b80edbe37b8fb9659 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Thu, 17 Oct 2024 18:01:13 +0200 +Subject: [PATCH] net: phy: realtek: add RTL8125D-internal PHY + +The first boards show up with Realtek's RTL8125D. This MAC/PHY chip +comes with an integrated 2.5Gbps PHY with ID 0x001cc841. It's not +clear yet whether there's an external version of this PHY and how +Realtek calls it, therefore use the numeric id for now. + +Link: https://lore.kernel.org/netdev/2ada65e1-5dfa-456c-9334-2bc51272e9da@gmail.com/T/ +Signed-off-by: Heiner Kallweit +Message-ID: <7d2924de-053b-44d2-a479-870dc3878170@gmail.com> +Reviewed-by: Andrew Lunn +Signed-off-by: Andrew Lunn +--- + drivers/net/phy/realtek.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -1151,6 +1151,7 @@ static int rtl_internal_nbaset_match_phy + case RTL_GENERIC_PHYID: + case RTL_8221B: + case RTL_8251B: ++ case 0x001cc841: + break; + default: + return false; diff --git a/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch b/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch index 2b77b6e02f9..8de57707a26 100644 --- a/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch +++ b/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch @@ -15,7 +15,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c -@@ -1375,6 +1375,7 @@ static struct phy_driver realtek_drvs[] +@@ -1412,6 +1412,7 @@ static struct phy_driver realtek_drvs[] }, { .name = "RTL8226 2.5Gbps PHY", .match_phy_device = rtl8226_match_phy_device, @@ -23,15 +23,15 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, -@@ -1387,6 +1388,7 @@ static struct phy_driver realtek_drvs[] +@@ -1422,6 +1423,7 @@ static struct phy_driver realtek_drvs[] }, { - PHY_ID_MATCH_EXACT(0x001cc840), + .match_phy_device = rtl8221b_match_phy_device, .name = "RTL8226B_RTL8221B 2.5Gbps PHY", + .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .config_init = rtl822xb_config_init, -@@ -1401,6 +1403,7 @@ static struct phy_driver realtek_drvs[] +@@ -1434,6 +1436,7 @@ static struct phy_driver realtek_drvs[] }, { PHY_ID_MATCH_EXACT(0x001cc838), .name = "RTL8226-CG 2.5Gbps PHY", @@ -39,7 +39,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, -@@ -1411,6 +1414,7 @@ static struct phy_driver realtek_drvs[] +@@ -1444,6 +1447,7 @@ static struct phy_driver realtek_drvs[] }, { PHY_ID_MATCH_EXACT(0x001cc848), .name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY", @@ -47,7 +47,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .config_init = rtl822xb_config_init, -@@ -1423,6 +1427,7 @@ static struct phy_driver realtek_drvs[] +@@ -1456,6 +1460,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", @@ -55,7 +55,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .config_init = rtl822xb_config_init, -@@ -1435,6 +1440,7 @@ static struct phy_driver realtek_drvs[] +@@ -1468,6 +1473,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", @@ -63,7 +63,7 @@ Signed-off-by: Daniel Golle .config_init = rtl822xb_config_init, .get_rate_matching = rtl822xb_get_rate_matching, .get_features = rtl822x_c45_get_features, -@@ -1445,6 +1451,7 @@ static struct phy_driver realtek_drvs[] +@@ -1478,6 +1484,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", @@ -71,7 +71,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .config_init = rtl822xb_config_init, -@@ -1457,6 +1464,7 @@ static struct phy_driver realtek_drvs[] +@@ -1490,6 +1497,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", diff --git a/target/linux/generic/pending-6.6/720-02-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch b/target/linux/generic/pending-6.6/720-02-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch index cbef74d317b..7e48c16515d 100644 --- a/target/linux/generic/pending-6.6/720-02-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch +++ b/target/linux/generic/pending-6.6/720-02-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch @@ -20,7 +20,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c -@@ -814,8 +814,8 @@ static int rtl822x_write_mmd(struct phy_ +@@ -815,8 +815,8 @@ static int rtl822x_write_mmd(struct phy_ static int rtl822xb_config_init(struct phy_device *phydev) { bool has_2500, has_sgmii; @@ -30,7 +30,7 @@ Signed-off-by: Daniel Golle has_2500 = test_bit(PHY_INTERFACE_MODE_2500BASEX, phydev->host_interfaces) || -@@ -865,7 +865,29 @@ static int rtl822xb_config_init(struct p +@@ -866,7 +866,29 @@ static int rtl822xb_config_init(struct p if (ret < 0) return ret; diff --git a/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch b/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch index 216fa918e1f..722ec02cdce 100644 --- a/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch +++ b/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch @@ -18,7 +18,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c -@@ -1092,9 +1092,11 @@ static bool rtlgen_supports_2_5gbps(stru +@@ -1093,9 +1093,11 @@ static bool rtlgen_supports_2_5gbps(stru { int val; diff --git a/target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_probe.patch b/target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_probe.patch index 08c13f34e44..1b9cdada6db 100644 --- a/target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_probe.patch +++ b/target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_probe.patch @@ -24,7 +24,7 @@ Signed-off-by: Daniel Golle #define RTL8366RB_POWER_SAVE 0x15 #define RTL8366RB_POWER_SAVE_ON BIT(12) -@@ -1152,6 +1156,25 @@ static int rtl8251b_c45_match_phy_device +@@ -1189,6 +1193,25 @@ static int rtl8251b_c45_match_phy_device return rtlgen_is_c45_match(phydev, RTL_8251B, true); } @@ -50,7 +50,7 @@ Signed-off-by: Daniel Golle static int rtlgen_resume(struct phy_device *phydev) { int ret = genphy_resume(phydev); -@@ -1427,6 +1450,7 @@ static struct phy_driver realtek_drvs[] +@@ -1460,6 +1483,7 @@ static struct phy_driver realtek_drvs[] }, { PHY_ID_MATCH_EXACT(0x001cc838), .name = "RTL8226-CG 2.5Gbps PHY", @@ -58,7 +58,7 @@ Signed-off-by: Daniel Golle .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1438,6 +1462,7 @@ static struct phy_driver realtek_drvs[] +@@ -1471,6 +1495,7 @@ static struct phy_driver realtek_drvs[] }, { PHY_ID_MATCH_EXACT(0x001cc848), .name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY", @@ -66,7 +66,7 @@ Signed-off-by: Daniel Golle .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1451,6 +1476,7 @@ static struct phy_driver realtek_drvs[] +@@ -1484,6 +1509,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", @@ -74,7 +74,7 @@ Signed-off-by: Daniel Golle .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1464,6 +1490,7 @@ static struct phy_driver realtek_drvs[] +@@ -1497,6 +1523,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", @@ -82,7 +82,7 @@ Signed-off-by: Daniel Golle .soft_reset = genphy_soft_reset, .config_init = rtl822xb_config_init, .get_rate_matching = rtl822xb_get_rate_matching, -@@ -1475,6 +1502,7 @@ static struct phy_driver realtek_drvs[] +@@ -1508,6 +1535,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", @@ -90,7 +90,7 @@ Signed-off-by: Daniel Golle .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1488,6 +1516,7 @@ static struct phy_driver realtek_drvs[] +@@ -1521,6 +1549,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", diff --git a/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch b/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch index 6938552d14d..63ffd0a0c93 100644 --- a/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch +++ b/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch @@ -14,7 +14,7 @@ Signed-off-by: Daniel Golle Signed-off-by: Mieczyslaw Nalewaj --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c -@@ -1120,10 +1120,32 @@ static int rtl8226_match_phy_device(stru +@@ -1139,10 +1139,32 @@ static int rtl8226_match_phy_device(stru static int rtlgen_is_c45_match(struct phy_device *phydev, unsigned int id, bool is_c45) { @@ -49,4 +49,4 @@ Signed-off-by: Mieczyslaw Nalewaj + } } - static int rtl8221b_vb_cg_c22_match_phy_device(struct phy_device *phydev) + static int rtl8221b_match_phy_device(struct phy_device *phydev) diff --git a/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch b/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch index a796b8f011d..c9e15fb4630 100644 --- a/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch +++ b/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch @@ -12,7 +12,7 @@ Signed-off-by: Jianhui Zhao --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c -@@ -1332,6 +1332,51 @@ static irqreturn_t rtl9000a_handle_inter +@@ -1369,6 +1369,51 @@ static irqreturn_t rtl9000a_handle_inter return IRQ_HANDLED; } @@ -64,7 +64,7 @@ Signed-off-by: Jianhui Zhao static struct phy_driver realtek_drvs[] = { { PHY_ID_MATCH_EXACT(0x00008201), -@@ -1498,6 +1543,8 @@ static struct phy_driver realtek_drvs[] +@@ -1531,6 +1576,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", @@ -73,7 +73,7 @@ Signed-off-by: Jianhui Zhao .probe = rtl822x_probe, .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, -@@ -1512,6 +1559,8 @@ static struct phy_driver realtek_drvs[] +@@ -1545,6 +1592,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", @@ -82,7 +82,7 @@ Signed-off-by: Jianhui Zhao .probe = rtl822x_probe, .soft_reset = genphy_soft_reset, .config_init = rtl822xb_config_init, -@@ -1524,6 +1573,8 @@ static struct phy_driver realtek_drvs[] +@@ -1557,6 +1606,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", @@ -91,7 +91,7 @@ Signed-off-by: Jianhui Zhao .probe = rtl822x_probe, .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, -@@ -1538,6 +1589,8 @@ static struct phy_driver realtek_drvs[] +@@ -1571,6 +1622,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", From 0eeba04a16fb72b13d90973ef8ba95f0549f973e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Mon, 30 Dec 2024 01:01:33 +0100 Subject: [PATCH 045/173] generic: 6.6: backport upstream r8169 patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 7a3bcd39ae1f r8169: use helper r8169_mod_reg8_cond to simplify rtl_jumbo_config e3e9e9039fa6 r8169: align WAKE_PHY handling with r8125/r8126 vendor drivers 330dc2297c82 r8169: improve rtl_set_d3_pll_down c507e96b5763 r8169: improve __rtl8169_set_wol 83cb4b470c66 r8169: remove leftover locks after reverted change 2cd02f2fdd8a r8169: improve initialization of RSS registers on RTL8125/RTL8126 a3d8520e6a19 r8169: align RTL8126 EEE config with vendor driver 4af2f60bf737 r8169: align RTL8125/RTL8126 PHY config with vendor driver eb90f876b796 r8169: align RTL8125 EEE config with vendor driver b8bd8c44a266 r8169: fix inconsistent indenting in rtl8169_get_eth_mac_stats f75d1fbe7809 r8169: add support for RTL8125D c4e64095c00c r8169: enable EEE at 2.5G per default on RTL8125B d64113c6bb5e r8169: remove rtl_dash_loop_wait_high/low 1c105bacb160 r8169: avoid duplicated messages if loading firmware fails and switch to warn level ac48430368c1 r8169: don't take RTNL lock in rtl_task() e3fc5139bd8f r8169: implement additional ethtool stats ops b8bf38440ba9 r8169: enable SG/TSO on selected chip versions per default 854d71c555df r8169: remove original workaround for RTL8125 broken rx issue 1ffcc8d41306 r8169: add support for the temperature sensor being available from RTL8125B The following patches require backporting additional linux patches: e2015942e90a r8169: replace custom flag with disable_work() et al e340bff27e63 r8169: copy vendor driver 2.5G/5G EEE advertisement constraints Signed-off-by: Álvaro Fernández Rojas --- package/kernel/linux/modules/netdevices.mk | 2 +- ...t-for-the-temperature-sensor-being-a.patch | 83 ++++++++++ ...ginal-workaround-for-RTL8125-broken-.patch | 33 ++++ ...TSO-on-selected-chip-versions-per-de.patch | 52 +++++++ ...plement-additional-ethtool-stats-ops.patch | 130 ++++++++++++++++ ...169-don-t-take-RTNL-lock-in-rtl_task.patch | 50 ++++++ ...icated-messages-if-loading-firmware-.patch | 41 +++++ ...9-remove-rtl_dash_loop_wait_high-low.patch | 82 ++++++++++ ...-EEE-at-2.5G-per-default-on-RTL8125B.patch | 28 ++++ ...v6.13-r8169-add-support-for-RTL8125D.patch | 143 ++++++++++++++++++ ...istent-indenting-in-rtl8169_get_eth_.patch | 30 ++++ ...TL8125-EEE-config-with-vendor-driver.patch | 49 ++++++ ...125-RTL8126-PHY-config-with-vendor-d.patch | 46 ++++++ ...TL8126-EEE-config-with-vendor-driver.patch | 25 +++ ...itialization-of-RSS-registers-on-RTL.patch | 38 +++++ ...leftover-locks-after-reverted-change.patch | 113 ++++++++++++++ ...6.13-r8169-improve-__rtl8169_set_wol.patch | 108 +++++++++++++ ...13-r8169-improve-rtl_set_d3_pll_down.patch | 44 ++++++ ..._PHY-handling-with-r8125-r8126-vendo.patch | 29 ++++ ...-r8169_mod_reg8_cond-to-simplify-rtl.patch | 117 ++++++++++++++ 20 files changed, 1242 insertions(+), 1 deletion(-) create mode 100644 target/linux/generic/backport-6.6/780-24-v6.13-r8169-add-support-for-the-temperature-sensor-being-a.patch create mode 100644 target/linux/generic/backport-6.6/780-25-v6.13-r8169-remove-original-workaround-for-RTL8125-broken-.patch create mode 100644 target/linux/generic/backport-6.6/780-26-v6.13-r8169-enable-SG-TSO-on-selected-chip-versions-per-de.patch create mode 100644 target/linux/generic/backport-6.6/780-27-v6.13-r8169-implement-additional-ethtool-stats-ops.patch create mode 100644 target/linux/generic/backport-6.6/780-28-v6.13-r8169-don-t-take-RTNL-lock-in-rtl_task.patch create mode 100644 target/linux/generic/backport-6.6/780-30-v6.13-r8169-avoid-duplicated-messages-if-loading-firmware-.patch create mode 100644 target/linux/generic/backport-6.6/780-31-v6.13-r8169-remove-rtl_dash_loop_wait_high-low.patch create mode 100644 target/linux/generic/backport-6.6/780-32-v6.13-r8169-enable-EEE-at-2.5G-per-default-on-RTL8125B.patch create mode 100644 target/linux/generic/backport-6.6/780-33-v6.13-r8169-add-support-for-RTL8125D.patch create mode 100644 target/linux/generic/backport-6.6/780-34-v6.13-r8169-fix-inconsistent-indenting-in-rtl8169_get_eth_.patch create mode 100644 target/linux/generic/backport-6.6/780-35-v6.13-r8169-align-RTL8125-EEE-config-with-vendor-driver.patch create mode 100644 target/linux/generic/backport-6.6/780-36-v6.13-r8169-align-RTL8125-RTL8126-PHY-config-with-vendor-d.patch create mode 100644 target/linux/generic/backport-6.6/780-37-v6.13-r8169-align-RTL8126-EEE-config-with-vendor-driver.patch create mode 100644 target/linux/generic/backport-6.6/780-38-v6.13-r8169-improve-initialization-of-RSS-registers-on-RTL.patch create mode 100644 target/linux/generic/backport-6.6/780-39-v6.13-r8169-remove-leftover-locks-after-reverted-change.patch create mode 100644 target/linux/generic/backport-6.6/780-40-v6.13-r8169-improve-__rtl8169_set_wol.patch create mode 100644 target/linux/generic/backport-6.6/780-41-v6.13-r8169-improve-rtl_set_d3_pll_down.patch create mode 100644 target/linux/generic/backport-6.6/780-42-v6.13-r8169-align-WAKE_PHY-handling-with-r8125-r8126-vendo.patch create mode 100644 target/linux/generic/backport-6.6/780-43-v6.13-r8169-use-helper-r8169_mod_reg8_cond-to-simplify-rtl.patch diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index 097bea7f50d..dc256237e97 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -970,7 +970,7 @@ $(eval $(call KernelPackage,8139cp)) define KernelPackage/r8169 SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=RealTek RTL-8169 PCI Gigabit Ethernet Adapter kernel support - DEPENDS:=@PCI_SUPPORT +kmod-mii +r8169-firmware +kmod-phy-realtek +kmod-mdio-devres + DEPENDS:=@PCI_SUPPORT +kmod-mii +r8169-firmware +kmod-phy-realtek +kmod-mdio-devres +kmod-hwmon-core KCONFIG:= \ CONFIG_R8169 \ CONFIG_R8169_LEDS=y diff --git a/target/linux/generic/backport-6.6/780-24-v6.13-r8169-add-support-for-the-temperature-sensor-being-a.patch b/target/linux/generic/backport-6.6/780-24-v6.13-r8169-add-support-for-the-temperature-sensor-being-a.patch new file mode 100644 index 00000000000..2403da5d555 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-24-v6.13-r8169-add-support-for-the-temperature-sensor-being-a.patch @@ -0,0 +1,83 @@ +From 1ffcc8d41306fd2e5f140b276820714a26a11cc4 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Mon, 7 Oct 2024 20:34:12 +0200 +Subject: [PATCH] r8169: add support for the temperature sensor being available + from RTL8125B + +This adds support for the temperature sensor being available from +RTL8125B. Register information was taken from r8125 vendor driver. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/realtek/r8169_main.c | 44 +++++++++++++++++++++++ + 1 file changed, 44 insertions(+) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -16,6 +16,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -5373,6 +5374,43 @@ static bool rtl_aspm_is_safe(struct rtl8 + return false; + } + ++static umode_t r8169_hwmon_is_visible(const void *drvdata, ++ enum hwmon_sensor_types type, ++ u32 attr, int channel) ++{ ++ return 0444; ++} ++ ++static int r8169_hwmon_read(struct device *dev, enum hwmon_sensor_types type, ++ u32 attr, int channel, long *val) ++{ ++ struct rtl8169_private *tp = dev_get_drvdata(dev); ++ int val_raw; ++ ++ val_raw = phy_read_paged(tp->phydev, 0xbd8, 0x12) & 0x3ff; ++ if (val_raw >= 512) ++ val_raw -= 1024; ++ ++ *val = 1000 * val_raw / 2; ++ ++ return 0; ++} ++ ++static const struct hwmon_ops r8169_hwmon_ops = { ++ .is_visible = r8169_hwmon_is_visible, ++ .read = r8169_hwmon_read, ++}; ++ ++static const struct hwmon_channel_info * const r8169_hwmon_info[] = { ++ HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT), ++ NULL ++}; ++ ++static const struct hwmon_chip_info r8169_hwmon_chip_info = { ++ .ops = &r8169_hwmon_ops, ++ .info = r8169_hwmon_info, ++}; ++ + static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) + { + struct rtl8169_private *tp; +@@ -5547,6 +5585,12 @@ static int rtl_init_one(struct pci_dev * + if (rc) + return rc; + ++ /* The temperature sensor is available from RTl8125B */ ++ if (IS_REACHABLE(CONFIG_HWMON) && tp->mac_version >= RTL_GIGA_MAC_VER_63) ++ /* ignore errors */ ++ devm_hwmon_device_register_with_info(&pdev->dev, "nic_temp", tp, ++ &r8169_hwmon_chip_info, ++ NULL); + rc = register_netdev(dev); + if (rc) + return rc; diff --git a/target/linux/generic/backport-6.6/780-25-v6.13-r8169-remove-original-workaround-for-RTL8125-broken-.patch b/target/linux/generic/backport-6.6/780-25-v6.13-r8169-remove-original-workaround-for-RTL8125-broken-.patch new file mode 100644 index 00000000000..8c6e6d8dc41 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-25-v6.13-r8169-remove-original-workaround-for-RTL8125-broken-.patch @@ -0,0 +1,33 @@ +From 854d71c555dfc3383c1fde7d9989b6046e21093d Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Wed, 9 Oct 2024 07:48:05 +0200 +Subject: [PATCH] r8169: remove original workaround for RTL8125 broken rx issue + +Now that we have b9c7ac4fe22c ("r8169: disable ALDPS per default for +RTL8125"), the first attempt to fix the issue shouldn't be needed +any longer. So let's effectively revert 621735f59064 ("r8169: fix +rare issue with broken rx after link-down on RTL8125") and see +whether anybody complains. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/382d8c88-cbce-400f-ad62-fda0181c7e38@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 4 ---- + 1 file changed, 4 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -4779,11 +4779,7 @@ static void r8169_phylink_handler(struct + if (netif_carrier_ok(ndev)) { + rtl_link_chg_patch(tp); + pm_request_resume(d); +- netif_wake_queue(tp->dev); + } else { +- /* In few cases rx is broken after link-down otherwise */ +- if (rtl_is_8125(tp)) +- rtl_schedule_task(tp, RTL_FLAG_TASK_RESET_NO_QUEUE_WAKE); + pm_runtime_idle(d); + } + diff --git a/target/linux/generic/backport-6.6/780-26-v6.13-r8169-enable-SG-TSO-on-selected-chip-versions-per-de.patch b/target/linux/generic/backport-6.6/780-26-v6.13-r8169-enable-SG-TSO-on-selected-chip-versions-per-de.patch new file mode 100644 index 00000000000..dc05299628e --- /dev/null +++ b/target/linux/generic/backport-6.6/780-26-v6.13-r8169-enable-SG-TSO-on-selected-chip-versions-per-de.patch @@ -0,0 +1,52 @@ +From b8bf38440ba94e8ed8e2ae55c5dfb0276d30e843 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Thu, 10 Oct 2024 12:58:02 +0200 +Subject: [PATCH] r8169: enable SG/TSO on selected chip versions per default + +Due to problem reports in the past SG and TSO/TSO6 are disabled per +default. It's not fully clear which chip versions are affected, so we +may impact also users of unaffected chip versions, unless they know +how to use ethtool for enabling SG/TSO/TSO6. +Vendor drivers r8168/r8125 enable SG/TSO/TSO6 for selected chip +versions per default, I'd interpret this as confirmation that these +chip versions are unaffected. So let's do the same here. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/realtek/r8169_main.c | 16 +++++++++++----- + 1 file changed, 11 insertions(+), 5 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -5529,11 +5529,6 @@ static int rtl_init_one(struct pci_dev * + + dev->features |= dev->hw_features; + +- /* There has been a number of reports that using SG/TSO results in +- * tx timeouts. However for a lot of people SG/TSO works fine. +- * Therefore disable both features by default, but allow users to +- * enable them. Use at own risk! +- */ + if (rtl_chip_supports_csum_v2(tp)) { + dev->hw_features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6; + netif_set_tso_max_size(dev, RTL_GSO_MAX_SIZE_V2); +@@ -5544,6 +5539,17 @@ static int rtl_init_one(struct pci_dev * + netif_set_tso_max_segs(dev, RTL_GSO_MAX_SEGS_V1); + } + ++ /* There has been a number of reports that using SG/TSO results in ++ * tx timeouts. However for a lot of people SG/TSO works fine. ++ * It's not fully clear which chip versions are affected. Vendor ++ * drivers enable SG/TSO for certain chip versions per default, ++ * let's mimic this here. On other chip versions users can ++ * use ethtool to enable SG/TSO, use at own risk! ++ */ ++ if (tp->mac_version >= RTL_GIGA_MAC_VER_46 && ++ tp->mac_version != RTL_GIGA_MAC_VER_61) ++ dev->features |= dev->hw_features; ++ + dev->hw_features |= NETIF_F_RXALL; + dev->hw_features |= NETIF_F_RXFCS; + diff --git a/target/linux/generic/backport-6.6/780-27-v6.13-r8169-implement-additional-ethtool-stats-ops.patch b/target/linux/generic/backport-6.6/780-27-v6.13-r8169-implement-additional-ethtool-stats-ops.patch new file mode 100644 index 00000000000..faab0df7f40 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-27-v6.13-r8169-implement-additional-ethtool-stats-ops.patch @@ -0,0 +1,130 @@ +From e3fc5139bd8ffaa1498adc21be4e8ecbc6aed508 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Sun, 13 Oct 2024 11:17:39 +0200 +Subject: [PATCH] r8169: implement additional ethtool stats ops + +This adds support for ethtool standard statistics, and makes use of the +extended hardware statistics being available from RTl8125. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/58e0da73-a7dd-4be3-82ae-d5b3f9069bde@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 82 +++++++++++++++++++++++ + 1 file changed, 82 insertions(+) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -2162,6 +2162,19 @@ static void rtl8169_get_ringparam(struct + data->tx_pending = NUM_TX_DESC; + } + ++static void rtl8169_get_pause_stats(struct net_device *dev, ++ struct ethtool_pause_stats *pause_stats) ++{ ++ struct rtl8169_private *tp = netdev_priv(dev); ++ ++ if (!rtl_is_8125(tp)) ++ return; ++ ++ rtl8169_update_counters(tp); ++ pause_stats->tx_pause_frames = le32_to_cpu(tp->counters->tx_pause_on); ++ pause_stats->rx_pause_frames = le32_to_cpu(tp->counters->rx_pause_on); ++} ++ + static void rtl8169_get_pauseparam(struct net_device *dev, + struct ethtool_pauseparam *data) + { +@@ -2188,6 +2201,69 @@ static int rtl8169_set_pauseparam(struct + return 0; + } + ++static void rtl8169_get_eth_mac_stats(struct net_device *dev, ++ struct ethtool_eth_mac_stats *mac_stats) ++{ ++ struct rtl8169_private *tp = netdev_priv(dev); ++ ++ rtl8169_update_counters(tp); ++ ++ mac_stats->FramesTransmittedOK = ++ le64_to_cpu(tp->counters->tx_packets); ++ mac_stats->SingleCollisionFrames = ++ le32_to_cpu(tp->counters->tx_one_collision); ++ mac_stats->MultipleCollisionFrames = ++ le32_to_cpu(tp->counters->tx_multi_collision); ++ mac_stats->FramesReceivedOK = ++ le64_to_cpu(tp->counters->rx_packets); ++ mac_stats->AlignmentErrors = ++ le16_to_cpu(tp->counters->align_errors); ++ mac_stats->FramesLostDueToIntMACXmitError = ++ le64_to_cpu(tp->counters->tx_errors); ++ mac_stats->BroadcastFramesReceivedOK = ++ le64_to_cpu(tp->counters->rx_broadcast); ++ mac_stats->MulticastFramesReceivedOK = ++ le32_to_cpu(tp->counters->rx_multicast); ++ ++ if (!rtl_is_8125(tp)) ++ return; ++ ++ mac_stats->AlignmentErrors = ++ le32_to_cpu(tp->counters->align_errors32); ++ mac_stats->OctetsTransmittedOK = ++ le64_to_cpu(tp->counters->tx_octets); ++ mac_stats->LateCollisions = ++ le32_to_cpu(tp->counters->tx_late_collision); ++ mac_stats->FramesAbortedDueToXSColls = ++ le32_to_cpu(tp->counters->tx_aborted32); ++ mac_stats->OctetsReceivedOK = ++ le64_to_cpu(tp->counters->rx_octets); ++ mac_stats->FramesLostDueToIntMACRcvError = ++ le32_to_cpu(tp->counters->rx_mac_error); ++ mac_stats->MulticastFramesXmittedOK = ++ le64_to_cpu(tp->counters->tx_multicast64); ++ mac_stats->BroadcastFramesXmittedOK = ++ le64_to_cpu(tp->counters->tx_broadcast64); ++ mac_stats->MulticastFramesReceivedOK = ++ le64_to_cpu(tp->counters->rx_multicast64); ++ mac_stats->FrameTooLongErrors = ++ le32_to_cpu(tp->counters->rx_frame_too_long); ++} ++ ++static void rtl8169_get_eth_ctrl_stats(struct net_device *dev, ++ struct ethtool_eth_ctrl_stats *ctrl_stats) ++{ ++ struct rtl8169_private *tp = netdev_priv(dev); ++ ++ if (!rtl_is_8125(tp)) ++ return; ++ ++ rtl8169_update_counters(tp); ++ ++ ctrl_stats->UnsupportedOpcodesReceived = ++ le32_to_cpu(tp->counters->rx_unknown_opcode); ++} ++ + static const struct ethtool_ops rtl8169_ethtool_ops = { + .supported_coalesce_params = ETHTOOL_COALESCE_USECS | + ETHTOOL_COALESCE_MAX_FRAMES, +@@ -2209,8 +2285,11 @@ static const struct ethtool_ops rtl8169_ + .get_link_ksettings = phy_ethtool_get_link_ksettings, + .set_link_ksettings = phy_ethtool_set_link_ksettings, + .get_ringparam = rtl8169_get_ringparam, ++ .get_pause_stats = rtl8169_get_pause_stats, + .get_pauseparam = rtl8169_get_pauseparam, + .set_pauseparam = rtl8169_set_pauseparam, ++ .get_eth_mac_stats = rtl8169_get_eth_mac_stats, ++ .get_eth_ctrl_stats = rtl8169_get_eth_ctrl_stats, + }; + + static enum mac_version rtl8169_get_mac_version(u16 xid, bool gmii) +@@ -3895,6 +3974,9 @@ static void rtl_hw_start_8125(struct rtl + break; + } + ++ /* enable extended tally counter */ ++ r8168_mac_ocp_modify(tp, 0xea84, 0, BIT(1) | BIT(0)); ++ + rtl_hw_config(tp); + } + diff --git a/target/linux/generic/backport-6.6/780-28-v6.13-r8169-don-t-take-RTNL-lock-in-rtl_task.patch b/target/linux/generic/backport-6.6/780-28-v6.13-r8169-don-t-take-RTNL-lock-in-rtl_task.patch new file mode 100644 index 00000000000..38b5035441f --- /dev/null +++ b/target/linux/generic/backport-6.6/780-28-v6.13-r8169-don-t-take-RTNL-lock-in-rtl_task.patch @@ -0,0 +1,50 @@ +From ac48430368c1a4f4e6c2fa92243b4b93fd25bee4 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Wed, 16 Oct 2024 22:05:57 +0200 +Subject: [PATCH] r8169: don't take RTNL lock in rtl_task() + +There's not really a benefit here in taking the RTNL lock. The task +handler does exception handling only, so we're in trouble anyway when +we come here, and there's no need to protect against e.g. a parallel +ethtool call. +A benefit of removing the RTNL lock here is that we now can +synchronously cancel the workqueue from a context holding the RTNL mutex. + +Signed-off-by: Heiner Kallweit +Signed-off-by: Andrew Lunn +--- + drivers/net/ethernet/realtek/r8169_main.c | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -4802,10 +4802,8 @@ static void rtl_task(struct work_struct + container_of(work, struct rtl8169_private, wk.work); + int ret; + +- rtnl_lock(); +- + if (!test_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags)) +- goto out_unlock; ++ return; + + if (test_and_clear_bit(RTL_FLAG_TASK_TX_TIMEOUT, tp->wk.flags)) { + /* if chip isn't accessible, reset bus to revive it */ +@@ -4814,7 +4812,7 @@ static void rtl_task(struct work_struct + if (ret < 0) { + netdev_err(tp->dev, "Can't reset secondary PCI bus, detach NIC\n"); + netif_device_detach(tp->dev); +- goto out_unlock; ++ return; + } + } + +@@ -4833,8 +4831,6 @@ reset: + } else if (test_and_clear_bit(RTL_FLAG_TASK_RESET_NO_QUEUE_WAKE, tp->wk.flags)) { + rtl_reset_work(tp); + } +-out_unlock: +- rtnl_unlock(); + } + + static int rtl8169_poll(struct napi_struct *napi, int budget) diff --git a/target/linux/generic/backport-6.6/780-30-v6.13-r8169-avoid-duplicated-messages-if-loading-firmware-.patch b/target/linux/generic/backport-6.6/780-30-v6.13-r8169-avoid-duplicated-messages-if-loading-firmware-.patch new file mode 100644 index 00000000000..6430d32252b --- /dev/null +++ b/target/linux/generic/backport-6.6/780-30-v6.13-r8169-avoid-duplicated-messages-if-loading-firmware-.patch @@ -0,0 +1,41 @@ +From 1c105bacb160b5918e917ab811552b7be69fc69c Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Wed, 16 Oct 2024 22:29:39 +0200 +Subject: [PATCH] r8169: avoid duplicated messages if loading firmware fails + and switch to warn level + +In case of a problem with firmware loading we inform at the driver level, +in addition the firmware load code itself issues warnings. Therefore +switch to firmware_request_nowarn() to avoid duplicated error messages. +In addition switch to warn level because the firmware is optional and +typically just fixes compatibility issues. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Message-ID: +Signed-off-by: Andrew Lunn +--- + drivers/net/ethernet/realtek/r8169_firmware.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_firmware.c ++++ b/drivers/net/ethernet/realtek/r8169_firmware.c +@@ -215,7 +215,7 @@ int rtl_fw_request_firmware(struct rtl_f + { + int rc; + +- rc = request_firmware(&rtl_fw->fw, rtl_fw->fw_name, rtl_fw->dev); ++ rc = firmware_request_nowarn(&rtl_fw->fw, rtl_fw->fw_name, rtl_fw->dev); + if (rc < 0) + goto out; + +@@ -227,7 +227,7 @@ int rtl_fw_request_firmware(struct rtl_f + + return 0; + out: +- dev_err(rtl_fw->dev, "Unable to load firmware %s (%d)\n", +- rtl_fw->fw_name, rc); ++ dev_warn(rtl_fw->dev, "Unable to load firmware %s (%d)\n", ++ rtl_fw->fw_name, rc); + return rc; + } diff --git a/target/linux/generic/backport-6.6/780-31-v6.13-r8169-remove-rtl_dash_loop_wait_high-low.patch b/target/linux/generic/backport-6.6/780-31-v6.13-r8169-remove-rtl_dash_loop_wait_high-low.patch new file mode 100644 index 00000000000..4792e371b63 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-31-v6.13-r8169-remove-rtl_dash_loop_wait_high-low.patch @@ -0,0 +1,82 @@ +From d64113c6bb5ea5a70b7c9c3a6bcadef307638187 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Wed, 16 Oct 2024 22:31:10 +0200 +Subject: [PATCH] r8169: remove rtl_dash_loop_wait_high/low + +Remove rtl_dash_loop_wait_high/low to simplify the code. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Message-ID: +Signed-off-by: Andrew Lunn +--- + drivers/net/ethernet/realtek/r8169_main.c | 35 ++++++----------------- + 1 file changed, 8 insertions(+), 27 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -1347,40 +1347,19 @@ static void rtl8168ep_stop_cmac(struct r + RTL_W8(tp, IBCR0, RTL_R8(tp, IBCR0) & ~0x01); + } + +-static void rtl_dash_loop_wait(struct rtl8169_private *tp, +- const struct rtl_cond *c, +- unsigned long usecs, int n, bool high) +-{ +- if (!tp->dash_enabled) +- return; +- rtl_loop_wait(tp, c, usecs, n, high); +-} +- +-static void rtl_dash_loop_wait_high(struct rtl8169_private *tp, +- const struct rtl_cond *c, +- unsigned long d, int n) +-{ +- rtl_dash_loop_wait(tp, c, d, n, true); +-} +- +-static void rtl_dash_loop_wait_low(struct rtl8169_private *tp, +- const struct rtl_cond *c, +- unsigned long d, int n) +-{ +- rtl_dash_loop_wait(tp, c, d, n, false); +-} +- + static void rtl8168dp_driver_start(struct rtl8169_private *tp) + { + r8168dp_oob_notify(tp, OOB_CMD_DRIVER_START); +- rtl_dash_loop_wait_high(tp, &rtl_dp_ocp_read_cond, 10000, 10); ++ if (tp->dash_enabled) ++ rtl_loop_wait_high(tp, &rtl_dp_ocp_read_cond, 10000, 10); + } + + static void rtl8168ep_driver_start(struct rtl8169_private *tp) + { + r8168ep_ocp_write(tp, 0x01, 0x180, OOB_CMD_DRIVER_START); + r8168ep_ocp_write(tp, 0x01, 0x30, r8168ep_ocp_read(tp, 0x30) | 0x01); +- rtl_dash_loop_wait_high(tp, &rtl_ep_ocp_read_cond, 10000, 30); ++ if (tp->dash_enabled) ++ rtl_loop_wait_high(tp, &rtl_ep_ocp_read_cond, 10000, 30); + } + + static void rtl8168_driver_start(struct rtl8169_private *tp) +@@ -1394,7 +1373,8 @@ static void rtl8168_driver_start(struct + static void rtl8168dp_driver_stop(struct rtl8169_private *tp) + { + r8168dp_oob_notify(tp, OOB_CMD_DRIVER_STOP); +- rtl_dash_loop_wait_low(tp, &rtl_dp_ocp_read_cond, 10000, 10); ++ if (tp->dash_enabled) ++ rtl_loop_wait_low(tp, &rtl_dp_ocp_read_cond, 10000, 10); + } + + static void rtl8168ep_driver_stop(struct rtl8169_private *tp) +@@ -1402,7 +1382,8 @@ static void rtl8168ep_driver_stop(struct + rtl8168ep_stop_cmac(tp); + r8168ep_ocp_write(tp, 0x01, 0x180, OOB_CMD_DRIVER_STOP); + r8168ep_ocp_write(tp, 0x01, 0x30, r8168ep_ocp_read(tp, 0x30) | 0x01); +- rtl_dash_loop_wait_low(tp, &rtl_ep_ocp_read_cond, 10000, 10); ++ if (tp->dash_enabled) ++ rtl_loop_wait_low(tp, &rtl_ep_ocp_read_cond, 10000, 10); + } + + static void rtl8168_driver_stop(struct rtl8169_private *tp) diff --git a/target/linux/generic/backport-6.6/780-32-v6.13-r8169-enable-EEE-at-2.5G-per-default-on-RTL8125B.patch b/target/linux/generic/backport-6.6/780-32-v6.13-r8169-enable-EEE-at-2.5G-per-default-on-RTL8125B.patch new file mode 100644 index 00000000000..4ec06cc6019 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-32-v6.13-r8169-enable-EEE-at-2.5G-per-default-on-RTL8125B.patch @@ -0,0 +1,28 @@ +From c4e64095c00cb2de413cd6b90be047c273bcd491 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Thu, 17 Oct 2024 22:27:44 +0200 +Subject: [PATCH] r8169: enable EEE at 2.5G per default on RTL8125B + +Register a6d/12 is shadowing register MDIO_AN_EEE_ADV2. So this line +disables advertisement of EEE at 2.5G. Latest vendor driver r8125 +doesn't do this (any longer?), so this mode seems to be safe. +EEE saves quite some energy, therefore enable this mode per default. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Message-ID: <95dd5a0c-09ea-4847-94d9-b7aa3063e8ff@gmail.com> +Signed-off-by: Andrew Lunn +--- + drivers/net/ethernet/realtek/r8169_phy_config.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/net/ethernet/realtek/r8169_phy_config.c ++++ b/drivers/net/ethernet/realtek/r8169_phy_config.c +@@ -99,7 +99,6 @@ static void rtl8125a_config_eee_phy(stru + + static void rtl8125b_config_eee_phy(struct phy_device *phydev) + { +- phy_modify_paged(phydev, 0xa6d, 0x12, 0x0001, 0x0000); + phy_modify_paged(phydev, 0xa6d, 0x14, 0x0010, 0x0000); + phy_modify_paged(phydev, 0xa42, 0x14, 0x0080, 0x0000); + phy_modify_paged(phydev, 0xa4a, 0x11, 0x0200, 0x0000); diff --git a/target/linux/generic/backport-6.6/780-33-v6.13-r8169-add-support-for-RTL8125D.patch b/target/linux/generic/backport-6.6/780-33-v6.13-r8169-add-support-for-RTL8125D.patch new file mode 100644 index 00000000000..81058e5e9f7 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-33-v6.13-r8169-add-support-for-RTL8125D.patch @@ -0,0 +1,143 @@ +From f75d1fbe7809bc5ed134204b920fd9e2fc5db1df Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Thu, 24 Oct 2024 22:42:33 +0200 +Subject: [PATCH] r8169: add support for RTL8125D + +This adds support for new chip version RTL8125D, which can be found on +boards like Gigabyte X870E AORUS ELITE WIFI7. Firmware rtl8125d-1.fw +for this chip version is available in linux-firmware already. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/d0306912-e88e-4c25-8b5d-545ae8834c0c@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169.h | 1 + + drivers/net/ethernet/realtek/r8169_main.c | 23 +++++++++++++------ + .../net/ethernet/realtek/r8169_phy_config.c | 10 ++++++++ + 3 files changed, 27 insertions(+), 7 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169.h ++++ b/drivers/net/ethernet/realtek/r8169.h +@@ -68,6 +68,7 @@ enum mac_version { + /* support for RTL_GIGA_MAC_VER_60 has been removed */ + RTL_GIGA_MAC_VER_61, + RTL_GIGA_MAC_VER_63, ++ RTL_GIGA_MAC_VER_64, + RTL_GIGA_MAC_VER_65, + RTL_GIGA_MAC_VER_66, + RTL_GIGA_MAC_NONE +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -56,6 +56,7 @@ + #define FIRMWARE_8107E_2 "rtl_nic/rtl8107e-2.fw" + #define FIRMWARE_8125A_3 "rtl_nic/rtl8125a-3.fw" + #define FIRMWARE_8125B_2 "rtl_nic/rtl8125b-2.fw" ++#define FIRMWARE_8125D_1 "rtl_nic/rtl8125d-1.fw" + #define FIRMWARE_8126A_2 "rtl_nic/rtl8126a-2.fw" + #define FIRMWARE_8126A_3 "rtl_nic/rtl8126a-3.fw" + +@@ -139,6 +140,7 @@ static const struct { + [RTL_GIGA_MAC_VER_61] = {"RTL8125A", FIRMWARE_8125A_3}, + /* reserve 62 for CFG_METHOD_4 in the vendor driver */ + [RTL_GIGA_MAC_VER_63] = {"RTL8125B", FIRMWARE_8125B_2}, ++ [RTL_GIGA_MAC_VER_64] = {"RTL8125D", FIRMWARE_8125D_1}, + [RTL_GIGA_MAC_VER_65] = {"RTL8126A", FIRMWARE_8126A_2}, + [RTL_GIGA_MAC_VER_66] = {"RTL8126A", FIRMWARE_8126A_3}, + }; +@@ -708,6 +710,7 @@ MODULE_FIRMWARE(FIRMWARE_8168FP_3); + MODULE_FIRMWARE(FIRMWARE_8107E_2); + MODULE_FIRMWARE(FIRMWARE_8125A_3); + MODULE_FIRMWARE(FIRMWARE_8125B_2); ++MODULE_FIRMWARE(FIRMWARE_8125D_1); + MODULE_FIRMWARE(FIRMWARE_8126A_2); + MODULE_FIRMWARE(FIRMWARE_8126A_3); + +@@ -2080,10 +2083,7 @@ static void rtl_set_eee_txidle_timer(str + tp->tx_lpi_timer = timer_val; + r8168_mac_ocp_write(tp, 0xe048, timer_val); + break; +- case RTL_GIGA_MAC_VER_61: +- case RTL_GIGA_MAC_VER_63: +- case RTL_GIGA_MAC_VER_65: +- case RTL_GIGA_MAC_VER_66: ++ case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_66: + tp->tx_lpi_timer = timer_val; + RTL_W16(tp, EEE_TXIDLE_TIMER_8125, timer_val); + break; +@@ -2295,6 +2295,9 @@ static enum mac_version rtl8169_get_mac_ + { 0x7cf, 0x64a, RTL_GIGA_MAC_VER_66 }, + { 0x7cf, 0x649, RTL_GIGA_MAC_VER_65 }, + ++ /* 8125D family. */ ++ { 0x7cf, 0x688, RTL_GIGA_MAC_VER_64 }, ++ + /* 8125B family. */ + { 0x7cf, 0x641, RTL_GIGA_MAC_VER_63 }, + +@@ -2562,9 +2565,7 @@ static void rtl_init_rxcfg(struct rtl816 + case RTL_GIGA_MAC_VER_61: + RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST); + break; +- case RTL_GIGA_MAC_VER_63: +- case RTL_GIGA_MAC_VER_65: +- case RTL_GIGA_MAC_VER_66: ++ case RTL_GIGA_MAC_VER_63 ... RTL_GIGA_MAC_VER_66: + RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST | + RX_PAUSE_SLOT_ON); + break; +@@ -3876,6 +3877,12 @@ static void rtl_hw_start_8125b(struct rt + rtl_hw_start_8125_common(tp); + } + ++static void rtl_hw_start_8125d(struct rtl8169_private *tp) ++{ ++ rtl_set_def_aspm_entry_latency(tp); ++ rtl_hw_start_8125_common(tp); ++} ++ + static void rtl_hw_start_8126a(struct rtl8169_private *tp) + { + rtl_set_def_aspm_entry_latency(tp); +@@ -3924,6 +3931,7 @@ static void rtl_hw_config(struct rtl8169 + [RTL_GIGA_MAC_VER_53] = rtl_hw_start_8117, + [RTL_GIGA_MAC_VER_61] = rtl_hw_start_8125a_2, + [RTL_GIGA_MAC_VER_63] = rtl_hw_start_8125b, ++ [RTL_GIGA_MAC_VER_64] = rtl_hw_start_8125d, + [RTL_GIGA_MAC_VER_65] = rtl_hw_start_8126a, + [RTL_GIGA_MAC_VER_66] = rtl_hw_start_8126a, + }; +@@ -3941,6 +3949,7 @@ static void rtl_hw_start_8125(struct rtl + /* disable interrupt coalescing */ + switch (tp->mac_version) { + case RTL_GIGA_MAC_VER_61: ++ case RTL_GIGA_MAC_VER_64: + for (i = 0xa00; i < 0xb00; i += 4) + RTL_W32(tp, i, 0); + break; +--- a/drivers/net/ethernet/realtek/r8169_phy_config.c ++++ b/drivers/net/ethernet/realtek/r8169_phy_config.c +@@ -1103,6 +1103,15 @@ static void rtl8125b_hw_phy_config(struc + rtl8125b_config_eee_phy(phydev); + } + ++static void rtl8125d_hw_phy_config(struct rtl8169_private *tp, ++ struct phy_device *phydev) ++{ ++ r8169_apply_firmware(tp); ++ rtl8125_legacy_force_mode(phydev); ++ rtl8168g_disable_aldps(phydev); ++ rtl8125b_config_eee_phy(phydev); ++} ++ + static void rtl8126a_hw_phy_config(struct rtl8169_private *tp, + struct phy_device *phydev) + { +@@ -1159,6 +1168,7 @@ void r8169_hw_phy_config(struct rtl8169_ + [RTL_GIGA_MAC_VER_53] = rtl8117_hw_phy_config, + [RTL_GIGA_MAC_VER_61] = rtl8125a_2_hw_phy_config, + [RTL_GIGA_MAC_VER_63] = rtl8125b_hw_phy_config, ++ [RTL_GIGA_MAC_VER_64] = rtl8125d_hw_phy_config, + [RTL_GIGA_MAC_VER_65] = rtl8126a_hw_phy_config, + [RTL_GIGA_MAC_VER_66] = rtl8126a_hw_phy_config, + }; diff --git a/target/linux/generic/backport-6.6/780-34-v6.13-r8169-fix-inconsistent-indenting-in-rtl8169_get_eth_.patch b/target/linux/generic/backport-6.6/780-34-v6.13-r8169-fix-inconsistent-indenting-in-rtl8169_get_eth_.patch new file mode 100644 index 00000000000..721e51ebf05 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-34-v6.13-r8169-fix-inconsistent-indenting-in-rtl8169_get_eth_.patch @@ -0,0 +1,30 @@ +From b8bd8c44a266c9a7dcb907eab10fbb119e3f6494 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Thu, 24 Oct 2024 22:48:59 +0200 +Subject: [PATCH] r8169: fix inconsistent indenting in + rtl8169_get_eth_mac_stats + +This fixes an inconsistent indenting introduced with e3fc5139bd8f +("r8169: implement additional ethtool stats ops"). + +Reported-by: kernel test robot +Closes: https://lore.kernel.org/oe-kbuild-all/202410220413.1gAxIJ4t-lkp@intel.com/ +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/20fd6f39-3c1b-4af0-9adc-7d1f49728fad@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -2227,7 +2227,7 @@ static void rtl8169_get_eth_mac_stats(st + le64_to_cpu(tp->counters->tx_broadcast64); + mac_stats->MulticastFramesReceivedOK = + le64_to_cpu(tp->counters->rx_multicast64); +- mac_stats->FrameTooLongErrors = ++ mac_stats->FrameTooLongErrors = + le32_to_cpu(tp->counters->rx_frame_too_long); + } + diff --git a/target/linux/generic/backport-6.6/780-35-v6.13-r8169-align-RTL8125-EEE-config-with-vendor-driver.patch b/target/linux/generic/backport-6.6/780-35-v6.13-r8169-align-RTL8125-EEE-config-with-vendor-driver.patch new file mode 100644 index 00000000000..de2be0165c2 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-35-v6.13-r8169-align-RTL8125-EEE-config-with-vendor-driver.patch @@ -0,0 +1,49 @@ +From eb90f876b7961d702d7fc549e14614860f531e60 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Thu, 31 Oct 2024 22:42:52 +0100 +Subject: [PATCH] r8169: align RTL8125 EEE config with vendor driver + +Align the EEE config for RTL8125A/RTL8125B with vendor driver r8125. +This should help to avoid compatibility issues. + +Signed-off-by: Heiner Kallweit +Link: https://patch.msgid.link/044c925e-8669-4b98-87df-95b4056f4f5f@gmail.com +Signed-off-by: Jakub Kicinski +--- + .../net/ethernet/realtek/r8169_phy_config.c | 18 ++++++++++++------ + 1 file changed, 12 insertions(+), 6 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_phy_config.c ++++ b/drivers/net/ethernet/realtek/r8169_phy_config.c +@@ -89,19 +89,25 @@ static void rtl8168h_config_eee_phy(stru + phy_modify_paged(phydev, 0xa42, 0x14, 0x0000, 0x0080); + } + +-static void rtl8125a_config_eee_phy(struct phy_device *phydev) ++static void rtl8125_common_config_eee_phy(struct phy_device *phydev) + { +- rtl8168h_config_eee_phy(phydev); ++ phy_modify_paged(phydev, 0xa6d, 0x14, 0x0010, 0x0000); ++ phy_modify_paged(phydev, 0xa42, 0x14, 0x0080, 0x0000); ++ phy_modify_paged(phydev, 0xa4a, 0x11, 0x0200, 0x0000); ++} + ++static void rtl8125a_config_eee_phy(struct phy_device *phydev) ++{ ++ rtl8168g_config_eee_phy(phydev); ++ /* disable EEE at 2.5Gbps */ + phy_modify_paged(phydev, 0xa6d, 0x12, 0x0001, 0x0000); +- phy_modify_paged(phydev, 0xa6d, 0x14, 0x0010, 0x0000); ++ rtl8125_common_config_eee_phy(phydev); + } + + static void rtl8125b_config_eee_phy(struct phy_device *phydev) + { +- phy_modify_paged(phydev, 0xa6d, 0x14, 0x0010, 0x0000); +- phy_modify_paged(phydev, 0xa42, 0x14, 0x0080, 0x0000); +- phy_modify_paged(phydev, 0xa4a, 0x11, 0x0200, 0x0000); ++ rtl8168g_config_eee_phy(phydev); ++ rtl8125_common_config_eee_phy(phydev); + } + + static void rtl8169s_hw_phy_config(struct rtl8169_private *tp, diff --git a/target/linux/generic/backport-6.6/780-36-v6.13-r8169-align-RTL8125-RTL8126-PHY-config-with-vendor-d.patch b/target/linux/generic/backport-6.6/780-36-v6.13-r8169-align-RTL8125-RTL8126-PHY-config-with-vendor-d.patch new file mode 100644 index 00000000000..a546c426b49 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-36-v6.13-r8169-align-RTL8125-RTL8126-PHY-config-with-vendor-d.patch @@ -0,0 +1,46 @@ +From 4af2f60bf7378bd5c92b15a528d8c6c7d02bed6c Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Thu, 31 Oct 2024 22:43:45 +0100 +Subject: [PATCH] r8169: align RTL8125/RTL8126 PHY config with vendor driver + +This aligns some parameters with vendor driver r8125/r8126 to avoid +compatibility issues. Note that for RTL8125B there's no functional +change, just the open-coded version of the function is replaced. + +Signed-off-by: Heiner Kallweit +Link: https://patch.msgid.link/a8a9d896-fbe6-41f2-bf87-666567d3cdb3@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_phy_config.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/realtek/r8169_phy_config.c ++++ b/drivers/net/ethernet/realtek/r8169_phy_config.c +@@ -1073,8 +1073,8 @@ static void rtl8125b_hw_phy_config(struc + struct phy_device *phydev) + { + r8169_apply_firmware(tp); ++ rtl8168g_enable_gphy_10m(phydev); + +- phy_modify_paged(phydev, 0xa44, 0x11, 0x0000, 0x0800); + phy_modify_paged(phydev, 0xac4, 0x13, 0x00f0, 0x0090); + phy_modify_paged(phydev, 0xad3, 0x10, 0x0003, 0x0001); + +@@ -1113,6 +1113,7 @@ static void rtl8125d_hw_phy_config(struc + struct phy_device *phydev) + { + r8169_apply_firmware(tp); ++ rtl8168g_enable_gphy_10m(phydev); + rtl8125_legacy_force_mode(phydev); + rtl8168g_disable_aldps(phydev); + rtl8125b_config_eee_phy(phydev); +@@ -1122,6 +1123,9 @@ static void rtl8126a_hw_phy_config(struc + struct phy_device *phydev) + { + r8169_apply_firmware(tp); ++ rtl8168g_enable_gphy_10m(phydev); ++ rtl8125_legacy_force_mode(phydev); ++ rtl8168g_disable_aldps(phydev); + } + + void r8169_hw_phy_config(struct rtl8169_private *tp, struct phy_device *phydev, diff --git a/target/linux/generic/backport-6.6/780-37-v6.13-r8169-align-RTL8126-EEE-config-with-vendor-driver.patch b/target/linux/generic/backport-6.6/780-37-v6.13-r8169-align-RTL8126-EEE-config-with-vendor-driver.patch new file mode 100644 index 00000000000..36c8041c94e --- /dev/null +++ b/target/linux/generic/backport-6.6/780-37-v6.13-r8169-align-RTL8126-EEE-config-with-vendor-driver.patch @@ -0,0 +1,25 @@ +From a3d8520e6a19ab018da6c7fc22512c913697a829 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Thu, 31 Oct 2024 22:44:36 +0100 +Subject: [PATCH] r8169: align RTL8126 EEE config with vendor driver + +Align the EEE config for RTL8126A with vendor driver r8126 to avoid +compatibility issues. + +Signed-off-by: Heiner Kallweit +Link: https://patch.msgid.link/71e4859e-4cd0-4b6b-b7fa-621d7721992f@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_phy_config.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/ethernet/realtek/r8169_phy_config.c ++++ b/drivers/net/ethernet/realtek/r8169_phy_config.c +@@ -1126,6 +1126,7 @@ static void rtl8126a_hw_phy_config(struc + rtl8168g_enable_gphy_10m(phydev); + rtl8125_legacy_force_mode(phydev); + rtl8168g_disable_aldps(phydev); ++ rtl8125_common_config_eee_phy(phydev); + } + + void r8169_hw_phy_config(struct rtl8169_private *tp, struct phy_device *phydev, diff --git a/target/linux/generic/backport-6.6/780-38-v6.13-r8169-improve-initialization-of-RSS-registers-on-RTL.patch b/target/linux/generic/backport-6.6/780-38-v6.13-r8169-improve-initialization-of-RSS-registers-on-RTL.patch new file mode 100644 index 00000000000..8cb79c82cf3 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-38-v6.13-r8169-improve-initialization-of-RSS-registers-on-RTL.patch @@ -0,0 +1,38 @@ +From 2cd02f2fdd8a92e5b6b85ff64eab0fc549b30c07 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Sat, 2 Nov 2024 14:49:01 +0100 +Subject: [PATCH] r8169: improve initialization of RSS registers on + RTL8125/RTL8126 + +Replace the register addresses with the names used in r8125/r8126 +vendor driver, and consider that RSS_CTRL_8125 is a 32 bit register. + +Signed-off-by: Heiner Kallweit +Link: https://patch.msgid.link/3bf2f340-b369-4174-97bf-fd38d4217492@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -347,6 +347,8 @@ enum rtl8125_registers { + TxPoll_8125 = 0x90, + LEDSEL3 = 0x96, + MAC0_BKP = 0x19e0, ++ RSS_CTRL_8125 = 0x4500, ++ Q_NUM_CTRL_8125 = 0x4800, + EEE_TXIDLE_TIMER_8125 = 0x6048, + }; + +@@ -3770,8 +3772,8 @@ static void rtl_hw_start_8125_common(str + rtl_pcie_state_l2l3_disable(tp); + + RTL_W16(tp, 0x382, 0x221b); +- RTL_W8(tp, 0x4500, 0); +- RTL_W16(tp, 0x4800, 0); ++ RTL_W32(tp, RSS_CTRL_8125, 0); ++ RTL_W16(tp, Q_NUM_CTRL_8125, 0); + + /* disable UPS */ + r8168_mac_ocp_modify(tp, 0xd40a, 0x0010, 0x0000); diff --git a/target/linux/generic/backport-6.6/780-39-v6.13-r8169-remove-leftover-locks-after-reverted-change.patch b/target/linux/generic/backport-6.6/780-39-v6.13-r8169-remove-leftover-locks-after-reverted-change.patch new file mode 100644 index 00000000000..20c42955e36 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-39-v6.13-r8169-remove-leftover-locks-after-reverted-change.patch @@ -0,0 +1,113 @@ +From 83cb4b470c66b37b19a347a35cea01e0cbdd258d Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Mon, 4 Nov 2024 23:16:20 +0100 +Subject: [PATCH] r8169: remove leftover locks after reverted change + +After e31a9fedc7d8 ("Revert "r8169: disable ASPM during NAPI poll"") +these locks aren't needed any longer. + +Signed-off-by: Heiner Kallweit +Link: https://patch.msgid.link/680f2606-ac7d-4ced-8694-e5033855da9b@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 29 ++--------------------- + 1 file changed, 2 insertions(+), 27 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -663,13 +663,9 @@ struct rtl8169_private { + struct work_struct work; + } wk; + +- raw_spinlock_t config25_lock; + raw_spinlock_t mac_ocp_lock; + struct mutex led_lock; /* serialize LED ctrl RMW access */ + +- raw_spinlock_t cfg9346_usage_lock; +- int cfg9346_usage_count; +- + unsigned supports_gmii:1; + unsigned aspm_manageable:1; + unsigned dash_enabled:1; +@@ -723,22 +719,12 @@ static inline struct device *tp_to_dev(s + + static void rtl_lock_config_regs(struct rtl8169_private *tp) + { +- unsigned long flags; +- +- raw_spin_lock_irqsave(&tp->cfg9346_usage_lock, flags); +- if (!--tp->cfg9346_usage_count) +- RTL_W8(tp, Cfg9346, Cfg9346_Lock); +- raw_spin_unlock_irqrestore(&tp->cfg9346_usage_lock, flags); ++ RTL_W8(tp, Cfg9346, Cfg9346_Lock); + } + + static void rtl_unlock_config_regs(struct rtl8169_private *tp) + { +- unsigned long flags; +- +- raw_spin_lock_irqsave(&tp->cfg9346_usage_lock, flags); +- if (!tp->cfg9346_usage_count++) +- RTL_W8(tp, Cfg9346, Cfg9346_Unlock); +- raw_spin_unlock_irqrestore(&tp->cfg9346_usage_lock, flags); ++ RTL_W8(tp, Cfg9346, Cfg9346_Unlock); + } + + static void rtl_pci_commit(struct rtl8169_private *tp) +@@ -749,24 +735,18 @@ static void rtl_pci_commit(struct rtl816 + + static void rtl_mod_config2(struct rtl8169_private *tp, u8 clear, u8 set) + { +- unsigned long flags; + u8 val; + +- raw_spin_lock_irqsave(&tp->config25_lock, flags); + val = RTL_R8(tp, Config2); + RTL_W8(tp, Config2, (val & ~clear) | set); +- raw_spin_unlock_irqrestore(&tp->config25_lock, flags); + } + + static void rtl_mod_config5(struct rtl8169_private *tp, u8 clear, u8 set) + { +- unsigned long flags; + u8 val; + +- raw_spin_lock_irqsave(&tp->config25_lock, flags); + val = RTL_R8(tp, Config5); + RTL_W8(tp, Config5, (val & ~clear) | set); +- raw_spin_unlock_irqrestore(&tp->config25_lock, flags); + } + + static bool rtl_is_8125(struct rtl8169_private *tp) +@@ -1572,7 +1552,6 @@ static void __rtl8169_set_wol(struct rtl + { WAKE_MAGIC, Config3, MagicPacket } + }; + unsigned int i, tmp = ARRAY_SIZE(cfg); +- unsigned long flags; + u8 options; + + rtl_unlock_config_regs(tp); +@@ -1591,14 +1570,12 @@ static void __rtl8169_set_wol(struct rtl + r8168_mac_ocp_modify(tp, 0xc0b6, BIT(0), 0); + } + +- raw_spin_lock_irqsave(&tp->config25_lock, flags); + for (i = 0; i < tmp; i++) { + options = RTL_R8(tp, cfg[i].reg) & ~cfg[i].mask; + if (wolopts & cfg[i].opt) + options |= cfg[i].mask; + RTL_W8(tp, cfg[i].reg, options); + } +- raw_spin_unlock_irqrestore(&tp->config25_lock, flags); + + switch (tp->mac_version) { + case RTL_GIGA_MAC_VER_02 ... RTL_GIGA_MAC_VER_06: +@@ -5498,8 +5475,6 @@ static int rtl_init_one(struct pci_dev * + tp->supports_gmii = ent->driver_data == RTL_CFG_NO_GBIT ? 0 : 1; + tp->ocp_base = OCP_STD_PHY_BASE; + +- raw_spin_lock_init(&tp->cfg9346_usage_lock); +- raw_spin_lock_init(&tp->config25_lock); + raw_spin_lock_init(&tp->mac_ocp_lock); + mutex_init(&tp->led_lock); + diff --git a/target/linux/generic/backport-6.6/780-40-v6.13-r8169-improve-__rtl8169_set_wol.patch b/target/linux/generic/backport-6.6/780-40-v6.13-r8169-improve-__rtl8169_set_wol.patch new file mode 100644 index 00000000000..8c88c078f29 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-40-v6.13-r8169-improve-__rtl8169_set_wol.patch @@ -0,0 +1,108 @@ +From c507e96b5763b36b63ad50ad804341f72ea000e4 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Wed, 6 Nov 2024 17:55:45 +0100 +Subject: [PATCH] r8169: improve __rtl8169_set_wol + +Add helper r8169_mod_reg8_cond() what allows to significantly simplify +__rtl8169_set_wol(). + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/697b197a-8eac-40c6-8847-27093cacec36@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 55 ++++++++++------------- + 1 file changed, 24 insertions(+), 31 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -749,6 +749,20 @@ static void rtl_mod_config5(struct rtl81 + RTL_W8(tp, Config5, (val & ~clear) | set); + } + ++static void r8169_mod_reg8_cond(struct rtl8169_private *tp, int reg, ++ u8 bits, bool cond) ++{ ++ u8 val, old_val; ++ ++ old_val = RTL_R8(tp, reg); ++ if (cond) ++ val = old_val | bits; ++ else ++ val = old_val & ~bits; ++ if (val != old_val) ++ RTL_W8(tp, reg, val); ++} ++ + static bool rtl_is_8125(struct rtl8169_private *tp) + { + return tp->mac_version >= RTL_GIGA_MAC_VER_61; +@@ -1539,58 +1553,37 @@ static void rtl8169_get_wol(struct net_d + + static void __rtl8169_set_wol(struct rtl8169_private *tp, u32 wolopts) + { +- static const struct { +- u32 opt; +- u16 reg; +- u8 mask; +- } cfg[] = { +- { WAKE_PHY, Config3, LinkUp }, +- { WAKE_UCAST, Config5, UWF }, +- { WAKE_BCAST, Config5, BWF }, +- { WAKE_MCAST, Config5, MWF }, +- { WAKE_ANY, Config5, LanWake }, +- { WAKE_MAGIC, Config3, MagicPacket } +- }; +- unsigned int i, tmp = ARRAY_SIZE(cfg); +- u8 options; +- + rtl_unlock_config_regs(tp); + + if (rtl_is_8168evl_up(tp)) { +- tmp--; + if (wolopts & WAKE_MAGIC) + rtl_eri_set_bits(tp, 0x0dc, MagicPacket_v2); + else + rtl_eri_clear_bits(tp, 0x0dc, MagicPacket_v2); + } else if (rtl_is_8125(tp)) { +- tmp--; + if (wolopts & WAKE_MAGIC) + r8168_mac_ocp_modify(tp, 0xc0b6, 0, BIT(0)); + else + r8168_mac_ocp_modify(tp, 0xc0b6, BIT(0), 0); ++ } else { ++ r8169_mod_reg8_cond(tp, Config3, MagicPacket, ++ wolopts & WAKE_MAGIC); + } + +- for (i = 0; i < tmp; i++) { +- options = RTL_R8(tp, cfg[i].reg) & ~cfg[i].mask; +- if (wolopts & cfg[i].opt) +- options |= cfg[i].mask; +- RTL_W8(tp, cfg[i].reg, options); +- } ++ r8169_mod_reg8_cond(tp, Config3, LinkUp, wolopts & WAKE_PHY); ++ r8169_mod_reg8_cond(tp, Config5, UWF, wolopts & WAKE_UCAST); ++ r8169_mod_reg8_cond(tp, Config5, BWF, wolopts & WAKE_BCAST); ++ r8169_mod_reg8_cond(tp, Config5, MWF, wolopts & WAKE_MCAST); ++ r8169_mod_reg8_cond(tp, Config5, LanWake, wolopts); + + switch (tp->mac_version) { + case RTL_GIGA_MAC_VER_02 ... RTL_GIGA_MAC_VER_06: +- options = RTL_R8(tp, Config1) & ~PMEnable; +- if (wolopts) +- options |= PMEnable; +- RTL_W8(tp, Config1, options); ++ r8169_mod_reg8_cond(tp, Config1, PMEnable, wolopts); + break; + case RTL_GIGA_MAC_VER_34: + case RTL_GIGA_MAC_VER_37: + case RTL_GIGA_MAC_VER_39 ... RTL_GIGA_MAC_VER_66: +- if (wolopts) +- rtl_mod_config2(tp, 0, PME_SIGNAL); +- else +- rtl_mod_config2(tp, PME_SIGNAL, 0); ++ r8169_mod_reg8_cond(tp, Config2, PME_SIGNAL, wolopts); + break; + default: + break; diff --git a/target/linux/generic/backport-6.6/780-41-v6.13-r8169-improve-rtl_set_d3_pll_down.patch b/target/linux/generic/backport-6.6/780-41-v6.13-r8169-improve-rtl_set_d3_pll_down.patch new file mode 100644 index 00000000000..e7626173102 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-41-v6.13-r8169-improve-rtl_set_d3_pll_down.patch @@ -0,0 +1,44 @@ +From 330dc2297c82953dff402e0b4176a5383a618538 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Wed, 6 Nov 2024 17:56:28 +0100 +Subject: [PATCH] r8169: improve rtl_set_d3_pll_down + +Make use of new helper r8169_mod_reg8_cond() and move from a switch() +to an if() clause. Benefit is that we don't have to touch this piece of +code each time support for a new chip version is added. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/e1ccdb85-a4ed-4800-89c2-89770ff06452@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 18 +++++------------- + 1 file changed, 5 insertions(+), 13 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -1432,19 +1432,11 @@ static enum rtl_dash_type rtl_get_dash_t + + static void rtl_set_d3_pll_down(struct rtl8169_private *tp, bool enable) + { +- switch (tp->mac_version) { +- case RTL_GIGA_MAC_VER_25 ... RTL_GIGA_MAC_VER_26: +- case RTL_GIGA_MAC_VER_29 ... RTL_GIGA_MAC_VER_30: +- case RTL_GIGA_MAC_VER_32 ... RTL_GIGA_MAC_VER_37: +- case RTL_GIGA_MAC_VER_39 ... RTL_GIGA_MAC_VER_66: +- if (enable) +- RTL_W8(tp, PMCH, RTL_R8(tp, PMCH) & ~D3_NO_PLL_DOWN); +- else +- RTL_W8(tp, PMCH, RTL_R8(tp, PMCH) | D3_NO_PLL_DOWN); +- break; +- default: +- break; +- } ++ if (tp->mac_version >= RTL_GIGA_MAC_VER_25 && ++ tp->mac_version != RTL_GIGA_MAC_VER_28 && ++ tp->mac_version != RTL_GIGA_MAC_VER_31 && ++ tp->mac_version != RTL_GIGA_MAC_VER_38) ++ r8169_mod_reg8_cond(tp, PMCH, D3_NO_PLL_DOWN, !enable); + } + + static void rtl_reset_packet_filter(struct rtl8169_private *tp) diff --git a/target/linux/generic/backport-6.6/780-42-v6.13-r8169-align-WAKE_PHY-handling-with-r8125-r8126-vendo.patch b/target/linux/generic/backport-6.6/780-42-v6.13-r8169-align-WAKE_PHY-handling-with-r8125-r8126-vendo.patch new file mode 100644 index 00000000000..de86c2f6cd0 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-42-v6.13-r8169-align-WAKE_PHY-handling-with-r8125-r8126-vendo.patch @@ -0,0 +1,29 @@ +From e3e9e9039fa6ae885c7d5c954d7b9f105fa23e8f Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Wed, 6 Nov 2024 17:57:08 +0100 +Subject: [PATCH] r8169: align WAKE_PHY handling with r8125/r8126 vendor + drivers + +Vendor drivers r8125/r8126 apply this additional magic setting when +enabling WAKE_PHY, so do the same here. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/51130715-45be-4db5-abb7-05d87e1f5df9@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -1563,6 +1563,9 @@ static void __rtl8169_set_wol(struct rtl + } + + r8169_mod_reg8_cond(tp, Config3, LinkUp, wolopts & WAKE_PHY); ++ if (rtl_is_8125(tp)) ++ r8168_mac_ocp_modify(tp, 0xe0c6, 0x3f, ++ wolopts & WAKE_PHY ? 0x13 : 0); + r8169_mod_reg8_cond(tp, Config5, UWF, wolopts & WAKE_UCAST); + r8169_mod_reg8_cond(tp, Config5, BWF, wolopts & WAKE_BCAST); + r8169_mod_reg8_cond(tp, Config5, MWF, wolopts & WAKE_MCAST); diff --git a/target/linux/generic/backport-6.6/780-43-v6.13-r8169-use-helper-r8169_mod_reg8_cond-to-simplify-rtl.patch b/target/linux/generic/backport-6.6/780-43-v6.13-r8169-use-helper-r8169_mod_reg8_cond-to-simplify-rtl.patch new file mode 100644 index 00000000000..5bcf06098a8 --- /dev/null +++ b/target/linux/generic/backport-6.6/780-43-v6.13-r8169-use-helper-r8169_mod_reg8_cond-to-simplify-rtl.patch @@ -0,0 +1,117 @@ +From 7a3bcd39ae1f0e3ab896d9df62339ab4297a0bfd Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Sat, 9 Nov 2024 23:12:12 +0100 +Subject: [PATCH] r8169: use helper r8169_mod_reg8_cond to simplify + rtl_jumbo_config + +Use recently added helper r8169_mod_reg8_cond() to simplify jumbo +mode configuration. + +Signed-off-by: Heiner Kallweit +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/3df1d484-a02e-46e7-8f75-db5b428e422e@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/realtek/r8169_main.c | 77 ++++------------------- + 1 file changed, 11 insertions(+), 66 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -2547,86 +2547,31 @@ static void rtl8169_init_ring_indexes(st + tp->dirty_tx = tp->cur_tx = tp->cur_rx = 0; + } + +-static void r8168c_hw_jumbo_enable(struct rtl8169_private *tp) +-{ +- RTL_W8(tp, Config3, RTL_R8(tp, Config3) | Jumbo_En0); +- RTL_W8(tp, Config4, RTL_R8(tp, Config4) | Jumbo_En1); +-} +- +-static void r8168c_hw_jumbo_disable(struct rtl8169_private *tp) +-{ +- RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Jumbo_En0); +- RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~Jumbo_En1); +-} +- +-static void r8168dp_hw_jumbo_enable(struct rtl8169_private *tp) +-{ +- RTL_W8(tp, Config3, RTL_R8(tp, Config3) | Jumbo_En0); +-} +- +-static void r8168dp_hw_jumbo_disable(struct rtl8169_private *tp) +-{ +- RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Jumbo_En0); +-} +- +-static void r8168e_hw_jumbo_enable(struct rtl8169_private *tp) +-{ +- RTL_W8(tp, MaxTxPacketSize, 0x24); +- RTL_W8(tp, Config3, RTL_R8(tp, Config3) | Jumbo_En0); +- RTL_W8(tp, Config4, RTL_R8(tp, Config4) | 0x01); +-} +- +-static void r8168e_hw_jumbo_disable(struct rtl8169_private *tp) +-{ +- RTL_W8(tp, MaxTxPacketSize, 0x3f); +- RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Jumbo_En0); +- RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~0x01); +-} +- +-static void r8168b_1_hw_jumbo_enable(struct rtl8169_private *tp) +-{ +- RTL_W8(tp, Config4, RTL_R8(tp, Config4) | (1 << 0)); +-} +- +-static void r8168b_1_hw_jumbo_disable(struct rtl8169_private *tp) +-{ +- RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~(1 << 0)); +-} +- + static void rtl_jumbo_config(struct rtl8169_private *tp) + { + bool jumbo = tp->dev->mtu > ETH_DATA_LEN; + int readrq = 4096; + ++ if (jumbo && tp->mac_version >= RTL_GIGA_MAC_VER_17 && ++ tp->mac_version <= RTL_GIGA_MAC_VER_26) ++ readrq = 512; ++ + rtl_unlock_config_regs(tp); + switch (tp->mac_version) { + case RTL_GIGA_MAC_VER_17: +- if (jumbo) { +- readrq = 512; +- r8168b_1_hw_jumbo_enable(tp); +- } else { +- r8168b_1_hw_jumbo_disable(tp); +- } ++ r8169_mod_reg8_cond(tp, Config4, BIT(0), jumbo); + break; + case RTL_GIGA_MAC_VER_18 ... RTL_GIGA_MAC_VER_26: +- if (jumbo) { +- readrq = 512; +- r8168c_hw_jumbo_enable(tp); +- } else { +- r8168c_hw_jumbo_disable(tp); +- } ++ r8169_mod_reg8_cond(tp, Config3, Jumbo_En0, jumbo); ++ r8169_mod_reg8_cond(tp, Config4, Jumbo_En1, jumbo); + break; + case RTL_GIGA_MAC_VER_28: +- if (jumbo) +- r8168dp_hw_jumbo_enable(tp); +- else +- r8168dp_hw_jumbo_disable(tp); ++ r8169_mod_reg8_cond(tp, Config3, Jumbo_En0, jumbo); + break; + case RTL_GIGA_MAC_VER_31 ... RTL_GIGA_MAC_VER_33: +- if (jumbo) +- r8168e_hw_jumbo_enable(tp); +- else +- r8168e_hw_jumbo_disable(tp); ++ RTL_W8(tp, MaxTxPacketSize, jumbo ? 0x24 : 0x3f); ++ r8169_mod_reg8_cond(tp, Config3, Jumbo_En0, jumbo); ++ r8169_mod_reg8_cond(tp, Config4, BIT(0), jumbo); + break; + default: + break; From 484f670ed3d41e44375bfa7f8892e660d3c8c26a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Sat, 4 Jan 2025 00:46:00 +0100 Subject: [PATCH 046/173] rockchip: refresh patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 8a477bafb4637e3499f69f569133039ce060559e backported an upstream patch without refreshing the patches. Fixes: 8a477bafb463 ("rockchip: fix phy reset on rk356x") Signed-off-by: Álvaro Fernández Rojas Link: https://github.com/openwrt/openwrt/pull/17474 Signed-off-by: Robert Marko --- .../301-arm64-dts-rockchip-add-DT-entry-for-RNG-to-RK3568.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/rockchip/patches-6.6/301-arm64-dts-rockchip-add-DT-entry-for-RNG-to-RK3568.patch b/target/linux/rockchip/patches-6.6/301-arm64-dts-rockchip-add-DT-entry-for-RNG-to-RK3568.patch index 130bf6723cc..6ba8002c756 100644 --- a/target/linux/rockchip/patches-6.6/301-arm64-dts-rockchip-add-DT-entry-for-RNG-to-RK3568.patch +++ b/target/linux/rockchip/patches-6.6/301-arm64-dts-rockchip-add-DT-entry-for-RNG-to-RK3568.patch @@ -14,7 +14,7 @@ Signed-off-by: Daniel Golle --- a/arch/arm64/boot/dts/rockchip/rk3568.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3568.dtsi -@@ -257,6 +257,13 @@ +@@ -258,6 +258,13 @@ }; }; From f11bc4f201e3a4ffec8c1e2083124ebda60dd763 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 4 Jan 2025 11:54:22 +0100 Subject: [PATCH 047/173] mt76: update to Git HEAD (2025-01-04) 35bcf68a6297 wifi: mt76: scan: fix setting tx_info fields 4d8d6e2e7710 wifi: mt76: scan: set vif offchannel link for scanning/roc e354436db440 wifi: mt76: mt7996: use the correct vif link for scanning/roc Signed-off-by: Felix Fietkau --- package/kernel/mt76/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index d603b6215fd..7bc030a9df3 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -8,9 +8,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/openwrt/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2025-01-03 -PKG_SOURCE_VERSION:=959a2d40007f502d9465b8aede79e761f875abd3 -PKG_MIRROR_HASH:=a00a26a4685c053a639a95657804b09d0d4a1452744647871070beb6332b7c3a +PKG_SOURCE_DATE:=2025-01-04 +PKG_SOURCE_VERSION:=e354436db4402552bcb0cbe9abab2a46fb1ad31c +PKG_MIRROR_HASH:=7e3894e1f2641e172f87be1ae0cc6adda318d989350ebd53500a7df02f0afd8f PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 From b795e5cbcffc54e858bc8d3bde0031a2ca32377e Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 4 Jan 2025 11:52:50 +0100 Subject: [PATCH 048/173] wifi-scripts: fix setting tx power on some drivers On some drivers, setting the tx power on the interface is not enough. Set it for the phy as well. Fixes: 04fb05914ea7 ("wifi-scripts: add multi-radio config support") Signed-off-by: Felix Fietkau --- .../files-ucode/lib/netifd/wireless/mac80211.sh | 1 + .../wifi-scripts/files/lib/netifd/wireless/mac80211.sh | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/package/network/config/wifi-scripts/files-ucode/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files-ucode/lib/netifd/wireless/mac80211.sh index 93ab404d57c..9b86abcee5d 100755 --- a/package/network/config/wifi-scripts/files-ucode/lib/netifd/wireless/mac80211.sh +++ b/package/network/config/wifi-scripts/files-ucode/lib/netifd/wireless/mac80211.sh @@ -195,6 +195,7 @@ function setup_phy(phy, config, data) { log(`Configuring '${phy}' txantenna: ${config.txantenna}, rxantenna: ${config.rxantenna} distance: ${config.distance}`); system(`iw phy ${phy} set antenna ${config.txantenna} ${config.rxantenna}`); system(`iw phy ${phy} set distance ${config.distance}`); + system(`iw phy ${phy} set txpower ${config.txpower}`); if (config.frag) system(`iw phy ${phy} set frag ${frag}`); diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh index 5d9bf8ee09e..9e9922e0b35 100755 --- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh @@ -1210,6 +1210,14 @@ drv_mac80211_setup() { wdev_tool "$phy$phy_suffix" set_config "$(json_dump)" $active_ifnames json_set_namespace "$prev" + [ -z "$phy_suffix" ] && { + if [ -n "$txpower" ]; then + iw phy "$phy" set txpower fixed "${txpower%%.*}00" + else + iw phy "$phy" set txpower auto + fi + } + for_each_interface "ap sta adhoc mesh monitor" mac80211_set_vif_txpower wireless_set_up } From f105d1a9a9739267fb25612d039c392a397775bd Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 2 Jan 2025 07:50:26 -0500 Subject: [PATCH 049/173] bcm27xx/bcm2712: Fix-up RP1 modules Correct a few mistakes around dependencies and naming and unset CONFIG_FIRMWARE_RP1 in RPi5B's config and instead of a builtin, build it as a module. Without this change, there are two entries for rp1.ko in /lib/modules/$(uname -r)/modules.builtin due to how we strip the leading directories when we generate it. See: package/kernel/linux/Makefile around line 63. % grep rp1.ko /lib/modules/$(uname -r)/modules.builtin pwm-rp1.ko clk-rp1.ko rp1.ko rp1.ko The kernel log gets spammed with tons of superfluous warnings as a results of the double entry: daemon.warn modprobe: found duplicate builtin module rp1 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17461 Signed-off-by: Robert Marko --- target/linux/bcm27xx/bcm2712/config-6.6 | 8 +-- target/linux/bcm27xx/modules/hwmon.mk | 19 +++++++ target/linux/bcm27xx/modules/other.mk | 70 ++++++++++++++++++++++++- target/linux/bcm27xx/modules/video.mk | 2 +- 4 files changed, 92 insertions(+), 7 deletions(-) diff --git a/target/linux/bcm27xx/bcm2712/config-6.6 b/target/linux/bcm27xx/bcm2712/config-6.6 index 9dac0688df3..749c569a541 100644 --- a/target/linux/bcm27xx/bcm2712/config-6.6 +++ b/target/linux/bcm27xx/bcm2712/config-6.6 @@ -239,7 +239,7 @@ CONFIG_FB_DEVICE=y CONFIG_FB_IOMEM_FOPS=y CONFIG_FB_IOMEM_HELPERS=y CONFIG_FB_SIMPLE=y -CONFIG_FIRMWARE_RP1=y +# CONFIG_FIRMWARE_RP1 is not set CONFIG_FIXED_PHY=y CONFIG_FIX_EARLYCON_MEM=y CONFIG_FONT_8x16=y @@ -372,7 +372,7 @@ CONFIG_MAGIC_SYSRQ=y CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1f6 CONFIG_MAILBOX=y # CONFIG_MAILBOX_TEST is not set -CONFIG_MBOX_RP1=y +# CONFIG_MBOX_RP1 is not set CONFIG_MDIO_BCM_UNIMAC=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y @@ -537,7 +537,7 @@ CONFIG_RESET_RASPBERRYPI=y CONFIG_RESET_SIMPLE=y CONFIG_RFS_ACCEL=y CONFIG_RODATA_FULL_DEFAULT_ENABLED=y -CONFIG_RP1_PIO=y +# CONFIG_RP1_PIO is not set # CONFIG_RPI_POE_POWER is not set CONFIG_RPS=y CONFIG_RTC_CLASS=y @@ -550,7 +550,7 @@ CONFIG_SCSI_COMMON=y # CONFIG_SCSI_LOWLEVEL is not set # CONFIG_SCSI_PROC_FS is not set CONFIG_SENSORS_RASPBERRYPI_HWMON=y -CONFIG_SENSORS_RP1_ADC=y +# CONFIG_SENSORS_RP1_ADC is not set CONFIG_SERIAL_8250_BCM2835AUX=y CONFIG_SERIAL_8250_BCM7271=y # CONFIG_SERIAL_8250_DMA is not set diff --git a/target/linux/bcm27xx/modules/hwmon.mk b/target/linux/bcm27xx/modules/hwmon.mk index 0f1547cd4f8..db8ba30f875 100644 --- a/target/linux/bcm27xx/modules/hwmon.mk +++ b/target/linux/bcm27xx/modules/hwmon.mk @@ -2,6 +2,23 @@ # # Copyright (C) 2019 OpenWrt.org +define KernelPackage/rp1-adc + SUBMENU:=$(OTHER_MENU) + TITLE:=RP1 ADC and temperature sensor driver + KCONFIG:=CONFIG_SENSORS_RP1_ADC + FILES:=$(LINUX_DIR)/drivers/hwmon/rp1-adc.ko + AUTOLOAD:=$(call AutoLoad,21,rp1-adc) + DEPENDS:=@TARGET_bcm27xx_bcm2712 +endef + +define KernelPackage/rp1-adc/description + Kernel module for RP1 silicon providing ADC and + temperature monitoring. +endef + +$(eval $(call KernelPackage,rp1-adc)) + + define KernelPackage/hwmon-raspberrypi TITLE:=Raspberry Pi voltage monitor KCONFIG:=CONFIG_SENSORS_RASPBERRYPI_HWMON @@ -15,3 +32,5 @@ define KernelPackage/hwmon-raspberrypi/description endef $(eval $(call KernelPackage,hwmon-raspberrypi)) + + diff --git a/target/linux/bcm27xx/modules/other.mk b/target/linux/bcm27xx/modules/other.mk index 5a690007483..099ce3ce14d 100644 --- a/target/linux/bcm27xx/modules/other.mk +++ b/target/linux/bcm27xx/modules/other.mk @@ -55,13 +55,46 @@ endef $(eval $(call KernelPackage,smi-bcm2835-dev)) +define KernelPackage/rp1 + SUBMENU:=$(OTHER_MENU) + TITLE:=RP1 firmware + KCONFIG:=CONFIG_FIRMWARE_RP1 + FILES:=$(LINUX_DIR)/drivers/firmware/rp1.ko + AUTOLOAD:=$(call AutoLoad,21,rp1) + DEPENDS:=@TARGET_bcm27xx_bcm2712 +endef + +define KernelPackage/rp1/description + This driver provides a firmware interface to the RP1 processor using shared + memory and a mailbox. +endef + +$(eval $(call KernelPackage,rp1)) + + +define KernelPackage/rp1-pio + SUBMENU:=$(OTHER_MENU) + TITLE:=RP1 PIO block support + KCONFIG:=CONFIG_RP1_PIO + FILES:=$(LINUX_DIR)/drivers/misc/rp1-pio.ko + AUTOLOAD:=$(call AutoLoad,21,rp1-pio) + DEPENDS:=@TARGET_bcm27xx_bcm2712 +kmod-rp1 +endef + +define KernelPackage/rp1-pio/description + Driver providing control of the Raspberry Pi PIO block, as found in RP1 +endef + +$(eval $(call KernelPackage,rp1-pio)) + + define KernelPackage/pwm-pio-rp1 SUBMENU:=$(OTHER_MENU) TITLE:=RP1 PWM support KCONFIG:=CONFIG_PWM_PIO_RP1 FILES:=$(LINUX_DIR)/drivers/pwm/pwm-pio-rp1.ko AUTOLOAD:=$(call AutoLoad,21,pwm-pio-rp1) - DEPENDS:=@TARGET_bcm27xx_bcm2712 + DEPENDS:=@TARGET_bcm27xx_bcm2712 +kmod-rp1-pio endef define KernelPackage/pwm-pio-rp1/description @@ -80,7 +113,7 @@ define KernelPackage/ws2812-pio-rp1 KCONFIG:=CONFIG_WS2812_PIO_RP1 FILES:=$(LINUX_DIR)/drivers/misc/ws2812-pio-rp1.ko AUTOLOAD:=$(call AutoLoad,21,ws2812-pio-rp1) - DEPENDS:=@TARGET_bcm27xx_bcm2712 + DEPENDS:=@TARGET_bcm27xx_bcm2712 +kmod-rp1-pio endef define KernelPackage/ws2812-pio-rp1/description @@ -90,3 +123,36 @@ define KernelPackage/ws2812-pio-rp1/description endef $(eval $(call KernelPackage,ws2812-pio-rp1)) + + +define KernelPackage/rp1-mailbox + SUBMENU:=$(OTHER_MENU) + TITLE:=RP1 mailbox IPC driver + KCONFIG:=CONFIG_MBOX_RP1 + FILES:=$(LINUX_DIR)/drivers/mailbox/rp1-mailbox.ko + AUTOLOAD:=$(call AutoLoad,21,rp1-mailbox) + DEPENDS:=@TARGET_bcm27xx_bcm2712 +endef + +define KernelPackage/rp1-mailbox/description + This is a RP1 mailbox IPC driver. +endef + +$(eval $(call KernelPackage,rp1-mailbox)) + + +define KernelPackage/rp1-pio + SUBMENU:=$(OTHER_MENU) + TITLE:=RP1 PIO driver + KCONFIG:=CONFIG_RP1_PIO + FILES:=$(LINUX_DIR)/drivers/misc/rp1-pio.ko + AUTOLOAD:=$(call AutoLoad,21,rp1-pio) + DEPENDS:=@TARGET_bcm27xx_bcm2712 +kmod-rp1 +endef + +define KernelPackage/rp1-pio/description + Driver for the RP1 PIO. +endef + +$(eval $(call KernelPackage,rp1-pio)) + diff --git a/target/linux/bcm27xx/modules/video.mk b/target/linux/bcm27xx/modules/video.mk index dddf13e0f4a..e8a61f138cc 100644 --- a/target/linux/bcm27xx/modules/video.mk +++ b/target/linux/bcm27xx/modules/video.mk @@ -175,7 +175,7 @@ define KernelPackage/drm-rp1-dpi CONFIG_DRM_TTM_HELPER=n FILES:=$(LINUX_DIR)/drivers/gpu/drm/rp1/rp1-dpi/drm-rp1-dpi.ko AUTOLOAD:=$(call AutoLoad,67,drm-rp1-dpi) - DEPENDS:=@TARGET_bcm27xx_bcm2712 +kmod-drm-vc4 + DEPENDS:=@TARGET_bcm27xx_bcm2712 +kmod-drm-vc4 +kmod-rp1-pio endef define KernelPackage/drm-rp1-dpi/description From 9f97e39a9336e279be7ea1c00c4221ec3f448457 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sun, 22 Dec 2024 00:30:43 +0800 Subject: [PATCH 050/173] uboot-mediatek: fix Routerich AX3000 support patch It seems that the original patch has been manually modified. The newly added line number is incorrect. Fixes: c0581520b1c5 ("uboot-mediatek: add Routerich AX3000 support") Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17338 Signed-off-by: Hauke Mehrtens --- .../boot/uboot-mediatek/patches/460-add-routerich-ax3000.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/boot/uboot-mediatek/patches/460-add-routerich-ax3000.patch b/package/boot/uboot-mediatek/patches/460-add-routerich-ax3000.patch index 9aa31843dea..f33ca076330 100644 --- a/package/boot/uboot-mediatek/patches/460-add-routerich-ax3000.patch +++ b/package/boot/uboot-mediatek/patches/460-add-routerich-ax3000.patch @@ -1,6 +1,6 @@ --- /dev/null +++ b/configs/mt7981_routerich_ax3000_defconfig -@@ -0,0 +1,107 @@ +@@ -0,0 +1,108 @@ +CONFIG_ARM=y +CONFIG_SYS_HAS_NONCACHED_MEMORY=y +CONFIG_POSITION_INDEPENDENT=y From 5ef71eaafd4e128ec3708a66b5633214427da373 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sun, 22 Dec 2024 00:31:06 +0800 Subject: [PATCH 051/173] uboot-mediatek: add missing LED command for OpenWrt One The u-boot LED command "led_loop_done" is missing from the OpenWrt One NAND flash u-boot. Copy it from the OpenWrt One NOR flash u-boot default environment to fix this issue. Fixes: https://github.com/openwrt/openwrt/issues/17310 Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17338 Signed-off-by: Hauke Mehrtens --- package/boot/uboot-mediatek/patches/453-add-openwrt-one.patch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/boot/uboot-mediatek/patches/453-add-openwrt-one.patch b/package/boot/uboot-mediatek/patches/453-add-openwrt-one.patch index 6c31d88be81..ed54cedbc37 100644 --- a/package/boot/uboot-mediatek/patches/453-add-openwrt-one.patch +++ b/package/boot/uboot-mediatek/patches/453-add-openwrt-one.patch @@ -520,7 +520,7 @@ +_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver" --- /dev/null +++ b/openwrt-one-spi-nand_env -@@ -0,0 +1,61 @@ +@@ -0,0 +1,62 @@ +ethaddr_factory=mtd read factory 0x46000000 0x0 0x20000 && env readmem -b ethaddr 0x4600002a 0x6 ; setenv ethaddr_factory +ipaddr=192.168.11.11 +serverip=192.168.11.23 @@ -562,6 +562,7 @@ +check_buttons=if button front ; then run boot_recovery ; run boot_tftp ; run led_loop_error ; else if button back ; then ; run usb_recover ; run led_loop_error ; fi ; fi +led_boot=led green on ; led white on ; led red on +led_done=led green on ; led white off ; led red off ++led_loop_done=led white off ; led green on ; echo done ; while true ; do sleep 1 ; done +led_loop_error=led white off ; led green off ; while true ; do led red on ; sleep 1 ; led red off ; sleep 1 ; done +led_start=led white on ; led green off ; led red off +preboot=run led_boot From f70cdfd682a87c9de942f9251fb5a0caaf43f7cf Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sat, 13 Jul 2024 11:32:45 +0800 Subject: [PATCH 052/173] ramips: mmc-mtk: add more vendor driver register init values In the MTK vendor driver, mt762x SDXC registers MSDC_PATCH_BIT and MSDC_PATCH_BIT1 have different init values than upstream driver. These magical values should have some help for the stability. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17446 Signed-off-by: Hauke Mehrtens --- ...tialize-pad-delay-and-drive-strength.patch | 53 +++++++++++++++---- 1 file changed, 44 insertions(+), 9 deletions(-) diff --git a/target/linux/ramips/patches-6.6/831-mmc-mtk-sd-initialize-pad-delay-and-drive-strength.patch b/target/linux/ramips/patches-6.6/831-mmc-mtk-sd-initialize-pad-delay-and-drive-strength.patch index 1d5c6dcd40c..c3d13932ef3 100644 --- a/target/linux/ramips/patches-6.6/831-mmc-mtk-sd-initialize-pad-delay-and-drive-strength.patch +++ b/target/linux/ramips/patches-6.6/831-mmc-mtk-sd-initialize-pad-delay-and-drive-strength.patch @@ -4,6 +4,8 @@ Subject: [PATCH] mmc: mtk-sd: initialize the pad and tune registers Signed-off-by: Shiji Yang --- + drivers/mmc/host/mtk-sd.c | 26 +++++++++++++++++++++++--- + 1 file changed, 23 insertions(+), 3 deletions(-) --- a/drivers/mmc/host/mtk-sd.c +++ b/drivers/mmc/host/mtk-sd.c @@ -20,19 +22,52 @@ Signed-off-by: Shiji Yang #define PAD_DS_TUNE 0x188 #define PAD_CMD_TUNE 0x18c #define EMMC51_CFG0 0x204 -@@ -1795,6 +1799,16 @@ static void msdc_init_hw(struct msdc_hos +@@ -400,6 +404,7 @@ struct mtk_mmc_compatible { + bool enhance_rx; + bool support_64g; + bool use_internal_cd; ++ bool legacy_mt762x; /* for mt7620, mt7621 and mt76x8 */ + }; + + struct msdc_tune_para { +@@ -537,6 +542,7 @@ static const struct mtk_mmc_compatible m + .stop_clk_fix = false, + .enhance_rx = false, + .use_internal_cd = true, ++ .legacy_mt762x = true, + }; + + static const struct mtk_mmc_compatible mt7622_compat = { +@@ -1729,9 +1735,11 @@ static void msdc_init_hw(struct msdc_hos + } + writel(0, host->base + MSDC_IOCON); + sdr_set_field(host->base + MSDC_IOCON, MSDC_IOCON_DDLSEL, 0); +- writel(0x403c0046, host->base + MSDC_PATCH_BIT); +- sdr_set_field(host->base + MSDC_PATCH_BIT, MSDC_CKGEN_MSDC_DLY_SEL, 1); +- writel(0xffff4089, host->base + MSDC_PATCH_BIT1); ++ if(!host->dev_comp->legacy_mt762x) { ++ writel(0x403c0046, host->base + MSDC_PATCH_BIT); ++ sdr_set_field(host->base + MSDC_PATCH_BIT, MSDC_CKGEN_MSDC_DLY_SEL, 1); ++ writel(0xffff4089, host->base + MSDC_PATCH_BIT1); ++ } + sdr_set_bits(host->base + EMMC50_CFG0, EMMC50_CFG_CFCSTS_SEL); + + if (host->dev_comp->stop_clk_fix) { +@@ -1795,6 +1803,18 @@ static void msdc_init_hw(struct msdc_hos MSDC_PAD_TUNE_RXDLYSEL); } -+ /* Set pins drive strength */ -+ writel(0x000d0044, host->base + MSDC_PAD_CTRL0); -+ writel(0x000e0044, host->base + MSDC_PAD_CTRL1); -+ writel(0x000e0044, host->base + MSDC_PAD_CTRL2); ++ if (host->dev_comp->legacy_mt762x) { ++ /* Set pins drive strength */ ++ writel(0x000d0044, host->base + MSDC_PAD_CTRL0); ++ writel(0x000e0044, host->base + MSDC_PAD_CTRL1); ++ writel(0x000e0044, host->base + MSDC_PAD_CTRL2); + -+ /* Set pad delay */ -+ writel(0x84101010, host->base + MSDC_PAD_TUNE); -+ writel(0x10101010, host->base + MSDC_PAD_TUNE0); -+ writel(0x10101010, host->base + MSDC_PAD_TUNE1); ++ /* Set pad delay */ ++ writel(0x84101010, host->base + MSDC_PAD_TUNE); ++ writel(0x10101010, host->base + MSDC_PAD_TUNE0); ++ writel(0x10101010, host->base + MSDC_PAD_TUNE1); ++ } + if (mmc->caps2 & MMC_CAP2_NO_SDIO) { sdr_clr_bits(host->base + SDC_CFG, SDC_CFG_SDIO); From 05ec3b50a8e673786dda0224b23f18b5d96a4a65 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 1 Jan 2025 16:06:10 +0800 Subject: [PATCH 053/173] ramips: pinctrl: allow mux SDXC pins for mt76x8 The mt76x8 SDXC pin register definition is incompatible with the mtmips generic pinctrl driver structure. This hack allows us to mux the SDXC IO to different pin groups in device tree. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17446 Signed-off-by: Hauke Mehrtens --- ...tmips-allow-mux-SDXC-pins-for-mt76x8.patch | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 target/linux/ramips/patches-6.6/809-pinctrl-mtmips-allow-mux-SDXC-pins-for-mt76x8.patch diff --git a/target/linux/ramips/patches-6.6/809-pinctrl-mtmips-allow-mux-SDXC-pins-for-mt76x8.patch b/target/linux/ramips/patches-6.6/809-pinctrl-mtmips-allow-mux-SDXC-pins-for-mt76x8.patch new file mode 100644 index 00000000000..69dcd7fb2c8 --- /dev/null +++ b/target/linux/ramips/patches-6.6/809-pinctrl-mtmips-allow-mux-SDXC-pins-for-mt76x8.patch @@ -0,0 +1,105 @@ +From: Shiji Yang +Date: Wed, 1 Jan 2025 13:30:11 +0800 +Subject: [PATCH] pinctrl: mtmips: allow mux SDXC pins for mt76x8 + +This is a hack to supprot two types of mt76x8 SDXC pinmaps: + +a) Use ethernet phy pins as SDXC IO. + +&pinctrl { + ephy-digital; + + sdxc_iot_mode: sdxc_iot_mode { + esd { + groups = "esd"; + function = "iot"; + }; + + sdxc { + groups = "sdmode"; + function = "sdxc"; + }; + }; +}; + +b) Use I2S/I2C/GPIO0/UART1 pins as SDXC IO. + +&pinctrl { + ephy-analog; + + sdxc_router_mode: sdxc_router_mode { + groups = "esd", "gpio", "i2c", "i2s", "sdmode", "uart1"; + function = "gpio"; + }; +}; + +Signed-off-by: Shiji Yang +--- + drivers/pinctrl/mediatek/pinctrl-mt76x8.c | 24 ++++++++++++++++++++++- + 1 file changed, 22 insertions(+), 1 deletion(-) + +--- a/drivers/pinctrl/mediatek/pinctrl-mt76x8.c ++++ b/drivers/pinctrl/mediatek/pinctrl-mt76x8.c +@@ -1,10 +1,13 @@ + // SPDX-License-Identifier: GPL-2.0-only + ++#include + #include + #include + #include + #include "pinctrl-mtmips.h" + ++#define SYSC_REG_AGPIO_CFG 0x3c ++ + #define MT76X8_GPIO_MODE_MASK 0x3 + + #define MT76X8_GPIO_MODE_P4LED_KN 58 +@@ -26,6 +29,7 @@ + #define MT76X8_GPIO_MODE_I2C 20 + #define MT76X8_GPIO_MODE_REFCLK 18 + #define MT76X8_GPIO_MODE_PERST 16 ++#define MT76X8_GPIO_MODE_ESD 15 + #define MT76X8_GPIO_MODE_WDT 14 + #define MT76X8_GPIO_MODE_SPI 12 + #define MT76X8_GPIO_MODE_SDMODE 10 +@@ -74,6 +78,12 @@ static struct mtmips_pmx_func refclk_grp + static struct mtmips_pmx_func perst_grp[] = { FUNC("perst", 0, 36, 1) }; + static struct mtmips_pmx_func wdt_grp[] = { FUNC("wdt", 0, 38, 1) }; + static struct mtmips_pmx_func spi_grp[] = { FUNC("spi", 0, 7, 4) }; ++/* ++ * "esd" (Ethernet SDXC) group supports two mode: ++ * "gpio" - SDXC mux to I2S/I2C/GPIO0/UART1 pins with "gpio" mode ++ * "iot" - SDXC mux to EPHY pins, eth p1-p4 pad must be set to "digital" ++ */ ++static struct mtmips_pmx_func esd_grp[] = { FUNC("iot", 0, 47, 1) }; + + static struct mtmips_pmx_func sd_mode_grp[] = { + FUNC("jtag", 3, 22, 8), +@@ -216,6 +226,7 @@ static struct mtmips_pmx_group mt76x8_pi + GRP("perst", perst_grp, 1, MT76X8_GPIO_MODE_PERST), + GRP("wdt", wdt_grp, 1, MT76X8_GPIO_MODE_WDT), + GRP("spi", spi_grp, 1, MT76X8_GPIO_MODE_SPI), ++ GRP("esd", esd_grp, 1, MT76X8_GPIO_MODE_ESD), + GRP_G("sdmode", sd_mode_grp, MT76X8_GPIO_MODE_MASK, + 1, MT76X8_GPIO_MODE_SDMODE), + GRP_G("uart0", uart0_grp, MT76X8_GPIO_MODE_MASK, +@@ -257,7 +268,18 @@ static struct mtmips_pmx_group mt76x8_pi + + static int mt76x8_pinctrl_probe(struct platform_device *pdev) + { +- return mtmips_pinctrl_init(pdev, mt76x8_pinmux_data); ++ int ret; ++ ++ ret = mtmips_pinctrl_init(pdev, mt76x8_pinmux_data); ++ if (ret) ++ return ret; ++ ++ if (of_property_present(pdev->dev.of_node, "ephy-analog")) ++ rt_sysc_m32(0xf << 17, 0, SYSC_REG_AGPIO_CFG); ++ else if (of_property_present(pdev->dev.of_node, "ephy-digital")) ++ rt_sysc_m32(0xf << 17, 0xf << 17, SYSC_REG_AGPIO_CFG); ++ ++ return ret; + } + + static const struct of_device_id mt76x8_pinctrl_match[] = { From cea4aae0a921d71407d11957502f8cc3b652be21 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 1 Jan 2025 16:06:38 +0800 Subject: [PATCH 054/173] ramips: add back SDXC card reader support for HiWiFi HC5x61A After adding the correct package and pin group configurations, the SDXC card slot can now function properly. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17446 Signed-off-by: Hauke Mehrtens --- .../ramips/dts/mt7628an_hiwifi_hc5661a.dts | 20 ++++++++++++++++++- .../ramips/dts/mt7628an_hiwifi_hc5761a.dts | 18 ++++++++++++++++- target/linux/ramips/image/mt76x8.mk | 3 ++- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/target/linux/ramips/dts/mt7628an_hiwifi_hc5661a.dts b/target/linux/ramips/dts/mt7628an_hiwifi_hc5661a.dts index 9e4068ce8c7..52cd3afac89 100644 --- a/target/linux/ramips/dts/mt7628an_hiwifi_hc5661a.dts +++ b/target/linux/ramips/dts/mt7628an_hiwifi_hc5661a.dts @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + #include "mt7628an_hiwifi_hc5x61a.dtsi" / { @@ -25,9 +27,25 @@ }; }; +&pinctrl { + ephy-analog; + + sdxc_router_mode: sdxc_router_mode { + groups = "esd", "gpio", "i2c", "sdmode", "uart1"; + function = "gpio"; + }; +}; + +&sdhci { + status = "okay"; + + pinctrl-0 = <&sdxc_router_mode>; + pinctrl-1 = <&sdxc_router_mode>; +}; + &state_default { gpio { - groups = "i2c", "refclk", "wdt", "wled_an"; + groups = "i2s", "refclk", "wdt", "wled_an"; function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/mt7628an_hiwifi_hc5761a.dts b/target/linux/ramips/dts/mt7628an_hiwifi_hc5761a.dts index 5ec041c8048..940df6e19a7 100644 --- a/target/linux/ramips/dts/mt7628an_hiwifi_hc5761a.dts +++ b/target/linux/ramips/dts/mt7628an_hiwifi_hc5761a.dts @@ -44,9 +44,25 @@ }; }; +&pinctrl { + ephy-analog; + + sdxc_router_mode: sdxc_router_mode { + groups = "esd", "gpio", "i2c", "sdmode", "uart1"; + function = "gpio"; + }; +}; + +&sdhci { + status = "okay"; + + pinctrl-0 = <&sdxc_router_mode>; + pinctrl-1 = <&sdxc_router_mode>; +}; + &state_default { gpio { - groups = "i2c", "refclk", "wdt", "p2led_an", "p3led_an", "wled_an"; + groups = "i2s", "refclk", "wdt", "p2led_an", "p3led_an", "wled_an"; function = "gpio"; }; }; diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index 25a7344afbe..da44b0005c5 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -289,6 +289,7 @@ define Device/hiwifi_hc5661a IMAGE_SIZE := 15808k DEVICE_VENDOR := HiWiFi DEVICE_MODEL := HC5661A + DEVICE_PACKAGES := kmod-mmc-mtk SUPPORTED_DEVICES += hc5661a endef TARGET_DEVICES += hiwifi_hc5661a @@ -297,7 +298,7 @@ define Device/hiwifi_hc5761a IMAGE_SIZE := 15808k DEVICE_VENDOR := HiWiFi DEVICE_MODEL := HC5761A - DEVICE_PACKAGES := kmod-mt76x0e kmod-usb2 kmod-usb-ohci + DEVICE_PACKAGES := kmod-mmc-mtk kmod-mt76x0e kmod-usb2 kmod-usb-ohci endef TARGET_DEVICES += hiwifi_hc5761a From f5996ae947c88461029060d74ace6a85a30dd9fd Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 1 Jan 2025 16:16:29 +0800 Subject: [PATCH 055/173] ramips: fix SDXC function for mt76x8 one eth port devices There are only 5 devices in mt76x8 sub-target selected the MTK SDXC driver package. And they are all single ethernet port routers or dev boards: * LinkIt Smart 7688 * Onion Omega2+ * RAVPower RP-WD009 * VoCore VoCore2 * VoCore VoCore2-Lite For these devices, they are using the ephy p1 - p4 as the SDXC IO pins. Therefore, these GPIO pads must be configured in "digital" IO mode. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17446 Signed-off-by: Hauke Mehrtens --- .../mt7628an_mediatek_linkit-smart-7688.dts | 19 +++++++++++++++ .../ramips/dts/mt7628an_onion_omega2.dtsi | 19 +++++++++++++++ .../ramips/dts/mt7628an_ravpower_rp-wd009.dts | 19 +++++++++++++++ .../ramips/dts/mt7628an_vocore_vocore2.dtsi | 23 +++++++++++++++++++ 4 files changed, 80 insertions(+) diff --git a/target/linux/ramips/dts/mt7628an_mediatek_linkit-smart-7688.dts b/target/linux/ramips/dts/mt7628an_mediatek_linkit-smart-7688.dts index 34ef15eca0b..fab70dc7b7f 100644 --- a/target/linux/ramips/dts/mt7628an_mediatek_linkit-smart-7688.dts +++ b/target/linux/ramips/dts/mt7628an_mediatek_linkit-smart-7688.dts @@ -168,8 +168,27 @@ nvmem-cell-names = "mac-address"; }; +&pinctrl { + ephy-digital; + + sdxc_iot_mode: sdxc_iot_mode { + esd { + groups = "esd"; + function = "iot"; + }; + + sdxc { + groups = "sdmode"; + function = "sdxc"; + }; + }; +}; + &sdhci { status = "okay"; + + pinctrl-0 = <&sdxc_iot_mode>; + pinctrl-1 = <&sdxc_iot_mode>; cd-inverted; }; diff --git a/target/linux/ramips/dts/mt7628an_onion_omega2.dtsi b/target/linux/ramips/dts/mt7628an_onion_omega2.dtsi index d279cbcfb8e..2d45e0385f1 100644 --- a/target/linux/ramips/dts/mt7628an_onion_omega2.dtsi +++ b/target/linux/ramips/dts/mt7628an_onion_omega2.dtsi @@ -170,8 +170,27 @@ nvmem-cell-names = "mac-address"; }; +&pinctrl { + ephy-digital; + + sdxc_iot_mode: sdxc_iot_mode { + esd { + groups = "esd"; + function = "iot"; + }; + + sdxc { + groups = "sdmode"; + function = "sdxc"; + }; + }; +}; + &sdhci { status = "okay"; + + pinctrl-0 = <&sdxc_iot_mode>; + pinctrl-1 = <&sdxc_iot_mode>; }; &wmac { diff --git a/target/linux/ramips/dts/mt7628an_ravpower_rp-wd009.dts b/target/linux/ramips/dts/mt7628an_ravpower_rp-wd009.dts index 607787f68e1..71c77d7ae67 100644 --- a/target/linux/ramips/dts/mt7628an_ravpower_rp-wd009.dts +++ b/target/linux/ramips/dts/mt7628an_ravpower_rp-wd009.dts @@ -84,6 +84,22 @@ }; }; +&pinctrl { + ephy-digital; + + sdxc_iot_mode: sdxc_iot_mode { + esd { + groups = "esd"; + function = "iot"; + }; + + sdxc { + groups = "sdmode"; + function = "sdxc"; + }; + }; +}; + &state_default { gpio { groups = "uart1", "wled_an", "p0led_an", "p2led_an", "p3led_an", @@ -94,6 +110,9 @@ &sdhci { status = "okay"; + + pinctrl-0 = <&sdxc_iot_mode>; + pinctrl-1 = <&sdxc_iot_mode>; }; &i2c { diff --git a/target/linux/ramips/dts/mt7628an_vocore_vocore2.dtsi b/target/linux/ramips/dts/mt7628an_vocore_vocore2.dtsi index 4982d8bccc9..da2026ec7d3 100644 --- a/target/linux/ramips/dts/mt7628an_vocore_vocore2.dtsi +++ b/target/linux/ramips/dts/mt7628an_vocore_vocore2.dtsi @@ -68,6 +68,22 @@ }; }; +&pinctrl { + ephy-digital; + + sdxc_iot_mode: sdxc_iot_mode { + esd { + groups = "esd"; + function = "iot"; + }; + + sdxc { + groups = "sdmode"; + function = "sdxc"; + }; + }; +}; + &state_default { gpio { groups = "wled_an", "refclk", "wdt"; @@ -75,6 +91,13 @@ }; }; +&sdhci { + status = "okay"; + + pinctrl-0 = <&sdxc_iot_mode>; + pinctrl-1 = <&sdxc_iot_mode>; +}; + &wmac { status = "okay"; From 0764e3008228bbdafb5e4a9837fe9efec7e138a0 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 1 Jan 2025 16:17:08 +0800 Subject: [PATCH 056/173] ramips: make package kmod-sdhci-mt7620 conflict with kmod-mmc-mtk These two packages are SDXC drivers for Mediatek mt762x series SoCs. One is upstream implementation, and the other is downstream driver. Installing them together will result in conflicts. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17446 Signed-off-by: Hauke Mehrtens --- target/linux/ramips/modules.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ramips/modules.mk b/target/linux/ramips/modules.mk index ced479dc93e..175ba94eff9 100644 --- a/target/linux/ramips/modules.mk +++ b/target/linux/ramips/modules.mk @@ -47,6 +47,7 @@ $(eval $(call KernelPackage,pwm-mediatek-ramips)) define KernelPackage/sdhci-mt7620 SUBMENU:=Other modules TITLE:=MT7620 SDCI + CONFLICTS:=kmod-mmc-mtk DEPENDS:=@(TARGET_ramips_mt7620||TARGET_ramips_mt76x8||TARGET_ramips_mt7621) +kmod-mmc KCONFIG:= \ CONFIG_MTK_MMC \ From b4a9f85c1394f13806fc2f51f5f6f23494773d7e Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 1 Jan 2025 16:17:53 +0800 Subject: [PATCH 057/173] ramips: mtk-mmc: remove nt76x8 pinctrl hack Now we can set the mt76x8 SDXC pinmux in device tree. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17446 Signed-off-by: Hauke Mehrtens --- target/linux/ramips/files/drivers/mmc/host/mtk-mmc/sd.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/target/linux/ramips/files/drivers/mmc/host/mtk-mmc/sd.c b/target/linux/ramips/files/drivers/mmc/host/mtk-mmc/sd.c index df95900a26e..a9c242bfd36 100644 --- a/target/linux/ramips/files/drivers/mmc/host/mtk-mmc/sd.c +++ b/target/linux/ramips/files/drivers/mmc/host/mtk-mmc/sd.c @@ -2210,12 +2210,6 @@ static int msdc_drv_probe(struct platform_device *pdev) struct msdc_hw *hw; int ret; - //FIXME: this should be done by pinconf and not by the sd driver - if ((ralink_soc == MT762X_SOC_MT7688 || - ralink_soc == MT762X_SOC_MT7628AN) && - (!(rt_sysc_r32(0x60) & BIT(15)))) - rt_sysc_m32(0xf << 17, 0xf << 17, 0x3c); - hw = &msdc0_hw; if (of_property_read_bool(pdev->dev.of_node, "mtk,wp-en")) From 14be320291e0c00a1291ad8bd220fd37b12ba138 Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Fri, 3 Jan 2025 19:59:22 +0100 Subject: [PATCH 058/173] lantiq: xrx200: add support for lan3 and lan4 on AVM 5490/5491 On the AVM 5490/5491, lan1, lan2 and wan ports are connected directly to the internal GSWIP switch. The lan3 and lan4 ports are connected via an external QCA8334 switch. This commit adds the missing entries in dts and adds the driver module. Signed-off-by: Aleksander Jan Bajkowski Link: https://github.com/openwrt/openwrt/pull/17473 Signed-off-by: Hauke Mehrtens --- .../boot/dts/lantiq/vr9_avm_fritz5490.dtsi | 66 +++++++++++++++++++ target/linux/lantiq/image/vr9.mk | 4 +- .../xrx200/base-files/etc/board.d/02_network | 6 +- 3 files changed, 70 insertions(+), 6 deletions(-) diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz5490.dtsi b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz5490.dtsi index b38ac9f8b84..2ba8e680b48 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz5490.dtsi +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz5490.dtsi @@ -46,6 +46,61 @@ phy9: ethernet-phy@9 { reg = <0x09>; }; + + switch@0 { + compatible = "qca,qca8334"; + #address-cells = <1>; + #size-cells = <0>; + + reset-gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + reg = <0>; + + dsa,member = <1 0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + ethernet = <&rgmii0>; + phy-mode = "rgmii-txid"; + tx-internal-delay-ps = <3000>; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + + port@2 { + reg = <2>; + label = "lan3"; + phy-mode = "internal"; + phy-handle = <&phy_port2>; + }; + + port@3 { + reg = <3>; + label = "lan4"; + phy-mode = "internal"; + phy-handle = <&phy_port3>; + }; + }; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + + phy_port2: phy@1 { + reg = <1>; + }; + + phy_port3: phy@2 { + reg = <2>; + }; + }; + }; }; &gswip_ports { @@ -56,6 +111,17 @@ phy-handle = <&phy6>; }; + rgmii0: port@1 { + reg = <1>; + label = "sw0"; + phy-mode = "rgmii"; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + port@2 { reg = <2>; label = "lan2"; diff --git a/target/linux/lantiq/image/vr9.mk b/target/linux/lantiq/image/vr9.mk index e2608213dc5..48a372f4768 100644 --- a/target/linux/lantiq/image/vr9.mk +++ b/target/linux/lantiq/image/vr9.mk @@ -177,7 +177,7 @@ define Device/avm_fritz5490 DEVICE_VARIANT := Other NAND KERNEL_SIZE := 4096k IMAGE_SIZE := 49152k - DEVICE_PACKAGES := kmod-usb3 fritz-tffs \ + DEVICE_PACKAGES := kmod-dsa-qca8k kmod-phy-qca83xx kmod-usb3 fritz-tffs \ -ltq-vdsl-vr9-vectoring-fw-installer -kmod-ltq-vdsl-vr9-mei \ -kmod-ltq-vdsl-vr9 -kmod-ltq-atm-vr9 -kmod-ltq-ptm-vr9 \ -ltq-vdsl-vr9-app -kmod-owl-loader \ @@ -195,7 +195,7 @@ define Device/avm_fritz5490-micron DEVICE_VARIANT := Micron NAND KERNEL_SIZE := 4096k IMAGE_SIZE := 49152k - DEVICE_PACKAGES := kmod-usb3 fritz-tffs \ + DEVICE_PACKAGES := kmod-dsa-qca8k kmod-phy-qca83xx kmod-usb3 fritz-tffs \ -ltq-vdsl-vr9-vectoring-fw-installer -kmod-ltq-vdsl-vr9-mei \ -kmod-ltq-vdsl-vr9 -kmod-ltq-atm-vr9 -kmod-ltq-ptm-vr9 \ -ltq-vdsl-vr9-app -kmod-owl-loader \ diff --git a/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network b/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network index 6c35c7a4deb..8c2cdb12af5 100644 --- a/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network +++ b/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network @@ -14,15 +14,13 @@ lantiq_setup_interfaces() arcadyan,arv7519rw22) ucidef_set_interface_lan "lan1 lan2 lan3 lan4 lan5" ;; - avm,fritz5490|\ - avm,fritz5490-micron) - ucidef_set_interfaces_lan_wan "lan1 lan2" "wan" - ;; arcadyan,vgv7510kw22-brn|\ arcadyan,vgv7510kw22-nor|\ arcadyan,vgv7519-brn|\ arcadyan,vgv7519-nor|\ arcadyan,vrv9510kwac23|\ + avm,fritz5490|\ + avm,fritz5490-micron|\ bt,homehub-v5a|\ lantiq,easy80920-nand|\ lantiq,easy80920-nor|\ From 58056df84f6dfd0c86d45e2e22d715a3c501ce1e Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 24 Nov 2024 12:43:07 -0800 Subject: [PATCH 059/173] bcm53xx: backport nvmem mac for meraki mr26 Avoids having to set the MAC in userspace. Also added a mac-base change to set the wifi MACs. It's not clear if upstream would want it once mac-base is upstreamed. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/17064 Signed-off-by: Robert Marko --- .../bcm53xx/base-files/etc/board.d/02_network | 5 -- .../hotplug.d/ieee80211/10-fix-mac-address | 18 ----- ...eraki-mr26-set-mac-address-for-gmac0.patch | 52 ++++++++++++++ ...ARM-dts-meraki-mr26-wifi-MACs-in-dts.patch | 67 +++++++++++++++++++ 4 files changed, 119 insertions(+), 23 deletions(-) delete mode 100644 target/linux/bcm53xx/base-files/etc/hotplug.d/ieee80211/10-fix-mac-address create mode 100644 target/linux/bcm53xx/patches-6.6/050-v6.13-ARM-dts-meraki-mr26-set-mac-address-for-gmac0.patch create mode 100644 target/linux/bcm53xx/patches-6.6/051-ARM-dts-meraki-mr26-wifi-MACs-in-dts.patch diff --git a/target/linux/bcm53xx/base-files/etc/board.d/02_network b/target/linux/bcm53xx/base-files/etc/board.d/02_network index 19569e7a781..5edf6ec9b8f 100644 --- a/target/linux/bcm53xx/base-files/etc/board.d/02_network +++ b/target/linux/bcm53xx/base-files/etc/board.d/02_network @@ -71,11 +71,6 @@ bcm53xx_setup_macs() etXmacaddr=$(nvram get et0macaddr) offset=5 ;; - meraki,mr26) - label_mac="$(mtd_get_mac_binary_ubi board-config 0x66)" - ucidef_set_interface_macaddr "lan" "$label_mac" - ucidef_set_label_macaddr "$label_mac" - ;; meraki,mx64 | \ meraki,mx64-a0 | \ meraki,mx65) diff --git a/target/linux/bcm53xx/base-files/etc/hotplug.d/ieee80211/10-fix-mac-address b/target/linux/bcm53xx/base-files/etc/hotplug.d/ieee80211/10-fix-mac-address deleted file mode 100644 index c1c56a10f39..00000000000 --- a/target/linux/bcm53xx/base-files/etc/hotplug.d/ieee80211/10-fix-mac-address +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/ash - -[ "$ACTION" = "add" ] || exit 0 - -PHYNBR=${DEVPATH##*/phy} - -[ -n $PHYNBR ] || exit 0 - -. /lib/functions.sh -. /lib/functions/system.sh - -board=$(board_name) - -case "$board" in -meraki,mr26) - macaddr_add "$(macaddr_setbit_la $(mtd_get_mac_binary_ubi 'board-config' 0x66))" $(($PHYNBR * 8 + 1)) > /sys${DEVPATH}/macaddress - ;; -esac diff --git a/target/linux/bcm53xx/patches-6.6/050-v6.13-ARM-dts-meraki-mr26-set-mac-address-for-gmac0.patch b/target/linux/bcm53xx/patches-6.6/050-v6.13-ARM-dts-meraki-mr26-set-mac-address-for-gmac0.patch new file mode 100644 index 00000000000..f6a6f819d1a --- /dev/null +++ b/target/linux/bcm53xx/patches-6.6/050-v6.13-ARM-dts-meraki-mr26-set-mac-address-for-gmac0.patch @@ -0,0 +1,52 @@ +From ad1915e2070cf832bfb81dcbeb44b073c09e6dcc Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Sun, 20 Oct 2024 18:51:47 -0700 +Subject: [PATCH] ARM: dts: meraki-mr26: set mac address for gmac0 + +Currently this needs to be done in userspace. + +Signed-off-by: Rosen Penev +Link: https://lore.kernel.org/r/20241021015147.172700-1-rosenp@gmail.com +Signed-off-by: Florian Fainelli +--- + .../dts/broadcom/bcm53015-meraki-mr26.dts | 20 +++++++++++++++++++ + 1 file changed, 20 insertions(+) + +--- a/arch/arm/boot/dts/broadcom/bcm53015-meraki-mr26.dts ++++ b/arch/arm/boot/dts/broadcom/bcm53015-meraki-mr26.dts +@@ -59,6 +59,9 @@ + + &gmac0 { + status = "okay"; ++ ++ nvmem-cells = <&macaddr_board_config_66>; ++ nvmem-cell-names = "mac-address"; + }; + + &gmac1 { +@@ -102,8 +105,25 @@ + }; + + partition@800000 { ++ compatible = "linux,ubi"; + label = "ubi"; + reg = <0x800000 0x7780000>; ++ ++ volumes { ++ ubi-volume-board-config { ++ volname = "board-config"; ++ ++ nvmem-layout { ++ compatible = "fixed-layout"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ macaddr_board_config_66: macaddr@66 { ++ reg = <0x66 0x6>; ++ }; ++ }; ++ }; ++ }; + }; + }; + }; diff --git a/target/linux/bcm53xx/patches-6.6/051-ARM-dts-meraki-mr26-wifi-MACs-in-dts.patch b/target/linux/bcm53xx/patches-6.6/051-ARM-dts-meraki-mr26-wifi-MACs-in-dts.patch new file mode 100644 index 00000000000..fd31438cdb2 --- /dev/null +++ b/target/linux/bcm53xx/patches-6.6/051-ARM-dts-meraki-mr26-wifi-MACs-in-dts.patch @@ -0,0 +1,67 @@ +From c18e0b14b466fb0aa17c8ca6e61f16ba1254aebd Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Sun, 24 Nov 2024 12:58:51 -0800 +Subject: [PATCH] ARM: dts: meraki-mr26: wifi MACs in dts + +OPENWRT HACK. Probably will not be accepted upstream. + +Signed-off-by: Rosen Penev +--- + .../dts/broadcom/bcm53015-meraki-mr26.dts | 31 ++++++++++++++++++- + 1 file changed, 30 insertions(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/broadcom/bcm53015-meraki-mr26.dts ++++ b/arch/arm/boot/dts/broadcom/bcm53015-meraki-mr26.dts +@@ -60,7 +60,7 @@ + &gmac0 { + status = "okay"; + +- nvmem-cells = <&macaddr_board_config_66>; ++ nvmem-cells = <&macaddr_board_config_66 0>; + nvmem-cell-names = "mac-address"; + }; + +@@ -74,6 +74,33 @@ + status = "disabled"; + }; + ++&pcie0 { ++ wifi@0,0 { ++ reg = <0x0000 0 0 0 0>; ++ compatible = "brcm,bcm43431"; ++ nvmem-cells = <&macaddr_board_config_66 1>; ++ nvmem-cell-names = "mac-address"; ++ }; ++}; ++ ++&pcie1 { ++ wifi@0,0 { ++ reg = <0x0000 0 0 0 0>; ++ compatible = "brcm,bcm43431"; ++ nvmem-cells = <&macaddr_board_config_66 2>; ++ nvmem-cell-names = "mac-address"; ++ }; ++}; ++ ++&pcie2 { ++ wifi@0,0 { ++ reg = <0x0000 0 0 0 0>; ++ compatible = "brcm,bcm43428"; ++ nvmem-cells = <&macaddr_board_config_66 3>; ++ nvmem-cell-names = "mac-address"; ++ }; ++}; ++ + &nandcs { + partitions { + compatible = "fixed-partitions"; +@@ -119,7 +146,9 @@ + #size-cells = <1>; + + macaddr_board_config_66: macaddr@66 { ++ compatible = "mac-base"; + reg = <0x66 0x6>; ++ #nvmem-cell-cells = <1>; + }; + }; + }; From 3410ad2f40c085e5db7a71f6ae4b80734826a1e3 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Fri, 13 Dec 2024 13:30:38 +0800 Subject: [PATCH 060/173] base-files: enable get_mac_ascii() to handle redundant strings The function get_mac_ascii() will fail when there are two or more same MAC address variable names in the mtd partition. Only retain the first variable to workaround this rare situation. Fixes: https://github.com/openwrt/openwrt/issues/17236 Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17262 Signed-off-by: Hauke Mehrtens --- package/base-files/files/lib/functions/system.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/base-files/files/lib/functions/system.sh b/package/base-files/files/lib/functions/system.sh index 048e32f0e16..aaeb75f2616 100644 --- a/package/base-files/files/lib/functions/system.sh +++ b/package/base-files/files/lib/functions/system.sh @@ -66,7 +66,7 @@ get_mac_ascii() { local key="$2" local mac_dirty - mac_dirty=$(strings "$part" | sed -n 's/^'"$key"'=//p') + mac_dirty=$(strings "$part" | sed -n 's/^'"$key"'=//p' | head -n 1) # "canonicalize" mac [ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty" From 551e04f3c9c063d885ca7a91db36f27f684a3a5c Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Mon, 16 Dec 2024 15:09:50 +0800 Subject: [PATCH 061/173] base-files: strip space and tab characters from ASCII mac address Spaces and tabs are widely used in variable definitions. We have to remove them to ensure that get_mac_ascii() works properly. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17262 Signed-off-by: Hauke Mehrtens --- package/base-files/files/lib/functions/system.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/base-files/files/lib/functions/system.sh b/package/base-files/files/lib/functions/system.sh index aaeb75f2616..f43281b5dce 100644 --- a/package/base-files/files/lib/functions/system.sh +++ b/package/base-files/files/lib/functions/system.sh @@ -66,7 +66,7 @@ get_mac_ascii() { local key="$2" local mac_dirty - mac_dirty=$(strings "$part" | sed -n 's/^'"$key"'=//p' | head -n 1) + mac_dirty=$(strings "$part" | tr -d ' \t' | sed -n 's/^'"$key"'=//p' | head -n 1) # "canonicalize" mac [ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty" From 4baa20ec661725550a830e7c86f9f75cbb1fbc4b Mon Sep 17 00:00:00 2001 From: Thomas Richard Date: Fri, 3 Jan 2025 10:19:05 +0100 Subject: [PATCH 062/173] include/trusted-firmware-a.mk: unset CC before compiling If CC is explicitly set to a non default value, TF-A keeps this value. Otherwise it assigns generic default value. As the build bot set CC=/usr/bin/gcc-10, TF-A uses it which causes a compile issue. So unset CC before compiling. It's a new behavior since v2.12. A part of the explanation is available in this commit [1]. [1] https://github.com/ARM-software/arm-trusted-firmware/commit/e01c71266f9df46ac46dc72669449490d1c94419 Signed-off-by: Thomas Richard Link: https://github.com/openwrt/openwrt/pull/17465 Signed-off-by: Hauke Mehrtens --- include/trusted-firmware-a.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/trusted-firmware-a.mk b/include/trusted-firmware-a.mk index c0d11d68c4b..c329b76c56a 100644 --- a/include/trusted-firmware-a.mk +++ b/include/trusted-firmware-a.mk @@ -77,7 +77,8 @@ endef DTC=$(wildcard $(LINUX_DIR)/scripts/dtc/dtc) define Build/Compile/Trusted-Firmware-A - +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ + +unset CC; \ + $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ CROSS_COMPILE=$(TARGET_CROSS) \ OPENSSL_DIR=$(STAGING_DIR_HOST) \ $(if $(DTC),DTC="$(DTC)") \ From d5545a9595cdf9571fbf1e57ae03291145feeceb Mon Sep 17 00:00:00 2001 From: "Anton Yu. Ivanusev" Date: Thu, 26 Dec 2024 09:42:53 +0500 Subject: [PATCH 063/173] ramips: mt76x8: add support for Keenetic Extra (KN-1713) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Specification: SoC: MediaTek MT7628AN RAM: 128M DDR2, Etron Technology EM68C16CWQG-25H Flash: 32M, cFeon EN25QH256A (Dual Boot, SPI) Switch: MediaTek MT7628AN, 4 ports 100 Mbps WiFi: MediaTek MT7628AN 2.4 GHz 802.11n and MediaTek MT7613BEN 5 GHz 802.11ac USB: 1 port USB 2.0 GPIO: 3 buttons (Wi-Fi, Reset, FN), 4 LEDs (Power, Internet, FN, Wi-Fi), USB port power controls Disassembly: There are 2 screws at the bottom. After removing the screws, pry the gray plastic part around (it is secured with latches) and remove it. UART Interface: The UART interface can be connected to the 5 pin located between the WAN port and the RESET button. Pins (from WAN port to Reset button): VCC, TX, RX, NC, GRD Settings: 115200, 8N1 Flashing via OEM recovery software: 1. Download the OEM recovery software from the manufacturer's website 2. Download the firmware image (for OpenWRT it is *-squashfs-factory.bin), rename it to KN-1713_recovery.bin 3. Replace the file in the fw folder OEM recovery software with the file from step 2. 4. Run the OEM recovery software and follow the instructions. Flashing via TFTP: 1. Connect your PC and router to port 1-3, configure PC interface using IP 192.168.1.2, mask 255.255.255.252 2. Serve the firmware image (for OpenWRT it is *-squashfs-factory.bin) renamed to KN-1713_recovery.bin via TFTP 3. Power up the router while pressing Reset button on the back 4. Release Restart button when Power LED starts blinking To revert back to OEM firmware: The return to the OEM firmware is carried out by using the methods described above with the help of the appropriate firmware image. When using OEM bootloader, the firmware image size cannot exceed the size of one OEM «Firmware_x» partition or Kernel + rootFS size. Signed-off-by: Anton Yu. Ivanusev Link: https://github.com/openwrt/openwrt/pull/17382 Signed-off-by: Hauke Mehrtens --- .../ramips/dts/mt7628an_keenetic_kn-1713.dts | 241 ++++++++++++++++++ target/linux/ramips/image/mt76x8.mk | 12 + .../mt76x8/base-files/etc/board.d/01_leds | 3 +- .../mt76x8/base-files/etc/board.d/02_network | 1 + 4 files changed, 256 insertions(+), 1 deletion(-) create mode 100644 target/linux/ramips/dts/mt7628an_keenetic_kn-1713.dts diff --git a/target/linux/ramips/dts/mt7628an_keenetic_kn-1713.dts b/target/linux/ramips/dts/mt7628an_keenetic_kn-1713.dts new file mode 100644 index 00000000000..972c88eadd0 --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_keenetic_kn-1713.dts @@ -0,0 +1,241 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +#include "mt7628an.dtsi" + +#include +#include +#include + +/ { + compatible = "keenetic,kn-1713", "mediatek,mt7628an-soc"; + model = "Keenetic KN-1713"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "USB-power"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + + leds { + compatible = "gpio-leds"; + + led_power: power { + function = LED_FUNCTION_POWER; + color = ; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + + internet { + function = LED_FUNCTION_WAN; + color = ; + gpios = <&gpio 38 GPIO_ACTIVE_LOW>; + }; + + fn { + function = LED_FUNCTION_USB; + color = ; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + + wifi { + function = LED_FUNCTION_WLAN; + color = ; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt","phy1tpt"; + }; + }; + + + keys { + compatible = "gpio-keys"; + + fn { + label = "fn"; + gpios = <&gpio 32 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + reset { + label = "restart"; + gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 37 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + virtual_flash { + compatible = "mtd-concat"; + devices = <&firmware1 &firmware2>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x0 0x1CC0000>; + }; + }; + }; +}; + +&state_default { + gpio { + groups = "i2s", "i2c", "gpio", "refclk", "wdt", "wled_an"; + function = "gpio"; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <104000000>; + + partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-config"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "rf-eeprom"; + reg = <0x40000 0x10000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x400>; + }; + + eeprom_factory_400: eeprom@400 { + reg = <0x400 0x4da8>; + }; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; + }; + }; + + firmware1: partition@50000 { + label = "firmware_1"; + reg = <0x50000 0xe60000>; + }; + + partition@EB0000 { + label = "config_1"; + reg = <0xEB0000 0x40000>; + read-only; + }; + + partition@EF0000 { + label = "storage"; + reg = <0xEF0000 0x100000>; + read-only; + }; + + partition@FF0000 { + label = "dump"; + reg = <0xFF0000 0x10000>; + read-only; + }; + + partition@1000000 { + label = "u-state"; + reg = <0x1000000 0x30000>; + read-only; + }; + + partition@1030000 { + label = "u-config_res"; + reg = <0x1030000 0x10000>; + read-only; + }; + + partition@1040000 { + label = "rf-eeprom_res"; + reg = <0x1040000 0x10000>; + read-only; + }; + + firmware2: partition@1050000 { + label = "firmware_2"; + reg = <0x1050000 0xE60000>; + }; + + partition@1EB0000 { + label = "Config_2"; + reg = <0x1EB0000 0x40000>; + read-only; + }; + }; + }; +}; + +ðernet { + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&wmac { + status = "okay"; + + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&eeprom_factory_400>; + nvmem-cell-names = "eeprom"; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index da44b0005c5..dbad26a140c 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -366,6 +366,18 @@ define Device/keenetic_kn-1613 endef TARGET_DEVICES += keenetic_kn-1613 +define Device/keenetic_kn-1713 + BLOCKSIZE := 64k + IMAGE_SIZE := 13434880 + DEVICE_VENDOR := Keenetic + DEVICE_MODEL := KN-1713 + DEVICE_PACKAGES := kmod-mt7615e kmod-mt7663-firmware-ap kmod-usb2 + IMAGES += factory.bin + IMAGE/factory.bin := $$(sysupgrade_bin) | pad-to $$$$(BLOCKSIZE) | \ + check-size | zyimage -d 0x801713 -v "KN-1713" +endef +TARGET_DEVICES += keenetic_kn-1713 + define Device/keenetic_kn-3211 IMAGE_SIZE := 31488k DEVICE_VENDOR := Keenetic diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds index 00e5086bb3f..fda4fa3bdf3 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds @@ -58,7 +58,8 @@ hiwifi,hc5661a|\ hiwifi,hc5761a) ucidef_set_led_switch "internet" "internet" "blue:internet" "switch0" "0x10" ;; -keenetic,kn-1613) +keenetic,kn-1613|\ +keenetic,kn-1713) ucidef_set_led_switch "internet" "internet" "green:internet" "switch0" "0x01" ;; mediatek,linkit-smart-7688) diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network index e57643690a1..10e0e84dde3 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network @@ -130,6 +130,7 @@ ramips_setup_interfaces() "0:lan" "1:lan" "2:lan" "6@eth0" ;; keenetic,kn-1613|\ + keenetic,kn-1713|\ motorola,mwr03) ucidef_add_switch "switch0" \ "1:lan" "2:lan" "3:lan" "0:wan" "6@eth0" From 5d0f61e957ff19a7f6ad0b733c8b422f965525c5 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sat, 28 Dec 2024 17:38:11 +0900 Subject: [PATCH 064/173] mediatek: mt7622: improve fixup of trx for Buffalo devices Unify the common part to the function and don't fixup trx when booting with initramfs image. Signed-off-by: INAGAKI Hiroshi Link: https://github.com/openwrt/openwrt/pull/17408 Signed-off-by: Hauke Mehrtens --- .../base-files/etc/uci-defaults/09_fix_crc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/09_fix_crc b/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/09_fix_crc index 59b00a6e69b..25c8a0359ba 100644 --- a/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/09_fix_crc +++ b/target/linux/mediatek/mt7622/base-files/etc/uci-defaults/09_fix_crc @@ -1,14 +1,22 @@ . /lib/functions.sh -kernel_size=$(sed -n 's/mtd[0-9]*: \([0-9a-f]*\).*"\(kernel\|linux\)".*/\1/p' /proc/mtd) +# don't modify FW data when booting with initramfs image +fstype="$(/bin/mount | awk '($3 ~ /^\/$/) && ($5 !~ /rootfs/) { print $5 }')" +[ "$fstype" = "tmpfs" ] && \ + exit 0 + +fixup_trx_crc() { + local trx_magic="$1" + local kernel_size=$(sed -n 's/mtd[0-9]*: \([0-9a-f]*\).*"\(kernel\|linux\)".*/\1/p' /proc/mtd) + + mtd -M $trx_magic ${kernel_size:+-c 0x$kernel_size} fixtrx firmware +} case "$(board_name)" in buffalo,wsr-2533dhp2) - mtd -M 0x44485032 ${kernel_size:+-c 0x$kernel_size} fixtrx firmware && exit 0 - exit 1 + fixup_trx_crc 0x44485032 ;; buffalo,wsr-3200ax4s) - mtd -M 0x44485033 ${kernel_size:+-c 0x$kernel_size} fixtrx firmware && exit 0 - exit 1 + fixup_trx_crc 0x44485033 ;; esac From 376d8f96b1d1285a6fce711146d223d5d325edf5 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sat, 28 Dec 2024 17:48:02 +0900 Subject: [PATCH 065/173] mediatek: mt7622: sync buffalo.sh with ramips/mt7621 Sync buffalo.sh with the one in ramips/mt7621 to improve handling of the TRX magic numbers of Buffalo WSR devices and switching sysupgrade method between buffalo_upgrade_ubinized() and nand_do_upgrade(). Signed-off-by: INAGAKI Hiroshi Link: https://github.com/openwrt/openwrt/pull/17408 Signed-off-by: Hauke Mehrtens --- .../mt7622/base-files/lib/upgrade/buffalo.sh | 27 ++++++++++++++++--- .../mt7622/base-files/lib/upgrade/platform.sh | 11 +------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/target/linux/mediatek/mt7622/base-files/lib/upgrade/buffalo.sh b/target/linux/mediatek/mt7622/base-files/lib/upgrade/buffalo.sh index 844cc4ed959..fcfea36966d 100644 --- a/target/linux/mediatek/mt7622/base-files/lib/upgrade/buffalo.sh +++ b/target/linux/mediatek/mt7622/base-files/lib/upgrade/buffalo.sh @@ -34,20 +34,30 @@ # # The mtd partitions "firmware" and "Kernel2" on NAND flash are os-image # partitions. These partitions are called as "Image1/Image2" in U-Boot -# on WSR-2533DHP2, and they are checked conditions when booting. +# on WSR devices, and they are checked conditions when booting. # "Image1" is always used for booting. # # == U-Boot Behaviors == # - "Image1"/"Image2" images are good, images are different or # "Image2" image is broken -# -> writes os-image to "Image2" from "Image1" +# -> copy os-image to "Image2" from "Image1" # # - "Image1" image is broken -# -> writes os-image to "Image1" from "Image2" +# -> copy os-image to "Image1" from "Image2" # # - "Image1"/"Image2" images are broken # -> fall to U-Boot command line +# TRX magic numbers of each model +case "$(board_name)" in +buffalo,wsr-2533dhp2) + BUFFALO_TRX_MAGIC="44485032" # "DHP2" + ;; +buffalo,wsr-3200ax4s) + BUFFALO_TRX_MAGIC="44485033" # "DHP3" + ;; +esac + buffalo_check_image() { local board="$1" local boardname="$(echo $board | tr ',' '_')" @@ -56,7 +66,7 @@ buffalo_check_image() { # return error state if TRX + UBI formatted image specified # to notify about configurations - if [ "$magic" = "44485032" -o "$magic" = "44485033" ]; then + if [ "$magic" = "$BUFFALO_TRX_MAGIC" ]; then echo "Your configurations won't be saved if factory-uboot.bin image specified." echo "But if you want to upgrade, please execute sysupgrade with \"-F\" option." return 1 @@ -124,3 +134,12 @@ buffalo_upgrade_ubinized() { exit 1 fi } + +buffalo_do_upgrade() { + if [ "$(get_magic_long "$1")" = "$BUFFALO_TRX_MAGIC" ]; then + buffalo_upgrade_ubinized "$1" + else + CI_KERNPART="firmware" + nand_do_upgrade "$1" + fi +} 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 2607f170e05..f017509637e 100755 --- a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh @@ -16,16 +16,7 @@ platform_do_upgrade() { ;; buffalo,wsr-2533dhp2|\ buffalo,wsr-3200ax4s) - local magic="$(get_magic_long "$1")" - - # use "mtd write" if the magic is "DHP2 (0x44485032)" - # or "DHP3 (0x44485033)" - if [ "$magic" = "44485032" -o "$magic" = "44485033" ]; then - buffalo_upgrade_ubinized "$1" - else - CI_KERNPART="firmware" - nand_do_upgrade "$1" - fi + buffalo_do_upgrade "$1" ;; dlink,eagle-pro-ai-m32-a1|\ dlink,eagle-pro-ai-r32-a1|\ From a06a2ef89db03fac2cbd950304e5b507da9deb1e Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sat, 28 Dec 2024 19:07:09 +0900 Subject: [PATCH 066/173] mediatek: append metadata to factory-uboot.bin for WSR devices Append metadata to factory-uboot.bin image to pass the image verification on sysupgrade. Signed-off-by: INAGAKI Hiroshi Link: https://github.com/openwrt/openwrt/pull/17408 Signed-off-by: Hauke Mehrtens --- target/linux/mediatek/image/mt7622.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk index 9f5fdc86888..faf1b20e4ac 100644 --- a/target/linux/mediatek/image/mt7622.mk +++ b/target/linux/mediatek/image/mt7622.mk @@ -123,7 +123,7 @@ define Device/buffalo_wsr buffalo-enc $$(DEVICE_MODEL) $$(BUFFALO_TAG_VERSION) -l | \ buffalo-tag-dhp $$(DEVICE_MODEL) JP JP | buffalo-enc-tag -l | buffalo-dhp-image IMAGE/factory-uboot.bin := append-ubi | \ - buffalo-trx $$$$(BUFFALO_TRX_MAGIC) $$$$@ $(KDIR)/ubi_mark + buffalo-trx $$$$(BUFFALO_TRX_MAGIC) $$$$@ $(KDIR)/ubi_mark | append-metadata IMAGE/sysupgrade.bin := \ buffalo-trx $$$$(BUFFALO_TRX_MAGIC) $(KDIR)/tmp/$$(DEVICE_NAME).null | \ sysupgrade-tar kernel=$$$$@ | append-metadata From d5669c040beb0fa29e6916049941f0e76ce07460 Mon Sep 17 00:00:00 2001 From: John Audia Date: Sat, 4 Jan 2025 16:36:20 +0100 Subject: [PATCH 067/173] bcm27xx: remove duplicated kmod-rp1-pio package MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit f105d1a9a9739267fb25612d039c392a397775bd added a duplicated kmod-rp1-pio package. Also remove unneeded blank lines added by the same commit. Fixes: f105d1a9a973 ("bcm27xx/bcm2712: Fix-up RP1 modules") Signed-off-by: John Audia Signed-off-by: Álvaro Fernández Rojas --- target/linux/bcm27xx/modules/hwmon.mk | 2 -- target/linux/bcm27xx/modules/other.mk | 17 ----------------- 2 files changed, 19 deletions(-) diff --git a/target/linux/bcm27xx/modules/hwmon.mk b/target/linux/bcm27xx/modules/hwmon.mk index db8ba30f875..320b11708f9 100644 --- a/target/linux/bcm27xx/modules/hwmon.mk +++ b/target/linux/bcm27xx/modules/hwmon.mk @@ -32,5 +32,3 @@ define KernelPackage/hwmon-raspberrypi/description endef $(eval $(call KernelPackage,hwmon-raspberrypi)) - - diff --git a/target/linux/bcm27xx/modules/other.mk b/target/linux/bcm27xx/modules/other.mk index 099ce3ce14d..7ec35c95f0b 100644 --- a/target/linux/bcm27xx/modules/other.mk +++ b/target/linux/bcm27xx/modules/other.mk @@ -139,20 +139,3 @@ define KernelPackage/rp1-mailbox/description endef $(eval $(call KernelPackage,rp1-mailbox)) - - -define KernelPackage/rp1-pio - SUBMENU:=$(OTHER_MENU) - TITLE:=RP1 PIO driver - KCONFIG:=CONFIG_RP1_PIO - FILES:=$(LINUX_DIR)/drivers/misc/rp1-pio.ko - AUTOLOAD:=$(call AutoLoad,21,rp1-pio) - DEPENDS:=@TARGET_bcm27xx_bcm2712 +kmod-rp1 -endef - -define KernelPackage/rp1-pio/description - Driver for the RP1 PIO. -endef - -$(eval $(call KernelPackage,rp1-pio)) - From e7419381fdd43a49e7583a786ce2d9c2ed1b4afe Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Thu, 2 Jan 2025 15:44:45 +0100 Subject: [PATCH 068/173] ath79: Push MV88E6060 DSA switch into package We can use a package for the MV88E6060 DSA switch on the single ath79 device that uses it, saving around 600 KB of memory on all other devices (for the DSA infrastructure, mainly). As far as I can see the TP-Link TL WR941 v2 is the only device using MV88E6060 and the only device with a DSA switch overall. However the ath79 people should look at this so I'm not mistaken. Signed-off-by: Linus Walleij Link: https://patchwork.ozlabs.org/project/openwrt/patch/20250102-ath79-mv88e6060-module-v1-1-c2a8e31e72fc@linaro.org/ Signed-off-by: Hauke Mehrtens --- target/linux/ath79/image/tiny-tp-link.mk | 1 + target/linux/ath79/tiny/config-default | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/target/linux/ath79/image/tiny-tp-link.mk b/target/linux/ath79/image/tiny-tp-link.mk index 93cbc7d148c..70c3ab4c7b5 100644 --- a/target/linux/ath79/image/tiny-tp-link.mk +++ b/target/linux/ath79/image/tiny-tp-link.mk @@ -481,6 +481,7 @@ define Device/tplink_tl-wr941-v2 $(Device/tplink-4m) SOC := ar9132 DEVICE_MODEL := TL-WR941ND + DEVICE_PACKAGES := kmod-dsa-mv88e6060 DEVICE_VARIANT := v2/v3 DEVICE_ALT0_VENDOR := TP-Link DEVICE_ALT0_MODEL := TL-WR941N diff --git a/target/linux/ath79/tiny/config-default b/target/linux/ath79/tiny/config-default index e47260df820..38fbe1b5228 100644 --- a/target/linux/ath79/tiny/config-default +++ b/target/linux/ath79/tiny/config-default @@ -1,9 +1,6 @@ CONFIG_GRO_CELLS=y CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y CONFIG_NET_DEVLINK=y -CONFIG_NET_DSA=y -CONFIG_NET_DSA_MV88E6060=y -CONFIG_NET_DSA_TAG_TRAILER=y CONFIG_NET_SWITCHDEV=y CONFIG_NVMEM_SYSFS=y CONFIG_NVMEM_U_BOOT_ENV=y From c9ae39b2d156ff893d88a7d75b9044aac2fdd8d0 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Wed, 1 Jan 2025 22:18:05 +0100 Subject: [PATCH 069/173] realtek: trim default package selection Images for certain devices are staring to become too large, as some device only have 6MB available in their vendor partition layout for the initial install. This is especially pressing for bootloaders only supporting gzip compression. Drop some packages from DEFAULT_PACKAGES that aren't strictly required for a factory install. The user can always install more packages later using opkg/apk, or via a sysupgrade to a custom build. firewall4 is kept to ensure the most recent firewall package is selected in builds including LuCI. ethtool is kept as a frequently used diagnostics tool. Link: https://github.com/openwrt/openwrt/pull/17450 Signed-off-by: Sander Vanheule --- target/linux/realtek/Makefile | 5 ----- 1 file changed, 5 deletions(-) diff --git a/target/linux/realtek/Makefile b/target/linux/realtek/Makefile index 2614b148c4d..6cdd32a9d81 100644 --- a/target/linux/realtek/Makefile +++ b/target/linux/realtek/Makefile @@ -20,13 +20,8 @@ include $(INCLUDE_DIR)/target.mk DEFAULT_PACKAGES += \ ethtool \ firewall4 \ - ip-bridge \ - ip-full \ kmod-gpio-button-hotplug \ - kmod-nft-offload \ - nftables \ odhcp6c \ - tc-bpf \ uboot-envtools \ From 70733c6093ee1e2fae12fdff97425270ea733dae Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 25 Dec 2024 19:39:29 +0800 Subject: [PATCH 070/173] mac80211: rt2x00: some improvements for rt2800 generic 1. Respect the rt2800 hardware TX queue index. 2. Increase the watchdog sampling frequency. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/16845 Signed-off-by: Hauke Mehrtens --- ...spect-rt2800-hardware-TX-queue-index.patch | 257 ++++++++++++++++++ ...ease-the-watchdog-sampling-frequency.patch | 74 +++++ ...t-support-for-external-LNA-on-MT7620.patch | 4 +- ...-differentiate-based-on-SoC-CHIP_VER.patch | 22 +- 4 files changed, 344 insertions(+), 13 deletions(-) create mode 100644 package/kernel/mac80211/patches/rt2x00/620-01-rt2x00-respect-rt2800-hardware-TX-queue-index.patch create mode 100644 package/kernel/mac80211/patches/rt2x00/620-02-rt2x00-increase-the-watchdog-sampling-frequency.patch diff --git a/package/kernel/mac80211/patches/rt2x00/620-01-rt2x00-respect-rt2800-hardware-TX-queue-index.patch b/package/kernel/mac80211/patches/rt2x00/620-01-rt2x00-respect-rt2800-hardware-TX-queue-index.patch new file mode 100644 index 00000000000..e2c75979dfe --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/620-01-rt2x00-respect-rt2800-hardware-TX-queue-index.patch @@ -0,0 +1,257 @@ +From 654653e718f6c55c6f29fd94cc8152a92c8166ac Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Tue, 24 Dec 2024 08:36:32 +0800 +Subject: [PATCH 1/2] rt2x00: respect the rt2800 hardware TX queue index + +The Ralink TX queue register index is different from the Linux +IEEE80211 queue id definition. Their conversion table is as follows: + +Queue IEEE80211 Ralink +AC_VO 0 3 +AC_VI 1 2 +AC_BE 2 0 +AC_BK 3 1 + +The TX queues are still functioning properly under the current +configuration. I don't have evidence, but I believe there should +be some differences in the internal hardware implementation of +different TX queues, e.g. interrupt priority. so it's better to +respect the queue index defined by the Ralink when we construct +the TX rings and descriptors. + +And the more important thing is that we are using the wrong queue +index to calculate the register offset and mask in .conf_tx(), +which resulted in writing incorrect AIFSN, CWMAX, CWMIN and TXOP +values for all TX queues. This patch introduces a index conversion +table to fix these parameters. + +Signed-off-by: Shiji Yang +--- + drivers/net/wireless/ralink/rt2x00/rt2800.h | 24 ++++++------ + .../net/wireless/ralink/rt2x00/rt2800lib.c | 20 +++++++--- + .../net/wireless/ralink/rt2x00/rt2800mmio.c | 38 ++++++++++--------- + .../net/wireless/ralink/rt2x00/rt2x00queue.h | 20 ++++++++++ + 4 files changed, 67 insertions(+), 35 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h +@@ -379,10 +379,10 @@ + + /* + * WMM_AIFSN_CFG: Aifsn for each EDCA AC +- * AIFSN0: AC_VO +- * AIFSN1: AC_VI +- * AIFSN2: AC_BE +- * AIFSN3: AC_BK ++ * AIFSN0: AC_BE ++ * AIFSN1: AC_BK ++ * AIFSN2: AC_VI ++ * AIFSN3: AC_VO + */ + #define WMM_AIFSN_CFG 0x0214 + #define WMM_AIFSN_CFG_AIFSN0 FIELD32(0x0000000f) +@@ -392,10 +392,10 @@ + + /* + * WMM_CWMIN_CSR: CWmin for each EDCA AC +- * CWMIN0: AC_VO +- * CWMIN1: AC_VI +- * CWMIN2: AC_BE +- * CWMIN3: AC_BK ++ * CWMIN0: AC_BE ++ * CWMIN1: AC_BK ++ * CWMIN2: AC_VI ++ * CWMIN3: AC_VO + */ + #define WMM_CWMIN_CFG 0x0218 + #define WMM_CWMIN_CFG_CWMIN0 FIELD32(0x0000000f) +@@ -405,10 +405,10 @@ + + /* + * WMM_CWMAX_CSR: CWmax for each EDCA AC +- * CWMAX0: AC_VO +- * CWMAX1: AC_VI +- * CWMAX2: AC_BE +- * CWMAX3: AC_BK ++ * CWMAX0: AC_BE ++ * CWMAX1: AC_BK ++ * CWMAX2: AC_VI ++ * CWMAX3: AC_VO + */ + #define WMM_CWMAX_CFG 0x021c + #define WMM_CWMAX_CFG_CWMAX0 FIELD32(0x0000000f) +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -835,7 +835,8 @@ void rt2800_write_tx_data(struct queue_e + txdesc->key_idx : txdesc->u.ht.wcid); + rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, + txdesc->length); +- rt2x00_set_field32(&word, TXWI_W1_PACKETID_QUEUE, entry->queue->qid); ++ rt2x00_set_field32(&word, TXWI_W1_PACKETID_QUEUE, ++ rt2x00_ac_to_hwq(entry->queue->qid)); + rt2x00_set_field32(&word, TXWI_W1_PACKETID_ENTRY, (entry->entry_idx % 3) + 1); + rt2x00_desc_write(txwi, 1, word); + +@@ -1125,6 +1126,12 @@ void rt2800_txdone(struct rt2x00_dev *rt + u32 reg; + u8 qid; + bool match; ++ static const u8 rt2ac[] = { ++ IEEE80211_AC_BE, ++ IEEE80211_AC_BK, ++ IEEE80211_AC_VI, ++ IEEE80211_AC_VO, ++ }; + + while (quota-- > 0 && kfifo_get(&rt2x00dev->txstatus_fifo, ®)) { + /* +@@ -1132,6 +1139,8 @@ void rt2800_txdone(struct rt2x00_dev *rt + * guaranteed to be one of the TX QIDs . + */ + qid = rt2x00_get_field32(reg, TX_STA_FIFO_PID_QUEUE); ++ /* Convert Ralink hardware queue index to IEEE80211 queue id. */ ++ qid = rt2ac[qid]; + queue = rt2x00queue_get_tx_queue(rt2x00dev, qid); + + if (unlikely(rt2x00queue_empty(queue))) { +@@ -12188,8 +12197,9 @@ int rt2800_conf_tx(struct ieee80211_hw * + queue = rt2x00queue_get_tx_queue(rt2x00dev, queue_idx); + + /* Update WMM TXOP register */ +- offset = WMM_TXOP0_CFG + (sizeof(u32) * (!!(queue_idx & 2))); +- field.bit_offset = (queue_idx & 1) * 16; ++ offset = WMM_TXOP0_CFG + ++ (sizeof(u32) * (!!(rt2x00_ac_to_hwq(queue_idx) & 2))); ++ field.bit_offset = (rt2x00_ac_to_hwq(queue_idx) & 1) * 16; + field.bit_mask = 0xffff << field.bit_offset; + + reg = rt2800_register_read(rt2x00dev, offset); +@@ -12197,7 +12207,7 @@ int rt2800_conf_tx(struct ieee80211_hw * + rt2800_register_write(rt2x00dev, offset, reg); + + /* Update WMM registers */ +- field.bit_offset = queue_idx * 4; ++ field.bit_offset = rt2x00_ac_to_hwq(queue_idx) * 4; + field.bit_mask = 0xf << field.bit_offset; + + reg = rt2800_register_read(rt2x00dev, WMM_AIFSN_CFG); +@@ -12213,7 +12223,7 @@ int rt2800_conf_tx(struct ieee80211_hw * + rt2800_register_write(rt2x00dev, WMM_CWMAX_CFG, reg); + + /* Update EDCA registers */ +- offset = EDCA_AC0_CFG + (sizeof(u32) * queue_idx); ++ offset = EDCA_AC0_CFG + (sizeof(u32) * rt2x00_ac_to_hwq(queue_idx)); + + reg = rt2800_register_read(rt2x00dev, offset); + rt2x00_set_field32(®, EDCA_AC0_CFG_TX_OP, queue->txop); +--- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c +@@ -35,7 +35,7 @@ unsigned int rt2800mmio_get_dma_done(str + case QID_AC_VI: + case QID_AC_BE: + case QID_AC_BK: +- qid = queue->qid; ++ qid = rt2x00_ac_to_hwq(queue->qid); + idx = rt2x00mmio_register_read(rt2x00dev, TX_DTX_IDX(qid)); + break; + case QID_MGMT: +@@ -456,6 +456,7 @@ void rt2800mmio_kick_queue(struct data_q + { + struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; + struct queue_entry *entry; ++ u8 qid; + + switch (queue->qid) { + case QID_AC_VO: +@@ -464,7 +465,8 @@ void rt2800mmio_kick_queue(struct data_q + case QID_AC_BK: + WARN_ON_ONCE(rt2x00queue_empty(queue)); + entry = rt2x00queue_get_entry(queue, Q_INDEX); +- rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX(queue->qid), ++ qid = rt2x00_ac_to_hwq(queue->qid); ++ rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX(qid), + entry->entry_idx); + hrtimer_start(&rt2x00dev->txstatus_timer, + TXSTATUS_TIMEOUT, HRTIMER_MODE_REL); +@@ -666,36 +668,36 @@ int rt2800mmio_init_queues(struct rt2x00 + * Initialize registers. + */ + entry_priv = rt2x00dev->tx[0].entries[0].priv_data; +- rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR0, ++ rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR3, + entry_priv->desc_dma); +- rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT0, ++ rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT3, + rt2x00dev->tx[0].limit); +- rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX0, 0); +- rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX0, 0); ++ rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX3, 0); ++ rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX3, 0); + + entry_priv = rt2x00dev->tx[1].entries[0].priv_data; +- rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR1, ++ rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR2, + entry_priv->desc_dma); +- rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT1, ++ rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT2, + rt2x00dev->tx[1].limit); +- rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX1, 0); +- rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX1, 0); ++ rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX2, 0); ++ rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX2, 0); + + entry_priv = rt2x00dev->tx[2].entries[0].priv_data; +- rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR2, ++ rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR0, + entry_priv->desc_dma); +- rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT2, ++ rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT0, + rt2x00dev->tx[2].limit); +- rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX2, 0); +- rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX2, 0); ++ rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX0, 0); ++ rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX0, 0); + + entry_priv = rt2x00dev->tx[3].entries[0].priv_data; +- rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR3, ++ rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR1, + entry_priv->desc_dma); +- rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT3, ++ rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT1, + rt2x00dev->tx[3].limit); +- rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX3, 0); +- rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX3, 0); ++ rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX1, 0); ++ rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX1, 0); + + rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR4, 0); + rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT4, 0); +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.h +@@ -57,6 +57,26 @@ enum data_queue_qid { + }; + + /** ++ * rt2x00_ac_to_hwq - Convert IEEE80211 queue id to Ralink hardware ++ * queue register index. ++ * @ac: TX queue id. ++ */ ++static inline u8 rt2x00_ac_to_hwq(enum data_queue_qid ac) ++{ ++ static const u8 ralink_queue_map[] = { ++ [IEEE80211_AC_BE] = 0, ++ [IEEE80211_AC_BK] = 1, ++ [IEEE80211_AC_VI] = 2, ++ [IEEE80211_AC_VO] = 3, ++ }; ++ ++ if (unlikely(ac >= IEEE80211_NUM_ACS)) ++ return ac; ++ ++ return ralink_queue_map[ac]; ++} ++ ++/** + * enum skb_frame_desc_flags: Flags for &struct skb_frame_desc + * + * @SKBDESC_DMA_MAPPED_RX: &skb_dma field has been mapped for RX diff --git a/package/kernel/mac80211/patches/rt2x00/620-02-rt2x00-increase-the-watchdog-sampling-frequency.patch b/package/kernel/mac80211/patches/rt2x00/620-02-rt2x00-increase-the-watchdog-sampling-frequency.patch new file mode 100644 index 00000000000..c60d2ad54a9 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/620-02-rt2x00-increase-the-watchdog-sampling-frequency.patch @@ -0,0 +1,74 @@ +From aec50d1a30349759de0ac535f54c3441bf7ebef7 Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sun, 22 Dec 2024 17:06:59 +0800 +Subject: [PATCH 2/2] rt2x00: increase the watchdog sampling frequency + +Increase the sampling frequency of the watchdog when the hung +counter reaches the threshold to avoid some unnecessary resets. + +Signed-off-by: Shiji Yang +--- + .../net/wireless/ralink/rt2x00/rt2800lib.c | 45 +++++++++++++------ + 1 file changed, 32 insertions(+), 13 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -1320,26 +1320,45 @@ static bool rt2800_watchdog_hung(struct + return true; + } + ++static inline bool check_dma_busy_rx(u32 reg_cfg, u32 reg_int) ++{ ++ return (rt2x00_get_field32(reg_cfg, WPDMA_GLO_CFG_RX_DMA_BUSY) && ++ rt2x00_get_field32(reg_int, INT_SOURCE_CSR_RX_COHERENT)); ++} ++ ++static inline bool check_dma_busy_tx(u32 reg_cfg, u32 reg_int) ++{ ++ return (rt2x00_get_field32(reg_cfg, WPDMA_GLO_CFG_TX_DMA_BUSY) && ++ rt2x00_get_field32(reg_int, INT_SOURCE_CSR_TX_COHERENT)); ++} ++ + 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; ++ rt2x00dev->rxdma_busy = check_dma_busy_rx(reg_cfg, reg_int) ? ++ rt2x00dev->rxdma_busy + 1 : 0; ++ rt2x00dev->txdma_busy = check_dma_busy_tx(reg_cfg, reg_int) ? ++ rt2x00dev->txdma_busy + 1 : 0; ++ ++ if (rt2x00dev->rxdma_busy > 25 || rt2x00dev->txdma_busy > 25) { ++ int cnt; ++ for (cnt = 0; cnt < 10; cnt++) { ++ msleep(5); ++ reg_cfg = rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG); ++ reg_int = rt2800_register_read(rt2x00dev, INT_SOURCE_CSR); ++ ++ if (!check_dma_busy_rx(reg_cfg, reg_int)) ++ rt2x00dev->rxdma_busy = 0; ++ if (!check_dma_busy_tx(reg_cfg, reg_int)) ++ rt2x00dev->txdma_busy = 0; ++ } ++ } + +- busy_rx = rt2x00dev->rxdma_busy > 30; +- busy_tx = rt2x00dev->txdma_busy > 30; ++ busy_rx = rt2x00dev->rxdma_busy > 40; ++ busy_tx = rt2x00dev->txdma_busy > 40; + + if (!busy_rx && !busy_tx) + return false; 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 bb3f8197020..869879178fb 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 @@ -52,7 +52,7 @@ Signed-off-by: Daniel Golle static const unsigned int rt2800_eeprom_map[EEPROM_WORD_COUNT] = { [EEPROM_CHIP_ID] = 0x0000, [EEPROM_VERSION] = 0x0001, -@@ -10404,8 +10422,10 @@ static void rt2800_calibration_rt6352(st +@@ -10432,8 +10450,10 @@ static void rt2800_calibration_rt6352(st u32 reg; if (rt2x00_has_cap_external_pa(rt2x00dev) || @@ -64,7 +64,7 @@ Signed-off-by: Daniel Golle rt2800_r_calibration(rt2x00dev); rt2800_rf_self_txdc_cal(rt2x00dev); -@@ -10423,6 +10443,8 @@ static void rt2800_calibration_rt6352(st +@@ -10451,6 +10471,8 @@ static void rt2800_calibration_rt6352(st !rt2x00_has_cap_external_lna_bg(rt2x00dev)) return; 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 4c07a105906..df7f9927af0 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 @@ -14,7 +14,7 @@ */ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -3836,14 +3836,16 @@ static void rt2800_config_channel_rf7620 +@@ -3864,14 +3864,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, -@@ -3877,18 +3879,23 @@ static void rt2800_config_channel_rf7620 +@@ -3905,18 +3907,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)) { -@@ -4002,25 +4009,29 @@ static void rt2800_config_alc_rt6352(str +@@ -4030,25 +4037,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,7 @@ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, mac_sys_ctrl); rt2800_vco_calibration(rt2x00dev); -@@ -4513,7 +4524,8 @@ static void rt2800_config_channel(struct +@@ -4541,7 +4552,8 @@ static void rt2800_config_channel(struct if (rt2x00_rt(rt2x00dev, RT6352)) { /* BBP for GLRT BW */ bbp = conf_is_ht40(conf) ? @@ -131,7 +131,7 @@ 0x15 : 0x1a; rt2800_bbp_glrt_write(rt2x00dev, 141, bbp); -@@ -6017,18 +6029,33 @@ static int rt2800_init_registers(struct +@@ -6045,18 +6057,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)) { @@ -177,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); -@@ -7141,14 +7168,16 @@ static void rt2800_init_bbp_6352(struct +@@ -7169,14 +7196,16 @@ static void rt2800_init_bbp_6352(struct rt2800_bbp_write(rt2x00dev, 188, 0x00); rt2800_bbp_write(rt2x00dev, 189, 0x00); @@ -202,7 +202,7 @@ /* BBP for G band GLRT function (BBP_128 ~ BBP_221) */ rt2800_bbp_glrt_write(rt2x00dev, 0, 0x00); -@@ -10378,6 +10407,9 @@ static void rt2800_restore_rf_bbp_rt6352 +@@ -10406,6 +10435,9 @@ static void rt2800_restore_rf_bbp_rt6352 rt2800_register_write(rt2x00dev, RF_BYPASS3, 0x0); } @@ -212,7 +212,7 @@ if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16); rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x23); -@@ -10455,6 +10487,9 @@ static void rt2800_calibration_rt6352(st +@@ -10483,6 +10515,9 @@ static void rt2800_calibration_rt6352(st rt2800_register_write(rt2x00dev, RF_BYPASS3, reg); } @@ -222,7 +222,7 @@ if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66); rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20); -@@ -10545,31 +10580,36 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10573,31 +10608,36 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write(rt2x00dev, 42, 0x5B); rt2800_rfcsr_write(rt2x00dev, 43, 0x00); @@ -284,7 +284,7 @@ /* Initialize RF channel register to default value */ rt2800_rfcsr_write_chanreg(rt2x00dev, 0, 0x03); -@@ -10635,63 +10675,71 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10663,63 +10703,71 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_bank(rt2x00dev, 6, 45, 0xC5); @@ -411,7 +411,7 @@ /* Initialize RF DC calibration register to default value */ rt2800_rfcsr_write_dccal(rt2x00dev, 0, 0x47); -@@ -10754,12 +10802,17 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10782,12 +10830,17 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 62, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 63, 0x00); From 5d583901657bdfbbf9fad77d9247872427aa5c99 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 25 Dec 2024 19:39:29 +0800 Subject: [PATCH 071/173] mac80211: rt2x00: some improvements for mt7620 This patch contains some performance and stability improvements for MT7620: 1. Always calibrate MT7620 when switching channel. 2. Rework link tuner for MT7620. 3. Correct MT7620 SDM mode register value. 4. Fix register operation on RXIQ calibration. 5. Fix TX_PIN_CFG and TX_ALC_VGA3 init values. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/16845 Signed-off-by: Hauke Mehrtens --- ...librate-MT7620-when-switching-channe.patch | 77 +++++++++++++++++++ ...-rt2x00-rework-link-tuner-for-MT7620.patch | 48 ++++++++++++ ...rrect-MT7620-SDM-mode-register-value.patch | 25 ++++++ ...gister-operation-on-RXIQ-calibration.patch | 60 +++++++++++++++ ...t-support-for-external-LNA-on-MT7620.patch | 10 +-- ...-differentiate-based-on-SoC-CHIP_VER.patch | 25 +++--- 6 files changed, 228 insertions(+), 17 deletions(-) create mode 100644 package/kernel/mac80211/patches/rt2x00/621-01-rt2x00-always-calibrate-MT7620-when-switching-channe.patch create mode 100644 package/kernel/mac80211/patches/rt2x00/621-02-rt2x00-rework-link-tuner-for-MT7620.patch create mode 100644 package/kernel/mac80211/patches/rt2x00/621-03-rt2x00-correct-MT7620-SDM-mode-register-value.patch create mode 100644 package/kernel/mac80211/patches/rt2x00/621-04-rt2x00-fix-register-operation-on-RXIQ-calibration.patch diff --git a/package/kernel/mac80211/patches/rt2x00/621-01-rt2x00-always-calibrate-MT7620-when-switching-channe.patch b/package/kernel/mac80211/patches/rt2x00/621-01-rt2x00-always-calibrate-MT7620-when-switching-channe.patch new file mode 100644 index 00000000000..e66fbd43694 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/621-01-rt2x00-always-calibrate-MT7620-when-switching-channe.patch @@ -0,0 +1,77 @@ +From 2c5aad0f9990724cce48e0a53b66bc0438e4603d Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sun, 22 Dec 2024 17:06:59 +0800 +Subject: [PATCH 1/4] rt2x00: always calibrate MT7620 when switching channel + +Perform calibration work after each channel switching operation. +This should help improve the rx/tx signal strength for MT7620. + +Signed-off-by: Shiji Yang +--- + .../net/wireless/ralink/rt2x00/rt2800lib.c | 24 ++++++++++++++----- + 1 file changed, 18 insertions(+), 6 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -5704,6 +5704,9 @@ static void rt2800_config_ps(struct rt2x + } + } + ++static void rt2800_calibration_rt6352_stage1(struct rt2x00_dev *rt2x00dev); ++static void rt2800_calibration_rt6352_stage2(struct rt2x00_dev *rt2x00dev); ++ + void rt2800_config(struct rt2x00_dev *rt2x00dev, + struct rt2x00lib_conf *libconf, + const unsigned int flags) +@@ -5718,10 +5721,18 @@ void rt2800_config(struct rt2x00_dev *rt + */ + rt2800_update_survey(rt2x00dev); + ++ if (rt2x00_rt(rt2x00dev, RT6352) && ++ !test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) ++ rt2800_calibration_rt6352_stage1(rt2x00dev); ++ + rt2800_config_channel(rt2x00dev, libconf->conf, + &libconf->rf, &libconf->channel); + rt2800_config_txpower(rt2x00dev, libconf->conf->chandef.chan, + libconf->conf->power_level); ++ ++ if (rt2x00_rt(rt2x00dev, RT6352) && ++ !test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) ++ rt2800_calibration_rt6352_stage2(rt2x00dev); + } + if (flags & IEEE80211_CONF_CHANGE_POWER) + rt2800_config_txpower(rt2x00dev, libconf->conf->chandef.chan, +@@ -10427,15 +10438,19 @@ static void rt2800_restore_rf_bbp_rt6352 + } + } + +-static void rt2800_calibration_rt6352(struct rt2x00_dev *rt2x00dev) ++static void rt2800_calibration_rt6352_stage1(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); ++} ++ ++static void rt2800_calibration_rt6352_stage2(struct rt2x00_dev *rt2x00dev) ++{ ++ u32 reg; ++ + rt2800_rf_self_txdc_cal(rt2x00dev); + rt2800_rxdcoc_calibration(rt2x00dev); + rt2800_bw_filter_calibration(rt2x00dev, true); +@@ -10766,9 +10781,6 @@ static void rt2800_init_rfcsr_6352(struc + + rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); + rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); +- +- /* Do calibration and init PA/LNA */ +- rt2800_calibration_rt6352(rt2x00dev); + } + + static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) diff --git a/package/kernel/mac80211/patches/rt2x00/621-02-rt2x00-rework-link-tuner-for-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/621-02-rt2x00-rework-link-tuner-for-MT7620.patch new file mode 100644 index 00000000000..f7e7a8e5ffa --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/621-02-rt2x00-rework-link-tuner-for-MT7620.patch @@ -0,0 +1,48 @@ +From aaa57924324c1ee77afa5e3effc95cc86158ddcc Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sun, 22 Dec 2024 17:06:59 +0800 +Subject: [PATCH 2/4] rt2x00: rework link tuner for MT7620 + +Correct the VGC gain value for MT7620 and only do gain calibration +for supported devices. + +Signed-off-by: Shiji Yang +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -5561,6 +5561,9 @@ static void rt2800_config_txpower(struct + + void rt2800_gain_calibration(struct rt2x00_dev *rt2x00dev) + { ++ if (rt2x00_rt(rt2x00dev, RT6352)) ++ return; ++ + rt2800_config_txpower(rt2x00dev, rt2x00dev->hw->conf.chandef.chan, + rt2x00dev->tx_power); + } +@@ -5773,9 +5776,10 @@ static u8 rt2800_get_default_vgc(struct + rt2x00_rt(rt2x00dev, RT3593) || + rt2x00_rt(rt2x00dev, RT5390) || + rt2x00_rt(rt2x00dev, RT5392) || +- rt2x00_rt(rt2x00dev, RT5592) || +- rt2x00_rt(rt2x00dev, RT6352)) ++ rt2x00_rt(rt2x00dev, RT5592)) + vgc = 0x1c + (2 * rt2x00dev->lna_gain); ++ else if(rt2x00_rt(rt2x00dev, RT6352)) ++ vgc = 0x04 + (2 * rt2x00dev->lna_gain); + else + vgc = 0x2e + rt2x00dev->lna_gain; + } else { /* 5GHZ band */ +@@ -5828,7 +5832,8 @@ void rt2800_link_tuner(struct rt2x00_dev + { + u8 vgc; + +- if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860C)) ++ if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860C) || ++ rt2x00_rt(rt2x00dev, RT6352)) + return; + + /* When RSSI is better than a certain threshold, increase VGC diff --git a/package/kernel/mac80211/patches/rt2x00/621-03-rt2x00-correct-MT7620-SDM-mode-register-value.patch b/package/kernel/mac80211/patches/rt2x00/621-03-rt2x00-correct-MT7620-SDM-mode-register-value.patch new file mode 100644 index 00000000000..7c376df197a --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/621-03-rt2x00-correct-MT7620-SDM-mode-register-value.patch @@ -0,0 +1,25 @@ +From b672507ca9f06bb17213036b16bc4f5c5bc65357 Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sun, 22 Dec 2024 17:06:59 +0800 +Subject: [PATCH 3/4] rt2x00: correct MT7620 SDM mode register value + +rt2x00_set_field8() is a mask writing function. If we want to set +the BIT(7) for the SDM mode register here, we only need to fill "4" +in the mask. + +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 +@@ -3848,7 +3848,7 @@ static void rt2800_config_channel_rf7620 + + /* Default: XO=20MHz , SDM mode */ + rfcsr = rt2800_rfcsr_read(rt2x00dev, 16); +- rt2x00_set_field8(&rfcsr, RFCSR16_SDM_MODE_MT7620, 0x80); ++ rt2x00_set_field8(&rfcsr, RFCSR16_SDM_MODE_MT7620, 4); + rt2800_rfcsr_write(rt2x00dev, 16, rfcsr); + + rfcsr = rt2800_rfcsr_read(rt2x00dev, 21); diff --git a/package/kernel/mac80211/patches/rt2x00/621-04-rt2x00-fix-register-operation-on-RXIQ-calibration.patch b/package/kernel/mac80211/patches/rt2x00/621-04-rt2x00-fix-register-operation-on-RXIQ-calibration.patch new file mode 100644 index 00000000000..aa6f9c437c6 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/621-04-rt2x00-fix-register-operation-on-RXIQ-calibration.patch @@ -0,0 +1,60 @@ +From 2585ada646e4dcf152ab813a24d667e6903105f4 Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sun, 22 Dec 2024 17:06:59 +0800 +Subject: [PATCH 4/4] rt2x00: fix register operation on RXIQ calibration + +In rt2800_rxiq_calibration(), some variables are overwritten +before being used. Based on the values of the relevant registers +in other functions, I believe the correct operation should be +bit mask writing. + +Signed-off-by: Shiji Yang +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -8846,7 +8846,7 @@ static void rt2800_rxiq_calibration(stru + rt2x00_warn(rt2x00dev, "Timeout waiting for MAC status in RXIQ calibration\n"); + + bbpval = bbp4 & (~0x18); +- bbpval = bbp4 | 0x00; ++ bbpval = bbpval | 0x00; + rt2800_bbp_write(rt2x00dev, 4, bbpval); + + bbpval = rt2800_bbp_read(rt2x00dev, 21); +@@ -8928,13 +8928,13 @@ static void rt2800_rxiq_calibration(stru + for (ch_idx = 0; ch_idx < 2; ch_idx = ch_idx + 1) { + if (ch_idx == 0) { + rfval = rfb0r1 & (~0x3); +- rfval = rfb0r1 | 0x1; ++ rfval = rfval | 0x1; + rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, rfval); + rfval = rfb0r2 & (~0x33); +- rfval = rfb0r2 | 0x11; ++ rfval = rfval | 0x11; + rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, rfval); + rfval = rfb0r42 & (~0x50); +- rfval = rfb0r42 | 0x10; ++ rfval = rfval | 0x10; + rt2800_rfcsr_write_bank(rt2x00dev, 0, 42, rfval); + + rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00001006); +@@ -8947,13 +8947,13 @@ static void rt2800_rxiq_calibration(stru + rt2800_bbp_dcoc_write(rt2x00dev, 1, 0x00); + } else { + rfval = rfb0r1 & (~0x3); +- rfval = rfb0r1 | 0x2; ++ rfval = rfval | 0x2; + rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, rfval); + rfval = rfb0r2 & (~0x33); +- rfval = rfb0r2 | 0x22; ++ rfval = rfval | 0x22; + rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, rfval); + rfval = rfb0r42 & (~0x50); +- rfval = rfb0r42 | 0x40; ++ rfval = rfval | 0x40; + rt2800_rfcsr_write_bank(rt2x00dev, 0, 42, rfval); + + rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00002006); 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 869879178fb..9d15d181d72 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 @@ -52,9 +52,9 @@ Signed-off-by: Daniel Golle static const unsigned int rt2800_eeprom_map[EEPROM_WORD_COUNT] = { [EEPROM_CHIP_ID] = 0x0000, [EEPROM_VERSION] = 0x0001, -@@ -10432,8 +10450,10 @@ static void rt2800_calibration_rt6352(st - u32 reg; - +@@ -10446,8 +10464,10 @@ static void rt2800_restore_rf_bbp_rt6352 + static void rt2800_calibration_rt6352_stage1(struct rt2x00_dev *rt2x00dev) + { if (rt2x00_has_cap_external_pa(rt2x00dev) || - rt2x00_has_cap_external_lna_bg(rt2x00dev)) + rt2x00_has_cap_external_lna_bg(rt2x00dev)) { @@ -63,8 +63,8 @@ Signed-off-by: Daniel Golle + } rt2800_r_calibration(rt2x00dev); - rt2800_rf_self_txdc_cal(rt2x00dev); -@@ -10451,6 +10471,8 @@ static void rt2800_calibration_rt6352(st + } +@@ -10471,6 +10491,8 @@ static void rt2800_calibration_rt6352_st !rt2x00_has_cap_external_lna_bg(rt2x00dev)) return; 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 df7f9927af0..f4cc0443224 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 @@ -20,7 +20,7 @@ - /* Default: XO=20MHz , SDM mode */ - rfcsr = rt2800_rfcsr_read(rt2x00dev, 16); -- rt2x00_set_field8(&rfcsr, RFCSR16_SDM_MODE_MT7620, 0x80); +- rt2x00_set_field8(&rfcsr, RFCSR16_SDM_MODE_MT7620, 4); - rt2800_rfcsr_write(rt2x00dev, 16, rfcsr); - - rfcsr = rt2800_rfcsr_read(rt2x00dev, 21); @@ -29,7 +29,7 @@ + if (rt2800_hw_get_chipver(rt2x00dev) > 1) { + /* Default: XO=20MHz , SDM mode */ + rfcsr = rt2800_rfcsr_read(rt2x00dev, 16); -+ rt2x00_set_field8(&rfcsr, RFCSR16_SDM_MODE_MT7620, 0x80); ++ rt2x00_set_field8(&rfcsr, RFCSR16_SDM_MODE_MT7620, 4); + rt2800_rfcsr_write(rt2x00dev, 16, rfcsr); + + rfcsr = rt2800_rfcsr_read(rt2x00dev, 21); @@ -131,7 +131,7 @@ 0x15 : 0x1a; rt2800_bbp_glrt_write(rt2x00dev, 141, bbp); -@@ -6045,18 +6057,33 @@ static int rt2800_init_registers(struct +@@ -6061,18 +6073,34 @@ 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)) { @@ -162,7 +162,8 @@ + rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000401); + rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x000C0001); + rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); -+ rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x00000000); ++ rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0x00150f0f); ++ rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x06060606); + rt2800_register_write(rt2x00dev, TX0_BB_GAIN_ATTEN, 0x0); + rt2800_register_write(rt2x00dev, TX1_BB_GAIN_ATTEN, 0x0); + rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, @@ -177,7 +178,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); -@@ -7169,14 +7196,16 @@ static void rt2800_init_bbp_6352(struct +@@ -7185,14 +7213,16 @@ static void rt2800_init_bbp_6352(struct rt2800_bbp_write(rt2x00dev, 188, 0x00); rt2800_bbp_write(rt2x00dev, 189, 0x00); @@ -202,7 +203,7 @@ /* BBP for G band GLRT function (BBP_128 ~ BBP_221) */ rt2800_bbp_glrt_write(rt2x00dev, 0, 0x00); -@@ -10406,6 +10435,9 @@ static void rt2800_restore_rf_bbp_rt6352 +@@ -10422,6 +10452,9 @@ static void rt2800_restore_rf_bbp_rt6352 rt2800_register_write(rt2x00dev, RF_BYPASS3, 0x0); } @@ -212,7 +213,7 @@ if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16); rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x23); -@@ -10483,6 +10515,9 @@ static void rt2800_calibration_rt6352(st +@@ -10503,6 +10536,9 @@ static void rt2800_calibration_rt6352_st rt2800_register_write(rt2x00dev, RF_BYPASS3, reg); } @@ -222,7 +223,7 @@ if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66); rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20); -@@ -10573,31 +10608,36 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10593,31 +10629,36 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write(rt2x00dev, 42, 0x5B); rt2800_rfcsr_write(rt2x00dev, 43, 0x00); @@ -284,7 +285,7 @@ /* Initialize RF channel register to default value */ rt2800_rfcsr_write_chanreg(rt2x00dev, 0, 0x03); -@@ -10663,63 +10703,71 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10683,63 +10724,71 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_bank(rt2x00dev, 6, 45, 0xC5); @@ -411,7 +412,7 @@ /* Initialize RF DC calibration register to default value */ rt2800_rfcsr_write_dccal(rt2x00dev, 0, 0x47); -@@ -10782,12 +10830,17 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10802,12 +10851,17 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 62, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 63, 0x00); @@ -431,6 +432,6 @@ + rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); + rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); + } + } - /* Do calibration and init PA/LNA */ - rt2800_calibration_rt6352(rt2x00dev); + static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) From 59557ca19a460d8ad70991f63616d1ad0dfe9823 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 25 Dec 2024 19:39:29 +0800 Subject: [PATCH 072/173] mac80211: rt2x00: some improvements for rt5592 This patch contains some performance and stability improvements for RT5592: 1. Fix RFCSR register init values for RT5592. 2. Fix BBP register init values for RT5592. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/16845 Signed-off-by: Hauke Mehrtens --- ...FCSR-register-init-values-for-RT5592.patch | 230 ++++++++++++++++++ ...-BBP-register-init-values-for-RT5592.patch | 119 +++++++++ ...t-support-for-external-LNA-on-MT7620.patch | 4 +- ...-differentiate-based-on-SoC-CHIP_VER.patch | 22 +- 4 files changed, 362 insertions(+), 13 deletions(-) create mode 100644 package/kernel/mac80211/patches/rt2x00/622-01-rt2x00-fix-RFCSR-register-init-values-for-RT5592.patch create mode 100644 package/kernel/mac80211/patches/rt2x00/622-02-rt2x00-fix-BBP-register-init-values-for-RT5592.patch diff --git a/package/kernel/mac80211/patches/rt2x00/622-01-rt2x00-fix-RFCSR-register-init-values-for-RT5592.patch b/package/kernel/mac80211/patches/rt2x00/622-01-rt2x00-fix-RFCSR-register-init-values-for-RT5592.patch new file mode 100644 index 00000000000..15d1601eef1 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/622-01-rt2x00-fix-RFCSR-register-init-values-for-RT5592.patch @@ -0,0 +1,230 @@ +From b48887d5de9921d0ff9e88068e3cd555a383d702 Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sun, 22 Dec 2024 17:06:59 +0800 +Subject: [PATCH 1/2] rt2x00: fix RFCSR register init values for RT5592 + +Based on Raink proprietary driver 2.7.1.5, correct the initial +values of some RFCSR registers for RT5592. + +Signed-off-by: Shiji Yang +--- + .../net/wireless/ralink/rt2x00/rt2800lib.c | 122 ++++++++---------- + 1 file changed, 53 insertions(+), 69 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -3576,9 +3576,8 @@ static void rt2800_config_channel_rf55xx + + /* TODO RF27 <- tssi */ + +- rfcsr = rf->channel <= 10 ? 0x07 : 0x06; +- rt2800_rfcsr_write(rt2x00dev, 23, rfcsr); +- rt2800_rfcsr_write(rt2x00dev, 59, rfcsr); ++ rt2800_rfcsr_write(rt2x00dev, 23, rf->channel <= 10 ? 0x08 : 0x07); ++ rt2800_rfcsr_write(rt2x00dev, 59, rf->channel <= 4 ? 0x06 : 0x04); + + if (is_11b) { + /* CCK */ +@@ -3599,7 +3598,7 @@ static void rt2800_config_channel_rf55xx + power_bound = POWER_BOUND; + ep_reg = 0x2; + } else { +- rt2800_rfcsr_write(rt2x00dev, 10, 0x97); ++ rt2800_rfcsr_write(rt2x00dev, 10, 0x95); + /* FIMXE: RF11 overwrite */ + rt2800_rfcsr_write(rt2x00dev, 11, 0x40); + rt2800_rfcsr_write(rt2x00dev, 25, 0xBF); +@@ -3608,13 +3607,15 @@ static void rt2800_config_channel_rf55xx + rt2800_rfcsr_write(rt2x00dev, 37, 0x04); + rt2800_rfcsr_write(rt2x00dev, 38, 0x85); + rt2800_rfcsr_write(rt2x00dev, 40, 0x42); +- rt2800_rfcsr_write(rt2x00dev, 41, 0xBB); ++ rt2800_rfcsr_write(rt2x00dev, 41, 0xAB); + rt2800_rfcsr_write(rt2x00dev, 42, 0xD7); +- rt2800_rfcsr_write(rt2x00dev, 45, 0x41); ++ rt2800_rfcsr_write(rt2x00dev, 45, 0x01); + rt2800_rfcsr_write(rt2x00dev, 48, 0x00); + rt2800_rfcsr_write(rt2x00dev, 57, 0x77); ++ rt2800_rfcsr_write(rt2x00dev, 58, 0x19); + rt2800_rfcsr_write(rt2x00dev, 60, 0x05); + rt2800_rfcsr_write(rt2x00dev, 61, 0x01); ++ rt2800_rfcsr_write(rt2x00dev, 62, 0x19); + + /* TODO RF27 <- tssi */ + +@@ -3623,82 +3624,59 @@ static void rt2800_config_channel_rf55xx + rt2800_rfcsr_write(rt2x00dev, 12, 0x2E); + rt2800_rfcsr_write(rt2x00dev, 13, 0x22); + rt2800_rfcsr_write(rt2x00dev, 22, 0x60); +- rt2800_rfcsr_write(rt2x00dev, 23, 0x7F); +- if (rf->channel <= 50) +- rt2800_rfcsr_write(rt2x00dev, 24, 0x09); +- else if (rf->channel >= 52) +- rt2800_rfcsr_write(rt2x00dev, 24, 0x07); ++ rt2800_rfcsr_write(rt2x00dev, 23, 0x7E); ++ rt2800_rfcsr_write(rt2x00dev, 24, 0x07); + rt2800_rfcsr_write(rt2x00dev, 39, 0x1C); + rt2800_rfcsr_write(rt2x00dev, 43, 0x5B); +- rt2800_rfcsr_write(rt2x00dev, 44, 0X40); + rt2800_rfcsr_write(rt2x00dev, 46, 0X00); +- rt2800_rfcsr_write(rt2x00dev, 51, 0xFE); +- rt2800_rfcsr_write(rt2x00dev, 52, 0x0C); +- rt2800_rfcsr_write(rt2x00dev, 54, 0xF8); ++ rt2800_rfcsr_write(rt2x00dev, 51, 0xFD); ++ rt2800_rfcsr_write(rt2x00dev, 52, 0x0E); ++ rt2800_rfcsr_write(rt2x00dev, 55, 0x04); ++ rt2800_rfcsr_write(rt2x00dev, 56, 0xBB); ++ rt2800_rfcsr_write(rt2x00dev, 59, 0x7C); ++ + if (rf->channel <= 50) { +- rt2800_rfcsr_write(rt2x00dev, 55, 0x06), +- rt2800_rfcsr_write(rt2x00dev, 56, 0xD3); ++ rt2800_rfcsr_write(rt2x00dev, 44, 0X32); ++ rt2800_rfcsr_write(rt2x00dev, 54, 0xF9); + } else if (rf->channel >= 52) { +- rt2800_rfcsr_write(rt2x00dev, 55, 0x04); +- rt2800_rfcsr_write(rt2x00dev, 56, 0xBB); ++ rt2800_rfcsr_write(rt2x00dev, 44, 0X2A); ++ rt2800_rfcsr_write(rt2x00dev, 54, 0xF8); + } +- +- rt2800_rfcsr_write(rt2x00dev, 58, 0x15); +- rt2800_rfcsr_write(rt2x00dev, 59, 0x7F); +- rt2800_rfcsr_write(rt2x00dev, 62, 0x15); +- + } else if (rf->channel >= 100 && rf->channel <= 165) { +- + rt2800_rfcsr_write(rt2x00dev, 12, 0x0E); + rt2800_rfcsr_write(rt2x00dev, 13, 0x42); + rt2800_rfcsr_write(rt2x00dev, 22, 0x40); +- if (rf->channel <= 153) { +- rt2800_rfcsr_write(rt2x00dev, 23, 0x3C); +- rt2800_rfcsr_write(rt2x00dev, 24, 0x06); +- } else if (rf->channel >= 155) { +- rt2800_rfcsr_write(rt2x00dev, 23, 0x38); +- rt2800_rfcsr_write(rt2x00dev, 24, 0x05); +- } ++ rt2800_rfcsr_write(rt2x00dev, 52, 0x06); ++ rt2800_rfcsr_write(rt2x00dev, 55, 0x01); ++ + if (rf->channel <= 138) { ++ rt2800_rfcsr_write(rt2x00dev, 23, 0x7C); + rt2800_rfcsr_write(rt2x00dev, 39, 0x1A); + rt2800_rfcsr_write(rt2x00dev, 43, 0x3B); +- rt2800_rfcsr_write(rt2x00dev, 44, 0x20); + rt2800_rfcsr_write(rt2x00dev, 46, 0x18); +- } else if (rf->channel >= 140) { ++ } else { ++ rt2800_rfcsr_write(rt2x00dev, 23, 0x78); + rt2800_rfcsr_write(rt2x00dev, 39, 0x18); + rt2800_rfcsr_write(rt2x00dev, 43, 0x1B); +- rt2800_rfcsr_write(rt2x00dev, 44, 0x10); + rt2800_rfcsr_write(rt2x00dev, 46, 0X08); + } +- if (rf->channel <= 124) +- rt2800_rfcsr_write(rt2x00dev, 51, 0xFC); +- else if (rf->channel >= 126) +- rt2800_rfcsr_write(rt2x00dev, 51, 0xEC); +- if (rf->channel <= 138) +- rt2800_rfcsr_write(rt2x00dev, 52, 0x06); +- else if (rf->channel >= 140) +- rt2800_rfcsr_write(rt2x00dev, 52, 0x06); +- rt2800_rfcsr_write(rt2x00dev, 54, 0xEB); +- if (rf->channel <= 138) +- rt2800_rfcsr_write(rt2x00dev, 55, 0x01); +- else if (rf->channel >= 140) +- rt2800_rfcsr_write(rt2x00dev, 55, 0x00); +- if (rf->channel <= 128) +- rt2800_rfcsr_write(rt2x00dev, 56, 0xBB); +- else if (rf->channel >= 130) +- rt2800_rfcsr_write(rt2x00dev, 56, 0xAB); +- if (rf->channel <= 116) +- rt2800_rfcsr_write(rt2x00dev, 58, 0x1D); +- else if (rf->channel >= 118) +- rt2800_rfcsr_write(rt2x00dev, 58, 0x15); +- if (rf->channel <= 138) +- rt2800_rfcsr_write(rt2x00dev, 59, 0x3F); +- else if (rf->channel >= 140) +- rt2800_rfcsr_write(rt2x00dev, 59, 0x7C); +- if (rf->channel <= 116) +- rt2800_rfcsr_write(rt2x00dev, 62, 0x1D); +- else if (rf->channel >= 118) +- rt2800_rfcsr_write(rt2x00dev, 62, 0x15); ++ ++ if (rf->channel <= 114) { ++ rt2800_rfcsr_write(rt2x00dev, 24, 0x02); ++ rt2800_rfcsr_write(rt2x00dev, 44, 0x1A); ++ rt2800_rfcsr_write(rt2x00dev, 54, 0xEA); ++ rt2800_rfcsr_write(rt2x00dev, 56, 0xB3); ++ } else { ++ rt2800_rfcsr_write(rt2x00dev, 24, 0x03); ++ rt2800_rfcsr_write(rt2x00dev, 44, 0x0A); ++ rt2800_rfcsr_write(rt2x00dev, 54, 0xF9); ++ rt2800_rfcsr_write(rt2x00dev, 56, 0x9B); ++ } ++ ++ rt2800_rfcsr_write(rt2x00dev, 51, rf->channel <= 124 ? 0xFC : 0xEC); ++ rt2800_rfcsr_write(rt2x00dev, 58, rf->channel <= 116 ? 0x1D : 0x15); ++ rfcsr = (rf->channel >= 116 && rf->channel <= 138) ? 0x7E : 0x7C; ++ rt2800_rfcsr_write(rt2x00dev, 59, rfcsr); + } + + power_bound = POWER_BOUND_5G; +@@ -3710,7 +3688,7 @@ static void rt2800_config_channel_rf55xx + rt2x00_set_field8(&rfcsr, RFCSR49_TX, power_bound); + else + rt2x00_set_field8(&rfcsr, RFCSR49_TX, info->default_power1); +- if (is_type_ep) ++ if (!is_type_ep) + rt2x00_set_field8(&rfcsr, RFCSR49_EP, ep_reg); + rt2800_rfcsr_write(rt2x00dev, 49, rfcsr); + +@@ -3719,7 +3697,7 @@ static void rt2800_config_channel_rf55xx + rt2x00_set_field8(&rfcsr, RFCSR50_TX, power_bound); + else + rt2x00_set_field8(&rfcsr, RFCSR50_TX, info->default_power2); +- if (is_type_ep) ++ if (!is_type_ep) + rt2x00_set_field8(&rfcsr, RFCSR50_EP, ep_reg); + rt2800_rfcsr_write(rt2x00dev, 50, rfcsr); + +@@ -3740,7 +3718,6 @@ static void rt2800_config_channel_rf55xx + rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 0); + + rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); +- rt2800_rfcsr_write(rt2x00dev, 6, 0xe4); + + if (conf_is_ht40(conf)) + rt2800_rfcsr_write(rt2x00dev, 30, 0x16); +@@ -8505,12 +8482,15 @@ static void rt2800_init_rfcsr_5392(struc + + static void rt2800_init_rfcsr_5592(struct rt2x00_dev *rt2x00dev) + { ++ u16 eeprom; ++ + rt2800_rf_init_calibration(rt2x00dev, 30); + + rt2800_rfcsr_write(rt2x00dev, 1, 0x3F); ++ rt2800_rfcsr_write(rt2x00dev, 2, 0x80); + rt2800_rfcsr_write(rt2x00dev, 3, 0x08); + rt2800_rfcsr_write(rt2x00dev, 5, 0x10); +- rt2800_rfcsr_write(rt2x00dev, 6, 0xE4); ++ rt2800_rfcsr_write(rt2x00dev, 6, 0xE0); + rt2800_rfcsr_write(rt2x00dev, 7, 0x00); + rt2800_rfcsr_write(rt2x00dev, 14, 0x00); + rt2800_rfcsr_write(rt2x00dev, 15, 0x00); +@@ -8526,9 +8506,13 @@ static void rt2800_init_rfcsr_5592(struc + rt2800_rfcsr_write(rt2x00dev, 34, 0x07); + rt2800_rfcsr_write(rt2x00dev, 35, 0x12); + rt2800_rfcsr_write(rt2x00dev, 47, 0x0C); +- rt2800_rfcsr_write(rt2x00dev, 53, 0x22); ++ rt2800_rfcsr_write(rt2x00dev, 53, 0x44); + rt2800_rfcsr_write(rt2x00dev, 63, 0x07); + ++ eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF2); ++ if (!rt2x00_get_field16(eeprom, EEPROM_NIC_CONF2_CRYSTAL)) ++ rt2800_rfcsr_write(rt2x00dev, 6, 0xE4); ++ + rt2800_rfcsr_write(rt2x00dev, 2, 0x80); + msleep(1); + diff --git a/package/kernel/mac80211/patches/rt2x00/622-02-rt2x00-fix-BBP-register-init-values-for-RT5592.patch b/package/kernel/mac80211/patches/rt2x00/622-02-rt2x00-fix-BBP-register-init-values-for-RT5592.patch new file mode 100644 index 00000000000..19d1951b7b5 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/622-02-rt2x00-fix-BBP-register-init-values-for-RT5592.patch @@ -0,0 +1,119 @@ +From 1847d817df5585f9d957d16ed2a56ceb41cf6df7 Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sun, 22 Dec 2024 17:06:59 +0800 +Subject: [PATCH 2/2] rt2x00: fix BBP register init values for RT5592 + +Based on Raink proprietary driver 2.7.1.5, correct the initial +values of some BBP registers for RT5592. + +Signed-off-by: Shiji Yang +--- + .../net/wireless/ralink/rt2x00/rt2800lib.c | 32 +++++++++---------- + 1 file changed, 15 insertions(+), 17 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -3746,6 +3746,7 @@ static void rt2800_config_channel_rf55xx + rt2800_bbp_write(rt2x00dev, 80, (rf->channel <= 14) ? 0x0E : 0x08); + rt2800_bbp_write(rt2x00dev, 81, (rf->channel <= 14) ? 0x3A : 0x38); + rt2800_bbp_write(rt2x00dev, 82, (rf->channel <= 14) ? 0x62 : 0x92); ++ rt2800_bbp_write(rt2x00dev, 95, (rf->channel <= 14) ? 0x9A : 0x1A); + + /* GLRT band configuration */ + rt2800_bbp_write(rt2x00dev, 195, 128); +@@ -3758,7 +3759,7 @@ static void rt2800_config_channel_rf55xx + rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x32 : 0x20); + rt2800_bbp_write(rt2x00dev, 195, 133); + rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x28 : 0x7F); +- rt2800_bbp_write(rt2x00dev, 195, 124); ++ rt2800_bbp_write(rt2x00dev, 195, 134); + rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x19 : 0x7F); + } + +@@ -4304,7 +4305,8 @@ static void rt2800_config_channel(struct + rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); + rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); + rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain); +- if (rt2x00_rt(rt2x00dev, RT6352)) ++ if (rt2x00_rt(rt2x00dev, RT5592) || ++ rt2x00_rt(rt2x00dev, RT6352)) + rt2800_bbp_write(rt2x00dev, 86, 0x38); + else + rt2800_bbp_write(rt2x00dev, 86, 0); +@@ -4313,6 +4315,7 @@ static void rt2800_config_channel(struct + if (rf->channel <= 14) { + if (!rt2x00_rt(rt2x00dev, RT5390) && + !rt2x00_rt(rt2x00dev, RT5392) && ++ !rt2x00_rt(rt2x00dev, RT5592) && + !rt2x00_rt(rt2x00dev, RT6352)) { + if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { + rt2800_bbp_write(rt2x00dev, 82, 0x62); +@@ -4336,17 +4339,20 @@ static void rt2800_config_channel(struct + else if (rt2x00_rt(rt2x00dev, RT3593) || + rt2x00_rt(rt2x00dev, RT3883)) + rt2800_bbp_write(rt2x00dev, 82, 0x82); +- else if (!rt2x00_rt(rt2x00dev, RT6352)) ++ else if (!rt2x00_rt(rt2x00dev, RT5592) && ++ !rt2x00_rt(rt2x00dev, RT6352)) + rt2800_bbp_write(rt2x00dev, 82, 0xf2); + + if (rt2x00_rt(rt2x00dev, RT3593) || + rt2x00_rt(rt2x00dev, RT3883)) + rt2800_bbp_write(rt2x00dev, 83, 0x9a); + +- if (rt2x00_has_cap_external_lna_a(rt2x00dev)) +- rt2800_bbp_write(rt2x00dev, 75, 0x46); +- else +- rt2800_bbp_write(rt2x00dev, 75, 0x50); ++ if (!rt2x00_rt(rt2x00dev, RT5592)) { ++ if (rt2x00_has_cap_external_lna_a(rt2x00dev)) ++ rt2800_bbp_write(rt2x00dev, 75, 0x46); ++ else ++ rt2800_bbp_write(rt2x00dev, 75, 0x50); ++ } + } + + reg = rt2800_register_read(rt2x00dev, TX_BAND_CFG); +@@ -5783,12 +5789,10 @@ static inline void rt2800_set_vgc(struct + if (rt2x00_rt(rt2x00dev, RT3572) || + rt2x00_rt(rt2x00dev, RT3593) || + rt2x00_rt(rt2x00dev, RT3883) || ++ rt2x00_rt(rt2x00dev, RT5592) || + rt2x00_rt(rt2x00dev, RT6352)) { + rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, + vgc_level); +- } else if (rt2x00_rt(rt2x00dev, RT5592)) { +- rt2800_bbp_write(rt2x00dev, 83, qual->rssi > -65 ? 0x4a : 0x7a); +- rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, vgc_level); + } else { + rt2800_bbp_write(rt2x00dev, 66, vgc_level); + } +@@ -7016,7 +7020,6 @@ static void rt2800_init_bbp_5592(struct + rt2800_bbp_write(rt2x00dev, 88, 0x90); + rt2800_bbp_write(rt2x00dev, 91, 0x04); + rt2800_bbp_write(rt2x00dev, 92, 0x02); +- rt2800_bbp_write(rt2x00dev, 95, 0x9a); + rt2800_bbp_write(rt2x00dev, 98, 0x12); + rt2800_bbp_write(rt2x00dev, 103, 0xC0); + rt2800_bbp_write(rt2x00dev, 104, 0x92); +@@ -7027,6 +7030,7 @@ static void rt2800_init_bbp_5592(struct + rt2800_bbp_write(rt2x00dev, 134, 0xD0); + rt2800_bbp_write(rt2x00dev, 135, 0xF6); + rt2800_bbp_write(rt2x00dev, 137, 0x0F); ++ rt2800_bbp_write(rt2x00dev, 148, 0x84); + + /* Initialize GLRT (Generalized Likehood Radio Test) */ + rt2800_init_bbp_5592_glrt(rt2x00dev); +@@ -7051,12 +7055,6 @@ static void rt2800_init_bbp_5592(struct + rt2x00_set_field8(&value, BBP254_BIT7, 1); + rt2800_bbp_write(rt2x00dev, 254, value); + } +- +- rt2800_init_freq_calibration(rt2x00dev); +- +- rt2800_bbp_write(rt2x00dev, 84, 0x19); +- if (rt2x00_rt_rev_gte(rt2x00dev, RT5592, REV_RT5592C)) +- rt2800_bbp_write(rt2x00dev, 103, 0xc0); + } + + static void rt2800_init_bbp_6352(struct rt2x00_dev *rt2x00dev) 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 9d15d181d72..88a72fd03ec 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 @@ -52,7 +52,7 @@ Signed-off-by: Daniel Golle static const unsigned int rt2800_eeprom_map[EEPROM_WORD_COUNT] = { [EEPROM_CHIP_ID] = 0x0000, [EEPROM_VERSION] = 0x0001, -@@ -10446,8 +10464,10 @@ static void rt2800_restore_rf_bbp_rt6352 +@@ -10428,8 +10446,10 @@ static void rt2800_restore_rf_bbp_rt6352 static void rt2800_calibration_rt6352_stage1(struct rt2x00_dev *rt2x00dev) { if (rt2x00_has_cap_external_pa(rt2x00dev) || @@ -64,7 +64,7 @@ Signed-off-by: Daniel Golle rt2800_r_calibration(rt2x00dev); } -@@ -10471,6 +10491,8 @@ static void rt2800_calibration_rt6352_st +@@ -10453,6 +10473,8 @@ static void rt2800_calibration_rt6352_st !rt2x00_has_cap_external_lna_bg(rt2x00dev)) return; 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 f4cc0443224..eb0237a3893 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 @@ -14,7 +14,7 @@ */ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -3864,14 +3864,16 @@ static void rt2800_config_channel_rf7620 +@@ -3842,14 +3842,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, -@@ -3905,18 +3907,23 @@ static void rt2800_config_channel_rf7620 +@@ -3883,18 +3885,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)) { -@@ -4030,25 +4037,29 @@ static void rt2800_config_alc_rt6352(str +@@ -4008,25 +4015,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,7 @@ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, mac_sys_ctrl); rt2800_vco_calibration(rt2x00dev); -@@ -4541,7 +4552,8 @@ static void rt2800_config_channel(struct +@@ -4524,7 +4535,8 @@ static void rt2800_config_channel(struct if (rt2x00_rt(rt2x00dev, RT6352)) { /* BBP for GLRT BW */ bbp = conf_is_ht40(conf) ? @@ -131,7 +131,7 @@ 0x15 : 0x1a; rt2800_bbp_glrt_write(rt2x00dev, 141, bbp); -@@ -6061,18 +6073,34 @@ static int rt2800_init_registers(struct +@@ -6042,18 +6054,34 @@ 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)) { @@ -178,7 +178,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); -@@ -7185,14 +7213,16 @@ static void rt2800_init_bbp_6352(struct +@@ -7160,14 +7188,16 @@ static void rt2800_init_bbp_6352(struct rt2800_bbp_write(rt2x00dev, 188, 0x00); rt2800_bbp_write(rt2x00dev, 189, 0x00); @@ -203,7 +203,7 @@ /* BBP for G band GLRT function (BBP_128 ~ BBP_221) */ rt2800_bbp_glrt_write(rt2x00dev, 0, 0x00); -@@ -10422,6 +10452,9 @@ static void rt2800_restore_rf_bbp_rt6352 +@@ -10404,6 +10434,9 @@ static void rt2800_restore_rf_bbp_rt6352 rt2800_register_write(rt2x00dev, RF_BYPASS3, 0x0); } @@ -213,7 +213,7 @@ if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16); rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x23); -@@ -10503,6 +10536,9 @@ static void rt2800_calibration_rt6352_st +@@ -10485,6 +10518,9 @@ static void rt2800_calibration_rt6352_st rt2800_register_write(rt2x00dev, RF_BYPASS3, reg); } @@ -223,7 +223,7 @@ if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66); rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20); -@@ -10593,31 +10629,36 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10575,31 +10611,36 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write(rt2x00dev, 42, 0x5B); rt2800_rfcsr_write(rt2x00dev, 43, 0x00); @@ -285,7 +285,7 @@ /* Initialize RF channel register to default value */ rt2800_rfcsr_write_chanreg(rt2x00dev, 0, 0x03); -@@ -10683,63 +10724,71 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10665,63 +10706,71 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_bank(rt2x00dev, 6, 45, 0xC5); @@ -412,7 +412,7 @@ /* Initialize RF DC calibration register to default value */ rt2800_rfcsr_write_dccal(rt2x00dev, 0, 0x47); -@@ -10802,12 +10851,17 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10784,12 +10833,17 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 62, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 63, 0x00); From 70610a5240a94648e178713f091435bd0ba158d3 Mon Sep 17 00:00:00 2001 From: Roland Reinl Date: Wed, 18 Dec 2024 15:45:37 +0100 Subject: [PATCH 073/173] mediatek: Fix U-Boot variables handling for D-Link M30 A1 I think I implemented the U-Boot handling incorrectly on M30 (saw the issue while porting M60 to OpenWrt). Maybe someone with more U-Boot experience can have a look at it. What I understood until now: Before flashing, `sw_tryactive` must be set to 0 because OpenWrt runs on partition 0 During reset after flashing, U-Boot executes the following line: `boot_rd_auto_sw_img=if itest.s ${sw_tryactive} == 2; then run boot_by_part; else run boot_by_tryactive; fi` As `sw_tryactive` was set to 0 before flashing, `boot_by_tryactive` will be executed: `boot_by_tryactive=if itest.s ${sw_tryactive} == 0; then setenv sw_tryactive 2; setenv sw_active 1; saveenv; run ub0; else setenv sw_tryactive 2; setenv sw_active 2; saveenv; run ub1; fi` As `sw_tryactive` was set to 0 before flashing, `sw_active` will be set to 1 and `ub0` will be executed: `ub0=setenv bootpart 0; mtkboardboot; run ub0to1; uip main; reset` If the OpenWrt boot is successful, `ub0to1` and `uip` main will never be executed. Only in case OpenWrt cannot be loaded, `mtkboardboot` will return and the fallback `ub0to1` is executed. Conclusion: It's sufficient to set `sw_tryacitve` to 0 before flashing, the added code in `target/linux/mediatek/filogic/base-files/etc/init.d/bootcount` is useless. In the worst case (/proc/cmdline doesn't contain `bootpart=ubi0` as expected), the bootpart variable would be set to 1 and causes starting the firmware from the second partition instead of the one on the first partition. Signed-off-by: Roland Reinl Link: https://github.com/openwrt/openwrt/pull/17298 Signed-off-by: Hauke Mehrtens --- .../linux/mediatek/filogic/base-files/etc/init.d/bootcount | 7 ------- .../mediatek/filogic/base-files/lib/upgrade/platform.sh | 1 + 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/target/linux/mediatek/filogic/base-files/etc/init.d/bootcount b/target/linux/mediatek/filogic/base-files/etc/init.d/bootcount index e186589f281..c52d004c639 100755 --- a/target/linux/mediatek/filogic/base-files/etc/init.d/bootcount +++ b/target/linux/mediatek/filogic/base-files/etc/init.d/bootcount @@ -5,13 +5,6 @@ START=99 boot() { case $(board_name) in - dlink,aquila-pro-ai-m30-a1) - if grep -q bootpart=ubi0 /proc/cmdline; then - fw_setenv bootpart 0 - else - fw_setenv bootpart 1 - fi - ;; zyxel,ex5700-telenor) fw_setenv uboot_bootcount 0 ;; diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index baab9ac2918..7556be52bda 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -123,6 +123,7 @@ platform_do_upgrade() { yuncore,ax835) default_do_upgrade "$1" ;; + dlink,aquila-pro-ai-m30-a1|\ dlink,aquila-pro-ai-m60-a1) fw_setenv sw_tryactive 0 nand_do_upgrade "$1" From 8925c469f4ec919b3df5d8afdbc608cfdb7a8b33 Mon Sep 17 00:00:00 2001 From: Manuel Fombuena Date: Wed, 1 Jan 2025 20:42:37 +0000 Subject: [PATCH 074/173] generic: add STMicroelectronics LED1202 driver This LED controller has a driver under development which is currently being reviewed by the respective kernel maintainers. They are currently on v11 which is included here. The LED1202 is a 12-channel low quiescent current LED driver with: * Supply range from 2.6 V to 5 V * 20 mA current capability per channel * 1.8 V compatible I2C control interface * 8-bit analog dimming individual control * 12-bit local PWM resolution * 8 programmable patterns If the led node is present in the controller then the channel is set to active. The output current can be adjusted separately for each channel by 8-bit analog (current sink input) and 12-bit digital (PWM) dimming control. The LED1202 implements 12 low-side current generators with independent dimming control. Internal volatile memory allows the user to store up to 8 different patterns, each pattern is a particular output configuration in terms of PWM duty-cycle (on 4096 steps). Analog dimming (on 256 steps) is per channel but common to all patterns. Each device tree LED node will have a corresponding entry in /sys/class/leds with the label name. The brightness property corresponds to the per channel analog dimming, while the patterns[1-8] to the PWM dimming control. Signed-off-by: Manuel Fombuena Link: https://github.com/openwrt/openwrt/pull/17451 Signed-off-by: Robert Marko --- package/kernel/linux/modules/leds.mk | 17 + ...ds-add-reset-controller-based-driver.patch | 4 +- ...rt-for-Sercomm-MSP430-LED-controller.patch | 2 +- ...ings-leds-Add-LED1202-LED-Controller.patch | 181 ++++++ .../892-leds-Add-LED1202-I2C-driver.patch | 513 ++++++++++++++++++ .../950-smartrg-i2c-led-driver.patch | 4 +- 6 files changed, 716 insertions(+), 5 deletions(-) create mode 100644 target/linux/generic/pending-6.6/891-dt-bindings-leds-Add-LED1202-LED-Controller.patch create mode 100644 target/linux/generic/pending-6.6/892-leds-Add-LED1202-I2C-driver.patch diff --git a/package/kernel/linux/modules/leds.mk b/package/kernel/linux/modules/leds.mk index 0c42895bb2f..98e6fc88490 100644 --- a/package/kernel/linux/modules/leds.mk +++ b/package/kernel/linux/modules/leds.mk @@ -233,6 +233,23 @@ endef $(eval $(call KernelPackage,leds-pwm)) +define KernelPackage/leds-st1202 + SUBMENU:=LED modules + TITLE:=LED support for ST LED1202 I2C chips + DEPENDS:=+kmod-i2c-core +kmod-ledtrig-pattern + KCONFIG:=CONFIG_LEDS_ST1202 + FILES:= $(LINUX_DIR)/drivers/leds/leds-st1202.ko + AUTOLOAD:=$(call AutoProbe,leds-st1202) +endef + +define KernelPackage/leds-st1202/description + This option enables support for LEDs connected to LED1202 + LED driver chips accessed via the I2C bus. +endef + +$(eval $(call KernelPackage,leds-st1202)) + + define KernelPackage/leds-tlc591xx SUBMENU:=$(LEDS_MENU) TITLE:=LED driver for TLC59108 and TLC59116 controllers diff --git a/target/linux/ath79/patches-6.6/800-leds-add-reset-controller-based-driver.patch b/target/linux/ath79/patches-6.6/800-leds-add-reset-controller-based-driver.patch index fa958e767b3..e84cc00f4b1 100644 --- a/target/linux/ath79/patches-6.6/800-leds-add-reset-controller-based-driver.patch +++ b/target/linux/ath79/patches-6.6/800-leds-add-reset-controller-based-driver.patch @@ -13,7 +13,7 @@ Signed-off-by: John Crispin --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig -@@ -901,6 +901,17 @@ source "drivers/leds/flash/Kconfig" +@@ -911,6 +911,17 @@ source "drivers/leds/flash/Kconfig" comment "RGB LED drivers" source "drivers/leds/rgb/Kconfig" @@ -176,7 +176,7 @@ Signed-off-by: John Crispin +MODULE_ALIAS("platform:leds-reset"); --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile -@@ -88,6 +88,7 @@ obj-$(CONFIG_LEDS_TURRIS_OMNIA) += leds +@@ -89,6 +89,7 @@ obj-$(CONFIG_LEDS_TURRIS_OMNIA) += leds obj-$(CONFIG_LEDS_WM831X_STATUS) += leds-wm831x-status.o obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o obj-$(CONFIG_LEDS_WRAP) += leds-wrap.o diff --git a/target/linux/bmips/patches-6.6/700-leds-add-support-for-Sercomm-MSP430-LED-controller.patch b/target/linux/bmips/patches-6.6/700-leds-add-support-for-Sercomm-MSP430-LED-controller.patch index a2e4a62349e..0b9a29b18f5 100644 --- a/target/linux/bmips/patches-6.6/700-leds-add-support-for-Sercomm-MSP430-LED-controller.patch +++ b/target/linux/bmips/patches-6.6/700-leds-add-support-for-Sercomm-MSP430-LED-controller.patch @@ -40,6 +40,6 @@ Signed-off-by: Álvaro Fernández Rojas obj-$(CONFIG_LEDS_REGULATOR) += leds-regulator.o obj-$(CONFIG_LEDS_SC27XX_BLTC) += leds-sc27xx-bltc.o +obj-$(CONFIG_LEDS_SERCOMM_MSP430) += leds-sercomm-msp430.o + obj-$(CONFIG_LEDS_ST1202) += leds-st1202.o obj-$(CONFIG_LEDS_SUNFIRE) += leds-sunfire.o obj-$(CONFIG_LEDS_SYSCON) += leds-syscon.o - obj-$(CONFIG_LEDS_TCA6507) += leds-tca6507.o diff --git a/target/linux/generic/pending-6.6/891-dt-bindings-leds-Add-LED1202-LED-Controller.patch b/target/linux/generic/pending-6.6/891-dt-bindings-leds-Add-LED1202-LED-Controller.patch new file mode 100644 index 00000000000..164256081af --- /dev/null +++ b/target/linux/generic/pending-6.6/891-dt-bindings-leds-Add-LED1202-LED-Controller.patch @@ -0,0 +1,181 @@ +From: Vicentiu Galanopulo +To: Pavel Machek , Lee Jones , + Rob Herring , + Krzysztof Kozlowski , + Conor Dooley , + Jonathan Corbet , + Vicentiu Galanopulo , + linux-leds@vger.kernel.org, devicetree@vger.kernel.org, + linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org +Cc: Krzysztof Kozlowski +Subject: [PATCH v11 2/3] dt-bindings: leds: Add LED1202 LED Controller +Date: Wed, 18 Dec 2024 18:33:58 +0000 [thread overview] +Message-ID: <20241218183401.41687-3-vicentiu.galanopulo@remote-tech.co.uk> (raw) +In-Reply-To: <20241218183401.41687-1-vicentiu.galanopulo@remote-tech.co.uk> + +The LED1202 is a 12-channel low quiescent current LED driver with: + * Supply range from 2.6 V to 5 V + * 20 mA current capability per channel + * 1.8 V compatible I2C control interface + * 8-bit analog dimming individual control + * 12-bit local PWM resolution + * 8 programmable patterns + +If the led node is present in the controller then the channel is +set to active. + +Signed-off-by: Vicentiu Galanopulo +Reviewed-by: Krzysztof Kozlowski +--- + v1: https://lore.kernel.org/lkml/ZnCnnQfwuRueCIQ0@admins-Air/T/ + v2: https://lore.kernel.org/all/ZniNdGgKyUMV-hjq@admins-Air/T/ + v3: https://lore.kernel.org/all/ZniNdGgKyUMV-hjq@admins-Air/T/ + + Changes in v4: + - remove label property, use devm_led_classdev_register_ext instead + Changes in v3: + - remove active property + Changes in v2: + - renamed label to remove color from it + - add color property for each node + - add function and function-enumerator property for each node + + .../devicetree/bindings/leds/st,led1202.yaml | 132 ++++++++++++++++++ + 1 file changed, 132 insertions(+) + create mode 100644 Documentation/devicetree/bindings/leds/st,led1202.yaml + +--- /dev/null ++++ b/Documentation/devicetree/bindings/leds/st,led1202.yaml +@@ -0,0 +1,132 @@ ++# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/leds/st,led1202.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: ST LED1202 LED controllers ++ ++maintainers: ++ - Vicentiu Galanopulo ++ ++description: | ++ The LED1202 is a 12-channel low quiescent current LED controller ++ programmable via I2C; The output current can be adjusted separately ++ for each channel by 8-bit analog and 12-bit digital dimming control. ++ Datasheet available at ++ https://www.st.com/en/power-management/led1202.html ++ ++properties: ++ compatible: ++ const: st,led1202 ++ ++ reg: ++ maxItems: 1 ++ ++ "#address-cells": ++ const: 1 ++ ++ "#size-cells": ++ const: 0 ++ ++patternProperties: ++ "^led@[0-9a-f]$": ++ type: object ++ $ref: common.yaml# ++ unevaluatedProperties: false ++ ++ properties: ++ reg: ++ minimum: 0 ++ maximum: 11 ++ ++ required: ++ - reg ++ ++required: ++ - compatible ++ - reg ++ - "#address-cells" ++ - "#size-cells" ++ ++additionalProperties: false ++ ++examples: ++ - | ++ #include ++ ++ i2c { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ led-controller@58 { ++ compatible = "st,led1202"; ++ reg = <0x58>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ led@0 { ++ reg = <0x0>; ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ function-enumerator = <1>; ++ }; ++ ++ led@1 { ++ reg = <0x1>; ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ function-enumerator = <2>; ++ }; ++ ++ led@2 { ++ reg = <0x2>; ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ function-enumerator = <3>; ++ }; ++ ++ led@3 { ++ reg = <0x3>; ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ function-enumerator = <4>; ++ }; ++ ++ led@4 { ++ reg = <0x4>; ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ function-enumerator = <5>; ++ }; ++ ++ led@5 { ++ reg = <0x5>; ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ function-enumerator = <6>; ++ }; ++ ++ led@6 { ++ reg = <0x6>; ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ function-enumerator = <7>; ++ }; ++ ++ led@7 { ++ reg = <0x7>; ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ function-enumerator = <8>; ++ }; ++ ++ led@8 { ++ reg = <0x8>; ++ function = LED_FUNCTION_STATUS; ++ color = ; ++ function-enumerator = <9>; ++ }; ++ }; ++ }; ++... diff --git a/target/linux/generic/pending-6.6/892-leds-Add-LED1202-I2C-driver.patch b/target/linux/generic/pending-6.6/892-leds-Add-LED1202-I2C-driver.patch new file mode 100644 index 00000000000..0777c5ce283 --- /dev/null +++ b/target/linux/generic/pending-6.6/892-leds-Add-LED1202-I2C-driver.patch @@ -0,0 +1,513 @@ +From: Vicentiu Galanopulo +To: Pavel Machek , Lee Jones , + Rob Herring , + Krzysztof Kozlowski , + Conor Dooley , + Jonathan Corbet , + Vicentiu Galanopulo , + linux-leds@vger.kernel.org, devicetree@vger.kernel.org, + linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org +Subject: [PATCH v11 3/3] leds: Add LED1202 I2C driver +Date: Wed, 18 Dec 2024 18:33:59 +0000 [thread overview] +Message-ID: <20241218183401.41687-4-vicentiu.galanopulo@remote-tech.co.uk> (raw) +In-Reply-To: <20241218183401.41687-1-vicentiu.galanopulo@remote-tech.co.uk> + +The output current can be adjusted separately for each channel by 8-bit +analog (current sink input) and 12-bit digital (PWM) dimming control. The +LED1202 implements 12 low-side current generators with independent dimming +control. +Internal volatile memory allows the user to store up to 8 different patterns, +each pattern is a particular output configuration in terms of PWM +duty-cycle (on 4096 steps). Analog dimming (on 256 steps) is per channel but +common to all patterns. Each device tree LED node will have a corresponding +entry in /sys/class/leds with the label name. The brightness property +corresponds to the per channel analog dimming, while the patterns[1-8] to the +PWM dimming control. + +Signed-off-by: Vicentiu Galanopulo +--- + Changes in v10: + - update description help in Kconfig + - move st1202_led and st1202_chip into one line, declaration and definition + Changes in v9: + - log errors directly in st1202_write_reg and st1202_read_reg + - use mutex guards instead of lock/unlock + - remove i2c_set_clientdata + Changes in v7: + - fix st1202_brightness_get() error: uninitialized symbol 'value' + Changes in v6: + - fix build error + Changes in v5: + - remove unused macros + - switch to using devm_led_classdev_register_ext (struct st1202_led update) + - add prescalar_to_milliseconds (convert [22..5660]ms to [0..255] reg value) + - remove register range check in dt_init (range protected by yaml) + - address all review comments in v4 + Changes in v4: + - Remove attributes/extended attributes implementation + - Use /sys/class/leds//hw_pattern (Pavel suggestion) + - Implement review findings of Christophe JAILLET + Changes in v3: + - Rename all ll1202 to st1202, including driver file name + - Convert all magic numbers to defines + - Refactor the show/store callbacks as per Lee's and Thomas's review + - Remove ll1202_get_channel and use dev_ext_attributes instead + - Log all error values for all the functions + - Use sysfs_emit for show callbacks + Changes in v2: + - Fix build error for device_attribute modes + + drivers/leds/Kconfig | 10 + + drivers/leds/Makefile | 1 + + drivers/leds/leds-st1202.c | 416 +++++++++++++++++++++++++++++++++++++ + 3 files changed, 427 insertions(+) + create mode 100644 drivers/leds/leds-st1202.c + +--- a/drivers/leds/Kconfig ++++ b/drivers/leds/Kconfig +@@ -865,6 +865,16 @@ config LEDS_LM36274 + Say Y to enable the LM36274 LED driver for TI LMU devices. + This supports the LED device LM36274. + ++config LEDS_ST1202 ++ tristate "LED Support for STMicroelectronics LED1202 I2C chips" ++ depends on LEDS_CLASS ++ depends on I2C ++ depends on OF ++ select LEDS_TRIGGERS ++ help ++ Say Y to enable support for LEDs connected to LED1202 ++ LED driver chips accessed via the I2C bus. ++ + config LEDS_TPS6105X + tristate "LED support for TI TPS6105X" + depends on LEDS_CLASS +--- a/drivers/leds/Makefile ++++ b/drivers/leds/Makefile +@@ -78,6 +78,7 @@ obj-$(CONFIG_LEDS_POWERNV) += leds-powe + obj-$(CONFIG_LEDS_PWM) += leds-pwm.o + obj-$(CONFIG_LEDS_REGULATOR) += leds-regulator.o + obj-$(CONFIG_LEDS_SC27XX_BLTC) += leds-sc27xx-bltc.o ++obj-$(CONFIG_LEDS_ST1202) += leds-st1202.o + obj-$(CONFIG_LEDS_SUNFIRE) += leds-sunfire.o + obj-$(CONFIG_LEDS_SYSCON) += leds-syscon.o + obj-$(CONFIG_LEDS_TCA6507) += leds-tca6507.o +--- /dev/null ++++ b/drivers/leds/leds-st1202.c +@@ -0,0 +1,416 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * LED driver for STMicroelectronics LED1202 chip ++ * ++ * Copyright (C) 2024 Remote-Tech Ltd. UK ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define ST1202_CHAN_DISABLE_ALL 0x00 ++#define ST1202_CHAN_ENABLE_HIGH 0x03 ++#define ST1202_CHAN_ENABLE_LOW 0x02 ++#define ST1202_CONFIG_REG 0x04 ++/* PATS: Pattern sequence feature enable */ ++#define ST1202_CONFIG_REG_PATS BIT(7) ++/* PATSR: Pattern sequence runs (self-clear when sequence is finished) */ ++#define ST1202_CONFIG_REG_PATSR BIT(6) ++#define ST1202_CONFIG_REG_SHFT BIT(3) ++#define ST1202_DEV_ENABLE 0x01 ++#define ST1202_DEV_ENABLE_ON BIT(0) ++#define ST1202_DEV_ENABLE_RESET BIT(7) ++#define ST1202_DEVICE_ID 0x00 ++#define ST1202_ILED_REG0 0x09 ++#define ST1202_MAX_LEDS 12 ++#define ST1202_MAX_PATTERNS 8 ++#define ST1202_MILLIS_PATTERN_DUR_MAX 5660 ++#define ST1202_MILLIS_PATTERN_DUR_MIN 22 ++#define ST1202_PATTERN_DUR 0x16 ++#define ST1202_PATTERN_PWM 0x1E ++#define ST1202_PATTERN_REP 0x15 ++ ++struct st1202_led { ++ struct fwnode_handle *fwnode; ++ struct led_classdev led_cdev; ++ struct st1202_chip *chip; ++ bool is_active; ++ int led_num; ++}; ++ ++struct st1202_chip { ++ struct i2c_client *client; ++ struct mutex lock; ++ struct st1202_led leds[ST1202_MAX_LEDS]; ++}; ++ ++static struct st1202_led *cdev_to_st1202_led(struct led_classdev *cdev) ++{ ++ return container_of(cdev, struct st1202_led, led_cdev); ++} ++ ++static int st1202_read_reg(struct st1202_chip *chip, int reg, uint8_t *val) ++{ ++ struct device *dev = &chip->client->dev; ++ int ret; ++ ++ ret = i2c_smbus_read_byte_data(chip->client, reg); ++ if (ret < 0) { ++ dev_err(dev, "Failed to read register [0x%x]: %d\n", reg, ret); ++ return ret; ++ } ++ ++ *val = (uint8_t)ret; ++ return 0; ++} ++ ++static int st1202_write_reg(struct st1202_chip *chip, int reg, uint8_t val) ++{ ++ struct device *dev = &chip->client->dev; ++ int ret; ++ ++ ret = i2c_smbus_write_byte_data(chip->client, reg, val); ++ if (ret != 0) ++ dev_err(dev, "Failed to write %d to register [0x%x]: %d\n", val, reg, ret); ++ ++ return ret; ++} ++ ++static uint8_t st1202_prescalar_to_miliseconds(unsigned int value) ++{ ++ return value / ST1202_MILLIS_PATTERN_DUR_MIN - 1; ++} ++ ++static int st1202_pwm_pattern_write(struct st1202_chip *chip, int led_num, ++ int pattern, unsigned int value) ++{ ++ u8 value_l, value_h; ++ int ret; ++ ++ value_l = (u8)value; ++ value_h = (u8)(value >> 8); ++ ++ /* ++ * Datasheet: Register address low = 1Eh + 2*(xh) + 18h*(yh), ++ * where x is the channel number (led number) in hexadecimal (x = 00h .. 0Bh) ++ * and y is the pattern number in hexadecimal (y = 00h .. 07h) ++ */ ++ ret = st1202_write_reg(chip, (ST1202_PATTERN_PWM + (led_num * 2) + 0x18 * pattern), ++ value_l); ++ if (ret != 0) ++ return ret; ++ ++ /* ++ * Datasheet: Register address high = 1Eh + 01h + 2(xh) +18h*(yh), ++ * where x is the channel number in hexadecimal (x = 00h .. 0Bh) ++ * and y is the pattern number in hexadecimal (y = 00h .. 07h) ++ */ ++ ret = st1202_write_reg(chip, (ST1202_PATTERN_PWM + 0x1 + (led_num * 2) + 0x18 * pattern), ++ value_h); ++ if (ret != 0) ++ return ret; ++ ++ return 0; ++} ++ ++static int st1202_duration_pattern_write(struct st1202_chip *chip, int pattern, ++ unsigned int value) ++{ ++ return st1202_write_reg(chip, (ST1202_PATTERN_DUR + pattern), ++ st1202_prescalar_to_miliseconds(value)); ++} ++ ++static void st1202_brightness_set(struct led_classdev *led_cdev, ++ enum led_brightness value) ++{ ++ struct st1202_led *led = cdev_to_st1202_led(led_cdev); ++ struct st1202_chip *chip = led->chip; ++ ++ guard(mutex)(&chip->lock); ++ ++ st1202_write_reg(chip, ST1202_ILED_REG0 + led->led_num, value); ++} ++ ++static enum led_brightness st1202_brightness_get(struct led_classdev *led_cdev) ++{ ++ struct st1202_led *led = cdev_to_st1202_led(led_cdev); ++ struct st1202_chip *chip = led->chip; ++ u8 value = 0; ++ ++ guard(mutex)(&chip->lock); ++ ++ st1202_read_reg(chip, ST1202_ILED_REG0 + led->led_num, &value); ++ ++ return value; ++} ++ ++static int st1202_channel_set(struct st1202_chip *chip, int led_num, bool active) ++{ ++ u8 chan_low, chan_high; ++ int ret; ++ ++ guard(mutex)(&chip->lock); ++ ++ if (led_num <= 7) { ++ ret = st1202_read_reg(chip, ST1202_CHAN_ENABLE_LOW, &chan_low); ++ if (ret < 0) ++ return ret; ++ ++ chan_low = active ? chan_low | BIT(led_num) : chan_low & ~BIT(led_num); ++ ++ ret = st1202_write_reg(chip, ST1202_CHAN_ENABLE_LOW, chan_low); ++ if (ret < 0) ++ return ret; ++ ++ } else { ++ ret = st1202_read_reg(chip, ST1202_CHAN_ENABLE_HIGH, &chan_high); ++ if (ret < 0) ++ return ret; ++ ++ chan_high = active ? chan_high | (BIT(led_num) >> 8) : ++ chan_high & ~(BIT(led_num) >> 8); ++ ++ ret = st1202_write_reg(chip, ST1202_CHAN_ENABLE_HIGH, chan_high); ++ if (ret < 0) ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static int st1202_led_set(struct led_classdev *ldev, enum led_brightness value) ++{ ++ struct st1202_led *led = cdev_to_st1202_led(ldev); ++ struct st1202_chip *chip = led->chip; ++ ++ return st1202_channel_set(chip, led->led_num, value == LED_OFF ? false : true); ++} ++ ++static int st1202_led_pattern_clear(struct led_classdev *ldev) ++{ ++ struct st1202_led *led = cdev_to_st1202_led(ldev); ++ struct st1202_chip *chip = led->chip; ++ int ret; ++ ++ guard(mutex)(&chip->lock); ++ ++ for (int patt = 0; patt < ST1202_MAX_PATTERNS; patt++) { ++ ret = st1202_pwm_pattern_write(chip, led->led_num, patt, LED_OFF); ++ if (ret != 0) ++ return ret; ++ ++ ret = st1202_duration_pattern_write(chip, patt, ST1202_MILLIS_PATTERN_DUR_MIN); ++ if (ret != 0) ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static int st1202_led_pattern_set(struct led_classdev *ldev, ++ struct led_pattern *pattern, ++ u32 len, int repeat) ++{ ++ struct st1202_led *led = cdev_to_st1202_led(ldev); ++ struct st1202_chip *chip = led->chip; ++ int ret; ++ ++ if (len > ST1202_MAX_PATTERNS) ++ return -EINVAL; ++ ++ guard(mutex)(&chip->lock); ++ ++ for (int patt = 0; patt < len; patt++) { ++ if (pattern[patt].delta_t < ST1202_MILLIS_PATTERN_DUR_MIN || ++ pattern[patt].delta_t > ST1202_MILLIS_PATTERN_DUR_MAX) ++ return -EINVAL; ++ ++ ret = st1202_pwm_pattern_write(chip, led->led_num, patt, pattern[patt].brightness); ++ if (ret != 0) ++ return ret; ++ ++ ret = st1202_duration_pattern_write(chip, patt, pattern[patt].delta_t); ++ if (ret != 0) ++ return ret; ++ } ++ ++ ret = st1202_write_reg(chip, ST1202_PATTERN_REP, repeat); ++ if (ret != 0) ++ return ret; ++ ++ ret = st1202_write_reg(chip, ST1202_CONFIG_REG, (ST1202_CONFIG_REG_PATSR | ++ ST1202_CONFIG_REG_PATS | ST1202_CONFIG_REG_SHFT)); ++ if (ret != 0) ++ return ret; ++ ++ return 0; ++} ++ ++static int st1202_dt_init(struct st1202_chip *chip) ++{ ++ struct device *dev = &chip->client->dev; ++ struct st1202_led *led; ++ int err, reg; ++ ++ for_each_available_child_of_node_scoped(dev_of_node(dev), child) { ++ struct led_init_data init_data = {}; ++ ++ err = of_property_read_u32(child, "reg", ®); ++ if (err) ++ return dev_err_probe(dev, err, "Invalid register\n"); ++ ++ led = &chip->leds[reg]; ++ led->is_active = true; ++ led->fwnode = of_fwnode_handle(child); ++ ++ led->led_cdev.max_brightness = U8_MAX; ++ led->led_cdev.brightness_set_blocking = st1202_led_set; ++ led->led_cdev.pattern_set = st1202_led_pattern_set; ++ led->led_cdev.pattern_clear = st1202_led_pattern_clear; ++ led->led_cdev.default_trigger = "pattern"; ++ ++ init_data.fwnode = led->fwnode; ++ init_data.devicename = "st1202"; ++ init_data.default_label = ":"; ++ ++ err = devm_led_classdev_register_ext(dev, &led->led_cdev, &init_data); ++ if (err < 0) ++ return dev_err_probe(dev, err, "Failed to register LED class device\n"); ++ ++ led->led_cdev.brightness_set = st1202_brightness_set; ++ led->led_cdev.brightness_get = st1202_brightness_get; ++ } ++ ++ return 0; ++} ++ ++static int st1202_setup(struct st1202_chip *chip) ++{ ++ int ret; ++ ++ guard(mutex)(&chip->lock); ++ ++ /* ++ * Once the supply voltage is applied, the LED1202 executes some internal checks, ++ * afterwords it stops the oscillator and puts the internal LDO in quiescent mode. ++ * To start the device, EN bit must be set inside the “Device Enable” register at ++ * address 01h. As soon as EN is set, the LED1202 loads the adjustment parameters ++ * from the internal non-volatile memory and performs an auto-calibration procedure ++ * in order to increase the output current precision. ++ * Such initialization lasts about 6.5 ms. ++ */ ++ ++ /* Reset the chip during setup */ ++ ret = st1202_write_reg(chip, ST1202_DEV_ENABLE, ST1202_DEV_ENABLE_RESET); ++ if (ret < 0) ++ return ret; ++ ++ /* Enable phase-shift delay feature */ ++ ret = st1202_write_reg(chip, ST1202_CONFIG_REG, ST1202_CONFIG_REG_SHFT); ++ if (ret < 0) ++ return ret; ++ ++ /* Enable the device */ ++ ret = st1202_write_reg(chip, ST1202_DEV_ENABLE, ST1202_DEV_ENABLE_ON); ++ if (ret < 0) ++ return ret; ++ ++ /* Duration of initialization */ ++ usleep_range(6500, 10000); ++ ++ /* Deactivate all LEDS (channels) and activate only the ones found in Device Tree */ ++ ret = st1202_write_reg(chip, ST1202_CHAN_ENABLE_LOW, ST1202_CHAN_DISABLE_ALL); ++ if (ret < 0) ++ return ret; ++ ++ ret = st1202_write_reg(chip, ST1202_CHAN_ENABLE_HIGH, ST1202_CHAN_DISABLE_ALL); ++ if (ret < 0) ++ return ret; ++ ++ ret = st1202_write_reg(chip, ST1202_CONFIG_REG, ++ ST1202_CONFIG_REG_PATS | ST1202_CONFIG_REG_PATSR); ++ if (ret < 0) ++ return ret; ++ ++ return 0; ++} ++ ++static int st1202_probe(struct i2c_client *client) ++{ ++ struct st1202_chip *chip; ++ struct st1202_led *led; ++ int ret; ++ ++ if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) ++ return dev_err_probe(&client->dev, -EIO, "SMBUS Byte Data not Supported\n"); ++ ++ chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); ++ if (!chip) ++ return -ENOMEM; ++ ++ devm_mutex_init(&client->dev, &chip->lock); ++ chip->client = client; ++ ++ ret = st1202_dt_init(chip); ++ if (ret < 0) ++ return ret; ++ ++ ret = st1202_setup(chip); ++ if (ret < 0) ++ return ret; ++ ++ for (int i = 0; i < ST1202_MAX_LEDS; i++) { ++ led = &chip->leds[i]; ++ led->chip = chip; ++ led->led_num = i; ++ ++ if (!led->is_active) ++ continue; ++ ++ ret = st1202_channel_set(led->chip, led->led_num, true); ++ if (ret < 0) ++ return dev_err_probe(&client->dev, ret, ++ "Failed to activate LED channel\n"); ++ ++ ret = st1202_led_pattern_clear(&led->led_cdev); ++ if (ret < 0) ++ return dev_err_probe(&client->dev, ret, ++ "Failed to clear LED pattern\n"); ++ } ++ ++ return 0; ++} ++ ++static const struct i2c_device_id st1202_id[] = { ++ { "st1202-i2c" }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(i2c, st1202_id); ++ ++static const struct of_device_id st1202_dt_ids[] = { ++ { .compatible = "st,led1202" }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(of, st1202_dt_ids); ++ ++static struct i2c_driver st1202_driver = { ++ .driver = { ++ .name = "leds-st1202", ++ .of_match_table = of_match_ptr(st1202_dt_ids), ++ }, ++ .probe = st1202_probe, ++ .id_table = st1202_id, ++}; ++module_i2c_driver(st1202_driver); ++ ++MODULE_AUTHOR("Remote Tech LTD"); ++MODULE_DESCRIPTION("STMicroelectronics LED1202 : 12-channel constant current LED driver"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/mediatek/patches-6.6/950-smartrg-i2c-led-driver.patch b/target/linux/mediatek/patches-6.6/950-smartrg-i2c-led-driver.patch index cb3b394dc6a..81234f68eab 100644 --- a/target/linux/mediatek/patches-6.6/950-smartrg-i2c-led-driver.patch +++ b/target/linux/mediatek/patches-6.6/950-smartrg-i2c-led-driver.patch @@ -5,7 +5,7 @@ --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig -@@ -901,6 +901,16 @@ source "drivers/leds/flash/Kconfig" +@@ -911,6 +911,16 @@ source "drivers/leds/flash/Kconfig" comment "RGB LED drivers" source "drivers/leds/rgb/Kconfig" @@ -29,6 +29,6 @@ obj-$(CONFIG_LEDS_REGULATOR) += leds-regulator.o obj-$(CONFIG_LEDS_SC27XX_BLTC) += leds-sc27xx-bltc.o +obj-$(CONFIG_LEDS_SMARTRG_LED) += leds-smartrg-system.o + obj-$(CONFIG_LEDS_ST1202) += leds-st1202.o obj-$(CONFIG_LEDS_SUNFIRE) += leds-sunfire.o obj-$(CONFIG_LEDS_SYSCON) += leds-syscon.o - obj-$(CONFIG_LEDS_TCA6507) += leds-tca6507.o From 7ce4ed4829fafdd37a57681304ea91e3749bc3c8 Mon Sep 17 00:00:00 2001 From: Manuel Fombuena Date: Thu, 2 Jan 2025 18:28:16 +0000 Subject: [PATCH 075/173] qualcommax: ipq807x: mx4200v2: fix LED controller The Linksys MX4200v2 doesn't have the same LED controller as the MX4200v1 or MX4300. It comes with the STMicroelectronics LED1202 while the others come with the NXP PCA9633. This LED controller has a driver under development which is currently being reviewed by the respective kernel maintainers. They are currently on v11. Apart from the changes needed on the MX4200v2, this commit also amends the configuration of other devices affected by this change as the LED controller is no common to all of them as it was originally thought. Signed-off-by: Manuel Fombuena Link: https://github.com/openwrt/openwrt/pull/17451 Signed-off-by: Robert Marko --- .../arm64/boot/dts/qcom/ipq8174-mx4200v1.dts | 29 +++++++++++++++++++ .../arm64/boot/dts/qcom/ipq8174-mx4200v2.dts | 26 +++++++++++++++++ .../arm64/boot/dts/qcom/ipq8174-mx4300.dts | 29 +++++++++++++++++++ .../arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi | 26 ----------------- target/linux/qualcommax/image/ipq807x.mk | 12 ++++---- 5 files changed, 91 insertions(+), 31 deletions(-) diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v1.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v1.dts index 7946e5c54d3..12897419bbd 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v1.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v1.dts @@ -11,6 +11,35 @@ compatible = "linksys,mx4200v1", "qcom,ipq8074"; }; +&blsp1_i2c2 { + + led-controller@62 { + compatible = "nxp,pca9633"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x62>; + nxp,hw-blink; + + led_system_red: led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led_system_green: led@1 { + reg = <1>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led_system_blue: led@2 { + reg = <2>; + color = ; + function = LED_FUNCTION_STATUS; + }; + }; +}; + &wifi { status = "okay"; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v2.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v2.dts index 44e1b72f16a..c1779a2d488 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v2.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v2.dts @@ -10,6 +10,32 @@ compatible = "linksys,mx4200v2", "qcom,ipq8074"; }; +&blsp1_i2c2 { + + led-controller@58 { + compatible = "st,led1202"; + reg = <0x58>; + #address-cells = <1>; + #size-cells = <0>; + + led_system_green: led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_STATUS; + }; + led_system_red: led@1 { + reg = <1>; + color = ; + function = LED_FUNCTION_STATUS; + }; + led_system_blue: led@2 { + reg = <2>; + color = ; + function = LED_FUNCTION_STATUS; + }; + }; +}; + &wifi { status = "okay"; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4300.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4300.dts index 1477019ab94..d09710b9c47 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4300.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4300.dts @@ -242,6 +242,35 @@ }; }; +&blsp1_i2c2 { + + led-controller@62 { + compatible = "nxp,pca9633"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x62>; + nxp,hw-blink; + + led_system_red: led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led_system_green: led@1 { + reg = <1>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led_system_blue: led@2 { + reg = <2>; + color = ; + function = LED_FUNCTION_STATUS; + }; + }; +}; + &dp2 { status = "okay"; phy-handle = <&qca8075_1>; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi index 84e68dae356..2dca7ffd3bf 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi @@ -94,32 +94,6 @@ &blsp1_i2c2 { status = "okay"; - - led-controller@62 { - compatible = "nxp,pca9633"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x62>; - nxp,hw-blink; - - led_system_red: led@0 { - reg = <0>; - color = ; - function = LED_FUNCTION_STATUS; - }; - - led_system_green: led@1 { - reg = <1>; - color = ; - function = LED_FUNCTION_STATUS; - }; - - led_system_blue: led@2 { - reg = <2>; - color = ; - function = LED_FUNCTION_STATUS; - }; - }; }; &mdio { diff --git a/target/linux/qualcommax/image/ipq807x.mk b/target/linux/qualcommax/image/ipq807x.mk index 260b358ce89..731c2ba0caa 100644 --- a/target/linux/qualcommax/image/ipq807x.mk +++ b/target/linux/qualcommax/image/ipq807x.mk @@ -167,7 +167,6 @@ define Device/linksys_mx SOC := ipq8072 IMAGES += factory.bin IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | linksys-image type=$$$$(DEVICE_MODEL) - DEVICE_PACKAGES := kmod-leds-pca963x endef define Device/linksys_mx4x00 @@ -180,13 +179,15 @@ define Device/linksys_mx4200v1 $(call Device/linksys_mx4x00) DEVICE_MODEL := MX4200 DEVICE_VARIANT := v1 - DEVICE_PACKAGES += kmod-bluetooth + DEVICE_PACKAGES += kmod-bluetooth kmod-leds-pca963x endef TARGET_DEVICES += linksys_mx4200v1 define Device/linksys_mx4200v2 - $(call Device/linksys_mx4200v1) + $(call Device/linksys_mx4x00) + DEVICE_MODEL := MX4200 DEVICE_VARIANT := v2 + DEVICE_PACKAGES += kmod-bluetooth kmod-leds-st1202 endef TARGET_DEVICES += linksys_mx4200v2 @@ -198,6 +199,7 @@ define Device/linksys_mx4300 KERNEL_SIZE := 8192k IMAGE_SIZE := 171264k NAND_SIZE := 1024m + DEVICE_PACKAGES += kmod-leds-pca963x endef TARGET_DEVICES += linksys_mx4300 @@ -205,7 +207,7 @@ define Device/linksys_mx5300 $(call Device/linksys_mx) DEVICE_MODEL := MX5300 DEVICE_PACKAGES += kmod-rtc-ds1307 ipq-wifi-linksys_mx5300 \ - kmod-ath10k-ct ath10k-firmware-qca9984-ct + kmod-ath10k-ct ath10k-firmware-qca9984-ct kmod-leds-pca963x endef TARGET_DEVICES += linksys_mx5300 @@ -213,7 +215,7 @@ define Device/linksys_mx8500 $(call Device/linksys_mx) DEVICE_MODEL := MX8500 DEVICE_PACKAGES += ipq-wifi-linksys_mx8500 kmod-ath11k-pci \ - ath11k-firmware-qcn9074 kmod-bluetooth + ath11k-firmware-qcn9074 kmod-bluetooth kmod-leds-pca963x endef TARGET_DEVICES += linksys_mx8500 From 39b61ee36fa8e5802e008ee01c428b97cba83e46 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Sun, 5 Jan 2025 12:32:32 +0100 Subject: [PATCH 076/173] Revert "qualcommax: ipq807x: mx4200v2: fix LED controller" This reverts commit 7ce4ed4829fafdd37a57681304ea91e3749bc3c8. Turns out that this requires more work, so revert to prevent making the LED uncontrollable. Signed-off-by: Robert Marko --- .../arm64/boot/dts/qcom/ipq8174-mx4200v1.dts | 29 ------------------- .../arm64/boot/dts/qcom/ipq8174-mx4200v2.dts | 26 ----------------- .../arm64/boot/dts/qcom/ipq8174-mx4300.dts | 29 ------------------- .../arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi | 26 +++++++++++++++++ target/linux/qualcommax/image/ipq807x.mk | 12 ++++---- 5 files changed, 31 insertions(+), 91 deletions(-) diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v1.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v1.dts index 12897419bbd..7946e5c54d3 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v1.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v1.dts @@ -11,35 +11,6 @@ compatible = "linksys,mx4200v1", "qcom,ipq8074"; }; -&blsp1_i2c2 { - - led-controller@62 { - compatible = "nxp,pca9633"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x62>; - nxp,hw-blink; - - led_system_red: led@0 { - reg = <0>; - color = ; - function = LED_FUNCTION_STATUS; - }; - - led_system_green: led@1 { - reg = <1>; - color = ; - function = LED_FUNCTION_STATUS; - }; - - led_system_blue: led@2 { - reg = <2>; - color = ; - function = LED_FUNCTION_STATUS; - }; - }; -}; - &wifi { status = "okay"; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v2.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v2.dts index c1779a2d488..44e1b72f16a 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v2.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v2.dts @@ -10,32 +10,6 @@ compatible = "linksys,mx4200v2", "qcom,ipq8074"; }; -&blsp1_i2c2 { - - led-controller@58 { - compatible = "st,led1202"; - reg = <0x58>; - #address-cells = <1>; - #size-cells = <0>; - - led_system_green: led@0 { - reg = <0>; - color = ; - function = LED_FUNCTION_STATUS; - }; - led_system_red: led@1 { - reg = <1>; - color = ; - function = LED_FUNCTION_STATUS; - }; - led_system_blue: led@2 { - reg = <2>; - color = ; - function = LED_FUNCTION_STATUS; - }; - }; -}; - &wifi { status = "okay"; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4300.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4300.dts index d09710b9c47..1477019ab94 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4300.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4300.dts @@ -242,35 +242,6 @@ }; }; -&blsp1_i2c2 { - - led-controller@62 { - compatible = "nxp,pca9633"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x62>; - nxp,hw-blink; - - led_system_red: led@0 { - reg = <0>; - color = ; - function = LED_FUNCTION_STATUS; - }; - - led_system_green: led@1 { - reg = <1>; - color = ; - function = LED_FUNCTION_STATUS; - }; - - led_system_blue: led@2 { - reg = <2>; - color = ; - function = LED_FUNCTION_STATUS; - }; - }; -}; - &dp2 { status = "okay"; phy-handle = <&qca8075_1>; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi index 2dca7ffd3bf..84e68dae356 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi @@ -94,6 +94,32 @@ &blsp1_i2c2 { status = "okay"; + + led-controller@62 { + compatible = "nxp,pca9633"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x62>; + nxp,hw-blink; + + led_system_red: led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led_system_green: led@1 { + reg = <1>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led_system_blue: led@2 { + reg = <2>; + color = ; + function = LED_FUNCTION_STATUS; + }; + }; }; &mdio { diff --git a/target/linux/qualcommax/image/ipq807x.mk b/target/linux/qualcommax/image/ipq807x.mk index 731c2ba0caa..260b358ce89 100644 --- a/target/linux/qualcommax/image/ipq807x.mk +++ b/target/linux/qualcommax/image/ipq807x.mk @@ -167,6 +167,7 @@ define Device/linksys_mx SOC := ipq8072 IMAGES += factory.bin IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | linksys-image type=$$$$(DEVICE_MODEL) + DEVICE_PACKAGES := kmod-leds-pca963x endef define Device/linksys_mx4x00 @@ -179,15 +180,13 @@ define Device/linksys_mx4200v1 $(call Device/linksys_mx4x00) DEVICE_MODEL := MX4200 DEVICE_VARIANT := v1 - DEVICE_PACKAGES += kmod-bluetooth kmod-leds-pca963x + DEVICE_PACKAGES += kmod-bluetooth endef TARGET_DEVICES += linksys_mx4200v1 define Device/linksys_mx4200v2 - $(call Device/linksys_mx4x00) - DEVICE_MODEL := MX4200 + $(call Device/linksys_mx4200v1) DEVICE_VARIANT := v2 - DEVICE_PACKAGES += kmod-bluetooth kmod-leds-st1202 endef TARGET_DEVICES += linksys_mx4200v2 @@ -199,7 +198,6 @@ define Device/linksys_mx4300 KERNEL_SIZE := 8192k IMAGE_SIZE := 171264k NAND_SIZE := 1024m - DEVICE_PACKAGES += kmod-leds-pca963x endef TARGET_DEVICES += linksys_mx4300 @@ -207,7 +205,7 @@ define Device/linksys_mx5300 $(call Device/linksys_mx) DEVICE_MODEL := MX5300 DEVICE_PACKAGES += kmod-rtc-ds1307 ipq-wifi-linksys_mx5300 \ - kmod-ath10k-ct ath10k-firmware-qca9984-ct kmod-leds-pca963x + kmod-ath10k-ct ath10k-firmware-qca9984-ct endef TARGET_DEVICES += linksys_mx5300 @@ -215,7 +213,7 @@ define Device/linksys_mx8500 $(call Device/linksys_mx) DEVICE_MODEL := MX8500 DEVICE_PACKAGES += ipq-wifi-linksys_mx8500 kmod-ath11k-pci \ - ath11k-firmware-qcn9074 kmod-bluetooth kmod-leds-pca963x + ath11k-firmware-qcn9074 kmod-bluetooth endef TARGET_DEVICES += linksys_mx8500 From 916af73fc388d638b1a717a2411792e0680dd8e6 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 3 Jan 2025 21:46:13 +0100 Subject: [PATCH 077/173] ath79: reset ETH switch for AR9344 According to datasheet, on AR9344 the switch and switch analog need to be reset first before initiating a full reset. Resetting these systems fixes spurious reset hangs on Atheros AR9344 SoCs. Link: https://github.com/freifunk-gluon/gluon/issues/2904 Signed-off-by: David Bauer --- ...et-ath79-reset-ETH-switch-for-AR9344.patch | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 target/linux/ath79/patches-6.6/101-reset-ath79-reset-ETH-switch-for-AR9344.patch diff --git a/target/linux/ath79/patches-6.6/101-reset-ath79-reset-ETH-switch-for-AR9344.patch b/target/linux/ath79/patches-6.6/101-reset-ath79-reset-ETH-switch-for-AR9344.patch new file mode 100644 index 00000000000..dcac5be58b3 --- /dev/null +++ b/target/linux/ath79/patches-6.6/101-reset-ath79-reset-ETH-switch-for-AR9344.patch @@ -0,0 +1,104 @@ +From: David Bauer +Date: Tue, 2 Jan 2025 19:22:40 +0100 +Subject: [PATCH] reset: ath79: reset ETH switch for AR9344 + +According to datasheet, on AR9344 the switch and switch analog need to +be reset first before initiating a full reset. + +Resetting these systems fixes spurious reset hangs on Atheros AR9344 +SoCs. + +Link: https://github.com/freifunk-gluon/gluon/issues/2904 + +Signed-off-by: David Bauer + +--- a/drivers/reset/reset-ath79.c ++++ b/drivers/reset/reset-ath79.c +@@ -12,8 +12,11 @@ + #include + #include + #include ++#include ++#include + + struct ath79_reset { ++ struct platform_device *pdev; + struct reset_controller_dev rcdev; + struct notifier_block restart_nb; + void __iomem *base; +@@ -21,16 +24,13 @@ struct ath79_reset { + }; + + #define FULL_CHIP_RESET 24 ++#define ETH_SWITCH_RESET 8 ++#define ETH_SWITCH_ARESET 12 + +-static int ath79_reset_update(struct reset_controller_dev *rcdev, ++static void __ath79_reset_update_unlocked(struct ath79_reset *ath79_reset, + unsigned long id, bool assert) + { +- struct ath79_reset *ath79_reset = +- container_of(rcdev, struct ath79_reset, rcdev); +- unsigned long flags; + u32 val; +- +- spin_lock_irqsave(&ath79_reset->lock, flags); + val = readl(ath79_reset->base); + if (assert) + val |= BIT(id); +@@ -39,6 +39,17 @@ static int ath79_reset_update(struct res + writel(val, ath79_reset->base); + /* Flush cache */ + readl(ath79_reset->base); ++} ++ ++static int ath79_reset_update(struct reset_controller_dev *rcdev, ++ unsigned long id, bool assert) ++{ ++ struct ath79_reset *ath79_reset = ++ container_of(rcdev, struct ath79_reset, rcdev); ++ unsigned long flags; ++ ++ spin_lock_irqsave(&ath79_reset->lock, flags); ++ __ath79_reset_update_unlocked(ath79_reset, id, assert); + spin_unlock_irqrestore(&ath79_reset->lock, flags); + + return 0; +@@ -79,8 +90,27 @@ static int ath79_reset_restart_handler(s + { + struct ath79_reset *ath79_reset = + container_of(nb, struct ath79_reset, restart_nb); ++ unsigned long flags; + +- ath79_reset_assert(&ath79_reset->rcdev, FULL_CHIP_RESET); ++ spin_lock_irqsave(&ath79_reset->lock, flags); ++ ++ if (of_device_is_compatible(ath79_reset->pdev->dev.of_node, "qca,ar9340-reset")) { ++ /** ++ * AR9344 has been observed to hang on reboot in rare cases. ++ * ++ * Datasheet states to reset the ETH switch systems before asserting ++ * full chip reset. See page 111 of the AR9344 datasheet. ++ */ ++ __ath79_reset_update_unlocked(ath79_reset, ETH_SWITCH_RESET, true); ++ mdelay(10); ++ __ath79_reset_update_unlocked(ath79_reset, ETH_SWITCH_ARESET, true); ++ mdelay(10); ++ } ++ ++ __ath79_reset_update_unlocked(ath79_reset, FULL_CHIP_RESET, true); ++ mdelay(10); ++ ++ spin_unlock_irqrestore(&ath79_reset->lock, flags); + + return NOTIFY_DONE; + } +@@ -95,6 +125,8 @@ static int ath79_reset_probe(struct plat + if (!ath79_reset) + return -ENOMEM; + ++ ath79_reset->pdev = pdev; ++ + ath79_reset->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(ath79_reset->base)) + return PTR_ERR(ath79_reset->base); From 381f6624cfb5a1beb763cb09967cb931bcd98427 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sat, 4 Jan 2025 15:59:57 +0800 Subject: [PATCH 078/173] ppp: update to 2.5.2 This is a minor upgrade that mainly fixes some compilation errors and remove old unused code. The Makefile has been reorganized. Now all package make parameters are passed as configure arguments instead of environment variables. The compilation dependencies remain the same as ppp v2.5.1 and the package size changes are negligible. Change log: https://github.com/ppp-project/ppp/blob/v2.5.2/README#L70 Upstreamed patches: 101-pppd-crypto-fix-build-without-openssl.patch [1] 102-pppd-make-pid-directory-before-create-the-pid-file.patch [2] 103-pppd-crypto-fix-gcc-14-build.patch [3] [1] https://github.com/ppp-project/ppp/commit/5f6eabdb6666d914e0f8feb3facfa591dee75a1f [2] https://github.com/ppp-project/ppp/commit/734bc0438e78b7c7cd34acfce3a4ec119d9a50b6 [3] https://github.com/ppp-project/ppp/commit/ac269dbf7c142371cd975c775c6171707ac4dde8 Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17477 Signed-off-by: Nick Hainke --- package/network/services/ppp/Makefile | 37 ++++++++------- ...ppd-crypto-fix-build-without-openssl.patch | 45 ------------------- ...directory-before-create-the-pid-file.patch | 27 ----------- .../103-pppd-crypto-fix-gcc-14-build.patch | 42 ----------------- .../ppp/patches/105-debian_demand.patch | 10 ++--- .../ppp/patches/204-radius_config.patch | 4 +- .../ppp/patches/208-fix_status_code.patch | 4 +- .../ppp/patches/310-precompile_filter.patch | 4 +- ...multilink_support_custom_iface_names.patch | 12 ++--- .../340-populate_default_gateway.patch | 4 +- .../patches/400-simplify_kernel_checks.patch | 24 +++++----- .../ppp/patches/401-no_record_file.patch | 6 +-- .../404-remove_obsolete_protocol_names.patch | 16 +++---- .../ppp/patches/500-add-pptp-plugin.patch | 4 +- 14 files changed, 65 insertions(+), 174 deletions(-) delete mode 100644 package/network/services/ppp/patches/101-pppd-crypto-fix-build-without-openssl.patch delete mode 100644 package/network/services/ppp/patches/102-pppd-make-pid-directory-before-create-the-pid-file.patch delete mode 100644 package/network/services/ppp/patches/103-pppd-crypto-fix-gcc-14-build.patch diff --git a/package/network/services/ppp/Makefile b/package/network/services/ppp/Makefile index 760a31dc0d0..ceb32c39780 100644 --- a/package/network/services/ppp/Makefile +++ b/package/network/services/ppp/Makefile @@ -9,14 +9,14 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=ppp -PKG_VERSION:=2.5.1 +PKG_VERSION:=2.5.2 PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/ppp-project/ppp -PKG_SOURCE_DATE:=2024-09-18 -PKG_SOURCE_VERSION:=d5aeec65752d4a9b3bb46771d0b221c4a4a6539e -PKG_MIRROR_HASH:=b98125933d8160ff3476b053414e787e65a94948c0ecee53f6261cd403ff4b03 +PKG_SOURCE_DATE:=2024-12-31 +PKG_SOURCE_VERSION:=9f612dc02c34509f062ed63b60bcc7e937e25178 +PKG_MIRROR_HASH:=677b71d23b668db986146e13b0c651f2ac506eb4fb244ffba1ff406cbae3511b PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-4-Clause @@ -30,17 +30,22 @@ PKG_FIXUP:=autoreconf PKG_INSTALL:=1 include $(INCLUDE_DIR)/package.mk -CONFIGURE_VARS += \ - enable_eaptls=no \ - enable_microsoft_extensions=yes \ - enable_peap=no - CONFIGURE_ARGS += \ - with_openssl=no \ - with_pam=no \ - with_pcap=no \ - with_srp=no \ - with_static_pcap=yes + --disable-cbcp \ + --disable-eaptls \ + --disable-mslanman \ + --disable-openssl-engine \ + --disable-peap \ + --disable-systemd \ + --enable-ipv6cp \ + --enable-microsoft-extensions \ + --enable-plugins \ + --with-atm \ + --with-static-pcap \ + --without-openssl \ + --without-pam \ + --without-pcap \ + --without-srp define Package/ppp/Default SECTION:=net @@ -185,8 +190,8 @@ not initiate a session. Can be useful to debug pppoe. endef ifeq ($(BUILD_VARIANT),multilink) - CONFIGURE_VARS += \ - enable_multilink=yes + CONFIGURE_ARGS += \ + --enable-multilink endif define Build/InstallDev diff --git a/package/network/services/ppp/patches/101-pppd-crypto-fix-build-without-openssl.patch b/package/network/services/ppp/patches/101-pppd-crypto-fix-build-without-openssl.patch deleted file mode 100644 index eb243694ec7..00000000000 --- a/package/network/services/ppp/patches/101-pppd-crypto-fix-build-without-openssl.patch +++ /dev/null @@ -1,45 +0,0 @@ -From: Shiji Yang -Date: Fri, 4 Oct 2024 12:19:42 +0000 -Subject: [PATCH] pppd/crypto: fix build without openssl - -Compile openssl relevant code only when PPP_WITH_OPENSSL is defined. - -Signed-off-by: Shiji Yang ---- - pppd/crypto.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/pppd/crypto.c -+++ b/pppd/crypto.c -@@ -199,6 +199,7 @@ int PPP_crypto_init() - { - int retval = 0; - -+#ifdef PPP_WITH_OPENSSL - #if OPENSSL_VERSION_NUMBER >= 0x30000000L - g_crypto_ctx.legacy = OSSL_PROVIDER_load(NULL, "legacy"); - if (g_crypto_ctx.legacy == NULL) -@@ -214,6 +215,7 @@ int PPP_crypto_init() - goto done; - } - #endif -+#endif - - retval = 1; - -@@ -224,6 +226,7 @@ done: - - int PPP_crypto_deinit() - { -+#ifdef PPP_WITH_OPENSSL - #if OPENSSL_VERSION_NUMBER >= 0x30000000L - if (g_crypto_ctx.legacy) { - OSSL_PROVIDER_unload(g_crypto_ctx.legacy); -@@ -239,6 +242,7 @@ int PPP_crypto_deinit() - #if OPENSSL_VERSION_NUMBER < 0x10100000L - ERR_free_strings(); - #endif -+#endif - return 1; - } - diff --git a/package/network/services/ppp/patches/102-pppd-make-pid-directory-before-create-the-pid-file.patch b/package/network/services/ppp/patches/102-pppd-make-pid-directory-before-create-the-pid-file.patch deleted file mode 100644 index 69e68cdff40..00000000000 --- a/package/network/services/ppp/patches/102-pppd-make-pid-directory-before-create-the-pid-file.patch +++ /dev/null @@ -1,27 +0,0 @@ -From: Shiji Yang -Date: Fri, 4 Oct 2024 14:02:14 +0000 -Subject: [PATCH] pppd: make pid directory before create the pid file - -If multilink feature is not enabled, the '/var/run/pppd' directory -won't be created before adding pid file. - -Fixes error message: -'Failed to create pid file /var/run/pppd/pppoe-wan.pid: No such file or directory' - -Signed-off-by: Shiji Yang ---- - pppd/main.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/pppd/main.c -+++ b/pppd/main.c -@@ -921,6 +921,9 @@ create_pidfile(int pid) - { - FILE *pidfile; - -+#ifndef PPP_WITH_TDB -+ mkdir_recursive(PPP_PATH_VARRUN); -+#endif - slprintf(pidfilename, sizeof(pidfilename), "%s/%s.pid", - PPP_PATH_VARRUN, ifname); - if ((pidfile = fopen(pidfilename, "w")) != NULL) { diff --git a/package/network/services/ppp/patches/103-pppd-crypto-fix-gcc-14-build.patch b/package/network/services/ppp/patches/103-pppd-crypto-fix-gcc-14-build.patch deleted file mode 100644 index 3a76deb0427..00000000000 --- a/package/network/services/ppp/patches/103-pppd-crypto-fix-gcc-14-build.patch +++ /dev/null @@ -1,42 +0,0 @@ -From: Tan Zien -Date: Tue, 1 Oct 2024 10:38:45 +0800 -Subject: [PATCH] pppd/crypto: fix gcc 14 build - -fix this: - -crypto.c: In function 'PPP_crypto_error': -crypto.c:178:11: error: implicit declaration of function 'vsnprintf' [-Wimplicit-function-declaration] - 178 | off = vsnprintf(buf, len, fmt, args); - | ^~~~~~~~~ -crypto.c:41:1: note: include '' or provide a declaration of 'vsnprintf' - 40 | #include "crypto-priv.h" - +++ |+#include - 41 | -crypto.c:178:26: warning: 'vsnprintf' argument 2 type is 'int' where 'long unsigned int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch] - 178 | off = vsnprintf(buf, len, fmt, args); - | ^~~ -: note: built-in 'vsnprintf' declared here - -Signed-off-by: Tan Zien ---- - pppd/crypto.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/pppd/crypto.c -+++ b/pppd/crypto.c -@@ -34,6 +34,7 @@ - - #include - #include -+#include - - #include "pppd.h" - #include "crypto.h" -@@ -247,7 +248,6 @@ int PPP_crypto_deinit() - } - - #ifdef UNIT_TEST --#include - - int debug; - int error_count; diff --git a/package/network/services/ppp/patches/105-debian_demand.patch b/package/network/services/ppp/patches/105-debian_demand.patch index 10ce13b2535..25f1644aa4b 100644 --- a/package/network/services/ppp/patches/105-debian_demand.patch +++ b/package/network/services/ppp/patches/105-debian_demand.patch @@ -1,6 +1,6 @@ --- a/pppd/demand.c +++ b/pppd/demand.c -@@ -40,6 +40,8 @@ +@@ -34,6 +34,8 @@ #include #include #include @@ -9,7 +9,7 @@ #include #include #include -@@ -47,6 +49,8 @@ +@@ -41,6 +43,8 @@ #include #include #include @@ -18,7 +18,7 @@ #ifdef PPP_WITH_FILTER #include #endif -@@ -223,6 +227,14 @@ loop_chars(unsigned char *p, int n) +@@ -217,6 +221,14 @@ loop_chars(unsigned char *p, int n) int c, rv; rv = 0; @@ -33,7 +33,7 @@ for (; n > 0; --n) { c = *p++; if (c == PPP_FLAG) { -@@ -299,16 +311,100 @@ loop_frame(unsigned char *frame, int len +@@ -293,16 +305,100 @@ loop_frame(unsigned char *frame, int len * loopback, now that the real serial link is up. */ void @@ -159,7 +159,7 @@ } else { --- a/pppd/pppd-private.h +++ b/pppd/pppd-private.h -@@ -368,7 +368,7 @@ void demand_conf(void); /* config interf +@@ -370,7 +370,7 @@ void demand_conf(void); /* config interf void demand_block(void); /* set all NPs to queue up packets */ void demand_unblock(void); /* set all NPs to pass packets */ void demand_discard(void); /* set all NPs to discard packets */ diff --git a/package/network/services/ppp/patches/204-radius_config.patch b/package/network/services/ppp/patches/204-radius_config.patch index 3f6db59b710..1f5fdffa956 100644 --- a/package/network/services/ppp/patches/204-radius_config.patch +++ b/package/network/services/ppp/patches/204-radius_config.patch @@ -1,6 +1,6 @@ --- a/pppd/plugins/radius/config.c +++ b/pppd/plugins/radius/config.c -@@ -381,31 +381,37 @@ static int test_config(char *filename) +@@ -379,31 +379,37 @@ static int test_config(char *filename) } #endif @@ -40,7 +40,7 @@ } --- a/pppd/plugins/radius/options.h +++ b/pppd/plugins/radius/options.h -@@ -31,24 +31,21 @@ typedef struct _option { +@@ -29,24 +29,21 @@ typedef struct _option { static SERVER acctserver = {0}; static SERVER authserver = {0}; diff --git a/package/network/services/ppp/patches/208-fix_status_code.patch b/package/network/services/ppp/patches/208-fix_status_code.patch index 10cd9453742..2d1e02742e3 100644 --- a/package/network/services/ppp/patches/208-fix_status_code.patch +++ b/package/network/services/ppp/patches/208-fix_status_code.patch @@ -12,13 +12,13 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/main.c +++ b/pppd/main.c -@@ -1152,7 +1152,8 @@ get_input(void) +@@ -1150,7 +1150,8 @@ get_input(void) } notice("Modem hangup"); hungup = 1; - code = EXIT_HANGUP; + if (code == EXIT_OK) + code = EXIT_HANGUP; + need_holdoff = 0; lcp_lowerdown(0); /* serial link is no longer available */ link_terminated(0); - return; diff --git a/package/network/services/ppp/patches/310-precompile_filter.patch b/package/network/services/ppp/patches/310-precompile_filter.patch index ad0dd03de8e..6a6d2769796 100644 --- a/package/network/services/ppp/patches/310-precompile_filter.patch +++ b/package/network/services/ppp/patches/310-precompile_filter.patch @@ -23,7 +23,7 @@ Signed-off-by: Jo-Philipp Wich # # SunOS provides a version of libpcap that would work, but SunOS has no support for activity filter AM_CONDITIONAL([PPP_WITH_FILTER], [ test "x${with_pcap}" = "xyes" && test "x${build_sunos}" != "xyes" ]) -@@ -359,6 +362,7 @@ $PACKAGE_NAME version $PACKAGE_VERSION +@@ -348,6 +351,7 @@ $PACKAGE_NAME version $PACKAGE_VERSION With libatm..........: ${with_atm:-no} With libpam..........: ${with_pam:-no} With libpcap.........: ${with_pcap:-no} @@ -33,7 +33,7 @@ Signed-off-by: Jo-Philipp Wich Linker...............: $LD $LDFLAGS $LIBS --- a/pppd/Makefile.am +++ b/pppd/Makefile.am -@@ -138,6 +138,12 @@ pppd_LDFLAGS += $(PCAP_LDFLAGS) +@@ -137,6 +137,12 @@ pppd_LDFLAGS += $(PCAP_LDFLAGS) pppd_LIBS += $(PCAP_LIBS) endif diff --git a/package/network/services/ppp/patches/321-multilink_support_custom_iface_names.patch b/package/network/services/ppp/patches/321-multilink_support_custom_iface_names.patch index a761ca650d6..2070ab7d091 100644 --- a/package/network/services/ppp/patches/321-multilink_support_custom_iface_names.patch +++ b/package/network/services/ppp/patches/321-multilink_support_custom_iface_names.patch @@ -8,7 +8,7 @@ Signed-off-by: George Kashperko 2 files changed, 53 insertions(+), 14 deletions(-) --- a/pppd/multilink.c +++ b/pppd/multilink.c -@@ -40,6 +40,7 @@ +@@ -36,6 +36,7 @@ #include #include #include @@ -16,7 +16,7 @@ Signed-off-by: George Kashperko #include "pppd-private.h" #include "fsm.h" -@@ -62,7 +63,8 @@ static void iterate_bundle_links(void (* +@@ -58,7 +59,8 @@ static void iterate_bundle_links(void (* static int get_default_epdisc(struct epdisc *); static int parse_num(char *str, const char *key, int *valp); @@ -26,7 +26,7 @@ Signed-off-by: George Kashperko #define set_ip_epdisc(ep, addr) do { \ ep->length = 4; \ -@@ -215,35 +217,38 @@ mp_join_bundle(void) +@@ -211,35 +213,38 @@ mp_join_bundle(void) key.dptr = bundle_id; key.dsize = p - bundle_id; pid = tdb_fetch(pppdb, key); @@ -73,7 +73,7 @@ Signed-off-by: George Kashperko } /* we have to make a new bundle */ -@@ -423,20 +428,39 @@ parse_num(char *str, const char *key, in +@@ -419,20 +424,39 @@ parse_num(char *str, const char *key, in return 0; } @@ -119,7 +119,7 @@ Signed-off-by: George Kashperko && memcmp(vd.dptr, key.dptr, vd.dsize) == 0; --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -984,6 +984,16 @@ void cfg_bundle(int mrru, int mtru, int +@@ -980,6 +980,16 @@ void cfg_bundle(int mrru, int mtru, int add_fd(ppp_dev_fd); } @@ -136,7 +136,7 @@ Signed-off-by: George Kashperko /* * make_new_bundle - create a new PPP unit (i.e. a bundle) * and connect our channel to it. This should only get called -@@ -1002,6 +1012,8 @@ void make_new_bundle(int mrru, int mtru, +@@ -998,6 +1008,8 @@ void make_new_bundle(int mrru, int mtru, /* set the mrru and flags */ cfg_bundle(mrru, mtru, rssn, tssn); diff --git a/package/network/services/ppp/patches/340-populate_default_gateway.patch b/package/network/services/ppp/patches/340-populate_default_gateway.patch index f3279713469..7d20f0449d7 100644 --- a/package/network/services/ppp/patches/340-populate_default_gateway.patch +++ b/package/network/services/ppp/patches/340-populate_default_gateway.patch @@ -13,7 +13,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -2251,6 +2251,9 @@ int sifdefaultroute (int unit, u_int32_t +@@ -2247,6 +2247,9 @@ int sifdefaultroute (int unit, u_int32_t memset (&rt, 0, sizeof (rt)); SET_SA_FAMILY (rt.rt_dst, AF_INET); @@ -23,7 +23,7 @@ Signed-off-by: Jo-Philipp Wich rt.rt_dev = ifname; rt.rt_metric = dfl_route_metric + 1; /* +1 for binary compatibility */ -@@ -2259,7 +2262,7 @@ int sifdefaultroute (int unit, u_int32_t +@@ -2255,7 +2258,7 @@ int sifdefaultroute (int unit, u_int32_t SIN_ADDR(rt.rt_genmask) = 0L; } diff --git a/package/network/services/ppp/patches/400-simplify_kernel_checks.patch b/package/network/services/ppp/patches/400-simplify_kernel_checks.patch index 311bb8752f9..014831a3a42 100644 --- a/package/network/services/ppp/patches/400-simplify_kernel_checks.patch +++ b/package/network/services/ppp/patches/400-simplify_kernel_checks.patch @@ -10,7 +10,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -224,14 +224,10 @@ static fd_set in_fds; /* set of fds tha +@@ -220,14 +220,10 @@ static fd_set in_fds; /* set of fds tha static int max_in_fd; /* highest fd set in in_fds */ static int has_proxy_arp = 0; @@ -26,7 +26,7 @@ Signed-off-by: Jo-Philipp Wich static char loop_name[20]; static unsigned char inbuf[512]; /* buffer for chars read from loopback */ -@@ -249,9 +245,8 @@ static int dynaddr_set; /* 1 if ip_dyna +@@ -245,9 +241,8 @@ static int dynaddr_set; /* 1 if ip_dyna static int looped; /* 1 if using loop */ static int link_mtu; /* mtu for the link (not bundle) */ @@ -37,7 +37,7 @@ Signed-off-by: Jo-Philipp Wich #define MAX_IFS 100 -@@ -1970,11 +1965,12 @@ int ccp_fatal_error (int unit) +@@ -1966,11 +1961,12 @@ int ccp_fatal_error (int unit) * * path_to_procfs - find the path to the proc file system mount point */ @@ -52,7 +52,7 @@ Signed-off-by: Jo-Philipp Wich struct mntent *mntent; FILE *fp; -@@ -1996,6 +1992,7 @@ static char *path_to_procfs(const char * +@@ -1992,6 +1988,7 @@ static char *path_to_procfs(const char * fclose (fp); } } @@ -60,7 +60,7 @@ Signed-off-by: Jo-Philipp Wich strlcpy(proc_path + proc_path_len, tail, sizeof(proc_path) - proc_path_len); -@@ -2889,6 +2886,8 @@ ppp_registered(void) +@@ -2883,6 +2880,8 @@ ppp_registered(void) int ppp_check_kernel_support(void) { @@ -69,7 +69,7 @@ Signed-off-by: Jo-Philipp Wich int s, ok, fd; struct ifreq ifr; int size; -@@ -3016,6 +3015,7 @@ int ppp_check_kernel_support(void) +@@ -3010,6 +3009,7 @@ int ppp_check_kernel_support(void) } close(s); return ok; @@ -77,7 +77,7 @@ Signed-off-by: Jo-Philipp Wich } #ifndef HAVE_LOGWTMP -@@ -3577,6 +3577,7 @@ get_pty(int *master_fdp, int *slave_fdp, +@@ -3571,6 +3571,7 @@ get_pty(int *master_fdp, int *slave_fdp, } #endif /* TIOCGPTN */ @@ -85,7 +85,7 @@ Signed-off-by: Jo-Philipp Wich if (sfd < 0) { /* the old way - scan through the pty name space */ for (i = 0; i < 64; ++i) { -@@ -3601,6 +3602,7 @@ get_pty(int *master_fdp, int *slave_fdp, +@@ -3595,6 +3596,7 @@ get_pty(int *master_fdp, int *slave_fdp, } } } @@ -93,7 +93,7 @@ Signed-off-by: Jo-Philipp Wich if (sfd < 0) return 0; -@@ -3716,6 +3718,7 @@ get_host_seed(void) +@@ -3710,6 +3712,7 @@ get_host_seed(void) int sys_check_options(void) { @@ -101,7 +101,7 @@ Signed-off-by: Jo-Philipp Wich if (demand && driver_is_old) { ppp_option_error("demand dialling is not supported by kernel driver " "version %d.%d.%d", driver_version, driver_modification, -@@ -3726,6 +3729,7 @@ sys_check_options(void) +@@ -3720,6 +3723,7 @@ sys_check_options(void) warn("Warning: multilink is not supported by the kernel driver"); multilink = 0; } @@ -124,7 +124,7 @@ Signed-off-by: Jo-Philipp Wich #endif --- a/pppd/plugins/pppoe/plugin.c +++ b/pppd/plugins/pppoe/plugin.c -@@ -57,9 +57,6 @@ static char const RCSID[] = +@@ -54,9 +54,6 @@ char pppd_version[] = PPPD_VERSION; @@ -134,7 +134,7 @@ Signed-off-by: Jo-Philipp Wich char *pppd_pppoe_service = NULL; static char *acName = NULL; static char *existingSession = NULL; -@@ -421,10 +418,6 @@ PPPoEDevnameHook(char *cmd, char **argv, +@@ -418,10 +415,6 @@ PPPoEDevnameHook(char *cmd, char **argv, void plugin_init(void) { diff --git a/package/network/services/ppp/patches/401-no_record_file.patch b/package/network/services/ppp/patches/401-no_record_file.patch index 5ef1a178d70..436bfb5f5ea 100644 --- a/package/network/services/ppp/patches/401-no_record_file.patch +++ b/package/network/services/ppp/patches/401-no_record_file.patch @@ -7,7 +7,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/pppd-private.h +++ b/pppd/pppd-private.h -@@ -187,7 +187,6 @@ extern int holdoff; /* Dead time before +@@ -189,7 +189,6 @@ extern int holdoff; /* Dead time before extern bool holdoff_specified; /* true if user gave a holdoff value */ extern bool notty; /* Stdin/out is not a tty */ extern char *pty_socket; /* Socket to connect to pty */ @@ -17,7 +17,7 @@ Signed-off-by: Jo-Philipp Wich extern bool tune_kernel; /* May alter kernel settings as necessary */ --- a/pppd/tty.c +++ b/pppd/tty.c -@@ -150,7 +150,7 @@ char *disconnect_script = NULL; /* Scrip +@@ -146,7 +146,7 @@ char *disconnect_script = NULL; /* Scrip char *welcomer = NULL; /* Script to run after phys link estab. */ char *ptycommand = NULL; /* Command to run on other side of pty */ bool notty = 0; /* Stdin/out is not a tty */ @@ -26,7 +26,7 @@ Signed-off-by: Jo-Philipp Wich int max_data_rate; /* max bytes/sec through charshunt */ bool sync_serial = 0; /* Device is synchronous serial device */ char *pty_socket = NULL; /* Socket to connect to pty */ -@@ -206,8 +206,10 @@ static struct option tty_options[] = { +@@ -202,8 +202,10 @@ static struct option tty_options[] = { "Send and receive over socket, arg is host:port", OPT_PRIO | OPT_DEVNAM }, diff --git a/package/network/services/ppp/patches/404-remove_obsolete_protocol_names.patch b/package/network/services/ppp/patches/404-remove_obsolete_protocol_names.patch index 6b2d15ed256..5738118c5f7 100644 --- a/package/network/services/ppp/patches/404-remove_obsolete_protocol_names.patch +++ b/package/network/services/ppp/patches/404-remove_obsolete_protocol_names.patch @@ -7,7 +7,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/main.c +++ b/pppd/main.c -@@ -984,14 +984,17 @@ struct protocol_list { +@@ -982,14 +982,17 @@ struct protocol_list { const char *name; } protocol_list[] = { { 0x21, "IP" }, @@ -25,7 +25,7 @@ Signed-off-by: Jo-Philipp Wich { 0x33, "Stream Protocol ST-II" }, { 0x35, "Banyan Vines" }, { 0x39, "AppleTalk EDDP" }, -@@ -1005,8 +1008,11 @@ struct protocol_list { +@@ -1003,8 +1006,11 @@ struct protocol_list { { 0x49, "Serial Data Transport Protocol (PPP-SDTP)" }, { 0x4b, "SNA over 802.2" }, { 0x4d, "SNA" }, @@ -37,7 +37,7 @@ Signed-off-by: Jo-Philipp Wich { 0x53, "Encryption" }, { 0x55, "Individual Link Encryption" }, { 0x57, "IPv6" }, -@@ -1017,12 +1023,15 @@ struct protocol_list { +@@ -1015,12 +1021,15 @@ struct protocol_list { { 0x65, "RTP IPHC Compressed non-TCP" }, { 0x67, "RTP IPHC Compressed UDP 8" }, { 0x69, "RTP IPHC Compressed RTP 8" }, @@ -53,7 +53,7 @@ Signed-off-by: Jo-Philipp Wich { 0x0203, "IBM Source Routing BPDU" }, { 0x0205, "DEC LANBridge100 Spanning Tree" }, { 0x0207, "Cisco Discovery Protocol" }, -@@ -1034,15 +1043,19 @@ struct protocol_list { +@@ -1032,15 +1041,19 @@ struct protocol_list { { 0x0231, "Luxcom" }, { 0x0233, "Sigma Network Systems" }, { 0x0235, "Apple Client Server Protocol" }, @@ -73,7 +73,7 @@ Signed-off-by: Jo-Philipp Wich { 0x4001, "Cray Communications Control Protocol" }, { 0x4003, "CDPD Mobile Network Registration Protocol" }, { 0x4005, "Expand accelerator protocol" }, -@@ -1053,8 +1066,10 @@ struct protocol_list { +@@ -1051,8 +1064,10 @@ struct protocol_list { { 0x4023, "RefTek Protocol" }, { 0x4025, "Fibre Channel" }, { 0x4027, "EMIT Protocols" }, @@ -84,7 +84,7 @@ Signed-off-by: Jo-Philipp Wich { 0x8023, "OSI Network Layer Control Protocol" }, { 0x8025, "Xerox NS IDP Control Protocol" }, { 0x8027, "DECnet Phase IV Control Protocol" }, -@@ -1063,7 +1078,9 @@ struct protocol_list { +@@ -1061,7 +1076,9 @@ struct protocol_list { { 0x8031, "Bridging NCP" }, { 0x8033, "Stream Protocol Control Protocol" }, { 0x8035, "Banyan Vines Control Protocol" }, @@ -94,7 +94,7 @@ Signed-off-by: Jo-Philipp Wich { 0x803f, "NETBIOS Framing Control Protocol" }, { 0x8041, "Cisco Systems Control Protocol" }, { 0x8043, "Ascom Timeplex" }, -@@ -1072,18 +1089,24 @@ struct protocol_list { +@@ -1070,18 +1087,24 @@ struct protocol_list { { 0x8049, "Serial Data Control Protocol (PPP-SDCP)" }, { 0x804b, "SNA over 802.2 Control Protocol" }, { 0x804d, "SNA Control Protocol" }, @@ -119,7 +119,7 @@ Signed-off-by: Jo-Philipp Wich { 0x8207, "Cisco Discovery Protocol Control" }, { 0x8209, "Netcs Twin Routing" }, { 0x820b, "STP - Control Protocol" }, -@@ -1092,24 +1115,29 @@ struct protocol_list { +@@ -1090,24 +1113,29 @@ struct protocol_list { { 0x8281, "MPLSCP" }, { 0x8285, "IEEE p1284.4 standard - Protocol Control" }, { 0x8287, "ETSI TETRA TNP1 Control Protocol" }, diff --git a/package/network/services/ppp/patches/500-add-pptp-plugin.patch b/package/network/services/ppp/patches/500-add-pptp-plugin.patch index 4b66cd21657..38b0c825065 100644 --- a/package/network/services/ppp/patches/500-add-pptp-plugin.patch +++ b/package/network/services/ppp/patches/500-add-pptp-plugin.patch @@ -1,6 +1,6 @@ --- a/configure.ac +++ b/configure.ac -@@ -344,6 +344,7 @@ AC_CONFIG_FILES([ +@@ -333,6 +333,7 @@ AC_CONFIG_FILES([ pppd/plugins/pppoatm/Makefile pppd/plugins/pppol2tp/Makefile pppd/plugins/radius/Makefile @@ -10,7 +10,7 @@ scripts/Makefile --- a/pppd/plugins/Makefile.am +++ b/pppd/plugins/Makefile.am -@@ -21,5 +21,5 @@ winbind_la_LDFLAGS = $(PLUGIN_LDFLAGS) +@@ -17,5 +17,5 @@ winbind_la_LDFLAGS = $(PLUGIN_LDFLAGS) winbind_la_SOURCES = winbind.c if !SUNOS From 3ec7f3a512a27f8ca6402954ad2a997176103b4b Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sun, 22 Dec 2024 02:56:12 +0100 Subject: [PATCH 079/173] mac80211: set basic-rate for mesh interfaces Basic rates were not set for mesh-interfaces, resulting in the undesired behavior where 11s frames might be sent with a rate which was not configured. Depending on the driver, the basic rate might also be used to determine the beacon rate configured to the chip. One such example are MediaTek MT7915 platforms. Signed-off-by: David Bauer --- .../wifi-scripts/files/lib/netifd/wireless/mac80211.sh | 6 ++++++ .../config/wifi-scripts/files/usr/share/hostap/wdev.uc | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh index 9e9922e0b35..52c36a8c926 100755 --- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh @@ -849,6 +849,11 @@ mac80211_setup_mesh() { [ -n "$mcast_rate" ] && wpa_supplicant_add_rate mcval "$mcast_rate" [ -n "$mesh_id" ] && ssid="$mesh_id" + brstr= + for br in $basic_rate_list; do + wpa_supplicant_add_rate brstr "$br" + done + local prev json_set_namespace wdev_uc prev @@ -859,6 +864,7 @@ mac80211_setup_mesh() { json_add_string freq "$freq" json_add_string htmode "$iw_htmode" [ -n "$mcval" ] && json_add_string mcast-rate "$mcval" + [ -n "$brstr" ] && json_add_string basic-rates "$brstr" json_add_int beacon-interval "$beacon_int" mac80211_add_mesh_params diff --git a/package/network/config/wifi-scripts/files/usr/share/hostap/wdev.uc b/package/network/config/wifi-scripts/files/usr/share/hostap/wdev.uc index d836a930fc4..166e9403dfc 100644 --- a/package/network/config/wifi-scripts/files/usr/share/hostap/wdev.uc +++ b/package/network/config/wifi-scripts/files/usr/share/hostap/wdev.uc @@ -45,7 +45,7 @@ function iface_start(wdev) system(cmd); } else if (wdev.mode == "mesh") { let cmd = [ "iw", "dev", ifname, "mesh", "join", wdev.ssid, "freq", wdev.freq, htmode ]; - for (let key in [ "mcast-rate", "beacon-interval" ]) + for (let key in [ "basic-rates", "mcast-rate", "beacon-interval" ]) if (wdev[key]) push(cmd, key, wdev[key]); system(cmd); From d09dd75fbd1314ec5f3571511195da4012d7a51a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 31 Dec 2024 12:23:53 +0100 Subject: [PATCH 080/173] ipq40xx: dts: add ethernet0 alias for all devices Updating the driver patches for ipq40xx (correctly) removed the ethernet0 alias from qcom-ipq4019.dtsi; however, on some devices this alias is needed for the bootloader to set MAC addresses in the FDT. As it is unknown which devices actually need the alias, simply add it to all devices trees for now that enable the &gmac now to avoid regressions from previous OpenWrt releases. The additional alias should not cause any issues even when it is not needed. A TODO comment is added to the same Device Trees to document that the alias may not be needed (hopefully preventing it from being copied unnecessarily to newly added devices in the future). The following devices are known to need the alias for correct MAC address assignment, so no TODO comment is added: - FRITZ!Box 4040 - FRITZ!Box 7530 Fixes: cd9c7211241e ("ipq40xx: 6.1: use latest DSA and ethernet patches") Signed-off-by: Matthias Schiffer Link: https://github.com/openwrt/openwrt/pull/17442 Signed-off-by: Robert Marko --- .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-a42.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-ap120c-ac.dts | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cap-ac.dts | 2 ++ .../arm/boot/dts/qcom/qcom-ipq4018-cs-w3-wd1200g-eup.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-dap-2610.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-ea6350v3.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-eap1300.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-ex61x0v2.dtsi | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-fritzbox-4040.dts | 1 + .../arch/arm/boot/dts/qcom/qcom-ipq4018-gl-a1300.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-gl-ap1300.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-hap-ac2.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-jalapeno.dtsi | 2 ++ .../arm/boot/dts/qcom/qcom-ipq4018-magic-2-wifi-next.dts | 5 +++++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-mf287_common.dtsi | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-nbg6617.dts | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-pa1200.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-rt-ac58u.dts | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-sxtsq-5-ac.dts | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wac510.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-wap-ac.dtsi | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-whw01.dts | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wr-1.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4018-wrtq-329acn.dts | 5 +++++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-a62.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-cm520-79f.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-e2600ac-c1.dts | 5 +++++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-e2600ac-c2.dts | 5 +++++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-fritzbox-7530.dts | 1 + .../arm/boot/dts/qcom/qcom-ipq4019-fritzrepeater-1200.dts | 2 ++ .../arm/boot/dts/qcom/qcom-ipq4019-fritzrepeater-3000.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-gl-b2200.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-habanero-dvk.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3-lte6-kit.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3.dts | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-lbr20.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-lhgg-60ad.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-map-ac2200.dts | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf18a.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-mf282plus.dts | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf286d.dts | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf289f.dts | 2 ++ .../arm/boot/dts/qcom/qcom-ipq4019-ncp-hg100-cellular.dts | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-pa2200.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-r619ac.dtsi | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-rt-ac42u.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-rtl30vw.dts | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-whw03.dtsi | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-wia3300-20.dts | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wifi.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-wtr-m2133hp.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4019-xx8300.dtsi | 5 +++++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4028-wpj428.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4029-ap-303h.dts | 2 ++ .../arm/boot/dts/qcom/qcom-ipq4029-aruba-glenmorangie.dtsi | 5 +++++ .../arch/arm/boot/dts/qcom/qcom-ipq4029-gl-b1300.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4029-insect-common.dtsi | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4029-ws-ap3915i.dts | 2 ++ .../arch/arm/boot/dts/qcom/qcom-ipq4029-ws-ap391x.dts | 2 ++ .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq40x9-dr40x9.dts | 5 +++++ 61 files changed, 141 insertions(+) diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-a42.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-a42.dts index c117a905388..6d1babf00e9 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-a42.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-a42.dts @@ -52,6 +52,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_status_green; led-failsafe = &led_status_green; led-running = &led_status_green; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ap120c-ac.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ap120c-ac.dts index f2e2ed3f7f6..83b4addb796 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ap120c-ac.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ap120c-ac.dts @@ -15,6 +15,8 @@ led-failsafe = &status; led-running = &status; led-upgrade = &status; + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; ethernet1 = &swport5; }; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cap-ac.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cap-ac.dts index b061428bb34..f2690a095d9 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cap-ac.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cap-ac.dts @@ -21,6 +21,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_user; led-failsafe = &led_user; led-running = &led_user; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cs-w3-wd1200g-eup.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cs-w3-wd1200g-eup.dts index 8d09bfd0b7a..469a6ca7576 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cs-w3-wd1200g-eup.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cs-w3-wd1200g-eup.dts @@ -11,6 +11,8 @@ compatible = "ezviz,cs-w3-wd1200g-eup"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_status_green; led-failsafe = &led_status_red; led-running = &led_status_blue; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-dap-2610.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-dap-2610.dts index df5d9331a1e..69164540cd4 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-dap-2610.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-dap-2610.dts @@ -11,6 +11,8 @@ compatible = "dlink,dap-2610"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_red; led-failsafe = &led_red; led-running = &led_green; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ea6350v3.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ea6350v3.dts index e80a5402445..6cace3b88f0 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ea6350v3.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ea6350v3.dts @@ -11,6 +11,8 @@ compatible = "linksys,ea6350v3"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &power; led-failsafe = &power; led-running = &power; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-eap1300.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-eap1300.dts index f343bea725b..049b3a5ba3a 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-eap1300.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-eap1300.dts @@ -41,6 +41,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &power; led-failsafe = &power; led-running = &power; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ex61x0v2.dtsi b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ex61x0v2.dtsi index ca064837c86..a13fc719873 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ex61x0v2.dtsi +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-ex61x0v2.dtsi @@ -46,6 +46,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &power_amber; led-failsafe = &power_amber; led-running = &power_green; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-fritzbox-4040.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-fritzbox-4040.dts index bcb3b24232c..0d7d8883fc3 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-fritzbox-4040.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-fritzbox-4040.dts @@ -11,6 +11,7 @@ compatible = "avm,fritzbox-4040"; aliases { + ethernet0 = &gmac; led-boot = &power; led-failsafe = &flash; led-running = &power; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-gl-a1300.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-gl-a1300.dts index d8b4300a520..4293191b075 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-gl-a1300.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-gl-a1300.dts @@ -11,6 +11,8 @@ compatible = "glinet,gl-a1300", "qcom,ipq4019"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_run; led-failsafe = &led_run; led-running = &led_run; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-gl-ap1300.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-gl-ap1300.dts index bb197c27427..4ed8a82af6f 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-gl-ap1300.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-gl-ap1300.dts @@ -11,6 +11,8 @@ compatible = "glinet,gl-ap1300"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_power; led-failsafe = &led_power; led-running = &led_power; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-hap-ac2.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-hap-ac2.dts index 07ad4d3d520..d91725dfb7b 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-hap-ac2.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-hap-ac2.dts @@ -21,6 +21,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_user; led-failsafe = &led_user; led-running = &led_user; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-jalapeno.dtsi b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-jalapeno.dtsi index 9828b4b34ef..fcacb98cb9b 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-jalapeno.dtsi +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-jalapeno.dtsi @@ -8,6 +8,8 @@ / { aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; ethernet1 = &swport5; }; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-magic-2-wifi-next.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-magic-2-wifi-next.dts index 293bf3d20a0..5deb9ba3de2 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-magic-2-wifi-next.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-magic-2-wifi-next.dts @@ -9,6 +9,11 @@ model = "devolo Magic 2 WiFi next"; compatible = "devolo,magic-2-wifi-next"; + aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; + }; + memory { device_type = "memory"; reg = <0x80000000 0x10000000>; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-mf287_common.dtsi b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-mf287_common.dtsi index bf2fc0e37e2..c19262497d7 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-mf287_common.dtsi +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-mf287_common.dtsi @@ -11,6 +11,8 @@ / { aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_status; led-failsafe = &led_status; led-running = &led_status; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-nbg6617.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-nbg6617.dts index 957ccb306c7..2b79169c0df 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-nbg6617.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-nbg6617.dts @@ -21,6 +21,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &power; led-failsafe = &power; led-running = &power; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-pa1200.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-pa1200.dts index a353c7f9f3d..8040bb494b1 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-pa1200.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-pa1200.dts @@ -52,6 +52,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_status_purple; led-failsafe = &led_status_yellow; led-running = &led_status_cyan; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rt-ac58u.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rt-ac58u.dts index e58b3378d57..946b3b3038f 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rt-ac58u.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rt-ac58u.dts @@ -16,6 +16,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_power; led-failsafe = &led_power; led-running = &led_power; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts index ea2102f7d6a..56d920a6dde 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts @@ -7,6 +7,8 @@ compatible = "teltonika,rutx50"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_rssi0; led-failsafe = &led_rssi0; led-running = &led_rssi0; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-sxtsq-5-ac.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-sxtsq-5-ac.dts index 23e9457f029..d434145278c 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-sxtsq-5-ac.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-sxtsq-5-ac.dts @@ -21,6 +21,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_user; led-failsafe = &led_user; led-running = &led_user; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wac510.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wac510.dts index 8515f3c0347..982ceef044e 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wac510.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wac510.dts @@ -16,6 +16,8 @@ led-failsafe = &led_power_amber; led-running = &led_power_green; led-upgrade = &led_power_amber; + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; ethernet1 = &swport5; }; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wap-ac.dtsi b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wap-ac.dtsi index 2b357a1f033..f8b458f9f79 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wap-ac.dtsi +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wap-ac.dtsi @@ -18,6 +18,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_user; led-failsafe = &led_user; led-running = &led_user; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-whw01.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-whw01.dts index 1f26db58690..fe6e8626ea8 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-whw01.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-whw01.dts @@ -10,6 +10,8 @@ compatible = "linksys,whw01"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; serial0 = &blsp1_uart1; led-boot = &led_system_blue; led-running = &led_system_blue; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wr-1.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wr-1.dts index dd56cb215e8..990eb70daae 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wr-1.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wr-1.dts @@ -11,6 +11,8 @@ compatible = "pakedge,wr-1"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; label-mac-device = &gmac; led-boot = &led_power; led-failsafe = &led_power; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wrtq-329acn.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wrtq-329acn.dts index fc5a7a94aa3..7c8e81de330 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wrtq-329acn.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wrtq-329acn.dts @@ -9,6 +9,11 @@ model = "Luma Home WRTQ-329ACN"; compatible = "luma,wrtq-329acn"; + aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; + }; + i2c-gpio { compatible = "i2c-gpio"; sda-gpios = <&tlmm 1 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-a62.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-a62.dts index d8249236f04..79242a42e43 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-a62.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-a62.dts @@ -52,6 +52,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_status_green; led-failsafe = &led_status_green; led-running = &led_status_green; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-cm520-79f.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-cm520-79f.dts index 3569d6e53ab..3346fc8098f 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-cm520-79f.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-cm520-79f.dts @@ -11,6 +11,8 @@ compatible = "mobipromo,cm520-79f"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_sys; led-failsafe = &led_sys; led-running = &led_sys; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-e2600ac-c1.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-e2600ac-c1.dts index 243d19fb033..00fc918ccfc 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-e2600ac-c1.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-e2600ac-c1.dts @@ -11,6 +11,11 @@ / { model = "Qxwlan E2600AC c1"; compatible = "qxwlan,e2600ac-c1"; + + aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; + }; }; &blsp1_spi1 { diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-e2600ac-c2.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-e2600ac-c2.dts index e065ef01680..c2c602114f8 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-e2600ac-c2.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-e2600ac-c2.dts @@ -11,6 +11,11 @@ / { model = "Qxwlan E2600AC c2"; compatible = "qxwlan,e2600ac-c2"; + + aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; + }; }; &blsp1_spi1 { diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzbox-7530.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzbox-7530.dts index 4f6cafb8853..39905d4342d 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzbox-7530.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzbox-7530.dts @@ -15,6 +15,7 @@ }; aliases { + ethernet0 = &gmac; led-boot = &power_green; led-failsafe = &info_red; led-running = &power_green; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzrepeater-1200.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzrepeater-1200.dts index 106c8031e31..e60cd42778d 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzrepeater-1200.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzrepeater-1200.dts @@ -11,6 +11,8 @@ compatible = "avm,fritzrepeater-1200"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &power_green; led-failsafe = &power_red; led-running = &power_green; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzrepeater-3000.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzrepeater-3000.dts index e8daef63f14..f720be6d03b 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzrepeater-3000.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-fritzrepeater-3000.dts @@ -11,6 +11,8 @@ compatible = "avm,fritzrepeater-3000"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &power_led; led-failsafe = &power_led; led-running = &power_led; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-gl-b2200.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-gl-b2200.dts index 89ba523e57d..33400170c85 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-gl-b2200.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-gl-b2200.dts @@ -20,6 +20,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; ethernet1 = &swport4; }; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-habanero-dvk.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-habanero-dvk.dts index 94be4d976e2..d792599f1a2 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-habanero-dvk.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-habanero-dvk.dts @@ -12,6 +12,8 @@ compatible = "8dev,habanero-dvk"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_status; led-failsafe = &led_status; led-running = &led_status; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3-lte6-kit.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3-lte6-kit.dts index b1a04012fb2..881abc23dbe 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3-lte6-kit.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3-lte6-kit.dts @@ -21,6 +21,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_status_blue; led-failsafe = &led_status_red; led-running = &led_status_blue; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3.dts index 4a3a323b5ff..bd7f1b5cb98 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3.dts @@ -21,6 +21,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_status_blue; led-failsafe = &led_status_red; led-running = &led_status_blue; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-lbr20.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-lbr20.dts index 4e5497cbc30..09d9a8f3ddf 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-lbr20.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-lbr20.dts @@ -15,6 +15,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_backlight_white; led-failsafe = &led_status_green; led-running = &led_status_green; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-lhgg-60ad.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-lhgg-60ad.dts index a5b55ff421f..b042329bc7b 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-lhgg-60ad.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-lhgg-60ad.dts @@ -35,6 +35,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &user; led-failsafe = &user; led-running = &user; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-map-ac2200.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-map-ac2200.dts index 7ec3c6a9ae7..e3a5ad7be5c 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-map-ac2200.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-map-ac2200.dts @@ -15,6 +15,8 @@ led-failsafe = &led_red0; led-running = &led_blue0; led-upgrade = &led_red0; + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; ethernet1 = &swport4; }; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf18a.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf18a.dts index 7c0260ec3c5..3eaa75b520b 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf18a.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf18a.dts @@ -14,6 +14,8 @@ compatible = "zte,mf18a"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_power; led-failsafe = &led_power; led-running = &led_power; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf282plus.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf282plus.dts index a4606dd21cb..80a729e9632 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf282plus.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf282plus.dts @@ -13,6 +13,8 @@ compatible = "zte,mf282plus"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_internal; led-failsafe = &led_internal; led-running = &led_internal; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf286d.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf286d.dts index 06d65b89441..91cf49b1b00 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf286d.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf286d.dts @@ -12,6 +12,8 @@ compatible = "zte,mf286d"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_internal; led-failsafe = &led_internal; led-running = &led_internal; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf289f.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf289f.dts index f5a985b6d16..f03717be330 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf289f.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-mf289f.dts @@ -13,6 +13,8 @@ compatible = "zte,mf289f"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_status; led-failsafe = &led_status; led-running = &led_status; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-ncp-hg100-cellular.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-ncp-hg100-cellular.dts index e115c211aab..4bef4994990 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-ncp-hg100-cellular.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-ncp-hg100-cellular.dts @@ -12,6 +12,8 @@ compatible = "sony,ncp-hg100-cellular"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_cloud_green; led-failsafe = &led_cloud_red; led-running = &led_cloud_green; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-pa2200.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-pa2200.dts index f87ab074162..f4c64d6b061 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-pa2200.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-pa2200.dts @@ -44,6 +44,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_power_orange; led-failsafe = &led_status_blue; led-running = &led_power_orange; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-r619ac.dtsi b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-r619ac.dtsi index 0463c61236e..5ebbaa90ade 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-r619ac.dtsi +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-r619ac.dtsi @@ -12,6 +12,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_sys; led-failsafe = &led_sys; led-running = &led_sys; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-rt-ac42u.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-rt-ac42u.dts index 3cd8997a925..48b2e43d18e 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-rt-ac42u.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-rt-ac42u.dts @@ -16,6 +16,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_power; led-failsafe = &led_power; led-running = &led_power; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-rtl30vw.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-rtl30vw.dts index 7a13241b661..593b3959fc1 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-rtl30vw.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-rtl30vw.dts @@ -14,6 +14,8 @@ compatible = "cellc,rtl30vw"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_power_blue; led-failsafe = &led_power_red; led-running = &led_power_blue; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-whw03.dtsi b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-whw03.dtsi index 54e3cc7818c..cb12381022c 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-whw03.dtsi +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-whw03.dtsi @@ -8,6 +8,8 @@ / { aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_blue; led-failsafe = &led_red; led-running = &led_blue; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wia3300-20.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wia3300-20.dts index 644329419d9..887762bd232 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wia3300-20.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wia3300-20.dts @@ -11,6 +11,8 @@ model = "SKSpruce WIA3300-20"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; label-mac-device = &gmac; led-boot = &led_status_red; led-failsafe = &led_status_lime; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wifi.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wifi.dts index f2e39c87aef..c6113e7aab0 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wifi.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wifi.dts @@ -14,6 +14,8 @@ compatible = "google,wifi", "google,gale-v2", "qcom,ipq4019"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; label-mac-device = &gmac0; led-boot = &led0_blue; led-failsafe = &led0_red; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wtr-m2133hp.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wtr-m2133hp.dts index ab985dfce16..c892bf0c5be 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wtr-m2133hp.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wtr-m2133hp.dts @@ -29,6 +29,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_power_blue; led-failsafe = &led_power_orange; led-running = &led_power_white; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-xx8300.dtsi b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-xx8300.dtsi index 0673dc02416..3bcc5c3cec2 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-xx8300.dtsi +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-xx8300.dtsi @@ -26,6 +26,11 @@ }; + aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; + }; + soc { tcsr@1949000 { compatible = "qcom,tcsr"; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4028-wpj428.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4028-wpj428.dts index 517d691d105..fd7878b47a0 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4028-wpj428.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4028-wpj428.dts @@ -73,6 +73,8 @@ }; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &status; led-failsafe = &status; led-upgrade = &status; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-ap-303h.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-ap-303h.dts index 62270272662..1cb1b9d5dd9 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-ap-303h.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-ap-303h.dts @@ -10,6 +10,8 @@ compatible = "aruba,ap-303h"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_system_green; led-failsafe = &led_system_red; led-running = &led_system_green; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-aruba-glenmorangie.dtsi b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-aruba-glenmorangie.dtsi index 7f8f9be7956..520ccdfd1cc 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-aruba-glenmorangie.dtsi +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-aruba-glenmorangie.dtsi @@ -6,6 +6,11 @@ #include / { + aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; + }; + memory { device_type = "memory"; reg = <0x80000000 0x10000000>; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-gl-b1300.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-gl-b1300.dts index dfb639e2bbb..2aea68d5205 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-gl-b1300.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-gl-b1300.dts @@ -25,6 +25,8 @@ compatible = "glinet,gl-b1300"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &power; led-failsafe = &power; led-running = &power; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-insect-common.dtsi b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-insect-common.dtsi index 8286e1899f8..9d2f7ce1bc2 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-insect-common.dtsi +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-insect-common.dtsi @@ -20,6 +20,8 @@ / { aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &status_green; led-failsafe = &status_red; led-running = &status_green; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-ws-ap3915i.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-ws-ap3915i.dts index 48e0bb903e5..533ff388a9f 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-ws-ap3915i.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-ws-ap3915i.dts @@ -10,6 +10,8 @@ compatible = "extreme-networks,ws-ap3915i"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_system_green; led-failsafe = &led_system_amber; led-running = &led_system_green; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-ws-ap391x.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-ws-ap391x.dts index 9e1dfa5c1d7..254de0a46d1 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-ws-ap391x.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-ws-ap391x.dts @@ -10,6 +10,8 @@ compatible = "extreme-networks,ws-ap391x"; aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; led-boot = &led_system_green; led-failsafe = &led_system_red; led-running = &led_system_green; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq40x9-dr40x9.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq40x9-dr40x9.dts index a549f034074..d432b2ec2d6 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq40x9-dr40x9.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq40x9-dr40x9.dts @@ -9,6 +9,11 @@ model = "Wallystech DR40X9"; compatible = "wallys,dr40x9"; + aliases { + // TODO: Verify if the ethernet0 alias is needed + ethernet0 = &gmac; + }; + chosen { bootargs-append = " ubi.mtd=ubi root=/dev/ubiblock0_1"; }; From 285bdd29cb55900a2009e26303ab5abb66e165e9 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Mon, 6 Jan 2025 19:12:18 +0100 Subject: [PATCH 081/173] uboot-envtools: ipq60xx: remove number of blocks It is not required to specify the number of blocks as envtools are able to autodetect it. Link: https://github.com/openwrt/openwrt/pull/17504 Signed-off-by: Robert Marko --- package/boot/uboot-envtools/files/qualcommax_ipq60xx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/boot/uboot-envtools/files/qualcommax_ipq60xx b/package/boot/uboot-envtools/files/qualcommax_ipq60xx index ccc74e2df6e..eec99ce8f97 100644 --- a/package/boot/uboot-envtools/files/qualcommax_ipq60xx +++ b/package/boot/uboot-envtools/files/qualcommax_ipq60xx @@ -18,12 +18,12 @@ cambiumnetworks,xe3-4) linksys,mr7350) idx="$(find_mtd_index u_env)" [ -n "$idx" ] && \ - ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2" + ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" ;; netgear,wax214) idx="$(find_mtd_index 0:appsblenv)" [ -n "$idx" ] && \ - ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2" + ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" ;; yuncore,fap650) idx="$(find_mtd_index 0:appsblenv)" From a6edcb4cb0a67ca60f2ad86cb5596e14e1075cd0 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Fri, 27 Dec 2024 17:53:57 +0100 Subject: [PATCH 082/173] realtek: rtl838x: Refresh kernel config Run 'make kernel_oldconfig' to get an up-to-date config. Signed-off-by: Sander Vanheule --- target/linux/realtek/rtl838x/config-6.6 | 34 ++++++++++++++++++------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/target/linux/realtek/rtl838x/config-6.6 b/target/linux/realtek/rtl838x/config-6.6 index 44c1d7e0645..a190a69ec66 100644 --- a/target/linux/realtek/rtl838x/config-6.6 +++ b/target/linux/realtek/rtl838x/config-6.6 @@ -12,6 +12,7 @@ CONFIG_CLONE_BACKWARDS=y CONFIG_COMMON_CLK=y CONFIG_COMMON_CLK_REALTEK=y CONFIG_COMMON_CLK_RTL83XX=y +CONFIG_COMPACT_UNEVICTABLE_DEFAULT=1 CONFIG_COMPAT_32BIT_TIME=y CONFIG_CONSOLE_LOGLEVEL_DEFAULT=15 CONFIG_CPUFREQ_DT=y @@ -37,6 +38,7 @@ CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS32_R1 is not set CONFIG_CPU_MIPS32_R2=y CONFIG_CPU_MIPSR2=y +CONFIG_CPU_MITIGATIONS=y CONFIG_CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS=y CONFIG_CPU_R4K_CACHE_TLB=y CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y @@ -44,29 +46,35 @@ CONFIG_CPU_SUPPORTS_CPUFREQ=y CONFIG_CPU_SUPPORTS_HIGHMEM=y CONFIG_CPU_SUPPORTS_MSA=y CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y +CONFIG_CRYPTO_LIB_GF128MUL=y CONFIG_CRYPTO_LIB_POLY1305_RSIZE=2 -CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_LIB_SHA1=y +CONFIG_CRYPTO_LIB_UTILS=y +CONFIG_DEBUG_INFO=y CONFIG_DEBUG_SECTION_MISMATCH=y CONFIG_DMA_NONCOHERENT=y CONFIG_DTC=y CONFIG_EARLY_PRINTK=y CONFIG_EARLY_PRINTK_8250=y +CONFIG_EXCLUSIVE_SYSTEM_RAM=y CONFIG_EXTRA_FIRMWARE="rtl838x_phy/rtl838x_8214fc.fw rtl838x_phy/rtl838x_8218b.fw rtl838x_phy/rtl838x_8380.fw" CONFIG_EXTRA_FIRMWARE_DIR="firmware" CONFIG_FIXED_PHY=y -CONFIG_FORCE_MAX_ZONEORDER=13 +CONFIG_FORCE_NR_CPUS=y +CONFIG_FS_IOMAP=y +CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y +CONFIG_FW_LOADER_SYSFS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_CPU_AUTOPROBE=y -CONFIG_GENERIC_FIND_FIRST_BIT=y CONFIG_GENERIC_GETTIMEOFDAY=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y CONFIG_GENERIC_IOMAP=y CONFIG_GENERIC_IRQ_CHIP=y -CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y CONFIG_GENERIC_IRQ_SHOW=y CONFIG_GENERIC_LIB_ASHLDI3=y CONFIG_GENERIC_LIB_ASHRDI3=y @@ -91,10 +99,10 @@ CONFIG_GPIO_RTL8231=y CONFIG_GPIO_WATCHDOG=y # CONFIG_GPIO_WATCHDOG_ARCH_INITCALL is not set CONFIG_GRO_CELLS=y -CONFIG_HANDLE_DOMAIN_IRQ=y CONFIG_HARDWARE_WATCHPOINTS=y CONFIG_HAS_DMA=y CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y CONFIG_HAS_IOPORT_MAP=y CONFIG_HWMON=y CONFIG_HZ_PERIODIC=y @@ -123,7 +131,6 @@ CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y CONFIG_MDIO_I2C=y CONFIG_MDIO_SMBUS=y -CONFIG_MEMFD_CREATE=y CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y CONFIG_MIPS=y @@ -131,13 +138,12 @@ CONFIG_MIPS_ASID_BITS=8 CONFIG_MIPS_ASID_SHIFT=0 # CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER is not set CONFIG_MIPS_CMDLINE_FROM_DTB=y -CONFIG_MIPS_EBPF_JIT=y CONFIG_MIPS_EXTERNAL_TIMER=y CONFIG_MIPS_L1_CACHE_SHIFT=5 -CONFIG_MIPS_LD_CAN_LINK_VDSO=y # CONFIG_MIPS_NO_APPENDED_DTB is not set CONFIG_MIPS_RAW_APPENDED_DTB=y CONFIG_MIPS_SPRAM=y +CONFIG_MMU_LAZY_TLB_REFCOUNT=y CONFIG_MODULES_USE_ELF_REL=y CONFIG_MTD_CFI_ADV_OPTIONS=y CONFIG_MTD_CFI_GEOMETRY=y @@ -157,12 +163,16 @@ CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y CONFIG_NET_DSA_RTL83XX=y CONFIG_NET_DSA_TAG_TRAILER=y +CONFIG_NET_EGRESS=y +CONFIG_NET_INGRESS=y CONFIG_NET_RTL838X=y CONFIG_NET_SELFTESTS=y CONFIG_NET_SWITCHDEV=y +CONFIG_NET_XGRESS=y CONFIG_NO_EXCEPT_FILL=y CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y CONFIG_NVMEM=y +CONFIG_NVMEM_LAYOUTS=y CONFIG_OF=y CONFIG_OF_ADDRESS=y CONFIG_OF_EARLY_FLATTREE=y @@ -171,17 +181,23 @@ CONFIG_OF_GPIO=y CONFIG_OF_IRQ=y CONFIG_OF_KOBJ=y CONFIG_OF_MDIO=y +CONFIG_PAGE_POOL=y +CONFIG_PAGE_SIZE_LESS_THAN_256KB=y +CONFIG_PAGE_SIZE_LESS_THAN_64KB=y CONFIG_PCI_DRIVERS_LEGACY=y CONFIG_PERF_USE_VMALLOC=y CONFIG_PGTABLE_LEVELS=2 CONFIG_PHYLIB=y +CONFIG_PHYLIB_LEDS=y CONFIG_PHYLINK=y CONFIG_PINCTRL=y CONFIG_PM_OPP=y CONFIG_POWER_RESET=y CONFIG_POWER_RESET_GPIO_RESTART=y CONFIG_POWER_RESET_SYSCON=y +CONFIG_PREEMPT_NONE_BUILD=y CONFIG_PTP_1588_CLOCK_OPTIONAL=y +CONFIG_RANDSTRUCT_NONE=y CONFIG_RATIONAL=y CONFIG_REALTEK_OTTO_TIMER=y CONFIG_REALTEK_OTTO_WDT=y @@ -200,8 +216,8 @@ CONFIG_SFP=y CONFIG_SPI=y CONFIG_SPI_MASTER=y CONFIG_SPI_MEM=y +CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y CONFIG_SRAM=y -CONFIG_SRCU=y CONFIG_SWPHY=y CONFIG_SYSCTL_EXCEPTION_TRACE=y CONFIG_SYS_HAS_CPU_MIPS32_R1=y From d3b62ba3ed6aaad95ae52d76a46a72c438531770 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Sun, 29 Dec 2024 14:29:10 +0100 Subject: [PATCH 083/173] realtek: rtl839x: Refresh kernel config Run 'make kernel_oldconfig' to get an up-to-date config. "# CONFIG_I2C_MUX_RTL9300 is not set" is retained, as the kernel module build will selects CONFIG_I2C_MUX=m, on which this symbol depends. Signed-off-by: Sander Vanheule --- target/linux/realtek/rtl839x/config-6.6 | 41 +++++++++++++++++-------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/target/linux/realtek/rtl839x/config-6.6 b/target/linux/realtek/rtl839x/config-6.6 index 630027bf813..53a167e8f70 100644 --- a/target/linux/realtek/rtl839x/config-6.6 +++ b/target/linux/realtek/rtl839x/config-6.6 @@ -6,13 +6,15 @@ CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=4096 # CONFIG_BMIPS_CPUFREQ is not set -CONFIG_CLKDEV_LOOKUP=y CONFIG_CLONE_BACKWARDS=y CONFIG_COMMON_CLK=y CONFIG_COMMON_CLK_REALTEK=y CONFIG_COMMON_CLK_RTL83XX=y +CONFIG_COMPACT_UNEVICTABLE_DEFAULT=1 CONFIG_COMPAT_32BIT_TIME=y CONFIG_CONSOLE_LOGLEVEL_DEFAULT=15 +CONFIG_CONTEXT_TRACKING=y +CONFIG_CONTEXT_TRACKING_IDLE=y CONFIG_CPUFREQ_DT=y CONFIG_CPUFREQ_DT_PLATDEV=y CONFIG_CPU_BIG_ENDIAN=y @@ -38,6 +40,7 @@ CONFIG_CPU_MIPS32_R2=y CONFIG_CPU_MIPSR2=y CONFIG_CPU_MIPSR2_IRQ_EI=y CONFIG_CPU_MIPSR2_IRQ_VI=y +CONFIG_CPU_MITIGATIONS=y CONFIG_CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS=y CONFIG_CPU_R4K_CACHE_TLB=y CONFIG_CPU_RMAP=y @@ -46,24 +49,30 @@ CONFIG_CPU_SUPPORTS_CPUFREQ=y CONFIG_CPU_SUPPORTS_HIGHMEM=y CONFIG_CPU_SUPPORTS_MSA=y CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y +CONFIG_CRYPTO_LIB_GF128MUL=y CONFIG_CRYPTO_LIB_POLY1305_RSIZE=2 -CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_LIB_SHA1=y +CONFIG_CRYPTO_LIB_UTILS=y +CONFIG_DEBUG_INFO=y CONFIG_DEBUG_SECTION_MISMATCH=y CONFIG_DMA_NONCOHERENT=y CONFIG_DTC=y CONFIG_EARLY_PRINTK=y CONFIG_EARLY_PRINTK_8250=y +CONFIG_EXCLUSIVE_SYSTEM_RAM=y CONFIG_FIXED_PHY=y -CONFIG_FORCE_MAX_ZONEORDER=13 +CONFIG_FS_IOMAP=y +CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y +CONFIG_FW_LOADER_SYSFS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_CPU_AUTOPROBE=y -CONFIG_GENERIC_FIND_FIRST_BIT=y CONFIG_GENERIC_GETTIMEOFDAY=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y CONFIG_GENERIC_IOMAP=y CONFIG_GENERIC_IRQ_CHIP=y CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y @@ -91,10 +100,10 @@ CONFIG_GPIO_RTL8231=y CONFIG_GPIO_WATCHDOG=y # CONFIG_GPIO_WATCHDOG_ARCH_INITCALL is not set CONFIG_GRO_CELLS=y -CONFIG_HANDLE_DOMAIN_IRQ=y CONFIG_HARDWARE_WATCHPOINTS=y CONFIG_HAS_DMA=y CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y CONFIG_HAS_IOPORT_MAP=y CONFIG_HWMON=y CONFIG_HZ_PERIODIC=y @@ -122,20 +131,15 @@ CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y CONFIG_MDIO_I2C=y CONFIG_MDIO_SMBUS=y -CONFIG_MEMFD_CREATE=y CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y CONFIG_MIPS=y CONFIG_MIPS_ASID_BITS=8 CONFIG_MIPS_ASID_SHIFT=0 -CONFIG_MIPS_CLOCK_VSYSCALL=y -# CONFIG_MIPS_CMDLINE_DTB_EXTEND is not set # CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER is not set CONFIG_MIPS_CMDLINE_FROM_DTB=y -CONFIG_MIPS_EBPF_JIT=y CONFIG_MIPS_EXTERNAL_TIMER=y CONFIG_MIPS_L1_CACHE_SHIFT=5 -CONFIG_MIPS_LD_CAN_LINK_VDSO=y CONFIG_MIPS_MT=y # CONFIG_MIPS_MT_FPAFF is not set CONFIG_MIPS_MT_SMP=y @@ -144,6 +148,7 @@ CONFIG_MIPS_NR_CPU_NR_MAP=2 CONFIG_MIPS_PERF_SHARED_TC_COUNTERS=y CONFIG_MIPS_RAW_APPENDED_DTB=y CONFIG_MIPS_SPRAM=y +CONFIG_MMU_LAZY_TLB_REFCOUNT=y CONFIG_MODULES_USE_ELF_REL=y CONFIG_MTD_CFI_ADV_OPTIONS=y CONFIG_MTD_CFI_GEOMETRY=y @@ -158,18 +163,23 @@ CONFIG_MTD_SPLIT_TPLINK_FW=y CONFIG_MTD_SPLIT_UIMAGE_FW=y CONFIG_MTD_VIRT_CONCAT=y CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_SRCU_NMI_SAFE=y CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y CONFIG_NET_DSA_RTL83XX=y CONFIG_NET_DSA_TAG_TRAILER=y +CONFIG_NET_EGRESS=y CONFIG_NET_FLOW_LIMIT=y +CONFIG_NET_INGRESS=y CONFIG_NET_RTL838X=y CONFIG_NET_SELFTESTS=y CONFIG_NET_SWITCHDEV=y +CONFIG_NET_XGRESS=y CONFIG_NO_EXCEPT_FILL=y CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y CONFIG_NR_CPUS=2 CONFIG_NVMEM=y +CONFIG_NVMEM_LAYOUTS=y CONFIG_OF=y CONFIG_OF_ADDRESS=y CONFIG_OF_EARLY_FLATTREE=y @@ -179,19 +189,25 @@ CONFIG_OF_IRQ=y CONFIG_OF_KOBJ=y CONFIG_OF_MDIO=y CONFIG_PADATA=y +CONFIG_PAGE_POOL=y +CONFIG_PAGE_SIZE_LESS_THAN_256KB=y +CONFIG_PAGE_SIZE_LESS_THAN_64KB=y CONFIG_PCI_DRIVERS_LEGACY=y CONFIG_PERF_USE_VMALLOC=y CONFIG_PGTABLE_LEVELS=2 CONFIG_PHYLIB=y +CONFIG_PHYLIB_LEDS=y CONFIG_PHYLINK=y CONFIG_PINCTRL=y CONFIG_PM_OPP=y CONFIG_POWER_RESET=y CONFIG_POWER_RESET_GPIO_RESTART=y CONFIG_POWER_RESET_SYSCON=y +CONFIG_PREEMPT_NONE_BUILD=y CONFIG_PTP_1588_CLOCK_OPTIONAL=y CONFIG_QUEUED_RWLOCKS=y CONFIG_QUEUED_SPINLOCKS=y +CONFIG_RANDSTRUCT_NONE=y CONFIG_RATIONAL=y CONFIG_REALTEK_OTTO_TIMER=y CONFIG_REALTEK_OTTO_WDT=y @@ -215,8 +231,8 @@ CONFIG_SOCK_RX_QUEUE_MAPPING=y CONFIG_SPI=y CONFIG_SPI_MASTER=y CONFIG_SPI_MEM=y +CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y CONFIG_SRAM=y -CONFIG_SRCU=y CONFIG_SWPHY=y CONFIG_SYNC_R4K=y CONFIG_SYSCTL_EXCEPTION_TRACE=y @@ -235,7 +251,8 @@ CONFIG_TARGET_ISA_REV=2 CONFIG_TICK_CPU_ACCOUNTING=y CONFIG_TIMER_OF=y CONFIG_TIMER_PROBE=y -CONFIG_TINY_SRCU=y +CONFIG_TREE_RCU=y +CONFIG_TREE_SRCU=y CONFIG_USE_GENERIC_EARLY_PRINTK_8250=y CONFIG_USE_OF=y CONFIG_WATCHDOG_CORE=y From e1777c95d3571f86fe0da84aa7191c28ac3b161d Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Sun, 29 Dec 2024 14:33:12 +0100 Subject: [PATCH 084/173] realtek: rtl930x: Refresh kernel config Run 'make kernel_oldconfig' to get an up-to-date config. Signed-off-by: Sander Vanheule --- target/linux/realtek/rtl930x/config-6.6 | 35 ++++++++++++++++++------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/target/linux/realtek/rtl930x/config-6.6 b/target/linux/realtek/rtl930x/config-6.6 index 5a29bdc3c1b..a6a23ebcffc 100644 --- a/target/linux/realtek/rtl930x/config-6.6 +++ b/target/linux/realtek/rtl930x/config-6.6 @@ -12,6 +12,7 @@ CONFIG_BOARD_SCACHE=y CONFIG_CLONE_BACKWARDS=y CONFIG_COMMON_CLK=y # CONFIG_COMMON_CLK_REALTEK is not set +CONFIG_COMPACT_UNEVICTABLE_DEFAULT=1 CONFIG_COMPAT_32BIT_TIME=y CONFIG_CONSOLE_LOGLEVEL_DEFAULT=15 CONFIG_CPU_BIG_ENDIAN=y @@ -24,32 +25,40 @@ CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS32_R1 is not set CONFIG_CPU_MIPS32_R2=y CONFIG_CPU_MIPSR2=y +CONFIG_CPU_MITIGATIONS=y CONFIG_CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS=y CONFIG_CPU_R4K_CACHE_TLB=y CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y CONFIG_CPU_SUPPORTS_HIGHMEM=y CONFIG_CPU_SUPPORTS_MSA=y +CONFIG_CRC_CCITT=y CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y +CONFIG_CRYPTO_LIB_GF128MUL=y CONFIG_CRYPTO_LIB_POLY1305_RSIZE=2 -CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_LIB_SHA1=y +CONFIG_CRYPTO_LIB_UTILS=y +CONFIG_DEBUG_INFO=y CONFIG_DEBUG_SECTION_MISMATCH=y CONFIG_DMA_NONCOHERENT=y CONFIG_DTC=y CONFIG_EARLY_PRINTK=y CONFIG_EARLY_PRINTK_8250=y +CONFIG_EXCLUSIVE_SYSTEM_RAM=y CONFIG_FIXED_PHY=y -CONFIG_FORCE_MAX_ZONEORDER=13 +CONFIG_FORCE_NR_CPUS=y +CONFIG_FS_IOMAP=y +CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y +CONFIG_FW_LOADER_SYSFS=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_CPU_AUTOPROBE=y -CONFIG_GENERIC_FIND_FIRST_BIT=y CONFIG_GENERIC_GETTIMEOFDAY=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y CONFIG_GENERIC_IOMAP=y CONFIG_GENERIC_IRQ_CHIP=y -CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y CONFIG_GENERIC_IRQ_SHOW=y CONFIG_GENERIC_LIB_ASHLDI3=y CONFIG_GENERIC_LIB_ASHRDI3=y @@ -71,10 +80,10 @@ CONFIG_GPIO_PCA953X=y CONFIG_GPIO_REALTEK_OTTO=y CONFIG_GPIO_RTL8231=y CONFIG_GRO_CELLS=y -CONFIG_HANDLE_DOMAIN_IRQ=y CONFIG_HARDWARE_WATCHPOINTS=y CONFIG_HAS_DMA=y CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y CONFIG_HAS_IOPORT_MAP=y CONFIG_HWMON=y CONFIG_HZ_PERIODIC=y @@ -104,7 +113,6 @@ CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y CONFIG_MDIO_I2C=y CONFIG_MDIO_SMBUS=y -CONFIG_MEMFD_CREATE=y CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y CONFIG_MIPS=y @@ -113,14 +121,13 @@ CONFIG_MIPS_ASID_SHIFT=0 # CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER is not set CONFIG_MIPS_CMDLINE_FROM_DTB=y CONFIG_MIPS_CPU_SCACHE=y -CONFIG_MIPS_EBPF_JIT=y CONFIG_MIPS_EXTERNAL_TIMER=y CONFIG_MIPS_L1_CACHE_SHIFT=5 -CONFIG_MIPS_LD_CAN_LINK_VDSO=y # CONFIG_MIPS_MT_SMP is not set # CONFIG_MIPS_NO_APPENDED_DTB is not set CONFIG_MIPS_RAW_APPENDED_DTB=y CONFIG_MIPS_SPRAM=y +CONFIG_MMU_LAZY_TLB_REFCOUNT=y CONFIG_MODULES_USE_ELF_REL=y CONFIG_MTD_CFI_ADV_OPTIONS=y CONFIG_MTD_CFI_GEOMETRY=y @@ -138,12 +145,16 @@ CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y CONFIG_NET_DSA_RTL83XX=y CONFIG_NET_DSA_TAG_TRAILER=y +CONFIG_NET_EGRESS=y +CONFIG_NET_INGRESS=y CONFIG_NET_RTL838X=y CONFIG_NET_SELFTESTS=y CONFIG_NET_SWITCHDEV=y +CONFIG_NET_XGRESS=y CONFIG_NO_EXCEPT_FILL=y CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y CONFIG_NVMEM=y +CONFIG_NVMEM_LAYOUTS=y CONFIG_OF=y CONFIG_OF_ADDRESS=y CONFIG_OF_EARLY_FLATTREE=y @@ -152,16 +163,22 @@ CONFIG_OF_GPIO=y CONFIG_OF_IRQ=y CONFIG_OF_KOBJ=y CONFIG_OF_MDIO=y +CONFIG_PAGE_POOL=y +CONFIG_PAGE_SIZE_LESS_THAN_256KB=y +CONFIG_PAGE_SIZE_LESS_THAN_64KB=y CONFIG_PCI_DRIVERS_LEGACY=y CONFIG_PERF_USE_VMALLOC=y CONFIG_PGTABLE_LEVELS=2 CONFIG_PHYLIB=y +CONFIG_PHYLIB_LEDS=y CONFIG_PHYLINK=y CONFIG_PINCTRL=y CONFIG_POWER_RESET=y CONFIG_POWER_RESET_GPIO_RESTART=y CONFIG_POWER_RESET_SYSCON=y +CONFIG_PREEMPT_NONE_BUILD=y CONFIG_PTP_1588_CLOCK_OPTIONAL=y +CONFIG_RANDSTRUCT_NONE=y CONFIG_RATIONAL=y CONFIG_REALTEK_OTTO_TIMER=y CONFIG_REALTEK_OTTO_WDT=y @@ -181,7 +198,7 @@ CONFIG_SFP=y CONFIG_SPI=y CONFIG_SPI_MASTER=y CONFIG_SPI_MEM=y -CONFIG_SRCU=y +CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y CONFIG_SWPHY=y CONFIG_SYSCTL_EXCEPTION_TRACE=y CONFIG_SYS_HAS_CPU_MIPS32_R1=y From c2240a75d5802be60b2b614f726ff0f638aa3541 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Sun, 29 Dec 2024 14:37:50 +0100 Subject: [PATCH 085/173] realtek: rtl931x: Refresh kernel config Run 'make kernel_oldconfig' to get an up-to-date config. Signed-off-by: Sander Vanheule --- target/linux/realtek/rtl931x/config-6.6 | 39 ++++++++++++++++++------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/target/linux/realtek/rtl931x/config-6.6 b/target/linux/realtek/rtl931x/config-6.6 index df235defe83..9d332cee27a 100644 --- a/target/linux/realtek/rtl931x/config-6.6 +++ b/target/linux/realtek/rtl931x/config-6.6 @@ -8,15 +8,17 @@ CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=4096 CONFIG_BOARD_SCACHE=y -CONFIG_CEVT_RTL9300=y CONFIG_CLKSRC_MIPS_GIC=y CONFIG_CLOCKSOURCE_WATCHDOG=y CONFIG_CLOCKSOURCE_WATCHDOG_MAX_SKEW_US=125 CONFIG_CLONE_BACKWARDS=y CONFIG_COMMON_CLK=y # CONFIG_COMMON_CLK_REALTEK is not set +CONFIG_COMPACT_UNEVICTABLE_DEFAULT=1 CONFIG_COMPAT_32BIT_TIME=y CONFIG_CONSOLE_LOGLEVEL_DEFAULT=15 +CONFIG_CONTEXT_TRACKING=y +CONFIG_CONTEXT_TRACKING_IDLE=y CONFIG_CPU_BIG_ENDIAN=y CONFIG_CPU_GENERIC_DUMP_TLB=y CONFIG_CPU_HAS_DIEI=y @@ -29,6 +31,7 @@ CONFIG_CPU_MIPS32_R2=y CONFIG_CPU_MIPSR2=y CONFIG_CPU_MIPSR2_IRQ_EI=y CONFIG_CPU_MIPSR2_IRQ_VI=y +CONFIG_CPU_MITIGATIONS=y CONFIG_CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS=y CONFIG_CPU_R4K_CACHE_TLB=y CONFIG_CPU_RMAP=y @@ -36,24 +39,29 @@ CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y CONFIG_CPU_SUPPORTS_HIGHMEM=y CONFIG_CPU_SUPPORTS_MSA=y CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y +CONFIG_CRYPTO_LIB_GF128MUL=y CONFIG_CRYPTO_LIB_POLY1305_RSIZE=2 -CONFIG_CRYPTO_RNG2=y -CONFIG_CSRC_R4K=y +CONFIG_CRYPTO_LIB_SHA1=y +CONFIG_CRYPTO_LIB_UTILS=y +CONFIG_DEBUG_INFO=y CONFIG_DEBUG_SECTION_MISMATCH=y CONFIG_DMA_NONCOHERENT=y CONFIG_DTC=y CONFIG_EARLY_PRINTK=y CONFIG_EARLY_PRINTK_8250=y +CONFIG_EXCLUSIVE_SYSTEM_RAM=y CONFIG_FIXED_PHY=y -CONFIG_FORCE_MAX_ZONEORDER=13 +CONFIG_FS_IOMAP=y +CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y +CONFIG_FW_LOADER_SYSFS=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_CPU_AUTOPROBE=y -CONFIG_GENERIC_FIND_FIRST_BIT=y CONFIG_GENERIC_GETTIMEOFDAY=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y CONFIG_GENERIC_IOMAP=y CONFIG_GENERIC_IRQ_CHIP=y CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y @@ -77,10 +85,10 @@ CONFIG_GPIO_GENERIC=y CONFIG_GPIO_REALTEK_OTTO=y CONFIG_GPIO_RTL8231=y CONFIG_GRO_CELLS=y -CONFIG_HANDLE_DOMAIN_IRQ=y CONFIG_HARDWARE_WATCHPOINTS=y CONFIG_HAS_DMA=y CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y CONFIG_HAS_IOPORT_MAP=y CONFIG_HIGHMEM=y CONFIG_HWMON=y @@ -113,7 +121,6 @@ CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y CONFIG_MDIO_I2C=y CONFIG_MDIO_SMBUS=y -CONFIG_MEMFD_CREATE=y CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y CONFIG_MIPS=y @@ -127,10 +134,9 @@ CONFIG_MIPS_CPC=y CONFIG_MIPS_CPS=y # CONFIG_MIPS_CPS_NS16550_BOOL is not set CONFIG_MIPS_CPU_SCACHE=y -CONFIG_MIPS_EBPF_JIT=y +CONFIG_MIPS_EXTERNAL_TIMER=y CONFIG_MIPS_GIC=y CONFIG_MIPS_L1_CACHE_SHIFT=5 -CONFIG_MIPS_LD_CAN_LINK_VDSO=y CONFIG_MIPS_MT=y CONFIG_MIPS_MT_FPAFF=y CONFIG_MIPS_MT_SMP=y @@ -139,6 +145,7 @@ CONFIG_MIPS_NR_CPU_NR_MAP=2 CONFIG_MIPS_PERF_SHARED_TC_COUNTERS=y CONFIG_MIPS_RAW_APPENDED_DTB=y CONFIG_MIPS_SPRAM=y +CONFIG_MMU_LAZY_TLB_REFCOUNT=y CONFIG_MODULES_USE_ELF_REL=y CONFIG_MTD_CFI_ADV_OPTIONS=y CONFIG_MTD_CFI_GEOMETRY=y @@ -151,18 +158,23 @@ CONFIG_MTD_SPLIT_FIRMWARE=y CONFIG_MTD_SPLIT_TPLINK_FW=y CONFIG_MTD_SPLIT_UIMAGE_FW=y CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_SRCU_NMI_SAFE=y CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y CONFIG_NET_DSA_RTL83XX=y CONFIG_NET_DSA_TAG_TRAILER=y +CONFIG_NET_EGRESS=y CONFIG_NET_FLOW_LIMIT=y +CONFIG_NET_INGRESS=y CONFIG_NET_RTL838X=y CONFIG_NET_SELFTESTS=y CONFIG_NET_SWITCHDEV=y +CONFIG_NET_XGRESS=y CONFIG_NO_EXCEPT_FILL=y CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y CONFIG_NR_CPUS=2 CONFIG_NVMEM=y +CONFIG_NVMEM_LAYOUTS=y CONFIG_OF=y CONFIG_OF_ADDRESS=y CONFIG_OF_EARLY_FLATTREE=y @@ -172,21 +184,26 @@ CONFIG_OF_IRQ=y CONFIG_OF_KOBJ=y CONFIG_OF_MDIO=y CONFIG_PADATA=y +CONFIG_PAGE_POOL=y +CONFIG_PAGE_SIZE_LESS_THAN_256KB=y +CONFIG_PAGE_SIZE_LESS_THAN_64KB=y CONFIG_PCI_DRIVERS_LEGACY=y CONFIG_PERF_USE_VMALLOC=y CONFIG_PGTABLE_LEVELS=2 CONFIG_PHYLIB=y +CONFIG_PHYLIB_LEDS=y CONFIG_PHYLINK=y CONFIG_PINCTRL=y CONFIG_POWER_RESET=y CONFIG_POWER_RESET_SYSCON=y +CONFIG_PREEMPT_NONE_BUILD=y CONFIG_PTP_1588_CLOCK_OPTIONAL=y CONFIG_QUEUED_RWLOCKS=y CONFIG_QUEUED_SPINLOCKS=y +CONFIG_RANDSTRUCT_NONE=y CONFIG_RATIONAL=y # CONFIG_REALTEK_OTTO_TIMER is not set CONFIG_REALTEK_OTTO_WDT=y -# CONFIG_REALTEK_PHY is not set CONFIG_REALTEK_SOC_PHY=y CONFIG_REGMAP=y CONFIG_REGMAP_I2C=y @@ -209,7 +226,7 @@ CONFIG_SOCK_RX_QUEUE_MAPPING=y CONFIG_SPI=y CONFIG_SPI_MASTER=y CONFIG_SPI_MEM=y -CONFIG_SRCU=y +CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y CONFIG_SWPHY=y CONFIG_SYNC_R4K=y CONFIG_SYSCTL_EXCEPTION_TRACE=y From ae833c01b312258c27ff2dc1c8d44b15b7028e32 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Fri, 27 Dec 2024 15:53:23 +0100 Subject: [PATCH 086/173] realtek: Add driver for auxiliary MDIO busses Add a driver that exposes the auxiliary busses, used for the RTL8231 expanders, as a proper MDIO controller. The device must be instantiated under an MFD device, so the driver should also be compatible with SoC managed by an external CPU via SPI. Leave the driver disabled in builds until required. Signed-off-by: Sander Vanheule --- ...dd-Realtek-Otto-auxiliary-controller.patch | 193 ++++++++++++++++++ target/linux/realtek/rtl838x/config-6.6 | 1 + target/linux/realtek/rtl839x/config-6.6 | 1 + target/linux/realtek/rtl930x/config-6.6 | 1 + target/linux/realtek/rtl931x/config-6.6 | 1 + 5 files changed, 197 insertions(+) create mode 100644 target/linux/realtek/patches-6.6/723-net-mdio-Add-Realtek-Otto-auxiliary-controller.patch diff --git a/target/linux/realtek/patches-6.6/723-net-mdio-Add-Realtek-Otto-auxiliary-controller.patch b/target/linux/realtek/patches-6.6/723-net-mdio-Add-Realtek-Otto-auxiliary-controller.patch new file mode 100644 index 00000000000..430f8f5c007 --- /dev/null +++ b/target/linux/realtek/patches-6.6/723-net-mdio-Add-Realtek-Otto-auxiliary-controller.patch @@ -0,0 +1,193 @@ +From c7ddb74c981c1a29bad82d555d08724aca93b687 Mon Sep 17 00:00:00 2001 +From: Sander Vanheule +Date: Fri, 27 Dec 2024 14:55:31 +0100 +Subject: [PATCH] net: mdio: Add Realtek Otto auxiliary controller + +SoCs in Realtek's Otto platform such as the RTL8380 and RTL8391 have a +simple auxiliary MDIO controller that is commonly used to manage RTL8231 +GPIO expanders on switch devices. + +Add a new MDIO controller driver supporting the RTL838x (maple) and +RTL839x (cypress) SoCs. + +Signed-off-by: Sander Vanheule +--- + drivers/net/mdio/Kconfig | 10 ++ + drivers/net/mdio/Makefile | 1 + + drivers/net/mdio/mdio-realtek-otto-aux.c | 129 +++++++++++++++++++++++ + 3 files changed, 140 insertions(+) + create mode 100644 drivers/net/mdio/mdio-realtek-otto-aux.c + +--- a/drivers/net/mdio/Kconfig ++++ b/drivers/net/mdio/Kconfig +@@ -207,6 +207,16 @@ config MDIO_REGMAP + regmap. Users willing to use this driver must explicitly select + REGMAP. + ++config MDIO_REALTEK_OTTO_AUX ++ tristate "Realtek Otto auxiliary MDIO interface support" ++ default MACH_REALTEK_RTL ++ depends on MACH_REALTEK_RTL ++ depends on MFD_SYSCON ++ select MDIO_DEVRES ++ help ++ This driver supports the auxilairy MDIO bus on RTL838x SoCs. This bus ++ is typically used to attach RTL8231 GPIO extenders. ++ + config MDIO_THUNDER + tristate "ThunderX SOCs MDIO buses" + depends on 64BIT +--- a/drivers/net/mdio/Makefile ++++ b/drivers/net/mdio/Makefile +@@ -20,6 +20,7 @@ obj-$(CONFIG_MDIO_MSCC_MIIM) += mdio-ms + obj-$(CONFIG_MDIO_MVUSB) += mdio-mvusb.o + obj-$(CONFIG_MDIO_OCTEON) += mdio-octeon.o + obj-$(CONFIG_MDIO_REGMAP) += mdio-regmap.o ++obj-$(CONFIG_MDIO_REALTEK_OTTO_AUX) += mdio-realtek-otto-aux.o + obj-$(CONFIG_MDIO_SMBUS) += mdio-smbus.o + obj-$(CONFIG_MDIO_SUN4I) += mdio-sun4i.o + obj-$(CONFIG_MDIO_THUNDER) += mdio-thunder.o +--- /dev/null ++++ b/drivers/net/mdio/mdio-realtek-otto-aux.c +@@ -0,0 +1,141 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define RTL8380_EXT_GPIO_INDIRECT_ACCESS 0xA09C ++#define RTL8390_EXT_GPIO_INDIRECT_ACCESS 0x0224 ++ ++#define RTL83XX_AUX_MDIO_DATA GENMASK(31, 16) ++#define RTL83XX_AUX_MDIO_REG GENMASK(11, 7) ++#define RTL83XX_AUX_MDIO_PHY_ADDR GENMASK(6, 2) ++#define RTL83XX_AUX_MDIO_WRITE BIT(1) ++#define RTL83XX_AUX_MDIO_READ 0 ++#define RTL83XX_AUX_MDIO_EXEC BIT(0) ++ ++struct realtek_aux_mdio_ctrl { ++ struct device *dev; ++ struct regmap *map; ++ unsigned int cmd_reg; ++}; ++ ++#define mii_bus_to_ctrl(bus) ((struct realtek_aux_mdio_ctrl *) bus->priv) ++ ++static int rtl83xx_aux_mdio_cmd(struct realtek_aux_mdio_ctrl *ctrl, int addr, int regnum, ++ u32 rw_bit, u16 *data) ++{ ++ unsigned int mask_volatile; ++ unsigned int cmd; ++ unsigned int run; ++ int err; ++ ++ cmd = rw_bit | RTL83XX_AUX_MDIO_EXEC; ++ cmd |= FIELD_PREP(RTL83XX_AUX_MDIO_PHY_ADDR, addr); ++ cmd |= FIELD_PREP(RTL83XX_AUX_MDIO_REG, regnum); ++ ++ mask_volatile = RTL83XX_AUX_MDIO_EXEC; ++ ++ if (rw_bit == RTL83XX_AUX_MDIO_WRITE) ++ cmd |= FIELD_PREP(RTL83XX_AUX_MDIO_DATA, *data); ++ else ++ mask_volatile |= RTL83XX_AUX_MDIO_DATA; ++ ++ err = regmap_write(ctrl->map, ctrl->cmd_reg, cmd); ++ if (err) ++ return err; ++ ++ err = regmap_read_poll_timeout(ctrl->map, ctrl->cmd_reg, run, (run != cmd), 3, 100); ++ ++ if ((run & ~mask_volatile) != (cmd & ~mask_volatile)) { ++ dev_err(ctrl->dev, "Command modified. Is offloading still active?"); ++ return -EIO; ++ } ++ ++ if (!err && (rw_bit == RTL83XX_AUX_MDIO_READ)) ++ *data = FIELD_GET(RTL83XX_AUX_MDIO_DATA, run); ++ ++ return err; ++} ++ ++static int rtl83xx_aux_mdio_read(struct mii_bus *bus, int addr, int regnum) ++{ ++ struct realtek_aux_mdio_ctrl *ctrl = mii_bus_to_ctrl(bus); ++ u16 data; ++ int err; ++ ++ err = rtl83xx_aux_mdio_cmd(ctrl, addr, regnum, RTL83XX_AUX_MDIO_READ, &data); ++ ++ if (err) ++ return err; ++ else ++ return data; ++} ++ ++static int rtl83xx_aux_mdio_write(struct mii_bus *bus, int addr, int regnum, u16 val) ++{ ++ struct realtek_aux_mdio_ctrl *ctrl = mii_bus_to_ctrl(bus); ++ ++ return rtl83xx_aux_mdio_cmd(ctrl, addr, regnum, RTL83XX_AUX_MDIO_WRITE, &val); ++} ++ ++static int realtek_aux_mdio_probe(struct platform_device *pdev) ++{ ++ struct device_node *np = pdev->dev.of_node; ++ struct realtek_aux_mdio_ctrl *ctrl; ++ struct mii_bus *bus; ++ ++ bus = devm_mdiobus_alloc_size(&pdev->dev, sizeof(*ctrl)); ++ if (!bus) ++ return -ENOMEM; ++ ++ ctrl = bus->priv; ++ ctrl->dev = &pdev->dev; ++ ctrl->cmd_reg = (unsigned int) device_get_match_data(ctrl->dev); ++ ctrl->map = syscon_node_to_regmap(np->parent); ++ if (IS_ERR(ctrl->map)) ++ return PTR_ERR(ctrl->map); ++ ++ bus->name = "RTL83xx auxiliary MDIO bus"; ++ snprintf(bus->id, MII_BUS_ID_SIZE, "rtl83xx-aux-mdio") ; ++ bus->parent = ctrl->dev; ++ bus->read = rtl83xx_aux_mdio_read; ++ bus->write = rtl83xx_aux_mdio_write; ++ /* Don't have interrupts */ ++ for (unsigned int i = 0; i < PHY_MAX_ADDR; i++) ++ bus->irq[i] = PHY_POLL; ++ ++ return devm_of_mdiobus_register(ctrl->dev, bus, np); ++} ++ ++static const struct of_device_id realtek_aux_mdio_of_match[] = { ++ { ++ .compatible = "realtek,rtl8380-aux-mdio", ++ .data = (void *) RTL8380_EXT_GPIO_INDIRECT_ACCESS, ++ }, ++ { ++ .compatible = "realtek,rtl8390-aux-mdio", ++ .data = (void *) RTL8390_EXT_GPIO_INDIRECT_ACCESS, ++ }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(of, realtek_aux_mdio_of_match); ++ ++static struct platform_driver realtek_aux_mdio_driver = { ++ .driver = { ++ .name = "realtek-otto-aux-mdio", ++ .of_match_table = realtek_aux_mdio_of_match ++ }, ++ .probe = realtek_aux_mdio_probe, ++}; ++module_platform_driver(realtek_aux_mdio_driver); ++ ++MODULE_AUTHOR("Sander Vanheule "); ++MODULE_DESCRIPTION("Realtek RTL83xx auxiliary MDIO bus"); ++MODULE_LICENSE("GPL v2"); diff --git a/target/linux/realtek/rtl838x/config-6.6 b/target/linux/realtek/rtl838x/config-6.6 index a190a69ec66..6cceded5af5 100644 --- a/target/linux/realtek/rtl838x/config-6.6 +++ b/target/linux/realtek/rtl838x/config-6.6 @@ -130,6 +130,7 @@ CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y CONFIG_MDIO_I2C=y +# CONFIG_MDIO_REALTEK_OTTO_AUX is not set CONFIG_MDIO_SMBUS=y CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y diff --git a/target/linux/realtek/rtl839x/config-6.6 b/target/linux/realtek/rtl839x/config-6.6 index 53a167e8f70..ebf473db61c 100644 --- a/target/linux/realtek/rtl839x/config-6.6 +++ b/target/linux/realtek/rtl839x/config-6.6 @@ -130,6 +130,7 @@ CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y CONFIG_MDIO_I2C=y +# CONFIG_MDIO_REALTEK_OTTO_AUX is not set CONFIG_MDIO_SMBUS=y CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y diff --git a/target/linux/realtek/rtl930x/config-6.6 b/target/linux/realtek/rtl930x/config-6.6 index a6a23ebcffc..35d088fe089 100644 --- a/target/linux/realtek/rtl930x/config-6.6 +++ b/target/linux/realtek/rtl930x/config-6.6 @@ -112,6 +112,7 @@ CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y CONFIG_MDIO_I2C=y +# CONFIG_MDIO_REALTEK_OTTO_AUX is not set CONFIG_MDIO_SMBUS=y CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y diff --git a/target/linux/realtek/rtl931x/config-6.6 b/target/linux/realtek/rtl931x/config-6.6 index 9d332cee27a..d843382f515 100644 --- a/target/linux/realtek/rtl931x/config-6.6 +++ b/target/linux/realtek/rtl931x/config-6.6 @@ -120,6 +120,7 @@ CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y CONFIG_MDIO_I2C=y +# CONFIG_MDIO_REALTEK_OTTO_AUX is not set CONFIG_MDIO_SMBUS=y CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y From 92ae8cb16c46823d5a00489b4d3a9cc724ba67a4 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Fri, 27 Dec 2024 15:56:44 +0100 Subject: [PATCH 087/173] realtek: rtl838x: Instantiate auxiliary MDIO bus Add a disabled node for the auxiliary MDIO bus, used to manage the RTL8231 expanders. A simple-mfd parent node is added, at the same (implied) address as the switch@1b000000 node, as the switch drivers should anyway transistion to MFD subdivices at some point. Additionally, two pinctrl-single node are added to allow the MDX pins to be muxed correctly, in case the bootloader leaves these unconfigured. Signed-off-by: Sander Vanheule --- target/linux/realtek/dts/rtl838x.dtsi | 56 +++++++++++++++++++++++++ target/linux/realtek/rtl838x/config-6.6 | 2 +- 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/target/linux/realtek/dts/rtl838x.dtsi b/target/linux/realtek/dts/rtl838x.dtsi index 13ba6450b2d..ab034fc1bcf 100644 --- a/target/linux/realtek/dts/rtl838x.dtsi +++ b/target/linux/realtek/dts/rtl838x.dtsi @@ -232,6 +232,42 @@ }; }; + switchcore@1b000000 { + compatible = "syscon", "simple-mfd"; + reg = <0x1b000000 0x20000>; + + mdio_aux: mdio-aux { + compatible = "realtek,rtl8380-aux-mdio"; + #address-cells = <1>; + #size-cells = <0>; + + status = "disabled"; + + pinctrl-names = "default"; + pinctrl-0 = <&mdio_aux_mdx>, <&aux_mode_mdio>; + }; + }; + + pinmux@1b000144 { + compatible = "pinctrl-single"; + reg = <0x1b000144 0x4>; + + pinctrl-single,bit-per-mux; + pinctrl-single,register-width = <32>; + pinctrl-single,function-mask = <0x1>; + #pinctrl-cells = <2>; + + /* I2C mode */ + aux_mode_i2c: i2c-pins { + pinctrl-single,bits = <0x0 0x0 0x1>; + }; + + /* MDIO mode */ + aux_mode_mdio: mdx-pins { + pinctrl-single,bits = <0x0 0x1 0x1>; + }; + }; + pinmux: pinmux@1b001000 { compatible = "pinctrl-single"; reg = <0x1b001000 0x4>; @@ -262,6 +298,26 @@ }; }; + pinmux@1b00a0e0 { + compatible = "pinctrl-single"; + reg = <0x1b00a0e0 0x4>; + + pinctrl-single,bit-per-mux; + pinctrl-single,register-width = <32>; + pinctrl-single,function-mask = <0x1>; + #pinctrl-cells = <2>; + + /* Use SoC GPIO 2/3 as GPIO */ + mdio_aux_gpio: gpio-pins { + pinctrl-single,bits = <0x0 0x0 0x1>; + }; + + /* Use SoC GPIO 2/3 as MDC/MDIO */ + mdio_aux_mdx: mdx-pins { + pinctrl-single,bits = <0x0 0x1 0x1>; + }; + }; + ethernet0: ethernet@1b00a300 { compatible = "realtek,rtl838x-eth"; reg = <0x1b00a300 0x100>; diff --git a/target/linux/realtek/rtl838x/config-6.6 b/target/linux/realtek/rtl838x/config-6.6 index 6cceded5af5..9364888e47b 100644 --- a/target/linux/realtek/rtl838x/config-6.6 +++ b/target/linux/realtek/rtl838x/config-6.6 @@ -130,7 +130,7 @@ CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y CONFIG_MDIO_I2C=y -# CONFIG_MDIO_REALTEK_OTTO_AUX is not set +CONFIG_MDIO_REALTEK_OTTO_AUX=y CONFIG_MDIO_SMBUS=y CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y From 6ef6014887c393dc07f0349028d93e4fa82e0733 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Thu, 26 Dec 2024 20:55:16 +0100 Subject: [PATCH 088/173] realtek: Add pinctrl support for RTL8231 Add pending patches to add RTL8231 support as a MDIO-bus attached multi-functional device. This includes subdrivers for the pincontrol and GPIO features, as well as the LED matrix support. Leave the drivers disabled until required by a device. Signed-off-by: Sander Vanheule --- ...ap-Bypass-cache-for-shadowed-outputs.patch | 56 ++ ...-regmap-Use-generic-request-free-ops.patch | 26 + .../802-mfd-Add-RTL8231-core-device.patch | 330 ++++++++++ ...RTL8231-pin-control-and-GPIO-support.patch | 581 ++++++++++++++++++ ...-support-for-RTL8231-LED-scan-matrix.patch | 338 ++++++++++ target/linux/realtek/rtl838x/config-6.6 | 1 + target/linux/realtek/rtl839x/config-6.6 | 1 + target/linux/realtek/rtl930x/config-6.6 | 1 + target/linux/realtek/rtl931x/config-6.6 | 1 + 9 files changed, 1335 insertions(+) create mode 100644 target/linux/realtek/patches-6.6/800-gpio-regmap-Bypass-cache-for-shadowed-outputs.patch create mode 100644 target/linux/realtek/patches-6.6/801-gpio-regmap-Use-generic-request-free-ops.patch create mode 100644 target/linux/realtek/patches-6.6/802-mfd-Add-RTL8231-core-device.patch create mode 100644 target/linux/realtek/patches-6.6/803-pinctrl-Add-RTL8231-pin-control-and-GPIO-support.patch create mode 100644 target/linux/realtek/patches-6.6/804-leds-Add-support-for-RTL8231-LED-scan-matrix.patch diff --git a/target/linux/realtek/patches-6.6/800-gpio-regmap-Bypass-cache-for-shadowed-outputs.patch b/target/linux/realtek/patches-6.6/800-gpio-regmap-Bypass-cache-for-shadowed-outputs.patch new file mode 100644 index 00000000000..b4dbf320b2d --- /dev/null +++ b/target/linux/realtek/patches-6.6/800-gpio-regmap-Bypass-cache-for-shadowed-outputs.patch @@ -0,0 +1,56 @@ +From b3f79468c90d8770f007d628a1e32b2d5d44a5c2 Mon Sep 17 00:00:00 2001 +From: Sander Vanheule +Date: Sat, 15 May 2021 11:57:32 +0200 +Subject: [PATCH] gpio: regmap: Bypass cache for shadowed outputs + +Some chips have the read-only input and write-only output data registers +aliased to the same offset, but do not perform direction multiplexing on +writes. Upon writing the register, this then always updates the output +value, even when the pin is configured as input. As a result it is not +safe to perform read-modify-writes on output pins, when other pins are +still configured as input. + +For example, on a bit-banged I2C bus, where the lines are switched +between out-low and in (with external pull-up) + + OUT(L) IN OUT(H) +SCK ....../''''''|'''''' + +SDA '''''''''\.......... + ^ ^- SCK switches to direction to OUT, but now has a high + | value, breaking the clock. + | + \- Perform RMW to update SDA. This reads the current input + value for SCK, updates the SDA value and writes back a 1 + for SCK as well. + +If a register is used for both the data input and data output (and is +not marked as volatile) the driver should ensure the cache is not +updated on register reads. This ensures proper functioning of writing +the output register with regmap_update_bits(), which will then use and +update the cache only on register writes. + +Signed-off-by: Sander Vanheule +--- + drivers/gpio/gpio-regmap.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +--- a/drivers/gpio/gpio-regmap.c ++++ b/drivers/gpio/gpio-regmap.c +@@ -74,7 +74,15 @@ static int gpio_regmap_get(struct gpio_c + if (ret) + return ret; + +- ret = regmap_read(gpio->regmap, reg, &val); ++ /* ++ * Ensure we don't spoil the register cache with pin input values and ++ * perform a bypassed read. This way the cache (if any) is only used and ++ * updated on register writes. ++ */ ++ if (gpio->reg_dat_base == gpio->reg_set_base) ++ ret = regmap_read_bypassed(gpio->regmap, reg, &val); ++ else ++ ret = regmap_read(gpio->regmap, reg, &val); + if (ret) + return ret; + diff --git a/target/linux/realtek/patches-6.6/801-gpio-regmap-Use-generic-request-free-ops.patch b/target/linux/realtek/patches-6.6/801-gpio-regmap-Use-generic-request-free-ops.patch new file mode 100644 index 00000000000..a06ba7464aa --- /dev/null +++ b/target/linux/realtek/patches-6.6/801-gpio-regmap-Use-generic-request-free-ops.patch @@ -0,0 +1,26 @@ +From f21b15dfe254b51f80c552750eb20b1dc752507a Mon Sep 17 00:00:00 2001 +From: Sander Vanheule +Date: Mon, 30 Dec 2024 17:59:24 +0100 +Subject: [PATCH] gpio: regmap: Use generic request/free ops + +Set the gpiochip request and free ops to the generic implementations. +This way a user can provide a gpio-ranges property defined for a pinmux, +allowing pins to automatically be muxed to their GPIO function when +requested. + +Signed-off-by: Sander Vanheule +--- + drivers/gpio/gpio-regmap.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/gpio/gpio-regmap.c ++++ b/drivers/gpio/gpio-regmap.c +@@ -270,6 +270,8 @@ struct gpio_regmap *gpio_regmap_register + chip->label = config->label ?: dev_name(config->parent); + chip->can_sleep = regmap_might_sleep(config->regmap); + ++ chip->request = gpiochip_generic_request; ++ chip->free = gpiochip_generic_free; + chip->get = gpio_regmap_get; + if (gpio->reg_set_base && gpio->reg_clr_base) + chip->set = gpio_regmap_set_with_clear; diff --git a/target/linux/realtek/patches-6.6/802-mfd-Add-RTL8231-core-device.patch b/target/linux/realtek/patches-6.6/802-mfd-Add-RTL8231-core-device.patch new file mode 100644 index 00000000000..df4d4aa1434 --- /dev/null +++ b/target/linux/realtek/patches-6.6/802-mfd-Add-RTL8231-core-device.patch @@ -0,0 +1,330 @@ +From 4e3455e058d40eb2a7326016494e3c81dc506c33 Mon Sep 17 00:00:00 2001 +From: Sander Vanheule +Date: Mon, 10 May 2021 18:33:01 +0200 +Subject: [PATCH] mfd: Add RTL8231 core device + +The RTL8231 is implemented as an MDIO device, and provides a regmap +interface for register access by the core and child devices. + +The chip can also be a device on an SMI bus, an I2C-like bus by Realtek. +Since kernel support for SMI is limited, and no real-world SMI +implementations have been encountered for this device, this is currently +unimplemented. The use of the regmap interface should make any future +support relatively straightforward. + +After reset, all pins are muxed to GPIO inputs before the pin drivers +are enabled. This is done to prevent accidental system resets, when a +pin is connected to the parent SoC's reset line. + +To provide different read and write semantics for the GPIO data +registers, a secondary virtual register range is used to enable separate +caching properties of pin input and output values. + +Signed-off-by: Sander Vanheule +--- + drivers/mfd/Kconfig | 9 ++ + drivers/mfd/Makefile | 1 + + drivers/mfd/rtl8231.c | 193 ++++++++++++++++++++++++++++++++++++ + include/linux/mfd/rtl8231.h | 71 +++++++++++++ + 4 files changed, 274 insertions(+) + create mode 100644 drivers/mfd/rtl8231.c + create mode 100644 include/linux/mfd/rtl8231.h + +--- a/drivers/mfd/Kconfig ++++ b/drivers/mfd/Kconfig +@@ -1171,6 +1171,15 @@ config MFD_RDC321X + southbridge which provides access to GPIOs and Watchdog using the + southbridge PCI device configuration space. + ++config MFD_RTL8231 ++ tristate "Realtek RTL8231 GPIO and LED expander" ++ select MFD_CORE ++ select REGMAP_MDIO ++ help ++ Support for the Realtek RTL8231 GPIO and LED expander. ++ Provides up to 37 GPIOs, 88 LEDs, and one PWM output. ++ When built as a module, this module will be named rtl8231. ++ + config MFD_RT4831 + tristate "Richtek RT4831 four channel WLED and Display Bias Voltage" + depends on I2C +--- a/drivers/mfd/Makefile ++++ b/drivers/mfd/Makefile +@@ -240,6 +240,7 @@ obj-$(CONFIG_MFD_HI6421_PMIC) += hi6421- + obj-$(CONFIG_MFD_HI6421_SPMI) += hi6421-spmi-pmic.o + obj-$(CONFIG_MFD_HI655X_PMIC) += hi655x-pmic.o + obj-$(CONFIG_MFD_DLN2) += dln2.o ++obj-$(CONFIG_MFD_RTL8231) += rtl8231.o + obj-$(CONFIG_MFD_RT4831) += rt4831.o + obj-$(CONFIG_MFD_RT5033) += rt5033.o + obj-$(CONFIG_MFD_RT5120) += rt5120.o +--- /dev/null ++++ b/drivers/mfd/rtl8231.c +@@ -0,0 +1,193 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++static bool rtl8231_volatile_reg(struct device *dev, unsigned int reg) ++{ ++ switch (reg) { ++ /* ++ * Registers with self-clearing bits, strapping pin values. ++ * Don't mark the data registers as volatile, since we need ++ * caching for the output values. ++ */ ++ case RTL8231_REG_FUNC0: ++ case RTL8231_REG_FUNC1: ++ case RTL8231_REG_PIN_HI_CFG: ++ case RTL8231_REG_LED_END: ++ return true; ++ default: ++ return false; ++ } ++} ++ ++static const struct reg_field RTL8231_FIELD_LED_START = REG_FIELD(RTL8231_REG_FUNC0, 1, 1); ++ ++static const struct mfd_cell rtl8231_cells[] = { ++ { ++ .name = "rtl8231-pinctrl", ++ }, ++ { ++ .name = "rtl8231-leds", ++ .of_compatible = "realtek,rtl8231-leds", ++ }, ++}; ++ ++static int rtl8231_soft_reset(struct regmap *map) ++{ ++ const unsigned int all_pins_mask = GENMASK(RTL8231_BITS_VAL - 1, 0); ++ unsigned int val; ++ int err; ++ ++ /* SOFT_RESET bit self-clears when done */ ++ regmap_write_bits(map, RTL8231_REG_PIN_HI_CFG, ++ RTL8231_PIN_HI_CFG_SOFT_RESET, RTL8231_PIN_HI_CFG_SOFT_RESET); ++ err = regmap_read_poll_timeout(map, RTL8231_REG_PIN_HI_CFG, val, ++ !(val & RTL8231_PIN_HI_CFG_SOFT_RESET), 50, 1000); ++ if (err) ++ return err; ++ ++ regcache_mark_dirty(map); ++ ++ /* ++ * Chip reset results in a pin configuration that is a mix of LED and GPIO outputs. ++ * Select GPI functionality for all pins before enabling pin outputs. ++ */ ++ regmap_write(map, RTL8231_REG_PIN_MODE0, all_pins_mask); ++ regmap_write(map, RTL8231_REG_GPIO_DIR0, all_pins_mask); ++ regmap_write(map, RTL8231_REG_PIN_MODE1, all_pins_mask); ++ regmap_write(map, RTL8231_REG_GPIO_DIR1, all_pins_mask); ++ regmap_write(map, RTL8231_REG_PIN_HI_CFG, ++ RTL8231_PIN_HI_CFG_MODE_MASK | RTL8231_PIN_HI_CFG_DIR_MASK); ++ ++ return 0; ++} ++ ++static int rtl8231_init(struct device *dev, struct regmap *map) ++{ ++ struct regmap_field *led_start; ++ unsigned int started; ++ unsigned int val; ++ int err; ++ ++ err = regmap_read(map, RTL8231_REG_FUNC1, &val); ++ if (err) { ++ dev_err(dev, "failed to read READY_CODE\n"); ++ return err; ++ } ++ ++ val = FIELD_GET(RTL8231_FUNC1_READY_CODE_MASK, val); ++ if (val != RTL8231_FUNC1_READY_CODE_VALUE) { ++ dev_err(dev, "RTL8231 not present or ready 0x%x != 0x%x\n", ++ val, RTL8231_FUNC1_READY_CODE_VALUE); ++ return -ENODEV; ++ } ++ ++ led_start = dev_get_drvdata(dev); ++ err = regmap_field_read(led_start, &started); ++ if (err) ++ return err; ++ ++ if (!started) { ++ err = rtl8231_soft_reset(map); ++ if (err) ++ return err; ++ /* LED_START enables power to output pins, and starts the LED engine */ ++ err = regmap_field_force_write(led_start, 1); ++ } ++ ++ return err; ++} ++ ++static const struct regmap_config rtl8231_mdio_regmap_config = { ++ .val_bits = RTL8231_BITS_VAL, ++ .reg_bits = RTL8231_BITS_REG, ++ .volatile_reg = rtl8231_volatile_reg, ++ .max_register = RTL8231_REG_COUNT - 1, ++ .use_single_read = true, ++ .use_single_write = true, ++ .reg_format_endian = REGMAP_ENDIAN_BIG, ++ .val_format_endian = REGMAP_ENDIAN_BIG, ++ /* Cannot use REGCACHE_FLAT because it's not smart enough about cache invalidation */ ++ .cache_type = REGCACHE_RBTREE, ++}; ++ ++static int rtl8231_mdio_probe(struct mdio_device *mdiodev) ++{ ++ struct device *dev = &mdiodev->dev; ++ struct regmap_field *led_start; ++ struct regmap *map; ++ int err; ++ ++ map = devm_regmap_init_mdio(mdiodev, &rtl8231_mdio_regmap_config); ++ if (IS_ERR(map)) { ++ dev_err(dev, "failed to init regmap\n"); ++ return PTR_ERR(map); ++ } ++ ++ led_start = devm_regmap_field_alloc(dev, map, RTL8231_FIELD_LED_START); ++ if (IS_ERR(led_start)) ++ return PTR_ERR(led_start); ++ ++ dev_set_drvdata(dev, led_start); ++ ++ mdiodev->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); ++ if (IS_ERR(mdiodev->reset_gpio)) ++ return PTR_ERR(mdiodev->reset_gpio); ++ ++ device_property_read_u32(dev, "reset-assert-delay", &mdiodev->reset_assert_delay); ++ device_property_read_u32(dev, "reset-deassert-delay", &mdiodev->reset_deassert_delay); ++ ++ err = rtl8231_init(dev, map); ++ if (err) ++ return err; ++ ++ return devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO, rtl8231_cells, ++ ARRAY_SIZE(rtl8231_cells), NULL, 0, NULL); ++} ++ ++__maybe_unused static int rtl8231_suspend(struct device *dev) ++{ ++ struct regmap_field *led_start = dev_get_drvdata(dev); ++ ++ return regmap_field_force_write(led_start, 0); ++} ++ ++__maybe_unused static int rtl8231_resume(struct device *dev) ++{ ++ struct regmap_field *led_start = dev_get_drvdata(dev); ++ ++ return regmap_field_force_write(led_start, 1); ++} ++ ++static SIMPLE_DEV_PM_OPS(rtl8231_pm_ops, rtl8231_suspend, rtl8231_resume); ++ ++static const struct of_device_id rtl8231_of_match[] = { ++ { .compatible = "realtek,rtl8231" }, ++ {} ++}; ++MODULE_DEVICE_TABLE(of, rtl8231_of_match); ++ ++static struct mdio_driver rtl8231_mdio_driver = { ++ .mdiodrv.driver = { ++ .name = "rtl8231-expander", ++ .of_match_table = rtl8231_of_match, ++ .pm = pm_ptr(&rtl8231_pm_ops), ++ }, ++ .probe = rtl8231_mdio_probe, ++}; ++mdio_module_driver(rtl8231_mdio_driver); ++ ++MODULE_AUTHOR("Sander Vanheule "); ++MODULE_DESCRIPTION("Realtek RTL8231 GPIO and LED expander"); ++MODULE_LICENSE("GPL"); +--- /dev/null ++++ b/include/linux/mfd/rtl8231.h +@@ -0,0 +1,71 @@ ++/* SPDX-License-Identifier: GPL-2.0-or-later */ ++/* ++ * Register definitions the RTL8231 GPIO and LED expander chip ++ */ ++ ++#ifndef __LINUX_MFD_RTL8231_H ++#define __LINUX_MFD_RTL8231_H ++ ++#include ++ ++/* ++ * Registers addresses are 5 bit, values are 16 bit ++ * Also define a duplicated range of virtual addresses, to enable ++ * different read/write behaviour on the GPIO data registers ++ */ ++#define RTL8231_BITS_VAL 16 ++#define RTL8231_BITS_REG 5 ++ ++/* Chip control */ ++#define RTL8231_REG_FUNC0 0x00 ++#define RTL8231_FUNC0_SCAN_MODE BIT(0) ++#define RTL8231_FUNC0_SCAN_SINGLE 0 ++#define RTL8231_FUNC0_SCAN_BICOLOR BIT(0) ++ ++#define RTL8231_REG_FUNC1 0x01 ++#define RTL8231_FUNC1_READY_CODE_VALUE 0x37 ++#define RTL8231_FUNC1_READY_CODE_MASK GENMASK(9, 4) ++#define RTL8231_FUNC1_DEBOUNCE_MASK GENMASK(15, 10) ++ ++/* Pin control */ ++#define RTL8231_REG_PIN_MODE0 0x02 ++#define RTL8231_REG_PIN_MODE1 0x03 ++ ++#define RTL8231_PIN_MODE_LED 0 ++#define RTL8231_PIN_MODE_GPIO 1 ++ ++/* Pin high config: pin and GPIO control for pins 32-26 */ ++#define RTL8231_REG_PIN_HI_CFG 0x04 ++#define RTL8231_PIN_HI_CFG_MODE_MASK GENMASK(4, 0) ++#define RTL8231_PIN_HI_CFG_DIR_MASK GENMASK(9, 5) ++#define RTL8231_PIN_HI_CFG_INV_MASK GENMASK(14, 10) ++#define RTL8231_PIN_HI_CFG_SOFT_RESET BIT(15) ++ ++/* GPIO control registers */ ++#define RTL8231_REG_GPIO_DIR0 0x05 ++#define RTL8231_REG_GPIO_DIR1 0x06 ++#define RTL8231_REG_GPIO_INVERT0 0x07 ++#define RTL8231_REG_GPIO_INVERT1 0x08 ++ ++#define RTL8231_GPIO_DIR_IN 1 ++#define RTL8231_GPIO_DIR_OUT 0 ++ ++/* ++ * GPIO data registers ++ * Only the output data can be written to these registers, and only the input ++ * data can be read. ++ */ ++#define RTL8231_REG_GPIO_DATA0 0x1c ++#define RTL8231_REG_GPIO_DATA1 0x1d ++#define RTL8231_REG_GPIO_DATA2 0x1e ++#define RTL8231_PIN_HI_DATA_MASK GENMASK(4, 0) ++ ++/* LED control base registers */ ++#define RTL8231_REG_LED0_BASE 0x09 ++#define RTL8231_REG_LED1_BASE 0x10 ++#define RTL8231_REG_LED2_BASE 0x17 ++#define RTL8231_REG_LED_END 0x1b ++ ++#define RTL8231_REG_COUNT 0x1f ++ ++#endif /* __LINUX_MFD_RTL8231_H */ diff --git a/target/linux/realtek/patches-6.6/803-pinctrl-Add-RTL8231-pin-control-and-GPIO-support.patch b/target/linux/realtek/patches-6.6/803-pinctrl-Add-RTL8231-pin-control-and-GPIO-support.patch new file mode 100644 index 00000000000..de0f5ee8684 --- /dev/null +++ b/target/linux/realtek/patches-6.6/803-pinctrl-Add-RTL8231-pin-control-and-GPIO-support.patch @@ -0,0 +1,581 @@ +From 098324288a63a6dcc44e96cc381aef3d5c48d89e Mon Sep 17 00:00:00 2001 +From: Sander Vanheule +Date: Mon, 10 May 2021 22:15:31 +0200 +Subject: [PATCH] pinctrl: Add RTL8231 pin control and GPIO support + +This driver implements the GPIO and pin muxing features provided by the +RTL8231. The device should be instantiated as an MFD child, where the +parent device has already configured the regmap used for register +access. + +Debouncing is only available for the six highest GPIOs, and must be +emulated when other pins are used for (button) inputs. Although +described in the bindings, drive strength selection is currently not +implemented. + +Signed-off-by: Sander Vanheule +--- + drivers/pinctrl/Kconfig | 11 + + drivers/pinctrl/Makefile | 1 + + drivers/pinctrl/pinctrl-rtl8231.c | 521 ++++++++++++++++++++++++++++++ + 3 files changed, 533 insertions(+) + create mode 100644 drivers/pinctrl/pinctrl-rtl8231.c + +--- a/drivers/pinctrl/Kconfig ++++ b/drivers/pinctrl/Kconfig +@@ -417,6 +417,17 @@ config PINCTRL_ROCKCHIP + help + This support pinctrl and GPIO driver for Rockchip SoCs. + ++config PINCTRL_RTL8231 ++ tristate "Realtek RTL8231 GPIO expander's pin controller" ++ depends on MFD_RTL8231 ++ default MFD_RTL8231 ++ select GPIO_REGMAP ++ select GENERIC_PINCONF ++ select GENERIC_PINMUX_FUNCTIONS ++ help ++ Support for RTL8231 expander's GPIOs and pin controller. ++ When built as a module, the module will be called pinctrl-rtl8231. ++ + config PINCTRL_SINGLE + tristate "One-register-per-pin type device tree based pinctrl driver" + depends on OF +--- a/drivers/pinctrl/Makefile ++++ b/drivers/pinctrl/Makefile +@@ -43,6 +43,7 @@ obj-$(CONFIG_PINCTRL_PIC32) += pinctrl-p + obj-$(CONFIG_PINCTRL_PISTACHIO) += pinctrl-pistachio.o + obj-$(CONFIG_PINCTRL_RK805) += pinctrl-rk805.o + obj-$(CONFIG_PINCTRL_ROCKCHIP) += pinctrl-rockchip.o ++obj-$(CONFIG_PINCTRL_RTL8231) += pinctrl-rtl8231.o + obj-$(CONFIG_PINCTRL_SINGLE) += pinctrl-single.o + obj-$(CONFIG_PINCTRL_ST) += pinctrl-st.o + obj-$(CONFIG_PINCTRL_STMFX) += pinctrl-stmfx.o +--- /dev/null ++++ b/drivers/pinctrl/pinctrl-rtl8231.c +@@ -0,0 +1,525 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "core.h" ++#include "pinmux.h" ++#include ++ ++#define RTL8231_NUM_GPIOS 37 ++#define RTL8231_DEBOUNCE_USEC 100000 ++#define RTL8231_DEBOUNCE_MIN_OFFSET 31 ++ ++struct rtl8231_pin_ctrl { ++ struct pinctrl_desc pctl_desc; ++ struct regmap *map; ++}; ++ ++/* ++ * Pin controller functionality ++ */ ++static const char * const rtl8231_pin_function_names[] = { ++ "gpio", ++ "led", ++ "pwm", ++}; ++ ++enum rtl8231_pin_function { ++ RTL8231_PIN_FUNCTION_GPIO = BIT(0), ++ RTL8231_PIN_FUNCTION_LED = BIT(1), ++ RTL8231_PIN_FUNCTION_PWM = BIT(2), ++}; ++ ++struct rtl8231_pin_desc { ++ const enum rtl8231_pin_function functions; ++ const u8 reg; ++ const u8 offset; ++ const u8 gpio_function_value; ++}; ++ ++#define RTL8231_PIN_DESC(_num, _func, _reg, _fld, _val) \ ++ [_num] = { \ ++ .functions = RTL8231_PIN_FUNCTION_GPIO | _func, \ ++ .reg = _reg, \ ++ .offset = _fld, \ ++ .gpio_function_value = _val, \ ++ } ++#define RTL8231_GPIO_PIN_DESC(_num, _reg, _fld) \ ++ RTL8231_PIN_DESC(_num, 0, _reg, _fld, RTL8231_PIN_MODE_GPIO) ++#define RTL8231_LED_PIN_DESC(_num, _reg, _fld) \ ++ RTL8231_PIN_DESC(_num, RTL8231_PIN_FUNCTION_LED, _reg, _fld, RTL8231_PIN_MODE_GPIO) ++#define RTL8231_PWM_PIN_DESC(_num, _reg, _fld) \ ++ RTL8231_PIN_DESC(_num, RTL8231_PIN_FUNCTION_PWM, _reg, _fld, 0) ++ ++/* ++ * All pins have a GPIO/LED mux bit, but the bits for pins 35/36 are read-only. Use this bit ++ * for the GPIO-only pin instead of a placeholder, so the rest of the logic can stay generic. ++ */ ++static struct rtl8231_pin_desc rtl8231_pin_data[RTL8231_NUM_GPIOS] = { ++ RTL8231_LED_PIN_DESC(0, RTL8231_REG_PIN_MODE0, 0), ++ RTL8231_LED_PIN_DESC(1, RTL8231_REG_PIN_MODE0, 1), ++ RTL8231_LED_PIN_DESC(2, RTL8231_REG_PIN_MODE0, 2), ++ RTL8231_LED_PIN_DESC(3, RTL8231_REG_PIN_MODE0, 3), ++ RTL8231_LED_PIN_DESC(4, RTL8231_REG_PIN_MODE0, 4), ++ RTL8231_LED_PIN_DESC(5, RTL8231_REG_PIN_MODE0, 5), ++ RTL8231_LED_PIN_DESC(6, RTL8231_REG_PIN_MODE0, 6), ++ RTL8231_LED_PIN_DESC(7, RTL8231_REG_PIN_MODE0, 7), ++ RTL8231_LED_PIN_DESC(8, RTL8231_REG_PIN_MODE0, 8), ++ RTL8231_LED_PIN_DESC(9, RTL8231_REG_PIN_MODE0, 9), ++ RTL8231_LED_PIN_DESC(10, RTL8231_REG_PIN_MODE0, 10), ++ RTL8231_LED_PIN_DESC(11, RTL8231_REG_PIN_MODE0, 11), ++ RTL8231_LED_PIN_DESC(12, RTL8231_REG_PIN_MODE0, 12), ++ RTL8231_LED_PIN_DESC(13, RTL8231_REG_PIN_MODE0, 13), ++ RTL8231_LED_PIN_DESC(14, RTL8231_REG_PIN_MODE0, 14), ++ RTL8231_LED_PIN_DESC(15, RTL8231_REG_PIN_MODE0, 15), ++ RTL8231_LED_PIN_DESC(16, RTL8231_REG_PIN_MODE1, 0), ++ RTL8231_LED_PIN_DESC(17, RTL8231_REG_PIN_MODE1, 1), ++ RTL8231_LED_PIN_DESC(18, RTL8231_REG_PIN_MODE1, 2), ++ RTL8231_LED_PIN_DESC(19, RTL8231_REG_PIN_MODE1, 3), ++ RTL8231_LED_PIN_DESC(20, RTL8231_REG_PIN_MODE1, 4), ++ RTL8231_LED_PIN_DESC(21, RTL8231_REG_PIN_MODE1, 5), ++ RTL8231_LED_PIN_DESC(22, RTL8231_REG_PIN_MODE1, 6), ++ RTL8231_LED_PIN_DESC(23, RTL8231_REG_PIN_MODE1, 7), ++ RTL8231_LED_PIN_DESC(24, RTL8231_REG_PIN_MODE1, 8), ++ RTL8231_LED_PIN_DESC(25, RTL8231_REG_PIN_MODE1, 9), ++ RTL8231_LED_PIN_DESC(26, RTL8231_REG_PIN_MODE1, 10), ++ RTL8231_LED_PIN_DESC(27, RTL8231_REG_PIN_MODE1, 11), ++ RTL8231_LED_PIN_DESC(28, RTL8231_REG_PIN_MODE1, 12), ++ RTL8231_LED_PIN_DESC(29, RTL8231_REG_PIN_MODE1, 13), ++ RTL8231_LED_PIN_DESC(30, RTL8231_REG_PIN_MODE1, 14), ++ RTL8231_LED_PIN_DESC(31, RTL8231_REG_PIN_MODE1, 15), ++ RTL8231_LED_PIN_DESC(32, RTL8231_REG_PIN_HI_CFG, 0), ++ RTL8231_LED_PIN_DESC(33, RTL8231_REG_PIN_HI_CFG, 1), ++ RTL8231_LED_PIN_DESC(34, RTL8231_REG_PIN_HI_CFG, 2), ++ RTL8231_PWM_PIN_DESC(35, RTL8231_REG_FUNC1, 3), ++ RTL8231_GPIO_PIN_DESC(36, RTL8231_REG_PIN_HI_CFG, 4), ++}; ++ ++#define RTL8231_PIN(_num) \ ++ { \ ++ .number = _num, \ ++ .name = "gpio" #_num, \ ++ .drv_data = &rtl8231_pin_data[_num] \ ++ } ++ ++static const struct pinctrl_pin_desc rtl8231_pins[RTL8231_NUM_GPIOS] = { ++ RTL8231_PIN(0), ++ RTL8231_PIN(1), ++ RTL8231_PIN(2), ++ RTL8231_PIN(3), ++ RTL8231_PIN(4), ++ RTL8231_PIN(5), ++ RTL8231_PIN(6), ++ RTL8231_PIN(7), ++ RTL8231_PIN(8), ++ RTL8231_PIN(9), ++ RTL8231_PIN(10), ++ RTL8231_PIN(11), ++ RTL8231_PIN(12), ++ RTL8231_PIN(13), ++ RTL8231_PIN(14), ++ RTL8231_PIN(15), ++ RTL8231_PIN(16), ++ RTL8231_PIN(17), ++ RTL8231_PIN(18), ++ RTL8231_PIN(19), ++ RTL8231_PIN(20), ++ RTL8231_PIN(21), ++ RTL8231_PIN(22), ++ RTL8231_PIN(23), ++ RTL8231_PIN(24), ++ RTL8231_PIN(25), ++ RTL8231_PIN(26), ++ RTL8231_PIN(27), ++ RTL8231_PIN(28), ++ RTL8231_PIN(29), ++ RTL8231_PIN(30), ++ RTL8231_PIN(31), ++ RTL8231_PIN(32), ++ RTL8231_PIN(33), ++ RTL8231_PIN(34), ++ RTL8231_PIN(35), ++ RTL8231_PIN(36), ++}; ++ ++static int rtl8231_get_groups_count(struct pinctrl_dev *pctldev) ++{ ++ return ARRAY_SIZE(rtl8231_pins); ++} ++ ++static const char *rtl8231_get_group_name(struct pinctrl_dev *pctldev, unsigned int selector) ++{ ++ return rtl8231_pins[selector].name; ++} ++ ++static int rtl8231_get_group_pins(struct pinctrl_dev *pctldev, unsigned int selector, ++ const unsigned int **pins, unsigned int *num_pins) ++{ ++ if (selector >= ARRAY_SIZE(rtl8231_pins)) ++ return -EINVAL; ++ ++ *pins = &rtl8231_pins[selector].number; ++ *num_pins = 1; ++ ++ return 0; ++} ++ ++static const struct pinctrl_ops rtl8231_pinctrl_ops = { ++ .get_groups_count = rtl8231_get_groups_count, ++ .get_group_name = rtl8231_get_group_name, ++ .get_group_pins = rtl8231_get_group_pins, ++ .dt_node_to_map = pinconf_generic_dt_node_to_map_all, ++ .dt_free_map = pinconf_generic_dt_free_map, ++}; ++ ++static int rtl8231_set_mux(struct pinctrl_dev *pctldev, unsigned int func_selector, ++ unsigned int group_selector) ++{ ++ const struct function_desc *func = pinmux_generic_get_function(pctldev, func_selector); ++ const struct rtl8231_pin_desc *desc = rtl8231_pins[group_selector].drv_data; ++ const struct rtl8231_pin_ctrl *ctrl = pinctrl_dev_get_drvdata(pctldev); ++ unsigned int func_flag = (uintptr_t) func->data; ++ unsigned int function_mask; ++ unsigned int gpio_function; ++ ++ if (!(desc->functions & func_flag)) ++ return -EINVAL; ++ ++ function_mask = BIT(desc->offset); ++ gpio_function = desc->gpio_function_value << desc->offset; ++ ++ if (func_flag == RTL8231_PIN_FUNCTION_GPIO) ++ return regmap_update_bits(ctrl->map, desc->reg, function_mask, gpio_function); ++ else ++ return regmap_update_bits(ctrl->map, desc->reg, function_mask, ~gpio_function); ++} ++ ++static int rtl8231_gpio_request_enable(struct pinctrl_dev *pctldev, ++ struct pinctrl_gpio_range *range, unsigned int offset) ++{ ++ const struct rtl8231_pin_desc *desc = rtl8231_pins[offset].drv_data; ++ struct rtl8231_pin_ctrl *ctrl = pinctrl_dev_get_drvdata(pctldev); ++ unsigned int function_mask; ++ unsigned int gpio_function; ++ ++ function_mask = BIT(desc->offset); ++ gpio_function = desc->gpio_function_value << desc->offset; ++ ++ return regmap_update_bits(ctrl->map, desc->reg, function_mask, gpio_function); ++} ++ ++static const struct pinmux_ops rtl8231_pinmux_ops = { ++ .get_functions_count = pinmux_generic_get_function_count, ++ .get_function_name = pinmux_generic_get_function_name, ++ .get_function_groups = pinmux_generic_get_function_groups, ++ .set_mux = rtl8231_set_mux, ++ .gpio_request_enable = rtl8231_gpio_request_enable, ++ .strict = true, ++}; ++ ++static int rtl8231_pin_config_get(struct pinctrl_dev *pctldev, unsigned int offset, ++ unsigned long *config) ++{ ++ struct rtl8231_pin_ctrl *ctrl = pinctrl_dev_get_drvdata(pctldev); ++ unsigned int param = pinconf_to_config_param(*config); ++ unsigned int arg; ++ int err; ++ int v; ++ ++ switch (param) { ++ case PIN_CONFIG_INPUT_DEBOUNCE: ++ if (offset < RTL8231_DEBOUNCE_MIN_OFFSET) ++ return -EINVAL; ++ ++ err = regmap_read(ctrl->map, RTL8231_REG_FUNC1, &v); ++ if (err) ++ return err; ++ ++ v = FIELD_GET(RTL8231_FUNC1_DEBOUNCE_MASK, v); ++ if (v & BIT(offset - RTL8231_DEBOUNCE_MIN_OFFSET)) ++ arg = RTL8231_DEBOUNCE_USEC; ++ else ++ arg = 0; ++ break; ++ default: ++ return -ENOTSUPP; ++ } ++ ++ *config = pinconf_to_config_packed(param, arg); ++ ++ return 0; ++} ++ ++static int rtl8231_pin_config_set(struct pinctrl_dev *pctldev, unsigned int offset, ++ unsigned long *configs, unsigned int num_configs) ++{ ++ struct rtl8231_pin_ctrl *ctrl = pinctrl_dev_get_drvdata(pctldev); ++ unsigned int param, arg; ++ unsigned int pin_mask; ++ int err; ++ int i; ++ ++ for (i = 0; i < num_configs; i++) { ++ param = pinconf_to_config_param(configs[i]); ++ arg = pinconf_to_config_argument(configs[i]); ++ ++ switch (param) { ++ case PIN_CONFIG_INPUT_DEBOUNCE: ++ if (offset < RTL8231_DEBOUNCE_MIN_OFFSET) ++ return -EINVAL; ++ ++ pin_mask = FIELD_PREP(RTL8231_FUNC1_DEBOUNCE_MASK, ++ BIT(offset - RTL8231_DEBOUNCE_MIN_OFFSET)); ++ ++ switch (arg) { ++ case 0: ++ err = regmap_update_bits(ctrl->map, RTL8231_REG_FUNC1, ++ pin_mask, 0); ++ break; ++ case RTL8231_DEBOUNCE_USEC: ++ err = regmap_update_bits(ctrl->map, RTL8231_REG_FUNC1, ++ pin_mask, pin_mask); ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ break; ++ default: ++ return -ENOTSUPP; ++ } ++ } ++ ++ return err; ++} ++ ++static const struct pinconf_ops rtl8231_pinconf_ops = { ++ .is_generic = true, ++ .pin_config_get = rtl8231_pin_config_get, ++ .pin_config_set = rtl8231_pin_config_set, ++}; ++ ++static int rtl8231_pinctrl_init_functions(struct pinctrl_dev *pctl, struct rtl8231_pin_ctrl *ctrl) ++{ ++ const char *function_name; ++ const char **groups; ++ unsigned int f_idx; ++ unsigned int pin; ++ int num_groups; ++ int err; ++ ++ for (f_idx = 0; f_idx < ARRAY_SIZE(rtl8231_pin_function_names); f_idx++) { ++ function_name = rtl8231_pin_function_names[f_idx]; ++ ++ for (pin = 0, num_groups = 0; pin < ctrl->pctl_desc.npins; pin++) ++ if (rtl8231_pin_data[pin].functions & BIT(f_idx)) ++ num_groups++; ++ ++ groups = devm_kcalloc(pctl->dev, num_groups, sizeof(*groups), GFP_KERNEL); ++ if (!groups) ++ return -ENOMEM; ++ ++ for (pin = 0, num_groups = 0; pin < ctrl->pctl_desc.npins; pin++) ++ if (rtl8231_pin_data[pin].functions & BIT(f_idx)) ++ groups[num_groups++] = rtl8231_pins[pin].name; ++ ++ err = pinmux_generic_add_function(pctl, function_name, groups, num_groups, ++ (void *) BIT(f_idx)); ++ if (err < 0) ++ return err; ++ } ++ ++ return 0; ++} ++ ++struct pin_field_info { ++ const struct reg_field gpio_data; ++ const struct reg_field gpio_dir; ++ const struct reg_field mode; ++}; ++ ++static const struct pin_field_info pin_fields[] = { ++ { ++ .gpio_data = REG_FIELD(RTL8231_REG_GPIO_DATA0, 0, 15), ++ .gpio_dir = REG_FIELD(RTL8231_REG_GPIO_DIR0, 0, 15), ++ .mode = REG_FIELD(RTL8231_REG_PIN_MODE0, 0, 15), ++ }, ++ { ++ .gpio_data = REG_FIELD(RTL8231_REG_GPIO_DATA1, 0, 15), ++ .gpio_dir = REG_FIELD(RTL8231_REG_GPIO_DIR1, 0, 15), ++ .mode = REG_FIELD(RTL8231_REG_PIN_MODE1, 0, 15), ++ }, ++ { ++ .gpio_data = REG_FIELD(RTL8231_REG_GPIO_DATA2, 0, 4), ++ .gpio_dir = REG_FIELD(RTL8231_REG_PIN_HI_CFG, 5, 9), ++ .mode = REG_FIELD(RTL8231_REG_PIN_HI_CFG, 0, 4), ++ }, ++}; ++ ++static int rtl8231_configure_safe(struct device *dev, struct regmap *map) ++{ ++ struct regmap_field *field_data; ++ struct regmap_field *field_mode; ++ struct regmap_field *field_dir; ++ unsigned int is_output; ++ unsigned int is_gpio; ++ unsigned int data; ++ unsigned int mode; ++ unsigned int dir; ++ int err; ++ ++ for (unsigned int i = 0; i < ARRAY_SIZE(pin_fields); i++) { ++ field_data = devm_regmap_field_alloc(dev, map, pin_fields[i].gpio_data); ++ if (IS_ERR(field_data)) ++ return PTR_ERR(field_data); ++ ++ field_dir = devm_regmap_field_alloc(dev, map, pin_fields[i].gpio_dir); ++ if (IS_ERR(field_dir)) ++ return PTR_ERR(field_dir); ++ ++ field_mode = devm_regmap_field_alloc(dev, map, pin_fields[i].mode); ++ if (IS_ERR(field_mode)) ++ return PTR_ERR(field_mode); ++ ++ /* The register cache is invalid at start-up, so this should read from HW */ ++ err = regmap_field_read(field_data, &data); ++ if (err) ++ return err; ++ ++ err = regmap_field_read(field_dir, &dir); ++ if (err) ++ return err; ++ ++ err = regmap_field_read(field_mode, &mode); ++ if (err) ++ return err; ++ ++ /* Write back only the GPIO-out values to fix the cache */ ++ data &= ~dir; ++ regmap_field_write(field_data, data); ++ ++ /* ++ * Set every pin that is configured as gpio-output but muxed for the alternative ++ * (LED) function to gpio-in. That way the pin will be high impedance when it is ++ * muxed to GPIO, preventing unwanted glitches. ++ * The pin muxes are left as-is, so there are no signal changes. ++ */ ++ is_gpio = mode; ++ is_output = ~dir; ++ regmap_field_write(field_dir, dir | (~is_gpio & is_output)); ++ ++ devm_regmap_field_free(dev, field_data); ++ devm_regmap_field_free(dev, field_dir); ++ devm_regmap_field_free(dev, field_mode); ++ } ++ ++ return 0; ++} ++ ++static int rtl8231_pinctrl_init(struct device *dev, struct rtl8231_pin_ctrl *ctrl) ++{ ++ struct pinctrl_dev *pctldev; ++ int err; ++ ++ ctrl->pctl_desc.name = "rtl8231-pinctrl"; ++ ctrl->pctl_desc.owner = THIS_MODULE; ++ ctrl->pctl_desc.confops = &rtl8231_pinconf_ops; ++ ctrl->pctl_desc.pctlops = &rtl8231_pinctrl_ops; ++ ctrl->pctl_desc.pmxops = &rtl8231_pinmux_ops; ++ ctrl->pctl_desc.npins = ARRAY_SIZE(rtl8231_pins); ++ ctrl->pctl_desc.pins = rtl8231_pins; ++ ++ err = devm_pinctrl_register_and_init(dev->parent, &ctrl->pctl_desc, ctrl, &pctldev); ++ if (err) { ++ dev_err(dev, "failed to register pin controller\n"); ++ return err; ++ } ++ ++ err = rtl8231_pinctrl_init_functions(pctldev, ctrl); ++ if (err) ++ return err; ++ ++ err = pinctrl_enable(pctldev); ++ if (err) ++ dev_err(dev, "failed to enable pin controller\n"); ++ ++ return err; ++} ++ ++/* ++ * GPIO controller functionality ++ */ ++static int rtl8231_gpio_reg_mask_xlate(struct gpio_regmap *gpio, unsigned int base, ++ unsigned int offset, unsigned int *reg, unsigned int *mask) ++{ ++ unsigned int pin_mask = BIT(offset % RTL8231_BITS_VAL); ++ ++ if (base == RTL8231_REG_GPIO_DATA0 || offset < 32) { ++ *reg = base + offset / RTL8231_BITS_VAL; ++ *mask = pin_mask; ++ } else if (base == RTL8231_REG_GPIO_DIR0) { ++ *reg = RTL8231_REG_PIN_HI_CFG; ++ *mask = FIELD_PREP(RTL8231_PIN_HI_CFG_DIR_MASK, pin_mask); ++ } else { ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static int rtl8231_pinctrl_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct rtl8231_pin_ctrl *ctrl; ++ struct gpio_regmap_config gpio_cfg = {}; ++ int err; ++ ++ ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); ++ if (!ctrl) ++ return -ENOMEM; ++ ++ ctrl->map = dev_get_regmap(dev->parent, NULL); ++ if (!ctrl->map) ++ return -ENODEV; ++ ++ err = rtl8231_configure_safe(dev, ctrl->map); ++ if (err) ++ return err; ++ ++ err = rtl8231_pinctrl_init(dev, ctrl); ++ if (err) ++ return err; ++ ++ gpio_cfg.regmap = ctrl->map; ++ gpio_cfg.parent = dev->parent; ++ gpio_cfg.ngpio = RTL8231_NUM_GPIOS; ++ gpio_cfg.ngpio_per_reg = RTL8231_BITS_VAL; ++ ++ gpio_cfg.reg_dat_base = GPIO_REGMAP_ADDR(RTL8231_REG_GPIO_DATA0); ++ gpio_cfg.reg_set_base = GPIO_REGMAP_ADDR(RTL8231_REG_GPIO_DATA0); ++ gpio_cfg.reg_dir_in_base = GPIO_REGMAP_ADDR(RTL8231_REG_GPIO_DIR0); ++ ++ gpio_cfg.reg_mask_xlate = rtl8231_gpio_reg_mask_xlate; ++ ++ return PTR_ERR_OR_ZERO(devm_gpio_regmap_register(dev, &gpio_cfg)); ++} ++ ++static struct platform_driver rtl8231_pinctrl_driver = { ++ .driver = { ++ .name = "rtl8231-pinctrl", ++ }, ++ .probe = rtl8231_pinctrl_probe, ++}; ++module_platform_driver(rtl8231_pinctrl_driver); ++ ++MODULE_AUTHOR("Sander Vanheule "); ++MODULE_DESCRIPTION("Realtek RTL8231 pin control and GPIO support"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/realtek/patches-6.6/804-leds-Add-support-for-RTL8231-LED-scan-matrix.patch b/target/linux/realtek/patches-6.6/804-leds-Add-support-for-RTL8231-LED-scan-matrix.patch new file mode 100644 index 00000000000..37542b82303 --- /dev/null +++ b/target/linux/realtek/patches-6.6/804-leds-Add-support-for-RTL8231-LED-scan-matrix.patch @@ -0,0 +1,338 @@ +From 6b797a97c007e46d6081fc6f4b41ce8407078605 Mon Sep 17 00:00:00 2001 +From: Sander Vanheule +Date: Mon, 10 May 2021 22:16:11 +0200 +Subject: [PATCH] leds: Add support for RTL8231 LED scan matrix + +Both single and bi-color scanning modes are supported. The driver will +verify that the addresses are valid for the current mode, before +registering the LEDs. LEDs can be turned on, off, or toggled at one of +six predefined rates from 40ms to 1280ms. + +Implements a platform device for use as a child device with RTL8231 MFD, +and uses the parent regmap to access the required registers. + +Signed-off-by: Sander Vanheule +--- + drivers/leds/Kconfig | 10 ++ + drivers/leds/Makefile | 1 + + drivers/leds/leds-rtl8231.c | 291 ++++++++++++++++++++++++++++++++++++ + 3 files changed, 302 insertions(+) + create mode 100644 drivers/leds/leds-rtl8231.c + +--- a/drivers/leds/Kconfig ++++ b/drivers/leds/Kconfig +@@ -586,6 +586,16 @@ config LEDS_REGULATOR + help + This option enables support for regulator driven LEDs. + ++config LEDS_RTL8231 ++ tristate "RTL8231 LED matrix support" ++ depends on LEDS_CLASS ++ depends on MFD_RTL8231 ++ default MFD_RTL8231 ++ help ++ This option enables support for using the LED scanning matrix output ++ of the RTL8231 GPIO and LED expander chip. ++ When built as a module, this module will be named leds-rtl8231. ++ + config LEDS_BD2606MVV + tristate "LED driver for BD2606MVV" + depends on LEDS_CLASS +--- a/drivers/leds/Makefile ++++ b/drivers/leds/Makefile +@@ -77,6 +77,7 @@ obj-$(CONFIG_LEDS_PM8058) += leds-pm805 + obj-$(CONFIG_LEDS_POWERNV) += leds-powernv.o + obj-$(CONFIG_LEDS_PWM) += leds-pwm.o + obj-$(CONFIG_LEDS_REGULATOR) += leds-regulator.o ++obj-$(CONFIG_LEDS_RTL8231) += leds-rtl8231.o + obj-$(CONFIG_LEDS_SC27XX_BLTC) += leds-sc27xx-bltc.o + obj-$(CONFIG_LEDS_ST1202) += leds-st1202.o + obj-$(CONFIG_LEDS_SUNFIRE) += leds-sunfire.o +--- /dev/null ++++ b/drivers/leds/leds-rtl8231.c +@@ -0,0 +1,285 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++/** ++ * struct led_toggle_rate - description of an LED blinking mode ++ * @interval_ms: LED toggle rate in milliseconds ++ * @mode: Register field value used to activate this mode ++ * ++ * For LED hardware accelerated blinking, with equal on and off delay. ++ * Both delays are given by @interval, so the interval at which the LED blinks ++ * (i.e. turn on and off once) is double this value. ++ */ ++struct led_toggle_rate { ++ u16 interval_ms; ++ u8 mode; ++}; ++ ++/** ++ * struct led_modes - description of all LED modes ++ * @toggle_rates: Array of led_toggle_rate values, sorted by ascending interval ++ * @num_toggle_rates: Number of elements in @led_toggle_rate ++ * @off: Register field value to turn LED off ++ * @on: Register field value to turn LED on ++ */ ++struct led_modes { ++ const struct led_toggle_rate *toggle_rates; ++ unsigned int num_toggle_rates; ++ u8 off; ++ u8 on; ++}; ++ ++struct rtl8231_led { ++ struct led_classdev led; ++ const struct led_modes *modes; ++ struct regmap_field *reg_field; ++}; ++#define to_rtl8231_led(_cdev) container_of(_cdev, struct rtl8231_led, led) ++ ++#define RTL8231_NUM_LEDS 3 ++#define RTL8231_LED_PER_REG 5 ++#define RTL8231_BITS_PER_LED 3 ++ ++static const unsigned int rtl8231_led_port_counts_single[RTL8231_NUM_LEDS] = {32, 32, 24}; ++static const unsigned int rtl8231_led_port_counts_bicolor[RTL8231_NUM_LEDS] = {24, 24, 24}; ++ ++static const unsigned int rtl8231_led_base[RTL8231_NUM_LEDS] = { ++ RTL8231_REG_LED0_BASE, ++ RTL8231_REG_LED1_BASE, ++ RTL8231_REG_LED2_BASE, ++}; ++ ++#define RTL8231_DEFAULT_TOGGLE_INTERVAL_MS 500 ++ ++static const struct led_toggle_rate rtl8231_toggle_rates[] = { ++ { 40, 1}, ++ { 80, 2}, ++ { 160, 3}, ++ { 320, 4}, ++ { 640, 5}, ++ {1280, 6}, ++}; ++ ++static const struct led_modes rtl8231_led_modes = { ++ .off = 0, ++ .on = 7, ++ .num_toggle_rates = ARRAY_SIZE(rtl8231_toggle_rates), ++ .toggle_rates = rtl8231_toggle_rates, ++}; ++ ++static void rtl8231_led_brightness_set(struct led_classdev *led_cdev, ++ enum led_brightness brightness) ++{ ++ struct rtl8231_led *pled = to_rtl8231_led(led_cdev); ++ ++ if (brightness) ++ regmap_field_write(pled->reg_field, pled->modes->on); ++ else ++ regmap_field_write(pled->reg_field, pled->modes->off); ++} ++ ++static enum led_brightness rtl8231_led_brightness_get(struct led_classdev *led_cdev) ++{ ++ struct rtl8231_led *pled = to_rtl8231_led(led_cdev); ++ u32 current_mode = pled->modes->off; ++ ++ regmap_field_read(pled->reg_field, ¤t_mode); ++ ++ if (current_mode == pled->modes->off) ++ return LED_OFF; ++ else ++ return LED_ON; ++} ++ ++static unsigned int rtl8231_led_current_interval(struct rtl8231_led *pled) ++{ ++ unsigned int mode; ++ unsigned int i; ++ ++ if (regmap_field_read(pled->reg_field, &mode)) ++ return 0; ++ ++ for (i = 0; i < pled->modes->num_toggle_rates; i++) ++ if (mode == pled->modes->toggle_rates[i].mode) ++ return pled->modes->toggle_rates[i].interval_ms; ++ ++ return 0; ++} ++ ++static int rtl8231_led_blink_set(struct led_classdev *led_cdev, unsigned long *delay_on, ++ unsigned long *delay_off) ++{ ++ struct rtl8231_led *pled = to_rtl8231_led(led_cdev); ++ const struct led_toggle_rate *rates = pled->modes->toggle_rates; ++ unsigned int num_rates = pled->modes->num_toggle_rates; ++ unsigned int interval_ms; ++ unsigned int i; ++ int err; ++ ++ if (*delay_on == 0 && *delay_off == 0) { ++ interval_ms = RTL8231_DEFAULT_TOGGLE_INTERVAL_MS; ++ } else { ++ /* ++ * If the current mode is blinking, choose the delay that (likely) changed. ++ * Otherwise, choose the interval that would have the same total delay. ++ */ ++ interval_ms = rtl8231_led_current_interval(pled); ++ if (interval_ms > 0 && interval_ms == *delay_off) ++ interval_ms = *delay_on; ++ else if (interval_ms > 0 && interval_ms == *delay_on) ++ interval_ms = *delay_off; ++ else ++ interval_ms = (*delay_on + *delay_off) / 2; ++ } ++ ++ /* Find clamped toggle interval */ ++ for (i = 0; i < (num_rates - 1); i++) ++ if (interval_ms > rates[i].interval_ms) ++ break; ++ ++ interval_ms = rates[i].interval_ms; ++ ++ err = regmap_field_write(pled->reg_field, rates[i].mode); ++ if (err) ++ return err; ++ ++ *delay_on = interval_ms; ++ *delay_off = interval_ms; ++ ++ return 0; ++} ++ ++static int rtl8231_led_read_address(struct fwnode_handle *fwnode, unsigned int *addr_port, ++ unsigned int *addr_led) ++{ ++ u32 addr[2]; ++ int err; ++ ++ err = fwnode_property_count_u32(fwnode, "reg"); ++ if (err < 0) ++ return err; ++ if (err != ARRAY_SIZE(addr)) ++ return -EINVAL; ++ ++ err = fwnode_property_read_u32_array(fwnode, "reg", addr, ARRAY_SIZE(addr)); ++ if (err) ++ return err; ++ ++ *addr_port = addr[0]; ++ *addr_led = addr[1]; ++ ++ return 0; ++} ++ ++static const struct regmap_field *rtl8231_led_get_field(struct device *dev, struct regmap *map, ++ unsigned int port_index, unsigned int led_index) ++{ ++ unsigned int offset = port_index / RTL8231_LED_PER_REG; ++ unsigned int shift = (port_index % RTL8231_LED_PER_REG) * RTL8231_BITS_PER_LED; ++ const struct reg_field field = REG_FIELD(rtl8231_led_base[led_index] + offset, shift, ++ shift + RTL8231_BITS_PER_LED - 1); ++ ++ return devm_regmap_field_alloc(dev, map, field); ++} ++ ++static int rtl8231_led_probe_single(struct device *dev, struct regmap *map, ++ const unsigned int *port_counts, struct fwnode_handle *fwnode) ++{ ++ struct led_init_data init_data = {}; ++ struct rtl8231_led *pled; ++ unsigned int port_index; ++ unsigned int led_index; ++ int err; ++ ++ pled = devm_kzalloc(dev, sizeof(*pled), GFP_KERNEL); ++ if (!pled) ++ return -ENOMEM; ++ ++ err = rtl8231_led_read_address(fwnode, &port_index, &led_index); ++ if (err) { ++ dev_err(dev, "LED address invalid"); ++ return err; ++ } ++ ++ if (led_index >= RTL8231_NUM_LEDS || port_index >= port_counts[led_index]) { ++ dev_err(dev, "LED address (%d.%d) invalid", port_index, led_index); ++ return -EINVAL; ++ } ++ ++ pled->reg_field = rtl8231_led_get_field(dev, map, port_index, led_index); ++ if (IS_ERR(pled->reg_field)) ++ return PTR_ERR(pled->reg_field); ++ ++ pled->modes = &rtl8231_led_modes; ++ ++ pled->led.max_brightness = 1; ++ pled->led.brightness_get = rtl8231_led_brightness_get; ++ pled->led.brightness_set = rtl8231_led_brightness_set; ++ pled->led.blink_set = rtl8231_led_blink_set; ++ ++ init_data.fwnode = fwnode; ++ ++ return devm_led_classdev_register_ext(dev, &pled->led, &init_data); ++} ++ ++static int rtl8231_led_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ const unsigned int *port_counts; ++ struct fwnode_handle *child; ++ struct regmap *map; ++ int err; ++ ++ map = dev_get_regmap(dev->parent, NULL); ++ if (!map) ++ return -ENODEV; ++ ++ if (device_property_match_string(dev, "realtek,led-scan-mode", "single-color") >= 0) { ++ port_counts = rtl8231_led_port_counts_single; ++ regmap_update_bits(map, RTL8231_REG_FUNC0, ++ RTL8231_FUNC0_SCAN_MODE, RTL8231_FUNC0_SCAN_SINGLE); ++ } else if (device_property_match_string(dev, "realtek,led-scan-mode", "bi-color") >= 0) { ++ port_counts = rtl8231_led_port_counts_bicolor; ++ regmap_update_bits(map, RTL8231_REG_FUNC0, ++ RTL8231_FUNC0_SCAN_MODE, RTL8231_FUNC0_SCAN_BICOLOR); ++ } else { ++ dev_err(dev, "scan mode missing or invalid"); ++ return -EINVAL; ++ } ++ ++ fwnode_for_each_available_child_node(dev->fwnode, child) { ++ err = rtl8231_led_probe_single(dev, map, port_counts, child); ++ if (err) ++ dev_warn(dev, "failed to register LED %pfwP", child); ++ } ++ ++ return 0; ++} ++ ++static const struct of_device_id of_rtl8231_led_match[] = { ++ { .compatible = "realtek,rtl8231-leds" }, ++ {} ++}; ++MODULE_DEVICE_TABLE(of, of_rtl8231_led_match); ++ ++static struct platform_driver rtl8231_led_driver = { ++ .driver = { ++ .name = "rtl8231-leds", ++ .of_match_table = of_rtl8231_led_match, ++ }, ++ .probe = rtl8231_led_probe, ++}; ++module_platform_driver(rtl8231_led_driver); ++ ++MODULE_AUTHOR("Sander Vanheule "); ++MODULE_DESCRIPTION("Realtek RTL8231 LED support"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/realtek/rtl838x/config-6.6 b/target/linux/realtek/rtl838x/config-6.6 index 9364888e47b..23f3d9adfb4 100644 --- a/target/linux/realtek/rtl838x/config-6.6 +++ b/target/linux/realtek/rtl838x/config-6.6 @@ -132,6 +132,7 @@ CONFIG_MDIO_DEVRES=y CONFIG_MDIO_I2C=y CONFIG_MDIO_REALTEK_OTTO_AUX=y CONFIG_MDIO_SMBUS=y +# CONFIG_MFD_RTL8231 is not set CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y CONFIG_MIPS=y diff --git a/target/linux/realtek/rtl839x/config-6.6 b/target/linux/realtek/rtl839x/config-6.6 index ebf473db61c..2616286a172 100644 --- a/target/linux/realtek/rtl839x/config-6.6 +++ b/target/linux/realtek/rtl839x/config-6.6 @@ -132,6 +132,7 @@ CONFIG_MDIO_DEVRES=y CONFIG_MDIO_I2C=y # CONFIG_MDIO_REALTEK_OTTO_AUX is not set CONFIG_MDIO_SMBUS=y +# CONFIG_MFD_RTL8231 is not set CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y CONFIG_MIPS=y diff --git a/target/linux/realtek/rtl930x/config-6.6 b/target/linux/realtek/rtl930x/config-6.6 index 35d088fe089..5b070a8371c 100644 --- a/target/linux/realtek/rtl930x/config-6.6 +++ b/target/linux/realtek/rtl930x/config-6.6 @@ -114,6 +114,7 @@ CONFIG_MDIO_DEVRES=y CONFIG_MDIO_I2C=y # CONFIG_MDIO_REALTEK_OTTO_AUX is not set CONFIG_MDIO_SMBUS=y +# CONFIG_MFD_RTL8231 is not set CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y CONFIG_MIPS=y diff --git a/target/linux/realtek/rtl931x/config-6.6 b/target/linux/realtek/rtl931x/config-6.6 index d843382f515..716d805e51f 100644 --- a/target/linux/realtek/rtl931x/config-6.6 +++ b/target/linux/realtek/rtl931x/config-6.6 @@ -122,6 +122,7 @@ CONFIG_MDIO_DEVRES=y CONFIG_MDIO_I2C=y # CONFIG_MDIO_REALTEK_OTTO_AUX is not set CONFIG_MDIO_SMBUS=y +# CONFIG_MFD_RTL8231 is not set CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y CONFIG_MIPS=y From 5141e2d8617efa774b64f9ebc6d97cdc85487dc8 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Thu, 26 Dec 2024 22:26:33 +0100 Subject: [PATCH 089/173] realtek: rtl838x: Switch GS1900 rtl8231 driver Update the devicetree files to switch the GS1900 devices over to the new pinctrl and GPIO driver. Enable the drivers to ensure the nodes can be used. This may fix issues caused by bad RMW behaviour on the GPIO data lines, or glitches due to setting the pin direction before the pin level. Although the driver supports retaining GPIO state after a warm boot, some bootloaders appear to apply a default configuration on boot, which may cause an interrupt in PoE-PSE support. Signed-off-by: Sander Vanheule --- .../realtek/dts/rtl8380_zyxel_gs1900.dtsi | 25 ++++++++++++++++--- target/linux/realtek/rtl838x/config-6.6 | 7 +++++- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi b/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi index 3889fe8859a..927b9527a95 100644 --- a/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi +++ b/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi @@ -40,18 +40,35 @@ gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; }; }; +}; + +&mdio_aux { + status = "okay"; + + // Reset GPIO is <&gpio0 1 GPIO_ACTIVE_LOW> + // Don't specify the reset info so the mdio subsystem doesn't reset the bus + //reset-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + //reset-delay-us = <1000>; + //reset-post-delay-us = <10000>; + + gpio1: expander@0 { + compatible = "realtek,rtl8231"; + reg = <0x0>; - gpio1: rtl8231-gpio { - compatible = "realtek,rtl8231-gpio"; - #gpio-cells = <2>; gpio-controller; - indirect-access-bus-id = <0>; + #gpio-cells = <2>; + gpio-ranges = <&gpio1 0 0 37>; poe_enable { gpio-hog; gpios = <13 GPIO_ACTIVE_HIGH>; output-high; }; + + led-controller { + compatible = "realtek,rtl8231-leds"; + status = "disabled"; + }; }; }; diff --git a/target/linux/realtek/rtl838x/config-6.6 b/target/linux/realtek/rtl838x/config-6.6 index 23f3d9adfb4..58c15f7bb04 100644 --- a/target/linux/realtek/rtl838x/config-6.6 +++ b/target/linux/realtek/rtl838x/config-6.6 @@ -95,6 +95,7 @@ CONFIG_GPIO_GENERIC=y CONFIG_GPIO_PCA953X=y CONFIG_GPIO_PCA953X_IRQ=y CONFIG_GPIO_REALTEK_OTTO=y +CONFIG_GPIO_REGMAP=y CONFIG_GPIO_RTL8231=y CONFIG_GPIO_WATCHDOG=y # CONFIG_GPIO_WATCHDOG_ARCH_INITCALL is not set @@ -122,6 +123,7 @@ CONFIG_IRQ_MIPS_CPU=y CONFIG_IRQ_WORK=y CONFIG_JFFS2_ZLIB=y CONFIG_LEDS_GPIO=y +# CONFIG_LEDS_RTL8231 is not set CONFIG_LIBFDT=y CONFIG_LOCK_DEBUGGING_SUPPORT=y CONFIG_MACH_REALTEK_RTL=y @@ -132,7 +134,8 @@ CONFIG_MDIO_DEVRES=y CONFIG_MDIO_I2C=y CONFIG_MDIO_REALTEK_OTTO_AUX=y CONFIG_MDIO_SMBUS=y -# CONFIG_MFD_RTL8231 is not set +CONFIG_MFD_CORE=y +CONFIG_MFD_RTL8231=y CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y CONFIG_MIPS=y @@ -193,6 +196,7 @@ CONFIG_PHYLIB=y CONFIG_PHYLIB_LEDS=y CONFIG_PHYLINK=y CONFIG_PINCTRL=y +CONFIG_PINCTRL_RTL8231=y CONFIG_PM_OPP=y CONFIG_POWER_RESET=y CONFIG_POWER_RESET_GPIO_RESTART=y @@ -207,6 +211,7 @@ CONFIG_REALTEK_PHY=y CONFIG_REALTEK_SOC_PHY=y CONFIG_REGMAP=y CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_MDIO=y CONFIG_REGMAP_MMIO=y CONFIG_RESET_CONTROLLER=y CONFIG_RTL838X=y From 3deeb7805f69f54b9ab20c0e12f8dd916fec4de1 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Tue, 7 Jan 2025 11:43:36 +0100 Subject: [PATCH 090/173] wifi-scripts: allow per-IF mesh basic rate selection Bringing up a mesh interface using wpa_supplicant already supports a per-VIF basic rate selection. Add the same ability when creating a mesh VIF without wpa_supplicant. Signed-off-by: David Bauer --- .../wifi-scripts/files/lib/netifd/wireless/mac80211.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh index 52c36a8c926..b4aa19bf526 100755 --- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh @@ -844,13 +844,19 @@ mac80211_setup_adhoc() { mac80211_setup_mesh() { json_get_vars ssid mesh_id mcast_rate + json_get_values iface_basic_rate_list basic_rate mcval= [ -n "$mcast_rate" ] && wpa_supplicant_add_rate mcval "$mcast_rate" [ -n "$mesh_id" ] && ssid="$mesh_id" + br_list="$basic_rate_list" + if [ -n "$iface_basic_rate_list" ]; then + br_list="$iface_basic_rate_list" + fi + brstr= - for br in $basic_rate_list; do + for br in $br_list; do wpa_supplicant_add_rate brstr "$br" done From d34697c7e575adb4d24e0e65b8b3abe35b3d020c Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Wed, 8 Jan 2025 16:55:33 +0800 Subject: [PATCH 091/173] uboot-rockchip: bump to 2025.01 Removed upstreamed patches. Signed-off-by: Tianling Shen --- package/boot/uboot-rockchip/Makefile | 4 +- ...se-rng-seed-size-to-make-it-sufficie.patch | 96 ------------------- ...libfdt-i_shipped-Use-SWIG_AppendOutp.patch | 55 ----------- ...llow-rockchip_dnl_key_pressed-in-SPL.patch | 4 +- ...e-PCI-to-discover-network-controller.patch | 51 ---------- ...dd-photonicat-board-watchdog-support.patch | 4 +- 6 files changed, 6 insertions(+), 208 deletions(-) delete mode 100644 package/boot/uboot-rockchip/patches/001-rockchip-board-Increase-rng-seed-size-to-make-it-sufficie.patch delete mode 100644 package/boot/uboot-rockchip/patches/002-scripts-dtc-pylibfdt-libfdt-i_shipped-Use-SWIG_AppendOutp.patch delete mode 100644 package/boot/uboot-rockchip/patches/105-bootstd-efi-Initialize-PCI-to-discover-network-controller.patch diff --git a/package/boot/uboot-rockchip/Makefile b/package/boot/uboot-rockchip/Makefile index e947910d30b..8dbbb41bce8 100644 --- a/package/boot/uboot-rockchip/Makefile +++ b/package/boot/uboot-rockchip/Makefile @@ -5,9 +5,9 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk -PKG_VERSION:=2024.10 +PKG_VERSION:=2025.01 PKG_RELEASE:=1 -PKG_HASH:=b28daf4ac17e43156363078bf510297584137f6df50fced9b12df34f61a92fb0 +PKG_HASH:=cdef7d507c93f1bbd9f015ea9bc21fa074268481405501945abc6f854d5b686f PKG_MAINTAINER:=Sarah Maedel diff --git a/package/boot/uboot-rockchip/patches/001-rockchip-board-Increase-rng-seed-size-to-make-it-sufficie.patch b/package/boot/uboot-rockchip/patches/001-rockchip-board-Increase-rng-seed-size-to-make-it-sufficie.patch deleted file mode 100644 index 0b7bf1be7d0..00000000000 --- a/package/boot/uboot-rockchip/patches/001-rockchip-board-Increase-rng-seed-size-to-make-it-sufficie.patch +++ /dev/null @@ -1,96 +0,0 @@ -From ed4ae7386257aa66455e330234e513d098a36f84 Mon Sep 17 00:00:00 2001 -From: Alex Shumsky -Date: Wed, 16 Oct 2024 13:02:03 +0300 -Subject: [PATCH] rockchip: board: Increase rng-seed size to make it sufficient - for modern Linux - -Increase rng-seed size to make Linux happy and initialize rng pool instantly. -Linux 5.19+ requires 32 bytes of entropy to initialize random pool, but u-boot -currently provides only 8 bytes. -Linux 5.18 and probably some versions before it used to require 64 bytes. -Bump min value to 64 bytes to be on a safe side. - -Boot with 8 byte rng-seed (Linux 6.11): - # dmesg | grep crng - [ 12.089286] random: crng init done -Boot with 32 byte rng-seed (Linux 6.11): - # dmesg | grep crng - [ 0.000000] random: crng init done - -Linux source references: -https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/char/random.c?h=v5.19#n551 -https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/char/random.c?h=v5.18#n236 - -Signed-off-by: Alex Shumsky -Fixes: d2048bafae40 ("rockchip: board: Add board_rng_seed() for all Rockchip devices") -Reviewed-by: Dragan Simic -Reviewed-by: Marek Vasut -Reviewed-by: Quentin Schulz -Reviewed-by: Kever Yang ---- - arch/arm/mach-rockchip/board.c | 11 ++++++++++- - common/Kconfig | 3 +++ - doc/usage/environment.rst | 5 +++++ - include/fdt_support.h | 3 ++- - 4 files changed, 20 insertions(+), 2 deletions(-) - ---- a/arch/arm/mach-rockchip/board.c -+++ b/arch/arm/mach-rockchip/board.c -@@ -480,9 +480,18 @@ __weak int misc_init_r(void) - __weak int board_rng_seed(struct abuf *buf) - { - struct udevice *dev; -- size_t len = 0x8; -+ ulong len = env_get_ulong("rng_seed_size", 10, 64); - u64 *data; - -+ if (len < 64) { -+ /* -+ * rng_seed_size should be at least 32 bytes for Linux 5.19+, -+ * or 64 for older Linux kernel versions -+ */ -+ log_warning("Value for rng_seed_size (%lu) too low, Linux kernel RNG may fail to initialize early\n", -+ len); -+ } -+ - data = malloc(len); - if (!data) { - printf("Out of memory\n"); ---- a/common/Kconfig -+++ b/common/Kconfig -@@ -927,6 +927,9 @@ config BOARD_RNG_SEED - new seed for use on subsequent boots, and whether or not the - kernel should account any entropy from the given seed. - -+ Default seed size (64 bytes) can be overridden by a decimal -+ environment variable rng_seed_size. -+ - endmenu - - menu "Update support" ---- a/doc/usage/environment.rst -+++ b/doc/usage/environment.rst -@@ -323,6 +323,11 @@ netretry - Useful on scripts which control the retry operation - themselves. - -+rng_seed_size -+ Size of random value added to device-tree node /chosen/rng-seed. -+ This variable is given as a decimal number. -+ If unset, 64 bytes is used as the default. -+ - silent_linux - If set then Linux will be told to boot silently, by - adding 'console=' to its command line. If "yes" it will be ---- a/include/fdt_support.h -+++ b/include/fdt_support.h -@@ -202,7 +202,8 @@ int ft_board_setup(void *blob, struct bd - * - * This function is called if CONFIG_BOARD_RNG_SEED is set, and must - * be provided by the board. It should return, via @buf, some suitable -- * seed value to pass to the kernel. -+ * seed value to pass to the kernel. Seed size could be set in a decimal -+ * environment variable rng_seed_size and it defaults to 64 bytes. - * - * @param buf A struct abuf for returning the seed and its size. - * @return 0 if ok, negative on error. diff --git a/package/boot/uboot-rockchip/patches/002-scripts-dtc-pylibfdt-libfdt-i_shipped-Use-SWIG_AppendOutp.patch b/package/boot/uboot-rockchip/patches/002-scripts-dtc-pylibfdt-libfdt-i_shipped-Use-SWIG_AppendOutp.patch deleted file mode 100644 index f5beca8d77a..00000000000 --- a/package/boot/uboot-rockchip/patches/002-scripts-dtc-pylibfdt-libfdt-i_shipped-Use-SWIG_AppendOutp.patch +++ /dev/null @@ -1,55 +0,0 @@ -From a63456b9191fae2fe49f4b121e025792022e3950 Mon Sep 17 00:00:00 2001 -From: Markus Volk -Date: Wed, 30 Oct 2024 06:07:16 +0100 -Subject: [PATCH] scripts/dtc/pylibfdt/libfdt.i_shipped: Use SWIG_AppendOutput -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Swig has changed language specific AppendOutput functions. The helper -macro SWIG_AppendOutput remains unchanged. Use that instead -of SWIG_Python_AppendOutput, which would require an extra parameter -since swig 4.3.0. - -/home/flk/poky/build-test/tmp/work/qemux86_64-poky-linux/u-boot/2024.10/git/arch/x86/cpu/u-boot-64.lds -| scripts/dtc/pylibfdt/libfdt_wrap.c: In function ‘_wrap_fdt_next_node’: -| scripts/dtc/pylibfdt/libfdt_wrap.c:5581:17: error: too few arguments to function ‘SWIG_Python_AppendOutput’ -| 5581 | resultobj = SWIG_Python_AppendOutput(resultobj, val); -| | ^~~~~~~~~~~~~~~~~~~~~~~~ - -Signed-off-by: Markus Volk -Reported-by: Rudi Heitbaum -Link: https://github.com/dgibson/dtc/pull/154 ---- - scripts/dtc/pylibfdt/libfdt.i_shipped | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - ---- a/scripts/dtc/pylibfdt/libfdt.i_shipped -+++ b/scripts/dtc/pylibfdt/libfdt.i_shipped -@@ -1037,7 +1037,7 @@ typedef uint32_t fdt32_t; - fdt_string(fdt1, fdt32_to_cpu($1->nameoff))); - buff = PyByteArray_FromStringAndSize( - (const char *)($1 + 1), fdt32_to_cpu($1->len)); -- resultobj = SWIG_Python_AppendOutput(resultobj, buff); -+ resultobj = SWIG_AppendOutput(resultobj, buff); - } - } - -@@ -1076,7 +1076,7 @@ typedef uint32_t fdt32_t; - - %typemap(argout) int *depth { - PyObject *val = Py_BuildValue("i", *arg$argnum); -- resultobj = SWIG_Python_AppendOutput(resultobj, val); -+ resultobj = SWIG_AppendOutput(resultobj, val); - } - - %apply int *depth { int *depth }; -@@ -1092,7 +1092,7 @@ typedef uint32_t fdt32_t; - if (PyTuple_GET_SIZE(resultobj) == 0) - resultobj = val; - else -- resultobj = SWIG_Python_AppendOutput(resultobj, val); -+ resultobj = SWIG_AppendOutput(resultobj, val); - } - } - diff --git a/package/boot/uboot-rockchip/patches/101-rockchip-boot_mode-Allow-rockchip_dnl_key_pressed-in-SPL.patch b/package/boot/uboot-rockchip/patches/101-rockchip-boot_mode-Allow-rockchip_dnl_key_pressed-in-SPL.patch index f7f64a1b9b3..c1acc3aa8c3 100644 --- a/package/boot/uboot-rockchip/patches/101-rockchip-boot_mode-Allow-rockchip_dnl_key_pressed-in-SPL.patch +++ b/package/boot/uboot-rockchip/patches/101-rockchip-boot_mode-Allow-rockchip_dnl_key_pressed-in-SPL.patch @@ -26,7 +26,7 @@ Signed-off-by: Chris Morgan obj-spl-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o --ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) +-ifeq ($(CONFIG_XPL_BUILD)$(CONFIG_TPL_BUILD),) - # Always include boot_mode.o, as we bypass it (i.e. turn it off) # inside of boot_mode.c when CONFIG_ROCKCHIP_BOOT_MODE_REG is 0. This way, @@ -101,7 +101,7 @@ Signed-off-by: Chris Morgan #include #include #include -@@ -133,3 +134,26 @@ int arch_cpu_init(void) +@@ -139,3 +140,26 @@ int arch_cpu_init(void) #endif return 0; } diff --git a/package/boot/uboot-rockchip/patches/105-bootstd-efi-Initialize-PCI-to-discover-network-controller.patch b/package/boot/uboot-rockchip/patches/105-bootstd-efi-Initialize-PCI-to-discover-network-controller.patch deleted file mode 100644 index bfc9e8b1ba0..00000000000 --- a/package/boot/uboot-rockchip/patches/105-bootstd-efi-Initialize-PCI-to-discover-network-controller.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 583d37d192d92c5e92efa68b1d97f8ecdef71c47 Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Sun, 12 Nov 2023 10:57:21 +0000 -Subject: [PATCH] bootstd: efi: Initialize PCI to discover network controllers - -Boards like Radxa ROCK 5 Model B and NanoPi R5C require PCI to be -initialized in order to discover their onboard network controllers. - -During standard boot, PCI gets initialized after faster boot media have -been evaluated. However when an EFI bootflow is run from a fast boot -media, PCI initialization may not have happended and as a result no -network device is exposed to EFI. - -Fix this by initializing PCI during EFI bootflow when no ethernet device -can be found. - -This allows chainloading e.g. iPXE on ROCK 5B and NanoPi R5C without -having to enable PCI_INIT_R. Enabling of PCI_INIT_R has the side affect -of slowing down booting from faster boot media, by adding ~1 second off -boot delay for each unocupied M.2 slot. - -Signed-off-by: Jonas Karlman ---- - boot/bootmeth_efi.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - ---- a/boot/bootmeth_efi.c -+++ b/boot/bootmeth_efi.c -@@ -16,6 +16,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -307,6 +308,14 @@ static int distro_efi_read_bootflow(stru - { - int ret; - -+ /* init PCI first since this is often used to provide Ehternet */ -+ if (IS_ENABLED(CONFIG_NETDEVICES) && IS_ENABLED(CONFIG_PCI) && -+ !eth_get_dev()) { -+ ret = pci_init(); -+ if (ret) -+ return log_msg_ret("pci", ret); -+ } -+ - /* - * bootmeth_efi doesn't allocate any buffer neither for blk nor net device - * set flag to avoid freeing static buffer. diff --git a/package/boot/uboot-rockchip/patches/200-add-photonicat-board-watchdog-support.patch b/package/boot/uboot-rockchip/patches/200-add-photonicat-board-watchdog-support.patch index 8016fa105ee..22cbd2adf88 100644 --- a/package/boot/uboot-rockchip/patches/200-add-photonicat-board-watchdog-support.patch +++ b/package/boot/uboot-rockchip/patches/200-add-photonicat-board-watchdog-support.patch @@ -1,13 +1,13 @@ --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile -@@ -50,3 +50,4 @@ obj-$(CONFIG_WDT_STM32MP) += stm32mp_wdt +@@ -52,3 +52,4 @@ obj-$(CONFIG_WDT_STM32MP) += stm32mp_wdt obj-$(CONFIG_WDT_SUNXI) += sunxi_wdt.o obj-$(CONFIG_WDT_TANGIER) += tangier_wdt.o obj-$(CONFIG_WDT_XILINX) += xilinx_wwdt.o +obj-$(CONFIG_WDT_PCAT) += pcat_wdt.o --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig -@@ -421,4 +421,10 @@ config WDT_FTWDT010 +@@ -443,4 +443,10 @@ config WDT_FTWDT010 help Faraday Technology ftwdt010 watchdog is an architecture independent watchdog. It is usually used in SoC chip design. From 4abd81968395ddf1a4b1db1324c6e0da10be1321 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 4 Jan 2025 18:49:14 -0800 Subject: [PATCH 092/173] ath79: remove dr_mode and vbus-supply ath79 uses the generic-ehci driver, which does not support regulators using vbus-supply. dr_mode is also not useful as the driver does not support multiple modes. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/17486 Signed-off-by: Robert Marko --- target/linux/ath79/dts/ar9344_nec_aterm.dtsi | 2 -- target/linux/ath79/dts/ar9344_qihoo_c301.dts | 4 ++-- target/linux/ath79/dts/qca9531_8dev_carambola3.dts | 2 -- target/linux/ath79/dts/qca9531_8dev_lima.dts | 2 -- target/linux/ath79/dts/qca9531_alcatel_hh40v.dts | 2 -- .../linux/ath79/dts/qca9531_tplink_tl-wr810n-v1.dts | 2 -- target/linux/ath79/dts/qca953x.dtsi | 1 - target/linux/ath79/dts/qca9558_aruba_ap-115.dts | 1 - target/linux/ath79/dts/qca9558_nec_aterm.dtsi | 2 -- target/linux/ath79/dts/qca9558_sophos_ap.dtsi | 4 ---- target/linux/ath79/dts/qca9558_sophos_ap100.dts | 1 - target/linux/ath79/dts/qca9558_sophos_ap55.dts | 1 - target/linux/ath79/dts/qca9558_tplink_archer-d7.dtsi | 4 ---- target/linux/ath79/dts/qca955x_elecom_wab.dtsi | 12 +----------- 14 files changed, 3 insertions(+), 37 deletions(-) diff --git a/target/linux/ath79/dts/ar9344_nec_aterm.dtsi b/target/linux/ath79/dts/ar9344_nec_aterm.dtsi index dfe2b064b7e..ba1cd41b8e3 100644 --- a/target/linux/ath79/dts/ar9344_nec_aterm.dtsi +++ b/target/linux/ath79/dts/ar9344_nec_aterm.dtsi @@ -281,8 +281,6 @@ #address-cells = <1>; #size-cells = <0>; - dr_mode = "host"; - /delete-node/ port@1; /* NEC uPD720114 */ diff --git a/target/linux/ath79/dts/ar9344_qihoo_c301.dts b/target/linux/ath79/dts/ar9344_qihoo_c301.dts index 0e9104dbb99..a63c8bc4d9a 100644 --- a/target/linux/ath79/dts/ar9344_qihoo_c301.dts +++ b/target/linux/ath79/dts/ar9344_qihoo_c301.dts @@ -59,8 +59,9 @@ regulator-name = "usb_vbus"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; - enable-active-high; + regulator-always-on; gpios = <&gpio 19 GPIO_ACTIVE_HIGH>; + enable-active-high; }; }; @@ -208,7 +209,6 @@ &usb_phy { status = "okay"; - phy-supply = <&usb_vbus>; }; &pcie { diff --git a/target/linux/ath79/dts/qca9531_8dev_carambola3.dts b/target/linux/ath79/dts/qca9531_8dev_carambola3.dts index a1149aeaeb0..a740999af6d 100644 --- a/target/linux/ath79/dts/qca9531_8dev_carambola3.dts +++ b/target/linux/ath79/dts/qca9531_8dev_carambola3.dts @@ -35,8 +35,6 @@ &usb0 { status = "okay"; - - dr_mode = "host"; }; &usb_phy { diff --git a/target/linux/ath79/dts/qca9531_8dev_lima.dts b/target/linux/ath79/dts/qca9531_8dev_lima.dts index 884d1a588e7..22d80a7d6fe 100644 --- a/target/linux/ath79/dts/qca9531_8dev_lima.dts +++ b/target/linux/ath79/dts/qca9531_8dev_lima.dts @@ -26,8 +26,6 @@ &usb0 { status = "okay"; - - dr_mode = "host"; }; &usb_phy { diff --git a/target/linux/ath79/dts/qca9531_alcatel_hh40v.dts b/target/linux/ath79/dts/qca9531_alcatel_hh40v.dts index 16ba785a235..800d32611d5 100644 --- a/target/linux/ath79/dts/qca9531_alcatel_hh40v.dts +++ b/target/linux/ath79/dts/qca9531_alcatel_hh40v.dts @@ -74,8 +74,6 @@ &usb0 { status = "okay"; - - dr_mode = "host"; }; &usb_phy { diff --git a/target/linux/ath79/dts/qca9531_tplink_tl-wr810n-v1.dts b/target/linux/ath79/dts/qca9531_tplink_tl-wr810n-v1.dts index 6f96b613928..127b1ad3584 100644 --- a/target/linux/ath79/dts/qca9531_tplink_tl-wr810n-v1.dts +++ b/target/linux/ath79/dts/qca9531_tplink_tl-wr810n-v1.dts @@ -19,8 +19,6 @@ &usb0 { status = "okay"; - - vbus-supply = <®_usb_vbus>; }; &usb_phy { diff --git a/target/linux/ath79/dts/qca953x.dtsi b/target/linux/ath79/dts/qca953x.dtsi index 0e982016f42..782b0949ca7 100644 --- a/target/linux/ath79/dts/qca953x.dtsi +++ b/target/linux/ath79/dts/qca953x.dtsi @@ -193,7 +193,6 @@ interrupts = <3>; resets = <&rst 5>; - dr_mode = "host"; has-transaction-translator; caps-offset = <0x100>; diff --git a/target/linux/ath79/dts/qca9558_aruba_ap-115.dts b/target/linux/ath79/dts/qca9558_aruba_ap-115.dts index 7a59bda6eb2..8f6cb71724f 100644 --- a/target/linux/ath79/dts/qca9558_aruba_ap-115.dts +++ b/target/linux/ath79/dts/qca9558_aruba_ap-115.dts @@ -243,6 +243,5 @@ }; &usb0 { - dr_mode = "host"; status = "okay"; }; diff --git a/target/linux/ath79/dts/qca9558_nec_aterm.dtsi b/target/linux/ath79/dts/qca9558_nec_aterm.dtsi index 76d39c2ee70..441d906f449 100644 --- a/target/linux/ath79/dts/qca9558_nec_aterm.dtsi +++ b/target/linux/ath79/dts/qca9558_nec_aterm.dtsi @@ -352,8 +352,6 @@ #address-cells = <1>; #size-cells = <0>; - dr_mode = "host"; - /delete-node/ port@1; /* NEC uPD720114 */ diff --git a/target/linux/ath79/dts/qca9558_sophos_ap.dtsi b/target/linux/ath79/dts/qca9558_sophos_ap.dtsi index 744871a9311..965ce351c9a 100644 --- a/target/linux/ath79/dts/qca9558_sophos_ap.dtsi +++ b/target/linux/ath79/dts/qca9558_sophos_ap.dtsi @@ -191,7 +191,3 @@ nvmem-cells = <&cal_art_1000>; nvmem-cell-names = "calibration"; }; - -&usb0 { - vbus-supply = <®_usb_vbus>; -}; diff --git a/target/linux/ath79/dts/qca9558_sophos_ap100.dts b/target/linux/ath79/dts/qca9558_sophos_ap100.dts index 50ed5fbfbad..ebd82ebd792 100644 --- a/target/linux/ath79/dts/qca9558_sophos_ap100.dts +++ b/target/linux/ath79/dts/qca9558_sophos_ap100.dts @@ -17,5 +17,4 @@ &usb0 { status = "okay"; - dr_mode = "host"; }; diff --git a/target/linux/ath79/dts/qca9558_sophos_ap55.dts b/target/linux/ath79/dts/qca9558_sophos_ap55.dts index 9a3fd61c933..2259360deba 100644 --- a/target/linux/ath79/dts/qca9558_sophos_ap55.dts +++ b/target/linux/ath79/dts/qca9558_sophos_ap55.dts @@ -17,5 +17,4 @@ &usb0 { status = "okay"; - dr_mode = "host"; }; diff --git a/target/linux/ath79/dts/qca9558_tplink_archer-d7.dtsi b/target/linux/ath79/dts/qca9558_tplink_archer-d7.dtsi index b4f32b9fc7c..b7fc212d8e4 100644 --- a/target/linux/ath79/dts/qca9558_tplink_archer-d7.dtsi +++ b/target/linux/ath79/dts/qca9558_tplink_archer-d7.dtsi @@ -145,8 +145,6 @@ }; &usb0 { - dr_mode = "host"; - vbus-supply = <®_usb0_vbus>; status = "okay"; }; @@ -155,7 +153,5 @@ }; &usb1 { - dr_mode = "host"; - vbus-supply = <®_usb1_vbus>; status = "okay"; }; diff --git a/target/linux/ath79/dts/qca955x_elecom_wab.dtsi b/target/linux/ath79/dts/qca955x_elecom_wab.dtsi index 43e34c60291..3d16d4aa705 100644 --- a/target/linux/ath79/dts/qca955x_elecom_wab.dtsi +++ b/target/linux/ath79/dts/qca955x_elecom_wab.dtsi @@ -34,7 +34,7 @@ gpios = <&gpio 15 GPIO_ACTIVE_LOW>; color = ; function = LED_FUNCTION_USB; - trigger-sources = <&usb_port1>; + trigger-sources = <&hub_port0>; linux,default-trigger = "usbport"; }; }; @@ -232,17 +232,7 @@ }; &usb0 { - #address-cells = <1>; - #size-cells = <0>; status = "okay"; - - dr_mode = "host"; - vbus-supply = <®_usb_vbus>; - - usb_port1: port@1 { - reg = <1>; - #trigger-source-cells = <0>; - }; }; &wdt { From f5b1d340be9488af71e6522c3f10f1ebd1a35446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 8 Jan 2025 17:56:16 +0100 Subject: [PATCH 093/173] generic: move gpio-regmap request/free ops patch from realtek MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch is also needed on bmips since it fixes issues with GPIOs not being properly configured due to gpio_request_enable not being called on bcm63xx devices. Therefore we can now drop the bcm63268 gpio function patch. Signed-off-by: Álvaro Fernández Rojas --- ...0-pinctrl-bcm63268-add-gpio-function.patch | 260 ------------------ ...-regmap-Use-generic-request-free-ops.patch | 131 +++++++++ ...-regmap-Use-generic-request-free-ops.patch | 26 -- 3 files changed, 131 insertions(+), 286 deletions(-) delete mode 100644 target/linux/bmips/patches-6.6/110-pinctrl-bcm63268-add-gpio-function.patch create mode 100644 target/linux/generic/pending-6.6/821-gpio-regmap-Use-generic-request-free-ops.patch delete mode 100644 target/linux/realtek/patches-6.6/801-gpio-regmap-Use-generic-request-free-ops.patch diff --git a/target/linux/bmips/patches-6.6/110-pinctrl-bcm63268-add-gpio-function.patch b/target/linux/bmips/patches-6.6/110-pinctrl-bcm63268-add-gpio-function.patch deleted file mode 100644 index afd4aa87168..00000000000 --- a/target/linux/bmips/patches-6.6/110-pinctrl-bcm63268-add-gpio-function.patch +++ /dev/null @@ -1,260 +0,0 @@ -From patchwork Tue Dec 24 10:36:45 2024 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 8bit -X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= - -X-Patchwork-Id: 2027352 -Return-Path: - -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -Authentication-Results: legolas.ozlabs.org; - dkim=pass (2048-bit key; - unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 - header.s=20230601 header.b=UahONGdE; - dkim-atps=neutral -Authentication-Results: legolas.ozlabs.org; - spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org - (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; - envelope-from=linux-gpio+bounces-14196-incoming=patchwork.ozlabs.org@vger.kernel.org; - receiver=patchwork.ozlabs.org) -Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org - [IPv6:2604:1380:45d1:ec00::1]) - (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) - key-exchange X25519 server-signature ECDSA (secp384r1)) - (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4YHWfw1qmwz1yRt - for ; Tue, 24 Dec 2024 21:42:16 +1100 (AEDT) -Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) - (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) - (No client certificate requested) - by ny.mirrors.kernel.org (Postfix) with ESMTPS id C1409161D8A - for ; Tue, 24 Dec 2024 10:37:04 +0000 (UTC) -Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) - by smtp.subspace.kernel.org (Postfix) with ESMTP id C7E791B4132; - Tue, 24 Dec 2024 10:36:55 +0000 (UTC) -Authentication-Results: smtp.subspace.kernel.org; - dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com - header.b="UahONGdE" -X-Original-To: linux-gpio@vger.kernel.org -Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com - [209.85.221.53]) - (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) - (No client certificate requested) - by smtp.subspace.kernel.org (Postfix) with ESMTPS id D319C156F54; - Tue, 24 Dec 2024 10:36:53 +0000 (UTC) -Authentication-Results: smtp.subspace.kernel.org; - arc=none smtp.client-ip=209.85.221.53 -ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; - t=1735036615; cv=none; - b=PEr2vZNz4kb5F2BBGJpTRVGs1Sp8DsmivUP7NnKOWY8KgRPxzLf347SrUxfe6CzXLRpkbCWVoCYMXckrj9poJHbYkU+/I53Nl72IMCm3umwEzLBU+DBhEYh9gmJ1E+IPV+A8Zrs6umt4+Y7IMFxaZA+O2c13TX+AQwjWhRutDPw= -ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; - s=arc-20240116; t=1735036615; c=relaxed/simple; - bh=dXQRhQVd1Zyosn15/gUbEta/P7NJqalhPImmU9urz+Y=; - h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: - MIME-Version:Content-Type; - b=Gb5/JI8lf48IhgVAoC7Sh3vHpBSJCe3+dnVZG4qlAQp3DZVyr+TWYice/Redmrl8JkjoE273hxZ6hFSvJlzF9EclMz0e7k977iOmuQon+N5YlhtfDL94suzV5P9sfXwYvtVjZwnr7aqkRr3w3ihchOawYmk3dg3505bUebInQnk= -ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; - dmarc=pass (p=none dis=none) header.from=gmail.com; - spf=pass smtp.mailfrom=gmail.com; - dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com - header.b=UahONGdE; arc=none smtp.client-ip=209.85.221.53 -Authentication-Results: smtp.subspace.kernel.org; - dmarc=pass (p=none dis=none) header.from=gmail.com -Authentication-Results: smtp.subspace.kernel.org; - spf=pass smtp.mailfrom=gmail.com -Received: by mail-wr1-f53.google.com with SMTP id - ffacd0b85a97d-3862d161947so2420686f8f.3; - Tue, 24 Dec 2024 02:36:53 -0800 (PST) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=gmail.com; s=20230601; t=1735036612; x=1735641412; - darn=vger.kernel.org; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=sMhk1A5we+Q0WqaTiBzTXNhUdePPFx1uKEyCWbVNvYc=; - b=UahONGdExN2DP5PBiZ87j1+mGkDzwCd+MCQpZmUblrKP7GD0KfO4OV/GKtEfTO1sYK - pH+O3hs+yDawgBghqREytfRP390tCBpz+65UNn6GkBDU2iptaRDiGcn1nKnPYpkd3P6X - 0zVyYKneAQ/sAcE/VjH0I7HWuyARq5PtnKMegYi8dZmpFXux+gaBjgnSsjPuOyR/xWxN - RP1C9BDzN3NqeptC5oSsG5eB2Rs5niHvJoSbGuKVBPipP+k6qu88w4bfhTIponae1bt1 - gpUV23UfNa49ChxKv0ivW7QfFky1P30da1oXtQsNS0FVVVrHlWJhhivVT7Fuf2g6dgDh - fgTw== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20230601; t=1735036612; x=1735641412; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc - :subject:date:message-id:reply-to; - bh=sMhk1A5we+Q0WqaTiBzTXNhUdePPFx1uKEyCWbVNvYc=; - b=btRSTKjTHUEx37dhjkiEkJmdS2tVqBjs7UEaMq1bUwXvN7mwvBDdqJz6RW8W2xFdh6 - m/cDdd2Ao9FpXD5R4SBkvIZQPd95+LaDjw6iz7msVP0dvjc1qTTEqlgKHl3ibs8U7Jro - +1nitU/Nl1I5VSgWSRx0in3pH/aD/dSfNPutLktI7IeegBU6dfXrVXaTsFofys1UjBk/ - bOdQRBEsG+X3rHrNTNuVwLewIwk0RwRp6KT6hlaF7bGdhl1UPuG+AMK7PAFUP4e2D5OK - QmBE6ayI4XOeRQHFCbGG2OUvddtktA8BQzwr28+DwYWADQQiKCuy0UJBtW0DmzaxKr7F - gCIw== -X-Forwarded-Encrypted: i=1; - AJvYcCVHVB9BqpG5+V+fo4vdtCQHh3nIKV69RT+IPj0tFJoUTpQdG+vPR4Iqt7ktLVoMBVXhtsD0DAuZpXFa@vger.kernel.org, - AJvYcCXtcLMfobpgZfmtjLs1KKQ2YT3EaF+0+Mdt7kFCJbskk1e1IbXmjE8SiwRlPc7Xop8LBdifPZoTR1ZCl6PN@vger.kernel.org -X-Gm-Message-State: AOJu0YwqZ5qOpBs+2cK9ou/rHf3nhKSpv1sOAgh/R/uVc6pFB2dqDkjp - okaKt94cn3iBf/E0yr+jvP84miiyWBjHOiwUifpj2I+eg2/hRbLe -X-Gm-Gg: ASbGnctb0LTvTOtGESMAhgeg3r7sjorwh3VXs5dZZezH+8LeYUD4c6SPFEXxiNeIZAv - NZLn9cN6bKQLaVX9lTUF2nNmqijrn8WPhaSpeqeSNnZdNpdoDTqTuYpEhY0y+72yNiTqhDFtbyr - OhCPhYE5VV+HKOekEluViF9bHOmkGhpUmBXyGOQmHPxEnDdZINMAMYHxUBC8E4nuG8p/hyD7dPD - iHXkaNnmD4NjYqjgTyxSACjy6eWinXEuukXXHZVbbJY9nJ4wVWI -X-Google-Smtp-Source: - AGHT+IEbrRmLj2uKOuyl6xkrJtxDUC1KVwEPA3dNsbU/+R2F0ZKZu/sQbMNvRjB6t41GnHxO0mDDAQ== -X-Received: by 2002:a05:6000:4023:b0:385:f220:f788 with SMTP id - ffacd0b85a97d-38a223fd77bmr14541441f8f.48.1735036611884; - Tue, 24 Dec 2024 02:36:51 -0800 (PST) -Received: from skynet.lan ([213.99.205.117]) - by smtp.gmail.com with ESMTPSA id - ffacd0b85a97d-38a1c89e1a1sm13645138f8f.69.2024.12.24.02.36.51 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Tue, 24 Dec 2024 02:36:51 -0800 (PST) -From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= -To: linus.walleij@linaro.org, - kylehendrydev@gmail.com, - linux-gpio@vger.kernel.org, - linux-kernel@vger.kernel.org -Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= -Subject: [PATCH v2] pinctrl: bcm63268: add gpio function -Date: Tue, 24 Dec 2024 11:36:45 +0100 -Message-Id: <20241224103645.1709996-1-noltari@gmail.com> -X-Mailer: git-send-email 2.39.5 -In-Reply-To: <20241207223335.17535-1-kylehendrydev@gmail.com> -References: <20241207223335.17535-1-kylehendrydev@gmail.com> -Precedence: bulk -X-Mailing-List: linux-gpio@vger.kernel.org -List-Id: -List-Subscribe: -List-Unsubscribe: -MIME-Version: 1.0 - -From: Kyle Hendry - -There is no guarantee that the bootloader will leave the pin configuration -in a known default state, so pinctrl needs to be explicitly set in some -cases. This patch adds a gpio function for drivers that need it, i.e. -gpio-leds. - -Signed-off-by: Kyle Hendry -Signed-off-by: Álvaro Fernández Rojas ---- - drivers/pinctrl/bcm/pinctrl-bcm63268.c | 71 +++++++++++++++++++++++++- - 1 file changed, 70 insertions(+), 1 deletion(-) - ---- a/drivers/pinctrl/bcm/pinctrl-bcm63268.c -+++ b/drivers/pinctrl/bcm/pinctrl-bcm63268.c -@@ -34,6 +34,7 @@ - #define BCM63268_BASEMODE_VDSL_PHY_3 BIT(9) /* GPIOs 26/27 */ - - enum bcm63268_pinctrl_reg { -+ BCM63268_NONE, - BCM63268_LEDCTRL, - BCM63268_MODE, - BCM63268_CTRL, -@@ -242,6 +243,61 @@ static struct pingroup bcm63268_groups[] - BCM_PIN_GROUP(vdsl_phy3_grp), - }; - -+static const char * const gpio_groups[] = { -+ "gpio0", -+ "gpio1", -+ "gpio2", -+ "gpio3", -+ "gpio4", -+ "gpio5", -+ "gpio6", -+ "gpio7", -+ "gpio8", -+ "gpio9", -+ "gpio10", -+ "gpio11", -+ "gpio12", -+ "gpio13", -+ "gpio14", -+ "gpio15", -+ "gpio16", -+ "gpio17", -+ "gpio18", -+ "gpio19", -+ "gpio20", -+ "gpio21", -+ "gpio22", -+ "gpio23", -+ "gpio24", -+ "gpio25", -+ "gpio26", -+ "gpio27", -+ "gpio28", -+ "gpio29", -+ "gpio30", -+ "gpio31", -+ "gpio32", -+ "gpio33", -+ "gpio34", -+ "gpio35", -+ "gpio36", -+ "gpio37", -+ "gpio38", -+ "gpio39", -+ "gpio40", -+ "gpio41", -+ "gpio42", -+ "gpio43", -+ "gpio44", -+ "gpio45", -+ "gpio46", -+ "gpio47", -+ "gpio48", -+ "gpio49", -+ "gpio50", -+ "gpio51", -+}; -+ - static const char * const led_groups[] = { - "gpio0", - "gpio1", -@@ -394,6 +450,14 @@ static const char * const vdsl_phy_overr - "vdsl_phy_override_3_grp", - }; - -+#define BCM63268_GPIO_FUN(n) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .reg = BCM63268_NONE, \ -+ } -+ - #define BCM63268_LED_FUN(n) \ - { \ - .name = #n, \ -@@ -428,6 +492,7 @@ static const char * const vdsl_phy_overr - } - - static const struct bcm63268_function bcm63268_funcs[] = { -+ BCM63268_GPIO_FUN(gpio), - BCM63268_LED_FUN(led), - BCM63268_MODE_FUN(serial_led_clk), - BCM63268_MODE_FUN(serial_led_data), -@@ -542,6 +607,9 @@ static int bcm63268_pinctrl_set_mux(stru - bcm63268_set_gpio(pc, pg->pins[i]); - - switch (f->reg) { -+ case BCM63268_NONE: -+ reg = 0; -+ break; - case BCM63268_LEDCTRL: - reg = BCM63268_LED_REG; - mask = BIT(pg->pins[0]); -@@ -567,7 +635,8 @@ static int bcm63268_pinctrl_set_mux(stru - return -EINVAL; - } - -- regmap_update_bits(pc->regs, reg, mask, val); -+ if (reg) -+ regmap_update_bits(pc->regs, reg, mask, val); - - return 0; - } diff --git a/target/linux/generic/pending-6.6/821-gpio-regmap-Use-generic-request-free-ops.patch b/target/linux/generic/pending-6.6/821-gpio-regmap-Use-generic-request-free-ops.patch new file mode 100644 index 00000000000..344a5b1c5a7 --- /dev/null +++ b/target/linux/generic/pending-6.6/821-gpio-regmap-Use-generic-request-free-ops.patch @@ -0,0 +1,131 @@ +From patchwork Tue Jan 7 20:16:20 2025 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +X-Patchwork-Submitter: Sander Vanheule +X-Patchwork-Id: 2031059 +Return-Path: + +X-Original-To: incoming@patchwork.ozlabs.org +Delivered-To: patchwork-incoming@legolas.ozlabs.org +Authentication-Results: legolas.ozlabs.org; + dkim=pass (2048-bit key; + secure) header.d=svanheule.net header.i=@svanheule.net header.a=rsa-sha256 + header.s=mail1707 header.b=YjCvLC2H; + dkim-atps=neutral +Authentication-Results: legolas.ozlabs.org; + spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org + (client-ip=2604:1380:4601:e00::3; helo=am.mirrors.kernel.org; + envelope-from=linux-gpio+bounces-14582-incoming=patchwork.ozlabs.org@vger.kernel.org; + receiver=patchwork.ozlabs.org) +Received: from am.mirrors.kernel.org (am.mirrors.kernel.org + [IPv6:2604:1380:4601:e00::3]) + (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) + key-exchange X25519 server-signature ECDSA (secp384r1)) + (No client certificate requested) + by legolas.ozlabs.org (Postfix) with ESMTPS id 4YSMxB3WwSz1yPG + for ; Wed, 8 Jan 2025 07:25:18 +1100 (AEDT) +Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) + (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) + (No client certificate requested) + by am.mirrors.kernel.org (Postfix) with ESMTPS id A7B811887AD1 + for ; Tue, 7 Jan 2025 20:25:19 +0000 (UTC) +Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) + by smtp.subspace.kernel.org (Postfix) with ESMTP id C09A21F63FE; + Tue, 7 Jan 2025 20:25:11 +0000 (UTC) +Authentication-Results: smtp.subspace.kernel.org; + dkim=pass (2048-bit key) header.d=svanheule.net header.i=@svanheule.net + header.b="YjCvLC2H" +X-Original-To: linux-gpio@vger.kernel.org +Received: from polaris.svanheule.net (polaris.svanheule.net [84.16.241.116]) + (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) + (No client certificate requested) + by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8DD631DF97A + for ; Tue, 7 Jan 2025 20:25:07 +0000 (UTC) +Authentication-Results: smtp.subspace.kernel.org; + arc=none smtp.client-ip=84.16.241.116 +ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; + t=1736281511; cv=none; + b=Xe/s+ul4S/+nhYxSMqUWJ/GXKP+J7uJo6tFw/w5bTXcmGxkbpCXTLOiTNXAhv8PMhTfsLYSQes6VF8dzDXaJxL4c8SlQsPNfGH/PqecmSvFMbZTz1XbjP9mBUCvX9lxCH8CSRavkuPuYdhss3a56TgaFzi9GifUSHCsHGs7+xk0= +ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; + s=arc-20240116; t=1736281511; c=relaxed/simple; + bh=31kjLyaoVOzIAs1m+zMi59Ia2jUwYW56Jp1YE6hLflg=; + h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; + b=q7miNkZBtMq3dcxL5HMjUpP3EFdQ7/xU/WnWIFVl6MK4rszqphqvaziMOK6avsn+UA5pAx2JJV8bDY8LfNhiVWwZtPfxbikjjZFm1HYlCDWmGudasM0b//K3/On625L4iqFWmVmLUdEdhvwIkJKSL4wTfN0OMz27EI272o5ygLg= +ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; + dmarc=pass (p=none dis=none) header.from=svanheule.net; + spf=pass smtp.mailfrom=svanheule.net; + dkim=pass (2048-bit key) header.d=svanheule.net header.i=@svanheule.net + header.b=YjCvLC2H; arc=none smtp.client-ip=84.16.241.116 +Authentication-Results: smtp.subspace.kernel.org; + dmarc=pass (p=none dis=none) header.from=svanheule.net +Authentication-Results: smtp.subspace.kernel.org; + spf=pass smtp.mailfrom=svanheule.net +Received: from terra.vega.svanheule.net (unknown [94.110.49.146]) + (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) + key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest + SHA256) + (No client certificate requested) + (Authenticated sender: sander@svanheule.net) + by polaris.svanheule.net (Postfix) with ESMTPSA id 1E18459A0D6; + Tue, 7 Jan 2025 21:17:02 +0100 (CET) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svanheule.net; + s=mail1707; t=1736281022; + h=from:from:reply-to:subject:subject:date:date:message-id:message-id: + to:to:cc:cc:mime-version:mime-version:content-type:content-type: + content-transfer-encoding:content-transfer-encoding; + bh=yNGIiTe7uonx3NZIc6+B7LVjvR8RnIV2zq++EO7NLhg=; + b=YjCvLC2HqArIGWGFkNYmh+oloGi7ZFo7WZGlTbxuHqrQVJ6mLNoLCTCkPkX1EJWEQyNysD + Jj+7tBnAYyCrJ0NuSTD9CPW1+KwKP4wlvWpBUlayCdUJyU4rzjqmlYAI5vJ1UX8FOnvEpn + KeWjgjbeMI6dvIE7ATPFkDvMrDxR9KSEe/1pfzY3E5jh1T8tcnTRMQKTll7hSUBN63dVfJ + U7wnHRLvwx8ESIjrHDKOlsSohmV6lyQTrgEeE2RCM6SpZPNoSpPVjTinF1kPuMHNWHV+Th + 6eDOblXxt859JECDowM0NjF87XJqjgph22+A1WUV4iaePO4GIWo9DQ3KhP/Pyg== +From: Sander Vanheule +To: Michael Walle , + Linus Walleij , + Bartosz Golaszewski , + linux-gpio@vger.kernel.org, + linux-kernel@vger.kernel.org +Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= , + jonas.gorski@gmail.com, kylehendrydev@gmail.com, + florian.fainelli@broadcom.com, Sander Vanheule +Subject: [PATCH] gpio: regmap: Use generic request/free ops +Date: Tue, 7 Jan 2025 21:16:20 +0100 +Message-ID: <20250107201621.12467-1-sander@svanheule.net> +X-Mailer: git-send-email 2.47.1 +Precedence: bulk +X-Mailing-List: linux-gpio@vger.kernel.org +List-Id: +List-Subscribe: +List-Unsubscribe: +MIME-Version: 1.0 + +Set the gpiochip request and free ops to the generic implementations. +This way a user can provide a gpio-ranges property defined for a pinmux, +easing muxing of gpio functions. Provided that the pin controller +implementents the pinmux op .gpio_request_enable(), pins will +automatically be muxed to their GPIO function when requested. + +Signed-off-by: Sander Vanheule +Acked-by: Michael Walle +--- +Álvaro has submitted a similar patch today. My implementation's impact +is more limited, but I hadn't gotten around to submitting it yet. + +For the original (short) discussion, see: +https://lore.kernel.org/linux-gpio/20250107102735.317446-1-noltari@gmail.com/T/#t + + drivers/gpio/gpio-regmap.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/gpio/gpio-regmap.c ++++ b/drivers/gpio/gpio-regmap.c +@@ -262,6 +262,8 @@ struct gpio_regmap *gpio_regmap_register + chip->label = config->label ?: dev_name(config->parent); + chip->can_sleep = regmap_might_sleep(config->regmap); + ++ chip->request = gpiochip_generic_request; ++ chip->free = gpiochip_generic_free; + chip->get = gpio_regmap_get; + if (gpio->reg_set_base && gpio->reg_clr_base) + chip->set = gpio_regmap_set_with_clear; diff --git a/target/linux/realtek/patches-6.6/801-gpio-regmap-Use-generic-request-free-ops.patch b/target/linux/realtek/patches-6.6/801-gpio-regmap-Use-generic-request-free-ops.patch deleted file mode 100644 index a06ba7464aa..00000000000 --- a/target/linux/realtek/patches-6.6/801-gpio-regmap-Use-generic-request-free-ops.patch +++ /dev/null @@ -1,26 +0,0 @@ -From f21b15dfe254b51f80c552750eb20b1dc752507a Mon Sep 17 00:00:00 2001 -From: Sander Vanheule -Date: Mon, 30 Dec 2024 17:59:24 +0100 -Subject: [PATCH] gpio: regmap: Use generic request/free ops - -Set the gpiochip request and free ops to the generic implementations. -This way a user can provide a gpio-ranges property defined for a pinmux, -allowing pins to automatically be muxed to their GPIO function when -requested. - -Signed-off-by: Sander Vanheule ---- - drivers/gpio/gpio-regmap.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/gpio/gpio-regmap.c -+++ b/drivers/gpio/gpio-regmap.c -@@ -270,6 +270,8 @@ struct gpio_regmap *gpio_regmap_register - chip->label = config->label ?: dev_name(config->parent); - chip->can_sleep = regmap_might_sleep(config->regmap); - -+ chip->request = gpiochip_generic_request; -+ chip->free = gpiochip_generic_free; - chip->get = gpio_regmap_get; - if (gpio->reg_set_base && gpio->reg_clr_base) - chip->set = gpio_regmap_set_with_clear; From 1b1527dc11f57116b439b8ab73586d1d2e1feed4 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Thu, 9 Jan 2025 14:35:46 +0800 Subject: [PATCH 094/173] uboot-rockchip: disable video output to reduce size Signed-off-by: Tianling Shen --- package/boot/uboot-rockchip/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/package/boot/uboot-rockchip/Makefile b/package/boot/uboot-rockchip/Makefile index 8dbbb41bce8..76ff54fe96e 100644 --- a/package/boot/uboot-rockchip/Makefile +++ b/package/boot/uboot-rockchip/Makefile @@ -442,6 +442,7 @@ UBOOT_CUSTOMIZE_CONFIG := \ --disable EFI_CAPSULE_FIRMWARE_RAW \ --disable SPL_FIT_SIGNATURE \ --disable USB_FUNCTION_FASTBOOT \ + --disable VIDEO \ ) UBOOT_MAKE_FLAGS += \ From d3f097a70ea217c835ca76f07d62dbe26cea2534 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Thu, 9 Jan 2025 17:33:27 +0800 Subject: [PATCH 095/173] uboot-rockchip: refresh u-boot dtsi Signed-off-by: Tianling Shen --- .../arm/dts/rk3568-fastrhino-r66s-u-boot.dtsi | 17 ----------------- .../arch/arm/dts/rk3568-mrkaio-m68s-u-boot.dtsi | 12 ------------ .../arch/arm/dts/rk3568-photonicat-u-boot.dtsi | 10 ---------- .../src/arch/arm/dts/rk3568-roc-pc-u-boot.dtsi | 12 ------------ 4 files changed, 51 deletions(-) diff --git a/package/boot/uboot-rockchip/src/arch/arm/dts/rk3568-fastrhino-r66s-u-boot.dtsi b/package/boot/uboot-rockchip/src/arch/arm/dts/rk3568-fastrhino-r66s-u-boot.dtsi index 6ce824c95c7..e783581cf14 100644 --- a/package/boot/uboot-rockchip/src/arch/arm/dts/rk3568-fastrhino-r66s-u-boot.dtsi +++ b/package/boot/uboot-rockchip/src/arch/arm/dts/rk3568-fastrhino-r66s-u-boot.dtsi @@ -4,7 +4,6 @@ / { chosen { - stdout-path = &uart2; u-boot,spl-boot-order = "same-as-spl", &sdmmc0; }; }; @@ -16,19 +15,3 @@ &pcie3x2 { /delete-property/ vpcie3v3-supply; }; - -&uart2 { - clock-frequency = <24000000>; - bootph-all; - status = "okay"; -}; - -&vcc5v0_usb_host { - /delete-property/ regulator-always-on; - /delete-property/ regulator-boot-on; -}; - -&vcc5v0_usb_otg { - /delete-property/ regulator-always-on; - /delete-property/ regulator-boot-on; -}; diff --git a/package/boot/uboot-rockchip/src/arch/arm/dts/rk3568-mrkaio-m68s-u-boot.dtsi b/package/boot/uboot-rockchip/src/arch/arm/dts/rk3568-mrkaio-m68s-u-boot.dtsi index feb00c312e3..f82f3c3076c 100644 --- a/package/boot/uboot-rockchip/src/arch/arm/dts/rk3568-mrkaio-m68s-u-boot.dtsi +++ b/package/boot/uboot-rockchip/src/arch/arm/dts/rk3568-mrkaio-m68s-u-boot.dtsi @@ -2,12 +2,6 @@ #include "rk356x-u-boot.dtsi" -/ { - chosen { - stdout-path = &uart2; - }; -}; - &sdhci { cap-mmc-highspeed; mmc-ddr-1_8v; @@ -17,12 +11,6 @@ pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe>; }; -&uart2 { - clock-frequency = <24000000>; - bootph-all; - status = "okay"; -}; - &vcc5v0_usb_host { /delete-property/ regulator-always-on; /delete-property/ regulator-boot-on; diff --git a/package/boot/uboot-rockchip/src/arch/arm/dts/rk3568-photonicat-u-boot.dtsi b/package/boot/uboot-rockchip/src/arch/arm/dts/rk3568-photonicat-u-boot.dtsi index 2df97d1c5a3..0851b5b9970 100644 --- a/package/boot/uboot-rockchip/src/arch/arm/dts/rk3568-photonicat-u-boot.dtsi +++ b/package/boot/uboot-rockchip/src/arch/arm/dts/rk3568-photonicat-u-boot.dtsi @@ -3,10 +3,6 @@ #include "rk356x-u-boot.dtsi" / { - chosen { - stdout-path = &uart2; - }; - pcat-wdt { compatible = "linux,wdt-pcat"; port = <&uart4>; @@ -26,12 +22,6 @@ pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe>; }; -&uart2 { - clock-frequency = <24000000>; - bootph-all; - status = "okay"; -}; - &vcc3v3_sd { bootph-pre-ram; }; diff --git a/package/boot/uboot-rockchip/src/arch/arm/dts/rk3568-roc-pc-u-boot.dtsi b/package/boot/uboot-rockchip/src/arch/arm/dts/rk3568-roc-pc-u-boot.dtsi index 7506a3cc5b5..59c4b59c4f6 100644 --- a/package/boot/uboot-rockchip/src/arch/arm/dts/rk3568-roc-pc-u-boot.dtsi +++ b/package/boot/uboot-rockchip/src/arch/arm/dts/rk3568-roc-pc-u-boot.dtsi @@ -2,12 +2,6 @@ #include "rk356x-u-boot.dtsi" -/ { - chosen { - stdout-path = &uart2; - }; -}; - &sdhci { cap-mmc-highspeed; mmc-ddr-1_8v; @@ -17,12 +11,6 @@ pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe>; }; -&uart2 { - clock-frequency = <24000000>; - bootph-all; - status = "okay"; -}; - &vcc5v0_host { /delete-property/ regulator-always-on; }; From c113982706989c76c69e94e15abce0d316e97f6b Mon Sep 17 00:00:00 2001 From: Florian Maurer Date: Thu, 9 Jan 2025 00:46:18 +0100 Subject: [PATCH 096/173] ipq40xx: fix label MAC address for Linksys WHW03 v2 The label MAC address is written inside the case of the whw03 v2 at the bottom. Similar fix as to the 4040 in b22d382ae4eaa1af42930115d91855f402314cac Signed-off-by: Florian Maurer Link: https://github.com/openwrt/openwrt/pull/17535 Signed-off-by: Robert Marko --- .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-whw03.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-whw03.dtsi b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-whw03.dtsi index cb12381022c..6c9eaadd770 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-whw03.dtsi +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-whw03.dtsi @@ -8,12 +8,12 @@ / { aliases { - // TODO: Verify if the ethernet0 alias is needed ethernet0 = &gmac; led-boot = &led_blue; led-failsafe = &led_red; led-running = &led_blue; led-upgrade = &led_red; + label-mac-device = &gmac; }; soc { From b52e8972968ce25026447fea3de320fb395a2f3a Mon Sep 17 00:00:00 2001 From: Eric Fahlgren Date: Mon, 30 Dec 2024 15:54:55 -0800 Subject: [PATCH 097/173] include/package-pack: remove leading whitespace from install scripts Strip off initial leading blanks and tabs from scripts and script fragments that are supplied by the package's Makefile. Specifically, the script included in the postrm must be left justified so that the shebang is in the first column. Fixes: https://github.com/openwrt/openwrt/issues/17439 Signed-off-by: Eric Fahlgren Link: https://github.com/openwrt/openwrt/pull/17440 Signed-off-by: Robert Marko --- include/package-pack.mk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/package-pack.mk b/include/package-pack.mk index a36d6909016..411bae825a9 100644 --- a/include/package-pack.mk +++ b/include/package-pack.mk @@ -302,7 +302,7 @@ else echo 'export pkgname="$(1)"'; \ echo "add_group_and_user"; \ echo "default_postinst"; \ - [ ! -f $$(ADIR_$(1))/postinst-pkg ] || cat "$$(ADIR_$(1))/postinst-pkg"; \ + [ ! -f $$(ADIR_$(1))/postinst-pkg ] || sed -z 's/^\s*#!/#!/' "$$(ADIR_$(1))/postinst-pkg"; \ ) > $$(ADIR_$(1))/post-install; ( \ @@ -312,9 +312,11 @@ else echo 'export root="$$$${IPKG_INSTROOT}"'; \ echo 'export pkgname="$(1)"'; \ echo "default_prerm"; \ - [ ! -f $$(ADIR_$(1))/prerm-pkg ] || cat "$$(ADIR_$(1))/prerm-pkg"; \ + [ ! -f $$(ADIR_$(1))/prerm-pkg ] || sed -z 's/^\s*#!/#!/' "$$(ADIR_$(1))/prerm-pkg"; \ ) > $$(ADIR_$(1))/pre-deinstall; + [ ! -f $$(ADIR_$(1))/postrm ] || sed -zi 's/^\s*#!/#!/' "$$(ADIR_$(1))/postrm"; + if [ -n "$(USERID)" ]; then echo $(USERID) > $$(IDIR_$(1))/lib/apk/packages/$(1).rusers; fi; if [ -n "$(ALTERNATIVES)" ]; then echo $(ALTERNATIVES) > $$(IDIR_$(1))/lib/apk/packages/$(1).alternatives; fi; (cd $$(IDIR_$(1)) && find . -type f,l -printf "/%P\n" > $$(IDIR_$(1))/lib/apk/packages/$(1).list) From 16373d80dff9fd7c0375018b748275c71b3ca4fc Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Thu, 15 Dec 2022 01:49:20 -0800 Subject: [PATCH 098/173] ipq806x: mtd: spi-nor: micron-st: Add n25q064a WP support These flash chips are used on Google / TP-Link / ASUS OnHub devices, and OnHub devices are write-protected by default (same as any other ChromeOS/Chromebook system). This patch has been submitted upstream, per the notes in the patch file. Signed-off-by: Brian Norris Link: https://github.com/openwrt/openwrt/pull/16014 Signed-off-by: Robert Marko --- .../901-mtd-spi-nor-n25q064a-wp.patch | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 target/linux/ipq806x/patches-6.6/901-mtd-spi-nor-n25q064a-wp.patch diff --git a/target/linux/ipq806x/patches-6.6/901-mtd-spi-nor-n25q064a-wp.patch b/target/linux/ipq806x/patches-6.6/901-mtd-spi-nor-n25q064a-wp.patch new file mode 100644 index 00000000000..93e15bec612 --- /dev/null +++ b/target/linux/ipq806x/patches-6.6/901-mtd-spi-nor-n25q064a-wp.patch @@ -0,0 +1,29 @@ +From 1e019e728800d4033b4b3b1b5570f5da5ed309f2 Mon Sep 17 00:00:00 2001 +From: Brian Norris +Date: Thu, 15 Dec 2022 01:49:20 -0800 +Subject: [PATCH] mtd: spi-nor: micron-st: Add n25q064a WP support + +These flash chips are used on Google / TP-Link / ASUS OnHub devices, and +OnHub devices are write-protected by default (same as any other +ChromeOS/Chromebook system). + +Signed-off-by: Brian Norris +--- +Submitted upstream at: + https://lore.kernel.org/linux-mtd/20240726185825.142733-1-computersforpeace@gmail.com/ + https://patchwork.ozlabs.org/project/linux-mtd/patch/20240726185825.142733-1-computersforpeace@gmail.com/ + + drivers/mtd/spi-nor/micron-st.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/mtd/spi-nor/micron-st.c ++++ b/drivers/mtd/spi-nor/micron-st.c +@@ -183,6 +183,8 @@ static const struct flash_info st_nor_pa + { "n25q064", INFO(0x20ba17, 0, 64 * 1024, 128) + NO_SFDP_FLAGS(SECT_4K | SPI_NOR_QUAD_READ) }, + { "n25q064a", INFO(0x20bb17, 0, 64 * 1024, 128) ++ FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | ++ SPI_NOR_BP3_SR_BIT6) + NO_SFDP_FLAGS(SECT_4K | SPI_NOR_QUAD_READ) }, + { "n25q128a11", INFO(0x20bb18, 0, 64 * 1024, 256) + FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | From 992afd2caba654bd0934ff616ed0149cd035661e Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Fri, 18 Aug 2023 18:53:58 -0700 Subject: [PATCH 099/173] ipq40xx: chromium: Support Chromium "crossystem" GPIO tooling ChromiumOS's vboot_reference tooling [1] provides convenient access to various firmware and hardware details via its `crossystem` tool. crossystem currently: (1) relies on the v1 GPIO cdev API to read GPIOs; and (2) expects gpio-line-names properties. Enable the kernel config, and document a few pins for Google WiFi devices. I only go so far as to pull two relevant names out of the vendor device tree. Others could perhaps be backfilled if the info is available and useful. [1] https://chromium.googlesource.com/chromiumos/platform/vboot_reference/+/HEAD/README Signed-off-by: Brian Norris Link: https://github.com/openwrt/openwrt/pull/16014 Signed-off-by: Robert Marko --- target/linux/ipq40xx/chromium/config-default | 1 + .../arm/boot/dts/qcom/qcom-ipq4019-wifi.dts | 61 +++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/target/linux/ipq40xx/chromium/config-default b/target/linux/ipq40xx/chromium/config-default index d78ca0ab280..29214b69155 100644 --- a/target/linux/ipq40xx/chromium/config-default +++ b/target/linux/ipq40xx/chromium/config-default @@ -1,4 +1,5 @@ CONFIG_BLK_DEV_SD=y +CONFIG_GPIO_CDEV_V1=y CONFIG_SCSI=y CONFIG_SCSI_COMMON=y CONFIG_SG_POOL=y diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wifi.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wifi.dts index c6113e7aab0..491a497af0e 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wifi.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wifi.dts @@ -74,6 +74,67 @@ }; &tlmm { + gpio-line-names = "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + /* AP_FLASH_WP_L is crossystem ABI. */ + "AP_FLASH_WP_L" /* 53 */, + "", + "", + "", + /* RECOVERY_SW_L is crossystem ABI. */ + "RECOVERY_SW_L" /* 57 */; + fw_pinmux: fw_pinmux { wp { pins = "gpio53"; From 219ee4d4d73b72490ad4f2bae0427bf35501b22e Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Fri, 18 Aug 2023 18:58:48 -0700 Subject: [PATCH 100/173] ipq806x: chromium: Support Chromium "crossystem" GPIO tooling ChromiumOS's vboot_reference tooling [1] provides convenient access to various firmware and hardware details via its `crossystem` tool. crossystem currently: (1) relies on the v1 GPIO cdev API to read GPIOs; and (2) expects gpio-line-names properties. Enable the kernel config, and document a few pins for OnHub devices. I only go so far as to pull two relevant names out of the vendor device tree. Others could perhaps be backfilled if the info is available and useful. [1] https://chromium.googlesource.com/chromiumos/platform/vboot_reference/+/HEAD/README Signed-off-by: Brian Norris Link: https://github.com/openwrt/openwrt/pull/16014 Signed-off-by: Robert Marko --- target/linux/ipq806x/chromium/config-default | 1 + .../dts/qcom/qcom-ipq8064-tplink-onhub.dts | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/target/linux/ipq806x/chromium/config-default b/target/linux/ipq806x/chromium/config-default index 927aba360f4..644c6a6c69a 100644 --- a/target/linux/ipq806x/chromium/config-default +++ b/target/linux/ipq806x/chromium/config-default @@ -1,5 +1,6 @@ # CONFIG_ARM_QCOM_SPM_CPUIDLE is not set CONFIG_BLK_DEV_SD=y +CONFIG_GPIO_CDEV_V1=y CONFIG_LEDS_LP5523=y CONFIG_LEDS_LP55XX_COMMON=y CONFIG_PHY_QCOM_IPQ806X_USB=y diff --git a/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8064-tplink-onhub.dts b/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8064-tplink-onhub.dts index 6adc6be4aec..9fa0ff18583 100644 --- a/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8064-tplink-onhub.dts +++ b/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8064-tplink-onhub.dts @@ -14,6 +14,27 @@ }; &qcom_pinmux { + gpio-line-names = "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + /* RECOVERY_SW_L is crossystem ABI. */ + "RECOVERY_SW_L", /* 16 */ + /* AP_FLASH_WP_L is crossystem ABI. */ + "AP_FLASH_WP_L" /* 17 */; + i2c7_pins: i2c7_pinmux { mux { pins = "gpio8", "gpio9"; From efafd7d47f8fa26a9f99283605c9324a833ef852 Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 9 Jan 2025 08:54:54 -0500 Subject: [PATCH 101/173] kernel: bump 6.6 to 6.6.70 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.70 Removed upstreamed: generic/backport-6.6/902-net-llc-reset-skb-transport_header.patch[1] generic/pending-6.6/605-netfilter-nft_set_hash-unaligned-atomic-read-on-stru.patch[2] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.70&id=0c896816aa193e6459fc947747e5753c06b395b9 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.70&id=4f49349c1963e507aa37c1ec05178faeb0103959 Build system: x86/64 Build-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17545 Signed-off-by: Robert Marko --- include/kernel-6.6 | 4 +- ...mt7621-Add-Airoha-EN7581-i2c-support.patch | 2 +- ...tend-guard-with-spinlock_bh-variants.patch | 12 +-- ...ci-add-quirk-for-host-controllers-th.patch | 4 +- ...all-the-downstream-rpi-sound-card-dr.patch | 2 +- ...hci_fixup_endpoint-for-interval-adju.patch | 4 +- ...und-for-bogus-SET_DEQ_PENDING-endpoi.patch | 2 +- ...d-add-the-endpoint-context-in-xhci_f.patch | 2 +- ...ore-event-ring-segment-table-entries.patch | 2 +- ...-quirks-add-link-TRB-quirk-for-VL805.patch | 4 +- ...b-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch | 2 +- ...5-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch | 8 +- ...wc3-Set-DMA-and-coherent-masks-early.patch | 4 +- ...-add-FS-LS-bus-instance-parkmode-dis.patch | 4 +- ...n-Maintain-TLB-coherency-in-LRU-code.patch | 2 +- ...d-support-for-setting-NAK-enhancemen.patch | 4 +- ...-prevent-a-theoretical-race-on-non-c.patch | 2 +- ...support-for-performing-fake-doorbell.patch | 6 +- ...tional-threaded-NAPI-wakeup-based-on.patch | 6 +- ...-to-use-SMP-threads-for-backlog-NAPI.patch | 22 ++--- ...klog-NAPI-to-clean-up-the-defer_list.patch | 2 +- ...-net-Rename-rps_lock-to-backlog_lock.patch | 18 ++-- ...-net-Make-USO-depend-on-CSUM-offload.patch | 6 +- ...64-if-device-if-driver-is-configured.patch | 2 +- ...-create-a-dummy-net_device-allocator.patch | 6 +- ...t-introduce-napi_is_scheduled-helper.patch | 2 +- ...et-free_netdev-exit-earlier-if-dummy.patch | 2 +- ...2-net-llc-reset-skb-transport_header.patch | 52 ----------- .../hack-6.6/901-debloat_sock_diag.patch | 2 +- .../generic/hack-6.6/902-debloat_proc.patch | 2 +- ...t_hash-unaligned-atomic-read-on-stru.patch | 87 ------------------- .../pending-6.6/630-packet_socket_type.patch | 16 ++-- ..._F_GSO_FRAGLIST-from-NETIF_F_GSO_SOF.patch | 2 +- ...PS-lantiq-add-FALC-ON-i2c-bus-master.patch | 2 +- .../810-uvc-add-iPassion-iP2970-support.patch | 2 +- .../825-i2c-MIPS-adds-ralink-I2C-driver.patch | 2 +- .../310-add-i2c-rtl9300-support.patch | 2 +- ...c3-add-optional-PHY-interface-clocks.patch | 4 +- ...ove-performance-usb-using-lowmem-for.patch | 16 ++-- 39 files changed, 93 insertions(+), 232 deletions(-) delete mode 100644 target/linux/generic/backport-6.6/902-net-llc-reset-skb-transport_header.patch delete mode 100644 target/linux/generic/pending-6.6/605-netfilter-nft_set_hash-unaligned-atomic-read-on-stru.patch diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 6cee9d1e8cb..1cda04d0c58 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .69 -LINUX_KERNEL_HASH-6.6.69 = 9c6305567b75d99514cde6eb9de39973f3d5c857a75bd9dcdfca57041f8d4f34 +LINUX_VERSION-6.6 = .70 +LINUX_KERNEL_HASH-6.6.70 = 84d23ee07fb26febbcb6d1295ba15efdc67ac382b4137b2c8853146c10fd2f97 diff --git a/target/linux/airoha/patches-6.6/002-v6.11-i2c-mt7621-Add-Airoha-EN7581-i2c-support.patch b/target/linux/airoha/patches-6.6/002-v6.11-i2c-mt7621-Add-Airoha-EN7581-i2c-support.patch index 25eb475e214..46c376e343d 100644 --- a/target/linux/airoha/patches-6.6/002-v6.11-i2c-mt7621-Add-Airoha-EN7581-i2c-support.patch +++ b/target/linux/airoha/patches-6.6/002-v6.11-i2c-mt7621-Add-Airoha-EN7581-i2c-support.patch @@ -16,7 +16,7 @@ Signed-off-by: Andi Shyti --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig -@@ -839,7 +839,7 @@ config I2C_MT65XX +@@ -841,7 +841,7 @@ config I2C_MT65XX config I2C_MT7621 tristate "MT7621/MT7628 I2C Controller" diff --git a/target/linux/airoha/patches-6.6/200-spinlock-extend-guard-with-spinlock_bh-variants.patch b/target/linux/airoha/patches-6.6/200-spinlock-extend-guard-with-spinlock_bh-variants.patch index e613b69f81f..d4905d5fff6 100644 --- a/target/linux/airoha/patches-6.6/200-spinlock-extend-guard-with-spinlock_bh-variants.patch +++ b/target/linux/airoha/patches-6.6/200-spinlock-extend-guard-with-spinlock_bh-variants.patch @@ -12,9 +12,9 @@ Signed-off-by: Christian Marangi --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h -@@ -515,6 +515,10 @@ DEFINE_LOCK_GUARD_1(raw_spinlock_irq, ra - raw_spin_lock_irq(_T->lock), - raw_spin_unlock_irq(_T->lock)) +@@ -519,6 +519,10 @@ DEFINE_LOCK_GUARD_1(raw_spinlock_irq, ra + + DEFINE_LOCK_GUARD_1_COND(raw_spinlock_irq, _try, raw_spin_trylock_irq(_T->lock)) +DEFINE_LOCK_GUARD_1(raw_spinlock_bh, raw_spinlock_t, + raw_spin_lock_bh(_T->lock), @@ -23,9 +23,9 @@ Signed-off-by: Christian Marangi DEFINE_LOCK_GUARD_1(raw_spinlock_irqsave, raw_spinlock_t, raw_spin_lock_irqsave(_T->lock, _T->flags), raw_spin_unlock_irqrestore(_T->lock, _T->flags), -@@ -528,6 +532,10 @@ DEFINE_LOCK_GUARD_1(spinlock_irq, spinlo - spin_lock_irq(_T->lock), - spin_unlock_irq(_T->lock)) +@@ -540,6 +544,10 @@ DEFINE_LOCK_GUARD_1(spinlock_irq, spinlo + DEFINE_LOCK_GUARD_1_COND(spinlock_irq, _try, + spin_trylock_irq(_T->lock)) +DEFINE_LOCK_GUARD_1(spinlock_bh, spinlock_t, + spin_lock_bh(_T->lock), diff --git a/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch b/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch index f8aa2fe5a74..7dc38f06117 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch @@ -28,7 +28,7 @@ We don't agree with upstream revert so undo it. pdev->device == PCI_DEVICE_ID_ASMEDIA_1042_XHCI) { --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -633,8 +633,11 @@ static int xhci_move_dequeue_past_td(str +@@ -634,8 +634,11 @@ static int xhci_move_dequeue_past_td(str struct xhci_ring *ep_ring; struct xhci_command *cmd; struct xhci_segment *new_seg; @@ -40,7 +40,7 @@ We don't agree with upstream revert so undo it. dma_addr_t addr; u64 hw_dequeue; bool cycle_found = false; -@@ -672,7 +675,27 @@ static int xhci_move_dequeue_past_td(str +@@ -673,7 +676,27 @@ static int xhci_move_dequeue_past_td(str hw_dequeue = xhci_get_hw_deq(xhci, dev, ep_index, stream_id); new_seg = ep_ring->deq_seg; new_deq = ep_ring->dequeue; diff --git a/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch b/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch index ecb7bffa025..fe0e2275f10 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch @@ -17583,7 +17583,7 @@ Signed-off-by: Phil Elwell * For devices with more than one control interface, we assume the --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c -@@ -2247,6 +2247,8 @@ static const struct usb_audio_quirk_flag +@@ -2249,6 +2249,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x534d, 0x2109, /* MacroSilicon MS2109 */ QUIRK_FLAG_ALIGN_TRANSFER), diff --git a/target/linux/bcm27xx/patches-6.6/950-0161-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch b/target/linux/bcm27xx/patches-6.6/950-0161-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch index 942f47a0a36..157fedf2708 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0161-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0161-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch @@ -15,7 +15,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c -@@ -1497,6 +1497,109 @@ command_cleanup: +@@ -1498,6 +1498,109 @@ command_cleanup: } /* @@ -125,7 +125,7 @@ Signed-off-by: Jonathan Bell * non-error returns are a promise to giveback() the urb later * we drop ownership so next owner (or urb unlink) can get it */ -@@ -5347,6 +5450,7 @@ static const struct hc_driver xhci_hc_dr +@@ -5360,6 +5463,7 @@ static const struct hc_driver xhci_hc_dr .endpoint_reset = xhci_endpoint_reset, .check_bandwidth = xhci_check_bandwidth, .reset_bandwidth = xhci_reset_bandwidth, diff --git a/target/linux/bcm27xx/patches-6.6/950-0162-usb-xhci-workaround-for-bogus-SET_DEQ_PENDING-endpoi.patch b/target/linux/bcm27xx/patches-6.6/950-0162-usb-xhci-workaround-for-bogus-SET_DEQ_PENDING-endpoi.patch index 32681a1bc4b..bae92863652 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0162-usb-xhci-workaround-for-bogus-SET_DEQ_PENDING-endpoi.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0162-usb-xhci-workaround-for-bogus-SET_DEQ_PENDING-endpoi.patch @@ -26,7 +26,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -738,9 +738,9 @@ deq_found: +@@ -739,9 +739,9 @@ deq_found: } if ((ep->ep_state & SET_DEQ_PENDING)) { diff --git a/target/linux/bcm27xx/patches-6.6/950-0163-usb-xhci-drop-and-add-the-endpoint-context-in-xhci_f.patch b/target/linux/bcm27xx/patches-6.6/950-0163-usb-xhci-drop-and-add-the-endpoint-context-in-xhci_f.patch index 1e5bb6059d2..70401f6e7b5 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0163-usb-xhci-drop-and-add-the-endpoint-context-in-xhci_f.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0163-usb-xhci-drop-and-add-the-endpoint-context-in-xhci_f.patch @@ -19,7 +19,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c -@@ -1586,7 +1586,7 @@ static void xhci_fixup_endpoint(struct u +@@ -1587,7 +1587,7 @@ static void xhci_fixup_endpoint(struct u return; } ctrl_ctx->add_flags = xhci_get_endpoint_flag_from_index(ep_index); diff --git a/target/linux/bcm27xx/patches-6.6/950-0481-xhci-Use-more-event-ring-segment-table-entries.patch b/target/linux/bcm27xx/patches-6.6/950-0481-xhci-Use-more-event-ring-segment-table-entries.patch index ff8c9223b5f..874725601c1 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0481-xhci-Use-more-event-ring-segment-table-entries.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0481-xhci-Use-more-event-ring-segment-table-entries.patch @@ -52,7 +52,7 @@ Signed-off-by: Jonathan Bell erst_base = xhci_read_64(xhci, &ir->ir_set->erst_base); --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1425,8 +1425,9 @@ struct urb_priv { +@@ -1426,8 +1426,9 @@ struct urb_priv { * Each segment table entry is 4*32bits long. 1K seems like an ok size: * (1K bytes * 8bytes/bit) / (4*32 bits) = 64 segment entries in the table, * meaning 64 ring segments. diff --git a/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch b/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch index 93e45b54424..55479438800 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch @@ -34,7 +34,7 @@ Signed-off-by: Jonathan Bell if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -728,6 +728,15 @@ static int xhci_move_dequeue_past_td(str +@@ -729,6 +729,15 @@ static int xhci_move_dequeue_past_td(str } while (!cycle_found || !td_last_trb_found); deq_found: @@ -52,7 +52,7 @@ Signed-off-by: Jonathan Bell addr = xhci_trb_virt_to_dma(new_seg, new_deq); --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1663,6 +1663,9 @@ struct xhci_hcd { +@@ -1664,6 +1664,9 @@ struct xhci_hcd { #define XHCI_CDNS_SCTX_QUIRK BIT_ULL(48) #define XHCI_ETRON_HOST BIT_ULL(49) diff --git a/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch b/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch index add65ee641d..a1e8f9ed222 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch @@ -100,7 +100,7 @@ Signed-off-by: Jonathan Bell if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1665,6 +1665,7 @@ struct xhci_hcd { +@@ -1666,6 +1666,7 @@ struct xhci_hcd { /* Downstream VLI fixes */ #define XHCI_AVOID_DQ_ON_LINK BIT_ULL(56) diff --git a/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch b/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch index 9c45bd77e9a..26abb99fe6f 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch @@ -75,7 +75,7 @@ Signed-off-by: Jonathan Bell if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -3674,6 +3674,48 @@ static int xhci_align_td(struct xhci_hcd +@@ -3714,6 +3714,48 @@ static int xhci_align_td(struct xhci_hcd return 1; } @@ -124,7 +124,7 @@ Signed-off-by: Jonathan Bell /* This is very similar to what ehci-q.c qtd_fill() does */ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, int slot_id, unsigned int ep_index) -@@ -3830,6 +3872,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3870,6 +3912,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * } check_trb_math(urb, enqd_len); @@ -133,7 +133,7 @@ Signed-off-by: Jonathan Bell giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, start_cycle, start_trb); return 0; -@@ -3979,6 +4023,8 @@ int xhci_queue_ctrl_tx(struct xhci_hcd * +@@ -4019,6 +4063,8 @@ int xhci_queue_ctrl_tx(struct xhci_hcd * /* Event on completion */ field | TRB_IOC | TRB_TYPE(TRB_STATUS) | ep_ring->cycle_state); @@ -144,7 +144,7 @@ Signed-off-by: Jonathan Bell return 0; --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1666,6 +1666,7 @@ struct xhci_hcd { +@@ -1667,6 +1667,7 @@ struct xhci_hcd { /* Downstream VLI fixes */ #define XHCI_AVOID_DQ_ON_LINK BIT_ULL(56) #define XHCI_VLI_SS_BULK_OUT_BUG BIT_ULL(57) diff --git a/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch b/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch index 551bfccc750..2448bd942a9 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch @@ -333,7 +333,7 @@ Signed-off-by: Jonathan Bell /* Global Debug LSP MUX Select */ #define DWC3_GDBGLSPMUX_ENDBC BIT(15) /* Host only */ #define DWC3_GDBGLSPMUX_HOSTSELECT(n) ((n) & 0x3fff) -@@ -1062,6 +1065,7 @@ struct dwc3_scratchpad_array { +@@ -1066,6 +1069,7 @@ struct dwc3_scratchpad_array { * @tx_max_burst_prd: max periodic ESS transmit burst size * @tx_fifo_resize_max_num: max number of fifos allocated during txfifo resize * @clear_stall_protocol: endpoint number that requires a delayed status phase @@ -341,7 +341,7 @@ Signed-off-by: Jonathan Bell * @hsphy_interface: "utmi" or "ulpi" * @connected: true when we're connected to a host, false otherwise * @softconnect: true when gadget connect is called, false when disconnect runs -@@ -1299,6 +1303,7 @@ struct dwc3 { +@@ -1303,6 +1307,7 @@ struct dwc3 { u8 tx_max_burst_prd; u8 tx_fifo_resize_max_num; u8 clear_stall_protocol; diff --git a/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch b/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch index 706baccdc72..6eb5e5697f7 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0853-drivers-usb-dwc3-add-FS-LS-bus-instance-parkmode-dis.patch @@ -45,7 +45,7 @@ Signed-off-by: Jonathan Bell #define DWC3_GUCTL1_RESUME_OPMODE_HS_HOST BIT(10) /* Global Status Register */ -@@ -1117,10 +1118,12 @@ struct dwc3_scratchpad_array { +@@ -1121,10 +1122,12 @@ struct dwc3_scratchpad_array { * generation after resume from suspend. * @ulpi_ext_vbus_drv: Set to confiure the upli chip to drives CPEN pin * VBUS with an external supply. @@ -62,7 +62,7 @@ Signed-off-by: Jonathan Bell * @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk * @tx_de_emphasis: Tx de-emphasis value * 0 - -6dB de-emphasis -@@ -1347,6 +1350,7 @@ struct dwc3 { +@@ -1351,6 +1354,7 @@ struct dwc3 { unsigned ulpi_ext_vbus_drv:1; unsigned parkmode_disable_ss_quirk:1; unsigned parkmode_disable_hs_quirk:1; diff --git a/target/linux/bcm27xx/patches-6.6/950-1261-mm-vmscan-Maintain-TLB-coherency-in-LRU-code.patch b/target/linux/bcm27xx/patches-6.6/950-1261-mm-vmscan-Maintain-TLB-coherency-in-LRU-code.patch index 70ece97505c..3c60865aa7f 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1261-mm-vmscan-Maintain-TLB-coherency-in-LRU-code.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1261-mm-vmscan-Maintain-TLB-coherency-in-LRU-code.patch @@ -16,7 +16,7 @@ Signed-off-by: Phil Elwell --- a/mm/vmscan.c +++ b/mm/vmscan.c -@@ -4716,7 +4716,7 @@ void lru_gen_look_around(struct page_vma +@@ -4723,7 +4723,7 @@ void lru_gen_look_around(struct page_vma if (!folio) continue; diff --git a/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch b/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch index ed7dbb0e6c6..cb4f6deb393 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1359-usb-dwc3-core-add-support-for-setting-NAK-enhancemen.patch @@ -57,7 +57,7 @@ Signed-off-by: Jonathan Bell #define DWC3_GUCTL1_PARKMODE_DISABLE_SS BIT(17) #define DWC3_GUCTL1_PARKMODE_DISABLE_HS BIT(16) #define DWC3_GUCTL1_PARKMODE_DISABLE_FSLS BIT(15) -@@ -1118,6 +1120,8 @@ struct dwc3_scratchpad_array { +@@ -1122,6 +1124,8 @@ struct dwc3_scratchpad_array { * generation after resume from suspend. * @ulpi_ext_vbus_drv: Set to confiure the upli chip to drives CPEN pin * VBUS with an external supply. @@ -66,7 +66,7 @@ Signed-off-by: Jonathan Bell * @parkmode_disable_ss_quirk: If set, disable park mode feature for all * Superspeed instances. * @parkmode_disable_hs_quirk: If set, disable park mode feature for all -@@ -1348,6 +1352,8 @@ struct dwc3 { +@@ -1352,6 +1356,8 @@ struct dwc3 { unsigned dis_tx_ipgap_linecheck_quirk:1; unsigned resume_hs_terminations:1; unsigned ulpi_ext_vbus_drv:1; diff --git a/target/linux/bcm27xx/patches-6.6/950-1361-drivers-usb-xhci-prevent-a-theoretical-race-on-non-c.patch b/target/linux/bcm27xx/patches-6.6/950-1361-drivers-usb-xhci-prevent-a-theoretical-race-on-non-c.patch index d3ea1041c2a..c2f37a0fc1f 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1361-drivers-usb-xhci-prevent-a-theoretical-race-on-non-c.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1361-drivers-usb-xhci-prevent-a-theoretical-race-on-non-c.patch @@ -28,7 +28,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -505,6 +505,19 @@ void xhci_ring_ep_doorbell(struct xhci_h +@@ -506,6 +506,19 @@ void xhci_ring_ep_doorbell(struct xhci_h trace_xhci_ring_ep_doorbell(slot_id, DB_VALUE(ep_index, stream_id)); diff --git a/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch b/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch index 7ac12a290f6..aef84351482 100644 --- a/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch +++ b/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch @@ -35,7 +35,7 @@ it on BCM4708 family. /* called during probe() after chip reset completes */ --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c -@@ -161,6 +161,49 @@ int xhci_start(struct xhci_hcd *xhci) +@@ -162,6 +162,49 @@ int xhci_start(struct xhci_hcd *xhci) return ret; } @@ -85,7 +85,7 @@ it on BCM4708 family. /* * Reset a halted HC. * -@@ -480,6 +523,15 @@ static int xhci_run_finished(struct xhci +@@ -481,6 +524,15 @@ static int xhci_run_finished(struct xhci return -ENODEV; } @@ -103,7 +103,7 @@ it on BCM4708 family. if (xhci->quirks & XHCI_NEC_HOST) --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1661,6 +1661,7 @@ struct xhci_hcd { +@@ -1662,6 +1662,7 @@ struct xhci_hcd { #define XHCI_WRITE_64_HI_LO BIT_ULL(47) #define XHCI_CDNS_SCTX_QUIRK BIT_ULL(48) #define XHCI_ETRON_HOST BIT_ULL(49) diff --git a/target/linux/generic/backport-6.6/600-v6.10-net-Remove-conditional-threaded-NAPI-wakeup-based-on.patch b/target/linux/generic/backport-6.6/600-v6.10-net-Remove-conditional-threaded-NAPI-wakeup-based-on.patch index 6ee4716c5cd..a6164c82389 100644 --- a/target/linux/generic/backport-6.6/600-v6.10-net-Remove-conditional-threaded-NAPI-wakeup-based-on.patch +++ b/target/linux/generic/backport-6.6/600-v6.10-net-Remove-conditional-threaded-NAPI-wakeup-based-on.patch @@ -32,7 +32,7 @@ Signed-off-by: Paolo Abeni --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -4481,13 +4481,7 @@ static inline void ____napi_schedule(str +@@ -4483,13 +4483,7 @@ static inline void ____napi_schedule(str */ thread = READ_ONCE(napi->thread); if (thread) { @@ -47,7 +47,7 @@ Signed-off-by: Paolo Abeni wake_up_process(thread); return; } -@@ -6643,8 +6637,6 @@ static int napi_poll(struct napi_struct +@@ -6645,8 +6639,6 @@ static int napi_poll(struct napi_struct static int napi_thread_wait(struct napi_struct *napi) { @@ -56,7 +56,7 @@ Signed-off-by: Paolo Abeni set_current_state(TASK_INTERRUPTIBLE); while (!kthread_should_stop()) { -@@ -6653,15 +6645,13 @@ static int napi_thread_wait(struct napi_ +@@ -6655,15 +6647,13 @@ static int napi_thread_wait(struct napi_ * Testing SCHED bit is not enough because SCHED bit might be * set by some other busy poll thread or by napi_disable(). */ diff --git a/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch b/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch index 8c0b41f37b3..b3729e8b6c0 100644 --- a/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch +++ b/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch @@ -108,7 +108,7 @@ Signed-off-by: Paolo Abeni static inline void rps_lock_irqsave(struct softnet_data *sd, unsigned long *flags) { -@@ -4449,6 +4475,7 @@ EXPORT_SYMBOL(__dev_direct_xmit); +@@ -4451,6 +4477,7 @@ EXPORT_SYMBOL(__dev_direct_xmit); /************************************************************************* * Receiver routines *************************************************************************/ @@ -116,7 +116,7 @@ Signed-off-by: Paolo Abeni int netdev_max_backlog __read_mostly = 1000; EXPORT_SYMBOL(netdev_max_backlog); -@@ -4481,12 +4508,16 @@ static inline void ____napi_schedule(str +@@ -4483,12 +4510,16 @@ static inline void ____napi_schedule(str */ thread = READ_ONCE(napi->thread); if (thread) { @@ -133,7 +133,7 @@ Signed-off-by: Paolo Abeni list_add_tail(&napi->poll_list, &sd->poll_list); WRITE_ONCE(napi->list_owner, smp_processor_id()); /* If not called from net_rx_action() -@@ -4732,6 +4763,11 @@ static void napi_schedule_rps(struct sof +@@ -4734,6 +4765,11 @@ static void napi_schedule_rps(struct sof #ifdef CONFIG_RPS if (sd != mysd) { @@ -145,7 +145,7 @@ Signed-off-by: Paolo Abeni sd->rps_ipi_next = mysd->rps_ipi_list; mysd->rps_ipi_list = sd; -@@ -5955,7 +5991,7 @@ static void net_rps_action_and_irq_enabl +@@ -5957,7 +5993,7 @@ static void net_rps_action_and_irq_enabl #ifdef CONFIG_RPS struct softnet_data *remsd = sd->rps_ipi_list; @@ -154,7 +154,7 @@ Signed-off-by: Paolo Abeni sd->rps_ipi_list = NULL; local_irq_enable(); -@@ -5970,7 +6006,7 @@ static void net_rps_action_and_irq_enabl +@@ -5972,7 +6008,7 @@ static void net_rps_action_and_irq_enabl static bool sd_has_rps_ipi_waiting(struct softnet_data *sd) { #ifdef CONFIG_RPS @@ -163,7 +163,7 @@ Signed-off-by: Paolo Abeni #else return false; #endif -@@ -6014,7 +6050,7 @@ static int process_backlog(struct napi_s +@@ -6016,7 +6052,7 @@ static int process_backlog(struct napi_s * We can use a plain write instead of clear_bit(), * and we dont need an smp_mb() memory barrier. */ @@ -172,7 +172,7 @@ Signed-off-by: Paolo Abeni again = false; } else { skb_queue_splice_tail_init(&sd->input_pkt_queue, -@@ -6680,43 +6716,48 @@ static void skb_defer_free_flush(struct +@@ -6682,43 +6718,48 @@ static void skb_defer_free_flush(struct } } @@ -250,7 +250,7 @@ Signed-off-by: Paolo Abeni return 0; } -@@ -11297,7 +11338,7 @@ static int dev_cpu_dead(unsigned int old +@@ -11299,7 +11340,7 @@ static int dev_cpu_dead(unsigned int old list_del_init(&napi->poll_list); if (napi->poll == process_backlog) @@ -259,7 +259,7 @@ Signed-off-by: Paolo Abeni else ____napi_schedule(sd, napi); } -@@ -11305,12 +11346,14 @@ static int dev_cpu_dead(unsigned int old +@@ -11307,12 +11348,14 @@ static int dev_cpu_dead(unsigned int old raise_softirq_irqoff(NET_TX_SOFTIRQ); local_irq_enable(); @@ -278,7 +278,7 @@ Signed-off-by: Paolo Abeni /* Process offline CPU's input_pkt_queue */ while ((skb = __skb_dequeue(&oldsd->process_queue))) { -@@ -11573,6 +11616,38 @@ static struct pernet_operations __net_in +@@ -11575,6 +11618,38 @@ static struct pernet_operations __net_in * */ @@ -317,7 +317,7 @@ Signed-off-by: Paolo Abeni /* * This is called single threaded during boot, so no need * to take the rtnl semaphore. -@@ -11623,7 +11698,10 @@ static int __init net_dev_init(void) +@@ -11625,7 +11700,10 @@ static int __init net_dev_init(void) init_gro_hash(&sd->backlog); sd->backlog.poll = process_backlog; sd->backlog.weight = weight_p; diff --git a/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch b/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch index 3fcc72e5895..82b83552d37 100644 --- a/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch +++ b/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch @@ -82,7 +82,7 @@ Signed-off-by: Paolo Abeni spin_unlock_irq(&sd->input_pkt_queue.lock); else if (!IS_ENABLED(CONFIG_PREEMPT_RT)) local_irq_enable(); -@@ -4782,6 +4782,23 @@ static void napi_schedule_rps(struct sof +@@ -4784,6 +4784,23 @@ static void napi_schedule_rps(struct sof __napi_schedule_irqoff(&mysd->backlog); } diff --git a/target/linux/generic/backport-6.6/603-v6.10-net-Rename-rps_lock-to-backlog_lock.patch b/target/linux/generic/backport-6.6/603-v6.10-net-Rename-rps_lock-to-backlog_lock.patch index 056bd5686ea..a6199cd2500 100644 --- a/target/linux/generic/backport-6.6/603-v6.10-net-Rename-rps_lock-to-backlog_lock.patch +++ b/target/linux/generic/backport-6.6/603-v6.10-net-Rename-rps_lock-to-backlog_lock.patch @@ -67,7 +67,7 @@ Signed-off-by: Paolo Abeni { if (IS_ENABLED(CONFIG_RPS) || use_backlog_threads()) spin_unlock_irq(&sd->input_pkt_queue.lock); -@@ -4787,12 +4787,12 @@ void kick_defer_list_purge(struct softne +@@ -4789,12 +4789,12 @@ void kick_defer_list_purge(struct softne unsigned long flags; if (use_backlog_threads()) { @@ -82,7 +82,7 @@ Signed-off-by: Paolo Abeni } else if (!cmpxchg(&sd->defer_ipi_scheduled, 0, 1)) { smp_call_function_single_async(cpu, &sd->defer_csd); -@@ -4854,7 +4854,7 @@ static int enqueue_to_backlog(struct sk_ +@@ -4856,7 +4856,7 @@ static int enqueue_to_backlog(struct sk_ reason = SKB_DROP_REASON_NOT_SPECIFIED; sd = &per_cpu(softnet_data, cpu); @@ -91,7 +91,7 @@ Signed-off-by: Paolo Abeni if (!netif_running(skb->dev)) goto drop; qlen = skb_queue_len(&sd->input_pkt_queue); -@@ -4863,7 +4863,7 @@ static int enqueue_to_backlog(struct sk_ +@@ -4865,7 +4865,7 @@ static int enqueue_to_backlog(struct sk_ enqueue: __skb_queue_tail(&sd->input_pkt_queue, skb); input_queue_tail_incr_save(sd, qtail); @@ -100,7 +100,7 @@ Signed-off-by: Paolo Abeni return NET_RX_SUCCESS; } -@@ -4878,7 +4878,7 @@ enqueue: +@@ -4880,7 +4880,7 @@ enqueue: drop: sd->dropped++; @@ -109,7 +109,7 @@ Signed-off-by: Paolo Abeni dev_core_stats_rx_dropped_inc(skb->dev); kfree_skb_reason(skb, reason); -@@ -5909,7 +5909,7 @@ static void flush_backlog(struct work_st +@@ -5911,7 +5911,7 @@ static void flush_backlog(struct work_st local_bh_disable(); sd = this_cpu_ptr(&softnet_data); @@ -118,7 +118,7 @@ Signed-off-by: Paolo Abeni skb_queue_walk_safe(&sd->input_pkt_queue, skb, tmp) { if (skb->dev->reg_state == NETREG_UNREGISTERING) { __skb_unlink(skb, &sd->input_pkt_queue); -@@ -5917,7 +5917,7 @@ static void flush_backlog(struct work_st +@@ -5919,7 +5919,7 @@ static void flush_backlog(struct work_st input_queue_head_incr(sd); } } @@ -127,7 +127,7 @@ Signed-off-by: Paolo Abeni skb_queue_walk_safe(&sd->process_queue, skb, tmp) { if (skb->dev->reg_state == NETREG_UNREGISTERING) { -@@ -5935,14 +5935,14 @@ static bool flush_required(int cpu) +@@ -5937,14 +5937,14 @@ static bool flush_required(int cpu) struct softnet_data *sd = &per_cpu(softnet_data, cpu); bool do_flush; @@ -144,7 +144,7 @@ Signed-off-by: Paolo Abeni return do_flush; #endif -@@ -6057,7 +6057,7 @@ static int process_backlog(struct napi_s +@@ -6059,7 +6059,7 @@ static int process_backlog(struct napi_s } @@ -153,7 +153,7 @@ Signed-off-by: Paolo Abeni if (skb_queue_empty(&sd->input_pkt_queue)) { /* * Inline a custom version of __napi_complete(). -@@ -6073,7 +6073,7 @@ static int process_backlog(struct napi_s +@@ -6075,7 +6075,7 @@ static int process_backlog(struct napi_s skb_queue_splice_tail_init(&sd->input_pkt_queue, &sd->process_queue); } diff --git a/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch b/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch index 42aff7f0afc..6b5272d583f 100644 --- a/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch +++ b/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch @@ -20,7 +20,7 @@ Signed-off-by: Jakub Kicinski --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -9759,6 +9759,15 @@ static void netdev_sync_lower_features(s +@@ -9761,6 +9761,15 @@ static void netdev_sync_lower_features(s } } @@ -36,7 +36,7 @@ Signed-off-by: Jakub Kicinski static netdev_features_t netdev_fix_features(struct net_device *dev, netdev_features_t features) { -@@ -9840,15 +9849,9 @@ static netdev_features_t netdev_fix_feat +@@ -9842,15 +9851,9 @@ static netdev_features_t netdev_fix_feat features &= ~NETIF_F_LRO; } @@ -55,7 +55,7 @@ Signed-off-by: Jakub Kicinski } if ((features & NETIF_F_HW_TLS_RX) && !(features & NETIF_F_RXCSUM)) { -@@ -9856,6 +9859,11 @@ static netdev_features_t netdev_fix_feat +@@ -9858,6 +9861,11 @@ static netdev_features_t netdev_fix_feat features &= ~NETIF_F_HW_TLS_RX; } diff --git a/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch b/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch index d72882dbb68..8f2c26d6543 100644 --- a/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch +++ b/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch @@ -18,7 +18,7 @@ Signed-off-by: Paolo Abeni --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -10666,6 +10666,8 @@ struct rtnl_link_stats64 *dev_get_stats( +@@ -10668,6 +10668,8 @@ struct rtnl_link_stats64 *dev_get_stats( ops->ndo_get_stats64(dev, storage); } else if (ops->ndo_get_stats) { netdev_stats_to_stats64(storage, ops->ndo_get_stats(dev)); diff --git a/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch b/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch index 3f48a8c34a9..c8b4ccc3004 100644 --- a/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch +++ b/target/linux/generic/backport-6.6/700-v6.10-net-create-a-dummy-net_device-allocator.patch @@ -49,7 +49,7 @@ Signed-off-by: David S. Miller unsigned char name_assign_type, --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -10353,25 +10353,12 @@ err_free_name: +@@ -10355,25 +10355,12 @@ err_free_name: } EXPORT_SYMBOL(register_netdevice); @@ -79,7 +79,7 @@ Signed-off-by: David S. Miller /* make sure we BUG if trying to hit standard * register/unregister code path */ -@@ -10391,12 +10378,32 @@ int init_dummy_netdev(struct net_device +@@ -10393,12 +10380,32 @@ int init_dummy_netdev(struct net_device * because users of this 'device' dont need to change * its refcount. */ @@ -113,7 +113,7 @@ Signed-off-by: David S. Miller /** * register_netdev - register a network device * @dev: device to register -@@ -10990,6 +10997,19 @@ void free_netdev(struct net_device *dev) +@@ -10992,6 +10999,19 @@ void free_netdev(struct net_device *dev) EXPORT_SYMBOL(free_netdev); /** diff --git a/target/linux/generic/backport-6.6/770-net-introduce-napi_is_scheduled-helper.patch b/target/linux/generic/backport-6.6/770-net-introduce-napi_is_scheduled-helper.patch index d7b2b275067..2bf136e18a3 100644 --- a/target/linux/generic/backport-6.6/770-net-introduce-napi_is_scheduled-helper.patch +++ b/target/linux/generic/backport-6.6/770-net-introduce-napi_is_scheduled-helper.patch @@ -85,7 +85,7 @@ Signed-off-by: Paolo Abeni /** --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -6610,7 +6610,7 @@ static int __napi_poll(struct napi_struc +@@ -6612,7 +6612,7 @@ static int __napi_poll(struct napi_struc * accidentally calling ->poll() when NAPI is not scheduled. */ work = 0; diff --git a/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch b/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch index 21db87419ee..5f7210812fb 100644 --- a/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch +++ b/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch @@ -23,7 +23,7 @@ Signed-off-by: David S. Miller --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -10983,7 +10983,8 @@ void free_netdev(struct net_device *dev) +@@ -10985,7 +10985,8 @@ void free_netdev(struct net_device *dev) dev->xdp_bulkq = NULL; /* Compatibility with error handling in drivers */ diff --git a/target/linux/generic/backport-6.6/902-net-llc-reset-skb-transport_header.patch b/target/linux/generic/backport-6.6/902-net-llc-reset-skb-transport_header.patch deleted file mode 100644 index b1f0b8fce7e..00000000000 --- a/target/linux/generic/backport-6.6/902-net-llc-reset-skb-transport_header.patch +++ /dev/null @@ -1,52 +0,0 @@ -From a024e377efed31ecfb39210bed562932321345b3 Mon Sep 17 00:00:00 2001 -From: Antonio Pastor -Date: Tue, 24 Dec 2024 20:07:20 -0500 -Subject: [PATCH] net: llc: reset skb->transport_header - -802.2+LLC+SNAP frames received by napi_complete_done with GRO and DSA -have skb->transport_header set two bytes short, or pointing 2 bytes -before network_header & skb->data. As snap_rcv expects transport_header -to point to SNAP header (OID:PID) after LLC processing advances offset -over LLC header (llc_rcv & llc_fixup_skb), code doesn't find a match -and packet is dropped. - -Between napi_complete_done and snap_rcv, transport_header is not used -until __netif_receive_skb_core, where originally it was being reset. -Commit fda55eca5a33 ("net: introduce skb_transport_header_was_set()") -only does so if not set, on the assumption the value was set correctly -by GRO (and also on assumption that "network stacks usually reset the -transport header anyway"). Afterwards it is moved forward by -llc_fixup_skb. - -Locally generated traffic shows up at __netif_receive_skb_core with no -transport_header set and is processed without issue. On a setup with -GRO but no DSA, transport_header and network_header are both set to -point to skb->data which is also correct. - -As issue is LLC specific, to avoid impacting non-LLC traffic, and to -follow up on original assumption made on previous code change, -llc_fixup_skb to reset the offset after skb pull. llc_fixup_skb -assumes the LLC header is at skb->data, and by definition SNAP header -immediately follows. - -Fixes: fda55eca5a33 ("net: introduce skb_transport_header_was_set()") -Signed-off-by: Antonio Pastor -Reviewed-by: Eric Dumazet -Link: https://patch.msgid.link/20241225010723.2830290-1-antonio.pastor@gmail.com -Signed-off-by: Jakub Kicinski ---- - net/llc/llc_input.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/net/llc/llc_input.c -+++ b/net/llc/llc_input.c -@@ -124,8 +124,8 @@ static inline int llc_fixup_skb(struct s - if (unlikely(!pskb_may_pull(skb, llc_len))) - return 0; - -- skb->transport_header += llc_len; - skb_pull(skb, llc_len); -+ skb_reset_transport_header(skb); - if (skb->protocol == htons(ETH_P_802_2)) { - __be16 pdulen; - s32 data_size; diff --git a/target/linux/generic/hack-6.6/901-debloat_sock_diag.patch b/target/linux/generic/hack-6.6/901-debloat_sock_diag.patch index 4b1ea3c5ad9..c0ba6c008e8 100644 --- a/target/linux/generic/hack-6.6/901-debloat_sock_diag.patch +++ b/target/linux/generic/hack-6.6/901-debloat_sock_diag.patch @@ -83,7 +83,7 @@ Signed-off-by: Felix Fietkau INDIRECT_CALLABLE_DECLARE(struct dst_entry *ip6_dst_check(struct dst_entry *, u32)); INDIRECT_CALLABLE_DECLARE(struct dst_entry *ipv4_dst_check(struct dst_entry *, -@@ -2239,9 +2256,11 @@ static void __sk_free(struct sock *sk) +@@ -2242,9 +2259,11 @@ static void __sk_free(struct sock *sk) if (likely(sk->sk_net_refcnt)) sock_inuse_add(sock_net(sk), -1); diff --git a/target/linux/generic/hack-6.6/902-debloat_proc.patch b/target/linux/generic/hack-6.6/902-debloat_proc.patch index 54985070076..8a2f3330abf 100644 --- a/target/linux/generic/hack-6.6/902-debloat_proc.patch +++ b/target/linux/generic/hack-6.6/902-debloat_proc.patch @@ -330,7 +330,7 @@ Signed-off-by: Felix Fietkau --- a/net/core/sock.c +++ b/net/core/sock.c -@@ -4140,6 +4140,8 @@ static __net_initdata struct pernet_oper +@@ -4143,6 +4143,8 @@ static __net_initdata struct pernet_oper static int __init proto_init(void) { diff --git a/target/linux/generic/pending-6.6/605-netfilter-nft_set_hash-unaligned-atomic-read-on-stru.patch b/target/linux/generic/pending-6.6/605-netfilter-nft_set_hash-unaligned-atomic-read-on-stru.patch deleted file mode 100644 index 61e163293e2..00000000000 --- a/target/linux/generic/pending-6.6/605-netfilter-nft_set_hash-unaligned-atomic-read-on-stru.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 113fb8a8d1f27156f58b27ce0fc02af9b3705bf7 Mon Sep 17 00:00:00 2001 -From: Pablo Neira Ayuso -Date: Sun, 22 Dec 2024 11:02:39 +0100 -Subject: [PATCH] netfilter: nft_set_hash: unaligned atomic read on struct - nft_set_ext - -Access to genmask field in struct nft_set_ext results in unaligned -atomic read: - -[ 72.130109] Unable to handle kernel paging request at virtual address ffff0000c2bb708c -[ 72.131036] Mem abort info: -[ 72.131213] ESR = 0x0000000096000021 -[ 72.131446] EC = 0x25: DABT (current EL), IL = 32 bits -[ 72.132209] SET = 0, FnV = 0 -[ 72.133216] EA = 0, S1PTW = 0 -[ 72.134080] FSC = 0x21: alignment fault -[ 72.135593] Data abort info: -[ 72.137194] ISV = 0, ISS = 0x00000021, ISS2 = 0x00000000 -[ 72.142351] CM = 0, WnR = 0, TnD = 0, TagAccess = 0 -[ 72.145989] GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 -[ 72.150115] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000237d27000 -[ 72.154893] [ffff0000c2bb708c] pgd=0000000000000000, p4d=180000023ffff403, pud=180000023f84b403, pmd=180000023f835403, -+pte=0068000102bb7707 -[ 72.163021] Internal error: Oops: 0000000096000021 [#1] SMP -[...] -[ 72.170041] CPU: 7 UID: 0 PID: 54 Comm: kworker/7:0 Tainted: G E 6.13.0-rc3+ #2 -[ 72.170509] Tainted: [E]=UNSIGNED_MODULE -[ 72.170720] Hardware name: QEMU QEMU Virtual Machine, BIOS edk2-stable202302-for-qemu 03/01/2023 -[ 72.171192] Workqueue: events_power_efficient nft_rhash_gc [nf_tables] -[ 72.171552] pstate: 21400005 (nzCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--) -[ 72.171915] pc : nft_rhash_gc+0x200/0x2d8 [nf_tables] -[ 72.172166] lr : nft_rhash_gc+0x128/0x2d8 [nf_tables] -[ 72.172546] sp : ffff800081f2bce0 -[ 72.172724] x29: ffff800081f2bd40 x28: ffff0000c2bb708c x27: 0000000000000038 -[ 72.173078] x26: ffff0000c6780ef0 x25: ffff0000c643df00 x24: ffff0000c6778f78 -[ 72.173431] x23: 000000000000001a x22: ffff0000c4b1f000 x21: ffff0000c6780f78 -[ 72.173782] x20: ffff0000c2bb70dc x19: ffff0000c2bb7080 x18: 0000000000000000 -[ 72.174135] x17: ffff0000c0a4e1c0 x16: 0000000000003000 x15: 0000ac26d173b978 -[ 72.174485] x14: ffffffffffffffff x13: 0000000000000030 x12: ffff0000c6780ef0 -[ 72.174841] x11: 0000000000000000 x10: ffff800081f2bcf8 x9 : ffff0000c3000000 -[ 72.175193] x8 : 00000000000004be x7 : 0000000000000000 x6 : 0000000000000000 -[ 72.175544] x5 : 0000000000000040 x4 : ffff0000c3000010 x3 : 0000000000000000 -[ 72.175871] x2 : 0000000000003a98 x1 : ffff0000c2bb708c x0 : 0000000000000004 -[ 72.176207] Call trace: -[ 72.176316] nft_rhash_gc+0x200/0x2d8 [nf_tables] (P) -[ 72.176653] process_one_work+0x178/0x3d0 -[ 72.176831] worker_thread+0x200/0x3f0 -[ 72.176995] kthread+0xe8/0xf8 -[ 72.177130] ret_from_fork+0x10/0x20 -[ 72.177289] Code: 54fff984 d503201f d2800080 91003261 (f820303f) -[ 72.177557] ---[ end trace 0000000000000000 ]--- - -Align struct nft_set_ext to word size to address this and -documentation it. - -pahole reports that this increases the size of elements for rhash and -pipapo in 8 bytes on x86_64. - -Fixes: 7ffc7481153b ("netfilter: nft_set_hash: skip duplicated elements pending gc run") -Signed-off-by: Pablo Neira Ayuso ---- - include/net/netfilter/nf_tables.h | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - ---- a/include/net/netfilter/nf_tables.h -+++ b/include/net/netfilter/nf_tables.h -@@ -721,15 +721,18 @@ struct nft_set_ext_tmpl { - /** - * struct nft_set_ext - set extensions - * -- * @genmask: generation mask -+ * @genmask: generation mask, but also flags (see NFT_SET_ELEM_DEAD_BIT) - * @offset: offsets of individual extension types - * @data: beginning of extension data -+ * -+ * This structure must be aligned to word size, otherwise atomic bitops -+ * on genmask field can cause aligment failure on some archs. - */ - struct nft_set_ext { - u8 genmask; - u8 offset[NFT_SET_EXT_NUM]; - char data[]; --}; -+} __aligned(BITS_PER_LONG / 8); - - static inline void nft_set_ext_prepare(struct nft_set_ext_tmpl *tmpl) - { diff --git a/target/linux/generic/pending-6.6/630-packet_socket_type.patch b/target/linux/generic/pending-6.6/630-packet_socket_type.patch index 2b753efa673..f5c15756c5e 100644 --- a/target/linux/generic/pending-6.6/630-packet_socket_type.patch +++ b/target/linux/generic/pending-6.6/630-packet_socket_type.patch @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau #define PACKET_FANOUT_LB 1 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c -@@ -1925,6 +1925,7 @@ static int packet_rcv_spkt(struct sk_buf +@@ -1911,6 +1911,7 @@ static int packet_rcv_spkt(struct sk_buf { struct sock *sk; struct sockaddr_pkt *spkt; @@ -38,7 +38,7 @@ Signed-off-by: Felix Fietkau /* * When we registered the protocol we saved the socket in the data -@@ -1932,6 +1933,7 @@ static int packet_rcv_spkt(struct sk_buf +@@ -1918,6 +1919,7 @@ static int packet_rcv_spkt(struct sk_buf */ sk = pt->af_packet_priv; @@ -46,7 +46,7 @@ Signed-off-by: Felix Fietkau /* * Yank back the headers [hope the device set this -@@ -1944,7 +1946,7 @@ static int packet_rcv_spkt(struct sk_buf +@@ -1930,7 +1932,7 @@ static int packet_rcv_spkt(struct sk_buf * so that this procedure is noop. */ @@ -55,7 +55,7 @@ Signed-off-by: Felix Fietkau goto out; if (!net_eq(dev_net(dev), sock_net(sk))) -@@ -2190,12 +2192,12 @@ static int packet_rcv(struct sk_buff *sk +@@ -2176,12 +2178,12 @@ static int packet_rcv(struct sk_buff *sk unsigned int snaplen, res; bool is_drop_n_account = false; @@ -71,7 +71,7 @@ Signed-off-by: Felix Fietkau if (!net_eq(dev_net(dev), sock_net(sk))) goto drop; -@@ -2322,12 +2324,12 @@ static int tpacket_rcv(struct sk_buff *s +@@ -2308,12 +2310,12 @@ static int tpacket_rcv(struct sk_buff *s BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h2)) != 32); BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h3)) != 48); @@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau if (!net_eq(dev_net(dev), sock_net(sk))) goto drop; -@@ -3451,6 +3453,7 @@ static int packet_create(struct net *net +@@ -3437,6 +3439,7 @@ static int packet_create(struct net *net mutex_init(&po->pg_vec_lock); po->rollover = NULL; po->prot_hook.func = packet_rcv; @@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau if (sock->type == SOCK_PACKET) po->prot_hook.func = packet_rcv_spkt; -@@ -4118,6 +4121,16 @@ packet_setsockopt(struct socket *sock, i +@@ -4104,6 +4107,16 @@ packet_setsockopt(struct socket *sock, i packet_sock_flag_set(po, PACKET_SOCK_QDISC_BYPASS, val); return 0; } @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau default: return -ENOPROTOOPT; } -@@ -4177,6 +4190,13 @@ static int packet_getsockopt(struct sock +@@ -4163,6 +4176,13 @@ static int packet_getsockopt(struct sock case PACKET_VNET_HDR_SZ: val = READ_ONCE(po->vnet_hdr_sz); break; diff --git a/target/linux/generic/pending-6.6/681-net-remove-NETIF_F_GSO_FRAGLIST-from-NETIF_F_GSO_SOF.patch b/target/linux/generic/pending-6.6/681-net-remove-NETIF_F_GSO_FRAGLIST-from-NETIF_F_GSO_SOF.patch index 97e321bfec1..58ccff247fb 100644 --- a/target/linux/generic/pending-6.6/681-net-remove-NETIF_F_GSO_FRAGLIST-from-NETIF_F_GSO_SOF.patch +++ b/target/linux/generic/pending-6.6/681-net-remove-NETIF_F_GSO_FRAGLIST-from-NETIF_F_GSO_SOF.patch @@ -96,7 +96,7 @@ Signed-off-by: Felix Fietkau return features; --- a/net/core/sock.c +++ b/net/core/sock.c -@@ -2441,7 +2441,7 @@ void sk_setup_caps(struct sock *sk, stru +@@ -2444,7 +2444,7 @@ void sk_setup_caps(struct sock *sk, stru if (sk_is_tcp(sk)) sk->sk_route_caps |= NETIF_F_GSO; if (sk->sk_route_caps & NETIF_F_GSO) diff --git a/target/linux/lantiq/patches-6.6/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch b/target/linux/lantiq/patches-6.6/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch index 1f2f5139d60..73eb59f1664 100644 --- a/target/linux/lantiq/patches-6.6/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch +++ b/target/linux/lantiq/patches-6.6/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch @@ -18,7 +18,7 @@ Signed-off-by: John Crispin --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig -@@ -817,6 +817,16 @@ config I2C_MICROCHIP_CORE +@@ -819,6 +819,16 @@ config I2C_MICROCHIP_CORE This driver can also be built as a module. If so, the module will be called i2c-microchip-core. diff --git a/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch b/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch index c98aaf9442b..a01911b1f4e 100644 --- a/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch +++ b/target/linux/ramips/patches-6.6/810-uvc-add-iPassion-iP2970-support.patch @@ -13,7 +13,7 @@ Signed-off-by: John Crispin --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c -@@ -3249,6 +3249,18 @@ static const struct usb_device_id uvc_id +@@ -3271,6 +3271,18 @@ static const struct usb_device_id uvc_id .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, diff --git a/target/linux/ramips/patches-6.6/825-i2c-MIPS-adds-ralink-I2C-driver.patch b/target/linux/ramips/patches-6.6/825-i2c-MIPS-adds-ralink-I2C-driver.patch index c8cfb784ce5..9755eeb777d 100644 --- a/target/linux/ramips/patches-6.6/825-i2c-MIPS-adds-ralink-I2C-driver.patch +++ b/target/linux/ramips/patches-6.6/825-i2c-MIPS-adds-ralink-I2C-driver.patch @@ -45,7 +45,7 @@ Signed-off-by: John Crispin +}; --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig -@@ -1021,6 +1021,11 @@ config I2C_RK3X +@@ -1023,6 +1023,11 @@ config I2C_RK3X This driver can also be built as a module. If so, the module will be called i2c-rk3x. diff --git a/target/linux/realtek/patches-6.6/310-add-i2c-rtl9300-support.patch b/target/linux/realtek/patches-6.6/310-add-i2c-rtl9300-support.patch index 71df91bdacb..9eaed95d0df 100644 --- a/target/linux/realtek/patches-6.6/310-add-i2c-rtl9300-support.patch +++ b/target/linux/realtek/patches-6.6/310-add-i2c-rtl9300-support.patch @@ -17,7 +17,7 @@ Submitted-by: Birger Koblitz --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig -@@ -1021,6 +1021,16 @@ config I2C_RK3X +@@ -1023,6 +1023,16 @@ config I2C_RK3X This driver can also be built as a module. If so, the module will be called i2c-rk3x. diff --git a/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch b/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch index 00ca1d40139..d38d260ef17 100644 --- a/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch +++ b/target/linux/rockchip/patches-6.6/034-v6.7-usb-dwc3-add-optional-PHY-interface-clocks.patch @@ -71,7 +71,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h -@@ -998,6 +998,8 @@ struct dwc3_scratchpad_array { +@@ -1002,6 +1002,8 @@ struct dwc3_scratchpad_array { * @bus_clk: clock for accessing the registers * @ref_clk: reference clock * @susp_clk: clock used when the SS phy is in low power (S3) state @@ -80,7 +80,7 @@ Signed-off-by: Greg Kroah-Hartman * @reset: reset control * @regs: base address for our registers * @regs_size: address space size -@@ -1170,6 +1172,8 @@ struct dwc3 { +@@ -1174,6 +1176,8 @@ struct dwc3 { struct clk *bus_clk; struct clk *ref_clk; struct clk *susp_clk; diff --git a/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch b/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch index 847b8e20ff4..4c1dfabd9e9 100644 --- a/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch +++ b/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch @@ -160,7 +160,7 @@ Signed-off-by: minda.chen } --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -3667,7 +3667,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3707,7 +3707,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * full_len = urb->transfer_buffer_length; /* If we have scatter/gather list, we use it. */ @@ -172,7 +172,7 @@ Signed-off-by: minda.chen addr = (u64) sg_dma_address(sg); --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c -@@ -18,6 +18,8 @@ +@@ -19,6 +19,8 @@ #include #include #include @@ -181,7 +181,7 @@ Signed-off-by: minda.chen #include "xhci.h" #include "xhci-trace.h" -@@ -1285,6 +1287,55 @@ static void xhci_unmap_temp_buf(struct u +@@ -1286,6 +1288,55 @@ static void xhci_unmap_temp_buf(struct u urb->transfer_buffer = NULL; } @@ -237,7 +237,7 @@ Signed-off-by: minda.chen /* * Bypass the DMA mapping if URB is suitable for Immediate Transfer (IDT), * we'll copy the actual data into the TRB address register. This is limited to -@@ -1305,9 +1356,11 @@ static int xhci_map_urb_for_dma(struct u +@@ -1306,9 +1357,11 @@ static int xhci_map_urb_for_dma(struct u if (xhci_urb_temp_buffer_required(hcd, urb)) return xhci_map_temp_buffer(hcd, urb); } @@ -249,7 +249,7 @@ Signed-off-by: minda.chen static void xhci_unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb) { struct xhci_hcd *xhci; -@@ -1320,8 +1373,10 @@ static void xhci_unmap_urb_for_dma(struc +@@ -1321,8 +1374,10 @@ static void xhci_unmap_urb_for_dma(struc if ((xhci->quirks & XHCI_SG_TRB_CACHE_SIZE_QUIRK) && unmap_temp_buf) xhci_unmap_temp_buf(hcd, urb); @@ -263,7 +263,7 @@ Signed-off-by: minda.chen /** --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1508,6 +1508,13 @@ struct xhci_hub { +@@ -1509,6 +1509,13 @@ struct xhci_hub { u8 min_rev; }; @@ -277,7 +277,7 @@ Signed-off-by: minda.chen /* There is one xhci_hcd structure per controller */ struct xhci_hcd { struct usb_hcd *main_hcd; -@@ -1662,6 +1669,8 @@ struct xhci_hcd { +@@ -1663,6 +1670,8 @@ struct xhci_hcd { #define XHCI_CDNS_SCTX_QUIRK BIT_ULL(48) #define XHCI_ETRON_HOST BIT_ULL(49) @@ -286,7 +286,7 @@ Signed-off-by: minda.chen unsigned int num_active_eps; unsigned int limit_active_eps; struct xhci_port *hw_ports; -@@ -1691,6 +1700,8 @@ struct xhci_hcd { +@@ -1692,6 +1701,8 @@ struct xhci_hcd { struct list_head regset_list; void *dbc; From c23e177080960e18ea560be95edf09cad8eb51e5 Mon Sep 17 00:00:00 2001 From: FUKAUMI Naoki Date: Wed, 8 Jan 2025 21:59:23 +0000 Subject: [PATCH 102/173] uboot-rockchip: Fix product name for Radxa ROCK Pi 4 "ROCK" is the correct series name. https://radxa.com/products/rock4 Signed-off-by: FUKAUMI Naoki Link: https://github.com/openwrt/openwrt/pull/17532 Signed-off-by: Robert Marko --- package/boot/uboot-rockchip/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/boot/uboot-rockchip/Makefile b/package/boot/uboot-rockchip/Makefile index 7070ca973d3..02f750a2977 100644 --- a/package/boot/uboot-rockchip/Makefile +++ b/package/boot/uboot-rockchip/Makefile @@ -138,7 +138,7 @@ endef define U-Boot/rock-pi-4-rk3399 $(U-Boot/rk3399/Default) - NAME:=Rock Pi 4 + NAME:=ROCK Pi 4 BUILD_DEVICES:= \ radxa_rock-pi-4a endef From ead1b45c76b7ad6bb532ca65124a4e593366be08 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Mon, 6 Jan 2025 08:53:28 +0800 Subject: [PATCH 103/173] Revert "kernel: Fix alloc_node_mem_map with ARCH_PFN_OFFSET" The boot hang issue on ralink rt288x has been fixed in Linux upstream commit 7f028bff8a8e ("MIPS: ralink: rt288x: select MIPS_AUTO_PFN_OFFSET") Link: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=7f028bff8a8e55a783eeb12e50bb3f5f18804459 This reverts commit b3c5db79eb72fb068809052a9b53ce7282583c0b. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17498 Signed-off-by: Robert Marko --- ...e_mem_map-with-ARCH_PFN_OFFSET-calcu.patch | 82 ------------------- 1 file changed, 82 deletions(-) delete mode 100644 target/linux/generic/pending-6.6/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch diff --git a/target/linux/generic/pending-6.6/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch b/target/linux/generic/pending-6.6/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch deleted file mode 100644 index 099b07ef7af..00000000000 --- a/target/linux/generic/pending-6.6/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch +++ /dev/null @@ -1,82 +0,0 @@ -From: Tobias Wolf -Subject: mm: Fix alloc_node_mem_map with ARCH_PFN_OFFSET calculation - -An rt288x (ralink) based router (Belkin F5D8235 v1) does not boot with any -kernel beyond version 4.3 resulting in: - -BUG: Bad page state in process swapper pfn:086ac - -bisect resulted in: - -a1c34a3bf00af2cede839879502e12dc68491ad5 is the first bad commit -commit a1c34a3bf00af2cede839879502e12dc68491ad5 -Author: Laura Abbott -Date: Thu Nov 5 18:48:46 2015 -0800 - - mm: Don't offset memmap for flatmem - - Srinivas Kandagatla reported bad page messages when trying to remove the - bottom 2MB on an ARM based IFC6410 board - - BUG: Bad page state in process swapper pfn:fffa8 - page:ef7fb500 count:0 mapcount:0 mapping: (null) index:0x0 - flags: 0x96640253(locked|error|dirty|active|arch_1|reclaim|mlocked) - page dumped because: PAGE_FLAGS_CHECK_AT_FREE flag(s) set - bad because of flags: - flags: 0x200041(locked|active|mlocked) - Modules linked in: - CPU: 0 PID: 0 Comm: swapper Not tainted 3.19.0-rc3-00007-g412f9ba-dirty -#816 - Hardware name: Qualcomm (Flattened Device Tree) - unwind_backtrace - show_stack - dump_stack - bad_page - free_pages_prepare - free_hot_cold_page - __free_pages - free_highmem_page - mem_init - start_kernel - Disabling lock debugging due to kernel taint - [...] -:040000 040000 2de013c372345fd471cd58f0553c9b38b0ef1cc4 -0a8156f848733dfa21e16c196dfb6c0a76290709 M mm - -This fix for ARM does not account ARCH_PFN_OFFSET for mem_map as later used by -page_to_pfn anymore. - -The following output was generated with two hacked in printk statements: - -printk("before %p vs. %p or %p\n", mem_map, mem_map - offset, mem_map - -(pgdat->node_start_pfn - ARCH_PFN_OFFSET)); - if (page_to_pfn(mem_map) != pgdat->node_start_pfn) - mem_map -= offset + (pgdat->node_start_pfn - ARCH_PFN_OFFSET); -printk("after %p\n", mem_map); - -Output: - -[ 0.000000] before 8861b280 vs. 8861b280 or 8851b280 -[ 0.000000] after 8851b280 - -As seen in the first line mem_map with subtraction of offset does not equal the -mem_map after subtraction of ARCH_PFN_OFFSET. - -After adding the offset of ARCH_PFN_OFFSET as well to mem_map as the -previously calculated offset is zero for the named platform it is able to boot -4.4 and 4.9-rc7 again. - -Signed-off-by: Tobias Wolf ---- - ---- a/mm/mm_init.c -+++ b/mm/mm_init.c -@@ -1673,7 +1673,7 @@ static void __init alloc_node_mem_map(st - if (pgdat == NODE_DATA(0)) { - mem_map = NODE_DATA(0)->node_mem_map; - if (page_to_pfn(mem_map) != pgdat->node_start_pfn) -- mem_map -= offset; -+ mem_map -= offset + (pgdat->node_start_pfn - ARCH_PFN_OFFSET); - } - #endif - } From 73d368868c9dd2facfdf3f58533ee6310b2a665c Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 10 Jan 2025 14:14:45 +0100 Subject: [PATCH 104/173] airoha: an7581: enable MMC and PCI and refresh config Enable MMC and PCI config symbol and refresh config for Airoha AN7581. Signed-off-by: Christian Marangi --- target/linux/airoha/an7581/config-6.6 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/target/linux/airoha/an7581/config-6.6 b/target/linux/airoha/an7581/config-6.6 index b26cbeeb33e..f80bf49f8c1 100644 --- a/target/linux/airoha/an7581/config-6.6 +++ b/target/linux/airoha/an7581/config-6.6 @@ -131,6 +131,8 @@ CONFIG_COMPAT_32BIT_TIME=y CONFIG_CONTEXT_TRACKING=y CONFIG_CONTEXT_TRACKING_IDLE=y CONFIG_COREDUMP=y +CONFIG_CPUFREQ_DT=y +CONFIG_CPUFREQ_DT_PLATDEV=y CONFIG_CPUSETS=y CONFIG_CPU_FREQ=y CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y @@ -190,8 +192,6 @@ CONFIG_CRYPTO_SHA512=y CONFIG_CRYPTO_ZSTD=y CONFIG_DCACHE_WORD_ACCESS=y CONFIG_DEBUG_BUGVERBOSE=y -# CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT is not set -CONFIG_DEBUG_INFO_NONE=y CONFIG_DEBUG_MISC=y CONFIG_DEVMEM=y CONFIG_DMADEVICES=y @@ -351,6 +351,10 @@ CONFIG_MDIO_DEVRES=y # CONFIG_MEMCG is not set CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y +CONFIG_MMC=y +CONFIG_MMC_BLOCK=y +CONFIG_MMC_CQHCI=y +CONFIG_MMC_MTK=y CONFIG_MMU_LAZY_TLB_REFCOUNT=y CONFIG_MODULES_TREE_LOOKUP=y CONFIG_MODULES_USE_ELF_RELA=y @@ -433,7 +437,8 @@ CONFIG_PCIEASPM_PERFORMANCE=y # CONFIG_PCIEASPM_POWERSAVE is not set # CONFIG_PCIEASPM_POWER_SUPERSAVE is not set CONFIG_PCIEPORTBUS=y -# CONFIG_PCIE_MEDIATEK is not set +CONFIG_PCIE_MEDIATEK=y +CONFIG_PCIE_MEDIATEK_GEN3=y CONFIG_PCIE_PME=y CONFIG_PCI_DOMAINS=y CONFIG_PCI_DOMAINS_GENERIC=y From 07b49ce87660a0448c0535b481b330e1bd333a8c Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 10 Jan 2025 14:15:31 +0100 Subject: [PATCH 105/173] airoha: an7581: replace BUS clock patch with upstream version Replace BUS clock patch with upstream version with related tag as it got approved and merged. Signed-off-by: Christian Marangi --- ...3-clk-en7523-Fix-wrong-BUS-clock-for-EN7581.patch} | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) rename target/linux/airoha/patches-6.6/{109-clk-en7523-Fix-wrong-BUS-clock-for-EN7581.patch => 035-v6.13-clk-en7523-Fix-wrong-BUS-clock-for-EN7581.patch} (82%) diff --git a/target/linux/airoha/patches-6.6/109-clk-en7523-Fix-wrong-BUS-clock-for-EN7581.patch b/target/linux/airoha/patches-6.6/035-v6.13-clk-en7523-Fix-wrong-BUS-clock-for-EN7581.patch similarity index 82% rename from target/linux/airoha/patches-6.6/109-clk-en7523-Fix-wrong-BUS-clock-for-EN7581.patch rename to target/linux/airoha/patches-6.6/035-v6.13-clk-en7523-Fix-wrong-BUS-clock-for-EN7581.patch index 01a5fd0c876..89b970f8bb6 100644 --- a/target/linux/airoha/patches-6.6/109-clk-en7523-Fix-wrong-BUS-clock-for-EN7581.patch +++ b/target/linux/airoha/patches-6.6/035-v6.13-clk-en7523-Fix-wrong-BUS-clock-for-EN7581.patch @@ -1,12 +1,12 @@ -From 6d74b9e6d3bb07f50b22b9ea047b84a83aba185c Mon Sep 17 00:00:00 2001 +From 2eb75f86d52565367211c51334d15fe672633085 Mon Sep 17 00:00:00 2001 From: Christian Marangi -Date: Thu, 17 Oct 2024 19:26:24 +0200 +Date: Sat, 16 Nov 2024 11:56:53 +0100 Subject: [PATCH] clk: en7523: Fix wrong BUS clock for EN7581 The Documentation for EN7581 had a typo and still referenced the EN7523 BUS base source frequency. This was in conflict with a different page in -the Documentration that state that the BUS runs at 300MHz (600MHz source with -divisor set to 2) and the actual watchdog that tick at half the BUS +the Documentration that state that the BUS runs at 300MHz (600MHz source +with divisor set to 2) and the actual watchdog that tick at half the BUS clock (150MHz). This was verified with the watchdog by timing the seconds that the system takes to reboot (due too watchdog) and by operating on different values of the BUS divisor. @@ -18,6 +18,9 @@ This was also confirmed by Airoha. Cc: stable@vger.kernel.org Fixes: 66bc47326ce2 ("clk: en7523: Add EN7581 support") Signed-off-by: Christian Marangi +Link: https://lore.kernel.org/r/20241116105710.19748-1-ansuelsmth@gmail.com +Acked-by: Lorenzo Bianconi +Signed-off-by: Stephen Boyd --- drivers/clk/clk-en7523.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) From b4ae5378d403aa263ba5ec26ccc333ab0de81cff Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 10 Jan 2025 14:16:46 +0100 Subject: [PATCH 106/173] airoha: an7581: backport 2 fix for airoha ethernet driver Backport 2 fix for airoha ethernet driver merged upstream. Signed-off-by: Christian Marangi --- ...ypo-in-REG_CDM2_FWD_CFG-configuratio.patch | 35 ++++++ ...iroha-Fix-error-path-in-airoha_probe.patch | 102 ++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 target/linux/airoha/patches-6.6/036-v6.13-net-airoha-Fix-typo-in-REG_CDM2_FWD_CFG-configuratio.patch create mode 100644 target/linux/airoha/patches-6.6/037-v6.14-net-airoha-Fix-error-path-in-airoha_probe.patch diff --git a/target/linux/airoha/patches-6.6/036-v6.13-net-airoha-Fix-typo-in-REG_CDM2_FWD_CFG-configuratio.patch b/target/linux/airoha/patches-6.6/036-v6.13-net-airoha-Fix-typo-in-REG_CDM2_FWD_CFG-configuratio.patch new file mode 100644 index 00000000000..a71197150f4 --- /dev/null +++ b/target/linux/airoha/patches-6.6/036-v6.13-net-airoha-Fix-typo-in-REG_CDM2_FWD_CFG-configuratio.patch @@ -0,0 +1,35 @@ +From 30d9d8f6a2d7e44a9f91737dd409dbc87ac6f6b7 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Tue, 15 Oct 2024 09:58:09 +0200 +Subject: [PATCH] net: airoha: Fix typo in REG_CDM2_FWD_CFG configuration + +Fix typo in airoha_fe_init routine configuring CDM2_OAM_QSEL_MASK field +of REG_CDM2_FWD_CFG register. +This bug is not introducing any user visible problem since Frame Engine +CDM2 port is used just by the second QDMA block and we currently enable +just QDMA1 block connected to the MT7530 dsa switch via CDM1 port. + +Introduced by commit 23020f049327 ("net: airoha: Introduce ethernet +support for EN7581 SoC") + +Reported-by: ChihWei Cheng +Signed-off-by: Lorenzo Bianconi +Reviewed-by: Simon Horman +Message-ID: <20241015-airoha-eth-cdm2-fixes-v1-1-9dc6993286c3@kernel.org> +Signed-off-by: Andrew Lunn +--- + drivers/net/ethernet/mediatek/airoha_eth.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/mediatek/airoha_eth.c ++++ b/drivers/net/ethernet/mediatek/airoha_eth.c +@@ -1369,7 +1369,8 @@ static int airoha_fe_init(struct airoha_ + airoha_fe_set(eth, REG_GDM_MISC_CFG, + GDM2_RDM_ACK_WAIT_PREF_MASK | + GDM2_CHN_VLD_MODE_MASK); +- airoha_fe_rmw(eth, REG_CDM2_FWD_CFG, CDM2_OAM_QSEL_MASK, 15); ++ airoha_fe_rmw(eth, REG_CDM2_FWD_CFG, CDM2_OAM_QSEL_MASK, ++ FIELD_PREP(CDM2_OAM_QSEL_MASK, 15)); + + /* init fragment and assemble Force Port */ + /* NPU Core-3, NPU Bridge Channel-3 */ diff --git a/target/linux/airoha/patches-6.6/037-v6.14-net-airoha-Fix-error-path-in-airoha_probe.patch b/target/linux/airoha/patches-6.6/037-v6.14-net-airoha-Fix-error-path-in-airoha_probe.patch new file mode 100644 index 00000000000..9499c1541a1 --- /dev/null +++ b/target/linux/airoha/patches-6.6/037-v6.14-net-airoha-Fix-error-path-in-airoha_probe.patch @@ -0,0 +1,102 @@ +From 0c7469ee718e1dd929f52bfb142a7f6fb68f0765 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Mon, 16 Dec 2024 18:47:33 +0100 +Subject: [PATCH] net: airoha: Fix error path in airoha_probe() + +Do not run napi_disable() if airoha_hw_init() fails since Tx/Rx napi +has not been started yet. In order to fix the issue, introduce +airoha_qdma_stop_napi routine and remove napi_disable in +airoha_hw_cleanup(). + +Fixes: 23020f049327 ("net: airoha: Introduce ethernet support for EN7581 SoC") +Reviewed-by: Michal Swiatkowski +Signed-off-by: Lorenzo Bianconi +Link: https://patch.msgid.link/20241216-airoha_probe-error-path-fix-v2-1-6b10e04e9a5c@kernel.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/mediatek/airoha_eth.c | 33 ++++++++++++++++------ + 1 file changed, 25 insertions(+), 8 deletions(-) + +--- a/drivers/net/ethernet/mediatek/airoha_eth.c ++++ b/drivers/net/ethernet/mediatek/airoha_eth.c +@@ -2139,17 +2139,14 @@ static void airoha_hw_cleanup(struct air + if (!qdma->q_rx[i].ndesc) + continue; + +- napi_disable(&qdma->q_rx[i].napi); + netif_napi_del(&qdma->q_rx[i].napi); + airoha_qdma_cleanup_rx_queue(&qdma->q_rx[i]); + if (qdma->q_rx[i].page_pool) + page_pool_destroy(qdma->q_rx[i].page_pool); + } + +- for (i = 0; i < ARRAY_SIZE(qdma->q_tx_irq); i++) { +- napi_disable(&qdma->q_tx_irq[i].napi); ++ for (i = 0; i < ARRAY_SIZE(qdma->q_tx_irq); i++) + netif_napi_del(&qdma->q_tx_irq[i].napi); +- } + + for (i = 0; i < ARRAY_SIZE(qdma->q_tx); i++) { + if (!qdma->q_tx[i].ndesc) +@@ -2174,6 +2171,21 @@ static void airoha_qdma_start_napi(struc + } + } + ++static void airoha_qdma_stop_napi(struct airoha_qdma *qdma) ++{ ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(qdma->q_tx_irq); i++) ++ napi_disable(&qdma->q_tx_irq[i].napi); ++ ++ for (i = 0; i < ARRAY_SIZE(qdma->q_rx); i++) { ++ if (!qdma->q_rx[i].ndesc) ++ continue; ++ ++ napi_disable(&qdma->q_rx[i].napi); ++ } ++} ++ + static void airoha_update_hw_stats(struct airoha_gdm_port *port) + { + struct airoha_eth *eth = port->qdma->eth; +@@ -2731,7 +2743,7 @@ static int airoha_probe(struct platform_ + + err = airoha_hw_init(pdev, eth); + if (err) +- goto error; ++ goto error_hw_cleanup; + + for (i = 0; i < ARRAY_SIZE(eth->qdma); i++) + airoha_qdma_start_napi(ð->qdma[i]); +@@ -2746,13 +2758,16 @@ static int airoha_probe(struct platform_ + err = airoha_alloc_gdm_port(eth, np); + if (err) { + of_node_put(np); +- goto error; ++ goto error_napi_stop; + } + } + + return 0; + +-error: ++error_napi_stop: ++ for (i = 0; i < ARRAY_SIZE(eth->qdma); i++) ++ airoha_qdma_stop_napi(ð->qdma[i]); ++error_hw_cleanup: + for (i = 0; i < ARRAY_SIZE(eth->qdma); i++) + airoha_hw_cleanup(ð->qdma[i]); + +@@ -2773,8 +2788,10 @@ static void airoha_remove(struct platfor + struct airoha_eth *eth = platform_get_drvdata(pdev); + int i; + +- for (i = 0; i < ARRAY_SIZE(eth->qdma); i++) ++ for (i = 0; i < ARRAY_SIZE(eth->qdma); i++) { ++ airoha_qdma_stop_napi(ð->qdma[i]); + airoha_hw_cleanup(ð->qdma[i]); ++ } + + for (i = 0; i < ARRAY_SIZE(eth->ports); i++) { + struct airoha_gdm_port *port = eth->ports[i]; From 3ec3ea5316ceebae260f4d170c6e1c3a19864438 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 10 Jan 2025 14:22:31 +0100 Subject: [PATCH 107/173] airoha: an7581: backport patch to support ETS and HTB sched Backport patch to support ETS and HTB scheduler for airoha ethernet driver. Signed-off-by: Christian Marangi --- ...e-Tx-drop-capability-for-each-Tx-DMA.patch | 27 ++ ...-Introduce-ndo_select_queue-callback.patch | 86 ++++ ...airoha-Add-sched-ETS-offload-support.patch | 292 ++++++++++++++ ...airoha-Add-sched-HTB-offload-support.patch | 371 ++++++++++++++++++ 4 files changed, 776 insertions(+) create mode 100644 target/linux/airoha/patches-6.6/038-01-v6.14-net-airoha-Enable-Tx-drop-capability-for-each-Tx-DMA.patch create mode 100644 target/linux/airoha/patches-6.6/038-02-v6.14-net-airoha-Introduce-ndo_select_queue-callback.patch create mode 100644 target/linux/airoha/patches-6.6/038-03-v6.14-net-airoha-Add-sched-ETS-offload-support.patch create mode 100644 target/linux/airoha/patches-6.6/038-04-v6.14-net-airoha-Add-sched-HTB-offload-support.patch diff --git a/target/linux/airoha/patches-6.6/038-01-v6.14-net-airoha-Enable-Tx-drop-capability-for-each-Tx-DMA.patch b/target/linux/airoha/patches-6.6/038-01-v6.14-net-airoha-Enable-Tx-drop-capability-for-each-Tx-DMA.patch new file mode 100644 index 00000000000..c8681aace5b --- /dev/null +++ b/target/linux/airoha/patches-6.6/038-01-v6.14-net-airoha-Enable-Tx-drop-capability-for-each-Tx-DMA.patch @@ -0,0 +1,27 @@ +From 5f795590380476f1c9b7ed0ac945c9b0269dc23a Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Fri, 3 Jan 2025 13:17:02 +0100 +Subject: [PATCH 1/4] net: airoha: Enable Tx drop capability for each Tx DMA + ring + +This is a preliminary patch in order to enable hw Qdisc offloading. + +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/mediatek/airoha_eth.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/net/ethernet/mediatek/airoha_eth.c ++++ b/drivers/net/ethernet/mediatek/airoha_eth.c +@@ -1790,6 +1790,10 @@ static int airoha_qdma_init_tx_queue(str + WRITE_ONCE(q->desc[i].ctrl, cpu_to_le32(val)); + } + ++ /* xmit ring drop default setting */ ++ airoha_qdma_set(qdma, REG_TX_RING_BLOCKING(qid), ++ TX_RING_IRQ_BLOCKING_TX_DROP_EN_MASK); ++ + airoha_qdma_wr(qdma, REG_TX_RING_BASE(qid), dma_addr); + airoha_qdma_rmw(qdma, REG_TX_CPU_IDX(qid), TX_RING_CPU_IDX_MASK, + FIELD_PREP(TX_RING_CPU_IDX_MASK, q->head)); diff --git a/target/linux/airoha/patches-6.6/038-02-v6.14-net-airoha-Introduce-ndo_select_queue-callback.patch b/target/linux/airoha/patches-6.6/038-02-v6.14-net-airoha-Introduce-ndo_select_queue-callback.patch new file mode 100644 index 00000000000..75743bdd347 --- /dev/null +++ b/target/linux/airoha/patches-6.6/038-02-v6.14-net-airoha-Introduce-ndo_select_queue-callback.patch @@ -0,0 +1,86 @@ +From 2b288b81560b94958cd68bbe54673e55a1730c95 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Fri, 3 Jan 2025 13:17:03 +0100 +Subject: [PATCH 2/4] net: airoha: Introduce ndo_select_queue callback + +Airoha EN7581 SoC supports 32 Tx DMA rings used to feed packets to QoS +channels. Each channels supports 8 QoS queues where the user can apply +QoS scheduling policies. In a similar way, the user can configure hw +rate shaping for each QoS channel. +Introduce ndo_select_queue callback in order to select the tx queue +based on QoS channel and QoS queue. In particular, for dsa device select +QoS channel according to the dsa user port index, rely on port id +otherwise. Select QoS queue based on the skb priority. + +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/mediatek/airoha_eth.c | 30 ++++++++++++++++++++-- + 1 file changed, 28 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/mediatek/airoha_eth.c ++++ b/drivers/net/ethernet/mediatek/airoha_eth.c +@@ -23,6 +23,8 @@ + #define AIROHA_MAX_NUM_XSI_RSTS 5 + #define AIROHA_MAX_MTU 2000 + #define AIROHA_MAX_PACKET_SIZE 2048 ++#define AIROHA_NUM_QOS_CHANNELS 4 ++#define AIROHA_NUM_QOS_QUEUES 8 + #define AIROHA_NUM_TX_RING 32 + #define AIROHA_NUM_RX_RING 32 + #define AIROHA_FE_MC_MAX_VLAN_TABLE 64 +@@ -2422,21 +2424,44 @@ static void airoha_dev_get_stats64(struc + } while (u64_stats_fetch_retry(&port->stats.syncp, start)); + } + ++static u16 airoha_dev_select_queue(struct net_device *dev, struct sk_buff *skb, ++ struct net_device *sb_dev) ++{ ++ struct airoha_gdm_port *port = netdev_priv(dev); ++ int queue, channel; ++ ++ /* For dsa device select QoS channel according to the dsa user port ++ * index, rely on port id otherwise. Select QoS queue based on the ++ * skb priority. ++ */ ++ channel = netdev_uses_dsa(dev) ? skb_get_queue_mapping(skb) : port->id; ++ channel = channel % AIROHA_NUM_QOS_CHANNELS; ++ queue = (skb->priority - 1) % AIROHA_NUM_QOS_QUEUES; /* QoS queue */ ++ queue = channel * AIROHA_NUM_QOS_QUEUES + queue; ++ ++ return queue < dev->num_tx_queues ? queue : 0; ++} ++ + static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb, + struct net_device *dev) + { + struct skb_shared_info *sinfo = skb_shinfo(skb); + struct airoha_gdm_port *port = netdev_priv(dev); +- u32 msg0 = 0, msg1, len = skb_headlen(skb); +- int i, qid = skb_get_queue_mapping(skb); ++ u32 msg0, msg1, len = skb_headlen(skb); + struct airoha_qdma *qdma = port->qdma; + u32 nr_frags = 1 + sinfo->nr_frags; + struct netdev_queue *txq; + struct airoha_queue *q; + void *data = skb->data; ++ int i, qid; + u16 index; + u8 fport; + ++ qid = skb_get_queue_mapping(skb) % ARRAY_SIZE(qdma->q_tx); ++ msg0 = FIELD_PREP(QDMA_ETH_TXMSG_CHAN_MASK, ++ qid / AIROHA_NUM_QOS_QUEUES) | ++ FIELD_PREP(QDMA_ETH_TXMSG_QUEUE_MASK, ++ qid % AIROHA_NUM_QOS_QUEUES); + if (skb->ip_summed == CHECKSUM_PARTIAL) + msg0 |= FIELD_PREP(QDMA_ETH_TXMSG_TCO_MASK, 1) | + FIELD_PREP(QDMA_ETH_TXMSG_UCO_MASK, 1) | +@@ -2610,6 +2635,7 @@ static const struct net_device_ops airoh + .ndo_init = airoha_dev_init, + .ndo_open = airoha_dev_open, + .ndo_stop = airoha_dev_stop, ++ .ndo_select_queue = airoha_dev_select_queue, + .ndo_start_xmit = airoha_dev_xmit, + .ndo_get_stats64 = airoha_dev_get_stats64, + .ndo_set_mac_address = airoha_dev_set_macaddr, diff --git a/target/linux/airoha/patches-6.6/038-03-v6.14-net-airoha-Add-sched-ETS-offload-support.patch b/target/linux/airoha/patches-6.6/038-03-v6.14-net-airoha-Add-sched-ETS-offload-support.patch new file mode 100644 index 00000000000..ad5e0e5c2a6 --- /dev/null +++ b/target/linux/airoha/patches-6.6/038-03-v6.14-net-airoha-Add-sched-ETS-offload-support.patch @@ -0,0 +1,292 @@ +From 20bf7d07c956e5c7a22d3076c599cbb7a6054917 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Fri, 3 Jan 2025 13:17:04 +0100 +Subject: [PATCH 3/4] net: airoha: Add sched ETS offload support + +Introduce support for ETS Qdisc offload available on the Airoha EN7581 +ethernet controller. In order to be effective, ETS Qdisc must configured +as leaf of a HTB Qdisc (HTB Qdisc offload will be added in the following +patch). ETS Qdisc available on EN7581 ethernet controller supports at +most 8 concurrent bands (QoS queues). We can enable an ETS Qdisc for +each available QoS channel. + +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/mediatek/airoha_eth.c | 196 ++++++++++++++++++++- + 1 file changed, 195 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/mediatek/airoha_eth.c ++++ b/drivers/net/ethernet/mediatek/airoha_eth.c +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + #include + + #define AIROHA_MAX_NUM_GDM_PORTS 1 +@@ -543,9 +544,24 @@ + #define INGRESS_SLOW_TICK_RATIO_MASK GENMASK(29, 16) + #define INGRESS_FAST_TICK_MASK GENMASK(15, 0) + ++#define REG_QUEUE_CLOSE_CFG(_n) (0x00a0 + ((_n) & 0xfc)) ++#define TXQ_DISABLE_CHAN_QUEUE_MASK(_n, _m) BIT((_m) + (((_n) & 0x3) << 3)) ++ + #define REG_TXQ_DIS_CFG_BASE(_n) ((_n) ? 0x20a0 : 0x00a0) + #define REG_TXQ_DIS_CFG(_n, _m) (REG_TXQ_DIS_CFG_BASE((_n)) + (_m) << 2) + ++#define REG_CNTR_CFG(_n) (0x0400 + ((_n) << 3)) ++#define CNTR_EN_MASK BIT(31) ++#define CNTR_ALL_CHAN_EN_MASK BIT(30) ++#define CNTR_ALL_QUEUE_EN_MASK BIT(29) ++#define CNTR_ALL_DSCP_RING_EN_MASK BIT(28) ++#define CNTR_SRC_MASK GENMASK(27, 24) ++#define CNTR_DSCP_RING_MASK GENMASK(20, 16) ++#define CNTR_CHAN_MASK GENMASK(7, 3) ++#define CNTR_QUEUE_MASK GENMASK(2, 0) ++ ++#define REG_CNTR_VAL(_n) (0x0404 + ((_n) << 3)) ++ + #define REG_LMGR_INIT_CFG 0x1000 + #define LMGR_INIT_START BIT(31) + #define LMGR_SRAM_MODE_MASK BIT(30) +@@ -571,9 +587,19 @@ + #define TWRR_WEIGHT_SCALE_MASK BIT(31) + #define TWRR_WEIGHT_BASE_MASK BIT(3) + ++#define REG_TXWRR_WEIGHT_CFG 0x1024 ++#define TWRR_RW_CMD_MASK BIT(31) ++#define TWRR_RW_CMD_DONE BIT(30) ++#define TWRR_CHAN_IDX_MASK GENMASK(23, 19) ++#define TWRR_QUEUE_IDX_MASK GENMASK(18, 16) ++#define TWRR_VALUE_MASK GENMASK(15, 0) ++ + #define REG_PSE_BUF_USAGE_CFG 0x1028 + #define PSE_BUF_ESTIMATE_EN_MASK BIT(29) + ++#define REG_CHAN_QOS_MODE(_n) (0x1040 + ((_n) << 2)) ++#define CHAN_QOS_MODE_MASK(_n) GENMASK(2 + ((_n) << 2), (_n) << 2) ++ + #define REG_GLB_TRTCM_CFG 0x1080 + #define GLB_TRTCM_EN_MASK BIT(31) + #define GLB_TRTCM_MODE_MASK BIT(30) +@@ -722,6 +748,17 @@ enum { + FE_PSE_PORT_DROP = 0xf, + }; + ++enum tx_sched_mode { ++ TC_SCH_WRR8, ++ TC_SCH_SP, ++ TC_SCH_WRR7, ++ TC_SCH_WRR6, ++ TC_SCH_WRR5, ++ TC_SCH_WRR4, ++ TC_SCH_WRR3, ++ TC_SCH_WRR2, ++}; ++ + struct airoha_queue_entry { + union { + void *buf; +@@ -812,6 +849,10 @@ struct airoha_gdm_port { + int id; + + struct airoha_hw_stats stats; ++ ++ /* qos stats counters */ ++ u64 cpu_tx_packets; ++ u64 fwd_tx_packets; + }; + + struct airoha_eth { +@@ -1962,6 +2003,27 @@ static void airoha_qdma_init_qos(struct + FIELD_PREP(SLA_SLOW_TICK_RATIO_MASK, 40)); + } + ++static void airoha_qdma_init_qos_stats(struct airoha_qdma *qdma) ++{ ++ int i; ++ ++ for (i = 0; i < AIROHA_NUM_QOS_CHANNELS; i++) { ++ /* Tx-cpu transferred count */ ++ airoha_qdma_wr(qdma, REG_CNTR_VAL(i << 1), 0); ++ airoha_qdma_wr(qdma, REG_CNTR_CFG(i << 1), ++ CNTR_EN_MASK | CNTR_ALL_QUEUE_EN_MASK | ++ CNTR_ALL_DSCP_RING_EN_MASK | ++ FIELD_PREP(CNTR_CHAN_MASK, i)); ++ /* Tx-fwd transferred count */ ++ airoha_qdma_wr(qdma, REG_CNTR_VAL((i << 1) + 1), 0); ++ airoha_qdma_wr(qdma, REG_CNTR_CFG(i << 1), ++ CNTR_EN_MASK | CNTR_ALL_QUEUE_EN_MASK | ++ CNTR_ALL_DSCP_RING_EN_MASK | ++ FIELD_PREP(CNTR_SRC_MASK, 1) | ++ FIELD_PREP(CNTR_CHAN_MASK, i)); ++ } ++} ++ + static int airoha_qdma_hw_init(struct airoha_qdma *qdma) + { + int i; +@@ -2012,6 +2074,7 @@ static int airoha_qdma_hw_init(struct ai + + airoha_qdma_set(qdma, REG_TXQ_CNGST_CFG, + TXQ_CNGST_DROP_EN | TXQ_CNGST_DEI_DROP_EN); ++ airoha_qdma_init_qos_stats(qdma); + + return 0; + } +@@ -2631,6 +2694,135 @@ airoha_ethtool_get_rmon_stats(struct net + } while (u64_stats_fetch_retry(&port->stats.syncp, start)); + } + ++static int airoha_qdma_set_chan_tx_sched(struct airoha_gdm_port *port, ++ int channel, enum tx_sched_mode mode, ++ const u16 *weights, u8 n_weights) ++{ ++ int i; ++ ++ for (i = 0; i < AIROHA_NUM_TX_RING; i++) ++ airoha_qdma_clear(port->qdma, REG_QUEUE_CLOSE_CFG(channel), ++ TXQ_DISABLE_CHAN_QUEUE_MASK(channel, i)); ++ ++ for (i = 0; i < n_weights; i++) { ++ u32 status; ++ int err; ++ ++ airoha_qdma_wr(port->qdma, REG_TXWRR_WEIGHT_CFG, ++ TWRR_RW_CMD_MASK | ++ FIELD_PREP(TWRR_CHAN_IDX_MASK, channel) | ++ FIELD_PREP(TWRR_QUEUE_IDX_MASK, i) | ++ FIELD_PREP(TWRR_VALUE_MASK, weights[i])); ++ err = read_poll_timeout(airoha_qdma_rr, status, ++ status & TWRR_RW_CMD_DONE, ++ USEC_PER_MSEC, 10 * USEC_PER_MSEC, ++ true, port->qdma, ++ REG_TXWRR_WEIGHT_CFG); ++ if (err) ++ return err; ++ } ++ ++ airoha_qdma_rmw(port->qdma, REG_CHAN_QOS_MODE(channel >> 3), ++ CHAN_QOS_MODE_MASK(channel), ++ mode << __ffs(CHAN_QOS_MODE_MASK(channel))); ++ ++ return 0; ++} ++ ++static int airoha_qdma_set_tx_prio_sched(struct airoha_gdm_port *port, ++ int channel) ++{ ++ static const u16 w[AIROHA_NUM_QOS_QUEUES] = {}; ++ ++ return airoha_qdma_set_chan_tx_sched(port, channel, TC_SCH_SP, w, ++ ARRAY_SIZE(w)); ++} ++ ++static int airoha_qdma_set_tx_ets_sched(struct airoha_gdm_port *port, ++ int channel, ++ struct tc_ets_qopt_offload *opt) ++{ ++ struct tc_ets_qopt_offload_replace_params *p = &opt->replace_params; ++ enum tx_sched_mode mode = TC_SCH_SP; ++ u16 w[AIROHA_NUM_QOS_QUEUES] = {}; ++ int i, nstrict = 0; ++ ++ if (p->bands > AIROHA_NUM_QOS_QUEUES) ++ return -EINVAL; ++ ++ for (i = 0; i < p->bands; i++) { ++ if (!p->quanta[i]) ++ nstrict++; ++ } ++ ++ /* this configuration is not supported by the hw */ ++ if (nstrict == AIROHA_NUM_QOS_QUEUES - 1) ++ return -EINVAL; ++ ++ for (i = 0; i < p->bands - nstrict; i++) ++ w[i] = p->weights[nstrict + i]; ++ ++ if (!nstrict) ++ mode = TC_SCH_WRR8; ++ else if (nstrict < AIROHA_NUM_QOS_QUEUES - 1) ++ mode = nstrict + 1; ++ ++ return airoha_qdma_set_chan_tx_sched(port, channel, mode, w, ++ ARRAY_SIZE(w)); ++} ++ ++static int airoha_qdma_get_tx_ets_stats(struct airoha_gdm_port *port, ++ int channel, ++ struct tc_ets_qopt_offload *opt) ++{ ++ u64 cpu_tx_packets = airoha_qdma_rr(port->qdma, ++ REG_CNTR_VAL(channel << 1)); ++ u64 fwd_tx_packets = airoha_qdma_rr(port->qdma, ++ REG_CNTR_VAL((channel << 1) + 1)); ++ u64 tx_packets = (cpu_tx_packets - port->cpu_tx_packets) + ++ (fwd_tx_packets - port->fwd_tx_packets); ++ _bstats_update(opt->stats.bstats, 0, tx_packets); ++ ++ port->cpu_tx_packets = cpu_tx_packets; ++ port->fwd_tx_packets = fwd_tx_packets; ++ ++ return 0; ++} ++ ++static int airoha_tc_setup_qdisc_ets(struct airoha_gdm_port *port, ++ struct tc_ets_qopt_offload *opt) ++{ ++ int channel = TC_H_MAJ(opt->handle) >> 16; ++ ++ if (opt->parent == TC_H_ROOT) ++ return -EINVAL; ++ ++ switch (opt->command) { ++ case TC_ETS_REPLACE: ++ return airoha_qdma_set_tx_ets_sched(port, channel, opt); ++ case TC_ETS_DESTROY: ++ /* PRIO is default qdisc scheduler */ ++ return airoha_qdma_set_tx_prio_sched(port, channel); ++ case TC_ETS_STATS: ++ return airoha_qdma_get_tx_ets_stats(port, channel, opt); ++ default: ++ return -EOPNOTSUPP; ++ } ++} ++ ++static int airoha_dev_tc_setup(struct net_device *dev, enum tc_setup_type type, ++ void *type_data) ++{ ++ struct airoha_gdm_port *port = netdev_priv(dev); ++ ++ switch (type) { ++ case TC_SETUP_QDISC_ETS: ++ return airoha_tc_setup_qdisc_ets(port, type_data); ++ default: ++ return -EOPNOTSUPP; ++ } ++} ++ + static const struct net_device_ops airoha_netdev_ops = { + .ndo_init = airoha_dev_init, + .ndo_open = airoha_dev_open, +@@ -2639,6 +2831,7 @@ static const struct net_device_ops airoh + .ndo_start_xmit = airoha_dev_xmit, + .ndo_get_stats64 = airoha_dev_get_stats64, + .ndo_set_mac_address = airoha_dev_set_macaddr, ++ .ndo_setup_tc = airoha_dev_tc_setup, + }; + + static const struct ethtool_ops airoha_ethtool_ops = { +@@ -2688,7 +2881,8 @@ static int airoha_alloc_gdm_port(struct + dev->watchdog_timeo = 5 * HZ; + dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM | + NETIF_F_TSO6 | NETIF_F_IPV6_CSUM | +- NETIF_F_SG | NETIF_F_TSO; ++ NETIF_F_SG | NETIF_F_TSO | ++ NETIF_F_HW_TC; + dev->features |= dev->hw_features; + dev->dev.of_node = np; + dev->irq = qdma->irq; diff --git a/target/linux/airoha/patches-6.6/038-04-v6.14-net-airoha-Add-sched-HTB-offload-support.patch b/target/linux/airoha/patches-6.6/038-04-v6.14-net-airoha-Add-sched-HTB-offload-support.patch new file mode 100644 index 00000000000..1239b174e51 --- /dev/null +++ b/target/linux/airoha/patches-6.6/038-04-v6.14-net-airoha-Add-sched-HTB-offload-support.patch @@ -0,0 +1,371 @@ +From ef1ca9271313b4ea7b03de69576aacef1e78f381 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Fri, 3 Jan 2025 13:17:05 +0100 +Subject: [PATCH 4/4] net: airoha: Add sched HTB offload support + +Introduce support for HTB Qdisc offload available in the Airoha EN7581 +ethernet controller. EN7581 can offload only one level of HTB leafs. +Each HTB leaf represents a QoS channel supported by EN7581 SoC. +The typical use-case is creating a HTB leaf for QoS channel to rate +limit the egress traffic and attach an ETS Qdisc to each HTB leaf in +order to enforce traffic prioritization. + +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/mediatek/airoha_eth.c | 288 ++++++++++++++++++++- + 1 file changed, 287 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/mediatek/airoha_eth.c ++++ b/drivers/net/ethernet/mediatek/airoha_eth.c +@@ -28,6 +28,8 @@ + #define AIROHA_NUM_QOS_QUEUES 8 + #define AIROHA_NUM_TX_RING 32 + #define AIROHA_NUM_RX_RING 32 ++#define AIROHA_NUM_NETDEV_TX_RINGS (AIROHA_NUM_TX_RING + \ ++ AIROHA_NUM_QOS_CHANNELS) + #define AIROHA_FE_MC_MAX_VLAN_TABLE 64 + #define AIROHA_FE_MC_MAX_VLAN_PORT 16 + #define AIROHA_NUM_TX_IRQ 2 +@@ -43,6 +45,9 @@ + #define PSE_RSV_PAGES 128 + #define PSE_QUEUE_RSV_PAGES 64 + ++#define QDMA_METER_IDX(_n) ((_n) & 0xff) ++#define QDMA_METER_GROUP(_n) (((_n) >> 8) & 0x3) ++ + /* FE */ + #define PSE_BASE 0x0100 + #define CSR_IFC_BASE 0x0200 +@@ -583,6 +588,17 @@ + #define EGRESS_SLOW_TICK_RATIO_MASK GENMASK(29, 16) + #define EGRESS_FAST_TICK_MASK GENMASK(15, 0) + ++#define TRTCM_PARAM_RW_MASK BIT(31) ++#define TRTCM_PARAM_RW_DONE_MASK BIT(30) ++#define TRTCM_PARAM_TYPE_MASK GENMASK(29, 28) ++#define TRTCM_METER_GROUP_MASK GENMASK(27, 26) ++#define TRTCM_PARAM_INDEX_MASK GENMASK(23, 17) ++#define TRTCM_PARAM_RATE_TYPE_MASK BIT(16) ++ ++#define REG_TRTCM_CFG_PARAM(_n) ((_n) + 0x4) ++#define REG_TRTCM_DATA_LOW(_n) ((_n) + 0x8) ++#define REG_TRTCM_DATA_HIGH(_n) ((_n) + 0xc) ++ + #define REG_TXWRR_MODE_CFG 0x1020 + #define TWRR_WEIGHT_SCALE_MASK BIT(31) + #define TWRR_WEIGHT_BASE_MASK BIT(3) +@@ -759,6 +775,29 @@ enum tx_sched_mode { + TC_SCH_WRR2, + }; + ++enum trtcm_param_type { ++ TRTCM_MISC_MODE, /* meter_en, pps_mode, tick_sel */ ++ TRTCM_TOKEN_RATE_MODE, ++ TRTCM_BUCKETSIZE_SHIFT_MODE, ++ TRTCM_BUCKET_COUNTER_MODE, ++}; ++ ++enum trtcm_mode_type { ++ TRTCM_COMMIT_MODE, ++ TRTCM_PEAK_MODE, ++}; ++ ++enum trtcm_param { ++ TRTCM_TICK_SEL = BIT(0), ++ TRTCM_PKT_MODE = BIT(1), ++ TRTCM_METER_MODE = BIT(2), ++}; ++ ++#define MIN_TOKEN_SIZE 4096 ++#define MAX_TOKEN_SIZE_OFFSET 17 ++#define TRTCM_TOKEN_RATE_MASK GENMASK(23, 6) ++#define TRTCM_TOKEN_RATE_FRACTION_MASK GENMASK(5, 0) ++ + struct airoha_queue_entry { + union { + void *buf; +@@ -850,6 +889,8 @@ struct airoha_gdm_port { + + struct airoha_hw_stats stats; + ++ DECLARE_BITMAP(qos_sq_bmap, AIROHA_NUM_QOS_CHANNELS); ++ + /* qos stats counters */ + u64 cpu_tx_packets; + u64 fwd_tx_packets; +@@ -2810,6 +2851,243 @@ static int airoha_tc_setup_qdisc_ets(str + } + } + ++static int airoha_qdma_get_trtcm_param(struct airoha_qdma *qdma, int channel, ++ u32 addr, enum trtcm_param_type param, ++ enum trtcm_mode_type mode, ++ u32 *val_low, u32 *val_high) ++{ ++ u32 idx = QDMA_METER_IDX(channel), group = QDMA_METER_GROUP(channel); ++ u32 val, config = FIELD_PREP(TRTCM_PARAM_TYPE_MASK, param) | ++ FIELD_PREP(TRTCM_METER_GROUP_MASK, group) | ++ FIELD_PREP(TRTCM_PARAM_INDEX_MASK, idx) | ++ FIELD_PREP(TRTCM_PARAM_RATE_TYPE_MASK, mode); ++ ++ airoha_qdma_wr(qdma, REG_TRTCM_CFG_PARAM(addr), config); ++ if (read_poll_timeout(airoha_qdma_rr, val, ++ val & TRTCM_PARAM_RW_DONE_MASK, ++ USEC_PER_MSEC, 10 * USEC_PER_MSEC, true, ++ qdma, REG_TRTCM_CFG_PARAM(addr))) ++ return -ETIMEDOUT; ++ ++ *val_low = airoha_qdma_rr(qdma, REG_TRTCM_DATA_LOW(addr)); ++ if (val_high) ++ *val_high = airoha_qdma_rr(qdma, REG_TRTCM_DATA_HIGH(addr)); ++ ++ return 0; ++} ++ ++static int airoha_qdma_set_trtcm_param(struct airoha_qdma *qdma, int channel, ++ u32 addr, enum trtcm_param_type param, ++ enum trtcm_mode_type mode, u32 val) ++{ ++ u32 idx = QDMA_METER_IDX(channel), group = QDMA_METER_GROUP(channel); ++ u32 config = TRTCM_PARAM_RW_MASK | ++ FIELD_PREP(TRTCM_PARAM_TYPE_MASK, param) | ++ FIELD_PREP(TRTCM_METER_GROUP_MASK, group) | ++ FIELD_PREP(TRTCM_PARAM_INDEX_MASK, idx) | ++ FIELD_PREP(TRTCM_PARAM_RATE_TYPE_MASK, mode); ++ ++ airoha_qdma_wr(qdma, REG_TRTCM_DATA_LOW(addr), val); ++ airoha_qdma_wr(qdma, REG_TRTCM_CFG_PARAM(addr), config); ++ ++ return read_poll_timeout(airoha_qdma_rr, val, ++ val & TRTCM_PARAM_RW_DONE_MASK, ++ USEC_PER_MSEC, 10 * USEC_PER_MSEC, true, ++ qdma, REG_TRTCM_CFG_PARAM(addr)); ++} ++ ++static int airoha_qdma_set_trtcm_config(struct airoha_qdma *qdma, int channel, ++ u32 addr, enum trtcm_mode_type mode, ++ bool enable, u32 enable_mask) ++{ ++ u32 val; ++ ++ if (airoha_qdma_get_trtcm_param(qdma, channel, addr, TRTCM_MISC_MODE, ++ mode, &val, NULL)) ++ return -EINVAL; ++ ++ val = enable ? val | enable_mask : val & ~enable_mask; ++ ++ return airoha_qdma_set_trtcm_param(qdma, channel, addr, TRTCM_MISC_MODE, ++ mode, val); ++} ++ ++static int airoha_qdma_set_trtcm_token_bucket(struct airoha_qdma *qdma, ++ int channel, u32 addr, ++ enum trtcm_mode_type mode, ++ u32 rate_val, u32 bucket_size) ++{ ++ u32 val, config, tick, unit, rate, rate_frac; ++ int err; ++ ++ if (airoha_qdma_get_trtcm_param(qdma, channel, addr, TRTCM_MISC_MODE, ++ mode, &config, NULL)) ++ return -EINVAL; ++ ++ val = airoha_qdma_rr(qdma, addr); ++ tick = FIELD_GET(INGRESS_FAST_TICK_MASK, val); ++ if (config & TRTCM_TICK_SEL) ++ tick *= FIELD_GET(INGRESS_SLOW_TICK_RATIO_MASK, val); ++ if (!tick) ++ return -EINVAL; ++ ++ unit = (config & TRTCM_PKT_MODE) ? 1000000 / tick : 8000 / tick; ++ if (!unit) ++ return -EINVAL; ++ ++ rate = rate_val / unit; ++ rate_frac = rate_val % unit; ++ rate_frac = FIELD_PREP(TRTCM_TOKEN_RATE_MASK, rate_frac) / unit; ++ rate = FIELD_PREP(TRTCM_TOKEN_RATE_MASK, rate) | ++ FIELD_PREP(TRTCM_TOKEN_RATE_FRACTION_MASK, rate_frac); ++ ++ err = airoha_qdma_set_trtcm_param(qdma, channel, addr, ++ TRTCM_TOKEN_RATE_MODE, mode, rate); ++ if (err) ++ return err; ++ ++ val = max_t(u32, bucket_size, MIN_TOKEN_SIZE); ++ val = min_t(u32, __fls(val), MAX_TOKEN_SIZE_OFFSET); ++ ++ return airoha_qdma_set_trtcm_param(qdma, channel, addr, ++ TRTCM_BUCKETSIZE_SHIFT_MODE, ++ mode, val); ++} ++ ++static int airoha_qdma_set_tx_rate_limit(struct airoha_gdm_port *port, ++ int channel, u32 rate, ++ u32 bucket_size) ++{ ++ int i, err; ++ ++ for (i = 0; i <= TRTCM_PEAK_MODE; i++) { ++ err = airoha_qdma_set_trtcm_config(port->qdma, channel, ++ REG_EGRESS_TRTCM_CFG, i, ++ !!rate, TRTCM_METER_MODE); ++ if (err) ++ return err; ++ ++ err = airoha_qdma_set_trtcm_token_bucket(port->qdma, channel, ++ REG_EGRESS_TRTCM_CFG, ++ i, rate, bucket_size); ++ if (err) ++ return err; ++ } ++ ++ return 0; ++} ++ ++static int airoha_tc_htb_alloc_leaf_queue(struct airoha_gdm_port *port, ++ struct tc_htb_qopt_offload *opt) ++{ ++ u32 channel = TC_H_MIN(opt->classid) % AIROHA_NUM_QOS_CHANNELS; ++ u32 rate = div_u64(opt->rate, 1000) << 3; /* kbps */ ++ struct net_device *dev = port->dev; ++ int num_tx_queues = dev->real_num_tx_queues; ++ int err; ++ ++ if (opt->parent_classid != TC_HTB_CLASSID_ROOT) { ++ NL_SET_ERR_MSG_MOD(opt->extack, "invalid parent classid"); ++ return -EINVAL; ++ } ++ ++ err = airoha_qdma_set_tx_rate_limit(port, channel, rate, opt->quantum); ++ if (err) { ++ NL_SET_ERR_MSG_MOD(opt->extack, ++ "failed configuring htb offload"); ++ return err; ++ } ++ ++ if (opt->command == TC_HTB_NODE_MODIFY) ++ return 0; ++ ++ err = netif_set_real_num_tx_queues(dev, num_tx_queues + 1); ++ if (err) { ++ airoha_qdma_set_tx_rate_limit(port, channel, 0, opt->quantum); ++ NL_SET_ERR_MSG_MOD(opt->extack, ++ "failed setting real_num_tx_queues"); ++ return err; ++ } ++ ++ set_bit(channel, port->qos_sq_bmap); ++ opt->qid = AIROHA_NUM_TX_RING + channel; ++ ++ return 0; ++} ++ ++static void airoha_tc_remove_htb_queue(struct airoha_gdm_port *port, int queue) ++{ ++ struct net_device *dev = port->dev; ++ ++ netif_set_real_num_tx_queues(dev, dev->real_num_tx_queues - 1); ++ airoha_qdma_set_tx_rate_limit(port, queue + 1, 0, 0); ++ clear_bit(queue, port->qos_sq_bmap); ++} ++ ++static int airoha_tc_htb_delete_leaf_queue(struct airoha_gdm_port *port, ++ struct tc_htb_qopt_offload *opt) ++{ ++ u32 channel = TC_H_MIN(opt->classid) % AIROHA_NUM_QOS_CHANNELS; ++ ++ if (!test_bit(channel, port->qos_sq_bmap)) { ++ NL_SET_ERR_MSG_MOD(opt->extack, "invalid queue id"); ++ return -EINVAL; ++ } ++ ++ airoha_tc_remove_htb_queue(port, channel); ++ ++ return 0; ++} ++ ++static int airoha_tc_htb_destroy(struct airoha_gdm_port *port) ++{ ++ int q; ++ ++ for_each_set_bit(q, port->qos_sq_bmap, AIROHA_NUM_QOS_CHANNELS) ++ airoha_tc_remove_htb_queue(port, q); ++ ++ return 0; ++} ++ ++static int airoha_tc_get_htb_get_leaf_queue(struct airoha_gdm_port *port, ++ struct tc_htb_qopt_offload *opt) ++{ ++ u32 channel = TC_H_MIN(opt->classid) % AIROHA_NUM_QOS_CHANNELS; ++ ++ if (!test_bit(channel, port->qos_sq_bmap)) { ++ NL_SET_ERR_MSG_MOD(opt->extack, "invalid queue id"); ++ return -EINVAL; ++ } ++ ++ opt->qid = channel; ++ ++ return 0; ++} ++ ++static int airoha_tc_setup_qdisc_htb(struct airoha_gdm_port *port, ++ struct tc_htb_qopt_offload *opt) ++{ ++ switch (opt->command) { ++ case TC_HTB_CREATE: ++ break; ++ case TC_HTB_DESTROY: ++ return airoha_tc_htb_destroy(port); ++ case TC_HTB_NODE_MODIFY: ++ case TC_HTB_LEAF_ALLOC_QUEUE: ++ return airoha_tc_htb_alloc_leaf_queue(port, opt); ++ case TC_HTB_LEAF_DEL: ++ case TC_HTB_LEAF_DEL_LAST: ++ case TC_HTB_LEAF_DEL_LAST_FORCE: ++ return airoha_tc_htb_delete_leaf_queue(port, opt); ++ case TC_HTB_LEAF_QUERY_QUEUE: ++ return airoha_tc_get_htb_get_leaf_queue(port, opt); ++ default: ++ return -EOPNOTSUPP; ++ } ++ ++ return 0; ++} ++ + static int airoha_dev_tc_setup(struct net_device *dev, enum tc_setup_type type, + void *type_data) + { +@@ -2818,6 +3096,8 @@ static int airoha_dev_tc_setup(struct ne + switch (type) { + case TC_SETUP_QDISC_ETS: + return airoha_tc_setup_qdisc_ets(port, type_data); ++ case TC_SETUP_QDISC_HTB: ++ return airoha_tc_setup_qdisc_htb(port, type_data); + default: + return -EOPNOTSUPP; + } +@@ -2868,7 +3148,8 @@ static int airoha_alloc_gdm_port(struct + } + + dev = devm_alloc_etherdev_mqs(eth->dev, sizeof(*port), +- AIROHA_NUM_TX_RING, AIROHA_NUM_RX_RING); ++ AIROHA_NUM_NETDEV_TX_RINGS, ++ AIROHA_NUM_RX_RING); + if (!dev) { + dev_err(eth->dev, "alloc_etherdev failed\n"); + return -ENOMEM; +@@ -2888,6 +3169,11 @@ static int airoha_alloc_gdm_port(struct + dev->irq = qdma->irq; + SET_NETDEV_DEV(dev, eth->dev); + ++ /* reserve hw queues for HTB offloading */ ++ err = netif_set_real_num_tx_queues(dev, AIROHA_NUM_TX_RING); ++ if (err) ++ return err; ++ + err = of_get_ethdev_address(np, dev); + if (err) { + if (err == -EPROBE_DEFER) From 7e237f190225c0bcba0f5374632d0508f11398a8 Mon Sep 17 00:00:00 2001 From: Lorenzo Bianconi Date: Sat, 4 Jan 2025 15:46:57 +0100 Subject: [PATCH 108/173] kernel: modules: Add ETS Qdisc scheduler to sched KernelPackage Add ETS Qdisch scheduler to kernel package modules. Signed-off-by: Lorenzo Bianconi [ add commit description ] Signed-off-by: Christian Marangi --- package/kernel/linux/modules/netsupport.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/kernel/linux/modules/netsupport.mk b/package/kernel/linux/modules/netsupport.mk index 3551a89a9b2..06ef8232809 100644 --- a/package/kernel/linux/modules/netsupport.mk +++ b/package/kernel/linux/modules/netsupport.mk @@ -1026,7 +1026,7 @@ endef $(eval $(call KernelPackage,bpf-test)) -SCHED_MODULES_EXTRA = sch_codel sch_gred sch_multiq sch_sfq sch_teql sch_fq act_pedit act_simple act_skbmod act_csum em_cmp em_nbyte em_meta em_text +SCHED_MODULES_EXTRA = sch_codel sch_gred sch_multiq sch_sfq sch_teql sch_fq sch_ets act_pedit act_simple act_skbmod act_csum em_cmp em_nbyte em_meta em_text SCHED_FILES_EXTRA = $(foreach mod,$(SCHED_MODULES_EXTRA),$(LINUX_DIR)/net/sched/$(mod).ko) define KernelPackage/sched @@ -1040,6 +1040,7 @@ define KernelPackage/sched CONFIG_NET_SCH_SFQ \ CONFIG_NET_SCH_TEQL \ CONFIG_NET_SCH_FQ \ + CONFIG_NET_SCH_ETS \ CONFIG_NET_ACT_PEDIT \ CONFIG_NET_ACT_SIMP \ CONFIG_NET_ACT_SKBMOD \ From be5a9ff24b9c3b7d1b5bf508b84a35be9f9b3ea9 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 10 Jan 2025 14:27:07 +0100 Subject: [PATCH 109/173] airoha: an7581: add patch fixing support for MMC Add patch fixing support for MMC. Additional clock are needed for MMC to work and some small fixup to make the Mediatek MMC driver on Airoha SoC. Signed-off-by: Christian Marangi --- ...k-clock-handling-for-different-clock.patch | 82 +++++++++++ ...ck-drop-NUM_CLOCKS-define-for-EN7581.patch | 23 +++ ...ngs-clock-add-ID-for-eMMC-for-EN7581.patch | 23 +++ ...en7523-Add-clock-for-eMMC-for-EN7581.patch | 39 +++++ ...k-sd-add-support-for-AN7581-MMC-Host.patch | 138 ++++++++++++++++++ 5 files changed, 305 insertions(+) create mode 100644 target/linux/airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch create mode 100644 target/linux/airoha/patches-6.6/110-02-dt-bindings-clock-drop-NUM_CLOCKS-define-for-EN7581.patch create mode 100644 target/linux/airoha/patches-6.6/110-03-dt-bindings-clock-add-ID-for-eMMC-for-EN7581.patch create mode 100644 target/linux/airoha/patches-6.6/110-04-clk-en7523-Add-clock-for-eMMC-for-EN7581.patch create mode 100644 target/linux/airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch diff --git a/target/linux/airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch b/target/linux/airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch new file mode 100644 index 00000000000..7333ebbdf26 --- /dev/null +++ b/target/linux/airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch @@ -0,0 +1,82 @@ +From 04cd09990fdc3106d9fc4c47dda100e521d62a43 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Wed, 18 Dec 2024 10:03:45 +0100 +Subject: [PATCH 1/4] clk: en7523: Rework clock handling for different clock + numbers + +Airoha EN7581 SoC have additional clock compared to EN7523 but current +driver permits to only support up to EN7523 clock numbers. + +To handle this, rework the clock handling and permit to declare the +clocks number in match_data and alloca clk_data based on the compatible +match_data. + +Signed-off-by: Christian Marangi +--- + drivers/clk/clk-en7523.c | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +--- a/drivers/clk/clk-en7523.c ++++ b/drivers/clk/clk-en7523.c +@@ -75,6 +75,7 @@ struct en_rst_data { + }; + + struct en_clk_soc_data { ++ u32 num_clocks; + const struct clk_ops pcie_ops; + int (*hw_init)(struct platform_device *pdev, + struct clk_hw_onecell_data *clk_data); +@@ -525,8 +526,6 @@ static void en7523_register_clocks(struc + + hw = en7523_register_pcie_clk(dev, np_base); + clk_data->hws[EN7523_CLK_PCIE] = hw; +- +- clk_data->num = EN7523_NUM_CLOCKS; + } + + static int en7523_clk_hw_init(struct platform_device *pdev, +@@ -587,8 +586,6 @@ static void en7581_register_clocks(struc + + hw = en7523_register_pcie_clk(dev, base); + clk_data->hws[EN7523_CLK_PCIE] = hw; +- +- clk_data->num = EN7523_NUM_CLOCKS; + } + + static int en7523_reset_update(struct reset_controller_dev *rcdev, +@@ -702,21 +699,24 @@ static int en7523_clk_probe(struct platf + struct clk_hw_onecell_data *clk_data; + int r; + ++ soc_data = device_get_match_data(&pdev->dev); ++ + clk_data = devm_kzalloc(&pdev->dev, +- struct_size(clk_data, hws, EN7523_NUM_CLOCKS), ++ struct_size(clk_data, hws, soc_data->num_clocks), + GFP_KERNEL); + if (!clk_data) + return -ENOMEM; + +- soc_data = device_get_match_data(&pdev->dev); + r = soc_data->hw_init(pdev, clk_data); + if (r) + return r; + ++ clk_data->num = soc_data->num_clocks; + return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data); + } + + static const struct en_clk_soc_data en7523_data = { ++ .num_clocks = ARRAY_SIZE(en7523_base_clks) + 1, + .pcie_ops = { + .is_enabled = en7523_pci_is_enabled, + .prepare = en7523_pci_prepare, +@@ -726,6 +726,8 @@ static const struct en_clk_soc_data en75 + }; + + static const struct en_clk_soc_data en7581_data = { ++ /* We increment num_clocks by 1 to account for additional PCIe clock */ ++ .num_clocks = ARRAY_SIZE(en7581_base_clks) + 1, + .pcie_ops = { + .is_enabled = en7581_pci_is_enabled, + .enable = en7581_pci_enable, diff --git a/target/linux/airoha/patches-6.6/110-02-dt-bindings-clock-drop-NUM_CLOCKS-define-for-EN7581.patch b/target/linux/airoha/patches-6.6/110-02-dt-bindings-clock-drop-NUM_CLOCKS-define-for-EN7581.patch new file mode 100644 index 00000000000..e858d8b77d4 --- /dev/null +++ b/target/linux/airoha/patches-6.6/110-02-dt-bindings-clock-drop-NUM_CLOCKS-define-for-EN7581.patch @@ -0,0 +1,23 @@ +From 8fc9b68ee448d0e687d4dc52ec95bf367eb04caa Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Thu, 19 Dec 2024 13:13:37 +0100 +Subject: [PATCH 2/4] dt-bindings: clock: drop NUM_CLOCKS define for EN7581 + +Drop NUM_CLOCKS define for EN7581 include. This is not a binding and +should not be placed here. Value is derived internally in the user +driver. + +Signed-off-by: Christian Marangi +--- + include/dt-bindings/clock/en7523-clk.h | 2 -- + 1 file changed, 2 deletions(-) + +--- a/include/dt-bindings/clock/en7523-clk.h ++++ b/include/dt-bindings/clock/en7523-clk.h +@@ -12,6 +12,4 @@ + #define EN7523_CLK_CRYPTO 6 + #define EN7523_CLK_PCIE 7 + +-#define EN7523_NUM_CLOCKS 8 +- + #endif /* _DT_BINDINGS_CLOCK_AIROHA_EN7523_H_ */ diff --git a/target/linux/airoha/patches-6.6/110-03-dt-bindings-clock-add-ID-for-eMMC-for-EN7581.patch b/target/linux/airoha/patches-6.6/110-03-dt-bindings-clock-add-ID-for-eMMC-for-EN7581.patch new file mode 100644 index 00000000000..7bc987f4203 --- /dev/null +++ b/target/linux/airoha/patches-6.6/110-03-dt-bindings-clock-add-ID-for-eMMC-for-EN7581.patch @@ -0,0 +1,23 @@ +From 238436f998c551688695d26ecdcd2ea4d51190b1 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Wed, 11 Dec 2024 12:22:37 +0100 +Subject: [PATCH 3/4] dt-bindings: clock: add ID for eMMC for EN7581 + +Add ID for eMMC for EN7581. This is to control clock selection of eMMC +between 200MHz and 150MHz. + +Signed-off-by: Christian Marangi +Acked-by: Conor Dooley +--- + include/dt-bindings/clock/en7523-clk.h | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/include/dt-bindings/clock/en7523-clk.h ++++ b/include/dt-bindings/clock/en7523-clk.h +@@ -12,4 +12,6 @@ + #define EN7523_CLK_CRYPTO 6 + #define EN7523_CLK_PCIE 7 + ++#define EN7581_CLK_EMMC 8 ++ + #endif /* _DT_BINDINGS_CLOCK_AIROHA_EN7523_H_ */ diff --git a/target/linux/airoha/patches-6.6/110-04-clk-en7523-Add-clock-for-eMMC-for-EN7581.patch b/target/linux/airoha/patches-6.6/110-04-clk-en7523-Add-clock-for-eMMC-for-EN7581.patch new file mode 100644 index 00000000000..64d53391769 --- /dev/null +++ b/target/linux/airoha/patches-6.6/110-04-clk-en7523-Add-clock-for-eMMC-for-EN7581.patch @@ -0,0 +1,39 @@ +From 4fc22765b3888cf6575015b904718bfd36d1f49c Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Wed, 11 Dec 2024 12:22:38 +0100 +Subject: [PATCH 4/4] clk: en7523: Add clock for eMMC for EN7581 + +Add clock for eMMC for EN7581. This is used to give info of the current +eMMC source clock and to switch it from 200MHz or 150MHz. + +Signed-off-by: Christian Marangi +--- + drivers/clk/clk-en7523.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/drivers/clk/clk-en7523.c ++++ b/drivers/clk/clk-en7523.c +@@ -91,6 +91,7 @@ static const u32 emi7581_base[] = { 5400 + static const u32 bus7581_base[] = { 600000000, 540000000 }; + static const u32 npu7581_base[] = { 800000000, 750000000, 720000000, 600000000 }; + static const u32 crypto_base[] = { 540000000, 480000000 }; ++static const u32 emmc7581_base[] = { 200000000, 150000000 }; + + static const struct en_clk_desc en7523_base_clks[] = { + { +@@ -281,6 +282,15 @@ static const struct en_clk_desc en7581_b + .base_shift = 0, + .base_values = crypto_base, + .n_base_values = ARRAY_SIZE(crypto_base), ++ }, { ++ .id = EN7581_CLK_EMMC, ++ .name = "emmc", ++ ++ .base_reg = REG_CRYPTO_CLKSRC2, ++ .base_bits = 1, ++ .base_shift = 12, ++ .base_values = emmc7581_base, ++ .n_base_values = ARRAY_SIZE(emmc7581_base), + } + }; + diff --git a/target/linux/airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch b/target/linux/airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch new file mode 100644 index 00000000000..24c4dbde786 --- /dev/null +++ b/target/linux/airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch @@ -0,0 +1,138 @@ +From f38f16925e1aa7cc71f63d3d52997b1c98cd7781 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Wed, 11 Dec 2024 11:27:10 +0100 +Subject: [PATCH 4/4] mmc: mtk-sd: add support for AN7581 MMC Host + +Add support for AN7581 MMC Host. The MMC Host controller is based on +mt7622 with the difference of not having regulator supply and state_uhs +pins and hclk clock. + +Some minor fixes are applied to check if the state_uhs pins are defined +and make hclk optional for the new airoha compatible. + +Signed-off-by: Christian Marangi +--- + drivers/mmc/host/mtk-sd.c | 55 ++++++++++++++++++++++++++++++++------- + 1 file changed, 46 insertions(+), 9 deletions(-) + +--- a/drivers/mmc/host/mtk-sd.c ++++ b/drivers/mmc/host/mtk-sd.c +@@ -615,6 +615,19 @@ static const struct mtk_mmc_compatible m + .stop_clk_fix = true, + }; + ++static const struct mtk_mmc_compatible an7581_compat = { ++ .clk_div_bits = 12, ++ .recheck_sdio_irq = true, ++ .hs400_tune = false, ++ .pad_tune_reg = MSDC_PAD_TUNE0, ++ .async_fifo = true, ++ .data_tune = true, ++ .busy_check = true, ++ .stop_clk_fix = true, ++ .enhance_rx = true, ++ .support_64g = false, ++}; ++ + static const struct of_device_id msdc_of_ids[] = { + { .compatible = "mediatek,mt2701-mmc", .data = &mt2701_compat}, + { .compatible = "mediatek,mt2712-mmc", .data = &mt2712_compat}, +@@ -627,7 +640,7 @@ static const struct of_device_id msdc_of + { .compatible = "mediatek,mt8173-mmc", .data = &mt8173_compat}, + { .compatible = "mediatek,mt8183-mmc", .data = &mt8183_compat}, + { .compatible = "mediatek,mt8516-mmc", .data = &mt8516_compat}, +- ++ { .compatible = "airoha,an7581-mmc", .data = &an7581_compat}, + {} + }; + MODULE_DEVICE_TABLE(of, msdc_of_ids); +@@ -1479,6 +1492,10 @@ static int msdc_ops_switch_volt(struct m + struct msdc_host *host = mmc_priv(mmc); + int ret; + ++ /* Skip setting supply if not supported */ ++ if (!mmc->supply.vqmmc) ++ return 0; ++ + if (!IS_ERR(mmc->supply.vqmmc)) { + if (ios->signal_voltage != MMC_SIGNAL_VOLTAGE_330 && + ios->signal_voltage != MMC_SIGNAL_VOLTAGE_180) { +@@ -1578,7 +1595,9 @@ static void msdc_enable_sdio_irq(struct + dev_dbg(host->dev, "SDIO eint irq: %d!\n", host->eint_irq); + } + +- pinctrl_select_state(host->pinctrl, host->pins_uhs); ++ /* Skip setting uhs pins if not supported */ ++ if (host->pins_uhs) ++ pinctrl_select_state(host->pinctrl, host->pins_uhs); + } else { + dev_pm_clear_wake_irq(host->dev); + } +@@ -1886,6 +1905,10 @@ static void msdc_ops_set_ios(struct mmc_ + + msdc_set_buswidth(host, ios->bus_width); + ++ /* Skip regulator if not supported */ ++ if (!mmc->supply.vmmc) ++ goto skip_regulator; ++ + /* Suspend/Resume will do power off/on */ + switch (ios->power_mode) { + case MMC_POWER_UP: +@@ -1921,6 +1944,7 @@ static void msdc_ops_set_ios(struct mmc_ + break; + } + ++skip_regulator: + if (host->mclk != ios->clock || host->timing != ios->timing) + msdc_set_mclk(host, ios->timing, ios->clock); + } +@@ -2617,9 +2641,12 @@ static int msdc_of_clock_parse(struct pl + if (IS_ERR(host->src_clk)) + return PTR_ERR(host->src_clk); + +- host->h_clk = devm_clk_get(&pdev->dev, "hclk"); +- if (IS_ERR(host->h_clk)) +- return PTR_ERR(host->h_clk); ++ /* AN7581 SoC doesn't have hclk */ ++ if (!device_is_compatible(&pdev->dev, "airoha,an7581-mmc")) { ++ host->h_clk = devm_clk_get(&pdev->dev, "hclk"); ++ if (IS_ERR(host->h_clk)) ++ return PTR_ERR(host->h_clk); ++ } + + host->bus_clk = devm_clk_get_optional(&pdev->dev, "bus_clk"); + if (IS_ERR(host->bus_clk)) +@@ -2740,11 +2767,14 @@ static int msdc_drv_probe(struct platfor + goto host_free; + } + +- host->pins_uhs = pinctrl_lookup_state(host->pinctrl, "state_uhs"); +- if (IS_ERR(host->pins_uhs)) { +- ret = PTR_ERR(host->pins_uhs); +- dev_err(&pdev->dev, "Cannot find pinctrl uhs!\n"); +- goto host_free; ++ /* AN7581 doesn't have state_uhs pins */ ++ if (!device_is_compatible(&pdev->dev, "airoha,an7581-mmc")) { ++ host->pins_uhs = pinctrl_lookup_state(host->pinctrl, "state_uhs"); ++ if (IS_ERR(host->pins_uhs)) { ++ ret = PTR_ERR(host->pins_uhs); ++ dev_err(&pdev->dev, "Cannot find pinctrl uhs!\n"); ++ goto host_free; ++ } + } + + /* Support for SDIO eint irq ? */ +@@ -2825,6 +2855,12 @@ static int msdc_drv_probe(struct platfor + dev_err(&pdev->dev, "Cannot ungate clocks!\n"); + goto release_mem; + } ++ ++ /* AN7581 without regulator require tune to OCR values */ ++ if (device_is_compatible(&pdev->dev, "airoha,an7581-mmc") && ++ !mmc->ocr_avail) ++ mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; ++ + msdc_init_hw(host); + + if (mmc->caps2 & MMC_CAP2_CQE) { From 77329b7d8d870897d85270a4e806ec0d04396685 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 10 Jan 2025 14:28:20 +0100 Subject: [PATCH 110/173] airoha: an7581: add pending patch to fix PCI Add pending patch to fix PCIe missing register. Signed-off-by: Christian Marangi --- ...3-configure-PBUS_CSR-registers-for-E.patch | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 target/linux/airoha/patches-6.6/112-PCI-mediatek-gen3-configure-PBUS_CSR-registers-for-E.patch diff --git a/target/linux/airoha/patches-6.6/112-PCI-mediatek-gen3-configure-PBUS_CSR-registers-for-E.patch b/target/linux/airoha/patches-6.6/112-PCI-mediatek-gen3-configure-PBUS_CSR-registers-for-E.patch new file mode 100644 index 00000000000..d896e1aee3f --- /dev/null +++ b/target/linux/airoha/patches-6.6/112-PCI-mediatek-gen3-configure-PBUS_CSR-registers-for-E.patch @@ -0,0 +1,83 @@ +From 2285d3b428c7d8f1c4fda2fb995e7e46a05350e0 Mon Sep 17 00:00:00 2001 +Message-ID: <2285d3b428c7d8f1c4fda2fb995e7e46a05350e0.1736324542.git.lorenzo@kernel.org> +In-Reply-To: <0c0ae72f5c84c5a29495337b254ac3cc2d5c16bb.1736324541.git.lorenzo@kernel.org> +References: <0c0ae72f5c84c5a29495337b254ac3cc2d5c16bb.1736324541.git.lorenzo@kernel.org> +From: Lorenzo Bianconi +Date: Tue, 3 Sep 2024 23:14:02 +0200 +Subject: [PATCH 2/2] PCI: mediatek-gen3: configure PBUS_CSR registers for + EN7581 SoC + +Configure PBus base address and address mask in order to allow the hw +detecting if a given address is on PCIE0, PCIE1 or PCIE2. + +Signed-off-by: Lorenzo Bianconi +--- + drivers/pci/controller/pcie-mediatek-gen3.c | 29 ++++++++++++++++++++- + 1 file changed, 28 insertions(+), 1 deletion(-) + +--- a/drivers/pci/controller/pcie-mediatek-gen3.c ++++ b/drivers/pci/controller/pcie-mediatek-gen3.c +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -24,6 +25,7 @@ + #include + #include + #include ++#include + #include + + #include "../pci.h" +@@ -120,6 +122,13 @@ + + #define MAX_NUM_PHY_RESETS 3 + ++#define PCIE_EN7581_PBUS_ADDR(_n) (0x00 + ((_n) << 3)) ++#define PCIE_EN7581_PBUS_ADDR_MASK(_n) (0x04 + ((_n) << 3)) ++#define PCIE_EN7581_PBUS_BASE_ADDR(_n) \ ++ ((_n) == 2 ? 0x28000000 : \ ++ (_n) == 1 ? 0x24000000 : 0x20000000) ++#define PCIE_EN7581_PBUS_BASE_ADDR_MASK GENMASK(31, 26) ++ + /* Time in ms needed to complete PCIe reset on EN7581 SoC */ + #define PCIE_EN7581_RESET_TIME_MS 100 + +@@ -871,7 +880,8 @@ static int mtk_pcie_parse_port(struct mt + static int mtk_pcie_en7581_power_up(struct mtk_gen3_pcie *pcie) + { + struct device *dev = pcie->dev; +- int err; ++ struct regmap *map; ++ int err, slot; + u32 val; + + /* +@@ -880,6 +890,23 @@ static int mtk_pcie_en7581_power_up(stru + */ + mdelay(PCIE_EN7581_RESET_TIME_MS); + ++ map = syscon_regmap_lookup_by_compatible("airoha,en7581-pbus-csr"); ++ if (IS_ERR(map)) ++ return PTR_ERR(map); ++ ++ /* ++ * Configure PBus base address and address mask in order to allow the ++ * hw detecting if a given address is on PCIE0, PCIE1 or PCIE2. ++ */ ++ slot = of_get_pci_domain_nr(dev->of_node); ++ if (slot < 0) ++ return slot; ++ ++ regmap_write(map, PCIE_EN7581_PBUS_ADDR(slot), ++ PCIE_EN7581_PBUS_BASE_ADDR(slot)); ++ regmap_write(map, PCIE_EN7581_PBUS_ADDR_MASK(slot), ++ PCIE_EN7581_PBUS_BASE_ADDR_MASK); ++ + err = phy_init(pcie->phy); + if (err) { + dev_err(dev, "failed to initialize PHY\n"); From 53bc7633317a7da9bf7ef440ed3da39404cf146e Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 10 Jan 2025 14:29:02 +0100 Subject: [PATCH 111/173] airoha: an7581: add pending patch for ETS qdisc on ethernet driver Add pending patch for ETS qdisc on Airoha ethernet driver. Signed-off-by: Christian Marangi --- ...-channel-configuration-for-ETS-Qdisc.patch | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 target/linux/airoha/patches-6.6/113-net-airoha-Fix-channel-configuration-for-ETS-Qdisc.patch diff --git a/target/linux/airoha/patches-6.6/113-net-airoha-Fix-channel-configuration-for-ETS-Qdisc.patch b/target/linux/airoha/patches-6.6/113-net-airoha-Fix-channel-configuration-for-ETS-Qdisc.patch new file mode 100644 index 00000000000..5bd7487b9f2 --- /dev/null +++ b/target/linux/airoha/patches-6.6/113-net-airoha-Fix-channel-configuration-for-ETS-Qdisc.patch @@ -0,0 +1,104 @@ +From patchwork Tue Jan 7 22:26:28 2025 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Lorenzo Bianconi +X-Patchwork-Id: 13929634 +X-Patchwork-Delegate: kuba@kernel.org +Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org + [10.30.226.201]) + (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) + (No client certificate requested) + by smtp.subspace.kernel.org (Postfix) with ESMTPS id A82271A3035 + for ; Tue, 7 Jan 2025 22:27:02 +0000 (UTC) +Authentication-Results: smtp.subspace.kernel.org; + arc=none smtp.client-ip=10.30.226.201 +ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; + t=1736288822; cv=none; + b=XZhiaYPBxLiUvOxWeE7zfuFI3fOmu5SLoHdLPFXNXBtvmZWWIohKA8AeGI37v/l+0Du9JwGRKMkb19v/IxDJtMXkyTJXHHKYhXWaNFpj/pFRk9C4WsIa29OCqanfA+yXUQLJyGVopMLsxfcbzznozIANWbaO0NVBHyZZSH9eaYU= +ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; + s=arc-20240116; t=1736288822; c=relaxed/simple; + bh=/BuvRwLGk+7by7QeOu7n+QgJ5Sk03TO9WCsGbgTs3sE=; + h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; + b=jHXwJfD+6o5WvM5xaeL35BI6hshOViNtg+mSqf5q8jH9l3k6FctngCkEYdxJzcYaw9aEEigC8/FZiHoPrIXGyJA29kTWkYSjj7rtagL1aSIWPGAuSJaaAUv2Bj8jxUmIlJxb23wTleEv/Pwnz+1oSf3yZ7g46h9gv4RZaU8yySg= +ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; + dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org + header.b=Gx3FMrdJ; arc=none smtp.client-ip=10.30.226.201 +Authentication-Results: smtp.subspace.kernel.org; + dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org + header.b="Gx3FMrdJ" +Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1A57C4CED6; + Tue, 7 Jan 2025 22:27:01 +0000 (UTC) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; + s=k20201202; t=1736288822; + bh=/BuvRwLGk+7by7QeOu7n+QgJ5Sk03TO9WCsGbgTs3sE=; + h=From:Date:Subject:To:Cc:From; + b=Gx3FMrdJH+xaen2jSRnu523A40ZOBBFaj896IwBv1PeosUm+eiUCx+K3Qz9CAisX0 + Bj4ohheTiHZDQHZelhKF3ZFTfVQUyYiLiard4x5QdylW2YZA0cpwJe64TMf7CsHbrT + NHCF7nrJPJUwOhDoS/YVdeTw/bb9DlM95aKGSfyH0cy7Kdmjz55No3Im9bCSKcgyaX + Y/lcRZglFjbLyiC3LS06AtM0KOyhUxQKrH+ZWpx5E/sdOEj3SRTJ/I+K8o3m75Kzsn + wKRft5pBwfhGEIrJXrFR4f73QwnxJ6eSUrfjYV8k4mFQpH3nB0hKLi2DpvYPim5dj/ + ADsdcP6QPwokg== +From: Lorenzo Bianconi +Date: Tue, 07 Jan 2025 23:26:28 +0100 +Subject: [PATCH net-next] net: airoha: Fix channel configuration for ETS + Qdisc +Precedence: bulk +X-Mailing-List: netdev@vger.kernel.org +List-Id: +List-Subscribe: +List-Unsubscribe: +MIME-Version: 1.0 +Message-Id: <20250107-airoha-ets-fix-chan-v1-1-97f66ed3a068@kernel.org> +X-B4-Tracking: v=1; b=H4sIABOqfWcC/x2MSwqAMAwFryJZG6ifVvAq4qLUaLNRaUSE0rsbX + Q5v3mQQSkwCY5Uh0c3Cx67Q1BWE6PeNkBdlaE1rTWMG9JyO6JEuwZUf/CSkzobgw+AW14M+z0S + 6/dVpLuUFNrlCSGUAAAA= +X-Change-ID: 20250107-airoha-ets-fix-chan-e35ccac76d64 +To: Felix Fietkau , Sean Wang , + Mark Lee , Andrew Lunn , + "David S. Miller" , Eric Dumazet , + Jakub Kicinski , Paolo Abeni , + Matthias Brugger , + AngeloGioacchino Del Regno +Cc: linux-arm-kernel@lists.infradead.org, + linux-mediatek@lists.infradead.org, netdev@vger.kernel.org, + Lorenzo Bianconi +X-Mailer: b4 0.14.2 +X-Patchwork-Delegate: kuba@kernel.org + +Limit ETS QoS channel to AIROHA_NUM_QOS_CHANNELS in +airoha_tc_setup_qdisc_ets() in order to align the configured channel to +the value set in airoha_dev_select_queue(). + +Fixes: 20bf7d07c956 ("net: airoha: Add sched ETS offload support") +Signed-off-by: Lorenzo Bianconi +Reviewed-by: Michal Swiatkowski +--- + drivers/net/ethernet/mediatek/airoha_eth.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + + +--- +base-commit: a1942da8a38717ddd9b4c132f59e1657c85c1432 +change-id: 20250107-airoha-ets-fix-chan-e35ccac76d64 + +Best regards, + +--- a/drivers/net/ethernet/mediatek/airoha_eth.c ++++ b/drivers/net/ethernet/mediatek/airoha_eth.c +@@ -2833,11 +2833,14 @@ static int airoha_qdma_get_tx_ets_stats( + static int airoha_tc_setup_qdisc_ets(struct airoha_gdm_port *port, + struct tc_ets_qopt_offload *opt) + { +- int channel = TC_H_MAJ(opt->handle) >> 16; ++ int channel; + + if (opt->parent == TC_H_ROOT) + return -EINVAL; + ++ channel = TC_H_MAJ(opt->handle) >> 16; ++ channel = channel % AIROHA_NUM_QOS_CHANNELS; ++ + switch (opt->command) { + case TC_ETS_REPLACE: + return airoha_qdma_set_tx_ets_sched(port, channel, opt); From 506955735075241d3467d632cae7ed5f10e21c2f Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 10 Jan 2025 14:53:04 +0100 Subject: [PATCH 112/173] airoha: an7581: replace cpufreq patch with new version Replace cpufreq patch with new version requested upstream. Signed-off-by: Christian Marangi --- ...oha-Add-Airoha-CPU-PM-Domain-support.patch | 201 ++++++++++++++ ...roha-Add-EN7581-CPUFreq-SMCCC-driver.patch | 253 ++++++++++++++++++ ...airoha-Add-EN7581-Cpufreq-SMC-driver.patch | 247 ----------------- 3 files changed, 454 insertions(+), 247 deletions(-) create mode 100644 target/linux/airoha/patches-6.6/100-01-pmdomain-airoha-Add-Airoha-CPU-PM-Domain-support.patch create mode 100644 target/linux/airoha/patches-6.6/100-02-cpufreq-airoha-Add-EN7581-CPUFreq-SMCCC-driver.patch delete mode 100644 target/linux/airoha/patches-6.6/100-cpufreq-airoha-Add-EN7581-Cpufreq-SMC-driver.patch diff --git a/target/linux/airoha/patches-6.6/100-01-pmdomain-airoha-Add-Airoha-CPU-PM-Domain-support.patch b/target/linux/airoha/patches-6.6/100-01-pmdomain-airoha-Add-Airoha-CPU-PM-Domain-support.patch new file mode 100644 index 00000000000..52d3f40b369 --- /dev/null +++ b/target/linux/airoha/patches-6.6/100-01-pmdomain-airoha-Add-Airoha-CPU-PM-Domain-support.patch @@ -0,0 +1,201 @@ +From 76e4e6ce9aaae897f80e375345bf0095e1b09ff2 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Sat, 4 Jan 2025 19:03:09 +0100 +Subject: [PATCH v9 1/2] pmdomain: airoha: Add Airoha CPU PM Domain support + +Add Airoha CPU PM Domain support to control frequency and power of CPU +present on Airoha EN7581 SoC. + +Frequency and power can be controlled with the use of the SMC command by +passing the performance state. The driver also expose a read-only clock +that expose the current CPU frequency with SMC command. + +Signed-off-by: Christian Marangi +--- +Changes v9: +- Fix compile error targetting wrong branch (remove_new change) +Changes v8: +- Add this patch +- Use SMC invoke instead of 1.2 + + drivers/pmdomain/mediatek/Kconfig | 11 ++ + drivers/pmdomain/mediatek/Makefile | 1 + + .../pmdomain/mediatek/airoha-cpu-pmdomain.c | 144 ++++++++++++++++++ + 3 files changed, 156 insertions(+) + create mode 100644 drivers/pmdomain/mediatek/airoha-cpu-pmdomain.c + +--- a/drivers/soc/mediatek/Kconfig ++++ b/drivers/soc/mediatek/Kconfig +@@ -72,6 +72,17 @@ config MTK_SCPSYS_PM_DOMAINS + Control Processor System (SCPSYS) has several power management related + tasks in the system. + ++config AIROHA_CPU_PM_DOMAIN ++ tristate "Airoha CPU power domain" ++ default ARCH_AIROHA ++ depends on PM ++ select PM_GENERIC_DOMAINS ++ help ++ Say y here to enable CPU power domain support for Airoha SoC. ++ ++ CPU frequency and power is controlled by ATF with SMC command to ++ set performance states. ++ + config MTK_MMSYS + tristate "MediaTek MMSYS Support" + default ARCH_MEDIATEK +--- a/drivers/pmdomain/mediatek/Makefile ++++ b/drivers/pmdomain/mediatek/Makefile +@@ -1,3 +1,4 @@ + # SPDX-License-Identifier: GPL-2.0-only + obj-$(CONFIG_MTK_SCPSYS) += mtk-scpsys.o + obj-$(CONFIG_MTK_SCPSYS_PM_DOMAINS) += mtk-pm-domains.o ++obj-$(CONFIG_AIROHA_CPU_PM_DOMAIN) += airoha-cpu-pmdomain.o +--- /dev/null ++++ b/drivers/pmdomain/mediatek/airoha-cpu-pmdomain.c +@@ -0,0 +1,145 @@ ++// SPDX-License-Identifier: GPL-2.0 ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define AIROHA_SIP_AVS_HANDLE 0x82000301 ++#define AIROHA_AVS_OP_BASE 0xddddddd0 ++#define AIROHA_AVS_OP_MASK GENMASK(1, 0) ++#define AIROHA_AVS_OP_FREQ_DYN_ADJ (AIROHA_AVS_OP_BASE | \ ++ FIELD_PREP(AIROHA_AVS_OP_MASK, 0x1)) ++#define AIROHA_AVS_OP_GET_FREQ (AIROHA_AVS_OP_BASE | \ ++ FIELD_PREP(AIROHA_AVS_OP_MASK, 0x2)) ++ ++struct airoha_cpu_pmdomain_priv { ++ struct clk_hw hw; ++ struct generic_pm_domain pd; ++}; ++ ++static long airoha_cpu_pmdomain_clk_round(struct clk_hw *hw, unsigned long rate, ++ unsigned long *parent_rate) ++{ ++ return rate; ++} ++ ++static unsigned long airoha_cpu_pmdomain_clk_get(struct clk_hw *hw, ++ unsigned long parent_rate) ++{ ++ struct arm_smccc_res res; ++ ++ arm_smccc_1_1_invoke(AIROHA_SIP_AVS_HANDLE, AIROHA_AVS_OP_GET_FREQ, ++ 0, 0, 0, 0, 0, 0, &res); ++ ++ /* SMCCC returns freq in MHz */ ++ return (int)(res.a0 * 1000 * 1000); ++} ++ ++/* Airoha CPU clk SMCC is always enabled */ ++static int airoha_cpu_pmdomain_clk_is_enabled(struct clk_hw *hw) ++{ ++ return true; ++} ++ ++static const struct clk_ops airoha_cpu_pmdomain_clk_ops = { ++ .recalc_rate = airoha_cpu_pmdomain_clk_get, ++ .is_enabled = airoha_cpu_pmdomain_clk_is_enabled, ++ .round_rate = airoha_cpu_pmdomain_clk_round, ++}; ++ ++static int airoha_cpu_pmdomain_set_performance_state(struct generic_pm_domain *domain, ++ unsigned int state) ++{ ++ struct arm_smccc_res res; ++ ++ arm_smccc_1_1_invoke(AIROHA_SIP_AVS_HANDLE, AIROHA_AVS_OP_FREQ_DYN_ADJ, ++ 0, state, 0, 0, 0, 0, &res); ++ ++ /* SMC signal correct apply by unsetting BIT 0 */ ++ return res.a0 & BIT(0) ? -EINVAL : 0; ++} ++ ++static int airoha_cpu_pmdomain_probe(struct platform_device *pdev) ++{ ++ struct airoha_cpu_pmdomain_priv *priv; ++ struct device *dev = &pdev->dev; ++ struct clk_init_data init = { }; ++ struct generic_pm_domain *pd; ++ struct clk_hw *hw; ++ int ret; ++ ++ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ /* Init and register a get-only clk for Cpufreq */ ++ init.name = "cpu"; ++ init.ops = &airoha_cpu_pmdomain_clk_ops; ++ /* Clock with no set_rate, can't cache */ ++ init.flags = CLK_GET_RATE_NOCACHE; ++ ++ hw = &priv->hw; ++ hw->init = &init; ++ ret = devm_clk_hw_register(dev, hw); ++ if (ret) ++ return ret; ++ ++ ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, hw); ++ if (ret) ++ return ret; ++ ++ /* Init and register a PD for CPU */ ++ pd = &priv->pd; ++ pd->name = "cpu_pd"; ++ pd->flags = GENPD_FLAG_ALWAYS_ON; ++ pd->set_performance_state = airoha_cpu_pmdomain_set_performance_state; ++ ++ ret = pm_genpd_init(pd, NULL, false); ++ if (ret) ++ return ret; ++ ++ ret = of_genpd_add_provider_simple(dev->of_node, pd); ++ if (ret) ++ goto err_add_provider; ++ ++ platform_set_drvdata(pdev, priv); ++ ++ return 0; ++ ++err_add_provider: ++ pm_genpd_remove(pd); ++ ++ return ret; ++} ++ ++static void airoha_cpu_pmdomain_remove(struct platform_device *pdev) ++{ ++ struct airoha_cpu_pmdomain_priv *priv = platform_get_drvdata(pdev); ++ ++ of_genpd_del_provider(pdev->dev.of_node); ++ pm_genpd_remove(&priv->pd); ++} ++ ++static const struct of_device_id airoha_cpu_pmdomain_of_match[] = { ++ { .compatible = "airoha,en7581-cpufreq" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, airoha_cpu_pmdomain_of_match); ++ ++static struct platform_driver airoha_cpu_pmdomain_driver = { ++ .probe = airoha_cpu_pmdomain_probe, ++ .remove_new = airoha_cpu_pmdomain_remove, ++ .driver = { ++ .name = "airoha-cpu-pmdomain", ++ .of_match_table = airoha_cpu_pmdomain_of_match, ++ }, ++}; ++module_platform_driver(airoha_cpu_pmdomain_driver); ++ ++MODULE_AUTHOR("Christian Marangi "); ++MODULE_DESCRIPTION("CPU PM domain driver for Airoha SoCs"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/airoha/patches-6.6/100-02-cpufreq-airoha-Add-EN7581-CPUFreq-SMCCC-driver.patch b/target/linux/airoha/patches-6.6/100-02-cpufreq-airoha-Add-EN7581-CPUFreq-SMCCC-driver.patch new file mode 100644 index 00000000000..6a2e54f4d1a --- /dev/null +++ b/target/linux/airoha/patches-6.6/100-02-cpufreq-airoha-Add-EN7581-CPUFreq-SMCCC-driver.patch @@ -0,0 +1,253 @@ +From fa27cb99b297a1a9c0a5824afe5a670e424fff61 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Wed, 16 Oct 2024 18:00:57 +0200 +Subject: [PATCH v9 2/2] cpufreq: airoha: Add EN7581 CPUFreq SMCCC driver + +Add simple CPU Freq driver for Airoha EN7581 SoC that control CPU +frequency scaling with SMC APIs and register a generic "cpufreq-dt" +device. + +All CPU share the same frequency and can't be controlled independently. +CPU frequency is controlled by the attached PM domain. + +Add SoC compatible to cpufreq-dt-plat block list as a dedicated cpufreq +driver is needed with OPP v2 nodes declared in DTS. + +Signed-off-by: Christian Marangi +--- +Changes v9: +- Fix compile error targetting wrong branch (remove_new change and new PM OPs) +Changes v8: +- Split in dedicated PM domain driver +Changes v7: +- No changes +Changes v6: +- Improve Kconfig depends logic +- Select PM (PM_GENERIC_DOMAINS depends on it) +- Drop (int) cast for +Changes v5: +- Rename cpu_pd to perf for power domain name +- Use remove instead of remove_new +Changes v4: +- Rework to clk-only + PM set_performance_state implementation +Changes v3: +- Adapt to new cpufreq-dt APIs +- Register cpufreq-dt instead of custom freq driver +Changes v2: +- Fix kernel bot error with missing slab.h and bitfield.h header +- Limit COMPILE_TEST to ARM64 due to smcc 1.2 + + drivers/cpufreq/Kconfig.arm | 8 ++ + drivers/cpufreq/Makefile | 1 + + drivers/cpufreq/airoha-cpufreq.c | 152 +++++++++++++++++++++++++++ + drivers/cpufreq/cpufreq-dt-platdev.c | 2 + + 4 files changed, 163 insertions(+) + create mode 100644 drivers/cpufreq/airoha-cpufreq.c + +--- a/drivers/cpufreq/Kconfig.arm ++++ b/drivers/cpufreq/Kconfig.arm +@@ -41,6 +41,14 @@ config ARM_ALLWINNER_SUN50I_CPUFREQ_NVME + To compile this driver as a module, choose M here: the + module will be called sun50i-cpufreq-nvmem. + ++config ARM_AIROHA_SOC_CPUFREQ ++ tristate "Airoha EN7581 SoC CPUFreq support" ++ depends on ARCH_AIROHA || COMPILE_TEST ++ select PM_OPP ++ default ARCH_AIROHA ++ help ++ This adds the CPUFreq driver for Airoha EN7581 SoCs. ++ + config ARM_APPLE_SOC_CPUFREQ + tristate "Apple Silicon SoC CPUFreq support" + depends on ARCH_APPLE || (COMPILE_TEST && 64BIT) +--- a/drivers/cpufreq/Makefile ++++ b/drivers/cpufreq/Makefile +@@ -52,6 +52,7 @@ obj-$(CONFIG_X86_AMD_FREQ_SENSITIVITY) + + + ################################################################################## + # ARM SoC drivers ++obj-$(CONFIG_ARM_AIROHA_SOC_CPUFREQ) += airoha-cpufreq.o + obj-$(CONFIG_ARM_APPLE_SOC_CPUFREQ) += apple-soc-cpufreq.o + obj-$(CONFIG_ARM_ARMADA_37XX_CPUFREQ) += armada-37xx-cpufreq.o + obj-$(CONFIG_ARM_ARMADA_8K_CPUFREQ) += armada-8k-cpufreq.o +--- /dev/null ++++ b/drivers/cpufreq/airoha-cpufreq.c +@@ -0,0 +1,166 @@ ++// SPDX-License-Identifier: GPL-2.0 ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "cpufreq-dt.h" ++ ++struct airoha_cpufreq_priv { ++ int opp_token; ++ struct device **virt_devs; ++ struct platform_device *cpufreq_dt; ++}; ++ ++static struct platform_device *cpufreq_pdev; ++ ++/* NOP function to disable OPP from setting clock */ ++static int airoha_cpufreq_config_clks_nop(struct device *dev, ++ struct opp_table *opp_table, ++ struct dev_pm_opp *old_opp, ++ struct dev_pm_opp *opp, ++ void *data, bool scaling_down) ++{ ++ return 0; ++} ++ ++static const char * const airoha_cpufreq_clk_names[] = { "cpu", NULL }; ++static const char * const airoha_cpufreq_genpd_names[] = { "cpu_pd", NULL }; ++ ++static int airoha_cpufreq_probe(struct platform_device *pdev) ++{ ++ struct dev_pm_opp_config config = { }; ++ struct platform_device *cpufreq_dt; ++ struct airoha_cpufreq_priv *priv; ++ struct device *dev = &pdev->dev; ++ struct device **virt_devs = NULL; ++ struct device *cpu_dev; ++ int ret; ++ ++ /* CPUs refer to the same OPP table */ ++ cpu_dev = get_cpu_device(0); ++ if (!cpu_dev) ++ return -ENODEV; ++ ++ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ config.clk_names = airoha_cpufreq_clk_names; ++ config.config_clks = airoha_cpufreq_config_clks_nop; ++ config.genpd_names = airoha_cpufreq_genpd_names; ++ config.virt_devs = &virt_devs; ++ ++ priv->opp_token = dev_pm_opp_set_config(cpu_dev, &config); ++ if (priv->opp_token < 0) ++ return dev_err_probe(dev, priv->opp_token, "Failed to set OPP config\n"); ++ ++ /* Set Attached PM for OPP ACTIVE */ ++ if (virt_devs) { ++ const char * const *name = airoha_cpufreq_genpd_names; ++ int i, j; ++ ++ for (i = 0; *name; i++, name++) { ++ ret = pm_runtime_resume_and_get(virt_devs[i]); ++ if (ret) { ++ dev_err(cpu_dev, "failed to resume %s: %d\n", ++ *name, ret); ++ ++ /* Rollback previous PM runtime calls */ ++ name = config.genpd_names; ++ for (j = 0; *name && j < i; j++, name++) ++ pm_runtime_put(virt_devs[j]); ++ ++ goto err_register_cpufreq; ++ } ++ } ++ priv->virt_devs = virt_devs; ++ } ++ ++ cpufreq_dt = platform_device_register_simple("cpufreq-dt", -1, NULL, 0); ++ ret = PTR_ERR_OR_ZERO(cpufreq_dt); ++ if (ret) { ++ dev_err(dev, "failed to create cpufreq-dt device: %d\n", ret); ++ goto err_register_cpufreq; ++ } ++ ++ priv->cpufreq_dt = cpufreq_dt; ++ platform_set_drvdata(pdev, priv); ++ ++ return 0; ++ ++err_register_cpufreq: ++ dev_pm_opp_clear_config(priv->opp_token); ++ ++ return ret; ++} ++ ++static void airoha_cpufreq_remove(struct platform_device *pdev) ++{ ++ struct airoha_cpufreq_priv *priv = platform_get_drvdata(pdev); ++ const char * const *name = airoha_cpufreq_genpd_names; ++ int i; ++ ++ platform_device_unregister(priv->cpufreq_dt); ++ ++ dev_pm_opp_clear_config(priv->opp_token); ++ ++ for (i = 0; *name; i++, name++) ++ pm_runtime_put(priv->virt_devs[i]); ++} ++ ++static struct platform_driver airoha_cpufreq_driver = { ++ .probe = airoha_cpufreq_probe, ++ .remove_new = airoha_cpufreq_remove, ++ .driver = { ++ .name = "airoha-cpufreq", ++ }, ++}; ++ ++static const struct of_device_id airoha_cpufreq_match_list[] __initconst = { ++ { .compatible = "airoha,en7581" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, airoha_cpufreq_match_list); ++ ++static int __init airoha_cpufreq_init(void) ++{ ++ struct device_node *np = of_find_node_by_path("/"); ++ const struct of_device_id *match; ++ int ret; ++ ++ if (!np) ++ return -ENODEV; ++ ++ match = of_match_node(airoha_cpufreq_match_list, np); ++ of_node_put(np); ++ if (!match) ++ return -ENODEV; ++ ++ ret = platform_driver_register(&airoha_cpufreq_driver); ++ if (unlikely(ret < 0)) ++ return ret; ++ ++ cpufreq_pdev = platform_device_register_data(NULL, "airoha-cpufreq", ++ -1, match, sizeof(*match)); ++ ret = PTR_ERR_OR_ZERO(cpufreq_pdev); ++ if (ret) ++ platform_driver_unregister(&airoha_cpufreq_driver); ++ ++ return ret; ++} ++module_init(airoha_cpufreq_init); ++ ++static void __exit airoha_cpufreq_exit(void) ++{ ++ platform_device_unregister(cpufreq_pdev); ++ platform_driver_unregister(&airoha_cpufreq_driver); ++} ++module_exit(airoha_cpufreq_exit); ++ ++MODULE_AUTHOR("Christian Marangi "); ++MODULE_DESCRIPTION("CPUfreq driver for Airoha SoCs"); ++MODULE_LICENSE("GPL"); +--- a/drivers/cpufreq/cpufreq-dt-platdev.c ++++ b/drivers/cpufreq/cpufreq-dt-platdev.c +@@ -103,6 +103,8 @@ static const struct of_device_id allowli + * platforms using "operating-points-v2" property. + */ + static const struct of_device_id blocklist[] __initconst = { ++ { .compatible = "airoha,en7581", }, ++ + { .compatible = "allwinner,sun50i-h6", }, + + { .compatible = "apple,arm-platform", }, diff --git a/target/linux/airoha/patches-6.6/100-cpufreq-airoha-Add-EN7581-Cpufreq-SMC-driver.patch b/target/linux/airoha/patches-6.6/100-cpufreq-airoha-Add-EN7581-Cpufreq-SMC-driver.patch deleted file mode 100644 index 0276a4ee811..00000000000 --- a/target/linux/airoha/patches-6.6/100-cpufreq-airoha-Add-EN7581-Cpufreq-SMC-driver.patch +++ /dev/null @@ -1,247 +0,0 @@ -From 5296da64f77ef6c809b715cdecf308977a08acb9 Mon Sep 17 00:00:00 2001 -From: Christian Marangi -Date: Wed, 16 Oct 2024 18:00:57 +0200 -Subject: [PATCH] cpufreq: airoha: Add EN7581 Cpufreq SMC driver - -Add simple Cpufreq driver for Airoha EN7581 SoC that control CPU -frequency scaling with SMC APIs. - -All CPU share the same frequency and can't be controlled independently. -Current shared CPU frequency is returned by the related SMC command. - -Add SoC compatible to cpufreq-dt-plat block list as a dedicated cpufreq -driver is needed with OPP v2 nodes declared in DTS. - -Signed-off-by: Christian Marangi ---- - drivers/cpufreq/Kconfig.arm | 8 ++ - drivers/cpufreq/Makefile | 1 + - drivers/cpufreq/airoha-cpufreq.c | 183 +++++++++++++++++++++++++++ - drivers/cpufreq/cpufreq-dt-platdev.c | 2 + - 4 files changed, 194 insertions(+) - create mode 100644 drivers/cpufreq/airoha-cpufreq.c - ---- a/drivers/cpufreq/Kconfig.arm -+++ b/drivers/cpufreq/Kconfig.arm -@@ -41,6 +41,14 @@ config ARM_ALLWINNER_SUN50I_CPUFREQ_NVME - To compile this driver as a module, choose M here: the - module will be called sun50i-cpufreq-nvmem. - -+config ARM_AIROHA_SOC_CPUFREQ -+ tristate "Airoha EN7581 SoC CPUFreq support" -+ depends on ARCH_AIROHA || COMPILE_TEST -+ select PM_OPP -+ default ARCH_AIROHA -+ help -+ This adds the CPUFreq driver for Airoha EN7581 SoCs. -+ - config ARM_APPLE_SOC_CPUFREQ - tristate "Apple Silicon SoC CPUFreq support" - depends on ARCH_APPLE || (COMPILE_TEST && 64BIT) ---- a/drivers/cpufreq/Makefile -+++ b/drivers/cpufreq/Makefile -@@ -52,6 +52,7 @@ obj-$(CONFIG_X86_AMD_FREQ_SENSITIVITY) + - - ################################################################################## - # ARM SoC drivers -+obj-$(CONFIG_ARM_AIROHA_SOC_CPUFREQ) += airoha-cpufreq.o - obj-$(CONFIG_ARM_APPLE_SOC_CPUFREQ) += apple-soc-cpufreq.o - obj-$(CONFIG_ARM_ARMADA_37XX_CPUFREQ) += armada-37xx-cpufreq.o - obj-$(CONFIG_ARM_ARMADA_8K_CPUFREQ) += armada-8k-cpufreq.o ---- /dev/null -+++ b/drivers/cpufreq/airoha-cpufreq.c -@@ -0,0 +1,183 @@ -+// SPDX-License-Identifier: GPL-2.0 -+ -+#include -+#include -+#include -+ -+#define AIROHA_SIP_AVS_HANDLE 0x82000301 -+#define AIROHA_AVS_OP_BASE 0xddddddd0 -+#define AIROHA_AVS_OP_MASK GENMASK(1, 0) -+#define AIROHA_AVS_OP_FREQ_DYN_ADJ (AIROHA_AVS_OP_BASE | \ -+ FIELD_PREP(AIROHA_AVS_OP_MASK, 0x1)) -+#define AIROHA_AVS_OP_GET_FREQ (AIROHA_AVS_OP_BASE | \ -+ FIELD_PREP(AIROHA_AVS_OP_MASK, 0x2)) -+ -+struct airoha_cpufreq_priv { -+ struct list_head list; -+ -+ cpumask_var_t cpus; -+ struct device *cpu_dev; -+ struct cpufreq_frequency_table *freq_table; -+}; -+ -+static LIST_HEAD(priv_list); -+ -+static unsigned int airoha_cpufreq_get(unsigned int cpu) -+{ -+ const struct arm_smccc_1_2_regs args = { -+ .a0 = AIROHA_SIP_AVS_HANDLE, -+ .a1 = AIROHA_AVS_OP_GET_FREQ, -+ }; -+ struct arm_smccc_1_2_regs res; -+ -+ arm_smccc_1_2_smc(&args, &res); -+ -+ return (int)(res.a0 * 1000); -+} -+ -+static int airoha_cpufreq_set_target(struct cpufreq_policy *policy, unsigned int index) -+{ -+ const struct arm_smccc_1_2_regs args = { -+ .a0 = AIROHA_SIP_AVS_HANDLE, -+ .a1 = AIROHA_AVS_OP_FREQ_DYN_ADJ, -+ .a3 = index, -+ }; -+ struct arm_smccc_1_2_regs res; -+ -+ arm_smccc_1_2_smc(&args, &res); -+ -+ /* SMC signal correct apply by unsetting BIT 0 */ -+ return res.a0 & BIT(0) ? -EINVAL : 0; -+} -+ -+static struct airoha_cpufreq_priv *airoha_cpufreq_find_data(int cpu) -+{ -+ struct airoha_cpufreq_priv *priv; -+ -+ list_for_each_entry(priv, &priv_list, list) { -+ if (cpumask_test_cpu(cpu, priv->cpus)) -+ return priv; -+ } -+ -+ return NULL; -+} -+ -+static int airoha_cpufreq_init(struct cpufreq_policy *policy) -+{ -+ struct airoha_cpufreq_priv *priv; -+ struct device *cpu_dev; -+ -+ priv = airoha_cpufreq_find_data(policy->cpu); -+ if (!priv) -+ return -ENODEV; -+ -+ cpu_dev = priv->cpu_dev; -+ cpumask_copy(policy->cpus, priv->cpus); -+ policy->driver_data = priv; -+ policy->freq_table = priv->freq_table; -+ -+ return 0; -+} -+ -+static struct cpufreq_driver airoha_cpufreq_driver = { -+ .flags = CPUFREQ_NEED_INITIAL_FREQ_CHECK | -+ CPUFREQ_IS_COOLING_DEV, -+ .verify = cpufreq_generic_frequency_table_verify, -+ .target_index = airoha_cpufreq_set_target, -+ .get = airoha_cpufreq_get, -+ .init = airoha_cpufreq_init, -+ .attr = cpufreq_generic_attr, -+ .name = "airoha-cpufreq", -+}; -+ -+static int airoha_cpufreq_driver_init_cpu(int cpu) -+{ -+ struct airoha_cpufreq_priv *priv; -+ struct device *cpu_dev; -+ int ret; -+ -+ cpu_dev = get_cpu_device(cpu); -+ if (!cpu_dev) -+ return -EPROBE_DEFER; -+ -+ priv = kzalloc(sizeof(*priv), GFP_KERNEL); -+ if (!priv) -+ return -ENOMEM; -+ -+ if (!zalloc_cpumask_var(&priv->cpus, GFP_KERNEL)) -+ return -ENOMEM; -+ -+ cpumask_set_cpu(cpu, priv->cpus); -+ priv->cpu_dev = cpu_dev; -+ -+ ret = dev_pm_opp_of_get_sharing_cpus(cpu_dev, priv->cpus); -+ if (ret) -+ goto err; -+ -+ ret = dev_pm_opp_of_cpumask_add_table(priv->cpus); -+ if (ret) -+ goto err; -+ -+ ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &priv->freq_table); -+ if (ret) -+ goto err; -+ -+ list_add(&priv->list, &priv_list); -+ -+ return 0; -+ -+err: -+ dev_pm_opp_of_cpumask_remove_table(priv->cpus); -+ free_cpumask_var(priv->cpus); -+ -+ return ret; -+} -+ -+static void airoha_cpufreq_release(void) -+{ -+ struct airoha_cpufreq_priv *priv, *tmp; -+ -+ list_for_each_entry_safe(priv, tmp, &priv_list, list) { -+ dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &priv->freq_table); -+ dev_pm_opp_of_cpumask_remove_table(priv->cpus); -+ free_cpumask_var(priv->cpus); -+ list_del(&priv->list); -+ kfree(priv); -+ } -+} -+ -+static int __init airoha_cpufreq_driver_probe(void) -+{ -+ int cpu, ret; -+ -+ if (!of_machine_is_compatible("airoha,en7581")) -+ return -ENODEV; -+ -+ for_each_possible_cpu(cpu) { -+ ret = airoha_cpufreq_driver_init_cpu(cpu); -+ if (ret) -+ goto err; -+ } -+ -+ ret = cpufreq_register_driver(&airoha_cpufreq_driver); -+ if (ret) -+ goto err; -+ -+ return 0; -+ -+err: -+ airoha_cpufreq_release(); -+ return ret; -+} -+module_init(airoha_cpufreq_driver_probe); -+ -+static void __exit airoha_cpufreq_driver_remove(void) -+{ -+ cpufreq_unregister_driver(&airoha_cpufreq_driver); -+ airoha_cpufreq_release(); -+} -+module_exit(airoha_cpufreq_driver_remove); -+ -+MODULE_AUTHOR("Christian Marangi "); -+MODULE_DESCRIPTION("CPUfreq driver for Airoha SoCs"); -+MODULE_LICENSE("GPL"); ---- a/drivers/cpufreq/cpufreq-dt-platdev.c -+++ b/drivers/cpufreq/cpufreq-dt-platdev.c -@@ -103,6 +103,8 @@ static const struct of_device_id allowli - * platforms using "operating-points-v2" property. - */ - static const struct of_device_id blocklist[] __initconst = { -+ { .compatible = "airoha,en7581", }, -+ - { .compatible = "allwinner,sun50i-h6", }, - - { .compatible = "apple,arm-platform", }, From 17b0d1379a3cd4a2e2dbefa7d0f9bc281269f97e Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 10 Jan 2025 14:53:49 +0100 Subject: [PATCH 113/173] airoha: an7581: refresh DTS with changes for cpufreq, MTD and MMC Refresh DTS with required changes for cpufreq, MTD and MMC. While at it also fix wrong speed for MAC. Signed-off-by: Christian Marangi --- target/linux/airoha/dts/an7581-evb.dts | 31 ++++--- target/linux/airoha/dts/an7581.dtsi | 118 +++++++++++++++++++++++-- 2 files changed, 127 insertions(+), 22 deletions(-) diff --git a/target/linux/airoha/dts/an7581-evb.dts b/target/linux/airoha/dts/an7581-evb.dts index 3cf531a29c4..9e88bc8a77b 100644 --- a/target/linux/airoha/dts/an7581-evb.dts +++ b/target/linux/airoha/dts/an7581-evb.dts @@ -150,35 +150,40 @@ &spi_nand { partitions { - compatible = "airoha,fixed-partitions"; + compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; bootloader@0 { label = "bootloader"; reg = <0x00000000 0x00080000>; + read-only; }; - tclinux@80000 { + art@200000 { + label = "art"; + reg = <0x00200000 0x00400000>; + }; + + tclinux@600000 { label = "tclinux"; - compatible = "denx,fit"; - reg = <0x00080000 0x02800000>; + reg = <0x00600000 0x03200000>; }; - tclinux_slave@2880000 { - label = "tclinux_slave"; - reg = <0x02880000 0x02800000>; + tclinux_slave@3800000 { + label = "tclinux_alt"; + reg = <0x03800000 0x03200000>; }; - rootfs_data@5080000 { + rootfs_data@6a00000 { label = "rootfs_data"; - reg = <0x5080000 0x00800000>; + reg = <0x06a00000 0x01400000>; }; - art@ffffffff { - compatible = "airoha,dynamic-art"; - label = "art"; - reg = <0xffffffff 0x00300000>; + reserved_bmt@7e00000 { + label = "reserved_bmt"; + reg = <0x07e00000 0x00200000>; + read-only; }; }; }; diff --git a/target/linux/airoha/dts/an7581.dtsi b/target/linux/airoha/dts/an7581.dtsi index 8abd736875c..820ab0bfa8f 100644 --- a/target/linux/airoha/dts/an7581.dtsi +++ b/target/linux/airoha/dts/an7581.dtsi @@ -78,7 +78,10 @@ reg = <0x0>; operating-points-v2 = <&cpu_opp_table>; enable-method = "psci"; - clock-frequency = <80000000>; + clocks = <&cpufreq>; + clock-names = "cpu"; + power-domains = <&cpufreq>; + power-domain-names = "cpu_pd"; next-level-cache = <&l2>; #cooling-cells = <2>; }; @@ -89,7 +92,10 @@ reg = <0x1>; operating-points-v2 = <&cpu_opp_table>; enable-method = "psci"; - clock-frequency = <80000000>; + clocks = <&cpufreq>; + clock-names = "cpu"; + power-domains = <&cpufreq>; + power-domain-names = "cpu_pd"; next-level-cache = <&l2>; #cooling-cells = <2>; }; @@ -100,7 +106,10 @@ reg = <0x2>; operating-points-v2 = <&cpu_opp_table>; enable-method = "psci"; - clock-frequency = <80000000>; + clocks = <&cpufreq>; + clock-names = "cpu"; + power-domains = <&cpufreq>; + power-domain-names = "cpu_pd"; next-level-cache = <&l2>; #cooling-cells = <2>; }; @@ -111,7 +120,10 @@ reg = <0x3>; operating-points-v2 = <&cpu_opp_table>; enable-method = "psci"; - clock-frequency = <80000000>; + clocks = <&cpufreq>; + clock-names = "cpu"; + power-domains = <&cpufreq>; + power-domain-names = "cpu_pd"; next-level-cache = <&l2>; #cooling-cells = <2>; }; @@ -125,68 +137,156 @@ }; }; + cpufreq: cpufreq { + compatible = "airoha,en7581-cpufreq"; + + operating-points-v2 = <&cpu_smcc_opp_table>; + + #power-domain-cells = <0>; + #clock-cells = <0>; + }; + cpu_opp_table: opp-table { compatible = "operating-points-v2"; opp-shared; opp-500000000 { opp-hz = /bits/ 64 <500000000>; + required-opps = <&smcc_opp0>; }; opp-550000000 { opp-hz = /bits/ 64 <550000000>; + required-opps = <&smcc_opp1>; }; opp-600000000 { opp-hz = /bits/ 64 <600000000>; + required-opps = <&smcc_opp2>; }; opp-650000000 { opp-hz = /bits/ 64 <650000000>; + required-opps = <&smcc_opp3>; }; opp-7000000000 { opp-hz = /bits/ 64 <700000000>; + required-opps = <&smcc_opp4>; }; opp-7500000000 { opp-hz = /bits/ 64 <750000000>; + required-opps = <&smcc_opp5>; }; opp-8000000000 { opp-hz = /bits/ 64 <800000000>; + required-opps = <&smcc_opp6>; }; opp-8500000000 { opp-hz = /bits/ 64 <850000000>; + required-opps = <&smcc_opp7>; }; opp-9000000000 { opp-hz = /bits/ 64 <900000000>; + required-opps = <&smcc_opp8>; }; opp-9500000000 { opp-hz = /bits/ 64 <950000000>; + required-opps = <&smcc_opp9>; }; opp-10000000000 { opp-hz = /bits/ 64 <1000000000>; + required-opps = <&smcc_opp10>; }; opp-10500000000 { opp-hz = /bits/ 64 <1050000000>; + required-opps = <&smcc_opp11>; }; opp-11000000000 { opp-hz = /bits/ 64 <1100000000>; + required-opps = <&smcc_opp12>; }; opp-11500000000 { opp-hz = /bits/ 64 <1150000000>; + required-opps = <&smcc_opp13>; }; opp-12000000000 { opp-hz = /bits/ 64 <1200000000>; + required-opps = <&smcc_opp14>; + }; + }; + + cpu_smcc_opp_table: opp-table-cpu-smcc { + compatible = "operating-points-v2"; + + smcc_opp0: opp0 { + opp-level = <0>; + }; + + smcc_opp1: opp1 { + opp-level = <1>; + }; + + smcc_opp2: opp2 { + opp-level = <2>; + }; + + smcc_opp3: opp3 { + opp-level = <3>; + }; + + smcc_opp4: opp4 { + opp-level = <4>; + }; + + smcc_opp5: opp5 { + opp-level = <5>; + }; + + smcc_opp6: opp6 { + opp-level = <6>; + }; + + smcc_opp7: opp7 { + opp-level = <7>; + }; + + smcc_opp8: opp8 { + opp-level = <8>; + }; + + smcc_opp9: opp9 { + opp-level = <9>; + }; + + smcc_opp10: opp10 { + opp-level = <10>; + }; + + smcc_opp11: opp11 { + opp-level = <11>; + }; + + smcc_opp12: opp12 { + opp-level = <12>; + }; + + smcc_opp13: opp13 { + opp-level = <13>; + }; + + smcc_opp14: opp14 { + opp-level = <14>; }; }; @@ -431,16 +531,16 @@ spi-max-frequency = <50000000>; spi-tx-bus-width = <1>; spi-rx-bus-width = <2>; - airoha,bmt; }; }; mmc0: mmc@1fa0e000 { - compatible = "mediatek,mt7622-mmc"; + compatible = "airoha,an7581-mmc"; reg = <0x0 0x1fa0e000 0x0 0x1000>, <0x0 0x1fa0c000 0x0 0x60>; interrupts = ; - bus-width = <4>; + clocks = <&scuclk EN7581_CLK_EMMC>; + clock-names = "source"; bus-width = <4>; max-frequency = <52000000>; disable-wp; cap-mmc-highspeed; @@ -587,7 +687,7 @@ status = "disabled"; fixed-link { - speed = <1000>; + speed = <10000>; full-duplex; pause; }; @@ -648,7 +748,7 @@ phy-mode = "internal"; fixed-link { - speed = <1000>; + speed = <10000>; full-duplex; pause; }; From 9c8ac97e70fdad528387d203571176b9328f94ef Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Sun, 26 May 2024 16:40:51 +1000 Subject: [PATCH 114/173] ramips: Add support for TP-Link Archer MR200 v6 This adds a new port for the above device. Currently, there is no easy installation method except opening the device up and soldering a UART header on and getting u-boot shell access. You boot the initramfs version first using tftpboot, then once booted, you sysupgrade. Shell access to root on vendor firmware: admin:1234 To get U-Boot console, spam '4' into the serial console at boot. with LEDs on the left, serial pinout is: o - tx o - rx o - gnd x - 3v3 server ip for tftpboot 192.168.0.225 The initramfs-kernel version boots without touching onboard flash with: MT7628# tftpboot 0x80000000 openwrt-ramips-mt76x8-tplink_archer-mr200-v6-initramfs-kernel.bin MT7628# bootm 0x80000000 Then when it boots off RAM, you copy openwrt-ramips-mt76x8-tplink_archer-mr200-v6-squashfs-sysupgrade.bin to /tmp/sysupgrade.bin of the device and run: root@OpenWrt:/tmp# sysupgrade -n sysupgrade.bin - [x] LEDs working - [x] Buttons working - [x] wlan detected - [x] wwan detected - [x] initramfs image working - [x] sysupgrade working Signed-off-by: Damien Zammit Link: https://github.com/openwrt/openwrt/pull/15610 Signed-off-by: Hauke Mehrtens --- .../dts/mt7628an_tplink_archer-mr200-v6.dts | 192 ++++++++++++++++++ target/linux/ramips/image/mt76x8.mk | 16 ++ .../mt76x8/base-files/etc/board.d/01_leds | 3 +- .../mt76x8/base-files/etc/board.d/02_network | 3 +- 4 files changed, 212 insertions(+), 2 deletions(-) create mode 100644 target/linux/ramips/dts/mt7628an_tplink_archer-mr200-v6.dts diff --git a/target/linux/ramips/dts/mt7628an_tplink_archer-mr200-v6.dts b/target/linux/ramips/dts/mt7628an_tplink_archer-mr200-v6.dts new file mode 100644 index 00000000000..c33b885c7e3 --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_tplink_archer-mr200-v6.dts @@ -0,0 +1,192 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7628an.dtsi" + +#include +#include +#include + +/ { + compatible = "tplink,archer-mr200-v6", "mediatek,mt7628an-soc"; + model = "TP-Link Archer MR200 v6"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + label-mac-device = ðernet; + }; + + chosen { + bootargs = "console=ttyS0,115200n8"; + }; + + leds { + compatible = "gpio-leds"; + + lan { + function = LED_FUNCTION_LAN; + color = ; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + + wan { + function = LED_FUNCTION_WAN; + color = ; + gpios = <&gpio 40 GPIO_ACTIVE_LOW>; + }; + + led_power: power { + function = LED_FUNCTION_POWER; + color = ; + gpios = <&gpio 39 GPIO_ACTIVE_LOW>; + }; + + signal1 { + label = "white:signal1"; + gpios = <&gpio 41 GPIO_ACTIVE_LOW>; + }; + + signal2 { + label = "white:signal2"; + gpios = <&gpio 42 GPIO_ACTIVE_LOW>; + }; + + signal3 { + label = "white:signal3"; + gpios = <&gpio 43 GPIO_ACTIVE_LOW>; + }; + + wlan { + function = LED_FUNCTION_WLAN; + color = ; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 38 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + rfkill { + label = "rfkill"; + gpios = <&gpio 46 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + m25p,fast-read; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x20000>; + read-only; + }; + + firmware@20000 { + compatible = "tplink,firmware"; + label = "firmware"; + reg = <0x20000 0xfa0000>; + }; + + partition@fc0000 { + label = "config"; + reg = <0xfc0000 0x10000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_config_f100: macaddr@f100 { + compatible = "mac-base"; + reg = <0xf100 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + partition@fd0000 { + label = "romfile"; + reg = <0xfd0000 0x10000>; + read-only; + }; + + partition@fe0000 { + label = "radio"; + reg = <0xfe0000 0x10000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_radio_0: eeprom@0 { + reg = <0x0 0x400>; + }; + + eeprom_radio_8000: eeprom@8000 { + reg = <0x8000 0x4da8>; + }; + }; + }; + }; + }; +}; + +&state_default { + gpio { + groups = "i2c", "p0led_an", "p1led_an", "p2led_an", "p3led_an", "p4led_an", "uart1", "wdt"; + function = "gpio"; + }; +}; + +&wmac { + nvmem-cells = <&eeprom_radio_0>, <&macaddr_config_f100 0>; + nvmem-cell-names = "eeprom", "mac-address"; + status = "okay"; +}; + +&esw { + mediatek,portdisable = <0x30>; +}; + +ðernet { + nvmem-cells = <&macaddr_config_f100 0>; + nvmem-cell-names = "mac-address"; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + reg = <0x0000 0 0 0 0>; + ieee80211-freq-limit = <5000000 6000000>; + nvmem-cells = <&eeprom_radio_8000>, <&macaddr_config_f100 (-1)>; + nvmem-cell-names = "eeprom", "mac-address"; + }; +}; diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index dbad26a140c..76b19515884 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -675,6 +675,22 @@ define Device/tplink_archer-mr200-v5 endef TARGET_DEVICES += tplink_archer-mr200-v5 +define Device/tplink_archer-mr200-v6 + $(Device/tplink-v2) + IMAGE_SIZE := 15936k + DEVICE_MODEL := Archer MR200 + DEVICE_VARIANT := v6 + TPLINK_FLASHLAYOUT := 16Mmtk + TPLINK_HWID := 0x20000006 + TPLINK_HWREV := 0x6 + TPLINK_HWREVADD := 0x6 + DEVICE_PACKAGES := kmod-mt76x0e uqmi kmod-usb2 kmod-usb-serial-option + KERNEL := kernel-bin | append-dtb | lzma -d22 + KERNEL_INITRAMFS := kernel-bin | append-dtb + IMAGES := sysupgrade.bin +endef +TARGET_DEVICES += tplink_archer-mr200-v6 + define Device/tplink_re200-v2 $(Device/tplink-safeloader) IMAGE_SIZE := 7808k diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds index fda4fa3bdf3..e13c5db50e6 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds @@ -89,7 +89,8 @@ tplink,archer-c50-v6) ucidef_set_led_wlan "wlan2g" "wlan2g" "green:wlan2g" "phy0tpt" ucidef_set_led_wlan "wlan5g" "wlan5g" "green:wlan5g" "phy1tpt" ;; -tplink,archer-mr200-v5) +tplink,archer-mr200-v5|\ +tplink,archer-mr200-v6) ucidef_set_led_netdev "lan" "lan" "white:lan" "eth0" ucidef_set_led_netdev "wan" "wan" "white:wan" "wwan0" ;; diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network index 10e0e84dde3..994ed0009b5 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network @@ -166,7 +166,8 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" \ "0:wan" "1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0" ;; - tplink,archer-mr200-v5) + tplink,archer-mr200-v5|\ + tplink,archer-mr200-v6) ucidef_add_switch "switch0" \ "0:lan" "1:lan" "2:lan" "3:lan" "6t@eth0" ucidef_set_interface "wan" device "/dev/cdc-wdm0" protocol "qmi" From 7a888afa40714fba18329c3c679cda111bd993ae Mon Sep 17 00:00:00 2001 From: John Audia Date: Mon, 6 Jan 2025 05:40:38 -0500 Subject: [PATCH 115/173] e2fsprogs: update to 1.47.2 Release information (not yet published): https://e2fsprogs.sourceforge.net/e2fsprogs-release.html#1.47.2 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17499 Signed-off-by: Hauke Mehrtens --- package/utils/e2fsprogs/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/utils/e2fsprogs/Makefile b/package/utils/e2fsprogs/Makefile index 16b47748e35..bebfc8dab22 100644 --- a/package/utils/e2fsprogs/Makefile +++ b/package/utils/e2fsprogs/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=e2fsprogs -PKG_VERSION:=1.47.0 -PKG_RELEASE:=2 +PKG_VERSION:=1.47.2 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/kernel/people/tytso/e2fsprogs/v$(PKG_VERSION)/ -PKG_HASH:=144af53f2bbd921cef6f8bea88bb9faddca865da3fbc657cc9b4d2001097d5db +PKG_HASH:=08242e64ca0e8194d9c1caad49762b19209a06318199b63ce74ae4ef2d74e63c PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=NOTICE From 40e2710dfad800e3dd81882bf1ddd429b2ce7180 Mon Sep 17 00:00:00 2001 From: John Audia Date: Fri, 10 Jan 2025 15:26:29 -0500 Subject: [PATCH 116/173] tools/e2fsprogs: update to 1.47.2 Release information (not yet published): https://e2fsprogs.sourceforge.net/e2fsprogs-release.html#1.47.2 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17499 Signed-off-by: Hauke Mehrtens --- tools/e2fsprogs/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/e2fsprogs/Makefile b/tools/e2fsprogs/Makefile index 50c3888b642..5deee081609 100644 --- a/tools/e2fsprogs/Makefile +++ b/tools/e2fsprogs/Makefile @@ -9,10 +9,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:=e2fsprogs PKG_CPE_ID:=cpe:/a:e2fsprogs_project:e2fsprogs -PKG_VERSION:=1.47.0 -PKG_HASH:=0b4fe723d779b0927fb83c9ae709bc7b40f66d7df36433bef143e41c54257084 +PKG_VERSION:=1.47.2 +PKG_HASH:=08242e64ca0e8194d9c1caad49762b19209a06318199b63ce74ae4ef2d74e63c -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/kernel/people/tytso/e2fsprogs/v$(PKG_VERSION)/ HOST_BUILD_PARALLEL:=1 From 277642c035f5a403433f6d24addf021c6485cb79 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Fri, 10 Jan 2025 09:29:31 +0100 Subject: [PATCH 117/173] kernel: netdevices: fold mv88e6xxx into one package This was the first DSA packaged, and the tagger was made into a separate package. This is too complicated: the mv88e6xxx is the only module using this tagger after all, fold the module for the DSA hardware and the driver for the tagger into a single package and let modprobe do its job of probing the tagger for the driver. Tested on the BMIPS Inteno XG6846. Link: https://patchwork.ozlabs.org/project/openwrt/patch/20250110-mv88e6xxx-single-package-v1-1-223ad7fb312e@linaro.org/ Signed-off-by: Linus Walleij --- package/kernel/linux/modules/netdevices.mk | 29 +++++++--------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index dc256237e97..2a6ecb7a2bd 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -593,31 +593,20 @@ endef $(eval $(call KernelPackage,dsa-mv88e6060)) -define KernelPackage/dsa-tag-dsa - SUBMENU:=$(NETWORK_DEVICES_MENU) - TITLE:=Marvell DSA type DSA and EDSA taggers - DEPENDS:=+kmod-dsa - KCONFIG:= CONFIG_NET_DSA_TAG_DSA_COMMON \ - CONFIG_NET_DSA_TAG_DSA \ - CONFIG_NET_DSA_TAG_EDSA - FILES:=$(LINUX_DIR)/net/dsa/tag_dsa.ko - AUTOLOAD:=$(call AutoLoad,40,tag_dsa,1) -endef - -define KernelPackage/dsa-tag-dsa/description - Kernel modules for Marvell DSA and EDSA tagging -endef - -$(eval $(call KernelPackage,dsa-tag-dsa)) - define KernelPackage/dsa-mv88e6xxx SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Marvell MV88E6XXX DSA Switch - DEPENDS:=+kmod-dsa +kmod-ptp +kmod-phy-marvell +kmod-dsa-tag-dsa - KCONFIG:=CONFIG_NET_DSA_MV88E6XXX \ + DEPENDS:=+kmod-dsa +kmod-ptp +kmod-phy-marvell + KCONFIG:= \ + CONFIG_NET_DSA_TAG_DSA_COMMON \ + CONFIG_NET_DSA_TAG_DSA \ + CONFIG_NET_DSA_TAG_EDSA \ + CONFIG_NET_DSA_MV88E6XXX \ CONFIG_NET_DSA_MV88E6XXX_LEDS=y \ CONFIG_NET_DSA_MV88E6XXX_PTP=y - FILES:=$(LINUX_DIR)/drivers/net/dsa/mv88e6xxx/mv88e6xxx.ko + FILES:= \ + $(LINUX_DIR)/net/dsa/tag_dsa.ko \ + $(LINUX_DIR)/drivers/net/dsa/mv88e6xxx/mv88e6xxx.ko AUTOLOAD:=$(call AutoLoad,41,mv88e6xxx,1) endef From e9415be4ad3cacbbd6e65fee5213baf3eaf9e07a Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sat, 4 Jan 2025 19:51:48 +0100 Subject: [PATCH 118/173] apm821xx: fixes WNDAP620 + WNDAP660 sysupgrade failures OpenWRT on the WNDAP6x0 refuses to sysupgrade to itself due to a compat_version imbalance. The Image is generated with version 2.0, but the uci-defaults says that it needs to be at 3.0 for the device. Fix this by downgrading WNDAP6x0 05_fix-compat-version's values back to 2.0 so it matches what we use. Fixes: 5815884c3a2a ("apm821xx: migrate to DSA") Signed-off-by: Christian Lamparter --- .../base-files/etc/uci-defaults/05_fix-compat-version | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/target/linux/apm821xx/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/apm821xx/base-files/etc/uci-defaults/05_fix-compat-version index 00d3954e5f4..11af63c9e7c 100644 --- a/target/linux/apm821xx/base-files/etc/uci-defaults/05_fix-compat-version +++ b/target/linux/apm821xx/base-files/etc/uci-defaults/05_fix-compat-version @@ -2,12 +2,15 @@ case "$(board_name)" in meraki,mx60|\ -netgear,wndap620|\ -netgear,wndap660|\ netgear,wndr4700) uci set system.@system[0].compat_version="3.0" uci commit system ;; +netgear,wndap620|\ +netgear,wndap660) + uci set system.@system[0].compat_version="2.0" + uci commit system + ;; esac exit 0 From 1c178f364454c5b73eb453fa0b101ae2f6454d4c Mon Sep 17 00:00:00 2001 From: Kien Truong Date: Sat, 11 Jan 2025 12:20:12 +0700 Subject: [PATCH 119/173] rockchip: disable kernel preemption This setting is more suitable for device running OpenWRT. Most OpenWRT targets are already default to this configuration, and it has shown better performance in VPN (wireguard). Fix: #17454 Signed-off-by: Kien Truong Link: https://github.com/openwrt/openwrt/pull/17575 Signed-off-by: Robert Marko --- target/linux/rockchip/armv8/config-6.6 | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/target/linux/rockchip/armv8/config-6.6 b/target/linux/rockchip/armv8/config-6.6 index 56fb2f96a14..68eed3e5f9b 100644 --- a/target/linux/rockchip/armv8/config-6.6 +++ b/target/linux/rockchip/armv8/config-6.6 @@ -530,12 +530,7 @@ CONFIG_POWER_RESET=y CONFIG_POWER_SUPPLY=y CONFIG_POWER_SUPPLY_HWMON=y CONFIG_PPS=y -CONFIG_PREEMPT=y -CONFIG_PREEMPTION=y -CONFIG_PREEMPT_BUILD=y -CONFIG_PREEMPT_COUNT=y -# CONFIG_PREEMPT_NONE is not set -CONFIG_PREEMPT_RCU=y +CONFIG_PREEMPT_NONE_BUILD=y CONFIG_PRINTK_TIME=y CONFIG_PROC_PAGE_MONITOR=y CONFIG_PROC_VMCORE=y From 5f54e17bae54f79541524b83fd72da102196fab8 Mon Sep 17 00:00:00 2001 From: Jack Sun Date: Sun, 12 Jan 2025 14:14:16 +0800 Subject: [PATCH 120/173] tools/cmake: update to 3.31.4 Release notes: https://cmake.org/cmake/help/latest/release/3.31.html No need refresh patch Signed-off-by: Jack Sun Link: https://github.com/openwrt/openwrt/pull/17587 Signed-off-by: Robert Marko --- tools/cmake/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/cmake/Makefile b/tools/cmake/Makefile index c204c7522e7..da6eb516b75 100644 --- a/tools/cmake/Makefile +++ b/tools/cmake/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=cmake -PKG_VERSION:=3.31.3 +PKG_VERSION:=3.31.4 PKG_VERSION_MAJOR:=$(word 1,$(subst ., ,$(PKG_VERSION))).$(word 2,$(subst ., ,$(PKG_VERSION))) PKG_RELEASE:=1 PKG_CPE_ID:=cpe:/a:kitware:cmake @@ -15,7 +15,7 @@ PKG_CPE_ID:=cpe:/a:kitware:cmake PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/Kitware/CMake/releases/download/v$(PKG_VERSION)/ \ https://cmake.org/files/v$(PKG_VERSION_MAJOR)/ -PKG_HASH:=fac45bc6d410b49b3113ab866074888d6c9e9dc81a141874446eb239ac38cb87 +PKG_HASH:=a6130bfe75f5ba5c73e672e34359f7c0a1931521957e8393a5c2922c8b0f7f25 HOST_BUILD_PARALLEL:=1 HOST_CONFIGURE_PARALLEL:=1 From 3f87c5ac4221deb37d4c3e730e692eef8f9c9ffe Mon Sep 17 00:00:00 2001 From: John Audia Date: Fri, 10 Jan 2025 16:01:56 -0500 Subject: [PATCH 121/173] kernel: bump 6.6 to 6.6.71 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.71 Manually rebased: airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch All other patches automatically rebased. Build system: x86/64 Build-tested: bcm27xx/bcm2712 Run-tested: bcm27xx/bcm2712 Signed-off-by: John Audia [ fix manually rebased patch ] Link: https://github.com/openwrt/openwrt/pull/17568 Signed-off-by: Christian Marangi --- include/kernel-6.6 | 4 ++-- ...Rework-clock-handling-for-different-clock.patch | 14 +++++++------- ...mc-mtk-sd-add-support-for-AN7581-MMC-Host.patch | 14 ++++++-------- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 1cda04d0c58..f034d0754cc 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .70 -LINUX_KERNEL_HASH-6.6.70 = 84d23ee07fb26febbcb6d1295ba15efdc67ac382b4137b2c8853146c10fd2f97 +LINUX_VERSION-6.6 = .71 +LINUX_KERNEL_HASH-6.6.71 = 219715ba2dcfa6539fba09ad3f9212772f3507189eb60d77f8e89b06c32e724e diff --git a/target/linux/airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch b/target/linux/airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch index 7333ebbdf26..187715a5cc3 100644 --- a/target/linux/airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch +++ b/target/linux/airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch @@ -26,15 +26,15 @@ Signed-off-by: Christian Marangi const struct clk_ops pcie_ops; int (*hw_init)(struct platform_device *pdev, struct clk_hw_onecell_data *clk_data); -@@ -525,8 +526,6 @@ static void en7523_register_clocks(struc +@@ -504,8 +505,6 @@ static void en7523_register_clocks(struc + u32 rate; + int i; - hw = en7523_register_pcie_clk(dev, np_base); - clk_data->hws[EN7523_CLK_PCIE] = hw; -- - clk_data->num = EN7523_NUM_CLOCKS; - } - - static int en7523_clk_hw_init(struct platform_device *pdev, +- + for (i = 0; i < ARRAY_SIZE(en7523_base_clks); i++) { + const struct en_clk_desc *desc = &en7523_base_clks[i]; + u32 reg = desc->div_reg ? desc->div_reg : desc->base_reg; @@ -587,8 +586,6 @@ static void en7581_register_clocks(struc hw = en7523_register_pcie_clk(dev, base); diff --git a/target/linux/airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch b/target/linux/airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch index 24c4dbde786..d116bb9ee05 100644 --- a/target/linux/airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch +++ b/target/linux/airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch @@ -103,29 +103,27 @@ Signed-off-by: Christian Marangi host->bus_clk = devm_clk_get_optional(&pdev->dev, "bus_clk"); if (IS_ERR(host->bus_clk)) -@@ -2740,11 +2767,14 @@ static int msdc_drv_probe(struct platfor - goto host_free; +@@ -2731,10 +2758,13 @@ static int msdc_drv_probe(struct platfor + return PTR_ERR(host->pins_default); } - host->pins_uhs = pinctrl_lookup_state(host->pinctrl, "state_uhs"); - if (IS_ERR(host->pins_uhs)) { -- ret = PTR_ERR(host->pins_uhs); - dev_err(&pdev->dev, "Cannot find pinctrl uhs!\n"); -- goto host_free; +- return PTR_ERR(host->pins_uhs); + /* AN7581 doesn't have state_uhs pins */ + if (!device_is_compatible(&pdev->dev, "airoha,an7581-mmc")) { + host->pins_uhs = pinctrl_lookup_state(host->pinctrl, "state_uhs"); + if (IS_ERR(host->pins_uhs)) { -+ ret = PTR_ERR(host->pins_uhs); + dev_err(&pdev->dev, "Cannot find pinctrl uhs!\n"); -+ goto host_free; ++ return PTR_ERR(host->pins_uhs); + } } /* Support for SDIO eint irq ? */ -@@ -2825,6 +2855,12 @@ static int msdc_drv_probe(struct platfor +@@ -2815,6 +2845,12 @@ static int msdc_drv_probe(struct platfor dev_err(&pdev->dev, "Cannot ungate clocks!\n"); - goto release_mem; + goto release_clk; } + + /* AN7581 without regulator require tune to OCR values */ From a00ff9f6d13f6ff5eae57be70a270ccd668d5240 Mon Sep 17 00:00:00 2001 From: Alexandru Gagniuc Date: Sun, 7 Aug 2022 10:15:35 -0500 Subject: [PATCH 122/173] qualcommax: ipq60xx: add TP-Link EAP610-Outdoor support TP-Link EAP610-Outdoor is a 802.11ax AP claiming AX1800 support. It is wall or pole mountable, and rated for outdoor use. It can only be powered via PoE. Specifications: --------------- * CPU: Qualcomm IPQ6018 Quad core Cortex-A53 * RAM: 512 MB * Storage: ESMT PSR1GA30DT 128MB NAND * Ethernet: * Gigabit RJ45 port with PoE input * WLAN: * 2.4GHz/5GHz * LEDs: * Multi-color System LED (Green/Amber) * Buttons: * 1x Reset * UART: 4-pin unpopulated header * 1.8 V level, Pinout 1 - TX, 2 - RX, 3 - GND, 4 - 1.8V Installation: ============= Web UI method ------------- Set up the device using the vendor's web UI. After that go to Management->SSH and enable the "SSH Login" checkbox. Select "Save". The connect to the machine via SSH: ssh -o hostkeyalgorithms=ssh-rsa Disable signature verification: cliclientd stopcs Rename the "-web-ui-factory" image to something less than 63 characters, maintaining the ".bin" suffix. * Go to System -> Firmware Update. * Under "New Firmware File", click "Browse" and select the image * Select "Update" and confirm by clicking "OK". If the update fails, the web UI should show an error message. Otherwise, the device should reboot into OpenWRT. TFTP method ----------- To flash via tftp, first place the initramfs image on the TFTP server. setenv serverip setenv ipaddr tftpboot tplink_eap610-outdoor-initramfs-uImage.itb bootm This should boot OpenWRT. Once booted, flash the sysupgrade.bin image using either luci or the commandline. The tplink2022 image format ============================ The vendor images of this device are packaged in a format that does not match any previous tplink formats. In order for flashing to work from the vendor's web UI, firmware updates need to be packaged in this format. The `tplink-mkimage-2022.py` is provided for this purpose. This script can also analyze vendor images, and extract the required "support" string. This string is checked by the vendor firmware, and images with a missing or incorrect string are rejected. Signed-off-by: Alexandru Gagniuc Link: https://github.com/openwrt/openwrt/pull/14922 Signed-off-by: Robert Marko --- include/image-commands.mk | 8 + .../uboot-envtools/files/qualcommax_ipq60xx | 4 + package/firmware/ipq-wifi/Makefile | 2 + scripts/tplink-mkimage-2022.py | 198 ++++++++++++++++++ .../boot/dts/qcom/ipq6018-eap610-outdoor.dts | 151 +++++++++++++ target/linux/qualcommax/image/ipq60xx.mk | 18 ++ .../ipq60xx/base-files/etc/board.d/02_network | 7 + .../etc/hotplug.d/firmware/11-ath11k-caldata | 7 + .../lib/preinit/09_mount_factory_data | 19 ++ .../base-files/lib/upgrade/platform.sh | 76 +++++++ 10 files changed, 490 insertions(+) create mode 100755 scripts/tplink-mkimage-2022.py create mode 100644 target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-eap610-outdoor.dts create mode 100644 target/linux/qualcommax/ipq60xx/base-files/lib/preinit/09_mount_factory_data diff --git a/include/image-commands.mk b/include/image-commands.mk index 2e129e0347d..aa48e19399e 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -626,6 +626,14 @@ define Build/sysupgrade-tar $@ endef +define Build/tplink-image-2022 + $(TOPDIR)/scripts/tplink-mkimage-2022.py \ + --create $@.new \ + --rootfs $@ \ + --support "$(TPLINK_SUPPORT_STRING)" + @mv $@.new $@ +endef + define Build/tplink-safeloader -$(STAGING_DIR_HOST)/bin/tplink-safeloader \ -B $(TPLINK_BOARD_ID) \ diff --git a/package/boot/uboot-envtools/files/qualcommax_ipq60xx b/package/boot/uboot-envtools/files/qualcommax_ipq60xx index eec99ce8f97..77c96da24ac 100644 --- a/package/boot/uboot-envtools/files/qualcommax_ipq60xx +++ b/package/boot/uboot-envtools/files/qualcommax_ipq60xx @@ -25,6 +25,10 @@ netgear,wax214) [ -n "$idx" ] && \ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" ;; +tplink,eap610-outdoor) + idx="$(find_mtd_index 0:appsblenv)" + [ -n "$idx" ] && \ + ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" yuncore,fap650) idx="$(find_mtd_index 0:appsblenv)" [ -n "$idx" ] && \ diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 679a1442115..9821e39a85f 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -55,6 +55,7 @@ ALLWIFIBOARDS:= \ redmi_ax6 \ skspruce_wia3300-20 \ spectrum_sax1v1k \ + tplink_eap610-outdoor \ tplink_eap620hd-v1 \ tplink_eap660hd-v1 \ wallys_dr40x9 \ @@ -185,6 +186,7 @@ $(eval $(call generate-ipq-wifi-package,prpl_haze,prpl Haze)) $(eval $(call generate-ipq-wifi-package,redmi_ax6,Redmi AX6)) $(eval $(call generate-ipq-wifi-package,skspruce_wia3300-20,SKSpruce WIA3300-20)) $(eval $(call generate-ipq-wifi-package,spectrum_sax1v1k,Spectrum SAX1V1K)) +$(eval $(call generate-ipq-wifi-package,tplink_eap610-outdoor,TPLink EAP610-Outdoor)) $(eval $(call generate-ipq-wifi-package,tplink_eap620hd-v1,TP-Link EAP620 HD v1)) $(eval $(call generate-ipq-wifi-package,tplink_eap660hd-v1,TP-Link EAP660 HD v1)) $(eval $(call generate-ipq-wifi-package,wallys_dr40x9,Wallys DR40X9)) diff --git a/scripts/tplink-mkimage-2022.py b/scripts/tplink-mkimage-2022.py new file mode 100755 index 00000000000..4db69409c9e --- /dev/null +++ b/scripts/tplink-mkimage-2022.py @@ -0,0 +1,198 @@ +#!/usr/bin/env python3 + +'''A program for manipulating tplink2022 images. + +A tplink2022 is an image format encountered on TP-Link devices around the year +2022. This was seen at least on the EAP610-Outdoor. The format is a container +for a rootfs, and has optional fields for the "software" version. It also + requires a "support" string that describes the list of compatible devices. + +This module is intended for creating such images with an OpenWRT UBI image, but +also supports analysis and extraction of vendor images. Altough tplink2022 +images can be signed, this program does not support signing image. + +To get an explanation of the commandline arguments, run this program with the +"--help" argument. +''' + +import argparse +import hashlib +import os +import pprint +import struct + +def decode_header(datafile): + '''Read the tplink2022 image header anbd decode it into a dictionary''' + header = {} + fmt = '>2I' + + datafile.seek(0x1014) + raw_header = datafile.read(8) + fields = struct.unpack(fmt, raw_header) + + header['rootfs_size'] = fields[0] + header['num_items'] = fields[1] + header['items'] = [] + + rootfs = {} + rootfs['name'] = 'rootfs.ubi' + rootfs['offset'] = 0 + rootfs['size'] = header['rootfs_size'] + header['items'].append(rootfs) + + for _ in range(header['num_items']): + entry = datafile.read(0x2c) + fmt = '>I32s2I' + fields = struct.unpack(fmt, entry) + + section = {} + section['name'] = fields[1].decode("utf-8").rstrip('\0') + section['type'] = fields[0] + section['offset'] = fields[2] + section['size'] = fields[3] + header['items'].append(section) + return header + +def extract(datafile): + '''Extract the sections of the tplink2022 image to separate files''' + header = decode_header(datafile) + + pretty = pprint.PrettyPrinter(indent=4, sort_dicts=False) + pretty.pprint(header) + + for section in header['items']: + datafile.seek(0x1814 + section['offset']) + section_contents = datafile.read(section['size']) + + with open(f"{section['name']}.bin", 'wb') as section_file: + section_file.write(section_contents) + + with open('leftover.bin', 'wb') as extras_file: + extras_file.write(datafile.read()) + +def get_section_contents(section): + '''I don't remember what this does. It's been a year since I wrote this''' + if section.get('data'): + data = section['data'] + elif section.get('file'): + with open(section['file'], 'rb') as section_file: + data = section_file.read() + else: + data = bytes() + + if section['size'] != len(data): + raise ValueError("Wrong section size", len(data)) + + return data + +def write_image(output_image, header): + '''Write a tplink2022 image with the contents in the "header" dictionary''' + with open(output_image, 'w+b') as out_file: + # header MD5 + salt = [ 0x7a, 0x2b, 0x15, 0xed, + 0x9b, 0x98, 0x59, 0x6d, + 0xe5, 0x04, 0xab, 0x44, + 0xac, 0x2a, 0x9f, 0x4e + ] + + out_file.seek(4) + out_file.write(bytes(salt)) + + # unknown section + out_file.write(bytes([0xff] * 0x1000)) + + # Table of contents + raw_header = struct.pack('>2I', header['rootfs_size'], + header['num_items']) + out_file.write(raw_header) + + for section in header['items']: + if section['name'] == 'rootfs.ubi': + continue + + hdr = struct.pack('>I32s2I', + section.get('type', 0), + section['name'].encode('utf-8'), + section['offset'], + section['size'] + ) + + out_file.write(hdr) + + for section in header['items']: + out_file.seek(0x1814 + section['offset']) + out_file.write(get_section_contents(section)) + + size = out_file.tell() + + out_file.seek(4) + md5_sum = hashlib.md5(out_file.read()) + + out_file.seek(0) + out_file.write(struct.pack('>I16s', size, md5_sum.digest())) + +def encode_soft_verson(): + '''Not sure of the meaning of version. Also doesn't appear to be needed.''' + return struct.pack('>4B1I2I', 0xff, 1, 0 ,0, 0x2020202, 30000, 1) + +def create_image(output_image, root, support): + '''Create an image with a ubi "root" and a "support" string.''' + header = {} + + header['rootfs_size'] = os.path.getsize(root) + header['items'] = [] + + rootfs = {} + rootfs['name'] = 'rootfs.ubi' + rootfs['file'] = root + rootfs['offset'] = 0 + rootfs['size'] = header['rootfs_size'] + header['items'].append(rootfs) + + support_list = {} + support_list['name'] = 'support-list' + support_list['data'] = support.replace(" ", "\r\n").encode('utf-8') + support_list['offset'] = header['rootfs_size'] + support_list['size'] = len(support_list['data']) + header['items'].append(support_list) + + sw_version = {} + sw_version['name'] = 'soft-version' + sw_version['type'] = 1 + sw_version['data'] = encode_soft_verson() + sw_version['offset'] = support_list['offset'] + support_list['size'] + sw_version['size'] = len(sw_version['data']) + header['items'].append(sw_version) + + header['num_items'] = len(header['items']) - 1 + write_image(output_image, header) + +def main(args): + '''We support image analysis,extraction, and creation''' + if args.extract: + with open(args.image, 'rb') as image: + extract(image) + elif args.create: + if not args.rootfs or not args.support: + raise ValueError('To create an image, specify rootfs and support list') + create_image(args.image, args.rootfs, args.support) + else: + with open(args.image, 'rb') as image: + header = decode_header(image) + + pretty = pprint.PrettyPrinter(indent=4, sort_dicts=False) + pretty.pprint(header) + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description='EAP extractor') + parser.add_argument('--info', action='store_true') + parser.add_argument('--extract', action='store_true') + parser.add_argument('--create', action='store_true') + parser.add_argument('image', type=str, + help='Name of image to create or decode') + parser.add_argument('--rootfs', type=str, + help='When creating an EAP image, UBI image with rootfs and kernel') + parser.add_argument('--support', type=str, + help='String for the "support-list" section') + + main(parser.parse_args()) diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-eap610-outdoor.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-eap610-outdoor.dts new file mode 100644 index 00000000000..165fc3ef1b1 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-eap610-outdoor.dts @@ -0,0 +1,151 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq6018.dtsi" +#include "ipq6018-cp-cpu.dtsi" +#include "ipq6018-ess.dtsi" + +#include +#include +#include + +/ { + model = "TP-Link EAP610-Outdoor"; + compatible = "tplink,eap610-outdoor", "qcom,ipq6018"; + + aliases { + serial0 = &blsp1_uart3; + led-boot = &led_sys_green; + led-failsafe = &led_sys_amber; + led-running = &led_sys_green; + led-upgrade = &led_sys_amber; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs-append = " ubi.block=0,rootfs root=/dev/ubiblock0_1"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&tlmm 9 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_sys_amber: led-0 { + function = "system"; + color = ; + gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>; + }; + + led_sys_green: led-1 { + function = "system"; + color = ; + gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio-restart { + compatible = "gpio-restart"; + gpios = <&tlmm 61 GPIO_ACTIVE_LOW>; + open-source; + }; +}; + +&blsp1_uart3 { + pinctrl-0 = <&serial_3_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&tlmm { + mdio_pins: mdio-pins { + mdc { + pins = "gpio64"; + function = "mdc"; + drive-strength = <8>; + bias-pull-up; + }; + + mdio { + pins = "gpio65"; + function = "mdio"; + drive-strength = <8>; + bias-pull-up; + }; + }; + + led_enable { + gpio-hog; + output-high; + gpios = <36 GPIO_ACTIVE_HIGH>; + line-name = "enable-leds"; + }; +}; + +&dp5 { + phy-handle = <&rtl8211f_4>; + phy-mode = "sgmii"; + label = "lan"; + status = "okay"; +}; + +&edma { + status = "okay"; +}; + +&mdio { + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 77 GPIO_ACTIVE_LOW>; + reset-delay-us = <10000>; + reset-post-delay-us = <50000>; + status = "okay"; + + rtl8211f_4: ethernet-phy@4 { + reg = <4>; + }; +}; + +&switch { + switch_lan_bmp = ; + switch_mac_mode1 = ; + status = "okay"; + + qcom,port_phyinfo { + port@4 { + port_id = <5>; + phy_address = <4>; + }; + }; +}; + +&qpic_bam { + status = "okay"; +}; + +&qpic_nand { + status = "okay"; + + nand@0 { + reg = <0>; + + nand-ecc-strength = <4>; + nand-ecc-step-size = <512>; + nand-bus-width = <8>; + }; +}; + +&wifi { + ieee80211-freq-limit = <2402000 5835000>; + qcom,ath11k-calibration-variant = "TP-Link-EAP610-Outdoor"; + status = "okay"; +}; diff --git a/target/linux/qualcommax/image/ipq60xx.mk b/target/linux/qualcommax/image/ipq60xx.mk index 0b7cd413c36..c7e0be1181e 100644 --- a/target/linux/qualcommax/image/ipq60xx.mk +++ b/target/linux/qualcommax/image/ipq60xx.mk @@ -68,6 +68,24 @@ define Device/qihoo_360v6 endef TARGET_DEVICES += qihoo_360v6 +define Device/tplink_eap610-outdoor + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := TP-Link + DEVICE_MODEL := EAP610-Outdoor + BLOCKSIZE := 128k + PAGESIZE := 2048 + SOC := ipq6018 + DEVICE_PACKAGES := ipq-wifi-tplink_eap610-outdoor + IMAGES += web-ui-factory.bin + IMAGE/web-ui-factory.bin := append-ubi | tplink-image-2022 + TPLINK_SUPPORT_STRING := SupportList: \ + EAP610-Outdoor(TP-Link|UN|AX1800-D):1.0 \ + EAP610-Outdoor(TP-Link|JP|AX1800-D):1.0 \ + EAP610-Outdoor(TP-Link|CA|AX1800-D):1.0 +endef +TARGET_DEVICES += tplink_eap610-outdoor + define Device/yuncore_fap650 $(call Device/FitImage) $(call Device/UbiFit) diff --git a/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network b/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network index ecc9e57117b..44c0ba7049e 100644 --- a/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network +++ b/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network @@ -23,6 +23,9 @@ ipq60xx_setup_interfaces() qihoo,360v6) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" ;; + tplink,eap610-outdoor) + ucidef_set_interface_lan "lan" "dhcp" + ;; linksys,mr7350|\ yuncore,fap650) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" @@ -51,6 +54,10 @@ ipq60xx_setup_macs() wan_mac=$(macaddr_add "$lan_mac" 1) label_mac=$lan_mac ;; + tplink,eap610-outdoor) + label_mac=$(get_mac_binary /tmp/factory_data/default-mac 0) + lan_mac=$label_mac + ;; esac [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac diff --git a/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata b/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata index 3380cc8653f..cf3e400586b 100644 --- a/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata +++ b/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata @@ -32,6 +32,13 @@ case "$FIRMWARE" in ath11k_patch_mac $(macaddr_add $label_mac 2) 1 ath11k_set_macflag ;; + tplink,eap610-outdoor) + caldata_from_file "/tmp/factory_data/radio" 0 0x10000 + label_mac=$(get_mac_binary /tmp/factory_data/default-mac 0) + ath11k_patch_mac $label_mac 1 + ath11k_patch_mac $(macaddr_add $label_mac 1) 0 + ath11k_set_macflag + ;; yuncore,fap650) caldata_extract "0:art" 0x1000 0x20000 ;; diff --git a/target/linux/qualcommax/ipq60xx/base-files/lib/preinit/09_mount_factory_data b/target/linux/qualcommax/ipq60xx/base-files/lib/preinit/09_mount_factory_data new file mode 100644 index 00000000000..97608db55dd --- /dev/null +++ b/target/linux/qualcommax/ipq60xx/base-files/lib/preinit/09_mount_factory_data @@ -0,0 +1,19 @@ +#!/bin/sh + +preinit_mount_factory_data() { + local mtd_path + + . /lib/functions.sh + . /lib/functions/system.sh + + case $(board_name) in + tplink,eap610-outdoor) + mtd_path=$(find_mtd_chardev "factory_data") + ubiattach --dev-path="$mtd_path" --devn=1 + mkdir /tmp/factory_data + mount -o ro,noatime -t ubifs ubi1:ubi_factory_data /tmp/factory_data + ;; + esac +} + +boot_hook_add preinit_main preinit_mount_factory_data diff --git a/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh index 411570715c2..f9d446ff1f7 100644 --- a/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh @@ -4,6 +4,79 @@ REQUIRE_IMAGE_METADATA=1 RAMFS_COPY_BIN='fw_printenv fw_setenv head' RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock' +remove_oem_ubi_volume() { + local oem_volume_name="$1" + local oem_ubivol + local mtdnum + local ubidev + + mtdnum=$(find_mtd_index "$CI_UBIPART") + if [ ! "$mtdnum" ]; then + return + fi + + ubidev=$(nand_find_ubi "$CI_UBIPART") + if [ ! "$ubidev" ]; then + ubiattach --mtdn="$mtdnum" + ubidev=$(nand_find_ubi "$CI_UBIPART") + fi + + if [ "$ubidev" ]; then + oem_ubivol=$(nand_find_volume "$ubidev" "$oem_volume_name") + [ "$oem_ubivol" ] && ubirmvol "/dev/$ubidev" --name="$oem_volume_name" + fi +} + +tplink_get_boot_part() { + local cur_boot_part + local args + + # Try to find rootfs from kernel arguments + read -r args < /proc/cmdline + for arg in $args; do + local ubi_mtd_arg=${arg#ubi.mtd=} + case "$ubi_mtd_arg" in + rootfs|rootfs_1) + echo "$ubi_mtd_arg" + return + ;; + esac + done + + # Fallback to u-boot env (e.g. when running initramfs) + cur_boot_part="$(/usr/sbin/fw_printenv -n tp_boot_idx)" + case $cur_boot_part in + 1) + echo rootfs_1 + ;; + 0|*) + echo rootfs + ;; + esac +} + +tplink_do_upgrade() { + local new_boot_part + + case $(tplink_get_boot_part) in + rootfs) + CI_UBIPART="rootfs_1" + new_boot_part=1 + ;; + rootfs_1) + CI_UBIPART="rootfs" + new_boot_part=0 + ;; + esac + + fw_setenv -s - <<-EOF + tp_boot_idx $new_boot_part + EOF + + remove_oem_ubi_volume ubi_rootfs + nand_do_upgrade "$1" +} + platform_check_image() { return 0; } @@ -55,6 +128,9 @@ platform_do_upgrade() { qihoo,360v6) nand_do_upgrade "$1" ;; + tplink,eap610-outdoor) + tplink_do_upgrade "$1" + ;; yuncore,fap650) [ "$(fw_printenv -n owrt_env_ver 2>/dev/null)" != "7" ] && yuncore_fap650_env_setup local active="$(fw_printenv -n owrt_slotactive 2>/dev/null)" From 9d66b8b312fb6a4087244ee3ee10e1ba1623df81 Mon Sep 17 00:00:00 2001 From: Juan Pedro Paredes Caballero Date: Sat, 7 Dec 2024 14:20:31 +0100 Subject: [PATCH 123/173] mediatek: filogic: Add support for cudy wr3000h The manufacturer Cudy usually releases signed openwrt firmware, to facilitate the migration from the proprietary version to the official versions of openwrt. In contact with the manufacturer tells me that only releases the firmware of the WR3000H if and only if there is an official version. With this proposal I pretend to have an initial operative version so that they do their part, and facilitate to the users the possibility of using openwrt. In the present state, it is only possible to use this firmware by uploading and installing it with UART connection. AX3000 2.5G Dual Band Wi-Fi 6 Mesh Router (WR3000H) Hardware -------- MediaTek MT7981 WiSoC 256MB DDR3 RAM 128MB SPI-NAND (XMC XM25QH128C) MediaTek MT7981 2x2 DBDC 802.11ax 2T2R (2.4 / 5) 4 LAN MediaTek MT7531 PHY 1 WAN RTL8221B-VB-CG 2.5Gbps PHY (C22) 2 Radios MT7976CN UART: 115200 8N1 3.3V MAC: LAN MAC: label mac WAN MAC: label mac + 1 2.4G MAC: label mac 5G MAC: label mac + 1 with LA bit set Installation ------------ 1. Connect to the serial port as described in the "Hardware" section. 2. Power on the device + press reset pin. Keep pressing reset pin to enter the U-Boot shell (The recovery.bin image load process must fail). 3. Download the OpenWrt initramfs image. Place it on an TFTP server connected to the Cudy LAN ports. Make sure the server is reachable at 192.168.1.88. Rename the image to "cudy3000h.bin" 4. Download and boot the OpenWrt initramfs image. $ tftpboot 0x46000000 cudy3000h.bin; bootm 0x46000000 5. IMPORTANT: Make backup from original firmware. System -> Backup /Flash Firmware -> Save mtdblock contents. All mtdblock one by one, keep unaltered (BL2, u-boot-env, Factory, bdinfo, FIP, and ubi). 6. Transfer the OpenWrt sysupgrade image to the device using scp. Install with sysupgrade. Warning for BL2 and U-BOOT developers ------------------------------------- The nand partition layout from vendor is slightly diferent from "standard". The FIP partition starts at 0x3c0000 be carefull with BL2 to BL31. The UBI partition start at 0x5c0000 be carefull. DO NOT OVERWRITE bdinfo partition it contains hardware MAC definition Layout is start-end (not start size) - 0x000000000000-0x000007800000 : "nmbm0" - 0x000000000000-0x000000100000 : "bl2" - 0x000000100000-0x000000180000 : "u-boot-env" - 0x000000180000-0x000000380000 : "factory" - 0x000000380000-0x0000003c0000 : "bdinfo" - 0x0000003c0000-0x0000005c0000 : "fip" - 0x0000005c0000-0x0000045c0000 : "ubi" ALLWAYS for U-BOOT operations check this setenv mtdids nmbm0=nmbm0 setenv mtdparts nmbm0:1024k(bl2),512k(u-boot-env),2048k(factory),256k(bdinfo),2048k(fip),65536k(ubi) Signed-off-by: Juan Pedro Paredes Caballero Link: https://github.com/openwrt/openwrt/pull/17458 Signed-off-by: Hauke Mehrtens --- .../mediatek/dts/mt7981b-cudy-wr3000h-v1.dts | 337 ++++++++++++++++++ .../filogic/base-files/etc/board.d/01_leds | 8 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 1 + .../base-files/lib/upgrade/platform.sh | 4 + target/linux/mediatek/image/filogic.mk | 17 + 5 files changed, 367 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981b-cudy-wr3000h-v1.dts diff --git a/target/linux/mediatek/dts/mt7981b-cudy-wr3000h-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-wr3000h-v1.dts new file mode 100644 index 00000000000..0808eb9557a --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-cudy-wr3000h-v1.dts @@ -0,0 +1,337 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; + +#include + +#include "mt7981.dtsi" + +/ { + model = "Cudy WR3000H v1"; + compatible = "cudy,wr3000h-v1", "mediatek,mt7981-spim-snand-rfb"; + + aliases { + label-mac-device = &gmac0; + led-boot = &led_status; + led-failsafe = &led_status; + led-running = &led_status; + led-upgrade = &led_status; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "wps"; + linux,code = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-export { + compatible = "gpio-export"; + #size-cells = <0>; + + phyreset { + gpio-export,name = "phyreset"; + gpio-export,output = <1>; + gpios = <&pio 3 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status: led@0 { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&pio 5 GPIO_ACTIVE_LOW>; + }; + + + led_internet { + function = LED_FUNCTION_WAN_ONLINE; + color = ; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + + led_wps { + function = LED_FUNCTION_WPS; + color = ; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + + led_wlan2g { + function = LED_FUNCTION_WLAN_2GHZ; + color = ; + gpios = <&pio 6 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led_wlan5g { + function = LED_FUNCTION_WLAN_5GHZ; + color = ; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + + led_lan1 { + function = LED_FUNCTION_LAN; + function-enumerator = <1>; + color = ; + gpios = <&pio 8 GPIO_ACTIVE_LOW>; + }; + + led_lan2 { + function = LED_FUNCTION_LAN; + function-enumerator = <2>; + color = ; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + + led_lan3 { + function = LED_FUNCTION_LAN; + function-enumerator = <3>; + color = ; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + }; + + led_lan4 { + function = LED_FUNCTION_LAN; + function-enumerator = <4>; + color = ; + gpios = <&pio 13 GPIO_ACTIVE_LOW>; + }; + + led_wan { + function = LED_FUNCTION_WAN; + color = ; + gpios = <&pio 35 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins>; + + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_bdinfo_de00 0>; + label = "lan"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "2500base-x"; + phy-handle = <&phy6>; + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_bdinfo_de00 1>; + label = "wan"; + }; + +}; + +&mdio_bus { + switch: switch@1f { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; + }; + phy6: ethernet-phy@6 { + compatible = "ethernet-phy-ieee802.3-c22"; // [RTL8221B-VB-CG 2.5Gbps PHY (C22)] + reg = <6>; + phy-mode = "2500base-x"; + }; + +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + spi_nand: flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-nand"; + reg = <0>; + spi-max-frequency = <52000000>; + + spi-cal-enable; + spi-cal-mode = "read-data"; + spi-cal-datalen = <7>; + spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>; + spi-cal-addrlen = <5>; + spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>; + + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BL2"; + reg = <0x00000 0x0100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x0100000 0x0080000>; + read-only; + }; + + factory: partition@180000 { + label = "Factory"; + reg = <0x180000 0x0200000>; + read-only; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + }; + }; + + partition@380000 { + label = "bdinfo"; + reg = <0x380000 0x0040000>; + read-only; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_bdinfo_de00: macaddr@de00 { + compatible = "mac-base"; + reg = <0xde00 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + partition@3C0000 { + label = "FIP"; + reg = <0x3C0000 0x0200000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + reg = <0x5C0000 0x4000000>; + compatible = "linux,ubi"; + }; + }; + }; +}; + +&pio { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + conf-pu { + pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; + drive-strength = ; + bias-pull-up = ; + }; + + conf-pd { + pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; + drive-strength = ; + bias-pull-down = ; + }; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan1"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + }; + + port@3 { + reg = <3>; + label = "lan4"; + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&wifi { + status = "okay"; + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds index ca4961c6553..a6bb9b0ca8a 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds @@ -38,6 +38,14 @@ cudy,re3000-v1) cudy,wr3000-v1) ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" ;; +cudy,wr3000h-v1) + ucidef_set_led_netdev "lan1" "lan1" "white:lan-1" "lan1" "link tx rx" + ucidef_set_led_netdev "lan2" "lan2" "white:lan-2" "lan2" "link tx rx" + ucidef_set_led_netdev "lan3" "lan3" "white:lan-3" "lan3" "link tx rx" + ucidef_set_led_netdev "lan4" "lan4" "white:lan-4" "lan4" "link tx rx" + ucidef_set_led_netdev "wan" "wan" "white:wan" "wan" "link tx rx" + ucidef_set_led_netdev "internet" "internet" "white:wan-online" "wan" "link" + ;; glinet,gl-x3000|\ glinet,gl-xe3000) ucidef_set_led_default "power" "POWER" "green:power" "1" diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index 3188fe71d5a..4ae2c70658f 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -79,6 +79,7 @@ case "$board" in cudy,re3000-v1|\ cudy,tr3000-v1|\ cudy,wr3000s-v1|\ + cudy,wr3000h-v1|\ cudy,wr3000-v1) addr=$(mtd_get_mac_binary bdinfo 0xde00) # Originally, phy0 is phy1 mac with LA bit set. However, this would conflict diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index 7556be52bda..1d89640a4ef 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -118,6 +118,10 @@ platform_do_upgrade() { CI_KERNPART="linux" nand_do_upgrade "$1" ;; + cudy,wr3000h-v1) + CI_UBIPART="ubi" + nand_do_upgrade "$1" + ;; cudy,re3000-v1|\ cudy,wr3000-v1|\ yuncore,ax835) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 22c9151ff37..afa5224b19a 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -705,6 +705,23 @@ define Device/cudy_wr3000s-v1 endef TARGET_DEVICES += cudy_wr3000s-v1 +define Device/cudy_wr3000h-v1 + DEVICE_VENDOR := Cudy + DEVICE_MODEL := WR3000H + DEVICE_VARIANT := v1 + DEVICE_DTS := mt7981b-cudy-wr3000h-v1 + DEVICE_DTS_DIR := ../dts + SUPPORTED_DEVICES += R59 + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 65536k + KERNEL_IN_UBI := 1 + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware +endef +TARGET_DEVICES += cudy_wr3000h-v1 + define Device/dlink_aquila-pro-ai-m30-a1 DEVICE_VENDOR := D-Link DEVICE_MODEL := AQUILA PRO AI M30 From e5d1a501cbd0fdda47d9169e9f669c7fb4813f2a Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Tue, 7 Jan 2025 14:55:24 +0100 Subject: [PATCH 124/173] realtek: switch RTL8231 driver for HPE 1920-8G Update the base DTS file for the 8 port HPE 1920 devices (JG920A, JG921A, JG922A), causing the new RTL8231 MFD driver to be loaded at start-up. Signed-off-by: Sander Vanheule --- .../realtek/dts/rtl8380_hpe_1920-8g.dtsi | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/target/linux/realtek/dts/rtl8380_hpe_1920-8g.dtsi b/target/linux/realtek/dts/rtl8380_hpe_1920-8g.dtsi index 262dd83d21c..ddd46c4cf64 100644 --- a/target/linux/realtek/dts/rtl8380_hpe_1920-8g.dtsi +++ b/target/linux/realtek/dts/rtl8380_hpe_1920-8g.dtsi @@ -4,13 +4,6 @@ #include "rtl83xx_hpe_1920.dtsi" / { - gpio1: rtl8231-gpio { - compatible = "realtek,rtl8231-gpio"; - #gpio-cells = <2>; - gpio-controller; - indirect-access-bus-id = <0>; - }; - i2c0: i2c-gpio-0 { compatible = "i2c-gpio"; sda-gpios = <&gpio1 23 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; @@ -46,6 +39,24 @@ }; }; +&mdio_aux { + status = "okay"; + + gpio1: expander@0 { + compatible = "realtek,rtl8231"; + reg = <0>; + + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&gpio1 0 0 37>; + + led-controller { + compatible = "realtek,rtl8231-leds"; + status = "disabled"; + }; + }; +}; + ðernet0 { mdio: mdio-bus { compatible = "realtek,rtl838x-mdio"; From 96850585e52dfff2c25d8b20b0b5cd192981ed4d Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Tue, 7 Jan 2025 14:59:20 +0100 Subject: [PATCH 125/173] realtek: switch RTL8231 driver for HPE 1920-16/24G Update the base DTS file for the 16 and 24 port HPE 1920 devices (JG923A, JG924A, JG925A, JG926A), causing the new RTL8231 MFD driver to be loaded at start-up. Signed-off-by: Sander Vanheule --- .../linux/realtek/dts/rtl8382_hpe_1920.dtsi | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/target/linux/realtek/dts/rtl8382_hpe_1920.dtsi b/target/linux/realtek/dts/rtl8382_hpe_1920.dtsi index af168067d4d..20d8693a3be 100644 --- a/target/linux/realtek/dts/rtl8382_hpe_1920.dtsi +++ b/target/linux/realtek/dts/rtl8382_hpe_1920.dtsi @@ -4,12 +4,6 @@ #include "rtl83xx_hpe_1920.dtsi" / { - gpio1: rtl8231-gpio { - compatible = "realtek,rtl8231-gpio"; - #gpio-cells = <2>; - gpio-controller; - indirect-access-bus-id = <0>; - }; i2c0: i2c-gpio-0 { compatible = "i2c-gpio"; @@ -84,6 +78,24 @@ }; }; +&mdio_aux { + status = "okay"; + + gpio1: expander@0 { + compatible = "realtek,rtl8231"; + reg = <0>; + + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&gpio1 0 0 37>; + + led-controller { + compatible = "realtek,rtl8231-leds"; + status = "disabled"; + }; + }; +}; + ðernet0 { mdio: mdio-bus { compatible = "realtek,rtl838x-mdio"; From 191ed4e803bbd82e9023d73ed9ff3c1d5ea64892 Mon Sep 17 00:00:00 2001 From: "Anton Yu. Ivanusev" Date: Wed, 8 Jan 2025 01:14:10 +0500 Subject: [PATCH 126/173] ramips: mt76x8: fixs for Keenetic Air (KN-1613) and Extra (KN-1713) A new syntax for LEDs was used, and migration of the LEDs configuration was added. Used lower case hex characters for the addresses. Fixed a USB port power issue. Signed-off-by: Anton Yu. Ivanusev Link: https://github.com/openwrt/openwrt/pull/17521 Signed-off-by: Hauke Mehrtens --- .../ramips/dts/mt7628an_keenetic_kn-1613.dts | 9 ++++-- .../ramips/dts/mt7628an_keenetic_kn-1713.dts | 32 ++++++++++--------- .../base-files/etc/board.d/04_led_migration | 16 ++++++++++ 3 files changed, 39 insertions(+), 18 deletions(-) create mode 100644 target/linux/ramips/mt76x8/base-files/etc/board.d/04_led_migration diff --git a/target/linux/ramips/dts/mt7628an_keenetic_kn-1613.dts b/target/linux/ramips/dts/mt7628an_keenetic_kn-1613.dts index 4b124c92954..af6292980b8 100644 --- a/target/linux/ramips/dts/mt7628an_keenetic_kn-1613.dts +++ b/target/linux/ramips/dts/mt7628an_keenetic_kn-1613.dts @@ -30,18 +30,21 @@ }; internet { - label = "green:internet"; + function = LED_FUNCTION_WAN; + color = ; gpios = <&gpio 38 GPIO_ACTIVE_LOW>; }; wifi2 { - label = "green:wifi2"; + function = LED_FUNCTION_WLAN_2GHZ; + color = ; gpios = <&gpio 3 GPIO_ACTIVE_LOW>; linux,default-trigger = "phy0tpt"; }; wifi5 { - label = "green:wifi5"; + function = LED_FUNCTION_WLAN_5GHZ; + color = ; gpios = <&gpio 4 GPIO_ACTIVE_LOW>; linux,default-trigger = "phy1tpt"; }; diff --git a/target/linux/ramips/dts/mt7628an_keenetic_kn-1713.dts b/target/linux/ramips/dts/mt7628an_keenetic_kn-1713.dts index 972c88eadd0..84127a88e04 100644 --- a/target/linux/ramips/dts/mt7628an_keenetic_kn-1713.dts +++ b/target/linux/ramips/dts/mt7628an_keenetic_kn-1713.dts @@ -27,6 +27,7 @@ regulator-max-microvolt = <5000000>; gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; enable-active-high; + regulator-always-on; }; leds { @@ -44,17 +45,18 @@ gpios = <&gpio 38 GPIO_ACTIVE_LOW>; }; - fn { - function = LED_FUNCTION_USB; + wifi2 { + function = LED_FUNCTION_WLAN_2GHZ; color = ; gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; }; - wifi { - function = LED_FUNCTION_WLAN; + wifi5 { + function = LED_FUNCTION_WLAN_5GHZ; color = ; gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy0tpt","phy1tpt"; + linux,default-trigger = "phy1tpt"; }; }; @@ -93,7 +95,7 @@ partition@0 { compatible = "denx,uimage"; label = "firmware"; - reg = <0x0 0x1CC0000>; + reg = <0x0 0x1cc0000>; }; }; }; @@ -160,21 +162,21 @@ reg = <0x50000 0xe60000>; }; - partition@EB0000 { + partition@eb0000 { label = "config_1"; - reg = <0xEB0000 0x40000>; + reg = <0xeb0000 0x40000>; read-only; }; - partition@EF0000 { + partition@ef0000 { label = "storage"; - reg = <0xEF0000 0x100000>; + reg = <0xef0000 0x100000>; read-only; }; - partition@FF0000 { + partition@ff0000 { label = "dump"; - reg = <0xFF0000 0x10000>; + reg = <0xff0000 0x10000>; read-only; }; @@ -198,12 +200,12 @@ firmware2: partition@1050000 { label = "firmware_2"; - reg = <0x1050000 0xE60000>; + reg = <0x1050000 0xe60000>; }; - partition@1EB0000 { + partition@1eb0000 { label = "Config_2"; - reg = <0x1EB0000 0x40000>; + reg = <0x1eb0000 0x40000>; read-only; }; }; diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/04_led_migration b/target/linux/ramips/mt76x8/base-files/etc/board.d/04_led_migration new file mode 100644 index 00000000000..c845fadd734 --- /dev/null +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/04_led_migration @@ -0,0 +1,16 @@ +. /lib/functions.sh +. /lib/functions/migrations.sh + +board=$(board_name) + +case "$board" in +keenetic,kn-1613) + migrate_leds 'green:internet=green:wan' + ;; +esac + +remove_devicename_leds + +migrations_apply system + +exit 0 From b2b4ce15322c75bda0cae6fb2160a74270185831 Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Sat, 11 Jan 2025 17:04:33 +0100 Subject: [PATCH 127/173] lantiq: xrx200_legacy: add alternative names for TP-Link TD-W9980(B) The TP-Link TD-W9980(B) shares the same hardware with the TP-Link TD-W8980. The only difference is that the TD-W8980 does not support VDSL. This is a software limitation and once the software is changed, both work equally supporting VDSL. This commit adds alternative names for devices so they can be easily found in the firmware selector. Signed-off-by: Aleksander Jan Bajkowski Link: https://github.com/openwrt/openwrt/pull/17583 Signed-off-by: Hauke Mehrtens --- target/linux/lantiq/image/tp-link_legacy.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/target/linux/lantiq/image/tp-link_legacy.mk b/target/linux/lantiq/image/tp-link_legacy.mk index d9bcd35d10f..19a81bd8274 100644 --- a/target/linux/lantiq/image/tp-link_legacy.mk +++ b/target/linux/lantiq/image/tp-link_legacy.mk @@ -36,6 +36,12 @@ define Device/tplink_tdw8980 $(Device/lantiqTpLink) DEVICE_MODEL := TD-W8980 DEVICE_VARIANT := v1 + DEVICE_ALT0_VENDOR := TP-LINK + DEVICE_ALT0_MODEL := TD-W9980 + DEVICE_ALT0_VARIANT := v1 + DEVICE_ALT1_VENDOR := TP-LINK + DEVICE_ALT1_MODEL := TD-W9980B + DEVICE_ALT1_VARIANT := v1 TPLINK_FLASHLAYOUT := 8Mltq TPLINK_HWID := 0x89800001 TPLINK_HWREV := 14 From 1b045a7c13aeb141e0c069aaf5fc38989eee11cf Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Sat, 11 Jan 2025 17:10:42 +0100 Subject: [PATCH 128/173] lantiq: xrx200: add alternative names for Plusnet Hub One and BT Business Hub 5A The Plusnet Hub One and BT Business Hub 5A have the same hardware as the BT Home Hub 5A. This commit adds alternative names so that both devices can be easily found in the firmware selector. Signed-off-by: Aleksander Jan Bajkowski Link: https://github.com/openwrt/openwrt/pull/17583 Signed-off-by: Hauke Mehrtens --- target/linux/lantiq/image/vr9.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/linux/lantiq/image/vr9.mk b/target/linux/lantiq/image/vr9.mk index 48a372f4768..05999e408de 100644 --- a/target/linux/lantiq/image/vr9.mk +++ b/target/linux/lantiq/image/vr9.mk @@ -292,6 +292,11 @@ define Device/bt_homehub-v5a DEVICE_VENDOR := British Telecom (BT) DEVICE_MODEL := Home Hub 5 DEVICE_VARIANT := Type A + DEVICE_ALT0_VENDOR := British Telecom (BT) + DEVICE_ALT0_MODEL := Business Hub 5 + DEVICE_ALT0_VARIANT := Type A + DEVICE_ALT1_VENDOR := Plusnet + DEVICE_ALT1_MODEL := Hub One BOARD_NAME := BTHOMEHUBV5A DEVICE_PACKAGES := kmod-ath9k kmod-owl-loader \ kmod-ath10k-ct ath10k-firmware-qca988x-ct wpad-basic-mbedtls kmod-usb-dwc2 From 524e22b4c71366be86493ca3ee7a16ff92d52288 Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Sat, 11 Jan 2025 16:34:46 +0100 Subject: [PATCH 129/173] lantiq: xway_legacy: refresh config This was done by executing these command: $ make kernel_oldconfig CONFIG_TARGET=subtarget Signed-off-by: Aleksander Jan Bajkowski Link: https://github.com/openwrt/openwrt/pull/17581 Signed-off-by: Hauke Mehrtens --- target/linux/lantiq/xrx200_legacy/config-6.6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/lantiq/xrx200_legacy/config-6.6 b/target/linux/lantiq/xrx200_legacy/config-6.6 index c8650c4e87f..166a2cde067 100644 --- a/target/linux/lantiq/xrx200_legacy/config-6.6 +++ b/target/linux/lantiq/xrx200_legacy/config-6.6 @@ -7,7 +7,6 @@ CONFIG_CPU_MIPSR2_IRQ_VI=y CONFIG_CPU_RMAP=y CONFIG_CRC16=y CONFIG_CRYPTO_DEFLATE=y -CONFIG_CRYPTO_HASH_INFO=y CONFIG_CRYPTO_LZO=y CONFIG_CRYPTO_ZSTD=y CONFIG_EXTRA_FIRMWARE="lantiq/xrx200_phy11g_a14.bin lantiq/xrx200_phy11g_a22.bin lantiq/xrx200_phy22f_a14.bin lantiq/xrx200_phy22f_a22.bin" @@ -47,6 +46,7 @@ CONFIG_NET_SWITCHDEV=y CONFIG_NLS=y CONFIG_NR_CPUS=2 CONFIG_PADATA=y +CONFIG_PAHOLE_HAS_LANG_EXCLUDE=y CONFIG_PCI=y CONFIG_PCIEPORTBUS=y CONFIG_PCIE_LANTIQ=y From 517b9c1cdcd357fd84c7f27bd2886f235f3ec946 Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Sat, 11 Jan 2025 16:37:47 +0100 Subject: [PATCH 130/173] lantiq: xrx200_legacy: disable unused phy drivers Subtarget xrx200_legacy supports only a few devices. They all use the integrated Lantiq GSWIP switch and lantiq xway PHYs. The atheros and icplus PHYs can be safely disabled. Switches used by individual devices are listed below. Device Switch PHY Alpha ASL56026 Lantiq GSWIP int. switch Arcadyan VG3503J Lantiq GSWIP int. switch Netgear DM200 Lantiq GSWIP int. switch TP-LINK TD-W8970 Lantiq GSWIP Lantiq PEF7071V TP-Link TD-W8980 Lantiq GSWIP Lantiq PEF7071V Reduces uncompressed kernel size by 16 kB. Signed-off-by: Aleksander Jan Bajkowski Link: https://github.com/openwrt/openwrt/pull/17581 Signed-off-by: Hauke Mehrtens --- target/linux/lantiq/xrx200_legacy/config-6.6 | 3 --- 1 file changed, 3 deletions(-) diff --git a/target/linux/lantiq/xrx200_legacy/config-6.6 b/target/linux/lantiq/xrx200_legacy/config-6.6 index 166a2cde067..9bb65cff07d 100644 --- a/target/linux/lantiq/xrx200_legacy/config-6.6 +++ b/target/linux/lantiq/xrx200_legacy/config-6.6 @@ -1,4 +1,3 @@ -CONFIG_AT803X_PHY=y CONFIG_BLK_MQ_PCI=y CONFIG_CONTEXT_TRACKING=y CONFIG_CONTEXT_TRACKING_IDLE=y @@ -16,7 +15,6 @@ CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y CONFIG_GRO_CELLS=y CONFIG_HWMON=y CONFIG_HW_RANDOM=y -CONFIG_ICPLUS_PHY=y CONFIG_IFX_VPE_EXT=y CONFIG_INPUT=y CONFIG_INPUT_EVDEV=y @@ -57,7 +55,6 @@ CONFIG_PHY_LANTIQ_VRX200_PCIE=y CONFIG_POWER_RESET_GPIO=y CONFIG_POWER_SUPPLY=y CONFIG_POWER_SUPPLY_HWMON=y -CONFIG_QCOM_NET_PHYLIB=y CONFIG_QUEUED_RWLOCKS=y CONFIG_QUEUED_SPINLOCKS=y CONFIG_REGULATOR=y From 5aa996b06d77d7c0935071de6f2217f13be3f253 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 23 Dec 2024 13:28:25 -0800 Subject: [PATCH 131/173] ath79: pineapple-nano: use regulator for USB GPIO The chipidea USB2 driver used on this platform supports controlling GPIO through regulators. This is the upstream friendly solution. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/17356 Signed-off-by: Hauke Mehrtens --- .../dts/ar9331_hak5_wifi-pineapple-nano.dts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/target/linux/ath79/dts/ar9331_hak5_wifi-pineapple-nano.dts b/target/linux/ath79/dts/ar9331_hak5_wifi-pineapple-nano.dts index a2b6edbd5e7..4a4f455acf0 100644 --- a/target/linux/ath79/dts/ar9331_hak5_wifi-pineapple-nano.dts +++ b/target/linux/ath79/dts/ar9331_hak5_wifi-pineapple-nano.dts @@ -29,12 +29,6 @@ gpio-export,name = "usb-alarm"; gpios = <&gpio 20 GPIO_ACTIVE_LOW>; }; - - usb-power { - gpio-export,name = "usb-power"; - gpio-export,output = <0>; - gpios = <&gpio 23 GPIO_ACTIVE_LOW>; - }; }; keys { @@ -57,6 +51,14 @@ linux,default-trigger = "phy0tpt"; }; }; + + reg_power_usb: regulator { + compatible = "regulator-fixed"; + regulator-name = "power_usb"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpios = <&gpio 23 GPIO_ACTIVE_LOW>; + }; }; ð0 { @@ -123,6 +125,8 @@ &usb { status = "okay"; + + vbus-supply = <®_power_usb>; }; &usb_phy { From 90e86a871319e481322959e301b2603c258092a9 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 23 Dec 2024 13:20:49 -0800 Subject: [PATCH 132/173] ath79: gl-ar150: fix USB GPIO usage Currently, an OpenWrt hack is used to turn the GPIO on in terms of the PHY driver when it should be the USB driver that controls it. The chipidea USB2 driver has support for a vbus-supply property. Use it instead of the local OpenWrt solution that just turns on the GPIO. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/17356 Signed-off-by: Hauke Mehrtens --- target/linux/ath79/dts/ar9330_glinet_gl-ar150.dts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/target/linux/ath79/dts/ar9330_glinet_gl-ar150.dts b/target/linux/ath79/dts/ar9330_glinet_gl-ar150.dts index fe1d3186cff..8e38c9f5fba 100644 --- a/target/linux/ath79/dts/ar9330_glinet_gl-ar150.dts +++ b/target/linux/ath79/dts/ar9330_glinet_gl-ar150.dts @@ -62,16 +62,26 @@ gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; }; }; + + reg_power_usb: regulator { + compatible = "regulator-fixed"; + regulator-name = "power_usb"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &usb { - dr_mode = "host"; status = "okay"; + + dr_mode = "host"; + vbus-supply = <®_power_usb>; }; &usb_phy { status = "okay"; - gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; }; &spi { From 6c1ad2830e8bc5591db0bfed22873da5a670d08e Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 23 Dec 2024 13:35:01 -0800 Subject: [PATCH 133/173] ath79: phy: remove named gpio exports The only real user of this patch was removed and migrated to the upstream friendly regulator. Remove this hack. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/17356 Signed-off-by: Hauke Mehrtens --- .../700-phy-add-ath79-usb-phys.patch | 23 ++----------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/target/linux/ath79/patches-6.6/700-phy-add-ath79-usb-phys.patch b/target/linux/ath79/patches-6.6/700-phy-add-ath79-usb-phys.patch index b50e4b51a45..1c1b2f2ca1b 100644 --- a/target/linux/ath79/patches-6.6/700-phy-add-ath79-usb-phys.patch +++ b/target/linux/ath79/patches-6.6/700-phy-add-ath79-usb-phys.patch @@ -51,7 +51,7 @@ Signed-off-by: John Crispin obj-$(CONFIG_PHY_LPC18XX_USB_OTG) += phy-lpc18xx-usb-otg.o --- /dev/null +++ b/drivers/phy/phy-ar7100-usb.c -@@ -0,0 +1,127 @@ +@@ -0,0 +1,117 @@ +/* + * Copyright (C) 2018 John Crispin + * @@ -144,16 +144,6 @@ Signed-off-by: John Crispin + if (IS_ERR(priv->phy)) + return dev_err_probe(&pdev->dev, PTR_ERR(priv->phy), "failed to create PHY"); + -+ priv->gpio = of_get_named_gpio(pdev->dev.of_node, "gpios", 0); -+ if (gpio_is_valid(priv->gpio)) { -+ int ret = devm_gpio_request(&pdev->dev, priv->gpio, dev_name(&pdev->dev)); -+ if (ret) -+ return dev_err_probe(&pdev->dev, ret, "failed to request gpio"); -+ -+ gpio_export_with_name(gpio_to_desc(priv->gpio), 0, dev_name(&pdev->dev)); -+ gpio_set_value(priv->gpio, 1); -+ } -+ + phy_set_drvdata(priv->phy, priv); + + phy_provider = devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate); @@ -181,7 +171,7 @@ Signed-off-by: John Crispin +MODULE_LICENSE("GPL"); --- /dev/null +++ b/drivers/phy/phy-ar7200-usb.c -@@ -0,0 +1,120 @@ +@@ -0,0 +1,111 @@ +/* + * Copyright (C) 2015 Alban Bedel + * @@ -268,15 +258,6 @@ Signed-off-by: John Crispin + if (IS_ERR(priv->phy)) + return dev_err_probe(&pdev->dev, PTR_ERR(priv->phy), "failed to create PHY"); + -+ priv->gpio = of_get_named_gpio(pdev->dev.of_node, "gpios", 0); -+ if (gpio_is_valid(priv->gpio)) { -+ int ret = devm_gpio_request(&pdev->dev, priv->gpio, dev_name(&pdev->dev)); -+ if (ret) -+ return dev_err_probe(&pdev->dev, ret, "failed to request gpio"); -+ gpio_export_with_name(gpio_to_desc(priv->gpio), 0, dev_name(&pdev->dev)); -+ gpio_set_value(priv->gpio, 1); -+ } -+ + phy_set_drvdata(priv->phy, priv); + + phy_provider = devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate); From 8fb805aa1f25b69b7849c8b1ce787ed47b16d123 Mon Sep 17 00:00:00 2001 From: Robert Senderek Date: Fri, 22 Nov 2024 00:05:39 +0100 Subject: [PATCH 134/173] mvebu: Add support for WD Cloud Mirror Gen2 Hardware -------- Marvell Armada 385 (MV88F6820) 512B RAM 256MB NAND (Hynix H27U2G8F2CTR) 1x 1Gbit 2x USB 3.0 2x SATA-III UART: 115200 8N1 3.3V RTC Weltrend MCU WT6703F connected via UART1 for Power LED / PWM Fan / hw reset / WoL Installation ------------ Connect UART 3.3V adapter to JP2 pins: 1-RX / 2-GND / 5-TX Use USB2.0 FAT32 pendrive with openwrt-mvebu-cortexa9-wd_cloud-mirror-gen2-initramfs-kernel.bin 1. stop boot by pressing 1 2. usb start 3. fatload usb 0:1 0x02000000 openwrt-mvebu-cortexa9-wd_cloud-mirror-gen2-initramfs-kernel.bin;bootm 0x02000000 - 4. do backup mtd1 mtd3 5. use sysupgrade Or tftp 1. stop boot by pressing 1 2. setenv ethact egiga2;setenv serverip 192.168.11.114;setenv ipaddr 192.168.11.113 3. tftpboot 0x02000000 openwrt-mvebu-cortexa9-wd_cloud-mirror-gen2-initramfs-kernel.bin; bootm 0x02000000 - 4. do backup mtd1 mtd3 5. use sysupgrade or Evgeny Kolesnikov method from his failed PR 2040 - Using original firmware's network settings obtain SSH access to the device. - Put *-image-cfs-factory.bin and *-uImage-factory.bin images into device's /tmp directory. - Write kernel (uImage) image 'flash_eraseall /dev/mtd1 && nandwrite --markbad -p /dev/mtd1 /tmp/*-uImage-factory.bin'. - Write rootfs (image-cfs) image 'ubiformat /dev/mtd3 -f /tmp/*-image.cfs-factory.bin -y'. - Reboot the device. Installation (upgrade): Use *-sysupgrade.bin in a usual way. Weltrend MCU control is done via uart1 19200 stty -F /dev/ttyS1 raw speed 19200 stty -F /dev/ttyS1 raw speed 19200 PWM Fan Control off: 00 echo -n -e '\xfa\x02\x00\x00\x00\x00\xfb' > /dev/ttyS1 slow: 5F echo -n -e '\xfa\x02\x00\x5f\x00\x00\xfb' > /dev/ttyS1 max: FF echo -n -e '\xfa\x02\x00\xff\x00\x00\xfb' > /dev/ttyS1 Power LED Control Blue echo -n -e '\xfa\x26\x00\x11\x00\x01\xfb' > /dev/ttyS1 Red echo -n -e '\xfa\x26\x00\x14\x00\x01\xfb' > /dev/ttyS1 Orange echo -n -e '\xfa\x26\x00\x12\x00\x01\xfb' > /dev/ttyS1 more here: https://github.com/c-MM/mcm-daemon/blob/master/mcm.h Signed-off-by: Robert Senderek Link: https://github.com/openwrt/openwrt/pull/17046 Signed-off-by: Hauke Mehrtens --- .../base-files/etc/board.d/02_network | 9 +- .../base-files/lib/upgrade/platform.sh | 3 +- .../armada-385-wd_cloud-mirror-gen2.dts | 368 ++++++++++++++++++ target/linux/mvebu/image/cortexa9.mk | 17 + 4 files changed, 395 insertions(+), 2 deletions(-) create mode 100644 target/linux/mvebu/files-6.6/arch/arm/boot/dts/marvell/armada-385-wd_cloud-mirror-gen2.dts diff --git a/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network b/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network index 680af1ce673..8cf1c0e4261 100644 --- a/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network +++ b/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network @@ -13,7 +13,8 @@ mvebu_setup_interfaces() case "$board" in ctera,c200-v2|\ - synology,ds213j) + synology,ds213j|\ + wd,cloud-mirror-gen2) ucidef_set_interface_lan "eth0" "dhcp" ;; cznic,turris-omnia) @@ -94,6 +95,12 @@ mvebu_setup_macs() lan_mac=$label_mac wan_mac=$label_mac ;; + wd,cloud-mirror-gen2) + # mac address is on ubi "config" or ubi "reserve2" in text file. + # ubi "reserve2" /dev/mtd7 is twice small and only contains basic OEM factory info + label_mac=$(macaddr_canonicalize $(strings /dev/mtd7|grep -E '([0-9A-F]{2}[:])')) + lan_mac=$label_mac + ;; esac [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac diff --git a/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh index 70678622d34..13d8e77c93c 100755 --- a/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh +++ b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh @@ -31,7 +31,8 @@ platform_do_upgrade() { CI_ROOT_UBIPART=ubi nand_do_upgrade "$1" ;; - buffalo,ls421de) + buffalo,ls421de|\ + wd,cloud-mirror-gen2) nand_do_upgrade "$1" ;; ctera,c200-v2) diff --git a/target/linux/mvebu/files-6.6/arch/arm/boot/dts/marvell/armada-385-wd_cloud-mirror-gen2.dts b/target/linux/mvebu/files-6.6/arch/arm/boot/dts/marvell/armada-385-wd_cloud-mirror-gen2.dts new file mode 100644 index 00000000000..50936e72adf --- /dev/null +++ b/target/linux/mvebu/files-6.6/arch/arm/boot/dts/marvell/armada-385-wd_cloud-mirror-gen2.dts @@ -0,0 +1,368 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Device Tree file for Western Digital My Cloud Mirror Gen 2 + * (BWVZ/Grand Teton) + * + * Copyright (C) 2020 + * + * Based on the code from: + * + * Copyright (C) 2019 Evgeny Kolesnikov + * Copyright (C) 2016 Martin Mueller + * Copyright (C) 2013 Gregory CLEMENT + * Copyright (C) 2014 Thomas Petazzoni + * + */ + +/dts-v1/; +#include +#include +#include +#include "armada-385.dtsi" + +/ { + model = "WD MyCloud Mirror Gen 2 (BWVZ/Grand Teton)"; + compatible = "wd,cloud-mirror-gen2", "marvell,armada385", "marvell,armada380"; + + aliases { + led-boot = &led_boot; + led-failsafe = &led_boot; + led-upgrade = &led_boot; + }; + + chosen { + stdout-path = "serial0:115200n8"; + append-rootblock = "nullparameter="; /* override the bootloader args */ + }; + + memory { + device_type = "memory"; + reg = <0x00000000 0x20000000>; /* 512 MB */ + }; + + soc { + ranges = ; + + internal-regs { + timer@c200 { + status = "okay"; + }; + + i2c0: i2c@11000 { + status = "okay"; + clock-frequency = <100000>; + }; + + i2c1: i2c@11100 { + status = "okay"; + clock-frequency = <100000>; + }; + + serial@12000 { + status = "okay"; + }; + + /* Connected to Welltrend 6703F-OG240WT MCU + * which controls power, fan and other things + */ + serial@12100 { + status = "okay"; + }; + + pinctrl@18000 { + /* use only one pin for UART1, as mpp20 is used by sata0 */ + uart1_pins: uart-pins-1 { + marvell,pins = "mpp19"; + marvell,function = "ua1"; + }; + + xhci0_vbus_pins: xhci0-vbus-pins { + marvell,pins = "mpp26"; + marvell,function = "gpio"; + }; + + xhci1_vbus_pins: xhci1-vbus-pins { + marvell,pins = "mpp27"; + marvell,function = "gpio"; + }; + + sata0_pins: sata-pins-0 { + marvell,pins = "mpp55"; + marvell,function = "sata0"; + }; + + sata1_pins: sata-pins-1 { + marvell,pins = "mpp56"; + marvell,function = "sata1"; + }; + + sata_leds: sata-leds { + marvell,pins = "mpp43", "mpp52", "mpp53", "mpp54"; + marvell,function = "gpio"; + }; + + btn_pins: btn-pins { + marvell,pins = "mpp50"; + marvell,function = "gpio"; + }; + }; + + usb@58000 { + status = "okay"; + }; + + phy: mdio@72004 { + phy0: ethernet-phy@0 { + /* Init ETH LEDs */ + marvell,reg-init = <3 16 0 0x101e>; + reg = <0>; + }; + }; + + sata@a8000 { + status = "okay"; + }; + + nand-controller@d0000 { + status = "okay"; + + nand: nand@0 { + reg = <0>; + label = "pxa3xx_nand-0"; + nand-rb = <0>; + marvell,nand-keep-config; + #marvell,nand-enable-arbiter; //optional + nand-on-flash-bbt; + nand-ecc-strength = <4>; + nand-ecc-step-size = <512>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@00000000 { + label = "U-Boot"; + reg = <0x00000000 0x00500000>; /* 5 MB */ + read-only; + }; + + partition@00500000 { + label = "kernel"; + reg = <0x00500000 0x00500000>; /* 5 MB */ + }; + + partition@00a00000 { + label = "uRamdisk"; + reg = <0x00a00000 0x00500000>; /* 5 MB */ + read-only; + }; + + partition@00f00000 { + label = "ubi"; + reg = <0x00f00000 0x0b900000>; /* 185 MB */ + }; + + partition@c800000 { + label = "rescue fw"; + reg = <0x0c800000 0x00f00000>; /* 15 MB */ + read-only; + }; + + partition@d70000 { + label = "config"; + reg = <0x0d700000 0x01400000>; /* 20 MB */ + read-only; + }; + + partition@eb00000 { + label = "reserve1"; + reg = <0x0eb00000 0x00a00000>; /* 10 MB */ + read-only; + }; + + partition@f500000 { + label = "reserve2"; + reg = <0x0f500000 0x00a00000>; /* 10 MB */ + read-only; + }; + }; + }; + }; + + usb3@f0000 { + usb-phy = <&usb3_0_phy>; + status = "okay"; + }; + + usb3@f8000 { + usb-phy = <&usb3_1_phy>; + status = "okay"; + }; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&sata_leds>; + + led_boot: s1red { + label = "red:hdd1"; + gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; + }; + s2red { + label = "red:hdd2"; + gpios = <&gpio1 20 GPIO_ACTIVE_HIGH>; + }; + s1blue { + label = "blue:hdd1"; + gpios = <&gpio1 21 GPIO_ACTIVE_LOW>; + linux,default-trigger = "ata1"; + }; + s2blue { + label = "blue:hdd2"; + gpios = <&gpio1 22 GPIO_ACTIVE_LOW>; + linux,default-trigger = "ata2"; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + pinctrl-names = "default"; + pinctrl-0 = <&btn_pins>; + + reset { + label = "reset"; + linux,code = ; // Restart=0x198, Power=0x116 + gpios = <&gpio1 18 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + wakeup-source; + }; + }; + + usb3_0_phy: usb3_0_phy { + compatible = "usb-nop-xceiv"; + vcc-supply = <®_usb3_0_vbus>; + }; + + usb3_1_phy: usb3_1_phy { + compatible = "usb-nop-xceiv"; + vcc-supply = <®_usb3_1_vbus>; + }; + + reg_usb3_0_vbus: usb3-vbus0 { + compatible = "regulator-fixed"; + regulator-name = "usb3-vbus0"; + pinctrl-names = "default"; + pinctrl-0 = <&xhci0_vbus_pins>; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + enable-active-high; + regulator-always-on; + gpio = <&gpio0 26 GPIO_ACTIVE_HIGH>; + }; + + reg_usb3_1_vbus: usb3-vbus1 { + compatible = "regulator-fixed"; + regulator-name = "usb3-vbus1"; + pinctrl-names = "default"; + pinctrl-0 = <&xhci1_vbus_pins>; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + enable-active-high; + regulator-always-on; + gpio = <&gpio0 27 GPIO_ACTIVE_HIGH>; + }; + + reg_sata0: pwr-sata0 { + compatible = "regulator-fixed"; + regulator-name = "pwr_en_sata0"; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + enable-active-high; + regulator-boot-on; + gpio = <&gpio1 23 GPIO_ACTIVE_HIGH>; + }; + + reg_5v_sata0: v5-sata0 { + compatible = "regulator-fixed"; + regulator-name = "v5.0-sata0"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <®_sata0>; + }; + + reg_12v_sata0: v12-sata0 { + compatible = "regulator-fixed"; + regulator-name = "v12.0-sata0"; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + vin-supply = <®_sata0>; + }; + + reg_sata1: pwr-sata1 { + compatible = "regulator-fixed"; + regulator-name = "pwr_en_sata1"; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + enable-active-high; + regulator-boot-on; + gpio = <&gpio1 24 GPIO_ACTIVE_HIGH>; + }; + + reg_5v_sata1: v5-sata1 { + compatible = "regulator-fixed"; + regulator-name = "v5.0-sata1"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <®_sata1>; + }; + + reg_12v_sata1: v12-sata1 { + compatible = "regulator-fixed"; + regulator-name = "v12.0-sata1"; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + vin-supply = <®_sata1>; + }; +}; + +&bm { + status = "okay"; +}; + +&bm_bppi { + status = "okay"; +}; + +ð2 { + status = "okay"; + phy = <&phy0>; + phy-mode = "sgmii"; + buffer-manager = <&bm>; + bm,pool-long = <0>; + bm,pool-short = <1>; +}; + +&ahci0 { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + sata-port@0 { + reg = <0>; + target-supply = <®_sata0>; + #thermal-sensor-cells = <0>; + }; + + sata-port@1 { + reg = <1>; + target-supply = <®_sata1>; + #thermal-sensor-cells = <1>; + }; +}; diff --git a/target/linux/mvebu/image/cortexa9.mk b/target/linux/mvebu/image/cortexa9.mk index 4a41f2c1029..d572264866b 100644 --- a/target/linux/mvebu/image/cortexa9.mk +++ b/target/linux/mvebu/image/cortexa9.mk @@ -448,3 +448,20 @@ define Device/synology_ds213j -ppp -kmod-nft-offload -dnsmasq -odhcpd-ipv6only endef TARGET_DEVICES += synology_ds213j + +define Device/wd_cloud-mirror-gen2 + $(Device/NAND-128K) + DEVICE_VENDOR := Western Digital + DEVICE_MODEL := MyCloud Mirror Gen 2 (BWVZ/Grand Teton) + DEVICE_PACKAGES += -uboot-envtools coreutils-stty mkf2fs e2fsprogs \ + partx-utils kmod-hwmon-drivetemp -ppp -kmod-nft-offload -dnsmasq \ + -odhcpd-ipv6only + DEVICE_DTS := armada-385-wd_cloud-mirror-gen2 + KERNEL_SIZE := 5120k + KERNEL := kernel-bin | append-dtb | uImage none + KERNEL_INITRAMFS := kernel-bin | append-dtb | uImage none + IMAGES += image-cfs-factory.bin uImage-factory.bin + IMAGE/image-cfs-factory.bin := append-ubi + IMAGE/uImage-factory.bin := append-kernel +endef +TARGET_DEVICES += wd_cloud-mirror-gen2 From 8973c48515b758998c3870ceb94318cca1707896 Mon Sep 17 00:00:00 2001 From: "Anton Yu. Ivanusev" Date: Tue, 7 Jan 2025 20:38:09 +0500 Subject: [PATCH 135/173] ramips: mt76x8: add support for Keenetic Extra (KN-1711) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Specification: SoC: MediaTek MT7628AN RAM: 128 MB, ESMT M14D1G1664A (DDR2) Flash: 32MB, Winbond 25Q256JVFQ (Dual Boot, SPI) Switch: MediaTek MT7628AN, 5 ports 100 Mbps WiFi: MediaTek MT7603 2T2R/2.4GHz 802.11n and MediaTek MT7613AEN 2T2R/5GHz 802.11ac USB: 1 port USB 2.0 GPIO: 3 buttons (Wi-Fi, Reset, FN), 4 LEDs (Power, Internet, FN, Wi-Fi), USB port power controls Disassembly: At the bottom there are 4 screws hidden by rubber feet. After removing the screws, pry the gray plastic part around (it is secured with latches) and remove it. Serial Interface: The serial interface can be connected to the 4 pin dots to the left of the flash. Pins (from LEDs to LAN ports): 3.3V (do not connect) TX RX GND Settings: 115200, 8N1 Flashing via OEM recovery software: 1. Download the OEM recovery software from the manufacturer's website 2. Download the firmware image (for OpenWRT it is *-squashfs-factory.bin), rename it to KN-1711_recovery.bin 3. Replace the file in the fw folder OEM recovery software with the file from step 2. 4. Run the OEM recovery software and follow the instructions. Flashing via TFTP: 1. Connect your PC and router to port 1-4, configure PC interface using IP 192.168.1.2, mask 255.255.255.252 2. Serve the firmware image (for OpenWRT it is *-squashfs-factory.bin) renamed to KN-1711_recovery.bin via TFTP 3. Power up the router while pressing Reset button on the back 4. Release Restart button when Power LED starts blinking To revert back to OEM firmware: The return to the OEM firmware is carried out by using the methods described above with the help of the appropriate firmware image. When using OEM bootloader, the firmware image size cannot exceed the size of one OEM «Firmware_x» partition or Kernel + rootFS size. Signed-off-by: Anton Yu. Ivanusev Link: https://github.com/openwrt/openwrt/pull/17519 Signed-off-by: Hauke Mehrtens --- .../ramips/dts/mt7628an_keenetic_kn-1711.dts | 243 ++++++++++++++++++ target/linux/ramips/image/mt76x8.mk | 12 + .../mt76x8/base-files/etc/board.d/01_leds | 3 +- .../mt76x8/base-files/etc/board.d/02_network | 1 + 4 files changed, 258 insertions(+), 1 deletion(-) create mode 100644 target/linux/ramips/dts/mt7628an_keenetic_kn-1711.dts diff --git a/target/linux/ramips/dts/mt7628an_keenetic_kn-1711.dts b/target/linux/ramips/dts/mt7628an_keenetic_kn-1711.dts new file mode 100644 index 00000000000..c0350eb4942 --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_keenetic_kn-1711.dts @@ -0,0 +1,243 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +#include "mt7628an.dtsi" + +#include +#include +#include + +/ { + compatible = "keenetic,kn-1711", "mediatek,mt7628an-soc"; + model = "Keenetic KN-1711"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "USB-power"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-always-on; + }; + + leds { + compatible = "gpio-leds"; + + led_power: power { + function = LED_FUNCTION_POWER; + color = ; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + + internet { + function = LED_FUNCTION_WAN; + color = ; + gpios = <&gpio 38 GPIO_ACTIVE_LOW>; + }; + + wifi2 { + function = LED_FUNCTION_WLAN_2GHZ; + color = ; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + wifi5 { + function = LED_FUNCTION_WLAN_5GHZ; + color = ; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + }; + + + keys { + compatible = "gpio-keys"; + + fn { + label = "fn"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + reset { + label = "restart"; + gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 37 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + virtual_flash { + compatible = "mtd-concat"; + devices = <&firmware1 &firmware2>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x0 0x1CC0000>; + }; + }; + }; +}; + +&state_default { + gpio { + groups = "i2s", "i2c", "gpio", "refclk", "wdt", "wled_an"; + function = "gpio"; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <104000000>; + + partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-config"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "rf-eeprom"; + reg = <0x40000 0x10000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x400>; + }; + + eeprom_factory_400: eeprom@400 { + reg = <0x400 0x4da8>; + }; + + macaddr_factory_28: macaddr@28 { + reg = <0x28 0x6>; + }; + }; + }; + + firmware1: partition@50000 { + label = "firmware_1"; + reg = <0x50000 0xe60000>; + }; + + partition@eb0000 { + label = "config_1"; + reg = <0xeb0000 0x40000>; + read-only; + }; + + partition@ef0000 { + label = "storage"; + reg = <0xef0000 0x100000>; + read-only; + }; + + partition@ff0000 { + label = "dump"; + reg = <0xff0000 0x10000>; + read-only; + }; + + partition@1000000 { + label = "u-state"; + reg = <0x1000000 0x30000>; + read-only; + }; + + partition@1030000 { + label = "u-config_res"; + reg = <0x1030000 0x10000>; + read-only; + }; + + partition@1040000 { + label = "rf-eeprom_res"; + reg = <0x1040000 0x10000>; + read-only; + }; + + firmware2: partition@1050000 { + label = "firmware_2"; + reg = <0x1050000 0xe60000>; + }; + + partition@1EB0000 { + label = "Config_2"; + reg = <0x1eb0000 0x40000>; + read-only; + }; + }; + }; +}; + +ðernet { + nvmem-cells = <&macaddr_factory_28>; + nvmem-cell-names = "mac-address"; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&wmac { + status = "okay"; + + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&eeprom_factory_400>; + nvmem-cell-names = "eeprom"; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index 76b19515884..d63148cae4a 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -366,6 +366,18 @@ define Device/keenetic_kn-1613 endef TARGET_DEVICES += keenetic_kn-1613 +define Device/keenetic_kn-1711 + BLOCKSIZE := 64k + IMAGE_SIZE := 13434880 + DEVICE_VENDOR := Keenetic + DEVICE_MODEL := KN-1711 + DEVICE_PACKAGES := kmod-mt7615e kmod-mt7663-firmware-ap kmod-usb2 + IMAGES += factory.bin + IMAGE/factory.bin := $$(sysupgrade_bin) | pad-to $$$$(BLOCKSIZE) | \ + check-size | zyimage -d 0x801711 -v "KN-1711" +endef +TARGET_DEVICES += keenetic_kn-1711 + define Device/keenetic_kn-1713 BLOCKSIZE := 64k IMAGE_SIZE := 13434880 diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds index e13c5db50e6..b87062ae3c5 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds @@ -59,8 +59,9 @@ hiwifi,hc5761a) ucidef_set_led_switch "internet" "internet" "blue:internet" "switch0" "0x10" ;; keenetic,kn-1613|\ +keenetic,kn-1711|\ keenetic,kn-1713) - ucidef_set_led_switch "internet" "internet" "green:internet" "switch0" "0x01" + ucidef_set_led_switch "wan" "WAN" "green:wan" "switch0" "0x01" ;; mediatek,linkit-smart-7688) ucidef_set_led_wlan "wifi" "wifi" "orange:wifi" "phy0tpt" diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network index 994ed0009b5..496bb809ef9 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network @@ -45,6 +45,7 @@ ramips_setup_interfaces() hilink,hlk-7628n|\ hilink,hlk-7688a|\ hiwifi,hc5861b|\ + keenetic,kn-1711|\ kroks,kndrt31r16|\ skylab,skw92a|\ tplink,archer-c20-v4|\ From 433be50c945a62c8ce9947166e86a8f122b174a8 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 8 Jan 2025 22:57:10 +0800 Subject: [PATCH 136/173] uboot-envtools: update to v2025.01 Update to latest version. There are no patches that need to be refreshed. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17538 Signed-off-by: Hauke Mehrtens --- package/boot/uboot-envtools/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/boot/uboot-envtools/Makefile b/package/boot/uboot-envtools/Makefile index 61939be6de9..5b52c3b3959 100644 --- a/package/boot/uboot-envtools/Makefile +++ b/package/boot/uboot-envtools/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uboot-envtools PKG_DISTNAME:=u-boot -PKG_VERSION:=2024.07 +PKG_VERSION:=2025.01 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2 @@ -17,7 +17,7 @@ PKG_SOURCE_URL:= \ https://ftp.denx.de/pub/u-boot \ https://mirror.cyberbits.eu/u-boot \ ftp://ftp.denx.de/pub/u-boot -PKG_HASH:=f591da9ab90ef3d6b3d173766d0ddff90c4ed7330680897486117df390d83c8f +PKG_HASH:=cdef7d507c93f1bbd9f015ea9bc21fa074268481405501945abc6f854d5b686f PKG_SOURCE_SUBDIR:=$(PKG_DISTNAME)-$(PKG_VERSION) PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_DISTNAME)-$(PKG_VERSION) From 9a0f0611d2022fb21c400abfcf51c67493b5265a Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 8 Jan 2025 22:57:36 +0800 Subject: [PATCH 137/173] mkimage: update to v2025.01 Update to latest version. There are no patches that need to be refreshed. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17539 Signed-off-by: Hauke Mehrtens --- tools/mkimage/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/mkimage/Makefile b/tools/mkimage/Makefile index 0a1712bc678..18d7ea2caad 100644 --- a/tools/mkimage/Makefile +++ b/tools/mkimage/Makefile @@ -7,14 +7,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mkimage -PKG_VERSION:=2024.07 +PKG_VERSION:=2025.01 PKG_SOURCE:=u-boot-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:= \ https://mirror.cyberbits.eu/u-boot \ https://ftp.denx.de/pub/u-boot \ ftp://ftp.denx.de/pub/u-boot -PKG_HASH:=f591da9ab90ef3d6b3d173766d0ddff90c4ed7330680897486117df390d83c8f +PKG_HASH:=cdef7d507c93f1bbd9f015ea9bc21fa074268481405501945abc6f854d5b686f HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/u-boot-$(PKG_VERSION) From 0d1568246f6834e4b593b23d43524d4c16a29e82 Mon Sep 17 00:00:00 2001 From: Roland Reinl Date: Mon, 6 Jan 2025 08:33:36 +0100 Subject: [PATCH 138/173] mediatek: D-Link AQUILA PRO AI M60 A1: Fixed phy6 DTS settings Settings for phy6 can be simplified in the DTS Signed-off-by: Roland Reinl Link: https://github.com/openwrt/openwrt/pull/17430 Signed-off-by: Hauke Mehrtens --- .../linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts b/target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts index e805554a134..81634c7c08d 100644 --- a/target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts +++ b/target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts @@ -87,9 +87,8 @@ reset-post-delay-us = <1000000>; phy6: phy@6 { - compatible = "maxlinear,gpy211", "ethernet-phy-ieee802.3-c45"; + compatible = "ethernet-phy-ieee802.3-c45"; reg = <6>; - phy-mode = "2500base-x"; }; switch@1f { From d04f41e092294789b5add6816bb3b3bd7570a30d Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sun, 8 Dec 2024 04:08:38 +0100 Subject: [PATCH 139/173] ath79: teltonika-rut230: fix typo in "green:signal-strength4" LED It's missing a hyphen present in every other LED from the set. Set it to "green:signal-strength-4". Signed-off-by: Lech Perczak Link: https://github.com/openwrt/openwrt/pull/17503 Signed-off-by: Hauke Mehrtens --- target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts index c2c54b46629..192a7d2a045 100644 --- a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts +++ b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts @@ -68,7 +68,7 @@ }; signal-strength-4 { - label = "green:signal-strength4"; + label = "green:signal-strength-4"; gpios = <&gpio 27 GPIO_ACTIVE_HIGH>; }; From 7b9ca01109827368deb68b7d8217643b78b87cb9 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Mon, 6 Jan 2025 17:31:44 +0100 Subject: [PATCH 140/173] ath79: teltonika-rut230: fix failsafe boot without SIM tray Due to "SIM present" input defaulting to "button" type, it is interpreted as such when booting, and causes the system to enter failsafe, if the tray is missing. Similarly to rfkill switch on TP-Link WDR4300 and Archer C7, make it EV_SW instead, to stop it from interfering with the boot process. Signed-off-by: Lech Perczak Link: https://github.com/openwrt/openwrt/pull/17503 Signed-off-by: Hauke Mehrtens --- target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts index 192a7d2a045..73a6cc52ca5 100644 --- a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts +++ b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts @@ -36,6 +36,7 @@ sim-tray { label = "sim-tray"; + linux,input-type = ; linux,code = ; gpios = <&gpio 20 GPIO_ACTIVE_LOW>; debounce-interval = <60>; From f28010a79c653f0ac7183c3cf774ed70f8818935 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sat, 7 Dec 2024 04:27:18 +0100 Subject: [PATCH 141/173] ath79: teltonika-rut230: add 4G LED Teltonika RUT240 has an extra 4G status LED on GPIO21. Otherwise the hardware is fully compatible with RUT230 line. Attach the LED inside device tree. Signed-off-by: Lech Perczak Link: https://github.com/openwrt/openwrt/pull/17503 Signed-off-by: Hauke Mehrtens --- target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts index 73a6cc52ca5..aa8a2204700 100644 --- a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts +++ b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts @@ -83,6 +83,11 @@ gpios = <&gpio 24 GPIO_ACTIVE_HIGH>; }; + 4g { + label = "green:4g"; + gpios = <&gpio 21 GPIO_ACTIVE_HIGH>; + }; + lan { function = LED_FUNCTION_LAN; color = ; @@ -96,8 +101,6 @@ gpios = <&gpio 17 GPIO_ACTIVE_LOW>; /* GPIO 14 - ACTIVE HIGH for hwrev 0 */ }; - - /* 4G LED - GPIO21 ACTIVE_HIGH for RUT240 */ }; reg_usb_vbus: reg_usb_vbus { From 46a6f4968530f1f3b9d7ad0d3b1cac302ef45388 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sat, 4 Jan 2025 02:12:42 +0100 Subject: [PATCH 142/173] ath79: teltonika-rut230: drop reg_usb_vbus USB VBUS regulator was attached to GPIO19, which isn't in fact controlling the modem power itself, but rather modem power key - which has to be asserted high for at least 500ms, to start the modem. Keeping it high allows the modem to reboot upon shutdown - so it is desirable to control this line from userspace, for example - to allow clean modem shutdown down upon powering off the router part. Signed-off-by: Lech Perczak Link: https://github.com/openwrt/openwrt/pull/17503 Signed-off-by: Hauke Mehrtens --- target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts index aa8a2204700..abac2797753 100644 --- a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts +++ b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts @@ -102,15 +102,6 @@ /* GPIO 14 - ACTIVE HIGH for hwrev 0 */ }; }; - - reg_usb_vbus: reg_usb_vbus { - compatible = "regulator-fixed"; - regulator-name = "usb_vbus"; - regulator-min-microvolt = <5000000>; - regulator-max-microvolt = <5000000>; - gpios = <&gpio 19 GPIO_ACTIVE_HIGH>; - enable-active-high; - }; }; ð0 { @@ -197,7 +188,6 @@ &usb { dr_mode = "host"; - vbus-supply = <®_usb_vbus>; status = "okay"; }; From 852911a85dcaf69a8495153b2dabdf5f31efb5a6 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sat, 7 Dec 2024 04:34:00 +0100 Subject: [PATCH 143/173] ath79: teltonika-rut230: fully support digital output lines Remove GPIO hog for modem power, as well as define userspace GPIO switches for enabling and resetting the modem. While at that, define a switch for the external GPIO available on the power connector. Signed-off-by: Lech Perczak Link: https://github.com/openwrt/openwrt/pull/17503 Signed-off-by: Hauke Mehrtens --- target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts | 9 --------- .../generic/base-files/etc/board.d/03_gpio_switches | 5 +++++ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts index abac2797753..ee59cecabb3 100644 --- a/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts +++ b/target/linux/ath79/dts/ar9331_teltonika_rut230-v1.dts @@ -191,15 +191,6 @@ status = "okay"; }; -&gpio { - modem-power { - gpio-hog; - output-low; - gpios = <18 GPIO_ACTIVE_HIGH>; - line-name = "modem-power"; - }; -}; - &usb_phy { status = "okay"; }; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/03_gpio_switches b/target/linux/ath79/generic/base-files/etc/board.d/03_gpio_switches index d5b41dc0b80..fe71b7b3c40 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/ath79/generic/base-files/etc/board.d/03_gpio_switches @@ -48,6 +48,11 @@ dlink,dir-835-a1) librerouter,librerouter-v1) ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "513" "0" ;; +teltonika,rut230-v1) + ucidef_add_gpio_switch "DOUT" "DOUT" "524" "0" + ucidef_add_gpio_switch "modem_pwr" "Modem power" "531" "1" + ucidef_add_gpio_switch "modem_rst" "Modem reset" "530" "0" + ;; teltonika,rut955) ucidef_add_gpio_switch "sim_sel" "SIM select" "542" "1" ucidef_add_gpio_switch "DOUT1" "DOUT1 (OC)" "543" "0" From f39115632c69ffae50b1c37937d80e934a27d26d Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sun, 8 Dec 2024 04:31:36 +0100 Subject: [PATCH 144/173] ath79: teltonika-rut230: include kmod-usb2 in image Otherwise USB PHY, controller and the built-in modem won't probe. Signed-off-by: Lech Perczak Link: https://github.com/openwrt/openwrt/pull/17503 Signed-off-by: Hauke Mehrtens --- target/linux/ath79/image/generic.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 74ef0d2da08..88915c650c9 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -3063,8 +3063,8 @@ define Device/teltonika_rut230-v1 DEVICE_VENDOR := Teltonika DEVICE_MODEL := RUT230 DEVICE_VARIANT := v1 - DEVICE_PACKAGES := kmod-usb-chipidea2 kmod-usb-acm kmod-usb-net-qmi-wwan \ - uqmi -uboot-envtools + DEVICE_PACKAGES := kmod-usb2 kmod-usb-chipidea2 kmod-usb-acm \ + kmod-usb-net-qmi-wwan uqmi -uboot-envtools IMAGE_SIZE := 15552k TPLINK_HWID := 0x32200002 TPLINK_HWREV := 0x1 From 11ad73f97d35518b3b4def26a62fa78ae1b3dfe1 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sat, 7 Dec 2024 04:39:13 +0100 Subject: [PATCH 145/173] ath79: teltonika-rut230: include kmod-usb-serial-option in image Newer modems used in RUT240 (Quectel EC25 and MeiG SLM750) use the "option" driver instead of CDC-ACM. Include it in the image too. Signed-off-by: Lech Perczak Link: https://github.com/openwrt/openwrt/pull/17503 Signed-off-by: Hauke Mehrtens --- target/linux/ath79/image/generic.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 88915c650c9..3f813df2537 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -3064,7 +3064,7 @@ define Device/teltonika_rut230-v1 DEVICE_MODEL := RUT230 DEVICE_VARIANT := v1 DEVICE_PACKAGES := kmod-usb2 kmod-usb-chipidea2 kmod-usb-acm \ - kmod-usb-net-qmi-wwan uqmi -uboot-envtools + kmod-usb-net-qmi-wwan kmod-usb-serial-option uqmi -uboot-envtools IMAGE_SIZE := 15552k TPLINK_HWID := 0x32200002 TPLINK_HWREV := 0x1 From 62af69f9e4611182ca529ab4bf27a105a77df2a7 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sat, 7 Dec 2024 04:36:52 +0100 Subject: [PATCH 146/173] ath79: teltonika-rut230: add RUT240 model alias Define RUT240 as alternative name, to explicitly show the device is supported using existing image. Signed-off-by: Lech Perczak Link: https://github.com/openwrt/openwrt/pull/17503 Signed-off-by: Hauke Mehrtens --- target/linux/ath79/image/generic.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 3f813df2537..b15b8b0efeb 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -3063,6 +3063,9 @@ define Device/teltonika_rut230-v1 DEVICE_VENDOR := Teltonika DEVICE_MODEL := RUT230 DEVICE_VARIANT := v1 + DEVICE_ALT0_VENDOR := Teltonika + DEVICE_ALT0_MODEL := RUT240 + DEVICE_ALT0_VARIANT := v1 DEVICE_PACKAGES := kmod-usb2 kmod-usb-chipidea2 kmod-usb-acm \ kmod-usb-net-qmi-wwan kmod-usb-serial-option uqmi -uboot-envtools IMAGE_SIZE := 15552k From 5ce1af9539da667f62dc3cb426f9ec36e53fb54e Mon Sep 17 00:00:00 2001 From: Rany Hany Date: Sun, 12 Jan 2025 22:41:48 +0000 Subject: [PATCH 147/173] hostapd: backport upstream patch to fix setting BSS color MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this patch, we get the following error: Mon Dec 23 11:35:44 2024 daemon.err hostapd: nl80211: kernel reports: integer out of range As updating hostapd would be too complex and requires further testing, we backport this simple upstream fix instead. Fixes: https://github.com/openwrt/openwrt/issues/16680 Signed-off-by: Rany Hany Link: https://github.com/openwrt/openwrt/pull/17590 Signed-off-by: Petr Štetiar --- package/network/services/hostapd/Makefile | 2 +- .../hostapd/patches/763-radius-wispr.patch | 2 +- .../803-hostapd-fix-80211be-build.patch | 2 +- ...learing-up-settings-for-color-switch.patch | 28 +++++++++++++++++++ 4 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 package/network/services/hostapd/patches/804-hostapd-Fix-clearing-up-settings-for-color-switch.patch diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 44c73586cac..58c18a9088b 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE_URL:=https://w1.fi/hostap.git PKG_SOURCE_PROTO:=git diff --git a/package/network/services/hostapd/patches/763-radius-wispr.patch b/package/network/services/hostapd/patches/763-radius-wispr.patch index da81a623e76..f5c4668e13b 100644 --- a/package/network/services/hostapd/patches/763-radius-wispr.patch +++ b/package/network/services/hostapd/patches/763-radius-wispr.patch @@ -36,7 +36,7 @@ sm->eap_if->aaaFail = true; --- a/src/ap/sta_info.h +++ b/src/ap/sta_info.h -@@ -95,6 +95,7 @@ struct sta_info { +@@ -94,6 +94,7 @@ struct sta_info { u8 supported_rates[WLAN_SUPP_RATES_MAX]; int supported_rates_len; u8 qosinfo; /* Valid when WLAN_STA_WMM is set */ diff --git a/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch b/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch index cbd6298d9d3..f197b71bd7b 100644 --- a/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch +++ b/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch @@ -25,7 +25,7 @@ + --- a/src/ap/sta_info.h +++ b/src/ap/sta_info.h -@@ -408,23 +408,8 @@ int ap_sta_re_add(struct hostapd_data *h +@@ -409,23 +409,8 @@ int ap_sta_re_add(struct hostapd_data *h void ap_free_sta_pasn(struct hostapd_data *hapd, struct sta_info *sta); diff --git a/package/network/services/hostapd/patches/804-hostapd-Fix-clearing-up-settings-for-color-switch.patch b/package/network/services/hostapd/patches/804-hostapd-Fix-clearing-up-settings-for-color-switch.patch new file mode 100644 index 00000000000..87d68911c79 --- /dev/null +++ b/package/network/services/hostapd/patches/804-hostapd-Fix-clearing-up-settings-for-color-switch.patch @@ -0,0 +1,28 @@ +From 161327f91d956771996c96ea1b6e4e1cb8dc074c Mon Sep 17 00:00:00 2001 +From: Stone Zhang +Date: Mon, 14 Oct 2024 18:47:32 +0800 +Subject: [PATCH] hostapd: Fix clearing up settings for color switch + +Settings for color switch (struct cca_settings settings) +is used without zero clearing, which causes the member +settings->ubpr->unsol_bcast_probe_resp_intervalettings +to be a random value. It is againsts the NLA policy of +NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_INT and causes +BSS color switch failure. + +Fixes: 654d2395dddf ("BSS coloring: Handling of collision events and triggering CCA") +Signed-off-by: Stone Zhang +--- + src/ap/hostapd.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -4813,6 +4813,7 @@ static void hostapd_switch_color_timeout + struct cca_settings settings; + int ret; + ++ os_memset(&settings, 0, sizeof(settings)); + hostapd_cleanup_cca_params(bss); + bss->cca_color = r; + bss->cca_count = 10; From f310b8c74e7232f135c5b2911513e9cd2fb81b85 Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Mon, 13 Jan 2025 16:00:05 +0800 Subject: [PATCH 148/173] mediatek: filogic: add support for Huasifei WH3000 The Huasifei WH3000 eMMC model (aka Fudy MT3000) is a Wi-Fi 6 5G cellular router based on MediaTek MT7981A SoC. Specifications: SoC: Filogic 820 MT7981A (1.3GHz) RAM: DDR4 1GB Flash: eMMC 8G WiFi: 2.4GHz and 5GHz with 3 antennas Ethernet: 1x WAN (10/100/1000M) 1x LAN (10/100/1000/2500M) USB: 1x USB 3.0 port UART: 3.3V, TX, RX, GND / 115200 8N1 Installation via U-Boot rescue: Connect to the GbE eth port, then press and hold reset button while booting the device. Wait for the Internet led to blink 5 times, release reset button. The rescue page is accessible via http://192.168.1.1 Select the OpenWrt sysupgrade image and start upgrade. Wait for the router to flash new firmware and reboot. --- .../uboot-envtools/files/mediatek_filogic | 5 +- .../dts/mt7981b-huasifei-wh3000-emmc.dts | 199 ++++++++++++++++++ .../filogic/base-files/etc/board.d/01_leds | 4 + .../filogic/base-files/etc/board.d/02_network | 3 +- .../base-files/lib/upgrade/platform.sh | 2 + target/linux/mediatek/image/filogic.mk | 17 ++ 6 files changed, 226 insertions(+), 4 deletions(-) create mode 100644 target/linux/mediatek/dts/mt7981b-huasifei-wh3000-emmc.dts diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index bff42bfba2f..349a48a4234 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -62,6 +62,7 @@ glinet,gl-mt2500|\ glinet,gl-mt6000|\ glinet,gl-x3000|\ glinet,gl-xe3000|\ +huasifei,wh3000-emmc|\ nradio,c8-668gl) local envdev=$(find_mmc_part "u-boot-env") ubootenv_add_uci_config "$envdev" "0x0" "0x80000" @@ -94,6 +95,7 @@ konka,komi-a31) cetron,ct3003|\ edgecore,eap111|\ h3c,magic-nx30-pro-nmbm|\ +livinet,zr-3020|\ netgear,wax220|\ zbtlink,zbt-z8102ax|\ zbtlink,zbt-z8103ax) @@ -112,9 +114,6 @@ gatonetworks,gdsp) glinet,gl-mt3000) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000" ;; -livinet,zr-3020) - ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" "1" - ;; mercusys,mr90x-v1|\ routerich,ax3000|\ tenbay,wr3000k|\ diff --git a/target/linux/mediatek/dts/mt7981b-huasifei-wh3000-emmc.dts b/target/linux/mediatek/dts/mt7981b-huasifei-wh3000-emmc.dts new file mode 100644 index 00000000000..9dd32d9e7dd --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-huasifei-wh3000-emmc.dts @@ -0,0 +1,199 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include +#include +#include + +#include "mt7981.dtsi" + +/ { + model = "Huasifei WH3000 eMMC version"; + compatible = "huasifei,wh3000-emmc", "mediatek,mt7981"; + + aliases { + serial0 = &uart0; + led-boot = &wlan_led; + led-failsafe = &wlan_led; + led-upgrade = &wlan_led; + }; + + chosen { + bootargs = "root=PARTLABEL=rootfs rootwait rootfstype=squashfs,f2fs"; + stdout-path = "serial0:115200n8"; + }; + + memory@40000000 { + reg = <0 0x40000000 0 0x40000000>; + }; + + gpio-keys { + compatible = "gpio-keys"; + + button-mode { + label = "mode"; + linux,code = ; + linux,input-type = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + button-reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wan_led: led-0 { + function = LED_FUNCTION_WAN; + color = ; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + + wlan_led: led-1 { + function = LED_FUNCTION_WLAN; + color = ; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + }; + + usb_vbus: regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "usb-vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + regulator-boot-on; + }; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins>; + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + nvmem-cells = <&macaddr_factory_4 2>; + nvmem-cell-names = "mac-address"; + phy-mode = "2500base-x"; + phy-handle = <&phy1>; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + nvmem-cells = <&macaddr_factory_4 3>; + nvmem-cell-names = "mac-address"; + phy-mode = "gmii"; + phy-handle = <&int_gbe_phy>; + }; +}; + +&mdio_bus { + phy1: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <1>; + interrupts = <38 IRQ_TYPE_LEVEL_LOW>; + interrupt-parent = <&pio>; + reset-assert-us = <100000>; + reset-deassert-us = <100000>; + reset-gpios = <&pio 39 GPIO_ACTIVE_LOW>; + realtek,aldps-enable; + }; +}; + +&mmc0 { + bus-width = <8>; + cap-mmc-highspeed; + max-frequency = <52000000>; + no-sd; + no-sdio; + non-removable; + pinctrl-names = "default", "state_uhs"; + pinctrl-0 = <&mmc0_pins_default>; + pinctrl-1 = <&mmc0_pins_uhs>; + vmmc-supply = <®_3p3v>; + status = "okay"; + + card@0 { + compatible = "mmc-card"; + reg = <0>; + + block { + compatible = "block-device"; + + partitions { + block-partition-factory { + partname = "factory"; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + + macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + }; + }; + }; +}; + +&pio { + mmc0_pins_default: mmc0-pins-default { + mux { + function = "flash"; + groups = "emmc_45"; + }; + }; + + mmc0_pins_uhs: mmc0-pins-uhs { + mux { + function = "flash"; + groups = "emmc_45"; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; + status = "okay"; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_factory_4 1>; + nvmem-cell-names = "mac-address"; + }; +}; + +&usb_phy { + status = "okay"; +}; + +&xhci { + status = "okay"; + vbus-supply = <&usb_vbus>; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds index 8da2d0aecb7..c4a91279136 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds @@ -49,6 +49,10 @@ glinet,gl-xe3000) ucidef_set_led_netdev "wlan2g" "WLAN2G" "green:wifi2g" "phy0-ap0" ucidef_set_led_netdev "wlan5g" "WLAN5G" "green:wifi5g" "phy1-ap0" ;; +huasifei,wh3000-emmc) + ucidef_set_led_netdev "wan" "WAN" "red:wan" "eth1" + ucidef_set_led_netdev "wlan" "WLAN" "white:wlan" "phy1-ap0" + ;; imou,lc-hx3001|\ nokia,ea0326gmp) ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1" "link" diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index bf38a5c3472..53215cc9687 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -70,7 +70,8 @@ mediatek_setup_interfaces() ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 sfp2" "sfp1 wan" ;; bananapi,bpi-r3-mini|\ - edgecore,eap111) + edgecore,eap111|\ + huasifei,wh3000-emmc) ucidef_set_interfaces_lan_wan eth0 eth1 ;; bananapi,bpi-r4) diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index a0c0efecda6..3bfed4f893a 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -105,6 +105,7 @@ platform_do_upgrade() { glinet,gl-mt6000|\ glinet,gl-x3000|\ glinet,gl-xe3000|\ + huasifei,wh3000-emmc|\ smartrg,sdg-8612|\ smartrg,sdg-8614|\ smartrg,sdg-8622|\ @@ -229,6 +230,7 @@ platform_copy_config() { glinet,gl-mt6000|\ glinet,gl-x3000|\ glinet,gl-xe3000|\ + huasifei,wh3000-emmc|\ jdcloud,re-cp-03|\ nradio,c8-668gl|\ smartrg,sdg-8612|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 38ec736a4c2..e6c47f56ac1 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -954,6 +954,23 @@ define Device/h3c_magic-nx30-pro-nmbm endef TARGET_DEVICES += h3c_magic-nx30-pro-nmbm +define Device/huasifei_wh3000-emmc + DEVICE_VENDOR := Huasifei + DEVICE_MODEL := WH3000 eMMC + DEVICE_ALT0_VENDOR := Fudy + DEVICE_ALT0_MODEL := MT3000 + DEVICE_DTS := mt7981b-huasifei-wh3000-emmc + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware f2fsck mkf2fs \ + kmod-usb-net-cdc-mbim kmod-usb-net-qmi-wwan kmod-usb-serial-option \ + kmod-usb3 automount uqmi + KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += huasifei_wh3000-emmc + define Device/imou_lc-hx3001 DEVICE_VENDOR := Imou DEVICE_MODEL := LC-HX3001 From bc79a29f8a8d043e496fba6821ef91922190cb1f Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Mon, 13 Jan 2025 20:41:23 +0800 Subject: [PATCH 149/173] mediatek: add missing dependency to huasifei wh3000 emmc Signed-off-by: Tianling Shen --- target/linux/mediatek/image/filogic.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index e6c47f56ac1..678bb145214 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -961,9 +961,9 @@ define Device/huasifei_wh3000-emmc DEVICE_ALT0_MODEL := MT3000 DEVICE_DTS := mt7981b-huasifei-wh3000-emmc DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware f2fsck mkf2fs \ + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware \ kmod-usb-net-cdc-mbim kmod-usb-net-qmi-wwan kmod-usb-serial-option \ - kmod-usb3 automount uqmi + kmod-usb3 automount f2fsck mkf2fs uqmi KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb KERNEL_INITRAMFS := kernel-bin | lzma | \ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k From ac1ad1a7ad6bb3a528def4154e91dd398fda8db5 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Mon, 13 Jan 2025 15:12:38 +0100 Subject: [PATCH 150/173] ipq40xx: turn on Teltonika RUTX50 modem by default Turn on the 5G modem of the RUTX50 on by default. This allows to make the modem detectable on a fresh installation OOTB without further intervention. Signed-off-by: David Bauer --- .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts index 56d920a6dde..a2974597950 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts @@ -29,7 +29,7 @@ gpio_modem_power { gpio-export,name = "modem_power"; - gpio-export,output = <0>; + gpio-export,output = <1>; gpios = <&shift_io 9 GPIO_ACTIVE_HIGH>; }; From 08c93512fe39ac25f78fb2ab0f32cb2a830c5b70 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Mon, 13 Jan 2025 15:18:31 +0100 Subject: [PATCH 151/173] ipq40xx: use correct wired MAC-addresses for RUTX50 The Teltonika RUTX50 mac-addresses on its wired interfaces are currently random on every boot. Setting the mac-addresses from device-tree using nvmem does not work, as the vendor bootloader mangles the mtd partitions, removing the nvmem-cells property. To remedy the random mac-addresse, set the correct ones in preinit. Signed-off-by: David Bauer --- .../lib/preinit/05_set_iface_mac_ipq40xx.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh b/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh index 1ede544aacc..092f9da4407 100644 --- a/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh +++ b/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh @@ -43,6 +43,17 @@ preinit_set_mac_address() { ip link set dev sw-eth1 address "$base_mac" ip link set dev sw-eth2 address $(macaddr_add "$base_mac" 1) ;; + teltonika,rutx50) + # Vendor Bootloader removes nvmem-cells from partition, + # so this needs to be done here. + base_mac="$(mtd_get_mac_binary 0:CONFIG 0x0)" + ip link set dev eth0 address "$base_mac" + ip link set dev lan1 address "$base_mac" + ip link set dev lan2 address "$base_mac" + ip link set dev lan3 address "$base_mac" + ip link set dev lan4 address "$base_mac" + ip link set dev wan address "$(macaddr_add "$base_mac" 1)" + ;; zyxel,nbg6617) base_mac=$(cat /sys/class/net/eth0/address) ip link set dev eth0 address $(macaddr_add "$base_mac" 2) From 54463f1e2e17d14a24d3504acea8107f45228f27 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Mon, 13 Jan 2025 15:18:51 +0100 Subject: [PATCH 152/173] ipq40xx: enable WiFi LED for Teltonika RUTX50 Enable activity on the WiFi LEDs of the Teltonika RUTX50 like other boards in the ipq40xx target. Signed-off-by: David Bauer --- .../files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts index a2974597950..ae244bd126a 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-rutx50.dts @@ -103,11 +103,13 @@ led-10 { label = "green:wifi2g"; gpios = <&shift_io 12 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy0tpt"; }; led-11 { label = "green:wifi5g"; gpios = <&shift_io 13 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy1tpt"; }; }; From 51272fcd004955198265f030707aac1dd9794b98 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Mon, 13 Jan 2025 21:52:19 +0800 Subject: [PATCH 153/173] mediatek: add ubootmod layout for cudy tr3000 v1 This allows us to use the full size of nand, which increases ubi size from 64M to 122.25M. If you are at factory firmware, please refer commit 63b8d98dd0d2 ("mediatek: add support for Cudy TR3000 v1") to boot into OpenWrt initramfs (stock layout version). Flash instructions: 1. Login into the device and backup everything, especially 'Factory' part. 1. Unlock mtd partitions: apk update && apk add kmod-mtd-rw insmod mtd-rw i_want_a_brick=1 3. Write new BL2 and FIP mtd write openwrt-mediatek-filogic-cudy_tr3000-v1-ubootmod-preloader.bin BL2 mtd write openwrt-mediatek-filogic-cudy_tr3000-v1-ubootmod-bl31-uboot.fip FIP 4. Set static IP on your PC: IP 192.168.1.254/24, GW 192.168.1.1 5. Serve OpenWrt initramfs image using TFTP server. 6. Cut off the power and re-engage, wait for TFTP recovery to complete. 7. After OpenWrt has booted, perform sysupgrade. Signed-off-by: Tianling Shen --- .../arm-trusted-firmware-mediatek/Makefile | 17 +- .../uboot-envtools/files/mediatek_filogic | 1 + package/boot/uboot-mediatek/Makefile | 12 + .../patches/448-add-cudy_tr3000-v1.patch | 330 ++++++++++++++++++ .../dts/mt7981b-cudy-tr3000-v1-ubootmod.dts | 24 ++ .../mediatek/dts/mt7981b-cudy-tr3000-v1.dts | 234 +------------ .../mediatek/dts/mt7981b-cudy-tr3000-v1.dtsi | 214 ++++++++++++ target/linux/mediatek/image/filogic.mk | 25 ++ 8 files changed, 636 insertions(+), 221 deletions(-) create mode 100644 package/boot/uboot-mediatek/patches/448-add-cudy_tr3000-v1.patch create mode 100644 target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1-ubootmod.dts create mode 100644 target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dtsi diff --git a/package/boot/arm-trusted-firmware-mediatek/Makefile b/package/boot/arm-trusted-firmware-mediatek/Makefile index 3046a01a586..59ee49e71c2 100644 --- a/package/boot/arm-trusted-firmware-mediatek/Makefile +++ b/package/boot/arm-trusted-firmware-mediatek/Makefile @@ -35,6 +35,8 @@ define Trusted-Firmware-A/Default DRAM_USE_COMB:= RAM_BOOT_UART_DL:= USE_UBI:= + FIP_OFFSET:= + FIP_SIZE:= endef define Trusted-Firmware-A/mt7622-nor-1ddr @@ -221,6 +223,16 @@ define Trusted-Firmware-A/mt7981-spim-nand-ddr3 DDR_TYPE:=ddr3 endef +define Trusted-Firmware-A/mt7981-cudy-tr3000-v1 + NAME:=Cudy TR3000 v1 (SPI-NAND via SPIM, DDR3) + BOOT_DEVICE:=spim-nand + BUILD_SUBTARGET:=filogic + PLAT:=mt7981 + DDR_TYPE:=ddr3 + FIP_OFFSET:=0x3c0000 + FIP_SIZE:=0x200000 +endef + define Trusted-Firmware-A/mt7986-ram-ddr4 NAME:=MediaTek MT7986 (RAM, DDR4) BOOT_DEVICE:=ram @@ -534,6 +546,7 @@ TFA_TARGETS:= \ mt7981-ram-ddr4 \ mt7981-emmc-ddr4 \ mt7981-spim-nand-ddr4 \ + mt7981-cudy-tr3000-v1 \ mt7986-ram-ddr3 \ mt7986-emmc-ddr3 \ mt7986-nor-ddr3 \ @@ -582,7 +595,9 @@ TFA_MAKE_FLAGS += \ $(if $(USE_UBI),UBI=1 $(if $(findstring mt7622,$(PLAT)),OVERRIDE_UBI_START_ADDR=0x80000)) \ $(if $(USE_UBI),UBI=1 $(if $(findstring mt7981,$(PLAT)),OVERRIDE_UBI_START_ADDR=0x100000)) \ $(if $(USE_UBI),UBI=1 $(if $(findstring mt7986,$(PLAT)),OVERRIDE_UBI_START_ADDR=0x200000)) \ - $(if $(RAM_BOOT_UART_DL),bl2,all) + $(if $(RAM_BOOT_UART_DL),bl2,all) \ + $(if $(FIP_OFFSET),OVERRIDE_FIP_BASE=$(FIP_OFFSET)) \ + $(if $(FIP_SIZE),OVERRIDE_FIP_SIZE=$(FIP_SIZE)) define Package/trusted-firmware-a-ram/install $(INSTALL_DIR) $(STAGING_DIR_IMAGE) diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 349a48a4234..b6ccf58752c 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -36,6 +36,7 @@ case "$board" in abt,asr3000|\ cetron,ct3003-ubootmod|\ cmcc,a10|\ +cudy,tr3000-v1-ubootmod|\ h3c,magic-nx30-pro|\ imou,lc-hx3001|\ jcg,q30-pro|\ diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index 9ecd3bd2460..e0b50f481bc 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -279,6 +279,17 @@ define U-Boot/mt7981_cmcc_rax3000m-nand DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr4 endef +define U-Boot/mt7981_cudy_tr3000-v1 + NAME:=Cudy TR3000 v1 + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=cudy_tr3000-v1-ubootmod + UBOOT_CONFIG:=mt7981_cudy_tr3000-v1 + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=cudy-tr3000-v1 + BL2_SOC:=mt7981 + DEPENDS:=+trusted-firmware-a-mt7981-cudy-tr3000-v1 +endef + define U-Boot/mt7981_glinet_gl-x3000 NAME:=GL.iNet GL-X3000 BUILD_SUBTARGET:=filogic @@ -921,6 +932,7 @@ UBOOT_TARGETS := \ mt7981_cmcc_a10 \ mt7981_cmcc_rax3000m-emmc \ mt7981_cmcc_rax3000m-nand \ + mt7981_cudy_tr3000-v1 \ mt7981_gatonetworks_gdsp \ mt7981_glinet_gl-x3000 \ mt7981_glinet_gl-xe3000 \ diff --git a/package/boot/uboot-mediatek/patches/448-add-cudy_tr3000-v1.patch b/package/boot/uboot-mediatek/patches/448-add-cudy_tr3000-v1.patch new file mode 100644 index 00000000000..66a8518eb89 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/448-add-cudy_tr3000-v1.patch @@ -0,0 +1,330 @@ +--- /dev/null ++++ b/configs/mt7981_cudy_tr3000-v1_defconfig +@@ -0,0 +1,107 @@ ++CONFIG_ARM=y ++CONFIG_SYS_HAS_NONCACHED_MEMORY=y ++CONFIG_POSITION_INDEPENDENT=y ++CONFIG_ARCH_MEDIATEK=y ++CONFIG_TEXT_BASE=0x41e00000 ++CONFIG_SYS_MALLOC_F_LEN=0x4000 ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_DEFAULT_DEVICE_TREE="mt7981-cudy-tr3000-v1" ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_TARGET_MT7981=y ++CONFIG_PRE_CON_BUF_ADDR=0x4007EF00 ++CONFIG_DEBUG_UART_BASE=0x11002000 ++CONFIG_DEBUG_UART_CLOCK=40000000 ++CONFIG_SYS_LOAD_ADDR=0x46000000 ++CONFIG_DEBUG_UART=y ++CONFIG_FIT=y ++CONFIG_BOOTDELAY=30 ++CONFIG_AUTOBOOT_KEYED=y ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981-cudy-tr3000-v1.dtb" ++CONFIG_LOGLEVEL=7 ++CONFIG_PRE_CONSOLE_BUFFER=y ++CONFIG_LOG=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_PROMPT="MT7981> " ++CONFIG_CMD_CPU=y ++CONFIG_CMD_LICENSE=y ++CONFIG_CMD_BOOTMENU=y ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_ERASEENV=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_CMD_STRINGS=y ++CONFIG_CMD_DM=y ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_GPT=y ++CONFIG_CMD_MTD=y ++CONFIG_CMD_PART=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_LINK_LOCAL=y ++CONFIG_CMD_PXE=y ++CONFIG_CMD_CACHE=y ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 ++CONFIG_CMD_UUID=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_SMC=y ++CONFIG_CMD_UBI=y ++CONFIG_CMD_UBI_RENAME=y ++CONFIG_OF_EMBED=y ++CONFIG_ENV_OVERWRITE=y ++CONFIG_ENV_IS_IN_UBI=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_ENV_UBI_PART="ubi" ++CONFIG_ENV_UBI_VOLUME="ubootenv" ++CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2" ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_DEFAULT_ENV_FILE="cudy_tr3000-v1_env" ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y ++CONFIG_VERSION_VARIABLE=y ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_NETCONSOLE=y ++CONFIG_USE_IPADDR=y ++CONFIG_IPADDR="192.168.1.1" ++CONFIG_USE_SERVERIP=y ++CONFIG_SERVERIP="192.168.1.254" ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_CLK=y ++CONFIG_GPIO_HOG=y ++CONFIG_LED=y ++CONFIG_LED_BLINK=y ++CONFIG_LED_GPIO=y ++# CONFIG_MMC is not set ++CONFIG_MTD=y ++CONFIG_DM_MTD=y ++CONFIG_MTD_SPI_NAND=y ++CONFIG_MTD_UBI_FASTMAP=y ++CONFIG_PHY_FIXED=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PHY=y ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7981=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_REGULATOR_GPIO=y ++CONFIG_RAM=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++CONFIG_DM_SPI=y ++CONFIG_MTK_SPIM=y ++CONFIG_ZSTD=y ++CONFIG_HEXDUMP=y ++CONFIG_LMB_MAX_REGIONS=64 +--- /dev/null ++++ b/arch/arm/dts/mt7981-cudy-tr3000-v1.dts +@@ -0,0 +1,160 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later ++ ++/dts-v1/; ++#include "mt7981.dtsi" ++#include ++#include ++ ++/ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ model = "Cudy TR3000 v1"; ++ compatible = "mediatek,mt7981", "mediatek,mt7981-rfb"; ++ ++ chosen { ++ stdout-path = &uart0; ++ tick-timer = &timer0; ++ }; ++ ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x20000000>; ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ ++ button-reset { ++ label = "reset"; ++ linux,code = ; ++ gpios = <&gpio 1 GPIO_ACTIVE_LOW>; ++ }; ++ ++ button-mode { ++ label = "mode"; ++ linux,code = ; ++ linux,input-type = ; ++ gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; ++ debounce-interval = <60>; ++ }; ++ }; ++ ++ gpio-leds { ++ compatible = "gpio-leds"; ++ ++ led_status: led-0 { ++ label = "red:power"; ++ gpios = <&gpio 11 GPIO_ACTIVE_LOW>; ++ default-state = "on"; ++ }; ++ ++ led-1 { ++ label = "white:status"; ++ gpios = <&gpio 10 GPIO_ACTIVE_LOW>; ++ default-state = "off"; ++ }; ++ }; ++}; ++ ++ð { ++ status = "okay"; ++ mediatek,gmac-id = <1>; ++ phy-mode = "gmii"; ++ phy-handle = <&phy0>; ++ ++ mdio { ++ phy0: ethernet-phy@0 { ++ compatible = "ethernet-phy-id03a2.9461"; ++ reg = <0x0>; ++ phy-mode = "gmii"; ++ }; ++ }; ++}; ++ ++&pinctrl { ++ spi_flash_pins: spi0-pins-func-1 { ++ mux { ++ function = "flash"; ++ groups = "spi0", "spi0_wp_hold"; ++ }; ++ ++ conf-pu { ++ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; ++ drive-strength = ; ++ bias-pull-up = ; ++ }; ++ ++ conf-pd { ++ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; ++ drive-strength = ; ++ bias-pull-down = ; ++ }; ++ }; ++}; ++ ++&spi0 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi_flash_pins>; ++ status = "okay"; ++ must_tx; ++ enhance_timing; ++ dma_ext; ++ ipm_design; ++ support_quad; ++ tick_dly = <2>; ++ sample_sel = <0>; ++ ++ spi_nand@0 { ++ compatible = "spi-nand"; ++ reg = <0>; ++ spi-max-frequency = <52000000>; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "bl2"; ++ reg = <0x0 0x100000>; ++ }; ++ ++ partition@100000 { ++ label = "u-boot-env"; ++ reg = <0x100000 0x80000>; ++ }; ++ ++ partition@180000 { ++ label = "factory"; ++ reg = <0x180000 0x200000>; ++ }; ++ ++ partition@380000 { ++ label = "bdinfo"; ++ reg = <0x380000 0x40000>; ++ }; ++ ++ partition@3c0000 { ++ label = "fip"; ++ reg = <0x3c0000 0x200000>; ++ }; ++ ++ partition@5c0000 { ++ label = "ubi"; ++ reg = <0x5c0000 0x7a40000>; ++ compatible = "linux,ubi"; ++ }; ++ }; ++ }; ++}; ++ ++&uart0 { ++ mediatek,force-highspeed; ++ status = "okay"; ++}; ++ ++&watchdog { ++ status = "disabled"; ++}; +--- /dev/null ++++ b/cudy_tr3000-v1_env +@@ -0,0 +1,54 @@ ++ipaddr=192.168.1.1 ++serverip=192.168.1.254 ++loadaddr=0x46000000 ++console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0 ++bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi ++bootconf=config-1 ++bootdelay=0 ++bootfile=immortalwrt-mediatek-filogic-cudy_tr3000-v1-ubootmod-initramfs-recovery.itb ++bootfile_bl2=immortalwrt-mediatek-filogic-cudy_tr3000-v1-ubootmod-preloader.bin ++bootfile_fip=immortalwrt-mediatek-filogic-cudy_tr3000-v1-ubootmod-bl31-uboot.fip ++bootfile_upg=immortalwrt-mediatek-filogic-cudy_tr3000-v1-ubootmod-squashfs-sysupgrade.itb ++bootled_pwr=red:power ++bootled_rec=white:status ++bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60 ++bootmenu_default=0 ++bootmenu_delay=0 ++bootmenu_title= ( ( ( OpenWrt ) ) ) ++bootmenu_0=Initialize environment.=run _firstboot ++bootmenu_0d=Run default boot command.=run boot_default ++bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return ++bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return ++bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return ++bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_6=Load BL31+U-Boot FIP via TFTP then write to NAND.=run boot_tftp_write_fip ; run bootmenu_confirm_return ++bootmenu_7=Load BL2 preloader via TFTP then write to NAND.=run boot_tftp_write_bl2 ; run bootmenu_confirm_return ++bootmenu_8=Reboot.=reset ++bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset ++boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu ++boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever ++boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off ++boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off ++boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever ++boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done ++boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf ++boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory ++boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2 ++reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800 ++mtd_write_fip=mtd erase fip && mtd write fip $loadaddr ++mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr ++ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic || run ubi_format ++ubi_format=ubi detach ; mtd erase ubi && ubi part ubi ; reset ++ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi ++ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs ++ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery ++ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data ++ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize ++ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize ++_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv ++_firstboot=setenv _firstboot ; run _switch_to_menu ; run _init_env ; run boot_first ++_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title ++_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver" diff --git a/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1-ubootmod.dts b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1-ubootmod.dts new file mode 100644 index 00000000000..07e706dc3a4 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1-ubootmod.dts @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; +#include "mt7981b-cudy-tr3000-v1.dtsi" + +/ { + model = "Cudy TR3000 v1 (OpenWrt U-Boot layout)"; + compatible = "cudy,tr3000-v1-ubootmod", "mediatek,mt7981"; +}; + +&chosen { + bootargs = "root=/dev/fit0 rootwait"; + rootdisk = <&ubi_rootdisk>; +}; + +&ubi { + reg = <0x5c0000 0x7a40000>; + + volumes { + ubi_rootdisk: ubi-volume-fit { + volname = "fit"; + }; + }; +}; diff --git a/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts index 1f03b42b1b0..d65e2352b74 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts @@ -1,232 +1,26 @@ // SPDX-License-Identifier: (GPL-2.0 OR MIT) /dts-v1/; - -#include - -#include "mt7981.dtsi" +#include "mt7981b-cudy-tr3000-v1.dtsi" / { model = "Cudy TR3000 v1"; - compatible = "cudy,tr3000-v1", "mediatek,mt7981-spim-snand-rfb"; - - aliases { - label-mac-device = &gmac1; - led-boot = &led_status; - led-failsafe = &led_status; - led-running = &led_status; - led-upgrade = &led_status; - serial0 = &uart0; - }; - - chosen { - stdout-path = "serial0:115200n8"; - }; - - gpio-keys { - compatible = "gpio-keys"; - - reset { - label = "reset"; - linux,code = ; - gpios = <&pio 1 GPIO_ACTIVE_LOW>; - }; - - mode { - label = "mode"; - linux,input-type = ; - linux,code = ; - gpios = <&pio 0 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - led_status: led_0 { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pio 11 GPIO_ACTIVE_LOW>; - }; - - led_1 { - function = LED_FUNCTION_STATUS; - color = ; - gpios = <&pio 10 GPIO_ACTIVE_LOW>; - }; - - }; - - usb_vbus: regulator-usb { - compatible = "regulator-fixed"; - - regulator-name = "usb-vbus"; - regulator-min-microvolt = <5000000>; - regulator-max-microvolt = <5000000>; - - gpios = <&pio 9 GPIO_ACTIVE_LOW>; - regulator-boot-on; - }; -}; - -&uart0 { - status = "okay"; -}; - -&watchdog { - status = "okay"; -}; - -ð { - pinctrl-names = "default"; - pinctrl-0 = <&mdio_pins>; - - status = "okay"; - - gmac0: mac@0 { - compatible = "mediatek,eth-mac"; - reg = <0>; - phy-mode = "2500base-x"; - phy-handle = <&phy1>; - nvmem-cell-names = "mac-address"; - nvmem-cells = <&macaddr_bdinfo_de00 1>; - }; - - gmac1: mac@1 { - compatible = "mediatek,eth-mac"; - reg = <1>; - phy-mode = "gmii"; - phy-handle = <&int_gbe_phy>; - nvmem-cell-names = "mac-address"; - nvmem-cells = <&macaddr_bdinfo_de00 0>; - }; -}; - -&mdio_bus { - phy1: phy@1 { - reg = <1>; - compatible = "ethernet-phy-ieee802.3-c45"; - phy-mode = "2500base-x"; - reset-gpios = <&pio 39 GPIO_ACTIVE_LOW>; - interrupts = <38 IRQ_TYPE_LEVEL_LOW>; - reset-assert-us = <100000>; - reset-deassert-us = <100000>; - realtek,aldps-enable; - }; -}; - -&spi0 { - pinctrl-names = "default"; - pinctrl-0 = <&spi0_flash_pins>; - status = "okay"; - - spi_nand: flash@0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "spi-nand"; - reg = <0>; - spi-max-frequency = <52000000>; - - spi-cal-enable; - spi-cal-mode = "read-data"; - spi-cal-datalen = <7>; - spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>; - spi-cal-addrlen = <5>; - spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>; - - spi-tx-bus-width = <4>; - spi-rx-bus-width = <4>; - mediatek,nmbm; - mediatek,bmt-max-ratio = <1>; - mediatek,bmt-max-reserved-blocks = <64>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "BL2"; - reg = <0x00000 0x0100000>; - read-only; - }; - - partition@100000 { - label = "u-boot-env"; - reg = <0x0100000 0x0080000>; - read-only; - }; - - factory: partition@180000 { - label = "Factory"; - reg = <0x180000 0x0200000>; - read-only; - nvmem-layout { - compatible = "fixed-layout"; - #address-cells = <1>; - #size-cells = <1>; - - eeprom_factory_0: eeprom@0 { - reg = <0x0 0x1000>; - }; - }; - }; - - partition@380000 { - label = "bdinfo"; - reg = <0x380000 0x0040000>; - read-only; - nvmem-layout { - compatible = "fixed-layout"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_bdinfo_de00: macaddr@de00 { - compatible = "mac-base"; - reg = <0xde00 0x6>; - #nvmem-cell-cells = <1>; - }; - }; - - }; - - partition@3C0000 { - label = "FIP"; - reg = <0x3C0000 0x0200000>; - read-only; - }; - - partition@580000 { - label = "ubi"; - reg = <0x5C0000 0x4000000>; - compatible = "linux,ubi"; - }; - }; - }; + compatible = "cudy,tr3000-v1", "mediatek,mt7981"; }; +&spi_nand { + spi-cal-enable; + spi-cal-mode = "read-data"; + spi-cal-datalen = <7>; + spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>; + spi-cal-addrlen = <5>; + spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>; -&pio { - spi0_flash_pins: spi0-pins { - mux { - function = "spi"; - groups = "spi0", "spi0_wp_hold"; - }; - }; -}; - -&usb_phy { - status = "okay"; -}; - -&xhci { - status = "okay"; - vbus-supply = <&usb_vbus>; + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; }; -&wifi { - status = "okay"; - nvmem-cells = <&eeprom_factory_0>; - nvmem-cell-names = "eeprom"; +&ubi { + reg = <0x5c0000 0x4000000>; }; diff --git a/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dtsi b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dtsi new file mode 100644 index 00000000000..86d15ea22eb --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dtsi @@ -0,0 +1,214 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; +#include +#include "mt7981.dtsi" + +/ { + aliases { + label-mac-device = &gmac1; + led-boot = &led_status; + led-failsafe = &led_status; + led-running = &led_status; + led-upgrade = &led_status; + serial0 = &uart0; + }; + + chosen: chosen { + stdout-path = "serial0:115200n8"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + + mode { + label = "mode"; + linux,input-type = ; + linux,code = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status: led_0 { + function = LED_FUNCTION_POWER; + color = ; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + + led_1 { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + + }; + + usb_vbus: regulator-usb { + compatible = "regulator-fixed"; + + regulator-name = "usb-vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + regulator-boot-on; + }; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins>; + + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + phy-handle = <&phy1>; + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_bdinfo_de00 1>; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "gmii"; + phy-handle = <&int_gbe_phy>; + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_bdinfo_de00 0>; + }; +}; + +&mdio_bus { + phy1: phy@1 { + reg = <1>; + compatible = "ethernet-phy-ieee802.3-c45"; + phy-mode = "2500base-x"; + reset-gpios = <&pio 39 GPIO_ACTIVE_LOW>; + interrupts = <38 IRQ_TYPE_LEVEL_LOW>; + reset-assert-us = <100000>; + reset-deassert-us = <100000>; + realtek,aldps-enable; + }; +}; + +&pio { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + spi_nand: flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-nand"; + reg = <0>; + spi-max-frequency = <52000000>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BL2"; + reg = <0x00000 0x0100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x0100000 0x0080000>; + read-only; + }; + + factory: partition@180000 { + label = "Factory"; + reg = <0x180000 0x0200000>; + read-only; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + }; + }; + + partition@380000 { + label = "bdinfo"; + reg = <0x380000 0x0040000>; + read-only; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_bdinfo_de00: macaddr@de00 { + compatible = "mac-base"; + reg = <0xde00 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + + }; + + partition@3c0000 { + label = "FIP"; + reg = <0x3c0000 0x0200000>; + read-only; + }; + + ubi: partition@5c0000 { + label = "ubi"; + compatible = "linux,ubi"; + }; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + status = "okay"; + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; +}; + +&xhci { + status = "okay"; + vbus-supply = <&usb_vbus>; +}; diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 04fc7cfce85..06ad636c136 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -726,6 +726,31 @@ define Device/cudy_tr3000-v1 endef TARGET_DEVICES += cudy_tr3000-v1 +define Device/cudy_tr3000-v1-ubootmod + DEVICE_VENDOR := Cudy + DEVICE_MODEL := TR3000 + DEVICE_VARIANT := v1 (OpenWrt U-Boot layout) + DEVICE_DTS := mt7981b-cudy-tr3000-v1-ubootmod + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-usb3 kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_IN_UBI := 1 + UBOOTENV_IN_UBI := 1 + IMAGES := sysupgrade.itb + KERNEL_INITRAMFS_SUFFIX := -recovery.itb + KERNEL := kernel-bin | gzip + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGE/sysupgrade.itb := append-kernel | \ + fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata + ARTIFACTS := preloader.bin bl31-uboot.fip + ARTIFACT/preloader.bin := mt7981-bl2 cudy-tr3000-v1 + ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot cudy_tr3000-v1 +endef +TARGET_DEVICES += cudy_tr3000-v1-ubootmod + define Device/cudy_wr3000-v1 DEVICE_VENDOR := Cudy DEVICE_MODEL := WR3000 From 97681b4fbd2e6764ef96d21e9f7a0b67b9c5d1b9 Mon Sep 17 00:00:00 2001 From: Jack Sun Date: Fri, 10 Jan 2025 18:30:12 +0800 Subject: [PATCH 154/173] tools/meson: update to 1.6.1 Changelog: https://mesonbuild.com/Release-notes-for-1-6-0.html Signed-off-by: Jack Sun Link: https://github.com/openwrt/openwrt/pull/17556 Signed-off-by: Hauke Mehrtens --- tools/meson/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/meson/Makefile b/tools/meson/Makefile index f967f33ecd1..6593f41f538 100644 --- a/tools/meson/Makefile +++ b/tools/meson/Makefile @@ -1,11 +1,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=meson -PKG_VERSION:=1.5.1 +PKG_VERSION:=1.6.1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/mesonbuild/meson/releases/download/$(PKG_VERSION) -PKG_HASH:=567e533adf255de73a2de35049b99923caf872a455af9ce03e01077e0d384bed +PKG_HASH:=1eca49eb6c26d58bbee67fd3337d8ef557c0804e30a6d16bfdf269db997464de PKG_MAINTAINER:=Andre Heider PKG_LICENSE:=Apache-2.0 From 8a17bae722a62954269f29dc48025e88c919dc24 Mon Sep 17 00:00:00 2001 From: Raylynn Knight Date: Sat, 11 Jan 2025 00:19:59 -0500 Subject: [PATCH 155/173] d1: Use correct module for devices with wifi Devices with wifi (LicheePi RV and MangoPi MQ Pro) were using the wrong module. Also wpad was missing to enable using the WiFi. Signed-off-by: Raylynn Knight Link: https://github.com/openwrt/openwrt/pull/17576 Signed-off-by: Hauke Mehrtens --- target/linux/d1/base-files/etc/board.d/02_network | 4 ++++ target/linux/d1/image/Makefile | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/target/linux/d1/base-files/etc/board.d/02_network b/target/linux/d1/base-files/etc/board.d/02_network index df48b431af5..dc61e4bde51 100644 --- a/target/linux/d1/base-files/etc/board.d/02_network +++ b/target/linux/d1/base-files/etc/board.d/02_network @@ -8,6 +8,10 @@ board_config_update case "$(board_name)" in +sipeed,lichee-rv-dock |\ +widora,mangopi-mq-pro) + ucidef_set_interface_lan "wlan0" + ;; *) ucidef_set_interface_lan 'eth0' ;; diff --git a/target/linux/d1/image/Makefile b/target/linux/d1/image/Makefile index 8dca2fb1cb0..ea41e65c760 100644 --- a/target/linux/d1/image/Makefile +++ b/target/linux/d1/image/Makefile @@ -65,7 +65,7 @@ define Device/sipeed_lichee-rv-dock DEVICE_MODEL := LicheePi RV (dock) DEVICE_DTS := allwinner/sun20i-d1-lichee-rv-dock SUPPORTED_DEVICES += lichee_rv_dock - DEVICE_PACKAGES += kmod-rtl8723bs + DEVICE_PACKAGES += kmod-rtw88-8723ds wpad-basic-mbedtls UBOOT := lichee_rv_dock endef TARGET_DEVICES += sipeed_lichee-rv-dock @@ -76,7 +76,7 @@ define Device/widora_mangopi-mq-pro DEVICE_MODEL := MQ Pro DEVICE_DTS := allwinner/sun20i-d1-mangopi-mq-pro SUPPORTED_DEVICES += mangopi_mq_pro - DEVICE_PACKAGES += kmod-rtl8723bs + DEVICE_PACKAGES += kmod-rtw88-8723ds wpad-basic-mbedtls UBOOT := mangopi_mq_pro endef TARGET_DEVICES += widora_mangopi-mq-pro From f65b533e41c7b5893a3ed4aad33329622ef79e40 Mon Sep 17 00:00:00 2001 From: "Anton Yu. Ivanusev" Date: Thu, 26 Dec 2024 09:34:39 +0500 Subject: [PATCH 156/173] ramips: mt7621: add support for Keenetic Viva (KN-1910) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Specification: SoC: MediaTek MT7621A RAM: 128M DDR3, Winbond W631GG6MB-12 (DDR3-1600) or Winbond W631GG6MB-11 Flash: 128M, Macronix MX30LF1G18AC-TI (Dual Boot, Parallel-NAND) Switch: MT7530, 5 ports 1Gbps WiFi: MT7615DN, 2.4GHz 802.11n and 5GHz 802.11ac USB: 2 ports USB 2.0 GPIO: 4 buttons (Wi-Fi, Reset, FN1, FN2), 4 LEDs (Power, Internet, FN, Wi-Fi), USB port power controls LAN: RF-EEPROM + 0x04 WAN: RF-EEPROM + 0x28 2.4 GHz: RF-EEPROM + 0x04 5 GHz: 2.4GHz + 82:00:00:00:00:00 Disassembly: There are 2 screws at the bottom. After removing the screws, pry the gray plastic part around (it is secured with latches) and remove it. Serial Interface: The serial interface can be connected to the 4 pin dots to the left of the radiator. Pins (from LAN ports to LEDs): 3.3V (do not connect) TX RX GND Settings: 57600, 8N1 Flashing via OEM recovery software: 1. Download the OEM recovery software from the manufacturer's website 2. Download the firmware image (for OpenWRT it is *-squashfs-factory.bin), rename it to KN-1910_recovery.bin 3. Replace the file in the fw folder OEM recovery software with the file from step 2. 4. Run the OEM recovery software and follow the instructions. Flashing via TFTP: 1. Connect your PC and router to port 1-4, configure PC interface using IP 192.168.1.2, mask 255.255.255.252 2. Serve the firmware image (for OpenWRT it is *-squashfs-factory.bin) renamed to KN-1910_recovery.bin via TFTP 3. Power up the router while pressing Reset button on the back 4. Release Restart button when Power LED starts blinking To revert back to OEM firmware: The return to the OEM firmware is carried out by using the methods described above with the help of the appropriate firmware image. Keenetic's bootloader supports booting a LZMA compressed kernel but seems to fail if the uncompressed data is larger than a fixed buffer therefore it is safer to use a uimage-lzma-loader. When using OEM bootloader, the firmware image size cannot exceed the size of one OEM «Firmware_x» partition or Kernel + rootFS size. Signed-off-by: Anton Yu. Ivanusev Link: https://github.com/openwrt/openwrt/pull/17381 Signed-off-by: Hauke Mehrtens --- .../ramips/dts/mt7621_keenetic_kn-1910.dts | 280 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 16 + .../mt7621/base-files/etc/board.d/01_leds | 1 + 3 files changed, 297 insertions(+) create mode 100644 target/linux/ramips/dts/mt7621_keenetic_kn-1910.dts diff --git a/target/linux/ramips/dts/mt7621_keenetic_kn-1910.dts b/target/linux/ramips/dts/mt7621_keenetic_kn-1910.dts new file mode 100644 index 00000000000..97b7c956882 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_keenetic_kn-1910.dts @@ -0,0 +1,280 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +#include "mt7621.dtsi" + +#include +#include +#include + +/ { + compatible = "keenetic,kn-1910", "mediatek,mt7621-soc"; + model = "Keenetic KN-1910"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + label-mac-device = &gmac0; + }; + + reg_usb_vbus: regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "usb_vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "fixed-3.3V"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + + keys { + compatible = "gpio-keys"; + + restart { + label = "restart"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + fn1 { + label = "fn1"; + gpios = <&gpio 10 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + fn2 { + label = "fn2"; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_power: power { + function = LED_FUNCTION_POWER; + color = ; + gpios = <&gpio 9 GPIO_ACTIVE_HIGH>; + }; + + internet { + function = LED_FUNCTION_WAN; + color = ; + gpios = <&gpio 17 GPIO_ACTIVE_HIGH>; + }; + + fn { + function = LED_FUNCTION_WLAN_2GHZ; + color = ; + gpios = <&gpio 13 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy0tpt"; + }; + + wifi { + function = LED_FUNCTION_WLAN_5GHZ; + color = ; + gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy1tpt"; + }; + }; + + virtual_flash { + compatible = "mtd-concat"; + devices = <&firmware1 &firmware2 &storage_a &storage_b>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "kernel"; + reg = <0x0 0x400000>; + }; + + partition@400000 { + label = "ubi"; + reg = <0x400000 0x7540000>; + }; + }; + }; +}; + +&xhci { + vbus-supply = <®_usb_vbus>; + vusb33-supply = <®_3p3v>; +}; + +&nand { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "U-Boot"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@80000 { + label = "U-Config"; + reg = <0x80000 0x80000>; + read-only; + }; + + partition@100000 { + label = "RF-EEPROM"; + reg = <0x100000 0x80000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x4da8>; + }; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; + + macaddr_factory_28: macaddr@28 { + reg = <0x28 0x6>; + }; + }; + }; + + firmware1: partition@180000 { + label = "Firmware_1"; + reg = <0x180000 0x1bc0000>; + }; + + partition@1d40000 { + label = "Config_1"; + reg = <0x1d40000 0x80000>; + read-only; + }; + + partition@1dc0000 { + label = "Storage_Legacy"; + reg = <0x1dc0000 0x200000>; + read-only; + }; + + partition@1fc0000 { + label = "Dump"; + reg = <0x1fc0000 0x40000>; + read-only; + }; + + storage_a: partition@2000000 { + label = "Storage_A"; + reg = <0x2000000 0x1fc0000>; + }; + + partition@3fc0000 { + label = "U-State"; + reg = <0x3fc0000 0x80000>; + read-only; + }; + + partition@4040000 { + label = "U-Config_res"; + reg = <0x4040000 0x80000>; + read-only; + }; + + partition@40c0000 { + label = "RF-EEPROM_res"; + reg = <0x40c0000 0x80000>; + read-only; + }; + + firmware2: partition@4140000 { + label = "Firmware_2"; + reg = <0x4140000 0x1bc0000>; + }; + + partition@5d00000 { + label = "Config_2"; + reg = <0x5d00000 0x80000>; + read-only; + }; + + storage_b: partition@5d80000 { + label = "Storage_B"; + reg = <0x5d80000 0x2200000>; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; + }; +}; + +ðphy0 { + /delete-property/ interrupts; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; +}; + +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_28>; + nvmem-cell-names = "mac-address"; +}; + +&switch0 { + ports { + port@1 { + status = "okay"; + }; + + port@2 { + status = "okay"; + }; + + port@3 { + status = "okay"; + }; + + port@4 { + status = "okay"; + }; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index ed0da905287..aa38495224c 100755 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1787,6 +1787,22 @@ define Device/jdcloud_re-cp-02 endef TARGET_DEVICES += jdcloud_re-cp-02 +define Device/keenetic_kn-1910 + $(Device/nand) + $(Device/uimage-lzma-loader) + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 24903680 + DEVICE_VENDOR := Keenetic + DEVICE_MODEL := KN-1910 + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 \ + kmod-usb-ledtrig-usbport + IMAGES += factory.bin + IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | \ + append-ubi | check-size | zyimage -d 0x801910 -v "KN-1910" +endef +TARGET_DEVICES += keenetic_kn-1910 + define Device/keenetic_kn-3010 $(Device/dsa-migration) $(Device/uimage-lzma-loader) diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index 9a77b1b1bc4..ec452ccd944 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -125,6 +125,7 @@ gnubee,gb-pc2) huasifei,ws1208v2) ucidef_set_led_netdev "wwan0" "wwan0" "green:cellular" "wwan0" "link tx rx" ;; +keenetic,kn-1910|\ keenetic,kn-3010) ucidef_set_led_netdev "internet" "internet" "green:internet" "wan" ;; From 717f62d256ccb52549a24c256615b28440ed1a86 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 13 Jan 2025 23:56:09 +0100 Subject: [PATCH 157/173] mvebu: WD Cloud Mirror Gen2: Remove stty dependency The package coreutils-stty is not part of the OpenWrt main packages. A board can not depend on it. Remove the dependency to fix a build problem seen in the build bots. Fixes: 8fb805aa1f25 ("mvebu: Add support for WD Cloud Mirror Gen2") Signed-off-by: Hauke Mehrtens --- target/linux/mvebu/image/cortexa9.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/mvebu/image/cortexa9.mk b/target/linux/mvebu/image/cortexa9.mk index d572264866b..b5f89aec20c 100644 --- a/target/linux/mvebu/image/cortexa9.mk +++ b/target/linux/mvebu/image/cortexa9.mk @@ -453,7 +453,7 @@ define Device/wd_cloud-mirror-gen2 $(Device/NAND-128K) DEVICE_VENDOR := Western Digital DEVICE_MODEL := MyCloud Mirror Gen 2 (BWVZ/Grand Teton) - DEVICE_PACKAGES += -uboot-envtools coreutils-stty mkf2fs e2fsprogs \ + DEVICE_PACKAGES += -uboot-envtools mkf2fs e2fsprogs \ partx-utils kmod-hwmon-drivetemp -ppp -kmod-nft-offload -dnsmasq \ -odhcpd-ipv6only DEVICE_DTS := armada-385-wd_cloud-mirror-gen2 From a18385041eaeaf6d98ab79a30ce5fba4e712b765 Mon Sep 17 00:00:00 2001 From: Sebastian Pflieger Date: Thu, 9 Jan 2025 18:16:04 +0100 Subject: [PATCH 158/173] lldpd: bump version to 1.0.18 Changes (breaking): - Remove support for building 802.3bt TLVs (broken). Fix: - Fix memory leaks in EDP/FDP decoding when receiving some TLVs twice. - Do not set interface description continuously. - Use a different Netlink socket for changes and queries. Signed-off-by: Sebastian Pflieger Link: https://github.com/openwrt/openwrt/pull/17570 Signed-off-by: Robert Marko --- package/network/services/lldpd/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/network/services/lldpd/Makefile b/package/network/services/lldpd/Makefile index f34cd28faac..b21ca76c5e1 100644 --- a/package/network/services/lldpd/Makefile +++ b/package/network/services/lldpd/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=lldpd -PKG_VERSION:=1.0.17 +PKG_VERSION:=1.0.18 PKG_RELEASE:=5 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/lldpd/lldpd/releases/download/$(PKG_VERSION)/ -PKG_HASH:=89ae691a4917ac9e0ec3b8b2c1e634cc402d43b804f98850c73bd1c7df380882 +PKG_HASH:=38cd319aa02ab61d9a2ad130e22f906795ccca9ac73a0a0d9dac19ca99a8a870 PKG_MAINTAINER:=Stijn Tintel PKG_LICENSE:=ISC From abbec429b40f149f9c5a99a64ee7bf4e804fbb7d Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Tue, 14 Jan 2025 09:37:33 +0100 Subject: [PATCH 159/173] lldpd: reset PKG_RELEASE lldpd was updated, so reset PKG_RELEASE after the PKG_VERSION update. Signed-off-by: Robert Marko --- package/network/services/lldpd/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/services/lldpd/Makefile b/package/network/services/lldpd/Makefile index b21ca76c5e1..6be9723a9b4 100644 --- a/package/network/services/lldpd/Makefile +++ b/package/network/services/lldpd/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=lldpd PKG_VERSION:=1.0.18 -PKG_RELEASE:=5 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/lldpd/lldpd/releases/download/$(PKG_VERSION)/ From 7bf3bc871ac1ae6b6f199ba1bd83eba9d017a0d5 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 14 Jan 2025 11:55:08 +0100 Subject: [PATCH 160/173] mac80211: fix issues with including linux/acpi_amd_wbrf.h on newer kernels Change the double-include guard to avoid conflict with the linux kernel header Reported-by: Tony Ambardar Signed-off-by: Felix Fietkau --- ...-fix-linux-acpi_amd_wbrf.h-inclusion.patch | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 package/kernel/mac80211/patches/build/110-backport-include-fix-linux-acpi_amd_wbrf.h-inclusion.patch diff --git a/package/kernel/mac80211/patches/build/110-backport-include-fix-linux-acpi_amd_wbrf.h-inclusion.patch b/package/kernel/mac80211/patches/build/110-backport-include-fix-linux-acpi_amd_wbrf.h-inclusion.patch new file mode 100644 index 00000000000..d8d3783ed60 --- /dev/null +++ b/package/kernel/mac80211/patches/build/110-backport-include-fix-linux-acpi_amd_wbrf.h-inclusion.patch @@ -0,0 +1,32 @@ +From: Felix Fietkau +Date: Tue, 14 Jan 2025 11:42:25 +0100 +Subject: [PATCH] backport-include: fix linux/acpi_amd_wbrf.h inclusion + +Fix building for kernel >= 6.8 by adjusting incorrect guard usage, +otherwise an #include_next header is masked and compilation will fail +for net/mac80211/wbrf.c in the mac80211 kernel module. + +Fixes: 52cdcaab ("backport-include: backport linux/acpi_amd_wbrf.h") +Reported-by: Tony Ambardar +Signed-off-by: Felix Fietkau +--- + +--- a/backport-include/linux/acpi_amd_wbrf.h ++++ b/backport-include/linux/acpi_amd_wbrf.h +@@ -4,8 +4,8 @@ + * Copyright (C) 2023 Advanced Micro Devices + */ + +-#ifndef _ACPI_AMD_WBRF_H +-#define _ACPI_AMD_WBRF_H ++#ifndef __BACKPORT_ACPI_AMD_WBRF_H ++#define __BACKPORT_ACPI_AMD_WBRF_H + + #if LINUX_VERSION_IS_GEQ(6,8,0) + #include_next +@@ -83,4 +83,4 @@ int amd_wbrf_unregister_notifier(struct + } + + #endif /* >=6,8,0 */ +-#endif /* _ACPI_AMD_WBRF_H */ ++#endif /* __BACKPORT_ACPI_AMD_WBRF_H */ From e5168715156ef5b71791c1ce16a9aeec0f94cb30 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 14 Jan 2025 13:29:40 +0100 Subject: [PATCH 161/173] wifi-scripts: sync enable_background_radar in ucode with old version It needs to be opt-in instead of opt-out, since there is no reliable way to determine if the extra background radar chain has an antenna connected. Signed-off-by: Felix Fietkau --- .../wifi-scripts/files-ucode/usr/share/ucode/wifi/hostapd.uc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/wifi/hostapd.uc b/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/wifi/hostapd.uc index adbfc1b9781..0e3cfc5b901 100644 --- a/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/wifi/hostapd.uc +++ b/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/wifi/hostapd.uc @@ -493,7 +493,7 @@ function generate(config) { if (!phy_features.radar_background || config.band != '5g') delete config.enable_background_radar; else - set_default(config, 'enable_background_radar', phy_features.radar_background); + set_default(config, 'enable_background_radar', false); append_vars(config, [ 'acs_chan_bias', 'acs_exclude_dfs', 'enable_background_radar' ]); From 3963dab0302ae29cbf2acf28f26c1432e4ddf1a5 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 14 Jan 2025 13:48:23 +0100 Subject: [PATCH 162/173] mt76: update to Git HEAD (2025-01-14) cf4e709e493a wifi: mt76: mt7996: fix crash in mt7996_set_radar_background 4c786fa52bb2 wifi: mt76: mt7915: fix register mapping 849923df3dde wifi: mt76: mt7996: fix register mapping 6be1dc9a1c79 wifi: mt76: mt7925: fix the unfinished command of regd_notifier before suspend d33ea3cab72b wifi: mt76: mt7925: fix CLC command timeout when suspend/resume 5aacd0d73c80 wifi: mt76: mt7925: add handler to hif suspend/resume event e86e97e45397 wifi: mt76: mt7925e: fix too long of wifi resume time e43df6bf4892 wifi: mt76: mt7996: fix thermal sparse warning 02f453d8dfc8 wifi: mt76: fix survey regression 7279e3f3c3e0 wifi: mt76: mt7925: fix unused-but-set warning 49c0bd66da3b wifi: mt76: mt7996: fix unused-but-set variable 2c068c96382e wifi: mt76: fix crash in mt76_switch_vif_chanctx 731070da2c2a wifi: mt76: mt7996: add max mpdu len capability 99d8ed164a96 wifi: mt76: mt7996: fix the capability of reception of EHT MU PPDU 32ee924831ba wifi: mt76: mt7996: fix HE Phy capability 9b588c7fb333 wifi: mt76: mt7996: fix incorrect indexing of MIB FW event 46798905cf5a wifi: mt76: connac: adjust phy capabilities based on band constraints 5c50f6f7dafe wifi: mt76: mt7996: fix definition of tx descriptor 9cdb62dc084f wifi: mt76: mt7996: fix ldpc setting 8c6cb2f97fe0 wifi: mt76: mt7996: fix beacon command during disabling 8e4f72b682e9 wifi: mt76: mt7996: add implicit beamforming support for mt7992 Signed-off-by: Felix Fietkau --- package/kernel/mt76/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 7bc030a9df3..cd168f49bcc 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -8,9 +8,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/openwrt/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2025-01-04 -PKG_SOURCE_VERSION:=e354436db4402552bcb0cbe9abab2a46fb1ad31c -PKG_MIRROR_HASH:=7e3894e1f2641e172f87be1ae0cc6adda318d989350ebd53500a7df02f0afd8f +PKG_SOURCE_DATE:=2025-01-14 +PKG_SOURCE_VERSION:=8e4f72b682e9070108536507c5e2720b18c3816d +PKG_MIRROR_HASH:=fa8c5a2ece9e7287605910d9f906b601711c7863613addaadd666f9e3858a9e7 PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 From dac8021297a5541eac418fb295a9013109d39a61 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 14 Jan 2025 14:02:16 +0100 Subject: [PATCH 163/173] build: use lazy evaluation for NPROC to speed up metadata dump Reduces package metadata dump time by ~10% Signed-off-by: Felix Fietkau --- rules.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules.mk b/rules.mk index 16d6020e1a0..dbc448e1a43 100644 --- a/rules.mk +++ b/rules.mk @@ -96,7 +96,7 @@ TARGET_SUFFIX=$(call qstrip,$(CONFIG_TARGET_SUFFIX)) BUILD_SUFFIX:=$(call qstrip,$(CONFIG_BUILD_SUFFIX)) SUBDIR:=$(patsubst $(TOPDIR)/%,%,${CURDIR}) BUILD_SUBDIR:=$(patsubst $(TOPDIR)/%,%,${CURDIR}) -NPROC:=$(shell sysctl -n hw.ncpu 2>/dev/null || nproc) +NPROC=$(shell sysctl -n hw.ncpu 2>/dev/null || nproc) export SHELL:=/usr/bin/env bash IS_PACKAGE_BUILD := $(if $(filter package/%,$(BUILD_SUBDIR)),1) From 2c22d7c3a4a7edcce1af656c8cddb1ab163e3d02 Mon Sep 17 00:00:00 2001 From: Sebastian Pflieger Date: Thu, 9 Jan 2025 18:10:38 +0100 Subject: [PATCH 164/173] lldpd: fix config for build without LLDP-MED The lldp_class and lldp_location config option are only valid when compiled with LLDP-MED support. If not they will cause lldpd not to start. Signed-off-by: Sebastian Pflieger Link: https://github.com/openwrt/openwrt/pull/17571 Signed-off-by: Robert Marko --- package/network/services/lldpd/Makefile | 4 +++- package/network/services/lldpd/files/lldpd.init | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/package/network/services/lldpd/Makefile b/package/network/services/lldpd/Makefile index 6be9723a9b4..3fbd0bf4f93 100644 --- a/package/network/services/lldpd/Makefile +++ b/package/network/services/lldpd/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=lldpd PKG_VERSION:=1.0.18 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/lldpd/lldpd/releases/download/$(PKG_VERSION)/ @@ -90,6 +90,8 @@ endif ifneq ($(CONFIG_LLDPD_WITH_LLDPMED),y) sed -i -e 's/CONFIG_LLDPD_WITH_LLDPMED=y/CONFIG_LLDPD_WITH_LLDPMED=n/g' $(1)/etc/init.d/lldpd sed -i -e '/agentxsocket/d' $(1)/etc/config/lldpd + sed -i -e '/lldp_class/d' $(1)/etc/config/lldpd + sed -i -e '/lldp_location/d' $(1)/etc/config/lldpd endif endef diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init index 3922b676b52..6c1c184bfa1 100644 --- a/package/network/services/lldpd/files/lldpd.init +++ b/package/network/services/lldpd/files/lldpd.init @@ -39,7 +39,6 @@ get_config_restart_hash() { config_load 'lldpd' - config_get v 'config' 'lldp_class'; append _string "$v" "," if [ "$CONFIG_LLDPD_WITH_SNMP" = "y" ]; then config_get v 'config' 'agentxsocket'; append _string "$v" "," fi @@ -49,6 +48,7 @@ get_config_restart_hash() { config_get_bool v 'config' 'lldp_no_version'; append _string "$v" "," if [ "$CONFIG_LLDPD_WITH_LLDPMED" = "y" ]; then config_get_bool v 'config' 'lldpmed_no_inventory'; append _string "$v" "," + config_get v 'config' 'lldp_class'; append _string "$v" "," fi config_get_bool v 'config' 'enable_lldp' 1; append _string "$v" "," config_get_bool v 'config' 'force_lldp'; append _string "$v" "," @@ -243,10 +243,10 @@ start_service() { config_get_bool enable_edp 'config' 'enable_edp' 0 config_get_bool force_edp 'config' 'force_edp' 0 fi - config_get lldp_class 'config' 'lldp_class' config_get_bool lldp_no_version 'config' 'lldp_no_version' 0 if [ "$CONFIG_LLDPD_WITH_LLDPMED" = "y" ]; then config_get_bool lldpmed_no_inventory 'config' 'lldpmed_no_inventory' 0 + config_get lldp_class 'config' 'lldp_class' fi config_get_bool readonly_mode 'config' 'readonly_mode' 0 if [ "$CONFIG_LLDPD_WITH_SNMP" = "y" ]; then From 1c5ca24da6cd727f4fcb8edbe00fa66543a6c678 Mon Sep 17 00:00:00 2001 From: Luis Mita Date: Wed, 8 Jan 2025 18:10:04 -0400 Subject: [PATCH 165/173] ramips: mt7621: add support for Confiabits MT7621 v1 Hardware: - SoC: MediaTek MT7621DAT - Flash: 16 MiB cFeon - RAM: 128 MiB MT7621DAT - WLAN: 2.4 GHz (MT7603EN), 5 GHz (MT7613BEN 802.11ac) - Ethernet: 1x 10/100/1000 Mbps WAN, 3x 10/100/1000 LAN (MT7621DAT) - Buttons: 1 Reset button, 1 WPS button - LEDs: 5x Green (POWER/WAN/2.4G/5G/WPS), 1x Red (WAN) - Serial console: unpopulated header, 57600 8n1 - Power: 12 VDC, 1 A MAC: LAN MAC: label mac (eeprom@4) WAN MAC: label mac (eeprom@4) 2.4G MAC: label mac (eeprom@4) 5G MAC: label mac + 1 (eeprom@8004) Installation: The stock firmware is OpenWrt-based. If you can reach LuCI or SSH, just use the sysupgrade image with the 'Keep settings' option turned off. Signed-off-by: Luis Mita Link: https://github.com/openwrt/openwrt/pull/17534 Signed-off-by: Hauke Mehrtens --- .../dts/mt7621_confiabits_mt7621-v1.dts | 215 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 12 + .../mt7621/base-files/etc/board.d/01_leds | 7 +- .../mt7621/base-files/etc/board.d/02_network | 1 + 4 files changed, 232 insertions(+), 3 deletions(-) create mode 100644 target/linux/ramips/dts/mt7621_confiabits_mt7621-v1.dts diff --git a/target/linux/ramips/dts/mt7621_confiabits_mt7621-v1.dts b/target/linux/ramips/dts/mt7621_confiabits_mt7621-v1.dts new file mode 100644 index 00000000000..858747ecada --- /dev/null +++ b/target/linux/ramips/dts/mt7621_confiabits_mt7621-v1.dts @@ -0,0 +1,215 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include +#include + +/ { + compatible = "confiabits,mt7621-v1", "mediatek,mt7621-soc"; + model = "Confiabits MT7621 v1"; + + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_green; + led-running = &led_power_green; + led-upgrade = &led_power_green; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + keys { + compatible = "gpio-keys"; + + button-wps { + label = "wps"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + linux,code = ; + }; + + button-reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_power_green: led-power-green { + color = ; + function = LED_FUNCTION_POWER; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + + led-wan-red { + color = ; + function = LED_FUNCTION_WAN; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + led-wlan5 { + color = ; + function = LED_FUNCTION_WLAN_5GHZ; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + + led-wps { + color = ; + function = LED_FUNCTION_WPS; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + led-wlan24 { + color = ; + function = LED_FUNCTION_WLAN_2GHZ; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led-wan-green { + color = ; + function = LED_FUNCTION_WAN; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <40000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "radio"; + reg = <0x40000 0x10000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_radio_0: eeprom@0 { + reg = <0x0 0x400>; + }; + + eeprom_radio_8000: eeprom@8000 { + reg = <0x8000 0x4da8>; + }; + + macaddr_radio_4: macaddr@4 { + reg = <0x4 0x6>; + }; + + macaddr_radio_8004: macaddr@8004 { + reg = <0x8004 0x6>; + }; + }; + }; + + partition@50000 { + label = "firmware"; + compatible = "denx,uimage"; + reg = <0x50000 0xfb0000>; + }; + }; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_radio_4>; + nvmem-cell-names = "mac-address"; +}; + +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_radio_4>; + nvmem-cell-names = "mac-address"; +}; + +ðphy4 { + /delete-property/ interrupts; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + ieee80211-freq-limit = <2400000 2500000>; + + nvmem-cells = <&eeprom_radio_0>; + nvmem-cell-names = "eeprom"; + }; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + ieee80211-freq-limit = <5000000 6000000>; + + nvmem-cells = <&eeprom_radio_8000>; + nvmem-cell-names = "eeprom"; + }; +}; + +&state_default { + gpio { + groups = "i2c", "jtag", "wdt"; + function = "gpio"; + }; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "lan1"; + }; + + port@1 { + status = "okay"; + label = "lan2"; + }; + + port@2 { + status = "okay"; + label = "lan3"; + }; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index aa38495224c..08b3dcc64f7 100755 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -687,6 +687,18 @@ define Device/comfast_cf-ew72-v2 endef TARGET_DEVICES += comfast_cf-ew72-v2 +define Device/confiabits_mt7621-v1 + $(Device/dsa-migration) + $(Device/uimage-lzma-loader) + IMAGE_SIZE := 16064k + DEVICE_VENDOR := Confiabits + DEVICE_MODEL := MT7621 + DEVICE_VARIANT := v1 + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap \ + -uboot-envtools +endef +TARGET_DEVICES += confiabits_mt7621-v1 + define Device/cudy_m1800 $(Device/dsa-migration) DEVICE_VENDOR := Cudy diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index ec452ccd944..1542eed8f62 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -58,6 +58,10 @@ wifire,s1500-nbn) belkin,rt1800) ucidef_set_led_netdev "wan" "wan" "white:wan" "wan" ;; +confiabits,mt7621-v1|\ +netis,n6) + ucidef_set_led_netdev "wan" "wan" "green:wan" "wan" "link tx rx" + ;; cudy,wr2100) ucidef_set_led_netdev "lan1" "lan1" "green:lan1" "lan1" ucidef_set_led_netdev "lan2" "lan2" "green:lan2" "lan2" @@ -189,9 +193,6 @@ netgear,r7450) netgear,wax202) ucidef_set_led_netdev "internet" "Internet" "green:net" "wan" ;; -netis,n6) - ucidef_set_led_netdev "wan" "wan" "green:wan" "wan" "link tx rx" - ;; oraybox,x3a) ucidef_set_led_netdev "wan" "wan link" "red:status" "wan" ucidef_set_led_netdev "lan" "lan link" "green:status" "br-lan" diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index c780443c1c5..f40e9616d01 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -13,6 +13,7 @@ ramips_setup_interfaces() asus,rt-ax53u|\ buffalo,wsr-2533dhpl2|\ buffalo,wsr-2533dhpls|\ + confiabits,mt7621-v1|\ gehua,ghl-r-001|\ h3c,tx1800-plus|\ h3c,tx1801-plus|\ From c9ebd4fb30773ca55cc2da6b2c1962046a2e0fff Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Thu, 22 Jun 2023 23:36:28 +0000 Subject: [PATCH 166/173] armsr: change image names to 'combined-efi' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit luci-app-attendedsysupgrade expects images to be named 'combined-efi' when the system is using EFI images. This came about as x86 has 'combined' images for legacy (BIOS) boot and 'combined-efi' for EFI systems. armsr images were originally named 'combined' only as there was no 'legacy' image type. To avoid special handling in the attendedsysupgrade code, name EFI images consistent with other targets. Signed-off-by: Mathew McBride Link: https://github.com/openwrt/luci/pull/6430 Link: https://github.com/openwrt/openwrt/pull/12963 Signed-off-by: Petr Štetiar --- target/linux/armsr/README | 4 ++-- target/linux/armsr/image/Makefile | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/target/linux/armsr/README b/target/linux/armsr/README index b4b9012826a..04f01f8e305 100644 --- a/target/linux/armsr/README +++ b/target/linux/armsr/README @@ -49,7 +49,7 @@ With a EDKII or U-Boot binary for the QEMU ARM virtual machines, you can use the images in EFI mode: 32-bit: -gunzip -c bin/targets/armsr/armv7/openwrt-armsr-armv7-generic-ext4-combined.img.gz > openwrt-arm-32.img +gunzip -c bin/targets/armsr/armv7/openwrt-armsr-armv7-generic-ext4-combined-efi.img.gz > openwrt-arm-32.img qemu-system-arm -nographic \ -cpu cortex-a15 -machine virt \ -bios bin/targets/armsr/armv7/u-boot-qemu_armv7/u-boot.bin \ @@ -60,7 +60,7 @@ qemu-system-arm -nographic \ -netdev user,id=testwan -net nic,netdev=testwan 64-bit: -gunzip -c bin/targets/armsr/armv8/openwrt-armsr-armv8-generic-ext4-combined.img.gz > openwrt-arm-64.img +gunzip -c bin/targets/armsr/armv8/openwrt-armsr-armv8-generic-ext4-combined-efi.img.gz > openwrt-arm-64.img qemu-system-aarch64 -nographic \ -cpu cortex-a53 -machine virt \ -bios bin/targets/armsr/armv8/u-boot-qemu_armv8/u-boot.bin \ diff --git a/target/linux/armsr/image/Makefile b/target/linux/armsr/image/Makefile index 09c37beeec4..b34c1f16e79 100644 --- a/target/linux/armsr/image/Makefile +++ b/target/linux/armsr/image/Makefile @@ -74,18 +74,18 @@ DEVICE_VARS += GRUB2_VARIANT UBOOT define Device/efi-default IMAGE/rootfs.img := append-rootfs | pad-to $(ROOTFS_PARTSIZE) IMAGE/rootfs.img.gz := append-rootfs | pad-to $(ROOTFS_PARTSIZE) | gzip - IMAGE/combined.img := grub-config efi | combined efi | grub-install efi | append-metadata - IMAGE/combined.img.gz := grub-config efi | combined efi | grub-install efi | gzip | append-metadata - IMAGE/combined.vmdk := grub-config efi | combined efi | grub-install efi | qemu-image vmdk + IMAGE/combined-efi.img := grub-config efi | combined efi | grub-install efi | append-metadata + IMAGE/combined-efi.img.gz := grub-config efi | combined efi | grub-install efi | gzip | append-metadata + IMAGE/combined-efi.vmdk := grub-config efi | combined efi | grub-install efi | qemu-image vmdk ifeq ($(CONFIG_TARGET_IMAGES_GZIP),y) IMAGES-y := rootfs.img.gz - IMAGES-y += combined.img.gz + IMAGES-y += combined-efi.img.gz else IMAGES-y := rootfs.img - IMAGES-y += combined.img + IMAGES-y += combined-efi.img endif ifeq ($(CONFIG_VMDK_IMAGES),y) - IMAGES-y += combined.vmdk + IMAGES-y += combined-efi.vmdk endif KERNEL := kernel-bin KERNEL_INSTALL := 1 From 272391c84f783f170acc9ff50389aafa17200643 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Wed, 15 Jan 2025 13:05:52 +0800 Subject: [PATCH 167/173] mediatek: add missing network setup for cudy tr3000-v1 ubootmod Signed-off-by: Tianling Shen --- package/boot/arm-trusted-firmware-mediatek/Makefile | 4 ++-- .../mediatek/base-files/lib/preinit/05_set_preinit_iface | 1 + .../linux/mediatek/filogic/base-files/etc/board.d/02_network | 1 + .../base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac | 1 + target/linux/mediatek/image/filogic.mk | 4 ++-- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/package/boot/arm-trusted-firmware-mediatek/Makefile b/package/boot/arm-trusted-firmware-mediatek/Makefile index 59ee49e71c2..9e4c3759b71 100644 --- a/package/boot/arm-trusted-firmware-mediatek/Makefile +++ b/package/boot/arm-trusted-firmware-mediatek/Makefile @@ -595,9 +595,9 @@ TFA_MAKE_FLAGS += \ $(if $(USE_UBI),UBI=1 $(if $(findstring mt7622,$(PLAT)),OVERRIDE_UBI_START_ADDR=0x80000)) \ $(if $(USE_UBI),UBI=1 $(if $(findstring mt7981,$(PLAT)),OVERRIDE_UBI_START_ADDR=0x100000)) \ $(if $(USE_UBI),UBI=1 $(if $(findstring mt7986,$(PLAT)),OVERRIDE_UBI_START_ADDR=0x200000)) \ - $(if $(RAM_BOOT_UART_DL),bl2,all) \ $(if $(FIP_OFFSET),OVERRIDE_FIP_BASE=$(FIP_OFFSET)) \ - $(if $(FIP_SIZE),OVERRIDE_FIP_SIZE=$(FIP_SIZE)) + $(if $(FIP_SIZE),OVERRIDE_FIP_SIZE=$(FIP_SIZE)) \ + $(if $(RAM_BOOT_UART_DL),bl2,all) define Package/trusted-firmware-a-ram/install $(INSTALL_DIR) $(STAGING_DIR_IMAGE) diff --git a/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface b/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface index 1025d1f1e13..0d757510690 100644 --- a/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface +++ b/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface @@ -2,6 +2,7 @@ set_preinit_iface() { case $(board_name) in cudy,m3000-v1|\ cudy,tr3000-v1|\ + cudy,tr3000-v1-ubootmod|\ glinet,gl-mt3000|\ openembed,som7981) ip link set eth1 up diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 53215cc9687..7b64638ccb8 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -93,6 +93,7 @@ mediatek_setup_interfaces() ;; cudy,m3000-v1|\ cudy,tr3000-v1|\ + cudy,tr3000-v1-ubootmod|\ glinet,gl-mt2500|\ glinet,gl-mt3000|\ glinet,gl-x3000|\ diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index a0495115e73..95336eb2fc1 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -73,6 +73,7 @@ case "$board" in cudy,m3000-v1|\ cudy,re3000-v1|\ cudy,tr3000-v1|\ + cudy,tr3000-v1-ubootmod|\ cudy,wr3000s-v1|\ cudy,wr3000h-v1|\ cudy,wr3000-v1) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 06ad636c136..fe7006117f7 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -722,7 +722,7 @@ define Device/cudy_tr3000-v1 IMAGE_SIZE := 65536k KERNEL_IN_UBI := 1 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata - DEVICE_PACKAGES := kmod-usb3 kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware + DEVICE_PACKAGES := kmod-usb3 kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware automount endef TARGET_DEVICES += cudy_tr3000-v1 @@ -732,7 +732,7 @@ define Device/cudy_tr3000-v1-ubootmod DEVICE_VARIANT := v1 (OpenWrt U-Boot layout) DEVICE_DTS := mt7981b-cudy-tr3000-v1-ubootmod DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := kmod-usb3 kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware + DEVICE_PACKAGES := kmod-usb3 kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware automount UBINIZE_OPTS := -E 5 BLOCKSIZE := 128k PAGESIZE := 2048 From f64541db020ef5689186609e8b7b7a3bb9755160 Mon Sep 17 00:00:00 2001 From: Evan Jobling Date: Tue, 14 Jan 2025 12:13:21 +0000 Subject: [PATCH 168/173] realtek: HPE 1920 8G PoE+ 180W move fans to hwmon The GPIO numbering has changed and is not stable. As a result fan control via gpio_switch is broken, resulting in errors: "export_store: invalid GPIO 456" Move to using hwmon and gpio-fan. This is by adding gpio_fan_array to DTS and kmod-hwmon-gpiofan to DEVICE_PACKAGES. In combination with the new rtl8231 gpio driver the default fan behaviour will be maximum fan speed. Bump compat value to 1.1 due to existing config in /etc/config/system via gpio_switch. Also notify in device compat that fan is now going to be at bootloader setting (maximum in this case) by default unless turned down. Signed-off-by: Evan Jobling Link: https://github.com/openwrt/openwrt/pull/17605 Signed-off-by: Sander Vanheule --- .../realtek/base-files/etc/board.d/03_gpio_switches | 1 - .../realtek/base-files/etc/board.d/05_compat-version | 3 +++ .../realtek/dts/rtl8380_hpe_1920-8g-poe-180w.dts | 11 +++++++++++ target/linux/realtek/image/common.mk | 8 ++++++++ target/linux/realtek/image/rtl838x.mk | 3 ++- 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/target/linux/realtek/base-files/etc/board.d/03_gpio_switches b/target/linux/realtek/base-files/etc/board.d/03_gpio_switches index c869153e4ca..c178bd43308 100644 --- a/target/linux/realtek/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/realtek/base-files/etc/board.d/03_gpio_switches @@ -6,7 +6,6 @@ board_config_update board=$(board_name) case "$board" in -hpe,1920-8g-poe-180w|\ hpe,1920-24g-poe-180w|\ hpe,1920-24g-poe-370w) ucidef_add_gpio_switch "fan_ctrl" "Fan control" "456" "0" diff --git a/target/linux/realtek/base-files/etc/board.d/05_compat-version b/target/linux/realtek/base-files/etc/board.d/05_compat-version index 5c4ecb9aae3..687cbb32a5a 100644 --- a/target/linux/realtek/base-files/etc/board.d/05_compat-version +++ b/target/linux/realtek/base-files/etc/board.d/05_compat-version @@ -8,6 +8,9 @@ board_config_update case "$(board_name)" in + hpe,1920-8g-poe-180w) + ucidef_set_compat_version "1.1" + ;; zyxel,gs1900-8 | \ zyxel,gs1900-8hp-v1 | \ zyxel,gs1900-8hp-v2 | \ diff --git a/target/linux/realtek/dts/rtl8380_hpe_1920-8g-poe-180w.dts b/target/linux/realtek/dts/rtl8380_hpe_1920-8g-poe-180w.dts index 6398e6d034d..f15498354e9 100644 --- a/target/linux/realtek/dts/rtl8380_hpe_1920-8g-poe-180w.dts +++ b/target/linux/realtek/dts/rtl8380_hpe_1920-8g-poe-180w.dts @@ -5,6 +5,17 @@ / { compatible = "hpe,1920-8g-poe-180w", "realtek,rtl838x-soc"; model = "HPE 1920-8G-PoE+ 180W (JG922A)"; + + gpio_fan_array { + compatible = "gpio-fan"; + + gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; + gpio-fan,speed-map = <5000 0>, + <8200 1>; + + alarm-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; + #cooling-cells = <2>; + }; }; &uart1 { diff --git a/target/linux/realtek/image/common.mk b/target/linux/realtek/image/common.mk index d9647dbc072..e600b2347d7 100644 --- a/target/linux/realtek/image/common.mk +++ b/target/linux/realtek/image/common.mk @@ -56,6 +56,14 @@ define Device/hpe_1920 append-metadata endef +define Device/hwmon-fan-migration + DEVICE_COMPAT_VERSION := 1.1 + DEVICE_COMPAT_MESSAGE := Fan control switched to hwmon. Your fans will retain \ + bootloader speed unless another control scheme is in place. \ + Config cannot be kept due to conflict in gpio_switch config 'fan_ctrl' under \ + /etc/config/system. +endef + define Device/zyxel_gs1900 DEVICE_COMPAT_VERSION := 2.0 DEVICE_COMPAT_MESSAGE := Dual firmware paritition merged due to size constraints. \ diff --git a/target/linux/realtek/image/rtl838x.mk b/target/linux/realtek/image/rtl838x.mk index 866659ad141..27dbc6ce59a 100644 --- a/target/linux/realtek/image/rtl838x.mk +++ b/target/linux/realtek/image/rtl838x.mk @@ -120,9 +120,10 @@ TARGET_DEVICES += hpe_1920-8g-poe-65w define Device/hpe_1920-8g-poe-180w $(Device/hpe_1920) + $(Device/hwmon-fan-migration) SOC := rtl8380 DEVICE_MODEL := 1920-8G-PoE+ 180W (JG922A) - DEVICE_PACKAGES += realtek-poe + DEVICE_PACKAGES += realtek-poe kmod-hwmon-gpiofan H3C_DEVICE_ID := 0x00010025 SUPPORTED_DEVICES += hpe_1920-8g-poe endef From 07f8319d2d9166a41c2fd94ec1422bcd80ada991 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Owoc?= Date: Sat, 17 Aug 2024 16:59:58 +0200 Subject: [PATCH 169/173] qualcommax: ipq807x: add support for Linksys HomeWRK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hardware specification: ======== SoC: Qualcomm IPQ8174 Flash: 1GB (Micron MT29F8G08ABBCAH4 or AMD/Spansion S34MS08G2) RAM: 2GB (2x Kingston B5116ECMDXGJD or ESMT M15T2G16128A DDR3L) Ethernet: 4x 10/100/1000Mbps (Qualcomm QCA8075) WiFi1: 5GHz ax 2x2 (Qualcomm QCN5054 + Skyworks SKY85755-11) - channels 36-64 (low band) WiFi2: 2.4GHz ax 2x2 (Qualcomm QCN5024 + Skyworks SKY85340-11) WiFi3: 5GHz ax 4x4 (Qualcomm QCN5054 + Skyworks SKY85755-11) - channels 100-177 (high band) LED: 1x RGB status (NXP PCA9633) USB: 1x USB 3.0 Button: WPS, Reset Flash instructions: ======== 1. Installation from initramfs image using USB drive: Put the initramfs image on the USB drive: - dd bs=1M if=openwrt-qualcommax-ipq807x-linksys_homewrk-initramfs-uImage.itb of=/dev/sdX Connect serial console (JST PH 6-pin connector): - 1 - GND, 2 - TX, 4 - RX (115200, 8N1, 3.3V) Stop u-boot and run: - usb start && usbboot 44000000 0 && bootm 44000000 Write firmware to the flash from initramfs: - sysupgrade -n openwrt-qualcommax-ipq807x-linksys_homewrk-squashfs-sysupgrade.bin or - ubiformat /dev/mtd22 -y -f openwrt-qualcommax-ipq807x-linksys_homewrk-squashfs-factory.ubi 2. USB recovery: Put the initramfs image on the USB: - dd bs=1M if=openwrt-qualcommax-ipq807x-linksys_homewrk-initramfs-uImage.itb of=/dev/sdX Set u-boot env: - fw_setenv bootusb 'usb start && usbboot 44000000 0 && bootm 44000000' - fw_setenv bootcmd 'run bootusb; bootipq' Signed-off-by: Paweł Owoc Link: https://github.com/openwrt/openwrt/pull/17463 Signed-off-by: Robert Marko --- .../uboot-envtools/files/qualcommax_ipq807x | 5 ++ package/firmware/ipq-wifi/Makefile | 8 ++- .../arm64/boot/dts/qcom/ipq8174-homewrk.dts | 68 +++++++++++++++++++ target/linux/qualcommax/image/ipq807x.mk | 15 ++++ .../ipq807x/base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/firmware/11-ath11k-caldata | 1 + .../base-files/lib/upgrade/platform.sh | 5 ++ 7 files changed, 100 insertions(+), 3 deletions(-) create mode 100644 target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-homewrk.dts diff --git a/package/boot/uboot-envtools/files/qualcommax_ipq807x b/package/boot/uboot-envtools/files/qualcommax_ipq807x index 49754338a59..0fcd55b6010 100644 --- a/package/boot/uboot-envtools/files/qualcommax_ipq807x +++ b/package/boot/uboot-envtools/files/qualcommax_ipq807x @@ -29,6 +29,11 @@ edimax,cax1800) [ -n "$idx" ] && \ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x20000" ;; +linksys,homewrk) + idx="$(find_mtd_index 0:appsblenv)" + [ -n "$idx" ] && \ + ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x40000" + ;; linksys,mx4200v1|\ linksys,mx4200v2|\ linksys,mx5300|\ diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 9821e39a85f..da5fd5e23e9 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -6,9 +6,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware/qca-wireless.git -PKG_SOURCE_DATE:=2024-12-18 -PKG_SOURCE_VERSION:=4b849214b137b14a903112af3c2016ad9acf48c2 -PKG_MIRROR_HASH:=28162682fe7612460e42398ecc669e245fc0ece873361e3910c2dd8a56111f1c +PKG_SOURCE_DATE:=2025-01-15 +PKG_SOURCE_VERSION:=6e1801a4992fe72a98a2219f2dcd038194785971 +PKG_MIRROR_HASH:=569cf6894e21712ed6a5553b4fad0bbdeed14e0cc4b9292f5f86343f7897fc7e PKG_FLAGS:=nonshared include $(INCLUDE_DIR)/package.mk @@ -37,6 +37,7 @@ ALLWIFIBOARDS:= \ dynalink_dl-wrx36 \ edgecore_eap102 \ edimax_cax1800 \ + linksys_homewrk \ linksys_mr7350 \ linksys_mx4200 \ linksys_mx5300 \ @@ -168,6 +169,7 @@ $(eval $(call generate-ipq-wifi-package,compex_wpq873,Compex WPQ-873)) $(eval $(call generate-ipq-wifi-package,dynalink_dl-wrx36,Dynalink DL-WRX36)) $(eval $(call generate-ipq-wifi-package,edgecore_eap102,Edgecore EAP102)) $(eval $(call generate-ipq-wifi-package,edimax_cax1800,Edimax CAX1800)) +$(eval $(call generate-ipq-wifi-package,linksys_homewrk,Linksys HomeWRK)) $(eval $(call generate-ipq-wifi-package,linksys_mr7350,Linksys MR7350)) $(eval $(call generate-ipq-wifi-package,linksys_mx4200,Linksys MX4200)) $(eval $(call generate-ipq-wifi-package,linksys_mx5300,Linksys MX5300)) diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-homewrk.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-homewrk.dts new file mode 100644 index 00000000000..0e184452e30 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-homewrk.dts @@ -0,0 +1,68 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq8174-mx4x00.dtsi" + +/ { + model = "Linksys HomeWRK"; + compatible = "linksys,homewrk", "qcom,ipq8074"; + + aliases { + ethernet3 = &dp4; + ethernet4 = &dp5; + }; + + chosen { + bootargs-append = " root=/dev/ubiblock0_1"; + }; +}; + +&qpic_nand { + status = "okay"; + + nand@0 { + reg = <0>; + /* + * Some devices use Micron NAND with with 8 bit ECC + * other AMD/Spansion NAND with 4 bit ECC + *nand-ecc-strength = <4>; + *nand-ecc-step-size = <512>; + */ + nand-bus-width = <8>; + + partitions { + compatible = "qcom,smem-part"; + }; + }; +}; + +&dp2 { + status = "okay"; + phy-handle = <&qca8075_1>; + label = "wan"; +}; + +&dp3 { + status = "okay"; + phy-handle = <&qca8075_2>; + label = "lan3"; +}; + +&dp4 { + status = "okay"; + phy-handle = <&qca8075_3>; + label = "lan2"; +}; + +&dp5 { + status = "okay"; + phy-handle = <&qca8075_4>; + label = "lan1"; +}; + +&wifi { + status = "okay"; + + qcom,ath11k-calibration-variant = "Linksys-HomeWRK"; +}; diff --git a/target/linux/qualcommax/image/ipq807x.mk b/target/linux/qualcommax/image/ipq807x.mk index 260b358ce89..39fc63827ca 100644 --- a/target/linux/qualcommax/image/ipq807x.mk +++ b/target/linux/qualcommax/image/ipq807x.mk @@ -156,6 +156,21 @@ define Device/edimax_cax1800 endef TARGET_DEVICES += edimax_cax1800 +define Device/linksys_homewrk + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := Linksys + DEVICE_MODEL := HomeWRK + DEVICE_DTS_CONFIG := config@oak03 + BLOCKSIZE := 256k + PAGESIZE := 4096 + IMAGE_SIZE := 475m + NAND_SIZE := 1024m + SOC := ipq8174 + DEVICE_PACKAGES += kmod-leds-pca963x ipq-wifi-linksys_homewrk +endef +TARGET_DEVICES += linksys_homewrk + define Device/linksys_mx $(call Device/FitImage) DEVICE_VENDOR := Linksys diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network index 5bacbd7dee1..af1d2dfebbe 100644 --- a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network +++ b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network @@ -27,6 +27,7 @@ ipq807x_setup_interfaces() ucidef_set_interfaces_lan_wan "lan plc" "wan" ;; compex,wpq873|\ + linksys,homewrk|\ linksys,mx4200v1|\ linksys,mx4200v2|\ linksys,mx4300|\ diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata index 65e064ea4d2..ec772de8eb6 100644 --- a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata +++ b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata @@ -30,6 +30,7 @@ case "$FIRMWARE" in zte,mf269) caldata_extract "0:art" 0x1000 0x20000 ;; + linksys,homewrk|\ linksys,mx4200v1|\ linksys,mx8500) caldata_extract "0:art" 0x1000 0x20000 diff --git a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh index b53ec149fe2..2d68ec62ed7 100644 --- a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh @@ -166,6 +166,11 @@ platform_do_upgrade() { fw_setenv upgrade_available 1 nand_do_upgrade "$1" ;; + linksys,homewrk) + CI_UBIPART="rootfs" + remove_oem_ubi_volume ubi_rootfs + nand_do_upgrade "$1" + ;; linksys,mx4200v1|\ linksys,mx4200v2|\ linksys,mx4300|\ From 9decfc82dcd0d9d90fbdbddebba053492c594ca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Owoc?= Date: Fri, 10 Jan 2025 21:16:57 +0100 Subject: [PATCH 170/173] uboot-envtools: ipq807x: remove number of blocks and code simplification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Envtools can automatically detect the number of blocks. Signed-off-by: Paweł Owoc Link: https://github.com/openwrt/openwrt/pull/17463 Signed-off-by: Robert Marko --- .../uboot-envtools/files/qualcommax_ipq807x | 76 +++++++++---------- 1 file changed, 34 insertions(+), 42 deletions(-) diff --git a/package/boot/uboot-envtools/files/qualcommax_ipq807x b/package/boot/uboot-envtools/files/qualcommax_ipq807x index 0fcd55b6010..840e97fa10c 100644 --- a/package/boot/uboot-envtools/files/qualcommax_ipq807x +++ b/package/boot/uboot-envtools/files/qualcommax_ipq807x @@ -7,79 +7,71 @@ touch /etc/config/ubootenv board=$(board_name) +ubootenv_add_mtd() { + local idx="$(find_mtd_index "${1}")" + [ -n "$idx" ] && \ + ubootenv_add_uci_config "/dev/mtd$idx" "${2}" "${3}" "${4}" +} + +ubootenv_add_sys_mtd() { + local idx="$(find_mtd_index "${1}")" + [ -n "$idx" ] && \ + ubootenv_add_uci_sys_config "/dev/mtd$idx" "${2}" "${3}" "${4}" +} + +ubootenv_add_mmc() { + local mmcpart="$(find_mmc_part "${1}")" + [ -n "$mmcpart" ] && \ + ubootenv_add_uci_config "$mmcpart" "${2}" "${3}" "${4}" "${5}" +} + case "$board" in dynalink,dl-wrx36|\ netgear,rax120v2|\ +netgear,sxr80|\ +netgear,sxs80|\ netgear,wax218|\ netgear,wax620|\ -netgear,wax630) - idx="$(find_mtd_index 0:appsblenv)" - [ -n "$idx" ] && \ - ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2" +netgear,wax630|\ +tplink,eap620hd-v1|\ +tplink,eap660hd-v1) + ubootenv_add_mtd "0:appsblenv" "0x0" "0x40000" "0x20000" ;; compex,wpq873|\ edgecore,eap102|\ zyxel,nbg7815) - idx="$(find_mtd_index 0:appsblenv)" - [ -n "$idx" ] && \ - ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" "1" + ubootenv_add_mtd "0:appsblenv" "0x0" "0x10000" "0x10000" ;; edimax,cax1800) - idx="$(find_mtd_index 0:appsblenv)" - [ -n "$idx" ] && \ - ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x20000" + ubootenv_add_mtd "0:appsblenv" "0x0" "0x10000" "0x20000" ;; linksys,homewrk) - idx="$(find_mtd_index 0:appsblenv)" - [ -n "$idx" ] && \ - ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x40000" + ubootenv_add_mtd "0:appsblenv" "0x0" "0x40000" "0x40000" ;; linksys,mx4200v1|\ linksys,mx4200v2|\ linksys,mx5300|\ linksys,mx8500) - idx="$(find_mtd_index u_env)" - [ -n "$idx" ] && \ - ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2" + ubootenv_add_mtd "u_env" "0x0" "0x40000" "0x20000" ;; linksys,mx4300) - idx="$(find_mtd_index u_env)" - [ -n "$idx" ] && \ - ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x40000" "1" - ;; -netgear,sxr80|\ -netgear,sxs80|\ -tplink,eap620hd-v1|\ -tplink,eap660hd-v1) - idx="$(find_mtd_index 0:appsblenv)" - [ -n "$idx" ] && \ - ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" + ubootenv_add_mtd "u_env" "0x0" "0x40000" "0x40000" ;; redmi,ax6|\ xiaomi,ax3600|\ xiaomi,ax9000) - idx="$(find_mtd_index 0:appsblenv)" - [ -n "$idx" ] && \ - ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x20000" - idx2="$(find_mtd_index bdata)" - [ -n "$idx2" ] && \ - ubootenv_add_uci_sys_config "/dev/mtd$idx2" "0x0" "0x10000" "0x20000" + ubootenv_add_mtd "0:appsblenv" "0x0" "0x10000" "0x20000" + ubootenv_add_sys_mtd "bdata" "0x0" "0x10000" "0x20000" ;; prpl,haze) - mmcpart="$(find_mmc_part 0:APPSBLENV)" - [ -n "$mmcpart" ] && \ - ubootenv_add_uci_config "$mmcpart" "0x0" "0x40000" "0x400" "0x100" + ubootenv_add_mmc "0:APPSBLENV" "0x0" "0x40000" "0x400" "0x100" ;; asus,rt-ax89x|\ qnap,301w) - idx="$(find_mtd_index 0:appsblenv)" - [ -n "$idx" ] && \ - ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x20000" "0x20000" "1" + ubootenv_add_mtd "0:appsblenv" "0x0" "0x20000" "0x20000" ;; spectrum,sax1v1k) - mmcpart="$(find_mmc_part 0:APPSBLENV)" - [ -n "$mmcpart" ] && \ - ubootenv_add_uci_config "$mmcpart" "0x0" "0x40000" "0x40000" "1" + ubootenv_add_mmc "0:APPSBLENV" "0x0" "0x40000" "0x40000" "1" ;; esac From 112b21d616a586f1e4381b4ec4274d69ac188c74 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Wed, 15 Jan 2025 21:38:54 +0800 Subject: [PATCH 171/173] rockchip: backport latest gate link patches Signed-off-by: Tianling Shen --- ...kchip-support-clocks-registered-late.patch | 106 ++++++++++++++++++ ...hip-rk3588-register-GATE_LINK-later.patch} | 43 +++---- ...chip-expose-rockchip_clk_set_lookup.patch} | 34 ++---- ...implement-linked-gate-clock-support.patch} | 68 ++++------- ...kchip-rk3588-drop-RK3588_LINKED_CLK.patch} | 24 +--- ...dle-missing-clocks-with-EPROBE_DEFER.patch | 42 ------- ...d-property-to-disable-VLAN-hw-filter.patch | 2 +- ...69-add-devname-configuration-from-OF.patch | 6 +- ...-LED-configuration-from-OF-for-8211f.patch | 4 +- 9 files changed, 165 insertions(+), 164 deletions(-) create mode 100644 target/linux/rockchip/patches-6.6/030-12-v6.14-clk-rockchip-support-clocks-registered-late.patch rename target/linux/rockchip/patches-6.6/{111-03-clk-rockchip-rk3588-register-GATE_LINK-later.patch => 030-13-v6.14-clk-rockchip-rk3588-register-GATE_LINK-later.patch} (79%) rename target/linux/rockchip/patches-6.6/{111-04-clk-rockchip-expose-rockchip_clk_set_lookup.patch => 030-14-v6.14-clk-rockchip-expose-rockchip_clk_set_lookup.patch} (66%) rename target/linux/rockchip/patches-6.6/{111-06-clk-rockchip-implement-linked-gate-clock-support.patch => 030-15-v6.14-clk-rockchip-implement-linked-gate-clock-support.patch} (80%) rename target/linux/rockchip/patches-6.6/{111-07-clk-rockchip-rk3588-drop-RK3588_LINKED_CLK.patch => 030-16-v6.14-clk-rockchip-rk3588-drop-RK3588_LINKED_CLK.patch} (87%) delete mode 100644 target/linux/rockchip/patches-6.6/111-02-clk-rockchip-handle-missing-clocks-with-EPROBE_DEFER.patch diff --git a/target/linux/rockchip/patches-6.6/030-12-v6.14-clk-rockchip-support-clocks-registered-late.patch b/target/linux/rockchip/patches-6.6/030-12-v6.14-clk-rockchip-support-clocks-registered-late.patch new file mode 100644 index 00000000000..b5f32b2de62 --- /dev/null +++ b/target/linux/rockchip/patches-6.6/030-12-v6.14-clk-rockchip-support-clocks-registered-late.patch @@ -0,0 +1,106 @@ +From 9e89f02da718bc912f7f253b58804d4a52efed30 Mon Sep 17 00:00:00 2001 +From: Sebastian Reichel +Date: Wed, 11 Dec 2024 17:58:50 +0100 +Subject: [PATCH] clk: rockchip: support clocks registered late + +When some clocks are registered late and some clocks are registered +early we need to make sure the late registered clocks report probe defer +until the final registration has happened. + +But we do not want to keep reporting probe defer after the late +registration has happened. Also not all Rockchip SoCs have late +registered clocks and may not need to report probe defer at all. + +This restructures code a bit, so that there is a new function +rockchip_clk_init_early(), which should be used for initializing the CRU +structure on SoCs making use of late initialization in addition to the +early init. These platforms should call rockchip_clk_finalize() +once all clocks have been registered. + +Signed-off-by: Sebastian Reichel +[added EXPORT_SYMBOL_GPL(rockchip_clk_finalize) to match the early function] +Link: https://lore.kernel.org/r/20241211165957.94922-2-sebastian.reichel@collabora.com +Signed-off-by: Heiko Stuebner +--- + drivers/clk/rockchip/clk.c | 36 ++++++++++++++++++++++++++++++++---- + drivers/clk/rockchip/clk.h | 3 +++ + 2 files changed, 35 insertions(+), 4 deletions(-) + +--- a/drivers/clk/rockchip/clk.c ++++ b/drivers/clk/rockchip/clk.c +@@ -359,14 +359,17 @@ static struct clk *rockchip_clk_register + return hw->clk; + } + +-struct rockchip_clk_provider *rockchip_clk_init(struct device_node *np, +- void __iomem *base, +- unsigned long nr_clks) ++static struct rockchip_clk_provider *rockchip_clk_init_base( ++ struct device_node *np, void __iomem *base, ++ unsigned long nr_clks, bool has_late_clocks) + { + struct rockchip_clk_provider *ctx; + struct clk **clk_table; ++ struct clk *default_clk_val; + int i; + ++ default_clk_val = ERR_PTR(has_late_clocks ? -EPROBE_DEFER : -ENOENT); ++ + ctx = kzalloc(sizeof(struct rockchip_clk_provider), GFP_KERNEL); + if (!ctx) + return ERR_PTR(-ENOMEM); +@@ -376,7 +379,7 @@ struct rockchip_clk_provider *rockchip_c + goto err_free; + + for (i = 0; i < nr_clks; ++i) +- clk_table[i] = ERR_PTR(-ENOENT); ++ clk_table[i] = default_clk_val; + + ctx->reg_base = base; + ctx->clk_data.clks = clk_table; +@@ -393,8 +396,33 @@ err_free: + kfree(ctx); + return ERR_PTR(-ENOMEM); + } ++ ++struct rockchip_clk_provider *rockchip_clk_init(struct device_node *np, ++ void __iomem *base, ++ unsigned long nr_clks) ++{ ++ return rockchip_clk_init_base(np, base, nr_clks, false); ++} + EXPORT_SYMBOL_GPL(rockchip_clk_init); + ++struct rockchip_clk_provider *rockchip_clk_init_early(struct device_node *np, ++ void __iomem *base, ++ unsigned long nr_clks) ++{ ++ return rockchip_clk_init_base(np, base, nr_clks, true); ++} ++EXPORT_SYMBOL_GPL(rockchip_clk_init_early); ++ ++void rockchip_clk_finalize(struct rockchip_clk_provider *ctx) ++{ ++ int i; ++ ++ for (i = 0; i < ctx->clk_data.clk_num; ++i) ++ if (ctx->clk_data.clks[i] == ERR_PTR(-EPROBE_DEFER)) ++ ctx->clk_data.clks[i] = ERR_PTR(-ENOENT); ++} ++EXPORT_SYMBOL_GPL(rockchip_clk_finalize); ++ + void rockchip_clk_of_add_provider(struct device_node *np, + struct rockchip_clk_provider *ctx) + { +--- a/drivers/clk/rockchip/clk.h ++++ b/drivers/clk/rockchip/clk.h +@@ -972,6 +972,9 @@ struct rockchip_clk_branch { + + struct rockchip_clk_provider *rockchip_clk_init(struct device_node *np, + void __iomem *base, unsigned long nr_clks); ++struct rockchip_clk_provider *rockchip_clk_init_early(struct device_node *np, ++ void __iomem *base, unsigned long nr_clks); ++void rockchip_clk_finalize(struct rockchip_clk_provider *ctx); + void rockchip_clk_of_add_provider(struct device_node *np, + struct rockchip_clk_provider *ctx); + unsigned long rockchip_clk_find_max_clk_id(struct rockchip_clk_branch *list, diff --git a/target/linux/rockchip/patches-6.6/111-03-clk-rockchip-rk3588-register-GATE_LINK-later.patch b/target/linux/rockchip/patches-6.6/030-13-v6.14-clk-rockchip-rk3588-register-GATE_LINK-later.patch similarity index 79% rename from target/linux/rockchip/patches-6.6/111-03-clk-rockchip-rk3588-register-GATE_LINK-later.patch rename to target/linux/rockchip/patches-6.6/030-13-v6.14-clk-rockchip-rk3588-register-GATE_LINK-later.patch index 5647896c353..5e47d89a8f2 100644 --- a/target/linux/rockchip/patches-6.6/111-03-clk-rockchip-rk3588-register-GATE_LINK-later.patch +++ b/target/linux/rockchip/patches-6.6/030-13-v6.14-clk-rockchip-rk3588-register-GATE_LINK-later.patch @@ -1,23 +1,7 @@ +From 33af96244a66f855baa43d424844bb437c79c30c Mon Sep 17 00:00:00 2001 From: Sebastian Reichel -To: Michael Turquette , - Stephen Boyd , - linux-clk@vger.kernel.org -Cc: Elaine Zhang , - Kever Yang , - Heiko Stuebner , - Rob Herring , - Krzysztof Kozlowski , - Conor Dooley , - huangtao@rock-chips.com, andy.yan@rock-chips.com, - Michal Tomek , Ilya K , - Chad LeClair , - devicetree@vger.kernel.org, linux-rockchip@lists.infradead.org, - Sebastian Reichel , - kernel@collabora.com -Subject: [PATCH v9 3/7] clk: rockchip: rk3588: register GATE_LINK later -Date: Mon, 25 Mar 2024 20:33:34 +0100 [thread overview] -Message-ID: <20240325193609.237182-4-sebastian.reichel@collabora.com> (raw) -In-Reply-To: <20240325193609.237182-1-sebastian.reichel@collabora.com> +Date: Wed, 11 Dec 2024 17:58:51 +0100 +Subject: [PATCH] clk: rockchip: rk3588: register GATE_LINK later The proper GATE_LINK implementation will use runtime PM to handle the linked gate clocks, which requires device context. Currently all clocks @@ -33,9 +17,11 @@ are not needed early either, they have also been moved to the probe routine. Signed-off-by: Sebastian Reichel +Link: https://lore.kernel.org/r/20241211165957.94922-3-sebastian.reichel@collabora.com +Signed-off-by: Heiko Stuebner --- - drivers/clk/rockchip/clk-rk3588.c | 64 +++++++++++++++++++++++++++---- - 1 file changed, 56 insertions(+), 8 deletions(-) + drivers/clk/rockchip/clk-rk3588.c | 66 +++++++++++++++++++++++++++---- + 1 file changed, 58 insertions(+), 8 deletions(-) --- a/drivers/clk/rockchip/clk-rk3588.c +++ b/drivers/clk/rockchip/clk-rk3588.c @@ -67,7 +53,7 @@ Signed-off-by: Sebastian Reichel GATE_LINK(ACLK_ISP1_PRE, "aclk_isp1_pre", "aclk_isp1_root", ACLK_VI_ROOT, 0, RK3588_CLKGATE_CON(26), 6, GFLAGS), GATE_LINK(HCLK_ISP1_PRE, "hclk_isp1_pre", "hclk_isp1_root", HCLK_VI_ROOT, 0, RK3588_CLKGATE_CON(26), 8, GFLAGS), GATE_LINK(HCLK_NVM, "hclk_nvm", "hclk_nvm_root", ACLK_NVM_ROOT, RK3588_LINKED_CLK, RK3588_CLKGATE_CON(31), 2, GFLAGS), -@@ -2453,14 +2457,18 @@ static struct rockchip_clk_branch rk3588 +@@ -2453,26 +2457,31 @@ static struct rockchip_clk_branch rk3588 GATE_LINK(PCLK_VO1GRF, "pclk_vo1grf", "pclk_vo1_root", HCLK_VO1, CLK_IGNORE_UNUSED, RK3588_CLKGATE_CON(59), 12, GFLAGS), }; @@ -90,7 +76,13 @@ Signed-off-by: Sebastian Reichel reg_base = of_iomap(np, 0); if (!reg_base) { pr_err("%s: could not map cru region\n", __func__); -@@ -2473,6 +2481,7 @@ static void __init rk3588_clk_init(struc + return; + } + +- ctx = rockchip_clk_init(np, reg_base, clk_nr_clks); ++ ctx = rockchip_clk_init_early(np, reg_base, clk_nr_clks); + if (IS_ERR(ctx)) { + pr_err("%s: rockchip clk init failed\n", __func__); iounmap(reg_base); return; } @@ -98,7 +90,7 @@ Signed-off-by: Sebastian Reichel rockchip_clk_register_plls(ctx, rk3588_pll_clks, ARRAY_SIZE(rk3588_pll_clks), -@@ -2491,14 +2500,53 @@ static void __init rk3588_clk_init(struc +@@ -2491,14 +2500,55 @@ static void __init rk3588_clk_init(struc &rk3588_cpub1clk_data, rk3588_cpub1clk_rates, ARRAY_SIZE(rk3588_cpub1clk_rates)); @@ -119,7 +111,8 @@ Signed-off-by: Sebastian Reichel ARRAY_SIZE(rk3588_clk_branches)); - rk3588_rst_init(np, reg_base); -- ++ rockchip_clk_finalize(ctx); + + rk3588_rst_init(np, ctx->reg_base); rockchip_register_restart_notifier(ctx, RK3588_GLB_SRST_FST, NULL); diff --git a/target/linux/rockchip/patches-6.6/111-04-clk-rockchip-expose-rockchip_clk_set_lookup.patch b/target/linux/rockchip/patches-6.6/030-14-v6.14-clk-rockchip-expose-rockchip_clk_set_lookup.patch similarity index 66% rename from target/linux/rockchip/patches-6.6/111-04-clk-rockchip-expose-rockchip_clk_set_lookup.patch rename to target/linux/rockchip/patches-6.6/030-14-v6.14-clk-rockchip-expose-rockchip_clk_set_lookup.patch index 998b679d07e..8711733f51e 100644 --- a/target/linux/rockchip/patches-6.6/111-04-clk-rockchip-expose-rockchip_clk_set_lookup.patch +++ b/target/linux/rockchip/patches-6.6/030-14-v6.14-clk-rockchip-expose-rockchip_clk_set_lookup.patch @@ -1,30 +1,16 @@ +From fe0fb6675fa48cade97d8bcd46226479c4a704df Mon Sep 17 00:00:00 2001 From: Sebastian Reichel -To: Michael Turquette , - Stephen Boyd , - linux-clk@vger.kernel.org -Cc: Elaine Zhang , - Kever Yang , - Heiko Stuebner , - Rob Herring , - Krzysztof Kozlowski , - Conor Dooley , - huangtao@rock-chips.com, andy.yan@rock-chips.com, - Michal Tomek , Ilya K , - Chad LeClair , - devicetree@vger.kernel.org, linux-rockchip@lists.infradead.org, - Sebastian Reichel , - kernel@collabora.com -Subject: [PATCH v9 4/7] clk: rockchip: expose rockchip_clk_set_lookup -Date: Mon, 25 Mar 2024 20:33:35 +0100 [thread overview] -Message-ID: <20240325193609.237182-5-sebastian.reichel@collabora.com> (raw) -In-Reply-To: <20240325193609.237182-1-sebastian.reichel@collabora.com> +Date: Wed, 11 Dec 2024 17:58:52 +0100 +Subject: [PATCH] clk: rockchip: expose rockchip_clk_set_lookup Move rockchip_clk_add_lookup to clk.h, so that it can be used by sub-devices with their own driver. These might also have to do a lookup, so rename the function to rockchip_clk_set_lookup -and add a matching rockchip_clk_add_lookup. +and add a matching rockchip_clk_get_lookup. Signed-off-by: Sebastian Reichel +Link: https://lore.kernel.org/r/20241211165957.94922-4-sebastian.reichel@collabora.com +Signed-off-by: Heiko Stuebner --- drivers/clk/rockchip/clk.c | 14 ++++---------- drivers/clk/rockchip/clk.h | 12 ++++++++++++ @@ -54,7 +40,7 @@ Signed-off-by: Sebastian Reichel /* notifier on the fraction divider to catch rate changes */ if (frac->mux_frac_idx >= 0) { -@@ -424,7 +418,7 @@ void rockchip_clk_register_plls(struct r +@@ -452,7 +446,7 @@ void rockchip_clk_register_plls(struct r continue; } @@ -63,7 +49,7 @@ Signed-off-by: Sebastian Reichel } } EXPORT_SYMBOL_GPL(rockchip_clk_register_plls); -@@ -586,7 +580,7 @@ void rockchip_clk_register_branches(stru +@@ -614,7 +608,7 @@ void rockchip_clk_register_branches(stru continue; } @@ -72,7 +58,7 @@ Signed-off-by: Sebastian Reichel } } EXPORT_SYMBOL_GPL(rockchip_clk_register_branches); -@@ -610,7 +604,7 @@ void rockchip_clk_register_armclk(struct +@@ -638,7 +632,7 @@ void rockchip_clk_register_armclk(struct return; } @@ -101,4 +87,4 @@ Signed-off-by: Sebastian Reichel + struct rockchip_clk_provider *rockchip_clk_init(struct device_node *np, void __iomem *base, unsigned long nr_clks); - void rockchip_clk_of_add_provider(struct device_node *np, + struct rockchip_clk_provider *rockchip_clk_init_early(struct device_node *np, diff --git a/target/linux/rockchip/patches-6.6/111-06-clk-rockchip-implement-linked-gate-clock-support.patch b/target/linux/rockchip/patches-6.6/030-15-v6.14-clk-rockchip-implement-linked-gate-clock-support.patch similarity index 80% rename from target/linux/rockchip/patches-6.6/111-06-clk-rockchip-implement-linked-gate-clock-support.patch rename to target/linux/rockchip/patches-6.6/030-15-v6.14-clk-rockchip-implement-linked-gate-clock-support.patch index 8e4799c5bce..6e8da4c82c8 100644 --- a/target/linux/rockchip/patches-6.6/111-06-clk-rockchip-implement-linked-gate-clock-support.patch +++ b/target/linux/rockchip/patches-6.6/030-15-v6.14-clk-rockchip-implement-linked-gate-clock-support.patch @@ -1,23 +1,7 @@ +From c62fa612cfa66ab58ab215e5afc95c43c613b513 Mon Sep 17 00:00:00 2001 From: Sebastian Reichel -To: Michael Turquette , - Stephen Boyd , - linux-clk@vger.kernel.org -Cc: Elaine Zhang , - Kever Yang , - Heiko Stuebner , - Rob Herring , - Krzysztof Kozlowski , - Conor Dooley , - huangtao@rock-chips.com, andy.yan@rock-chips.com, - Michal Tomek , Ilya K , - Chad LeClair , - devicetree@vger.kernel.org, linux-rockchip@lists.infradead.org, - Sebastian Reichel , - kernel@collabora.com -Subject: [PATCH v9 6/7] clk: rockchip: implement linked gate clock support -Date: Mon, 25 Mar 2024 20:33:37 +0100 [thread overview] -Message-ID: <20240325193609.237182-7-sebastian.reichel@collabora.com> (raw) -In-Reply-To: <20240325193609.237182-1-sebastian.reichel@collabora.com> +Date: Wed, 11 Dec 2024 17:58:53 +0100 +Subject: [PATCH] clk: rockchip: implement linked gate clock support Recent Rockchip SoCs have a new hardware block called Native Interface Unit (NIU), which gates clocks to devices behind them. These clock @@ -36,13 +20,15 @@ to use the correct runtime PM operations. Thus the complete handling of these clocks has been moved into its own driver. Signed-off-by: Sebastian Reichel +Link: https://lore.kernel.org/r/20241211165957.94922-5-sebastian.reichel@collabora.com +Signed-off-by: Heiko Stuebner --- drivers/clk/rockchip/Makefile | 1 + - drivers/clk/rockchip/clk-rk3588.c | 23 +------ - drivers/clk/rockchip/clk.c | 52 ++++++++++++++++ - drivers/clk/rockchip/clk.h | 25 ++++++++ - drivers/clk/rockchip/gate-link.c | 99 +++++++++++++++++++++++++++++++ - 5 files changed, 179 insertions(+), 21 deletions(-) + drivers/clk/rockchip/clk-rk3588.c | 23 +-------- + drivers/clk/rockchip/clk.c | 52 +++++++++++++++++++ + drivers/clk/rockchip/clk.h | 25 +++++++++ + drivers/clk/rockchip/gate-link.c | 85 +++++++++++++++++++++++++++++++ + 5 files changed, 165 insertions(+), 21 deletions(-) create mode 100644 drivers/clk/rockchip/gate-link.c --- a/drivers/clk/rockchip/Makefile @@ -92,8 +78,8 @@ Signed-off-by: Sebastian Reichel + rockchip_clk_register_late_branches(dev, ctx, rk3588_clk_branches, + ARRAY_SIZE(rk3588_clk_branches)); - rk3588_rst_init(np, ctx->reg_base); - rockchip_register_restart_notifier(ctx, RK3588_GLB_SRST_FST, NULL); + rockchip_clk_finalize(ctx); + --- a/drivers/clk/rockchip/clk.c +++ b/drivers/clk/rockchip/clk.c @@ -19,6 +19,7 @@ @@ -104,7 +90,7 @@ Signed-off-by: Sebastian Reichel #include #include -@@ -440,6 +441,29 @@ unsigned long rockchip_clk_find_max_clk_ +@@ -468,6 +469,29 @@ unsigned long rockchip_clk_find_max_clk_ } EXPORT_SYMBOL_GPL(rockchip_clk_find_max_clk_id); @@ -134,7 +120,7 @@ Signed-off-by: Sebastian Reichel void rockchip_clk_register_branches(struct rockchip_clk_provider *ctx, struct rockchip_clk_branch *list, unsigned int nr_clk) -@@ -565,6 +589,9 @@ void rockchip_clk_register_branches(stru +@@ -593,6 +617,9 @@ void rockchip_clk_register_branches(stru list->div_width, list->div_flags, ctx->reg_base, &ctx->lock); break; @@ -144,7 +130,7 @@ Signed-off-by: Sebastian Reichel } /* none of the cases above matched */ -@@ -585,6 +612,31 @@ void rockchip_clk_register_branches(stru +@@ -613,6 +640,31 @@ void rockchip_clk_register_branches(stru } EXPORT_SYMBOL_GPL(rockchip_clk_register_branches); @@ -226,8 +212,8 @@ Signed-off-by: Sebastian Reichel + struct rockchip_clk_provider *rockchip_clk_init(struct device_node *np, void __iomem *base, unsigned long nr_clks); - void rockchip_clk_of_add_provider(struct device_node *np, -@@ -991,6 +1012,10 @@ unsigned long rockchip_clk_find_max_clk_ + struct rockchip_clk_provider *rockchip_clk_init_early(struct device_node *np, +@@ -994,6 +1015,10 @@ unsigned long rockchip_clk_find_max_clk_ void rockchip_clk_register_branches(struct rockchip_clk_provider *ctx, struct rockchip_clk_branch *list, unsigned int nr_clk); @@ -240,7 +226,7 @@ Signed-off-by: Sebastian Reichel unsigned int nr_pll, int grf_lock_offset); --- /dev/null +++ b/drivers/clk/rockchip/gate-link.c -@@ -0,0 +1,99 @@ +@@ -0,0 +1,85 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2024 Collabora Ltd. @@ -308,30 +294,16 @@ Signed-off-by: Sebastian Reichel + return ret; +} + -+static void rk_clk_gate_link_remove(struct platform_device *pdev) -+{ -+ struct rockchip_gate_link_platdata *pdata; -+ struct device *dev = &pdev->dev; -+ struct clk *clk, *linked_clk; -+ -+ pdata = dev_get_platdata(dev); -+ clk = rockchip_clk_get_lookup(pdata->ctx, pdata->clkbr->id); -+ linked_clk = rockchip_clk_get_lookup(pdata->ctx, pdata->clkbr->linked_clk_id); -+ rockchip_clk_set_lookup(pdata->ctx, ERR_PTR(-ENODEV), pdata->clkbr->id); -+ clk_unregister_gate(clk); -+ pm_clk_remove_clk(dev, linked_clk); -+} -+ +static const struct dev_pm_ops rk_clk_gate_link_pm_ops = { + SET_RUNTIME_PM_OPS(pm_clk_suspend, pm_clk_resume, NULL) +}; + -+struct platform_driver rk_clk_gate_link_driver = { ++static struct platform_driver rk_clk_gate_link_driver = { + .probe = rk_clk_gate_link_probe, -+ .remove_new = rk_clk_gate_link_remove, + .driver = { + .name = "rockchip-gate-link-clk", + .pm = &rk_clk_gate_link_pm_ops, ++ .suppress_bind_attrs = true, + }, +}; + diff --git a/target/linux/rockchip/patches-6.6/111-07-clk-rockchip-rk3588-drop-RK3588_LINKED_CLK.patch b/target/linux/rockchip/patches-6.6/030-16-v6.14-clk-rockchip-rk3588-drop-RK3588_LINKED_CLK.patch similarity index 87% rename from target/linux/rockchip/patches-6.6/111-07-clk-rockchip-rk3588-drop-RK3588_LINKED_CLK.patch rename to target/linux/rockchip/patches-6.6/030-16-v6.14-clk-rockchip-rk3588-drop-RK3588_LINKED_CLK.patch index cbae321b85c..0e487f9b48c 100644 --- a/target/linux/rockchip/patches-6.6/111-07-clk-rockchip-rk3588-drop-RK3588_LINKED_CLK.patch +++ b/target/linux/rockchip/patches-6.6/030-16-v6.14-clk-rockchip-rk3588-drop-RK3588_LINKED_CLK.patch @@ -1,29 +1,15 @@ +From e9cdd7d6cf2a5031a968dc21f4f566101b602150 Mon Sep 17 00:00:00 2001 From: Sebastian Reichel -To: Michael Turquette , - Stephen Boyd , - linux-clk@vger.kernel.org -Cc: Elaine Zhang , - Kever Yang , - Heiko Stuebner , - Rob Herring , - Krzysztof Kozlowski , - Conor Dooley , - huangtao@rock-chips.com, andy.yan@rock-chips.com, - Michal Tomek , Ilya K , - Chad LeClair , - devicetree@vger.kernel.org, linux-rockchip@lists.infradead.org, - Sebastian Reichel , - kernel@collabora.com -Subject: [PATCH v9 7/7] clk: rockchip: rk3588: drop RK3588_LINKED_CLK -Date: Mon, 25 Mar 2024 20:33:38 +0100 [thread overview] -Message-ID: <20240325193609.237182-8-sebastian.reichel@collabora.com> (raw) -In-Reply-To: <20240325193609.237182-1-sebastian.reichel@collabora.com> +Date: Wed, 11 Dec 2024 17:58:54 +0100 +Subject: [PATCH] clk: rockchip: rk3588: drop RK3588_LINKED_CLK With the proper GATE_LINK support, we no longer need to keep the linked clocks always on. Thus it's time to drop the CLK_IS_CRITICAL flag for them. Signed-off-by: Sebastian Reichel +Link: https://lore.kernel.org/r/20241211165957.94922-6-sebastian.reichel@collabora.com +Signed-off-by: Heiko Stuebner --- drivers/clk/rockchip/clk-rk3588.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/target/linux/rockchip/patches-6.6/111-02-clk-rockchip-handle-missing-clocks-with-EPROBE_DEFER.patch b/target/linux/rockchip/patches-6.6/111-02-clk-rockchip-handle-missing-clocks-with-EPROBE_DEFER.patch deleted file mode 100644 index 9d138264b7f..00000000000 --- a/target/linux/rockchip/patches-6.6/111-02-clk-rockchip-handle-missing-clocks-with-EPROBE_DEFER.patch +++ /dev/null @@ -1,42 +0,0 @@ -From: Sebastian Reichel -To: Michael Turquette , - Stephen Boyd , - linux-clk@vger.kernel.org -Cc: Elaine Zhang , - Kever Yang , - Heiko Stuebner , - Rob Herring , - Krzysztof Kozlowski , - Conor Dooley , - huangtao@rock-chips.com, andy.yan@rock-chips.com, - Michal Tomek , Ilya K , - Chad LeClair , - devicetree@vger.kernel.org, linux-rockchip@lists.infradead.org, - Sebastian Reichel , - kernel@collabora.com -Subject: [PATCH v9 2/7] clk: rockchip: handle missing clocks with -EPROBE_DEFER -Date: Mon, 25 Mar 2024 20:33:33 +0100 [thread overview] -Message-ID: <20240325193609.237182-3-sebastian.reichel@collabora.com> (raw) -In-Reply-To: <20240325193609.237182-1-sebastian.reichel@collabora.com> - -In the future some clocks will be registered using CLK_OF_DECLARE -and some are registered later from the driver probe routine. Any -clock handled by the probe routine should return -EPROBE_DEFER -until that routine has been called. - -Signed-off-by: Sebastian Reichel ---- - drivers/clk/rockchip/clk.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/clk/rockchip/clk.c -+++ b/drivers/clk/rockchip/clk.c -@@ -376,7 +376,7 @@ struct rockchip_clk_provider *rockchip_c - goto err_free; - - for (i = 0; i < nr_clks; ++i) -- clk_table[i] = ERR_PTR(-ENOENT); -+ clk_table[i] = ERR_PTR(-EPROBE_DEFER); - - ctx->reg_base = base; - ctx->clk_data.clks = clk_table; diff --git a/target/linux/rockchip/patches-6.6/600-ethernet-stmmac-Add-property-to-disable-VLAN-hw-filter.patch b/target/linux/rockchip/patches-6.6/600-ethernet-stmmac-Add-property-to-disable-VLAN-hw-filter.patch index f2af29b4027..92810e0e14e 100644 --- a/target/linux/rockchip/patches-6.6/600-ethernet-stmmac-Add-property-to-disable-VLAN-hw-filter.patch +++ b/target/linux/rockchip/patches-6.6/600-ethernet-stmmac-Add-property-to-disable-VLAN-hw-filter.patch @@ -46,7 +46,7 @@ Signed-off-by: jensen } --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c -@@ -570,6 +570,9 @@ stmmac_probe_config_dt(struct platform_d +@@ -589,6 +589,9 @@ stmmac_probe_config_dt(struct platform_d "force_sf_dma_mode is ignored if force_thresh_dma_mode is set.\n"); } diff --git a/target/linux/rockchip/patches-6.6/602-net-ethernet-r8169-add-devname-configuration-from-OF.patch b/target/linux/rockchip/patches-6.6/602-net-ethernet-r8169-add-devname-configuration-from-OF.patch index 0f45d532e1c..c6f6a643181 100644 --- a/target/linux/rockchip/patches-6.6/602-net-ethernet-r8169-add-devname-configuration-from-OF.patch +++ b/target/linux/rockchip/patches-6.6/602-net-ethernet-r8169-add-devname-configuration-from-OF.patch @@ -1,6 +1,6 @@ --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -21,6 +21,7 @@ +@@ -22,6 +22,7 @@ #include #include #include @@ -8,7 +8,7 @@ #include #include #include -@@ -5379,6 +5380,7 @@ static int rtl_init_one(struct pci_dev * +@@ -5393,6 +5394,7 @@ static int rtl_init_one(struct pci_dev * int jumbo_max, region, rc; enum mac_version chipset; struct net_device *dev; @@ -16,7 +16,7 @@ u32 txconfig; u16 xid; -@@ -5386,6 +5388,9 @@ static int rtl_init_one(struct pci_dev * +@@ -5400,6 +5402,9 @@ static int rtl_init_one(struct pci_dev * if (!dev) return -ENOMEM; diff --git a/target/linux/rockchip/patches-6.6/604-net-phy-realtek-add-LED-configuration-from-OF-for-8211f.patch b/target/linux/rockchip/patches-6.6/604-net-phy-realtek-add-LED-configuration-from-OF-for-8211f.patch index ebdaa448c14..9a0bb6803e7 100644 --- a/target/linux/rockchip/patches-6.6/604-net-phy-realtek-add-LED-configuration-from-OF-for-8211f.patch +++ b/target/linux/rockchip/patches-6.6/604-net-phy-realtek-add-LED-configuration-from-OF-for-8211f.patch @@ -17,7 +17,7 @@ Subject: [PATCH] net: phy: realtek: add LED configuration from OF for 8211f #define RTL8211F_LEDCR 0x10 #define RTL8211F_LEDCR_MODE BIT(15) #define RTL8211F_LEDCR_ACT_TXRX BIT(4) -@@ -379,6 +380,7 @@ static int rtl8211f_config_init(struct p +@@ -380,6 +381,7 @@ static int rtl8211f_config_init(struct p struct rtl821x_priv *priv = phydev->priv; struct device *dev = &phydev->mdio.dev; u16 val_txdly, val_rxdly; @@ -25,7 +25,7 @@ Subject: [PATCH] net: phy: realtek: add LED configuration from OF for 8211f int ret; ret = phy_modify_paged_changed(phydev, 0xa43, RTL8211F_PHYCR1, -@@ -445,6 +447,15 @@ static int rtl8211f_config_init(struct p +@@ -446,6 +448,15 @@ static int rtl8211f_config_init(struct p val_rxdly ? "enabled" : "disabled"); } From 67a4aeef6c63e5836bd6b82faf6cc15934869efb Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 15 Jan 2025 21:46:53 +0100 Subject: [PATCH 172/173] netifd: fix napi process name matching in packet steering script Fixes CPU usage imbalance on some devices using threaded NAPI Signed-off-by: Felix Fietkau --- .../config/netifd/files/usr/libexec/network/packet-steering.uc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/config/netifd/files/usr/libexec/network/packet-steering.uc b/package/network/config/netifd/files/usr/libexec/network/packet-steering.uc index a578e288791..b2229e5d793 100755 --- a/package/network/config/netifd/files/usr/libexec/network/packet-steering.uc +++ b/package/network/config/netifd/files/usr/libexec/network/packet-steering.uc @@ -87,7 +87,7 @@ function set_netdev_cpu(dev, cpu) { function task_device_match(name, device) { - let napi_match = match(name, /napi\/([^-+])-\d+/); + let napi_match = match(name, /napi\/([^-]*)-\d+/); if (!napi_match) napi_match = match(name, /mt76-tx (phy\d+)/); if (napi_match && From 0a7c8ed9d94930ba062c71df79f63c06eeab4543 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Wed, 15 Jan 2025 20:12:02 +0100 Subject: [PATCH 173/173] realtek: HPE 1920 24G PoE+ 180W/370W move fans to hwmon Apply the equivalent of commit f64541db020e ("realtek: HPE 1920 8G PoE+ 180W move fans to hwmon") to the 24-ports variants of the HPE 1920 PoE+ switches, with model numbers JG925A and JG926A. Copy from the original commit message: Move to using hwmon and gpio-fan. This is by adding gpio_fan_array to DTS and kmod-hwmon-gpiofan to DEVICE_PACKAGES. In combination with the new rtl8231 gpio driver the default fan behaviour will be maximum fan speed. Bump compat value to 1.1 due to existing config in /etc/config/system via gpio_switch. Also notify in device compat that fan is now going to be at bootloader setting (maximum in this case) by default unless turned down. As the init script 03_gpio_switches does not perform any action after removing these devices from it, the file can be dropped. Link: https://github.com/openwrt/openwrt/pull/17598 Signed-off-by: Fabian Groffen Signed-off-by: Sander Vanheule --- .../base-files/etc/board.d/03_gpio_switches | 17 ----------------- .../base-files/etc/board.d/05_compat-version | 4 +++- .../dts/rtl8382_hpe_1920-24g-poe-180w.dts | 11 +++++++++++ .../dts/rtl8382_hpe_1920-24g-poe-370w.dts | 11 +++++++++++ target/linux/realtek/image/rtl838x.mk | 6 ++++-- 5 files changed, 29 insertions(+), 20 deletions(-) delete mode 100644 target/linux/realtek/base-files/etc/board.d/03_gpio_switches diff --git a/target/linux/realtek/base-files/etc/board.d/03_gpio_switches b/target/linux/realtek/base-files/etc/board.d/03_gpio_switches deleted file mode 100644 index c178bd43308..00000000000 --- a/target/linux/realtek/base-files/etc/board.d/03_gpio_switches +++ /dev/null @@ -1,17 +0,0 @@ - -. /lib/functions/uci-defaults.sh - -board_config_update - -board=$(board_name) - -case "$board" in -hpe,1920-24g-poe-180w|\ -hpe,1920-24g-poe-370w) - ucidef_add_gpio_switch "fan_ctrl" "Fan control" "456" "0" - ;; -esac - -board_config_flush - -exit 0 diff --git a/target/linux/realtek/base-files/etc/board.d/05_compat-version b/target/linux/realtek/base-files/etc/board.d/05_compat-version index 687cbb32a5a..9c27314b241 100644 --- a/target/linux/realtek/base-files/etc/board.d/05_compat-version +++ b/target/linux/realtek/base-files/etc/board.d/05_compat-version @@ -8,7 +8,9 @@ board_config_update case "$(board_name)" in - hpe,1920-8g-poe-180w) + hpe,1920-8g-poe-180w | \ + hpe,1920-24g-poe-180w | \ + hpe,1920-24g-poe-370w) ucidef_set_compat_version "1.1" ;; zyxel,gs1900-8 | \ diff --git a/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-180w.dts b/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-180w.dts index 4783cec15ca..69e647c59a9 100644 --- a/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-180w.dts +++ b/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-180w.dts @@ -5,6 +5,17 @@ / { compatible = "hpe,1920-24g-poe-180w", "realtek,rtl838x-soc"; model = "HPE 1920-24G-PoE+ 180W (JG925A)"; + + gpio_fan_array { + compatible = "gpio-fan"; + + gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; + gpio-fan,speed-map = <5000 0>, + <8200 1>; + + alarm-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; + #cooling-cells = <2>; + }; }; &uart1 { diff --git a/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-370w.dts b/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-370w.dts index ccdcf71d1bd..532f23ab2f2 100644 --- a/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-370w.dts +++ b/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-370w.dts @@ -5,6 +5,17 @@ / { compatible = "hpe,1920-24g-poe-370w", "realtek,rtl838x-soc"; model = "HPE 1920-24G-PoE+ 370W (JG926A)"; + + gpio_fan_array { + compatible = "gpio-fan"; + + gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; + gpio-fan,speed-map = <5000 0>, + <8200 1>; + + alarm-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; + #cooling-cells = <2>; + }; }; &uart1 { diff --git a/target/linux/realtek/image/rtl838x.mk b/target/linux/realtek/image/rtl838x.mk index 27dbc6ce59a..34464316c7f 100644 --- a/target/linux/realtek/image/rtl838x.mk +++ b/target/linux/realtek/image/rtl838x.mk @@ -147,18 +147,20 @@ TARGET_DEVICES += hpe_1920-24g define Device/hpe_1920-24g-poe-180w $(Device/hpe_1920) + $(Device/hwmon-fan-migration) SOC := rtl8382 DEVICE_MODEL := 1920-24G-PoE+ 180W (JG925A) - DEVICE_PACKAGES += realtek-poe + DEVICE_PACKAGES += realtek-poe kmod-hwmon-gpiofan H3C_DEVICE_ID := 0x00010028 endef TARGET_DEVICES += hpe_1920-24g-poe-180w define Device/hpe_1920-24g-poe-370w $(Device/hpe_1920) + $(Device/hwmon-fan-migration) SOC := rtl8382 DEVICE_MODEL := 1920-24G-PoE+ 370W (JG926A) - DEVICE_PACKAGES += realtek-poe + DEVICE_PACKAGES += realtek-poe kmod-hwmon-gpiofan H3C_DEVICE_ID := 0x00010029 endef TARGET_DEVICES += hpe_1920-24g-poe-370w