Skip to content

Commit a3b880a

Browse files
authored
ramips: add support for C-Life XG1 [WIFI6] (#10057)
CPU: MediaTek MT7621AT Flash: Micron MT29F2G08ABAGAWP 128M RAM: 256 M WiFi: MT7915 2.4/5 GHz 2T2R Ethernet: 10/100/1000 Mbps x3 LED: Status (red / blue / white / green / purple / cyan) USB: 2.0 x 1 ZigBee/BlueTooth USB Audio: iec958 x 1 Button: Reset Power: DC 12V,1.5A 开启ssh方法: 打开网页:192.168.10.1,用户路由器底面标注的用户名密码完成登陆。 然后打开网页:http://192.168.10.1/cgi-bin/luci/admin/mtk/console,在命令行中输入以下命令: echo -en "root\nroot\n" | passwd 然后打开网页:http://192.168.10.1/cgi-bin/luci/pti/ssh_open 即可ssh登陆192.168.10.1,用户名root,密码root 刷入openwrt: 开启ssh后,上传breed-mt7621-xiaomi-r3g.bin到路由器/tmp目录。 然后使用下面命令刷入breed: mtd -r write /tmp/breed-mt7621-xiaomi-r3g.bin Bootloader 等待机器重启,等1分钟断开电源。 按住C-Life XG1机身正面的圆形IoT按钮(gpio 18),通电就能进入breed刷机.
1 parent fb1fce9 commit a3b880a

File tree

6 files changed

+194
-0
lines changed

6 files changed

+194
-0
lines changed

package/boot/uboot-envtools/files/ramips

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ ravpower,rp-wd03)
4848
[ -n "$idx" ] && \
4949
ubootenv_add_uci_config "/dev/mtd$idx" "0x4000" "0x1000" "0x1000"
5050
;;
51+
c-life,xg1|\
5152
jcg,q20)
5253
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
5354
;;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
2+
3+
#include "mt7621.dtsi"
4+
5+
#include <dt-bindings/gpio/gpio.h>
6+
#include <dt-bindings/input/input.h>
7+
8+
/ {
9+
compatible = "c-life,xg1", "mediatek,mt7621-soc";
10+
model = "C-Life XG1";
11+
12+
aliases {
13+
led-boot = &led_status_red;
14+
led-failsafe = &led_status_red;
15+
led-running = &led_status_blue;
16+
led-upgrade = &led_status_blue;
17+
label-mac-device = &gmac0;
18+
};
19+
20+
chosen {
21+
bootargs = "console=ttyS0,115200";
22+
};
23+
24+
leds {
25+
compatible = "gpio-leds";
26+
27+
led_status_red: status_red {
28+
label = "red:status";
29+
gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
30+
};
31+
32+
led_status_blue: status_blue {
33+
label = "blue:status";
34+
gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
35+
};
36+
};
37+
38+
keys {
39+
compatible = "gpio-keys";
40+
41+
reset {
42+
label = "reset";
43+
gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
44+
linux,code = <KEY_RESTART>;
45+
};
46+
47+
wps {
48+
label = "wps";
49+
gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
50+
linux,code = <KEY_WPS_BUTTON>;
51+
};
52+
};
53+
};
54+
55+
&nand {
56+
status = "okay";
57+
58+
partitions {
59+
compatible = "fixed-partitions";
60+
#address-cells = <1>;
61+
#size-cells = <1>;
62+
63+
partition@0 {
64+
label = "Bootloader";
65+
reg = <0x0 0x80000>;
66+
};
67+
68+
partition@80000 {
69+
label = "Nvram";
70+
reg = <0x80000 0x40000>;
71+
read-only;
72+
};
73+
74+
partition@c0000 {
75+
label = "Bdata";
76+
reg = <0xc0000 0x40000>;
77+
read-only;
78+
};
79+
80+
factory: partition@100000 {
81+
label = "Factory";
82+
reg = <0x100000 0x80000>;
83+
read-only;
84+
};
85+
86+
partition@180000 {
87+
label = "crash";
88+
reg = <0x180000 0x40000>;
89+
read-only;
90+
};
91+
92+
partition@1c0000 {
93+
label = "crash_log";
94+
reg = <0x1c0000 0x40000>;
95+
read-only;
96+
};
97+
98+
partition@200000 {
99+
label = "kernel";
100+
reg = <0x200000 0x400000>;
101+
};
102+
103+
partition@600000 {
104+
label = "ubi";
105+
reg = <0x600000 0x7980000>;
106+
};
107+
};
108+
};
109+
110+
&pcie {
111+
status = "okay";
112+
};
113+
114+
&pcie1 {
115+
wifi@0,0 {
116+
compatible = "mediatek,mt76";
117+
reg = <0x0000 0 0 0 0>;
118+
mediatek,mtd-eeprom = <&factory 0x0>;
119+
};
120+
};
121+
122+
&gmac0 {
123+
mtd-mac-address = <&factory 0x04>;
124+
};
125+
126+
&gmac1 {
127+
mtd-mac-address = <&factory 0x0a>;
128+
phy-mode = "rgmii";
129+
status = "okay";
130+
131+
fixed-link {
132+
speed = <1000>;
133+
full-duplex;
134+
pause;
135+
};
136+
};
137+
138+
&gsw {
139+
mediatek,portmap = "llllw";
140+
status = "okay";
141+
};
142+
143+
&hnat {
144+
mtketh-wan = "eth1";
145+
mtketh-ppd = "eth0";
146+
mtketh-lan = "eth0";
147+
mtketh-max-gmac = <2>;
148+
/delete-property/ mtkdsa-wan-port;
149+
};
150+
151+
&switch0 {
152+
status = "disabled";
153+
};
154+
155+
&state_default {
156+
gpio {
157+
groups = "jtag", "wdt";
158+
function = "gpio";
159+
};
160+
};

target/linux/ramips/image/mt7621.mk

+17
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,23 @@ define Device/buffalo_wsr-600dhp
380380
endef
381381
TARGET_DEVICES += buffalo_wsr-600dhp
382382

383+
define Device/c-life_xg1
384+
$(Device/dsa-migration)
385+
BLOCKSIZE := 128k
386+
PAGESIZE := 2048
387+
UBINIZE_OPTS := -E 5
388+
KERNEL_SIZE := 4096k
389+
IMAGE_SIZE := 91136k
390+
IMAGES += factory.bin
391+
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
392+
IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \
393+
check-size
394+
DEVICE_VENDOR := C-Life
395+
DEVICE_MODEL := XG1
396+
DEVICE_PACKAGES := kmod-mt7915e uboot-envtools kmod-usb3
397+
endef
398+
TARGET_DEVICES += c-life_xg1
399+
383400
define Device/cudy_wr1300
384401
$(Device/dsa-migration)
385402
IMAGE_SIZE := 15872k

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

+9
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ ramips_setup_interfaces()
4545
ucidef_add_switch "switch0" \
4646
"1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4" "0:wan" "6@eth0"
4747
;;
48+
c-life,xg1)
49+
ucidef_add_switch "switch0" \
50+
"1:lan" "2:lan" "0:wan" "6u@eth0" "5u@eth1"
51+
;;
4852
d-team,newifi-d2)
4953
ucidef_add_switch "switch0" \
5054
"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan:5" "6@eth0"
@@ -143,6 +147,11 @@ ramips_setup_macs()
143147
wan_mac="$(grep -m1 mac= "/dev/mtd${index}" | cut -d= -f2)"
144148
lan_mac=$wan_mac
145149
;;
150+
c-life,xg1)
151+
base_mac=$(cat /sys/class/net/eth0/address)
152+
lan_mac=$(macaddr_add "$base_mac" -1)
153+
wan_mac=$(macaddr_add "$lan_mac" -1)
154+
;;
146155
d-team,newifi-d2)
147156
lan_mac=$(cat /sys/class/net/eth0/address)
148157
wan_mac=$(mtd_get_mac_binary factory 0xe006)

target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac

+6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ PHYNBR=${DEVPATH##*/phy}
1010
board=$(board_name)
1111

1212
case "$board" in
13+
c-life,xg1)
14+
if [ "$PHYNBR" = "1" ]; then
15+
base_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1)
16+
macaddr_setbit_la "$base_mac" > /sys${DEVPATH}/macaddress
17+
fi
18+
;;
1319
dlink,dir-853-a3)
1420
[ "$PHYNBR" = "0" ] && \
1521
macaddr_setbit_la "$(mtd_get_mac_binary factory 0xe000)" \

target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ platform_do_upgrade() {
7777
asus,rt-ac85p|\
7878
beeline,smartbox-giga|\
7979
beeline,smartbox-turbo-plus|\
80+
c-life,xg1|\
8081
dlink,dir-1960-a1|\
8182
dlink,dir-2640-a1|\
8283
dlink,dir-2660-a1|\

0 commit comments

Comments
 (0)