ramips: add support for Mikrotik LtAP-2HnD
[openwrt/openwrt.git] / target / linux / ramips / mt7621 / 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_mikrotik_ath9k() {
8 local offset=$(($1))
9 local count=$(($2))
10 local macaddr=$3
11 local wlan_data="/sys/firmware/mikrotik/hard_config/wlan_data"
12
13 caldata_from_file $wlan_data $offset $count /tmp/$FIRMWARE
14 ath9k_patch_mac "$macaddr" /tmp/$FIRMWARE
15 caldata_sysfsload_from_file /tmp/$FIRMWARE 0x0 $count
16 rm -f /tmp/$FIRMWARE
17 }
18
19 board=$(board_name)
20
21 case "$FIRMWARE" in
22 "ath9k-eeprom-pci-0000:01:00.0.bin")
23 case $board in
24 mikrotik,ltap-2hnd)
25 mac_base="$(cat /sys/firmware/mikrotik/hard_config/mac_base)"
26 caldata_mikrotik_ath9k 0x5000 0x440 $(macaddr_add "$mac_base" 1)
27 ;;
28 *)
29 caldata_die "board $board is not supported yet"
30 ;;
31 esac
32 ;;
33 esac