Skip to content

Commit f7a59ef

Browse files
committed
mediatek: add support for Hiveton H5000M
Hardware specification: SoC: MediaTek MT7987A Flash: 8GB eMMC RAM: 1GB DDR4 Ethernet: 2x 2.5GbE (RTL8221B PHY + Internal PHY) WiFi: MediaTek MT7992 / 2+3 antenna variant Interface: M.2 USB for 5G module LED: Power (hw-controlled), 2.5G LAN (hw-controlled), 5G Module (hw-controlled), LED-3 (user-definable), LED-4 (user-definable) Button: Reset, WPS Power: USB Type-C PD Other: PWM Fan control MAC address assignment is unconventional: the board has no Factory partition with pre-programmed MACs. Instead, all addresses are derived from the eMMC CID at runtime: LAN : macaddr_generate_from_mmc_cid mmcblk0 WAN : LAN + 1 (label_mac) phy0: LAN + 2 phy1: LAN + 3 This matches the vendor firmware behaviour and ensures stable, unique addresses across reboots without a dedicated EEPROM region for MACs. Flash instructions: Factory `mmcblk0p2` partition is empty, stock ImmortalWrt-798x-mt799x-6.6-mtwifi from PadavanOnly firmware uses `MT7991_MT7976_EEPROM_BE5040_iPAiLNA.bin`. You can flash it as eeprom before flashing OpenWrt: ``` dd if=/lib/firmware/MT7991_MT7976_EEPROM_BE5040_iPAiLNA.bin of=/dev/mmcblk0p2 bs=1 count=7680 sync ``` Power off the device. Press and hold the Reset button. Power on the device while keeping the Reset button pressed. Wait for the device to enter U-Boot recovery mode. Connect to the device via Ethernet (default IP: 192.168.1.1). Set your PC's IP to 192.168.1.x (e.g., 192.168.1.100). Open a web browser and navigate to http://192.168.1.1 Upload and flash the OpenWrt firmware Wait for the flashing process to complete and the device to reboot. Signed-off-by: Fil Dunsky <filipp.dunsky@gmail.com>
1 parent 11865bf commit f7a59ef

5 files changed

Lines changed: 264 additions & 0 deletions

File tree

Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
// SPDX-License-Identifier: (GPL-2.0 OR MIT)
2+
3+
/dts-v1/;
4+
#include "mt7987a.dtsi"
5+
#include <dt-bindings/input/input.h>
6+
7+
/ {
8+
model = "Hiveton H5000M";
9+
compatible = "hiveton,h5000m", "mediatek,mt7987a", "mediatek,mt7987";
10+
11+
aliases {
12+
led-boot = &led_status;
13+
led-failsafe = &led_status;
14+
led-upgrade = &led_status;
15+
serial0 = &uart0;
16+
};
17+
18+
chosen {
19+
bootargs = "earlycon=uart8250,mmio32,0x11000000 \
20+
root=PARTLABEL=rootfs rootwait pci=pcie_bus_perf";
21+
stdout-path = "serial0:115200n8";
22+
};
23+
24+
gpio-keys {
25+
compatible = "gpio-keys";
26+
27+
button-reset {
28+
label = "reset";
29+
linux,code = <KEY_RESTART>;
30+
gpios = <&pio 1 GPIO_ACTIVE_LOW>;
31+
debounce-interval = <10>;
32+
};
33+
34+
button-wps {
35+
label = "wps";
36+
linux,code = <KEY_WPS_BUTTON>;
37+
gpios = <&pio 0 GPIO_ACTIVE_LOW>;
38+
debounce-interval = <10>;
39+
};
40+
};
41+
42+
/*
43+
* LED Indicator Layout
44+
* -------------------
45+
* Total of 5 LED indicators, viewed from front with antenna facing up (left to right):
46+
*
47+
* LED 1: 5G Module indicator
48+
* LED 2: Built-in 2.5G Ethernet port indicator
49+
* LED 3: User-definable (configurable in system)
50+
* LED 4: User-definable (configurable in system)
51+
* LED 5: Power indicator
52+
*
53+
* Note:
54+
* - LEDs 1, 2, and 5 are hardware-controlled and cannot be modified via software
55+
* - In vendor firmware, LEDs 3 and 4 are used as WiFi link activity indicators
56+
* for dual-band (2.4GHz/5GHz) respectively
57+
*/
58+
leds {
59+
compatible = "gpio-leds";
60+
61+
led_status: led-3 {
62+
function = LED_FUNCTION_WLAN_2GHZ;
63+
color = <LED_COLOR_ID_AMBER>;
64+
gpios = <&pio 3 GPIO_ACTIVE_LOW>;
65+
linux,default-trigger = "phy0tpt";
66+
};
67+
68+
led-4 {
69+
function = LED_FUNCTION_WLAN_5GHZ;
70+
color = <LED_COLOR_ID_BLUE>;
71+
gpios = <&pio 4 GPIO_ACTIVE_LOW>;
72+
linux,default-trigger = "phy1tpt";
73+
};
74+
};
75+
76+
reg_3p3v: regulator-3p3v {
77+
compatible = "regulator-fixed";
78+
regulator-name = "fixed-3.3V";
79+
regulator-min-microvolt = <3300000>;
80+
regulator-max-microvolt = <3300000>;
81+
regulator-boot-on;
82+
regulator-always-on;
83+
};
84+
85+
reg_usb_5v: regulator-usb-5v {
86+
compatible = "regulator-fixed";
87+
regulator-name = "usb-5v";
88+
regulator-max-microvolt = <5000000>;
89+
regulator-min-microvolt = <5000000>;
90+
regulator-boot-on;
91+
regulator-always-on;
92+
};
93+
};
94+
95+
&eth {
96+
status = "okay";
97+
};
98+
99+
&fan {
100+
pwms = <&pwm 1 50000 0>;
101+
status = "okay";
102+
};
103+
104+
&gmac0 {
105+
phy-mode = "2500base-x";
106+
phy-handle = <&phy0>;
107+
status = "okay";
108+
};
109+
110+
&gmac1 {
111+
phy-mode = "internal";
112+
phy-handle = <&phy1>;
113+
status = "okay";
114+
};
115+
116+
&mdio {
117+
/* RTL8221B-VB-CG 2.5Gbps PHY (away from power) eth0 */
118+
phy0: phy@1 {
119+
compatible = "ethernet-phy-ieee802.3-c45";
120+
reg = <1>;
121+
reset-gpios = <&pio 42 GPIO_ACTIVE_LOW>;
122+
reset-assert-us = <100000>;
123+
reset-deassert-us = <100000>;
124+
interrupt-parent = <&pio>;
125+
interrupts = <41 IRQ_TYPE_LEVEL_LOW>;
126+
realtek,aldps-enable;
127+
};
128+
129+
/* built-in 2.5G Ethernet PHY (near power) eth1 */
130+
phy1: phy@15 {
131+
compatible = "ethernet-phy-ieee802.3-c45";
132+
reg = <15>;
133+
pinctrl-names = "i2p5gbe-led";
134+
pinctrl-0 = <&i2p5gbe_led0_pins>;
135+
};
136+
};
137+
138+
&mmc0 {
139+
pinctrl-names = "default", "state_uhs";
140+
pinctrl-0 = <&mmc_pins_default>;
141+
pinctrl-1 = <&mmc_pins_uhs>;
142+
bus-width = <8>;
143+
max-frequency = <48000000>;
144+
cap-mmc-highspeed;
145+
vmmc-supply = <&reg_3p3v>;
146+
non-removable;
147+
status = "okay";
148+
149+
card@0 {
150+
compatible = "mmc-card";
151+
reg = <0>;
152+
153+
block {
154+
compatible = "block-device";
155+
156+
partitions {
157+
block-partition-factory {
158+
partname = "factory";
159+
160+
nvmem-layout {
161+
compatible = "fixed-layout";
162+
#address-cells = <1>;
163+
#size-cells = <1>;
164+
165+
eeprom_factory_0: eeprom@0 {
166+
reg = <0x0 0x1e00>;
167+
};
168+
};
169+
};
170+
};
171+
};
172+
};
173+
};
174+
175+
&pcie0 {
176+
pinctrl-names = "default";
177+
pinctrl-0 = <&pcie0_pins>;
178+
reset-gpios = <&pio 36 GPIO_ACTIVE_HIGH>;
179+
status = "okay";
180+
181+
pcie@0,0 {
182+
reg = <0x0000 0 0 0 0>;
183+
#address-cells = <3>;
184+
#size-cells = <2>;
185+
device_type = "pci";
186+
187+
mt7992@0,0 {
188+
compatible = "mediatek,mt76";
189+
reg = <0x0000 0 0 0 0>;
190+
191+
nvmem-cells = <&eeprom_factory_0>;
192+
nvmem-cell-names = "eeprom";
193+
194+
#address-cells = <1>;
195+
#size-cells = <0>;
196+
197+
ieee80211-freq-limit = <2400000 2500000>,
198+
<5170000 5835000>;
199+
};
200+
};
201+
};
202+
203+
&pcie1 {
204+
status = "disabled";
205+
};
206+
207+
&pio {
208+
pwm_fan_pins: pwm-fan-pins {
209+
mux {
210+
function = "pwm";
211+
groups = "pwm1_0";
212+
};
213+
};
214+
};
215+
216+
&pwm {
217+
status = "okay";
218+
pinctrl-names = "default";
219+
pinctrl-0 = <&pwm_fan_pins>;
220+
};
221+
222+
&ssusb {
223+
status = "okay";
224+
vusb33-supply = <&reg_3p3v>;
225+
vbus-supply = <&reg_usb_5v>;
226+
};
227+
228+
&tphyu3port0 {
229+
status = "okay";
230+
};
231+
232+
&uart0 {
233+
pinctrl-names = "default";
234+
pinctrl-0 = <&uart0_pins>;
235+
status = "okay";
236+
};

target/linux/mediatek/filogic/base-files/etc/board.d/02_network

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ mediatek_setup_interfaces()
158158
glinet,gl-mt3600be|\
159159
glinet,gl-x3000|\
160160
glinet,gl-xe3000|\
161+
hiveton,h5000m|\
161162
openembed,som7981|\
162163
openwrt,one)
163164
ucidef_set_interfaces_lan_wan eth1 eth0
@@ -275,6 +276,11 @@ mediatek_setup_macs()
275276
lan_mac=$(macaddr_add "$wan_mac" 1)
276277
label_mac=$wan_mac
277278
;;
279+
hiveton,h5000m)
280+
lan_mac=$(macaddr_generate_from_mmc_cid mmcblk0)
281+
wan_mac=$(macaddr_add "$lan_mac" 1)
282+
label_mac=$wan_mac
283+
;;
278284
jiorouter,ax6000-jidu6101)
279285
label_mac=$(mtd_get_mac_ascii u-boot-env mac)
280286
wan_mac=$label_mac

target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,11 @@ case "$board" in
136136
[ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress
137137
[ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress
138138
;;
139+
hiveton,h5000m)
140+
base_mac=$(macaddr_generate_from_mmc_cid mmcblk0)
141+
[ "$PHYNBR" = "0" ] && macaddr_add $base_mac 2 > /sys${DEVPATH}/macaddress
142+
[ "$PHYNBR" = "1" ] && macaddr_add $base_mac 3 > /sys${DEVPATH}/macaddress
143+
;;
139144
iptime,ax3000q)
140145
addr=$(mtd_get_mac_binary "Factory" 0x4)
141146
[ "$PHYNBR" = "1" ] && macaddr_setbit_la $addr > /sys${DEVPATH}/macaddress

target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ platform_do_upgrade() {
199199
glinet,gl-x3000|\
200200
glinet,gl-xe3000|\
201201
globitel,bt-r320|\
202+
hiveton,h5000m|\
202203
huasifei,wh3000|\
203204
huasifei,wh3000-pro-emmc|\
204205
smartrg,sdg-8612|\
@@ -398,6 +399,7 @@ platform_check_image() {
398399
;;
399400
creatlentem,clt-r30b1|\
400401
creatlentem,clt-r30b1-112m|\
402+
hiveton,h5000m|\
401403
nradio,c8-668gl)
402404
# tar magic `ustar`
403405
magic="$(dd if="$1" bs=1 skip=257 count=5 2>/dev/null)"
@@ -444,6 +446,7 @@ platform_copy_config() {
444446
glinet,gl-x3000|\
445447
glinet,gl-xe3000|\
446448
globitel,bt-r320|\
449+
hiveton,h5000m|\
447450
huasifei,wh3000|\
448451
huasifei,wh3000-pro-emmc|\
449452
jdcloud,re-cp-03|\

target/linux/mediatek/image/filogic.mk

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1823,6 +1823,20 @@ define Device/h3c_magic-nx30-pro
18231823
endef
18241824
TARGET_DEVICES += h3c_magic-nx30-pro
18251825

1826+
define Device/hiveton_h5000m
1827+
DEVICE_VENDOR := Hiveton
1828+
DEVICE_MODEL := H5000M
1829+
DEVICE_ALT0_VENDOR := Airpi
1830+
DEVICE_ALT0_MODEL := H5000M
1831+
DEVICE_DTS := mt7987a-hiveton-h5000m
1832+
DEVICE_DTS_DIR := ../dts
1833+
DEVICE_PACKAGES := kmod-hwmon-pwmfan kmod-usb3 mt7987-2p5g-phy-firmware \
1834+
kmod-mt7996e kmod-mt7992-23-firmware f2fsck mkf2fs
1835+
KERNEL_LOADADDR := 0x40000000
1836+
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
1837+
endef
1838+
TARGET_DEVICES += hiveton_h5000m
1839+
18261840
define Device/huasifei_wh3000
18271841
DEVICE_VENDOR := Huasifei
18281842
DEVICE_MODEL := WH3000

0 commit comments

Comments
 (0)