ar71xx: add support for TP-Link Archer C60 v2
[openwrt/staging/wigyori.git] / target / linux / ar71xx / base-files / etc / hotplug.d / firmware / 11-ath10k-caldata
index f1301d0556c9b1fa67594fbe87b193eb14c3115f..5d01701aa89a9e0fb387d10c9c6e72e8be0f1129 100644 (file)
@@ -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"
 }
@@ -63,12 +69,14 @@ case "$FIRMWARE" in
                ath10kcal_extract "art" 20480 2116
                ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -1)
                ;;
-       cf-e355ac|\
+       cf-e355ac-v1|\
        cf-e380ac-v1|\
        cf-e380ac-v2|\
        dlan-pro-1200-ac|\
        e1700ac-v2|\
        e600gac-v2|\
+       oolite-v5.2|\
+       oolite-v5.2-dev|\
        sr3200|\
        xd3200)
                ath10kcal_extract "art" 20480 2116
@@ -155,12 +163,16 @@ case "$FIRMWARE" in
        archer-c58-v1|\
        archer-c59-v1|\
        archer-c60-v1|\
+       archer-c60-v2|\
        cf-e355ac-v2|\
        cf-e375ac)
                ath10kcal_extract "art" 20480 12064
                ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
                        /lib/firmware/ath10k/QCA9888/hw2.0/board.bin
                ;;
+       cf-e385ac)
+               ath10kcal_extract "art" 20480 12064
+               ;;
        esac
        ;;
 *)