Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions br-ext-chip-goke/configs/gk7205v300_ultimate_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ BR2_PACKAGE_LIBOGG_OPENIPC=y
BR2_PACKAGE_LIBWEBSOCKETS_OPENIPC=y
BR2_PACKAGE_LINUX_FIRMWARE_OPENIPC=y
BR2_PACKAGE_LINUX_FIRMWARE_OPENIPC_MEDIATEK_MT7601U=y
BR2_PACKAGE_TXW8301_OPENIPC=y
BR2_PACKAGE_TXW8301_OPENIPC_USB=y
BR2_PACKAGE_AWS_WEBRTC=y
BR2_PACKAGE_MAJESTIC_FONTS=y
BR2_PACKAGE_MAJESTIC_WEBUI=y
Expand Down
2 changes: 2 additions & 0 deletions br-ext-chip-sigmastar/configs/ssc338q_ultimate_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,7 @@ BR2_PACKAGE_RTL8733BU_OPENIPC=y
BR2_PACKAGE_SIGMASTAR_OSDRV_INFINITY6E=y
BR2_PACKAGE_UACME_OPENIPC=y
BR2_PACKAGE_VTUND_OPENIPC=y
BR2_PACKAGE_TXW8301_OPENIPC=y
BR2_PACKAGE_TXW8301_OPENIPC_USB=y
BR2_PACKAGE_YAML_CLI=y
BR2_PACKAGE_ZEROTIER_ONE=y
1 change: 1 addition & 0 deletions general/package/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ source "$BR2_EXTERNAL_GENERAL_PATH/package/siproxd-openipc/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/ssv615x-openipc/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/ssv635x-openipc/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/ssw101b/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/txw8301-openipc/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/uacme-openipc/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/uclibc-compat/Config.in"
source "$BR2_EXTERNAL_GENERAL_PATH/package/uqmi-openipc/Config.in"
Expand Down
34 changes: 34 additions & 0 deletions general/package/txw8301-openipc/Config.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
config BR2_PACKAGE_TXW8301_OPENIPC
bool "txw8301-openipc"
depends on BR2_LINUX_KERNEL
help
Taixin TXW8301 802.11ah (HaLow) FMAC driver for Linux.
Supports SDIO, USB, and UART interface modules.

Firmware blob is required at /lib/firmware/taixin/hgicf.bin
(installed via modprobe.d fw_file override).
Runtime config at /etc/hgicf.conf.

https://github.com/TXW8301/TXW8301-FMAC-linux-driver

if BR2_PACKAGE_TXW8301_OPENIPC

choice
prompt "Interface type"
default BR2_PACKAGE_TXW8301_OPENIPC_USB

config BR2_PACKAGE_TXW8301_OPENIPC_SDIO
bool "SDIO/SPI"
help
Select for SDIO or SPI-connected TXW8301 modules.

config BR2_PACKAGE_TXW8301_OPENIPC_USB
bool "USB"
help
Select for USB-connected TXW8301 modules.

endchoice
endif

comment "txw8301-openipc needs a Linux kernel to be built"
depends on !BR2_LINUX_KERNEL
64 changes: 64 additions & 0 deletions general/package/txw8301-openipc/files/S35txw8301
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/sh

IFACE="hg0"
PIDFILE="/var/run/udhcpc.${IFACE}.pid"
CONF="/etc/hgicf.conf"

load_module() {
if ! lsmod | grep -q "^hgicf"; then
modprobe hgicf 2>/dev/null || insmod /lib/modules/$(uname -r)/extra/hgicf.ko
fi
}

wait_iface() {
local i=0
while [ $i -lt 5 ]; do
ip link show "${IFACE}" >/dev/null 2>&1 && return 0
sleep 1
i=$((i + 1))
done
return 1
}

start() {
echo -n "Starting TXW8301 HaLow (${IFACE}): "
load_module
if ! wait_iface; then
echo "FAIL (interface ${IFACE} not found)"
return 1
fi
ip link set "${IFACE}" up
# Run DHCP only if hgicf.conf has dhcpc=1 or conf is absent
if [ ! -f "${CONF}" ] || grep -q "^dhcpc=1" "${CONF}"; then
udhcpc -b -i "${IFACE}" -p "${PIDFILE}" \
-x hostname:$(hostname) -A 3 -T 3 -t 5 -R \
>/dev/null 2>&1
fi
echo "OK"
}

stop() {
echo -n "Stopping TXW8301 HaLow (${IFACE}): "
if [ -f "${PIDFILE}" ]; then
kill "$(cat ${PIDFILE})" 2>/dev/null
rm -f "${PIDFILE}"
fi
ip link show "${IFACE}" >/dev/null 2>&1 && ip link set "${IFACE}" down
rmmod hgicf 2>/dev/null || true
echo "OK"
}

case "$1" in
start|stop)
$1
;;
restart)
stop
sleep 1
start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
9 changes: 9 additions & 0 deletions general/package/txw8301-openipc/hgicf.conf.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
freq_range=9080,9240,8
bss_bw=8
tx_mcs=255
chan_list=9080,9160,9240
key_mgmt=WPA-PSK
wpa_psk=
ssid=HALOW_XXXXXX
mode=sta
dhcpc=1
Binary file not shown.
Binary file added general/package/txw8301-openipc/hgicf_usb.bin
Binary file not shown.
2 changes: 2 additions & 0 deletions general/package/txw8301-openipc/modprobe-txw8301.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Override fw_file to use vendor subdirectory in /lib/firmware
options hgicf fw_file=taixin/hgicf.bin
53 changes: 53 additions & 0 deletions general/package/txw8301-openipc/txw8301-openipc.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
################################################################################
#
# txw8301-openipc
#
################################################################################

TXW8301_OPENIPC_SITE_METHOD = git
TXW8301_OPENIPC_SITE = https://github.com/TXW8301/TXW8301-FMAC-linux-driver
TXW8301_OPENIPC_VERSION = 867b5a55515d10c541786f3c5c5ab6002832f8b5

TXW8301_OPENIPC_LICENSE = GPL-2.0, proprietary (hgicf firmware blob)
TXW8301_OPENIPC_REDISTRIBUTE = NO

# Module source lives under hgic_fmac/, not at the repo root.
TXW8301_OPENIPC_MODULE_SUBDIRS = hgic_fmac

# CONFIG_HGIC_SDIO / CONFIG_HGIC_USB are plain kbuild make variables, not
# Kconfig symbols. Pass them via MODULE_MAKE_OPTS so Buildroot's kernel-module
# infra forwards them to: make -C $(LINUX_DIR) M=$(@D)/hgic_fmac modules
# CONFIG_COMPILE_ERR_SUPPRESS suppresses GCC date-stamp warnings promoted to
# errors on newer toolchains (-Wno-date-time -Wno-unused-result -Wno-format).
ifeq ($(BR2_PACKAGE_TXW8301_OPENIPC_SDIO),y)
TXW8301_OPENIPC_MODULE_MAKE_OPTS = CONFIG_HGICF=m CONFIG_HGIC_SDIO=y CONFIG_COMPILE_ERR_SUPPRESS=y
TXW8301_OPENIPC_FW_BLOB = hgicf_sdio.bin
else ifeq ($(BR2_PACKAGE_TXW8301_OPENIPC_USB),y)
TXW8301_OPENIPC_MODULE_MAKE_OPTS = CONFIG_HGICF=m CONFIG_HGIC_USB=y CONFIG_COMPILE_ERR_SUPPRESS=y
TXW8301_OPENIPC_FW_BLOB = hgicf_usb.bin
endif

# GNUmakefile in tools/test_app/ places binaries under bin/$(notdir $(CC))/.
TXW8301_OPENIPC_CC_NAME = $(notdir $(TARGET_CC))

define TXW8301_OPENIPC_BUILD_CMDS
$(MAKE) -C $(@D)/tools/test_app CC="$(TARGET_CC)" CFLAGS="$(TARGET_CFLAGS)"
endef

define TXW8301_OPENIPC_INSTALL_TARGET_CMDS
$(INSTALL) -D -m 644 $(TXW8301_OPENIPC_PKGDIR)/$(TXW8301_OPENIPC_FW_BLOB) \
$(TARGET_DIR)/lib/firmware/taixin/hgicf.bin
$(INSTALL) -D -m 644 $(TXW8301_OPENIPC_PKGDIR)/modprobe-txw8301.conf \
$(TARGET_DIR)/etc/modprobe.d/txw8301.conf
$(INSTALL) -D -m 644 $(TXW8301_OPENIPC_PKGDIR)/hgicf.conf.default \
$(TARGET_DIR)/etc/hgicf.conf
$(INSTALL) -D -m 755 $(@D)/tools/test_app/bin/$(TXW8301_OPENIPC_CC_NAME)/hgpriv \
$(TARGET_DIR)/usr/bin/hgpriv
$(INSTALL) -D -m 755 $(@D)/tools/test_app/bin/$(TXW8301_OPENIPC_CC_NAME)/hgicf \
$(TARGET_DIR)/usr/bin/hgicf
$(INSTALL) -D -m 755 $(TXW8301_OPENIPC_PKGDIR)/files/S35txw8301 \
$(TARGET_DIR)/etc/init.d/S35txw8301
endef

$(eval $(kernel-module))
$(eval $(generic-package))
Loading