Skip to content

Commit a369a5b

Browse files
committed
ramips: mt76x8: add support for Cudy LT300 v3
Hardware: - SoC: MediaTek MT7628AN (MIPS 580MHz) - Flash: 16 MiB NOR - RAM: 64 MiB DDR2 - WLAN: 2.4 GHz (MT7628), 5 GHz (MT7613BEN 802.11ac) - Ethernet: 1x 10/100 Mbps WAN/LAN, 1x 10/100 LAN (MT7628) - Build-in LTE Modem: MeigLink SLM770A 4G Cat. 4 (150/50 Mbps) - Buttons: 1x Reset, 1x wps - LEDs: Front: 1x Red, 1x White, Back: 3x White 4G signal strengh - Serial console: unpopulated header, 115200 8n1 - Power: USB-C MAC addresses: +---------+-------------------+-----------+ | | MAC | Algorithm | +---------+-------------------+-----------+ | WAN | 80:af:ca:xx:xx:x0 | label | | LAN | 80:af:ca:xx:xx:x0 | label | | WLAN 2g | 80:af:ca:xx:xx:x0 | label | | WLAN 5g | 80:af:ca:xx:xx:x2 | label+2 | +---------+-------------------+-----------+ Migration to OpenWrt: - Download the RSA signed intermediate firmware from the Cudy website: `openwrt-ramips-mt76x8-cudy_lt300-v3-squashfs-flash.bin` - Connect computer to LAN and flash the intermediate firmware via OEM web interface - OpenWrt is now accessible via 192.168.1.1 Revert back to OEM firmware: - Set up a TFTP server on IP 192.168.1.88 and connect to the WAN port (upper port) - Provide the Cudy firmware as recovery.bin in the TFTP server - Press the reset button while powering on the device - Recovery process is started now - When recovery process is done, OEM firmware is accessible via 192.168.10.1 again General information: - No possibility to load a initramfs image via U-Boot because there is no option to interrupt U-Boot Signed-off-by: Fil Dunsky <filipp.dunsky@gmail.com>
1 parent 361885b commit a369a5b

4 files changed

Lines changed: 235 additions & 0 deletions

File tree

Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
2+
3+
#include "mt7628an.dtsi"
4+
5+
#include <dt-bindings/gpio/gpio.h>
6+
#include <dt-bindings/input/input.h>
7+
#include <dt-bindings/leds/common.h>
8+
9+
/ {
10+
compatible = "cudy,lt300-v3", "mediatek,mt7628an-soc";
11+
model = "Cudy LT300 v3";
12+
13+
aliases {
14+
led-boot = &white_status;
15+
led-running = &white_status;
16+
led-failsafe = &red_status;
17+
led-upgrade = &red_status;
18+
label-mac-device = &ethernet;
19+
};
20+
21+
chosen {
22+
bootargs = "console=ttyS0,115200";
23+
};
24+
25+
gpio-keys {
26+
compatible = "gpio-keys";
27+
28+
reset {
29+
label = "reset";
30+
linux,code = <KEY_RESTART>;
31+
gpios = <&gpio 38 GPIO_ACTIVE_LOW>;
32+
};
33+
34+
wps {
35+
label = "wps";
36+
gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
37+
linux,code = <KEY_WPS_BUTTON>;
38+
};
39+
};
40+
41+
gpio-leds {
42+
compatible = "gpio-leds";
43+
44+
red_status: red_status {
45+
function = LED_FUNCTION_STATUS;
46+
color = <LED_COLOR_ID_RED>;
47+
gpios = <&gpio 37 GPIO_ACTIVE_LOW>;
48+
};
49+
50+
white_status: white_status {
51+
function = LED_FUNCTION_STATUS;
52+
color = <LED_COLOR_ID_WHITE>;
53+
gpios = <&gpio 44 GPIO_ACTIVE_LOW>;
54+
};
55+
56+
signal1 {
57+
label = "white:signal1";
58+
color = <LED_COLOR_ID_WHITE>;
59+
gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
60+
};
61+
62+
signal2 {
63+
label = "white:signal2";
64+
color = <LED_COLOR_ID_WHITE>;
65+
gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
66+
};
67+
68+
signal3 {
69+
label = "white:signal3";
70+
color = <LED_COLOR_ID_WHITE>;
71+
gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
72+
};
73+
};
74+
75+
gpio_export {
76+
compatible = "gpio-export";
77+
78+
usb4g {
79+
gpio-export,name = "4g";
80+
gpio-export,output = <0>;
81+
gpios = <&gpio 3 GPIO_ACTIVE_HIGH>;
82+
};
83+
};
84+
};
85+
86+
&spi0 {
87+
status = "okay";
88+
89+
flash@0 {
90+
compatible = "jedec,spi-nor";
91+
reg = <0>;
92+
spi-max-frequency = <40000000>;
93+
94+
partitions {
95+
compatible = "fixed-partitions";
96+
#address-cells = <1>;
97+
#size-cells = <1>;
98+
99+
partition@0 {
100+
label = "u-boot";
101+
reg = <0x0 0x30000>;
102+
read-only;
103+
};
104+
105+
partition@30000 {
106+
label = "u-boot-env";
107+
reg = <0x30000 0x10000>;
108+
read-only;
109+
};
110+
111+
partition@40000 {
112+
label = "factory";
113+
reg = <0x40000 0x10000>;
114+
read-only;
115+
116+
nvmem-layout {
117+
compatible = "fixed-layout";
118+
#address-cells = <1>;
119+
#size-cells = <1>;
120+
121+
eeprom_factory_0: eeprom@0 {
122+
reg = <0x0 0x400>;
123+
};
124+
125+
eeprom_factory_8000: eeprom@8000 {
126+
reg = <0x8000 0x4da8>;
127+
};
128+
};
129+
};
130+
131+
partition@fd0000 {
132+
label = "debug";
133+
reg = <0xfd0000 0x10000>;
134+
read-only;
135+
};
136+
137+
partition@fe0000 {
138+
label = "backup";
139+
reg = <0xfe000 0x10000>;
140+
read-only;
141+
};
142+
143+
partition@ff0000 {
144+
label = "bdinfo";
145+
reg = <0xff0000 0x10000>;
146+
read-only;
147+
148+
nvmem-layout {
149+
compatible = "fixed-layout";
150+
#address-cells = <1>;
151+
#size-cells = <1>;
152+
153+
macaddr_bdinfo_de00: macaddr@de00 {
154+
compatible = "mac-base";
155+
reg = <0xde00 0x6>;
156+
#nvmem-cell-cells = <1>;
157+
};
158+
};
159+
};
160+
161+
partition@50000 {
162+
compatible = "denx,uimage";
163+
label = "firmware";
164+
reg = <0x50000 0xf80000>;
165+
};
166+
};
167+
};
168+
};
169+
170+
&state_default {
171+
gpio {
172+
groups = "i2c", "gpio", "wdt", "p0led_an", "wled_an";
173+
function = "gpio";
174+
};
175+
};
176+
177+
&ehci {
178+
status = "okay";
179+
};
180+
181+
&ohci {
182+
status = "okay";
183+
};
184+
185+
&pcie {
186+
status = "okay";
187+
};
188+
189+
&pcie0 {
190+
wifi@0,0 {
191+
compatible = "mediatek,mt76";
192+
reg = <0x0000 0 0 0 0>;
193+
nvmem-cells = <&eeprom_factory_8000>, <&macaddr_bdinfo_de00 2>;
194+
nvmem-cell-names = "eeprom", "mac-address";
195+
ieee80211-freq-limit = <5000000 6000000>;
196+
};
197+
};
198+
199+
&wmac {
200+
status = "okay";
201+
202+
nvmem-cells = <&eeprom_factory_0>, <&macaddr_bdinfo_de00 0>;
203+
nvmem-cell-names = "eeprom", "mac-address";
204+
};
205+
206+
&ethernet {
207+
nvmem-cells = <&macaddr_bdinfo_de00 0>;
208+
nvmem-cell-names = "mac-address";
209+
};
210+
211+
&esw {
212+
mediatek,portmap = <0x3d>;
213+
mediatek,portdisable = <0x3c>;
214+
};

target/linux/ramips/image/mt76x8.mk

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,17 @@ define Device/creality_wb-01
199199
endef
200200
TARGET_DEVICES += creality_wb-01
201201

202+
define Device/cudy_lt300-v3
203+
IMAGE_SIZE := 15872k
204+
DEVICE_VENDOR := Cudy
205+
DEVICE_MODEL := LT300
206+
DEVICE_VARIANT := v3
207+
DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-net-cdc-ether \
208+
kmod-usb-serial-option kmod-mt7615e kmod-mt7663-firmware-ap
209+
SUPPORTED_DEVICES += R100
210+
endef
211+
TARGET_DEVICES += cudy_lt300-v3
212+
202213
define Device/cudy_lt400e-v1
203214
IMAGE_SIZE := 7808k
204215
DEVICE_VENDOR := Cudy

target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ yuncore,m300)
2727
creality,wb-01)
2828
ucidef_set_led_switch "lan" "lan" "blue:lan" "switch0" "0x1"
2929
;;
30+
cudy,lt300-v3)
31+
ucidef_set_led_netdev "internet" "internet" "white:status" "usb0"
32+
;;
3033
cudy,lt400e-v1)
3134
ucidef_set_led_switch "lan1" "lan1" "blue:lan-1" "switch0" "0x08"
3235
ucidef_set_led_switch "lan2" "lan2" "blue:lan-2" "switch0" "0x04"

target/linux/ramips/mt76x8/base-files/etc/board.d/02_network

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ ramips_setup_interfaces()
100100
ucidef_add_switch "switch0" \
101101
"4:lan" "6@eth0"
102102
;;
103+
cudy,lt300-v3)
104+
ucidef_add_switch "switch0" \
105+
"0:lan" "1:wan" "6@eth0"
106+
ucidef_set_interface "wwan" device "usb0" protocol "dhcp"
107+
uci add_list firewall.@zone[1].network='wwan'
108+
uci add_list firewall.@zone[1].network='wwan6'
109+
;;
103110
cudy,lt400e-v1)
104111
ucidef_add_switch "switch0" \
105112
"3:lan:1" "2:lan:2" "1:lan:3" "0:lan:4" "6@eth0"

0 commit comments

Comments
 (0)