From b50369007d4c9a01d0c56d32a8ed23919a86c56d Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Sun, 6 Apr 2025 23:08:21 +0800 Subject: [PATCH] filogic: improve HUASIFEI WH3000 support --- .../dts/mt7981b-huasifei-wh3000-emmc.dts | 107 +++++++++++------- .../filogic/base-files/etc/board.d/02_network | 5 - target/linux/mediatek/image/filogic.mk | 7 +- 3 files changed, 72 insertions(+), 47 deletions(-) diff --git a/target/linux/mediatek/dts/mt7981b-huasifei-wh3000-emmc.dts b/target/linux/mediatek/dts/mt7981b-huasifei-wh3000-emmc.dts index 364ba0f78..793a8b015 100644 --- a/target/linux/mediatek/dts/mt7981b-huasifei-wh3000-emmc.dts +++ b/target/linux/mediatek/dts/mt7981b-huasifei-wh3000-emmc.dts @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: (GPL-2.0 OR MIT) +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; @@ -43,38 +43,21 @@ }; }; - leds { + gpio-leds { compatible = "gpio-leds"; led_sys_red: led-0 { - function = LED_FUNCTION_STATUS; color = ; + function = LED_FUNCTION_STATUS; gpios = <&pio 11 GPIO_ACTIVE_LOW>; }; led_sys_green: led-1 { - function = LED_FUNCTION_STATUS; color = ; + function = LED_FUNCTION_STATUS; 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"; }; ð { @@ -87,6 +70,9 @@ reg = <0>; phy-mode = "2500base-x"; phy-handle = <&phy1>; + + nvmem-cells = <&macaddr_factory_4 2>; + nvmem-cell-names = "mac-address"; }; gmac1: mac@1 { @@ -94,11 +80,14 @@ reg = <1>; phy-mode = "gmii"; phy-handle = <&int_gbe_phy>; + + nvmem-cells = <&macaddr_factory_4 3>; + nvmem-cell-names = "mac-address"; }; }; &mdio_bus { - phy1: phy@1 { + phy1: ethernet-phy@1 { compatible = "ethernet-phy-ieee802.3-c45"; reg = <1>; reset-assert-us = <100000>; @@ -110,6 +99,49 @@ }; }; +&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 = <®_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 { @@ -125,27 +157,24 @@ }; }; +&uart0 { + status = "okay"; +}; + &usb_phy { status = "okay"; }; +&watchdog { + status = "okay"; +}; + +&wifi { + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; + 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 = <®_3p3v>; - non-removable; - status = "okay"; }; 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 71e60a65b..5f311c2a4 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 @@ -128,11 +128,6 @@ 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) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 476db82ed..dca61d99e 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -351,7 +351,7 @@ define Device/cmcc_xr30-nand DEVICE_VARIANT := (U-Boot mod) DEVICE_DTS := mt7981b-cmcc-xr30-nand DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware kmod-usb3 + DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware kmod-usb3 UBINIZE_OPTS := -E 5 BLOCKSIZE := 128k PAGESIZE := 2048 @@ -499,6 +499,7 @@ define Device/huasifei_wh3000-emmc 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,wh3000 endef TARGET_DEVICES += huasifei_wh3000-emmc @@ -508,11 +509,11 @@ define Device/hf_m7986r1-emmc DEVICE_DTS := mt7986a-hf-m7986r1-emmc DEVICE_DTS_DIR := ../dts DEVICE_PACKAGES := kmod-usb3 kmod-mt7921e kmod-usb-net-rndis kmod-usb-serial-option f2fsck mkf2fs - SUPPORTED_DEVICES += HF-M7986R1 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 += HF-M7986R1 endef TARGET_DEVICES += hf_m7986r1-emmc @@ -526,8 +527,8 @@ define Device/hf_m7986r1-nand PAGESIZE := 2048 KERNEL_IN_UBI := 1 DEVICE_PACKAGES := kmod-usb3 kmod-mt7921e kmod-usb-net-rndis kmod-usb-serial-option - SUPPORTED_DEVICES += HF-M7986R1 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + SUPPORTED_DEVICES += HF-M7986R1 endef TARGET_DEVICES += hf_m7986r1-nand