aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorDavid Bauer <mail@david-bauer.net>2023-05-17 15:55:42 +0200
committerDavid Bauer <mail@david-bauer.net>2023-05-18 01:46:13 +0200
commitc9cb6411c1a70516d5922e88c45b338de041baba (patch)
tree5e2b3ef51adcf9c631123c462ffae6ea33a6ad56 /target
parent3d7830d902e00ea6f713fff7b385a53fb01d614f (diff)
downloadupstream-c9cb6411c1a70516d5922e88c45b338de041baba.tar.gz
upstream-c9cb6411c1a70516d5922e88c45b338de041baba.tar.bz2
upstream-c9cb6411c1a70516d5922e88c45b338de041baba.zip
mediatek: add support for Cudy WR3000 v1
Hardware -------- MediaTek MT7981 WiSoC 256MB DDR3 RAM 16MB SPI-NOR (XMC XM25QH128C) MediaTek MT7981 2x2 DBDC 802.11ax 2T2R (2.4 / 5) UART: 115200 8N1 3.3V [LEDS] VCC-GND-RX-TX [ETH] Header is located below the heatsink Case ---- Unscrew the 4 bottom screws. Remove the top of the case by inserting a small screwdriver into the ventilation holes and lift the top cover. This works best by beginning near the ETH-ports. The top is clipped on the front near the LEDs with two plastic clips. The back has a single clip in the middle. Start at one of the back edges. MAC-Addresses ------------- 80:AF:CA:00:F9:C6 LAN 80:AF:CA:00:F9:C7 WAN 80:AF:CA:00:F9:C6 W2 82:AF:CA:30:F9:C6 W5 Installation ------------ 1. Connect to the serial port as described in the "Hardware" section. 2. Power on the device. Keep pressing the "0" key to enter the U-Boot shell. 3. Download the OpenWrt initramfs image. Place it on an TFTP server connected to the Cudy LAN ports. Make sure the server is reachable at 192.168.1.2. Rename the image to "cudy3000.bin" 4. Download and boot the OpenWrt initramfs image. $ tftpboot 0x46000000 cudy3000.bin; bootm 0x46000000 5. Transfer the OpenWrt sysupgrade image to the device using scp. Install with sysupgrade. Note: Cudy does not yet provide a image for disabling their signature-protection. This has happened in the past. Make sure to check the wiki for a possible easier installation method. Signed-off-by: David Bauer <mail@david-bauer.net>
Diffstat (limited to 'target')
-rw-r--r--target/linux/mediatek/dts/mt7981b-cudy-wr3000-v1.dts282
-rw-r--r--target/linux/mediatek/filogic/base-files/etc/board.d/01_leds3
-rw-r--r--target/linux/mediatek/filogic/base-files/etc/board.d/02_network3
-rw-r--r--target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac8
-rwxr-xr-xtarget/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh3
-rw-r--r--target/linux/mediatek/image/filogic.mk19
6 files changed, 318 insertions, 0 deletions
diff --git a/target/linux/mediatek/dts/mt7981b-cudy-wr3000-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-wr3000-v1.dts
new file mode 100644
index 0000000000..7c8a94d97c
--- /dev/null
+++ b/target/linux/mediatek/dts/mt7981b-cudy-wr3000-v1.dts
@@ -0,0 +1,282 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+
+/dts-v1/;
+
+#include "mt7981.dtsi"
+
+/ {
+ model = "Cudy WR3000 v1";
+ compatible = "cudy,wr3000-v1", "mediatek,mt7981";
+
+ aliases {
+ ethernet0 = &gmac0;
+ label-mac-device = &lan1;
+ led-boot = &led_status;
+ led-failsafe = &led_status;
+ led-running = &led_status;
+ led-upgrade = &led_status;
+ serial0 = &uart0;
+ };
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+
+ gpio-keys {
+ compatible = "gpio-keys";
+
+ reset {
+ label = "reset";
+ linux,code = <KEY_RESTART>;
+ gpios = <&pio 1 GPIO_ACTIVE_LOW>;
+ };
+
+ wps {
+ label = "wps";
+ linux,code = <KEY_WPS_BUTTON>;
+ gpios = <&pio 0 GPIO_ACTIVE_HIGH>;
+ };
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ led_status: led@0 {
+ label = "blue:status";
+ gpios = <&pio 10 GPIO_ACTIVE_LOW>;
+ };
+
+ led@1 {
+ label = "blue:internet";
+ gpios = <&pio 11 GPIO_ACTIVE_LOW>;
+ };
+
+ led@2 {
+ label = "blue:wan";
+ gpios = <&pio 5 GPIO_ACTIVE_LOW>;
+ };
+
+ led@3 {
+ label = "blue:lan";
+ gpios = <&pio 9 GPIO_ACTIVE_LOW>;
+ };
+
+ led@4 {
+ label = "blue:wifi2";
+ gpios = <&pio 6 GPIO_ACTIVE_LOW>;
+ linux,default-trigger = "phy0tpt";
+ };
+
+ led@5 {
+ label = "blue:wifi5";
+ gpios = <&pio 7 GPIO_ACTIVE_LOW>;
+ linux,default-trigger = "phy1tpt";
+ };
+ };
+};
+
+&uart0 {
+ status = "okay";
+};
+
+&watchdog {
+ status = "okay";
+};
+
+&eth {
+ pinctrl-names = "default";
+ pinctrl-0 = <&mdio_pins>;
+
+ status = "okay";
+
+ gmac0: mac@0 {
+ compatible = "mediatek,eth-mac";
+ reg = <0>;
+ phy-mode = "2500base-x";
+
+ nvmem-cell-names = "mac-address";
+ nvmem-cells = <&macaddr_bdinfo_de00>;
+
+ fixed-link {
+ speed = <2500>;
+ full-duplex;
+ pause;
+ };
+ };
+
+ gmac1: mac@1 {
+ compatible = "mediatek,eth-mac";
+ reg = <1>;
+ status = "disabled";
+ };
+};
+
+&mdio_bus {
+ switch: switch@0 {
+ compatible = "mediatek,mt7531";
+ reg = <31>;
+ reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>;
+ };
+};
+
+&spi0 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&spi0_flash_pins>;
+ status = "disabled";
+};
+
+&spi2 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&spi2_flash_pins>;
+ status = "okay";
+
+ flash@0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ compatible = "jedec,spi-nor";
+ reg = <0>;
+
+ spi-max-frequency = <25000000>;
+ spi-tx-buswidth = <4>;
+ spi-rx-buswidth = <4>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@00000 {
+ label = "BL2";
+ reg = <0x00000 0x40000>;
+ read-only;
+ };
+
+ partition@40000 {
+ label = "u-boot-env";
+ reg = <0x40000 0x10000>;
+ read-only;
+ };
+
+ factory: partition@50000 {
+ label = "Factory";
+ reg = <0x50000 0x10000>;
+ read-only;
+ };
+
+ bdinfo: partition@60000 {
+ label = "bdinfo";
+ reg = <0x60000 0x10000>;
+ read-only;
+ };
+
+ partition@70000 {
+ label = "FIP";
+ reg = <0x70000 0x80000>;
+ read-only;
+ };
+
+ partition@f0000 {
+ compatible = "denx,fit";
+ label = "firmware";
+ reg = <0xf0000 0xf10000>;
+ };
+ };
+ };
+};
+
+&pio {
+ spi0_flash_pins: spi0-pins {
+ mux {
+ function = "spi";
+ groups = "spi0", "spi0_wp_hold";
+ };
+ };
+
+ spi2_flash_pins: spi2-pins {
+ mux {
+ function = "spi";
+ groups = "spi2", "spi2_wp_hold";
+ };
+
+ conf-pu {
+ pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP";
+ drive-strength = <8>;
+ bias-pull-up = <103>;
+ };
+
+ conf-pd {
+ pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO";
+ drive-strength = <8>;
+ bias-pull-down = <103>;
+ };
+ };
+};
+
+&switch {
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+ label = "wan";
+
+ nvmem-cell-names = "mac-address";
+ nvmem-cells = <&macaddr_bdinfo_de00>;
+ mac-address-increment = <1>;
+ };
+
+ lan1: port@1 {
+ reg = <1>;
+ label = "lan1";
+
+ nvmem-cell-names = "mac-address";
+ nvmem-cells = <&macaddr_bdinfo_de00>;
+ };
+
+ port@2 {
+ reg = <2>;
+ label = "lan2";
+
+ nvmem-cell-names = "mac-address";
+ nvmem-cells = <&macaddr_bdinfo_de00>;
+ };
+
+ port@3 {
+ reg = <3>;
+ label = "lan3";
+
+ nvmem-cell-names = "mac-address";
+ nvmem-cells = <&macaddr_bdinfo_de00>;
+ };
+
+ port@6 {
+ reg = <6>;
+ label = "cpu";
+ ethernet = <&gmac0>;
+ phy-mode = "2500base-x";
+
+ fixed-link {
+ speed = <2500>;
+ full-duplex;
+ pause;
+ };
+ };
+ };
+};
+
+&wifi {
+ status = "okay";
+ mediatek,mtd-eeprom = <&factory 0x0>;
+};
+
+&bdinfo {
+ compatible = "nvmem-cells";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ macaddr_bdinfo_de00: macaddr@de00 {
+ reg = <0xde00 0x6>;
+ };
+};
diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds
index 6b922de163..1cb00ce26d 100644
--- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds
+++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds
@@ -6,6 +6,9 @@ board=$(board_name)
board_config_update
case $board in
+cudy,wr3000-v1)
+ ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan"
+ ;;
xiaomi,redmi-router-ax6000-stock|\
xiaomi,redmi-router-ax6000-ubootmod)
ucidef_set_led_netdev "wan" "wan" "rgb:network" "wan"
diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
index 4207a5873f..1bdc8337eb 100644
--- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
+++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
@@ -14,6 +14,9 @@ mediatek_setup_interfaces()
bananapi,bpi-r3)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 sfp2" "eth1 wan"
;;
+ cudy,wr3000-v1)
+ ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan"
+ ;;
mediatek,mt7986a-rfb)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan6" "eth1 wan"
;;
diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
index bcd32fab8e..8088b98eb6 100644
--- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
+++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
@@ -24,6 +24,14 @@ case "$board" in
[ "$PHYNBR" = "0" ] && macaddr_unsetbit $addr 6 > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && macaddr_setbit $addr 6 > /sys${DEVPATH}/macaddress
;;
+ cudy,wr3000-v1)
+ addr=$(mtd_get_mac_binary bdinfo 0xde00)
+ # Originally, phy0 is phy1 mac with LA bit set. However, this would conflict
+ # addresses on multiple VIFs with the other radio. Set LA bit and increment
+ # mac-address instead.
+ [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress
+ [ "$PHYNBR" = "1" ] && macaddr_setbit_la $(macaddr_add $addr 1) > /sys${DEVPATH}/macaddress
+ ;;
tplink,tl-xdr4288|\
tplink,tl-xdr6086|\
tplink,tl-xdr6088)
diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
index 9dafe1a97b..9a7a5aaffb 100755
--- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
+++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
@@ -67,6 +67,9 @@ platform_do_upgrade() {
;;
esac
;;
+ cudy,wr3000-v1)
+ default_do_upgrade "$1"
+ ;;
tplink,tl-xdr4288|\
tplink,tl-xdr6086|\
tplink,tl-xdr6088|\
diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk
index 1259d08152..821827e3ca 100644
--- a/target/linux/mediatek/image/filogic.mk
+++ b/target/linux/mediatek/image/filogic.mk
@@ -100,6 +100,25 @@ define Device/bananapi_bpi-r3
endef
TARGET_DEVICES += bananapi_bpi-r3
+define Device/cudy_wr3000-v1
+ DEVICE_VENDOR := Cudy
+ DEVICE_MODEL := WR3000
+ DEVICE_VARIANT := v1
+ DEVICE_DTS := mt7981b-cudy-wr3000-v1
+ DEVICE_DTS_DIR := ../dts
+ DEVICE_DTS_LOADADDR := 0x47000000
+ IMAGES := sysupgrade.bin
+ IMAGE_SIZE := 15424k
+ SUPPORTED_DEVICES += R31
+ KERNEL := kernel-bin | lzma | \
+ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
+ KERNEL_INITRAMFS := kernel-bin | lzma | \
+ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
+ IMAGE/sysupgrade.bin := append-kernel | pad-to 128k | append-rootfs | pad-rootfs | check-size | append-metadata
+ DEVICE_PACKAGES := kmod-mt7981-firmware
+endef
+TARGET_DEVICES += cudy_wr3000-v1
+
define Device/mediatek_mt7986a-rfb-nand
DEVICE_VENDOR := MediaTek
DEVICE_MODEL := MT7986 rfba AP (NAND)