Netdev List
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: Jonas Jelonek <jelonek.jonas@gmail.com>
Cc: "Oleksij Rempel" <o.rempel@pengutronix.de>,
	"Kory Maincent" <kory.maincent@bootlin.com>,
	"Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"Daniel Golle" <daniel@makrotopia.org>,
	"Bjørn Mork" <bjorn@mork.no>
Subject: Re: [PATCH net-next v5 1/4] dt-bindings: net: pse-pd: add bindings for Realtek/Broadcom PSE MCU
Date: Mon, 6 Jul 2026 18:35:53 +0100	[thread overview]
Message-ID: <20260706-player-handwash-0a3fe95cf5ec@spud> (raw)
In-Reply-To: <20260706112425.3149226-2-jelonek.jonas@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 8381 bytes --]

On Mon, Jul 06, 2026 at 11:24:21AM +0000, Jonas Jelonek wrote:
> Add a binding for the microcontroller (MCU) that fronts the PSE silicon
> on a range of managed 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 compatible names the MCU front-end, not a specific part. These
> boards front the PSE silicon with an MCU that presents a stable
> message protocol Realtek documents. The PSE chip behind it varies
> - Broadcom on older boards, Realtek on newer - and is detected at
> runtime; the arrangement appears to be a Realtek MCU-based PoE design
> carried across those PSE-chip generations. So the 'realtek' prefix
> names that front-end (Realtek's protocol and firmware), not the
> general-purpose MCU silicon or the PSE chip - the google,cros-ec-*
> model. The '-rtk'/'-brcm' suffix selects the Realtek or Broadcom dialect.
> 
> A single compatible per dialect covers both the I2C/SMBus and UART
> attachments: the wire protocol is identical across them and the transport
> is expressed by the node's parent bus, so it is not encoded in the
> compatible.
> 
> Both dialects share one protocol family and one device tree contract, so
> they are documented in a single binding under the one 'realtek' prefix,
> with the '-rtk'/'-brcm' suffix distinguishing the dialect.
> 
> Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
> ---
>  .../bindings/net/pse-pd/realtek,pse-mcu.yaml  | 154 ++++++++++++++++++
>  1 file changed, 154 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/pse-pd/realtek,pse-mcu.yaml
> 
> diff --git a/Documentation/devicetree/bindings/net/pse-pd/realtek,pse-mcu.yaml b/Documentation/devicetree/bindings/net/pse-pd/realtek,pse-mcu.yaml
> new file mode 100644
> index 000000000000..d0dfae220dc1
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/pse-pd/realtek,pse-mcu.yaml
> @@ -0,0 +1,154 @@
> +# 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.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Realtek/Broadcom PSE MCU
> +
> +maintainers:
> +  - Jonas Jelonek <jelonek.jonas@gmail.com>
> +
> +description: |
> +  Microcontroller (MCU) that fronts the PSE hardware on switches using
> +  Realtek (RTL8238B, RTL8239, RTL8239C) or Broadcom (BCM59111, BCM59121)
> +  PSE chips. The MCU exposes a small message-based protocol over either
> +  I2C/SMBus or UART; the actual PSE silicon is not accessed directly. The
> +  Realtek and Broadcom variants share this device tree contract but use
> +  different protocol opcodes, selected by the compatible.
> +
> +  The compatible identifies the PSE-MCU protocol dialect, not a specific
> +  part. The device here is the MCU: it presents a stable message protocol
> +  documented by Realtek, with the PSE silicon behind it - Broadcom on
> +  older boards, Realtek on newer - detected at runtime and not described
> +  here. The MCU's own silicon is general-purpose and varies across
> +  boards, so the 'realtek' vendor prefix names the protocol front-end
> +  (following the google,cros-ec pattern); the '-rtk'/'-brcm' suffix
> +  selects the Realtek or Broadcom dialect.
> +
> +  A single compatible per dialect covers both the I2C/SMBus and UART
> +  attachments: the wire protocol is identical across them and the
> +  transport is already expressed by the node's parent bus, so it is not
> +  encoded in the compatible. Transport-specific properties differ
> +  accordingly - the I2C attachment carries 'reg' (and, for Realtek,
> +  'realtek,i2c-protocol'), while the UART attachment carries the serial
> +  peripheral properties such as 'current-speed'.

I'm not really convinced by the arguments here.

If the switch vendors are running different software on their MCUs to
the point that they behave differently, then yes it makes sense to have
different compatibles.

The first thing I don't understand is why realtek is considered the
main vendor here? Is it their MCU that broadcom are re-using with some
protocol tweaks?
If it is, then having the vendor as a suffix like wheel reinvention to
me, and if the MCU and/or protocol aren't something that broadcom
borrowed from realtek then having a realtek vendor prefix is strange
altogether. The mention of old boards being broadcom while the protocol
is documented by realtek is confusing me.

Either way, encoding the vendor without using the vendor prefix seems
very odd me to.

Secondly, the compatibles you do provide seem too generic. Is it really
possible for a given board to use smbus AND i2c, or do specific boards
only ever use i2c OR smbus (or uart for that matter).
I find it more believable that a board would support i2c and uart than
supporting both i2c and smbus fwiw.

Can you provide a link to the actual devices somewhere? It is
completely non-obvious to me what the binding actually represents.

Cheers,
Conor.


> +
> +properties:
> +  compatible:
> +    enum:
> +      - realtek,pse-mcu-rtk
> +      - realtek,pse-mcu-brcm
> +
> +  reg:
> +    maxItems: 1
> +
> +  power-supply:
> +    description: Regulator supplying the PoE power rail.
> +
> +  enable-gpios:
> +    maxItems: 1
> +
> +  realtek,i2c-protocol:
> +    $ref: /schemas/types.yaml#/definitions/string
> +    enum: [ i2c, smbus ]
> +    description: |
> +      Wire framing the MCU firmware expects on the I2C bus. "smbus" means
> +      reads carry a leading command byte (0x00) and a repeated start; "i2c"
> +      means bare 12-byte writes and reads with no command prefix. Only
> +      applies to the Realtek I2C attachment.
> +
> +required:
> +  - compatible
> +
> +allOf:
> +  - $ref: pse-controller.yaml#
> +  - $ref: /schemas/serial/serial-peripheral-props.yaml#
> +  # The I2C attachment (identified by 'reg') cannot carry serial bus props.
> +  - if:
> +      required: [reg]
> +    then:
> +      properties:
> +        current-speed: false
> +        max-speed: false
> +  # 'realtek,i2c-protocol' is meaningful only for the Realtek I2C attachment;
> +  # the Broadcom variant and any UART attachment must not carry it.
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: realtek,pse-mcu-rtk
> +      required: [reg]
> +    then:
> +      required:
> +        - realtek,i2c-protocol
> +    else:
> +      properties:
> +        "realtek,i2c-protocol": false
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  # Realtek PSE chip, I2C attachment (SMBus framing).
> +  - |
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        ethernet-pse@20 {
> +            compatible = "realtek,pse-mcu-rtk";
> +            reg = <0x20>;
> +            realtek,i2c-protocol = "smbus";
> +
> +            pse-pis {
> +                #address-cells = <1>;
> +                #size-cells = <0>;
> +
> +                pse-pi@0 {
> +                    reg = <0>;
> +                    #pse-cells = <0>;
> +                };
> +            };
> +        };
> +    };
> +
> +  # Broadcom PSE chip, I2C attachment.
> +  - |
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        ethernet-pse@20 {
> +            compatible = "realtek,pse-mcu-brcm";
> +            reg = <0x20>;
> +
> +            pse-pis {
> +                #address-cells = <1>;
> +                #size-cells = <0>;
> +
> +                pse-pi@0 {
> +                    reg = <0>;
> +                    #pse-cells = <0>;
> +                };
> +            };
> +        };
> +    };
> +
> +  # Realtek PSE chip, UART attachment.
> +  - |
> +    serial {
> +        ethernet-pse {
> +            compatible = "realtek,pse-mcu-rtk";
> +            current-speed = <115200>;
> +
> +            pse-pis {
> +                #address-cells = <1>;
> +                #size-cells = <0>;
> +
> +                pse-pi@0 {
> +                    reg = <0>;
> +                    #pse-cells = <0>;
> +                };
> +            };
> +        };
> +    };
> -- 
> 2.51.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-07-06 17:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-06 11:24 [PATCH net-next v5 0/4] net: pse-pd: add Realtek/Broadcom PSE MCU support Jonas Jelonek
2026-07-06 11:24 ` [PATCH net-next v5 1/4] dt-bindings: net: pse-pd: add bindings for Realtek/Broadcom PSE MCU Jonas Jelonek
2026-07-06 17:35   ` Conor Dooley [this message]
2026-07-06 20:30     ` Jonas Jelonek
2026-07-06 11:24 ` [PATCH net-next v5 2/4] net: pse-pd: add Realtek/Broadcom PSE MCU core Jonas Jelonek
2026-07-06 17:12   ` Uwe Kleine-König
2026-07-06 11:24 ` [PATCH net-next v5 3/4] net: pse-pd: realtek-pse-mcu: add I2C transport Jonas Jelonek
2026-07-06 11:24 ` [PATCH net-next v5 4/4] net: pse-pd: realtek-pse-mcu: add UART transport Jonas Jelonek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260706-player-handwash-0a3fe95cf5ec@spud \
    --to=conor@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=bjorn@mork.no \
    --cc=conor+dt@kernel.org \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=jelonek.jonas@gmail.com \
    --cc=kory.maincent@bootlin.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox