Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpratt14/7cffc7c97cab72be34657014ff6c540c to your computer and use it in GitHub Desktop.
Save mpratt14/7cffc7c97cab72be34657014ff6c540c to your computer and use it in GitHub Desktop.
ENS202EXT port to ATH79 kernel attempt 1
From 3d3e2c61ae225d3f699e63f72c759f78fc307c5b Mon Sep 17 00:00:00 2001
From: Michael Pratt <mpratt51@gmail.com>
Date: Mon, 23 Mar 2020 17:07:27 -0400
Subject: [PATCH] ath79: Add support for ENS202EXT (attempt 1)
---
.../ath79/base-files/etc/board.d/01_leds | 6 +
.../ath79/base-files/etc/board.d/02_network | 9 ++
.../ath79/dts/ar9341_engenius_ens202ext.dts | 145 ++++++++++++++++++
target/linux/ath79/image/generic.mk | 8 +
4 files changed, 168 insertions(+)
create mode 100644 target/linux/ath79/dts/ar9341_engenius_ens202ext.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 dd483c0526..dff506d492 100755
--- a/target/linux/ath79/base-files/etc/board.d/01_leds
+++ b/target/linux/ath79/base-files/etc/board.d/01_leds
@@ -65,6 +65,12 @@ dlink,dir-859-a1)
engenius,ecb1750)
ucidef_set_led_netdev "lan" "LAN" "$boardname:blue:lan" "eth0"
;;
+engenius,ens202ext)
+ ucidef_set_rssimon "wlan0" "200000" "1"
+ ucidef_set_led_rssi "rssilow" "RSSILOW" "engenius:red:wlan1" "wlan0" "1" "100" "0" "13"
+ ucidef_set_led_rssi "rssimedium" "RSSIMEDIUM" "engenius:amber:wlan2" "wlan0" "33" "100" "-39" "13"
+ ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "engenius:green:wlan3" "wlan0" "75" "100" "-79" "13"
+ ;;
engenius,ews511ap)
ucidef_set_led_netdev "lan1" "LAN1" "$boardname:blue:lan1" "eth1"
ucidef_set_led_netdev "lan2" "LAN2" "$boardname:blue:lan2" "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 c985a823c4..4f73098cd5 100755
--- a/target/linux/ath79/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/base-files/etc/board.d/02_network
@@ -268,6 +268,11 @@ ath79_setup_interfaces()
ucidef_add_switch "switch0" \
"0@eth0" "3:lan:1" "4:lan:2"
;;
+ engenius,ens202ext)
+ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ ucidef_add_switch "switch0" \
+ "0@eth1" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
+ ;;
*)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
;;
@@ -308,6 +313,10 @@ ath79_setup_macs()
engenius,ecb1750)
lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
;;
+ engenius,ens202ext)
+ base_mac=$(mtd_get_mac_binary art 0)
+ wan_mac=$(macaddr_add "$base_mac" 1)
+ ;;
engenius,epg5000|\
iodata,wn-ac1167dgr|\
iodata,wn-ac1600dgr|\
diff --git a/target/linux/ath79/dts/ar9341_engenius_ens202ext.dts b/target/linux/ath79/dts/ar9341_engenius_ens202ext.dts
new file mode 100644
index 0000000000..445b6e5972
--- /dev/null
+++ b/target/linux/ath79/dts/ar9341_engenius_ens202ext.dts
@@ -0,0 +1,145 @@
+// 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 "ar9341.dtsi"
+
+/ {
+ model = "Engenius ENS202EXT";
+ compatible = "engenius,ens202ext", "qca,ar9341";
+
+ aliases {
+ serial0 = &uart;
+ led-boot = &system;
+ led-failsafe = &system;
+ led-running = &system;
+ led-upgrade = &system;
+ };
+
+ keys {
+ compatible = "gpio-keys-polled";
+ poll-interval = <20>;
+
+ reset {
+ label = "Reset";
+ linux,code = <KEY_RESTART>;
+ gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
+ debounce-interval = <60>;
+ };
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ system: power {
+ label = "engenius:amber:power";
+ gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
+ default-state = "on";
+ };
+
+ wlan {
+ label = "engenius:amber:wlan0";
+ gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
+ linux,default-trigger = "phy0tpt";
+ };
+
+ rssilow {
+ label = "engenius:red:wlan1";
+ gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
+ };
+
+ rssimedium {
+ label = "engenius:amber:wlan2";
+ gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
+ };
+
+ rssihigh {
+ label = "engenius:green:wlan3";
+ gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
+ };
+ };
+};
+
+&ref {
+ clock-frequency = <25000000>;
+};
+
+&uart {
+ status = "okay";
+};
+
+&gpio {
+ pinctrl-names = "default";
+ pinctrl-0 = <&jtag_disable_pins>;
+};
+
+&spi {
+ num-cs = <1>;
+
+ status = "okay";
+
+ flash@0 {
+ compatible = "jedec,spi-nor";
+ reg = <0>;
+ spi-max-frequency = <25000000>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ uboot: partition@0 {
+ label = "u-boot";
+ reg = <0x000000 0x040000>;
+ read-only;
+ };
+
+ partition@40000 {
+ label = "u-boot-env";
+ reg = <0x040000 0x010000>;
+ read-only;
+ };
+
+ partition@50000 {
+ label = "custom";
+ reg = <0x050000 0x050000>;
+ read-only;
+ };
+
+ partition@a0000 {
+ compatible = "engenius,firmware";
+ label = "firmware";
+ reg = <0x0a0000 0xd50000>;
+ };
+
+ partition@df0000 {
+ label = "failsafe";
+ reg = <0xdf0000 0x200000>;
+ read-only;
+ };
+
+ art: partition@ff0000 {
+ label = "art";
+ reg = <0xff0000 0x010000>;
+ read-only;
+ };
+ };
+ };
+};
+
+&eth0 {
+ status = "okay";
+
+ phy-handle = <&swphy0>;
+ mtd-mac-address = <&art 0x0>;
+ mtd-mac-address-increment = <(-1)>;
+};
+
+&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 55053be34f..afb3fd3ac7 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -340,6 +340,14 @@ define Device/engenius_ecb1750
endef
TARGET_DEVICES += engenius_ecb1750
+define Device/engenius_ens202ext
+ ATH_SOC := ar9341
+ DEVICE_TITLE := Engenius ENS202EXT
+ DEVICE_PACKAGES := rssileds kmod-leds-gpio
+ IMAGE_SIZE := 13632k
+endef
+TARGET_DEVICES += engenius_ens202ext
+
define Device/engenius_epg5000
ATH_SOC := qca9558
DEVICE_TITLE := EnGenius EPG5000
--
2.20.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment