mediatek: remove stock layout for 360 t7

The factory bootloader doesn't allow to boot with 3rd-party firmware,
so this "stock" layout is mostly useless.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2023-06-10 16:42:30 +08:00
parent 35289359b2
commit 7944d7a3da
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
8 changed files with 195 additions and 240 deletions

View File

@ -41,8 +41,7 @@ glinet,gl-mt3000)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
;;
livinet,zr-3020|\
qihoo,360-t7-stock|\
qihoo,360-t7-ubootmod)
qihoo,360t7-ubootmod)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" "1"
;;
xiaomi,redmi-router-ax6000|\

View File

@ -4,6 +4,9 @@
*/
/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include "mt7981.dtsi"
/ {
@ -83,14 +86,6 @@
};
};
&uart0 {
status = "okay";
};
&watchdog {
status = "okay";
};
&eth {
status = "okay";
@ -111,10 +106,9 @@
};
&mdio_bus {
switch0: switch@0 {
switch: switch@0 {
compatible = "mediatek,mt7531";
reg = <31>;
dsa,member = <0 0>;
reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>;
interrupt-controller;
#interrupt-cells = <1>;
@ -123,48 +117,6 @@
};
};
&switch0 {
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
label = "wan";
nvmem-cells = <&macaddr_config_50787>;
nvmem-cell-names = "mac-address-ascii";
};
port@2 {
reg = <2>;
label = "lan1";
};
port@3 {
reg = <3>;
label = "lan2";
};
port@4 {
reg = <4>;
label = "lan3";
};
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>;
@ -227,6 +179,7 @@
partition@6680000 {
label = "config2";
reg = <0x6680000 0x100000>;
read-only;
compatible = "nvmem-cells";
#address-cells = <1>;
@ -248,6 +201,48 @@
};
};
&switch {
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
label = "wan";
nvmem-cells = <&macaddr_config_50787>;
nvmem-cell-names = "mac-address-ascii";
};
port@2 {
reg = <2>;
label = "lan1";
};
port@3 {
reg = <3>;
label = "lan2";
};
port@4 {
reg = <4>;
label = "lan3";
};
port@6 {
reg = <6>;
ethernet = <&gmac0>;
phy-mode = "2500base-x";
fixed-link {
speed = <2500>;
full-duplex;
pause;
};
};
};
};
&pio {
i2c_pins: i2c-pins-g0 {
mux {
@ -318,11 +313,19 @@
};
};
&uart0 {
status = "okay";
};
&watchdog {
status = "okay";
};
&wifi {
status = "okay";
mediatek,mtd-eeprom = <&factory 0x0>;
nvmem-cells = <&macaddr_config_5068a>;
nvmem-cell-names = "mac-address-ascii";
status = "okay";
};

View File

@ -1,26 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include "mt7981b-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

@ -1,16 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include "mt7981b-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

@ -1,9 +1,16 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include "mt7981.dtsi"
/ {
model = "Qihoo 360T7 (modified U-Boot layout)";
compatible = "qihoo,360t7-ubootmod", "mediatek,mt7981";
aliases {
led-boot = &red_led;
led-failsafe = &red_led;
@ -47,14 +54,6 @@
};
};
&uart0 {
status = "okay";
};
&watchdog {
status = "okay";
};
&eth {
pinctrl-names = "default";
pinctrl-0 = <&mdio_pins>;
@ -78,10 +77,9 @@
};
&mdio_bus {
switch0: switch@0 {
switch: switch@0 {
compatible = "mediatek,mt7531";
reg = <31>;
dsa,member = <0 0>;
reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>;
interrupt-controller;
#interrupt-cells = <1>;
@ -90,7 +88,92 @@
};
};
&switch0 {
&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 {
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>;
};
factory: partition@180000 {
label = "Factory";
reg = <0x180000 0x200000>;
};
partition@380000 {
label = "FIP";
reg = <0x380000 0x200000>;
};
partition@580000 {
label = "ubi";
reg = <0x580000 0x6c00000>;
};
partition@7180000 {
label = "stock-config";
reg = <0x7180000 0x100000>;
read-only;
};
partition@7280000 {
label = "stock-factory";
reg = <0x7280000 0x80000>;
read-only;
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>;
read-only;
};
};
};
};
&switch {
ports {
#address-cells = <1>;
#size-cells = <0>;
@ -133,83 +216,6 @@
};
};
&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 {
@ -219,24 +225,32 @@
conf-pu {
pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
drive-strength = <MTK_DRIVE_8mA>;
bias-pull-up = <MTK_PUPD_SET_R1R0_11>;
drive-strength = <8>;
bias-pull-up = <103>;
};
conf-pd {
pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
drive-strength = <MTK_DRIVE_8mA>;
bias-pull-down = <MTK_PUPD_SET_R1R0_11>;
drive-strength = <8>;
bias-pull-down = <103>;
};
};
};
&uart0 {
status = "okay";
};
&watchdog {
status = "okay";
};
&wifi {
status = "okay";
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,17 +14,15 @@ mediatek_setup_interfaces()
bananapi,bpi-r3)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 sfp2" "eth1 wan"
;;
cudy,wr3000-v1)
cudy,wr3000-v1|\
livinet,zr-3020|\
qihoo,360t7|\
qihoo,360t7-ubootmod)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan"
;;
glinet,gl-mt3000)
ucidef_set_interfaces_lan_wan eth1 eth0
;;
livinet,zr-3020|\
qihoo,360-t7-stock|\
qihoo,360-t7-ubootmod)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" wan
;;
mediatek,mt7986a-rfb)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan6" "eth1 wan"
;;
@ -34,9 +32,6 @@ mediatek_setup_interfaces()
mediatek,mt7988a-dsa-10g-spim-snand)
ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" "eth1 eth2"
;;
qihoo,360t7)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" wan
;;
tplink,tl-xdr4288|\
tplink,tl-xdr6088)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5" eth1

View File

@ -36,12 +36,8 @@ 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
;;
qihoo,360t7)
qihoo,360t7|\
qihoo,360t7-ubootmod)
addr=$(mtd_get_mac_ascii factory lanMac)
[ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress

View File

@ -255,41 +255,9 @@ define Device/mediatek_mt7988a-rfb-nand
endef
TARGET_DEVICES += mediatek_mt7988a-rfb-nand
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 := mt7981b-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 := mt7981b-qihoo-360-t7-ubootmod
$(call Device/qihoo_360-t7-common)
endef
TARGET_DEVICES += qihoo_360-t7-ubootmod
define Device/qihoo_360t7
DEVICE_VENDOR := Qihoo
DEVICE_MODEL := 360 T7 (OpenWrt U-Boot layout)
DEVICE_MODEL := 360T7 (OpenWrt U-Boot layout)
DEVICE_DTS := mt7981b-qihoo-360t7
DEVICE_DTS_DIR := ../dts
UBINIZE_OPTS := -E 5
@ -311,6 +279,28 @@ define Device/qihoo_360t7
endef
TARGET_DEVICES += qihoo_360t7
define Device/qihoo_360t7-ubootmod
DEVICE_VENDOR := Qihoo
DEVICE_MODEL := 360T7 (modified U-Boot layout)
DEVICE_DTS := mt7981b-qihoo-360t7-ubootmod
DEVICE_DTS_DIR := ../dts
DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware
SUPPORTED_DEVICES += qihoo,360-t7-ubootmod
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
TARGET_DEVICES += qihoo_360t7-ubootmod
define Device/tplink_tl-xdr-common
DEVICE_VENDOR := TP-Link
DEVICE_DTS_DIR := ../dts