--- /dev/null
+#!/bin/sh
+# Based on ar71xx 10-ath9k-eeprom
+
+[ -e /lib/firmware/$FIRMWARE ] && exit 0
+
+. /lib/functions.sh
+. /lib/functions/system.sh
+. /lib/functions/lantiq.sh
+. /lib/upgrade/nand.sh
+
+# xor multiple hex values of the same length
+xor() {
+ local val
+ local ret="0x$1"
+ local retlen=${#1}
+
+ shift
+ while [ -n "$1" ]; do
+ val="0x$1"
+ ret=$((ret ^ val))
+ shift
+ done
+
+ printf "%0${retlen}x" "$ret"
+}
+
+ath9k_eeprom_die() {
+ echo "ath9k eeprom: $*"
+ exit 1
+}
+
+ath9k_eeprom_extract_raw() {
+ local source=$1
+ local offset=$2
+ local size=4096
+
+ dd if=$source of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$size 2>/dev/null || \
+ ath9k_eeprom_die "failed to extract from $mtd"
+}
+
+ath9k_eeprom_extract() {
+ local part=$1
+ local offset=$2
+ local mtd
+
+ mtd=$(find_mtd_chardev $part)
+ [ -n "$mtd" ] || \
+ ath9k_eeprom_die "no mtd device found for partition $part"
+
+ ath9k_eeprom_extract_raw $mtd $offset
+}
+
+ath9k_ubi_eeprom_extract() {
+ local part=$1
+ local offset=$2
+ local ubidev=$(nand_find_ubi $CI_UBIPART)
+ local ubi
+
+ ubi=$(nand_find_volume $ubidev $part)
+ [ -n "$ubi" ] || \
+ ath9k_eeprom_die "no UBI volume found for $part"
+
+ ath9k_eeprom_extract_raw /dev/$ubi $offset
+}
+
+ath9k_patch_firmware_mac() {
+ local mac=$1
+ local mac_offset=$2
+ local swap=$3
+ local chksum_offset=$4
+ local xor_mac
+ local xor_fw_mac
+ local xor_fw_chksum
+
+ [ -z "$mac" -o -z "$mac_offset" ] && return
+
+ [ $swap -gt 0 ] && mac="${mac:3:2}:${mac:0:2}:${mac:9:2}:${mac:6:2}:${mac:15:2}:${mac:12:2}"
+
+ [ -n "$chksum_offset" ] && {
+ xor_mac=${mac//:/}
+ xor_mac="${xor_mac:0:4} ${xor_mac:4:4} ${xor_mac:8:4}"
+
+ xor_fw_mac=$(hexdump -v -n 6 -s $mac_offset -e '/1 "%02x"' /lib/firmware/$FIRMWARE)
+ xor_fw_mac="${xor_fw_mac:0:4} ${xor_fw_mac:4:4} ${xor_fw_mac:8:4}"
+
+ xor_fw_chksum=$(hexdump -v -n 2 -s $chksum_offset -e '/1 "%02x"' /lib/firmware/$FIRMWARE)
+ xor_fw_chksum=$(xor $xor_fw_chksum $xor_fw_mac $xor_mac)
+
+ printf "%b" "\x${xor_fw_chksum:0:2}\x${xor_fw_chksum:2:2}" | \
+ dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=$chksum_offset count=2
+ }
+
+ macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=$mac_offset count=6
+}
+
+case "$FIRMWARE" in
+ "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)
+
+ case "$board" in
+ ARV7518PW)
+ ath9k_eeprom_extract "boardconfig" 1024
+ ;;
+ ARV8539PW22)
+ ath9k_eeprom_extract "art" 1024
+ ;;
+ BTHOMEHUBV2B)
+ ath9k_eeprom_extract "art" 0
+ ath9k_patch_firmware_mac "00:00:00:00:00:00" 524 1 514
+ ;;
+ BTHOMEHUBV3A)
+ ath9k_eeprom_extract "art-copy" 0
+ ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_ascii uboot-env ethaddr) +2) 268 1 258
+ ;;
+ BTHOMEHUBV5A)
+ ath9k_eeprom_extract "caldata" 4096
+ ;;
+ DGN3500*)
+ ath9k_eeprom_extract "calibration" 61440
+ ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_ascii uboot-env ethaddr) +2) 524 0 514
+ ;;
+ FRITZ3370)
+ ath9k_eeprom_extract "urlader" 2437
+ ath9k_patch_firmware_mac "00:00:00:00:00:00" 2 0
+ ;;
+ FRITZ7320|FRITZ7360SL)
+ ath9k_eeprom_extract "urlader" 2437
+ ath9k_patch_firmware_mac "00:00:00:00:00:00" 268 0 258
+ ;;
+ TDW8970|TDW8980)
+ ath9k_eeprom_extract "boardconfig" 135168
+ ;;
+ *)
+ ath9k_eeprom_die "board $board is not supported yet"
+ ;;
+ esac
+ ;;
+esac
gpio-controller;
lantiq,shadow = <0x0>;
};
-
- ath9k_eep {
- compatible = "ath9k,eeprom";
- ath,eep-flash = <&boardconfig 0x400>;
- ath,mac-offset = <0x16>;
- ath,mac-increment = <1>;
- ath,pci-slot = <14>;
- ath,eep-endian;
- };
};
gpio: pinmux@E100B10 {
status = "okay";
gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
};
-
- pci@E105400 {
- status = "okay";
- lantiq,external-clock;
- gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>;
- req-mask = <0xf>;
- };
};
/*
};
};
};
+
+&pci0 {
+ status = "okay";
+ gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>;
+ lantiq,external-clock;
+ req-mask = <0xf>;
+
+ wifi@168c,0029 {
+ compatible = "pci168c,0029";
+ reg = <0x7000 0 0 0 0>;
+ qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */
+ mtd-mac-address = <&boardconfig 0x16>;
+ mtd-mac-address-increment = <1>;
+ };
+};
};
};
};
-
- ath9k_eep {
- compatible = "ath9k,eeprom";
- ath,eep-flash = <&art 0x400>;
- ath,mac-offset = <0x16>;
- ath,mac-increment = <1>;
- ath,pci-slot = <14>;
- ath,eep-endian;
- };
};
gpio: pinmux@E100B10 {
mtd-mac-address = <&art 0x16>;
};
- pci@E105400 {
- status = "okay";
- gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>;
- };
-
ifxhcd@E101000 {
status = "okay";
gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
};
};
+&pci0 {
+ status = "okay";
+ gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>;
+
+ wifi@168c,0029 {
+ compatible = "pci168c,0029";
+ reg = <0x7000 0 0 0 0>;
+ qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */
+ mtd-mac-address = <&art 0x16>;
+ mtd-mac-address-increment = <1>;
+ };
+};
};
};
};
-
- ath9k_eep {
- compatible = "ath9k,eeprom";
- ath,eep-flash = <&ath9k_cal 0x0000>;
- ath,mac-increment = <1>;
- ath,pci-slot = <14>;
- ath,eep-endian;
- };
};
gpio: pinmux@E100B10 {
gpios: stp@E100BB0 {
status = "okay";
};
-
- pci@E105400 {
- status = "okay";
- gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>;
- };
};
gpio-keys-polled {
};
};
+&pci0 {
+ status = "okay";
+ gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>;
+
+ wifi@168c,0027 {
+ compatible = "pci168c,0027";
+ reg = <0x7000 0 0 0 0>;
+ qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */
+ };
+};
};
};
};
-
- ath9k_eep {
- compatible = "ath9k,eeprom";
- ath,eep-flash = <&ath9k_cal 0x0000>;
- ath,pci-slot = <14>;
- ath,eep-endian;
- };
};
gpio: pinmux@E100B10 {
status = "okay";
gpios = <&gpio 33 GPIO_ACTIVE_HIGH>;
};
-
- pci@E105400 {
- status = "okay";
- gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>;
- };
};
gpio-keys-polled {
};
};
};
+
+&pci0 {
+ status = "okay";
+ gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>;
+
+ ath9k@7000 {
+ reg = <0x7000 0 0 0 0>;
+ qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */
+ };
+};
status = "okay";
gpios = <&gpio 33 GPIO_ACTIVE_HIGH>;
};
-
- pci@E105400 {
- status = "okay";
- gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>;
- };
};
gphy-xrx200 {
phys = [ 00 01 ];
};
- ath9k_eep {
- compatible = "ath9k,eeprom";
- ath,eep-flash = <&caldata 0x1000>;
- ath,mac-offset = <0x110c>;
- ath,mac-increment = <2>;
- ath,pci-slot = <0xe>; /* 14 */
- };
-
gpio-keys-polled {
compatible = "gpio-keys-polled";
#address-cells = <1>;
};
};
+&pci0 {
+ status = "okay";
+ gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>;
+
+ wifi@168c,002d {
+ compatible = "pci168c,002d";
+ reg = <0x7000 0 0 0 0>;
+ qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */
+ qca,disable-5ghz;
+ mtd-mac-address = <&caldata 0x110c>;
+ mtd-mac-address-increment = <2>;
+ };
+};
+
ð0 {
lan: interface@0 {
compatible = "lantiq,xrx200-pdi";
ifxhcd@E101000 {
status = "okay";
};
-
- pci@E105400 {
- status = "okay";
- gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>;
- };
- };
-
- ath9k_eep {
- compatible = "ath9k,eeprom";
- ath,eep-flash = <&ath9k_cal 0xf000>;
- ath,pci-slot = <14>;
- ath,eep-endian;
- ath,eep-swap;
};
rtl8366rb {
};
};
+&pci0 {
+ status = "okay";
+ gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>;
+
+ wifi@168c,0029 {
+ compatible = "pci168c,0029";
+ reg = <0x7000 0 0 0 0>;
+ qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */
+ };
+};
+
&spi {
pinctrl-names = "default";
pinctrl-0 = <&pins_spi_default>;
};
};
- ath9k_eep {
- compatible = "ath9k,eeprom";
- ath,eep-flash = <&ath9k_cal 0x985>;
- ath,eep-endian;
- ath,eep-swap;
- };
-
gphy-xrx200 {
compatible = "lantiq,phy-xrx200";
firmware = "lantiq/vr9_phy11g_a1x.bin";
reg = <4 0>;
spi-max-frequency = <1000000>;
- ath9k_cal: partition@0 {
+ partition@0 {
reg = <0x0 0x20000>;
label = "urlader";
read-only;
};
};
};
+
+&pcie0 {
+ pcie@0 {
+ reg = <0 0 0 0 0>;
+ #interrupt-cells = <1>;
+ #size-cells = <2>;
+ #address-cells = <3>;
+ device_type = "pci";
+
+ wifi@0,0 {
+ compatible = "pci0,0";
+ reg = <0 0 0 0 0>;
+ qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:01:00.0.bin */
+ };
+ };
+};
};
};
- ath9k_eep {
- compatible = "ath9k,eeprom";
- ath,eep-flash = <&ath9k_cal 0x985>;
- ath,device-id = /bits/ 16 <0xff1d 0x2d>;
- ath,eep-endian;
- ath,eep-swap;
- };
-
gpio: pinmux@E100B10 {
pinctrl-names = "default";
pinctrl-0 = <&state_default>;
ifxhcd@E101000 {
status = "okay";
};
-
- pci@E105400 {
- status = "okay";
- req-mask = <0xf>;
- gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>;
- };
};
gpio-keys-polled {
};
};
};
+
+&pci0 {
+ status = "okay";
+ req-mask = <0xf>;
+ gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>;
+
+ wifi@0,0 {
+ compatible = "pci0,0";
+ reg = <0x7000 0 0 0 0>;
+ qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */
+ };
+};
};
};
- ath9k_eep {
- compatible = "ath9k,eeprom";
- ath,eep-flash = <&urlader 0x985>;
- ath,eep-endian;
- ath,eep-swap;
- ath,pci-slot = <0>;
- };
-
gphy-xrx200 {
compatible = "lantiq,phy-xrx200";
firmware = "lantiq/vr9_phy11g_a2x.bin";
};
};
};
+
+&pcie0 {
+ pcie@0 {
+ reg = <0 0 0 0 0>;
+ #interrupt-cells = <1>;
+ #size-cells = <2>;
+ #address-cells = <3>;
+ device_type = "pci";
+
+ wifi@168c,002e {
+ compatible = "pci168c,002e";
+ reg = <0 0 0 0 0>;
+ qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:01:00.0.bin */
+ };
+ };
+};
};
};
- ath9k_eep {
- ath,pci-slot = <0>;
- };
-
gpio-leds {
wifi2 {
label = "tdw8980:green:wlan5ghz";
led-dsl = &dsl;
led-internet = &internet;
+ led-wifi = &wifi;
led-usb = &usb0;
led-usb2 = &usb2;
};
phys = [ 00 01 ];
};
- ath9k_eep {
- compatible = "ath9k,eeprom";
- ath,eep-flash = <&ath9k_cal 0x21000>;
- ath,mac-offset = <0xf100>;
- ath,mac-increment = <2>;
- ath,led-pin = <0>;
- ath,disable-5ghz;
- ath,led-active-high;
- };
-
gpio-keys-polled {
compatible = "gpio-keys-polled";
#address-cells = <1>;
gpios = <&gpio 37 GPIO_ACTIVE_HIGH>;
};
};
+
+ wifi-leds {
+ compatible = "gpio-leds";
+
+ wifi: wifi {
+ label = "tdw89x0:green:wifi";
+ gpios = <&ath9k 0 GPIO_ACTIVE_HIGH>;
+ };
+ };
};
&spi {
};
};
};
+
+&pcie0 {
+ pcie@0 {
+ reg = <0 0 0 0 0>;
+ #interrupt-cells = <1>;
+ #size-cells = <2>;
+ #address-cells = <3>;
+ device_type = "pci";
+
+ ath9k: wifi@168c,002e {
+ compatible = "pci168c,002e";
+ reg = <0 0 0 0 0>;
+ #gpio-cells = <2>;
+ gpio-controller;
+ qca,no-eeprom;
+ qca,disable-5ghz;
+ mtd-mac-address = <&ath9k_cal 0xf100>;
+ mtd-mac-address-increment = <2>;
+ };
+ };
+};
kmod-ltq-adsl-danube-fw-a kmod-ltq-atm-danube \
kmod-ltq-deu-danube \
ltq-adsl-app ppp-mod-pppoa \
- kmod-ath9k wpad-mini
+ kmod-ath9k kmod-owl-loader wpad-mini
endef
TARGET_DEVICES += BTHOMEHUBV2B
kmod-ltq-adsl-danube-mei kmod-ltq-adsl-danube \
kmod-ltq-adsl-danube-fw-a kmod-ltq-atm-danube \
ltq-adsl-app ppp-mod-pppoa \
- kmod-ath9k wpad-mini
+ kmod-ath9k kmod-owl-loader wpad-mini
endef
TARGET_DEVICES += ARV7518PW
kmod-ltq-adsl-danube-mei kmod-ltq-adsl-danube \
kmod-ltq-adsl-danube-fw-b kmod-ltq-atm-danube \
ltq-adsl-app ppp-mod-pppoa \
- kmod-ath9k wpad-mini
+ kmod-ath9k kmod-owl-loader wpad-mini
endef
TARGET_DEVICES += ARV8539PW22
kmod-ltq-adsl-ar9-fw-a kmod-ltq-atm-ar9 \
kmod-ltq-deu-ar9 \
ltq-adsl-app ppp-mod-pppoa \
- kmod-ath9k wpad-mini uboot-envtools
+ kmod-ath9k kmod-owl-loader wpad-mini \
+ uboot-envtools
endef
TARGET_DEVICES += BTHOMEHUBV3A
check-size 16320k | pad-to 16384k
DEVICE_TITLE := Netgear DGN3500
DEVICE_PACKAGES := kmod-usb-dwc2 kmod-usb-ledtrig-usbport \
- kmod-ath9k wpad-mini \
+ kmod-ath9k kmod-owl-loader wpad-mini \
kmod-ltq-adsl-ar9-mei kmod-ltq-adsl-ar9 \
kmod-ltq-adsl-ar9-fw-a kmod-ltq-atm-ar9 \
ltq-adsl-app ppp-mod-pppoa \
check-size 16320k | pad-to 16384k
DEVICE_TITLE := Netgear DGN3500B
DEVICE_PACKAGES := kmod-usb-dwc2 kmod-usb-ledtrig-usbport \
- kmod-ath9k wpad-mini \
+ kmod-ath9k kmod-owl-loader wpad-mini \
kmod-ltq-adsl-ar9-mei kmod-ltq-adsl-ar9 \
kmod-ltq-adsl-ar9-fw-b kmod-ltq-atm-ar9 \
ltq-adsl-app ppp-mod-pppoa \
kmod-ltq-adsl-ar9-mei kmod-ltq-adsl-ar9 \
kmod-ltq-adsl-ar9-fw-a kmod-ltq-atm-ar9 \
ltq-adsl-app ppp-mod-pppoa \
- kmod-ath9k wpad-mini
+ kmod-ath9k kmod-owl-loader wpad-mini
endef
TARGET_DEVICES += WBMRA
kmod-ltq-adsl-ar9-mei kmod-ltq-adsl-ar9 \
kmod-ltq-adsl-ar9-fw-b kmod-ltq-atm-ar9 \
ltq-adsl-app ppp-mod-pppoa \
- kmod-ath9k wpad-mini
+ kmod-ath9k kmod-owl-loader wpad-mini
endef
TARGET_DEVICES += WBMRB
$(Device/AVM)
IMAGE_SIZE := 15744k
DEVICE_TITLE := 1&1 HomeServer - FRITZ7320
- DEVICE_PACKAGES := kmod-ath9k wpad-mini \
+ DEVICE_PACKAGES := kmod-ath9k kmod-owl-loader wpad-mini \
kmod-ltq-adsl-ar9-mei kmod-ltq-adsl-ar9 \
kmod-ltq-adsl-ar9-fw-b kmod-ltq-atm-ar9 \
ltq-adsl-app ppp-mod-pppoa \
- kmod-ltq-deu-ar9 kmod-usb-dwc2 \
- kmod-ath9k wpad-mini -swconfig
+ kmod-ltq-deu-ar9 kmod-usb-dwc2 -swconfig
endef
TARGET_DEVICES += FRITZ7320
define Device/BTHOMEHUBV5A
$(Device/NAND)
DEVICE_TITLE := BT Home Hub 5A
- DEVICE_PACKAGES := kmod-ath9k kmod-ath10k ath10k-firmware-qca988x wpad-mini kmod-usb-dwc2
+ DEVICE_PACKAGES := kmod-ath9k kmod-owl-loader \
+ kmod-ath10k ath10k-firmware-qca988x wpad-mini kmod-usb-dwc2
endef
TARGET_DEVICES += BTHOMEHUBV5A
$(Device/lantiqFullImage)
IMAGE_SIZE := 64512k
DEVICE_TITLE := Lantiq VR9 - EASY80920NAND
- DEVICE_PACKAGES := kmod-ath9k wpad-mini kmod-usb-dwc2 kmod-usb-ledtrig-usbport
+ DEVICE_PACKAGES := kmod-ath9k kmod-owl-loader wpad-mini kmod-usb-dwc2 kmod-usb-ledtrig-usbport
endef
TARGET_DEVICES += EASY80920NAND
define Device/EASY80920NOR
IMAGE_SIZE := 7936k
DEVICE_TITLE := Lantiq VR9 - EASY80920NOR
- DEVICE_PACKAGES := kmod-ath9k wpad-mini kmod-usb-dwc2 kmod-usb-ledtrig-usbport
+ DEVICE_PACKAGES := kmod-ath9k kmod-owl-loader wpad-mini kmod-usb-dwc2 kmod-usb-ledtrig-usbport
endef
TARGET_DEVICES += EASY80920NOR
$(Device/AVM)
IMAGE_SIZE := 15744k
DEVICE_TITLE := 1&1 HomeServer - FRITZ7360SL
- DEVICE_PACKAGES := kmod-ath9k wpad-mini kmod-usb-dwc2
+ DEVICE_PACKAGES := kmod-ath9k kmod-owl-loader wpad-mini kmod-usb-dwc2
endef
TARGET_DEVICES += FRITZ7360SL
BOARD_ID := TD-W8980v1
IMAGE_SIZE := 7680k
DEVICE_TITLE := TP-LINK TD-W8980
- DEVICE_PACKAGES:= kmod-ath9k wpad-mini kmod-usb-dwc2 kmod-usb-ledtrig-usbport
+ DEVICE_PACKAGES:= kmod-ath9k kmod-owl-loader wpad-mini kmod-usb-dwc2 kmod-usb-ledtrig-usbport
endef
define Device/VR200v