diff --git a/target/linux/mediatek/dts/mt7981b-huasifei-wh3000r-nand.dts b/target/linux/mediatek/dts/mt7981b-huasifei-wh3000r-nand.dts new file mode 100644 index 00000000000..f999ab516fb --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-huasifei-wh3000r-nand.dts @@ -0,0 +1,292 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include +#include +#include + +#include "mt7981b.dtsi" + +/ { + model = "Huasifei WH3000R NAND"; + compatible = "huasifei,wh3000r-nand", "mediatek,mt7981"; + + aliases { + label-mac-device = &gmac1; + + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_status; + led-upgrade = &led_power; + + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory { + reg = <0 0x40000000 0 0x20000000>; + device_type = "memory"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + button-mesh { + label = "mesh"; + linux,code = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + button-reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + led_power: led_power { + function = LED_FUNCTION_POWER; + color = ; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + + led_status: led_status { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + + led_internet { + function = LED_FUNCTION_WAN_ONLINE; + color = ; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + }; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + nvmem-cells = <&macaddr_factory_4 1>; + nvmem-cell-names = "mac-address"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "gmii"; + nvmem-cells = <&macaddr_factory_4 0>; + nvmem-cell-names = "mac-address"; + phy-handle = <&phy0>; + label = "wan"; + }; + + 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"; + }; + + switch: switch@1f { + compatible = "mediatek,mt7531"; + reg = <0x1f>; + reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; + }; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + spi_nand@0 { + compatible = "spi-nand"; + reg = <0>; + + spi-max-frequency = <52000000>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + + 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>; + + 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 = <0x0 0x100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x100000 0x80000>; + read-only; + }; + + partition@180000 { + label = "Factory"; + reg = <0x180000 0x200000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + + macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + partition@380000 { + label = "FIP"; + reg = <0x380000 0x200000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + reg = <0x580000 0xe280000>; + }; + }; + }; +}; + +&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 = ; + bias-pull-up = ; + }; + + conf-pd { + pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; + drive-strength = ; + bias-pull-down = ; + }; + }; +}; + +&switch { + 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@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&usb_phy { + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; + + band@0 { + reg = <0>; + nvmem-cells = <&macaddr_factory_4 2>; + nvmem-cell-names = "mac-address"; + }; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_factory_4 3>; + nvmem-cell-names = "mac-address"; + }; +}; + +&xhci { + status = "okay"; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds index f0d5dbedd50..1b90a5e2d92 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds @@ -126,6 +126,9 @@ glinet,gl-xe3000) huasifei,wh3000) ucidef_set_led_netdev "wan" "WAN" "red:wan" "eth1" "link tx rx" ;; +huasifei,wh3000r-nand) + ucidef_set_led_netdev "wan" "WAN" "blue:wan-online" "wan" "link" + ;; iptime,ax3000q) ucidef_set_led_netdev "wan" "WAN" "amber:wan" "wan" "link tx rx" ;; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 14bc06ad94f..67adfe64175 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -54,6 +54,7 @@ mediatek_setup_interfaces() creatlentem,clt-r30b1-112m|\ cudy,wr3000-v1|\ globitel,bt-r320|\ + huasifei,wh3000r-nand|\ jcg,q30-pro|\ keenetic,kn-3711|\ keenetic,kn-3811|\ diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index ae781d73e0c..59e020f7dff 100644 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -233,6 +233,7 @@ platform_do_upgrade() { cudy,wr3000h-v1|\ cudy,wr3000p-v1|\ huasifei,wh3000-pro-nand|\ + huasifei,wh3000r-nand|\ jiorouter,ax6000-jidu6101) CI_UBIPART="ubi" nand_do_upgrade "$1" diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 81feb3bb7c7..d164a0b6452 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -1885,6 +1885,19 @@ define Device/huasifei_wh3000-pro-nand endef TARGET_DEVICES += huasifei_wh3000-pro-nand +define Device/huasifei_wh3000r-nand + DEVICE_VENDOR := Huasifei + DEVICE_MODEL := WH3000R + DEVICE_VARIANT := NAND + DEVICE_DTS := mt7981b-huasifei-wh3000r-nand + DEVICE_DTS_DIR := ../dts + IMAGE_SIZE := 231936k + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware \ + kmod-usb3 +endef +TARGET_DEVICES += huasifei_wh3000r-nand + define Device/imou_hx21 DEVICE_VENDOR := Imou DEVICE_MODEL := HX21