Skip to contentSkip to conversation

net: pse-pd: Plain I2C transport for Realtek Gen1

PATCH Applied Sander Vanheule 8 participants 11 messages Oct 18 – Oct 21

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover net: pse-pd: Plain I2C transport for Realtek Gen1

While for the Gen2 protocol both a plain I2C transport and an SMBus transport were provided, Gen1 only got SMBus. The Unifi Switch Lite 16 PoE uses the Gen1 protocol to manage a single BCM59121, but does to using plain I2C.

These patches simply add a new compatible for the plain I2C transport and the associated match data. This is sufficient to let the existing code talk to the management MCU.

Sander Vanheule (2):
dt-bindings: net: pse-pd: realtek,pse: add gen1 I2C transport
net: pse-pd: realtek-pse-mcu: add gen1 I2C transport

 .../bindings/net/pse-pd/realtek,pse-mcu-gen1.yaml         | 7 +++++++
 drivers/net/pse-pd/realtek-pse-mcu-core.c                 | 8 +++++++-
 drivers/net/pse-pd/realtek-pse-mcu-i2c.c                  | 1 +
 drivers/net/pse-pd/realtek-pse-mcu.h                      | 1 +
 4 files changed, 16 insertions(+), 1 deletion(-)
Signature · 1 line
2.56.0
#1 lore raw

PATCH 1/2 dt-bindings: net: pse-pd: realtek,pse: add gen1 I2C transport

Like the gen2 protocol, the gen1 protocol can also be used over both a raw I2C transport and an SMBUs transport. Add a compatible for the former and the compatible for the Ubiquiti Unifi Switch Lite 16 PoE device that uses it.

---
 .../bindings/net/pse-pd/realtek,pse-mcu-gen1.yaml          | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/net/pse-pd/realtek,pse-mcu-gen1.yaml +7 -0
index 3bb32349c28c..526f8525bb4d 100644
@@ -54,6 +54,12 @@ properties:
               - zyxel,gs1920-24hp-v2-pse
           - const: realtek,pse-mcu-gen1-smbus
 
+      # I2C, raw framing
+      - items:
+          - enum:
+              - ubnt,usw-lite-16-poe-pse
+          - const: realtek,pse-mcu-gen1-i2c
+
       # UART
       - items:
           - enum:
@@ -100,6 +106,7 @@ allOf:
           contains:
             enum:
               - realtek,pse-mcu-gen1-smbus
+              - realtek,pse-mcu-gen1-i2c
               - realtek,pse-mcu-gen2-smbus
               - realtek,pse-mcu-gen2-i2c
     then:
Signature · 1 line
2.56.0
#2 lore raw

Re: [PATCH net-next 1/2] dt-bindings: net: pse-pd: realtek,pse: add gen1 I2C transport

Quoted 28 lines · Sander Vanheule

Like the gen2 protocol, the gen1 protocol can also be used over both a raw I2C transport and an SMBUs transport. Add a compatible for the former and the compatible for the Ubiquiti Unifi Switch Lite 16 PoE device that uses it.

---
 .../bindings/net/pse-pd/realtek,pse-mcu-gen1.yaml          | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/net/pse-pd/realtek,pse-mcu-gen1.yaml +6 -0
index 3bb32349c28c..526f8525bb4d 100644
@@ -54,6 +54,12 @@ properties:
               - zyxel,gs1920-24hp-v2-pse
           - const: realtek,pse-mcu-gen1-smbus
 
+      # I2C, raw framing
+      - items:
+          - enum:
+              - ubnt,usw-lite-16-poe-pse
+          - const: realtek,pse-mcu-gen1-i2c
+
       # UART
       - items:
           - enum:

Documentation/devicetree/bindings/net/pse-pd/realtek,pse-mcu-gen1.yaml allOf: · line 109

Quoted 4 lines
Documentation/devicetree/bindings/net/pse-pd/realtek,pse-mcu-gen1.yaml +1 -0
@@ -100,6 +106,7 @@ allOf:
           contains:
             enum:
               - realtek,pse-mcu-gen1-smbus
+              - realtek,pse-mcu-gen1-i2c

That's the same device as smbus, no? Same device, same compatible.

You can have property deciding about protocol, if this cannot be deduced from the clients.

Best regards,
Krzysztof

maintainer
#3 lore raw

Re: [PATCH net-next 1/2] dt-bindings: net: pse-pd: realtek,pse: add gen1 I2C transport

Hi,

Quoted 19 lines · Krzysztof Kozlowski
Quoted 18 lines · Sander Vanheule

Like the gen2 protocol, the gen1 protocol can also be used over both a raw I2C transport and an SMBUs transport. Add a compatible for the former and the compatible for the Ubiquiti Unifi Switch Lite 16 PoE device that uses it.

---
 .../bindings/net/pse-pd/realtek,pse-mcu-gen1.yaml          | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/net/pse-pd/realtek,pse-mcu-gen1.yaml +0 -0
index 3bb32349c28c..526f8525bb4d 100644
@@ -54,6 +54,12 @@ properties:
               - zyxel,gs1920-24hp-v2-pse
           - const: realtek,pse-mcu-gen1-smbus
 
Quoted 15 lines
Quoted 10 lines
Documentation/devicetree/bindings/net/pse-pd/realtek,pse-mcu-gen1.yaml +6 -0
+      # I2C, raw framing
+      - items:
+          - enum:
+              - ubnt,usw-lite-16-poe-pse
+          - const: realtek,pse-mcu-gen1-i2c
+
       # UART
       - items:
           - enum:

Documentation/devicetree/bindings/net/pse-pd/realtek,pse-mcu-gen1.yaml allOf: · line 109

Quoted 4 lines
Documentation/devicetree/bindings/net/pse-pd/realtek,pse-mcu-gen1.yaml +1 -0
@@ -100,6 +106,7 @@ allOf:
           contains:
             enum:
               - realtek,pse-mcu-gen1-smbus
+              - realtek,pse-mcu-gen1-i2c

That's the same device as smbus, no? Same device, same compatible.

Physically it's the same device/MCU but the baked-in firmware and configuration differs. Same for the UART vs. SMBus.

Quoted 2 lines

You can have property deciding about protocol, if this cannot be deduced from the clients.

This was the approach in the early versions of the driver when I sent it to the list. Rob favored the current way [1] and I think Conor was ok with it later on.

[1] https://lore.kernel.org/netdev/[email protected]/

Quoted 2 lines

Best regards,
Krzysztof

Best,
Jonas

Acked-by on v1 1/2
#4 lore raw

Re: [PATCH net-next 1/2] dt-bindings: net: pse-pd: realtek,pse: add gen1 I2C transport

In reply to Sander Vanheule
Quoted 6 lines · Sander Vanheule

Like the gen2 protocol, the gen1 protocol can also be used over both a raw I2C transport and an SMBUs transport. Add a compatible for the former and the compatible for the Ubiquiti Unifi Switch Lite 16 PoE device that uses it.

Best regards,
Krzysztof

maintainer Reviewed-by on v1 1/2
#5 lore raw

Re: [PATCH net-next 1/2] dt-bindings: net: pse-pd: realtek,pse: add gen1 I2C transport

In reply to Sander Vanheule
Quoted 10 lines · Sander Vanheule

Like the gen2 protocol, the gen1 protocol can also be used over both a raw I2C transport and an SMBUs transport. Add a compatible for the former and the compatible for the Ubiquiti Unifi Switch Lite 16 PoE device that uses it.

---
 .../bindings/net/pse-pd/realtek,pse-mcu-gen1.yaml          | 7 +++++++
 1 file changed, 7 insertions(+)
#6 lore raw

PATCH 2/2 net: pse-pd: realtek-pse-mcu: add gen1 I2C transport

In reply to Sander Vanheule

Provide the required data for the gen1 raw I2C binding, which like for gen2 is simply the gen1 protocol data with the native_i2c flag set.

---
 drivers/net/pse-pd/realtek-pse-mcu-core.c | 8 +++++++-
 drivers/net/pse-pd/realtek-pse-mcu-i2c.c  | 1 +
 drivers/net/pse-pd/realtek-pse-mcu.h      | 1 +
 3 files changed, 9 insertions(+), 1 deletion(-)
drivers/net/pse-pd/realtek-pse-mcu-core.c +7 -1
index e64f13ea6e4e..c70b09ca2012 100644
@@ -986,7 +986,13 @@ const struct rtpse_mcu_match_data rtpse_mcu_gen2_data = {
 };
 EXPORT_SYMBOL_GPL(rtpse_mcu_gen2_data);
 
-/* Same dialect as gen2, but the MCU expects raw-I2C framing. */
+/* Same dialects as above, but the MCU expects raw-I2C framing. */
+const struct rtpse_mcu_match_data rtpse_mcu_gen1_i2c_data = {
+	.dialect = &rtpse_mcu_dialect_gen1,
+	.native_i2c = true,
+};
+EXPORT_SYMBOL_GPL(rtpse_mcu_gen1_i2c_data);
+
 const struct rtpse_mcu_match_data rtpse_mcu_gen2_i2c_data = {
 	.dialect = &rtpse_mcu_dialect_gen2,
 	.native_i2c = true,
drivers/net/pse-pd/realtek-pse-mcu-i2c.c +1 -0
index b6769ac1d470..bbded772eddf 100644
@@ -128,6 +128,7 @@ static int rtpse_mcu_i2c_probe(struct i2c_client *client)
 
 static const struct of_device_id rtpse_mcu_i2c_of_match[] = {
 	{ .compatible = "realtek,pse-mcu-gen1-smbus", .data = &rtpse_mcu_gen1_data },
+	{ .compatible = "realtek,pse-mcu-gen1-i2c", .data = &rtpse_mcu_gen1_i2c_data },
 	{ .compatible = "realtek,pse-mcu-gen2-smbus", .data = &rtpse_mcu_gen2_data },
 	{ .compatible = "realtek,pse-mcu-gen2-i2c", .data = &rtpse_mcu_gen2_i2c_data },
 	{ /* sentinel */ }
drivers/net/pse-pd/realtek-pse-mcu.h +1 -0
index d75e91669b8f..5e31dd0993dd 100644
@@ -88,6 +88,7 @@ struct rtpse_mcu_ctrl {
 int rtpse_mcu_register(struct rtpse_mcu_ctrl *pse);
 
 extern const struct rtpse_mcu_match_data rtpse_mcu_gen1_data;
+extern const struct rtpse_mcu_match_data rtpse_mcu_gen1_i2c_data;
 extern const struct rtpse_mcu_match_data rtpse_mcu_gen2_data;
 extern const struct rtpse_mcu_match_data rtpse_mcu_gen2_i2c_data;
 
Signature · 1 line
2.56.0
maintainer Acked-by on v1 2/2
#7 lore raw

Re: [PATCH net-next 2/2] net: pse-pd: realtek-pse-mcu: add gen1 I2C transport

Quoted 4 lines · Sander Vanheule

Provide the required data for the gen1 raw I2C binding, which like for gen2 is simply the gen1 protocol data with the native_i2c flag set.

Thank you!

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 |
maintainer Reviewed-by on the v1 series
#9 lore raw
In reply to Sander Vanheule
Quoted 8 lines · Sander Vanheule

While for the Gen2 protocol both a plain I2C transport and an SMBus transport were provided, Gen1 only got SMBus. The Unifi Switch Lite 16 PoE uses the Gen1 protocol to manage a single BCM59121, but does to using plain I2C.

These patches simply add a new compatible for the plain I2C transport and the associated match data. This is sufficient to let the existing code talk to the management MCU.

Thank you!

Quoted 10 lines

Sander Vanheule (2):
dt-bindings: net: pse-pd: realtek,pse: add gen1 I2C transport
net: pse-pd: realtek-pse-mcu: add gen1 I2C transport

  .../bindings/net/pse-pd/realtek,pse-mcu-gen1.yaml         | 7 +++++++
  drivers/net/pse-pd/realtek-pse-mcu-core.c                 | 8 +++++++-
  drivers/net/pse-pd/realtek-pse-mcu-i2c.c                  | 1 +
  drivers/net/pse-pd/realtek-pse-mcu.h                      | 1 +
  4 files changed, 16 insertions(+), 1 deletion(-)
Signature · 3 lines
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
#10 lore raw
In reply to Sander Vanheule
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Sun, 18 Oct 2026 18:12:46 +0200 you wrote:

While for the Gen2 protocol both a plain I2C transport and an SMBus transport were provided, Gen1 only got SMBus. The Unifi Switch Lite 16 PoE uses the Gen1 protocol to manage a single BCM59121, but does to using plain I2C.

These patches simply add a new compatible for the plain I2C transport and the associated match data. This is sufficient to let the existing code talk to the management MCU.

[...]

Here is the summary with links:
- [net-next,1/2] dt-bindings: net: pse-pd: realtek,pse: add gen1 I2C transport

    https://git.kernel.org/netdev/net-next/c/9e6df8d57ee5
  - [net-next,2/2] net: pse-pd: realtek-pse-mcu: add gen1 I2C transport
    https://git.kernel.org/netdev/net-next/c/ca4bd46de863

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html