Skip to content

Commit

Permalink
mediatek: filogic: add support for HUASIFEI WH3000 (aka Fudy)
Browse files Browse the repository at this point in the history
  • Loading branch information
coolsnowwolf committed Dec 27, 2024
1 parent 1fcb93d commit 8cb77cb
Show file tree
Hide file tree
Showing 6 changed files with 179 additions and 2 deletions.
154 changes: 154 additions & 0 deletions target/linux/mediatek/dts/mt7981b-huasifei-wh3000-emmc.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
// SPDX-License-Identifier: (GPL-2.0 OR MIT)

/dts-v1/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>

#include "mt7981.dtsi"

/ {
model = "HUASIFEI WH3000 eMMC version";
compatible = "huasifei,wh3000-emmc", "mediatek,mt7981";

aliases {
label-mac-device = &gmac1;
led-boot = &led_sys_red;
led-failsafe = &led_sys_red;
led-running = &led_sys_white;
led-upgrade = &led_sys_white;
serial0 = &uart0;
};

chosen {
stdout-path = "serial0:115200n8";
bootargs-append = " root=PARTLABEL=rootfs rootwait";
};

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>;
};
};

leds {
compatible = "gpio-leds";

led_sys_red: led-0 {
function = LED_FUNCTION_POWER;
color = <LED_COLOR_ID_RED>;
gpios = <&pio 11 GPIO_ACTIVE_LOW>;
};

led_sys_white: led-1 {
function = LED_FUNCTION_STATUS;
color = <LED_COLOR_ID_WHITE>;
gpios = <&pio 10 GPIO_ACTIVE_LOW>;
};
};

usb_vbus: regulator-usb {
compatible = "regulator-fixed";
regulator-name = "usb-vbus";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
gpios = <&pio 9 GPIO_ACTIVE_LOW>;
regulator-boot-on;
};
};

&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";
phy-handle = <&phy1>;
};

gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
phy-mode = "gmii";
phy-handle = <&int_gbe_phy>;
};
};

&mdio_bus {
phy1: 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;
};
};


&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";
};
};
};

&usb_phy {
status = "okay";
};

&xhci {
status = "okay";
vbus-supply = <&usb_vbus>;
};

&wifi {
status = "okay";
};

&mmc0 {
status = "okay";

pinctrl-names = "default", "state_uhs";
pinctrl-0 = <&mmc0_pins_default>;
pinctrl-1 = <&mmc0_pins_uhs>;
bus-width = <8>;
max-frequency = <52000000>;
vmmc-supply = <&reg_3p3v>;
cap-mmc-highspeed;
non-removable;
};
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ mediatek_setup_interfaces()
bananapi,bpi-r3)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 sfp2" "eth1 wan"
;;
bananapi,bpi-r3-mini)
bananapi,bpi-r3-mini|\
huasifei,wh3000-emmc)
ucidef_set_interfaces_lan_wan eth0 eth1
;;
bananapi,bpi-r4|\
Expand Down Expand Up @@ -122,6 +123,11 @@ mediatek_setup_macs()
lan_mac=$(macaddr_add "$wan_mac" 1)
label_mac=$wan_mac
;;
huasifei,wh3000-emmc)
local wifi_mac=$(mmc_get_mac_binary factory 0x4)
lan_mac="$(macaddr_add $wifi_mac 2)"
wan_mac="$(macaddr_add $wifi_mac 3)"
;;
imou,lc-hx3001)
lan_mac=$(mtd_get_mac_ascii u-boot-env mac)
wan_mac=$(macaddr_add "$lan_mac" 2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ board=$(board_name)
case "$FIRMWARE" in
"mediatek/mt7981_eeprom_mt7976_dbdc.bin")
case "$board" in
cmcc,rax3000m-emmc)
cmcc,rax3000m-emmc|\
huasifei,wh3000-emmc)
caldata_extract_mmc "factory" 0x0 0x1000
;;
esac
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ case "$board" in
[ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && macaddr_setbit_la $(macaddr_add $addr 1) > /sys${DEVPATH}/macaddress
;;
huasifei,wh3000-emmc|\
glinet,gl-mt6000|\
glinet,gl-x3000|\
glinet,gl-xe3000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ platform_do_upgrade() {
glinet,gl-x3000|\
glinet,gl-xe3000|\
hf,m7986r1-emmc|\
huasifei,wh3000-emmc|\
jdcloud,re-cs-05)
CI_KERNPART="kernel"
CI_ROOTPART="rootfs"
Expand Down Expand Up @@ -104,6 +105,7 @@ platform_copy_config() {
glinet,gl-x3000|\
glinet,gl-xe3000|\
hf,m7986r1-emmc|\
huasifei,wh3000-emmc|\
jdcloud,re-cs-05)
emmc_copy_config
;;
Expand Down
13 changes: 13 additions & 0 deletions target/linux/mediatek/image/filogic.mk
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,19 @@ define Device/h3c_magic-nx30-pro
endef
TARGET_DEVICES += h3c_magic-nx30-pro

define Device/huasifei_wh3000-emmc
DEVICE_VENDOR := HUASIFEI
DEVICE_MODEL := WH3000 eMMC
DEVICE_DTS := mt7981b-huasifei-wh3000-emmc
DEVICE_DTS_DIR := ../dts
DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware kmod-usb3 f2fsck mkf2fs
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
endef
TARGET_DEVICES += huasifei_wh3000-emmc

define Device/hf_m7986r1-emmc
DEVICE_VENDOR := HF
DEVICE_MODEL := M7986R1 (eMMC)
Expand Down

0 comments on commit 8cb77cb

Please sign in to comment.