Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mcprat/512a83c6dcd5ea9d5a18dc72dfca9d61 to your computer and use it in GitHub Desktop.
Save mcprat/512a83c6dcd5ea9d5a18dc72dfca9d61 to your computer and use it in GitHub Desktop.
ath79: Add support for ENS202EXT (PR)
From d6ab998578841c05adf7ec1c81a08346df5a2fc3 Mon Sep 17 00:00:00 2001
From: Michael Pratt <[email protected]>
Date: Wed, 6 May 2020 01:29:00 -0400
Subject: [PATCH] ath79: Add support for ENS202EXT
---
package/boot/uboot-envtools/files/ath79 | 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 | 150 ++++++++++++++++++
target/linux/ath79/image/generic.mk | 8 +
5 files changed, 174 insertions(+)
create mode 100644 target/linux/ath79/dts/ar9341_engenius_ens202ext.dts
diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79
index b5afbc9b44..83215716f4 100644
--- a/package/boot/uboot-envtools/files/ath79
+++ b/package/boot/uboot-envtools/files/ath79
@@ -18,6 +18,7 @@ buffalo,wzr-hp-ag300h)
;;
buffalo,bhr-4grv2|\
engenius,ecb1750|\
+engenius,ens202ext|\
glinet,gl-ar300m-nand|\
glinet,gl-ar300m-nor|\
librerouter,librerouter-v1|\
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..13853fe4e6 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" "$boardname:red:rssi1" "wlan0" "1" "100"
+ ucidef_set_led_rssi "rssimedium" "RSSIMEDIUM" "$boardname:amber:rssi2" "wlan0" "33" "100"
+ ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "$boardname:green:rssi3" "wlan0" "75" "100"
+ ;;
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..b3836ced6c 100755
--- a/target/linux/ath79/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/base-files/etc/board.d/02_network
@@ -128,6 +128,11 @@ ath79_setup_interfaces()
ucidef_add_switch "switch0" \
"0@eth0" "1:wan" "2:lan:3" "3:lan:2"
;;
+ engenius,ens202ext)
+ ucidef_set_interface_wan "eth1"
+ ucidef_add_switch "switch0" \
+ "0@eth0" "1:lan"
+ ;;
engenius,ews511ap)
ucidef_set_interface_lan "eth0 eth1" "dhcp"
;;
@@ -308,6 +313,10 @@ ath79_setup_macs()
engenius,ecb1750)
lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
;;
+ engenius,ens202ext)
+ lan_mac=$(mtd_get_mac_binary art 0)
+ wan_mac=$(mtd_get_mac_binary art 0)
+ ;;
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..f21be52dc2
--- /dev/null
+++ b/target/linux/ath79/dts/ar9341_engenius_ens202ext.dts
@@ -0,0 +1,150 @@
+// 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 = "ens202ext:amber:power";
+ gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
+ default-state = "on";
+ };
+
+ wlan0 {
+ label = "ens202ext:amber:wlan0";
+ gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
+ linux,default-trigger = "phy0tpt";
+ };
+
+ rssilow {
+ label = "ens202ext:red:rssi1";
+ gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
+ };
+
+ rssimedium {
+ label = "ens202ext:amber:rssi2";
+ gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
+ };
+
+ rssihigh {
+ label = "ens202ext:green:rssi3";
+ gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
+ };
+ };
+};
+
+&ref {
+ clock-frequency = <25000000>;
+};
+
+&gpio {
+ status = "okay";
+};
+
+&spi {
+ status = "okay";
+
+ num-cs = <1>;
+ 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>;
+ };
+
+ partition@50000 {
+ label = "custom";
+ reg = <0x050000 0x050000>;
+ read-only;
+ };
+
+ partition@a0000 {
+ compatible = "denx,uimage";
+ 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>;
+};
+
+&eth1 {
+ status = "okay";
+
+ mtd-mac-address = <&art 0x0>;
+
+ gmac-config {
+ device = <&gmac>;
+ switch-phy-swap = <1>;
+ };
+};
+
+&wmac {
+ status = "okay";
+
+ mtd-cal-data = <&art 0x1000>;
+
+ mtd-mac-address = <&art 0x0>;
+ mtd-mac-address-increment = <(-1)>;
+};
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