]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: add generic support for Zyxel XS1930 lineup
authorJonas Jelonek <jelonek.jonas@gmail.com>
Tue, 23 Dec 2025 12:08:12 +0000 (12:08 +0000)
committerRobert Marko <robimarko@gmail.com>
Mon, 20 Apr 2026 09:13:06 +0000 (11:13 +0200)
Add generic support for Zyxel's XS1930 10G switch lineup. This will be
used by subsequent patches to share common behavior/settings.

Common specs:

- Realtek RTL9313 switch SoC
- 256MB RAM
- 32MB Flash with shared layout
- different 10G copper/SFP port configurations

The devices use a proprietary software chain from Zyxel, consisting of:
- stripped-down, heavily modified U-boot masked as "Bootbase"
- BootExtension stage2 loader
- Thread-X based ZyNOS

Those devices require to add some symbols to the kernel config, i.e.
CONFIG_AQUANTIA_PHY for the used PHYs and symbols for GPIO peripherals
and muxes due to the hardware design.

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22909
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/realtek/dts/rtl9313_zyxel_xs1930.dtsi [new file with mode: 0644]
target/linux/realtek/image/rtl931x.mk
target/linux/realtek/rtl931x/config-6.18

diff --git a/target/linux/realtek/dts/rtl9313_zyxel_xs1930.dtsi b/target/linux/realtek/dts/rtl9313_zyxel_xs1930.dtsi
new file mode 100644 (file)
index 0000000..efb517e
--- /dev/null
@@ -0,0 +1,139 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/dts-v1/;
+
+#include "rtl931x.dtsi"
+
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/leds/common.h>
+#include <dt-bindings/mux/mux.h>
+
+/ {
+       aliases {
+               label-mac-device = &ethernet0;
+               led-boot = &led_sys_green;
+               led-failsafe = &led_sys_red;
+               led-running = &led_sys_green;
+               led-upgrade = &led_sys_green;
+       };
+
+       chosen {
+               bootargs = "console=ttyS0,115200 earlycon";
+       };
+
+       memory@0 {
+               device_type = "memory";
+               reg = <0x00000000 0x10000000>;
+       };
+
+       keys {
+               compatible = "gpio-keys";
+
+               key-restore {
+                       label = "restore";
+                       gpios = <&gpio0 28 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_RESTART>;
+               };
+       };
+
+       leds: leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinmux_disable_sys_led>;
+
+               led_sys_green: led-0 {
+                       color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_INDICATOR;
+                       gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
+               };
+
+               led_sys_red: led-1 {
+                       color = <LED_COLOR_ID_RED>;
+                       function = LED_FUNCTION_INDICATOR;
+                       gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>;
+               };
+       };
+};
+
+&spi0 {
+       status = "okay";
+
+       flash@0 {
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               label = "BootBase";
+                               reg = <0x0 0xa0000>;
+                               read-only;
+
+                               nvmem-layout {
+                                       compatible = "fixed-layout";
+                                       #address-cells = <1>;
+                                       #size-cells = <1>;
+
+                                       factory_macaddr: macaddr@9fff8 {
+                                               reg = <0x9fff8 0x6>;
+                                       };
+                               };
+                       };
+
+                       /* DbgArea */
+                       partition@a0000 {
+                               label = "reserved";
+                               reg = <0xa0000 0x20000>;
+                               read-only;
+                       };
+
+                       partition@c0000 {
+                               label = "RomDir2";
+                               reg = <0xc0000 0x120000>;
+                               read-only;
+
+                               /* boot image index at offset 0x151 */
+                               nvmem-layout {
+                                       compatible = "fixed-layout";
+                                       #address-cells = <1>;
+                                       #size-cells = <1>;
+
+                                       boot_selector: boot-selector@151 {
+                                               reg = <0x151 0x1>;
+                                       };
+                               };
+                       };
+
+                       /* BootBase has dual-image support. Second partition starts at
+                        * 0x1280000 and has same layout as first partition but smaller size
+                        */
+                       partition@280000 {
+                               reg = <0x280000 0x1d80000>;
+                               label = "factory";
+
+                               compatible = "fixed-partitions";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+
+                               partition@0 {
+                                       label = "loader";
+                                       reg = <0x0 0x10000>;
+                               };
+
+                               partition@10000 {
+                                       label = "firmware";
+                                       reg = <0x10000 0x1d70000>;
+                                       compatible = "openwrt,uimage", "denx,uimage";
+                               };
+                       };
+               };
+       };
+};
+
+&ethernet0 {
+       nvmem-cells = <&factory_macaddr 0>;
+       nvmem-cell-names = "mac-address";
+};
index 0302988742f9c088e8666fd86783a2a3b041c8b6..0fde3c9b51a71f0e110291756fcf72189a9a8995 100644 (file)
@@ -1,5 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
+include ./common.mk
+
 define Device/plasmacloud-common
   SOC := rtl9312
   UIMAGE_MAGIC := 0x93100000
@@ -44,3 +46,13 @@ define Device/xikestor_sks8300-12x-v1
         append-rootfs | pad-rootfs | append-metadata | check-size
 endef
 TARGET_DEVICES += xikestor_sks8300-12x-v1
+
+define Device/zyxel_xs1930
+  SOC := rtl9313
+  DEVICE_PACKAGES := kmod-hwmon-lm85
+  FLASH_ADDR := 0xb4280000
+  IMAGE_SIZE := 31808k
+  ZYNFW_ALIGN := 0x10000
+  $(Device/zyxel_zynos)
+endef
+
index 5520ff3f35598db2cb70014e71b980b485ac461c..3f5a7289c677b06674c29e984de009c5267217b2 100644 (file)
@@ -4,6 +4,7 @@ CONFIG_ARCH_KEEP_MEMBLOCK=y
 CONFIG_ARCH_MMAP_RND_BITS_MAX=15
 CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_AQUANTIA_PHY=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=4096
@@ -81,6 +82,8 @@ CONFIG_GENERIC_TIME_VSYSCALL=y
 CONFIG_GPIOLIB_IRQCHIP=y
 CONFIG_GPIO_CDEV=y
 CONFIG_GPIO_GENERIC=y
+CONFIG_GPIO_LINE_MUX=y
+CONFIG_GPIO_PCA953X=y
 CONFIG_GPIO_REALTEK_OTTO=y
 CONFIG_GPIO_REGMAP=y
 CONFIG_GRO_CELLS=y
@@ -163,6 +166,7 @@ CONFIG_MTD_SPLIT_EVA_FW=y
 CONFIG_MTD_SPLIT_FIRMWARE=y
 CONFIG_MTD_SPLIT_TPLINK_FW=y
 CONFIG_MTD_SPLIT_UIMAGE_FW=y
+CONFIG_MUX_GPIO=y
 CONFIG_NEED_DMA_MAP_STATE=y
 CONFIG_NEED_SRCU_NMI_SAFE=y
 CONFIG_NET_DEVLINK=y