Skip to content

Commit afad4c7

Browse files
DerekDenkhauke
authored andcommitted
mediatek: filogic: add support for Cudy AP3000 Wall v1
This commit adds support for the Cudy AP3000 Wall v1. SoC: MediaTek MT7981b RAM: 256MiB Flash: spi-nand spi0.0: 128 MiB Wifi: MediaTek MT7981 2x2 DBDC 802.11ax 2T2R (2.4 / 5) LEDs: 1 LED in two colors (red & white) Buttons: 1 reset, 1 led on/off Ethernet: 5x 1GbE Power: PoE powered (standalone) The stock firmware is a customized variant of OpenWrt, which implements a signature check that only allows flashing official firmware. Cudy offers intermediate OpenWrt firmware images on their website [1][2] which do not implement the signature check. After flashing the intermediate image the upstream official OpenWrt image can be installed. The stock firmware can be recovered via TFTP using the U-Boot based boot loader[3]. Set up a TFTP server on your computer with IP 192.168.1.88/24 serving the stock firmware from Cudy's website renamed to "recovery.bin". Press and hold the reset button while powering on the device, wait for the TFTP server to send the recovery.bin file, then release the reset button. The router will take a couple of minutes to reboot and set up the stock firmware. [1] https://www.cudy.com/blogs/faq/openwrt-software-download [2] https://drive.google.com/drive/folders/1BKVarlwlNxf7uJUtRhuMGUqeCa5KpMnj [3] https://www.cudy.com/en-us/blogs/faq/how-to-recovery-the-cudy-router-from-openwrt-firmware-to-cudy-official-firmware Signed-off-by: Derek Denk <derek.denk@live.com> Link: openwrt/openwrt#21266 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
1 parent ff5e66a commit afad4c7

File tree

4 files changed

+297
-0
lines changed

4 files changed

+297
-0
lines changed
Lines changed: 276 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,276 @@
1+
// SPDX-License-Identifier: (GPL-2.0 OR MIT)
2+
3+
/dts-v1/;
4+
5+
#include <dt-bindings/leds/common.h>
6+
7+
#include "mt7981b.dtsi"
8+
9+
/ {
10+
model = "Cudy AP3000 Wall v1";
11+
compatible = "cudy,ap3000wall-v1", "mediatek,mt7981";
12+
13+
aliases {
14+
label-mac-device = &gmac0;
15+
led-boot = &led_status_white;
16+
led-failsafe = &led_status_red;
17+
led-running = &led_status_white;
18+
led-upgrade = &led_status_red;
19+
serial0 = &uart0;
20+
};
21+
22+
chosen {
23+
stdout-path = "serial0:115200n8";
24+
};
25+
26+
gpio-keys {
27+
compatible = "gpio-keys";
28+
29+
reset {
30+
label = "reset";
31+
linux,code = <KEY_RESTART>;
32+
gpios = <&pio 1 GPIO_ACTIVE_LOW>;
33+
};
34+
35+
lights_toggle {
36+
label = "lights_toggle";
37+
linux,code = <KEY_LIGHTS_TOGGLE>;
38+
gpios = <&pio 35 GPIO_ACTIVE_LOW>;
39+
};
40+
};
41+
42+
gpio-leds {
43+
compatible = "gpio-leds";
44+
45+
led_status_red: led@0 {
46+
label = "red:status";
47+
function = LED_FUNCTION_POWER;
48+
color = <LED_COLOR_ID_RED>;
49+
gpios = <&pio 4 GPIO_ACTIVE_LOW>;
50+
};
51+
52+
led_status_white: led@1 {
53+
label = "white:status";
54+
function = LED_FUNCTION_STATUS;
55+
color = <LED_COLOR_ID_WHITE>;
56+
gpios = <&pio 10 GPIO_ACTIVE_LOW>;
57+
};
58+
59+
};
60+
61+
gpio_export {
62+
compatible = "gpio-export";
63+
64+
poe_passthrough {
65+
gpio-export,name = "poe-passthrough";
66+
gpio-export,output = <0>;
67+
gpios = <&pio 12 GPIO_ACTIVE_HIGH>;
68+
};
69+
};
70+
71+
watchdog-hw {
72+
compatible = "linux,wdt-gpio";
73+
gpios = <&pio 6 GPIO_ACTIVE_HIGH>;
74+
hw_algo = "level";
75+
hw_margin_ms = <10000>;
76+
always-running;
77+
};
78+
};
79+
80+
&uart0 {
81+
status = "okay";
82+
};
83+
84+
&watchdog {
85+
status = "okay";
86+
};
87+
88+
&eth {
89+
pinctrl-names = "default";
90+
pinctrl-0 = <&mdio_pins>;
91+
status = "okay";
92+
93+
gmac0: mac@0 {
94+
compatible = "mediatek,eth-mac";
95+
reg = <0>;
96+
phy-mode = "2500base-x";
97+
nvmem-cell-names = "mac-address";
98+
nvmem-cells = <&macaddr_bdinfo_de00 0>;
99+
fixed-link {
100+
speed = <2500>;
101+
full-duplex;
102+
pause;
103+
};
104+
};
105+
};
106+
107+
&mdio_bus {
108+
switch: switch@1f {
109+
compatible = "mediatek,mt7531";
110+
reg = <31>;
111+
reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>;
112+
interrupt-controller;
113+
#interrupt-cells = <1>;
114+
interrupt-parent = <&pio>;
115+
interrupts = <38 IRQ_TYPE_LEVEL_HIGH>;
116+
};
117+
};
118+
119+
&spi0 {
120+
pinctrl-names = "default";
121+
pinctrl-0 = <&spi0_flash_pins>;
122+
status = "okay";
123+
124+
spi_nand: flash@0 {
125+
compatible = "spi-nand";
126+
reg = <0>;
127+
spi-max-frequency = <52000000>;
128+
129+
spi-cal-enable;
130+
spi-cal-mode = "read-data";
131+
spi-cal-datalen = <7>;
132+
spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>;
133+
spi-cal-addrlen = <5>;
134+
spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>;
135+
136+
spi-tx-bus-width = <4>;
137+
spi-rx-bus-width = <4>;
138+
mediatek,nmbm;
139+
mediatek,bmt-max-ratio = <1>;
140+
mediatek,bmt-max-reserved-blocks = <64>;
141+
142+
partitions {
143+
compatible = "fixed-partitions";
144+
#address-cells = <1>;
145+
#size-cells = <1>;
146+
147+
partition@0 {
148+
label = "BL2";
149+
reg = <0x00000 0x0100000>;
150+
read-only;
151+
};
152+
153+
partition@100000 {
154+
label = "u-boot-env";
155+
reg = <0x0100000 0x0080000>;
156+
read-only;
157+
};
158+
159+
factory: partition@180000 {
160+
label = "Factory";
161+
reg = <0x180000 0x0200000>;
162+
read-only;
163+
164+
nvmem-layout {
165+
compatible = "fixed-layout";
166+
#address-cells = <1>;
167+
#size-cells = <1>;
168+
169+
eeprom_factory_0: eeprom@0 {
170+
reg = <0x0 0x1000>;
171+
};
172+
};
173+
};
174+
175+
partition@380000 {
176+
label = "bdinfo";
177+
reg = <0x380000 0x0040000>;
178+
read-only;
179+
180+
nvmem-layout {
181+
compatible = "fixed-layout";
182+
#address-cells = <1>;
183+
#size-cells = <1>;
184+
185+
macaddr_bdinfo_de00: macaddr@de00 {
186+
compatible = "mac-base";
187+
reg = <0xde00 0x6>;
188+
#nvmem-cell-cells = <1>;
189+
};
190+
};
191+
};
192+
193+
partition@3c0000 {
194+
label = "FIP";
195+
reg = <0x3c0000 0x0200000>;
196+
read-only;
197+
};
198+
199+
partition@5c0000 {
200+
label = "ubi";
201+
reg = <0x5c0000 0x4000000>;
202+
compatible = "linux,ubi";
203+
};
204+
};
205+
};
206+
};
207+
208+
&pio {
209+
spi0_flash_pins: spi0-pins {
210+
mux {
211+
function = "spi";
212+
groups = "spi0", "spi0_wp_hold";
213+
};
214+
conf-pu {
215+
pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
216+
drive-strength = <MTK_DRIVE_8mA>;
217+
bias-pull-up = <MTK_PUPD_SET_R1R0_11>;
218+
};
219+
conf-pd {
220+
pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
221+
drive-strength = <MTK_DRIVE_8mA>;
222+
bias-pull-down = <MTK_PUPD_SET_R1R0_11>;
223+
};
224+
};
225+
};
226+
227+
&switch {
228+
ports {
229+
#address-cells = <1>;
230+
#size-cells = <0>;
231+
232+
port@0 {
233+
reg = <0>;
234+
label = "lan1";
235+
};
236+
237+
port@1 {
238+
reg = <1>;
239+
label = "lan2";
240+
};
241+
242+
port@2 {
243+
reg = <2>;
244+
label = "lan3";
245+
};
246+
247+
port@3 {
248+
reg = <3>;
249+
label = "lan4";
250+
};
251+
252+
port@4 {
253+
reg = <4>;
254+
label = "lan5";
255+
};
256+
257+
port@6 {
258+
reg = <6>;
259+
label = "cpu";
260+
ethernet = <&gmac0>;
261+
phy-mode = "2500base-x";
262+
263+
fixed-link {
264+
speed = <2500>;
265+
full-duplex;
266+
pause;
267+
};
268+
};
269+
};
270+
};
271+
272+
&wifi {
273+
status = "okay";
274+
nvmem-cells = <&eeprom_factory_0>;
275+
nvmem-cell-names = "eeprom";
276+
};

target/linux/mediatek/filogic/base-files/etc/board.d/02_network

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ mediatek_setup_interfaces()
106106
comfast,cf-e393ax)
107107
ucidef_set_interfaces_lan_wan "lan1" eth1
108108
;;
109+
cudy,ap3000wall-v1)
110+
ucidef_set_interface_lan "lan1 lan2 lan3 lan4 lan5"
111+
;;
109112
cudy,ap3000outdoor-v1|\
110113
cudy,ap3000-v1|\
111114
cudy,re3000-v1|\

target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ case "$board" in
8484
[ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress
8585
;;
8686
cudy,ap3000outdoor-v1|\
87+
cudy,ap3000wall-v1|\
8788
cudy,ap3000-v1|\
8889
cudy,m3000-v1|\
8990
cudy,re3000-v1|\

target/linux/mediatek/image/filogic.mk

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,6 +1027,23 @@ define Device/cudy_ap3000outdoor-v1
10271027
endef
10281028
TARGET_DEVICES += cudy_ap3000outdoor-v1
10291029

1030+
define Device/cudy_ap3000wall-v1
1031+
DEVICE_VENDOR := Cudy
1032+
DEVICE_MODEL := AP3000 Wall
1033+
DEVICE_VARIANT := v1
1034+
DEVICE_DTS := mt7981b-cudy-ap3000wall-v1
1035+
DEVICE_DTS_DIR := ../dts
1036+
SUPPORTED_DEVICES += R68
1037+
UBINIZE_OPTS := -E 5
1038+
BLOCKSIZE := 128k
1039+
PAGESIZE := 2048
1040+
IMAGE_SIZE := 65536k
1041+
KERNEL_IN_UBI := 1
1042+
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
1043+
DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware
1044+
endef
1045+
TARGET_DEVICES += cudy_ap3000wall-v1
1046+
10301047
define Device/cudy_ap3000-v1
10311048
DEVICE_VENDOR := Cudy
10321049
DEVICE_MODEL := AP3000

0 commit comments

Comments
 (0)