mediatek: add support for CMCC XR30 and CMCC XR30 eMMC

Hardware specification:
SoC: MediaTek MT7981B 2x A53
Flash: GIGADEVICE GD5F1GM7UExxG  128MB or 64GB eMMC
RAM: DDR4 512MB
Ethernet: 4x 10/100/1000 Mbps
Switch: MediaTek MT7531AE
WiFi: MediaTek MT7976C
Button: Reset, Mesh
Power: DC 12V 1.5A
This commit is contained in:
Aabandon 2024-08-28 11:16:23 +08:00 committed by hanwckf
parent 66ea5bed2d
commit 8fc10f5671
13 changed files with 325 additions and 109 deletions

View File

@ -11,6 +11,10 @@ CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_cmcc_rax3000m-emmc=y
CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_cmcc_rax3000m-emmc=""
CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_cmcc_rax3000m=y
CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_cmcc_rax3000m=""
CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_cmcc_xr30-emmc=y
CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_cmcc_xr30-emmc=""
CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_cmcc_xr30=y
CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_cmcc_xr30=""
CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_h3c_nx30pro=y
CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_h3c_nx30pro=""
CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_honor_fur-602=y

View File

@ -15,6 +15,10 @@ CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_glinet_gl-mt2500=y
CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_glinet_gl-mt2500=""
CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_glinet_gl-mt3000=y
CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_glinet_gl-mt3000=""
CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_cmcc_xr30-emmc=y
CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_cmcc_xr30-emmc=""
CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_cmcc_xr30=y
CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_cmcc_xr30=""
CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_h3c_nx30pro=y
CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_h3c_nx30pro=""
CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_honor_fur-602=y

View File

@ -14,6 +14,7 @@ board=$(board_name)
case "$board" in
cmcc,rax3000m-emmc |\
cmcc,xr30-emmc |\
glinet,gl-mt6000 |\
jdcloud,re-cp-03)
env_dev=$(find_mmc_part "u-boot-env")
@ -29,6 +30,7 @@ livinet,zr-3020*)
h3c,nx30pro |\
*clt,r30b1* |\
ruijie,rg-x60-pro* |\
cmcc,xr30 |\
cmcc,rax3000m)
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x80000" "0x20000" "4"
;;

View File

@ -755,6 +755,7 @@ setup_model()
xiaomi,mi-router-wr30u* |\
xiaomi,mi-router-ax3000t* |\
*rax3000m* |\
*cmcc,xr30* |\
h3c,nx30pro |\
*honor,fur-602* |\
konka,komi-a31 |\

View File

@ -0,0 +1,111 @@
/dts-v1/;
#include "mt7981.dtsi"
/ {
memory {
reg = <0 0x40000000 0 0x20000000>;
};
gpio-keys {
compatible = "gpio-keys";
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&pio 1 GPIO_ACTIVE_LOW>;
};
mesh {
label = "mesh";
gpios = <&pio 0 GPIO_ACTIVE_LOW>;
linux,code = <BTN_9>;
linux,input-type = <EV_SW>;
};
};
gsw: gsw@0 {
compatible = "mediatek,mt753x";
mediatek,ethsys = <&ethsys>;
#address-cells = <1>;
#size-cells = <0>;
};
};
&uart0 {
status = "okay";
};
&watchdog {
status = "okay";
};
&eth {
status = "okay";
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
phy-mode = "2500base-x";
fixed-link {
speed = <2500>;
full-duplex;
pause;
};
};
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
phy-mode = "gmii";
phy-handle = <&phy0>;
};
mdio: mdio-bus {
#address-cells = <1>;
#size-cells = <0>;
phy0: ethernet-phy@0 {
compatible = "ethernet-phy-id03a2.9461";
reg = <0>;
phy-mode = "gmii";
nvmem-cells = <&phy_calibration>;
nvmem-cell-names = "phy-cal-data";
};
};
};
&gsw {
mediatek,mdio = <&mdio>;
mediatek,mdio_master_pinmux = <0>;
reset-gpios = <&pio 39 0>;
interrupt-parent = <&pio>;
interrupts = <38 IRQ_TYPE_LEVEL_HIGH>;
status = "okay";
port6: port@6 {
compatible = "mediatek,mt753x-port";
mediatek,ssc-on;
reg = <6>;
phy-mode = "sgmii";
fixed-link {
speed = <2500>;
full-duplex;
};
};
};
&hnat {
mtketh-wan = "eth1";
mtketh-lan = "eth0";
mtketh-max-gmac = <2>;
ext-devices-prefix = "usb", "wwan";
status = "okay";
};
&xhci {
mediatek,u3p-dis-msk = <0x0>;
phys = <&u2port0 PHY_TYPE_USB2>,
<&u3port0 PHY_TYPE_USB3>;
status = "okay";
};

View File

@ -1,5 +1,5 @@
/dts-v1/;
#include "mt7981.dtsi"
#include "mt7981-cmcc-rax3000m-xr30.dtsi"
/ {
aliases {
@ -9,10 +9,6 @@
led-upgrade = &blue_led;
};
memory {
reg = <0 0x40000000 0 0x20000000>;
};
leds {
compatible = "gpio-leds";
@ -31,107 +27,5 @@
gpios = <&pio 12 GPIO_ACTIVE_LOW>;
};
};
gpio-keys {
compatible = "gpio-keys";
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&pio 1 GPIO_ACTIVE_LOW>;
};
mesh {
label = "mesh";
gpios = <&pio 0 GPIO_ACTIVE_LOW>;
linux,code = <BTN_9>;
linux,input-type = <EV_SW>;
};
};
gsw: gsw@0 {
compatible = "mediatek,mt753x";
mediatek,ethsys = <&ethsys>;
#address-cells = <1>;
#size-cells = <0>;
};
};
&uart0 {
status = "okay";
};
&watchdog {
status = "okay";
};
&eth {
status = "okay";
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
phy-mode = "2500base-x";
fixed-link {
speed = <2500>;
full-duplex;
pause;
};
};
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
phy-mode = "gmii";
phy-handle = <&phy0>;
};
mdio: mdio-bus {
#address-cells = <1>;
#size-cells = <0>;
phy0: ethernet-phy@0 {
compatible = "ethernet-phy-id03a2.9461";
reg = <0>;
phy-mode = "gmii";
nvmem-cells = <&phy_calibration>;
nvmem-cell-names = "phy-cal-data";
};
};
};
&gsw {
mediatek,mdio = <&mdio>;
mediatek,mdio_master_pinmux = <0>;
reset-gpios = <&pio 39 0>;
interrupt-parent = <&pio>;
interrupts = <38 IRQ_TYPE_LEVEL_HIGH>;
status = "okay";
port6: port@6 {
compatible = "mediatek,mt753x-port";
mediatek,ssc-on;
reg = <6>;
phy-mode = "sgmii";
fixed-link {
speed = <2500>;
full-duplex;
};
};
};
&hnat {
mtketh-wan = "eth1";
mtketh-lan = "eth0";
mtketh-max-gmac = <2>;
ext-devices-prefix = "usb", "wwan";
status = "okay";
};
&xhci {
mediatek,u3p-dis-msk = <0x0>;
phys = <&u2port0 PHY_TYPE_USB2>,
<&u3port0 PHY_TYPE_USB3>;
status = "okay";
};

View File

@ -0,0 +1,44 @@
/dts-v1/;
#include "mt7981-cmcc-xr30.dtsi"
/ {
model = "CMCC XR30 eMMC version (RAX3000Z Enhanced version)";
compatible = "cmcc,xr30-emmc", "mediatek,mt7981";
chosen {
bootargs = "console=ttyS0,115200n1 loglevel=8 \
earlycon=uart8250,mmio32,0x11002000 \
root=PARTLABEL=rootfs rootwait rootfstype=squashfs,f2fs";
};
};
&mmc0 {
bus-width = <8>;
cap-mmc-highspeed;
max-frequency = <52000000>;
no-sd;
no-sdio;
non-removable;
pinctrl-names = "default", "state_uhs";
pinctrl-0 = <&mmc0_pins_default>;
pinctrl-1 = <&mmc0_pins_uhs>;
vmmc-supply = <&reg_3p3v>;
non-removable;
status = "okay";
};
&pio {
mmc0_pins_default: mmc0-pins-default {
mux {
function = "flash";
groups = "emmc_45";
};
};
mmc0_pins_uhs: mmc0-pins-uhs {
mux {
function = "flash";
groups = "emmc_45";
};
};
};

View File

@ -0,0 +1,95 @@
/dts-v1/;
#include "mt7981-cmcc-xr30.dtsi"
/ {
model = "CMCC XR30";
compatible = "cmcc,xr30", "mediatek,mt7981";
chosen {
bootargs = "console=ttyS0,115200n1 loglevel=8 \
earlycon=uart8250,mmio32,0x11002000";
};
nmbm_spim_nand {
compatible = "generic,nmbm";
#address-cells = <1>;
#size-cells = <1>;
lower-mtd-device = <&spi_nand>;
forced-create;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "BL2";
reg = <0x0 0x100000>;
};
partition@100000 {
label = "u-boot-env";
reg = <0x100000 0x80000>;
};
partition@180000 {
label = "Factory";
reg = <0x180000 0x200000>;
};
partition@380000 {
label = "FIP";
reg = <0x380000 0x200000>;
};
partition@580000 {
label = "ubi";
reg = <0x580000 0x7200000>;
};
};
};
};
&spi0 {
pinctrl-names = "default";
pinctrl-0 = <&spi0_flash_pins>;
status = "okay";
spi_nand: spi_nand@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "spi-nand";
reg = <0>;
spi-max-frequency = <52000000>;
spi-tx-bus-width = <4>;
spi-rx-bus-width = <4>;
spi-cal-enable;
spi-cal-mode = "read-data";
spi-cal-datalen = <7>;
spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>; /* 'SPINAND' */
spi-cal-addrlen = <5>;
spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>;
};
};
&pio {
spi0_flash_pins: spi0-pins {
mux {
function = "spi";
groups = "spi0", "spi0_wp_hold";
};
conf-pu {
pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
drive-strength = <MTK_DRIVE_8mA>;
bias-pull-up = <MTK_PUPD_SET_R1R0_11>;
};
conf-pd {
pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
drive-strength = <MTK_DRIVE_8mA>;
bias-pull-down = <MTK_PUPD_SET_R1R0_11>;
};
};
};

View File

@ -0,0 +1,25 @@
/dts-v1/;
#include "mt7981-cmcc-rax3000m-xr30.dtsi"
/ {
aliases {
led-boot = &red_led;
led-failsafe = &red_led;
led-running = &white_led;
led-upgrade = &red_led;
};
leds {
compatible = "gpio-leds";
red_led: red {
label = "xr30:red";
gpios = <&pio 35 GPIO_ACTIVE_LOW>;
};
white_led: white {
label = "xr30:white";
gpios = <&pio 34 GPIO_ACTIVE_LOW>;
};
};
};

View File

@ -582,6 +582,36 @@ define Device/cmcc_rax3000m-emmc
endef
TARGET_DEVICES += cmcc_rax3000m-emmc
define Device/cmcc_xr30
DEVICE_VENDOR := CMCC
DEVICE_MODEL := XR30 NAND
DEVICE_DTS := mt7981-cmcc-xr30
DEVICE_DTS_DIR := $(DTS_DIR)/mediatek
DEVICE_PACKAGES := $(MT7981_USB_PKGS) luci-app-samba4
SUPPORTED_DEVICES := cmcc,xr30
UBINIZE_OPTS := -E 5
BLOCKSIZE := 128k
PAGESIZE := 2048
IMAGE_SIZE := 116736k
KERNEL_IN_UBI := 1
IMAGES += factory.bin
IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
endef
TARGET_DEVICES += cmcc_xr30
define Device/cmcc_xr30-emmc
DEVICE_VENDOR := CMCC
DEVICE_MODEL := XR30 eMMC
DEVICE_DTS := mt7981-cmcc-xr30-emmc
DEVICE_DTS_DIR := $(DTS_DIR)/mediatek
SUPPORTED_DEVICES := cmcc,xr30m-emmc
DEVICE_PACKAGES := $(MT7981_USB_PKGS) f2fsck losetup mkf2fs kmod-fs-f2fs kmod-mmc \
luci-app-samba4
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
endef
TARGET_DEVICES += cmcc_xr30-emmc
define Device/h3c_nx30pro
DEVICE_VENDOR := H3C
DEVICE_MODEL := NX30PRO

View File

@ -64,6 +64,7 @@ mediatek_setup_interfaces()
"1:lan" "2:lan" "3:lan" "0:wan" "6t@eth0"
;;
abt,asr3000 |\
*cmcc,xr30* |\
*rax3000m*)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" \
@ -202,9 +203,10 @@ mediatek_setup_macs()
label_mac=$lan_mac
local wifi_mac="$(mtd_get_mac_binary $part_name 0x04)"
;;
cmcc,xr30-emmc|\
cmcc,rax3000m-emmc)
lan_mac=$(mmc_get_mac_binary factory 0x24)
wan_mac=$(mmc_get_mac_binary factory 0x2a)
lan_mac=$(mmc_get_mac_binary factory 0x2a)
wan_mac=$(mmc_get_mac_binary factory 0x24)
label_mac=$wan_mac
;;
*imou,lc-hx3001*)

View File

@ -16,6 +16,7 @@ caldata_validate() {
do_extract_caldata() {
case $(board_name) in
cmcc,xr30-emmc |\
cmcc,rax3000m-emmc |\
ruijie,rg-x30e*)
FIRMWARE=MT7981_iPAiLNA_EEPROM.bin

View File

@ -204,6 +204,7 @@ platform_do_upgrade() {
nradio,wt9103 |\
cmcc,a10 |\
cmcc,rax3000m |\
cmcc,xr30 |\
h3c,nx30pro |\
*honor,fur-602* |\
*konka,komi-a31* |\
@ -215,6 +216,7 @@ platform_do_upgrade() {
nand_do_upgrade "$1"
;;
cmcc,rax3000m-emmc |\
cmcc,xr30-emmc |\
*emmc*)
CI_KERNPART="kernel"
CI_ROOTPART="rootfs"
@ -256,6 +258,7 @@ platform_check_image() {
*jcg,q30* |\
cmcc,a10 |\
cmcc,rax3000m* |\
cmcc,xr30* |\
h3c,nx30pro |\
*honor,fur-602* |\
*konka,komi-a31* |\