Devicetree
 help / color / mirror / Atom feed
From: Kyle Swenson <kyle.swenson@est.tech>
To: "o.rempel@pengutronix.de" <o.rempel@pengutronix.de>,
	"kory.maincent@bootlin.com" <kory.maincent@bootlin.com>,
	"andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"edumazet@google.com" <edumazet@google.com>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"robh@kernel.org" <robh@kernel.org>,
	"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>
Cc: "Kyle Swenson" <kyle.swenson@est.tech>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Roland Kovács" <roland.kovacs@est.tech>,
	"David Nyström" <david.nystrom@est.tech>
Subject: [RFC PATCH net-next v2 0/2] net: pse-pd: Add LTC4266 PSE controller driver
Date: Thu, 20 Aug 2026 14:25:39 +0000	[thread overview]
Message-ID: <20260820142429.2285172-1-kyle.swenson@est.tech> (raw)

This RFC series intends to continue discussion around the support for
the LTC4266, an older PSE controller that supports powering Type 1 and
Type 2 PDs.

This chip has four individually controllable ports, each with its own
detection, classification and current-limiting abilities.  The driver
declares the static power budgeting strategy.

The LTC4266 only enforces a current limit (I_CUT and I_LIM), not a power
limit, so an admin power limit has to be turned into a current limit.
There are two problems that fall out of this I don't feel like I've got
a great solution to either and would welcome feedback, hence the 2nd RFC
version.

The first problem is programming the current limit from the
admin-specified power limit for power limits other than a specific PD
class.  For this, I replaced the linear regression in the first RFC with
the minimum port voltage for a Type 2 PSE (50V, from Table 33-11 in the
IEEE 802.3 spec) to convert power to current.

The second problem is that when the admin does something like

    ethtool --set-pse eth1 c33-pse-avail-pw-limit 10000

the command fails with:

    netlink error: Can't calculate the current, PSE voltage read is 0
    netlink error: Result not representable

unless the PSE port has been enabled first, and the PSE has detected and
classified a PD on that port.  I'm hopeful I'm just missing something I
can do differently in this driver, but if not I'm open to adjusting
things at other layers to support this.

---
RFC v1 -> RFC v2:
  - Rebase on net-next/main
  - Integrate and test with the PSE core's PSE_BUDGET_EVAL_STATIC.
  - ltc4266: Convert register access to the regmap API (replaces the
    open-coded read-modify-write helper and its explicit mutex).  Note
    the explicit mutex is gone because it only protected reading both the
    high and low bytes of a port's voltage/current.  This isn't actually
    needed because reading the LSB will latch the MSB until the MSB is
    read, so I2C transactions between the two reads are benign (Oleksij)
  - ltc4266: Rename LTC4266_ICUT_RSENSE to LTC4266_ICUT_RSENSE_025_OHM
    (Oleksij)
  - ltc4266: Rename the ILIM AF/AT constants to TYPE1/TYPE2 (IEEE 802.3
    terminology) (Oleksij)
  - ltc4266: Add kernel-doc to ltc4266_port_set_ilim() citing IEEE Std
    802.3-2022 Table 33-11 / Eq. (33-6) and the datasheet Table 5
    sense-resistor dependence (Oleksij)
  - ltc4266: Use the standard "2-event classification" term (IEEE
    802.3-2022, Clause 33) instead of the datasheet's "Ping-Pong" name
    (Oleksij)
  - ltc4266: Document the ltc4266_port_mode enum
    (SHUTDOWN/MANUAL/SEMI/AUTO).  The suggestion to treat any OPMD other
    than SHUTDOWN as ADMIN_STATE_ENABLED didn't really apply since the
    PSE core added the PSE_BUDGET_EVAL_STRAT_STATIC (Oleksij)
  - ltc4266: Return 0 from ltc4266_read_iv() rather than -EINVAL when the
    port is not delivering power, so an "ethtool --show-pse" query is not
    aborted, and clarify the "delivering power" wording (Oleksij)
  - ltc4266: Replace the I_CUT (18750, 0x3F, 850) and current/voltage
    (122070, 61035, 5835) magic numbers with named defines (Oleksij)
  - dt-bindings: Drop the blank line after "channels:" (Krzysztof)
  - dt-bindings: Move the channels "description" after
    "additionalProperties" so the structural keywords stay together
    (Krzysztof)
  - dt-bindings: Drop the blank line before "type: object" (Krzysztof)
  - dt-bindings: Collapse the double blank line before
    "patternProperties" to one (Krzysztof)
  - dt-bindings: Use single quotes consistently for
    '#address-cells'/'#size-cells' (Krzysztof)
  - dt-bindings: Move "unevaluatedProperties: false" after the top-level
    "required" block (Krzysztof)
  - dt-bindings: Drop 'status = "okay";' from the example and tidy the
    surrounding blank lines, including separating the channels and
    pse-pis nodes (Krzysztof)
  - dt-bindings: Reword the channels description based on the review in
    [1] (Kory)

[1] https://lore.kernel.org/netdev/20250517003525.2f6a5005@kmaincent-XPS-13-7390/
RFC v1: https://lore.kernel.org/netdev/20250603230422.2553046-1-kyle.swenson@est.tech/

Kyle Swenson (2):
  dt-bindings: net: pse-pd: Add bindings for LTC4266 PSE Controller
  net: pse-pd: Add LTC4266 PSE controller driver

 .../bindings/net/pse-pd/lltc,ltc4266.yaml     |  180 +++
 drivers/net/pse-pd/Kconfig                    |   11 +
 drivers/net/pse-pd/Makefile                   |    1 +
 drivers/net/pse-pd/ltc4266.c                  | 1305 +++++++++++++++++
 4 files changed, 1497 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/pse-pd/lltc,ltc4266.yaml
 create mode 100644 drivers/net/pse-pd/ltc4266.c

-- 
2.55.0

             reply	other threads:[~2026-08-20 14:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-20 14:25 Kyle Swenson [this message]
2026-08-20 14:25 ` [RFC PATCH net-next v2 1/2] dt-bindings: net: pse-pd: Add bindings for LTC4266 PSE Controller Kyle Swenson
2026-08-20 14:25 ` [RFC PATCH net-next v2 2/2] net: pse-pd: Add LTC4266 PSE controller driver Kyle Swenson

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=20260820142429.2285172-1-kyle.swenson@est.tech \
    --to=kyle.swenson@est.tech \
    --cc=andrew+netdev@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=david.nystrom@est.tech \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.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 \
    --cc=roland.kovacs@est.tech \
    /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