[OpenWrt-Devel] [PATCH] ath79: add support for tplink tl-wdr3600 modified with 16M flash

Russell Senior russell at personaltelco.net
Thu Mar 14 23:42:04 PDT 2019


To modify a WDR3600 with 16MB flash, you will need an external SPI programmer
and soldering tools.  First, obtain a copy of the starting contents either with
the external programmer or from commands in OpenWrt:

 # dd if=/dev/mtdblock0 of=/tmp/uboot.img
 # dd if=/dev/mtdblock1 of=/tmp/firmware.img
 # dd if=/dev/mtdblock5 of=/tmp/art.img

Copy the files off the router.

In order to make clean reads/writes with the external SPI programmer, it
is helpful to hold the CPU in reset. To do this, solder a shunt across
R2 near the JTAG header so that a jumper between pin 10 and pin 11 of
the JTAG header can hold the RESET pin low. It is probabaly worth trying
out your external SPI programmer by reading a few copies before
desoldering the original flash part.

Desolder the SPI flash in the middle of the board. Solder on the new one,
noting the correct orientation.

Build the pepe2k u-boot for the WDR3600 (branch with support added):

 $ git clone https://github.com/RussellSenior/u-boot_mod/tree/add-wdr3600-16m
 $ make tp-link_tl-wdr3600_16m

Extract the novel bits from your original uboot.img, thusly:

 $ dd if=uboot.img of=macaddr.bin bs=1 skip=130048 count=6
 $ dd if=uboot.img of=model.bin bs=1 skip=130304 count=8
 $ dd if=uboot.img of=pin.bin bs=1 skip=130560 count=8
 $ dd if=/dev/zero bs=64k count=2 | tr '\000' '\377' > u-boot-new.img
 $ dd if=u-boot_mod.bin of=u-boot-new.img conv=notrunc
 $ dd if=macaddr.bin of=u-boot-new.img bs=1 count=6 seek=130048 conv=notrunc
 $ dd if=model.bin of=u-boot-new.img bs=1 count=8 seek=130304 conv=notrunc
 $ dd if=pin.bin of=u-boot-new.img bs=1 count=8 seek=130560 conv=notrunc

where u-boot_mod.bin is the u-boot image built using the pepe2k tree with
patches for the 16MB flash size.

Compose a new 16MB image:

 $ dd if=/dev/zero bs=1M count=16 | tr '\000' '\377' > 16MB-new.img
 $ dd if=u-boot-new.img of=16MB-new.img conv=notrunc
 $ dd if=openwrt-ath79-generic-tplink_tl-wdr3600-16m-squashfs-sysupgrade.bin of=16MB-new.img bs=64k seek=2 conv=notrunc
 $ dd if=art.bin of=16MB-new.img bs=64k seek=255 conv=notrunc

Then, use your external SPI flash programmer to write 16MB-new.img to the new
flash part.

Signed-off-by: Russell Senior <russell at personaltelco.net>
---
 .../ath79/base-files/etc/board.d/02_network   |  1 +
 .../etc/hotplug.d/firmware/10-ath9k-eeprom    |  1 +
 .../dts/ar9344_tplink_tl-wdr3600-16m.dts      | 46 +++++++++++++++++++
 target/linux/ath79/image/generic-tp-link.mk   | 10 ++++
 4 files changed, 58 insertions(+)
 create mode 100644 target/linux/ath79/dts/ar9344_tplink_tl-wdr3600-16m.dts

diff --git a/target/linux/ath79/base-files/etc/board.d/02_network b/target/linux/ath79/base-files/etc/board.d/02_network
index e66eb938fd..5701372ed5 100755
--- a/target/linux/ath79/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/base-files/etc/board.d/02_network
@@ -170,6 +170,7 @@ ath79_setup_interfaces()
 	tplink,archer-c7-v4|\
 	tplink,archer-c7-v5|\
 	tplink,tl-wdr3600|\
+	tplink,tl-wdr3600-16m|\
 	tplink,tl-wdr4300)
 		ucidef_add_switch "switch0" \
 			"0 at eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
diff --git a/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
index 84e4d07b35..40ea3f3a42 100644
--- a/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
+++ b/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
@@ -146,6 +146,7 @@ case "$FIRMWARE" in
 		;;
 	ocedo,raccoon|\
 	tplink,tl-wdr3600|\
+	tplink,tl-wdr3600-16m|\
 	tplink,tl-wdr4300|\
 	tplink,tl-wdr4900-v2|\
 	winchannel,wb2000)
diff --git a/target/linux/ath79/dts/ar9344_tplink_tl-wdr3600-16m.dts b/target/linux/ath79/dts/ar9344_tplink_tl-wdr3600-16m.dts
new file mode 100644
index 0000000000..ca8fd077e3
--- /dev/null
+++ b/target/linux/ath79/dts/ar9344_tplink_tl-wdr3600-16m.dts
@@ -0,0 +1,46 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "ar9344_tplink_tl-wdr4300.dtsi"
+
+/ {
+	model = "TP-Link WDR3600 16M";
+	compatible = "tplink,tl-wdr3600-16m", "qca,ar9344";
+};
+
+&spi {
+	num-cs = <1>;
+
+	status = "okay";
+
+	flash at 0 {
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <25000000>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			uboot: partition at 0 {
+				label = "u-boot";
+				reg = <0x000000 0x020000>;
+				read-only;
+			};
+
+			partition at 20000 {
+				compatible = "tplink,firmware";
+				label = "firmware";
+				reg = <0x020000 0xfd0000>;
+			};
+
+			art: partition at 7f0000 {
+				label = "art";
+				reg = <0xff0000 0x010000>;
+				read-only;
+			};
+		};
+	};
+};
+
diff --git a/target/linux/ath79/image/generic-tp-link.mk b/target/linux/ath79/image/generic-tp-link.mk
index e82a5a3073..bd8365618b 100644
--- a/target/linux/ath79/image/generic-tp-link.mk
+++ b/target/linux/ath79/image/generic-tp-link.mk
@@ -152,6 +152,16 @@ define Device/tplink_tl-wdr3600
 endef
 TARGET_DEVICES += tplink_tl-wdr3600
 
+define Device/tplink_tl-wdr3600-16m
+  $(Device/tplink-16mlzma)
+  ATH_SOC := ar9344
+  DEVICE_TITLE := TP-Link TL-WDR3600 16M
+  DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
+  TPLINK_HWID := 0x36000001
+  SUPPORTED_DEVICES += tl-wdr3600-16m
+endef
+TARGET_DEVICES += tplink_tl-wdr3600-16m
+
 define Device/tplink_tl-wdr4300
   $(Device/tplink-8mlzma)
   ATH_SOC := ar9344
-- 
2.21.0



-- 
Russell Senior, President
russell at personaltelco.net



More information about the openwrt-devel mailing list