aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--package/boot/uboot-envtools/files/mediatek_filogic17
-rw-r--r--target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-emmc.dtso43
-rw-r--r--target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-nand.dtso128
-rw-r--r--target/linux/mediatek/dts/mt7981b-cmcc-rax3000m.dts156
-rw-r--r--target/linux/mediatek/filogic/base-files/etc/board.d/02_network10
-rw-r--r--target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata11
-rw-r--r--target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac11
-rwxr-xr-xtarget/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh18
-rw-r--r--target/linux/mediatek/image/filogic.mk33
9 files changed, 425 insertions, 2 deletions
diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic
index f13beed526..6e39fac657 100644
--- a/package/boot/uboot-envtools/files/mediatek_filogic
+++ b/package/boot/uboot-envtools/files/mediatek_filogic
@@ -37,6 +37,23 @@ bananapi,bpi-r3)
;;
esac
;;
+cmcc,rax3000m)
+ case "$(cmdline_get_var root)" in
+ /dev/mmc*)
+ local envdev=$(find_mmc_part "ubootenv" "mmcblk0")
+ ubootenv_add_uci_config "$envdev" "0x0" "0x40000" "0x40000" "1"
+ ubootenv_add_uci_config "$envdev" "0x40000" "0x40000" "0x40000" "1"
+ ;;
+ *)
+ . /lib/upgrade/nand.sh
+ local envubi=$(nand_find_ubi ubi)
+ local envdev=/dev/$(nand_find_volume $envubi ubootenv)
+ local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
+ ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x1f000" "1"
+ ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x1f000" "1"
+ ;;
+ esac
+ ;;
glinet,gl-mt3000)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
;;
diff --git a/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-emmc.dtso b/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-emmc.dtso
new file mode 100644
index 0000000000..c1c9c75c27
--- /dev/null
+++ b/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-emmc.dtso
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+/plugin/;
+
+/ {
+ compatible = "cmcc,rax3000m", "mediatek,mt7981";
+
+ fragment@0 {
+ target = <&mmc0>;
+ __overlay__ {
+ bus-width = <8>;
+ max-frequency = <26000000>;
+ 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>;
+ status = "okay";
+ };
+ };
+
+ fragment@1 {
+ target = <&pio>;
+ __overlay__ {
+ mmc0_pins_default: mmc0-pins {
+ mux {
+ function = "flash";
+ groups = "emmc_45";
+ };
+ };
+
+ mmc0_pins_uhs: mmc0-uhs-pins {
+ mux {
+ function = "flash";
+ groups = "emmc_45";
+ };
+ };
+ };
+ };
+};
diff --git a/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-nand.dtso b/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-nand.dtso
new file mode 100644
index 0000000000..ff94a550fd
--- /dev/null
+++ b/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-nand.dtso
@@ -0,0 +1,128 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+/plugin/;
+
+/ {
+ compatible = "cmcc,rax3000m", "mediatek,mt7981";
+
+ fragment@0 {
+ target = <&gmac0>;
+ __overlay__ {
+ nvmem-cells = <&macaddr_factory_2a 0>;
+ nvmem-cell-names = "mac-address";
+ };
+ };
+
+ fragment@1 {
+ target = <&gmac1>;
+ __overlay__ {
+ nvmem-cells = <&macaddr_factory_24 0>;
+ nvmem-cell-names = "mac-address";
+ };
+ };
+
+ fragment@2 {
+ target = <&pio>;
+ __overlay__ {
+ spi0_flash_pins: spi0-pins {
+ mux {
+ function = "spi";
+ groups = "spi0", "spi0_wp_hold";
+ };
+
+ conf-pu {
+ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
+ drive-strength = <8>;
+ mediatek,pull-up-adv = <0>; /* bias-disable */
+ };
+
+ conf-pd {
+ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
+ drive-strength = <8>;
+ mediatek,pull-up-adv = <0>; /* bias-disable */
+ };
+ };
+ };
+ };
+
+ fragment@3 {
+ target = <&spi0>;
+ __overlay__ {
+ pinctrl-names = "default";
+ pinctrl-0 = <&spi0_flash_pins>;
+ status = "okay";
+
+ spi_nand@0 {
+ compatible = "spi-nand";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ reg = <0>;
+
+ spi-max-frequency = <52000000>;
+ spi-tx-bus-width = <4>;
+ spi-rx-bus-width = <4>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ label = "bl2";
+ reg = <0x00000 0x0100000>;
+ read-only;
+ };
+
+ partition@100000 {
+ label = "u-boot-env";
+ reg = <0x100000 0x80000>;
+ };
+
+ factory: partition@180000 {
+ label = "factory";
+ reg = <0x180000 0x200000>;
+ read-only;
+
+ compatible = "nvmem-cells";
+ nvmem-layout {
+ compatible = "fixed-layout";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ macaddr_factory_24: macaddr@24 {
+ compatible = "mac-base";
+ reg = <0x24 0x6>;
+ #nvmem-cell-cells = <1>;
+ };
+
+ macaddr_factory_2a: macaddr@2a {
+ compatible = "mac-base";
+ reg = <0x2a 0x6>;
+ #nvmem-cell-cells = <1>;
+ };
+ };
+ };
+
+ partition@380000 {
+ label = "fip";
+ reg = <0x380000 0x200000>;
+ read-only;
+ };
+
+ partition@580000 {
+ label = "ubi";
+ reg = <0x580000 0x7200000>;
+ };
+ };
+ };
+ };
+ };
+
+ fragment@4 {
+ target = <&wifi>;
+ __overlay__ {
+ mediatek,mtd-eeprom = <&factory 0x0>;
+ };
+ };
+};
diff --git a/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m.dts b/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m.dts
new file mode 100644
index 0000000000..e9c850e85b
--- /dev/null
+++ b/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m.dts
@@ -0,0 +1,156 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/*
+ * Copyright (C) 2023 Tianling Shen <cnsztl@immortalwrt.org>
+ */
+
+/dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+#include "mt7981.dtsi"
+
+/ {
+ model = "CMCC RAX3000M";
+ compatible = "cmcc,rax3000m", "mediatek,mt7981";
+
+ aliases {
+ led-boot = &red_led;
+ led-failsafe = &red_led;
+ led-running = &green_led;
+ led-upgrade = &green_led;
+ serial0 = &uart0;
+ };
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+
+ memory {
+ reg = <0 0x40000000 0 0x20000000>;
+ };
+
+ gpio-keys {
+ compatible = "gpio-keys";
+
+ button-reset {
+ label = "reset";
+ linux,code = <KEY_RESTART>;
+ gpios = <&pio 1 GPIO_ACTIVE_LOW>;
+ };
+
+ button-mesh {
+ label = "mesh";
+ linux,code = <BTN_9>;
+ linux,input-type = <EV_SW>;
+ gpios = <&pio 0 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ gpio-leds {
+ compatible = "gpio-leds";
+
+ green_led: led-0 {
+ label = "green:status";
+ gpios = <&pio 9 GPIO_ACTIVE_LOW>;
+ };
+
+ led-1 {
+ label = "blue:status";
+ gpios = <&pio 12 GPIO_ACTIVE_LOW>;
+ };
+
+ red_led: led-2 {
+ label = "red:status";
+ gpios = <&pio 35 GPIO_ACTIVE_LOW>;
+ };
+ };
+};
+
+&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 = <&int_gbe_phy>;
+ };
+};
+
+&mdio_bus {
+ switch: switch@0 {
+ compatible = "mediatek,mt7531";
+ reg = <31>;
+ reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>;
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ interrupt-parent = <&pio>;
+ interrupts = <38 IRQ_TYPE_LEVEL_HIGH>;
+ };
+};
+
+&switch {
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+ label = "lan3";
+ };
+
+ port@1 {
+ reg = <1>;
+ label = "lan2";
+ };
+
+ port@2 {
+ reg = <2>;
+ label = "lan1";
+ };
+
+ port@6 {
+ reg = <6>;
+ ethernet = <&gmac0>;
+ phy-mode = "2500base-x";
+
+ fixed-link {
+ speed = <2500>;
+ full-duplex;
+ pause;
+ };
+ };
+ };
+};
+
+&uart0 {
+ status = "okay";
+};
+
+&usb_phy {
+ status = "okay";
+};
+
+&watchdog {
+ status = "okay";
+};
+
+&wifi {
+ status = "okay";
+};
+
+&xhci {
+ status = "okay";
+};
diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
index 60c0bbc7e9..93e69e5c85 100644
--- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
+++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
@@ -28,6 +28,7 @@ mediatek_setup_interfaces()
glinet,gl-mt3000)
ucidef_set_interfaces_lan_wan eth1 eth0
;;
+ cmcc,rax3000m|\
h3c,magic-nx30-pro)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" eth1
;;
@@ -83,6 +84,15 @@ mediatek_setup_macs()
bananapi,bpi-r3)
wan_mac=$(macaddr_add $(cat /sys/class/net/eth0/address) 1)
;;
+ cmcc,rax3000m)
+ case "$(cmdline_get_var root)" in
+ /dev/mmc*)
+ wan_mac=$(mmc_get_mac_binary factory 0x2a)
+ lan_mac=$(mmc_get_mac_binary factory 0x24)
+ label_mac=$wan_mac
+ ;;
+ esac
+ ;;
h3c,magic-nx30-pro)
wan_mac=$(mtd_get_mac_ascii pdt_data_1 ethaddr)
lan_mac=$(macaddr_add "$wan_mac" 1)
diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata
index c3d7c09974..57e5670543 100644
--- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata
+++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata
@@ -14,6 +14,17 @@ case "$FIRMWARE" in
;;
esac
;;
+"mediatek/mt7981_eeprom_mt7976_dbdc.bin")
+ case "$board" in
+ cmcc,rax3000m)
+ case "$(cmdline_get_var root)" in
+ /dev/mmc*)
+ caldata_extract_mmc "factory" 0x0 0x1000
+ ;;
+ esac
+ ;;
+ esac
+ ;;
"mediatek/mt7986_eeprom_mt7976.bin")
case "$board" in
acer,predator-w6)
diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
index ebf76640c8..a1d51a548e 100644
--- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
+++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
@@ -30,6 +30,17 @@ case "$board" in
[ "$PHYNBR" = "0" ] && macaddr_unsetbit $addr 6 > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && macaddr_setbit $addr 6 > /sys${DEVPATH}/macaddress
;;
+ cmcc,rax3000m)
+ case "$(cmdline_get_var root)" in
+ /dev/mmc*)
+ addr=$(mmc_get_mac_binary factory 0xa)
+ ;;
+ *)
+ addr=$(mtd_get_mac_binary factory 0xa)
+ ;;
+ esac
+ [ "$PHYNBR" = "1" ] && echo "$addr" > /sys${DEVPATH}/macaddress
+ ;;
cudy,wr3000-v1)
addr=$(mtd_get_mac_binary bdinfo 0xde00)
# Originally, phy0 is phy1 mac with LA bit set. However, this would conflict
diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
index c492f834bf..201fd0cb5e 100755
--- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
+++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
@@ -81,6 +81,18 @@ platform_do_upgrade() {
;;
esac
;;
+ cmcc,rax3000m)
+ case "$(cmdline_get_var root)" in
+ /dev/mmc*)
+ CI_KERNPART="production"
+ emmc_do_upgrade "$1"
+ ;;
+ *)
+ CI_KERNPART="fit"
+ nand_do_upgrade "$1"
+ ;;
+ esac
+ ;;
cudy,wr3000-v1)
default_do_upgrade "$1"
;;
@@ -121,7 +133,8 @@ platform_check_image() {
[ "$#" -gt 1 ] && return 1
case "$board" in
- bananapi,bpi-r3)
+ bananapi,bpi-r3|\
+ cmcc,rax3000m)
[ "$magic" != "d00dfeed" ] && {
echo "Invalid image type."
return 1
@@ -139,7 +152,8 @@ platform_check_image() {
platform_copy_config() {
case "$(board_name)" in
- bananapi,bpi-r3)
+ bananapi,bpi-r3|\
+ cmcc,rax3000m)
case "$(cmdline_get_var root)" in
/dev/mmc*)
emmc_copy_config
diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk
index 1462186028..0f0f311970 100644
--- a/target/linux/mediatek/image/filogic.mk
+++ b/target/linux/mediatek/image/filogic.mk
@@ -172,6 +172,39 @@ define Device/bananapi_bpi-r3
endef
TARGET_DEVICES += bananapi_bpi-r3
+define Device/cmcc_rax3000m
+ DEVICE_VENDOR := CMCC
+ DEVICE_MODEL := RAX3000M
+ DEVICE_DTS := mt7981b-cmcc-rax3000m
+ DEVICE_DTS_OVERLAY := mt7981b-cmcc-rax3000m-emmc mt7981b-cmcc-rax3000m-nand
+ DEVICE_DTS_DIR := ../dts
+ DEVICE_DTC_FLAGS := --pad 4096
+ DEVICE_DTS_LOADADDR := 0x43f00000
+ DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware kmod-usb3 \
+ e2fsprogs f2fsck mkf2fs
+ KERNEL_LOADADDR := 0x44000000
+ KERNEL := kernel-bin | gzip
+ KERNEL_INITRAMFS := kernel-bin | lzma | \
+ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
+ KERNEL_INITRAMFS_SUFFIX := -recovery.itb
+ KERNEL_IN_UBI := 1
+ UBOOTENV_IN_UBI := 1
+ IMAGES := sysupgrade.itb
+ IMAGE_SIZE := $$(shell expr 64 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m
+ IMAGE/sysupgrade.itb := append-kernel | \
+ fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | \
+ pad-rootfs | append-metadata
+ ARTIFACTS := \
+ emmc-gpt.bin emmc-preloader.bin emmc-bl31-uboot.fip \
+ nand-preloader.bin nand-bl31-uboot.fip
+ ARTIFACT/emmc-gpt.bin := mt798x-gpt emmc
+ ARTIFACT/emmc-preloader.bin := mt7981-bl2 emmc-ddr4
+ ARTIFACT/emmc-bl31-uboot.fip := mt7981-bl31-uboot cmcc_rax3000m-emmc
+ ARTIFACT/nand-preloader.bin := mt7981-bl2 spim-nand-ddr4
+ ARTIFACT/nand-bl31-uboot.fip := mt7981-bl31-uboot cmcc_rax3000m-nand
+endef
+TARGET_DEVICES += cmcc_rax3000m
+
define Device/cudy_wr3000-v1
DEVICE_VENDOR := Cudy
DEVICE_MODEL := WR3000