Skip to contentSkip to conversation

net: pse-pd: add Realtek PSE MCU support

PATCH Superseded Jonas Jelonek 4 participants 16 messages Jul 15 – Jul 24

Subsystems (5)

v8 of 14 Superseded Latest is v14 →

lore
Share & tools
lore

Jonas Jelonek

author maintainer
#0 lore raw

v8 cover net: pse-pd: add Realtek PSE MCU support

This series adds a PSE-PD driver for the microcontroller (MCU) that fronts the PSE silicon on a range of managed switches, together with its DT binding.

Hardware model
==============

These boards do not expose the PSE chips to the host directly. A small microcontroller sits on an I2C/SMBus or UART bus and manages one or more PSE chips behind it; the host CPU only ever talks to that MCU, using a fixed 12-byte request/response protocol with a trailing checksum. The PSE silicon never appears on the bus.

Two generations of the protocol exist, both Realtek's: an older one on boards with Broadcom PSE silicon (BCM59111, BCM59121) and a newer one used with Realtek's own PSE silicon (RTL8238B, RTL8239, RTL8239C). They diverge in opcode numbering and a few response layouts; the driver abstracts that behind a per-dialect opcode table and parser hooks, selected by the compatible. The specific PSE chip behind the MCU is detected at runtime and only influences per-chip constants (power scaling and the per-port cap).

The compatibles
===============

The protocol compatibles name two generations of the Realtek protocol, with the I2C framing folded in:

  realtek,pse-mcu-gen1        gen1, UART
  realtek,pse-mcu-gen1-smbus  gen1, I2C/SMBus
  realtek,pse-mcu-gen2        gen2, UART
  realtek,pse-mcu-gen2-smbus  gen2, I2C/SMBus
  realtek,pse-mcu-gen2-i2c    gen2, raw I2C

and each board carries a device-specific compatible that falls back to one of these, e.g.

  compatible = "zyxel,xs1930-12hp-pse", "realtek,pse-mcu-gen2-smbus";

The naming is the part most likely to raise questions, so the reasoning up front (the binding documents it too):

- The node describes the MCU together with its Realtek firmware, not a PSE chip and not the microcontroller silicon. The PSE chips sit behind the MCU, never appear on the bus, and are reported by the MCU and detected at runtime; the microcontroller itself is a general-purpose part (GigaDevice, Nuvoton, ...) that varies across boards. What is fixed and Realtek's is the firmware and its host protocol - hence the 'realtek' prefix.

- gen1 and gen2 are two generations of that protocol, both Realtek's:
gen1 on older boards fronting Broadcom PSE silicon, gen2 the altered protocol used once Realtek shipped their own PSE silicon. The generation is fixed per board and is all the driver needs at DT-parse time, so the compatible encodes it.

- On I2C the MCU firmware expects one of two framings - SMBus or raw I2C - which is a genuine programming-model difference, so it is part of the compatible ('-smbus' / '-i2c'). A UART attachment carries no framing suffix; the transport is given structurally by the parent 'serial' node.

- Each board additionally carries a device-specific compatible that falls back to the protocol one. The driver only ever binds on the protocol compatible; the device-specific string keeps the binding specific and reserves a place for a future per-board quirk without having to retrofit device trees already deployed in the field.

Testing
=======

 - Linksys LGS328MPCv2     (RTL8238B, I2C)
 - Zyxel GS1900-10HP A1    (BCM59121, UART)
 - Zyxel GS1900-10HP B1    (RTL8238B, UART)
 - Zyxel GS1920-24HPv2     (BCM59121, SMBus)
 - Zyxel XMG1915-10EP      (RTL8239C, UART)
 - Zyxel XS1930-12HP       (RTL8239, SMBus)

---
v7 -> v8:
- dt-bindings: added Reviewed-by of Oleksij
- uart: check and warn-on-error for serdev_* operations (Oleksij)
- core, i2c, uart: added Acked-by of Oleksij
v7: https://lore.kernel.org/netdev/[email protected]/

v6 -> v7:
- dt-bindings: rename file to 'realtek,pse-mcu-gen1.yml', using specific compatible as file name (Conor)
- dt-bindings: added Conor's Reviewed-by
- core: replaced some leftover 'BCM/RTK' dialect framing in comments
- core: use rolling sequence number instead of always hardcoded 0xff, adressing the issue that stale data might be accepted for new requests (Sashiko)
- core: reordered MODULE_ calls to keep consistent across all driver parts
- i2c: replaced some leftover 'BCM/RTK' dialect framing in comments
- slight commit message adjustments
v6: https://lore.kernel.org/netdev/[email protected]/

v5 -> v6:
- dt-bindings: reworked the compatibles per DT-maintainer feedback
- name the two protocol generations -gen1 / -gen2 (both Realtek's) instead of the -rtk / -brcm dialect suffix (Conor)
- encode the I2C framing in the compatible (-smbus / raw -i2c) and drop the realtek,i2c-protocol property (Rob)
- add device-specific (switch) compatibles that fall back to the protocol compatibles, with the board↔protocol pairing enforced in the schema (Conor)
- rewrite the description accordingly
- driver: track the binding rework
- match on realtek,pse-mcu-gen{1,2}[-smbus|-i2c]; the I2C transport selects SMBus-vs-raw framing from a native_i2c match-data flag instead of reading the property (drops rtpse_mcu_needs_i2c_proto)
- rename the internal dialect and parser symbols rtk/brcm → gen1/gen2 (chip identifiers like RTL8238B/BCM59121 kept)
- i2c: DMA-safe raw-I2C path — bounce each frame through a heap buffer, since i2c_master_send()/i2c_master_recv() may DMA and the core's frame buffers are on the stack (SMBus and UART paths unaffected) (sashiko-nipa)
- includes: drop unused linux/mod_devicetable.h (core) (Uwe)
- includes: drop unused linux/delay.h (uart); add linux/regulator/consumer.h (core) and linux/slab.h + linux/string.h (i2c)
- commit messages — update the binding, core, and I2C messages to match (generations, framing-in-compatible, DMA note)
v5: https://lore.kernel.org/netdev/[email protected]/

v4 -> v5:
- split the single driver patch into three — core / I2C transport / UART transport. Binding stays patch 1, unchanged in shape. (Paolo) Please give guidance on how to if I should split more.
- core: set_pw_limit: guard divide-by-zero on pw_set_lsb_mW; cap the programmed value with U8_MAX instead of a bare 0xff; prg_val is now u8. (Oleksij, Sashiko)
- core: discover: also retry transient boot-time frames (-EBADMSG / -EBADE) within the bounded window, not just silence/NAK/not-ready (Sashiko).
- core: pw_status: report Broadcom 0x3 → TEST and 0x5 → OTHERFAULT (new STS_TEST/STS_OTHER_FAULT); pw_class comment corrected (0x3/0x5 aren't "other fault" on RTL; class-0-vs-fault note). (Sashiko)
- core: dropped unused decoded fields — function_mode, cls_type, disconnect_type, pair_type, inrush_mode, limit_type, chip_addr, channel. (Oleksij)
- core: removed forward declarations by moving the response structs above the dialect struct. (Oleksij)
- core: get_pw_limit_ranges: reverse-Christmas-tree local ordering. (Oleksij)
- core: dialect comment clarified (only divergent responses are hooked); commit message "parser hooks" tightened to "…for the responses that differ." (Sashiko)
- core: made parse_system_info hook void, both implementations return hardcoded 0. (Paolo)
- core: dropped GFP_KERNEL from kzalloc_obj. (Paolo)
- core: dropped unneeded u32 cast
- kept probe dev_info() for now deliberately, due to different opinions on whether a probe might print or not
- NOT included Acked-by from Oleksij, due to several changes
v4: https://lore.kernel.org/netdev/[email protected]/

v3 -> v4:
- move owner setting from core to transport, mitigating possible use-after-free (Sashiko)
- resend because net-next was still closed
v3: https://lore.kernel.org/netdev/[email protected]/

v2 -> v3:
- dt-bindings: using brcm instead of bcm for Broadcom
- rename the driver files and Kconfig symbols to realtek-pse-mcu-* / PSE_REALTEK_MCU* for consistency with the realtek,pse-mcu-* compatibles
- rename driver-internal prefix from 'rtpse_' to 'rtpse_mcu' to emphasize this targets the MCU-centric setup (and leaves room open for eventual directly addressable PSE chips)
- rework the vendor-prefix rationale (binding + commit message): the prefix names the protocol/firmware owner (Realtek documents the protocol and supplies the firmware), and -rtk/-brcm select the Realtek or Broadcom protocol dialect
- core: reject zeroed/echo-mismatched responses via the echoed seq_num (a BCM PORT_ENABLE on port 0 was otherwise accepted from an all-zero frame)
- core: enable the PoE supply before global-enabling the MCU, and roll back the global enable on probe failure or driver removal
- core: drop inline from helpers (flagged by automated check)
- uart: update the completion under rx_lock too, so a late frame can no longer make the next transaction fail spuriously with -EIO
v2: https://lore.kernel.org/netdev/[email protected]/

v1 -> v2:
- all points flagged by Sashiko addressed:
- uart: drop frame overflow (return count, not the stored length) so serdev retains no leftover bytes that would misalign the next response
- uart: guard rx_buf/rx_len with a spinlock to close a data race between the async receive_buf callback and send/recv
- i2c: return terminal MCU error opcodes (0xfd/0xfe) to the core immediately instead of polling to the 1 s timeout
- core: cap BCM59121 at 30 W (802.3at) — the basic 8-bit set command can't program the advertised 60 W (it silently clamped to 51 W)
v1: https://lore.kernel.org/netdev/[email protected]/

---
Jonas Jelonek (4):
dt-bindings: net: pse-pd: add bindings for Realtek PSE MCU
net: pse-pd: add Realtek PSE MCU core
net: pse-pd: realtek-pse-mcu: add I2C transport
net: pse-pd: realtek-pse-mcu: add UART transport

 .../net/pse-pd/realtek,pse-mcu-gen1.yaml      | 176 ++++
 MAINTAINERS                                   |   7 +
 drivers/net/pse-pd/Kconfig                    |  28 +
 drivers/net/pse-pd/Makefile                   |   3 +
 drivers/net/pse-pd/realtek-pse-mcu-core.c     | 995 ++++++++++++++++++
 drivers/net/pse-pd/realtek-pse-mcu-i2c.c      | 170 +++
 drivers/net/pse-pd/realtek-pse-mcu-uart.c     | 164 +++
 drivers/net/pse-pd/realtek-pse-mcu.h          |  91 ++
 8 files changed, 1634 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/pse-pd/realtek,pse-mcu-gen1.yaml
 create mode 100644 drivers/net/pse-pd/realtek-pse-mcu-core.c
 create mode 100644 drivers/net/pse-pd/realtek-pse-mcu-i2c.c
 create mode 100644 drivers/net/pse-pd/realtek-pse-mcu-uart.c
 create mode 100644 drivers/net/pse-pd/realtek-pse-mcu.h

base-commit: f6f3b36c15ed44de1fbb44e645e4fae8c4a4453e

Signature · 1 line
2.53.0
author maintainer
#1 lore raw

PATCH v8 1/4 dt-bindings: net: pse-pd: add bindings for Realtek PSE MCU

Add a binding for the microcontroller (MCU) that fronts the PSE silicon on a range of managed Realtek-based switches. The host talks only to the MCU, over I2C/SMBus or UART, using a fixed message-based protocol; the PSE chips behind it never appear on the bus.

The device is the MCU together with its Realtek firmware: the firmware and its host protocol are what the binding describes, not the general-purpose microcontroller they run on. The PSE silicon behind the MCU (Realtek or Broadcom) is reported by the MCU and detected at runtime, so it is not described here - hence the 'realtek' vendor prefix.

Two protocol generations exist, both Realtek's, selected by the
compatible: gen1 on older boards (fronting Broadcom PSE silicon) and gen2, the altered protocol used with Realtek's own PSE silicon. On an I2C attachment the framing the MCU firmware expects is part of the compatible as well - '-smbus' or raw '-i2c'; a UART attachment carries no framing suffix, as the transport is given by the parent serial node.

Each board additionally carries a device-specific compatible that falls back to one of the protocol compatibles above. Drivers bind on the protocol compatible; the device-specific string identifies the board and reserves a place for a future per-board quirk without having to retrofit device trees already in the field.

---
 .../net/pse-pd/realtek,pse-mcu-gen1.yaml      | 176 ++++++++++++++++++
 1 file changed, 176 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/pse-pd/realtek,pse-mcu-gen1.yaml
Documentation/devicetree/bindings/net/pse-pd/realtek,pse-mcu-gen1.yaml new file +176 -0
new file mode 100644
index 000000000000..2b0661c9e31f
@@ -0,0 +1,176 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/pse-pd/realtek,pse-mcu-gen1.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Realtek PSE MCU
+
+maintainers:
+  - Jonas Jelonek <[email protected]>
+
+description: |
+  A microcontroller (MCU) that manages the PSE (Power Sourcing Equipment)
+  hardware on a range of managed PoE switches. The host CPU talks only to
+  this MCU - over I2C/SMBus or UART - using a small message-based protocol;
+  the PSE silicon it drives sits behind the MCU and is never accessed
+  directly. For example, on the Zyxel GS1900-10HP the SoC reaches the MCU
+  over UART, and the MCU manages the on-board PSE chip.
+
+  This binding describes the MCU together with its Realtek firmware: the
+  firmware and its host protocol, which are stable across boards. The
+  microcontroller silicon is a general-purpose part that varies, and the
+  PSE silicon behind the MCU (Realtek RTL823x/RTL8239* or Broadcom
+  BCM59xxx) is reported by the MCU and detected at runtime - neither is
+  named here.
+
+  Two protocol generations exist, both Realtek's:
+    gen1  older boards, where the MCU fronts Broadcom PSE silicon
+    gen2  the altered protocol used with Realtek's own PSE silicon
+
+  On an I2C attachment the framing the MCU firmware expects is part of the
+  compatible: '-smbus' (reads carry a leading command byte and a repeated
+  start) or '-i2c' (bare block writes and reads). A UART attachment carries
+  no framing suffix; the transport is given by the parent 'serial' node.
+
+  Each board additionally carries a device-specific compatible that falls
+  back to one of the protocol compatibles above. Drivers bind on the
+  protocol compatible; the device-specific string identifies the board and
+  reserves a place for a future per-board quirk without having to retrofit
+  device trees already in the field.
+
+properties:
+  compatible:
+    oneOf:
+      # UART
+      - items:
+          - enum:
+              - zyxel,gs1900-10hp-a1-pse
+          - const: realtek,pse-mcu-gen1
+
+      # I2C, SMBus framing
+      - items:
+          - enum:
+              - zyxel,gs1920-24hp-v2-pse
+          - const: realtek,pse-mcu-gen1-smbus
+
+      # UART
+      - items:
+          - enum:
+              - zyxel,gs1900-10hp-b1-pse
+              - zyxel,xmg1915-10ep-pse
+          - const: realtek,pse-mcu-gen2
+
+      # I2C, SMBus framing
+      - items:
+          - enum:
+              - zyxel,xs1930-12hp-pse
+          - const: realtek,pse-mcu-gen2-smbus
+
+      # I2C, raw framing
+      - items:
+          - enum:
+              - linksys,lgs328mpc-v2-pse
+          - const: realtek,pse-mcu-gen2-i2c
+
+  reg:
+    maxItems: 1
+
+  power-supply:
+    description: Regulator supplying the PoE power rail.
+
+  enable-gpios:
+    maxItems: 1
+
+required:
+  - compatible
+
+allOf:
+  - $ref: pse-controller.yaml#
+  - $ref: /schemas/serial/serial-peripheral-props.yaml#
+  # A '-smbus'/'-i2c' compatible is an I2C attachment: it has 'reg' and
+  # cannot carry serial bus properties. A bare gen compatible is a UART
+  # attachment: no 'reg', the transport comes from the parent serial node.
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - realtek,pse-mcu-gen1-smbus
+              - realtek,pse-mcu-gen2-smbus
+              - realtek,pse-mcu-gen2-i2c
+    then:
+      required:
+        - reg
+      properties:
+        current-speed: false
+        max-speed: false
+    else:
+      properties:
+        reg: false
+
+unevaluatedProperties: false
+
+examples:
+  # SMBus-framed I2C attachment
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        ethernet-pse@20 {
+            compatible = "zyxel,xs1930-12hp-pse", "realtek,pse-mcu-gen2-smbus";
+            reg = <0x20>;
+
+            pse-pis {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                pse-pi@0 {
+                    reg = <0>;
+                    #pse-cells = <0>;
+                };
+            };
+        };
+    };
+
+  # Raw-I2C-framed attachment
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        ethernet-pse@20 {
+            compatible = "linksys,lgs328mpc-v2-pse", "realtek,pse-mcu-gen2-i2c";
+            reg = <0x20>;
+
+            pse-pis {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                pse-pi@0 {
+                    reg = <0>;
+                    #pse-cells = <0>;
+                };
+            };
+        };
+    };
+
+  # UART attachment
+  - |
+    serial {
+        ethernet-pse {
+            compatible = "zyxel,gs1900-10hp-a1-pse", "realtek,pse-mcu-gen1";
+            current-speed = <19200>;
+
+            pse-pis {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                pse-pi@0 {
+                    reg = <0>;
+                    #pse-cells = <0>;
+                };
+            };
+        };
+    };
Signature · 1 line
2.53.0
maintainer Reviewed-by on v8 1/4
#2 lore raw

Re: [PATCH net-next v8 1/4] dt-bindings: net: pse-pd: add bindings for Realtek PSE MCU

Quoted 24 lines · On Wed, 15 Jul 2026 07:55:25 +0000 Jonas Jelonek <[email protected]>…

Add a binding for the microcontroller (MCU) that fronts the PSE silicon on a range of managed Realtek-based switches. The host talks only to the MCU, over I2C/SMBus or UART, using a fixed message-based protocol; the PSE chips behind it never appear on the bus.

The device is the MCU together with its Realtek firmware: the firmware and its host protocol are what the binding describes, not the general-purpose microcontroller they run on. The PSE silicon behind the MCU (Realtek or Broadcom) is reported by the MCU and detected at runtime, so it is not described here - hence the 'realtek' vendor prefix.

Two protocol generations exist, both Realtek's, selected by the
compatible: gen1 on older boards (fronting Broadcom PSE silicon) and gen2, the altered protocol used with Realtek's own PSE silicon. On an I2C attachment the framing the MCU firmware expects is part of the compatible as well - '-smbus' or raw '-i2c'; a UART attachment carries no framing suffix, as the transport is given by the parent serial node.

Each board additionally carries a device-specific compatible that falls back to one of the protocol compatibles above. Drivers bind on the protocol compatible; the device-specific string identifies the board and reserves a place for a future per-board quirk without having to retrofit device trees already in the field.

Quoted 3 lines

Thank you!

Signature · 3 lines
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
#3 lore raw

Re: [PATCH net-next v8 1/4] dt-bindings: net: pse-pd: add bindings for Realtek PSE MCU

In reply to Jonas Jelonek

Hi,

Quoted 28 lines · Jonas Jelonek

Add a binding for the microcontroller (MCU) that fronts the PSE silicon on a range of managed Realtek-based switches. The host talks only to the MCU, over I2C/SMBus or UART, using a fixed message-based protocol; the PSE chips behind it never appear on the bus.

The device is the MCU together with its Realtek firmware: the firmware and its host protocol are what the binding describes, not the general-purpose microcontroller they run on. The PSE silicon behind the MCU (Realtek or Broadcom) is reported by the MCU and detected at runtime, so it is not described here - hence the 'realtek' vendor prefix.

Two protocol generations exist, both Realtek's, selected by the
compatible: gen1 on older boards (fronting Broadcom PSE silicon) and gen2, the altered protocol used with Realtek's own PSE silicon. On an I2C attachment the framing the MCU firmware expects is part of the compatible as well - '-smbus' or raw '-i2c'; a UART attachment carries no framing suffix, as the transport is given by the parent serial node.

Each board additionally carries a device-specific compatible that falls back to one of the protocol compatibles above. Drivers bind on the protocol compatible; the device-specific string identifies the board and reserves a place for a future per-board quirk without having to retrofit device trees already in the field.

---

[...]

Quoted 2 lines

+  power-supply:
+    description: Regulator supplying the PoE power rail.

As I reported to Jonas earlier [1], I used this property to define a power supply for the 54V rail. While everything was working nicely, I still got this warning for the missing vpwr-supply property on the PSE-PI nodes:

regulator regulator.2: supply vpwr not found, using dummy regulator Of course I don't like seeing warnings when everything is seemingly working fine, but I was also wondering if this duplicated way of providing the PoE power rail is a good way to go forward and if the generic pse-pi@n/vpwr-supply shouldn't just be used instead. The latter is admittedly more verbose, with a property on every node, but going forward offers a few advantages IMHO:
* Being able to reserve "power-supply" on the main node for the MCU's actual 3.3V regulator (not needed anywhere at the moment AFAIK)
* Being able to take advantage of the generic pse-pi framework evolving to take into account more properties of the parent regulator, such as requesting more power, or ensuring the parent supply is not overdrawn by the combined PSE-PI outputs.

[1] https://github.com/openwrt/openwrt/pull/23222#issuecomment-5032841546

Best,
Sander

author maintainer
#4 lore raw

Re: [PATCH net-next v8 1/4] dt-bindings: net: pse-pd: add bindings for Realtek PSE MCU

Hi,

Quoted 8 lines · Sander Vanheule

[...]

Quoted 2 lines

+  power-supply:
+    description: Regulator supplying the PoE power rail.

As I reported to Jonas earlier [1], I used this property to define a power supply for the 54V rail. While everything was working nicely, I still got this warning for the missing vpwr-supply property on the PSE-PI nodes:

Quoted 8 lines

regulator regulator.2: supply vpwr not found, using dummy regulator Of course I don't like seeing warnings when everything is seemingly working fine, but I was also wondering if this duplicated way of providing the PoE power rail is a good way to go forward and if the generic pse-pi@n/vpwr-supply shouldn't just be used instead. The latter is admittedly more verbose, with a property on every node, but going forward offers a few advantages IMHO:
* Being able to reserve "power-supply" on the main node for the MCU's actual 3.3V regulator (not needed anywhere at the moment AFAIK)

I would probably rename this, mirroring the PD692x0 naming. "power" is actually too blurry, leaving too much room for interpretation. Still keeping its purpose to reference the supply that serves the PoE rail for this MCU with its downstream PSE. Reasoning below.

Quoted 4 lines

* Being able to take advantage of the generic pse-pi framework evolving to take into account more properties of the parent regulator, such as requesting more power, or ensuring the parent supply is not overdrawn by the combined PSE-PI outputs.

Correct me if I'm wrong but from what I see, most of that budgeting machinery isn't used in dynamic budget evaluation strategy, which is used here because the MCU does budgeting on it's own. Using vpwr-supply on each PI still buys that the supply is enabled and ref-counted by PSE-PD core, and keeps potential for what might come. But no requesting, allocation or deallocation of power.

Given that, I had a closer look at PD692x0 and it seems, this has a similar setup. The difference here being just that there's no multi-manager concept. There is also a manager-level supply reference "vmain-supply" which the driver reads and applies to the hardware, which does budgeting also in hardware.

Based on that, I would just adjust the binding to more suitable name for the supply. Implementing the power budget application to the MCU is fine for a follow-up. All boards I've worked with so far already have a pre-set safe budget in their default configuration, avoiding any potential issues or physical damage due to overload.

Quoted 4 lines

[1] https://github.com/openwrt/openwrt/pull/23222#issuecomment-5032841546

Best,
Sander

Best,
Jonas

maintainer
#5 lore raw

Re: [PATCH net-next v8 1/4] dt-bindings: net: pse-pd: add bindings for Realtek PSE MCU

Hi Jonas,

Quoted 25 lines · Jonas Jelonek

Hi,

Quoted 8 lines · Sander Vanheule

[...]

Quoted 2 lines

+  power-supply:
+    description: Regulator supplying the PoE power rail.

As I reported to Jonas earlier [1], I used this property to define a power supply for the 54V rail. While everything was working nicely, I still got this warning for the missing vpwr-supply property on the PSE-PI nodes:

Quoted 8 lines

regulator regulator.2: supply vpwr not found, using dummy regulator Of course I don't like seeing warnings when everything is seemingly working fine, but I was also wondering if this duplicated way of providing the PoE power rail is a good way to go forward and if the generic pse-pi@n/vpwr-supply shouldn't just be used instead. The latter is admittedly more verbose, with a property on every node, but going forward offers a few advantages IMHO:
* Being able to reserve "power-supply" on the main node for the MCU's actual 3.3V regulator (not needed anywhere at the moment AFAIK)

I would probably rename this, mirroring the PD692x0 naming. "power" is actually too blurry, leaving too much room for interpretation. Still keeping its purpose to reference the supply that serves the PoE rail for this MCU with its downstream PSE. Reasoning below.

Quoted 8 lines
Quoted 4 lines

* Being able to take advantage of the generic pse-pi framework evolving to take into account more properties of the parent regulator, such as requesting more power, or ensuring the parent supply is not overdrawn by the combined PSE-PI outputs.

Correct me if I'm wrong but from what I see, most of that budgeting machinery isn't used in dynamic budget evaluation strategy, which is used here because the MCU does budgeting on it's own.

Hm, I guess the wording in header is a bit confusing, I see now the misconception :)

dynamic vs static means - haw available budget is calculated, not where. Dynamic can be implemented in the linux core too, but so far no one did. Static can be implement in the MCU firmware as well.

In static case - the Powered Device tells us haw much power budget we need to reserve for this device and it will be permanently accounted. Advantage - every device will get what it is requesting. Disadvantage - we do not use full capability of the power supply.

In dynamic case - we do not fully trust the Powered Device, first we reserve requested budget and then start measuring the PD consumption. If real consumption is less as requested, the reservation will be reduced.
Advantage - more PDs can be attached.
Disadvantage - a spike in consumption of one PD, may kick out some low prio PDs.

Since the dynamic case need a lot of measurements, it is usually implemented in the firmware. Both strategies have advantages and disadvantages and MCUs may allow to change the strategies, this is why we provide this information.

In your case it is not documented, but it can be tested if you have enough PDs where you can influence the load.

Not sure if we need an UNKNOWN flag to tell the user - we do not know what to expect, use it on your own risk.

Quoted 3 lines

Using vpwr-supply on each PI still buys that the
supply is enabled and ref-counted by PSE-PD core, and keeps potential for what might come. But no requesting, allocation or deallocation of power.

Ack, in many cases it is for diagnostic. Please note, a "manger" is in the practice a multi channel current limiter/regulator. It has maximal load per chip and different max load per port. This can be properly reflected with the regulators.

For example, RTL8238B-VB datasheet do not document maximal rating per chip, only per port. Calculating 8 ports, with 36W max, would result in 288W. It feels like a lot of heat. Can it actually handle it? May be the MCU firmware has integrated maximal power limit do avoid HW damage. A proper information in the regulator tree would help user to understand why not all ports will get requested power.

Quoted 4 lines

Given that, I had a closer look at PD692x0 and it seems, this has a similar setup. The difference here being just that there's no multi-manager concept. There is also a manager-level supply reference "vmain-supply" which the driver reads and applies to the hardware, which does budgeting also in hardware.

According to RTL8238B documentation, it has same multi-manager concept. Since one manager RTL8238B supports max 8 ports, a switch with more PoE capable ports would need more chips.

Since we already talk about power budgeting - all of this make sense if we have port priorities. For example PD692x0 firmware has default prios bound to port numbers. Is it the same with this firmware?

pw-bot: changes-requested

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
author maintainer
#6 lore raw

Re: [PATCH net-next v8 1/4] dt-bindings: net: pse-pd: add bindings for Realtek PSE MCU

Hi Oleksij,

Quoted 24 lines · Oleksij Rempel

[...]

Quoted 3 lines

Correct me if I'm wrong but from what I see, most of that budgeting machinery isn't used in dynamic budget evaluation strategy, which is used here because the MCU does budgeting on it's own.

Hm, I guess the wording in header is a bit confusing, I see now the misconception :)

dynamic vs static means - haw available budget is calculated, not where. Dynamic can be implemented in the linux core too, but so far no one did. Static can be implement in the MCU firmware as well.

In static case - the Powered Device tells us haw much power budget we need to reserve for this device and it will be permanently accounted. Advantage - every device will get what it is requesting. Disadvantage - we do not use full capability of the power supply.

In dynamic case - we do not fully trust the Powered Device, first we reserve requested budget and then start measuring the PD consumption. If real consumption is less as requested, the reservation will be reduced.
Advantage - more PDs can be attached.
Disadvantage - a spike in consumption of one PD, may kick out some low prio PDs.

Quoted 7 lines

Since the dynamic case need a lot of measurements, it is usually implemented in the firmware. Both strategies have advantages and disadvantages and MCUs may allow to change the strategies, this is why we provide this information.

In your case it is not documented, but it can be tested if you have enough PDs where you can influence the load.

Probably takes a bit of preparation to set up such a test.

Quoted 3 lines

Not sure if we need an UNKNOWN flag to tell the user - we do not know what to expect, use it on your own risk.

So dynamic happens to be the suitable case here right now, because the core doesn't handle it yet and the MCU does it on it's own without the core disturbing that?

I'd like to avoid dealing with that in this series as this seems at least to me like another deep rabbit hole. The MCU comes always in kind of a pre-configured state, having several limits set so it should behave safe and mostly as expected without the driver changing anything.

Quoted 11 lines
Quoted 3 lines

Using vpwr-supply on each PI still buys that the
supply is enabled and ref-counted by PSE-PD core, and keeps potential for what might come. But no requesting, allocation or deallocation of power.

Ack, in many cases it is for diagnostic. Please note, a "manger" is in the practice a multi channel current limiter/regulator. It has maximal load per chip and different max load per port. This can be properly reflected with the regulators.

For example, RTL8238B-VB datasheet do not document maximal rating per chip, only per port. Calculating 8 ports, with 36W max, would result in 288W. It feels like a lot of heat. Can it actually handle it?

I can't tell, but I would guess so. Several switches I have use a single PSE chip for 8 ports. Given the advertisment of 30W per port and staying within the overall budget, I might expect to be able to use it. Or the vendor hides some information.

Quoted 11 lines

May be the MCU firmware has integrated maximal power limit do avoid HW damage. A proper information in the regulator tree would help user to understand why not all ports will get requested power.

Quoted 4 lines

Given that, I had a closer look at PD692x0 and it seems, this has a similar setup. The difference here being just that there's no multi-manager concept. There is also a manager-level supply reference "vmain-supply" which the driver reads and applies to the hardware, which does budgeting also in hardware.

According to RTL8238B documentation, it has same multi-manager concept. Since one manager RTL8238B supports max 8 ports, a switch with more PoE capable ports would need more chips.

I see. I mixed up the terms and thought this "manager" is separate level in between. If "manager" == RTL823x PSE chip, then it's the same setup.

What do you suggest? I would like to avoid doing any half-grounded claims or assumptions here while not fully overviewing the whole picture. At the same time, I have the feeling the datasheet and host command guide from Realtek are genuinely trying to fool me.

The setup seems to be very similar to PD692x0, we have multiple managers, managed by a controller (the MCU). The MCU mostly does runtime discovery of the downstream managers, so right now there is no apparent need to have the same manager + port definitions in DT as PD692x0.

In reality I haven't seen a board which has different power rails for different managers. So there's usually a single wire from the PSU going to the PoE daughterboard where everything lands on a single supply PCB trace. The MCU has a multi-bank concept, however it's usage right now is rather confusing. Managers seem to have strapping pins which tell which bank they use, and on the MCU side one can set power limit for each bank.

Quoted 3 lines

Since we already talk about power budgeting - all of this make sense if we have port priorities. For example PD692x0 firmware has default prios bound to port numbers. Is it the same with this firmware?

Looking at several switches, by default all ports have a priority of 0 assigned. Thus, no pre-defined prioritisation, it's up to the user to set this.

Best regards,
Jonas

maintainer
#7 lore raw

Re: [PATCH net-next v8 1/4] dt-bindings: net: pse-pd: add bindings for Realtek PSE MCU

Quoted 38 lines · Jonas Jelonek

Hi Oleksij,

Quoted 24 lines · Oleksij Rempel

[...]

Quoted 3 lines

Correct me if I'm wrong but from what I see, most of that budgeting machinery isn't used in dynamic budget evaluation strategy, which is used here because the MCU does budgeting on it's own.

Hm, I guess the wording in header is a bit confusing, I see now the misconception :)

dynamic vs static means - haw available budget is calculated, not where. Dynamic can be implemented in the linux core too, but so far no one did. Static can be implement in the MCU firmware as well.

In static case - the Powered Device tells us haw much power budget we need to reserve for this device and it will be permanently accounted. Advantage - every device will get what it is requesting. Disadvantage - we do not use full capability of the power supply.

In dynamic case - we do not fully trust the Powered Device, first we reserve requested budget and then start measuring the PD consumption. If real consumption is less as requested, the reservation will be reduced.
Advantage - more PDs can be attached.
Disadvantage - a spike in consumption of one PD, may kick out some low prio PDs.

Quoted 7 lines

Since the dynamic case need a lot of measurements, it is usually implemented in the firmware. Both strategies have advantages and disadvantages and MCUs may allow to change the strategies, this is why we provide this information.

In your case it is not documented, but it can be tested if you have enough PDs where you can influence the load.

Probably takes a bit of preparation to set up such a test.

Quoted 1 line
Quoted 6 lines
Quoted 2 lines

Not sure if we need an UNKNOWN flag to tell the user - we do not know what to expect, use it on your own risk.

So dynamic happens to be the suitable case here right now, because the core doesn't handle it yet and the MCU does it on it's own without the core disturbing that?

Yes, dynamic happens to work with current core implementation for software point of view. And provide correct or incorrect information to user space. The PSE behavior expectations for user perspective will be different depending on this information.

Quoted 4 lines

I'd like to avoid dealing with that in this series as this seems at least to me like another deep rabbit hole. The MCU comes always in kind of a pre-configured state, having several limits set so it should behave safe and mostly as expected without the driver changing anything.

Ack, reverse engineering has own limitations. I do not expect we will be able to find all needed information.

Quoted 42 lines
Quoted 11 lines
Quoted 3 lines

Using vpwr-supply on each PI still buys that the
supply is enabled and ref-counted by PSE-PD core, and keeps potential for what might come. But no requesting, allocation or deallocation of power.

Ack, in many cases it is for diagnostic. Please note, a "manger" is in the practice a multi channel current limiter/regulator. It has maximal load per chip and different max load per port. This can be properly reflected with the regulators.

For example, RTL8238B-VB datasheet do not document maximal rating per chip, only per port. Calculating 8 ports, with 36W max, would result in 288W. It feels like a lot of heat. Can it actually handle it?

I can't tell, but I would guess so. Several switches I have use a single PSE chip for 8 ports. Given the advertisment of 30W per port and staying within the overall budget, I might expect to be able to use it. Or the vendor hides some information.

Quoted 11 lines

May be the MCU firmware has integrated maximal power limit do avoid HW damage. A proper information in the regulator tree would help user to understand why not all ports will get requested power.

Quoted 4 lines

Given that, I had a closer look at PD692x0 and it seems, this has a similar setup. The difference here being just that there's no multi-manager concept. There is also a manager-level supply reference "vmain-supply" which the driver reads and applies to the hardware, which does budgeting also in hardware.

According to RTL8238B documentation, it has same multi-manager concept. Since one manager RTL8238B supports max 8 ports, a switch with more PoE capable ports would need more chips.

I see. I mixed up the terms and thought this "manager" is separate level in between. If "manager" == RTL823x PSE chip, then it's the same setup.

What do you suggest? I would like to avoid doing any half-grounded claims or assumptions here while not fully overviewing the whole picture. At the same time, I have the feeling the datasheet and host command guide from Realtek are genuinely trying to fool me.

The setup seems to be very similar to PD692x0, we have multiple managers, managed by a controller (the MCU). The MCU mostly does runtime discovery of the downstream managers, so right now there is no apparent need to have the same manager + port definitions in DT as PD692x0.

Quoted 6 lines

In reality I haven't seen a board which has different power rails for different managers. So there's usually a single wire from the PSU going to the PoE daughterboard where everything lands on a single supply PCB trace. The MCU has a multi-bank concept, however it's usage right now is rather confusing. Managers seem to have strapping pins which tell which bank they use, and on the MCU side one can set power limit for each bank.

Current PSE framework already has a concept of power domain. Depending on implementation, the "manger" can be the weakest point in the chain. For example: one manager has 8 ports and can handle 200W, we have devices with 2 managers each 200W max and PSU providing 500W. If we attach 3 devices 100W each to ports 1, 2, 3 - will not work for the last one. If we attache them to ports 1, 2 + 9, will work just fine. Because it is attached to different power domain/manger.

Even if this information is hidden in the MCU. It is usable for admins, to understand what combination of ports should be used for optimal power delivery.

Quoted 6 lines
Quoted 3 lines

Since we already talk about power budgeting - all of this make sense if we have port priorities. For example PD692x0 firmware has default prios bound to port numbers. Is it the same with this firmware?

Looking at several switches, by default all ports have a priority of 0 assigned. Thus, no pre-defined prioritisation, it's up to the user to set this.

Do this switches have PSU covering all port at max load or it is over provisioning by design. Haw it behave in reality If we attach more consumer then it is able to handle - all ports go off, or only some of them?

PD692x0 firmware has user configurable prios - but if many ports share same prios it has internal prios based on port number.

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
author maintainer
#8 lore raw

Re: [PATCH net-next v8 1/4] dt-bindings: net: pse-pd: add bindings for Realtek PSE MCU

Hi Oleksij,

Quoted 26 lines · Oleksij Rempel
Quoted 11 lines · Jonas Jelonek

[...]
What do you suggest? I would like to avoid doing any half-grounded claims or assumptions here while not fully overviewing the whole picture. At the same time, I have the feeling the datasheet and host command guide from Realtek are genuinely trying to fool me.

The setup seems to be very similar to PD692x0, we have multiple managers, managed by a controller (the MCU). The MCU mostly does runtime discovery of the downstream managers, so right now there is no apparent need to have the same manager + port definitions in DT as PD692x0.

Quoted 6 lines

In reality I haven't seen a board which has different power rails for different managers. So there's usually a single wire from the PSU going to the PoE daughterboard where everything lands on a single supply PCB trace. The MCU has a multi-bank concept, however it's usage right now is rather confusing. Managers seem to have strapping pins which tell which bank they use, and on the MCU side one can set power limit for each bank.

Current PSE framework already has a concept of power domain. Depending on implementation, the "manger" can be the weakest point in the chain. For example: one manager has 8 ports and can handle 200W, we have devices with 2 managers each 200W max and PSU providing 500W. If we attach 3 devices 100W each to ports 1, 2, 3 - will not work for the last one. If we attache them to ports 1, 2 + 9, will work just fine. Because it is attached to different power domain/manger.

Quoted 3 lines

Even if this information is hidden in the MCU. It is usable for admins, to understand what combination of ports should be used for optimal power delivery.

It is not hidden, but I see two ways to surface this right now:
(1) Someone figures is out once per board and puts that topology in the DT.
(2) Runtime topology detection, the MCU tells us how many managers we have, which downstream addresses they have and which port lives on which manager.

I'm not sure what is preferred, having it in DT or using runtime detection if possible.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Since we already talk about power budgeting - all of this make sense if we have port priorities. For example PD692x0 firmware has default prios bound to port numbers. Is it the same with this firmware?

Looking at several switches, by default all ports have a priority of 0 assigned. Thus, no pre-defined prioritisation, it's up to the user to set this.

Do this switches have PSU covering all port at max load or it is over provisioning by design.

In most cases it's overprovisioned by design, the PSU budget is usually lower than what would be needed for all ports at max load. Even one of my switches, having a PoE budget of 400W, has 8 ports with 32W and 16 ports with 60 W, managed by 5 managers. Usually a manager is not overprovisioned but the system PSU is.

Quoted 3 lines

Haw it behave in reality If we attach more
consumer then it is able to handle - all ports go off, or only some of them?

That's a good question ^^. Unfortunately, I do not have enough PoE-powered devices here to test this scenario, or at least it takes a bit of time to get enough devices.

Quoted 4 lines

PD692x0 firmware has user configurable prios - but if many ports share same prios it has internal prios based on port number.

At least I'm not aware of that but since the firmware on the MCU is a blackbox, in the end this could be the case too. But it's not an obvious feature.

I'd like to slightly adjust the bindings, given the confusion about the naming that came up with Sander. Is there anything else that should be changed? Or is everything else in terms of supply, budgeting, etc. fine for follow-ups?

Best regards,
Jonas

maintainer
#9 lore raw

Re: [PATCH net-next v8 1/4] dt-bindings: net: pse-pd: add bindings for Realtek PSE MCU

Quoted 27 lines · Jonas Jelonek

Hi Oleksij,

Quoted 8 lines · Oleksij Rempel
Quoted 5 lines · Jonas Jelonek
Quoted 3 lines

Since we already talk about power budgeting - all of this make sense if we have port priorities. For example PD692x0 firmware has default prios bound to port numbers. Is it the same with this firmware?

Looking at several switches, by default all ports have a priority of 0 assigned. Thus, no pre-defined prioritisation, it's up to the user to set this.

Do this switches have PSU covering all port at max load or it is over provisioning by design.

In most cases it's overprovisioned by design, the PSU budget is usually lower than what would be needed for all ports at max load. Even one of my switches, having a PoE budget of 400W, has 8 ports with 32W and 16 ports with 60 W, managed by 5 managers. Usually a manager is not overprovisioned but the system PSU is.

Quoted 3 lines

Haw it behave in reality If we attach more
consumer then it is able to handle - all ports go off, or only some of them?

That's a good question ^^. Unfortunately, I do not have enough PoE-powered devices here to test this scenario, or at least it takes a bit of time to get enough devices.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

PD692x0 firmware has user configurable prios - but if many ports share same prios it has internal prios based on port number.

At least I'm not aware of that but since the firmware on the MCU is a blackbox, in the end this could be the case too. But it's not an obvious feature.

It would be nice to have both of this answers, but they are not blocker for this patch set.

Quoted 2 lines

I'd like to slightly adjust the bindings, given the confusion about the naming that came up with Sander.

Ack.

Quoted 2 lines

Is there anything else that should be changed? Or is everything else in terms of supply, budgeting, etc. fine for follow-ups?

Ack, can be done in follow-ups.

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
author maintainer
#10 lore raw

PATCH v8 2/4 net: pse-pd: add Realtek PSE MCU core

In reply to Jonas Jelonek

A range of managed Realtek-based PoE switches use a small microcontroller on the PCB to front the actual PSE silicon. The host CPU talks to that MCU over I2C/SMBus or UART using a fixed 12-byte request/response protocol with a trailing checksum; the PSE chips are managed by the MCU and are not accessed directly. Two generations of the protocol exist - both Realtek's - diverging in opcode numbering and a few response layouts; the driver handles this with a per-dialect opcode table and parser hooks for the responses that differ, selected by the compatible. The specific PSE chip behind the MCU is detected at runtime and only influences per-chip constants (power scaling and the per-port cap).

This core module implements the protocol, message framing, the dialect machinery and the pse_controller_ops glue, and exports a registration helper for transport modules. The I2C and UART transports that drive it follow in the next patches; the core (PSE_REALTEK_MCU) is selected automatically by those transports and is not user-selectable on its own.

The realtek-pse-mcu-* files and PSE_REALTEK_MCU* symbols match the realtek,pse-mcu-* compatibles (see the binding for the naming rationale). The two protocol generations - gen1 on older Broadcom-PSE boards, gen2 on Realtek's own PSE silicon - are both Realtek's, handled by the same shared core, each selecting its dialect via the compatible.

Power budgeting is left to the MCU firmware; the driver advertises PSE_BUDGET_EVAL_STRAT_DYNAMIC (controller-managed budget) accordingly.

---
 MAINTAINERS                               |   7 +
 drivers/net/pse-pd/Kconfig                |   6 +
 drivers/net/pse-pd/Makefile               |   1 +
 drivers/net/pse-pd/realtek-pse-mcu-core.c | 995 ++++++++++++++++++++++
 drivers/net/pse-pd/realtek-pse-mcu.h      |  91 ++
 5 files changed, 1100 insertions(+)
 create mode 100644 drivers/net/pse-pd/realtek-pse-mcu-core.c
 create mode 100644 drivers/net/pse-pd/realtek-pse-mcu.h
MAINTAINERS +7 -0
index f3218abefd0c..d84a4641aaec 100644
@@ -22717,6 +22717,13 @@ S:	Maintained
 F:	include/sound/rt*.h
 F:	sound/soc/codecs/rt*
 
+REALTEK PSE MCU DRIVER
+M:	Jonas Jelonek <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/net/pse-pd/realtek,pse-mcu-gen1.yaml
+F:	drivers/net/pse-pd/realtek-pse-mcu*
+
 REALTEK OTTO WATCHDOG
 M:	Sander Vanheule <[email protected]>
 L:	[email protected]
drivers/net/pse-pd/Kconfig +6 -0
index 7ef29657ee5d..3b0c245a2bc7 100644
@@ -13,6 +13,12 @@ menuconfig PSE_CONTROLLER
 
 if PSE_CONTROLLER
 
+config PSE_REALTEK_MCU
+	tristate
+	help
+	  Shared core for the Realtek PSE MCU driver. This is selected
+	  automatically by the transport options below.
+
 config PSE_REGULATOR
 	tristate "Regulator based PSE controller"
 	help
drivers/net/pse-pd/Makefile +1 -0
index cc78f7ea7f5f..bf35e2a5b110 100644
@@ -3,6 +3,7 @@
 
 obj-$(CONFIG_PSE_CONTROLLER) += pse_core.o
 
+obj-$(CONFIG_PSE_REALTEK_MCU) += realtek-pse-mcu-core.o
 obj-$(CONFIG_PSE_REGULATOR) += pse_regulator.o
 obj-$(CONFIG_PSE_PD692X0) += pd692x0.o
 obj-$(CONFIG_PSE_SI3474) += si3474.o
drivers/net/pse-pd/realtek-pse-mcu-core.c new file +995 -0

995 lines not on this page · raw message

drivers/net/pse-pd/realtek-pse-mcu.h new file +91 -0

91 lines not on this page · raw message

Signature · 1 line
2.53.0
maintainer Reviewed-by on v8 2/4
#11 lore raw

Re: [PATCH net-next v8 2/4] net: pse-pd: add Realtek PSE MCU core

Quoted 23 lines · On Wed, 15 Jul 2026 07:55:26 +0000 Jonas Jelonek <[email protected]>…

A range of managed Realtek-based PoE switches use a small microcontroller on the PCB to front the actual PSE silicon. The host CPU talks to that MCU over I2C/SMBus or UART using a fixed 12-byte request/response protocol with a trailing checksum; the PSE chips are managed by the MCU and are not accessed directly. Two generations of the protocol exist - both Realtek's - diverging in opcode numbering and a few response layouts; the driver handles this with a per-dialect opcode table and parser hooks for the responses that differ, selected by the compatible. The specific PSE chip behind the MCU is detected at runtime and only influences per-chip constants (power scaling and the per-port cap).

This core module implements the protocol, message framing, the dialect machinery and the pse_controller_ops glue, and exports a registration helper for transport modules. The I2C and UART transports that drive it follow in the next patches; the core (PSE_REALTEK_MCU) is selected automatically by those transports and is not user-selectable on its own.

The realtek-pse-mcu-* files and PSE_REALTEK_MCU* symbols match the realtek,pse-mcu-* compatibles (see the binding for the naming rationale). The two protocol generations - gen1 on older Broadcom-PSE boards, gen2 on Realtek's own PSE silicon - are both Realtek's, handled by the same shared core, each selecting its dialect via the compatible.

Quoted 5 lines

Power budgeting is left to the MCU firmware; the driver advertises PSE_BUDGET_EVAL_STRAT_DYNAMIC (controller-managed budget) accordingly.

Thank you!

Signature · 3 lines
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
author maintainer
#12 lore raw

PATCH v8 3/4 net: pse-pd: realtek-pse-mcu: add I2C transport

In reply to Jonas Jelonek

Add the I2C/SMBus transport for the Realtek PSE MCU core. It registers the MCU on an I2C bus and provides the send/recv callbacks the core uses to exchange the 12-byte frames.

The MCU firmware expects one of two framings on the I2C bus, and which one is part of the compatible: '-smbus' (reads carry a leading command byte and a repeated start) or raw '-i2c' (bare block writes and reads). The match data flags the raw-I2C case; SMBus is the default because that's what the majority of devices uses.

Because i2c_master_send()/i2c_master_recv() may DMA, the raw-I2C path bounces each frame through a heap buffer rather than the core's stack buffers; the SMBus path is unaffected.

---
 drivers/net/pse-pd/Kconfig               |  11 ++
 drivers/net/pse-pd/Makefile              |   1 +
 drivers/net/pse-pd/realtek-pse-mcu-i2c.c | 170 +++++++++++++++++++++++
 3 files changed, 182 insertions(+)
 create mode 100644 drivers/net/pse-pd/realtek-pse-mcu-i2c.c
drivers/net/pse-pd/Kconfig +11 -0
index 3b0c245a2bc7..6d14c8832e8b 100644
@@ -19,6 +19,17 @@ config PSE_REALTEK_MCU
 	  Shared core for the Realtek PSE MCU driver. This is selected
 	  automatically by the transport options below.
 
+config PSE_REALTEK_MCU_I2C
+	tristate "Realtek PSE MCU driver (I2C transport)"
+	depends on I2C
+	select PSE_REALTEK_MCU
+	help
+	  Driver for the microcontroller (MCU) that fronts the PSE
+	  hardware on various Realtek-based managed switches, attached
+	  via I2C/SMBus. The MCU exposes a message-based protocol; the actual
+	  PSE silicon is not accessed directly. To compile this driver as a
+	  module, choose M here: the module will be called realtek-pse-mcu-i2c.
+
 config PSE_REGULATOR
 	tristate "Regulator based PSE controller"
 	help
drivers/net/pse-pd/Makefile +1 -0
index bf35e2a5b110..ef869bba5ed9 100644
@@ -4,6 +4,7 @@
 obj-$(CONFIG_PSE_CONTROLLER) += pse_core.o
 
 obj-$(CONFIG_PSE_REALTEK_MCU) += realtek-pse-mcu-core.o
+obj-$(CONFIG_PSE_REALTEK_MCU_I2C) += realtek-pse-mcu-i2c.o
 obj-$(CONFIG_PSE_REGULATOR) += pse_regulator.o
 obj-$(CONFIG_PSE_PD692X0) += pd692x0.o
 obj-$(CONFIG_PSE_SI3474) += si3474.o
drivers/net/pse-pd/realtek-pse-mcu-i2c.c new file +170 -0

170 lines not on this page · raw message

Signature · 1 line
2.53.0
maintainer Reviewed-by on v8 3/4
#13 lore raw

Re: [PATCH net-next v8 3/4] net: pse-pd: realtek-pse-mcu: add I2C transport

Quoted 10 lines · On Wed, 15 Jul 2026 07:55:27 +0000 Jonas Jelonek <[email protected]>…

Add the I2C/SMBus transport for the Realtek PSE MCU core. It registers the MCU on an I2C bus and provides the send/recv callbacks the core uses to exchange the 12-byte frames.

The MCU firmware expects one of two framings on the I2C bus, and which one is part of the compatible: '-smbus' (reads carry a leading command byte and a repeated start) or raw '-i2c' (bare block writes and reads). The match data flags the raw-I2C case; SMBus is the default because that's what the majority of devices uses.

Quoted 6 lines

Because i2c_master_send()/i2c_master_recv() may DMA, the raw-I2C path bounces each frame through a heap buffer rather than the core's stack buffers; the SMBus path is unaffected.

Thank you!

Signature · 3 lines
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
author maintainer
#14 lore raw

PATCH v8 4/4 net: pse-pd: realtek-pse-mcu: add UART transport

In reply to Jonas Jelonek

Add the serdev (UART) transport for the Realtek PSE MCU core. It registers the MCU as a serdev device and provides the send/recv callbacks the core uses to exchange the 12-byte frames, receiving asynchronously via the serdev receive_buf callback.

The baud rate defaults to 19200 and can be overridden per board with the "current-speed" property.

---
 drivers/net/pse-pd/Kconfig                |  11 ++
 drivers/net/pse-pd/Makefile               |   1 +
 drivers/net/pse-pd/realtek-pse-mcu-uart.c | 164 ++++++++++++++++++++++
 3 files changed, 176 insertions(+)
 create mode 100644 drivers/net/pse-pd/realtek-pse-mcu-uart.c
drivers/net/pse-pd/Kconfig +11 -0
index 6d14c8832e8b..a0f2ae668c67 100644
@@ -30,6 +30,17 @@ config PSE_REALTEK_MCU_I2C
 	  PSE silicon is not accessed directly. To compile this driver as a
 	  module, choose M here: the module will be called realtek-pse-mcu-i2c.
 
+config PSE_REALTEK_MCU_UART
+	tristate "Realtek PSE MCU driver (UART transport)"
+	depends on SERIAL_DEV_BUS
+	select PSE_REALTEK_MCU
+	help
+	  Driver for the microcontroller (MCU) that fronts the PSE
+	  hardware on various Realtek-based managed switches, attached
+	  via UART. The MCU exposes a message-based protocol; the actual PSE
+	  silicon is not accessed directly. To compile this driver as a
+	  module, choose M here: the module will be called realtek-pse-mcu-uart.
+
 config PSE_REGULATOR
 	tristate "Regulator based PSE controller"
 	help
drivers/net/pse-pd/Makefile +1 -0
index ef869bba5ed9..9cca5900fe34 100644
@@ -5,6 +5,7 @@ obj-$(CONFIG_PSE_CONTROLLER) += pse_core.o
 
 obj-$(CONFIG_PSE_REALTEK_MCU) += realtek-pse-mcu-core.o
 obj-$(CONFIG_PSE_REALTEK_MCU_I2C) += realtek-pse-mcu-i2c.o
+obj-$(CONFIG_PSE_REALTEK_MCU_UART) += realtek-pse-mcu-uart.o
 obj-$(CONFIG_PSE_REGULATOR) += pse_regulator.o
 obj-$(CONFIG_PSE_PD692X0) += pd692x0.o
 obj-$(CONFIG_PSE_SI3474) += si3474.o
drivers/net/pse-pd/realtek-pse-mcu-uart.c new file +164 -0

164 lines not on this page · raw message

Signature · 1 line
2.53.0
maintainer Reviewed-by on v8 4/4
#15 lore raw

Re: [PATCH net-next v8 4/4] net: pse-pd: realtek-pse-mcu: add UART transport

Quoted 10 lines · On Wed, 15 Jul 2026 07:55:28 +0000 Jonas Jelonek <[email protected]>…

Add the serdev (UART) transport for the Realtek PSE MCU core. It registers the MCU as a serdev device and provides the send/recv callbacks the core uses to exchange the 12-byte frames, receiving asynchronously via the serdev receive_buf callback.

The baud rate defaults to 19200 and can be overridden per board with the "current-speed" property.

Thank you!

Signature · 3 lines
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com