bmips: hg556a: switch to kmod-owl-loader
[openwrt/staging/dedeckeh.git] / target / linux / bmips / bcm6358 / base-files / etc / hotplug.d / firmware / 10-ath9k-eeprom
1 #!/bin/sh
2
3 [ -e /lib/firmware/$FIRMWARE ] && exit 0
4
5 . /lib/functions/caldata.sh
6
7 caldata_extract_swap() {
8 local part=$1
9 local offset=$2
10 local count=$3
11 local mtd
12
13 mtd=$(find_mtd_chardev $part)
14 [ -n "$mtd" ] || caldata_die "no mtd device found for partition $part"
15
16 offset=$(($offset / 2))
17 count=$(($count / 2))
18
19 dd if=$mtd of=/lib/firmware/$FIRMWARE bs=2 skip=$offset count=$count conv=swab 2>/dev/null || \
20 caldata_die "failed to extract calibration data from $mtd"
21 }
22
23 case "$FIRMWARE" in
24 "ath9k-eeprom-pci-0000:00:01.0.bin")
25 case "$(board_name)" in
26 huawei,hg556a-b)
27 caldata_extract_swap "cal_data" 0x1e000 0xeb8
28 ;;
29 *)
30 caldata_die "board $board is not supported yet"
31 ;;
32 esac
33 ;;
34 esac