realtek: engenius_ews2910p: support multiple hardware versions
authorAlexandru Gagniuc <[email protected]>
Wed, 17 Apr 2024 02:28:23 +0000 (21:28 -0500)
committerRobert Marko <[email protected]>
Sat, 31 May 2025 21:19:01 +0000 (23:19 +0200)
When the Engenius EWS-2910P was added, only v1 was known. Move the
common parts to a dtsi, and split up the support to acccount for the
hardware version.

On v3, for example, the root partition uses a different uImage magic.

Add a "engenius,ews2910p-v1" compatible, while leaving the legacy
"engenius,ews2910p" to also mean v1.

Signed-off-by: Alexandru Gagniuc <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/15217
Signed-off-by: Robert Marko <[email protected]>
target/linux/realtek/base-files/etc/board.d/02_network
target/linux/realtek/dts/rtl8380_engenius_ews2910p-v1.dts [new file with mode: 0644]
target/linux/realtek/dts/rtl8380_engenius_ews2910p.dts [deleted file]
target/linux/realtek/dts/rtl8380_engenius_ews2910p.dtsi [new file with mode: 0644]
target/linux/realtek/image/common.mk
target/linux/realtek/image/rtl838x.mk

index 16642c273a4f54f7d8a78d30709add926f8e0785..c3951b591e1aaf71157bac455684fcec4d332268 100644 (file)
@@ -91,7 +91,7 @@ d-link,dgs-1210-28p-f)
        ucidef_set_poe 193 "lan8 lan7 lan6 lan5 lan4 lan3 lan2 lan1 lan16 lan15 lan14 lan13 lan12 lan11 lan10 lan9 lan24 lan23
                        lan22 lan21 lan20 lan19 lan18 lan17"
        ;;
-engenius,ews2910p)
+engenius,ews2910p-v1)
        ucidef_set_poe 60 "$(filter_port_list "$lan_list" "lan9 lan10")"
        ;;
 hpe,1920-8g-poe-65w)
diff --git a/target/linux/realtek/dts/rtl8380_engenius_ews2910p-v1.dts b/target/linux/realtek/dts/rtl8380_engenius_ews2910p-v1.dts
new file mode 100644 (file)
index 0000000..72f9ea7
--- /dev/null
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "rtl8380_engenius_ews2910p.dtsi"
+
+/ {
+       compatible = "engenius,ews2910p-v1", "realtek,rtl838x-soc";
+       model = "EnGenius EWS2910P v1";
+};
+
+&firmware_partition_1 {
+       compatible = "openwrt,uimage";
+       openwrt,ih-magic = <0x03802910>;
+};
diff --git a/target/linux/realtek/dts/rtl8380_engenius_ews2910p.dts b/target/linux/realtek/dts/rtl8380_engenius_ews2910p.dts
deleted file mode 100644 (file)
index b0f1e9b..0000000
+++ /dev/null
@@ -1,243 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#include "rtl838x.dtsi"
-
-#include <dt-bindings/input/input.h>
-#include <dt-bindings/leds/common.h>
-#include <dt-bindings/gpio/gpio.h>
-
-/ {
-       compatible = "engenius,ews2910p", "realtek,rtl838x-soc";
-       model = "EnGenius EWS2910P";
-
-       aliases {
-               led-boot = &led_power;
-               led-failsafe = &led_fault;
-               led-running = &led_power;
-               led-upgrade = &led_power;
-       };
-
-       memory@0 {
-               device_type = "memory";
-               reg = <0x0 0x10000000>;
-       };
-
-       keys {
-               compatible = "gpio-keys";
-
-               reset {
-                       label = "reset";
-                       gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
-                       linux,code = <KEY_RESTART>;
-               };
-
-               led_mode {
-                       label = "led-mode";
-                       gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
-                       linux,code = <BTN_0>;
-               };
-       };
-
-       gpio-export {
-               compatible = "gpio-export";
-
-               sff-p9-tx-disable {
-                       gpio-export,name = "sff-p9-tx-disable";
-                       gpio-export,output = <1>;
-                       gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
-               };
-       };
-
-       gpio-restart {
-               compatible = "gpio-restart";
-               gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
-       };
-
-       leds {
-               compatible = "gpio-leds";
-
-               led_power: led-0 {
-                       function = LED_FUNCTION_POWER;
-                       color = <LED_COLOR_ID_GREEN>;
-                       gpios = <&gpio1 3 GPIO_ACTIVE_LOW>;
-               };
-
-               led_lan_mode: led-1 {
-                       label = "green:lan-mode";
-                       gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
-               };
-
-               led_fault: led-2 {
-                       function = LED_FUNCTION_FAULT;
-                       color = <LED_COLOR_ID_AMBER>;
-                       gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;
-               };
-
-               led_poe_max: led-3 {
-                       label = "amber:poe-max";
-                       gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
-               };
-       };
-
-       i2c1: i2c-gpio-1 {
-               compatible = "i2c-gpio";
-               sda-gpios = <&gpio1 7 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
-               scl-gpios = <&gpio1 31 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
-               i2c-gpio,delay-us = <2>;
-               #address-cells = <1>;
-               #size-cells = <0>;
-       };
-       sfp1: sfp-p10 {
-               compatible = "sff,sfp";
-               i2c-bus = <&i2c1>;
-               tx-disable-gpio = <&gpio1 13 GPIO_ACTIVE_HIGH>;
-               los-gpio = <&gpio1 14 GPIO_ACTIVE_HIGH>;
-               mod-def0-gpio = <&gpio1 21 GPIO_ACTIVE_LOW>;
-       };
-};
-
-&mdio_aux {
-       status = "okay";
-
-       gpio1: expander@0 {
-               compatible = "realtek,rtl8231";
-               reg = <0>;
-
-               gpio-controller;
-               #gpio-cells = <2>;
-               gpio-ranges = <&gpio1 0 0 37>;
-
-               poe_enable {
-                       gpio-hog;
-                       gpios = <1 GPIO_ACTIVE_HIGH>;
-                       output-high;
-                       line-name = "poe-enable";
-               };
-
-               sff_p9_gpios {
-                       gpio-hog;
-                       gpios = < 6 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>,
-                               < 11 GPIO_ACTIVE_HIGH>, /* los-gpio */
-                               < 12 GPIO_ACTIVE_LOW>;   /* mod-def0-gpio */
-                       input;
-                       line-name = "sff-p9-gpios";
-               };
-
-               led-controller {
-                       compatible = "realtek,rtl8231-leds";
-                       status = "disabled";
-               };
-       };
-};
-
-&spi0 {
-       status = "okay";
-
-       flash@0 {
-               compatible = "jedec,spi-nor";
-               reg = <0>;
-               spi-max-frequency = <10000000>;
-
-               partitions {
-                       compatible = "fixed-partitions";
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-
-                       partition@0 {
-                               label = "u-boot";
-                               reg = <0x0 0x80000>;
-                               read-only;
-                       };
-                       partition@80000 {
-                               label = "u-boot-env";
-                               reg = <0x80000 0x10000>;
-                               read-only;
-                       };
-                       partition@90000 {
-                               label = "u-boot-env2";
-                               reg = <0x90000 0x10000>;
-                       };
-                       partition@a0000 {
-                               label = "rootfs_data";
-                               reg = <0xa0000 0xd60000>;
-                       };
-                       partition@e00000 {
-                               label = "jffs2-log";
-                               reg = <0xe00000 0x200000>;
-                       };
-                       partition@1000000 {
-                               compatible = "openwrt,uimage";
-                               label = "firmware";
-                               reg = <0x1000000 0x800000>;
-                               openwrt,ih-magic = <0x03802910>;
-                       };
-                       partition@1800000 {
-                               label = "firmware2";
-                               reg = <0x1800000 0x800000>;
-                       };
-               };
-       };
-};
-
-&ethernet0 {
-       mdio: mdio-bus {
-               compatible = "realtek,rtl838x-mdio";
-               regmap = <&ethernet0>;
-               #address-cells = <1>;
-               #size-cells = <0>;
-
-               INTERNAL_PHY(8)
-               INTERNAL_PHY(9)
-               INTERNAL_PHY(10)
-               INTERNAL_PHY(11)
-               INTERNAL_PHY(12)
-               INTERNAL_PHY(13)
-               INTERNAL_PHY(14)
-               INTERNAL_PHY(15)
-
-               INTERNAL_PHY(24)
-               INTERNAL_PHY(26)
-       };
-};
-
-&switch0 {
-       ports {
-               #address-cells = <1>;
-               #size-cells = <0>;
-
-               SWITCH_PORT(8, 1, internal)
-               SWITCH_PORT(9, 2, internal)
-               SWITCH_PORT(10, 3, internal)
-               SWITCH_PORT(11, 4, internal)
-               SWITCH_PORT(12, 5, internal)
-               SWITCH_PORT(13, 6, internal)
-               SWITCH_PORT(14, 7, internal)
-               SWITCH_PORT(15, 8, internal)
-
-               SWITCH_SFP_PORT(24, 9, 1000base-x)
-
-               port@26 {
-                       reg = <26>;
-                       label = "lan10";
-                       phy-mode = "1000base-x";
-                       phy-handle = <&phy26>;
-                       managed = "in-band-status";
-                       sfp = <&sfp1>;
-               };
-
-               port@28 {
-                       ethernet = <&ethernet0>;
-                       reg = <28>;
-                       phy-mode = "internal";
-
-                       fixed-link {
-                               speed = <1000>;
-                               full-duplex;
-                       };
-               };
-       };
-};
-
-&uart1 {
-       status = "okay";
-};
diff --git a/target/linux/realtek/dts/rtl8380_engenius_ews2910p.dtsi b/target/linux/realtek/dts/rtl8380_engenius_ews2910p.dtsi
new file mode 100644 (file)
index 0000000..e8cc9d7
--- /dev/null
@@ -0,0 +1,238 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "rtl838x.dtsi"
+
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+       aliases {
+               led-boot = &led_power;
+               led-failsafe = &led_fault;
+               led-running = &led_power;
+               led-upgrade = &led_power;
+       };
+
+       memory@0 {
+               device_type = "memory";
+               reg = <0x0 0x10000000>;
+       };
+
+       keys {
+               compatible = "gpio-keys";
+
+               reset {
+                       label = "reset";
+                       gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_RESTART>;
+               };
+
+               led_mode {
+                       label = "led-mode";
+                       gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
+                       linux,code = <BTN_0>;
+               };
+       };
+
+       gpio-export {
+               compatible = "gpio-export";
+
+               sff-p9-tx-disable {
+                       gpio-export,name = "sff-p9-tx-disable";
+                       gpio-export,output = <1>;
+                       gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       gpio-restart {
+               compatible = "gpio-restart";
+               gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led_power: led-0 {
+                       function = LED_FUNCTION_POWER;
+                       color = <LED_COLOR_ID_GREEN>;
+                       gpios = <&gpio1 3 GPIO_ACTIVE_LOW>;
+               };
+
+               led_lan_mode: led-1 {
+                       label = "green:lan-mode";
+                       gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
+               };
+
+               led_fault: led-2 {
+                       function = LED_FUNCTION_FAULT;
+                       color = <LED_COLOR_ID_AMBER>;
+                       gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;
+               };
+
+               led_poe_max: led-3 {
+                       label = "amber:poe-max";
+                       gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       i2c1: i2c-gpio-1 {
+               compatible = "i2c-gpio";
+               sda-gpios = <&gpio1 7 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+               scl-gpios = <&gpio1 31 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+               i2c-gpio,delay-us = <2>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+       };
+       sfp1: sfp-p10 {
+               compatible = "sff,sfp";
+               i2c-bus = <&i2c1>;
+               tx-disable-gpio = <&gpio1 13 GPIO_ACTIVE_HIGH>;
+               los-gpio = <&gpio1 14 GPIO_ACTIVE_HIGH>;
+               mod-def0-gpio = <&gpio1 21 GPIO_ACTIVE_LOW>;
+       };
+};
+
+&mdio_aux {
+       status = "okay";
+
+       gpio1: expander@0 {
+               compatible = "realtek,rtl8231";
+               reg = <0>;
+
+               gpio-controller;
+               #gpio-cells = <2>;
+               gpio-ranges = <&gpio1 0 0 37>;
+
+               poe_enable {
+                       gpio-hog;
+                       gpios = <1 GPIO_ACTIVE_HIGH>;
+                       output-high;
+                       line-name = "poe-enable";
+               };
+
+               sff_p9_gpios {
+                       gpio-hog;
+                       gpios = < 6 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>,
+                               < 11 GPIO_ACTIVE_HIGH>, /* los-gpio */
+                               < 12 GPIO_ACTIVE_LOW>;   /* mod-def0-gpio */
+                       input;
+                       line-name = "sff-p9-gpios";
+               };
+
+               led-controller {
+                       compatible = "realtek,rtl8231-leds";
+                       status = "disabled";
+               };
+       };
+};
+
+&spi0 {
+       status = "okay";
+
+       flash@0 {
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <10000000>;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               label = "u-boot";
+                               reg = <0x0 0x80000>;
+                               read-only;
+                       };
+                       partition@80000 {
+                               label = "u-boot-env";
+                               reg = <0x80000 0x10000>;
+                               read-only;
+                       };
+                       partition@90000 {
+                               label = "u-boot-env2";
+                               reg = <0x90000 0x10000>;
+                       };
+                       partition@a0000 {
+                               label = "rootfs_data";
+                               reg = <0xa0000 0xd60000>;
+                       };
+                       partition@e00000 {
+                               label = "jffs2-log";
+                               reg = <0xe00000 0x200000>;
+                       };
+                       firmware_partition_1: partition@1000000 {
+                               label = "firmware";
+                               reg = <0x1000000 0x800000>;
+                       };
+                       firmware_partition_2: partition@1800000 {
+                               label = "firmware2";
+                               reg = <0x1800000 0x800000>;
+                       };
+               };
+       };
+};
+
+&ethernet0 {
+       mdio: mdio-bus {
+               compatible = "realtek,rtl838x-mdio";
+               regmap = <&ethernet0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               INTERNAL_PHY(8)
+               INTERNAL_PHY(9)
+               INTERNAL_PHY(10)
+               INTERNAL_PHY(11)
+               INTERNAL_PHY(12)
+               INTERNAL_PHY(13)
+               INTERNAL_PHY(14)
+               INTERNAL_PHY(15)
+
+               INTERNAL_PHY(24)
+               INTERNAL_PHY(26)
+       };
+};
+
+&switch0 {
+       ports {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               SWITCH_PORT(8, 1, internal)
+               SWITCH_PORT(9, 2, internal)
+               SWITCH_PORT(10, 3, internal)
+               SWITCH_PORT(11, 4, internal)
+               SWITCH_PORT(12, 5, internal)
+               SWITCH_PORT(13, 6, internal)
+               SWITCH_PORT(14, 7, internal)
+               SWITCH_PORT(15, 8, internal)
+
+               SWITCH_SFP_PORT(24, 9, 1000base-x)
+
+               port@26 {
+                       reg = <26>;
+                       label = "lan10";
+                       phy-mode = "1000base-x";
+                       phy-handle = <&phy26>;
+                       managed = "in-band-status";
+                       sfp = <&sfp1>;
+               };
+
+               port@28 {
+                       ethernet = <&ethernet0>;
+                       reg = <28>;
+                       phy-mode = "internal";
+
+                       fixed-link {
+                               speed = <1000>;
+                               full-duplex;
+                       };
+               };
+       };
+};
+
+&uart1 {
+       status = "okay";
+};
index e600b2347d71fc4ec6eba6aa1ca60ffc78c2afa7..d68915ea90b43e9bf95cf46f951574a7bb0d5c59 100644 (file)
@@ -31,6 +31,18 @@ define Device/d-link_dgs-1210
   CAMEO_BOARD_VERSION := 32
 endef
 
+# The "IMG-" uImage name allows flashing the iniramfs from the vendor Web UI.
+# Avoided for sysupgrade, as the vendor FW would do an incomplete flash.
+define Device/engenius_ews2910p
+  IMAGE_SIZE := 8192k
+  DEVICE_VENDOR := EnGenius
+  KERNEL_INITRAMFS := \
+       kernel-bin | \
+       append-dtb | \
+       libdeflate-gzip | \
+       uImage gzip -n 'IMG-0.00.00-c0.0.00'
+endef
+
 define Device/hpe_1920
   DEVICE_VENDOR := HPE
   IMAGE_SIZE := 29632k
index a090390a50d3ad93a381579076d1cf00b319f85f..6e43317148b1b36f02abb84524e65a4166fa47d7 100644 (file)
@@ -91,22 +91,16 @@ define Device/d-link_dgs-1210-28p-f
 endef
 TARGET_DEVICES += d-link_dgs-1210-28p-f
 
-# The "IMG-" uImage name allows flashing the iniramfs from the vendor Web UI.
-# Avoided for sysupgrade, as the vendor FW would do an incomplete flash.
-define Device/engenius_ews2910p
+define Device/engenius_ews2910p-v1
+  $(Device/engenius_ews2910p)
   SOC := rtl8380
-  IMAGE_SIZE := 8192k
-  DEVICE_VENDOR := EnGenius
   DEVICE_MODEL := EWS2910P
+  DEVICE_VARIANT := v1
   DEVICE_PACKAGES += realtek-poe
   UIMAGE_MAGIC := 0x03802910
-  KERNEL_INITRAMFS := \
-       kernel-bin | \
-       append-dtb | \
-       libdeflate-gzip | \
-       uImage gzip -n 'IMG-0.00.00-c0.0.00'
+  SUPPORTED_DEVICES += engenius,ews2910p
 endef
-TARGET_DEVICES += engenius_ews2910p
+TARGET_DEVICES += engenius_ews2910p-v1
 
 define Device/hpe_1920-8g
   $(Device/hpe_1920)