ramips: add support for Huasifei WHF283

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen
2025-04-17 17:32:37 +08:00
parent c25b909304
commit 6a921f15b8
6 changed files with 183 additions and 5 deletions
@@ -30,6 +30,7 @@ alfa-network,ax1800rm|\
allnet,all0256n-4m|\
allnet,all0256n-8m|\
allnet,all5002|\
huasifei,shf283|\
jdcloud,re-cp-02|\
yuncore,ax820)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000"
@@ -0,0 +1,150 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "mt7628an.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>
/ {
model = "Huasifei SHF283";
compatible = "huasifei,shf283", "mediatek,mt7628an-soc";
aliases {
led-boot = &led_power;
led-failsafe = &led_power;
led-running = &led_power;
led-upgrade = &led_power;
};
chosen {
bootargs = "console=ttyS0,115200";
};
gpio-keys {
compatible = "gpio-keys";
button-reset {
label = "reset";
gpios = <&gpio 38 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
};
};
gpio-leds {
compatible = "gpio-leds";
led-0 {
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_STATUS;
gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
};
led-1 {
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_WLAN;
gpios = <&gpio 35 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy0tpt";
};
led_power: led-2 {
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_POWER;
gpios = <&gpio 37 GPIO_ACTIVE_LOW>;
};
led-3 {
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_WAN;
gpios = <&gpio 43 GPIO_ACTIVE_LOW>;
};
};
gpio-export {
compatible = "gpio-export";
modem-reset {
gpio-export,name = "modem_reset";
gpio-export,output = <0>;
gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
};
};
};
&ethernet {
nvmem-cells = <&macaddr_factory_28 0>;
nvmem-cell-names = "mac-address";
};
&pcie {
status = "okay";
};
&spi0 {
status = "okay";
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <12000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "bootloader";
reg = <0x0 0x30000>;
read-only;
};
partition@30000 {
label = "config";
reg = <0x30000 0x10000>;
read-only;
};
partition@40000 {
label = "factory";
reg = <0x40000 0x10000>;
read-only;
nvmem-layout {
eeprom_factory_0: eeprom@0 {
reg = <0x0 0x400>;
};
macaddr_factory_28: macaddr@28 {
compatible = "mac-base";
reg = <0x28 0x6>;
#nvmem-cell-cells = <1>;
};
};
};
partition@50000 {
compatible = "denx,uimage";
label = "firmware";
reg = <0x50000 0xfb0000>;
};
};
};
};
&state_default {
gpio {
groups = "i2c";
function = "gpio";
};
};
&uart1 {
status = "okay";
};
&wmac {
nvmem-cells = <&eeprom_factory_0>;
nvmem-cell-names = "eeprom";
status = "okay";
};
+9
View File
@@ -322,6 +322,15 @@ define Device/hiwifi_hc5861b
endef
TARGET_DEVICES += hiwifi_hc5861b
define Device/huasifei_shf283
IMAGE_SIZE := 16064k
DEVICE_VENDOR := Huasifei
DEVICE_MODEL := SHF283
DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-net-cdc-mbim \
kmod-usb-net-qmi-wwan kmod-usb-net-rndis kmod-usb-serial-option uqmi
endef
TARGET_DEVICES += huasifei_shf283
define Device/iptime_a3
IMAGE_SIZE := 7936k
UIMAGE_NAME := a3
@@ -58,6 +58,7 @@ hiwifi,hc5661a|\
hiwifi,hc5761a)
ucidef_set_led_switch "internet" "internet" "blue:internet" "switch0" "0x10"
;;
huasifei,shf283|\
keenetic,kn-1221|\
keenetic,kn-1613|\
keenetic,kn-1711|\
@@ -116,6 +116,10 @@ ramips_setup_interfaces()
ucidef_add_switch "switch0" \
"0:lan" "1:lan" "4:wan" "6@eth0"
;;
huasifei,shf283)
ucidef_add_switch "switch0" \
"2:lan" "3:lan" "4:lan" "1:wan" "6@eth0"
;;
iptime,a3|\
totolink,a3)
ucidef_add_switch "switch0" \
@@ -284,6 +288,12 @@ ramips_setup_macs()
[ -n "$lan_mac" ] || lan_mac=$(cat /sys/class/net/eth0/address)
wan_mac=$(macaddr_add "$lan_mac" 1)
;;
huasifei,shf283|\
rakwireless,rak633|\
unielec,u7628-01-16m|\
wavlink,wl-wn575a3)
wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x28)" 1)
;;
iptime,a3|\
iptime,a604m|\
totolink,a3)
@@ -319,11 +329,6 @@ ramips_setup_macs()
wavlink,wl-wn576a2)
label_mac=$(mtd_get_mac_binary factory 0x4)
;;
rakwireless,rak633|\
unielec,u7628-01-16m|\
wavlink,wl-wn575a3)
wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x28)" 1)
;;
tplink,archer-c20-v4|\
tplink,archer-c50-v3|\
tplink,tl-mr3420-v5|\
@@ -0,0 +1,12 @@
. /lib/functions.sh
preinit_fixup_model_name() {
case "$(board_name)" in
huasifei,shf283)
local model_name="$(fw_printenv -n model_name 2>/dev/null)"
[ -n "$model_name" ] && echo "$model_name" > "/tmp/sysinfo/model"
;;
esac
}
boot_hook_add preinit_main preinit_fixup_model_name