ath79: ar724x: fix pll settings
[openwrt/staging/dedeckeh.git] / target / linux / ath79 / base-files / etc / hotplug.d / firmware / 10-ath9k-eeprom
1 #!/bin/sh
2
3 [ -e /lib/firmware/$FIRMWARE ] && exit 0
4
5 . /lib/functions.sh
6 . /lib/functions/system.sh
7
8 ath9k_eeprom_die() {
9 echo "ath9k eeprom: " "$*"
10 exit 1
11 }
12
13 ath9k_eeprom_extract() {
14 local part=$1
15 local offset=$2
16 local count=$3
17 local mtd
18
19 mtd=$(find_mtd_chardev $part)
20 [ -n "$mtd" ] || \
21 ath9k_eeprom_die "no mtd device found for partition $part"
22
23 dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
24 ath9k_eeprom_die "failed to extract from $mtd"
25 }
26
27 board=$(board_name)
28
29 case "$FIRMWARE" in
30 "ath9k-eeprom-pci-0000:00:00.0.bin")
31 case $board in
32 "ubnt,unifi")
33 ath9k_eeprom_extract "art" 4096 2048
34 ;;
35 *)
36 ath9k_eeprom_die "board $board is not supported yet"
37 ;;
38 esac
39 ;;
40 esac