From patchwork Fri Mar 15 06:42:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell Senior X-Patchwork-Id: 1056872 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=personaltelco.net Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="FIFcnRXF"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44LGGk43T0z9s3l for ; Fri, 15 Mar 2019 17:42:37 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:Message-ID:Date:To :From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=2OASUuZiMzMGN/I+1g3R25UZqMpMip60BeE9JZRA0+8=; b=FIFcnRXFlp/tD3 6M2Vx24COXReyrwwpZFVa95JEt8pzEBV4Sj2pQfQJzMv3MSHCeOtZ8fymIS1Cor3DB/BI8bGSlQgV Lmk5gtg0qUZMSQppxL9AzA6KxDJdopnvd1I4Fq9c8wJLdzLw9NrbbO8Tjodnaoa5Gu3YexsAsNeIM B+dC9qUnKK14sjXorNocSNM1Yz9oRX5X8aYz/8zdYXNYJP22LE1G+VaqItXgUTTKFr2dDoDyQ7C7Z Gf6KY5VEU5A4F/E+lGD8qlMMrGsgjnQ/8fzlk6QxnMvHYH4q4yHroUf20WthiTz+YcJnjIl9hS9iy 9n6RE7J5JqHF0soYI/lA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4gXk-0001nw-E1; Fri, 15 Mar 2019 06:42:12 +0000 Received: from mail.klickitat.com ([54.70.207.208]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4gXh-0001nU-1g for openwrt-devel@lists.openwrt.org; Fri, 15 Mar 2019 06:42:11 +0000 Received: by mail.klickitat.com (Postfix, from userid 182) id 53DBDA6113C; Thu, 14 Mar 2019 23:42:06 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dodson.localdomain X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.2 Received: from husum (husum.ptp [192.168.80.4]) by mail.klickitat.com (Postfix) with ESMTP id 38E6BA6113C; Thu, 14 Mar 2019 23:42:04 -0700 (PDT) From: Russell Senior To: OpenWrt Development List Date: Thu, 14 Mar 2019 23:42:04 -0700 Message-ID: <87imwkbpvn.fsf@husum.klickitat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190314_234209_167806_6317D2B9 X-CRM114-Status: GOOD ( 16.00 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record Subject: [OpenWrt-Devel] [PATCH] ath79: add support for tplink tl-wdr3600 modified with 16M flash X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org 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 --- .../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@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@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + uboot: partition@0 { + label = "u-boot"; + reg = <0x000000 0x020000>; + read-only; + }; + + partition@20000 { + compatible = "tplink,firmware"; + label = "firmware"; + reg = <0x020000 0xfd0000>; + }; + + art: partition@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