Skip to content

Commit faf4b3e

Browse files
igieonhauke
authored andcommitted
mediatek: filogic: add support for Cudy WR3000S v1
Hardware -------- MediaTek MT7981 WiSoC 256MB DDR3 RAM 128MB SPI-NAND (XMC XM25QH128C) MediaTek MT7981 2x2 DBDC 802.11ax 2T2R (2.4 / 5) UART: 115200 8N1 3.3V MAC: LAN MAC: label mac WAN MAC: label mac + 1 2.4G MAC: label mac 5G MAC: label mac + 1 with LA bit set Installation ------------ 1. Connect to the serial port as described in the "Hardware" section. 2. Power on the device + press reset pin. Keep pressing reset pin 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.88. Rename the image to "cudy3000s.bin" 4. Download and boot the OpenWrt initramfs image. $ tftpboot 0x46000000 cudy3000s.bin; bootm 0x46000000 5. Transfer the OpenWrt sysupgrade image to the device using scp. Install with sysupgrade. Signed-off-by: David Ignjic <[email protected]> Link: openwrt/openwrt#16939 Signed-off-by: Hauke Mehrtens <[email protected]>
1 parent b8b658b commit faf4b3e

File tree

3 files changed

+301
-0
lines changed

3 files changed

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

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
@@ -81,6 +81,7 @@ case "$board" in
8181
;;
8282
cudy,ap3000outdoor-v1|\
8383
cudy,m3000-v1|\
84+
cudy,wr3000s-v1|\
8485
cudy,wr3000-v1)
8586
addr=$(mtd_get_mac_binary bdinfo 0xde00)
8687
# Originally, phy0 is phy1 mac with LA bit set. However, this would conflict

target/linux/mediatek/image/filogic.mk

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,23 @@ define Device/cudy_wr3000-v1
667667
endef
668668
TARGET_DEVICES += cudy_wr3000-v1
669669

670+
define Device/cudy_wr3000s-v1
671+
DEVICE_VENDOR := Cudy
672+
DEVICE_MODEL := WR3000S
673+
DEVICE_VARIANT := v1
674+
DEVICE_DTS := mt7981b-cudy-wr3000s-v1
675+
DEVICE_DTS_DIR := ../dts
676+
SUPPORTED_DEVICES += R59
677+
UBINIZE_OPTS := -E 5
678+
BLOCKSIZE := 128k
679+
PAGESIZE := 2048
680+
IMAGE_SIZE := 65536k
681+
KERNEL_IN_UBI := 1
682+
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
683+
DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware
684+
endef
685+
TARGET_DEVICES += cudy_wr3000s-v1
686+
670687
define Device/dlink_aquila-pro-ai-m30-a1
671688
DEVICE_VENDOR := D-Link
672689
DEVICE_MODEL := AQUILA PRO AI M30

0 commit comments

Comments
 (0)