mediatek: add Qihoo 360 T7 support

Co-authored-by: Chen Minqiang <ptpt52@gmail.com>
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2023-05-12 18:00:42 +08:00
parent d5a91a330a
commit 0e0de4f8b3
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
7 changed files with 328 additions and 2 deletions

View File

@ -37,7 +37,9 @@ bananapi,bpi-r3)
;;
esac
;;
livinet,zr-3020)
livinet,zr-3020|\
qihoo,360-t7-stock|\
qihoo,360-t7-ubootmod)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" "1"
;;
xiaomi,redmi-router-ax6000|\

View File

@ -0,0 +1,26 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include "mt7981-qihoo-360-t7.dtsi"
/ {
model = "Qihoo 360 T7 (stock layout)";
compatible = "qihoo,360-t7-stock", "mediatek,mt7981";
};
&partitions {
partition@580000 {
label = "ubi";
reg = <0x580000 0x2400000>;
};
partition@2980000 {
label = "firmware-1";
reg = <0x2980000 0x2400000>;
};
partition@4D80000 {
label = "plugin";
reg = <0x4d80000 0x2400000>;
};
};

View File

@ -0,0 +1,16 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include "mt7981-qihoo-360-t7.dtsi"
/ {
model = "Qihoo 360 T7 (modified U-Boot layout)";
compatible = "qihoo,360-t7-ubootmod", "mediatek,mt7981";
};
&partitions {
partition@580000 {
label = "ubi";
reg = <0x580000 0x6c00000>;
};
};

View File

@ -0,0 +1,238 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include "mt7981.dtsi"
/ {
aliases {
led-boot = &red_led;
led-failsafe = &red_led;
led-running = &green_led;
led-upgrade = &green_led;
serial0 = &uart0;
};
chosen {
stdout-path = "serial0:115200n8";
};
gpio-keys {
compatible = "gpio-keys";
button-reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&pio 1 GPIO_ACTIVE_LOW>;
};
button-wps {
label = "wps";
linux,code = <KEY_WPS_BUTTON>;
gpios = <&pio 0 GPIO_ACTIVE_LOW>;
};
};
gpio-leds {
compatible = "gpio-leds";
red_led: led-0 {
label = "red:system";
gpios = <&pio 3 GPIO_ACTIVE_LOW>;
};
green_led: led-1 {
label = "green:system";
gpios = <&pio 7 GPIO_ACTIVE_LOW>;
};
};
};
&uart0 {
status = "okay";
};
&watchdog {
status = "okay";
};
&eth {
pinctrl-names = "default";
pinctrl-0 = <&mdio_pins>;
status = "okay";
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
phy-mode = "2500base-x";
nvmem-cells = <&macaddr_factory_14>;
nvmem-cell-names = "mac-address-ascii";
fixed-link {
speed = <2500>;
full-duplex;
pause;
};
};
};
&mdio_bus {
switch0: switch@0 {
compatible = "mediatek,mt7531";
reg = <31>;
dsa,member = <0 0>;
reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>;
interrupt-controller;
#interrupt-cells = <1>;
interrupt-parent = <&pio>;
interrupts = <38 IRQ_TYPE_LEVEL_HIGH>;
};
};
&switch0 {
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
label = "lan1";
};
port@1 {
reg = <1>;
label = "lan2";
};
port@2 {
reg = <2>;
label = "lan3";
};
port@4 {
reg = <4>;
label = "wan";
};
port@6 {
reg = <6>;
ethernet = <&gmac0>;
phy-mode = "2500base-x";
fixed-link {
speed = <2500>;
full-duplex;
pause;
};
};
};
};
&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-buswidth = <4>;
spi-rx-buswidth = <4>;
mediatek,nmbm;
mediatek,bmt-max-ratio = <1>;
mediatek,bmt-max-reserved-blocks = <64>;
partitions: partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "BL2";
reg = <0x00 0x100000>;
};
partition@100000 {
label = "u-boot-env";
reg = <0x100000 0x80000>;
};
factory: partition@180000 {
label = "Factory";
reg = <0x180000 0x200000>;
};
partition@380000 {
label = "FIP";
reg = <0x380000 0x200000>;
};
partition@7180000 {
label = "stock-config";
reg = <0x7180000 0x100000>;
};
partition@7280000 {
label = "stock-factory";
reg = <0x7280000 0x80000>;
compatible = "nvmem-cells";
#address-cells = <1>;
#size-cells = <1>;
macaddr_factory_14: macaddr@14 {
reg = <0x14 0x11>;
};
};
partition@7300000 {
label = "stock-log";
reg = <0x7300000 0x400000>;
};
};
};
};
&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>;
};
};
};
&wifi {
mediatek,mtd-eeprom = <&factory 0x0>;
nvmem-cells = <&macaddr_factory_14>;
nvmem-cell-names = "mac-address-ascii";
mac-address-increment = <2>;
status = "okay";
};

View File

@ -14,7 +14,9 @@ mediatek_setup_interfaces()
bananapi,bpi-r3)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 sfp2" "eth1 wan"
;;
livinet,zr-3020)
livinet,zr-3020|\
qihoo,360-t7-stock|\
qihoo,360-t7-ubootmod)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" wan
;;
mediatek,mt7986a-rfb)
@ -61,6 +63,11 @@ mediatek_setup_macs()
livinet,zr-3020)
wan_mac=$(mtd_get_mac_ascii config2 wanmac)
;;
qihoo,360-t7-stock|\
qihoo,360-t7-ubootmod)
wan_mac=$(macaddr_add $(cat /sys/class/net/eth0/address) 1)
label_mac=$wan_mac
;;
xiaomi,redmi-router-ax6000|\
xiaomi,redmi-router-ax6000-stock|\
xiaomi,redmi-router-ax6000-ubootmod)

View File

@ -28,6 +28,11 @@ case "$board" in
addr=$(mtd_get_mac_ascii config2 wifi5gmac)
[ "$PHYNBR" = "1" ] && echo $macaddr > /sys${DEVPATH}/macaddress
;;
qihoo,360-t7-stock|\
qihoo,360-t7-ubootmod)
addr=$(macaddr_add $(cat /sys/class/net/eth0/address) 2)
[ "$PHYNBR" = "1" ] && macaddr_setbit $addr 6 > /sys${DEVPATH}/macaddress
;;
tplink,tl-xdr4288|\
tplink,tl-xdr6086|\
tplink,tl-xdr6088)

View File

@ -162,6 +162,38 @@ define Device/mediatek_mt7986b-rfb
endef
TARGET_DEVICES += mediatek_mt7986b-rfb
define Device/qihoo_360-t7-common
DEVICE_VENDOR := Qihoo
DEVICE_DTS_DIR := ../dts
DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware
UBINIZE_OPTS := -E 5
BLOCKSIZE := 128k
PAGESIZE := 2048
IMAGE_SIZE := 65536k
KERNEL_IN_UBI := 1
IMAGES += factory.bin
IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
KERNEL = kernel-bin | lzma | \
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
KERNEL_INITRAMFS = kernel-bin | lzma | \
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd
endef
define Device/qihoo_360-t7-stock
DEVICE_MODEL := 360 T7 (stock layout)
DEVICE_DTS := mt7981-qihoo-360-t7-stock
$(call Device/qihoo_360-t7-common)
endef
TARGET_DEVICES += qihoo_360-t7-stock
define Device/qihoo_360-t7-ubootmod
DEVICE_MODEL := 360 T7 (modified U-Boot layout)
DEVICE_DTS := mt7981-qihoo-360-t7-ubootmod
$(call Device/qihoo_360-t7-common)
endef
TARGET_DEVICES += qihoo_360-t7-ubootmod
define Device/tplink_tl-xdr-common
DEVICE_VENDOR := TP-Link
DEVICE_DTS_DIR := ../dts