56d083b4bfc5be33d8e76df5665ab5f9b532257b
[openwrt/openwrt.git] / target / linux / ath79 / generic / 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 board=$(board_name)
8
9 case "$FIRMWARE" in
10 "ath9k-eeprom-ahb-18100000.wmac.bin")
11 case $board in
12 avm,fritz1750e|\
13 avm,fritz4020|\
14 avm,fritz450e)
15 caldata_extract_reverse "urlader" 0x1541 0x440
16 ;;
17 dlink,dap-2695-a1)
18 caldata_extract "art" 0x1000 0x440
19 ath9k_patch_mac $(mtd_get_mac_ascii bdcfg "wlanmac")
20 ;;
21 dlink,dir-505|\
22 dlink,dir-825-c1|\
23 dlink,dir-835-a1)
24 caldata_extract "art" 0x1000 0x440
25 ath9k_patch_mac $(mtd_get_mac_text "mac" 0x4)
26 ;;
27 dlink,dir-842-c1|\
28 dlink,dir-842-c2|\
29 dlink,dir-842-c3|\
30 dlink,dir-859-a1|\
31 nec,wg1200cr|\
32 wd,mynet-n750)
33 caldata_extract "art" 0x1000 0x440
34 ath9k_patch_mac $(mtd_get_mac_ascii devdata "wlan24mac")
35 ;;
36 engenius,ecb1750)
37 caldata_extract "art" 0x1000 0x440
38 ath9k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env "athaddr") +1)
39 ;;
40 engenius,epg5000|\
41 iodata,wn-ac1167dgr|\
42 iodata,wn-ac1600dgr|\
43 iodata,wn-ac1600dgr2|\
44 iodata,wn-ag300dgr|\
45 sitecom,wlr-7100|\
46 sitecom,wlr-8100)
47 caldata_extract "art" 0x1000 0x440
48 ath9k_patch_mac $(mtd_get_mac_ascii u-boot-env ethaddr)
49 ;;
50 enterasys,ws-ap3705i)
51 caldata_extract "calibrate" 0x1000 0x440
52 ath9k_patch_mac $(mtd_get_mac_ascii u-boot-env0 RADIOADDR1)
53 ;;
54 nec,wg800hp)
55 caldata_extract "art" 0x1000 0x440
56 ath9k_patch_mac $(mtd_get_mac_text board_data 0x680)
57 ;;
58 qihoo,c301)
59 caldata_extract "radiocfg" 0x1000 0x440
60 ath9k_patch_mac $(mtd_get_mac_ascii devdata "wlan24mac")
61 ;;
62 *)
63 caldata_die "board $board is not supported yet"
64 ;;
65 esac
66 ;;
67 "ath9k-eeprom-pci-0000:00:00.0.bin")
68 case $board in
69 avm,fritz300e)
70 caldata_extract_reverse "urloader" 0x1541 0x440
71 ;;
72 buffalo,wzr-hp-g302h-a1a0)
73 caldata_extract "art" 0x1000 0xeb8
74 ;;
75 buffalo,wzr-hp-g450h)
76 caldata_extract "art" 0x1000 0x440
77 ;;
78 dlink,dir-825-c1|\
79 dlink,dir-835-a1)
80 caldata_extract "art" 0x5000 0x440
81 ath9k_patch_mac $(macaddr_add $(mtd_get_mac_text "mac" 0x18) 1)
82 ;;
83 enterasys,ws-ap3705i)
84 caldata_extract "calibrate" 0x5000 0x440
85 ath9k_patch_mac $(mtd_get_mac_ascii u-boot-env0 RADIOADDR0)
86 ;;
87 ocedo,raccoon|\
88 tplink,tl-wdr3500-v1|\
89 tplink,tl-wdr3600-v1|\
90 tplink,tl-wdr4300-v1|\
91 tplink,tl-wdr4300-v1-il|\
92 tplink,tl-wdr4310-v1|\
93 tplink,tl-wdr4900-v2|\
94 winchannel,wb2000)
95 caldata_extract "art" 0x5000 0x440
96 ;;
97 netgear,wnr2200-8m|\
98 netgear,wnr2200-16m|\
99 pcs,cap324|\
100 tplink,tl-wr2543-v1|\
101 tplink,tl-wr842n-v1|\
102 ubnt,airrouter|\
103 ubnt,bullet-m-ar7240|\
104 ubnt,bullet-m-ar7241|\
105 ubnt,nanobridge-m|\
106 ubnt,nanostation-loco-m|\
107 ubnt,nanostation-m|\
108 ubnt,picostation-m|\
109 ubnt,rocket-m)
110 caldata_extract "art" 0x1000 0x1000
111 ;;
112 ubnt,unifi)
113 caldata_extract "art" 0x1000 0x800
114 ;;
115 wd,mynet-n750)
116 caldata_extract "art" 0x5000 0x440
117 ath9k_patch_mac $(mtd_get_mac_ascii devdata "wlan5mac")
118 ;;
119 wd,mynet-wifi-rangeextender)
120 caldata_extract "art" 0x1000 0x1000
121 ath9k_patch_mac $(nvram get wl0_hwaddr)
122 ;;
123 *)
124 caldata_die "board $board is not supported yet"
125 ;;
126 esac
127 ;;
128 "ath9k-eeprom-pci-0000:00:11.0.bin")
129 case $board in
130 buffalo,wzr-hp-ag300h|\
131 netgear,wndr3700|\
132 netgear,wndr3700-v2|\
133 netgear,wndr3800|\
134 netgear,wndr3800ch|\
135 netgear,wndrmac-v1|\
136 netgear,wndrmac-v2)
137 caldata_extract "art" 0x1000 0xeb8
138 ;;
139 dlink,dir-825-b1)
140 caldata_extract "caldata" 0x1000 0xeb8
141 ath9k_patch_mac_crc $(mtd_get_mac_text "caldata" 0xffa0) 0x20c
142 ;;
143 *)
144 caldata_die "board $board is not supported yet"
145 ;;
146 esac
147 ;;
148 "ath9k-eeprom-pci-0000:00:12.0.bin")
149 case $board in
150 buffalo,wzr-hp-ag300h|\
151 netgear,wndr3700|\
152 netgear,wndr3700-v2|\
153 netgear,wndr3800|\
154 netgear,wndr3800ch|\
155 netgear,wndrmac-v1|\
156 netgear,wndrmac-v2)
157 caldata_extract "art" 0x5000 0xeb8
158 ;;
159 dlink,dir-825-b1)
160 caldata_extract "caldata" 0x5000 0xeb8
161 ath9k_patch_mac_crc $(macaddr_add $(mtd_get_mac_text "caldata" 0xffb4) 1) 0x20c
162 ;;
163 *)
164 caldata_die "board $board is not supported yet"
165 ;;
166 esac
167 ;;
168 esac