Skip to content

realtek: rtl931x: add support for Sirivision SR-ST31212F - #25202

Open
huiChen9517 wants to merge 1 commit into
openwrt:mainfrom
huiChen9517:realtek-sr-st31212f
Open

huiChen9517 wants to merge 1 commit into
openwrt:mainfrom
huiChen9517:realtek-sr-st31212f

Conversation

@huiChen9517

@huiChen9517 huiChen9517 commented Sep 15, 2026

Copy link
Copy Markdown

This commit adds support for the Sirivision SR-ST31212F, a 12-port 10G switch with 12x SFP+.

  • SoC: Realtek RTL9313
  • RAM: 512 MiB DDR3 (Micron D9PXV)
  • Flash: SPI-NOR 16 MiB (Winbond W25Q128)
  • Ethernet: 12x SFP+
  • LEDs: 1x power (hardware blink), 1x system green (SYS_LED/GPIO),
    1x SFP+ LED/port (link/act)
  • Button: none
  • Console: Cisco-style RJ45, 115200 8n1
  • Fan: 2x 12V 2pin fan, always full speed
  • Power: 12V DC from internal PSU, input AC 100-240V 50/60Hz

Board Layout

The following is a simplified view of the board "ST31212F_V1.0" layout:

                 Board Front                       Power
+-----------------------------------------------+----------
|SFP1                     DC-4PIN-Header        |
|SFP2                            FAN-2PIN-Header|
|SFP3  74HC125D                                 |
|SFP4                                           |
|SFP5        SPI:W25Q128JVSIQ                   |
|SFP6                                           |12V Supply
|SFP7    SoC:RTL9313       RAM:Micron-D9PXV     |
|SFP8                                           |
|SFP9         74HC125D                          |
|SFP10       RTL8231   Unknown-14PIN-EmptyHeader| 
|SFP11       RTL8231    Unknown-6PIN-EmptyHeader|
|SFP12                                          |
|Console  TI-MA3232C    TI-HC164 TI-HC164       |AC-Socket 
|PWR&SYS-LEDs                    FAN-2PIN-Header|
+-----------------------------------------------+----------

MAC address is read from u-boot-env ethaddr.
U-Boot image magic is 0x93000000.

SFP cage sideband uses GPIOs from the SoC and 2x RTL8231. Those pads are shared with the generic SPI master;
QSPI NOR uses a separate controller.
So pinmux_disable_spi0 / pinmux_disable_spi0_cs0 / pinmux_disable_spi0_cs1 are required to release the pins to be GPIOs. SerDes TX polarity is inverted on all SFP cages; without this, port LEDs work but traffic does not.
System LED is controlled via SYS_LED by default, here I use pinmux_disable_sys_led to switch it to GPIO0 from SoC to make it more functional in openwrt.

OpenWrt installation

  1. Serial console, 115200 8n1, press Esc to stop U-Boot
  2. Load initramfs-kernel.bin via YMODEM (loady) or TFTP and bootm.
    Optional for tftpboot:
    Use "printenv" to check the network settings of U-Boot.
    You can change the ip address of the device by "setenv ipaddr XXX.XXX.XXX.XXX" / "setenv netmask XXX.XXX.XXX.XXX".
    And you also need "setenv serverip XXX.XXX.XXX.XXX" to setup your tftp server ip.
    Then initialize the network by running "rtk network on".
    And you may need the "rtk 10g PORT ..." command for different SFP modules. Use "help rtk" for more details.
  3. Backup the whole flash if you have not yet. Since there's no backup runtime partition in this tiny flash, you will lose your
    original runtime once you write openwrt in it. Then sysupgrade the squashfs-sysupgrade.bin image.

@openwrt openwrt Bot added the target/realtek pull request/issue for realtek target label Sep 15, 2026

@jonasjelonek jonasjelonek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the commit message, please adjust the formatting of the table. Markdown is not parsed in commit messages.

Comment thread target/linux/realtek/dts/rtl9313_sirivision_sr-st31212f.dts Outdated
Comment thread target/linux/realtek/dts/rtl9313_sirivision_sr-st31212f.dts Outdated
Comment thread target/linux/realtek/dts/rtl9313_sirivision_sr-st31212f.dts Outdated
los-gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
mod-def0-gpios = <&gpio0 9 GPIO_ACTIVE_LOW>;
tx-disable-gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>;
maximum-power-milliwatt = <2000>;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this confirmed/given by the vendor?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LOS / MOD_ABS / TX_DISABLE pins were determined by inserting and
removing modules in each cage and watching the GPIO lines. They are
not from a vendor schematic.

maximum-power-milliwatt is not from the vendor. I set 2000 mW from SFP+ class-3 practice and
because a ~2 W 10GBASE-T module works on this board. Same value as
SR-ST3408F.

@openwrt openwrt Bot added the not following guidelines Pull request does not follow formatting guidelines label Sep 15, 2026
@openwrt openwrt Bot removed the not following guidelines Pull request does not follow formatting guidelines label Sep 15, 2026
@huiChen9517

Copy link
Copy Markdown
Author

In the commit message, please adjust the formatting of the table. Markdown is not parsed in commit messages.

already changed to text version.

Comment thread target/linux/realtek/dts/rtl9313_sirivision_sr-st31212f.dts Outdated
Comment thread target/linux/realtek/dts/rtl9313_sirivision_sr-st31212f.dts
Comment thread target/linux/realtek/dts/rtl9313_sirivision_sr-st31212f.dts Outdated
Comment thread target/linux/realtek/dts/rtl9313_sirivision_sr-st31212f.dts Outdated
@openwrt openwrt Bot added the not following guidelines Pull request does not follow formatting guidelines label Sep 16, 2026
@jonasjelonek

Copy link
Copy Markdown
Member

Please squash all changes into a single commit and force-push your PR branch.

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit checks

  • b3166ab, ddd3fde, 623ed77 "Update target/linux/realtek/dts/rtl9313_sirivision_sr-st31212f.dts" — GitHub's default suggestion-apply subject, missing the <prefix>: scope (this is what fails FormalityCheck / Git & Commits). Squash all three into b820e7a so the series stays a single realtek: rtl931x: add support for Sirivision SR-ST31212F commit.

Generated by Claude Code

Comment thread target/linux/realtek/dts/rtl9313_sirivision_sr-st31212f.dts Outdated
@openwrt openwrt Bot added core packages pull request/issue for core (in-tree) packages kernel pull request/issue with Linux kernel related changes target/airoha pull request/issue for airoha target target/apm821xx pull request/issue for apm821xx target target/armsr pull request/issue for armsr target target/ath79 pull request/issue for ath79 target target/bcm27xx pull request/issue for bcm27xx target target/bcm53xx pull request/issue for bcm53xx target target/bmips pull request/issue for bmips target target/d1 pull request/issue for d1 target target/econet pull request/issue for econet (MIPS) target target/imx pull request/issue for imx (imx6) target target/ipq40xx pull request/issue for ipq40xx target target/lantiq pull request/issue for lantiq target target/layerscape pull request/issue for layerscape target target/mediatek pull request/issue for mediatek target target/mvebu pull request/issue for mvebu target target/octeon pull request/issue for octeon target target/qualcommax pull request/issue for qualcommax target labels Sep 16, 2026
@openwrt openwrt Bot added the target/x86 pull request/issue for x86 target label Sep 16, 2026
@huiChen9517

Copy link
Copy Markdown
Author

Please squash all changes into a single commit and force-push your PR branch.

Squashed and force-pushed.

This commit adds support for the Sirivision SR-ST31212F, a 12-port 10G
switch with 12x SFP+.

- SoC:      Realtek RTL9313
- RAM:      512 MiB DDR3 (Micron D9PXV)
- Flash:    SPI-NOR 16 MiB (Winbond W25Q128)
- Ethernet: 12x SFP+
- LEDs:     1x power (hardware blink), 1x system green (SYS_LED/GPIO),
            1x SFP+ LED/port (link/act)
- Button:   none
- Console:  Cisco-style RJ45, 115200 8n1
- Fan:      2x 12V 2pin fan, always full speed
- Power:    12V DC from internal PSU, input AC 100-240V 50/60Hz

Board Layout
-----------

PCB ST31212F_V1.0, front, power side on the right:
SFP1-12 along the left. SoC RTL9313 and RAM (Micron D9PXV) center.
W25Q128 near SFP5/6. Two RTL8231 near SFP10-11.
Console, PWR/SYS LEDs, 74HC125, MA3232, HC164 near front-bottom.
12V header, two 2-pin fan headers, empty 14-pin and 6-pin headers.

MAC address is read from u-boot-env ethaddr.
U-Boot image magic is 0x93000000.

SFP cage sideband uses GPIOs from the SoC and 2x RTL8231.
Those pads are shared with the generic SPI master;
QSPI NOR uses a separate controller.
So pinmux_disable_spi0 / pinmux_disable_spi0_cs0 /
pinmux_disable_spi0_cs1 are required to release the pins to be GPIOs.
SerDes TX polarity is inverted on all SFP cages;
without this, port LEDs work but traffic does not.
System LED is controlled via SYS_LED by default,
here I use pinmux_disable_sys_led to switch it to GPIO0 from SoC
to make it more functional in openwrt.

OpenWrt installation
--------------------
1. Serial console, 115200 8n1, press Esc to stop U-Boot
2. Load initramfs-kernel.bin via YMODEM (loady) or TFTP and bootm.
   Optional for tftpboot:
      Use "printenv" to check the network settings of U-Boot.
          You can change the ip address of the device by
          "setenv ipaddr XXX.XXX.XXX.XXX" /
          "setenv netmask XXX.XXX.XXX.XXX".
      And you also need "setenv serverip XXX.XXX.XXX.XXX" to setup
          your tftp server ip.
      Then initialize the network by running "rtk network on".
      And you may need the "rtk 10g PORT ..." command for
          different SFP modules. Use "help rtk" for more details.
3. Backup the whole flash if you have not yet. Since there's no backup
   runtime partition in this tiny flash, you will lose your original
   runtime once you write openwrt in it.
   Then sysupgrade the squashfs-sysupgrade.bin image.

Signed-off-by: Hui Chen <[email protected]>
@openwrt openwrt Bot removed the not following guidelines Pull request does not follow formatting guidelines label Sep 16, 2026
@jonasjelonek jonasjelonek removed target/apm821xx pull request/issue for apm821xx target target/bcm53xx pull request/issue for bcm53xx target target/bcm27xx pull request/issue for bcm27xx target kernel pull request/issue with Linux kernel related changes target/lantiq pull request/issue for lantiq target target/layerscape pull request/issue for layerscape target target/mvebu pull request/issue for mvebu target target/octeon pull request/issue for octeon target core packages pull request/issue for core (in-tree) packages target/ramips pull request/issue for ramips target target/sunxi pull request/issue for sunxi target target/x86 pull request/issue for x86 target target/imx pull request/issue for imx (imx6) target target/ipq40xx pull request/issue for ipq40xx target target/ath79 pull request/issue for ath79 target target/mediatek pull request/issue for mediatek target target/bmips pull request/issue for bmips target target/airoha pull request/issue for airoha target target/armsr pull request/issue for armsr target target/qualcommax pull request/issue for qualcommax target target/d1 pull request/issue for d1 target target/starfive pull request/issue for starfive target target/qualcommbe pull request/issue for qualcommbe target target/econet pull request/issue for econet (MIPS) target labels Sep 16, 2026
lan_mac_start=$lan_mac
;;
d-link,dgs-1250-28x|\
draytek,g2282x|\

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be dropped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

target/realtek pull request/issue for realtek target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants