mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-29 17:42:41 +00:00
Support dual BDF for WF186H/WF186W/WF189/WF189H/WF189W/WF672A Fixes: WIFI-14890 Signed-off-by: Justin.Guo <guoxijun@actiontec.com>
284 lines
7.1 KiB
Bash
Executable File
284 lines
7.1 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
[ -e /lib/firmware/$FIRMWARE ] && exit 0
|
|
|
|
. /lib/functions.sh
|
|
. /lib/functions/system.sh
|
|
|
|
ath11k_generate_macs() {
|
|
touch /lib/firmware/ath11k-macs
|
|
eth=$(cat /sys/class/net/eth0/address)
|
|
mac1=$(macaddr_add $eth 2)
|
|
mac2=$(macaddr_add $eth 3)
|
|
mac3=$(macaddr_add $eth 4)
|
|
echo -ne \\x${mac1//:/\\x} >> /lib/firmware/ath11k-macs
|
|
echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs
|
|
echo -ne \\x${mac3//:/\\x} >> /lib/firmware/ath11k-macs
|
|
}
|
|
|
|
ath11k_generate_macs_wf186w() {
|
|
touch /lib/firmware/ath11k-macs
|
|
local dev=$(find_mtd_chardev "0:APPSBLENV")
|
|
mac=$(grep BaseMacAddress= $dev | cut -dx -f2)
|
|
eth=$(macaddr_canonicalize $mac)
|
|
mac1=$(macaddr_add $eth 2)
|
|
mac2=$(macaddr_add $eth 3)
|
|
mac3=$(macaddr_add $eth 4)
|
|
echo -ne \\x${mac1//:/\\x} >> /lib/firmware/ath11k-macs
|
|
echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs
|
|
echo -ne \\x${mac3//:/\\x} >> /lib/firmware/ath11k-macs
|
|
}
|
|
|
|
ath11k_generate_macs_ion4x() {
|
|
touch /lib/firmware/ath11k-macs
|
|
wifimac0=$(grep WLAN0_BASEMAC= /dev/mtd13 |cut -d '=' -f2)
|
|
wifimac1=$(grep WLAN1_BASEMAC= /dev/mtd13 |cut -d '=' -f2)
|
|
wifimac2=00:00:00:00:00:00
|
|
echo -ne \\x${wifimac0//:/\\x} >> /lib/firmware/ath11k-macs
|
|
echo -ne \\x${wifimac1//:/\\x} >> /lib/firmware/ath11k-macs
|
|
echo -ne \\x${wifimac2//:/\\x} >> /lib/firmware/ath11k-macs
|
|
}
|
|
|
|
ath11k_generate_macs_eww631_a1() {
|
|
touch /lib/firmware/ath11k-macs
|
|
local dev=$(find_mtd_chardev "0:APPSBLENV")
|
|
mac=$(grep BaseMacAddress= $dev | cut -d '=' -f2)
|
|
eth=$(macaddr_canonicalize $mac)
|
|
mac1=$(macaddr_add $eth 1)
|
|
mac2=$(macaddr_add $eth 2)
|
|
echo -ne \\x${mac1//:/\\x} >> /lib/firmware/ath11k-macs
|
|
echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs
|
|
}
|
|
|
|
ath11k_generate_macs_eww631_b1() {
|
|
touch /lib/firmware/ath11k-macs
|
|
local dev=$(find_mtd_chardev "0:APPSBLENV")
|
|
mac=$(grep BaseMacAddress= $dev | cut -d '=' -f2)
|
|
eth=$(macaddr_canonicalize $mac)
|
|
mac1=$(macaddr_add $eth 2)
|
|
mac2=$(macaddr_add $eth 3)
|
|
echo -ne \\x${mac1//:/\\x} >> /lib/firmware/ath11k-macs
|
|
echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs
|
|
}
|
|
|
|
ath11k_generate_macs_rap630c_311g() {
|
|
touch /lib/firmware/ath11k-macs
|
|
local dev=$(find_mtd_chardev "0:APPSBLENV")
|
|
mac=$(grep BaseMacAddress= $dev | cut -d '=' -f2)
|
|
eth=$(macaddr_canonicalize $mac)
|
|
mac1=$(macaddr_add $eth 1)
|
|
mac2=$(macaddr_add $eth 2)
|
|
echo -ne \\x${mac1//:/\\x} >> /lib/firmware/ath11k-macs
|
|
echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs
|
|
}
|
|
|
|
ath11k_generate_macs_rap630w_311g() {
|
|
touch /lib/firmware/ath11k-macs
|
|
local dev=$(find_mtd_chardev "0:APPSBLENV")
|
|
mac=$(grep BaseMacAddress= $dev | cut -d '=' -f2)
|
|
eth=$(macaddr_canonicalize $mac)
|
|
mac1=$(macaddr_add $eth 2)
|
|
mac2=$(macaddr_add $eth 3)
|
|
echo -ne \\x${mac1//:/\\x} >> /lib/firmware/ath11k-macs
|
|
echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs
|
|
}
|
|
|
|
ath11k_generate_macs_gl_b3000() {
|
|
mac=$(cat /proc/gl-hw-info/device_mac)
|
|
[ -z "$mac" ] && ath11k_generate_macs || {
|
|
touch /lib/firmware/ath11k-macs
|
|
mac1=$(macaddr_add $mac 2)
|
|
mac2=$(macaddr_add $mac 3)
|
|
echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs
|
|
echo -ne \\x${mac1//:/\\x} >> /lib/firmware/ath11k-macs
|
|
}
|
|
}
|
|
|
|
ath11k_generate_macs_rap630e() {
|
|
touch /lib/firmware/ath11k-macs
|
|
eth=$(cat /sys/class/net/eth0/address)
|
|
mac1=$(macaddr_add $eth 2)
|
|
mac2=$(macaddr_add $eth 3)
|
|
echo -ne \\x${mac1//:/\\x} >> /lib/firmware/ath11k-macs
|
|
echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs
|
|
}
|
|
|
|
caldata_die() {
|
|
echo "caldata: " "$*"
|
|
exit 1
|
|
}
|
|
|
|
caldata_extract() {
|
|
local part=$1
|
|
local offset=$(($2))
|
|
local count=$(($3))
|
|
local mtd
|
|
|
|
mtd=$(find_mtd_chardev $part)
|
|
[ -n "$mtd" ] || caldata_die "no mtd device found for partition $part"
|
|
|
|
dd if=$mtd of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
|
|
caldata_die "failed to extract calibration data from $mtd"
|
|
}
|
|
|
|
board=$(board_name)
|
|
|
|
case "$FIRMWARE" in
|
|
ath11k/IPQ5018/hw1.0/caldata.bin)
|
|
case "$board" in
|
|
cig,wf186w|\
|
|
cig,wf186h|\
|
|
sonicfi,rap630c-311g|\
|
|
sonicfi,rap630w-311g|\
|
|
sonicfi,rap630w-312g|\
|
|
sonicfi,rap630e|\
|
|
cybertan,eww631-a1|\
|
|
cybertan,eww631-b1|\
|
|
edgecore,eap104|\
|
|
edgecore,oap101|\
|
|
edgecore,oap101-6e|\
|
|
edgecore,oap101e|\
|
|
edgecore,oap101e-6e|\
|
|
emplus,wap385c|\
|
|
hfcl,ion4x_w|\
|
|
hfcl,ion4xi_w|\
|
|
optimcloud,d60|\
|
|
optimcloud,d60-5g|\
|
|
optimcloud,d50|\
|
|
optimcloud,d50-5g|\
|
|
udaya,a6-id2|\
|
|
udaya,a6-od2|\
|
|
wallys,dr5018|\
|
|
yuncore,fap655|\
|
|
emplus,wap581|\
|
|
glinet,b3000)
|
|
caldata_extract "0:ART" 0x1000 0x20000
|
|
;;
|
|
esac
|
|
;;
|
|
ath11k/qcn6122/hw1.0/caldata_1.bin)
|
|
case "$board" in
|
|
cig,wf186w|\
|
|
cig,wf186h|\
|
|
sonicfi,rap630c-311g|\
|
|
sonicfi,rap630w-311g|\
|
|
sonicfi,rap630w-312g|\
|
|
sonicfi,rap630e|\
|
|
cybertan,eww631-a1|\
|
|
cybertan,eww631-b1|\
|
|
edgecore,oap101|\
|
|
edgecore,oap101-6e|\
|
|
edgecore,oap101e|\
|
|
edgecore,oap101e-6e|\
|
|
emplus,wap385c|\
|
|
udaya,a6-id2|\
|
|
udaya,a6-od2|\
|
|
hfcl,ion4xi_w|\
|
|
wallys,dr5018|\
|
|
emplus,wap581|\
|
|
yuncore,fap655)
|
|
caldata_extract "0:ART" 0x26800 0x20000
|
|
;;
|
|
esac
|
|
;;
|
|
ath11k/qcn6122/hw1.0/caldata_2.bin)
|
|
case "$board" in
|
|
wallys,dr5018|\
|
|
edgecore,eap104|\
|
|
edgecore,oap101-6e|\
|
|
edgecore,oap101e-6e)
|
|
caldata_extract "0:ART" 0x4c000 0x20000
|
|
;;
|
|
sonicfi,rap630c-311g|\
|
|
sonicfi,rap630w-311g|\
|
|
sonicfi,rap630e|\
|
|
cybertan,eww631-a1|\
|
|
cybertan,eww631-b1|\
|
|
glinet,b3000)
|
|
caldata_extract "0:ART" 0x26800 0x20000
|
|
;;
|
|
esac
|
|
;;
|
|
ath11k/QCN9074/hw1.0/caldata_1.bin)
|
|
case "$board" in
|
|
optimcloud,d60|\
|
|
optimcloud,d60-5g|\
|
|
optimcloud,d50|\
|
|
optimcloud,d50-5g)
|
|
caldata_extract "0:ART" 0x26800 0x20000
|
|
;;
|
|
esac
|
|
;;
|
|
ath11k-macs)
|
|
case "$board" in
|
|
cig,wf186w|\
|
|
cig,wf186h)
|
|
ath11k_generate_macs_wf186w
|
|
;;
|
|
sonicfi,rap630c-311g)
|
|
ath11k_generate_macs_rap630c_311g
|
|
;;
|
|
sonicfi,rap630w-311g)
|
|
ath11k_generate_macs_rap630w_311g
|
|
;;
|
|
cybertan,eww631-a1)
|
|
ath11k_generate_macs_eww631_a1
|
|
;;
|
|
cybertan,eww631-b1)
|
|
ath11k_generate_macs_eww631_b1
|
|
;;
|
|
sonicfi,rap630e)
|
|
ath11k_generate_macs_rap630e
|
|
;;
|
|
edgecore,eap104|\
|
|
edgecore,oap101|\
|
|
edgecore,oap101-6e|\
|
|
edgecore,oap101e-6e|\
|
|
optimcloud,d60|\
|
|
optimcloud,d60-5g|\
|
|
optimcloud,d50|\
|
|
optimcloud,d50-5g|\
|
|
sonicfi,rap630w-312g|\
|
|
yuncore,fap655)
|
|
ath11k_generate_macs
|
|
;;
|
|
hfcl,ion4x_w|\
|
|
hfcl,ion4xi_w)
|
|
ath11k_generate_macs_ion4x
|
|
;;
|
|
glinet,b3000)
|
|
ath11k_generate_macs_gl_b3000
|
|
;;
|
|
esac
|
|
;;
|
|
ath11k/IPQ5018/hw1.0/board.bin)
|
|
case "$board" in
|
|
cig,wf186w|\
|
|
cig,wf186h)
|
|
country=`cat /etc/ucentral/country`
|
|
if [ "$country" == "CA" ]; then
|
|
ln -s /lib/firmware/ath11k/IPQ5018/hw1.0/board.bin.CA /lib/firmware/ath11k/IPQ5018/hw1.0/board.bin
|
|
else
|
|
ln -s /lib/firmware/ath11k/IPQ5018/hw1.0/board.bin.US /lib/firmware/ath11k/IPQ5018/hw1.0/board.bin
|
|
fi
|
|
;;
|
|
esac
|
|
;;
|
|
ath11k/qcn6122/hw1.0/board.bin)
|
|
case "$board" in
|
|
cig,wf186w|\
|
|
cig,wf186h)
|
|
country=`cat /etc/ucentral/country`
|
|
if [ "$country" == "CA" ]; then
|
|
ln -s /lib/firmware/ath11k/qcn6122/hw1.0/board.bin.CA /lib/firmware/ath11k/qcn6122/hw1.0/board.bin
|
|
else
|
|
ln -s /lib/firmware/ath11k/qcn6122/hw1.0/board.bin.US /lib/firmware/ath11k/qcn6122/hw1.0/board.bin
|
|
fi
|
|
;;
|
|
esac
|
|
;;
|
|
*)
|
|
exit 1
|
|
;;
|
|
esac
|