From 95b3e13fcb88fc35117a39c7169cde2c816db45d Mon Sep 17 00:00:00 2001 From: Lars Gierth Date: Sun, 9 Aug 2026 16:44:16 +0200 Subject: [PATCH] realtek: rtl930x: add STC8 MCU support for Hasivo F1100W/WP-4SX-4XGT This MCU is present on most Hasivo devices and controls basic things such as watchdog, sensor, and RTC if available. On devices with PoE PSE support, it also controls the PSE chip and LEDs. One funny detail is that while the watchdog is present on most Hasivo devices and (unless armed) resets the whole device, here it only resets the PoE LEDs. The PoE LEDs reset and blink twice every 75s, even if PoE is unmanaged or off. Signed-off-by: Lars Gierth Link: https://github.com/openwrt/openwrt/pull/24643 Signed-off-by: Jonas Jelonek --- ...rtl9303_hasivo_f1100w-4sx-4xgt-common.dtsi | 52 ++++++++++++++++--- target/linux/realtek/image/rtl930x.mk | 8 ++- 2 files changed, 50 insertions(+), 10 deletions(-) diff --git a/target/linux/realtek/dts/rtl9303_hasivo_f1100w-4sx-4xgt-common.dtsi b/target/linux/realtek/dts/rtl9303_hasivo_f1100w-4sx-4xgt-common.dtsi index 99f5b24d09c..089480af622 100644 --- a/target/linux/realtek/dts/rtl9303_hasivo_f1100w-4sx-4xgt-common.dtsi +++ b/target/linux/realtek/dts/rtl9303_hasivo_f1100w-4sx-4xgt-common.dtsi @@ -13,6 +13,13 @@ led-failsafe = &led_sys; led-running = &led_sys; led-upgrade = &led_sys; + + /* Pin the STC8 to i2c0 so the PoE pse-0-* LED triggers bind. */ + i2c0 = &i2c_stc8; + i2c1 = &i2c_sfp0; + i2c2 = &i2c_sfp1; + i2c3 = &i2c_sfp2; + i2c4 = &i2c_sfp3; }; chosen { @@ -51,30 +58,59 @@ >; }; + /* I2C bus to the STC8 MCU, which controls watchdog, sensor, and PoE. */ + i2c_stc8: i2c-gpio { + compatible = "i2c-gpio"; + #address-cells = <1>; + #size-cells = <0>; + + scl-gpios = <&gpio0 22 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + sda-gpios = <&gpio0 23 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + clock-frequency = <100000>; + + stc8: stc8@6e { + compatible = "hasivo,stc8-mfd", "syscon"; + reg = <0x6e>; + #address-cells = <2>; + #size-cells = <0>; + hasivo,execute-bit = <0x40>; + hasivo,execute-bit-registers = <0x01 0x02>; + status = "okay"; + + watchdog { + compatible = "hasivo,mcu-wdt"; + }; + + sensor { + compatible = "hasivo,mcu-sensor"; + }; + }; + }; + sfp0: sfp-p1 { compatible = "sff,sfp"; - i2c-bus = <&i2c0>; + i2c-bus = <&i2c_sfp0>; mod-def0-gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; #thermal-sensor-cells = <0>; }; sfp1: sfp-p2 { compatible = "sff,sfp"; - i2c-bus = <&i2c1>; + i2c-bus = <&i2c_sfp1>; mod-def0-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; #thermal-sensor-cells = <0>; }; sfp2: sfp-p3 { compatible = "sff,sfp"; - i2c-bus = <&i2c2>; + i2c-bus = <&i2c_sfp2>; mod-def0-gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; #thermal-sensor-cells = <0>; }; sfp3: sfp-p4 { compatible = "sff,sfp"; - i2c-bus = <&i2c3>; + i2c-bus = <&i2c_sfp3>; mod-def0-gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; #thermal-sensor-cells = <0>; }; @@ -83,10 +119,10 @@ &i2c_mst1 { status = "okay"; - i2c0: i2c@0 { reg = <0>; }; - i2c1: i2c@1 { reg = <1>; }; - i2c2: i2c@2 { reg = <2>; }; - i2c3: i2c@3 { reg = <3>; }; + i2c_sfp0: i2c@0 { reg = <0>; }; + i2c_sfp1: i2c@1 { reg = <1>; }; + i2c_sfp2: i2c@2 { reg = <2>; }; + i2c_sfp3: i2c@3 { reg = <3>; }; }; &spi0 { diff --git a/target/linux/realtek/image/rtl930x.mk b/target/linux/realtek/image/rtl930x.mk index 92841d74a0e..025955b27c7 100644 --- a/target/linux/realtek/image/rtl930x.mk +++ b/target/linux/realtek/image/rtl930x.mk @@ -29,7 +29,9 @@ define Device/hasivo_f1100w-4sx-4xgt-common DEVICE_MODEL := F1100W-4SX-4XGT DEVICE_ALT0_VENDOR := Hasivo DEVICE_ALT0_MODEL := F1100W-4SX-4XGT-SE - DEVICE_PACKAGES := kmod-phy-realtek rtl826x-firmware + DEVICE_PACKAGES := \ + kmod-hasivo-mcu-sensor kmod-hasivo-mcu-wdt kmod-mfd-hasivo-stc8 \ + kmod-phy-realtek rtl826x-firmware IMAGE_SIZE := 29696k $(Device/kernel-lzma) endef @@ -52,7 +54,9 @@ define Device/hasivo_f1100wp-4sx-4xgt-common DEVICE_MODEL := F1100WP-4SX-4XGT DEVICE_ALT0_VENDOR := Hasivo DEVICE_ALT0_MODEL := F1100WP-4SX-4XGT-SE - DEVICE_PACKAGES := kmod-phy-realtek rtl826x-firmware + DEVICE_PACKAGES := \ + kmod-hasivo-mcu-sensor kmod-hasivo-mcu-wdt kmod-mfd-hasivo-stc8 \ + kmod-phy-realtek rtl826x-firmware IMAGE_SIZE := 29696k $(Device/kernel-lzma) endef