ramips: add C-Life XG1 support

Hardware specification:
  SoC: MediaTek MT7621AT
  Flash: Micron MT29F2G08ABAGAWP 256Mib
  RAM: 256MB DDR3
  Ethernet: 3x 10/100/1000 Mbps
  LED: Status (red / blue / green / white / cyan / yellow / magenta)
  Switch: MediaTek MT7530
  WiFi: MediaTek MT7905DAN + MT7975DN
  Button: Reset (gpio 17), WPS (gpio 18)
  ZigBee: EFR32MG21
  Ble: EFR32BG21
  USB Audio: iec958
  Power: DC 12V 1.5A

Gain SSH access:
1. Login into web interface.
2. Go to http://192.168.10.1/cgi-bin/luci/admin/mtk/console (CMCC version) or http://192.168.2.1/cgi-bin/luci/admin/mtk/console (CT version)
   echo -en "root\nroot\n" | passwd
4. Go to http://192.168.10.1/cgi-bin/luci/pti/ssh_open (CMCC version) or http://192.168.2.1/cgi-bin/luci/pti/ssh_open (CT version)
5. Ssh to router username:root password:root
5. Fork https://github.com/DragonBluep/uboot-mt7621
6. Compile uboot by Github action.
   Flash Type : NAND
   MTD Partition Table : 512k(u-boot),256k(config),256k(configdata),512k(factory),-(firmware)
   Kernel Load Address : 0x180000
   Reset Button GPIO : 18  #Can't use gpio 17 because it is flipped, on is off, of is on.
   System LED GPIO : 14
   CPU Frequency (400 - 1200) : 880
   DRAM Frequency : 1200
   Prefered DDR Init Parameters : DDR3-256MiB
   Baud Rate : 115200
7. Check carefully everything is right.
8. Upload u-boot-mt7621.bin via scp.
9. Backup everything, especially 'Factory' part.
10. Write new uboot.
    mtd write u-boot-mt7621.bin Bootloader
11. Set static IP on your PC:
    IP 192.168.1.2/24, GW 192.168.1.1
12. Serve ImmortalWrt initramfs image using TFTP server. Don't forget to rename the image to "recovery.bin".
13. Cut off the power , hold wps button and re-engage, wait for TFTP recovery to complete.
14. After ImmortalWrt has booted, perform sysupgrade.

Attention: This firmware uses different boot address with https://github.com/coolsnowwolf/lede/pull/10057/commits/ecfbf648e564b058524d0ae119ba2b58b29f198a
Don't recommend to use breed, though it might work with environment valuable change. It's not designed for this board and may cause unexpected issues.

Original Partition table:
0x000000000000-0x000000080000 : "Bootloader"
0x000000080000-0x0000000c0000 : "Config"
0x0000000c0000-0x000000100000 : "ConfigData"
0x000000100000-0x000000180000 : "Factory"
0x000000180000-0x000007ae0000 : "firmware"
0x000000180000-0x000000500000 : "kernel"
0x000000500000-0x000007ae0000 : "rootfs"
0x000001540000-0x000007ae0000 : "rootfs_data"
0x000007fe0000-0x00000f940000 : "firmware_backup"
0x00000f440000-0x00000fe40000 : "ClifeData"
(Get that from dmesg, I don't know why last two partition mix together)

Immortalwrt Partition table:
0x000000000000-0x000000080000 : "Bootloader"
0x000000080000-0x0000000c0000 : "Config"
0x0000000c0000-0x000000100000 : "ConfigData"
0x000000100000-0x000000180000 : "Factory"
0x000000180000-0x000000580000 : "kernel"
0x000000580000-0x00000fe40000 : "ubi"

(cherry picked from commit e44074d272)
This commit is contained in:
xu6ao2
2025-07-03 18:51:10 +08:00
committed by Tianling Shen
parent 1f763bb64b
commit 6ee9c57a6d
6 changed files with 204 additions and 0 deletions
+1
View File
@@ -74,6 +74,7 @@ zte,mf283plus)
asus,rt-ax53u|\
asus,rt-ax54|\
belkin,rt1800|\
c-life,xg1|\
elecom,wrc-x1800gs|\
h3c,tx1800-plus|\
h3c,tx1801-plus|\
@@ -0,0 +1,186 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "mt7621.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>
/ {
compatible = "c-life,xg1", "mediatek,mt7621-soc";
model = "C-Life XG1";
aliases {
led-boot = &led_sys_red;
led-failsafe = &led_sys_red;
led-running = &led_sys_blue;
led-upgrade = &led_sys_green;
label-mac-device = &gmac0;
};
chosen {
bootargs = "console=ttyS0,115200";
};
gpio-keys {
compatible = "gpio-keys";
button-reset {
label = "reset";
gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
linux,code = <KEY_RESTART>;
};
button-wps {
label = "wps";
gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
linux,code = <KEY_WPS_BUTTON>;
};
};
gpio-leds {
compatible = "gpio-leds";
led_sys_red: led-0 {
color = <LED_COLOR_ID_RED>;
function = LED_FUNCTION_STATUS;
gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
};
led_sys_green: led-1 {
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_STATUS;
gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
};
led_sys_blue: led-2 {
color = <LED_COLOR_ID_BLUE>;
function = LED_FUNCTION_STATUS;
gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
};
};
};
&ethphy0 {
/delete-property/ interrupts;
};
&gmac0 {
nvmem-cells = <&macaddr_factory_4>;
nvmem-cell-names = "mac-address";
};
&gmac1 {
label = "wan";
nvmem-cells = <&macaddr_factory_a>;
nvmem-cell-names = "mac-address";
phy-handle = <&ethphy0>;
status = "okay";
};
&nand {
status = "okay";
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "Bootloader";
reg = <0x0 0x80000>;
read-only;
};
partition@80000 {
label = "Config";
reg = <0x80000 0x40000>;
read-only;
};
partition@c0000 {
label = "ConfigData";
reg = <0xc0000 0x40000>;
read-only;
};
partition@100000 {
label = "Factory";
reg = <0x100000 0x80000>;
read-only;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
eeprom_factory_0: eeprom@0 {
reg = <0x0 0xe00>;
};
macaddr_factory_4: macaddr@4 {
reg = <0x4 0x6>;
};
macaddr_factory_a: macaddr@a {
reg = <0xa 0x6>;
};
};
};
partition@180000 {
label = "kernel";
reg = <0x180000 0x400000>;
};
partition@580000 {
label = "ubi";
reg = <0x580000 0xf8c0000>;
};
};
};
&pcie {
status = "okay";
};
&pcie1 {
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&eeprom_factory_0>;
nvmem-cell-names = "eeprom";
mediatek,disable-radar-background;
};
};
&state_default {
gpio {
groups = "jtag", "wdt";
function = "gpio";
};
};
&switch0 {
ports {
port@1 {
status = "okay";
label = "lan1";
};
port@2 {
status = "okay";
label = "lan2";
};
};
};
&uartlite2 {
/* EFR32BG21 Ble */
status = "okay";
};
&uartlite3 {
/* EFR32MG21 Zigbee */
status = "okay";
};
+12
View File
@@ -662,6 +662,18 @@ define Device/bolt_arion
endef
TARGET_DEVICES += bolt_arion
define Device/c-life_xg1
$(Device/nand)
DEVICE_VENDOR := C-Life
DEVICE_MODEL := XG1
DEVICE_PACKAGES := kmod-mt7915-firmware kmod-usb3 kmod-usb-audio
IMAGE_SIZE := 254720k
IMAGES += factory.bin
IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \
check-size
endef
TARGET_DEVICES += c-life_xg1
define Device/comfast_cf-e390ax
$(Device/dsa-migration)
$(Device/uimage-lzma-loader)
@@ -89,6 +89,7 @@ ramips_setup_interfaces()
asiarf,ap7621-nv1|\
beeline,smartbox-flash|\
beeline,smartbox-giga|\
c-life,xg1|\
elecom,wmc-x1800gst|\
elecom,wrc-x1800gs|\
gemtek,wvrtm-127acn|\
@@ -41,6 +41,9 @@ case "$board" in
[ "$PHYNBR" = "1" ] && \
macaddr_add $lan_mac_addr 8 > /sys${DEVPATH}/macaddress
;;
c-life,xg1)
[ "$PHYNBR" = "1" ] && macaddr_setbit_la "$(macaddr_add $(get_mac_label) 1)" > /sys${DEVPATH}/macaddress
;;
comfast,cf-e390ax)
[ "$PHYNBR" = "0" ] && echo -n "$(mtd_get_mac_binary factory 0x0004)" > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && echo -n "$(mtd_get_mac_binary factory 0x8004)" > /sys${DEVPATH}/macaddress
@@ -80,6 +80,7 @@ platform_do_upgrade() {
beeline,smartbox-turbo|\
beeline,smartbox-turbo-plus|\
belkin,rt1800|\
c-life,xg1|\
dlink,covr-x1860-a1|\
dlink,dap-x1860-a1|\
dlink,dir-1960-a1|\