Hi Bas, thanks for the suggestion. I agree that such a consolidation could make sense, given how closely related the WR1300 hardware revisions are.
However, I only have access to a WR1300 v4 unit. Since such a refactor would also touch the existing v1 to v3 support, I would not feel confident preparing it without being able to test those revisions afterwards and verify that their current functionality remains unchanged. I also have rather limited experience with larger DTS refactors of existing device support, so I preferred to keep this initial patch focused on adding the v4 support while following the current upstream structure with the existing shared v2/v3 .dtsi. If someone with access to the older revisions would like to pursue that cleanup, I would of course be happy to help with the v4-specific details. Best regards. Ășt 12. 5. 2026 v 22:59 odesĂlatel Bas Mevissen <[email protected]> napsal: > > On Tue, 2026-05-12 at 15:37 +0200, Jan Brudna wrote: > > Cudy WR1300 v4 is a MT7621 based dual-band router. > > > > Hardware: > > - SoC: MediaTek MT7621 > > - RAM: 128 MiB > > - Flash: 16 MiB SPI NOR > > - WiFi 2.4 GHz: MediaTek MT7603E > > - WiFi 5 GHz: MediaTek MT7663E > > - Ethernet: 5x 10/100/1000 Mbps > > - Buttons: Reset, WPS > > - LEDs: System, Internet, WAN, LAN1-4, WiFi 2.4 GHz, WiFi 5 GHz > > > > The v4 hardware differs from v3 in GPIO assignments for LEDs and > > buttons. WiFi LEDs are connected to MT7621 GPIO5/GPIO6 and require > > the uart3 pin group to be muxed as GPIO. > > > > All HW versions are quite similar. Wouldn't it make sense to write a > single .dtsi file with all variations in #ifdef ... #endif? > > Then you simply write: > > wr1300_v1.dts: > #define WR1300_V1 > #include "wr1300.dtsi" > > (and so on). > > > > Tested on retail Cudy WR1300 v4: > > - sysupgrade image boots > > - WAN and LAN1-4 > > - 2.4 GHz and 5 GHz WiFi > > - Reset and WPS button events > > - System, Internet, WAN, LAN1-4 and WiFi LEDs > > > > Signed-off-by: Jan Brudna <[email protected]> > > --- > > .../ramips/dts/mt7621_cudy_wr1300-v4.dts | 111 ++++++++++++++++++ > > target/linux/ramips/image/mt7621.mk | 12 ++ > > .../mt7621/base-files/etc/board.d/01_leds | 9 ++ > > 3 files changed, 132 insertions(+) > > create mode 100644 target/linux/ramips/dts/mt7621_cudy_wr1300-v4.dts > > > > diff --git a/target/linux/ramips/dts/mt7621_cudy_wr1300-v4.dts > > b/target/linux/ramips/dts/mt7621_cudy_wr1300-v4.dts > > new file mode 100644 > > index 0000000000..0f16d5142d > > --- /dev/null > > +++ b/target/linux/ramips/dts/mt7621_cudy_wr1300-v4.dts > > @@ -0,0 +1,111 @@ > > +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT > > + > > +#include "mt7621_cudy_wr1300-v2v3.dtsi" > > (as alternative) wouldn't it be better to rename this file to > mt7621_cudy_wr1300-v2v3v4.dtsi (or ...v2-v4...) or even better just > mt7621_cudy_wr1300-common.dtsi? > > > + > > +/ { > > + compatible = "cudy,wr1300-v4", "mediatek,mt7621-soc"; > > + model = "Cudy WR1300 v4"; > > + > > + /delete-node/ leds; > > + /delete-node/ keys; > > + > > + aliases { > > + led-boot = &led_sys; > > + led-failsafe = &led_sys; > > + led-running = &led_sys; > > + led-upgrade = &led_sys; > > + label-mac-device = &gmac0; > > + }; > > + > > + keys { > > + compatible = "gpio-keys"; > > + > > + wps { > > + label = "wps"; > > + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; > > + linux,code = <KEY_WPS_BUTTON>; > > + }; > > + > > + reset { > > + label = "reset"; > > + gpios = <&gpio 10 GPIO_ACTIVE_LOW>; > > + linux,code = <KEY_RESTART>; > > + }; > > + }; > > + > > + leds { > > + compatible = "gpio-leds"; > > + > > + led_sys: sys { > > + label = "green:sys"; > > + gpios = <&gpio 18 GPIO_ACTIVE_HIGH>; > > + }; > > + > > + internet { > > + label = "green:internet"; > > + gpios = <&gpio 9 GPIO_ACTIVE_HIGH>; > > + }; > > + > > + lan4 { > > + label = "green:lan4"; > > + gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; > > + }; > > + > > + lan3 { > > + label = "green:lan3"; > > + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; > > + }; > > + > > + lan2 { > > + label = "green:lan2"; > > + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; > > + }; > > + > > + lan1 { > > + label = "green:lan1"; > > + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; > > + }; > > + > > + wan { > > + label = "green:wan"; > > + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; > > + }; > > + > > + wlan2g { > > + label = "green:wlan2g"; > > + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; > > + }; > > + > > + wlan5g { > > + label = "green:wlan5g"; > > + gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; > > + }; > > + }; > > +}; > > + > > +&pcie0 { > > + wifi@0,0 { > > + compatible = "mediatek,mt76"; > > + reg = <0x0000 0 0 0 0>; > > + nvmem-cells = <&eeprom_factory_0>, <&macaddr_bdinfo_de00 0>; > > + nvmem-cell-names = "eeprom", "mac-address"; > > + ieee80211-freq-limit = <2400000 2500000>; > > + }; > > +}; > > + > > +&pcie1 { > > + wifi@0,0 { > > + compatible = "mediatek,mt76"; > > + reg = <0x0000 0 0 0 0>; > > + nvmem-cells = <&eeprom_factory_8000>, <&macaddr_bdinfo_de00 > > 2>; > > + nvmem-cell-names = "eeprom", "mac-address"; > > + ieee80211-freq-limit = <5000000 6000000>; > > + }; > > +}; > > + > > +&state_default { > > + gpio { > > + groups = "wdt", "i2c", "jtag", "uart3"; > > + function = "gpio"; > > + }; > > +}; > > diff --git a/target/linux/ramips/image/mt7621.mk > > b/target/linux/ramips/image/mt7621.mk > > index cd595e72c4..76e2d6b43a 100644 > > --- a/target/linux/ramips/image/mt7621.mk > > +++ b/target/linux/ramips/image/mt7621.mk > > @@ -821,6 +821,18 @@ define Device/cudy_wr1300-v3 > > endef > > TARGET_DEVICES += cudy_wr1300-v3 > > > > +define Device/cudy_wr1300-v4 > > + $(Device/dsa-migration) > > + IMAGE_SIZE := 15872k > > + DEVICE_VENDOR := Cudy > > + DEVICE_MODEL := WR1300 > > + DEVICE_VARIANT := v4 > > + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap \ > > + -uboot-envtools > > + SUPPORTED_DEVICES += cudy,wr1300 R30 > > +endef > > +TARGET_DEVICES += cudy_wr1300-v4 > > + > > define Device/cudy_wr2100 > > $(Device/dsa-migration) > > DEVICE_VENDOR := Cudy > > diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds > > b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds > > index eb4de3e03d..efede4b59e 100644 > > --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds > > +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds > > @@ -7,6 +7,15 @@ board=$(board_name) > > board_config_update > > > > case $board in > > +cudy,wr1300-v4) > > + ucidef_set_led_netdev "wan" "WAN" "green:wan" "wan" "link tx rx" > > + ucidef_set_led_netdev "lan1" "LAN1" "green:lan1" "lan1" "link tx rx" > > + ucidef_set_led_netdev "lan2" "LAN2" "green:lan2" "lan2" "link tx rx" > > + ucidef_set_led_netdev "lan3" "LAN3" "green:lan3" "lan3" "link tx rx" > > + ucidef_set_led_netdev "lan4" "LAN4" "green:lan4" "lan4" "link tx rx" > > + ucidef_set_led_wlan "wlan2g" "WiFi 2.4GHz" "green:wlan2g" "phy0tpt" > > + ucidef_set_led_wlan "wlan5g" "WiFi 5GHz" "green:wlan5g" "phy1tpt" > > + ;; > > alfa-network,ax1800rm) > > ucidef_set_led_netdev "lan1" "lan1" "green:lan1" "lan1" > > ucidef_set_led_netdev "lan2" "lan2" "green:lan2" "lan2" _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
