diff --git a/.gitignore b/.gitignore index 7e3049b8a6..a59c920dcc 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,5 @@ git-src !/dl/datconf* !/dl/mt79* !/dl/warp* + +.config-* \ No newline at end of file diff --git a/defconfig/mt7981-ax3000.config b/defconfig/mt7981-ax3000.config index 960b6627fd..506b6674fe 100644 --- a/defconfig/mt7981-ax3000.config +++ b/defconfig/mt7981-ax3000.config @@ -61,6 +61,8 @@ CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_ruijie_rg-x30e-pro-firmware2=y CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_ruijie_rg-x30e-pro-firmware2="" CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_ruijie_rg-x30e-pro-stock=y CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_ruijie_rg-x30e-pro-stock="" +CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_sn_r1=y +CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_sn_r1="" CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_xiaomi_mi-router-ax3000t=y CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_xiaomi_mi-router-ax3000t="" CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_xiaomi_mi-router-ax3000t-stock=y diff --git a/package/boot/uboot-envtools/files/mediatek b/package/boot/uboot-envtools/files/mediatek index e111a0f3b6..4afeb4926f 100644 --- a/package/boot/uboot-envtools/files/mediatek +++ b/package/boot/uboot-envtools/files/mediatek @@ -16,7 +16,9 @@ case "$board" in cmcc,rax3000m-emmc |\ cmcc,xr30-emmc |\ glinet,gl-mt6000 |\ -jdcloud,re-cp-03) +jdcloud,re-cp-03 |\ +philips,hy3000 |\ +sn,r1) env_dev=$(find_mmc_part "u-boot-env") [ -n "$env_dev" ] && ubootenv_add_uci_config "$env_dev" "0" "0x80000" ;; diff --git a/package/mtk/applications/mtk-smp/files/smp.sh b/package/mtk/applications/mtk-smp/files/smp.sh index 5607688ccd..0f394c50e9 100755 --- a/package/mtk/applications/mtk-smp/files/smp.sh +++ b/package/mtk/applications/mtk-smp/files/smp.sh @@ -765,6 +765,8 @@ setup_model() newland,nl-wr9103 |\ nradio,wt9103 |\ ruijie,rg-x30e* |\ + philips,hy3000 |\ + sn,r1 |\ *7981*) MT7981_whnat $num_of_wifi $usbnet ;; diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-sn-r1.dts b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-sn-r1.dts new file mode 100644 index 0000000000..6e4b9c6299 --- /dev/null +++ b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-sn-r1.dts @@ -0,0 +1,218 @@ +/dts-v1/; +#include "mt7981.dtsi" + +/ { + model = "SN R1"; + compatible = "sn,r1", "mediatek,mt7981"; + + chosen { + bootargs = "console=ttyS0,115200n1 loglevel=8 \ + earlycon=uart8250,mmio32,0x11002000 \ + root=PARTLABEL=rootfs rootfstype=squashfs,f2fs"; + }; + + aliases { + led-boot = &status_red_led; + led-failsafe = &status_red_led; + led-running = &status_blue_led; + led-upgrade = &status_yellow_led; + }; + + leds { + compatible = "gpio-leds"; + + status_blue_led: led-0 { + label = "blue:status"; + gpios = <&pio 11 GPIO_ACTIVE_HIGH>; + }; + + status_yellow_led: led-1 { + label = "yellow:status"; + gpios = <&pio 12 GPIO_ACTIVE_HIGH>; + }; + + status_red_led: led-2 { + label = "red:status"; + gpios = <&pio 13 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "wps"; + gpios = <&pio 0 GPIO_ACTIVE_HIGH>; + linux,code = ; + linux,input-type = ; + }; + }; + + memory { + reg = <0 0x40000000 0 0x10000000>; + }; + + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "fixed-3.3V"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + regulator-always-on; + }; + + gsw: gsw@0 { + compatible = "mediatek,mt753x"; + mediatek,ethsys = <ðsys>; + #address-cells = <1>; + #size-cells = <0>; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +ð { + 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,portmap = "wllll"; + mediatek,mdio_master_pinmux = <0>; + reset-gpios = <&pio 39 0>; + interrupt-parent = <&pio>; + interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; + status = "okay"; + + port5: port@5 { + compatible = "mediatek,mt753x-port"; + reg = <5>; + phy-mode = "sgmii"; + + fixed-link { + speed = <2500>; + full-duplex; + }; + }; + + port6: port@6 { + compatible = "mediatek,mt753x-port"; + mediatek,ssc-on; + reg = <6>; + phy-mode = "sgmii"; + + fixed-link { + speed = <2500>; + full-duplex; + }; + }; +}; + +&hnat { + mtketh-wan = "eth0.2"; + mtketh-ppd = "eth0.1"; + mtketh-lan = "eth0"; + mtketh-max-gmac = <1>; + status = "okay"; +}; + +&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 = <®_3p3v>; + non-removable; + status = "okay"; +}; + +&spi1 { + pinctrl-names = "default"; + pinctrl-0 = <&spic_pins>; + status = "disabled"; +}; + +&pio { + spic_pins: spi1-pins { + mux { + function = "spi"; + groups = "spi1_1"; + }; + }; + + mmc0_pins_default: mmc0-pins-default { + mux { + function = "flash"; + groups = "emmc_45"; + }; + }; + + mmc0_pins_uhs: mmc0-pins-uhs { + mux { + function = "flash"; + groups = "emmc_45"; + }; + }; + + pcie_pins: pcie-pins { + mux { + function = "pcie"; + groups = "pcie_pereset", "pcie_clk", "pcie_wake"; + }; + }; +}; + +&pcie { + pinctrl-names = "default"; + pinctrl-0 = <&pcie_pins>; + status = "okay"; +}; \ No newline at end of file diff --git a/target/linux/mediatek/image/mt7981.mk b/target/linux/mediatek/image/mt7981.mk index c941ae9de0..1c74a0fd0f 100644 --- a/target/linux/mediatek/image/mt7981.mk +++ b/target/linux/mediatek/image/mt7981.mk @@ -821,3 +821,15 @@ define Device/routerich_ax3000 DEVICE_PACKAGES := $(MT7981_USB_PKGS) endef TARGET_DEVICES += routerich_ax3000 + +define Device/sn_r1 + DEVICE_VENDOR := SN + DEVICE_MODEL := R1 + DEVICE_DTS := mt7981-sn-r1 + DEVICE_DTS_DIR := $(DTS_DIR)/mediatek + SUPPORTED_DEVICES := sn,r1 + DEVICE_PACKAGES := f2fsck losetup mkf2fs f2fs-tools kmod-fs-f2fs kmod-mmc \ + luci-app-samba4 e2fsprogs kmod-nvme mmc-utils + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += sn_r1 diff --git a/target/linux/mediatek/mt7981/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7981/base-files/etc/board.d/02_network index a09138f983..4b9991b394 100755 --- a/target/linux/mediatek/mt7981/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/mt7981/base-files/etc/board.d/02_network @@ -103,6 +103,11 @@ mediatek_setup_interfaces() ucidef_add_switch "switch0" \ "0:lan:1" "2:lan:2" "3:lan:3" "4:wan" "6u@eth0" "5u@eth1" ;; + sn,r1) + ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" + ucidef_add_switch "switch0" \ + "1:lan" "2:lan" "3:lan" "4:lan:4" "0:wan" "6t@eth0" + ;; ikuai,q3000 |\ ruijie,rg-x30e*) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" wan @@ -280,6 +285,21 @@ mediatek_setup_macs() echo "MacAddress=$b1mac" >> ${b1dat} fi ;; + sn,r1) + lan_mac=$(mmc_get_mac_binary factory 0x2a) + wan_mac=$(mmc_get_mac_binary factory 0x24) + label_mac=$wan_mac + local b0dat="$(l1dat if2dat ra0)" + local b1dat="$(l1dat if2dat rax0)" + if [ -f ${b0dat} ] && ! grep -q "MacAddress=" ${b0dat}; then + local b0mac="$(macaddr_add $lan_mac 2)" + echo "MacAddress=$b0mac" >> ${b0dat} + fi + if [ -f ${b1dat} ] && ! grep -q "MacAddress=" ${b1dat}; then + local b1mac="$(macaddr_add $lan_mac 3)" + echo "MacAddress=$b1mac" >> ${b1dat} + fi + ;; ikuai,q3000) wan_mac=$(mtd_get_mac_binary $part_name 0x10048) lan_mac=$(macaddr_add $wan_mac 1) diff --git a/target/linux/mediatek/mt7981/base-files/lib/preinit/90_extract_caldata b/target/linux/mediatek/mt7981/base-files/lib/preinit/90_extract_caldata index 1179856abd..298ac7a047 100644 --- a/target/linux/mediatek/mt7981/base-files/lib/preinit/90_extract_caldata +++ b/target/linux/mediatek/mt7981/base-files/lib/preinit/90_extract_caldata @@ -18,7 +18,8 @@ do_extract_caldata() { case $(board_name) in cmcc,xr30-emmc |\ cmcc,rax3000m-emmc |\ - philips,hy3000) + philips,hy3000 |\ + sn,r1) FIRMWARE=MT7981_iPAiLNA_EEPROM.bin caldata_validate && exit 0 caldata_extract_mmc "factory" 0x0 0x1000 diff --git a/target/linux/mediatek/mt7981/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7981/base-files/lib/upgrade/platform.sh index 038dc06edc..611795c19a 100644 --- a/target/linux/mediatek/mt7981/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/mt7981/base-files/lib/upgrade/platform.sh @@ -220,6 +220,7 @@ platform_do_upgrade() { cmcc,rax3000m-emmc |\ cmcc,xr30-emmc |\ philips,hy3000 |\ + sn,r1 |\ *emmc*) CI_KERNPART="kernel" CI_ROOTPART="rootfs" @@ -271,6 +272,7 @@ platform_check_image() { newland,nl-wr9103 |\ nradio,wt9103 |\ philips,hy3000 |\ + sn,r1 |\ *snand* |\ *emmc* |\ routerich,ax3000)