* [PATCH net] net: pse-pd: realtek-pse-mcu: ensure MCU does dynamic power management
@ 2026-11-29 23:46 Jonas Jelonek
2026-11-29 23:48 ` netdev-bot+sinfo
0 siblings, 1 reply; 3+ messages in thread
From: Jonas Jelonek @ 2026-11-29 23:46 UTC (permalink / raw)
To: Oleksij Rempel, Kory Maincent, Andrew Lunn, David S . Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev
Cc: linux-kernel, Russell Senior, Jonas Jelonek
From: Russell Senior <russell@personaltelco.net>
The MCU may have any power management mode configuration by default
but the driver should ensure that the MCU performs dynamic power
management with priorities as advertised. On certain devices, the
default MCU configuration ships with another default, possibly
preventing any power delivery.
Both protocol generations define the mode-setting command, and no
firmware lacking it is known. Fail probe if the command fails rather
than register a controller advertising dynamic power management without
having established that policy in the MCU.
Select the mode before deasserting the hardware port gate, so a failure
to establish the management policy does not ungate the ports.
Fixes: 44566e614d84 ("net: pse-pd: add Realtek PSE MCU core")
Signed-off-by: Russell Senior <russell@personaltelco.net>
[jonas@jonasjelonek.de: adjust commit message, macro naming and comment;
shorten command and helper names to "mgmt"; change error handling; select
the mode before ungating ports; set dynamic mode with priorities directly
in the helper]
Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
---
drivers/net/pse-pd/realtek-pse-mcu-core.c | 36 +++++++++++++++++++++--
1 file changed, 34 insertions(+), 2 deletions(-)
diff --git a/drivers/net/pse-pd/realtek-pse-mcu-core.c b/drivers/net/pse-pd/realtek-pse-mcu-core.c
index c70b09ca2012..e382045932e9 100644
--- a/drivers/net/pse-pd/realtek-pse-mcu-core.c
+++ b/drivers/net/pse-pd/realtek-pse-mcu-core.c
@@ -68,10 +68,14 @@
/* Nominal PSE rail; 802.3at/bt operating range. */
#define RTPSE_MCU_PSE_VOLTAGE_UV 54000000
+/* RTPSE_MCU_CMD_SET_POWER_MGMT_MODE values */
+#define RTPSE_MCU_POWER_MGMT_DYNAMIC_PRIO 0x02 /* dynamic, with port priority */
+
enum rtpse_mcu_cmd {
RTPSE_MCU_CMD_SET_GLOBAL_STATE,
RTPSE_MCU_CMD_GET_SYSTEM_INFO,
RTPSE_MCU_CMD_GET_EXT_CONFIG,
+ RTPSE_MCU_CMD_SET_POWER_MGMT_MODE,
RTPSE_MCU_CMD_PORT_ENABLE,
RTPSE_MCU_CMD_PORT_SET_POWER_LIMIT_TYPE,
@@ -369,6 +373,26 @@ static int rtpse_mcu_set_global_state(struct rtpse_mcu_ctrl *pse, bool enable)
return (resp.payload[0] == 0x0) ? 0 : -EIO;
}
+static int rtpse_mcu_set_power_mgmt_mode(struct rtpse_mcu_ctrl *pse)
+{
+ struct rtpse_mcu_msg req, resp;
+ const struct rtpse_mcu_opcode *opc;
+ int ret;
+
+ opc = &pse->dialect->opcode[RTPSE_MCU_CMD_SET_POWER_MGMT_MODE];
+ if (!opc->valid)
+ return -EOPNOTSUPP;
+
+ rtpse_mcu_msg_init(&req, opc->op);
+ req.payload[0] = RTPSE_MCU_POWER_MGMT_DYNAMIC_PRIO;
+
+ ret = rtpse_mcu_do_xfer(pse, &req, &resp);
+ if (ret)
+ return ret;
+
+ return (resp.payload[0] == 0x0) ? 0 : -EIO;
+}
+
/* Port operations */
static int rtpse_mcu_port_get_status(struct rtpse_mcu_ctrl *pse, unsigned int port,
@@ -826,10 +850,16 @@ int rtpse_mcu_register(struct rtpse_mcu_ctrl *pse)
if (ret)
return ret;
+ /* ensure the MCU does dynamic power management with priorities */
+ ret = rtpse_mcu_set_power_mgmt_mode(pse);
+ if (ret)
+ return dev_err_probe(pse->dev, ret,
+ "failed to set power management mode\n");
+
/*
* Some boards gate all ports through a hardware line; deassert it only
- * after the MCU is confirmed, so a discover failure never ungates the
- * ports. It is then left to the MCU - not re-gated on unbind or a later
+ * after discovery and management-mode selection succeed.
+ * It is then left to the MCU - not re-gated on unbind or a later
* probe error - so a driver reload doesn't black out PoE.
*/
gpiod = devm_gpiod_get_optional(pse->dev, "disable-ports", GPIOD_OUT_LOW);
@@ -944,6 +974,7 @@ static const struct rtpse_mcu_dialect rtpse_mcu_dialect_gen2 = {
[RTPSE_MCU_CMD_SET_GLOBAL_STATE] = RTPSE_MCU_OP(0x00),
[RTPSE_MCU_CMD_GET_SYSTEM_INFO] = RTPSE_MCU_OP(0x40),
[RTPSE_MCU_CMD_GET_EXT_CONFIG] = RTPSE_MCU_OP(0x4a),
+ [RTPSE_MCU_CMD_SET_POWER_MGMT_MODE] = RTPSE_MCU_OP(0x10),
[RTPSE_MCU_CMD_PORT_ENABLE] = RTPSE_MCU_OP(0x01),
[RTPSE_MCU_CMD_PORT_SET_POWER_LIMIT_TYPE] = RTPSE_MCU_OP(0x12),
@@ -964,6 +995,7 @@ static const struct rtpse_mcu_dialect rtpse_mcu_dialect_gen1 = {
.opcode = {
[RTPSE_MCU_CMD_GET_SYSTEM_INFO] = RTPSE_MCU_OP(0x20),
[RTPSE_MCU_CMD_GET_EXT_CONFIG] = RTPSE_MCU_OP(0x2b),
+ [RTPSE_MCU_CMD_SET_POWER_MGMT_MODE] = RTPSE_MCU_OP(0x17),
[RTPSE_MCU_CMD_PORT_ENABLE] = RTPSE_MCU_OP(0x00),
[RTPSE_MCU_CMD_PORT_SET_POWER_LIMIT_TYPE] = RTPSE_MCU_OP(0x15),
base-commit: fad0d57b12f6979bc0127f0a4f704c6d7177ca78
--
2.53.0
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net] net: pse-pd: realtek-pse-mcu: ensure MCU does dynamic power management
2026-11-29 23:46 [PATCH net] net: pse-pd: realtek-pse-mcu: ensure MCU does dynamic power management Jonas Jelonek
@ 2026-11-29 23:48 ` netdev-bot+sinfo
2026-11-30 0:25 ` Russell Senior
0 siblings, 1 reply; 3+ messages in thread
From: netdev-bot+sinfo @ 2026-11-29 23:48 UTC (permalink / raw)
To: Jonas Jelonek
Cc: Oleksij Rempel, Kory Maincent, Andrew Lunn, David S . Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel,
Russell Senior
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during
development, syzbot report, manual code inspection, LLM or static
analysis tool scan.
- Whether the issue was actually triggered, or is only theoretical
(e.g. found by LLM and not proven at runtime). If it was triggered
please include the symptoms, like the stack trace or kernel messages.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.
*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
--
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: pse-pd: realtek-pse-mcu: ensure MCU does dynamic power management
2026-11-29 23:48 ` netdev-bot+sinfo
@ 2026-11-30 0:25 ` Russell Senior
0 siblings, 0 replies; 3+ messages in thread
From: Russell Senior @ 2026-11-30 0:25 UTC (permalink / raw)
To: netdev-bot+sinfo
Cc: Jonas Jelonek, Oleksij Rempel, Kory Maincent, Andrew Lunn,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netdev, linux-kernel
On Sun, Nov 29, 2026 at 3:48 PM <netdev-bot+sinfo@kernel.org> wrote:
>
> Hi!
>
> This is an automated message. This series looks like a fix, but its
> commit messages seem to be missing some information:
>
> - How the issue was discovered, e.g. hit in production, hit during
> development, syzbot report, manual code inspection, LLM or static
> analysis tool scan.
It was discovered during development by a human.
>
> - Whether the issue was actually triggered, or is only theoretical
> (e.g. found by LLM and not proven at runtime). If it was triggered
> please include the symptoms, like the stack trace or kernel messages.
As I recall, the symptoms were that poe didn't work, which led to an
investigation of what the vendor firmware did. This was the thing that
fixed it.
--
Russell Senior
russell@personaltelco.net
>
> Please do not repost the series just to address the above. Instead,
> reply to this email with the missing information, so that reviewers
> can take it into account.
>
> *IMPORTANT*: If you do repost (for other reasons) - please include
> the relevant info in the cover letter or commit messages.
> --
> The evaluation is done by an LLM so it may be wrong, if you think
> that is the case please reply and explain.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-30 0:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-29 23:46 [PATCH net] net: pse-pd: realtek-pse-mcu: ensure MCU does dynamic power management Jonas Jelonek
2026-11-29 23:48 ` netdev-bot+sinfo
2026-11-30 0:25 ` Russell Senior
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®