[openwrt/openwrt] ar71xx: fix 5 GHz Wi-Fi on NBG6716

LEDE Commits lede-commits at lists.infradead.org
Thu Feb 22 15:23:02 PST 2018


pepe2k pushed a commit to openwrt/openwrt.git, branch master:
https://git.lede-project.org/2ea98fc39b21392c1556d6768604f54a578278d4

commit 2ea98fc39b21392c1556d6768604f54a578278d4
Author: Matti Laakso <matti.laakso at outlook.com>
AuthorDate: Sun Jan 14 17:39:53 2018 +0200

    ar71xx: fix 5 GHz Wi-Fi on NBG6716
    
    Some NBG6716 do not have ath10k calibration data in flash, only in chip
    OTP. To determine if flash has a valid calibration data, the first two
    bytes telling the length of the calibration data are checked against the
    requested length. If the lengths match, calibration data is valid and
    read from flash.
    
    Signed-off-by: Matti Laakso <matti.laakso at outlook.com>
---
 .../ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata    | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index a3d4867..e6ea873 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -18,12 +18,18 @@ ath10kcal_extract() {
 	local part=$1
 	local offset=$2
 	local count=$3
-	local mtd
+	local mtd cal_size
 
 	mtd=$(find_mtd_chardev $part)
 	[ -n "$mtd" ] || \
 		ath10kcal_die "no mtd device found for partition $part"
 
+	# Check that the calibration data size in header equals the desired size
+	cal_size=$(dd if=$mtd bs=2 count=1 skip=$(( $offset / 2 )) conv=swab 2>/dev/null | hexdump -ve '1/2 "%d"')
+
+	[ "$count" = "$cal_size" ] || \
+		ath10kcal_die "no calibration data found in $part"
+
 	dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
 		ath10kcal_die "failed to extract calibration data from $mtd"
 }



More information about the lede-commits mailing list