-
-
Save compliment/43ac7e95700c1b0a05a63b9c07f41192 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From bfb65ea7646c67f92439db9d38ff0cd1c9ef66a5 Mon Sep 17 00:00:00 2001 | |
From: compliment <nishkumar1@outlook.com> | |
Date: Mon, 5 Jul 2021 14:50:18 +0530 | |
Subject: [PATCH 1/2] TL-WR850N v3 with | |
https://github.com/openwrt/openwrt/pull/1577 | |
--- | |
package/base-files/files/etc/diag.sh | 2 + | |
.../base-files/files/lib/functions/leds.sh | 27 ++++++++++-- | |
.../ramips/base-files/etc/board.d/01_leds | 13 ++++++ | |
.../ramips/base-files/etc/board.d/02_network | 6 +++ | |
target/linux/ramips/image/mt76x8.mk | 42 +++++++++++++++++++ | |
5 files changed, 86 insertions(+), 4 deletions(-) | |
diff --git a/package/base-files/files/etc/diag.sh b/package/base-files/files/etc/diag.sh | |
index 8eb36c6feb..37a8ec758e 100644 | |
--- a/package/base-files/files/etc/diag.sh | |
+++ b/package/base-files/files/etc/diag.sh | |
@@ -37,6 +37,8 @@ set_led_state() { | |
;; | |
done) | |
status_led_off | |
+ [ "$status_led" != "$running" ] && \ | |
+ status_led_restore_trigger "boot" | |
[ -n "$running" ] && { | |
status_led="$running" | |
status_led_on | |
diff --git a/package/base-files/files/lib/functions/leds.sh b/package/base-files/files/lib/functions/leds.sh | |
index 8a1d21caef..43b2fe02ed 100644 | |
--- a/package/base-files/files/lib/functions/leds.sh | |
+++ b/package/base-files/files/lib/functions/leds.sh | |
@@ -1,16 +1,24 @@ | |
#!/bin/sh | |
# Copyright (C) 2013 OpenWrt.org | |
-get_dt_led() { | |
- local label | |
+get_dt_led_path() { | |
local ledpath | |
local basepath="/proc/device-tree" | |
local nodepath="$basepath/aliases/led-$1" | |
[ -f "$nodepath" ] && ledpath=$(cat "$nodepath") | |
+ [ -n "$ledpath" ] && ledpath="$basepath$ledpath" | |
+ | |
+ echo "$ledpath" | |
+} | |
+ | |
+get_dt_led() { | |
+ local label | |
+ local ledpath=$(get_dt_led_path $1) | |
+ | |
[ -n "$ledpath" ] && \ | |
- label=$(cat "$basepath$ledpath/label" 2>/dev/null) || \ | |
- label=$(cat "$basepath$ledpath/chan-name" 2>/dev/null) | |
+ label=$(cat "$ledpath/label" 2>/dev/null) || \ | |
+ label=$(cat "$ledpath/chan-name" 2>/dev/null) | |
echo "$label" | |
} | |
@@ -35,6 +43,17 @@ led_off() { | |
led_set_attr $1 "brightness" 0 | |
} | |
+status_led_restore_trigger() { | |
+ local trigger | |
+ local ledpath=$(get_dt_led_path $1) | |
+ | |
+ [ -n "$ledpath" ] && \ | |
+ trigger=$(cat "$ledpath/linux,default-trigger" 2>/dev/null) | |
+ | |
+ [ -n "$trigger" ] && \ | |
+ led_set_attr "$(get_dt_led $1)" "trigger" "$trigger" | |
+} | |
+ | |
status_led_set_timer() { | |
led_timer $status_led "$1" "$2" | |
[ -n "$status_led2" ] && led_timer $status_led2 "$1" "$2" | |
diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds b/target/linux/ramips/base-files/etc/board.d/01_leds | |
index 0845db393d..137d8b55b4 100755 | |
--- a/target/linux/ramips/base-files/etc/board.d/01_leds | |
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds | |
@@ -1,5 +1,6 @@ | |
#!/bin/sh | |
+. /lib/functions/leds.sh | |
. /lib/functions/uci-defaults.sh | |
set_wifi_led() { | |
@@ -12,6 +13,9 @@ boardname="${board##*,}" | |
board_config_update | |
+led_wlan="$(get_dt_led wlan)" | |
+[ -n "$led_wlan" ] && ucidef_set_led_wlan "wifi_led" "wifi" "$led_wlan" "phy0tpt" | |
+ | |
case $board in | |
3g-6200n|\ | |
br-6475nd|\ | |
@@ -310,6 +314,10 @@ tl-wr840n-v4) | |
ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x1e" | |
ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01" | |
;; | |
+tplink,tl-wr840n-v62) | |
+ ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x1e" | |
+ ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01" | |
+ ;; | |
tl-wr841n-v13) | |
ucidef_set_led_wlan "wlan2g" "wlan2g" "$boardname:green:wlan" "phy0tpt" | |
ucidef_set_led_switch "lan1" "lan1" "$boardname:green:lan1" "switch0" "0x2" | |
@@ -318,6 +326,11 @@ tl-wr841n-v13) | |
ucidef_set_led_switch "lan4" "lan4" "$boardname:green:lan4" "switch0" "0x10" | |
ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01" | |
;; | |
+tplink,tl-wr841n-v14|\ | |
+tplink,tl-wr850n-v3) | |
+ ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x1e" | |
+ ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01" | |
+ ;; | |
tplink,c2-v1) | |
ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch1" "0x1e" | |
ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch1" "0x01" | |
diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network | |
index f743ce851a..42c75ee6b6 100755 | |
--- a/target/linux/ramips/base-files/etc/board.d/02_network | |
+++ b/target/linux/ramips/base-files/etc/board.d/02_network | |
@@ -244,9 +244,12 @@ ramips_setup_interfaces() | |
tplink,c50-v4|\ | |
tplink,tl-mr3420-v5|\ | |
tplink,tl-wr842n-v5|\ | |
+ tplink,tl-wr840n-v62|\ | |
tl-wr840n-v4|\ | |
tl-wr840n-v5|\ | |
tl-wr841n-v13|\ | |
+ tplink,tl-wr841n-v14|\ | |
+ tplink,tl-wr850n-v3|\ | |
u7628-01-128M-16M|\ | |
ubnt-erx|\ | |
ubnt-erx-sfp|\ | |
@@ -690,6 +693,9 @@ ramips_setup_macs() | |
zyxel,keenetic-start) | |
wan_mac=$(mtd_get_mac_binary factory 40) | |
;; | |
+ tplink,tl-wr850n-v3) | |
+ wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0xf100)" 1) | |
+ ;; | |
*) | |
lan_mac=$(cat /sys/class/net/eth0/address) | |
wan_mac=$(macaddr_add "$lan_mac" 1) | |
diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk | |
index 7df5c04297..6d24a59b65 100644 | |
--- a/target/linux/ramips/image/mt76x8.mk | |
+++ b/target/linux/ramips/image/mt76x8.mk | |
@@ -247,6 +247,20 @@ define Device/tl-wr840n-v5 | |
endef | |
TARGET_DEVICES += tl-wr840n-v5 | |
+define Device/tplink_tl-wr840n-v62 | |
+ $(Device/tplink) | |
+ DTS := TL-WR840NV62 | |
+ IMAGE_SIZE := 3968k | |
+ DEVICE_TITLE := TP-Link TL-WR840N v6.2 | |
+ TPLINK_FLASHLAYOUT := 4Mmtk | |
+ TPLINK_HWID := 0x08400006 | |
+ TPLINK_HWREV := 0x1 | |
+ TPLINK_HWREVADD := 0x7 | |
+ TPLINK_HVERSION := 3 | |
+ IMAGE/tftp-recovery.bin := pad-extra 64k | $$(IMAGE/factory.bin) | |
+endef | |
+TARGET_DEVICES += tplink_tl-wr840n-v62 | |
+ | |
define Device/tl-wr841n-v13 | |
$(Device/tplink) | |
DTS := TL-WR841NV13 | |
@@ -260,6 +274,34 @@ define Device/tl-wr841n-v13 | |
endef | |
TARGET_DEVICES += tl-wr841n-v13 | |
+define Device/tplink_tl-wr841n-v14 | |
+ $(Device/tplink) | |
+ DTS := TL-WR841NV14 | |
+ IMAGE_SIZE := 3968k | |
+ DEVICE_TITLE := TP-Link TL-WR841N v14 | |
+ TPLINK_FLASHLAYOUT := 4Mmtk | |
+ TPLINK_HWID := 0x08410014 | |
+ TPLINK_HWREV := 0x1 | |
+ TPLINK_HWREVADD := 0x14 | |
+ TPLINK_HVERSION := 3 | |
+ IMAGE/tftp-recovery.bin := pad-extra 64k | $$(IMAGE/factory.bin) | |
+endef | |
+TARGET_DEVICES += tplink_tl-wr841n-v14 | |
+ | |
+define Device/tplink_tl-wr850n-v3 | |
+ $(Device/tplink) | |
+ DTS := TL-WR850NV3 | |
+ IMAGE_SIZE := 3968k | |
+ DEVICE_TITLE := TP-Link TL-WR850N v3 | |
+ TPLINK_FLASHLAYOUT := 4Mmtk | |
+ TPLINK_HWID := 0x08500003 | |
+ TPLINK_HWREV := 0x3 | |
+ TPLINK_HWREVADD := 0x3 | |
+ TPLINK_HVERSION := 3 | |
+ IMAGE/tftp-recovery.bin := pad-extra 64k | $$(IMAGE/factory.bin) | |
+endef | |
+TARGET_DEVICES += tplink_tl-wr850n-v3 | |
+ | |
define Device/tplink_c20-v4 | |
$(Device/tplink) | |
DTS := ArcherC20v4 | |
-- | |
2.32.0 | |
From 307b097fc46cd03879f25e45cae36df4ae384b06 Mon Sep 17 00:00:00 2001 | |
From: compliment <nishkumar1@outlook.com> | |
Date: Mon, 5 Jul 2021 14:51:31 +0530 | |
Subject: [PATCH 2/2] TL-WR850N v3 with | |
https://github.com/openwrt/openwrt/pull/1577 | |
--- | |
target/linux/ramips/dts/TL-WR840NV62.dts | 138 +++++++++++++++++++++++ | |
target/linux/ramips/dts/TL-WR841NV14.dts | 138 +++++++++++++++++++++++ | |
target/linux/ramips/dts/TL-WR850NV3.dts | 80 +++++++++++++ | |
3 files changed, 356 insertions(+) | |
create mode 100644 target/linux/ramips/dts/TL-WR840NV62.dts | |
create mode 100644 target/linux/ramips/dts/TL-WR841NV14.dts | |
create mode 100644 target/linux/ramips/dts/TL-WR850NV3.dts | |
diff --git a/target/linux/ramips/dts/TL-WR840NV62.dts b/target/linux/ramips/dts/TL-WR840NV62.dts | |
new file mode 100644 | |
index 0000000000..1e9f5a4b9b | |
--- /dev/null | |
+++ b/target/linux/ramips/dts/TL-WR840NV62.dts | |
@@ -0,0 +1,138 @@ | |
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT | |
+/dts-v1/; | |
+ | |
+#include "mt7628an.dtsi" | |
+ | |
+#include <dt-bindings/gpio/gpio.h> | |
+#include <dt-bindings/input/input.h> | |
+ | |
+/ { | |
+ compatible = "tplink,tl-wr840n-v62", "mediatek,mt7628an-soc"; | |
+ model = "TP-Link TL-WR840N v6.2"; | |
+ | |
+ aliases { | |
+ led-boot = &led_wlan; | |
+ led-failsafe = &led_wlan; | |
+ led-upgrade = &led_wlan; | |
+ | |
+ led-wlan = &led_wlan; | |
+ }; | |
+ | |
+ chosen { | |
+ bootargs = "console=ttyS0,115200"; | |
+ }; | |
+ | |
+ memory@0 { | |
+ device_type = "memory"; | |
+ reg = <0x0 0x2000000>; | |
+ }; | |
+ | |
+ keys { | |
+ compatible = "gpio-keys-polled"; | |
+ poll-interval = <20>; | |
+ | |
+ reset { | |
+ label = "reset"; | |
+ gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; | |
+ linux,code = <KEY_RESTART>; | |
+ }; | |
+ }; | |
+ | |
+ leds { | |
+ compatible = "gpio-leds"; | |
+ | |
+ lan { | |
+ label = "tl-wr840n-v62:green:lan"; | |
+ gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; | |
+ }; | |
+ | |
+ wan_green { | |
+ label = "tl-wr840n-v62:green:wan"; | |
+ gpios = <&gpio1 8 GPIO_ACTIVE_LOW>; | |
+ }; | |
+ | |
+ led_wlan: wlan { | |
+ label = "tl-wr840n-v62:green:wlan"; | |
+ gpios = <&gpio1 12 GPIO_ACTIVE_LOW>; | |
+ linux,default-trigger = "phy0tpt"; | |
+ }; | |
+ | |
+ wan_orange { | |
+ label = "tl-wr840n-v62:orange:wan"; | |
+ gpios = <&gpio1 10 GPIO_ACTIVE_LOW>; | |
+ }; | |
+ }; | |
+}; | |
+ | |
+&spi0 { | |
+ status = "okay"; | |
+ | |
+ flash@0 { | |
+ compatible = "jedec,spi-nor"; | |
+ reg = <0>; | |
+ spi-max-frequency = <10000000>; | |
+ m25p,chunked-io = <32>; | |
+ | |
+ partitions { | |
+ compatible = "fixed-partitions"; | |
+ #address-cells = <1>; | |
+ #size-cells = <1>; | |
+ | |
+ partition@0 { | |
+ label = "boot"; | |
+ reg = <0x0 0x10000>; | |
+ read-only; | |
+ }; | |
+ | |
+ partition@10000 { | |
+ compatible = "tplink,firmware"; | |
+ label = "firmware"; | |
+ reg = <0x10000 0x3e0000>; | |
+ }; | |
+ | |
+ factory: partition@3f0000 { | |
+ label = "factory"; | |
+ reg = <0x3f0000 0x10000>; | |
+ read-only; | |
+ }; | |
+ }; | |
+ }; | |
+}; | |
+ | |
+&ehci { | |
+ status = "disabled"; | |
+}; | |
+ | |
+&ohci { | |
+ status = "disabled"; | |
+}; | |
+ | |
+&wmac { | |
+ status = "okay"; | |
+ mtd-mac-address = <&factory 0xf100>; | |
+}; | |
+ | |
+ðernet { | |
+ mtd-mac-address = <&factory 0xf100>; | |
+}; | |
+ | |
+&esw { | |
+ mediatek,portmap = <0x3e>; | |
+}; | |
+ | |
+&pinctrl { | |
+ state_default: pinctrl0 { | |
+ gpio { | |
+ ralink,group = "p4led_an", "p3led_an", "p2led_an", "p1led_an", "p0led_an", "wdt"; | |
+ ralink,function = "gpio"; | |
+ }; | |
+ }; | |
+}; | |
+ | |
+&gpio1 { | |
+ led_wlan_enable { | |
+ gpio-hog; | |
+ gpios = <11 GPIO_ACTIVE_HIGH>; | |
+ output-high; | |
+ }; | |
+}; | |
diff --git a/target/linux/ramips/dts/TL-WR841NV14.dts b/target/linux/ramips/dts/TL-WR841NV14.dts | |
new file mode 100644 | |
index 0000000000..7d728adebc | |
--- /dev/null | |
+++ b/target/linux/ramips/dts/TL-WR841NV14.dts | |
@@ -0,0 +1,138 @@ | |
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT | |
+/dts-v1/; | |
+ | |
+#include "mt7628an.dtsi" | |
+ | |
+#include <dt-bindings/gpio/gpio.h> | |
+#include <dt-bindings/input/input.h> | |
+ | |
+/ { | |
+ compatible = "tplink,tl-wr841n-v14", "mediatek,mt7628an-soc"; | |
+ model = "TP-Link TL-WR841N v14"; | |
+ | |
+ aliases { | |
+ led-boot = &led_wlan; | |
+ led-failsafe = &led_wlan; | |
+ led-upgrade = &led_wlan; | |
+ | |
+ led-wlan = &led_wlan; | |
+ }; | |
+ | |
+ chosen { | |
+ bootargs = "console=ttyS0,115200"; | |
+ }; | |
+ | |
+ memory@0 { | |
+ device_type = "memory"; | |
+ reg = <0x0 0x2000000>; | |
+ }; | |
+ | |
+ keys { | |
+ compatible = "gpio-keys-polled"; | |
+ poll-interval = <20>; | |
+ | |
+ reset { | |
+ label = "reset"; | |
+ gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; | |
+ linux,code = <KEY_RESTART>; | |
+ }; | |
+ }; | |
+ | |
+ leds { | |
+ compatible = "gpio-leds"; | |
+ | |
+ lan { | |
+ label = "tl-wr841n-v14:green:lan"; | |
+ gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; | |
+ }; | |
+ | |
+ wan_green { | |
+ label = "tl-wr841n-v14:green:wan"; | |
+ gpios = <&gpio1 8 GPIO_ACTIVE_LOW>; | |
+ }; | |
+ | |
+ led_wlan: wlan { | |
+ label = "tl-wr841n-v14:green:wlan"; | |
+ gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; | |
+ linux,default-trigger = "phy0tpt"; | |
+ }; | |
+ | |
+ wan_orange { | |
+ label = "tl-wr841n-v14:orange:wan"; | |
+ gpios = <&gpio1 10 GPIO_ACTIVE_LOW>; | |
+ }; | |
+ }; | |
+}; | |
+ | |
+&spi0 { | |
+ status = "okay"; | |
+ | |
+ flash@0 { | |
+ compatible = "jedec,spi-nor"; | |
+ reg = <0>; | |
+ spi-max-frequency = <10000000>; | |
+ m25p,chunked-io = <32>; | |
+ | |
+ partitions { | |
+ compatible = "fixed-partitions"; | |
+ #address-cells = <1>; | |
+ #size-cells = <1>; | |
+ | |
+ partition@0 { | |
+ label = "boot"; | |
+ reg = <0x0 0x10000>; | |
+ read-only; | |
+ }; | |
+ | |
+ partition@10000 { | |
+ compatible = "tplink,firmware"; | |
+ label = "firmware"; | |
+ reg = <0x10000 0x3e0000>; | |
+ }; | |
+ | |
+ factory: partition@3f0000 { | |
+ label = "factory"; | |
+ reg = <0x3f0000 0x10000>; | |
+ read-only; | |
+ }; | |
+ }; | |
+ }; | |
+}; | |
+ | |
+&ehci { | |
+ status = "disabled"; | |
+}; | |
+ | |
+&ohci { | |
+ status = "disabled"; | |
+}; | |
+ | |
+&wmac { | |
+ status = "okay"; | |
+ mtd-mac-address = <&factory 0xf100>; | |
+}; | |
+ | |
+ðernet { | |
+ mtd-mac-address = <&factory 0xf100>; | |
+}; | |
+ | |
+&esw { | |
+ mediatek,portmap = <0x3e>; | |
+}; | |
+ | |
+&pinctrl { | |
+ state_default: pinctrl0 { | |
+ gpio { | |
+ ralink,group = "p4led_an", "p3led_an", "p2led_an", "p1led_an", "p0led_an", "wdt"; | |
+ ralink,function = "gpio"; | |
+ }; | |
+ }; | |
+}; | |
+ | |
+&gpio1 { | |
+ led_wlan_enable { | |
+ gpio-hog; | |
+ gpios = <11 GPIO_ACTIVE_HIGH>; | |
+ output-high; | |
+ }; | |
+}; | |
diff --git a/target/linux/ramips/dts/TL-WR850NV3.dts b/target/linux/ramips/dts/TL-WR850NV3.dts | |
new file mode 100644 | |
index 0000000000..5539c55a12 | |
--- /dev/null | |
+++ b/target/linux/ramips/dts/TL-WR850NV3.dts | |
@@ -0,0 +1,80 @@ | |
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT | |
+/dts-v1/; | |
+ | |
+#include "mt7628an.dtsi" | |
+ | |
+#include <dt-bindings/gpio/gpio.h> | |
+#include <dt-bindings/input/input.h> | |
+ | |
+/ { | |
+ compatible = "tplink,tl-wr850n-v3", "mediatek,mt7628an-soc"; | |
+ model = "TP-Link TL-WR850N v3"; | |
+ | |
+ aliases { | |
+ led-boot = &led_power; | |
+ led-failsafe = &led_power; | |
+ led-running = &led_power; | |
+ led-upgrade = &led_power; | |
+ }; | |
+ | |
+ keys { | |
+ compatible = "gpio-keys"; | |
+ | |
+ reset { | |
+ label = "reset"; | |
+ gpios = <&gpio 38 GPIO_ACTIVE_LOW>; | |
+ linux,code = <KEY_RESTART>; | |
+ }; | |
+ }; | |
+ | |
+ leds { | |
+ compatible = "gpio-leds"; | |
+ | |
+ led_power: power { | |
+ label = "tl-wr850n-v3:green:power"; | |
+ gpios = <&gpio 36 GPIO_ACTIVE_LOW>; | |
+ }; | |
+ | |
+ wps { | |
+ label = "tl-wr850n-v3:green:wps"; | |
+ gpios = <&gpio 37 GPIO_ACTIVE_LOW>; | |
+ }; | |
+ | |
+ lan { | |
+ label = "tl-wr850n-v3:green:lan"; | |
+ gpios = <&gpio 41 GPIO_ACTIVE_LOW>; | |
+ }; | |
+ | |
+ wan { | |
+ label = "tl-wr850n-v3:green:wan"; | |
+ gpios = <&gpio 43 GPIO_ACTIVE_LOW>; | |
+ }; | |
+ | |
+ wlan { | |
+ label = "tl-wr850n-v3:green:wlan"; | |
+ gpios = <&gpio 44 GPIO_ACTIVE_LOW>; | |
+ linux,default-trigger = "phy0tpt"; | |
+ }; | |
+ }; | |
+}; | |
+ | |
+&pinctrl { | |
+ state_default: pinctrl0 { | |
+ gpio { | |
+ ralink,group,groups = "p0led_an", "p2led_an", "perst", "refclk", "wdt", "wled_an"; | |
+ ralink,function = "gpio"; | |
+ }; | |
+ }; | |
+}; | |
+ | |
+&esw { | |
+ mediatek,portmap = <0x3e>; | |
+}; | |
+ | |
+&ehci { | |
+ status = "disabled"; | |
+}; | |
+ | |
+&ohci { | |
+ status = "disabled"; | |
+}; | |
-- | |
2.32.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment