From c46b689149ac18d654d12dfddeb102feb938e4aa Mon Sep 17 00:00:00 2001 From: Roger Pueyo Centelles Date: Wed, 2 Jun 2021 18:45:30 +0200 Subject: [PATCH 1/5] ath79: add support for MikroTik RouterBOARD 750 r2 (hEX lite) This patch adds support for the MikroTik RouterBOARD 750 r2, marketed as hEX lite, a small indoor router with 5x 10/100 Mbps Ethernet ports, one with PoE in. The device was already supported by the ar71xx target. Specifications: - SoC: Qualcomm Atheros QCA9533 - Flash: 16 MB SPI NOR - RAM: 64 MB - Ethernet: 4x 10/100 Mbps LAN, 1x 10/100 Mbps WAN (PoE in) - LEDs: 5x Ethernet port activity (green), 1x user (green) - Buttons: 1x reset See https://mikrotik.com/product/RB750r2 for more details. Not working: - Serial port (already not working in ar71xx) Flashing: TFTP boot initramfs image and then perform sysupgrade. Only the "Internet" port will ask for an initramfs image. Follow common MikroTik procedure as in https://openwrt.org/toh/mikrotik/common. (cherry picked from commit 8486c677b8bf36808c5b94857f60ee0fb3d5fa28) Signed-off-by: Roger Pueyo Centelles Link: https://github.com/openwrt/openwrt/pull/13477 Signed-off-by: Hauke Mehrtens --- .../dts/qca9533_mikrotik_routerboard-16m.dtsi | 6 -- .../qca9533_mikrotik_routerboard-750-r2.dts | 78 +++++++++++++++++++ .../dts/qca9533_mikrotik_routerboard-95x.dtsi | 6 ++ .../qca9533_mikrotik_routerboard-lhg-hb.dtsi | 6 ++ .../qca9533_mikrotik_routerboard-map-2nd.dts | 6 ++ .../qca9533_mikrotik_routerboard-mapl-2nd.dts | 6 ++ .../qca9533_mikrotik_routerboard-wap-2nd.dts | 6 ++ .../qca9533_mikrotik_routerboard-wapr-2nd.dts | 6 ++ target/linux/ath79/image/mikrotik.mk | 9 +++ .../mikrotik/base-files/etc/board.d/01_leds | 1 + .../base-files/etc/board.d/02_network | 5 ++ 11 files changed, 129 insertions(+), 6 deletions(-) create mode 100644 target/linux/ath79/dts/qca9533_mikrotik_routerboard-750-r2.dts diff --git a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-16m.dtsi b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-16m.dtsi index e9bd05487c63d2..c112b9a193f3cb 100644 --- a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-16m.dtsi +++ b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-16m.dtsi @@ -75,9 +75,3 @@ }; }; }; - -&wmac { - status = "okay"; - - qca,no-eeprom; -}; diff --git a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-750-r2.dts b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-750-r2.dts new file mode 100644 index 00000000000000..b8fa9f2a7020c6 --- /dev/null +++ b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-750-r2.dts @@ -0,0 +1,78 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9533_mikrotik_routerboard-16m.dtsi" + +/ { + compatible = "mikrotik,routerboard-750-r2", "qca,qca9533"; + model = "MikroTik RouterBOARD 750 r2 (hEX lite)"; + + aliases { + led-boot = &led_usr; + led-failsafe = &led_usr; + led-upgrade = &led_usr; + led-running = &led_usr; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + + led_usr: usr { + label = "green:usr"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + led1 { + label = "green:port1"; + gpios = <&ssr 0 GPIO_ACTIVE_LOW>; + }; + + led2 { + label = "green:port2"; + gpios = <&ssr 1 GPIO_ACTIVE_LOW>; + }; + + led3 { + label = "green:port3"; + gpios = <&ssr 2 GPIO_ACTIVE_LOW>; + }; + + led4 { + label = "green:port4"; + gpios = <&ssr 3 GPIO_ACTIVE_LOW>; + }; + + led5 { + label = "green:port5"; + gpios = <&ssr 4 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&pinmux { + pmx_spi_cs1: pinmux_spi_cs1 { + pinctrl-single,bits = <0x8 0x0a000000 0xff000000>; + }; +}; + +&spi { + pinctrl-names = "default"; + pinctrl-0 = <&pmx_spi_cs1>; + + cs-gpios = <0>, <&gpio 11 GPIO_ACTIVE_LOW>; + + ssr: ssr@1 { + compatible = "fairchild,74hc595"; + gpio-controller; + #gpio-cells = <2>; + registers-number = <1>; + reg = <1>; + spi-max-frequency = <10000000>; + }; +}; + +ð0 { + status = "okay"; + + phy-handle = <&swphy4>; +}; diff --git a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-95x.dtsi b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-95x.dtsi index 79c9f44d328012..4f6503f9eac4e6 100644 --- a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-95x.dtsi +++ b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-95x.dtsi @@ -83,6 +83,12 @@ }; }; +&wmac { + status = "okay"; + + qca,no-eeprom; +}; + ð0 { status = "okay"; diff --git a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-lhg-hb.dtsi b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-lhg-hb.dtsi index a45365073be65c..aa5c57b27891d6 100644 --- a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-lhg-hb.dtsi +++ b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-lhg-hb.dtsi @@ -66,6 +66,12 @@ }; }; +&wmac { + status = "okay"; + + qca,no-eeprom; +}; + ð0 { status = "okay"; diff --git a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-map-2nd.dts b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-map-2nd.dts index 25971e6f4321c3..062c3bd061a617 100644 --- a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-map-2nd.dts +++ b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-map-2nd.dts @@ -93,6 +93,12 @@ }; }; +&wmac { + status = "okay"; + + qca,no-eeprom; +}; + ð0 { status = "okay"; diff --git a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-mapl-2nd.dts b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-mapl-2nd.dts index e2442f00950cf7..e337bcc70db878 100644 --- a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-mapl-2nd.dts +++ b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-mapl-2nd.dts @@ -42,6 +42,12 @@ }; }; +&wmac { + status = "okay"; + + qca,no-eeprom; +}; + ð0 { status = "okay"; diff --git a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-wap-2nd.dts b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-wap-2nd.dts index 807941c6081a50..d4d049920c7f3d 100644 --- a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-wap-2nd.dts +++ b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-wap-2nd.dts @@ -36,6 +36,12 @@ }; }; +&wmac { + status = "okay"; + + qca,no-eeprom; +}; + ð0 { status = "okay"; diff --git a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-wapr-2nd.dts b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-wapr-2nd.dts index 49756f3336de29..19ada708d99083 100644 --- a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-wapr-2nd.dts +++ b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-wapr-2nd.dts @@ -50,6 +50,12 @@ }; }; +&wmac { + status = "okay"; + + qca,no-eeprom; +}; + ð0 { status = "okay"; diff --git a/target/linux/ath79/image/mikrotik.mk b/target/linux/ath79/image/mikrotik.mk index 683e9a33304dc0..d26420c7f54c4b 100644 --- a/target/linux/ath79/image/mikrotik.mk +++ b/target/linux/ath79/image/mikrotik.mk @@ -9,6 +9,15 @@ define Device/mikrotik_routerboard-493g endef TARGET_DEVICES += mikrotik_routerboard-493g +define Device/mikrotik_routerboard-750-r2 + $(Device/mikrotik_nor) + SOC := qca9533 + DEVICE_MODEL := RouterBOARD 750 r2 (hEX lite) + IMAGE_SIZE := 16256k + SUPPORTED_DEVICES += rb-750-r2 +endef +TARGET_DEVICES += mikrotik_routerboard-750-r2 + define Device/mikrotik_routerboard-911-lite $(Device/mikrotik_nor) SOC := ar9344 diff --git a/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds b/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds index 31346ebdf581bf..66fa2ee6acdf8a 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds @@ -16,6 +16,7 @@ mikrotik,routerboard-lhg-5nd) ucidef_set_led_rssi "rssimediumhigh" "rssimediumhigh" "green:rssimediumhigh" "wlan0" "60" "100" ucidef_set_led_rssi "rssihigh" "rssihigh" "green:rssihigh" "wlan0" "80" "100" ;; +mikrotik,routerboard-750-r2|\ mikrotik,routerboard-951ui-2hnd|\ mikrotik,routerboard-951ui-2nd|\ mikrotik,routerboard-952ui-5ac2nd) 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 68c8cfb96e7534..d45af6dbb39b42 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 @@ -14,6 +14,11 @@ ath79_setup_interfaces() ucidef_add_switch "switch1" \ "0@eth1" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3" ;; + mikrotik,routerboard-750-r2) + ucidef_set_interface_wan "eth1" + ucidef_add_switch "switch0" \ + "0@eth0" "1:lan:4" "2:lan:1" "3:lan:3" "4:lan:2" + ;; mikrotik,routerboard-911-lite|\ mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-lhg-2nd|\ From 9bc6a18edec1d162c65171518c81a733f5672eec Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 25 Oct 2024 15:39:30 -0700 Subject: [PATCH 2/5] ramips: m4r v4: fix typo It should be debounce-interval, as with the others. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16802 Signed-off-by: Robert Marko --- target/linux/ramips/dts/mt7621_tplink_deco-m4r-v4.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ramips/dts/mt7621_tplink_deco-m4r-v4.dts b/target/linux/ramips/dts/mt7621_tplink_deco-m4r-v4.dts index 3d17dbf599cdcb..ab9678af6b4adc 100644 --- a/target/linux/ramips/dts/mt7621_tplink_deco-m4r-v4.dts +++ b/target/linux/ramips/dts/mt7621_tplink_deco-m4r-v4.dts @@ -34,7 +34,7 @@ led { label = "led"; gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - debounce_interval = <60>; + debounce-interval = <60>; linux,code = ; }; From 92c2a4cf932d6f77509639bd6a4db1c11f64e97b Mon Sep 17 00:00:00 2001 From: Rafal Boni Date: Thu, 24 Oct 2024 03:06:22 -0400 Subject: [PATCH 3/5] ipq806x: Revert "ipq806x: swap lan leds for Meraki MR52" This reverts commit ec8f647d168fa8f3b1eedd9b5fe665f793f3a659, as with the current kernel version, the change actually causes the same bug it once may have fixed -- that is, the leds are now again reversed. I suspect this was due to a switch to a newer kernel version between when the patch was submitted and now reversing the order of the interfaces, so that eth0 / the LAN interface is also the interface used for PoE, and eth1 / the WAN interface is the non-PoE interface. Signed-off-by: Rafal Boni Link: https://github.com/openwrt/openwrt/pull/16779 (cherry picked from commit b5e1544f4d45795ab8750b1054c54c8880b7b96b) Signed-off-by: Rafal Boni Link: https://github.com/openwrt/openwrt/pull/16822 Signed-off-by: Robert Marko --- .../files-5.15/arch/arm/boot/dts/qcom-ipq8068-mr52.dts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8068-mr52.dts b/target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8068-mr52.dts index b49ea499d659ef..695c5411ba02e9 100644 --- a/target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8068-mr52.dts +++ b/target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8068-mr52.dts @@ -46,12 +46,12 @@ lan1_green { label = "green:lan1"; - gpios = <&qcom_pinmux 23 GPIO_ACTIVE_HIGH>; + gpios = <&qcom_pinmux 24 GPIO_ACTIVE_HIGH>; }; lan2_green { label = "green:lan2"; - gpios = <&qcom_pinmux 24 GPIO_ACTIVE_HIGH>; + gpios = <&qcom_pinmux 23 GPIO_ACTIVE_HIGH>; }; led_active: active { @@ -61,12 +61,12 @@ lan1_orange { label = "orange:lan1"; - gpios = <&qcom_pinmux 60 GPIO_ACTIVE_HIGH>; + gpios = <&qcom_pinmux 62 GPIO_ACTIVE_HIGH>; }; lan2_orange { label = "orange:lan2"; - gpios = <&qcom_pinmux 62 GPIO_ACTIVE_HIGH>; + gpios = <&qcom_pinmux 60 GPIO_ACTIVE_HIGH>; }; }; }; From 607091d4fed9b459afdb4ed140c374e5cec535b3 Mon Sep 17 00:00:00 2001 From: Rafal Boni Date: Thu, 24 Oct 2024 11:40:53 -0400 Subject: [PATCH 4/5] ipq806x: Fix default MAC addresses on MR52 by moving to `nvmem-layout` Partial, single-target update extracted from https://github.com/openwrt/openwrt/commit/d264d3a6 The previous `mac-address-increment` is deprecated, and in particular on this target means that the kernel is unable to read the MAC address, causing the system to boot with a new random MAC address each time. Fixes: https://github.com/openwrt/openwrt/issues/15238 Signed-off-by: Rosen Penev [rafal.boni@gmail.com: single-target-specific backport from larger change] Signed-off-by: Rafal Boni Link: https://github.com/openwrt/openwrt/pull/16774 Signed-off-by: Robert Marko --- .../arch/arm/boot/dts/qcom-ipq8068-mr52.dts | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8068-mr52.dts b/target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8068-mr52.dts index 695c5411ba02e9..8bb932c6e4a84f 100644 --- a/target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8068-mr52.dts +++ b/target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8068-mr52.dts @@ -80,7 +80,7 @@ phy-mode = "sgmii"; phy-handle = <&phy0>; - nvmem-cells = <&mac_address>; + nvmem-cells = <&mac_address 0>; nvmem-cell-names = "mac-address"; }; @@ -93,9 +93,8 @@ phy-mode = "sgmii"; phy-handle = <&phy4>; - nvmem-cells = <&mac_address>; + nvmem-cells = <&mac_address 1>; nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; }; &gsbi7 { @@ -142,11 +141,17 @@ pagesize = <32>; reg = <0x52>; read-only; - #address-cells = <1>; - #size-cells = <1>; - mac_address: mac-address@66 { - reg = <0x66 0x6>; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + mac_address: mac-address@66 { + compatible = "mac-base"; + reg = <0x66 0x6>; + #nvmem-cell-cells = <1>; + }; }; }; }; @@ -212,21 +217,18 @@ }; &wifi0 { - nvmem-cells = <&mac_address>; + nvmem-cells = <&mac_address 4>; nvmem-cell-names = "mac-address"; - mac-address-increment = <4>; }; &wifi1 { - nvmem-cells = <&mac_address>; + nvmem-cells = <&mac_address 3>; nvmem-cell-names = "mac-address"; - mac-address-increment = <3>; }; &wifi2 { - nvmem-cells = <&mac_address>; + nvmem-cells = <&mac_address 2>; nvmem-cell-names = "mac-address"; - mac-address-increment = <2>; }; &hs_phy_0 { From 4f0e2817758df7a5e8b4ce1588ec87c7be0b3a21 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Thu, 24 Oct 2024 20:51:00 +0200 Subject: [PATCH 5/5] ath79: Really fix 5GHz on QCA9886 variant of ZTE MF286 Fix in commit 25eead21c5ab ("ath79: fix 5GHz on QCA9886 variant of ZTE MF286") was incomplete. A user of such variant popped up, and in the boot log after installation, we discovered that QCA9886 expects different pre-calibration data size, than the older QCA9880 variant: ath10k_pci 0000:00:00.0: qca9888 hw2.0 target 0x01000000 chip_id 0x00000000 sub 0000:0000 ath10k_pci 0000:00:00.0: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 0 ath10k_pci 0000:00:00.0: firmware ver 10.4b-ct-9888-fW-13-5ae337bb1 api 5 features mfp,peer-flow-ctrl,txstatus-noack,wmi-10.x-CT,ratemask-CT,regdump-CT,txrate-CT,flush-all-CT,pingpong-CT,ch-regs-CT,nop-CT,set-special-CT,tx-rc-CT,cust-stats-CT,txrate2-CT,beacon-cb-CT,wmi-block-ack-CT,wmi-bcn-rc-CT crc32 59e741e7 ath10k_pci 0000:00:00.0: invalid calibration data length in nvmem-cell 'pre-calibration': 2116 != 12064 ath10k_pci 0000:00:00.0: Loading BDF type 0 ath10k_pci 0000:00:00.0: failed to fetch board data for bus=pci,vendor=168c,device=0056,subsystem-vendor=0000,subsystem-device=0000 from ath10k/QCA9888/hw2.0/board-2.bin ath10k_pci 0000:00:00.0: failed to fetch board-2.bin or board.bin from ath10k/QCA9888/hw2.0 ath10k_pci 0000:00:00.0: failed to fetch board file: -12 ath10k_pci 0000:00:00.0: could not probe fw (-12) Explicitly define a pre-calibration nvmem-cell for this variant, and use it instead of the calibration one, which is shorter. Fixes: 25eead21c5ab ("ath79: fix 5GHz on QCA9886 variant of ZTE MF286") Signed-off-by: Lech Perczak (cherry picked from commit fc236f3b3c54953805173e5ab571f794eb5ff398) Link: https://github.com/openwrt/openwrt/pull/16810 Signed-off-by: Hauke Mehrtens --- target/linux/ath79/dts/qca9563_zte_mf286.dts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/target/linux/ath79/dts/qca9563_zte_mf286.dts b/target/linux/ath79/dts/qca9563_zte_mf286.dts index 877075c7699780..3a691dbc1c5ebe 100644 --- a/target/linux/ath79/dts/qca9563_zte_mf286.dts +++ b/target/linux/ath79/dts/qca9563_zte_mf286.dts @@ -66,13 +66,20 @@ #address-cells = <1>; #size-cells = <1>; + /* ath9k */ cal_caldata_1000: cal@1000 { reg = <0x1000 0x440>; }; + /* ath10k wave1 in plain MF286 */ cal_caldata_5000: cal@5000 { reg = <0x5000 0x844>; }; + + /* ath10k wave2 in early MF286A */ + precal_caldata_5000: precal@5000 { + reg = <0x5000 0x2f20>; + }; }; partition@280000 { @@ -119,7 +126,7 @@ }; &wifi_ath10k { - nvmem-cells = <&macaddr_mac_0>, <&cal_caldata_5000>, <&cal_caldata_5000>; + nvmem-cells = <&macaddr_mac_0>, <&cal_caldata_5000>, <&precal_caldata_5000>; nvmem-cell-names = "mac-address", "calibration", "pre-calibration"; mac-address-increment = <1>; };