realtek: add support for NicGiga S100-0800S-M

The NicGiga S100-0800S-M is an 8-port 10G SFP+ managed switch built on
the Realtek RTL9303 reference design (vendor U-Boot reports board model
"RTL9303_8XGE", board id 1). It is closely related to the TP-Link
TL-ST1008F v2 and shares its general layout, but differs in how the SFP
cages and port LEDs are wired (see below).

This DTS is derived from the TP-Link TL-ST1008F v2 support added by
Jonas Jelonek <jelonek.jonas@gmail.com> and Balazs Triszka
<balika011@gmail.com> in commit 39b9b491bb ("realtek: add support for
TP-Link TL-ST1008F v2.0").

Specifications:
- SoC: Realtek RTL9303
- RAM: 512 MiB DDR3
- Flash: 32 MiB SPI-NOR
- Ethernet: 8x 10G SFP+ (RTL9303 SerDes 2-9)
- UART: 115200 8N1 on the front-panel RJ45 console port (Cisco-style pinout)

MAC address:
The MAC addresses are read from the ethaddr variable in the vendor U-Boot
environment via the u-boot-env nvmem layout: the base address is assigned
to the SoC ethernet controller and an incrementing per-port offset to each
SFP port.

SFP presence and port LEDs:
Unlike the TP-Link TL-ST1008F v2, this board does not route the cage
MOD_ABS lines to the SoC GPIO controller (gpio0 pins 0-7 read stuck-low,
so an empty cage reads "present"), and the single PCA9534 I2C expander is
fully used for TX_DISABLE. No mod-def0-gpio is therefore provided; module
presence, including runtime hot-insertion and removal, is detected by
polling the SFP EEPROM over I2C. Each cage has a single green LED, driven
active-low.

Installation:
Interrupt the vendor U-Boot and TFTP-boot an OpenWrt initramfs image:
  setenv ipaddr 192.168.1.1
  setenv serverip <tftp-server>
  tftpboot 0x82000000 <...-initramfs-kernel.bin>
  bootm 0x82000000
From the running initramfs, flash with:
  sysupgrade -n <...-squashfs-sysupgrade.bin>

Signed-off-by: Greg Patrick <gregspatrick@hotmail.com>
Link: https://github.com/openwrt/openwrt/pull/23579
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
This commit is contained in:
Greg Patrick
2026-06-17 17:31:13 +02:00
committed by Jonas Jelonek
parent 317317d960
commit fbbc36c136
2 changed files with 298 additions and 0 deletions
@@ -0,0 +1,287 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "rtl930x.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>
/ {
compatible = "nicgiga,s100-0800s-m", "realtek,rtl930x-soc";
model = "NicGiga S100-0800S-M";
memory@0 {
device_type = "memory";
reg = <0x00000000 0x10000000>, /* first 256 MiB */
<0x20000000 0x10000000>; /* remaining 256 MiB */
};
chosen {
stdout-path = "serial0:115200n8";
};
led_set {
compatible = "realtek,rtl9300-leds";
active-low;
/* One green LED per SFP cage, lit on link + activity at any speed. */
led_set0 = <(RTL93XX_LED_SET_10G | RTL93XX_LED_SET_5G | RTL93XX_LED_SET_2P5G |
RTL93XX_LED_SET_1G | RTL93XX_LED_SET_100M | RTL93XX_LED_SET_10M |
RTL93XX_LED_SET_LINK | RTL93XX_LED_SET_ACT)>;
};
i2c_gpio {
compatible = "i2c-gpio";
#address-cells = <1>;
#size-cells = <0>;
i2c-gpio,delay-us = <2>;
scl-gpios = <&gpio0 22 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
sda-gpios = <&gpio0 23 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
gpioexp0: i2c@38 {
reg = <0x38>;
compatible = "nxp,pca9534";
gpio-controller;
#gpio-cells = <2>;
};
};
/*
* The related TP-Link TL-ST1008F v2 (same RTL9303 reference design)
* routes the SFP cage MOD_ABS lines to gpio0 pins 0-7, but on this
* board those pins read stuck-low under OpenWrt (an empty cage still
* reads "present"), and the PCA9534 expander is fully consumed by
* TX_DISABLE. No mod-def0-gpio is therefore wired up; module presence
* is instead detected by polling the SFP EEPROM over I2C, which also
* handles runtime hot-insertion and removal.
*/
sfp0: sfp-p1 {
compatible = "sff,sfp";
i2c-bus = <&i2c0>;
tx-disable-gpio = <&gpioexp0 0 GPIO_ACTIVE_HIGH>;
maximum-power-milliwatt = <2900>;
#thermal-sensor-cells = <0>;
};
sfp1: sfp-p2 {
compatible = "sff,sfp";
i2c-bus = <&i2c1>;
tx-disable-gpio = <&gpioexp0 1 GPIO_ACTIVE_HIGH>;
maximum-power-milliwatt = <1500>;
#thermal-sensor-cells = <0>;
};
sfp2: sfp-p3 {
compatible = "sff,sfp";
i2c-bus = <&i2c2>;
tx-disable-gpio = <&gpioexp0 2 GPIO_ACTIVE_HIGH>;
maximum-power-milliwatt = <1500>;
#thermal-sensor-cells = <0>;
};
sfp3: sfp-p4 {
compatible = "sff,sfp";
i2c-bus = <&i2c3>;
tx-disable-gpio = <&gpioexp0 3 GPIO_ACTIVE_HIGH>;
maximum-power-milliwatt = <2000>;
#thermal-sensor-cells = <0>;
};
sfp4: sfp-p5 {
compatible = "sff,sfp";
i2c-bus = <&i2c4>;
tx-disable-gpio = <&gpioexp0 4 GPIO_ACTIVE_HIGH>;
maximum-power-milliwatt = <2000>;
#thermal-sensor-cells = <0>;
};
sfp5: sfp-p6 {
compatible = "sff,sfp";
i2c-bus = <&i2c5>;
tx-disable-gpio = <&gpioexp0 5 GPIO_ACTIVE_HIGH>;
maximum-power-milliwatt = <1500>;
#thermal-sensor-cells = <0>;
};
sfp6: sfp-p7 {
compatible = "sff,sfp";
i2c-bus = <&i2c6>;
tx-disable-gpio = <&gpioexp0 6 GPIO_ACTIVE_HIGH>;
maximum-power-milliwatt = <1500>;
#thermal-sensor-cells = <0>;
};
sfp7: sfp-p8 {
compatible = "sff,sfp";
i2c-bus = <&i2c7>;
tx-disable-gpio = <&gpioexp0 7 GPIO_ACTIVE_HIGH>;
maximum-power-milliwatt = <2900>;
#thermal-sensor-cells = <0>;
};
watchdog {
compatible = "linux,wdt-gpio";
gpios = <&gpio0 21 GPIO_ACTIVE_HIGH>;
hw_algo = "toggle";
hw_margin_ms = <1200>;
always-running;
};
};
&i2c_mst1 {
status = "okay";
/* SDA0-7 correspond to GPIO9-16 */
i2c0: i2c@0 { reg = <0>; };
i2c1: i2c@1 { reg = <1>; };
i2c2: i2c@2 { reg = <2>; };
i2c3: i2c@3 { reg = <3>; };
i2c4: i2c@4 { reg = <4>; };
i2c5: i2c@5 { reg = <5>; };
i2c6: i2c@6 { reg = <6>; };
i2c7: i2c@7 { reg = <7>; };
};
&spi0 {
status = "okay";
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <100000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x0 0xe0000>;
read-only;
};
partition@e0000 {
label = "u-boot-env";
reg = <0xe0000 0x10000>;
nvmem-layout {
compatible = "u-boot,env";
macaddr_ubootenv_ethaddr: ethaddr {
#nvmem-cell-cells = <1>;
};
};
};
partition@f0000 {
label = "u-boot-env2";
reg = <0xf0000 0x10000>;
read-only;
};
partition@100000 {
label = "jffs2-cfg";
reg = <0x100000 0x100000>;
};
partition@200000 {
label = "jffs2-log";
reg = <0x200000 0x100000>;
};
partition@300000 {
compatible = "openwrt,uimage", "denx,uimage";
reg = <0x300000 0x1d00000>;
label = "firmware";
openwrt,ih-magic = <0x93030000>;
};
};
};
};
&switch0 {
ethernet-ports {
#address-cells = <1>;
#size-cells = <0>;
SWITCH_PORT_SFP(0, 1, 2, 0, 0)
SWITCH_PORT_SFP(8, 2, 3, 0, 1)
SWITCH_PORT_SFP(16, 3, 4, 0, 2)
SWITCH_PORT_SFP(20, 4, 5, 0, 3)
SWITCH_PORT_SFP(24, 5, 6, 0, 4)
SWITCH_PORT_SFP(25, 6, 7, 0, 5)
SWITCH_PORT_SFP(26, 7, 8, 0, 6)
SWITCH_PORT_SFP(27, 8, 9, 0, 7)
port@1c {
ethernet = <&ethernet0>;
reg = <28>;
phy-mode = "internal";
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
};
&ethernet0 {
nvmem-cells = <&macaddr_ubootenv_ethaddr 0>;
nvmem-cell-names = "mac-address";
};
&port0 {
nvmem-cells = <&macaddr_ubootenv_ethaddr 1>;
nvmem-cell-names = "mac-address";
};
&port8 {
nvmem-cells = <&macaddr_ubootenv_ethaddr 2>;
nvmem-cell-names = "mac-address";
};
&port16 {
nvmem-cells = <&macaddr_ubootenv_ethaddr 3>;
nvmem-cell-names = "mac-address";
};
&port20 {
nvmem-cells = <&macaddr_ubootenv_ethaddr 4>;
nvmem-cell-names = "mac-address";
};
&port24 {
nvmem-cells = <&macaddr_ubootenv_ethaddr 5>;
nvmem-cell-names = "mac-address";
};
&port25 {
nvmem-cells = <&macaddr_ubootenv_ethaddr 6>;
nvmem-cell-names = "mac-address";
};
&port26 {
nvmem-cells = <&macaddr_ubootenv_ethaddr 7>;
nvmem-cell-names = "mac-address";
};
&port27 {
nvmem-cells = <&macaddr_ubootenv_ethaddr 8>;
nvmem-cell-names = "mac-address";
};
&thermal_zones {
sfp-thermal {
polling-delay-passive = <10000>;
polling-delay = <10000>;
thermal-sensors = <&sfp0>, <&sfp1>, <&sfp2>, <&sfp3>, <&sfp4>, <&sfp5>, <&sfp6>, <&sfp7>;
trips {
sfp-crit {
temperature = <110000>;
hysteresis = <1000>;
type = "critical";
};
};
};
};
+11
View File
@@ -97,6 +97,17 @@ define Device/horaco_zx-swtgw2c8f
endef
TARGET_DEVICES += horaco_zx-swtgw2c8f
define Device/nicgiga_s100-0800s-m
SOC := rtl9303
UIMAGE_MAGIC := 0x93030000
DEVICE_VENDOR := NicGiga
DEVICE_MODEL := S100-0800S-M
DEVICE_PACKAGES := kmod-gpio-pca953x
IMAGE_SIZE := 29696k
$(Device/kernel-lzma)
endef
TARGET_DEVICES += nicgiga_s100-0800s-m
define Device/plasmacloud-common
SOC := rtl9302
UIMAGE_MAGIC := 0x93000000