From ecd81de7a5ab4899cc95107b402f7a402caf70bd Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Fri, 8 Apr 2022 10:20:08 +0000 Subject: [PATCH 01/26] ath79: add nvmem cell mac-address-ascii support This is needed for devices with mac address stored in ascii format, e.g. HiWiFi HC6361 to be ported in the following patch. Signed-off-by: Yousong Zhou --- ...of_net-add-mac-address-ascii-support.patch | 103 ++++++++++++++++++ ...of_net-add-mac-address-ascii-support.patch | 103 ++++++++++++++++++ 2 files changed, 206 insertions(+) create mode 100644 target/linux/ath79/patches-5.10/600-of_net-add-mac-address-ascii-support.patch create mode 100644 target/linux/ath79/patches-5.15/600-of_net-add-mac-address-ascii-support.patch diff --git a/target/linux/ath79/patches-5.10/600-of_net-add-mac-address-ascii-support.patch b/target/linux/ath79/patches-5.10/600-of_net-add-mac-address-ascii-support.patch new file mode 100644 index 0000000000..8849afb4d6 --- /dev/null +++ b/target/linux/ath79/patches-5.10/600-of_net-add-mac-address-ascii-support.patch @@ -0,0 +1,103 @@ +Index: linux-5.15.31/net/ethernet/eth.c +=================================================================== +--- linux-5.15.31.orig/net/ethernet/eth.c ++++ linux-5.15.31/net/ethernet/eth.c +@@ -544,6 +544,63 @@ int eth_platform_get_mac_address(struct + } + EXPORT_SYMBOL(eth_platform_get_mac_address); + ++static void *nvmem_cell_get_mac_address(struct nvmem_cell *cell) ++{ ++ size_t len; ++ void *mac; ++ ++ mac = nvmem_cell_read(cell, &len); ++ if (IS_ERR(mac)) ++ return PTR_ERR(mac); ++ if (len != ETH_ALEN) { ++ kfree(mac); ++ return ERR_PTR(-EINVAL); ++ } ++ return mac; ++} ++ ++static void *nvmem_cell_get_mac_address_ascii(struct nvmem_cell *cell) ++{ ++ size_t len; ++ int ret; ++ void *mac_ascii; ++ u8 *mac; ++ ++ mac_ascii = nvmem_cell_read(cell, &len); ++ if (IS_ERR(mac_ascii)) ++ return PTR_ERR(mac_ascii); ++ if (len != ETH_ALEN*2+5) { ++ kfree(mac_ascii); ++ return ERR_PTR(-EINVAL); ++ } ++ mac = kmalloc(ETH_ALEN, GFP_KERNEL); ++ if (!mac) { ++ kfree(mac_ascii); ++ return ERR_PTR(-ENOMEM); ++ } ++ ret = sscanf(mac_ascii, "%2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx", ++ &mac[0], &mac[1], &mac[2], ++ &mac[3], &mac[4], &mac[5]); ++ kfree(mac_ascii); ++ if (ret == ETH_ALEN) ++ return mac; ++ kfree(mac); ++ return ERR_PTR(-EINVAL); ++} ++ ++static struct nvmem_cell_mac_address_property { ++ char *name; ++ void *(*read)(struct nvmem_cell *); ++} nvmem_cell_mac_address_properties[] = { ++ { ++ .name = "mac-address", ++ .read = nvmem_cell_get_mac_address, ++ }, { ++ .name = "mac-address-ascii", ++ .read = nvmem_cell_get_mac_address_ascii, ++ }, ++}; ++ + /** + * nvmem_get_mac_address - Obtain the MAC address from an nvmem cell named + * 'mac-address' associated with given device. +@@ -557,19 +614,23 @@ int nvmem_get_mac_address(struct device + { + struct nvmem_cell *cell; + const void *mac; +- size_t len; ++ struct nvmem_cell_mac_address_property *property; ++ int i; + +- cell = nvmem_cell_get(dev, "mac-address"); +- if (IS_ERR(cell)) +- return PTR_ERR(cell); +- +- mac = nvmem_cell_read(cell, &len); +- nvmem_cell_put(cell); +- +- if (IS_ERR(mac)) +- return PTR_ERR(mac); ++ for (i = 0; i < ARRAY_SIZE(nvmem_cell_mac_address_properties); i++) { ++ property = &nvmem_cell_mac_address_properties[i]; ++ cell = nvmem_cell_get(dev, property->name); ++ if (IS_ERR(cell)) { ++ if (i == ARRAY_SIZE(nvmem_cell_mac_address_properties) - 1) ++ return PTR_ERR(cell); ++ continue; ++ } ++ mac = property->read(cell); ++ nvmem_cell_put(cell); ++ break; ++ } + +- if (len != ETH_ALEN || !is_valid_ether_addr(mac)) { ++ if (!is_valid_ether_addr(mac)) { + kfree(mac); + return -EINVAL; + } diff --git a/target/linux/ath79/patches-5.15/600-of_net-add-mac-address-ascii-support.patch b/target/linux/ath79/patches-5.15/600-of_net-add-mac-address-ascii-support.patch new file mode 100644 index 0000000000..8849afb4d6 --- /dev/null +++ b/target/linux/ath79/patches-5.15/600-of_net-add-mac-address-ascii-support.patch @@ -0,0 +1,103 @@ +Index: linux-5.15.31/net/ethernet/eth.c +=================================================================== +--- linux-5.15.31.orig/net/ethernet/eth.c ++++ linux-5.15.31/net/ethernet/eth.c +@@ -544,6 +544,63 @@ int eth_platform_get_mac_address(struct + } + EXPORT_SYMBOL(eth_platform_get_mac_address); + ++static void *nvmem_cell_get_mac_address(struct nvmem_cell *cell) ++{ ++ size_t len; ++ void *mac; ++ ++ mac = nvmem_cell_read(cell, &len); ++ if (IS_ERR(mac)) ++ return PTR_ERR(mac); ++ if (len != ETH_ALEN) { ++ kfree(mac); ++ return ERR_PTR(-EINVAL); ++ } ++ return mac; ++} ++ ++static void *nvmem_cell_get_mac_address_ascii(struct nvmem_cell *cell) ++{ ++ size_t len; ++ int ret; ++ void *mac_ascii; ++ u8 *mac; ++ ++ mac_ascii = nvmem_cell_read(cell, &len); ++ if (IS_ERR(mac_ascii)) ++ return PTR_ERR(mac_ascii); ++ if (len != ETH_ALEN*2+5) { ++ kfree(mac_ascii); ++ return ERR_PTR(-EINVAL); ++ } ++ mac = kmalloc(ETH_ALEN, GFP_KERNEL); ++ if (!mac) { ++ kfree(mac_ascii); ++ return ERR_PTR(-ENOMEM); ++ } ++ ret = sscanf(mac_ascii, "%2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx", ++ &mac[0], &mac[1], &mac[2], ++ &mac[3], &mac[4], &mac[5]); ++ kfree(mac_ascii); ++ if (ret == ETH_ALEN) ++ return mac; ++ kfree(mac); ++ return ERR_PTR(-EINVAL); ++} ++ ++static struct nvmem_cell_mac_address_property { ++ char *name; ++ void *(*read)(struct nvmem_cell *); ++} nvmem_cell_mac_address_properties[] = { ++ { ++ .name = "mac-address", ++ .read = nvmem_cell_get_mac_address, ++ }, { ++ .name = "mac-address-ascii", ++ .read = nvmem_cell_get_mac_address_ascii, ++ }, ++}; ++ + /** + * nvmem_get_mac_address - Obtain the MAC address from an nvmem cell named + * 'mac-address' associated with given device. +@@ -557,19 +614,23 @@ int nvmem_get_mac_address(struct device + { + struct nvmem_cell *cell; + const void *mac; +- size_t len; ++ struct nvmem_cell_mac_address_property *property; ++ int i; + +- cell = nvmem_cell_get(dev, "mac-address"); +- if (IS_ERR(cell)) +- return PTR_ERR(cell); +- +- mac = nvmem_cell_read(cell, &len); +- nvmem_cell_put(cell); +- +- if (IS_ERR(mac)) +- return PTR_ERR(mac); ++ for (i = 0; i < ARRAY_SIZE(nvmem_cell_mac_address_properties); i++) { ++ property = &nvmem_cell_mac_address_properties[i]; ++ cell = nvmem_cell_get(dev, property->name); ++ if (IS_ERR(cell)) { ++ if (i == ARRAY_SIZE(nvmem_cell_mac_address_properties) - 1) ++ return PTR_ERR(cell); ++ continue; ++ } ++ mac = property->read(cell); ++ nvmem_cell_put(cell); ++ break; ++ } + +- if (len != ETH_ALEN || !is_valid_ether_addr(mac)) { ++ if (!is_valid_ether_addr(mac)) { + kfree(mac); + return -EINVAL; + } From 5c147d36ba7e998aee7ff4f81553b935bcfc5383 Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Sat, 16 Apr 2022 00:23:52 +0000 Subject: [PATCH 02/26] ath79: port HiWiFi HC6361 from ar71xx The device was added for ar71xx target and dropped during the ath79 transition, mainly because of the ascii mac address stored in bdinfo partition Device page, http://wiki.openwrt.org/toh/hiwifi/hc6361 The vendor u-boot image accepts sysupgrade.bin image with specific requirements, including having squashfs signature "hsqs" at file offset 0x140000. This is not possible now that OpenWrt kernel image is at least 2MB with the signature at offset 0x240000. Installation of current build of OpenWrt now requires a bootstrap step of installing an earlier version first. - If the vendor u-boot accepts sysupgrade image, hc6361 image of LEDE release should work - If the vendor u-boot accepts only verified flashsmt image, install the one in the above device page. The image is based on Barrier Breaker SHA256SUM of the flashsmt image 81b193b95ea5f8e5c30cd62fa9facf275f39233be4fdeed7038f3deed2736156 After the bootstrap step, current build of OpenWrt can be installed there fine. Signed-off-by: Yousong Zhou --- .../linux/ath79/dts/ar9331_hiwifi_hc6361.dts | 156 ++++++++++++++++++ .../generic/base-files/etc/board.d/01_leds | 4 + .../generic/base-files/etc/board.d/02_network | 1 + target/linux/ath79/image/generic.mk | 12 ++ 4 files changed, 173 insertions(+) create mode 100644 target/linux/ath79/dts/ar9331_hiwifi_hc6361.dts diff --git a/target/linux/ath79/dts/ar9331_hiwifi_hc6361.dts b/target/linux/ath79/dts/ar9331_hiwifi_hc6361.dts new file mode 100644 index 0000000000..05d3f6730e --- /dev/null +++ b/target/linux/ath79/dts/ar9331_hiwifi_hc6361.dts @@ -0,0 +1,156 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9331.dtsi" + +#include +#include + +/ { + model = "HiWiFi HC6361"; + compatible = "hiwifi,hc6361", "qca,ar9331"; + + aliases { + serial0 = &uart; + led-boot = &led_system; + led-failsafe = &led_system; + led-running = &led_system; + led-upgrade = &led_system; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_system: system { + label = "blue:system"; + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + wlan { + label = "blue:wlan"; + gpios = <&gpio 0 GPIO_ACTIVE_LOW>; + }; + wan { + label = "blue:wan"; + gpios = <&gpio 27 GPIO_ACTIVE_LOW>; + }; + }; + + reg_usb_vbus: regulator { + compatible = "regulator-fixed"; + regulator-name = "usb_vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + enable-active-high; + gpio = <&gpio 20 GPIO_ACTIVE_HIGH>; + }; +}; + +&spi { + status = "okay"; + num-cs = <1>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + uboot: partition@0 { + reg = <0x0 0x10000>; + label = "u-boot"; + read-only; + }; + + bdinfo: partition@10000 { + reg = <0x10000 0x10000>; + label = "bdinfo"; + read-only; + }; + + firmware: partition@20000 { + compatible = "denx,uimage"; + reg = <0x20000 0xfc0000>; + label = "firmware"; + }; + + backup: partition@fe0000 { + reg = <0xfe0000 0x10000>; + label = "backup"; + read-only; + }; + + art: partition@ff0000 { + reg = <0xff0000 0x10000>; + label = "art"; + read-only; + }; + }; + }; +}; + +&gpio { + status = "okay"; +}; + +&uart { + status = "okay"; +}; + +&usb { + status = "okay"; + dr_mode = "host"; + vbus-supply = <®_usb_vbus>; +}; + +&usb_phy { + status = "okay"; +}; + +ð0 { + status = "okay"; + + nvmem-cells = <&macaddr_bdinfo_18a>; + nvmem-cell-names = "mac-address-ascii"; + mac-address-increment = <1>; +}; + +ð1 { + status = "okay"; + + nvmem-cells = <&macaddr_bdinfo_18a>; + nvmem-cell-names = "mac-address-ascii"; +}; + +&wmac { + status = "okay"; + mtd-cal-data = <&art 0x1000>; + + nvmem-cells = <&macaddr_bdinfo_18a>; + nvmem-cell-names = "mac-address-ascii"; + mac-address-increment = <2>; +}; + +&bdinfo { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_bdinfo_18a: macaddr@18a { + reg = <0x18a 0x11>; + }; +}; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds index 12a54f3bd5..24beb7a361 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds @@ -250,6 +250,10 @@ joyit,jt-or750i|\ yuncore,xd3200) ucidef_set_led_default "ath10k" "ath10k-disable" "ath10k-phy0" "0" ;; +hiwifi,hc6361) + ucidef_set_led_netdev "wan" "WAN" "blue:wan" "eth1" + ucidef_set_led_wlan "wlan" "WLAN" "blue:wlan" "phy0tpt" + ;; meraki,mr12|\ tplink,cpe210-v2|\ tplink,cpe210-v3) diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 03e6434422..8f6063baef 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -504,6 +504,7 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "1:lan" "2:lan" ;; + hiwifi,hc6361|\ xiaomi,mi-router-4q|\ zbtlink,zbt-wd323) ucidef_set_interface_wan "eth1" diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index dc85fb60bf..80a581a72c 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -1387,6 +1387,18 @@ define Device/hak5_wifi-pineapple-nano endef TARGET_DEVICES += hak5_wifi-pineapple-nano +define Device/hiwifi_hc6361 + SOC := ar9331 + DEVICE_VENDOR := HiWiFi + DEVICE_MODEL := HC6361 + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-chipidea2 kmod-usb-storage \ + kmod-fs-ext4 kmod-nls-iso8859-1 e2fsprogs + BOARDNAME := HiWiFi-HC6361 + KERNEL := kernel-bin | append-dtb | lzma | uImage lzma | pad-to $$(BLOCKSIZE) + IMAGE_SIZE := 16128k +endef +TARGET_DEVICES += hiwifi_hc6361 + define Device/iodata_etg3-r SOC := ar9342 DEVICE_VENDOR := I-O DATA From 3a4d972d43987e1ab0f697817c0f68d1a4a706dc Mon Sep 17 00:00:00 2001 From: Rodrigo Balerdi Date: Sat, 9 Apr 2022 17:41:38 -0300 Subject: [PATCH 03/26] ipq806x: remove non-working fixes for USB bug in 5.10 dtsi additions These workarrounds are incomplete and non-functional, and thus not needed. Signed-off-by: Rodrigo Balerdi --- .../ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-r7500.dts | 2 -- .../files/arch/arm/boot/dts/qcom-ipq8065-rt4230w-rev6.dts | 2 -- 2 files changed, 4 deletions(-) diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-r7500.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-r7500.dts index 94b7ed6277..0970eaf0ec 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-r7500.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-r7500.dts @@ -148,12 +148,10 @@ }; &usb3_0 { - clocks = <&gcc USB30_1_MASTER_CLK>; status = "okay"; }; &usb3_1 { - clocks = <&gcc USB30_0_MASTER_CLK>; status = "okay"; }; diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-rt4230w-rev6.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-rt4230w-rev6.dts index d700149939..a15dee6aca 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-rt4230w-rev6.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-rt4230w-rev6.dts @@ -283,12 +283,10 @@ &usb3_0 { status = "okay"; - clocks = <&gcc USB30_1_MASTER_CLK>; }; &usb3_1 { status = "okay"; - clocks = <&gcc USB30_0_MASTER_CLK>; }; &pcie0 { From 284f2c2ae0e569660effa61c9f8d0f6459a2ae19 Mon Sep 17 00:00:00 2001 From: Rodrigo Balerdi Date: Sat, 9 Apr 2022 18:26:17 -0300 Subject: [PATCH 04/26] ipq806x: fix USB bug in 5.10 dtsi additions The existing device tree has incorrect definitions for usb3_0 and usb3_1 and the blocks they depend upon: their addresses and interrupts are swapped. However, their clocks and resets are not. The result is that the USB blocks are non-functional if only one of them is enabled. This fix backports the definitions from mainline Linux 5.15 to OpenWrt's 5.10 dtsi additions. See the relevant mainline code here: https://github.com/torvalds/linux/blob/v5.17/arch/arm/boot/dts/qcom-ipq8064.dtsi#L1062-L1148 This fix does not break existing ports. But some ports may have enabled both USB blocks even thought their board only implements one, because enabling a single USB block would not have worked before this fix. This means that revisiting all ports of ipq806x devices that implement a single USB port is advised. This work must be done by maintainers that can determine which USB block corresponds to the implemented port on their hardware. Note that this fix swaps the names of the hardware ports. This is unfortunate, but will happen anyway when switching to kernel 5.15. Thus, it is best to do this ASAP, before users get to depend on port names. It is strongly recommended that this fix is backported to 22.03 before its release. This will minimize the number of users affected by the port name swap. Signed-off-by: Rodrigo Balerdi --- .../083-ipq8064-dtsi-additions.patch | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/target/linux/ipq806x/patches-5.10/083-ipq8064-dtsi-additions.patch b/target/linux/ipq806x/patches-5.10/083-ipq8064-dtsi-additions.patch index e74e6ad55d..a1a97ae941 100644 --- a/target/linux/ipq806x/patches-5.10/083-ipq8064-dtsi-additions.patch +++ b/target/linux/ipq806x/patches-5.10/083-ipq8064-dtsi-additions.patch @@ -681,7 +681,7 @@ + + hs_phy_0: hs_phy_0 { + compatible = "qcom,ipq806x-usb-phy-hs"; -+ reg = <0x110f8800 0x30>; ++ reg = <0x100f8800 0x30>; + clocks = <&gcc USB30_0_UTMI_CLK>; + clock-names = "ref"; + #phy-cells = <0>; @@ -689,17 +689,17 @@ + + ss_phy_0: ss_phy_0 { + compatible = "qcom,ipq806x-usb-phy-ss"; -+ reg = <0x110f8830 0x30>; ++ reg = <0x100f8830 0x30>; + clocks = <&gcc USB30_0_MASTER_CLK>; + clock-names = "ref"; + #phy-cells = <0>; + }; + -+ usb3_0: usb3@110f8800 { ++ usb3_0: usb3@100f8800 { + compatible = "qcom,dwc3", "syscon"; + #address-cells = <1>; + #size-cells = <1>; -+ reg = <0x110f8800 0x8000>; ++ reg = <0x100f8800 0x8000>; + clocks = <&gcc USB30_0_MASTER_CLK>; + clock-names = "core"; + @@ -710,10 +710,10 @@ + + status = "disabled"; + -+ dwc3_0: dwc3@11000000 { ++ dwc3_0: dwc3@10000000 { + compatible = "snps,dwc3"; -+ reg = <0x11000000 0xcd00>; -+ interrupts = ; ++ reg = <0x10000000 0xcd00>; ++ interrupts = ; + phys = <&hs_phy_0>, <&ss_phy_0>; + phy-names = "usb2-phy", "usb3-phy"; + dr_mode = "host"; @@ -723,7 +723,7 @@ + + hs_phy_1: hs_phy_1 { + compatible = "qcom,ipq806x-usb-phy-hs"; -+ reg = <0x100f8800 0x30>; ++ reg = <0x110f8800 0x30>; + clocks = <&gcc USB30_1_UTMI_CLK>; + clock-names = "ref"; + #phy-cells = <0>; @@ -731,17 +731,17 @@ + + ss_phy_1: ss_phy_1 { + compatible = "qcom,ipq806x-usb-phy-ss"; -+ reg = <0x100f8830 0x30>; ++ reg = <0x110f8830 0x30>; + clocks = <&gcc USB30_1_MASTER_CLK>; + clock-names = "ref"; + #phy-cells = <0>; + }; + -+ usb3_1: usb3@100f8800 { ++ usb3_1: usb3@110f8800 { + compatible = "qcom,dwc3", "syscon"; + #address-cells = <1>; + #size-cells = <1>; -+ reg = <0x100f8800 0x8000>; ++ reg = <0x110f8800 0x8000>; + clocks = <&gcc USB30_1_MASTER_CLK>; + clock-names = "core"; + @@ -752,10 +752,10 @@ + + status = "disabled"; + -+ dwc3_1: dwc3@10000000 { ++ dwc3_1: dwc3@11000000 { + compatible = "snps,dwc3"; -+ reg = <0x10000000 0xcd00>; -+ interrupts = ; ++ reg = <0x11000000 0xcd00>; ++ interrupts = ; + phys = <&hs_phy_1>, <&ss_phy_1>; + phy-names = "usb2-phy", "usb3-phy"; + dr_mode = "host"; From 3f0d87fd69b13f7d1fa06bdcc951a2896a0a9360 Mon Sep 17 00:00:00 2001 From: Ansuel Smith Date: Mon, 28 Mar 2022 02:47:12 +0200 Subject: [PATCH 05/26] ipq806x: fix wrong CPU OPP for ipq8062 Fix wrong CPU OPP for ipq8062. Revision of the SoC added an extra 25mV for every pvs. Also fix the voltage min/max value that were wrong. Reviewed-by: Robert Marko robimarko@gmail.com Signed-off-by: Ansuel Smith --- .../files/arch/arm/boot/dts/qcom-ipq8062.dtsi | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8062.dtsi b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8062.dtsi index f1681f4c02..29226ca275 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8062.dtsi +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8062.dtsi @@ -49,31 +49,31 @@ * Voltage thresholds are */ opp-384000000 { - opp-microvolt-speed0-pvs0-v0 = <950000 902500 997500>; - opp-microvolt-speed0-pvs1-v0 = <900000 855000 945000>; - opp-microvolt-speed0-pvs2-v0 = <850000 807500 892500>; - opp-microvolt-speed0-pvs3-v0 = <800000 760000 840000>; + opp-microvolt-speed0-pvs0-v0 = <1000000 950000 1050000>; + opp-microvolt-speed0-pvs1-v0 = < 925000 878750 971250>; + opp-microvolt-speed0-pvs2-v0 = < 875000 831250 918750>; + opp-microvolt-speed0-pvs3-v0 = < 800000 760000 840000>; }; opp-600000000 { - opp-microvolt-speed0-pvs0-v0 = <1000000 950000 1050000>; - opp-microvolt-speed0-pvs1-v0 = <950000 945000 955000>; - opp-microvolt-speed0-pvs2-v0 = <900000 895000 905000>; - opp-microvolt-speed0-pvs3-v0 = <850000 845000 855000>; + opp-microvolt-speed0-pvs0-v0 = <1050000 997500 1102500>; + opp-microvolt-speed0-pvs1-v0 = < 975000 926250 1023750>; + opp-microvolt-speed0-pvs2-v0 = < 925000 878750 971250>; + opp-microvolt-speed0-pvs3-v0 = < 850000 807500 892500>; }; opp-800000000 { - opp-microvolt-speed0-pvs0-v0 = <1050000 997500 1102500>; - opp-microvolt-speed0-pvs1-v0 = <1000000 995000 1005000>; - opp-microvolt-speed0-pvs2-v0 = <950000 945000 955000>; - opp-microvolt-speed0-pvs3-v0 = <900000 895000 905000>; + opp-microvolt-speed0-pvs0-v0 = <1100000 1045000 1155000>; + opp-microvolt-speed0-pvs1-v0 = <1025000 973750 1076250>; + opp-microvolt-speed0-pvs2-v0 = < 995000 945250 1044750>; + opp-microvolt-speed0-pvs3-v0 = < 900000 855000 945000>; }; opp-1000000000 { - opp-microvolt-speed0-pvs0-v0 = <1100000 1045000 1155000>; - opp-microvolt-speed0-pvs1-v0 = <1050000 997500 1102500>; - opp-microvolt-speed0-pvs2-v0 = <1000000 995000 1005000>; - opp-microvolt-speed0-pvs3-v0 = <950000 945000 955000>; + opp-microvolt-speed0-pvs0-v0 = <1150000 1092500 1207500>; + opp-microvolt-speed0-pvs1-v0 = <1075000 1021250 1128750>; + opp-microvolt-speed0-pvs2-v0 = <1025000 973750 1076250>; + opp-microvolt-speed0-pvs3-v0 = < 950000 902500 997500>; }; }; From c99013e242682a71051619806f9cc4f4e51a58fa Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Fri, 1 Apr 2022 22:05:08 +0200 Subject: [PATCH 06/26] kernel: backport ZTE RNDIS bogus MAC address fix This is required to support built-in modem of ZTE MF286R, in addition to other external modems, such as MF831, MF910, MF920, which refuse to reconfigure their remote MAC address, even if "locally administered" bit is set, leading to dropped traffic towards the host. Add a workaround for that issue already present in cdc_ether to rndis_host driver as well. Signed-off-by: Lech Perczak --- ...ether-export-usbnet_cdc_zte_rx_fixup.patch | 58 +++++++++ ...e-the-bogus-MAC-fixup-for-ZTE-device.patch | 118 ++++++++++++++++++ ...-scope-of-bogus-MAC-address-detectio.patch | 63 ++++++++++ ...ether-export-usbnet_cdc_zte_rx_fixup.patch | 58 +++++++++ ...e-the-bogus-MAC-fixup-for-ZTE-device.patch | 118 ++++++++++++++++++ ...-scope-of-bogus-MAC-address-detectio.patch | 63 ++++++++++ 6 files changed, 478 insertions(+) create mode 100644 target/linux/generic/backport-5.10/880-v5.19-cdc_ether-export-usbnet_cdc_zte_rx_fixup.patch create mode 100644 target/linux/generic/backport-5.10/881-v5.19-rndis_host-enable-the-bogus-MAC-fixup-for-ZTE-device.patch create mode 100644 target/linux/generic/backport-5.10/882-v5.19-rndis_host-limit-scope-of-bogus-MAC-address-detectio.patch create mode 100644 target/linux/generic/backport-5.15/880-v5.19-cdc_ether-export-usbnet_cdc_zte_rx_fixup.patch create mode 100644 target/linux/generic/backport-5.15/881-v5.19-rndis_host-enable-the-bogus-MAC-fixup-for-ZTE-device.patch create mode 100644 target/linux/generic/backport-5.15/882-v5.19-rndis_host-limit-scope-of-bogus-MAC-address-detectio.patch diff --git a/target/linux/generic/backport-5.10/880-v5.19-cdc_ether-export-usbnet_cdc_zte_rx_fixup.patch b/target/linux/generic/backport-5.10/880-v5.19-cdc_ether-export-usbnet_cdc_zte_rx_fixup.patch new file mode 100644 index 0000000000..b5a226181e --- /dev/null +++ b/target/linux/generic/backport-5.10/880-v5.19-cdc_ether-export-usbnet_cdc_zte_rx_fixup.patch @@ -0,0 +1,58 @@ +From d91a03b72c5f9c25e5b976f8f67bcf279601d644 Mon Sep 17 00:00:00 2001 +From: Lech Perczak +Date: Fri, 1 Apr 2022 22:03:55 +0200 +Subject: [PATCH 1/3] cdc_ether: export usbnet_cdc_zte_rx_fixup +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Commit bfe9b9d2df66 ("cdc_ether: Improve ZTE MF823/831/910 handling") +introduces a workaround for certain ZTE modems reporting invalid MAC +addresses over CDC-ECM. +The same issue was present on their RNDIS interface,which was fixed in +commit a5a18bdf7453 ("rndis_host: Set valid random MAC on buggy devices"). + +However, internal modem of ZTE MF286R router, on its RNDIS interface, also +exhibits a second issue fixed already in CDC-ECM, of the device not +respecting configured random MAC address. In order to share the fixup for +this with rndis_host driver, export the workaround function, which will +be re-used in the following commit in rndis_host. + +Cc: Kristian Evensen +Cc: Bjørn Mork +Cc: Oliver Neukum +Signed-off-by: Lech Perczak +--- + drivers/net/usb/cdc_ether.c | 3 ++- + include/linux/usb/usbnet.h | 1 + + 2 files changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/net/usb/cdc_ether.c ++++ b/drivers/net/usb/cdc_ether.c +@@ -466,7 +466,7 @@ static int usbnet_cdc_zte_bind(struct us + * device MAC address has been updated). Always set MAC address to that of the + * device. + */ +-static int usbnet_cdc_zte_rx_fixup(struct usbnet *dev, struct sk_buff *skb) ++int usbnet_cdc_zte_rx_fixup(struct usbnet *dev, struct sk_buff *skb) + { + if (skb->len < ETH_HLEN || !(skb->data[0] & 0x02)) + return 1; +@@ -476,6 +476,7 @@ static int usbnet_cdc_zte_rx_fixup(struc + + return 1; + } ++EXPORT_SYMBOL_GPL(usbnet_cdc_zte_rx_fixup); + + /* Ensure correct link state + * +--- a/include/linux/usb/usbnet.h ++++ b/include/linux/usb/usbnet.h +@@ -215,6 +215,7 @@ extern int usbnet_ether_cdc_bind(struct + extern int usbnet_cdc_bind(struct usbnet *, struct usb_interface *); + extern void usbnet_cdc_unbind(struct usbnet *, struct usb_interface *); + extern void usbnet_cdc_status(struct usbnet *, struct urb *); ++extern int usbnet_cdc_zte_rx_fixup(struct usbnet *dev, struct sk_buff *skb); + + /* CDC and RNDIS support the same host-chosen packet filters for IN transfers */ + #define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \ diff --git a/target/linux/generic/backport-5.10/881-v5.19-rndis_host-enable-the-bogus-MAC-fixup-for-ZTE-device.patch b/target/linux/generic/backport-5.10/881-v5.19-rndis_host-enable-the-bogus-MAC-fixup-for-ZTE-device.patch new file mode 100644 index 0000000000..99f0146e50 --- /dev/null +++ b/target/linux/generic/backport-5.10/881-v5.19-rndis_host-enable-the-bogus-MAC-fixup-for-ZTE-device.patch @@ -0,0 +1,118 @@ +From 69a9efb689b43fedf5f19431f1889aa6b8d35d55 Mon Sep 17 00:00:00 2001 +From: Lech Perczak +Date: Fri, 1 Apr 2022 22:04:01 +0200 +Subject: [PATCH 2/3] rndis_host: enable the bogus MAC fixup for ZTE devices + from cdc_ether +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Certain ZTE modems, namely: MF823. MF831, MF910, built-in modem from +MF286R, expose both CDC-ECM and RNDIS network interfaces. +They have a trait of ignoring the locally-administered MAC address +configured on the interface both in CDC-ECM and RNDIS part, +and this leads to dropping of incoming traffic by the host. +However, the workaround was only present in CDC-ECM, and MF286R +explicitly requires it in RNDIS mode. + +Re-use the workaround in rndis_host as well, to fix operation of MF286R +module, some versions of which expose only the RNDIS interface. Do so by +introducing new flag, RNDIS_DRIVER_DATA_DST_MAC_FIXUP, and testing for it +in rndis_rx_fixup. This is required, as RNDIS uses frame batching, and all +of the packets inside the batch need the fixup. This might introduce a +performance penalty, because test is done for every returned Ethernet +frame. + +Apply the workaround to both "flavors" of RNDIS interfaces, as older ZTE +modems, like MF823 found in the wild, report the USB_CLASS_COMM class +interfaces, while MF286R reports USB_CLASS_WIRELESS_CONTROLLER. + +Suggested-by: Bjørn Mork +Cc: Kristian Evensen +Cc: Oliver Neukum +Signed-off-by: Lech Perczak +--- + drivers/net/usb/rndis_host.c | 32 ++++++++++++++++++++++++++++++++ + include/linux/usb/rndis_host.h | 1 + + 2 files changed, 33 insertions(+) + +--- a/drivers/net/usb/rndis_host.c ++++ b/drivers/net/usb/rndis_host.c +@@ -485,10 +485,14 @@ EXPORT_SYMBOL_GPL(rndis_unbind); + */ + int rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb) + { ++ bool dst_mac_fixup; ++ + /* This check is no longer done by usbnet */ + if (skb->len < dev->net->hard_header_len) + return 0; + ++ dst_mac_fixup = !!(dev->driver_info->data & RNDIS_DRIVER_DATA_DST_MAC_FIXUP); ++ + /* peripheral may have batched packets to us... */ + while (likely(skb->len)) { + struct rndis_data_hdr *hdr = (void *)skb->data; +@@ -523,10 +527,17 @@ int rndis_rx_fixup(struct usbnet *dev, s + break; + skb_pull(skb, msg_len - sizeof *hdr); + skb_trim(skb2, data_len); ++ ++ if (unlikely(dst_mac_fixup)) ++ usbnet_cdc_zte_rx_fixup(dev, skb2); ++ + usbnet_skb_return(dev, skb2); + } + + /* caller will usbnet_skb_return the remaining packet */ ++ if (unlikely(dst_mac_fixup)) ++ usbnet_cdc_zte_rx_fixup(dev, skb); ++ + return 1; + } + EXPORT_SYMBOL_GPL(rndis_rx_fixup); +@@ -600,6 +611,17 @@ static const struct driver_info rndis_po + .tx_fixup = rndis_tx_fixup, + }; + ++static const struct driver_info zte_rndis_info = { ++ .description = "ZTE RNDIS device", ++ .flags = FLAG_ETHER | FLAG_POINTTOPOINT | FLAG_FRAMING_RN | FLAG_NO_SETINT, ++ .data = RNDIS_DRIVER_DATA_DST_MAC_FIXUP, ++ .bind = rndis_bind, ++ .unbind = rndis_unbind, ++ .status = rndis_status, ++ .rx_fixup = rndis_rx_fixup, ++ .tx_fixup = rndis_tx_fixup, ++}; ++ + /*-------------------------------------------------------------------------*/ + + static const struct usb_device_id products [] = { +@@ -609,6 +631,16 @@ static const struct usb_device_id produc + USB_CLASS_COMM, 2 /* ACM */, 0x0ff), + .driver_info = (unsigned long) &rndis_poll_status_info, + }, { ++ /* ZTE WWAN modules */ ++ USB_VENDOR_AND_INTERFACE_INFO(0x19d2, ++ USB_CLASS_WIRELESS_CONTROLLER, 1, 3), ++ .driver_info = (unsigned long)&zte_rndis_info, ++}, { ++ /* ZTE WWAN modules, ACM flavour */ ++ USB_VENDOR_AND_INTERFACE_INFO(0x19d2, ++ USB_CLASS_COMM, 2 /* ACM */, 0x0ff), ++ .driver_info = (unsigned long)&zte_rndis_info, ++}, { + /* Hytera Communications DMR radios' "Radio to PC Network" */ + USB_VENDOR_AND_INTERFACE_INFO(0x238b, + USB_CLASS_COMM, 2 /* ACM */, 0x0ff), +--- a/include/linux/usb/rndis_host.h ++++ b/include/linux/usb/rndis_host.h +@@ -197,6 +197,7 @@ struct rndis_keepalive_c { /* IN (option + + /* Flags for driver_info::data */ + #define RNDIS_DRIVER_DATA_POLL_STATUS 1 /* poll status before control */ ++#define RNDIS_DRIVER_DATA_DST_MAC_FIXUP 2 /* device ignores configured MAC address */ + + extern void rndis_status(struct usbnet *dev, struct urb *urb); + extern int diff --git a/target/linux/generic/backport-5.10/882-v5.19-rndis_host-limit-scope-of-bogus-MAC-address-detectio.patch b/target/linux/generic/backport-5.10/882-v5.19-rndis_host-limit-scope-of-bogus-MAC-address-detectio.patch new file mode 100644 index 0000000000..bdb78ff170 --- /dev/null +++ b/target/linux/generic/backport-5.10/882-v5.19-rndis_host-limit-scope-of-bogus-MAC-address-detectio.patch @@ -0,0 +1,63 @@ +From 1bfbe1799b9ec5d00f7f032d6e7db1980e466aeb Mon Sep 17 00:00:00 2001 +From: Lech Perczak +Date: Sat, 2 Apr 2022 02:19:57 +0200 +Subject: [PATCH 3/3] rndis_host: limit scope of bogus MAC address detection to + ZTE devices +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Reporting of bogus MAC addresses and ignoring configuration of new +destination address wasn't observed outside of a range of ZTE devices, +among which this seems to be the common bug. Align rndis_host driver +with implementation found in cdc_ether, which also limits this workaround +to ZTE devices. + +Suggested-by: Bjørn Mork +Cc: Kristian Evensen +Cc: Oliver Neukum +Signed-off-by: Lech Perczak +--- + drivers/net/usb/rndis_host.c | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +--- a/drivers/net/usb/rndis_host.c ++++ b/drivers/net/usb/rndis_host.c +@@ -418,10 +418,7 @@ generic_rndis_bind(struct usbnet *dev, s + goto halt_fail_and_release; + } + +- if (bp[0] & 0x02) +- eth_hw_addr_random(net); +- else +- ether_addr_copy(net->dev_addr, bp); ++ ether_addr_copy(net->dev_addr, bp); + + /* set a nonzero filter to enable data transfers */ + memset(u.set, 0, sizeof *u.set); +@@ -463,6 +460,16 @@ static int rndis_bind(struct usbnet *dev + return generic_rndis_bind(dev, intf, FLAG_RNDIS_PHYM_NOT_WIRELESS); + } + ++static int zte_rndis_bind(struct usbnet *dev, struct usb_interface *intf) ++{ ++ int status = rndis_bind(dev, intf); ++ ++ if (!status && (dev->net->dev_addr[0] & 0x02)) ++ eth_hw_addr_random(dev->net); ++ ++ return status; ++} ++ + void rndis_unbind(struct usbnet *dev, struct usb_interface *intf) + { + struct rndis_halt *halt; +@@ -615,7 +622,7 @@ static const struct driver_info zte_rndi + .description = "ZTE RNDIS device", + .flags = FLAG_ETHER | FLAG_POINTTOPOINT | FLAG_FRAMING_RN | FLAG_NO_SETINT, + .data = RNDIS_DRIVER_DATA_DST_MAC_FIXUP, +- .bind = rndis_bind, ++ .bind = zte_rndis_bind, + .unbind = rndis_unbind, + .status = rndis_status, + .rx_fixup = rndis_rx_fixup, diff --git a/target/linux/generic/backport-5.15/880-v5.19-cdc_ether-export-usbnet_cdc_zte_rx_fixup.patch b/target/linux/generic/backport-5.15/880-v5.19-cdc_ether-export-usbnet_cdc_zte_rx_fixup.patch new file mode 100644 index 0000000000..39fdb32773 --- /dev/null +++ b/target/linux/generic/backport-5.15/880-v5.19-cdc_ether-export-usbnet_cdc_zte_rx_fixup.patch @@ -0,0 +1,58 @@ +From a79a5613e1907e1bf09bb6ba6fd5ff43b66c1afe Mon Sep 17 00:00:00 2001 +From: Lech Perczak +Date: Fri, 1 Apr 2022 22:03:55 +0200 +Subject: [PATCH 1/3] cdc_ether: export usbnet_cdc_zte_rx_fixup +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Commit bfe9b9d2df66 ("cdc_ether: Improve ZTE MF823/831/910 handling") +introduces a workaround for certain ZTE modems reporting invalid MAC +addresses over CDC-ECM. +The same issue was present on their RNDIS interface,which was fixed in +commit a5a18bdf7453 ("rndis_host: Set valid random MAC on buggy devices"). + +However, internal modem of ZTE MF286R router, on its RNDIS interface, also +exhibits a second issue fixed already in CDC-ECM, of the device not +respecting configured random MAC address. In order to share the fixup for +this with rndis_host driver, export the workaround function, which will +be re-used in the following commit in rndis_host. + +Cc: Kristian Evensen +Cc: Bjørn Mork +Cc: Oliver Neukum +Signed-off-by: Lech Perczak +--- + drivers/net/usb/cdc_ether.c | 3 ++- + include/linux/usb/usbnet.h | 1 + + 2 files changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/net/usb/cdc_ether.c ++++ b/drivers/net/usb/cdc_ether.c +@@ -479,7 +479,7 @@ static int usbnet_cdc_zte_bind(struct us + * device MAC address has been updated). Always set MAC address to that of the + * device. + */ +-static int usbnet_cdc_zte_rx_fixup(struct usbnet *dev, struct sk_buff *skb) ++int usbnet_cdc_zte_rx_fixup(struct usbnet *dev, struct sk_buff *skb) + { + if (skb->len < ETH_HLEN || !(skb->data[0] & 0x02)) + return 1; +@@ -489,6 +489,7 @@ static int usbnet_cdc_zte_rx_fixup(struc + + return 1; + } ++EXPORT_SYMBOL_GPL(usbnet_cdc_zte_rx_fixup); + + /* Ensure correct link state + * +--- a/include/linux/usb/usbnet.h ++++ b/include/linux/usb/usbnet.h +@@ -214,6 +214,7 @@ extern int usbnet_ether_cdc_bind(struct + extern int usbnet_cdc_bind(struct usbnet *, struct usb_interface *); + extern void usbnet_cdc_unbind(struct usbnet *, struct usb_interface *); + extern void usbnet_cdc_status(struct usbnet *, struct urb *); ++extern int usbnet_cdc_zte_rx_fixup(struct usbnet *dev, struct sk_buff *skb); + + /* CDC and RNDIS support the same host-chosen packet filters for IN transfers */ + #define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \ diff --git a/target/linux/generic/backport-5.15/881-v5.19-rndis_host-enable-the-bogus-MAC-fixup-for-ZTE-device.patch b/target/linux/generic/backport-5.15/881-v5.19-rndis_host-enable-the-bogus-MAC-fixup-for-ZTE-device.patch new file mode 100644 index 0000000000..7da2280cd9 --- /dev/null +++ b/target/linux/generic/backport-5.15/881-v5.19-rndis_host-enable-the-bogus-MAC-fixup-for-ZTE-device.patch @@ -0,0 +1,118 @@ +From aa8aff10e969aca0cb64f5e54ff7489355582667 Mon Sep 17 00:00:00 2001 +From: Lech Perczak +Date: Fri, 1 Apr 2022 22:04:01 +0200 +Subject: [PATCH 2/3] rndis_host: enable the bogus MAC fixup for ZTE devices + from cdc_ether +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Certain ZTE modems, namely: MF823. MF831, MF910, built-in modem from +MF286R, expose both CDC-ECM and RNDIS network interfaces. +They have a trait of ignoring the locally-administered MAC address +configured on the interface both in CDC-ECM and RNDIS part, +and this leads to dropping of incoming traffic by the host. +However, the workaround was only present in CDC-ECM, and MF286R +explicitly requires it in RNDIS mode. + +Re-use the workaround in rndis_host as well, to fix operation of MF286R +module, some versions of which expose only the RNDIS interface. Do so by +introducing new flag, RNDIS_DRIVER_DATA_DST_MAC_FIXUP, and testing for it +in rndis_rx_fixup. This is required, as RNDIS uses frame batching, and all +of the packets inside the batch need the fixup. This might introduce a +performance penalty, because test is done for every returned Ethernet +frame. + +Apply the workaround to both "flavors" of RNDIS interfaces, as older ZTE +modems, like MF823 found in the wild, report the USB_CLASS_COMM class +interfaces, while MF286R reports USB_CLASS_WIRELESS_CONTROLLER. + +Suggested-by: Bjørn Mork +Cc: Kristian Evensen +Cc: Oliver Neukum +Signed-off-by: Lech Perczak +--- + drivers/net/usb/rndis_host.c | 32 ++++++++++++++++++++++++++++++++ + include/linux/usb/rndis_host.h | 1 + + 2 files changed, 33 insertions(+) + +--- a/drivers/net/usb/rndis_host.c ++++ b/drivers/net/usb/rndis_host.c +@@ -485,10 +485,14 @@ EXPORT_SYMBOL_GPL(rndis_unbind); + */ + int rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb) + { ++ bool dst_mac_fixup; ++ + /* This check is no longer done by usbnet */ + if (skb->len < dev->net->hard_header_len) + return 0; + ++ dst_mac_fixup = !!(dev->driver_info->data & RNDIS_DRIVER_DATA_DST_MAC_FIXUP); ++ + /* peripheral may have batched packets to us... */ + while (likely(skb->len)) { + struct rndis_data_hdr *hdr = (void *)skb->data; +@@ -523,10 +527,17 @@ int rndis_rx_fixup(struct usbnet *dev, s + break; + skb_pull(skb, msg_len - sizeof *hdr); + skb_trim(skb2, data_len); ++ ++ if (unlikely(dst_mac_fixup)) ++ usbnet_cdc_zte_rx_fixup(dev, skb2); ++ + usbnet_skb_return(dev, skb2); + } + + /* caller will usbnet_skb_return the remaining packet */ ++ if (unlikely(dst_mac_fixup)) ++ usbnet_cdc_zte_rx_fixup(dev, skb); ++ + return 1; + } + EXPORT_SYMBOL_GPL(rndis_rx_fixup); +@@ -600,6 +611,17 @@ static const struct driver_info rndis_po + .tx_fixup = rndis_tx_fixup, + }; + ++static const struct driver_info zte_rndis_info = { ++ .description = "ZTE RNDIS device", ++ .flags = FLAG_ETHER | FLAG_POINTTOPOINT | FLAG_FRAMING_RN | FLAG_NO_SETINT, ++ .data = RNDIS_DRIVER_DATA_DST_MAC_FIXUP, ++ .bind = rndis_bind, ++ .unbind = rndis_unbind, ++ .status = rndis_status, ++ .rx_fixup = rndis_rx_fixup, ++ .tx_fixup = rndis_tx_fixup, ++}; ++ + /*-------------------------------------------------------------------------*/ + + static const struct usb_device_id products [] = { +@@ -614,6 +636,16 @@ static const struct usb_device_id produc + USB_CLASS_COMM, 2 /* ACM */, 0x0ff), + .driver_info = (unsigned long)&rndis_info, + }, { ++ /* ZTE WWAN modules */ ++ USB_VENDOR_AND_INTERFACE_INFO(0x19d2, ++ USB_CLASS_WIRELESS_CONTROLLER, 1, 3), ++ .driver_info = (unsigned long)&zte_rndis_info, ++}, { ++ /* ZTE WWAN modules, ACM flavour */ ++ USB_VENDOR_AND_INTERFACE_INFO(0x19d2, ++ USB_CLASS_COMM, 2 /* ACM */, 0x0ff), ++ .driver_info = (unsigned long)&zte_rndis_info, ++}, { + /* RNDIS is MSFT's un-official variant of CDC ACM */ + USB_INTERFACE_INFO(USB_CLASS_COMM, 2 /* ACM */, 0x0ff), + .driver_info = (unsigned long) &rndis_info, +--- a/include/linux/usb/rndis_host.h ++++ b/include/linux/usb/rndis_host.h +@@ -197,6 +197,7 @@ struct rndis_keepalive_c { /* IN (option + + /* Flags for driver_info::data */ + #define RNDIS_DRIVER_DATA_POLL_STATUS 1 /* poll status before control */ ++#define RNDIS_DRIVER_DATA_DST_MAC_FIXUP 2 /* device ignores configured MAC address */ + + extern void rndis_status(struct usbnet *dev, struct urb *urb); + extern int diff --git a/target/linux/generic/backport-5.15/882-v5.19-rndis_host-limit-scope-of-bogus-MAC-address-detectio.patch b/target/linux/generic/backport-5.15/882-v5.19-rndis_host-limit-scope-of-bogus-MAC-address-detectio.patch new file mode 100644 index 0000000000..ebe7a43fd3 --- /dev/null +++ b/target/linux/generic/backport-5.15/882-v5.19-rndis_host-limit-scope-of-bogus-MAC-address-detectio.patch @@ -0,0 +1,63 @@ +From 9bfb4bcda7ba32d73ea322ea56a8ebe32e9247f6 Mon Sep 17 00:00:00 2001 +From: Lech Perczak +Date: Sat, 2 Apr 2022 02:19:57 +0200 +Subject: [PATCH 3/3] rndis_host: limit scope of bogus MAC address detection to + ZTE devices +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Reporting of bogus MAC addresses and ignoring configuration of new +destination address wasn't observed outside of a range of ZTE devices, +among which this seems to be the common bug. Align rndis_host driver +with implementation found in cdc_ether, which also limits this workaround +to ZTE devices. + +Suggested-by: Bjørn Mork +Cc: Kristian Evensen +Cc: Oliver Neukum +Signed-off-by: Lech Perczak +--- + drivers/net/usb/rndis_host.c | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +--- a/drivers/net/usb/rndis_host.c ++++ b/drivers/net/usb/rndis_host.c +@@ -418,10 +418,7 @@ generic_rndis_bind(struct usbnet *dev, s + goto halt_fail_and_release; + } + +- if (bp[0] & 0x02) +- eth_hw_addr_random(net); +- else +- ether_addr_copy(net->dev_addr, bp); ++ ether_addr_copy(net->dev_addr, bp); + + /* set a nonzero filter to enable data transfers */ + memset(u.set, 0, sizeof *u.set); +@@ -463,6 +460,16 @@ static int rndis_bind(struct usbnet *dev + return generic_rndis_bind(dev, intf, FLAG_RNDIS_PHYM_NOT_WIRELESS); + } + ++static int zte_rndis_bind(struct usbnet *dev, struct usb_interface *intf) ++{ ++ int status = rndis_bind(dev, intf); ++ ++ if (!status && (dev->net->dev_addr[0] & 0x02)) ++ eth_hw_addr_random(dev->net); ++ ++ return status; ++} ++ + void rndis_unbind(struct usbnet *dev, struct usb_interface *intf) + { + struct rndis_halt *halt; +@@ -615,7 +622,7 @@ static const struct driver_info zte_rndi + .description = "ZTE RNDIS device", + .flags = FLAG_ETHER | FLAG_POINTTOPOINT | FLAG_FRAMING_RN | FLAG_NO_SETINT, + .data = RNDIS_DRIVER_DATA_DST_MAC_FIXUP, +- .bind = rndis_bind, ++ .bind = zte_rndis_bind, + .unbind = rndis_unbind, + .status = rndis_status, + .rx_fixup = rndis_rx_fixup, From a67629bbe25ef3d0e159db1e0c6ca81affd06898 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Thu, 31 Mar 2022 21:16:01 +0200 Subject: [PATCH 07/26] comgt: ncm: allow specification of interface name Add ifname property to UCI, which can be used to override the autodetected interface name in case the detection fails due to having none or more than one interface exposed by the modem, which is not explicitly linked to TTY port. This is needed on certain variants of ZTE MF286R built-in modem, which exposes both RNDIS and CDC-ECM interfaces on the modem, on which the automatic detection may select the wrong network interface. Signed-off-by: Lech Perczak --- package/network/utils/comgt/files/ncm.sh | 32 +++++++++++++----------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/package/network/utils/comgt/files/ncm.sh b/package/network/utils/comgt/files/ncm.sh index 6545091c82..38a4ba7a0b 100644 --- a/package/network/utils/comgt/files/ncm.sh +++ b/package/network/utils/comgt/files/ncm.sh @@ -10,6 +10,7 @@ proto_ncm_init_config() { no_device=1 available=1 proto_config_add_string "device:device" + proto_config_add_string ifname proto_config_add_string apn proto_config_add_string auth proto_config_add_string username @@ -25,10 +26,10 @@ proto_ncm_init_config() { proto_ncm_setup() { local interface="$1" - local manufacturer initialize setmode connect finalize ifname devname devpath + local manufacturer initialize setmode connect finalize devname devpath - local device apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS - json_get_vars device apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS + local device ifname apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS + json_get_vars device ifname apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS [ "$metric" = "" ] && metric="0" @@ -53,17 +54,20 @@ proto_ncm_setup() { return 1 } - devname="$(basename "$device")" - case "$devname" in - 'tty'*) - devpath="$(readlink -f /sys/class/tty/$devname/device)" - ifname="$( ls "$devpath"/../../*/net )" - ;; - *) - devpath="$(readlink -f /sys/class/usbmisc/$devname/device/)" - ifname="$( ls "$devpath"/net )" - ;; - esac + [ -z "$ifname" ] && { + devname="$(basename "$device")" + case "$devname" in + 'tty'*) + devpath="$(readlink -f /sys/class/tty/$devname/device)" + ifname="$( ls "$devpath"/../../*/net )" + ;; + *) + devpath="$(readlink -f /sys/class/usbmisc/$devname/device/)" + ifname="$( ls "$devpath"/net )" + ;; + esac + } + [ -n "$ifname" ] || { echo "The interface could not be found." proto_notify_error "$interface" NO_IFACE From b2940bb8b2878ce193f2edaee3e7d4c44f4a2065 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Thu, 31 Mar 2022 21:16:22 +0200 Subject: [PATCH 08/26] comgt: ncm: select first available network interface for device Some modems expose multiple network interfaces on the same USB device, causing the connection setup script to fail, because glob matching in the detection phase causes 'ls' to output more than one interface name plus their base directories in sysfs. Avoid that by listing the directories explicitly and then selecting first available interface. This is the case for some variants of ZTE MF286R built-in modem, which exposes both RNDIS and CDC-ECM network interfaces, causing the connection setup to fail. Signed-off-by: Lech Perczak --- package/network/utils/comgt/files/ncm.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package/network/utils/comgt/files/ncm.sh b/package/network/utils/comgt/files/ncm.sh index 38a4ba7a0b..c3a06165ef 100644 --- a/package/network/utils/comgt/files/ncm.sh +++ b/package/network/utils/comgt/files/ncm.sh @@ -26,7 +26,7 @@ proto_ncm_init_config() { proto_ncm_setup() { local interface="$1" - local manufacturer initialize setmode connect finalize devname devpath + local manufacturer initialize setmode connect finalize devname devpath ifpath local device ifname apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS json_get_vars device ifname apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS @@ -59,13 +59,14 @@ proto_ncm_setup() { case "$devname" in 'tty'*) devpath="$(readlink -f /sys/class/tty/$devname/device)" - ifname="$( ls "$devpath"/../../*/net )" + ifpath="$devpath/../../*/net" ;; *) devpath="$(readlink -f /sys/class/usbmisc/$devname/device/)" - ifname="$( ls "$devpath"/net )" + ifpath="$devpath/net" ;; esac + ifname="$(ls $(ls -1 -d $ifpath | head -n 1))" } [ -n "$ifname" ] || { From ed7957810c0aee04943559be9b0ed23431ee0654 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Thu, 31 Mar 2022 21:16:34 +0200 Subject: [PATCH 09/26] comgt: ncm: try to detect interface for ttyACM ports Some modems expose ttyACM as their control ports, which have the "device" symlink pointing one level down in sysfs tree. Try to find network interfaces for them as well, this is commonly used for modems exposing ACM + RNDIS or ACM + ECM interface combinations. Co-developed-by: Cezary Jackiewicz Signed-off-by: Cezary Jackiewicz Signed-off-by: Lech Perczak --- package/network/utils/comgt/files/ncm.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package/network/utils/comgt/files/ncm.sh b/package/network/utils/comgt/files/ncm.sh index c3a06165ef..a2c913ea1d 100644 --- a/package/network/utils/comgt/files/ncm.sh +++ b/package/network/utils/comgt/files/ncm.sh @@ -57,6 +57,10 @@ proto_ncm_setup() { [ -z "$ifname" ] && { devname="$(basename "$device")" case "$devname" in + 'ttyACM'*) + devpath="$(readlink -f /sys/class/tty/$devname/device)" + ifpath="$devpath/../*/net" + ;; 'tty'*) devpath="$(readlink -f /sys/class/tty/$devname/device)" ifpath="$devpath/../../*/net" From e02fb42c53bad5dd36726c6ef5a46bfe31d2e400 Mon Sep 17 00:00:00 2001 From: Cezary Jackiewicz Date: Sun, 27 Feb 2022 14:12:39 +0100 Subject: [PATCH 10/26] comgt: support ZTE MF286R modem The modem is based on Marvell PXA1826 and uses ACM+RNDIS interface to establish connection with custom commands specific to ZTE modems. Two variants of modems were discovered, some identifying themselves as "ZTE", and others as plain "Marvell", the chipset manufacturer. The modem itself runs a fork of OpenWrt inside, which root shell can be accessed via ADB interface. Signed-off-by: Cezary Jackiewicz Signed-off-by: Lech Perczak --- package/network/utils/comgt/Makefile | 2 +- package/network/utils/comgt/files/ncm.json | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/package/network/utils/comgt/Makefile b/package/network/utils/comgt/Makefile index db5ea57473..24dae2521e 100644 --- a/package/network/utils/comgt/Makefile +++ b/package/network/utils/comgt/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=comgt PKG_VERSION:=0.32 -PKG_RELEASE:=33 +PKG_RELEASE:=34 PKG_SOURCE:=$(PKG_NAME).$(PKG_VERSION).tgz PKG_SOURCE_URL:=@SF/comgt diff --git a/package/network/utils/comgt/files/ncm.json b/package/network/utils/comgt/files/ncm.json index bbdb30c5ee..b6ad717529 100644 --- a/package/network/utils/comgt/files/ncm.json +++ b/package/network/utils/comgt/files/ncm.json @@ -74,5 +74,27 @@ "connect": "AT+CGACT=1,${profile}", "finalize": "AT+CGDATA=\\\"M-MBIM\\\",${profile},1", "disconnect": "AT+CGACT=0,${profile}" + }, + "\"zte": { + "initialize": [ + "AT+CFUN=1" + ], + "configure": [ + "AT+ZGDCONT=${profile},\\\"${pdptype}\\\",\\\"${apn}\\\",\\\"\\\",0,0", + "AT+ZGPCOAUTH=${profile},\\\"${username}\\\",\\\"${password}\\\",0" + ], + "connect": "AT+ZGACT=1,${profile}", + "disconnect": "AT+ZGACT=0,${profile}" + }, + "\"marvell\"": { + "initialize": [ + "AT+CFUN=1" + ], + "configure": [ + "AT+ZGDCONT=${profile},\\\"${pdptype}\\\",\\\"${apn}\\\",\\\"\\\",0,0", + "AT+ZGPCOAUTH=${profile},\\\"${username}\\\",\\\"${password}\\\",0" + ], + "connect": "AT+ZGACT=1,${profile}", + "disconnect": "AT+ZGACT=0,${profile}" } } From 56cd49bdc8ff762c52327ee7faa14cb99895e0fd Mon Sep 17 00:00:00 2001 From: Martin Blumenstingl Date: Fri, 18 Mar 2022 23:36:41 +0100 Subject: [PATCH 11/26] lantiq: fritz736x: Move GPIO resets to the inidvidual board.dts files FRITZ!Box 7360 V2 and FRITZ!Box 7360 SL both use GPIOs 37 (for &phy0) and GPIO 44 (for &phy1) to control the PHY's reset lines. FRITZ!Box 7362 SL however uses GPIO 45 (for &phy0) and GPIO 44 (for &phy1). Move the GPIO reset definitions to each individual board .dts and while at it, fix the GPIOs for the FRITZ!Box 7362 SL. Signed-off-by: Martin Blumenstingl --- .../boot/dts/lantiq/vr9_avm_fritz7360-v2.dts | 30 +++++++++++++++--- .../boot/dts/lantiq/vr9_avm_fritz7360sl.dts | 31 ++++++++++++++++--- .../boot/dts/lantiq/vr9_avm_fritz7362sl.dts | 31 ++++++++++++++++--- .../boot/dts/lantiq/vr9_avm_fritz736x.dtsi | 17 ---------- 4 files changed, 77 insertions(+), 32 deletions(-) diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7360-v2.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7360-v2.dts index 8881745819..063d6dca5e 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7360-v2.dts +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7360-v2.dts @@ -7,11 +7,23 @@ model = "AVM FRITZ!Box 7360 V2"; }; -&state_default { - pcie-rst { - lantiq,pins = "io21"; - lantiq,pull = <0>; - lantiq,output = <1>; +&gpio { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + pcie-rst { + lantiq,pins = "io21"; + lantiq,pull = <0>; + lantiq,output = <1>; + }; + + phy-rst { + lantiq,pins = "io37", "io44"; + lantiq,pull = <0>; + lantiq,open-drain; + lantiq,output = <1>; + }; }; }; @@ -58,6 +70,14 @@ mac-address-increment = <(-2)>; }; +&phy0 { + reset-gpios = <&gpio 37 GPIO_ACTIVE_LOW>; +}; + +&phy1 { + reset-gpios = <&gpio 44 GPIO_ACTIVE_LOW>; +}; + &urlader { compatible = "nvmem-cells"; #address-cells = <1>; diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7360sl.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7360sl.dts index 945c553688..31523eaae0 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7360sl.dts +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7360sl.dts @@ -7,12 +7,25 @@ model = "AVM FRITZ!Box 7360 SL"; }; -&state_default { - pcie-rst { - lantiq,pins = "io38"; - lantiq,pull = <0>; - lantiq,output = <1>; +&gpio { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + pcie-rst { + lantiq,pins = "io21"; + lantiq,pull = <0>; + lantiq,output = <1>; + }; + + phy-rst { + lantiq,pins = "io37", "io44"; + lantiq,pull = <0>; + lantiq,open-drain; + lantiq,output = <1>; + }; }; + }; &localbus { @@ -58,6 +71,14 @@ mac-address-increment = <(-2)>; }; +&phy0 { + reset-gpios = <&gpio 37 GPIO_ACTIVE_LOW>; +}; + +&phy1 { + reset-gpios = <&gpio 44 GPIO_ACTIVE_LOW>; +}; + &urlader { compatible = "nvmem-cells"; #address-cells = <1>; diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7362sl.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7362sl.dts index c75edd933c..7995b34971 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7362sl.dts +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz7362sl.dts @@ -7,12 +7,25 @@ model = "AVM FRITZ!Box 7362 SL"; }; -&state_default { - pcie-rst { - lantiq,pins = "io21"; - lantiq,open-drain = <1>; - lantiq,output = <1>; +&gpio { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + pcie-rst { + lantiq,pins = "io21"; + lantiq,pull = <0>; + lantiq,output = <1>; + }; + + phy-rst { + lantiq,pins = "io44", "io45"; + lantiq,pull = <0>; + lantiq,open-drain; + lantiq,output = <1>; + }; }; + }; &spi { @@ -96,6 +109,14 @@ mac-address-increment = <(-2)>; }; +&phy0 { + reset-gpios = <&gpio 45 GPIO_ACTIVE_LOW>; +}; + +&phy1 { + reset-gpios = <&gpio 44 GPIO_ACTIVE_LOW>; +}; + &urlader { compatible = "nvmem-cells"; #address-cells = <1>; diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz736x.dtsi b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz736x.dtsi index 8406539f69..73f6e152bf 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz736x.dtsi +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_avm_fritz736x.dtsi @@ -88,21 +88,6 @@ lantiq,gphy-mode = ; }; -&gpio { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinmux { - phy-rst { - lantiq,pins = "io37", "io44"; - lantiq,pull = <0>; - lantiq,open-drain; - lantiq,output = <1>; - }; - }; - -}; - &gswip { pinctrl-0 = <&mdio_pins>; pinctrl-names = "default"; @@ -111,12 +96,10 @@ &gswip_mdio { phy0: ethernet-phy@0 { reg = <0x00>; - reset-gpios = <&gpio 37 GPIO_ACTIVE_LOW>; }; phy1: ethernet-phy@1 { reg = <0x01>; - reset-gpios = <&gpio 44 GPIO_ACTIVE_LOW>; }; phy11: ethernet-phy@11 { From fc60b97a772e857d1d049b34f116d91c462db462 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 27 Mar 2022 13:27:15 -0700 Subject: [PATCH 12/26] pcre: pass -fPIC under host as well static libraries need them as they are not PIC by default. Signed-off-by: Rosen Penev --- package/libs/pcre/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/libs/pcre/Makefile b/package/libs/pcre/Makefile index 43267562ea..894f39b7d1 100644 --- a/package/libs/pcre/Makefile +++ b/package/libs/pcre/Makefile @@ -67,9 +67,8 @@ HOST_CONFIGURE_ARGS += \ --enable-unicode-properties \ --enable-pcre16 \ --with-match-limit-recursion=16000 \ - --enable-cpp - -TARGET_CFLAGS += $(FPIC) + --enable-cpp \ + --with-pic CONFIGURE_ARGS += \ --enable-utf8 \ @@ -78,7 +77,8 @@ CONFIGURE_ARGS += \ --enable-pcre32 \ $(if $(CONFIG_PCRE_JIT_ENABLED),--enable-jit,--disable-jit) \ --with-match-limit-recursion=16000 \ - --$(if $(CONFIG_PACKAGE_libpcrecpp),en,dis)able-cpp + --$(if $(CONFIG_PACKAGE_libpcrecpp),en,dis)able-cpp \ + --with-pic MAKE_FLAGS += \ CFLAGS="$(TARGET_CFLAGS)" From b363f7488643882b9c53a1e2c6db2a110703cc1d Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Wed, 30 Mar 2022 21:33:01 -0700 Subject: [PATCH 13/26] readline: add host PIC Python seems to fail to link to libreadline properly because of this. Not a fatal error but an error nontheless. Signed-off-by: Rosen Penev --- package/libs/readline/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/package/libs/readline/Makefile b/package/libs/readline/Makefile index d14f058eab..9cf061a648 100644 --- a/package/libs/readline/Makefile +++ b/package/libs/readline/Makefile @@ -53,6 +53,7 @@ CONFIGURE_VARS += \ bash_cv_func_sigsetjmp=yes \ TARGET_CFLAGS += $(FPIC) +HOST_CFLAGS += $(FPIC) define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include From bb505d82add5636da891bb97fdabc57947280e88 Mon Sep 17 00:00:00 2001 From: Davide Fioravanti Date: Wed, 16 Mar 2022 02:18:11 +0100 Subject: [PATCH 14/26] ramips: add support for Wavlink WL-WN531A3 The Wavlink WL-WN531A3 is an AC1200 router with 5 fast ethernet ports and one USB 2.0 port. It's also known as Wavlink QUANTUM D4. Hardware -------- SoC: Mediatek MT7628AN RAM: 64MB FLASH: 8MB NOR (GigaDevice GD25Q64CSIG3) ETH: - 5x 10/100 Mbps Ethernet (4x LAN + 1x WAN) WIFI: - 2.4GHz: 1x (integrated in SOC) (2x2:2) - 5GHz: 1x MT7612E (2x2:2) - 4 external antennas BTN: - 1x Reset button - 1x WPS button - 1x Turbo button - 1x Touchlink button - 1x ON/OFF switch LEDS: - 1x Red led (system status) - 1x Blue led (system status) - 7x Blue leds (wifi led + 5 ethernet ports + power) USB: - 1x USB 2.0 port UART: - 57600-8-N-1 J1 O VCC +3,3V (near lan ports) o RX o TX o GND Everything works correctly. Currently there is no firmware update available. Because of this, in order to restore the OEM firmware, you must firstly dump the OEM firmware from your router before you flash the OpenWrt image. Backup the OEM Firmware ----------------------- The following steps are to be intended for users having little to none experience in linux. Obviously there are many ways to backup the OEM firmware, but probably this is the easiest way for this router. Procedure tested on M31A3.V4300.200420 firmware version. 1) Go to http://192.168.10.1/webcmd.shtml 2) Type the following line in the "Command" input box and then press enter: mkdir /etc_ro/lighttpd/www/dev; cp /dev/mtd0ro /etc_ro/lighttpd/www/dev/mtd0ro; ls -la /etc_ro/lighttpd/www/dev/mtd0ro 3) After few seconds in the textarea should appear this output: -rw-r--r-- 1 0 0 8388608 /etc_ro/lighttpd/www/dev/mtd0ro If your output doesn't match mine, stop reading and ask for help in the forum. 4) Open in another tab http://192.168.10.1/dev/mtd0ro to download the content of the whole NOR. If the file size is 0 byte, stop reading and ask for help in the forum. 5) Come back to the http://192.168.10.1/webcmd.shtml webpage and type: rm /etc_ro/lighttpd/www/dev/mtd0ro; for i in 1 2 3 4 ; do cp /dev/mtd${i}ro /etc_ro/lighttpd/www/dev/mtd${i}ro; done; ls -la /etc_ro/lighttpd/www/dev/ 6) After few seconds, in the textarea should appear this output: -rw-r--r-- 1 0 0 196608 mtd1ro -rw-r--r-- 1 0 0 65536 mtd2ro -rw-r--r-- 1 0 0 65536 mtd3ro -rw-r--r-- 1 0 0 8060928 mtd4ro drwxr-xr-x 7 0 0 0 .. drwxr-xr-x 2 0 0 0 . If your output doesn't match mine, stop reading and ask for help in the forum. 7) Open the following links to download the partitions of the OEM FW: http://192.168.10.1/dev/mtd1ro http://192.168.10.1/dev/mtd2ro http://192.168.10.1/dev/mtd3ro http://192.168.10.1/dev/mtd4ro If one (or more) of these files are 0 byte, stop reading and ask for help in the forum. 8) Store these downloaded files in a safe place. 9) Reboot your router to remove any temporary file in ram. Installation ------------ Flash the initramfs image in the OEM firmware interface (http://192.168.10.1/update.shtml). When Openwrt boots, flash the sysupgrade image otherwise you won't be able to keep configuration between reboots. Restore OEM Firmware -------------------- Flash the "mtd4ro" file you previously backed-up directly from LUCI. Warning: Remember to not keep settings! Warning2: Remember to force the flash. Notes ----- 1) Router mac addresses: LAN XX:XX:XX:XX:XX:9B (factory @ 0x28) WAN XX:XX:XX:XX:XX:9C (factory @ 0x2e) WIFI 2G XX:XX:XX:XX:XX:9D (factory @ 0x04) WIFI 5G XX:XX:XX:XX:XX:9E (factory @ 0x8004) LABEL XX:XX:XX:XX:XX:9D 2) There is just one wifi led for both wifi interfaces. It currently shows only the 2.4 GHz wifi activity. Signed-off-by: Davide Fioravanti --- .../dts/mt7628an_wavlink_wl-wn531a3.dts | 148 ++++++++++++++++++ target/linux/ramips/image/mt76x8.mk | 11 ++ .../mt76x8/base-files/etc/board.d/02_network | 4 +- 3 files changed, 162 insertions(+), 1 deletion(-) create mode 100644 target/linux/ramips/dts/mt7628an_wavlink_wl-wn531a3.dts diff --git a/target/linux/ramips/dts/mt7628an_wavlink_wl-wn531a3.dts b/target/linux/ramips/dts/mt7628an_wavlink_wl-wn531a3.dts new file mode 100644 index 0000000000..2a09ce6f38 --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_wavlink_wl-wn531a3.dts @@ -0,0 +1,148 @@ +#include "mt7628an.dtsi" + +#include +#include + +/ { + compatible = "wavlink,wl-wn531a3", "mediatek,mt7628an-soc"; + model = "Wavlink WL-WN531A3"; + + aliases { + led-boot = &led_status_blue; + led-failsafe = &led_status_red; + led-running = &led_status_blue; + led-upgrade = &led_status_red; + }; + + keys { + compatible = "gpio-keys"; + + turbo { + label = "turbo"; + gpios = <&gpio 46 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 45 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio 38 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + touchlink { + label = "touchlink"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + wifi { + label = "blue:wifi"; + gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led_status_blue: led_status_blue { + label = "blue:status"; + gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; + }; + + led_status_red: led_status_red { + label = "red:status"; + gpios = <&gpio 4 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&state_default { + gpio { + groups = "i2c", "wled_an", "gpio", "wdt"; + function = "gpio"; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +&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; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; + }; + }; +}; + +&wmac { + status = "okay"; + + mediatek,mtd-eeprom = <&factory 0x0>; +}; + +ðernet { + nvmem-cells = <&macaddr_factory_28>; + nvmem-cell-names = "mac-address"; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_28: macaddr@28 { + reg = <0x28 0x6>; + }; +}; diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index 4482a1e315..bd91bd9340 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -776,6 +776,17 @@ define Device/vocore_vocore2-lite endef TARGET_DEVICES += vocore_vocore2-lite +define Device/wavlink_wl-wn531a3 + IMAGE_SIZE := 7872k + DEVICE_VENDOR := Wavlink + DEVICE_MODEL := WL-WN531A3 + DEVICE_ALT0_VENDOR := Wavlink + DEVICE_ALT0_MODEL := QUANTUM D4 + DEVICE_PACKAGES := kmod-mt76x2 kmod-usb2 kmod-usb-ohci + SUPPORTED_DEVICES += wl-wn531a3 +endef +TARGET_DEVICES += wavlink_wl-wn531a3 + define Device/wavlink_wl-wn570ha1 IMAGE_SIZE := 7872k DEVICE_VENDOR := Wavlink 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 7791ee6be2..1f833c1820 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 @@ -117,7 +117,8 @@ ramips_setup_interfaces() ;; netgear,r6020|\ netgear,r6080|\ - netgear,r6120) + netgear,r6120|\ + wavlink,wl-wn531a3) ucidef_add_switch "switch0" \ "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan" "6@eth0" ;; @@ -190,6 +191,7 @@ ramips_setup_macs() cudy,wr1000|\ hilink,hlk-7628n|\ hilink,hlk-7688a|\ + wavlink,wl-wn531a3|\ wavlink,wl-wn577a2|\ wavlink,wl-wn578a2) wan_mac=$(mtd_get_mac_binary factory 0x2e) From 78c3534645958c123aa82cec9926a34eed5dd5dd Mon Sep 17 00:00:00 2001 From: Abdul Aziz Amar Date: Mon, 14 Mar 2022 05:26:23 -0400 Subject: [PATCH 15/26] ramips: add support for BOLT! Arion This device is from now-defunct BOLT! ISP in Indonesia. The original firmware is based on mediatek SDK running linux 2.6 or 3.x in later revision. Specifications: - SoC: MediaTek MT7621 - Flash: 32 MiB NOR SPI - RAM: 128 MiB DDR3 - Ethernet: 2x 10/100/1000 Mbps (switched, LAN + WAN) - WIFI0: MT7603E 2.4GHz 802.11b/g/n - WIFI1: MT7612E 5GHz 802.11ac - Antennas: 2x internal, non-detachable - LEDs: Programmable LEDs: 5 blue LEDs (wlan, tel, sig1-3) and 2 red LEDs (wlan and sig1) Non-programmable "Power" LED - Buttons: Reset and WPS Instalation: Install from TFTP Set your PC IP to 10.10.10.3 and gateway to 10.10.10.123 Press "1" when turning on the router, and type the initramfs file name You also need to solder pin header or cable to J4 or neighboring test points (T19-T21) Pinouts from top to bottom: GND, TX, RX, VCC (3.3v) Baudrate: 57600n8 There's also an additional gigabit transformer and RTL8211FD managed by the LTE module on the backside of the PCB. Signed-off-by: Abdul Aziz Amar --- package/boot/uboot-envtools/files/ramips | 1 + target/linux/ramips/dts/mt7621_bolt_arion.dts | 181 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 10 + .../mt7621/base-files/etc/board.d/02_network | 7 + 4 files changed, 199 insertions(+) create mode 100644 target/linux/ramips/dts/mt7621_bolt_arion.dts diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index 763f15d4e0..92118a6319 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -71,6 +71,7 @@ zyxel,nr7101) [ -n "$idx" ] && \ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x1000" "0x80000" ;; +bolt,arion|\ xiaomi,mi-router-cr6606|\ xiaomi,mi-router-cr6608|\ xiaomi,mi-router-cr6609) diff --git a/target/linux/ramips/dts/mt7621_bolt_arion.dts b/target/linux/ramips/dts/mt7621_bolt_arion.dts new file mode 100644 index 0000000000..a665b7b143 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_bolt_arion.dts @@ -0,0 +1,181 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "bolt,arion", "mediatek,mt7621-soc"; + model = "Bolt Arion"; + + aliases { + label-mac-device = &wan; + }; + + chosen { + bootargs = "console=ttyS0,57600n8"; + }; + + leds { + compatible = "gpio-leds"; + + led_wlan_blue: wlan_blue { + label = "blue:wlan"; + gpios = <&gpio 43 GPIO_ACTIVE_LOW>; + }; + + led_wlan_red: wlan_red { + label = "red:wlan"; + gpios = <&gpio 86 GPIO_ACTIVE_LOW>; + }; + + led_tel_blue: tel_blue { + label = "blue:tel"; + gpios = <&gpio 41 GPIO_ACTIVE_LOW>; + }; + + led_sig1_blue: sig1_blue { + label = "blue:sig1"; + gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + }; + + led_sig1_red: sig1_red { + label = "red:sig1"; + gpios = <&gpio 87 GPIO_ACTIVE_LOW>; + }; + + led_sig2_blue: sig2_blue { + label = "blue:sig2"; + gpios = <&gpio 45 GPIO_ACTIVE_LOW>; + }; + + led_sig3_blue: sig3_blue { + label = "blue:sig3"; + gpios = <&gpio 46 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 26 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "WPS"; + gpios = <&gpio 18 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; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x20000 0x20000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0x1fb0000>; + }; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "pci14c3,7603"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + ieee80211-freq-limit = <2400000 2500000>; + }; +}; + +&pcie1 { + wifi@0,0 { + compatible = "pci14c3,7662"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_4000>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <3>; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "modem"; + }; + + wan: port@1 { + status = "okay"; + label = "wan"; + nvmem-cells = <&macaddr_factory_4000>; + nvmem-cell-names = "mac-address"; + }; + + port@2 { + status = "okay"; + label = "lan"; + }; + }; +}; + +&state_default { + gpio { + groups = "jtag", "uart2", "uart3", "wdt"; + function = "gpio"; + }; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_4000: macaddr@4000 { + reg = <0x28 0x6>; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 1e9b59d74f..3b34c9d364 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -288,6 +288,16 @@ define Device/buffalo_wsr-600dhp endef TARGET_DEVICES += buffalo_wsr-600dhp +define Device/bolt_arion + $(Device/dsa-migration) + $(Device/uimage-lzma-loader) + IMAGE_SIZE := 32448k + DEVICE_VENDOR := BOLT + DEVICE_MODEL := Arion + DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 uboot-envtools +endef +TARGET_DEVICES += bolt_arion + define Device/cudy_wr1300 $(Device/dsa-migration) IMAGE_SIZE := 15872k 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 1fc0ccdd5b..7223908f95 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 @@ -51,6 +51,13 @@ ramips_setup_interfaces() xiaomi,mi-router-4a-gigabit) ucidef_set_interfaces_lan_wan "lan1 lan2" "wan" ;; + bolt,arion) + ucidef_set_interfaces_lan_wan "lan" "wan" + ucidef_set_interface "eth_data" device "modem.103" protocol "static" ipaddr "10.22.127.222" netmask "255.255.255.255" + ucidef_set_interface "eth_om" device "modem.4094" protocol "static" ipaddr "169.254.0.2" netmask "255.255.255.252" + uci add_list firewall.@zone[1].network='eth_data' + uci add_list firewall.@zone[1].network='eth_om' + ;; gnubee,gb-pc1|\ gnubee,gb-pc2) ucidef_set_interface_lan "lan1 lan2" From 0085dd6cb5e3c57dd22994c22ce893575711b6f7 Mon Sep 17 00:00:00 2001 From: John Audia Date: Wed, 13 Apr 2022 16:25:50 -0400 Subject: [PATCH 16/26] kernel: bump 5.10 to 5.10.111 Removed upstreamed: pending-5.10/850-0003-PCI-aardvark-Fix-support-for-MSI-interrupts.patch apm821xx/patches-5.10/150-ata-sata_dwc_460ex-Fix-crash-due-to-OOB-write.patch All other patches automatically rebased. Build system: x86_64 Build-tested: bcm2711/RPi4B, mt7622/RT3200 Run-tested: bcm2711/RPi4B, mt7622/RT3200 Signed-off-by: John Audia --- include/kernel-5.10 | 4 +- ...dwc_460ex-Fix-crash-due-to-OOB-write.patch | 65 ----------------- ...core_get_rate_recalc-in-clk_rate_get.patch | 2 +- ...-t-prevent-IRQ-usage-of-output-GPIOs.patch | 4 +- ...37-clk-Introduce-a-clock-request-API.patch | 20 +++--- ...quests-Ignore-if-the-pointer-is-null.patch | 2 +- ...eference-the-request-pointer-after-t.patch | 2 +- ...96-clk-Always-clamp-the-rounded-rate.patch | 2 +- ...oup-Disable-cgroup-memory-by-default.patch | 8 +-- ...tree-gpio-hogs-on-dual-role-gpio-pin.patch | 4 +- ...-sfp-add-support-for-100-base-x-SFPs.patch | 4 +- ...the-dst-buffer-to-of_get_mac_address.patch | 6 +- ...PCI-aardvark-Clear-all-MSIs-at-setup.patch | 2 +- ...ment-actions-in-driver-remove-method.patch | 2 +- ...able-bus-mastering-when-unbinding-dr.patch | 4 +- ...k-all-interrupts-when-unbinding-driv.patch | 2 +- ...ark-Fix-memory-leak-in-driver-unbind.patch | 2 +- ...k-Assert-PERST-when-unbinding-driver.patch | 2 +- ...able-link-training-when-unbinding-dr.patch | 2 +- ...able-common-PHY-when-unbinding-drive.patch | 2 +- ...d-knob-for-filtering-rx-tx-BPDU-pack.patch | 2 +- ...ark-Fix-reading-MSI-interrupt-number.patch | 4 +- ...dvark-Fix-support-for-MSI-interrupts.patch | 72 ------------------- ...c-explicitly-deassert-gmac-ahb-reset.patch | 2 +- 24 files changed, 42 insertions(+), 179 deletions(-) delete mode 100644 target/linux/apm821xx/patches-5.10/150-ata-sata_dwc_460ex-Fix-crash-due-to-OOB-write.patch delete mode 100644 target/linux/generic/pending-5.10/850-0003-PCI-aardvark-Fix-support-for-MSI-interrupts.patch diff --git a/include/kernel-5.10 b/include/kernel-5.10 index 2a8fa3c4e7..76c5ff42d1 100644 --- a/include/kernel-5.10 +++ b/include/kernel-5.10 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.10 = .110 -LINUX_KERNEL_HASH-5.10.110 = dbef6a06325433481551cb8cfca9254d908d0ae950bc809f3da8ade00c485693 +LINUX_VERSION-5.10 = .111 +LINUX_KERNEL_HASH-5.10.111 = 1831b3d8765592ce91e51441bb179d908f6bcfe8c78d03c2bec8c675c4a0ab1a diff --git a/target/linux/apm821xx/patches-5.10/150-ata-sata_dwc_460ex-Fix-crash-due-to-OOB-write.patch b/target/linux/apm821xx/patches-5.10/150-ata-sata_dwc_460ex-Fix-crash-due-to-OOB-write.patch deleted file mode 100644 index c503be9c0d..0000000000 --- a/target/linux/apm821xx/patches-5.10/150-ata-sata_dwc_460ex-Fix-crash-due-to-OOB-write.patch +++ /dev/null @@ -1,65 +0,0 @@ -From ba068938e629eb1a8b423a54405233e685cedb78 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Christian Lamparter -Date: Thu, 17 Mar 2022 21:29:28 +0100 -Subject: [PATCH v1 1/2] ata: sata_dwc_460ex: Fix crash due to OOB write -To: linux-ide@vger.kernel.org -Cc: Damien Le Moal , - Jens Axboe , - Tejun Heo , - Andy Shevchenko - -the driver uses libata's "tag" values from in various arrays. -Since the mentioned patch bumped the ATA_TAG_INTERNAL to 32, -the value of the SATA_DWC_QCMD_MAX needs to be bumped to 33. - -Otherwise ATA_TAG_INTERNAL cause a crash like this: - -| BUG: Kernel NULL pointer dereference at 0x00000000 -| Faulting instruction address: 0xc03ed4b8 -| Oops: Kernel access of bad area, sig: 11 [#1] -| BE PAGE_SIZE=4K PowerPC 44x Platform -| CPU: 0 PID: 362 Comm: scsi_eh_1 Not tainted 5.4.163 #0 -| NIP: c03ed4b8 LR: c03d27e8 CTR: c03ed36c -| REGS: cfa59950 TRAP: 0300 Not tainted (5.4.163) -| MSR: 00021000 CR: 42000222 XER: 00000000 -| DEAR: 00000000 ESR: 00000000 -| GPR00: c03d27e8 cfa59a08 cfa55fe0 00000000 0fa46bc0 [...] -| [..] -| NIP [c03ed4b8] sata_dwc_qc_issue+0x14c/0x254 -| LR [c03d27e8] ata_qc_issue+0x1c8/0x2dc -| Call Trace: -| [cfa59a08] [c003f4e0] __cancel_work_timer+0x124/0x194 (unreliable) -| [cfa59a78] [c03d27e8] ata_qc_issue+0x1c8/0x2dc -| [cfa59a98] [c03d2b3c] ata_exec_internal_sg+0x240/0x524 -| [cfa59b08] [c03d2e98] ata_exec_internal+0x78/0xe0 -| [cfa59b58] [c03d30fc] ata_read_log_page.part.38+0x1dc/0x204 -| [cfa59bc8] [c03d324c] ata_identify_page_supported+0x68/0x130 -| [...] - -this is because sata_dwc_dma_xfer_complete() NULLs the -dma_pending's next neighbour "chan" (a *dma_chan struct) in -this '32' case right here (line ~735): -> hsdevp->dma_pending[tag] = SATA_DWC_DMA_PENDING_NONE; - -Then the next time, a dma gets issued; dma_dwc_xfer_setup() passes -the NULL'd hsdevp->chan to the dmaengine_slave_config() which then -causes the crash. - -Reported-by: ticerex (OpenWrt Forum) -Fixes: 28361c403683c ("libata: add extra internal command") -Cc: stable@kernel.org # 4.18+ -Link: https://forum.openwrt.org/t/my-book-live-duo-reboot-loop/122464 -Signed-off-by: Christian Lamparter ---- ---- a/drivers/ata/sata_dwc_460ex.c -+++ b/drivers/ata/sata_dwc_460ex.c -@@ -145,7 +145,7 @@ struct sata_dwc_device { - #endif - }; - --#define SATA_DWC_QCMD_MAX 32 -+#define SATA_DWC_QCMD_MAX 33 - - struct sata_dwc_device_port { - struct sata_dwc_device *hsdev; diff --git a/target/linux/at91/patches-5.10/247-clk-use-clk_core_get_rate_recalc-in-clk_rate_get.patch b/target/linux/at91/patches-5.10/247-clk-use-clk_core_get_rate_recalc-in-clk_rate_get.patch index a17acc2742..2e8893645c 100644 --- a/target/linux/at91/patches-5.10/247-clk-use-clk_core_get_rate_recalc-in-clk_rate_get.patch +++ b/target/linux/at91/patches-5.10/247-clk-use-clk_core_get_rate_recalc-in-clk_rate_get.patch @@ -18,7 +18,7 @@ Signed-off-by: Stephen Boyd --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c -@@ -3082,7 +3082,10 @@ static int clk_rate_get(void *data, u64 +@@ -3106,7 +3106,10 @@ static int clk_rate_get(void *data, u64 { struct clk_core *core = data; diff --git a/target/linux/bcm27xx/patches-5.10/950-0256-gpiolib-Don-t-prevent-IRQ-usage-of-output-GPIOs.patch b/target/linux/bcm27xx/patches-5.10/950-0256-gpiolib-Don-t-prevent-IRQ-usage-of-output-GPIOs.patch index fb57e916c5..e23e7ec376 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0256-gpiolib-Don-t-prevent-IRQ-usage-of-output-GPIOs.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0256-gpiolib-Don-t-prevent-IRQ-usage-of-output-GPIOs.patch @@ -26,7 +26,7 @@ Signed-off-by: Phil Elwell /* Device and char device-related information */ static DEFINE_IDA(gpio_ida); static dev_t gpio_devt; -@@ -2444,8 +2446,8 @@ int gpiod_direction_output(struct gpio_d +@@ -2463,8 +2465,8 @@ int gpiod_direction_output(struct gpio_d value = !!value; /* GPIOs used for enabled IRQs shall not be set as output */ @@ -37,7 +37,7 @@ Signed-off-by: Phil Elwell gpiod_err(desc, "%s: tried to set a GPIO tied to an IRQ as output\n", __func__); -@@ -3260,8 +3262,8 @@ int gpiochip_lock_as_irq(struct gpio_chi +@@ -3279,8 +3281,8 @@ int gpiochip_lock_as_irq(struct gpio_chi } /* To be valid for IRQ the line needs to be input or open drain */ diff --git a/target/linux/bcm27xx/patches-5.10/950-0537-clk-Introduce-a-clock-request-API.patch b/target/linux/bcm27xx/patches-5.10/950-0537-clk-Introduce-a-clock-request-API.patch index b9b916f15d..e90134d682 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0537-clk-Introduce-a-clock-request-API.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0537-clk-Introduce-a-clock-request-API.patch @@ -75,7 +75,7 @@ Signed-off-by: Maxime Ripard /*** runtime pm ***/ static int clk_pm_runtime_get(struct clk_core *core) { -@@ -1413,10 +1421,14 @@ unsigned long clk_hw_round_rate(struct c +@@ -1431,10 +1439,14 @@ unsigned long clk_hw_round_rate(struct c { int ret; struct clk_rate_request req; @@ -90,7 +90,7 @@ Signed-off-by: Maxime Ripard ret = clk_core_round_rate_nolock(hw->core, &req); if (ret) return 0; -@@ -1437,6 +1449,7 @@ EXPORT_SYMBOL_GPL(clk_hw_round_rate); +@@ -1455,6 +1467,7 @@ EXPORT_SYMBOL_GPL(clk_hw_round_rate); long clk_round_rate(struct clk *clk, unsigned long rate) { struct clk_rate_request req; @@ -98,7 +98,7 @@ Signed-off-by: Maxime Ripard int ret; if (!clk) -@@ -1450,6 +1463,9 @@ long clk_round_rate(struct clk *clk, uns +@@ -1468,6 +1481,9 @@ long clk_round_rate(struct clk *clk, uns clk_core_get_boundaries(clk->core, &req.min_rate, &req.max_rate); req.rate = rate; @@ -108,7 +108,7 @@ Signed-off-by: Maxime Ripard ret = clk_core_round_rate_nolock(clk->core, &req); if (clk->exclusive_count) -@@ -1917,6 +1933,7 @@ static struct clk_core *clk_calc_new_rat +@@ -1935,6 +1951,7 @@ static struct clk_core *clk_calc_new_rat unsigned long new_rate; unsigned long min_rate; unsigned long max_rate; @@ -116,7 +116,7 @@ Signed-off-by: Maxime Ripard int p_index = 0; long ret; -@@ -1931,6 +1948,9 @@ static struct clk_core *clk_calc_new_rat +@@ -1949,6 +1966,9 @@ static struct clk_core *clk_calc_new_rat clk_core_get_boundaries(core, &min_rate, &max_rate); @@ -126,7 +126,7 @@ Signed-off-by: Maxime Ripard /* find the closest rate and parent clk/rate */ if (clk_core_can_round(core)) { struct clk_rate_request req; -@@ -2135,6 +2155,7 @@ static unsigned long clk_core_req_round_ +@@ -2153,6 +2173,7 @@ static unsigned long clk_core_req_round_ { int ret, cnt; struct clk_rate_request req; @@ -134,7 +134,7 @@ Signed-off-by: Maxime Ripard lockdep_assert_held(&prepare_lock); -@@ -2149,6 +2170,9 @@ static unsigned long clk_core_req_round_ +@@ -2167,6 +2188,9 @@ static unsigned long clk_core_req_round_ clk_core_get_boundaries(core, &req.min_rate, &req.max_rate); req.rate = req_rate; @@ -144,7 +144,7 @@ Signed-off-by: Maxime Ripard ret = clk_core_round_rate_nolock(core, &req); /* restore the protection */ -@@ -2242,6 +2266,9 @@ int clk_set_rate(struct clk *clk, unsign +@@ -2260,6 +2284,9 @@ int clk_set_rate(struct clk *clk, unsign ret = clk_core_set_rate_nolock(clk->core, rate); @@ -154,7 +154,7 @@ Signed-off-by: Maxime Ripard if (clk->exclusive_count) clk_core_rate_protect(clk->core); -@@ -2402,6 +2429,99 @@ int clk_set_max_rate(struct clk *clk, un +@@ -2426,6 +2453,99 @@ int clk_set_max_rate(struct clk *clk, un EXPORT_SYMBOL_GPL(clk_set_max_rate); /** @@ -254,7 +254,7 @@ Signed-off-by: Maxime Ripard * clk_get_parent - return the parent of a clk * @clk: the clk whose parent gets returned * -@@ -3851,6 +3971,7 @@ __clk_register(struct device *dev, struc +@@ -3875,6 +3995,7 @@ __clk_register(struct device *dev, struc goto fail_parents; INIT_HLIST_HEAD(&core->clks); diff --git a/target/linux/bcm27xx/patches-5.10/950-0572-clk-requests-Ignore-if-the-pointer-is-null.patch b/target/linux/bcm27xx/patches-5.10/950-0572-clk-requests-Ignore-if-the-pointer-is-null.patch index 5ee8e71bda..973fc4e92b 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0572-clk-requests-Ignore-if-the-pointer-is-null.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0572-clk-requests-Ignore-if-the-pointer-is-null.patch @@ -10,7 +10,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c -@@ -2498,6 +2498,9 @@ void clk_request_done(struct clk_request +@@ -2522,6 +2522,9 @@ void clk_request_done(struct clk_request { struct clk_core *core = req->clk->core; diff --git a/target/linux/bcm27xx/patches-5.10/950-0581-clk-requests-Dereference-the-request-pointer-after-t.patch b/target/linux/bcm27xx/patches-5.10/950-0581-clk-requests-Dereference-the-request-pointer-after-t.patch index 9f87aadc17..9f7ccf85e9 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0581-clk-requests-Dereference-the-request-pointer-after-t.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0581-clk-requests-Dereference-the-request-pointer-after-t.patch @@ -15,7 +15,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c -@@ -2496,10 +2496,11 @@ EXPORT_SYMBOL_GPL(clk_request_start); +@@ -2520,10 +2520,11 @@ EXPORT_SYMBOL_GPL(clk_request_start); */ void clk_request_done(struct clk_request *req) { diff --git a/target/linux/bcm27xx/patches-5.10/950-0596-clk-Always-clamp-the-rounded-rate.patch b/target/linux/bcm27xx/patches-5.10/950-0596-clk-Always-clamp-the-rounded-rate.patch index 05cbc7afae..868e1569bc 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0596-clk-Always-clamp-the-rounded-rate.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0596-clk-Always-clamp-the-rounded-rate.patch @@ -17,7 +17,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c -@@ -1316,6 +1316,8 @@ static int clk_core_determine_round_nolo +@@ -1334,6 +1334,8 @@ static int clk_core_determine_round_nolo if (!core) return 0; diff --git a/target/linux/bcm27xx/patches-5.10/950-0639-cgroup-Disable-cgroup-memory-by-default.patch b/target/linux/bcm27xx/patches-5.10/950-0639-cgroup-Disable-cgroup-memory-by-default.patch index 315d79ddf4..84fbcdb2c2 100644 --- a/target/linux/bcm27xx/patches-5.10/950-0639-cgroup-Disable-cgroup-memory-by-default.patch +++ b/target/linux/bcm27xx/patches-5.10/950-0639-cgroup-Disable-cgroup-memory-by-default.patch @@ -17,7 +17,7 @@ Signed-off-by: Phil Elwell --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c -@@ -5720,6 +5720,9 @@ int __init cgroup_init_early(void) +@@ -5735,6 +5735,9 @@ int __init cgroup_init_early(void) return 0; } @@ -27,7 +27,7 @@ Signed-off-by: Phil Elwell /** * cgroup_init - cgroup initialization * -@@ -5758,6 +5761,12 @@ int __init cgroup_init(void) +@@ -5773,6 +5776,12 @@ int __init cgroup_init(void) mutex_unlock(&cgroup_mutex); @@ -40,7 +40,7 @@ Signed-off-by: Phil Elwell for_each_subsys(ss, ssid) { if (ss->early_init) { struct cgroup_subsys_state *css = -@@ -6296,6 +6305,10 @@ static int __init cgroup_disable(char *s +@@ -6311,6 +6320,10 @@ static int __init cgroup_disable(char *s strcmp(token, ss->legacy_name)) continue; @@ -51,7 +51,7 @@ Signed-off-by: Phil Elwell static_branch_disable(cgroup_subsys_enabled_key[i]); pr_info("Disabling %s control group subsystem\n", ss->name); -@@ -6305,6 +6318,31 @@ static int __init cgroup_disable(char *s +@@ -6320,6 +6333,31 @@ static int __init cgroup_disable(char *s } __setup("cgroup_disable=", cgroup_disable); diff --git a/target/linux/bcm63xx/patches-5.10/143-gpio-fix-device-tree-gpio-hogs-on-dual-role-gpio-pin.patch b/target/linux/bcm63xx/patches-5.10/143-gpio-fix-device-tree-gpio-hogs-on-dual-role-gpio-pin.patch index 17cb9e0f00..9657592d70 100644 --- a/target/linux/bcm63xx/patches-5.10/143-gpio-fix-device-tree-gpio-hogs-on-dual-role-gpio-pin.patch +++ b/target/linux/bcm63xx/patches-5.10/143-gpio-fix-device-tree-gpio-hogs-on-dual-role-gpio-pin.patch @@ -116,7 +116,7 @@ Signed-off-by: Jonas Gorski } --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c -@@ -1893,7 +1893,8 @@ int gpiochip_add_pingroup_range(struct g +@@ -1912,7 +1912,8 @@ int gpiochip_add_pingroup_range(struct g list_add_tail(&pin_range->node, &gdev->pin_ranges); @@ -126,7 +126,7 @@ Signed-off-by: Jonas Gorski } EXPORT_SYMBOL_GPL(gpiochip_add_pingroup_range); -@@ -1950,7 +1951,7 @@ int gpiochip_add_pin_range(struct gpio_c +@@ -1969,7 +1970,7 @@ int gpiochip_add_pin_range(struct gpio_c list_add_tail(&pin_range->node, &gdev->pin_ranges); diff --git a/target/linux/generic/backport-5.10/711-v5.12-sfp-add-support-for-100-base-x-SFPs.patch b/target/linux/generic/backport-5.10/711-v5.12-sfp-add-support-for-100-base-x-SFPs.patch index 7d06c235d9..0c87532e13 100644 --- a/target/linux/generic/backport-5.10/711-v5.12-sfp-add-support-for-100-base-x-SFPs.patch +++ b/target/linux/generic/backport-5.10/711-v5.12-sfp-add-support-for-100-base-x-SFPs.patch @@ -15,7 +15,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/phy/sfp-bus.c +++ b/drivers/net/phy/sfp-bus.c -@@ -280,6 +280,12 @@ void sfp_parse_support(struct sfp_bus *b +@@ -286,6 +286,12 @@ void sfp_parse_support(struct sfp_bus *b br_min <= 1300 && br_max >= 1200) phylink_set(modes, 1000baseX_Full); @@ -28,7 +28,7 @@ Signed-off-by: Jakub Kicinski /* For active or passive cables, select the link modes * based on the bit rates and the cable compliance bytes. */ -@@ -399,6 +405,9 @@ phy_interface_t sfp_select_interface(str +@@ -405,6 +411,9 @@ phy_interface_t sfp_select_interface(str if (phylink_test(link_modes, 1000baseX_Full)) return PHY_INTERFACE_MODE_1000BASEX; diff --git a/target/linux/generic/backport-5.10/732-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch b/target/linux/generic/backport-5.10/732-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch index ab35665581..3b7f618a31 100644 --- a/target/linux/generic/backport-5.10/732-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch +++ b/target/linux/generic/backport-5.10/732-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch @@ -1398,7 +1398,7 @@ Signed-off-by: David S. Miller } phy_mode = device_get_phy_mode(&pdev->dev); -@@ -644,7 +644,7 @@ void stmmac_remove_config_dt(struct plat +@@ -643,7 +643,7 @@ void stmmac_remove_config_dt(struct plat } #else struct plat_stmmacenet_data * @@ -1834,7 +1834,7 @@ Signed-off-by: David S. Miller /* --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c -@@ -334,7 +334,6 @@ int wfx_probe(struct wfx_dev *wdev) +@@ -339,7 +339,6 @@ int wfx_probe(struct wfx_dev *wdev) { int i; int err; @@ -1842,7 +1842,7 @@ Signed-off-by: David S. Miller struct gpio_desc *gpio_saved; // During first part of boot, gpio_wakeup cannot yet been used. So -@@ -423,9 +422,9 @@ int wfx_probe(struct wfx_dev *wdev) +@@ -428,9 +427,9 @@ int wfx_probe(struct wfx_dev *wdev) for (i = 0; i < ARRAY_SIZE(wdev->addresses); i++) { eth_zero_addr(wdev->addresses[i].addr); diff --git a/target/linux/generic/backport-5.10/850-v5.17-0004-PCI-aardvark-Clear-all-MSIs-at-setup.patch b/target/linux/generic/backport-5.10/850-v5.17-0004-PCI-aardvark-Clear-all-MSIs-at-setup.patch index d617845e42..dc01c5f85d 100644 --- a/target/linux/generic/backport-5.10/850-v5.17-0004-PCI-aardvark-Clear-all-MSIs-at-setup.patch +++ b/target/linux/generic/backport-5.10/850-v5.17-0004-PCI-aardvark-Clear-all-MSIs-at-setup.patch @@ -48,7 +48,7 @@ Signed-off-by: Lorenzo Pieralisi /* Enable summary interrupt for GIC SPI source */ reg = PCIE_IRQ_ALL_MASK & (~PCIE_IRQ_ENABLE_INTS_MASK); -@@ -1401,7 +1403,7 @@ static void advk_pcie_handle_msi(struct +@@ -1397,7 +1399,7 @@ static void advk_pcie_handle_msi(struct msi_mask = advk_readl(pcie, PCIE_MSI_MASK_REG); msi_val = advk_readl(pcie, PCIE_MSI_STATUS_REG); diff --git a/target/linux/generic/backport-5.10/850-v5.17-0005-PCI-aardvark-Comment-actions-in-driver-remove-method.patch b/target/linux/generic/backport-5.10/850-v5.17-0005-PCI-aardvark-Comment-actions-in-driver-remove-method.patch index 1261066289..45df1b9695 100644 --- a/target/linux/generic/backport-5.10/850-v5.17-0005-PCI-aardvark-Comment-actions-in-driver-remove-method.patch +++ b/target/linux/generic/backport-5.10/850-v5.17-0005-PCI-aardvark-Comment-actions-in-driver-remove-method.patch @@ -18,7 +18,7 @@ Signed-off-by: Lorenzo Pieralisi --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1700,11 +1700,13 @@ static int advk_pcie_remove(struct platf +@@ -1696,11 +1696,13 @@ static int advk_pcie_remove(struct platf struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); int i; diff --git a/target/linux/generic/backport-5.10/850-v5.17-0006-PCI-aardvark-Disable-bus-mastering-when-unbinding-dr.patch b/target/linux/generic/backport-5.10/850-v5.17-0006-PCI-aardvark-Disable-bus-mastering-when-unbinding-dr.patch index cb50e08fdc..5959d80592 100644 --- a/target/linux/generic/backport-5.10/850-v5.17-0006-PCI-aardvark-Disable-bus-mastering-when-unbinding-dr.patch +++ b/target/linux/generic/backport-5.10/850-v5.17-0006-PCI-aardvark-Disable-bus-mastering-when-unbinding-dr.patch @@ -19,7 +19,7 @@ Signed-off-by: Lorenzo Pieralisi --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1698,6 +1698,7 @@ static int advk_pcie_remove(struct platf +@@ -1694,6 +1694,7 @@ static int advk_pcie_remove(struct platf { struct advk_pcie *pcie = platform_get_drvdata(pdev); struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); @@ -27,7 +27,7 @@ Signed-off-by: Lorenzo Pieralisi int i; /* Remove PCI bus with all devices */ -@@ -1706,6 +1707,11 @@ static int advk_pcie_remove(struct platf +@@ -1702,6 +1703,11 @@ static int advk_pcie_remove(struct platf pci_remove_root_bus(bridge->bus); pci_unlock_rescan_remove(); diff --git a/target/linux/generic/backport-5.10/850-v5.17-0007-PCI-aardvark-Mask-all-interrupts-when-unbinding-driv.patch b/target/linux/generic/backport-5.10/850-v5.17-0007-PCI-aardvark-Mask-all-interrupts-when-unbinding-driv.patch index ce8088b3b1..130bb701f8 100644 --- a/target/linux/generic/backport-5.10/850-v5.17-0007-PCI-aardvark-Mask-all-interrupts-when-unbinding-driv.patch +++ b/target/linux/generic/backport-5.10/850-v5.17-0007-PCI-aardvark-Mask-all-interrupts-when-unbinding-driv.patch @@ -18,7 +18,7 @@ Signed-off-by: Lorenzo Pieralisi --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1712,6 +1712,27 @@ static int advk_pcie_remove(struct platf +@@ -1708,6 +1708,27 @@ static int advk_pcie_remove(struct platf val &= ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); advk_writel(pcie, val, PCIE_CORE_CMD_STATUS_REG); diff --git a/target/linux/generic/backport-5.10/850-v5.17-0008-PCI-aardvark-Fix-memory-leak-in-driver-unbind.patch b/target/linux/generic/backport-5.10/850-v5.17-0008-PCI-aardvark-Fix-memory-leak-in-driver-unbind.patch index a460f770f8..74d25d508b 100644 --- a/target/linux/generic/backport-5.10/850-v5.17-0008-PCI-aardvark-Fix-memory-leak-in-driver-unbind.patch +++ b/target/linux/generic/backport-5.10/850-v5.17-0008-PCI-aardvark-Fix-memory-leak-in-driver-unbind.patch @@ -21,7 +21,7 @@ Signed-off-by: Lorenzo Pieralisi --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1737,6 +1737,9 @@ static int advk_pcie_remove(struct platf +@@ -1733,6 +1733,9 @@ static int advk_pcie_remove(struct platf advk_pcie_remove_msi_irq_domain(pcie); advk_pcie_remove_irq_domain(pcie); diff --git a/target/linux/generic/backport-5.10/850-v5.17-0009-PCI-aardvark-Assert-PERST-when-unbinding-driver.patch b/target/linux/generic/backport-5.10/850-v5.17-0009-PCI-aardvark-Assert-PERST-when-unbinding-driver.patch index 2dfd22f439..26d8afdddd 100644 --- a/target/linux/generic/backport-5.10/850-v5.17-0009-PCI-aardvark-Assert-PERST-when-unbinding-driver.patch +++ b/target/linux/generic/backport-5.10/850-v5.17-0009-PCI-aardvark-Assert-PERST-when-unbinding-driver.patch @@ -20,7 +20,7 @@ Signed-off-by: Lorenzo Pieralisi --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1740,6 +1740,10 @@ static int advk_pcie_remove(struct platf +@@ -1736,6 +1736,10 @@ static int advk_pcie_remove(struct platf /* Free config space for emulated root bridge */ pci_bridge_emul_cleanup(&pcie->bridge); diff --git a/target/linux/generic/backport-5.10/850-v5.17-0010-PCI-aardvark-Disable-link-training-when-unbinding-dr.patch b/target/linux/generic/backport-5.10/850-v5.17-0010-PCI-aardvark-Disable-link-training-when-unbinding-dr.patch index e1ff7e8573..23346a9284 100644 --- a/target/linux/generic/backport-5.10/850-v5.17-0010-PCI-aardvark-Disable-link-training-when-unbinding-dr.patch +++ b/target/linux/generic/backport-5.10/850-v5.17-0010-PCI-aardvark-Disable-link-training-when-unbinding-dr.patch @@ -20,7 +20,7 @@ Signed-off-by: Lorenzo Pieralisi --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1744,6 +1744,11 @@ static int advk_pcie_remove(struct platf +@@ -1740,6 +1740,11 @@ static int advk_pcie_remove(struct platf if (pcie->reset_gpio) gpiod_set_value_cansleep(pcie->reset_gpio, 1); diff --git a/target/linux/generic/backport-5.10/850-v5.17-0011-PCI-aardvark-Disable-common-PHY-when-unbinding-drive.patch b/target/linux/generic/backport-5.10/850-v5.17-0011-PCI-aardvark-Disable-common-PHY-when-unbinding-drive.patch index 5a0840f3ed..a7d5c014ab 100644 --- a/target/linux/generic/backport-5.10/850-v5.17-0011-PCI-aardvark-Disable-common-PHY-when-unbinding-drive.patch +++ b/target/linux/generic/backport-5.10/850-v5.17-0011-PCI-aardvark-Disable-common-PHY-when-unbinding-drive.patch @@ -18,7 +18,7 @@ Signed-off-by: Lorenzo Pieralisi --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1753,6 +1753,9 @@ static int advk_pcie_remove(struct platf +@@ -1749,6 +1749,9 @@ static int advk_pcie_remove(struct platf for (i = 0; i < OB_WIN_COUNT; i++) advk_pcie_disable_ob_win(pcie, i); diff --git a/target/linux/generic/pending-5.10/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch b/target/linux/generic/pending-5.10/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch index ecd6e9e7a2..106f7d3560 100644 --- a/target/linux/generic/pending-5.10/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch +++ b/target/linux/generic/pending-5.10/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch @@ -164,7 +164,7 @@ Signed-off-by: Felix Fietkau struct rtnl_link { rtnl_doit_func doit; -@@ -4684,7 +4684,9 @@ int ndo_dflt_bridge_getlink(struct sk_bu +@@ -4695,7 +4695,9 @@ int ndo_dflt_bridge_getlink(struct sk_bu brport_nla_put_flag(skb, flags, mask, IFLA_BRPORT_MCAST_FLOOD, BR_MCAST_FLOOD) || brport_nla_put_flag(skb, flags, mask, diff --git a/target/linux/generic/pending-5.10/850-0002-PCI-aardvark-Fix-reading-MSI-interrupt-number.patch b/target/linux/generic/pending-5.10/850-0002-PCI-aardvark-Fix-reading-MSI-interrupt-number.patch index 6d08456d47..b2d32f5566 100644 --- a/target/linux/generic/pending-5.10/850-0002-PCI-aardvark-Fix-reading-MSI-interrupt-number.patch +++ b/target/linux/generic/pending-5.10/850-0002-PCI-aardvark-Fix-reading-MSI-interrupt-number.patch @@ -27,7 +27,7 @@ Signed-off-by: Marek Behún --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1395,7 +1395,7 @@ static void advk_pcie_remove_irq_domain( +@@ -1391,7 +1391,7 @@ static void advk_pcie_remove_irq_domain( static void advk_pcie_handle_msi(struct advk_pcie *pcie) { u32 msi_val, msi_mask, msi_status, msi_idx; @@ -36,7 +36,7 @@ Signed-off-by: Marek Behún msi_mask = advk_readl(pcie, PCIE_MSI_MASK_REG); msi_val = advk_readl(pcie, PCIE_MSI_STATUS_REG); -@@ -1405,13 +1405,12 @@ static void advk_pcie_handle_msi(struct +@@ -1401,13 +1401,12 @@ static void advk_pcie_handle_msi(struct if (!(BIT(msi_idx) & msi_status)) continue; diff --git a/target/linux/generic/pending-5.10/850-0003-PCI-aardvark-Fix-support-for-MSI-interrupts.patch b/target/linux/generic/pending-5.10/850-0003-PCI-aardvark-Fix-support-for-MSI-interrupts.patch deleted file mode 100644 index 813cbe5148..0000000000 --- a/target/linux/generic/pending-5.10/850-0003-PCI-aardvark-Fix-support-for-MSI-interrupts.patch +++ /dev/null @@ -1,72 +0,0 @@ -From bb03b126ea6c9e57177b537dd022246fa5dbef16 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Pali=20Roh=C3=A1r?= -Date: Fri, 12 Feb 2021 16:24:07 +0100 -Subject: [PATCH] PCI: aardvark: Fix support for MSI interrupts -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Aardvark hardware supports Multi-MSI and MSI_FLAG_MULTI_PCI_MSI is already -set for the MSI chip. But when allocating MSI interrupt numbers for -Multi-MSI, the numbers need to be properly aligned, otherwise endpoint -devices send MSI interrupt with incorrect numbers. - -Fix this issue by using function bitmap_find_free_region() instead of -bitmap_find_next_zero_area(). - -To ensure that aligned MSI interrupt numbers are used by endpoint devices, -we cannot use Linux virtual irq numbers (as they are random and not -properly aligned). Instead we need to use the aligned hwirq numbers. - -This change fixes receiving MSI interrupts on Armada 3720 boards and -allows using NVMe disks which use Multi-MSI feature with 3 interrupts. - -Without this NVMe disks freeze booting as linux nvme-core.c is waiting -60s for an interrupt. - -Signed-off-by: Pali Rohár -Signed-off-by: Marek Behún ---- - drivers/pci/controller/pci-aardvark.c | 16 ++++++---------- - 1 file changed, 6 insertions(+), 10 deletions(-) - ---- a/drivers/pci/controller/pci-aardvark.c -+++ b/drivers/pci/controller/pci-aardvark.c -@@ -1191,7 +1191,7 @@ static void advk_msi_irq_compose_msi_msg - - msg->address_lo = lower_32_bits(msi_msg); - msg->address_hi = upper_32_bits(msi_msg); -- msg->data = data->irq; -+ msg->data = data->hwirq; - } - - static int advk_msi_set_affinity(struct irq_data *irq_data, -@@ -1208,15 +1208,11 @@ static int advk_msi_irq_domain_alloc(str - int hwirq, i; - - mutex_lock(&pcie->msi_used_lock); -- hwirq = bitmap_find_next_zero_area(pcie->msi_used, MSI_IRQ_NUM, -- 0, nr_irqs, 0); -- if (hwirq >= MSI_IRQ_NUM) { -- mutex_unlock(&pcie->msi_used_lock); -- return -ENOSPC; -- } -- -- bitmap_set(pcie->msi_used, hwirq, nr_irqs); -+ hwirq = bitmap_find_free_region(pcie->msi_used, MSI_IRQ_NUM, -+ order_base_2(nr_irqs)); - mutex_unlock(&pcie->msi_used_lock); -+ if (hwirq < 0) -+ return -ENOSPC; - - for (i = 0; i < nr_irqs; i++) - irq_domain_set_info(domain, virq + i, hwirq + i, -@@ -1234,7 +1230,7 @@ static void advk_msi_irq_domain_free(str - struct advk_pcie *pcie = domain->host_data; - - mutex_lock(&pcie->msi_used_lock); -- bitmap_clear(pcie->msi_used, d->hwirq, nr_irqs); -+ bitmap_release_region(pcie->msi_used, d->hwirq, order_base_2(nr_irqs)); - mutex_unlock(&pcie->msi_used_lock); - } - diff --git a/target/linux/ipq806x/patches-5.10/108-v5.14-net-stmmac-explicitly-deassert-gmac-ahb-reset.patch b/target/linux/ipq806x/patches-5.10/108-v5.14-net-stmmac-explicitly-deassert-gmac-ahb-reset.patch index dd1e506e5b..77667b139e 100644 --- a/target/linux/ipq806x/patches-5.10/108-v5.14-net-stmmac-explicitly-deassert-gmac-ahb-reset.patch +++ b/target/linux/ipq806x/patches-5.10/108-v5.14-net-stmmac-explicitly-deassert-gmac-ahb-reset.patch @@ -50,7 +50,7 @@ Signed-off-by: David S. Miller if (priv->hw->pcs != STMMAC_PCS_TBI && --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c -@@ -617,6 +617,12 @@ stmmac_probe_config_dt(struct platform_d +@@ -616,6 +616,12 @@ stmmac_probe_config_dt(struct platform_d plat->stmmac_rst = NULL; } From de7535a6ac4467dbc2981fbd5b0aa785d286c9a0 Mon Sep 17 00:00:00 2001 From: Rui Salvaterra Date: Thu, 14 Apr 2022 09:28:11 +0100 Subject: [PATCH 17/26] kernel: bump 5.15 to 5.15.34 Deleted (upstreamed): generic/pending-5.15/850-0003-PCI-aardvark-Fix-support-for-MSI-interrupts.patch [1] [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.34&id=60eabd66d17fa2cbc31f670b2f201f0bc54090a2 Signed-off-by: Rui Salvaterra --- include/kernel-5.15 | 4 +- .../910-unaligned_access_hacks.patch | 2 +- ...PCI-aardvark-Clear-all-MSIs-at-setup.patch | 2 +- ...ment-actions-in-driver-remove-method.patch | 2 +- ...able-bus-mastering-when-unbinding-dr.patch | 4 +- ...k-all-interrupts-when-unbinding-driv.patch | 2 +- ...ark-Fix-memory-leak-in-driver-unbind.patch | 2 +- ...k-Assert-PERST-when-unbinding-driver.patch | 2 +- ...able-link-training-when-unbinding-dr.patch | 2 +- ...able-common-PHY-when-unbinding-drive.patch | 2 +- ...t-size-the-hashtable-more-adequately.patch | 2 +- ...d-knob-for-filtering-rx-tx-BPDU-pack.patch | 2 +- ...dvark-Fix-support-for-MSI-interrupts.patch | 72 ------------------- .../pending-5.15/920-mangle_bootargs.patch | 4 +- ...Mangle-bootloader-s-kernel-arguments.patch | 4 +- 15 files changed, 18 insertions(+), 90 deletions(-) delete mode 100644 target/linux/generic/pending-5.15/850-0003-PCI-aardvark-Fix-support-for-MSI-interrupts.patch diff --git a/include/kernel-5.15 b/include/kernel-5.15 index cb830e39db..31ee3119eb 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .33 -LINUX_KERNEL_HASH-5.15.33 = c30a17e6090f9ebf2d8ff58cd6c92c7324b1f4a8b3aa6a7f68850310af05a9c4 +LINUX_VERSION-5.15 = .34 +LINUX_KERNEL_HASH-5.15.34 = a7514685392f0f89b337fa252a10a004c6a97d23e8d1126059c8e373398fdb69 diff --git a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch index 7196d28fb2..46f5be3d4e 100644 --- a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch @@ -171,7 +171,7 @@ #define UDP_CORK 1 /* Never send partially complete segments */ --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c -@@ -292,8 +292,8 @@ nf_ct_get_tuple(const struct sk_buff *sk +@@ -305,8 +305,8 @@ nf_ct_get_tuple(const struct sk_buff *sk switch (l3num) { case NFPROTO_IPV4: diff --git a/target/linux/generic/backport-5.15/850-v5.17-0004-PCI-aardvark-Clear-all-MSIs-at-setup.patch b/target/linux/generic/backport-5.15/850-v5.17-0004-PCI-aardvark-Clear-all-MSIs-at-setup.patch index 9967f46639..61dd8b8733 100644 --- a/target/linux/generic/backport-5.15/850-v5.17-0004-PCI-aardvark-Clear-all-MSIs-at-setup.patch +++ b/target/linux/generic/backport-5.15/850-v5.17-0004-PCI-aardvark-Clear-all-MSIs-at-setup.patch @@ -48,7 +48,7 @@ Signed-off-by: Lorenzo Pieralisi /* Enable summary interrupt for GIC SPI source */ reg = PCIE_IRQ_ALL_MASK & (~PCIE_IRQ_ENABLE_INTS_MASK); -@@ -1393,7 +1395,7 @@ static void advk_pcie_handle_msi(struct +@@ -1389,7 +1391,7 @@ static void advk_pcie_handle_msi(struct msi_mask = advk_readl(pcie, PCIE_MSI_MASK_REG); msi_val = advk_readl(pcie, PCIE_MSI_STATUS_REG); diff --git a/target/linux/generic/backport-5.15/850-v5.17-0005-PCI-aardvark-Comment-actions-in-driver-remove-method.patch b/target/linux/generic/backport-5.15/850-v5.17-0005-PCI-aardvark-Comment-actions-in-driver-remove-method.patch index e60fbd0cea..a022f3ec6c 100644 --- a/target/linux/generic/backport-5.15/850-v5.17-0005-PCI-aardvark-Comment-actions-in-driver-remove-method.patch +++ b/target/linux/generic/backport-5.15/850-v5.17-0005-PCI-aardvark-Comment-actions-in-driver-remove-method.patch @@ -18,7 +18,7 @@ Signed-off-by: Lorenzo Pieralisi --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1685,11 +1685,13 @@ static int advk_pcie_remove(struct platf +@@ -1681,11 +1681,13 @@ static int advk_pcie_remove(struct platf struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); int i; diff --git a/target/linux/generic/backport-5.15/850-v5.17-0006-PCI-aardvark-Disable-bus-mastering-when-unbinding-dr.patch b/target/linux/generic/backport-5.15/850-v5.17-0006-PCI-aardvark-Disable-bus-mastering-when-unbinding-dr.patch index 7ac7db2ed3..9b8ae26dfe 100644 --- a/target/linux/generic/backport-5.15/850-v5.17-0006-PCI-aardvark-Disable-bus-mastering-when-unbinding-dr.patch +++ b/target/linux/generic/backport-5.15/850-v5.17-0006-PCI-aardvark-Disable-bus-mastering-when-unbinding-dr.patch @@ -19,7 +19,7 @@ Signed-off-by: Lorenzo Pieralisi --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1683,6 +1683,7 @@ static int advk_pcie_remove(struct platf +@@ -1679,6 +1679,7 @@ static int advk_pcie_remove(struct platf { struct advk_pcie *pcie = platform_get_drvdata(pdev); struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); @@ -27,7 +27,7 @@ Signed-off-by: Lorenzo Pieralisi int i; /* Remove PCI bus with all devices */ -@@ -1691,6 +1692,11 @@ static int advk_pcie_remove(struct platf +@@ -1687,6 +1688,11 @@ static int advk_pcie_remove(struct platf pci_remove_root_bus(bridge->bus); pci_unlock_rescan_remove(); diff --git a/target/linux/generic/backport-5.15/850-v5.17-0007-PCI-aardvark-Mask-all-interrupts-when-unbinding-driv.patch b/target/linux/generic/backport-5.15/850-v5.17-0007-PCI-aardvark-Mask-all-interrupts-when-unbinding-driv.patch index 85c8b7059d..97173ee281 100644 --- a/target/linux/generic/backport-5.15/850-v5.17-0007-PCI-aardvark-Mask-all-interrupts-when-unbinding-driv.patch +++ b/target/linux/generic/backport-5.15/850-v5.17-0007-PCI-aardvark-Mask-all-interrupts-when-unbinding-driv.patch @@ -18,7 +18,7 @@ Signed-off-by: Lorenzo Pieralisi --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1697,6 +1697,27 @@ static int advk_pcie_remove(struct platf +@@ -1693,6 +1693,27 @@ static int advk_pcie_remove(struct platf val &= ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); advk_writel(pcie, val, PCIE_CORE_CMD_STATUS_REG); diff --git a/target/linux/generic/backport-5.15/850-v5.17-0008-PCI-aardvark-Fix-memory-leak-in-driver-unbind.patch b/target/linux/generic/backport-5.15/850-v5.17-0008-PCI-aardvark-Fix-memory-leak-in-driver-unbind.patch index d24bd82273..e8611c82fe 100644 --- a/target/linux/generic/backport-5.15/850-v5.17-0008-PCI-aardvark-Fix-memory-leak-in-driver-unbind.patch +++ b/target/linux/generic/backport-5.15/850-v5.17-0008-PCI-aardvark-Fix-memory-leak-in-driver-unbind.patch @@ -21,7 +21,7 @@ Signed-off-by: Lorenzo Pieralisi --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1722,6 +1722,9 @@ static int advk_pcie_remove(struct platf +@@ -1718,6 +1718,9 @@ static int advk_pcie_remove(struct platf advk_pcie_remove_msi_irq_domain(pcie); advk_pcie_remove_irq_domain(pcie); diff --git a/target/linux/generic/backport-5.15/850-v5.17-0009-PCI-aardvark-Assert-PERST-when-unbinding-driver.patch b/target/linux/generic/backport-5.15/850-v5.17-0009-PCI-aardvark-Assert-PERST-when-unbinding-driver.patch index 1928a3c6f1..3e309159d0 100644 --- a/target/linux/generic/backport-5.15/850-v5.17-0009-PCI-aardvark-Assert-PERST-when-unbinding-driver.patch +++ b/target/linux/generic/backport-5.15/850-v5.17-0009-PCI-aardvark-Assert-PERST-when-unbinding-driver.patch @@ -20,7 +20,7 @@ Signed-off-by: Lorenzo Pieralisi --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1725,6 +1725,10 @@ static int advk_pcie_remove(struct platf +@@ -1721,6 +1721,10 @@ static int advk_pcie_remove(struct platf /* Free config space for emulated root bridge */ pci_bridge_emul_cleanup(&pcie->bridge); diff --git a/target/linux/generic/backport-5.15/850-v5.17-0010-PCI-aardvark-Disable-link-training-when-unbinding-dr.patch b/target/linux/generic/backport-5.15/850-v5.17-0010-PCI-aardvark-Disable-link-training-when-unbinding-dr.patch index f66635aaef..1a5725121b 100644 --- a/target/linux/generic/backport-5.15/850-v5.17-0010-PCI-aardvark-Disable-link-training-when-unbinding-dr.patch +++ b/target/linux/generic/backport-5.15/850-v5.17-0010-PCI-aardvark-Disable-link-training-when-unbinding-dr.patch @@ -20,7 +20,7 @@ Signed-off-by: Lorenzo Pieralisi --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1729,6 +1729,11 @@ static int advk_pcie_remove(struct platf +@@ -1725,6 +1725,11 @@ static int advk_pcie_remove(struct platf if (pcie->reset_gpio) gpiod_set_value_cansleep(pcie->reset_gpio, 1); diff --git a/target/linux/generic/backport-5.15/850-v5.17-0011-PCI-aardvark-Disable-common-PHY-when-unbinding-drive.patch b/target/linux/generic/backport-5.15/850-v5.17-0011-PCI-aardvark-Disable-common-PHY-when-unbinding-drive.patch index 263e81f354..4a4af186fd 100644 --- a/target/linux/generic/backport-5.15/850-v5.17-0011-PCI-aardvark-Disable-common-PHY-when-unbinding-drive.patch +++ b/target/linux/generic/backport-5.15/850-v5.17-0011-PCI-aardvark-Disable-common-PHY-when-unbinding-drive.patch @@ -18,7 +18,7 @@ Signed-off-by: Lorenzo Pieralisi --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1738,6 +1738,9 @@ static int advk_pcie_remove(struct platf +@@ -1734,6 +1734,9 @@ static int advk_pcie_remove(struct platf for (i = 0; i < OB_WIN_COUNT; i++) advk_pcie_disable_ob_win(pcie, i); diff --git a/target/linux/generic/hack-5.15/661-kernel-ct-size-the-hashtable-more-adequately.patch b/target/linux/generic/hack-5.15/661-kernel-ct-size-the-hashtable-more-adequately.patch index a003fc2944..134e2100c8 100644 --- a/target/linux/generic/hack-5.15/661-kernel-ct-size-the-hashtable-more-adequately.patch +++ b/target/linux/generic/hack-5.15/661-kernel-ct-size-the-hashtable-more-adequately.patch @@ -14,7 +14,7 @@ Signed-off-by: Rui Salvaterra --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c -@@ -2676,7 +2676,7 @@ int nf_conntrack_init_start(void) +@@ -2727,7 +2727,7 @@ int nf_conntrack_init_start(void) if (!nf_conntrack_htable_size) { nf_conntrack_htable_size diff --git a/target/linux/generic/pending-5.15/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch b/target/linux/generic/pending-5.15/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch index f30887fccb..84a3ee8e60 100644 --- a/target/linux/generic/pending-5.15/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch +++ b/target/linux/generic/pending-5.15/710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch @@ -161,7 +161,7 @@ Signed-off-by: Felix Fietkau struct rtnl_link { rtnl_doit_func doit; -@@ -4689,7 +4689,9 @@ int ndo_dflt_bridge_getlink(struct sk_bu +@@ -4700,7 +4700,9 @@ int ndo_dflt_bridge_getlink(struct sk_bu brport_nla_put_flag(skb, flags, mask, IFLA_BRPORT_MCAST_FLOOD, BR_MCAST_FLOOD) || brport_nla_put_flag(skb, flags, mask, diff --git a/target/linux/generic/pending-5.15/850-0003-PCI-aardvark-Fix-support-for-MSI-interrupts.patch b/target/linux/generic/pending-5.15/850-0003-PCI-aardvark-Fix-support-for-MSI-interrupts.patch deleted file mode 100644 index 950f3a8abf..0000000000 --- a/target/linux/generic/pending-5.15/850-0003-PCI-aardvark-Fix-support-for-MSI-interrupts.patch +++ /dev/null @@ -1,72 +0,0 @@ -From bb03b126ea6c9e57177b537dd022246fa5dbef16 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Pali=20Roh=C3=A1r?= -Date: Fri, 12 Feb 2021 16:24:07 +0100 -Subject: [PATCH] PCI: aardvark: Fix support for MSI interrupts -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Aardvark hardware supports Multi-MSI and MSI_FLAG_MULTI_PCI_MSI is already -set for the MSI chip. But when allocating MSI interrupt numbers for -Multi-MSI, the numbers need to be properly aligned, otherwise endpoint -devices send MSI interrupt with incorrect numbers. - -Fix this issue by using function bitmap_find_free_region() instead of -bitmap_find_next_zero_area(). - -To ensure that aligned MSI interrupt numbers are used by endpoint devices, -we cannot use Linux virtual irq numbers (as they are random and not -properly aligned). Instead we need to use the aligned hwirq numbers. - -This change fixes receiving MSI interrupts on Armada 3720 boards and -allows using NVMe disks which use Multi-MSI feature with 3 interrupts. - -Without this NVMe disks freeze booting as linux nvme-core.c is waiting -60s for an interrupt. - -Signed-off-by: Pali Rohár -Signed-off-by: Marek Behún ---- - drivers/pci/controller/pci-aardvark.c | 16 ++++++---------- - 1 file changed, 6 insertions(+), 10 deletions(-) - ---- a/drivers/pci/controller/pci-aardvark.c -+++ b/drivers/pci/controller/pci-aardvark.c -@@ -1184,7 +1184,7 @@ static void advk_msi_irq_compose_msi_msg - - msg->address_lo = lower_32_bits(msi_msg); - msg->address_hi = upper_32_bits(msi_msg); -- msg->data = data->irq; -+ msg->data = data->hwirq; - } - - static int advk_msi_set_affinity(struct irq_data *irq_data, -@@ -1201,15 +1201,11 @@ static int advk_msi_irq_domain_alloc(str - int hwirq, i; - - mutex_lock(&pcie->msi_used_lock); -- hwirq = bitmap_find_next_zero_area(pcie->msi_used, MSI_IRQ_NUM, -- 0, nr_irqs, 0); -- if (hwirq >= MSI_IRQ_NUM) { -- mutex_unlock(&pcie->msi_used_lock); -- return -ENOSPC; -- } -- -- bitmap_set(pcie->msi_used, hwirq, nr_irqs); -+ hwirq = bitmap_find_free_region(pcie->msi_used, MSI_IRQ_NUM, -+ order_base_2(nr_irqs)); - mutex_unlock(&pcie->msi_used_lock); -+ if (hwirq < 0) -+ return -ENOSPC; - - for (i = 0; i < nr_irqs; i++) - irq_domain_set_info(domain, virq + i, hwirq + i, -@@ -1227,7 +1223,7 @@ static void advk_msi_irq_domain_free(str - struct advk_pcie *pcie = domain->host_data; - - mutex_lock(&pcie->msi_used_lock); -- bitmap_clear(pcie->msi_used, d->hwirq, nr_irqs); -+ bitmap_release_region(pcie->msi_used, d->hwirq, order_base_2(nr_irqs)); - mutex_unlock(&pcie->msi_used_lock); - } - diff --git a/target/linux/generic/pending-5.15/920-mangle_bootargs.patch b/target/linux/generic/pending-5.15/920-mangle_bootargs.patch index d3f3a1c639..1fb0182f1e 100644 --- a/target/linux/generic/pending-5.15/920-mangle_bootargs.patch +++ b/target/linux/generic/pending-5.15/920-mangle_bootargs.patch @@ -31,7 +31,7 @@ Signed-off-by: Imre Kaloz help --- a/init/main.c +++ b/init/main.c -@@ -614,6 +614,29 @@ static inline void setup_nr_cpu_ids(void +@@ -615,6 +615,29 @@ static inline void setup_nr_cpu_ids(void static inline void smp_prepare_cpus(unsigned int maxcpus) { } #endif @@ -61,7 +61,7 @@ Signed-off-by: Imre Kaloz /* * We need to store the untouched command line for future reference. * We also need to store the touched command line since the parameter -@@ -954,6 +977,7 @@ asmlinkage __visible void __init __no_sa +@@ -955,6 +978,7 @@ asmlinkage __visible void __init __no_sa pr_notice("%s", linux_banner); early_security_init(); setup_arch(&command_line); diff --git a/target/linux/ipq806x/patches-5.15/0067-generic-Mangle-bootloader-s-kernel-arguments.patch b/target/linux/ipq806x/patches-5.15/0067-generic-Mangle-bootloader-s-kernel-arguments.patch index 9cc5719078..39ec7b8028 100644 --- a/target/linux/ipq806x/patches-5.15/0067-generic-Mangle-bootloader-s-kernel-arguments.patch +++ b/target/linux/ipq806x/patches-5.15/0067-generic-Mangle-bootloader-s-kernel-arguments.patch @@ -178,7 +178,7 @@ Signed-off-by: Adrian Panella } --- a/init/main.c +++ b/init/main.c -@@ -112,6 +112,10 @@ +@@ -113,6 +113,10 @@ #include @@ -189,7 +189,7 @@ Signed-off-by: Adrian Panella static int kernel_init(void *); extern void init_IRQ(void); -@@ -991,6 +995,18 @@ asmlinkage __visible void __init __no_sa +@@ -992,6 +996,18 @@ asmlinkage __visible void __init __no_sa pr_notice("Kernel command line: %s\n", saved_command_line); /* parameters may set static keys */ jump_label_init(); From 0642a2166b9526ec01fe47b6aed1fd57a29e35f9 Mon Sep 17 00:00:00 2001 From: Doug Kerr Date: Fri, 15 Apr 2022 15:47:32 -0400 Subject: [PATCH 18/26] scripts: use std library for jam crc32 calculation CRC32 is available in a standard library. It seems reasonable to defer to that rather than run a custom implementation. Signed-off-by: Doug Kerr --- scripts/cfe-partition-tag.py | 79 ++-------------------------------- scripts/cfe-wfi-tag.py | 82 +++--------------------------------- 2 files changed, 9 insertions(+), 152 deletions(-) diff --git a/scripts/cfe-partition-tag.py b/scripts/cfe-partition-tag.py index a2605d5205..875bfae85d 100755 --- a/scripts/cfe-partition-tag.py +++ b/scripts/cfe-partition-tag.py @@ -17,88 +17,16 @@ CFE Partition Tag import argparse import os import struct +import binascii + PART_NAME_SIZE = 33 PART_VERSION_SIZE = 21 -CRC32_INIT = 0xFFFFFFFF -CRC32_TABLE = [ - 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, - 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, - 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, - 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, - 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, - 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, - 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, - 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, - 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, - 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, - 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, - 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, - 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, - 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, - 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, - 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, - 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, - 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, - 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, - 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, - 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, - 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, - 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, - 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, - 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, - 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, - 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, - 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, - 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, - 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, - 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, - 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, - 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, - 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, - 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, - 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, - 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, - 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, - 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, - 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, - 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, - 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, - 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, - 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, - 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, - 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, - 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, - 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, - 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, - 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, - 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, - 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, - 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, - 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, - 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, - 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, - 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, - 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, - 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, - 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, - 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, - 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, - 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, - 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D -] def auto_int(x): return int(x, 0) -def crc32(bytes, size, crc): - i = 0 - while (i < size): - crc = (crc >> 8) ^ CRC32_TABLE[(crc ^ bytes[i]) & 0xff] - i += 1 - return crc - def str_to_bytes_pad(string, size): str_bytes = string.encode() num_bytes = len(str_bytes) @@ -109,7 +37,8 @@ def str_to_bytes_pad(string, size): return str_bytes def create_tag(args, in_bytes, size): - crc = crc32(in_bytes, size, CRC32_INIT) + # JAM CRC32 is bitwise not and unsigned + crc = (~binascii.crc32(in_bytes) & 0xFFFFFFFF) tag = bytearray() tag += struct.pack('>I', args.part_id) diff --git a/scripts/cfe-wfi-tag.py b/scripts/cfe-wfi-tag.py index 78ae869f1d..c98301d91a 100755 --- a/scripts/cfe-wfi-tag.py +++ b/scripts/cfe-wfi-tag.py @@ -43,87 +43,15 @@ Flags: import argparse import os import struct +import binascii -CRC32_INIT = 0xFFFFFFFF -CRC32_TABLE = [ - 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, - 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, - 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, - 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, - 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, - 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, - 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, - 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, - 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, - 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, - 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, - 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, - 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, - 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, - 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, - 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, - 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, - 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, - 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, - 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, - 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, - 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, - 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, - 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, - 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, - 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, - 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, - 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, - 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, - 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, - 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, - 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, - 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, - 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, - 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, - 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, - 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, - 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, - 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, - 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, - 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, - 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, - 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, - 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, - 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, - 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, - 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, - 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, - 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, - 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, - 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, - 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, - 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, - 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, - 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, - 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, - 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, - 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, - 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, - 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, - 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, - 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, - 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, - 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D -] def auto_int(x): return int(x, 0) -def crc32(bytes, size, crc): - i = 0 - while (i < size): - crc = (crc >> 8) ^ CRC32_TABLE[(crc ^ bytes[i]) & 0xff] - i += 1 - return crc - -def create_tag(args, in_bytes, size): - crc = crc32(in_bytes, size, CRC32_INIT) +def create_tag(args, in_bytes): + # JAM CRC32 is bitwise not and unsigned + crc = (~binascii.crc32(in_bytes) & 0xFFFFFFFF) tag = struct.pack('>IIIII', crc, args.tag_version, args.chip_id, args.flash_type, args.flags) return tag @@ -135,7 +63,7 @@ def create_output(args): in_bytes = in_f.read(in_size) in_f.close() - tag = create_tag(args, in_bytes, in_size) + tag = create_tag(args, in_bytes) out_f = open(args.output_file, 'w+b') out_f.write(in_bytes) From 6f692c9c497e5e60eb51da741b07ef1c10096355 Mon Sep 17 00:00:00 2001 From: Doug Kerr Date: Fri, 15 Apr 2022 15:54:30 -0400 Subject: [PATCH 19/26] scripts: format to black clean up formatting with black using 80 character line limit Signed-off-by: Doug Kerr --- scripts/cfe-partition-tag.py | 155 ++++++++++++++++++++--------------- scripts/cfe-wfi-tag.py | 135 +++++++++++++++++------------- 2 files changed, 165 insertions(+), 125 deletions(-) diff --git a/scripts/cfe-partition-tag.py b/scripts/cfe-partition-tag.py index 875bfae85d..41495a9af0 100755 --- a/scripts/cfe-partition-tag.py +++ b/scripts/cfe-partition-tag.py @@ -25,96 +25,115 @@ PART_VERSION_SIZE = 21 def auto_int(x): - return int(x, 0) + return int(x, 0) + def str_to_bytes_pad(string, size): - str_bytes = string.encode() - num_bytes = len(str_bytes) - if (num_bytes >= size): - str_bytes = str_bytes[:size - 1] + '\0'.encode() - else: - str_bytes += '\0'.encode() * (size - num_bytes) - return str_bytes + str_bytes = string.encode() + num_bytes = len(str_bytes) + if num_bytes >= size: + str_bytes = str_bytes[: size - 1] + "\0".encode() + else: + str_bytes += "\0".encode() * (size - num_bytes) + return str_bytes + def create_tag(args, in_bytes, size): # JAM CRC32 is bitwise not and unsigned - crc = (~binascii.crc32(in_bytes) & 0xFFFFFFFF) + crc = ~binascii.crc32(in_bytes) & 0xFFFFFFFF - tag = bytearray() - tag += struct.pack('>I', args.part_id) - tag += struct.pack('>I', size) - tag += struct.pack('>H', args.part_flags) - tag += str_to_bytes_pad(args.part_name, PART_NAME_SIZE) - tag += str_to_bytes_pad(args.part_version, PART_VERSION_SIZE) - tag += struct.pack('>I', crc) + tag = bytearray() + tag += struct.pack(">I", args.part_id) + tag += struct.pack(">I", size) + tag += struct.pack(">H", args.part_flags) + tag += str_to_bytes_pad(args.part_name, PART_NAME_SIZE) + tag += str_to_bytes_pad(args.part_version, PART_VERSION_SIZE) + tag += struct.pack(">I", crc) + + return tag - return tag def create_output(args): - in_st = os.stat(args.input_file) - in_size = in_st.st_size + in_st = os.stat(args.input_file) + in_size = in_st.st_size - in_f = open(args.input_file, 'r+b') - in_bytes = in_f.read(in_size) - in_f.close() + in_f = open(args.input_file, "r+b") + in_bytes = in_f.read(in_size) + in_f.close() - tag = create_tag(args, in_bytes, in_size) + tag = create_tag(args, in_bytes, in_size) + + out_f = open(args.output_file, "w+b") + out_f.write(tag) + out_f.close() - out_f = open(args.output_file, 'w+b') - out_f.write(tag) - out_f.close() def main(): - global args + global args - parser = argparse.ArgumentParser(description='') + parser = argparse.ArgumentParser(description="") - parser.add_argument('--flags', - dest='part_flags', - action='store', - type=auto_int, - help='Partition Flags') + parser.add_argument( + "--flags", + dest="part_flags", + action="store", + type=auto_int, + help="Partition Flags", + ) - parser.add_argument('--id', - dest='part_id', - action='store', - type=auto_int, - help='Partition ID') + parser.add_argument( + "--id", + dest="part_id", + action="store", + type=auto_int, + help="Partition ID", + ) - parser.add_argument('--input-file', - dest='input_file', - action='store', - type=str, - help='Input file') + parser.add_argument( + "--input-file", + dest="input_file", + action="store", + type=str, + help="Input file", + ) - parser.add_argument('--output-file', - dest='output_file', - action='store', - type=str, - help='Output file') + parser.add_argument( + "--output-file", + dest="output_file", + action="store", + type=str, + help="Output file", + ) - parser.add_argument('--name', - dest='part_name', - action='store', - type=str, - help='Partition Name') + parser.add_argument( + "--name", + dest="part_name", + action="store", + type=str, + help="Partition Name", + ) - parser.add_argument('--version', - dest='part_version', - action='store', - type=str, - help='Partition Version') + parser.add_argument( + "--version", + dest="part_version", + action="store", + type=str, + help="Partition Version", + ) - args = parser.parse_args() + args = parser.parse_args() + + if ( + (not args.part_flags) + or (not args.part_id) + or (not args.input_file) + or (not args.output_file) + or (not args.part_name) + or (not args.part_version) + ): + parser.print_help() + else: + create_output(args) - if ((not args.part_flags) or - (not args.part_id) or - (not args.input_file) or - (not args.output_file) or - (not args.part_name) or - (not args.part_version)): - parser.print_help() - else: - create_output(args) main() diff --git a/scripts/cfe-wfi-tag.py b/scripts/cfe-wfi-tag.py index c98301d91a..5fac8ee475 100755 --- a/scripts/cfe-wfi-tag.py +++ b/scripts/cfe-wfi-tag.py @@ -47,82 +47,103 @@ import binascii def auto_int(x): - return int(x, 0) + return int(x, 0) + def create_tag(args, in_bytes): # JAM CRC32 is bitwise not and unsigned - crc = (~binascii.crc32(in_bytes) & 0xFFFFFFFF) - tag = struct.pack('>IIIII', crc, args.tag_version, args.chip_id, args.flash_type, args.flags) - return tag + crc = ~binascii.crc32(in_bytes) & 0xFFFFFFFF + tag = struct.pack( + ">IIIII", + crc, + args.tag_version, + args.chip_id, + args.flash_type, + args.flags, + ) + return tag + def create_output(args): - in_st = os.stat(args.input_file) - in_size = in_st.st_size + in_st = os.stat(args.input_file) + in_size = in_st.st_size - in_f = open(args.input_file, 'r+b') - in_bytes = in_f.read(in_size) - in_f.close() + in_f = open(args.input_file, "r+b") + in_bytes = in_f.read(in_size) + in_f.close() - tag = create_tag(args, in_bytes) + tag = create_tag(args, in_bytes) + + out_f = open(args.output_file, "w+b") + out_f.write(in_bytes) + out_f.write(tag) + out_f.close() - out_f = open(args.output_file, 'w+b') - out_f.write(in_bytes) - out_f.write(tag) - out_f.close() def main(): - global args + global args - parser = argparse.ArgumentParser(description='') + parser = argparse.ArgumentParser(description="") - parser.add_argument('--input-file', - dest='input_file', - action='store', - type=str, - help='Input file') + parser.add_argument( + "--input-file", + dest="input_file", + action="store", + type=str, + help="Input file", + ) - parser.add_argument('--output-file', - dest='output_file', - action='store', - type=str, - help='Output file') + parser.add_argument( + "--output-file", + dest="output_file", + action="store", + type=str, + help="Output file", + ) - parser.add_argument('--version', - dest='tag_version', - action='store', - type=auto_int, - help='WFI Tag Version') + parser.add_argument( + "--version", + dest="tag_version", + action="store", + type=auto_int, + help="WFI Tag Version", + ) - parser.add_argument('--chip-id', - dest='chip_id', - action='store', - type=auto_int, - help='WFI Chip ID') + parser.add_argument( + "--chip-id", + dest="chip_id", + action="store", + type=auto_int, + help="WFI Chip ID", + ) - parser.add_argument('--flash-type', - dest='flash_type', - action='store', - type=auto_int, - help='WFI Flash Type') + parser.add_argument( + "--flash-type", + dest="flash_type", + action="store", + type=auto_int, + help="WFI Flash Type", + ) - parser.add_argument('--flags', - dest='flags', - action='store', - type=auto_int, - help='WFI Flags') + parser.add_argument( + "--flags", dest="flags", action="store", type=auto_int, help="WFI Flags" + ) - args = parser.parse_args() + args = parser.parse_args() - if not args.flags: - args.flags = 0 + if not args.flags: + args.flags = 0 + + if ( + (not args.input_file) + or (not args.output_file) + or (not args.tag_version) + or (not args.chip_id) + or (not args.flash_type) + ): + parser.print_help() + else: + create_output(args) - if ((not args.input_file) or - (not args.output_file) or - (not args.tag_version) or - (not args.chip_id) or - (not args.flash_type)): - parser.print_help() - else: - create_output(args) main() From a4bf562aa71ad1e3dcffa392b79110d803a93f11 Mon Sep 17 00:00:00 2001 From: Tamas Balogh Date: Fri, 15 Apr 2022 11:11:01 +0200 Subject: [PATCH 20/26] ramips: add support for ASUS RT-AC1200-V2 Hardware specifications: SoC: MT7628DAN MIPS_24KEc@580MHz 2.4G-n 2x2 WiFi: MT7613BEN 5G-ac 160MHz 2x2 Switch: 4x100M built-in SoC Flash: 16MB W25Q128JVSQ SPI-NOR DRAM: 64MB built-in SoC MAC addresses as verified by OEM firmware: use address source Lan/Wan/2G *:60 factory 0x4 (label) 5G *:64 factory 0x8000 Serial console: 57600,8n1 Installation: Asus windows recovery tool: install the Asus firmware restoration utility unplug the router, hold the reset button while powering it on release when the power LED flashes slowly specify a static IP on your computer: IP address: 192.168.1.75 Subnet mask 255.255.255.0 start the Asus firmware restoration utility, specify the factory image and press upload do NOT power off the device after OpenWrt has booted until the LED flashing after flashing OpenWrt, there will be first no 5GHz Wifi available probably, wait until blinking finishes and do a reboot TFTP Recovery method: set computer to a static ip, 192.168.1.75 connect computer to the LAN 1 port of the router hold the reset button while powering on the router for a few seconds send firmware image using a tftp client; i.e from linux: $ tftp tftp> binary tftp> connect 192.168.1.1 tftp> put factory.bin tftp> quit do NOT power off the device after OpenWrt has booted until the LED flashing after flashing OpenWrt, there will be first no 5GHz Wifi available probably, wait until blinking finishes and do a reboot Signed-off-by: Tamas Balogh --- .../ramips/dts/mt7628an_asus_rt-ac1200-v2.dts | 32 ++++ .../ramips/dts/mt7628an_asus_rt-ac1200.dts | 131 +---------------- .../ramips/dts/mt7628an_asus_rt-ac1200.dtsi | 138 ++++++++++++++++++ target/linux/ramips/image/mt76x8.mk | 13 ++ .../mt76x8/base-files/etc/board.d/02_network | 5 +- 5 files changed, 188 insertions(+), 131 deletions(-) create mode 100644 target/linux/ramips/dts/mt7628an_asus_rt-ac1200-v2.dts create mode 100644 target/linux/ramips/dts/mt7628an_asus_rt-ac1200.dtsi diff --git a/target/linux/ramips/dts/mt7628an_asus_rt-ac1200-v2.dts b/target/linux/ramips/dts/mt7628an_asus_rt-ac1200-v2.dts new file mode 100644 index 0000000000..2dd38fba4b --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_asus_rt-ac1200-v2.dts @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7628an_asus_rt-ac1200.dtsi" + +/ { + compatible = "asus,rt-ac1200-v2", "mediatek,mt7628an-soc"; + model = "ASUS RT-AC1200 V2"; +}; + +&state_default { + spis { + groups = "spis"; + function = "spis"; + }; + + gpio { + groups = "refclk", "i2c", "wled_an"; + function = "gpio"; + }; +}; + +&usbphy { + status = "disabled"; +}; + +&ehci { + status = "disabled"; +}; + +&ohci { + status = "disabled"; +}; diff --git a/target/linux/ramips/dts/mt7628an_asus_rt-ac1200.dts b/target/linux/ramips/dts/mt7628an_asus_rt-ac1200.dts index dbb8302b85..abb86456da 100644 --- a/target/linux/ramips/dts/mt7628an_asus_rt-ac1200.dts +++ b/target/linux/ramips/dts/mt7628an_asus_rt-ac1200.dts @@ -2,52 +2,15 @@ // Copyright (c) 2022 Ray Wang // Copyright (c) 2022 Ivan Pavlov -#include "mt7628an.dtsi" - -#include -#include +#include "mt7628an_asus_rt-ac1200.dtsi" / { compatible = "asus,rt-ac1200", "mediatek,mt7628an-soc"; model = "Asus RT-AC1200"; - aliases { - led-boot = &led_power; - led-failsafe = &led_power; - led-running = &led_power; - led-upgrade = &led_power; - }; - - keys { - compatible = "gpio-keys"; - - reset { - label = "reset"; - gpios = <&gpio 5 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - wps { - label = "wps"; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - leds { compatible = "gpio-leds"; - led_power: power { - label = "blue:power"; - gpios = <&gpio 37 GPIO_ACTIVE_LOW>; - }; - - wlan2g { - label = "blue:wlan2g"; - gpios = <&gpio 44 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy0tpt"; - }; - usb { label = "blue:usb"; gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; @@ -55,98 +18,6 @@ linux,default-trigger = "usbport"; }; }; - - gpio-export { - compatible = "gpio-export"; - #size-cells = <0>; - - led-all { - gpio-export,name = "led_all"; - gpio-export,output = <0>; - gpios = <&gpio 4 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 = "bootloader"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "nvram"; - reg = <0x30000 0x10000>; - read-only; - }; - - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_factory_28: macaddr@28 { - reg = <0x28 0x6>; - }; - }; - - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x50000 0xfb0000>; - }; - }; - }; -}; - -ðernet { - nvmem-cells = <&macaddr_factory_28>; - nvmem-cell-names = "mac-address"; -}; - -&esw { - mediatek,portmap = <0x3e>; -}; - -&wmac { - status = "okay"; - - mediatek,mtd-eeprom = <&factory 0x0>; -}; - -&pcie { - status = "okay"; -}; - -&pcie0 { - wifi@0,0 { - compatible = "mediatek,mt76"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - - led { - led-sources = <2>; - led-active-low; - }; - }; }; &state_default { diff --git a/target/linux/ramips/dts/mt7628an_asus_rt-ac1200.dtsi b/target/linux/ramips/dts/mt7628an_asus_rt-ac1200.dtsi new file mode 100644 index 0000000000..d8d4245447 --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_asus_rt-ac1200.dtsi @@ -0,0 +1,138 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7628an.dtsi" + +#include +#include + +/ { + aliases { + led-boot = &led_wps; + led-failsafe = &led_wps; + led-running = &led_wps; + led-upgrade = &led_wps; + label-mac-device = ðernet; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_wps: wps { + label = "blue:wps"; + gpios = <&gpio 37 GPIO_ACTIVE_LOW>; + }; + + wlan2g { + label = "blue:wlan2g"; + gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <58000000>; + m25p,fast-read; + + 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-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; + }; + }; +}; + +&gpio { + enable-leds { + gpio-hog; + line-name = "enable-leds"; + output-low; + gpios = <4 GPIO_ACTIVE_HIGH>; + }; +}; + +ðernet { + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&wmac { + status = "okay"; + + mediatek,mtd-eeprom = <&factory 0x0>; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + mt76@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + + led { + led-sources = <2>; + led-active-low; + }; + }; +}; diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index bd91bd9340..81b68f6354 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -47,6 +47,19 @@ define Device/asus_rt-ac1200 endef TARGET_DEVICES += asus_rt-ac1200 +define Device/asus_rt-ac1200-v2 + BLOCKSIZE := 64k + IMAGE_SIZE := 16064k + DEVICE_VENDOR := Asus + DEVICE_MODEL := RT-AC1200 + DEVICE_VARIANT := V2 + IMAGES += factory.bin + IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \ + append-rootfs | pad-rootfs + DEVICE_PACKAGES := kmod-mt7615e kmod-mt7663-firmware-ap +endef +TARGET_DEVICES += asus_rt-ac1200-v2 + define Device/asus_rt-n10p-v3 IMAGE_SIZE := 7872k DEVICE_VENDOR := Asus 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 1f833c1820..408f5f5e01 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 @@ -35,6 +35,7 @@ ramips_setup_interfaces() ucidef_set_interface_lan "eth0" ;; asus,rt-ac1200|\ + asus,rt-ac1200-v2|\ hilink,hlk-7628n|\ hilink,hlk-7688a|\ hiwifi,hc5861b|\ @@ -178,7 +179,9 @@ ramips_setup_macs() local label_mac="" case $board in - asus,rt-ac1200|\ + asus,rt-ac1200) + wan_mac=$(mtd_get_mac_binary factory 0x22) + ;; elecom,wrc-1167fs) wan_mac=$(mtd_get_mac_binary factory 0x22) label_mac=$wan_mac From fb3f519e59653ead7ed02a3254e6f2f9ecfc8030 Mon Sep 17 00:00:00 2001 From: Russell Morris Date: Fri, 8 Apr 2022 13:29:13 -0500 Subject: [PATCH 21/26] ramips: mt7621: make u_env partition r/w for Linksys EA7xxx devices Make u_env partition read/write - currently cannot write to it, which blocks fw_setenv. This in turn breaks features like Advanced Reboot, which rely on setting the environment variable boot_part (1 or 2). Signed-off-by: Russell Morris --- target/linux/ramips/dts/mt7621_linksys_ea7xxx.dtsi | 1 - 1 file changed, 1 deletion(-) diff --git a/target/linux/ramips/dts/mt7621_linksys_ea7xxx.dtsi b/target/linux/ramips/dts/mt7621_linksys_ea7xxx.dtsi index ec232968a6..5e9c82507d 100644 --- a/target/linux/ramips/dts/mt7621_linksys_ea7xxx.dtsi +++ b/target/linux/ramips/dts/mt7621_linksys_ea7xxx.dtsi @@ -95,7 +95,6 @@ partition@80000 { label = "u_env"; reg = <0x80000 0x40000>; - read-only; }; factory: partition@c0000 { From c2140e32ce32b9cc60f7d408e20bdf45dce6a634 Mon Sep 17 00:00:00 2001 From: Ryan Mounce Date: Sat, 10 Apr 2021 12:26:49 +0930 Subject: [PATCH 22/26] ath79: add support for MikroTik RouterBOARD 962UiGS-5HacT2HnT (hAP ac) This patch adds support for the MikroTik RouterBOARD 962UiGS-5HacT2HnT (hAP ac) Specifications: - SoC: QCA9558 - RAM: 128 MB - Flash: 16 MB SPI - 2.4GHz WLAN: 3x3:3 802.11n on SoC - 5GHz WLAN: 3x3:3 802.11ac on QCA9880 connected via PCIe - Switch: 5x 1000/100/10 on QCA8337 connected via RGMII - SFP cage: connected via SGMII (tested with genuine & generic GLC-T) - USB: 1x type A, GPIO power switch - PoE: Passive input on Ether1, GPIO switched passthrough to Ether5 - Reset button - "SFP" LED connected to SoC - Ethernet LEDs connected to QCA8337 switch - Green WLAN LED connected to QCA9880 Not working: - Red WLAN LED Installation: TFTP boot initramfs image and then perform sysupgrade. Follow common MikroTik procedure as in https://openwrt.org/toh/mikrotik/common. Signed-off-by: Ryan Mounce --- ...mikrotik_routerboard-962uigs-5hact2hnt.dts | 37 ++++ .../dts/qca9558_mikrotik_routerboard-96x.dtsi | 198 ++++++++++++++++++ target/linux/ath79/image/mikrotik.mk | 11 + .../base-files/etc/board.d/02_network | 4 + .../etc/hotplug.d/firmware/10-ath9k-eeprom | 3 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 1 + 6 files changed, 254 insertions(+) create mode 100644 target/linux/ath79/dts/qca9558_mikrotik_routerboard-962uigs-5hact2hnt.dts create mode 100644 target/linux/ath79/dts/qca9558_mikrotik_routerboard-96x.dtsi diff --git a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-962uigs-5hact2hnt.dts b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-962uigs-5hact2hnt.dts new file mode 100644 index 0000000000..f3fc31af14 --- /dev/null +++ b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-962uigs-5hact2hnt.dts @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9558_mikrotik_routerboard-96x.dtsi" + +/ { + compatible = "mikrotik,routerboard-962uigs-5hact2hnt", "qca,qca9558"; + model = "MikroTik RouterBOARD 962UiGS-5HacT2HnT (hAP ac)"; + + gpio-export { + compatible = "gpio-export"; + + port5_poe { + gpio-export,name = "port5-poe"; + gpio-export,output = <1>; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&gpio { + input-poe-out-compat { + gpio-hog; + gpios = <2 GPIO_ACTIVE_HIGH>; + input; + line-name = "PoE out compat"; + }; +}; + +&wmac { + status = "okay"; + + qca,no-eeprom; +}; + +&pcie1 { + status = "okay"; +}; diff --git a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-96x.dtsi b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-96x.dtsi new file mode 100644 index 0000000000..e1de96e40c --- /dev/null +++ b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-96x.dtsi @@ -0,0 +1,198 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca955x.dtsi" + +#include +#include + +/ { + aliases { + led-boot = &led_user; + led-failsafe = &led_user; + led-upgrade = &led_user; + serial0 = &uart; + }; + + leds { + compatible = "gpio-leds"; + + led_user: user { + label = "green:user"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 20 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + gpio-export { + compatible = "gpio-export"; + + buzzer { + /* Beeper requires PWM for frequency selection */ + gpio-export,name = "buzzer"; + gpio-export,output = <0>; + gpios = <&gpio 4 GPIO_ACTIVE_HIGH>; + }; + + usb_power { + gpio-export,name = "usb-power"; + gpio-export,output = <0>; + gpios = <&gpio 13 GPIO_ACTIVE_HIGH>; + }; + }; + + i2c: i2c { + compatible = "i2c-gpio"; + + sda-gpios = <&gpio 18 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; + scl-gpios = <&gpio 19 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; + i2c-gpio,delay-us = <5>; + i2c-gpio,timeout-ms = <1>; + }; + + sfp1: sfp { + compatible = "sff,sfp"; + + i2c-bus = <&i2c>; + maximum-power-milliwatt = <1000>; + los-gpios = <&gpio 21 GPIO_ACTIVE_HIGH>; + mod-def0-gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + tx-disable-gpios = <&gpio 16 GPIO_ACTIVE_HIGH>; + // Toggling GPIO16 actually enables/disables the transmitter, + // but the SFP driver does not seem to be using it. + }; +}; + +&spi { + 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 = "RouterBoot"; + reg = <0x0 0x20000>; + read-only; + compatible = "mikrotik,routerboot-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bootloader1"; + reg = <0x0 0x0>; + read-only; + }; + + hard_config { + read-only; + }; + + bios { + size = <0x1000>; + read-only; + }; + + partition@10000 { + label = "bootloader2"; + reg = <0x10000 0x0>; + read-only; + }; + + soft_config { + }; + }; + + partition@20000 { + compatible = "mikrotik,minor"; + label = "firmware"; + reg = <0x020000 0xfe0000>; + }; + }; + }; +}; + +&mdio0 { + status = "okay"; + + phy0: ethernet-phy@0 { + reg = <0>; + + qca,ar8327-initvals = < + /* PAD0_MODE from vendor firmware + * RGMII_EN, TX/RXCLK_DELAY_EN, TXCLK_DELAY_SEL=1 + */ + 0x04 0x07400000 /* PAD0_MODE */ + 0x50 0xc737c737 /* LED_CTRL0 */ + 0x54 0x00000000 /* LED_CTRL1 */ + 0x58 0x00000000 /* LED_CTRL2 */ + 0x5c 0x0030c300 /* LED_CTRL3 */ + 0x7c 0x0000007e /* PORT0_STATUS */ + >; + }; +}; + +ð0 { + status = "okay"; + + phy-handle = <&phy0>; + /* gigabit pll-data from vendor firmware + * TX_INVERT, TX_DELAY=3, GIGE, OFFSET_PHASE + */ + pll-data = <0x8f000000 0x00000101 0x00001616>; + + gmac-config { + device = <&gmac>; + rgmii-enabled = <1>; + }; +}; + +&mdio1 { + status = "okay"; + + phy_sfp: ethernet-phy@0 { + reg = <0>; + phy-mode = "sgmii"; + sfp = <&sfp1>; + }; +}; + +ð1 { + status = "okay"; + + phy-handle = <&phy_sfp>; + pll-data = <0x03000000 0x00000101 0x00001616>; + qca955x-sgmii-fixup; + + gmac-config { + device = <&gmac>; + }; + + fixed-link { + speed = <1000>; + full-duplex; + }; +}; + +&usb0 { + status = "okay"; +}; + +&usb_phy0 { + status = "okay"; +}; diff --git a/target/linux/ath79/image/mikrotik.mk b/target/linux/ath79/image/mikrotik.mk index dccb05e45a..13aec3949a 100644 --- a/target/linux/ath79/image/mikrotik.mk +++ b/target/linux/ath79/image/mikrotik.mk @@ -38,6 +38,17 @@ define Device/mikrotik_routerboard-922uags-5hpacd endef TARGET_DEVICES += mikrotik_routerboard-922uags-5hpacd +define Device/mikrotik_routerboard-962uigs-5hact2hnt + $(Device/mikrotik_nor) + SOC := qca9558 + DEVICE_MODEL := RouterBOARD 962UiGS-5HacT2HnT (hAP ac) + DEVICE_PACKAGES += kmod-ath10k-ct ath10k-firmware-qca988x-ct kmod-usb2 \ + kmod-i2c-gpio kmod-sfp + IMAGE_SIZE := 16256k + SUPPORTED_DEVICES += rb-962uigs-5hact2hnt +endef +TARGET_DEVICES += mikrotik_routerboard-962uigs-5hact2hnt + define Device/mikrotik_routerboard-lhg-2nd $(Device/mikrotik_nor) SOC := qca9533 diff --git a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network index cc4121f93e..04bedfb569 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network +++ b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network @@ -23,6 +23,10 @@ ath79_setup_interfaces() mikrotik,routerboard-wapr-2nd) ucidef_set_interface_lan "eth0" ;; + mikrotik,routerboard-962uigs-5hact2hnt) + ucidef_add_switch "switch0" \ + "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" + ;; *) ucidef_set_interfaces_lan_wan "eth0" "eth1" ;; diff --git a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index 8b1b5f04dd..4701460cb6 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -34,6 +34,9 @@ case "$FIRMWARE" in mikrotik,routerboard-wap-g-5hact2hnd) caldata_mikrotik_ath9k 0x1000 0x440 $(macaddr_add "$mac_base" 2) ;; + mikrotik,routerboard-962uigs-5hact2hnt) + caldata_mikrotik_ath9k 0x1000 0x440 $(macaddr_add "$mac_base" 7) + ;; *) caldata_die "board $board is not supported yet" ;; diff --git a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 31d4eeedbc..77cd47f6a0 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -12,6 +12,7 @@ case "$FIRMWARE" in "ath10k/cal-pci-0000:00:00.0.bin") case $board in mikrotik,routerboard-921gs-5hpacd-15s|\ + mikrotik,routerboard-962uigs-5hact2hnt|\ mikrotik,routerboard-wap-g-5hact2hnd) caldata_sysfsload_from_file $wlan_data 0x5000 0x844 ;; From 6f1efb28983758116a8ecaf9c93e1d875bb70af7 Mon Sep 17 00:00:00 2001 From: Andrew Powers-Holmes Date: Fri, 3 Sep 2021 23:53:57 +1000 Subject: [PATCH 23/26] ath79: add support for Sophos AP100/AP55 family The Sophos AP100, AP100C, AP55, and AP55C are dual-band 802.11ac access points based on the Qualcomm QCA9558 SoC. They share PCB designs with several devices that already have partial or full support, most notably the Devolo DVL1750i/e. The AP100 and AP100C are hardware-identical to the AP55 and AP55C, however the 55 models' ART does not contain calibration data for their third chain despite it being present on the PCB. Specifications common to all models: - Qualcomm QCA9558 SoC @ 720 MHz (MIPS 74Kc Big-endian processor) - 128 MB RAM - 16 MB SPI flash - 1x 10/100/1000 Mbps Ethernet port, 802.3af PoE-in - Green and Red status LEDs sharing a single external light-pipe - Reset button on PCB[1] - Piezo beeper on PCB[2] - Serial UART header on PCB - Alternate power supply via 5.5x2.1mm DC jack @ 12 VDC Unique to AP100 and AP100C: - 3T3R 2.4GHz 802.11b/g/n via SoC WMAC - 3T3R 5.8GHz 802.11a/n/ac via QCA9880 (PCI Express) AP55 and AP55C: - 2T2R 2.4GHz 802.11b/g/n via SoC WMAC - 2T2R 5.8GHz 802.11a/n/ac via QCA9880 (PCI Express) AP100 and AP55: - External RJ45 serial console port[3] - USB 2.0 Type A port, power controlled via GPIO 11 Flashing instructions: This firmware can be flashed either via a compatible Sophos SG or XG firewall appliance, which does not require disassembling the device, or via the U-Boot console available on the internal UART header. To flash via XG appliance: - Register on Sophos' website for a no-cost Home Use XG firewall license - Download and install the XG software on a compatible PC or virtual machine, complete initial appliance setup, and enable SSH console access - Connect the target AP device to the XG appliance's LAN interface - Approve the AP from the XG Web UI and wait until it shows as Active (this can take 3-5 minutes) - Connect to the XG appliance over SSH and access the Advanced Console (Menu option 5, then menu option 3) - Run `sudo awetool` and select the menu option to connect to an AP via SSH. When prompted to enable SSH on the target AP, select Yes. - Wait 2-3 minutes, then select the AP from the awetool menu again. This will connect you to a root shell on the target AP. - Copy the firmware to /tmp/openwrt.bin on the target AP via SCP/TFTP/etc - Run `mtd -r write /tmp/openwrt.bin astaro_image` - When complete, the access point will reboot to OpenWRT. To flash via U-Boot serial console: - Configure a TFTP server on your PC, and set IP address 192.168.99.8 with netmask 255.255.255.0 - Copy the firmware .bin to the TFTP server and rename to 'uImage_AP100C' - Open the target AP's enclosure and locate the 4-pin 3.3V UART header [4] - Connect the AP ethernet to your PC's ethernet port - Connect a terminal to the UART at 115200 8/N/1 as usual - Power on the AP and press a key to cancel autoboot when prompted - Run the following commands at the U-Boot console: - `tftpboot` - `cp.b $fileaddr 0x9f070000 $filesize` - `boot` - The access point will boot to OpenWRT. MAC addresses as verified by OEM firmware: use address source LAN label config 0x201a (label) 2g label + 1 art 0x1002 (also found at config 0x2004) 5g label + 9 art 0x5006 Increments confirmed across three AP55C, two AP55, and one AP100C. These changes have been tested to function on both current master and 21.02.0 without any obvious issues. [1] Button is present but does not alter state of any GPIO on SoC [2] Buzzer and driver circuitry is present on PCB but is not connected to any GPIO. Shorting an unpopulated resistor next to the driver circuitry should connect the buzzer to GPIO 4, but this is unconfirmed. [3] This external RJ45 serial port is disabled in the OEM firmware, but works in OpenWRT without additional configuration, at least on my three test units. [4] On AP100/AP55 models the UART header is accessible after removing the device's top cover. On AP100C/AP55C models, the PCB must be removed for access; three screws secure it to the case. Pin 1 is marked on the silkscreen. Pins from 1-4 are 3.3V, GND, TX, RX Signed-off-by: Andrew Powers-Holmes --- package/boot/uboot-envtools/files/ath79 | 6 + target/linux/ath79/dts/qca9558_sophos_ap.dtsi | 179 ++++++++++++++++++ .../linux/ath79/dts/qca9558_sophos_ap100.dts | 21 ++ .../linux/ath79/dts/qca9558_sophos_ap100c.dts | 8 + .../linux/ath79/dts/qca9558_sophos_ap55.dts | 21 ++ .../linux/ath79/dts/qca9558_sophos_ap55c.dts | 8 + .../generic/base-files/etc/board.d/02_network | 4 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 4 + target/linux/ath79/image/generic.mk | 36 ++++ 9 files changed, 287 insertions(+) create mode 100644 target/linux/ath79/dts/qca9558_sophos_ap.dtsi create mode 100644 target/linux/ath79/dts/qca9558_sophos_ap100.dts create mode 100644 target/linux/ath79/dts/qca9558_sophos_ap100c.dts create mode 100644 target/linux/ath79/dts/qca9558_sophos_ap55.dts create mode 100644 target/linux/ath79/dts/qca9558_sophos_ap55c.dts diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79 index c69a7c292c..98aa426c6b 100644 --- a/package/boot/uboot-envtools/files/ath79 +++ b/package/boot/uboot-envtools/files/ath79 @@ -125,6 +125,12 @@ plasmacloud,pa300e) qihoo,c301) ubootenv_add_uci_config "/dev/mtd9" "0x0" "0x10000" "0x10000" ;; +sophos,ap55|\ +sophos,ap55c|\ +sophos,ap100|\ +sophos,ap100c) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x10000" + ;; wallys,dr531) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0xf800" "0x10000" ;; diff --git a/target/linux/ath79/dts/qca9558_sophos_ap.dtsi b/target/linux/ath79/dts/qca9558_sophos_ap.dtsi new file mode 100644 index 0000000000..5c79d19de0 --- /dev/null +++ b/target/linux/ath79/dts/qca9558_sophos_ap.dtsi @@ -0,0 +1,179 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/* + * The hardware of this board family is most likely shared with other devices + * from other manufacturers. Edimax appear to be the actual OEM. + * + * Sophos use the same exact board for the AP55C/AP100C, and AP55/AP100. + * Yes, this means your AP55C is a 3x3 AP with a software lock, and your + * AP55 is an AP100 with one missing antenna pigtail. + * + * AP55 and AP55C boards have different physical layouts, but are logically + * almost identical. AP55/100 have an empty micro-USB OTG port footprint, + * which may be possible to retrofit with some work. + */ + +#include "qca955x.dtsi" + +#include +#include + +/ { + aliases { + led-boot = &led_status_green; + led-failsafe = &led_status_red; + led-running = &led_status_green; + led-upgrade = &led_status_red; + label-mac-device = ð0; + }; + + chosen { + bootargs = "console=ttyS0,115200n8"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_green: status_green { + label = "green:status"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + led_status_red: status_red { + label = "red:status"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + }; + + reg_usb_vbus: reg_usb_vbus { + compatible = "regulator-fixed"; + regulator-name = "usb_vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio 11 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-boot-on; + status = "disabled"; + }; +}; + +&pcie0 { + status = "okay"; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x000000 0x040000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x040000 0x010000>; + }; + + art: partition@50000 { + label = "art"; + reg = <0x050000 0x010000>; + read-only; + }; + + config: partition@60000 { + label = "config"; + reg = <0x060000 0x010000>; + read-only; + }; + + partition@70000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x070000 0xf90000>; + }; + }; + }; +}; + +&mdio0 { + status = "okay"; + + phy-mask = <0x10>; + + phy4: ethernet-phy@4 { + reg = <4>; + eee-broken-100tx; + eee-broken-1000t; + }; +}; + +ð0 { + status = "okay"; + + pll-data = <0xa6000000 0xa0000101 0xa0001313>; + + nvmem-cells = <&macaddr_config_201a>; + nvmem-cell-names = "mac-address"; + + phy-mode = "rgmii-id"; + phy-handle = <&phy4>; + + gmac_config: gmac-config { + device = <&gmac>; + + rgmii-enabled = <1>; + + rxdv-delay = <3>; + rxd-delay = <3>; + txen-delay = <3>; + txd-delay = <3>; + }; +}; + +&wmac { + status = "okay"; + + mtd-cal-data = <&art 0x1000>; +}; + +&config { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_config_201a: macaddr@201a { + reg = <0x201a 0x6>; + }; +}; + +&usb0 { + vbus-supply = <®_usb_vbus>; + + hub_port0: port@1 { + reg = <1>; + #trigger-source-cells = <0>; + }; +}; diff --git a/target/linux/ath79/dts/qca9558_sophos_ap100.dts b/target/linux/ath79/dts/qca9558_sophos_ap100.dts new file mode 100644 index 0000000000..50ed5fbfba --- /dev/null +++ b/target/linux/ath79/dts/qca9558_sophos_ap100.dts @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9558_sophos_ap.dtsi" + +/ { + compatible = "sophos,ap100", "qca,qca9558"; + model = "Sophos AP100"; +}; + +®_usb_vbus { + status = "okay"; +}; + +&usb_phy0 { + status = "okay"; +}; + +&usb0 { + status = "okay"; + dr_mode = "host"; +}; diff --git a/target/linux/ath79/dts/qca9558_sophos_ap100c.dts b/target/linux/ath79/dts/qca9558_sophos_ap100c.dts new file mode 100644 index 0000000000..1811b9e0a4 --- /dev/null +++ b/target/linux/ath79/dts/qca9558_sophos_ap100c.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9558_sophos_ap.dtsi" + +/ { + compatible = "sophos,ap100c", "qca,qca9558"; + model = "Sophos AP100C"; +}; diff --git a/target/linux/ath79/dts/qca9558_sophos_ap55.dts b/target/linux/ath79/dts/qca9558_sophos_ap55.dts new file mode 100644 index 0000000000..9a3fd61c93 --- /dev/null +++ b/target/linux/ath79/dts/qca9558_sophos_ap55.dts @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9558_sophos_ap.dtsi" + +/ { + compatible = "sophos,ap55", "qca,qca9558"; + model = "Sophos AP55"; +}; + +®_usb_vbus { + status = "okay"; +}; + +&usb_phy0 { + status = "okay"; +}; + +&usb0 { + status = "okay"; + dr_mode = "host"; +}; diff --git a/target/linux/ath79/dts/qca9558_sophos_ap55c.dts b/target/linux/ath79/dts/qca9558_sophos_ap55c.dts new file mode 100644 index 0000000000..bd88d8ac12 --- /dev/null +++ b/target/linux/ath79/dts/qca9558_sophos_ap55c.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9558_sophos_ap.dtsi" + +/ { + compatible = "sophos,ap55c", "qca,qca9558"; + model = "Sophos AP55C"; +}; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 8f6063baef..a6427efe2b 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -63,6 +63,10 @@ ath79_setup_interfaces() pisen,wmb001n|\ pisen,wmm003n|\ siemens,ws-ap3610|\ + sophos,ap55|\ + sophos,ap55c|\ + sophos,ap100|\ + sophos,ap100c|\ tplink,cpe210-v2|\ tplink,cpe210-v3|\ tplink,cpe510-v2|\ diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 17121d9618..00aa34f0a8 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -29,6 +29,10 @@ case "$FIRMWARE" in qxwlan,e1700ac-v2-16m|\ qxwlan,e600gac-v2-8m|\ qxwlan,e600gac-v2-16m|\ + sophos,ap55|\ + sophos,ap55c|\ + sophos,ap100|\ + sophos,ap100c|\ ubnt,aircube-ac|\ ubnt,bullet-ac|\ ubnt,unifiac-lite|\ diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 80a581a72c..edf6b7ee5e 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -2366,6 +2366,42 @@ define Device/sitecom_wlr-8100 endef TARGET_DEVICES += sitecom_wlr-8100 +define Device/sophos_ap55 + SOC := qca9558 + DEVICE_VENDOR := Sophos + DEVICE_MODEL := AP55 + DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct kmod-usb2 + IMAGE_SIZE := 15936k +endef +TARGET_DEVICES += sophos_ap55 + +define Device/sophos_ap55c + SOC := qca9558 + DEVICE_VENDOR := Sophos + DEVICE_MODEL := AP55C + DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct + IMAGE_SIZE := 15936k +endef +TARGET_DEVICES += sophos_ap55c + +define Device/sophos_ap100 + SOC := qca9558 + DEVICE_VENDOR := Sophos + DEVICE_MODEL := AP100 + DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct kmod-usb2 + IMAGE_SIZE := 15936k +endef +TARGET_DEVICES += sophos_ap100 + +define Device/sophos_ap100c + SOC := qca9558 + DEVICE_VENDOR := Sophos + DEVICE_MODEL := AP100C + DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct + IMAGE_SIZE := 15936k +endef +TARGET_DEVICES += sophos_ap100c + define Device/telco_t1 SOC := qca9531 DEVICE_VENDOR := Telco From eee41e33eca2f860724bceda3f36ea2e30149ef0 Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Wed, 9 Jun 2021 23:22:50 +0800 Subject: [PATCH 24/26] ipq806x: Askey RT4230W REV6: enable onboard spi flash There is a mr25h256 spi flash on this machine. From the mtd backup of the stock firmware, this spi flash is empty. [ 3.652745] spi_qup 1a280000.spi: IN:block:16, fifo:64, OUT:block:16, fifo:64 [ 3.653925] spi-nor spi0.0: mr25h256 (32 Kbytes) Signed-off-by: Chukun Pan --- .../boot/dts/qcom-ipq8065-rt4230w-rev6.dts | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-rt4230w-rev6.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-rt4230w-rev6.dts index a15dee6aca..b07e7320a7 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-rt4230w-rev6.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-rt4230w-rev6.dts @@ -96,6 +96,35 @@ input-disable; }; }; + + spi_pins: spi_pins { + cs { + pins = "gpio20"; + drive-strength = <12>; + }; + }; +}; + +&gsbi5 { + qcom,mode = ; + status = "okay"; + + spi@1a280000 { + status = "okay"; + + pinctrl-0 = <&spi_pins>; + pinctrl-names = "default"; + + cs-gpios = <&qcom_pinmux 20 GPIO_ACTIVE_HIGH>; + + flash@0 { + compatible = "everspin,mr25h256"; + #address-cells = <1>; + #size-cells = <1>; + spi-max-frequency = <40000000>; + reg = <0>; + }; + }; }; &nand { From 45b3111b992377f0298e52e8787b1a730440b3bd Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Thu, 10 Feb 2022 21:26:40 +0800 Subject: [PATCH 25/26] ipq806x: RT4230W: utilize nvmem-cells for ath10k caldata Converts extraction entries from 11-ath10k-caldata into nvmem-cells in the individual board's device-tree file. Same as commit 2047058 ("ipq806x: utilize nvmem-cells for pre-calibration data") Signed-off-by: Chukun Pan Reviewed-by: Ansuel Smith --- .../etc/hotplug.d/firmware/11-ath10k-caldata | 6 -- .../boot/dts/qcom-ipq8065-rt4230w-rev6.dts | 77 ++++++++++++++++--- 2 files changed, 66 insertions(+), 17 deletions(-) diff --git a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 4a474766d5..398ddf9a29 100644 --- a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -17,9 +17,6 @@ case "$FIRMWARE" in ;; "ath10k/pre-cal-pci-0000:01:00.0.bin") case $board in - askey,rt4230w-rev6) - caldata_extract "0:ART" 0x1000 0x2f20 - ;; asrock,g10) caldata_extract "0:art" 0x1000 0x2f20 ;; @@ -40,9 +37,6 @@ case "$FIRMWARE" in ;; "ath10k/pre-cal-pci-0001:01:00.0.bin") case $board in - askey,rt4230w-rev6) - caldata_extract "0:ART" 0x5000 0x2f20 - ;; asrock,g10) caldata_extract "0:art" 0x5000 0x2f20 ;; diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-rt4230w-rev6.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-rt4230w-rev6.dts index b07e7320a7..96163331f3 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-rt4230w-rev6.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-rt4230w-rev6.dts @@ -151,100 +151,139 @@ reg = <0x0000000 0x0040000>; read-only; }; + partition@40000 { label = "0:MIBIB"; reg = <0x0040000 0x0140000>; read-only; }; + partition@180000 { label = "0:SBL2"; reg = <0x0180000 0x0140000>; read-only; }; + partition@2c0000 { label = "0:SBL3"; reg = <0x02c0000 0x0280000>; read-only; }; + partition@540000 { label = "0:DDRCONFIG"; reg = <0x0540000 0x0120000>; read-only; }; + partition@660000 { label = "0:SSD"; reg = <0x0660000 0x0120000>; read-only; }; + partition@780000 { label = "0:TZ"; reg = <0x0780000 0x0280000>; read-only; }; + partition@a00000 { label = "0:RPM"; reg = <0x0a00000 0x0280000>; read-only; }; + partition@c80000 { label = "0:APPSBL"; reg = <0x0c80000 0x0500000>; read-only; }; + partition@1180000 { label = "0:APPSBLENV"; reg = <0x1180000 0x0080000>; }; - ART: partition@1200000 { + + partition@1200000 { label = "0:ART"; reg = <0x1200000 0x0140000>; read-only; + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_ART_0: macaddr@0 { + reg = <0x0 0x6>; + }; + + macaddr_ART_6: macaddr@6 { + reg = <0x6 0x6>; + }; + + precal_ART_1000: precal@1000 { + reg = <0x1000 0x2f20>; + }; + + precal_ART_5000: precal@5000 { + reg = <0x5000 0x2f20>; + }; }; + partition@1340000 { label = "0:BOOTCONFIG"; reg = <0x1340000 0x0060000>; read-only; }; + partition@13a0000 { label = "0:SBL2_1"; reg = <0x13a0000 0x0140000>; read-only; }; + partition@14e0000 { label = "0:SBL3_1"; reg = <0x14e0000 0x0280000>; read-only; }; + partition@1760000 { label = "0:DDRCONFIG_1"; reg = <0x1760000 0x0120000>; read-only; }; + partition@1880000 { label = "0:SSD_1"; reg = <0x1880000 0x0120000>; read-only; }; + partition@19a0000 { label = "0:TZ_1"; reg = <0x19a0000 0x0280000>; read-only; }; + partition@1c20000 { label = "0:RPM_1"; reg = <0x1c20000 0x0280000>; read-only; }; + partition@1ea0000 { label = "0:BOOTCONFIG1"; reg = <0x1ea0000 0x0060000>; read-only; }; + partition@1f00000 { label = "0:APPSBL_1"; reg = <0x1f00000 0x0500000>; read-only; }; + partition@2400000 { label = "ubi"; reg = <0x2400000 0x1a000000>; @@ -323,6 +362,21 @@ reset-gpio = <&qcom_pinmux 3 GPIO_ACTIVE_HIGH>; pinctrl-0 = <&pcie0_pins>; pinctrl-names = "default"; + + bridge@0,0 { + reg = <0x00000000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + ranges; + + wifi0: wifi@1,0 { + compatible = "pci168c,0046"; + reg = <0x00010000 0 0 0 0>; + + nvmem-cells = <&precal_ART_1000>; + nvmem-cell-names = "pre-calibration"; + }; + }; }; &pcie1 { @@ -331,18 +385,19 @@ pinctrl-0 = <&pcie1_pins>; pinctrl-names = "default"; max-link-speed = <1>; -}; -&ART { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; + bridge@0,0 { + reg = <0x00000000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + ranges; - macaddr_ART_0: macaddr@0 { - reg = <0x0 0x6>; - }; + wifi1: wifi@1,0 { + compatible = "pci168c,0046"; + reg = <0x00010000 0 0 0 0>; - macaddr_ART_6: macaddr@6 { - reg = <0x6 0x6>; + nvmem-cells = <&precal_ART_5000>; + nvmem-cell-names = "pre-calibration"; + }; }; }; From a5ac8ad0ba9df50bdd0dda1dc26cf36f83006893 Mon Sep 17 00:00:00 2001 From: Martin Kennedy Date: Sat, 5 Mar 2022 14:02:36 -0500 Subject: [PATCH 26/26] realtek: add ZyXEL GS1900-24HP v1 support The ZyXEL GS1900-24HP v1 is a 24 port PoE switch with two SFP ports, similar to the other GS1900 switches. Specifications -------------- * Device: ZyXEL GS1900-24HP v1 * SoC: Realtek RTL8382M 500 MHz MIPS 4KEc * Flash: 16 MiB * RAM: Winbond W9751G8KB-25 64 MiB DDR2 SDRAM * Ethernet: 24x 10/100/1000 Mbps, 2x SFP 100/1000 Mbps * LEDs: * 1 PWR LED (green, not configurable) * 1 SYS LED (green, configurable) * 24 ethernet port link/activity LEDs (green, SoC controlled) * 24 ethernet port PoE status LEDs * 2 SFP status/activity LEDs (green, SoC controlled) * Buttons: * 1 "RESET" button on front panel (soft reset) * 1 button ('SW1') behind right hex grate (hardwired power-off) * PoE: * Management MCU: ST Micro ST32F100 Microcontroller * 6 BCM59111 PSE chips * 170W power budget * Power: 120-240V AC C13 * UART: Internal populated 10-pin header ('J5') providing RS232; connected to SoC UART through a TI or SIPEX 3232C for voltage level shifting. * 'J5' RS232 Pinout (dot as pin 1): 2) SoC RXD 3) GND 10) SoC TXD Serial connection parameters: 115200 8N1. Installation ------------ OEM upgrade method: * Log in to OEM management web interface * Navigate to Maintenance > Firmware > Management * If "Active Image" has the first option selected, OpenWrt will need to be flashed to the "Active" partition. If the second option is selected, OpenWrt will need to be flashed to the "Backup" partition. * Navigate to Maintenance > Firmware > Upload * Upload the openwrt-realtek-rtl838x-zyxel_gs1900-24hp-v1-initramfs-kernel.bin file by your preferred method to the previously determined partition. When prompted, select to boot from the newly flashed image, and reboot the switch. * Once OpenWrt has booted, scp the sysupgrade image to /tmp and flash it: > sysupgrade /tmp/openwrt-realtek-rtl838x-zyxel_gs1900-24hp-v1-squashfs-sysupgrade.bin U-Boot TFTP method: * Configure your client with a static 192.168.1.x IP (e.g. 192.168.1.10). * Set up a TFTP server on your client and make it serve the initramfs image. * Connect serial, power up the switch, interrupt U-boot by hitting the space bar, and enable the network: > rtk network on * Since the GS1900-24HP v1 is a dual-partition device, you want to keep the OEM firmware on the backup partition for the time being. OpenWrt can only be installed in the first partition anyway (hardcoded in the DTS). To ensure we are set to boot from the first partition, issue the following commands: > setsys bootpartition 0 > savesys * Download the image onto the device and boot from it: > tftpboot 0x81f00000 192.168.1.10:openwrt-realtek-rtl838x-zyxel_gs1900-24hp-v1-initramfs-kernel.bin > bootm * Once OpenWrt has booted, scp the sysupgrade image to /tmp and flash it: > sysupgrade /tmp/openwrt-realtek-rtl838x-zyxel_gs1900-24hp-v1-squashfs-sysupgrade.bin Signed-off-by: Martin Kennedy [Add info on PoE hardware to commit message] Signed-off-by: Sander Vanheule --- package/boot/uboot-envtools/files/realtek | 1 + .../realtek/base-files/etc/board.d/02_network | 1 + .../dts-5.10/rtl8382_zyxel_gs1900-24hp-v1.dts | 125 ++++++++++++++++++ target/linux/realtek/image/rtl838x.mk | 9 ++ 4 files changed, 136 insertions(+) create mode 100644 target/linux/realtek/dts-5.10/rtl8382_zyxel_gs1900-24hp-v1.dts diff --git a/package/boot/uboot-envtools/files/realtek b/package/boot/uboot-envtools/files/realtek index 9836462a92..c07175a357 100644 --- a/package/boot/uboot-envtools/files/realtek +++ b/package/boot/uboot-envtools/files/realtek @@ -16,6 +16,7 @@ zyxel,gs1900-8hp-v1|\ zyxel,gs1900-8hp-v2|\ zyxel,gs1900-10hp|\ zyxel,gs1900-24-v1|\ +zyxel,gs1900-24hp-v1|\ zyxel,gs1900-24hp-v2) idx="$(find_mtd_index u-boot-env)" [ -n "$idx" ] && \ 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 e8e3f6035d..af9db848dd 100644 --- a/target/linux/realtek/base-files/etc/board.d/02_network +++ b/target/linux/realtek/base-files/etc/board.d/02_network @@ -57,6 +57,7 @@ zyxel,gs1900-8hp-v1|\ zyxel,gs1900-8hp-v2) ucidef_set_poe 70 "$lan_list" ;; +zyxel,gs1900-24hp-v1|\ zyxel,gs1900-24hp-v2) ucidef_set_poe 170 "$lan_list" ;; diff --git a/target/linux/realtek/dts-5.10/rtl8382_zyxel_gs1900-24hp-v1.dts b/target/linux/realtek/dts-5.10/rtl8382_zyxel_gs1900-24hp-v1.dts new file mode 100644 index 0000000000..7bb3410a31 --- /dev/null +++ b/target/linux/realtek/dts-5.10/rtl8382_zyxel_gs1900-24hp-v1.dts @@ -0,0 +1,125 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "rtl8380_zyxel_gs1900.dtsi" + +/ { + compatible = "zyxel,gs1900-24hp-v1", "realtek,rtl838x-soc"; + model = "ZyXEL GS1900-24HP v1"; + + memory@0 { + reg = <0x0 0x4000000>; + }; + + /* i2c of the left SFP cage: port 25 */ + i2c0: i2c-gpio-0 { + compatible = "i2c-gpio"; + sda-gpios = <&gpio1 24 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + scl-gpios = <&gpio1 25 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + i2c-gpio,delay-us = <2>; + #address-cells = <1>; + #size-cells = <0>; + }; + + sfp0: sfp-p25 { + compatible = "sff,sfp"; + i2c-bus = <&i2c0>; + los-gpio = <&gpio1 27 GPIO_ACTIVE_HIGH>; + tx-fault-gpio = <&gpio1 22 GPIO_ACTIVE_HIGH>; + mod-def0-gpio = <&gpio1 26 GPIO_ACTIVE_LOW>; + tx-disable-gpio = <&gpio1 23 GPIO_ACTIVE_HIGH>; + }; + + /* i2c of the right SFP cage: port 26 */ + i2c1: i2c-gpio-1 { + compatible = "i2c-gpio"; + sda-gpios = <&gpio1 30 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + scl-gpios = <&gpio1 31 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + i2c-gpio,delay-us = <2>; + #address-cells = <1>; + #size-cells = <0>; + }; + + sfp1: sfp-p26 { + compatible = "sff,sfp"; + i2c-bus = <&i2c1>; + los-gpio = <&gpio1 33 GPIO_ACTIVE_HIGH>; + tx-fault-gpio = <&gpio1 28 GPIO_ACTIVE_HIGH>; + mod-def0-gpio = <&gpio1 32 GPIO_ACTIVE_LOW>; + tx-disable-gpio = <&gpio1 29 GPIO_ACTIVE_HIGH>; + }; +}; + +&uart1 { + status = "okay"; +}; + +&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) + + EXTERNAL_PHY(16) + EXTERNAL_PHY(17) + EXTERNAL_PHY(18) + EXTERNAL_PHY(19) + EXTERNAL_PHY(20) + EXTERNAL_PHY(21) + EXTERNAL_PHY(22) + EXTERNAL_PHY(23) + + INTERNAL_PHY(24) + INTERNAL_PHY(26) +}; + +&switch0 { + ports { + 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) + + port@24 { + reg = <24>; + label = "lan25"; + phy-mode = "1000base-x"; + managed = "in-band-status"; + sfp = <&sfp0>; + }; + + port@26 { + reg = <26>; + label = "lan26"; + phy-mode = "1000base-x"; + managed = "in-band-status"; + sfp = <&sfp1>; + }; + }; +}; + diff --git a/target/linux/realtek/image/rtl838x.mk b/target/linux/realtek/image/rtl838x.mk index 9688dd93de..29e7ff2695 100644 --- a/target/linux/realtek/image/rtl838x.mk +++ b/target/linux/realtek/image/rtl838x.mk @@ -145,6 +145,15 @@ define Device/zyxel_gs1900-24-v1 endef TARGET_DEVICES += zyxel_gs1900-24-v1 +define Device/zyxel_gs1900-24hp-v1 + $(Device/zyxel_gs1900) + SOC := rtl8382 + DEVICE_MODEL := GS1900-24HP + DEVICE_VARIANT := v1 + ZYXEL_VERS := AAHM +endef +TARGET_DEVICES += zyxel_gs1900-24hp-v1 + define Device/zyxel_gs1900-24hp-v2 $(Device/zyxel_gs1900) SOC := rtl8382