[OpenWrt-Devel] [PATCH] ath79: add support for GL.iNet GL-MIFI

Kyson Lok kysonlok at gmail.com
Tue Sep 4 07:55:32 EDT 2018


Add support the ar71xx supported GL.iNet GL-MIFI to ath79.

Signed-off-by: Kyson Lok <kysonlok at gmail.com>
---
 target/linux/ath79/base-files/etc/board.d/01_leds  |   5 +
 .../linux/ath79/base-files/etc/board.d/02_network  |   3 +-
 target/linux/ath79/dts/ar9331_glinet_mifi.dts      | 139 +++++++++++++++++++++
 target/linux/ath79/image/generic.mk                |   9 ++
 4 files changed, 155 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/ath79/dts/ar9331_glinet_mifi.dts

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 db0d12c..1d3c95a 100755
--- a/target/linux/ath79/base-files/etc/board.d/01_leds
+++ b/target/linux/ath79/base-files/etc/board.d/01_leds
@@ -33,6 +33,11 @@ etactica,eg200)
 	ucidef_set_led_oneshot "modbus" "Modbus" "$boardname:red:modbus" "100" "33"
 	ucidef_set_led_default "etactica" "etactica" "$boardname:red:etactica" "ignore"
 	;;
+glinet,mifi)
+	ucidef_set_led_wlan "wlan" "WLAN" "$boardname:green:wlan" "phy0tpt"
+	ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" "eth0"
+	ucidef_set_led_netdev "3g" "3G" "$boardname:green:3g" "3g-wan"
+	;;
 netgear,wnr612-v2|\
 on,n150r)
 	ucidef_set_led_netdev "wan" "WAN" "netgear:green:wan" "eth0"
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 14f6c59..af42d8f 100755
--- a/target/linux/ath79/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/base-files/etc/board.d/02_network
@@ -48,7 +48,8 @@ ath79_setup_interfaces()
 		;;
 	avm,fritz4020|\
 	glinet,ar150|\
-	glinet,ar300m)
+	glinet,ar300m|\
+	glinet,mifi)
 		ucidef_set_interfaces_lan_wan "eth1" "eth0"
 		;;
 	iodata,etg3-r|\
diff --git a/target/linux/ath79/dts/ar9331_glinet_mifi.dts b/target/linux/ath79/dts/ar9331_glinet_mifi.dts
new file mode 100644
index 0000000..6fe4516
--- /dev/null
+++ b/target/linux/ath79/dts/ar9331_glinet_mifi.dts
@@ -0,0 +1,139 @@
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+#include "ar9331.dtsi"
+
+/ {
+	compatible = "glinet,mifi", "qca,ar9331";
+	model = "GL.iNet GL-MIFI";
+
+	aliases {
+		serial0 = &uart;
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		wlan {
+			label = "mifi:green:wlan";
+			gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
+		};
+
+		lan {
+			label = "mifi:green:lan";
+			gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
+		};
+
+		wan {
+			label = "mifi:green:wan";
+			gpios = <&gpio 27 GPIO_ACTIVE_HIGH>;
+		};
+
+		3g {
+			label = "mifi:green:3g";
+			gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
+		};
+	};
+
+	keys {
+		compatible = "gpio-keys-polled";
+		poll-interval = <20>;
+
+		reset {
+			label = "reset";
+			linux,code = <KEY_RESTART>;
+			gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
+			debounce-interval = <60>;
+		};
+	};
+
+	export {
+		compatible = "gpio-export";
+		#size-cells = <0>;
+
+		usb {
+			gpio-export,name = "usb";
+			gpio-export,output = <0>;
+			gpios = <&gpio 6 GPIO_ACTIVE_HIGH>;
+		};
+
+		3gcontrol {
+			gpio-export,name = "3gcontrol";
+			gpio-export,output = <1>;
+			gpios = <&gpio 7 GPIO_ACTIVE_HIGH>;
+		};
+	};
+};
+
+&uart {
+	status = "okay";
+};
+
+&gpio {
+	status = "okay";
+};
+
+&usb {
+	dr_mode = "host";
+	status = "okay";
+};
+
+&usb_phy {
+	status = "okay";
+};
+
+&spi {
+	num-chipselects = <1>;
+	status = "okay";
+
+	flash at 0 {
+		compatible = "jedec,spi-nor";
+		spi-max-frequency = <104000000>;
+		reg = <0>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition at 0 {
+				label = "u-boot";
+				reg = <0x000000 0x040000>;
+				read-only;
+			};
+
+			partition at 1 {
+				label = "u-boot-env";
+				reg = <0x040000 0x010000>;
+			};
+
+			partition at 2 {
+				label = "firmware";
+				reg = <0x050000 0xfa0000>;
+			};
+
+			art: partition at 3 {
+				label = "art";
+				reg = <0xff0000 0x010000>;
+			};
+		};
+	};
+};
+
+&eth0 {
+	status = "okay";
+	mtd-mac-address = <&art 0x0>;
+};
+
+&eth1 {
+	status = "okay";
+	mtd-mac-address = <&art 0x0>;
+};
+
+&wmac {
+	status = "okay";
+	mtd-cal-data = <&art 0x1000>;
+	mtd-mac-address = <&art 0x0>;
+};
diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk
index e35a356..f10a552 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -80,6 +80,15 @@ define Device/glinet_ar300m_nor
 endef
 TARGET_DEVICES += glinet_ar300m_nor
 
+define Device/glinet_mifi
+  ATH_SOC := ar9331
+  DEVICE_TITLE := GL.iNet GL-MIFI
+  DEVICE_PACKAGES := kmod-usb-chipidea2
+  IMAGE_SIZE := 16000k
+  SUPPORTED_DEVICES += gl-mifi
+endef
+TARGET_DEVICES += glinet_mifi
+
 define Device/iodata_etg3-r
   ATH_SOC := ar9342
   DEVICE_TITLE := I-O DATA ETG3-R
-- 
2.7.4


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



More information about the openwrt-devel mailing list