Skip to content

Commit cfffaa8

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 WAN (user-definable), 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`. Flashing this eeprom before flashing OpenWrt will make OpenWrt read eeprom: ``` dd if=/lib/firmware/MT7991_MT7976_EEPROM_BE5040_iPAiLNA.bin of=/dev/mmcblk0p2 bs=1 count=7680 sync ``` But it will have wifi issues for now. It's better to use OpenWrt fallback eeprom for now. 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 f4ddf8d commit cfffaa8

6 files changed

Lines changed: 277 additions & 0 deletions

File tree

Lines changed: 245 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
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_blue;
13+
led-failsafe = &led_status_amber;
14+
led-upgrade = &led_status_amber;
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 (configurable in system)
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 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_amber: led-3 {
62+
function = LED_FUNCTION_WLAN_2GHZ;
63+
color = <LED_COLOR_ID_AMBER>;
64+
gpios = <&pio 3 GPIO_ACTIVE_LOW>;
65+
};
66+
67+
led_status_blue: led-4 {
68+
function = LED_FUNCTION_WLAN_5GHZ;
69+
color = <LED_COLOR_ID_BLUE>;
70+
gpios = <&pio 4 GPIO_ACTIVE_LOW>;
71+
};
72+
};
73+
74+
reg_3p3v: regulator-3p3v {
75+
compatible = "regulator-fixed";
76+
regulator-name = "fixed-3.3V";
77+
regulator-min-microvolt = <3300000>;
78+
regulator-max-microvolt = <3300000>;
79+
regulator-boot-on;
80+
regulator-always-on;
81+
};
82+
83+
reg_usb_5v: regulator-usb-5v {
84+
compatible = "regulator-fixed";
85+
regulator-name = "usb-5v";
86+
regulator-max-microvolt = <5000000>;
87+
regulator-min-microvolt = <5000000>;
88+
regulator-boot-on;
89+
regulator-always-on;
90+
};
91+
};
92+
93+
&eth {
94+
status = "okay";
95+
};
96+
97+
&fan {
98+
pwms = <&pwm 1 50000 0>;
99+
status = "okay";
100+
};
101+
102+
&gmac0 {
103+
phy-mode = "2500base-x";
104+
phy-handle = <&phy0>;
105+
status = "okay";
106+
};
107+
108+
&gmac1 {
109+
phy-mode = "internal";
110+
phy-handle = <&phy1>;
111+
status = "okay";
112+
};
113+
114+
&mdio {
115+
/* RTL8221B-VB-CG 2.5Gbps PHY (away from power) eth0 */
116+
phy0: phy@1 {
117+
compatible = "ethernet-phy-ieee802.3-c45";
118+
reg = <1>;
119+
reset-gpios = <&pio 42 GPIO_ACTIVE_LOW>;
120+
reset-assert-us = <100000>;
121+
reset-deassert-us = <100000>;
122+
interrupt-parent = <&pio>;
123+
interrupts = <41 IRQ_TYPE_LEVEL_LOW>;
124+
realtek,aldps-enable;
125+
};
126+
127+
/* built-in 2.5G Ethernet PHY (near power) eth1 */
128+
phy1: phy@15 {
129+
compatible = "ethernet-phy-ieee802.3-c45";
130+
reg = <15>;
131+
pinctrl-names = "i2p5gbe-led";
132+
pinctrl-0 = <&i2p5gbe_led0_pins>;
133+
134+
leds {
135+
#address-cells = <1>;
136+
#size-cells = <0>;
137+
138+
led@0 {
139+
reg = <0>;
140+
function = LED_FUNCTION_WAN;
141+
color = <LED_COLOR_ID_RED>;
142+
};
143+
};
144+
};
145+
};
146+
147+
&mmc0 {
148+
pinctrl-names = "default", "state_uhs";
149+
pinctrl-0 = <&mmc_pins_default>;
150+
pinctrl-1 = <&mmc_pins_uhs>;
151+
bus-width = <8>;
152+
max-frequency = <48000000>;
153+
cap-mmc-highspeed;
154+
vmmc-supply = <&reg_3p3v>;
155+
non-removable;
156+
status = "okay";
157+
158+
card@0 {
159+
compatible = "mmc-card";
160+
reg = <0>;
161+
162+
block {
163+
compatible = "block-device";
164+
165+
partitions {
166+
block-partition-factory {
167+
partname = "factory";
168+
169+
nvmem-layout {
170+
compatible = "fixed-layout";
171+
#address-cells = <1>;
172+
#size-cells = <1>;
173+
174+
eeprom_factory_0: eeprom@0 {
175+
reg = <0x0 0x1e00>;
176+
};
177+
};
178+
};
179+
};
180+
};
181+
};
182+
};
183+
184+
&pcie0 {
185+
pinctrl-names = "default";
186+
pinctrl-0 = <&pcie0_pins>;
187+
reset-gpios = <&pio 36 GPIO_ACTIVE_HIGH>;
188+
status = "okay";
189+
190+
pcie@0,0 {
191+
reg = <0x0000 0 0 0 0>;
192+
#address-cells = <3>;
193+
#size-cells = <2>;
194+
device_type = "pci";
195+
196+
mt7992@0,0 {
197+
compatible = "mediatek,mt76";
198+
reg = <0x0000 0 0 0 0>;
199+
200+
nvmem-cells = <&eeprom_factory_0>;
201+
nvmem-cell-names = "eeprom";
202+
203+
#address-cells = <1>;
204+
#size-cells = <0>;
205+
206+
ieee80211-freq-limit = <2400000 2500000>,
207+
<5170000 5835000>;
208+
};
209+
};
210+
};
211+
212+
&pcie1 {
213+
status = "disabled";
214+
};
215+
216+
&pio {
217+
pwm_fan_pins: pwm-fan-pins {
218+
mux {
219+
function = "pwm";
220+
groups = "pwm1_0";
221+
};
222+
};
223+
};
224+
225+
&pwm {
226+
status = "okay";
227+
pinctrl-names = "default";
228+
pinctrl-0 = <&pwm_fan_pins>;
229+
};
230+
231+
&ssusb {
232+
status = "okay";
233+
vusb33-supply = <&reg_3p3v>;
234+
vbus-supply = <&reg_usb_5v>;
235+
};
236+
237+
&tphyu3port0 {
238+
status = "okay";
239+
};
240+
241+
&uart0 {
242+
pinctrl-names = "default";
243+
pinctrl-0 = <&uart0_pins>;
244+
status = "okay";
245+
};

target/linux/mediatek/filogic/base-files/etc/board.d/01_leds

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ glinet,gl-xe3000)
123123
ucidef_set_led_netdev "wlan2g" "WLAN2G" "green:wifi2g" "phy0-ap0"
124124
ucidef_set_led_netdev "wlan5g" "WLAN5G" "green:wifi5g" "phy1-ap0"
125125
;;
126+
hiveton,h5000m)
127+
ucidef_set_led_netdev "wlan2g" "wlan-2ghz" "amber:wlan-2ghz" "phy0.0-ap0" "link tx rx"
128+
ucidef_set_led_netdev "wlan5g" "wlan-5ghz" "blue:wlan-5ghz" "phy0.1-ap0" "link tx rx"
129+
;;
126130
huasifei,wh3000)
127131
ucidef_set_led_netdev "wan" "WAN" "red:wan" "eth1" "link tx rx"
128132
;;

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
@@ -140,6 +140,7 @@ mediatek_setup_interfaces()
140140
airpi,ap3000m|\
141141
bananapi,bpi-r3-mini|\
142142
edgecore,eap111|\
143+
hiveton,h5000m|\
143144
huasifei,wh3000|\
144145
huasifei,wh3000-pro-emmc|\
145146
huasifei,wh3000-pro-nand|\
@@ -276,6 +277,11 @@ mediatek_setup_macs()
276277
lan_mac=$(macaddr_add "$wan_mac" 1)
277278
label_mac=$wan_mac
278279
;;
280+
hiveton,h5000m)
281+
lan_mac=$(macaddr_generate_from_mmc_cid mmcblk0)
282+
wan_mac=$(macaddr_add "$lan_mac" 1)
283+
label_mac=$wan_mac
284+
;;
279285
jiorouter,ax6000-jidu6101)
280286
label_mac=$(mtd_get_mac_ascii u-boot-env mac)
281287
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
@@ -1825,6 +1825,20 @@ define Device/h3c_magic-nx30-pro
18251825
endef
18261826
TARGET_DEVICES += h3c_magic-nx30-pro
18271827

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

0 commit comments

Comments
 (0)