[openwrt/openwrt] realtek: add support for Zyxel XGS1010-12 A1
LEDE Commits
lede-commits at lists.infradead.org
Mon Nov 3 02:07:25 PST 2025
robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/10504e0c6b489d8f58a739d25c3fe0cff8eec628
commit 10504e0c6b489d8f58a739d25c3fe0cff8eec628
Author: Jan Hoffmann <jan at 3e8.eu>
AuthorDate: Thu Feb 27 20:44:59 2025 +0100
realtek: add support for Zyxel XGS1010-12 A1
This device is very similar to the already supported XGS1210-12 A1. For
now, only revision A1 is supported (not marked on the label).
Hardware:
- RTL9302B SoC
- 16 MiB NOR flash
- 128 MiB DDR3 SDRAM
- 8x 1G RJ45 (RTL8218D)
- 2x 2.5G RJ45 (2x RTL8226)
- 2x SFP+ (supporting 1G/2.5G/10G)
- 3.3V UART serial (115200 baud 8N1) on the right side of the case
(from bottom to top: GND, RX, TX, VCC)
It is originally an unmanaged switch, so there are a few differences:
- No reset button
- Different partition layout: There is some reserved space in the middle
of the flash which might be used by the bootloader for flash testing.
The remaining space in between is used for OpenWrt using mtd-concat.
The largest contiguous area is at the beginning, allowing a maximum
kernel size of 7 MiB.
- No individual MAC address: This device ships with an empty U-Boot
environment. When an OpenWrt squashfs image is booted for the first
time, a random MAC address will be written to the environment (but
only if the environment has been initialized from the bootloader
before and contains the default MAC address).
Steps to boot initramfs image via network:
- Configure a TFTP server to provide the OpenWrt initramfs image
- Connect to device using serial (see hardware information above)
- Power on the device and enter U-Boot using Esc when prompted
- Run the following commands (adjust as necessary):
# rtk network on
# tftpboot 0x84f00000 192.168.1.100:openwrt-xgs1010-initramfs.bin
# bootm
Installation on flash:
- Boot initramfs image as described above
- Now is a good time to create a backup of all flash partitions! You'll
need this if you want to revert to the unmanaged factory firmware at
some point.
- Use sysupgrade to install OpenWrt
- After restart enter U-Boot again and set the boot command:
# setenv bootcmd 'rtk network on; bootm 0xb4900000'
# saveenv
# run bootcmd
Note: The command "rtk network on" is only needed because the drivers
currently rely on some setup by the bootloader (without this the RJ45
ports don't work). If the drivers improve in the future, it should be
removed (i.e. change the boot command to "bootm 0xb4900000").
Reverting to factory firmware:
- Write back your backup of the firmware partition (or write just the
fwconcat1 partition, and erase the other two fwconcat partitions)
- Change the boot command back to "boota" (or just erase the u-boot-env
partition so the default gets used)
Signed-off-by: Jan Hoffmann <jan at 3e8.eu>
Link: https://github.com/openwrt/openwrt/pull/20469
Signed-off-by: Robert Marko <robimarko at gmail.com>
---
.../realtek/base-files/etc/board.d/02_network | 3 +-
.../etc/uci-defaults/99_fwenv-store-ethaddr | 16 +++
.../realtek/dts/rtl9302_zyxel_xgs1010-12-a1.dts | 112 +++++++++++++++++++++
target/linux/realtek/image/rtl930x.mk | 12 +++
target/linux/realtek/rtl930x/config-6.12 | 1 +
5 files changed, 143 insertions(+), 1 deletion(-)
diff --git a/target/linux/realtek/base-files/etc/board.d/02_network b/target/linux/realtek/base-files/etc/board.d/02_network
index 70a44d6bac..d5d60f6936 100644
--- a/target/linux/realtek/base-files/etc/board.d/02_network
+++ b/target/linux/realtek/base-files/etc/board.d/02_network
@@ -81,7 +81,8 @@ realtek_setup_macs()
label_mac=$(get_mac_label)
lan_mac="$label_mac"
;;
- tplink,tl-st1008f-v2)
+ tplink,tl-st1008f-v2|\
+ zyxel,xgs1010-12-a1)
lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
[ -z "$lan_mac" ] || [ "$lan_mac" = "00:e0:4c:00:00:00" ] && lan_mac=$(macaddr_random)
;;
diff --git a/target/linux/realtek/base-files/etc/uci-defaults/99_fwenv-store-ethaddr b/target/linux/realtek/base-files/etc/uci-defaults/99_fwenv-store-ethaddr
index c268422389..876dc75af1 100644
--- a/target/linux/realtek/base-files/etc/uci-defaults/99_fwenv-store-ethaddr
+++ b/target/linux/realtek/base-files/etc/uci-defaults/99_fwenv-store-ethaddr
@@ -24,6 +24,22 @@ tplink,tl-st1008f-v2)
[ -n "$board_ethaddr" ] && fw_setenv ethaddr "$board_ethaddr"
fi
;;
+zyxel,xgs1010-12-a1)
+ env_ethaddr=$(macaddr_canonicalize "$(fw_printenv -n ethaddr 2>/dev/null)")
+
+ # This device ships with an empty environment (invalid CRC). If it is still in
+ # that state, we don't want to modify it, because that would write the defaults
+ # of the userspace U-Boot tools (which differ from the ones in the bootloader).
+ # Thus, we don't do anything here if the ethaddr variable is empty.
+ if [ "$env_ethaddr" = "00:e0:4c:00:00:00" ]; then
+ json_init
+ json_load_file "$BOARD_CFG"
+ json_select network_device
+ json_select eth0
+ json_get_var board_ethaddr macaddr
+ [ -n "$board_ethaddr" ] && fw_setenv ethaddr "$board_ethaddr"
+ fi
+ ;;
esac
exit 0
diff --git a/target/linux/realtek/dts/rtl9302_zyxel_xgs1010-12-a1.dts b/target/linux/realtek/dts/rtl9302_zyxel_xgs1010-12-a1.dts
new file mode 100644
index 0000000000..6b2c73fd6b
--- /dev/null
+++ b/target/linux/realtek/dts/rtl9302_zyxel_xgs1010-12-a1.dts
@@ -0,0 +1,112 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/dts-v1/;
+
+#include "rtl9302_zyxel_xgs1x10-12-common.dtsi"
+
+/ {
+ compatible = "zyxel,xgs1010-12-a1", "realtek,rtl930x-soc";
+ model = "Zyxel XGS1010-12 A1";
+
+ virtual_flash {
+ compatible = "mtd-concat";
+
+ devices = <&fwconcat0 &fwconcat1 &fwconcat2>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition at 0 {
+ label = "firmware";
+ reg = <0x0 0x0>;
+ compatible = "openwrt,uimage", "denx,uimage";
+ openwrt,ih-magic = <0x93001010>;
+ };
+ };
+ };
+};
+
+&spi0 {
+ status = "okay";
+ flash at 0 {
+ compatible = "jedec,spi-nor";
+ reg = <0>;
+ spi-max-frequency = <10000000>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition at 0 {
+ label = "u-boot";
+ reg = <0x0 0xe0000>;
+ read-only;
+ };
+
+ partition at e0000 {
+ label = "u-boot-env";
+ reg = <0xe0000 0x10000>;
+ };
+
+ partition at f0000 {
+ label = "u-boot-env2";
+ reg = <0xf0000 0x10000>;
+ read-only;
+ };
+
+ /*
+ * If additional space is needed in the future, the JFFS2 partitions could
+ * be added to the concatenated firmware partition. They are only reserved
+ * for now to allow running the XGS1210-12 firmware, which can be useful
+ * as a reference during development.
+ */
+
+ partition at 100000 {
+ label = "jffs2-cfg";
+ reg = <0x100000 0x100000>;
+ };
+
+ partition at 200000 {
+ label = "jffs2-log";
+ reg = <0x200000 0x100000>;
+ };
+
+ fwconcat1: partition at 300000 {
+ label = "fwconcat1";
+ reg = <0x300000 0x510000>;
+ };
+
+ partition at 810000 {
+ reg = <0x810000 0x10000>;
+ label = "htp-log";
+ read-only;
+ };
+
+ fwconcat2: partition at 820000 {
+ label = "fwconcat2";
+ reg = <0x820000 0xd0000>;
+ };
+
+ partition at 8f0000 {
+ reg = <0x8f0000 0x10000>;
+ label = "htp-flash-test";
+ read-only;
+ };
+
+ fwconcat0: partition at 900000 {
+ label = "fwconcat0";
+ reg = <0x900000 0x700000>;
+ };
+ };
+ };
+};
+
+&phy24 {
+ rtl9300,smi-address = <1 8>;
+};
+
+&phy25 {
+ rtl9300,smi-address = <2 9>;
+};
diff --git a/target/linux/realtek/image/rtl930x.mk b/target/linux/realtek/image/rtl930x.mk
index 1b574c1433..b7df216fdb 100644
--- a/target/linux/realtek/image/rtl930x.mk
+++ b/target/linux/realtek/image/rtl930x.mk
@@ -98,6 +98,18 @@ define Device/xikestor_sks8310-8x
endef
TARGET_DEVICES += xikestor_sks8310-8x
+define Device/zyxel_xgs1010-12-a1
+ SOC := rtl9302
+ UIMAGE_MAGIC := 0x93001010
+ DEVICE_VENDOR := Zyxel
+ DEVICE_MODEL := XGS1010-12
+ DEVICE_VARIANT := A1
+ KERNEL_SIZE := 7168k
+ IMAGE_SIZE := 13184k
+ $(Device/kernel-lzma)
+endef
+TARGET_DEVICES += zyxel_xgs1010-12-a1
+
define Device/zyxel_xgs1210-12-a1
$(Device/zyxel_xgs1210-12)
SUPPORTED_DEVICES += zyxel,xgs1210-12
diff --git a/target/linux/realtek/rtl930x/config-6.12 b/target/linux/realtek/rtl930x/config-6.12
index df36dfb119..6745de6e08 100644
--- a/target/linux/realtek/rtl930x/config-6.12
+++ b/target/linux/realtek/rtl930x/config-6.12
@@ -153,6 +153,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_MTD_VIRT_CONCAT=y
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NEED_PER_CPU_KM=y
CONFIG_NET_DEVLINK=y
More information about the lede-commits
mailing list