[From nobody Thu Jun 25 05:55:23 2020
Received: from hosting.moc6.cz ([2a02:c60:c70:8900::1] helo=moc6.cz)
 by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux))
 id 1iABRo-00022G-Nd
 for openwrt-devel@lists.openwrt.org; Tue, 17 Sep 2019 11:15:07 +0000
Received: by moc6.cz (Postfix, from userid 1025)
 id AF9A12320022; Tue, 17 Sep 2019 13:14:52 +0200 (CEST)
Date: Tue, 17 Sep 2019 13:14:52 +0200
From: Filip Moc &lt;lede@moc6.cz&gt;
To: Adrian Schmutzler &lt;mail@adrianschmutzler.de&gt;,
 'Enrico Mioso' &lt;mrkiko.rs@gmail.com&gt;
Cc: openwrt-devel@lists.openwrt.org, 'Piotr Dymacz' &lt;pepe2k@gmail.com&gt;
Subject: Re: [OpenWrt-Devel] [PATCH] ath79: add support for TP-Link TL-MR6400
Message-ID: &lt;20190917111452.GA9795@moc6.cz&gt;
References: &lt;20190917002048.1062539-1-mrkiko.rs@gmail.com&gt;
 &lt;003c01d56d3f$b216bee0$16443ca0$@adrianschmutzler.de&gt;
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: &lt;003c01d56d3f$b216bee0$16443ca0$@adrianschmutzler.de&gt;
User-Agent: Mutt/1.10.1 (2018-07-13)
X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 
X-CRM114-CacheID: sfid-20190917_041505_099251_F009AF76 
X-CRM114-Status: GOOD (  29.46  )
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
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record

Hi,

&gt; Here, you assign eth1 to the &quot;wan&quot; LED, but in 02_network you assign eth1 to &quot;lan&quot;.
&gt; Either change 02_network or this LED shouldn't be called WAN.
I think this is correct because the port is actually labeled as WAN but is used
as LAN by default since LTE module is used for wan connection.

&gt; phy0tpt trigger can be moved to DTS, just have a look at other devices recently added to ath79.
Won't this disallow user to change LED function?

&gt; As stated above, this will make eth1 part of &quot;lan&quot; ...
I don't think you can have two interfaces in one network unless you use bridge
which you definitely don't want to use in this case.

&gt; What's that?
You mean the &quot;D12&quot; comment? These are LED labels on board. But I don't have
ath79 version of MR6400 so I can't tell whether LED labels on board didn't
change.


Anyway good job Enrico.


Filip


On Tue, Sep 17, 2019 at 12:07:20PM +0200, Adrian Schmutzler wrote:
&gt; Hi,
&gt; 
&gt; &gt; -----Original Message-----
&gt; &gt; From: openwrt-devel [mailto:openwrt-devel-bounces@lists.openwrt.org] On Behalf Of Enrico Mioso
&gt; &gt; Sent: Dienstag, 17. September 2019 02:21
&gt; &gt; To: openwrt-devel@lists.openwrt.org
&gt; &gt; Cc: Filip Moc &lt;lede@moc6.cz&gt;; Piotr Dymacz &lt;pepe2k@gmail.com&gt;; Enrico Mioso &lt;mrkiko.rs@gmail.com&gt;
&gt; &gt; Subject: [OpenWrt-Devel] [PATCH] ath79: add support for TP-Link TL-MR6400
&gt; &gt; 
&gt; &gt; This adds support to the ath79 target for the TP-Link MR6400 router.
&gt; &gt; 
&gt; &gt; As per original commit, hardware specifications (v1.0 EU):
&gt; &gt; - SoC: QCA9531
&gt; &gt; - Flash: Winbond W25Q64FV (8MiB)
&gt; &gt; - RAM: EtronTech EM6AB160TSE-5G (64MiB)
&gt; &gt; - Wireless: SoC platform only (2.4GHz b/g/n, 2x internal antenna)
&gt; &gt; - Ethernet: 2NIC (3x100M + 1x100M)
&gt; &gt; - WWAN: TP-LINK LTE MODULE (2x external detachable antenna)
&gt; &gt; - Power: DC 12V 1A
&gt; &gt; 
&gt; &gt; Flashing instructions:
&gt; &gt; You can flash via tftp recovery (serve factory image as /mr6400_tp_recovery.bin
&gt; &gt; on 192.168.0.66/24, connect to any ethernet port and power on device while
&gt; &gt; holding the reset button). Flashing via OEM web interface does not work.
&gt; &gt; 
&gt; &gt; Working:
&gt; &gt; - Wi-Fi
&gt; &gt; - TP-Link LTE module does it's thing (but see Notes)
&gt; &gt; - reset/rfkill keys
&gt; &gt; Untested:
&gt; &gt; - recovery via factory
&gt; &gt; - leds
&gt; &gt; 
&gt; &gt; Issues for which I need help:
&gt; &gt; eth1 detects link when infact it's not there, and occasionally causes kernel traces due to tx timeouts.
&gt; &gt; I promise I'll test untested items as well in final version
&gt; &gt; 
&gt; &gt; Note: as it happened occasionally in ar71xx, during bursty flash activity, LTE module init will fail, with USB enumeration errors.
&gt; &gt; 
&gt; &gt; Signed-off-by: Enrico Mioso &lt;mrkiko.rs@gmail.com&gt;
&gt; &gt; CC: Filip Moc &lt;lede@moc6.cz&gt;
&gt; &gt; CC: Piotr Dymacz &lt;pepe2k@gmail.com&gt;
&gt; &gt; ---
&gt; &gt;  .../ath79/base-files/etc/board.d/01_leds      |   6 +
&gt; &gt;  .../ath79/base-files/etc/board.d/02_network   |   5 +
&gt; &gt;  .../ath79/dts/qca9531_tplink_tl-mr6400-v1.dts | 165 ++++++++++++++++++
&gt; &gt;  target/linux/ath79/image/generic-tp-link.mk   |  10 ++
&gt; &gt;  4 files changed, 186 insertions(+)
&gt; &gt;  create mode 100644 target/linux/ath79/dts/qca9531_tplink_tl-mr6400-v1.dts
&gt; &gt; 
&gt; &gt; diff --git a/target/linux/ath79/base-files/etc/board.d/01_leds b/target/linux/ath79/base-files/etc/board.d/01_leds
&gt; &gt; index 778316e450..5728aeb491 100755
&gt; &gt; --- a/target/linux/ath79/base-files/etc/board.d/01_leds
&gt; &gt; +++ b/target/linux/ath79/base-files/etc/board.d/01_leds
&gt; &gt; @@ -130,6 +130,12 @@ tplink,archer-c7-v5)
&gt; &gt;  	ucidef_set_led_switch &quot;lan3&quot; &quot;LAN3&quot; &quot;tp-link:green:lan3&quot; &quot;switch0&quot; &quot;0x10&quot;
&gt; &gt;  	ucidef_set_led_switch &quot;lan4&quot; &quot;LAN4&quot; &quot;tp-link:green:lan4&quot; &quot;switch0&quot; &quot;0x20&quot;
&gt; &gt;  	;;
&gt; &gt; +tplink,tl-mr6400-v1)
&gt; &gt; +	ucidef_set_led_netdev &quot;lan&quot; &quot;LAN&quot; &quot;tp-link:white:lan&quot; &quot;eth0&quot;
&gt; &gt; +	ucidef_set_led_netdev &quot;wan&quot; &quot;WAN&quot; &quot;tp-link:white:wan&quot; &quot;eth1&quot;
&gt; 
&gt; Here, you assign eth1 to the &quot;wan&quot; LED, but in 02_network you assign eth1 to &quot;lan&quot;.
&gt; Either change 02_network or this LED shouldn't be called WAN.
&gt; 
&gt; &gt; +	ucidef_set_led_netdev &quot;4g&quot; &quot;4G&quot; &quot;tp-link:white:4g&quot; &quot;usb0&quot;
&gt; &gt; +	ucidef_set_led_wlan &quot;wlan&quot; &quot;WLAN&quot; &quot;tp-link:white:wlan&quot; &quot;phy0tpt&quot;
&gt; 
&gt; phy0tpt trigger can be moved to DTS, just have a look at other devices recently added to ath79.
&gt; 
&gt; &gt; +	;;
&gt; &gt;  tplink,archer-c2-v3|\
&gt; &gt;  tplink,tl-wr1043nd-v4|\
&gt; &gt;  tplink,tl-wr1043n-v5)
&gt; &gt; diff --git a/target/linux/ath79/base-files/etc/board.d/02_network b/target/linux/ath79/base-files/etc/board.d/02_network
&gt; &gt; index 5b47af8ef7..2b0e1ce400 100755
&gt; &gt; --- a/target/linux/ath79/base-files/etc/board.d/02_network
&gt; &gt; +++ b/target/linux/ath79/base-files/etc/board.d/02_network
&gt; &gt; @@ -56,6 +56,11 @@ ath79_setup_interfaces()
&gt; &gt;  	winchannel,wb2000)
&gt; &gt;  		ucidef_set_interface_lan &quot;eth0&quot;
&gt; &gt;  		;;
&gt; &gt; +	tplink,tl-mr6400-v1)
&gt; &gt; +		ucidef_set_interfaces_lan_wan &quot;eth0.1 eth1&quot; &quot;usb0&quot;
&gt; 
&gt; As stated above, this will make eth1 part of &quot;lan&quot; ...
&gt; 
&gt; &gt; +		ucidef_add_switch &quot;switch0&quot; \
&gt; &gt; +			&quot;0@eth0&quot; &quot;1:lan&quot; &quot;2:lan&quot; &quot;3:lan&quot;
&gt; &gt; +		;;
&gt; &gt;  	avm,fritz4020|\
&gt; &gt;  	pcs,cr3000|\
&gt; &gt;  	tplink,archer-c58-v1|\
&gt; &gt; diff --git a/target/linux/ath79/dts/qca9531_tplink_tl-mr6400-v1.dts b/target/linux/ath79/dts/qca9531_tplink_tl-mr6400-v1.dts
&gt; &gt; new file mode 100644
&gt; &gt; index 0000000000..4acb1a02a4
&gt; &gt; --- /dev/null
&gt; &gt; +++ b/target/linux/ath79/dts/qca9531_tplink_tl-mr6400-v1.dts
&gt; &gt; @@ -0,0 +1,165 @@
&gt; &gt; +// SPDX-License-Identifier: GPL-2.0-or-later
&gt; &gt; +/dts-v1/;
&gt; &gt; +
&gt; &gt; +#include &lt;dt-bindings/gpio/gpio.h&gt;
&gt; &gt; +#include &lt;dt-bindings/input/input.h&gt;
&gt; &gt; +
&gt; &gt; +#include &quot;qca953x.dtsi&quot;
&gt; &gt; +
&gt; &gt; +/ {
&gt; &gt; +	compatible = &quot;tplink,tl-mr6400-v1&quot;, &quot;qca,qca9531&quot;;
&gt; &gt; +	model = &quot;TP-Link TL-MR6400 v1.0&quot;;
&gt; 
&gt; I would remove the &quot;.0&quot; here, as with TP-Link the sub-revisions typically refer only to their firmware. So just &quot;v1&quot; should be better.
&gt; 
&gt; &gt; +
&gt; &gt; +	aliases {
&gt; &gt; +		led-boot = &amp;led_power;
&gt; &gt; +		led-failsafe = &amp;led_power;
&gt; &gt; +		led-running = &amp;led_power;
&gt; &gt; +		led-upgrade = &amp;led_power;
&gt; &gt; +	};
&gt; &gt; +
&gt; &gt; +	gpio_leds: leds {
&gt; &gt; +		compatible = &quot;gpio-leds&quot;;
&gt; &gt; +
&gt; &gt; +		/* D12 */
&gt; 
&gt; What's that?
&gt; 
&gt; &gt; +		led_wan: wan {
&gt; &gt; +			label = &quot;tp-link:white:wan&quot;;
&gt; &gt; +			gpios = &lt;&amp;gpio 0 GPIO_ACTIVE_HIGH&gt;;
&gt; &gt; +		};
&gt; 
&gt; IMO those labels only make sense if you use them, as for led_power. I would remove all of the other ones, i.e. only &quot;wan {&quot; here instead of &quot;led_wan: wan {&quot; ...
&gt; 
&gt; &gt; +
&gt; &gt; +		/* D11 */
&gt; &gt; +		led_4g: 4g {
&gt; &gt; +			label = &quot;tp-link:white:4g&quot;;
&gt; &gt; +			gpios = &lt;&amp;gpio 1 GPIO_ACTIVE_HIGH&gt;;
&gt; &gt; +		};
&gt; &gt; +
&gt; &gt; +		/* D5 */
&gt; &gt; +		led_wps: wps {
&gt; &gt; +			label = &quot;tp-link:white:wps&quot;;
&gt; &gt; +			gpios = &lt;&amp;gpio 3 GPIO_ACTIVE_HIGH&gt;;
&gt; &gt; +		};
&gt; &gt; +
&gt; &gt; +		/* D3 */
&gt; &gt; +		led_wlan: wlan {
&gt; &gt; +			label = &quot;tp-link:white:wlan&quot;;
&gt; &gt; +			gpios = &lt;&amp;gpio 11 GPIO_ACTIVE_HIGH&gt;;
&gt; &gt; +		};
&gt; &gt; +
&gt; &gt; +		/* D2 */
&gt; &gt; +		led_power: power {
&gt; &gt; +			label = &quot;tp-link:white:power&quot;;
&gt; &gt; +			gpios = &lt;&amp;gpio 13 GPIO_ACTIVE_HIGH&gt;;
&gt; &gt; +		};
&gt; &gt; +
&gt; &gt; +		/* D4 */
&gt; &gt; +		led_lan: lan {
&gt; &gt; +			label = &quot;tp-link:white:lan&quot;;
&gt; &gt; +			gpios = &lt;&amp;gpio 16 GPIO_ACTIVE_HIGH&gt;;
&gt; &gt; +		};
&gt; &gt; +	};
&gt; &gt; +
&gt; &gt; +	gpio-export {
&gt; &gt; +		compatible = &quot;gpio-export&quot;;
&gt; &gt; +		#size-cells = &lt;0&gt;;
&gt; &gt; +
&gt; &gt; +		gpio_usb_power {
&gt; &gt; +			gpio-export,name = &quot;tp-link:power:LTE&quot;;
&gt; &gt; +			gpio-export,output = &lt;0&gt;;
&gt; 
&gt; Sure about the 0?
&gt; 
&gt; &gt; +			gpios = &lt;&amp;gpio 4 GPIO_ACTIVE_LOW&gt;;
&gt; &gt; +		};
&gt; &gt; +	};
&gt; 
&gt; Please replace gpio-export by a gpio-hog. Either look at recently added devices or at https://patchwork.ozlabs.org/patch/1141057/
&gt; 
&gt; Note that in this case I would call the node &quot;lte_power&quot; or &quot;power_lte&quot; instead of referring to the USB, but that's a matter of taste.
&gt; 
&gt; &gt; +
&gt; &gt; +	keys {
&gt; &gt; +		compatible = &quot;gpio-keys&quot;;
&gt; &gt; +
&gt; &gt; +		/* SW2 */
&gt; &gt; +		reset {
&gt; &gt; +			label = &quot;Reset button&quot;;
&gt; &gt; +			linux,code = &lt;KEY_RESTART&gt;;
&gt; &gt; +			gpios = &lt;&amp;gpio 12 GPIO_ACTIVE_LOW&gt;;
&gt; &gt; +			debounce-interval = &lt;60&gt;;
&gt; &gt; +		};
&gt; &gt; +
&gt; &gt; +		/* SW3 */
&gt; &gt; +		rfkill {
&gt; &gt; +			label = &quot;RFKill button&quot;;
&gt; &gt; +			linux,code = &lt;KEY_RFKILL&gt;;
&gt; &gt; +			gpios = &lt;&amp;gpio 14 GPIO_ACTIVE_LOW&gt;;
&gt; &gt; +			debounce-interval = &lt;60&gt;;
&gt; &gt; +		};
&gt; &gt; +	};
&gt; &gt; +};
&gt; &gt; +
&gt; &gt; +&amp;uart {
&gt; &gt; +	status = &quot;okay&quot;;
&gt; &gt; +};
&gt; &gt; +
&gt; &gt; +&amp;spi {
&gt; &gt; +	status = &quot;okay&quot;;
&gt; &gt; +	num-cs = &lt;1&gt;;
&gt; &gt; +
&gt; &gt; +	flash@0 {
&gt; &gt; +		#address-cells = &lt;1&gt;;
&gt; &gt; +		#size-cells = &lt;1&gt;;
&gt; &gt; +		compatible = &quot;jedec,spi-nor&quot;;
&gt; &gt; +		reg = &lt;0&gt;;
&gt; &gt; +		spi-max-frequency = &lt;10000000&gt;;
&gt; &gt; +
&gt; &gt; +		partitions {
&gt; &gt; +			compatible = &quot;fixed-partitions&quot;;
&gt; &gt; +			#address-cells = &lt;1&gt;;
&gt; &gt; +			#size-cells = &lt;1&gt;;
&gt; &gt; +
&gt; &gt; +			uboot:	partition@0 {
&gt; 
&gt; There is a tab between uboot and partition. Replace by space ...
&gt; 
&gt; &gt; +				label = &quot;u-boot&quot;;
&gt; &gt; +				reg = &lt;0x000000 0x020000&gt;;
&gt; &gt; +				read-only;
&gt; &gt; +			};
&gt; &gt; +
&gt; &gt; +			partition@20000 {
&gt; &gt; +				compatible = &quot;tplink,firmware&quot;;
&gt; &gt; +				label = &quot;firmware&quot;;
&gt; &gt; +				reg = &lt;0x020000 0x7d0000&gt;;
&gt; &gt; +			};
&gt; &gt; +
&gt; &gt; +			art: partition@7f0000 {
&gt; &gt; +				label = &quot;art&quot;;
&gt; &gt; +				reg = &lt;0x7f0000 0x010000&gt;;
&gt; &gt; +				read-only;
&gt; &gt; +			};
&gt; &gt; +		};
&gt; &gt; +	};
&gt; &gt; +};
&gt; &gt; +
&gt; &gt; +&amp;eth1 {
&gt; &gt; +	mtd-mac-address = &lt;&amp;uboot 0x1fc00&gt;;
&gt; &gt; +	mtd-mac-address-increment = &lt;(-1)&gt;;
&gt; &gt; +};
&gt; &gt; +
&gt; &gt; +&amp;eth0 {
&gt; &gt; +	status = &quot;okay&quot;;
&gt; &gt; +	phy-handle = &lt;&amp;swphy4&gt;;
&gt; &gt; +
&gt; &gt; +	mtd-mac-address = &lt;&amp;uboot 0x1fc00&gt;;
&gt; &gt; +	mtd-mac-address-increment = &lt;1&gt;;
&gt; &gt; +};
&gt; &gt; +
&gt; &gt; +&amp;wmac {
&gt; &gt; +	status = &quot;okay&quot;;
&gt; &gt; +	mtd-cal-data = &lt;&amp;art 0x1000&gt;;
&gt; &gt; +	mtd-mac-address = &lt;&amp;uboot 0x1fc00&gt;;
&gt; &gt; +};
&gt; &gt; +
&gt; &gt; +&amp;usb0 {
&gt; &gt; +	#address-cells = &lt;1&gt;;
&gt; &gt; +	#size-cells = &lt;0&gt;;
&gt; &gt; +	status = &quot;okay&quot;;
&gt; &gt; +
&gt; &gt; +	hub_port: port@1 {
&gt; &gt; +		reg = &lt;1&gt;;
&gt; &gt; +		#trigger-source-cells = &lt;0&gt;;
&gt; &gt; +	};
&gt; &gt; +};
&gt; &gt; +
&gt; &gt; +&amp;usb_phy {
&gt; &gt; +	status = &quot;okay&quot;;
&gt; &gt; +};
&gt; &gt; diff --git a/target/linux/ath79/image/generic-tp-link.mk b/target/linux/ath79/image/generic-tp-link.mk
&gt; &gt; index 5519e9c960..78d7810f29 100644
&gt; &gt; --- a/target/linux/ath79/image/generic-tp-link.mk
&gt; &gt; +++ b/target/linux/ath79/image/generic-tp-link.mk
&gt; &gt; @@ -393,6 +393,16 @@ define Device/tplink_tl-wr810n-v1
&gt; &gt;  endef
&gt; &gt;  TARGET_DEVICES += tplink_tl-wr810n-v1
&gt; &gt; 
&gt; &gt; +define Device/tplink_tl-mr6400-v1
&gt; &gt; +  $(Device/tplink-8mlzma)
&gt; &gt; +  ATH_SOC := qca9531
&gt; &gt; +  DEVICE_MODEL := TL-MR6400
&gt; &gt; +  DEVICE_VARIANT := v1
&gt; &gt; +  TPLINK_HWID := 0x64000001
&gt; &gt; +  DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-net kmod-usb-net-rndis kmod-usb-serial kmod-usb-serial-option adb
&gt; 
&gt; You can remove kmod-usb-core, kmod-usb-net and kmod-usb-serial, as those are dependencies of the other packages.
&gt; 
&gt; Since this is a port from ar71xx, you should add a SUPPORTED_DEVICES entry.
&gt; 
&gt; Best
&gt; 
&gt; Adrian
&gt; 
&gt; &gt; +endef
&gt; &gt; +TARGET_DEVICES += tplink_tl-mr6400-v1
&gt; &gt; +
&gt; &gt;  define Device/tplink_tl-wr810n-v2
&gt; &gt;    $(Device/tplink-8mlzma)
&gt; &gt;    ATH_SOC := qca9533
&gt; &gt; --
&gt; &gt; 2.23.0
&gt; &gt; 
&gt; &gt; 
&gt; &gt; _______________________________________________
&gt; &gt; openwrt-devel mailing list
&gt; &gt; openwrt-devel@lists.openwrt.org
&gt; &gt; https://lists.openwrt.org/mailman/listinfo/openwrt-devel



]