From 058ba4a7d1cc7a6dff7656597f41f4313975b8e2 Mon Sep 17 00:00:00 2001 From: svswmw <47269902+SVSWMW@users.noreply.github.com> Date: Tue, 18 Apr 2023 02:50:39 +0800 Subject: [PATCH] ramips: add support for ZTE E8820S Signed-off-by: Tianling Shen --- target/linux/ramips/dts/mt7621_zte_e8820s.dts | 197 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 19 ++ .../mt7621/base-files/etc/board.d/01_leds | 4 + 3 files changed, 220 insertions(+) create mode 100644 target/linux/ramips/dts/mt7621_zte_e8820s.dts diff --git a/target/linux/ramips/dts/mt7621_zte_e8820s.dts b/target/linux/ramips/dts/mt7621_zte_e8820s.dts new file mode 100644 index 0000000000..4f00bb9d09 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_zte_e8820s.dts @@ -0,0 +1,197 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "zte,e8820s", "mediatek,mt7621-soc"; + model = "ZTE E8820S"; + + aliases { + led-boot = &led_sys; + led-failsafe = &led_sys; + led-running = &led_power; + led-upgrade = &led_power; + label-mac-device = &gmac0; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + leds { + compatible = "gpio-leds"; + + led_power: power { + label = "white:power"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + + led_sys: sys { + label = "white:sys"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + + wlan2g { + label = "white:wlan2g"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + + wlan5g { + label = "white:wlan5g"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_HIGH>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wifi { + label = "wifi"; + gpios = <&gpio 10 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + ubi-concat { + compatible = "mtd-concat"; + devices = <&ubipart0 &ubipart1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + ubi@0 { + label = "ubi"; + reg = <0x0 0x79c0000>; + }; + }; + }; +}; + +&nand { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@80000 { + label = "debug"; + reg = <0x80000 0x80000>; + read-only; + }; + + factory: partition@100000 { + label = "factory"; + reg = <0x100000 0x40000>; + read-only; + }; + + partition@140000 { + label = "kernel"; + reg = <0x140000 0x400000>; + }; + + ubipart0: partition@540000 { + label = "ubipart0"; + reg = <0x540000 0x1c80000>; + }; + + partition@21c0000 { + label = "bdinfo"; + reg = <0x21c0000 0x80000>; + read-only; + }; + + ubipart1: partition@2240000 { + label = "ubipart1"; + reg = <0x2240000 0x5d40000>; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "pci14c3,7603"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + ieee80211-freq-limit = <2400000 2500000>; + }; +}; + +&pcie1 { + wifi@0,0 { + compatible = "pci14c3,7662"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +&gmac0 { + mtd-mac-address = <&factory 0xe006>; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "lan1"; + }; + + port@1 { + status = "okay"; + label = "lan2"; + }; + + port@2 { + status = "okay"; + label = "lan3"; + }; + + port@3 { + status = "okay"; + label = "lan4"; + }; + + port@4 { + status = "okay"; + label = "wan"; + mtd-mac-address = <&factory 0xe000>; + }; + }; +}; + +&state_default { + gpio { + groups = "jtag", "uart2", "uart3", "wdt"; + function = "gpio"; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 26bf091a89..0abdb68f83 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1799,6 +1799,25 @@ define Device/zio_freezio endef TARGET_DEVICES += zio_freezio +define Device/zte_e8820s + $(Device/dsa-migration) + $(Device/uimage-lzma-loader) + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_SIZE := 4096k + UBINIZE_OPTS := -E 5 + IMAGE_SIZE := 32768k + IMAGES += factory.bin + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ + check-size + DEVICE_VENDOR := ZTE + DEVICE_MODEL := E8820S + DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 kmod-usb3 \ + kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += zte_e8820s + define Device/zyxel_nr7101 $(Device/dsa-migration) BLOCKSIZE := 128k diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index c21394547f..d506f24e7a 100755 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -123,6 +123,10 @@ xiaomi,redmi-router-ac2100) youhua,wr1200js) ucidef_set_led_netdev "internet" "INTERNET" "green:wan" "wan" ;; +zte,e8820s) + ucidef_set_led_netdev "wlan2g" "WiFi 2.4GHz" "white:wlan2g" "wlan0" + ucidef_set_led_netdev "wlan5g" "WiFi 5GHz" "white:wlan5g" "wlan1" + ;; esac board_config_flush