[LEDE-DEV] [PATCH v5 2/3] ipq806x: Add support for new device: tew827dru

J Mo jmomo at jmomo.net
Sat Nov 26 21:28:34 PST 2016


The TRENDnet TEW-827DRU is an ipq806x wireless router.

ipq8064 SoC with 2x ARMv7-ish Krait 300 CPUs at 1.4Ghz
512MB RAM, 256MB SLC NAND flash (64MB default UBI img size)
1x qca8337-al3c 1000BASE-T ethernet switch, 1-WAN, 4-LAN
2x qca9980 802.11 radios
2x USB3 type A

Product page:
https://www.trendnet.com/products/wifi/AC2600-MU-MIMO-AC-routers/TEW-827DRU

Development thread: https://forum.openwrt.org/viewtopic.php?id=65956

The tew827dru factory image format supports installation from both the
OEM web interface and a u-boot "recovery loader" HTTP page, which is
accessible by booting the device with the reset button held down for
four seconds. This factory image must be packaged in a FIT file with
specific content and a Cameo signature/hwid appended to the file. The
FIT image itself contains a u-boot hush shell script which installs a
UBI image containing the kernel, sqaushfs-rootfs, and ubifs-overlay.
Supporting this factory image required the addition of a new ITS
formatter tool (its-maker.sh), a u-boot shell script
(tew827dru-flash.scr), and a tiny "Fail Safe" bootconfig binary blob
(tew827dru-bootconfig.bin) which selects which of the redundant u-boot
and UBI partitions should be active.

Signed-off-by: Jesse Molina <jmomo at jmomo.net>
---
 .../linux/ipq806x/base-files/etc/board.d/01_leds   |   3 +
 .../ipq806x/base-files/etc/board.d/02_network      |   4 +
 .../etc/hotplug.d/firmware/11-ath10k-caldata       |   6 +
 .../etc/hotplug.d/ieee80211/10_fix_wifi_mac        |   3 +
 target/linux/ipq806x/base-files/lib/ipq806x.sh     |   3 +
 .../base-files/lib/preinit/06_set_iface_mac        |  22 ++
 .../ipq806x/base-files/lib/upgrade/platform.sh     |   3 +-
 .../arch/arm/boot/dts/qcom-ipq8064-tew827dru.dts   | 351 +++++++++++++++++++++
 target/linux/ipq806x/image/Makefile                |  61 +++-
 .../linux/ipq806x/image/tew827dru-bootconfig.bin   | Bin 0 -> 84 bytes
 target/linux/ipq806x/image/tew827dru-flash.scr     |  56 ++++
 .../linux/ipq806x/patches-4.4/800-devicetree.patch |   3 +-
 12 files changed, 512 insertions(+), 3 deletions(-)
 create mode 100644 target/linux/ipq806x/base-files/lib/preinit/06_set_iface_mac
 create mode 100644 target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-tew827dru.dts
 create mode 100644 target/linux/ipq806x/image/tew827dru-bootconfig.bin
 create mode 100644 target/linux/ipq806x/image/tew827dru-flash.scr

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 6570b78..6ae7d8f 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/01_leds
+++ b/target/linux/ipq806x/base-files/etc/board.d/01_leds
@@ -45,6 +45,9 @@ nbg6817)
 	ucidef_set_led_wlan "wlan5g" "WLAN5G" "$board:amber:wifi5" "phy0radio"
 	ucidef_set_led_netdev "wan" "WAN" "$board:white:internet" "eth1"
 	;;
+tew827dru)
+	ucidef_set_led_usbport "usb" "USB" "${board}:blue:usb" "usb1-port1" "usb2-port1" "usb3-port1" "usb4-port1"
+	;;
 vr2600v)
 	ucidef_set_led_usbport "usb" "USB" "${board}:white:usb" "usb1-port1" "usb2-port1" "usb3-port1" "usb4-port1"
 	ucidef_set_led_switch "lan" "lan" "${board}:white:lan" "switch0" "0x1e"
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 8417f0e..0212ae9 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/02_network
+++ b/target/linux/ipq806x/base-files/etc/board.d/02_network
@@ -23,6 +23,10 @@ vr2600v)
 	ucidef_add_switch "switch0" \
 		"1:lan" "2:lan" "3:lan" "4:lan" "6 at eth1" "5:wan" "0 at eth0"
 	;;
+tew827dru)
+	ucidef_add_switch "switch0" \
+		"1:lan" "2:lan" "3:lan" "4:lan" "6t at eth1" "5:wan" "0t at eth0"
+	;;
 db149)
 	ucidef_set_interface_lan "eth1 eth2 eth3"
 	ucidef_add_switch "switch0" \
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
index 625f77f..eaaca9d 100644
--- 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
@@ -63,6 +63,9 @@ case "$FIRMWARE" in
          r7800)
 		ath10kcal_extract "art" 4096 12064
 		;;
+	tew827dru)
+		ath10kcal_extract "ART" 4096 12064
+		;;
 	vr2600v)
 		ath10kcal_extract "ART" 4096 12064
 		;;
@@ -85,6 +88,9 @@ case "$FIRMWARE" in
         r7800)
 		ath10kcal_extract "art" 20480 12064
 		;;
+	tew827dru)
+		ath10kcal_extract "ART" 20480 12064
+		;;
 	vr2600v)
 		ath10kcal_extract "ART" 20480 12064
 		;;
diff --git a/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
index 3482a09..678fb74 100644
--- a/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
+++ b/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
@@ -21,6 +21,9 @@ case "$board" in
 	r7800)
 		echo $(macaddr_add $(mtd_get_mac_binary art 6)  $(($PHYNBR + 1)) ) > /sys${DEVPATH}/macaddress
 		;;
+	tew827dru)
+		echo $(macaddr_add $(mtd_get_mac_ascii APPSBLENV wan_mac) $(($PHYNBR + 1)) ) > /sys${DEVPATH}/macaddress
+		;;
 	vr2600v)
 		echo $(macaddr_add $(mtd_get_mac_binary default-mac 0)  $(($PHYNBR - 1)) ) > /sys${DEVPATH}/macaddress
 		;;
diff --git a/target/linux/ipq806x/base-files/lib/ipq806x.sh b/target/linux/ipq806x/base-files/lib/ipq806x.sh
index a8b909a..83f5243 100644
--- a/target/linux/ipq806x/base-files/lib/ipq806x.sh
+++ b/target/linux/ipq806x/base-files/lib/ipq806x.sh
@@ -41,6 +41,9 @@ ipq806x_board_detect() {
 	*"R7800")
 		name="r7800"
 		;;
+	"TRENDnet TEW-827DRU")
+		name="tew827dru"
+		;;
 	*"VR2600v")
 		name="vr2600v"
 		;;
diff --git a/target/linux/ipq806x/base-files/lib/preinit/06_set_iface_mac b/target/linux/ipq806x/base-files/lib/preinit/06_set_iface_mac
new file mode 100644
index 0000000..90c6796
--- /dev/null
+++ b/target/linux/ipq806x/base-files/lib/preinit/06_set_iface_mac
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Copyright (c) 2014 The Linux Foundation. All rights reserved.
+#
+
+set_ether_mac() {
+	. /lib/functions/uci-defaults.sh
+	. /lib/ipq806x.sh
+	. /lib/functions/system.sh
+
+	board=$(ipq806x_board_name)
+
+	case "$board" in
+	tew827dru)
+		# Set the correct ethernet MAC addresses per OEM intent.
+		ifconfig eth0 hw ether $(mtd_get_mac_ascii APPSBLENV wan_mac) 2>/dev/null
+		ifconfig eth1 hw ether $(mtd_get_mac_ascii APPSBLENV lan_mac) 2>/dev/null
+		;;
+	esac
+}
+
+boot_hook_add preinit_main set_ether_mac
diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
index c3741f9..905df55 100644
--- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
@@ -16,7 +16,8 @@ platform_pre_upgrade() {
 	nbg6817 |\
 	r7500 |\
 	r7500v2 |\
-	r7800)
+	r7800 |\
+	tew827dru)
 		nand_do_upgrade "$1"
 		;;
 	ea8500)
diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-tew827dru.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-tew827dru.dts
new file mode 100644
index 0000000..2841ebe
--- /dev/null
+++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-tew827dru.dts
@@ -0,0 +1,351 @@
+#include "qcom-ipq8064-v1.0.dtsi"
+#include <dt-bindings/input/input.h>
+
+/ {
+	model = "TRENDnet TEW-827DRU";
+	compatible = "trendnet,tew827dru", "qcom,ipq8064";
+
+	memory at 0 {
+		reg = <0x42000000 0x1e000000>;
+		device_type = "memory";
+	};
+
+	reserved-memory {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+		rsvd at 41200000 {
+			reg = <0x41200000 0x300000>;
+			no-map;
+		};
+	};
+
+	aliases {
+		serial0 = &uart4;
+		mdio-gpio0 = &mdio0;
+		led-boot = &power; /* LED aliases added for commit 4bdf615878dd98106b3fdb9e092f7349b1a8d39f */
+		led-failsafe = &power;
+		led-running = &power;
+		led-upgrade = &power;
+	};
+
+	chosen {
+		bootargs = "console=ttyMSM0,115200n8 ubi.mtd=11 ubi.block=0,1 root=/dev/ubiblock0_1 rootfstype=squashfs";
+		linux,stdout-path = "serial0:115200n8";
+
+	};
+
+	soc {
+		pinmux at 800000 {
+			i2c4_pins: i2c4_pinmux {
+				pins = "gpio12", "gpio13";
+				function = "gsbi4";
+				bias-disable;
+			};
+
+			spi_pins: spi_pins {
+				mux {
+					pins = "gpio18", "gpio19", "gpio21";
+					function = "gsbi5";
+					drive-strength = <10>;
+					bias-none;
+				};
+			};
+			nand_pins: nand_pins {
+				mux {
+					pins = "gpio34", "gpio35", "gpio36",
+					       "gpio37", "gpio38", "gpio39",
+					       "gpio40", "gpio41", "gpio42",
+					       "gpio43", "gpio44", "gpio45",
+					       "gpio46", "gpio47";
+					function = "nand";
+					drive-strength = <10>;
+					bias-disable;
+				};
+				pullups {
+					pins = "gpio39";
+					bias-pull-up;
+				};
+				hold {
+					pins = "gpio40", "gpio41", "gpio42",
+					       "gpio43", "gpio44", "gpio45",
+					       "gpio46", "gpio47";
+					bias-bus-hold;
+				};
+			};
+
+			mdio0_pins: mdio0_pins {
+				mux {
+					pins = "gpio0", "gpio1";
+					function = "gpio";
+					drive-strength = <8>;
+					bias-disable;
+				};
+			};
+
+			rgmii2_pins: rgmii2_pins {
+				mux {
+					pins = "gpio27", "gpio28", "gpio29", "gpio30", "gpio31", "gpio32",
+					       "gpio51", "gpio52", "gpio59", "gpio60", "gpio61", "gpio62" ;
+					function = "rgmii2";
+					drive-strength = <8>;
+					bias-disable;
+				};
+			};
+		};
+
+		gsbi at 16300000 {
+			qcom,mode = <GSBI_PROT_I2C_UART>;
+			status = "ok";
+
+			uart4: serial at 16340000 {
+				status = "ok";
+			};
+			/*
+			 * The i2c device on gsbi4 should not be enabled.
+			 * On ipq806x designs gsbi4 i2c is meant for exclusive
+			 * RPM usage. Turning this on in kernel manifests as
+			 * i2c failure for the RPM.
+			 */
+		};
+
+		phy at 100f8800 {		/* USB3 port 1 HS phy */
+			status = "ok";
+		};
+
+		phy at 100f8830 {		/* USB3 port 1 SS phy */
+			status = "ok";
+		};
+
+		phy at 110f8800 {		/* USB3 port 0 HS phy */
+			status = "ok";
+		};
+
+		phy at 110f8830 {		/* USB3 port 0 SS phy */
+			status = "ok";
+		};
+
+		usb30 at 0 {
+			status = "ok";
+		};
+
+		usb30 at 1 {
+			status = "ok";
+		};
+
+		pcie0: pci at 1b500000 {
+			status = "ok";
+			phy-tx0-term-offset = <7>;
+		};
+
+		pcie1: pci at 1b700000 {
+			status = "ok";
+			phy-tx0-term-offset = <7>;
+		};
+
+		nand at 1ac00000 {
+			status = "ok";
+
+			pinctrl-0 = <&nand_pins>;
+			pinctrl-names = "default";
+
+			nand-ecc-strength = <4>;
+			nand-bus-width = <8>;
+
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			SBL1 at 0 {
+				label = "SBL1";
+				reg = <0x0000000 0x0040000>;
+				read-only;
+			};
+
+			MIBIB at 40000 {
+				label = "MIBIB";
+				reg = <0x0040000 0x0140000>;
+				read-only;
+			};
+
+			SBL2 at 180000 {
+				label = "SBL2";
+				reg = <0x0180000 0x0140000>;
+				read-only;
+			};
+
+			SBL3 at 2c0000 {
+				label = "SBL3";
+				reg = <0x02c0000 0x0280000>;
+				read-only;
+			};
+
+			DDRCONFIG at 540000 {
+				label = "DDRCONFIG";
+				reg = <0x0540000 0x0120000>;
+				read-only;
+			};
+
+			SSD at 660000 {
+				label = "SSD";
+				reg = <0x0660000 0x0120000>;
+				read-only;
+			};
+
+			TZ at 780000 {
+				label = "TZ";
+				reg = <0x0780000 0x0280000>;
+				read-only;
+			};
+
+			RPM at a00000 {
+				label = "RPM";
+				reg = <0x0a00000 0x0280000>;
+				read-only;
+			};
+
+			APPSBL at 53a0000 {
+				label = "APPSBL";
+				reg = <0x53a0000 0x500000>;
+				read-only;
+			};
+
+			APPSBLENV at 1180000{
+				label = "APPSBLENV";
+				reg = <0x1180000 0x80000>;
+				read-only;
+			};
+
+			ART at 1180000 {
+				label = "ART";
+				reg = <0x1200000 0x140000>;
+				read-only;
+			};
+
+			rootfs at 58a0000 {
+				label = "rootfs";
+				reg = <0x58a0000 0x4000000>;
+			};
+
+			BOOTCONFIG at 5340000{
+				label = "BOOTCONFIG";
+				reg = <0x5340000 0x60000>;
+			};
+
+			APPSBL_1 at c80000{
+				label = "APPSBL_1";
+				reg = <0xc80000 0x500000>;
+				read-only;
+			};
+
+			rootfs_1 at 1340000 {
+				label = "rootfs_1";
+				reg = <0x1340000 0x4000000>;
+			};
+
+		};
+
+		mdio0: mdio {
+			compatible = "virtual,mdio-gpio";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			gpios = <&qcom_pinmux 1 0 &qcom_pinmux 0 0>;
+			pinctrl-0 = <&mdio0_pins>;
+			pinctrl-names = "default";
+
+			phy0: ethernet-phy at 0 {
+				device_type = "ethernet-phy";
+				reg = <0>;
+				qca,ar8327-initvals = <
+					0x00004 0x7600000   /* PAD0_MODE */
+					0x00008 0x1000000   /* PAD5_MODE */
+					0x0000c 0x80        /* PAD6_MODE */
+					0x000e4 0x6a545     /* MAC_POWER_SEL */
+					0x000e0 0xc74164de  /* SGMII_CTRL */
+					0x0007c 0x4e        /* PORT0_STATUS */
+					0x00094 0x4e        /* PORT6_STATUS */
+					>;
+			};
+
+			phy4: ethernet-phy at 4 {
+				device_type = "ethernet-phy";
+				reg = <4>;
+			};
+		};
+
+		/* WAN eth0 */
+		gmac1: ethernet at 37200000 {
+			status = "ok";
+			phy-mode = "rgmii";
+			qcom,id = <1>;
+			qcom,phy_mdio_addr = <4>;
+			qcom,poll_required = <1>;
+			qcom,rgmii_delay = <0>;
+			qcom,emulation = <0>;
+			pinctrl-0 = <&rgmii2_pins>;
+			pinctrl-names = "default";
+			fixed-link {
+				speed = <1000>;
+				full-duplex;
+			};
+		};
+
+		/* LAN eth1 */
+		gmac2: ethernet at 37400000 {
+			status = "ok";
+			phy-mode = "sgmii";
+			qcom,id = <2>;
+			qcom,phy_mdio_addr = <0>;	/* none */
+			qcom,poll_required = <0>;	/* no polling */
+			qcom,rgmii_delay = <0>;
+			qcom,emulation = <0>;
+			fixed-link {
+				speed = <1000>;
+				full-duplex;
+			};
+		};
+
+	};
+
+	gpio-keys {
+		compatible = "gpio-keys";
+
+		rfkill {
+			label = "rfkill";
+			gpios = <&qcom_pinmux 9 1>;
+			linux,code = <KEY_RFKILL>;
+		};
+
+		reset {
+			label = "reset";
+			gpios = <&qcom_pinmux 54 1>;
+			linux,code = <KEY_RESTART >;
+		};
+
+		wps {
+			label = "wps";
+			gpios = <&qcom_pinmux 67 1>;
+			linux,code = <KEY_WPS_BUTTON>;
+		};
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+
+		usb {
+			label = "tew827dru:blue:usb";
+			gpios = <&qcom_pinmux 7 1>;
+			default-state = "off";
+		};
+
+		power: power {
+			label = "tew827dru:blue:power";
+			gpios = <&qcom_pinmux 53 1>;
+			default-state = "off";
+			linux,default-trigger = "heartbeat";
+		};
+	};
+};
+
+&adm_dma {
+	status = "ok";
+};
diff --git a/target/linux/ipq806x/image/Makefile b/target/linux/ipq806x/image/Makefile
index 3cc48bb..01bcbc7 100644
--- a/target/linux/ipq806x/image/Makefile
+++ b/target/linux/ipq806x/image/Makefile
@@ -103,6 +103,49 @@ define Device/ZyXELImage
 	IMAGE/mmcblk0p4-kernel.bin := append-kernel
 endef
 
+define Build/mkfit-TEW827DRU
+	$(TOPDIR)/scripts/its-maker.sh \
+		--device $(DEVICE_NAME) \
+		-O $@.its \
+		--img-name 0 script \
+		--img-descr 0 "u-boot-HTTP firmware update script" \
+		--img-file 0 $(TOPDIR)/target/linux/ipq806x/image/tew827dru-flash.scr \
+		--img-type 0 script --img-arch 0 $(ARCH) \
+		--img-compression 0 none \
+		--img-hashes 0 crc32 \
+		--img-name 1 ubi-image \
+		--img-descr 1 "UBI rootfs image" \
+		--img-file 1 $@ \
+		--img-type 1 firmware \
+		--img-arch 1 $(ARCH) \
+		--img-compression 1 none \
+		--img-hashes 1 crc32 \
+		--img-name 2 bootconfig \
+		--img-descr 2 "BOOTCONFIG: boot from APPSBL and rootfs" \
+		--img-file 2 $(TOPDIR)/target/linux/ipq806x/image/tew827dru-bootconfig.bin \
+		--img-type 2 firmware \
+		--img-arch 2 $(ARCH) \
+		--img-compression 2 none \
+		--img-hashes 2 crc32
+	PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.fit
+	@rm $@.its
+	@mv $@.fit $@
+endef
+
+define Build/cameo-sig
+	{ \
+		cameo_sig=$(word 1, $(1)) ;\
+		align=$(if $(2),$(2),64) ;\
+		oldsize=$$(stat -c %s $@) ;\
+		sigsize=$$(echo -n $$cameo_sig | wc -c) ;\
+		padsize=$$(( ( ( ( ( ( $$oldsize + $$sigsize ) / $$align ) + 1 ) * $$align ) - $$oldsize ) - $$sigsize )) ;\
+		newsize=$$(( $$oldsize + $$padsize )) ;\
+		dd if=$@ of=$@.new bs=$$newsize count=1 conv=sync ;\
+		echo -n "$$cameo_sig" >> $@.new ; \
+	}
+	@mv $@.new $@
+endef
+
 define Device/AP148
 	$(call Device/FitImage)
 	$(call Device/UbiFit)
@@ -224,6 +267,22 @@ define Device/NBG6817
 	$(call Device/ZyXELImage)
 endef
 
+define Device/TEW827DRU
+	$(call Device/LegacyImage)
+	DEVICE_DTS := qcom-ipq8064-tew827dru
+	BLOCKSIZE := 128k
+	PAGESIZE := 2048
+	FILESYSTEMS := squashfs
+	KERNEL += | pad-to 2k
+	KERNEL_IN_UBI := 1
+	IMAGES := factory.bin sysupgrade.tar
+	IMAGE/factory.bin := append-ubi | mkfit-TEW827DRU | cameo-sig AP148AR9880-RT-150127-00
+	IMAGE/sysupgrade.tar := sysupgrade-tar
+	BOARD_NAME := tew827dru
+	DEVICE_TITLE := TRENDnet TEW-827DRU
+	DEVICE_PACKAGES := ath10k-firmware-qca99x0
+endef
+
 define Device/VR2600v
 	PROFILES += $$(DEVICE_NAME)
 	FILESYSTEMS := squashfs
@@ -241,6 +300,6 @@ define Device/VR2600v
 	IMAGE/sysupgrade.bin := pad-extra 512 | append-kernel | pad-to $$$${KERNEL_SIZE} | append-rootfs | pad-rootfs | append-metadata
 endef
 
-TARGET_DEVICES += AP148 AP148-legacy C2600 D7800 DB149 EA8500 R7500 R7500v2 R7800 NBG6817 VR2600v
+TARGET_DEVICES += AP148 AP148-legacy C2600 D7800 DB149 EA8500 R7500 R7500v2 R7800 NBG6817 TEW827DRU VR2600v
 
 $(eval $(call BuildImage))
diff --git a/target/linux/ipq806x/image/tew827dru-bootconfig.bin b/target/linux/ipq806x/image/tew827dru-bootconfig.bin
new file mode 100644
index 0000000000000000000000000000000000000000..3de2fff91073325ae7eaac1e72805b854d651c36
GIT binary patch
literal 84
ycmZ3maPd+GAYcY!11raXfM6#d5FZ2>ArwPVett<>F_eQOo}F5hmzskRhp_+?#tGQ~

literal 0
HcmV?d00001

diff --git a/target/linux/ipq806x/image/tew827dru-flash.scr b/target/linux/ipq806x/image/tew827dru-flash.scr
new file mode 100644
index 0000000..d3863a2
--- /dev/null
+++ b/target/linux/ipq806x/image/tew827dru-flash.scr
@@ -0,0 +1,56 @@
+# TRENDnet TEW-827DRU 1.0R u-boot script.
+# This script is read and executed by the uboot-HTTP recovery loader.
+# The OEM HTTP firmware upgrader does not use this file.
+# WARNING: Be extremely careful editing this script. A mistake could brick devices.
+#
+# "setenv imgaddr 0x42000000" is automatically set for us by the recovery tool.
+# imxtract automatically sets the $fileaddr and $filesize environment variables for the extracted image.
+
+echo ""
+echo "------------------------------------------------------------"
+echo ""
+echo "LEDE TEW-827DRU script START."
+
+# imgaddr=0x42000000
+support_hw_version=V1.0R
+support_machid=1260
+rootfs_nand_addr=0x58a0000
+rootfs_nand_size=0x4000000
+rootfs_1_nand_addr=0x1340000
+rootfs_1_nand_size=0x4000000
+BOOTCONFIG_nand_addr=0x5340000
+BOOTCONFIG_nand_size=0x60000
+
+# --------------------------------------------------
+
+# Validate hardware.
+if test "${hw_version}" != "${support_hw_version}" ; then echo "Wrong Hardware Version: Quitting." ; exit 1 ; fi
+if test "${machid}" != "${support_machid}" ; then echo "Wrong machine ID: Quitting." ; exit 1 ; fi
+
+# Write the UBI image (kernel+rootfs+ubifs)
+echo ""
+echo "Flashing the UBI image..."
+ipq_nand linux || echo "Failed to set ipq_nand: Quitting." && exit 1
+imxtract ${imgaddr} ubi-image || echo "Failed to imxtract the ubi image: Quitting." && exit 1
+nand erase ${rootfs_nand_addr} ${rootfs_nand_size} || echo "Failed to nand erase: Quitting." && exit 1
+nand write ${fileaddr} ${rootfs_nand_addr} ${filesize} || echo "Failed to nand write: Quitting." && exit 1
+echo "Done flashing UBI image."
+
+# Write the bootconfig to set APPSBL/rootfs as active.
+echo ""
+echo "Flashing the BOOTCONFIG image..."
+ipq_nand linux || echo "Failed to set ipq_nand: Quitting." && exit 1
+imxtract ${imgaddr} bootconfig || echo "Failed to imxtract the bootconfig image: Quitting." && exit 1
+nand erase ${BOOTCONFIG_nand_addr} ${BOOTCONFIG_nand_size} || echo "Failed to nand erase: Quitting." && exit 1
+# We need to write 0x800 instead of filesize for the bootconfig, due to page size.
+nand write ${fileaddr} ${BOOTCONFIG_nand_addr} 0x800 || echo "Failed to nand write: Quitting." && exit 1
+echo "Done flashing BOOTCONFIG image."
+
+echo ""
+echo "LEDE TEW-827DRU script END."
+echo ""
+echo "------------------------------------------------------------"
+echo ""
+exit 0
+
+# The u-boot HTTP loader will automatically reboot the system after exit.
diff --git a/target/linux/ipq806x/patches-4.4/800-devicetree.patch b/target/linux/ipq806x/patches-4.4/800-devicetree.patch
index 916e2ef..6db2f39 100644
--- a/target/linux/ipq806x/patches-4.4/800-devicetree.patch
+++ b/target/linux/ipq806x/patches-4.4/800-devicetree.patch
@@ -12,7 +12,7 @@ Signed-off-by: Jonas Gorski <jogo at openwrt.org>
 
 --- a/arch/arm/boot/dts/Makefile
 +++ b/arch/arm/boot/dts/Makefile
-@@ -506,7 +506,14 @@ dtb-$(CONFIG_ARCH_QCOM) += \
+@@ -506,7 +506,15 @@ dtb-$(CONFIG_ARCH_QCOM) += \
  	qcom-apq8084-ifc6540.dtb \
  	qcom-apq8084-mtp.dtb \
  	qcom-ipq8064-ap148.dtb \
@@ -24,6 +24,7 @@ Signed-off-by: Jonas Gorski <jogo at openwrt.org>
 +	qcom-ipq8064-r7500v2.dtb \
 +	qcom-ipq8065-nbg6817.dtb \
 +	qcom-ipq8065-r7800.dtb \
++	qcom-ipq8064-tew827dru.dtb \
  	qcom-msm8660-surf.dtb \
  	qcom-msm8960-cdp.dtb \
  	qcom-msm8974-sony-xperia-honami.dtb
-- 
2.1.4




More information about the Lede-dev mailing list