diff options
Diffstat (limited to 'recipes-bsp/wl12xx-firmware')
-rwxr-xr-x | recipes-bsp/wl12xx-firmware/wl12xx-firmware/calibrate-wifi | 159 | ||||
-rw-r--r-- | recipes-bsp/wl12xx-firmware/wl12xx-firmware/wl127x-fw-5-mr.bin | bin | 354600 -> 356280 bytes | |||
-rw-r--r-- | recipes-bsp/wl12xx-firmware/wl12xx-firmware/wl127x-fw-5-sr.bin | bin | 370996 -> 364028 bytes | |||
-rw-r--r-- | recipes-bsp/wl12xx-firmware/wl12xx-firmware_r6.bb | 17 |
4 files changed, 169 insertions, 7 deletions
diff --git a/recipes-bsp/wl12xx-firmware/wl12xx-firmware/calibrate-wifi b/recipes-bsp/wl12xx-firmware/wl12xx-firmware/calibrate-wifi new file mode 100755 index 0000000..319e481 --- /dev/null +++ b/recipes-bsp/wl12xx-firmware/wl12xx-firmware/calibrate-wifi @@ -0,0 +1,159 @@ +#!/bin/bash +#Calibrates wl1271 Wifi Chip and Sets Power Levels + +OEM_DIR="/var/oem" +NVS_DIR="mts" +NVS_OEM_FILE="$OEM_DIR/$NVS_DIR/wl1271-nvs.bin" +NVS_OEM_INI="$OEM_DIR/$NVS_DIR/TQS_S_2.6.ini" +NVS_FILE="/lib/firmware/ti-connectivity/wl1271-nvs.bin" +NVS_DEFAULT_FILE="$NVS_FILE.factory" +NVS_DEFAULT_INI="/usr/share/ti/wifi-utils/ini_files/127x/TQS_S_2.6.ini" +WIFI_PWR_LINE_B="FEM1_TxPerChannelPowerLimits_2_4G_11b =" +WIFI_PWR_LINE_OFDM="FEM1_TxPerChannelPowerLimits_2_4G_OFDM =" +WIFI_PWR_ARR_SIZE=14 +WIFI_PWR_INDEX_START=2 +WIFI_PWR_INDEX_END=$(( $WIFI_PWR_INDEX_START + $WIFI_PWR_ARR_SIZE)) +WIFIMAC=$(mts-io-sysfs show mac-wifi) +CHANNEL="ALL" + +# Reset in case getopts has been used previously in the shell. +OPTIND=1 + +function show_help() { + echo "Usage: $0 -m <WIFI MAC> -c <CHANNEL> <POWER LIMIT mBm>" + echo " Example: $0 -c 1 1250" + echo " Sets max transmit power to 12.5 dBm on channel 1" + echo "Note: Using no options will calibrate to factory settings" +} + +while getopts "h?c:m:" opt; do + case "$opt" in + h|\?) + show_help + exit 0 + ;; + c) CHANNEL=$OPTARG + ;; + m) WIFIMAC=$OPTARG + ;; + esac +done + +shift $((OPTIND-1)) +[ "$1" = "--" ] && shift + +POWER=$1 + +regexIsNumber='^[0-9]+$' + +if [ "$POWER" != "" ]; then + if ! [[ $POWER =~ $regexIsNumber ]] ; then + echo "Error: Power is Not a Number" >&2; exit 1 + fi + if [ $POWER -lt 0 ]; then + echo "Error: Minimum power lvl is 0 mBm" >&2; exit 1 + fi + if [ $POWER -gt 3000 ]; then + echo "Error: Maximum power lvl is 3000 mBm" >&2; exit 1 + fi +fi + +if [ "$CHANNEL" != "ALL" ]; then + if ! [[ $CHANNEL =~ $regexIsNumber ]] ; then + echo "Error: Channel is Not a Number" >&2; exit 1 + fi + if [ $CHANNEL -gt 14 ] || [ $CHANNEL -lt 1 ]; then + echo "Error: Valid Channels are 1-14" >&2; exit 1 + fi +fi + +echo "starting wifi calibration..." + +/etc/init.d/wifi stop >/dev/null 2>&1 + +mts-io-sysfs store wlan-enabled 0 +sleep 1 +mts-io-sysfs store wlan-enabled 1 +sleep 1 + +modprobe atmel_mci +sleep 5 + +mount -o remount,rw /var/oem +echo "removing $NVS_OEM_FILE" +# WARNING: need remove file after 'modprobe atmel_mci' +rm -f $NVS_OEM_FILE +mkdir -p $OEM_DIR/$NVS_DIR + +if [ ! -f $NVS_OEM_INI ]; then + cp $NVS_DEFAULT_INI $NVS_OEM_INI +fi + +#Pull Applicable Fields +lineB=$(grep "$WIFI_PWR_LINE_B" $NVS_OEM_INI) #GET B TX PWR LMT LINE +lineOFDM=$(grep "$WIFI_PWR_LINE_OFDM" $NVS_OEM_INI) #GET OFDM TX PWR LMT LINE +lineB=${lineB%%#*} #REMOVE TRAILING COMMENT LINE +lineOFDM=${lineOFDM%%#*} #REMOVE TRAILING COMMENT LINE + +if [ "$POWER" != "" ]; then + POWER=$((($POWER * 2) / 100 )) #POWER NEEDS TO BE IN 1/2 dB + + if [ "$CHANNEL" == "ALL" ]; then + echo "setting power levels on all channels..." + for ((i=$WIFI_PWR_INDEX_START; i < $WIFI_PWR_INDEX_END; i++)); do + pwrLine="$pwrLine $POWER" + done + else + echo "setting power level on channel $CHANNEL..." + channelIndex=$(( $WIFI_PWR_INDEX_START + $CHANNEL - 1 )) + IFS=', ' read -a array <<< "$lineB" + for ((i=$WIFI_PWR_INDEX_START; i < $WIFI_PWR_INDEX_END; i++)); do + if [ "$i" == "$channelIndex" ]; then + pwr=$POWER + else + pwr=${array[$i]} + fi + pwrLine="$pwrLine $pwr" + done + fi + newLineB="$WIFI_PWR_LINE_B $pwrLine" + newLineOFDM="$WIFI_PWR_LINE_OFDM $pwrLine" + sed -i "s/$lineB/$newLineB/g" "$NVS_OEM_INI" + sed -i "s/$lineOFDM/$newLineOFDM/g" "$NVS_OEM_INI" +else + #FACTORY SETTINGS + #960 mBm WAS MEASURED IN LAB TO PRODUCE 12.5 dBm on DEC2013 + #960 mBm => 19 steps in 1/2 dB + POWER=19 + echo "setting power levels to factory settings..." + channel=1 + for ((i=$WIFI_PWR_INDEX_START; i < $WIFI_PWR_INDEX_END; i++)); do + if [ $channel -gt 11 ]; then + #Set Channels 12 - 14 to zero power output + pwrLine="$pwrLine 0" + else + pwrLine="$pwrLine $POWER" + fi + let channel=channel+1 + done + newLineB="$WIFI_PWR_LINE_B $pwrLine" + newLineOFDM="$WIFI_PWR_LINE_OFDM $pwrLine" + sed -i "s/$lineB/$newLineB/g" "$NVS_OEM_INI" + sed -i "s/$lineOFDM/$newLineOFDM/g" "$NVS_OEM_INI" +fi + +sync + +echo "calibrating..." +calibrator plt autocalibrate wlan0 \ + /lib/modules/$(uname -r)/kernel/drivers/net/wireless/ti/wlcore/wlcore_sdio.ko \ + $NVS_OEM_INI \ + $NVS_FILE $WIFIMAC + +sync + +/etc/init.d/wifi restart >/dev/null 2>&1 + +mount -o remount,ro /var/oem + +echo "...calibration finished" diff --git a/recipes-bsp/wl12xx-firmware/wl12xx-firmware/wl127x-fw-5-mr.bin b/recipes-bsp/wl12xx-firmware/wl12xx-firmware/wl127x-fw-5-mr.bin Binary files differindex c953fef..a6279ed 100644 --- a/recipes-bsp/wl12xx-firmware/wl12xx-firmware/wl127x-fw-5-mr.bin +++ b/recipes-bsp/wl12xx-firmware/wl12xx-firmware/wl127x-fw-5-mr.bin diff --git a/recipes-bsp/wl12xx-firmware/wl12xx-firmware/wl127x-fw-5-sr.bin b/recipes-bsp/wl12xx-firmware/wl12xx-firmware/wl127x-fw-5-sr.bin Binary files differindex c83d3eb..ffc9594 100644 --- a/recipes-bsp/wl12xx-firmware/wl12xx-firmware/wl127x-fw-5-sr.bin +++ b/recipes-bsp/wl12xx-firmware/wl12xx-firmware/wl127x-fw-5-sr.bin diff --git a/recipes-bsp/wl12xx-firmware/wl12xx-firmware_r6.bb b/recipes-bsp/wl12xx-firmware/wl12xx-firmware_r6.bb index 75423c0..ed7fe36 100644 --- a/recipes-bsp/wl12xx-firmware/wl12xx-firmware_r6.bb +++ b/recipes-bsp/wl12xx-firmware/wl12xx-firmware_r6.bb @@ -2,7 +2,7 @@ DESCRIPTION = "TI wl1271 firmware" HOMEPAGE = "http://processors.wiki.ti.com/index.php/ARM_Processor_Open_Source_Wireless_Connectivity" LICENSE = "Proprietary" LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=1c9961176d6529283e0d0c983be41b45" -PR="r6" +PR="r9" # bluetooth firmware from TI-ECS on github.com: # https://github.com/TI-ECS/bt-firmware.git @@ -10,10 +10,10 @@ PR="r6" # Last file log message: "Updated to service pack 2.14" # file: am335x/TIInit_7.6.15.bts # md5sum: a46c46104c7fab23bb9ebfae1633a3af -# wifi firmware from TI-OpenLink on github.com -# https://github.com/TI-OpenLink/firmwares.git -# revision 977880610b1ad9048f4b7804ba5b8fa454e0b76a -# Last file log message: "Update the wl127x and wl128x firmwares to *.3.10.0.133 for single-role and *.5.7.0.42 for multi-role." +# wifi firmware from Wkennington on github.com +# https://github.com/wkennington/linux-firmware/tree/master/ti-connectivity +# revision 6d3bc8886517d171068fd1263176b8b5c51df204 +# Last file log message: "Fix permissions on ti-connectivity firmware from 05e9fe5 Signed-off-by: Kyle McMartin <kyle@kernel.org>" # file: ti-connectivity/wl127x-fw-5-sr.bin # file: ti-connectivity/wl127x-fw-5-mr.bin # file: ti-connectivity/wl127x-fw-5-plt.bin @@ -23,6 +23,7 @@ SRC_URI = "file://wl127x-fw-5-mr.bin \ file://wl127x-fw-5-sr.bin \ file://TIInit_7.6.15.bts \ file://wl1271-nvs.bin \ + file://calibrate-wifi \ file://LICENSE " # nothing to compile @@ -34,6 +35,7 @@ do_compile() { do_install() { install -d ${D}/lib/firmware + install -d ${D}/sbin install -d ${D}/lib/firmware/ti-connectivity # wifi firmware install ${WORKDIR}/wl127x-fw-*-*.bin ${D}/lib/firmware/ti-connectivity @@ -41,9 +43,10 @@ do_install() { # use local copy since the one in hw/firmware dir is *wrong* install ${WORKDIR}/wl1271-nvs.bin ${D}/lib/firmware/ti-connectivity/wl1271-nvs.bin.factory # link to nvs file with mac address set - ln -sf wl1271-nvs.bin.factory ${D}/lib/firmware/ti-connectivity/wl1271-nvs.bin + ln -sf /var/oem/mts/wl1271-nvs.bin ${D}/lib/firmware/ti-connectivity/wl127x-nvs.bin + install ${WORKDIR}/calibrate-wifi ${D}/sbin # bluetooth firmware install ${WORKDIR}/TIInit_7.6.15.bts ${D}/lib/firmware/ti-connectivity/TIInit_7.6.15.bts } -FILES_${PN} = "/lib/firmware" +FILES_${PN} = "/lib/firmware /sbin" |