Jelajahi Sumber

realtek: engenius_ews2910p: support multiple hardware versions

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]>
Alexandru Gagniuc 1 tahun lalu
induk
melakukan
e5625fb448

+ 1 - 1
target/linux/realtek/base-files/etc/board.d/02_network

@@ -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)

+ 13 - 0
target/linux/realtek/dts/rtl8380_engenius_ews2910p-v1.dts

@@ -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>;
+};

+ 2 - 7
target/linux/realtek/dts/rtl8380_engenius_ews2910p.dts → target/linux/realtek/dts/rtl8380_engenius_ews2910p.dtsi

@@ -7,9 +7,6 @@
 #include <dt-bindings/gpio/gpio.h>
 
 / {
-	compatible = "engenius,ews2910p", "realtek,rtl838x-soc";
-	model = "EnGenius EWS2910P";
-
 	aliases {
 		led-boot = &led_power;
 		led-failsafe = &led_fault;
@@ -165,13 +162,11 @@
 				label = "jffs2-log";
 				reg = <0xe00000 0x200000>;
 			};
-			partition@1000000 {
-				compatible = "openwrt,uimage";
+			firmware_partition_1: partition@1000000 {
 				label = "firmware";
 				reg = <0x1000000 0x800000>;
-				openwrt,ih-magic = <0x03802910>;
 			};
-			partition@1800000 {
+			firmware_partition_2: partition@1800000 {
 				label = "firmware2";
 				reg = <0x1800000 0x800000>;
 			};

+ 12 - 0
target/linux/realtek/image/common.mk

@@ -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

+ 5 - 11
target/linux/realtek/image/rtl838x.mk

@@ -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)