ipq806x: add support for Nokia Airscale AC400i
[openwrt/openwrt.git] / target / linux / ipq806x / base-files / etc / hotplug.d / firmware / 11-ath10k-caldata
1 #!/bin/sh
2
3 [ -e /lib/firmware/$FIRMWARE ] && exit 0
4
5 . /lib/functions/caldata.sh
6
7 board=$(board_name)
8
9 dt_base64_extract() {
10 local target_dir="/sys$DEVPATH"
11 local source="$target_dir/../../of_node/qcom,ath10k-calibration-data-base64"
12
13 [ -e "$source" ] || caldata_die "cannot find base64 calibration data: $source"
14 [ -d "$target_dir" ] || \
15 caldata_die "no sysfs dir to write: $target"
16
17 echo 1 > "$target_dir/loading"
18 base64decode.uc "$source" > "$target_dir/data"
19 if [ $? != 0 ]; then
20 echo 1 > "$target_dir/loading"
21 caldata_die \
22 "failed to write calibration data to $target_dir/data"
23 else
24 echo 0 > "$target_dir/loading"
25 fi
26 }
27
28 case "$FIRMWARE" in
29 "ath10k/cal-pci-0000:01:00.0.bin")
30 case "$board" in
31 asus,onhub |\
32 tplink,onhub)
33 dt_base64_extract
34 ;;
35 meraki,mr52)
36 CI_UBIPART=art
37 caldata_extract_ubi "ART" 0x1000 0x844
38 ;;
39 esac
40 ;;
41 "ath10k/pre-cal-pci-0000:01:00.0.bin")
42 case $board in
43 asrock,g10)
44 caldata_extract "0:art" 0x1000 0x2f20
45 ;;
46 linksys,ea7500-v1 |\
47 linksys,ea8500)
48 caldata_extract "art" 0x1000 0x2f20
49 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) 1)
50 ;;
51 meraki,mr42)
52 CI_UBIPART=art
53 caldata_extract_ubi "ART" 0x1000 0x2f20
54 ;;
55 nokia,ac400i)
56 caldata_extract "0:art" 0x1000 0x2f20
57 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii 0:appsblenv ethaddr) +2)
58 ;;
59 zyxel,nbg6817)
60 caldata_extract "0:art" 0x1000 0x2f20
61 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii 0:appsblenv ethaddr) 1)
62 ;;
63 esac
64 ;;
65 "ath10k/cal-pci-0001:01:00.0.bin")
66 case "$board" in
67 asus,onhub |\
68 tplink,onhub)
69 dt_base64_extract
70 ;;
71 esac
72 ;;
73 "ath10k/pre-cal-pci-0001:01:00.0.bin")
74 case $board in
75 asrock,g10)
76 caldata_extract "0:art" 0x5000 0x2f20
77 ;;
78 edgecore,ecw5410)
79 caldata_extract "0:art" 0x1000 0x2f20
80 ;;
81 linksys,ea7500-v1 |\
82 linksys,ea8500)
83 caldata_extract "art" 0x5000 0x2f20
84 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) 2)
85 ;;
86 meraki,mr42 |\
87 meraki,mr52)
88 CI_UBIPART=art
89 caldata_extract_ubi "ART" 0x5000 0x2f20
90 ;;
91 nokia,ac400i)
92 caldata_extract "0:art" 0x5000 0x2f20
93 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii 0:appsblenv ethaddr) +3)
94 ;;
95 zyxel,nbg6817)
96 caldata_extract "0:art" 0x5000 0x2f20
97 ath10k_patch_mac $(mtd_get_mac_ascii 0:appsblenv ethaddr)
98 ;;
99 esac
100 ;;
101 "ath10k/cal-pci-0002:01:00.0.bin")
102 case "$board" in
103 asus,onhub |\
104 tplink,onhub)
105 dt_base64_extract
106 ;;
107 meraki,mr42)
108 CI_UBIPART=art
109 caldata_extract_ubi "ART" 0x9000 0x844
110 ;;
111 esac
112 ;;
113 "ath10k/pre-cal-pci-0002:01:00.0.bin")
114 case $board in
115 edgecore,ecw5410)
116 caldata_extract "0:art" 0x5000 0x2f20
117 ;;
118 meraki,mr52)
119 CI_UBIPART=art
120 caldata_extract_ubi "ART" 0x9000 0x2f20
121 ;;
122 esac
123 ;;
124 *)
125 exit 1
126 ;;
127 esac