mediatek: filogic: add support for HUASIFEI WH3000 PRO (aka Fudy Pro)

This commit is contained in:
coolsnowwolf 2025-05-31 05:20:06 +08:00
parent 423165d489
commit 045b5eb8b8
5 changed files with 274 additions and 1 deletions

View File

@ -0,0 +1,241 @@
// 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 <dt-bindings/leds/common.h>
#include <dt-bindings/thermal/thermal.h>
#include "mt7981.dtsi"
/ {
model = "Huasifei WH3000 Pro";
compatible = "huasifei,wh3000-pro", "mediatek,mt7981";
aliases {
serial0 = &uart0;
led-boot = &led_sys_red;
led-failsafe = &led_sys_red;
led-running = &led_sys_green;
led-upgrade = &led_sys_green;
};
chosen {
stdout-path = "serial0:115200n8";
bootargs-append = " root=PARTLABEL=rootfs rootwait";
};
fan: pwm-fan {
compatible = "pwm-fan";
#cooling-cells = <2>;
cooling-levels = <0 63 127 191 223 255>;
interrupt-parent = <&pio>;
interrupts = <13 IRQ_TYPE_EDGE_FALLING>;
pwms = <&pwm 1 40000 0>;
status = "okay";
};
gpio-export {
compatible = "gpio-export";
gpio_modem_power {
gpio-export,name = "modem_power";
gpio-export,output = <0>;
gpios = <&pio 4 GPIO_ACTIVE_HIGH>;
};
};
gpio-keys {
compatible = "gpio-keys";
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&pio 1 GPIO_ACTIVE_LOW>;
};
mode {
label = "mode";
linux,code = <BTN_0>;
linux,input-type = <EV_SW>;
gpios = <&pio 0 GPIO_ACTIVE_LOW>;
debounce-interval = <60>;
};
};
gpio-leds {
compatible = "gpio-leds";
led_sys_red: led-0 {
color = <LED_COLOR_ID_RED>;
function = LED_FUNCTION_STATUS;
gpios = <&pio 11 GPIO_ACTIVE_LOW>;
};
led_sys_green: led-1 {
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_STATUS;
gpios = <&pio 10 GPIO_ACTIVE_LOW>;
};
};
};
&cpu_thermal {
cooling-maps {
cpu-active-low {
cooling-device = <&fan 1 1>;
trip = <&cpu_trip_active_low>;
};
cpu-active-med {
cooling-device = <&fan 2 2>;
trip = <&cpu_trip_active_med>;
};
cpu-active-high {
cooling-device = <&fan 3 3>;
trip = <&cpu_trip_active_high>;
};
};
};
&eth {
pinctrl-names = "default";
pinctrl-0 = <&mdio_pins>;
status = "okay";
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
phy-mode = "2500base-x";
phy-handle = <&phy1>;
nvmem-cells = <&macaddr_factory_4 2>;
nvmem-cell-names = "mac-address";
};
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
phy-mode = "gmii";
phy-handle = <&int_gbe_phy>;
nvmem-cells = <&macaddr_factory_4 3>;
nvmem-cell-names = "mac-address";
};
};
&mdio_bus {
phy1: ethernet-phy@1 {
compatible = "ethernet-phy-ieee802.3-c45";
reg = <1>;
reset-assert-us = <100000>;
reset-deassert-us = <100000>;
reset-gpios = <&pio 39 GPIO_ACTIVE_LOW>;
interrupts = <38 IRQ_TYPE_LEVEL_LOW>;
interrupt-parent = <&pio>;
realtek,aldps-enable;
};
};
&mmc0 {
bus-width = <8>;
cap-mmc-highspeed;
max-frequency = <52000000>;
non-removable;
pinctrl-names = "default", "state_uhs";
pinctrl-0 = <&mmc0_pins_default>;
pinctrl-1 = <&mmc0_pins_uhs>;
vmmc-supply = <&reg_3p3v>;
status = "okay";
card@0 {
compatible = "mmc-card";
reg = <0>;
block {
compatible = "block-device";
partitions {
block-partition-factory {
partname = "factory";
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>;
};
};
};
};
};
};
};
&pio {
mmc0_pins_default: mmc0-pins-default {
mux {
function = "flash";
groups = "emmc_45";
};
};
mmc0_pins_uhs: mmc0-pins-uhs {
mux {
function = "flash";
groups = "emmc_45";
};
};
pwm1_pin: pwm1-pin-g0 {
mux {
function = "pwm";
groups = "pwm1_0";
};
};
};
&uart0 {
status = "okay";
};
&usb_phy {
status = "okay";
};
&watchdog {
status = "okay";
};
&wifi {
nvmem-cells = <&eeprom_factory_0>;
nvmem-cell-names = "eeprom";
status = "okay";
};
&pwm {
pinctrl-names = "default";
pinctrl-0 = <&pwm1_pin>;
status = "okay";
};
&fan {
pwms = <&pwm 0 40000 0>;
interrupt-parent = <&pio>;
interrupts = <29 IRQ_TYPE_EDGE_RISING>;
status = "okay";
};
&xhci {
status = "okay";
};

View File

@ -35,7 +35,8 @@ mediatek_setup_interfaces()
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 sfp2" "eth1 wan"
;;
bananapi,bpi-r3-mini|\
huasifei,wh3000-emmc)
huasifei,wh3000-emmc|\
huasifei,wh3000-pro)
ucidef_set_interfaces_lan_wan eth0 eth1
;;
bananapi,bpi-r4|\

View File

@ -0,0 +1,15 @@
. /lib/functions/uci-defaults.sh
board_config_update
board=$(board_name)
case "$board" in
huasifei,wh3000-pro)
ucidef_add_gpio_switch "modem_power" "Modem power" "modem_power" "0"
;;
esac
board_config_flush
exit 0

View File

@ -50,6 +50,7 @@ platform_do_upgrade() {
glinet,gl-xe3000|\
hf,m7986r1-emmc|\
huasifei,wh3000-emmc|\
huasifei,wh3000-pro|\
jdcloud,re-cs-05)
CI_KERNPART="kernel"
CI_ROOTPART="rootfs"
@ -106,6 +107,7 @@ platform_copy_config() {
glinet,gl-xe3000|\
hf,m7986r1-emmc|\
huasifei,wh3000-emmc|\
huasifei,wh3000-pro|\
jdcloud,re-cs-05)
emmc_copy_config
;;

View File

@ -518,6 +518,20 @@ define Device/huasifei_wh3000-emmc
endef
TARGET_DEVICES += huasifei_wh3000-emmc
define Device/huasifei_wh3000-pro
DEVICE_VENDOR := Huasifei
DEVICE_MODEL := WH3000 PRO
DEVICE_DTS := mt7981b-huasifei-wh3000-pro
DEVICE_DTS_DIR := ../dts
DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware kmod-usb3 f2fsck mkf2fs kmod-hwmon-pwmfan
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 | pad-to 64k
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
SUPPORTED_DEVICES += huasifei,fudy-pro
endef
TARGET_DEVICES += huasifei_wh3000-pro
define Device/huasifei_ws3006
DEVICE_VENDOR := Huasifei
DEVICE_MODEL := WS3006