. /lib/functions.sh
. /lib/functions/system.sh
-. /lib/functions/lantiq.sh
. /lib/upgrade/nand.sh
# xor multiple hex values of the same length
ath9k_eeprom_die "failed to extract from $mtd"
}
+ath9k_eeprom_extract_reverse() {
+ local part=$1
+ local offset=$2
+ local count=$3
+ local mtd
+ local reversed
+ local caldata
+
+ mtd=$(find_mtd_chardev "$part")
+ reversed=$(hexdump -v -s $offset -n $count -e '/1 "%02x "' $mtd)
+
+ for byte in $reversed; do
+ caldata="\x${byte}${caldata}"
+ done
+
+ printf "%b" "$caldata" > /lib/firmware/$FIRMWARE
+}
+
ath9k_eeprom_extract() {
local part=$1
local offset=$2
"ath9k-eeprom-pci-0000:00:0e.0.bin" | \
"ath9k-eeprom-pci-0000:01:00.0.bin" | \
"ath9k-eeprom-pci-0000:02:00.0.bin")
- board=$(lantiq_board_name)
+ board=$(board_name)
case "$board" in
- ARV7518PW)
+ arcadyan,arv7518pw)
ath9k_eeprom_extract "boardconfig" 1024 1
;;
- ARV8539PW22)
+ arcadyan,arv8539pw22)
ath9k_eeprom_extract "art" 1024 1
;;
- BTHOMEHUBV2B)
+ bt,homehub-v2b)
ath9k_eeprom_extract "art" 0 1
ath9k_patch_fw_mac_crc "00:00:00:00:00:00" 524
;;
- BTHOMEHUBV3A)
+ bt,homehub-v3a)
ath9k_eeprom_extract "art-copy" 0 1
ath9k_patch_fw_mac_crc $(macaddr_add $(mtd_get_mac_ascii uboot_env ethaddr) +2) 268
;;
- BTHOMEHUBV5A)
+ bt,homehub-v5a)
ath9k_ubi_eeprom_extract "caldata" 4096 0
ath9k_patch_fw_mac_crc $(macaddr_add $(mtd_get_mac_binary_ubi caldata 4364) +2) 268
;;
- DGN3500*)
+ netgear,dgn3500|netgear,dgn3500b)
ath9k_eeprom_extract "calibration" 61440 0
ath9k_patch_fw_mac_crc $(macaddr_add $(mtd_get_mac_ascii uboot-env ethaddr) +2) 524
;;
- FRITZ3370)
- ath9k_eeprom_extract "urlader" 2437 0
- ath9k_patch_fw_mac "00:00:00:00:00:00" 2
+ avm,fritz3370-rev2-hynix|\
+ avm,fritz3370-rev2-micron)
+ ath9k_eeprom_extract_reverse "urlader" 5441 1088
;;
- FRITZ7320|FRITZ7360SL)
+ avm,fritz7312|avm,fritz7320|avm,fritz7360sl)
ath9k_eeprom_extract "urlader" 2437 0
- ath9k_patch_fw_mac_crc "00:00:00:00:00:00" 268
;;
- TDW8970|TDW8980)
+ tplink,tdw8970|tplink,tdw8980)
ath9k_eeprom_extract "boardconfig" 135168 0
;;
*)