From 3601c9aba63211ef2912b100f0b10de4d880a912 Mon Sep 17 00:00:00 2001
From: Martin Weinelt <mweinelt@users.noreply.github.com>
Date: Wed, 14 Nov 2018 23:35:02 +0100
Subject: [PATCH] mt76x8: add support for GL.iNet GL-MT300N-V2 (#1548)

Signed-off-by: Martin Weinelt <martin@darmstadt.freifunk.net>
---
 docs/index.rst                                |  5 ++-
 ...ips-fix-leds-on-GL.iNet-GL-MT300N-V2.patch | 34 +++++++++++++++++++
 targets/ramips-mt76x8                         |  5 +++
 3 files changed, 43 insertions(+), 1 deletion(-)
 create mode 100644 patches/openwrt/0012-ramips-fix-leds-on-GL.iNet-GL-MT300N-V2.patch

diff --git a/docs/index.rst b/docs/index.rst
index 3f1f075c2..f31c2132b 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -349,9 +349,12 @@ ramips-mt7621
   - EdgeRouter X
   - EdgeRouter X-SFP
 
-ramips-mt7628
+ramips-mt76x8
 ^^^^^^^^^^^^^
 
+* GL.iNet
+  - MT300N v2 [#80211s]_
+
 * TP-Link
 
   - Archer C50 v3 [#80211s]_
diff --git a/patches/openwrt/0012-ramips-fix-leds-on-GL.iNet-GL-MT300N-V2.patch b/patches/openwrt/0012-ramips-fix-leds-on-GL.iNet-GL-MT300N-V2.patch
new file mode 100644
index 000000000..89c2b60ae
--- /dev/null
+++ b/patches/openwrt/0012-ramips-fix-leds-on-GL.iNet-GL-MT300N-V2.patch
@@ -0,0 +1,34 @@
+From: Martin Weinelt <hexa@darmstadt.ccc.de>
+Date: Fri, 2 Nov 2018 20:52:01 +0100
+Subject: ramips: fix leds on GL.iNet GL-MT300N-V2
+
+The WAN LED now shows the link state. It's color is green,
+not blue.
+
+Signed-off-by: Martin Weinelt <hexa@darmstadt.ccc.de>
+
+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 54504c6ee8bb45db0ffa371ec68c3a8fd7e4d673..6057275978591192e3b7799a8e6d97761c3e23a5 100755
+--- a/target/linux/ramips/base-files/etc/board.d/01_leds
++++ b/target/linux/ramips/base-files/etc/board.d/01_leds
+@@ -210,6 +210,7 @@ gl-mt750)
+ 	;;
+ gl-mt300n-v2)
+ 	set_wifi_led "$boardname:red:wlan"
++	ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x1"
+ 	;;
+ hc5661|\
+ hc5661a)
+diff --git a/target/linux/ramips/dts/GL-MT300N-V2.dts b/target/linux/ramips/dts/GL-MT300N-V2.dts
+index e99d5578f05bbaf82917878b87eb973a8323198c..98c9a796330068b36df5946f4a428e1b324594f8 100644
+--- a/target/linux/ramips/dts/GL-MT300N-V2.dts
++++ b/target/linux/ramips/dts/GL-MT300N-V2.dts
+@@ -28,7 +28,7 @@
+ 		};
+ 
+ 		wan {
+-			label = "gl-mt300n-v2:blue:wan";
++			label = "gl-mt300n-v2:green:wan";
+ 			gpios = <&gpio1 11 GPIO_ACTIVE_LOW>;
+ 		};
+ 
diff --git a/targets/ramips-mt76x8 b/targets/ramips-mt76x8
index 4087fae0e..d0e001358 100644
--- a/targets/ramips-mt76x8
+++ b/targets/ramips-mt76x8
@@ -1,3 +1,8 @@
+# GL.iNet
+
+device gl-mt300n-v2 gl-mt300n-v2
+factory
+
 # TP-Link
 
 device tp-link-archer-c50-v3 tplink_c50-v3
-- 
GitLab