Skip to content

Commit 3030002

Browse files
committed
txw8301-openipc: add Taixin TXW8301 802.11ah HaLow Wi-Fi FMAC driver package
Adds Buildroot package under general/package/txw8301-openipc with firmware blobs, default config, and init script; enables TXW8301 on gk7205v300_ultimate and ssc338q_ultimate.
1 parent 817491b commit 3030002

8 files changed

Lines changed: 163 additions & 0 deletions

File tree

general/package/Config.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ source "$BR2_EXTERNAL_GENERAL_PATH/package/siproxd-openipc/Config.in"
104104
source "$BR2_EXTERNAL_GENERAL_PATH/package/ssv615x-openipc/Config.in"
105105
source "$BR2_EXTERNAL_GENERAL_PATH/package/ssv635x-openipc/Config.in"
106106
source "$BR2_EXTERNAL_GENERAL_PATH/package/ssw101b/Config.in"
107+
source "$BR2_EXTERNAL_GENERAL_PATH/package/txw8301-openipc/Config.in"
107108
source "$BR2_EXTERNAL_GENERAL_PATH/package/uacme-openipc/Config.in"
108109
source "$BR2_EXTERNAL_GENERAL_PATH/package/uclibc-compat/Config.in"
109110
source "$BR2_EXTERNAL_GENERAL_PATH/package/uqmi-openipc/Config.in"
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
config BR2_PACKAGE_TXW8301_OPENIPC
2+
bool "txw8301-openipc"
3+
depends on BR2_LINUX_KERNEL
4+
help
5+
Taixin TXW8301 802.11ah (HaLow) FMAC driver for Linux.
6+
Supports SDIO, USB, and UART interface modules.
7+
8+
Firmware blob is required at /lib/firmware/taixin/hgicf.bin
9+
(installed via modprobe.d fw_file override).
10+
Runtime config at /etc/hgicf.conf.
11+
12+
https://github.com/TXW8301/TXW8301-FMAC-linux-driver
13+
14+
if BR2_PACKAGE_TXW8301_OPENIPC
15+
16+
choice
17+
prompt "Interface type"
18+
default BR2_PACKAGE_TXW8301_OPENIPC_USB
19+
20+
config BR2_PACKAGE_TXW8301_OPENIPC_SDIO
21+
bool "SDIO/SPI"
22+
help
23+
Select for SDIO or SPI-connected TXW8301 modules.
24+
25+
config BR2_PACKAGE_TXW8301_OPENIPC_USB
26+
bool "USB"
27+
help
28+
Select for USB-connected TXW8301 modules.
29+
30+
endchoice
31+
endif
32+
33+
comment "txw8301-openipc needs a Linux kernel to be built"
34+
depends on !BR2_LINUX_KERNEL
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/bin/sh
2+
3+
IFACE="hg0"
4+
PIDFILE="/var/run/udhcpc.${IFACE}.pid"
5+
CONF="/etc/hgicf.conf"
6+
7+
load_module() {
8+
if ! lsmod | grep -q "^hgicf"; then
9+
modprobe hgicf 2>/dev/null || insmod /lib/modules/$(uname -r)/extra/hgicf.ko
10+
fi
11+
}
12+
13+
wait_iface() {
14+
local i=0
15+
while [ $i -lt 5 ]; do
16+
ip link show "${IFACE}" >/dev/null 2>&1 && return 0
17+
sleep 1
18+
i=$((i + 1))
19+
done
20+
return 1
21+
}
22+
23+
start() {
24+
echo -n "Starting TXW8301 HaLow (${IFACE}): "
25+
load_module
26+
if ! wait_iface; then
27+
echo "FAIL (interface ${IFACE} not found)"
28+
return 1
29+
fi
30+
ip link set "${IFACE}" up
31+
# Run DHCP only if hgicf.conf has dhcpc=1 or conf is absent
32+
if [ ! -f "${CONF}" ] || grep -q "^dhcpc=1" "${CONF}"; then
33+
udhcpc -b -i "${IFACE}" -p "${PIDFILE}" \
34+
-x hostname:$(hostname) -A 3 -T 3 -t 5 -R \
35+
>/dev/null 2>&1
36+
fi
37+
echo "OK"
38+
}
39+
40+
stop() {
41+
echo -n "Stopping TXW8301 HaLow (${IFACE}): "
42+
if [ -f "${PIDFILE}" ]; then
43+
kill "$(cat ${PIDFILE})" 2>/dev/null
44+
rm -f "${PIDFILE}"
45+
fi
46+
ip link show "${IFACE}" >/dev/null 2>&1 && ip link set "${IFACE}" down
47+
rmmod hgicf 2>/dev/null || true
48+
echo "OK"
49+
}
50+
51+
case "$1" in
52+
start|stop)
53+
$1
54+
;;
55+
restart)
56+
stop
57+
sleep 1
58+
start
59+
;;
60+
*)
61+
echo "Usage: $0 {start|stop|restart}"
62+
exit 1
63+
;;
64+
esac
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
freq_range=9080,9240,8
2+
bss_bw=8
3+
tx_mcs=255
4+
chan_list=9080,9160,9240
5+
key_mgmt=WPA-PSK
6+
wpa_psk=
7+
ssid=HALOW_XXXXXX
8+
mode=sta
9+
dhcpc=1
363 KB
Binary file not shown.
367 KB
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Override fw_file to use vendor subdirectory in /lib/firmware
2+
options hgicf fw_file=taixin/hgicf.bin
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
################################################################################
2+
#
3+
# txw8301-openipc
4+
#
5+
################################################################################
6+
7+
TXW8301_OPENIPC_SITE_METHOD = git
8+
TXW8301_OPENIPC_SITE = https://github.com/TXW8301/TXW8301-FMAC-linux-driver
9+
TXW8301_OPENIPC_VERSION = 867b5a55515d10c541786f3c5c5ab6002832f8b5
10+
11+
TXW8301_OPENIPC_LICENSE = GPL-2.0, proprietary (hgicf firmware blob)
12+
TXW8301_OPENIPC_REDISTRIBUTE = NO
13+
14+
# Module source lives under hgic_fmac/, not at the repo root.
15+
TXW8301_OPENIPC_MODULE_SUBDIRS = hgic_fmac
16+
17+
# CONFIG_HGIC_SDIO / CONFIG_HGIC_USB are plain kbuild make variables, not
18+
# Kconfig symbols. Pass them via MODULE_MAKE_OPTS so Buildroot's kernel-module
19+
# infra forwards them to: make -C $(LINUX_DIR) M=$(@D)/hgic_fmac modules
20+
# CONFIG_COMPILE_ERR_SUPPRESS suppresses GCC date-stamp warnings promoted to
21+
# errors on newer toolchains (-Wno-date-time -Wno-unused-result -Wno-format).
22+
ifeq ($(BR2_PACKAGE_TXW8301_OPENIPC_SDIO),y)
23+
TXW8301_OPENIPC_MODULE_MAKE_OPTS = CONFIG_HGICF=m CONFIG_HGIC_SDIO=y CONFIG_COMPILE_ERR_SUPPRESS=y
24+
TXW8301_OPENIPC_FW_BLOB = hgicf_sdio.bin
25+
else ifeq ($(BR2_PACKAGE_TXW8301_OPENIPC_USB),y)
26+
TXW8301_OPENIPC_MODULE_MAKE_OPTS = CONFIG_HGICF=m CONFIG_HGIC_USB=y CONFIG_COMPILE_ERR_SUPPRESS=y
27+
TXW8301_OPENIPC_FW_BLOB = hgicf_usb.bin
28+
endif
29+
30+
# GNUmakefile in tools/test_app/ places binaries under bin/$(notdir $(CC))/.
31+
TXW8301_OPENIPC_CC_NAME = $(notdir $(TARGET_CC))
32+
33+
define TXW8301_OPENIPC_BUILD_CMDS
34+
$(MAKE) -C $(@D)/tools/test_app CC="$(TARGET_CC)" CFLAGS="$(TARGET_CFLAGS)"
35+
endef
36+
37+
define TXW8301_OPENIPC_INSTALL_TARGET_CMDS
38+
$(INSTALL) -D -m 644 $(TXW8301_OPENIPC_PKGDIR)/$(TXW8301_OPENIPC_FW_BLOB) \
39+
$(TARGET_DIR)/lib/firmware/taixin/hgicf.bin
40+
$(INSTALL) -D -m 644 $(TXW8301_OPENIPC_PKGDIR)/modprobe-txw8301.conf \
41+
$(TARGET_DIR)/etc/modprobe.d/txw8301.conf
42+
$(INSTALL) -D -m 644 $(TXW8301_OPENIPC_PKGDIR)/hgicf.conf.default \
43+
$(TARGET_DIR)/etc/hgicf.conf
44+
$(INSTALL) -D -m 755 $(@D)/tools/test_app/bin/$(TXW8301_OPENIPC_CC_NAME)/hgpriv \
45+
$(TARGET_DIR)/usr/bin/hgpriv
46+
$(INSTALL) -D -m 755 $(@D)/tools/test_app/bin/$(TXW8301_OPENIPC_CC_NAME)/hgicf \
47+
$(TARGET_DIR)/usr/bin/hgicf
48+
$(INSTALL) -D -m 755 $(TXW8301_OPENIPC_PKGDIR)/files/S35txw8301 \
49+
$(TARGET_DIR)/etc/init.d/S35txw8301
50+
endef
51+
52+
$(eval $(kernel-module))
53+
$(eval $(generic-package))

0 commit comments

Comments
 (0)