mediatek: add ABT ASR3000 support

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2023-10-19 16:06:18 +08:00 committed by hanwckf
parent 4b7d660416
commit 0713c653e7
7 changed files with 285 additions and 0 deletions

View File

@ -1,6 +1,8 @@
CONFIG_TARGET_mediatek=y
CONFIG_TARGET_mediatek_mt7981=y
CONFIG_TARGET_MULTI_PROFILE=y
CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_abt_asr3000=y
CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_abt_asr3000=""
CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_cetron_ct3003=y
CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_cetron_ct3003=""
CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_cmcc_rax3000m=y

View File

@ -719,6 +719,7 @@ setup_model()
*mt2500* |\
*zr-3020* |\
*360,t7* |\
abt,asr3000* |\
xiaomi,mi-router-wr30u* |\
*rax3000m* |\
h3c,nx30pro |\

View File

@ -0,0 +1,249 @@
// 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 = "ABT ASR3000";
compatible = "abt,asr3000", "mediatek,mt7981";
aliases {
led-boot = &mesh_led;
led-failsafe = &mesh_led;
led-upgrade = &mesh_led;
};
chosen {
bootargs = "console=ttyS0,115200n1 loglevel=8 earlycon=uart8250,mmio32,0x11002000";
};
memory {
reg = <0 0x40000000 0 0x10000000>;
};
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_HIGH>;
};
};
gpio-leds {
compatible = "gpio-leds";
led-0 {
label = "red:wan";
gpios = <&pio 4 GPIO_ACTIVE_LOW>;
};
led-1 {
label = "green:wan";
gpios = <&pio 8 GPIO_ACTIVE_LOW>;
};
mesh_led: led-2 {
label = "green:mesh";
gpios = <&pio 15 GPIO_ACTIVE_LOW>;
};
led-3 {
label = "green:wlan2g";
gpios = <&pio 34 GPIO_ACTIVE_LOW>;
};
led-4 {
label = "green:wlan5g";
gpios = <&pio 35 GPIO_ACTIVE_LOW>;
};
};
gsw: gsw@0 {
compatible = "mediatek,mt753x";
mediatek,ethsys = <&ethsys>;
#address-cells = <1>;
#size-cells = <0>;
};
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 = <0x00000 0x100000>;
};
partition@100000 {
label = "u-boot-env";
reg = <0x100000 0x80000>;
};
partition@180000 {
label = "art";
reg = <0x180000 0x100000>;
};
factory: partition@280000 {
label = "Factory";
reg = <0x280000 0x100000>;
};
partition@380000 {
label = "FIP";
reg = <0x380000 0x200000>;
};
partition@580000 {
label = "ubi";
reg = <0x580000 0x6e80000>;
};
};
};
};
&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,portmap = "wllll";
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>;
status = "okay";
};
&spi0 {
pinctrl-names = "default";
pinctrl-0 = <&spi0_flash_pins>;
status = "okay";
spi_nand: flash@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "spi-nand";
reg = <0>;
spi-max-frequency = <52000000>;
spi-cal-enable;
spi-cal-mode = "read-data";
spi-cal-datalen = <7>;
spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>;
spi-cal-addrlen = <5>;
spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>;
spi-tx-bus-width = <4>;
spi-rx-bus-width = <4>;
mediatek,nmbm;
mediatek,bmt-max-ratio = <1>;
mediatek,bmt-max-reserved-blocks = <64>;
};
};
&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 = <8>;
bias-pull-up = <103>;
};
conf-pd {
pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
drive-strength = <8>;
bias-pull-down = <103>;
};
};
};
&uart0 {
status = "okay";
};
&watchdog {
status = "okay";
};

View File

@ -206,6 +206,23 @@ define Device/mt7981-360-t7-108M
endef
TARGET_DEVICES += mt7981-360-t7-108M
define Device/abt_asr3000
DEVICE_VENDOR := ABT
DEVICE_MODEL := ASR3000
DEVICE_DTS := mt7981-abt-asr3000
DEVICE_DTS_DIR := $(DTS_DIR)/mediatek
SUPPORTED_DEVICES := abt,asr3000
UBINIZE_OPTS := -E 5
BLOCKSIZE := 128k
PAGESIZE := 2048
IMAGE_SIZE := 114816k
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 += abt_asr3000
define Device/cetron_ct3003
DEVICE_VENDOR := CETRON
DEVICE_MODEL := CT3003

View File

@ -11,6 +11,11 @@ board=$(board_name)
board_config_update
case "$board" in
abt,asr3000)
ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1"
ucidef_set_led_netdev "wlan2g" "WLAN2G" "green:wlan2g" "ra0"
ucidef_set_led_netdev "wlan5g" "WLAN5G" "green:wlan5g" "rax0"
;;
clt,r30b1)
ucidef_set_led_default "green" "GREEN" "r30b1:green" "1"
ucidef_set_led_default "red" "RED" "r30b1:red" "0"

View File

@ -48,6 +48,7 @@ mediatek_setup_interfaces()
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "0:wan" "6t@eth0"
;;
abt,asr3000 |\
h3c,nx30pro |\
*konka,komi-a31*)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
@ -159,6 +160,14 @@ mediatek_setup_macs()
fi
fi
;;
*abt,asr3000*)
label_mac=$(mtd_get_mac_ascii art MAC_ADDRESS)
lan_mac=$label_mac
wan_mac=$label_mac
local wifi_mac="$(macaddr_add $label_mac 1)"
mtk_facrory_write_mac Factory 4 "$wifi_mac"
;;
*cetron,ct3003*)
lan_mac=$(mtd_get_mac_ascii art MAC_ADDRESS)
wan_mac=$(macaddr_add $lan_mac 3)

View File

@ -193,6 +193,7 @@ platform_do_upgrade() {
*mt2500* |\
*zr-3020* |\
*360,t7* |\
*abt,asr3000* |\
*cetron,ct3003* |\
*clt,r30b1* |\
*imou,lc-hx3001* |\
@ -237,6 +238,7 @@ platform_check_image() {
*360,t7* |\
xiaomi,mi-router-wr30u-stock|\
xiaomi,mi-router-wr30u-112m|\
*abt,asr3000* |\
*cetron,ct3003* |\
*clt,r30b1* |\
*imou,lc-hx3001* |\