πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #11895

Re: [PATCH net-next 3/4] net: pse-pd: realtek-pse-mcu: configure global power budget

#11895
From: Sander Vanheule
Date: Thu, 05 Nov 2026 21:54
200 lines
17637 bytes
Hi Kory,

On Wed, 2026-11-04 at 13:36 +0100, Kory Maincent wrote:
> 
> 
> On 11/4/26 13:20, Jonas Jelonek wrote:
> > Hi Kory,
> > 
> > On 04.11.26 12:32, Kory Maincent wrote:
> > > 
> > > 
> > > On 11/3/26 23:03, Jonas Jelonek wrote:
> > > > Use the optional VMAIN regulator power budget to configure the MCU's
> > > > aggregate PoE power limit during probe. Quantize the available budget to
> > > > the protocol's 100 mW units and reserve exactly that amount through the
> > > > regulator core.
> > > > 
> > > > The regulator budget represents the usable PoE allowance. Program zero
> > > > reserved power so the previous firmware guard band does not further
> > > > reduce
> > > > that allowance.
> > > > 
> > > > Require a finite budget of at least one protocol unit when vmain-supply
> > > > is
> > > > provided. Program the budget before selecting dynamic power management
> > > > and
> > > > ungating the ports, so enforcement starts with the regulator-derived
> > > > limit.
> > > > 
> > > > Enable VMAIN before hardware initialization and register one managed
> > > > cleanup
> > > > action to free any reserved budget and release the enable reference on
> > > > probe
> > > > failure and driver removal. Record each successful reservation
> > > > immediately
> > > > so subsequent initialization failures are covered by this action.
> > > > 
> > > > Read the current budget index before programming the MCU. Retain the
> > > > programmed MCU limit on probe failure and driver removal, as reducing
> > > > that
> > > > limit to zero would interrupt ongoing power delivery.
> > > > 
> > > > Boards without vmain-supply retain their existing firmware-managed
> > > > budget.
> > > > 
> > > > Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
> > > > ---
> > > 
> > > ...
> > > 
> > > > Β Β  +static void rtpse_mcu_cleanup_vmain(void *data)
> > > > +{
> > > > +Β Β Β  struct rtpse_mcu_ctrl *pse = data;
> > > > +
> > > > +Β Β Β  if (pse->requested_budget_mW)
> > > > +Β Β Β Β Β Β Β  regulator_free_power_budget(pse->vmain, pse-
> > > > >requested_budget_mW);
> > > > +Β Β Β  regulator_disable(pse->vmain);
> > > > +}
> > > 
> > > Following patch 4 logic, you might not want to disable the PSE controller
> > > power supply,
> > 
> > I added it because of the requirement that regulator_enable() calls must be
> > balanced with regulator_disable() calls. Accepting that this may power off
> > the
> > rail in theory, something outside of the driver would need to keep the
> > supply
> > enabled. Concretely, I'm thinking of "regulator-always-on". And all boards
> > I've seen so far which can use this driver do not provide a provide to
> > really
> > power off the PoE rail. Sure this is no finite guarantee.
> > 
> > What is the correct way? I see either droping the enable call too, just
> > relying on
> > that it is correctly handled outside of this driver, or I keep enable +
> > disable and
> > the continued delivery is ensured with "regulator-always-on".
> 
> Indeed if you use "regulator-always-on" it does not turn off the power 
> supply when we call regulator_disable().
> https://elixir.bootlin.com/linux/v7.3/source/drivers/regulator/core.c#L3269
> 
> Does the PSE controller needs this supply to start, or is it only 
> required to power the PSE PIs?
> 
> If it is the first you will need to enable it in the driver.
> If it's the latter, you could describe it as the PI's regulator parent 
> supply. An enable of any PI will enable this vmain regulator.

I'm not sure if you've seen a diagram before, but allow me to add one to show
what the binding currently models (for a UART controlled MCU):

              β–²Vdd     β–²Vpwr                          
        β”Œβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”            
        β”‚     β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”     β”‚            
        β”‚  β”Œβ”€β”€β”΄β”€β”€β”€β”€β”   β”‚       β”‚β”Œβ”€β”€β”΄β”€β”€β”€β” β”‚            
      ──┼─►─RX  SDAβ”œβ”€β”€β”€β”Όβ”€β”€β”€β”€β”¬β”€β”€β”Όβ”€      β”œβ”€β”Όβ”€β”€β”€β–Ί PSE-PI0
      ◄─┼-──TX  SCLβ”œβ”€β”€β”€β”Όβ”€β”€β”€β”¬β”Όβ”€β”€β”Όβ”€      β”œβ”€β”Όβ”€β”€β”€β–Ί PSE-PI1
        β”‚  β”‚       β”‚   β”‚   β”‚β”‚  β”‚β”‚      β”œβ”€β”Όβ”€β”€β”€β–Ί PSE-PI2
        β”‚  β”‚MCU    β”‚   β”œβ”€β”€β”€β”Όβ”Όβ”€β”€β”Όβ”€PSE-0 β”œβ”€β”Όβ”€β”€β”€β–Ί PSE-PI3
        β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚   β”‚β”‚  β”‚β””β”€β”€β”€β”€β”€β”€β”˜ β”‚            
        β”‚              β”‚   β”‚β”‚  └───┐     β”‚            
        β”‚              β”‚   β”‚β”‚   β”Œβ”€β”€β”΄β”€β”€β”€β” β”‚            
        β”‚              β”‚   │└────      β”œβ”€β”Όβ”€β”€β”€β–Ί PSE-PI4
        β”‚              β”‚   └─────      β”œβ”€β”Όβ”€β”€β”€β–Ί PSE-PI5
        β”‚              β”‚        β”‚      β”œβ”€β”Όβ”€β”€β”€β–Ί PSE-PI6
        β”‚              └─────────PSE-1 β”œβ”€β”Όβ”€β”€β”€β–Ί PSE-PI7
        β”‚realtek,pse-mcu-gen1   β””β”€β”€β”€β”€β”€β”€β”˜ β”‚            
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜            


The outer box is what is modeled by the binding, but really consists of at least
two chips on the board. The "vpwr-supply" (Vpwr) of the PSE PIs is controlled by
the PSE-n ICs. The MCU doesn't use Vpwr and doesn't control it directly, but has
to do this via the PSE controllers. This is similar to a PD69200 setup.

Like Jonas said, Vpwr is usually (always) an always-on power supply, which
matches well with "regulator-always-on". Vdd is the supply that actually powers
the logic, but that is normally also not a switchable supply and hence not
modeled by the devicetrees describing these PoE switches.

This proposal adds Vpwr as "vmain-supply" on the main DT node, but I suppose
that also means it should not be used for "vpwr-supply" on the PI subnodes?

Would it make sense to model realtek,pse-mcu as a regulator as well and have
"vpwr-supply" PI properties point there (instead of the fixed regulator)?
AFAICT that's similar to the approach taken by the microchip,pd692x0 binding,
where the PI nodes point to a manager. But I also don't know if that offers any
advantages here.

Best,
Sander
Technical Details
Message-ID: <86b137d440c29b92ea56a69fa6ad27970090f126.camel@svanheule.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-357627-linux-kernel-netdev=dewy.ru
References: <20261103220312.860629-1-jonas@jonasjelonek.de> <20261103220312.860629-4-jonas@jonasjelonek.de> <5e00fd7f-40f9-4041-8dfa-fff222b57b92@bootlin.com> <e0910567-999c-4c96-9b20-2e34434bec3d@jonasjelonek.de> <357f6311-7f00-42c3-8eec-e0fd0c35749e@bootlin.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-357627-linux-kernel-netdev=dewy.ru
From: sander@svanheule.net (Sander Vanheule)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next 3/4] net: pse-pd: realtek-pse-mcu: configure
 global power budget
Date: Thu, 05 Nov 2026 22:54:37 +0100
Organization: Usenet Network
Message-ID: <86b137d440c29b92ea56a69fa6ad27970090f126.camel@svanheule.net>
References: <20261103220312.860629-1-jonas@jonasjelonek.de>
	 <20261103220312.860629-4-jonas@jonasjelonek.de>
	 <5e00fd7f-40f9-4041-8dfa-fff222b57b92@bootlin.com>
	 <e0910567-999c-4c96-9b20-2e34434bec3d@jonasjelonek.de>
	 <357f6311-7f00-42c3-8eec-e0fd0c35749e@bootlin.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="3739507"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:h44Bcy/rYLs3jAac21L+tAfZT8Q= sha256:lEz2BHh0Ebdp6emH7rGgxBZ3kwEGLBt/iodntkirfVM=
	sha1:lcI0MIbPaFXG3QZwBN28wLDfJKw= sha256:ASAf+1aB+j9Wr4t8WKInv5lBzfLuGYjR1mk1dTwaX1o=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id AB4611130C2; Fri,  6 Nov 2026 01:00:03 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=svanheule.net
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id EIbsX0mKKPIY;
	Fri,  6 Nov 2026 00:59:55 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-357627-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=svanheule.net
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id EB2691130CC; Fri,  6 Nov 2026 00:59:45 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id C60E12E2AC; Thu,  5 Nov 2026 21:54:43 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793915681;
	b=1ifSm+I+vdZAD88yIjLQ3AdfjbhAlm0DWO0gBnNlg1vXQhjKhFOodwxylMyIoGDz4N1w
	 PTk03bDz/CO+D1juFonnL7E+7oILu1LkL6SUT9jvxo6gcNddwtNkj8uMJpZqM23gRsBvR
	 bMh85WxLNOKC7IQhIBkeUMLvmSb9zihRTq1pE9zuWT1JdqYQ8tpqrxpzscBpW0ndowPgM
	 9fYTWSs99G7sxoyCEaPcvhAw8X+x0FhG/EgQSn6Um4ApB5wB7uTuU8f7jxCUpAg+9p3/W
	 0hCqpVwpQhQXrFH81mBf8O1Em7qD6TnoBaon/uglNimA/ltS9RqwOdk+b6dg04f7qMA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793915681;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References:
	 Content-Type:Content-Transfer-Encoding:User-Agent:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence:MIME-Version;
	bh=UDf0ZD2mFU/9VOS9NrkMQ2SrgMQ/8BOQ9ZjvvF58EJ8=;
	b=k3I3m9woywRYlz3pcOyajEPMxru/W10bqI2kOpQw8tFyiADjvzg4C/Mro0FcaMQVlc68
	 EBj/qh+pzukNNaiSlBJj4wmbKJfYYMSs4OLiIhec8uef/VzMjGjju135OyxI1VOpEAnik
	 CBaAX8Y1m5H6Q9IxzZqhmFCWFMOJPj+8cIgNL2FvDmU9gcdb022okTKu/A5Aj22fO9f/o
	 keWbLWEqwj6VreVhzfUUdBKawWlHA+Tua9RBFFgFNjB1+tXQP5QX3fqFsmPyNtXxvov35
	 qgZ+w5fbeorZ37Qn/FN1ij4QpacCwdyWyOuUsqMnfUbKnR1EPrhR+75BEgOiZHFH/eA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=svanheule.net header.i=@svanheule.net header.a=rsa-sha256 header.s=mail1707 header.b=A5nstH6R;
	dmarc=pass header.from=svanheule.net;
	spf=pass smtp.mailfrom=svanheule.net;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id B6EA2606A31B;
	Thu,  5 Nov 2026 21:54:41 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=svanheule.net header.i=@svanheule.net header.a=rsa-sha256 header.s=mail1707 header.b=A5nstH6R
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=84.16.241.116
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793915680;
	b=lPSFSkMVHtqIYtrK24R6n4Df2ILWeQygjhxxeuuFiMRMj9IC4BBqTEVhWC9jtum1fZcV
	 Kot8ZkmLmrW0/BAWLfDsgTniOGj6JInwD+WOjdwsDrV00y0+pJA4WSSOnjEq5e5ZvkSdx
	 RYqR/76FQVKsAiL0XBl2HJYi4h2Ha9KWmGFUrOyTq6bBJNZ0ds+Xp7QunVb1OxWqqMlNn
	 OPXhW4go4VjpJUdabpDtmbibjUcVdQ8pK6VSfCbW0voFTKf6DB3kNBsy+prRZ5dbGtj3m
	 w69a1SJQE9/556O2C8IewnAXZuj4AKl2qzDQGP7hDAD8pG5IYLnq8KeHA/4trFFFkJw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793915680;
	h=DMARC-Filter:Received:DKIM-Signature:Message-ID:Subject:From:To:Cc:
	 Date:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:
	 User-Agent:MIME-Version;
	bh=UDf0ZD2mFU/9VOS9NrkMQ2SrgMQ/8BOQ9ZjvvF58EJ8=;
	b=KeDmLDGhl8rZ+iqQ/Zz+ztCTTBg3Tl+tNjeC4LV/D3f0kej3kWaQoZVjmXma91JEx2hu
	 2wGs4AB78kYDtMtaxpYpUoTeSvvfuuRF4bGSGU/kGxfy8XpPajuq/lktn77B0vOmSlMZe
	 WscE/I6nH09LA831DbjbYac0mTUuEILkBZIAJhrJJeGGqpIFHrV9p0KfqkhtKLtevGTQ+
	 agJoXFhID+AJhj6otrPRJStiKScD9vTLKL4Xs3FsNMAogxpnKm/zavdg7utv89y/k6j4G
	 4PaBqvMXgc7PB9jQL8vFX0JG+XQbsl/WG2q8Zbint+B8icE4uPTSKl4h7DkBY+3qd1w==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=svanheule.net;
	spf=pass smtp.mailfrom=svanheule.net;
	dkim=pass header.d=svanheule.net header.i=@svanheule.net header.a=rsa-sha256 header.s=mail1707 header.b=A5nstH6R;
	arc=none smtp.remote-ip=84.16.241.116
X-Received: from polaris.svanheule.net (polaris.svanheule.net [84.16.241.116])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 24A0E606A32D
	for <netdev@vger.kernel.org>; Thu,  5 Nov 2026 21:54:40 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 24A0E606A32D
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=svanheule.net
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=svanheule.net
X-Received: from [IPv6:2a02:1812:1620:5d00:3b08:a3e3:d87d:2eff] (2a02-1812-1620-5d00-3b08-a3e3-d87d-2eff.ip6.access.telenet.be [IPv6:2a02:1812:1620:5d00:3b08:a3e3:d87d:2eff])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	(Authenticated sender: sander@svanheule.net)
	by polaris.svanheule.net (Postfix) with ESMTPSA id D253A9D45BC;
	Thu,  5 Nov 2026 22:54:37 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svanheule.net;
	s=mail1707; t=1793915678;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=UDf0ZD2mFU/9VOS9NrkMQ2SrgMQ/8BOQ9ZjvvF58EJ8=;
	b=A5nstH6R9AxornaFbk3UsYO8XlNim0DtyFZTX/wxXmLmqw5kxDYxl7Vp1rT0WkaJSalDkN
	8EYZOO/vi/cpjE0hBzJ96TYeqXzs8Ugn3RENiq7oJYog9vadAQSEt6FsXRQOATBUKP9ePu
	D8uzYyET6KCOMHBrt+wxN2kajv97L405LbjngitAtGlDrOQvIcl6zS8WxPO54XaVmtFeFx
	4sN83+r0t3FTosgK1OJO8HcA/9zN/BLVaaPS4K3IqMM2dPxWvtW986GWyB8B9tAOGqs3EM
	9M647qxE3EFF/0r1yYln20FbmsxUcUAaw80FRoNAp0LXZ/fhJD39DrscfnAaDg==
X-Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Russell Senior
	 <russell@personaltelco.net>
X-In-Reply-To: <357f6311-7f00-42c3-8eec-e0fd0c35749e@bootlin.com>
X-User-Agent: Evolution 3.60.2 (3.60.2-3.fc44) 
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list