Re: [OpenWrt-Devel] [PATCH 1/3] ipq806x: add support for TP-Link Archer C2600 to makefiles, configs, scripts and device tree
Hi, comments inline On 04/01/2016 02:16, Josh Bendavid wrote: > Add initial support for Archer C2600 to Makefiles, profiles, led/network > config, and hotplug script. Together with firmware-utils and mac80211 > patches this is sufficient to build a working factory image flashable both > from stock web ui and bootloader tftp recovery. Sysupgrade is working as > well. Added hotplug script is adapted from existing script for ar71xx which > copies wireless calibration data from ART partition in flash to appropriate > place in /lib/firmware. The device tree file is similar to the current ap148 > dts, with sata and nand removed, and buttons/led's added. > > Working: Wired network, wireless (both bands), power/status/lan/wan/usb led's > > Not working: wireless status led's (these are not controlled through gpio, > but rather through the QCA9980 pcie chips). Also there is no way to set the > wan led to orange, which is possible in the stock firmware. Kernel 4.1 build > does not boot currently. > > Not tested: Hardware buttons. > > Signed-off-by: Josh Bendavid> > > --- > .../linux/ipq806x/base-files/etc/board.d/01_leds | 7 + > .../ipq806x/base-files/etc/board.d/02_network | 3 +- > .../etc/hotplug.d/firmware/11-ath10k-caldata | 66 + > target/linux/ipq806x/base-files/lib/ipq806x.sh | 3 + > .../ipq806x/base-files/lib/upgrade/platform.sh | 34 ++- > target/linux/ipq806x/image/Makefile| 24 +- > ...qcom-add-TP-Link-Archer-C2600-device-tree.patch | 300 > + > ...qcom-add-TP-Link-Archer-C2600-device-tree.patch | 300 > + > target/linux/ipq806x/profiles/tplink.mk| 20 ++ > 9 files changed, 754 insertions(+), 3 deletions(-) > create mode 100644 > target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata > create mode 100644 > target/linux/ipq806x/patches-3.18/711-ARM-qcom-add-TP-Link-Archer-C2600-device-tree.patch > create mode 100644 > target/linux/ipq806x/patches-4.1/711-ARM-qcom-add-TP-Link-Archer-C2600-device-tree.patch > create mode 100644 target/linux/ipq806x/profiles/tplink.mk > > diff --git a/target/linux/ipq806x/base-files/etc/board.d/01_leds > b/target/linux/ipq806x/base-files/etc/board.d/01_leds > index 07b5b06..46070ad6 100755 > --- a/target/linux/ipq806x/base-files/etc/board.d/01_leds > +++ b/target/linux/ipq806x/base-files/etc/board.d/01_leds > @@ -19,6 +19,13 @@ r7500) > ucidef_set_led_default "wps" "WPS" "r7500:white:wps" "0" > ucidef_set_led_default "rfkill" "rfkill" "r7500:white:rfkill" "0" > ;; > +c2600) > + ucidef_set_led_usbdev "usb1" "USB 1" "usb_2:blue" "2-1" > + ucidef_set_led_usbdev "usb2" "USB 2" "usb_4:blue" "4-1" > + ucidef_set_led_netdev "wan" "WAN" "wan:blue" "eth0" > + ucidef_set_led_netdev "lan" "LAN" "lan:blue" "br-lan" > + ucidef_set_led_default "general" "general" "ledgnr:blue" "1" > + ;; > alphabetical ordering please *) > ;; > esac > diff --git a/target/linux/ipq806x/base-files/etc/board.d/02_network > b/target/linux/ipq806x/base-files/etc/board.d/02_network > index 1302a55..9f061e4 100755 > --- a/target/linux/ipq806x/base-files/etc/board.d/02_network > +++ b/target/linux/ipq806x/base-files/etc/board.d/02_network > @@ -13,7 +13,8 @@ board=$(ipq806x_board_name) > > case "$board" in > ap148 |\ > -r7500) > +r7500 |\ > +c2600) alphabetical ordering please > ucidef_add_switch "switch0" \ > "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0" > ;; > diff --git > a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata > b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata > new file mode 100644 > index 000..7a423de > --- /dev/null > +++ b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata > @@ -0,0 +1,66 @@ i missed this one before. it should really go into its own patch aswell > +#!/bin/sh > + > +ath10kcal_die() { > + echo "ath10cal: " "$*" > + exit 1 > +} > + > +ath10kcal_from_file() { > + local source=$1 > + local offset=$2 > + local count=$3 > + > + dd if=$source of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count > 2>/dev/null || \ > + ath10kcal_die "failed to extract calibration data from $source" > +} > + > +ath10kcal_extract() { > + local part=$1 > + local offset=$2 > + local count=$3 > + local mtd > + > + mtd=$(find_mtd_chardev $part) > + [ -n "$mtd" ] || \ > + ath10kcal_die "no mtd device found for partition $part" > + > + dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count > 2>/dev/null || \ > + ath10kcal_die "failed to extract calibration data from $mtd" > +} > + > +ath10kcal_patch_mac() { > + local mac=$1 > + > + [ -z "$mac" ] && return > + > + macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 >
[OpenWrt-Devel] [PATCH 1/3] ipq806x: add support for TP-Link Archer C2600 to makefiles, configs, scripts and device tree
Add initial support for Archer C2600 to Makefiles, profiles, led/network config, and hotplug script. Together with firmware-utils and mac80211 patches this is sufficient to build a working factory image flashable both from stock web ui and bootloader tftp recovery. Sysupgrade is working as well. Added hotplug script is adapted from existing script for ar71xx which copies wireless calibration data from ART partition in flash to appropriate place in /lib/firmware. The device tree file is similar to the current ap148 dts, with sata and nand removed, and buttons/led's added. Working: Wired network, wireless (both bands), power/status/lan/wan/usb led's Not working: wireless status led's (these are not controlled through gpio, but rather through the QCA9980 pcie chips). Also there is no way to set the wan led to orange, which is possible in the stock firmware. Kernel 4.1 build does not boot currently. Not tested: Hardware buttons. Signed-off-by: Josh Bendavid--- .../linux/ipq806x/base-files/etc/board.d/01_leds | 7 + .../ipq806x/base-files/etc/board.d/02_network | 3 +- .../etc/hotplug.d/firmware/11-ath10k-caldata | 66 + target/linux/ipq806x/base-files/lib/ipq806x.sh | 3 + .../ipq806x/base-files/lib/upgrade/platform.sh | 34 ++- target/linux/ipq806x/image/Makefile| 24 +- ...qcom-add-TP-Link-Archer-C2600-device-tree.patch | 300 + ...qcom-add-TP-Link-Archer-C2600-device-tree.patch | 300 + target/linux/ipq806x/profiles/tplink.mk| 20 ++ 9 files changed, 754 insertions(+), 3 deletions(-) create mode 100644 target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata create mode 100644 target/linux/ipq806x/patches-3.18/711-ARM-qcom-add-TP-Link-Archer-C2600-device-tree.patch create mode 100644 target/linux/ipq806x/patches-4.1/711-ARM-qcom-add-TP-Link-Archer-C2600-device-tree.patch create mode 100644 target/linux/ipq806x/profiles/tplink.mk diff --git a/target/linux/ipq806x/base-files/etc/board.d/01_leds b/target/linux/ipq806x/base-files/etc/board.d/01_leds index 07b5b06..46070ad6 100755 --- a/target/linux/ipq806x/base-files/etc/board.d/01_leds +++ b/target/linux/ipq806x/base-files/etc/board.d/01_leds @@ -19,6 +19,13 @@ r7500) ucidef_set_led_default "wps" "WPS" "r7500:white:wps" "0" ucidef_set_led_default "rfkill" "rfkill" "r7500:white:rfkill" "0" ;; +c2600) + ucidef_set_led_usbdev "usb1" "USB 1" "usb_2:blue" "2-1" + ucidef_set_led_usbdev "usb2" "USB 2" "usb_4:blue" "4-1" + ucidef_set_led_netdev "wan" "WAN" "wan:blue" "eth0" + ucidef_set_led_netdev "lan" "LAN" "lan:blue" "br-lan" + ucidef_set_led_default "general" "general" "ledgnr:blue" "1" + ;; *) ;; esac diff --git a/target/linux/ipq806x/base-files/etc/board.d/02_network b/target/linux/ipq806x/base-files/etc/board.d/02_network index 1302a55..9f061e4 100755 --- a/target/linux/ipq806x/base-files/etc/board.d/02_network +++ b/target/linux/ipq806x/base-files/etc/board.d/02_network @@ -13,7 +13,8 @@ board=$(ipq806x_board_name) case "$board" in ap148 |\ -r7500) +r7500 |\ +c2600) ucidef_add_switch "switch0" \ "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0" ;; diff --git a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata new file mode 100644 index 000..7a423de --- /dev/null +++ b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -0,0 +1,66 @@ +#!/bin/sh + +ath10kcal_die() { + echo "ath10cal: " "$*" + exit 1 +} + +ath10kcal_from_file() { + local source=$1 + local offset=$2 + local count=$3 + + dd if=$source of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \ + ath10kcal_die "failed to extract calibration data from $source" +} + +ath10kcal_extract() { + local part=$1 + local offset=$2 + local count=$3 + local mtd + + mtd=$(find_mtd_chardev $part) + [ -n "$mtd" ] || \ + ath10kcal_die "no mtd device found for partition $part" + + dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \ + ath10kcal_die "failed to extract calibration data from $mtd" +} + +ath10kcal_patch_mac() { + local mac=$1 + + [ -z "$mac" ] && return + + macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=6 count=6 +} + +[ -e /lib/firmware/$FIRMWARE ] && exit 0 + +. /lib/ipq806x.sh +. /lib/functions.sh +. /lib/functions/system.sh + +board=$(ipq806x_board_name) + + +case "$FIRMWARE" in +"ath10k/cal-pci-:01:00.0.bin") + case $board in + c2600) + ath10kcal_extract "0:ART" 4096 12064 + ;; + esac + ;;