filogic: add support for HUASIFEI WH3000

This commit is contained in:
coolsnowwolf 2024-11-25 23:21:50 +08:00
parent 1fcb93df27
commit 817dfb5381
6 changed files with 177 additions and 3 deletions

View File

@ -0,0 +1,151 @@
// 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 {
serial0 = &uart0;
led-boot = &led_sys_red;
led-failsafe = &led_sys_red;
led-running = &led_sys_white;
led-upgrade = &led_sys_white;
};
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 {
pinctrl-names = "default", "state_uhs";
pinctrl-0 = <&mmc0_pins_default>;
pinctrl-1 = <&mmc0_pins_uhs>;
bus-width = <8>;
cap-mmc-highspeed;
max-frequency = <52000000>;
vmmc-supply = <&reg_3p3v>;
non-removable;
status = "okay";
};

View File

@ -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|\
@ -122,6 +123,11 @@ mediatek_setup_macs()
lan_mac=$(macaddr_add "$wan_mac" 1)
label_mac=$wan_mac
;;
huasifei,wh3000-emmc)
label_mac=$(mmc_get_mac_binary factory 0x4)
lan_mac="$(macaddr_add $label_mac 2)"
wan_mac="$(macaddr_add $label_mac 3)"
;;
imou,lc-hx3001)
lan_mac=$(mtd_get_mac_ascii u-boot-env mac)
wan_mac=$(macaddr_add "$lan_mac" 2)

View File

@ -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

View File

@ -50,7 +50,8 @@ case "$board" in
;;
glinet,gl-mt6000|\
glinet,gl-x3000|\
glinet,gl-xe3000)
glinet,gl-xe3000|\
huasifei,wh3000-emmc)
addr=$(mmc_get_mac_binary factory 0x04)
[ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress

View File

@ -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"
@ -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
;;

View File

@ -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)