[OpenWrt-Devel] [PATCH] ath79: port TP-Link TL-WR741ND v4 and TL-WR740ND v4

Mathias Kresin dev at kresin.me
Tue Jun 26 12:36:23 EDT 2018


Hey Rocco,

find my (minor) comments inline.

2018-06-26 17:58 GMT+02:00 Rocco Folino <rocco at folino.io>:
> This patch ports the TP-Link TL-WR741ND v4 and TL-WR740ND v4 to the
> ath79 target.
>
> Because the two devices share the same hw layout, this patch adds a common
> .dtsi which is included by the two .dts.
>
> Signed-off-by: Rocco Folino <rocco at folino.io>
> ---
>  .../ath79/base-files/etc/board.d/01_leds      |   9 +
>  .../ath79/base-files/etc/board.d/02_network   |   7 +
>  .../linux/ath79/dts/ar9331_tl-wr740nd-v4.dts  |   9 +
>  .../linux/ath79/dts/ar9331_tl-wr741nd-v4.dts  |   9 +
>  .../linux/ath79/dts/ar9331_tl-wr741nd-v4.dtsi | 169 ++++++++++++++++++
>  target/linux/ath79/image/tiny-tp-link.mk      |  18 ++
>  6 files changed, 221 insertions(+)
>  create mode 100644 target/linux/ath79/dts/ar9331_tl-wr740nd-v4.dts
>  create mode 100644 target/linux/ath79/dts/ar9331_tl-wr741nd-v4.dts
>  create mode 100644 target/linux/ath79/dts/ar9331_tl-wr741nd-v4.dtsi
>
> diff --git a/target/linux/ath79/base-files/etc/board.d/01_leds b/target/linux/ath79/base-files/etc/board.d/01_leds
> index 29416ad83ea7..13d8d1004f79 100755
> --- a/target/linux/ath79/base-files/etc/board.d/01_leds
> +++ b/target/linux/ath79/base-files/etc/board.d/01_leds
> @@ -45,6 +45,15 @@ case "$board" in
>         ucidef_set_led_switch "lan3" "LAN3" "$boardname:green:lan3" "switch0" "0x08"
>         ucidef_set_led_switch "lan4" "LAN4" "$boardname:green:lan4" "switch0" "0x10"
>         ;;
> +"tplink,tl-wr741nd-v4"|\
> +"tplink,tl-wr740nd-v4")
> +       ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1"
> +       ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x04"
> +       ucidef_set_led_switch "lan2" "LAN2" "tp-link:green:lan2" "switch0" "0x08"
> +       ucidef_set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x10"
> +       ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x02"
> +       ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"

Please use the linux,default-trigger devicetree property to set the
phy0tpt trigger. Have a look at the existing ath79 dts files for
examples.

> +       ;;
>  esac
>
>  board_config_flush
> 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 e2a45b05261a..510b563d6998 100755
> --- a/target/linux/ath79/base-files/etc/board.d/02_network
> +++ b/target/linux/ath79/base-files/etc/board.d/02_network
> @@ -62,6 +62,13 @@ ath79_setup_interfaces()
>                         "0 at eth1" "1:lan" "2:lan" "3:lan" "4:lan"
>                 ;;
>
> +       "tplink,tl-wr741nd-v4"|\
> +       "tplink,tl-wr740nd-v4")
> +               ucidef_set_interfaces_lan_wan "eth0.1" "eth1"

ucidef_add_switch should already set the lan interface. A
ucidef_set_interface_wan "eth1" should be sufficient here.

> +               ucidef_add_switch "switch0" \
> +                       "0 at eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
> +               ;;
> +
>         "tplink,tl-wr1043nd-v1")
>                 ucidef_add_switch "switch0" \
>                         "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5 at eth0"
> diff --git a/target/linux/ath79/dts/ar9331_tl-wr740nd-v4.dts b/target/linux/ath79/dts/ar9331_tl-wr740nd-v4.dts
> new file mode 100644
> index 000000000000..b0029b88b6f4
> --- /dev/null
> +++ b/target/linux/ath79/dts/ar9331_tl-wr740nd-v4.dts
> @@ -0,0 +1,9 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> +/dts-v1/;
> +
> +#include "ar9331_tl-wr741nd-v4.dtsi"
> +
> +/ {
> +       model = "TP-Link TL-WR740N/ND v4";
> +       compatible = "tplink,tl-wr740n-v4";
> +};
> diff --git a/target/linux/ath79/dts/ar9331_tl-wr741nd-v4.dts b/target/linux/ath79/dts/ar9331_tl-wr741nd-v4.dts
> new file mode 100644
> index 000000000000..118831b4d24c
> --- /dev/null
> +++ b/target/linux/ath79/dts/ar9331_tl-wr741nd-v4.dts
> @@ -0,0 +1,9 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> +/dts-v1/;
> +
> +#include "ar9331_tl-wr741nd-v4.dtsi"
> +
> +/ {
> +       model = "TP-Link TL-WR741N/ND v4";
> +       compatible = "tplink,tl-wr741n-v4";
> +};
> diff --git a/target/linux/ath79/dts/ar9331_tl-wr741nd-v4.dtsi b/target/linux/ath79/dts/ar9331_tl-wr741nd-v4.dtsi
> new file mode 100644
> index 000000000000..6aa578a52520
> --- /dev/null
> +++ b/target/linux/ath79/dts/ar9331_tl-wr741nd-v4.dtsi
> @@ -0,0 +1,169 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> +/dts-v1/;
> +
> +#include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/input.h>
> +
> +#include "ar9331.dtsi"
> +
> +/ {
> +       compatible = "tplink,tl-wr741n-v4", "qca,ar9331";
> +       model = "TP-Link TL-WR741N/ND v4";
> +
> +       aliases {
> +               serial0 = &uart;
> +               led-status = &led_system;
> +       };
> +
> +       memory at 0 {
> +               device_type = "memory";
> +               reg = <0x0 0x2000000>;
> +       };

The pending https://github.com/openwrt/openwrt/pull/1091 is about to
remove all memory nodes in favour of the automatic memory detection.
Would you please test if the correct of amount of memory is detected
without the node. If so, the node can be removed.

Mathias

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/listinfo/openwrt-devel



More information about the openwrt-devel mailing list