Skip to contentSkip to conversation

net: Add support for Power over Ethernet (PoE)

PATCH Superseded Kory Maincent 4 participants 46 messages Feb 8, 2024 – Feb 19, 2024

Subsystems (9)

v3 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Kory Maincent

author maintainer
#0 lore raw

v3 cover net: Add support for Power over Ethernet (PoE)

This patch series aims at adding support for PoE (Power over Ethernet), based on the already existing support for PoDL (Power over Data Line) implementation. In addition, it adds support for two specific PoE controller, the Microchip PD692x0 and the TI TPS23881.

In detail:
- Patch 1 to 13 prepare net to support PoE devices.
- Patch 14 and 15 add PD692x0 PoE PSE controller driver and its binding.
- Patch 16 and 17 add TI TPS23881 PSE controller driver and its binding.

Changes in v2:
- Extract "firmware_loader: Expand Firmware upload error codes patches" to send it alone and get it merge in an immutable branch.
- Add "c33" prefix for PoE variables and enums.
- Enhance few comments.
- Add PSE Documentation.
- Make several changes in pd692x0 driver, mainly for readibility.
- Link to v1: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Add patches to add Oleksij and myself to PSE MAINTAINERS.
- Add patches to add pse devlink.
- Add TI TPS23881 PSE controller driver with its binding.
- Replace pse_get_types helper by pse_has_podl and pse_has_c33
- Changed the PSE core bindings.
- Add a setup_pi_matrix callback.
- Register regulator for each PSE PI (Power Interface).
- Changed the PD692x0 bindings.
- Updated PD692x0 drivers to new bindings and PSE PI description.
- Updated PD692x0 drivers according to the reviews and made fixes.
- Link to v2: https://lore.kernel.org/r/[email protected]

---
Kory Maincent (17):
MAINTAINERS: net: Add Oleksij to pse-pd maintainers
of: property: Add fw_devlink support for pse parent
net: pse-pd: Rectify and adapt the naming of admin_cotrol member of struct pse_control_config
ethtool: Expand Ethernet Power Equipment with c33 (PoE) alongside PoDL
net: pse-pd: Introduce PSE types enumeration
net: ethtool: pse-pd: Expand pse commands with the PSE PoE interface
netlink: specs: Modify pse attribute prefix
netlink: specs: Expand the pse netlink command with PoE interface
MAINTAINERS: Add myself to pse networking maintainer
dt-bindings: net: pse-pd: Add another way of describing several PSE PIs
net: pse-pd: Add support for PSE PIs
net: pse-pd: Add support for setup_pi_matrix callback
net: pse-pd: Use regulator framework within PSE framework
dt-bindings: net: pse-pd: Add bindings for PD692x0 PSE controller
net: pse-pd: Add PD692x0 PSE controller driver
dt-bindings: net: pse-pd: Add bindings for TPS23881 PSE controller
net: pse-pd: Add TI TPS23881 PSE controller driver

 .../bindings/net/pse-pd/microchip,pd692x0.yaml     |  157 +++
 .../bindings/net/pse-pd/pse-controller.yaml        |  101 +-
 .../bindings/net/pse-pd/ti,tps2388x.yaml           |  112 ++
 Documentation/netlink/specs/ethtool.yaml           |   33 +-
 Documentation/networking/ethtool-netlink.rst       |   20 +
 Documentation/networking/index.rst                 |    1 +
 Documentation/networking/pse-pd/index.rst          |    9 +
 Documentation/networking/pse-pd/introduction.rst   |   73 ++
 MAINTAINERS                                        |    8 +
 drivers/net/mdio/fwnode_mdio.c                     |   29 +-
 drivers/net/pse-pd/Kconfig                         |   20 +
 drivers/net/pse-pd/Makefile                        |    2 +
 drivers/net/pse-pd/pd692x0.c                       | 1223 ++++++++++++++++++++
 drivers/net/pse-pd/pse_core.c                      |  491 +++++++-
 drivers/net/pse-pd/pse_regulator.c                 |   49 +-
 drivers/net/pse-pd/tps23881.c                      |  818 +++++++++++++
 drivers/of/property.c                              |    2 +
 include/linux/pse-pd/pse.h                         |   89 +-
 include/uapi/linux/ethtool.h                       |   43 +
 include/uapi/linux/ethtool_netlink.h               |    3 +
 include/uapi/linux/pse.h                           |   23 +
 net/ethtool/pse-pd.c                               |   60 +-
 22 files changed, 3246 insertions(+), 120 deletions(-)

---
base-commit: 05f5c48cfac2335df9bb76fb6d49703670ce8b00
change-id: 20231024-feature_poe-139490e73403

Best regards,

Signature · 3 lines
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
author maintainer
#1 lore raw

PATCH v3 1/17 MAINTAINERS: net: Add Oleksij to pse-pd maintainers

Oleksij was the first to add support for pse-pd net subsystem. Add himself to the maintainers seems logical.

---

Changes in v3:
- New patch

---
 MAINTAINERS | 7 +++++++
 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
index 3f465fd778b1..2dcf48948d2b 100644
@@ -17668,6 +17668,13 @@ F:	include/net/psample.h
 F:	include/uapi/linux/psample.h
 F:	net/psample
 
+PSE NETWORK DRIVER
+M:	Oleksij Rempel <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/net/pse-pd/
+F:	drivers/net/pse-pd/
+
 PSTORE FILESYSTEM
 M:	Kees Cook <[email protected]>
 R:	Tony Luck <[email protected]>
Signature · 1 line
2.25.1
maintainer
#2 lore raw

Re: [PATCH net-next v3 01/17] MAINTAINERS: net: Add Oleksij to pse-pd maintainers

Quoted 5 lines · Kory Maincent

Oleksij was the first to add support for pse-pd net subsystem. Add himself to the maintainers seems logical.

Oleksij, are you O.K. with this? It would be good to Acked-by: it.

Andrew

maintainer Acked-by
#3 lore raw

Re: [PATCH net-next v3 01/17] MAINTAINERS: net: Add Oleksij to pse-pd maintainers

Quoted 6 lines · Andrew Lunn
Quoted 5 lines · Kory Maincent

Oleksij was the first to add support for pse-pd net subsystem. Add himself to the maintainers seems logical.

Quoted 5 lines

Oleksij, are you O.K. with this? It would be good to Acked-by: it.

Andrew

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 |
author maintainer
#4 lore raw

PATCH v3 2/17 of: property: Add fw_devlink support for pse parent

In reply to Kory Maincent

This allows fw_devlink to create device links between consumers of a PSE and the supplier of the PSE.

---

Changes in v3:
- New patch

---
 drivers/of/property.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/of/property.c +2 -0
index 641a40cf5cf3..efe4dde65f30 100644
@@ -1269,6 +1269,7 @@ DEFINE_SIMPLE_PROP(leds, "leds", NULL)
 DEFINE_SIMPLE_PROP(backlight, "backlight", NULL)
 DEFINE_SIMPLE_PROP(panel, "panel", NULL)
 DEFINE_SIMPLE_PROP(msi_parent, "msi-parent", "#msi-cells")
+DEFINE_SIMPLE_PROP(pses, "pses", "#pse-cells")
 DEFINE_SUFFIX_PROP(regulators, "-supply", NULL)
 DEFINE_SUFFIX_PROP(gpio, "-gpio", "#gpio-cells")
 
@@ -1359,6 +1360,7 @@ static const struct supplier_bindings of_supplier_bindings[] = {
 	{ .parse_prop = parse_backlight, },
 	{ .parse_prop = parse_panel, },
 	{ .parse_prop = parse_msi_parent, },
+	{ .parse_prop = parse_pses, },
 	{ .parse_prop = parse_gpio_compat, },
 	{ .parse_prop = parse_interrupts, },
 	{ .parse_prop = parse_regulators, },
Signature · 1 line
2.25.1
maintainer Reviewed-by on v3 2/17
#5 lore raw

Re: [PATCH net-next v3 02/17] of: property: Add fw_devlink support for pse parent

Quoted 2 lines · Kory Maincent

This allows fw_devlink to create device links between consumers of a PSE and the supplier of the PSE.

It will be interesting to see how this turns out. fw_devlink often gets itself into knots with MAC and PHY dependencies sometimes being circular. If we get a PSE on an MDIO bus, this is going to get even more interesting.

Quoted 2 lines

Andrew

author maintainer
#6 lore raw

PATCH v3 3/17 net: pse-pd: Rectify and adapt the naming of admin_cotrol member of struct pse_control_config

In reply to Kory Maincent

In commit 18ff0bcda6d1 ("ethtool: add interface to interact with Ethernet Power Equipment"), the 'pse_control_config' structure was introduced, housing a single member labeled 'admin_cotrol' responsible for maintaining the operational state of the PoDL PSE functions.

A noticeable typographical error exists in the naming of this field ('cotrol' should be corrected to 'control'), which this commit aims to rectify.

Furthermore, with upcoming extensions of this structure to encompass PoE functionalities, the field is being renamed to 'podl_admin_state' to distinctly indicate that this state is tailored specifically for PoDL."

---
 drivers/net/pse-pd/pse_regulator.c | 8 ++++----
 include/linux/pse-pd/pse.h         | 4 ++--
 net/ethtool/pse-pd.c               | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/pse-pd/pse_regulator.c +4 -4
index e2bf8306ca90..1dedf4de296e 100644
@@ -31,10 +31,10 @@ pse_reg_ethtool_set_config(struct pse_controller_dev *pcdev, unsigned long id,
 	struct pse_reg_priv *priv = to_pse_reg(pcdev);
 	int ret;
 
-	if (priv->admin_state == config->admin_cotrol)
+	if (priv->admin_state == config->podl_admin_control)
 		return 0;
 
-	switch (config->admin_cotrol) {
+	switch (config->podl_admin_control) {
 	case ETHTOOL_PODL_PSE_ADMIN_STATE_ENABLED:
 		ret = regulator_enable(priv->ps);
 		break;
@@ -43,14 +43,14 @@ pse_reg_ethtool_set_config(struct pse_controller_dev *pcdev, unsigned long id,
 		break;
 	default:
 		dev_err(pcdev->dev, "Unknown admin state %i\n",
-			config->admin_cotrol);
+			config->podl_admin_control);
 		ret = -ENOTSUPP;
 	}
 
 	if (ret)
 		return ret;
 
-	priv->admin_state = config->admin_cotrol;
+	priv->admin_state = config->podl_admin_control;
 
 	return 0;
 }
include/linux/pse-pd/pse.h +2 -2
index fb724c65c77b..199cf4ae3cf2 100644
@@ -15,11 +15,11 @@ struct pse_controller_dev;
 /**
  * struct pse_control_config - PSE control/channel configuration.
  *
- * @admin_cotrol: set PoDL PSE admin control as described in
+ * @podl_admin_control: set PoDL PSE admin control as described in
  *	IEEE 802.3-2018 30.15.1.2.1 acPoDLPSEAdminControl
  */
 struct pse_control_config {
-	enum ethtool_podl_pse_admin_state admin_cotrol;
+	enum ethtool_podl_pse_admin_state podl_admin_control;
 };
 
 /**
net/ethtool/pse-pd.c +1 -1
index cc478af77111..aef57a058f0d 100644
@@ -130,7 +130,7 @@ ethnl_set_pse(struct ethnl_req_info *req_info, struct genl_info *info)
 	struct phy_device *phydev;
 
 	/* this values are already validated by the ethnl_pse_set_policy */
-	config.admin_cotrol = nla_get_u32(tb[ETHTOOL_A_PODL_PSE_ADMIN_CONTROL]);
+	config.podl_admin_control = nla_get_u32(tb[ETHTOOL_A_PODL_PSE_ADMIN_CONTROL]);
 
 	phydev = dev->phydev;
 	if (!phydev) {
Signature · 1 line
2.25.1
author maintainer
#7 lore raw

PATCH v3 4/17 ethtool: Expand Ethernet Power Equipment with c33 (PoE) alongside PoDL

In reply to Kory Maincent

In the current PSE interface for Ethernet Power Equipment, support is limited to PoDL. This patch extends the interface to accommodate the objects specified in IEEE 802.3-2022 145.2 for Power sourcing Equipment (PSE).

The following objects are now supported and considered mandatory:
- IEEE 802.3-2022 30.9.1.1.5 aPSEPowerDetectionStatus
- IEEE 802.3-2022 30.9.1.1.2 aPSEAdminState
- IEEE 802.3-2022 30.9.1.2.1 aPSEAdminControl

To avoid confusion between "PoDL PSE" and "PoE PSE", which have similar names but distinct values, we have followed the suggestion of Oleksij Rempel and Andrew Lunn to maintain separate naming schemes for each, using c33 (clause 33) prefix for "PoE PSE".
You can find more details in the discussion threads here:
https://lore.kernel.org/netdev/[email protected]/
https://lore.kernel.org/netdev/[email protected]/

---

Changes in v2:
- Rename all the PoE variables and enum with a c33 prefix.
- Add documentation, thanks to Oleksij for having written one.

Changes in v3:
- Fix documentation build warning.

---
 Documentation/networking/index.rst               |  1 +
 Documentation/networking/pse-pd/index.rst        |  9 +++
 Documentation/networking/pse-pd/introduction.rst | 73 ++++++++++++++++++++++++
 include/linux/pse-pd/pse.h                       |  9 +++
 include/uapi/linux/ethtool.h                     | 43 ++++++++++++++
 include/uapi/linux/ethtool_netlink.h             |  3 +
 6 files changed, 138 insertions(+)
Documentation/networking/index.rst +1 -0
index 69f3d6dcd9fd..af7da7006ce8 100644
@@ -92,6 +92,7 @@ Contents:
    plip
    ppp_generic
    proc_net_tcp
+   pse-pd/index
    radiotap-headers
    rds
    regulatory
Documentation/networking/pse-pd/index.rst new file +9 -0
new file mode 100644
index 000000000000..18197bc7303d
@@ -0,0 +1,9 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+Power Sourcing Equipment (PSE) Documentation
+============================================
+
+.. toctree::
+   :maxdepth: 2
+
+   introduction
Documentation/networking/pse-pd/introduction.rst new file +73 -0

73 lines not on this page · raw message

include/linux/pse-pd/pse.h +9 -0
index 199cf4ae3cf2..be4e5754eb24 100644
@@ -17,9 +17,12 @@ struct pse_controller_dev;
  *
  * @podl_admin_control: set PoDL PSE admin control as described in
  *	IEEE 802.3-2018 30.15.1.2.1 acPoDLPSEAdminControl
+ * @c33_admin_control: set PSE admin control as described in
+ *	IEEE 802.3-2022 30.9.1.2.1 acPSEAdminControl
  */
 struct pse_control_config {
 	enum ethtool_podl_pse_admin_state podl_admin_control;
+	enum ethtool_c33_pse_admin_state c33_admin_control;
 };
 
 /**
@@ -29,10 +32,16 @@ struct pse_control_config {
  *	functions. IEEE 802.3-2018 30.15.1.1.2 aPoDLPSEAdminState
  * @podl_pw_status: power detection status of the PoDL PSE.
  *	IEEE 802.3-2018 30.15.1.1.3 aPoDLPSEPowerDetectionStatus:
+ * @c33_admin_state: operational state of the PSE
+ *	functions. IEEE 802.3-2022 30.9.1.1.2 aPSEAdminState
+ * @c33_pw_status: power detection status of the PSE.
+ *	IEEE 802.3-2022 30.9.1.1.5 aPSEPowerDetectionStatus:
  */
 struct pse_control_status {
 	enum ethtool_podl_pse_admin_state podl_admin_state;
 	enum ethtool_podl_pse_pw_d_status podl_pw_status;
+	enum ethtool_c33_pse_admin_state c33_admin_state;
+	enum ethtool_c33_pse_pw_d_status c33_pw_status;
 };
 
 /**
include/uapi/linux/ethtool.h +43 -0

49 lines not on this page · raw message

include/uapi/linux/ethtool_netlink.h +3 -0
index 3f89074aa06c..3f32d360beb1 100644
@@ -895,6 +895,9 @@ enum {
 	ETHTOOL_A_PODL_PSE_ADMIN_STATE,		/* u32 */
 	ETHTOOL_A_PODL_PSE_ADMIN_CONTROL,	/* u32 */
 	ETHTOOL_A_PODL_PSE_PW_D_STATUS,		/* u32 */
+	ETHTOOL_A_C33_PSE_ADMIN_STATE,		/* u32 */
+	ETHTOOL_A_C33_PSE_ADMIN_CONTROL,	/* u32 */
+	ETHTOOL_A_C33_PSE_PW_D_STATUS,		/* u32 */
 
 	/* add new constants above here */
 	__ETHTOOL_A_PSE_CNT,
Signature · 1 line
2.25.1
author maintainer
#8 lore raw

PATCH v3 5/17 net: pse-pd: Introduce PSE types enumeration

In reply to Kory Maincent

Introduce an enumeration to define PSE types (C33 or PoDL), utilizing a bitfield for potential future support of both types. Include 'pse_get_types' helper for external access to PSE type info.

---

Changes in v2:
- Rename PSE_POE to PSE_C33 to have naming consistency.
- Use "static inline" instead of simple static in the header

Changes in v3:
- Move the pse_type enum in uapi.
- Replace pse_get_types helper by pse_has_podl and pse_has_c33.

---
 drivers/net/pse-pd/pse_core.c      | 12 ++++++++++++
 drivers/net/pse-pd/pse_regulator.c |  1 +
 include/linux/pse-pd/pse.h         | 16 ++++++++++++++++
 include/uapi/linux/pse.h           | 23 +++++++++++++++++++++++
 4 files changed, 52 insertions(+)
drivers/net/pse-pd/pse_core.c +12 -0
index 146b81f08a89..090e04c32f9e 100644
@@ -312,3 +312,15 @@ int pse_ethtool_set_config(struct pse_control *psec,
 	return err;
 }
 EXPORT_SYMBOL_GPL(pse_ethtool_set_config);
+
+bool pse_has_podl(struct pse_control *psec)
+{
+	return psec->pcdev->types & PSE_PODL;
+}
+EXPORT_SYMBOL_GPL(pse_has_podl);
+
+bool pse_has_c33(struct pse_control *psec)
+{
+	return psec->pcdev->types & PSE_C33;
+}
+EXPORT_SYMBOL_GPL(pse_has_c33);
drivers/net/pse-pd/pse_regulator.c +1 -0
index 1dedf4de296e..e34ab8526067 100644
@@ -116,6 +116,7 @@ pse_reg_probe(struct platform_device *pdev)
 	priv->pcdev.owner = THIS_MODULE;
 	priv->pcdev.ops = &pse_reg_ops;
 	priv->pcdev.dev = dev;
+	priv->pcdev.types = PSE_PODL;
 	ret = devm_pse_controller_register(dev, &priv->pcdev);
 	if (ret) {
 		dev_err(dev, "failed to register PSE controller (%pe)\n",
include/linux/pse-pd/pse.h +16 -0
index be4e5754eb24..f006cbdf8b3b 100644
@@ -8,6 +8,7 @@
 #include <linux/ethtool.h>
 #include <linux/list.h>
 #include <uapi/linux/ethtool.h>
+#include <uapi/linux/pse.h>
 
 struct phy_device;
 struct pse_controller_dev;
@@ -77,6 +78,7 @@ struct pse_control;
  *            device tree to id as given to the PSE control ops
  * @nr_lines: number of PSE controls in this controller device
  * @lock: Mutex for serialization access to the PSE controller
+ * @types: types of the PSE controller
  */
 struct pse_controller_dev {
 	const struct pse_controller_ops *ops;
@@ -89,6 +91,7 @@ struct pse_controller_dev {
 			const struct of_phandle_args *pse_spec);
 	unsigned int nr_lines;
 	struct mutex lock;
+	u32 types;
 };
 
 #if IS_ENABLED(CONFIG_PSE_CONTROLLER)
@@ -108,6 +111,9 @@ int pse_ethtool_set_config(struct pse_control *psec,
 			   struct netlink_ext_ack *extack,
 			   const struct pse_control_config *config);
 
+bool pse_has_podl(struct pse_control *psec);
+bool pse_has_c33(struct pse_control *psec);
+
 #else
 
 static inline struct pse_control *of_pse_control_get(struct device_node *node)
@@ -133,6 +139,16 @@ static inline int pse_ethtool_set_config(struct pse_control *psec,
 	return -ENOTSUPP;
 }
 
+static inline bool pse_has_podl(struct pse_control *psec)
+{
+	return false;
+}
+
+static inline bool pse_has_c33(struct pse_control *psec)
+{
+	return false;
+}
+
 #endif
 
 #endif
include/uapi/linux/pse.h new file +23 -0
new file mode 100644
index 000000000000..ebd9b4be9d9d
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Userspace API for Power Sourcing Equipment
+ *
+ * Copyright (c) 2023 Bootlin, Kory Maincent <[email protected]>
+ */
+#ifndef _PSE_CONTROLLER_H
+#define _PSE_CONTROLLER_H
+
+/**
+ * enum - Types of PSE controller.
+ *
+ * @PSE_UNKNOWN: Type of PSE controller is unknown
+ * @PSE_PODL: PSE controller which support PoDL
+ * @PSE_C33: PSE controller which support Clause 33 (PoE)
+ */
+enum {
+	PSE_UNKNOWN =	1 << 0,
+	PSE_PODL =	1 << 1,
+	PSE_C33 =	1 << 2,
+};
+
+#endif /* _PSE_CONTROLLER_H */
Signature · 1 line
2.25.1
maintainer Reviewed-by on v3 5/17
#9 lore raw

Re: [PATCH net-next v3 05/17] net: pse-pd: Introduce PSE types enumeration

Quoted 6 lines · Kory Maincent

Introduce an enumeration to define PSE types (C33 or PoDL), utilizing a bitfield for potential future support of both types. Include 'pse_get_types' helper for external access to PSE type info.

Andrew

author maintainer
#10 lore raw

PATCH v3 6/17 net: ethtool: pse-pd: Expand pse commands with the PSE PoE interface

In reply to Kory Maincent

Add PSE PoE interface support in the ethtool pse command.

---

Changes in v2:
- Follow the "c33" PoE prefix naming change.

Changes in v3:
- Replace the pse_get_types() helper by pse_has_podl() and pse_has_c33().
- Replace PoE to c33 in the netlink error log.
- Fix documentation build warning.

---
 Documentation/networking/ethtool-netlink.rst | 20 ++++++++++
 net/ethtool/pse-pd.c                         | 60 +++++++++++++++++++++++-----
 2 files changed, 70 insertions(+), 10 deletions(-)
Documentation/networking/ethtool-netlink.rst +20 -0
index d583d9abf2f8..294187c3a3b0 100644
@@ -1717,6 +1717,10 @@ Kernel response contents:
                                                   PSE functions
   ``ETHTOOL_A_PODL_PSE_PW_D_STATUS``         u32  power detection status of the
                                                   PoDL PSE.
+  ``ETHTOOL_A_C33_PSE_ADMIN_STATE``          u32  Operational state of the PoE
+                                                  PSE functions.
+  ``ETHTOOL_A_C33_PSE_PW_D_STATUS``          u32  power detection status of the
+                                                  PoE PSE.
   ======================================  ======  =============================
 
 When set, the optional ``ETHTOOL_A_PODL_PSE_ADMIN_STATE`` attribute identifies
@@ -1728,6 +1732,12 @@ aPoDLPSEAdminState. Possible values are:
 .. kernel-doc:: include/uapi/linux/ethtool.h
     :identifiers: ethtool_podl_pse_admin_state
 
+The same goes for ``ETHTOOL_A_C33_PSE_ADMIN_STATE`` implementing
+``IEEE 802.3-2022`` 30.9.1.1.2 aPSEAdminState.
+
+.. kernel-doc:: include/uapi/linux/ethtool.h
+    :identifiers: ethtool_c33_pse_admin_state
+
 When set, the optional ``ETHTOOL_A_PODL_PSE_PW_D_STATUS`` attribute identifies
 the power detection status of the PoDL PSE.  The status depend on internal PSE
 state machine and automatic PD classification support. This option is
@@ -1737,6 +1747,12 @@ Possible values are:
 .. kernel-doc:: include/uapi/linux/ethtool.h
     :identifiers: ethtool_podl_pse_pw_d_status
 
+The same goes for ``ETHTOOL_A_C33_PSE_ADMIN_PW_D_STATUS`` implementing
+``IEEE 802.3-2022`` 30.9.1.1.5 aPSEPowerDetectionStatus.
+
+.. kernel-doc:: include/uapi/linux/ethtool.h
+    :identifiers: ethtool_c33_pse_pw_d_status
+
 PSE_SET
 =======
 
@@ -1747,6 +1763,7 @@ Request contents:
   ======================================  ======  =============================
   ``ETHTOOL_A_PSE_HEADER``                nested  request header
   ``ETHTOOL_A_PODL_PSE_ADMIN_CONTROL``       u32  Control PoDL PSE Admin state
+  ``ETHTOOL_A_C33_PSE_ADMIN_CONTROL``        u32  Control PSE Admin state
   ======================================  ======  =============================
 
 When set, the optional ``ETHTOOL_A_PODL_PSE_ADMIN_CONTROL`` attribute is used
@@ -1754,6 +1771,9 @@ to control PoDL PSE Admin functions. This option is implementing
 ``IEEE 802.3-2018`` 30.15.1.2.1 acPoDLPSEAdminControl. See
 ``ETHTOOL_A_PODL_PSE_ADMIN_STATE`` for supported values.
 
+The same goes for ``ETHTOOL_A_C33_PSE_ADMIN_CONTROL`` implementing
+``IEEE 802.3-2022`` 30.9.1.2.1 acPSEAdminControl.
+
 RSS_GET
 =======
 
net/ethtool/pse-pd.c +50 -10

93 lines not on this page · raw message

Signature · 1 line
2.25.1
author maintainer
#12 lore raw

PATCH v3 7/17 netlink: specs: Modify pse attribute prefix

In reply to Kory Maincent

Remove podl from the attribute prefix to prepare the support of PoE pse netlink spec.

---

Changes in v2:
- Add the ethtool auto generated code.

Changes in v3:
- Remove the ethtool auto generated code.

---
 Documentation/netlink/specs/ethtool.yaml | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
Documentation/netlink/specs/ethtool.yaml +9 -9
index 197208f419dc..33e81fa189ca 100644
@@ -878,17 +878,17 @@ attribute-sets:
         type: nest
         nested-attributes: header
       -
-        name: admin-state
+        name: podl-pse-admin-state
         type: u32
-        name-prefix: ethtool-a-podl-pse-
+        name-prefix: ethtool-a-
       -
-        name: admin-control
+        name: podl-pse-admin-control
         type: u32
-        name-prefix: ethtool-a-podl-pse-
+        name-prefix: ethtool-a-
       -
-        name: pw-d-status
+        name: podl-pse-pw-d-status
         type: u32
-        name-prefix: ethtool-a-podl-pse-
+        name-prefix: ethtool-a-
   -
     name: rss
     attributes:
@@ -1571,9 +1571,9 @@ operations:
         reply:
           attributes: &pse
             - header
-            - admin-state
-            - admin-control
-            - pw-d-status
+            - podl-pse-admin-state
+            - podl-pse-admin-control
+            - podl-pse-pw-d-status
       dump: *pse-get-op
     -
       name: pse-set
Signature · 1 line
2.25.1
author maintainer
#14 lore raw

PATCH v3 8/17 netlink: specs: Expand the pse netlink command with PoE interface

In reply to Kory Maincent

Add the PoE pse attributes prefix to be able to use PoE interface.

Example usage:

./ynl/cli.py --spec netlink/specs/ethtool.yaml --no-schema --do pse-get \
             --json '{"header":{"dev-name":"eth0"}}'

{'header': {'dev-index': 4, 'dev-name': 'eth0'},
'c33-pse-admin-state': 3,
'c33-pse-pw-d-status': 4}

./ynl/cli.py --spec netlink/specs/ethtool.yaml --no-schema --do pse-set \
             --json '{"header":{"dev-name":"eth0"},
		     "c33-pse-admin-control":3}'

---

Changes in v2:
- Follow the "c33" PoE prefix naming change.
- Add the ethtool auto generated code.

Changes in v3:
- Remove the ethtool auto generated code.

---
 Documentation/netlink/specs/ethtool.yaml | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
Documentation/netlink/specs/ethtool.yaml +15 -0
index 33e81fa189ca..beaab9f0017f 100644
@@ -889,6 +889,18 @@ attribute-sets:
         name: podl-pse-pw-d-status
         type: u32
         name-prefix: ethtool-a-
+      -
+        name: c33-pse-admin-state
+        type: u32
+        name-prefix: ethtool-a-
+      -
+        name: c33-pse-admin-control
+        type: u32
+        name-prefix: ethtool-a-
+      -
+        name: c33-pse-pw-d-status
+        type: u32
+        name-prefix: ethtool-a-
   -
     name: rss
     attributes:
@@ -1574,6 +1586,9 @@ operations:
             - podl-pse-admin-state
             - podl-pse-admin-control
             - podl-pse-pw-d-status
+            - c33-pse-admin-state
+            - c33-pse-admin-control
+            - c33-pse-pw-d-status
       dump: *pse-get-op
     -
       name: pse-set
Signature · 1 line
2.25.1
maintainer Reviewed-by on v3 8/17
#15 lore raw

Re: [PATCH net-next v3 08/17] netlink: specs: Expand the pse netlink command with PoE interface

Quoted 9 lines · Kory Maincent

Add the PoE pse attributes prefix to be able to use PoE interface.

Example usage:

./ynl/cli.py --spec netlink/specs/ethtool.yaml --no-schema --do pse-get \
             --json '{"header":{"dev-name":"eth0"}}'

{'header': {'dev-index': 4, 'dev-name': 'eth0'},
'c33-pse-admin-state': 3,
'c33-pse-pw-d-status': 4}

Quoted 6 lines
./ynl/cli.py --spec netlink/specs/ethtool.yaml --no-schema --do pse-set \
             --json '{"header":{"dev-name":"eth0"},
		     "c33-pse-admin-control":3}'

Andrew

author maintainer
#16 lore raw

PATCH v3 9/17 MAINTAINERS: Add myself to pse networking maintainer

In reply to Kory Maincent

As I add support for PoE in PSE networking subsystem it seems legitimate to be added to the maintainers.

---

Changes in v3:
- New patch

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index 2dcf48948d2b..7a69f9d3de2d 100644
@@ -17670,6 +17670,7 @@ F:	net/psample
 
 PSE NETWORK DRIVER
 M:	Oleksij Rempel <[email protected]>
+M:	Kory Maincent <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	Documentation/devicetree/bindings/net/pse-pd/
Signature · 1 line
2.25.1
author maintainer
#18 lore raw

PATCH v3 10/17 dt-bindings: net: pse-pd: Add another way of describing several PSE PIs

In reply to Kory Maincent

Before hand we set "#pse-cell" to 1 to define a PSE controller with several PIs (Power Interface). The drawback of this was that we could not have any information on the PI except its number.
Add support for pse_pis and pse_pi node to be able to have more information on the PI like the number of pairset used and the pairset pinout.

---

Changes in v3:
- New patch

---
 .../bindings/net/pse-pd/pse-controller.yaml        | 101 ++++++++++++++++++++-
 1 file changed, 98 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml +98 -3
index 2d382faca0e6..dd5fb53e527a 100644
@@ -13,6 +13,7 @@ description: Binding for the Power Sourcing Equipment (PSE) as defined in the
 
 maintainers:
   - Oleksij Rempel <[email protected]>
+  - Kory Maincent <[email protected]>
 
 properties:
   $nodename:
@@ -22,11 +23,105 @@ properties:
     description:
       Used to uniquely identify a PSE instance within an IC. Will be
       0 on PSE nodes with only a single output and at least 1 on nodes
-      controlling several outputs.
+      controlling several outputs which are not described in the pse_pis
+      subnode. This property is deprecated, please use pse_pis instead.
     enum: [0, 1]
 
-required:
-  - "#pse-cells"
+  pse_pis:
+    $ref: "#/$defs/pse_pis"
+
+$defs:
+  pse_pis:
+    type: object
+    description:
+      Kind of a matrix to identify the concordance between a PSE Power
+      Interface and one or two (PoE4) physical ports.
+
+    properties:
+      "#address-cells":
+        const: 1
+
+      "#size-cells":
+        const: 0
+
+    patternProperties:
+      "^pse_pi@[0-9]+$":
+        $ref: "#/$defs/pse_pi"
+
+    required:
+      - "#address-cells"
+      - "#size-cells"
+
+  pse_pi:
+    description:
+      PSE PI device for power delivery via pairsets, compliant with IEEE
+      802.3-2022, Section 145.2.4. Each pairset comprises a positive and a
+      negative VPSE pair, adhering to the pinout configurations detailed in
+      the standard.
+    type: object
+    properties:
+      reg:
+        maxItems: 1
+
+      "#pse-cells":
+        const: 0
+
+      pairset-names:
+        description:
+          Names of the pairsets as per IEEE 802.3-2022, Section 145.2.4. Valid
+          values are "alternative-a" and "alternative-b". Each name should
+          correspond to a phandle in the 'pairset' property pointing to the
+          power supply for that pairset.
+        $ref: /schemas/types.yaml#/definitions/string-array
+        minItems: 1
+        maxItems: 2
+        items:
+          - enum:
+            - "alternative-a"
+            - "alternative-b"
+
+      pairsets:
+        description:
+          List of phandles, each pointing to the power supply for the
+          corresponding pairset named in 'pairset-names'. This property aligns
+          with IEEE 802.3-2022, Section 33.2.3 and 145.2.4.
+          PSE Pinout Alternatives (as per IEEE 802.3-2022 Table 145–3)
+          | Conductor | Alternative A (MDI-X) | Alternative A (MDI) | Alternative B(X) | Alternative B(S) |
+          |-----------|-----------------------|---------------------|------------------|------------------|
+          | 1         | Negative VPSE         | Positive VPSE       | —                | —                |
+          | 2         | Negative VPSE         | Positive VPSE       | —                | —                |
+          | 3         | Positive VPSE         | Negative VPSE       | —                | —                |
+          | 4         | —                     | —                   | Negative VPSE    | Positive VPSE    |
+          | 5         | —                     | —                   | Negative VPSE    | Positive VPSE    |
+          | 6         | Positive VPSE         | Negative VPSE       | —                | —                |
+          | 7         | —                     | —                   | Positive VPSE    | Negative VPSE    |
+          | 8         | —                     | —                   | Positive VPSE    | Negative VPSE    |
+        $ref: /schemas/types.yaml#/definitions/phandle-array
+        minItems: 1
+        maxItems: 2
+
+    required:
+      - reg
+      - "#pse-cells"
+      - pairset-names
+      - pairsets
+
+allOf:
+  - if:
+      required:
+        - "#pse-cells"
+    then:
+      not:
+        required:
+          - pse-pis
+
+  - if:
+      required:
+        - pse-pis
+    then:
+      not:
+        required:
+          - "#pse-cells"
 
 additionalProperties: true
 
Signature · 1 line
2.25.1
maintainer
#19 lore raw

Re: [PATCH net-next v3 10/17] dt-bindings: net: pse-pd: Add another way of describing several PSE PIs

Quoted 8 lines · Kory Maincent

Before hand we set "#pse-cell" to 1 to define a PSE controller with several PIs (Power Interface). The drawback of this was that we could not have any information on the PI except its number.
Add support for pse_pis and pse_pi node to be able to have more information on the PI like the number of pairset used and the pairset pinout.

Quoted 8 lines

---

Changes in v3:
- New patch

---
 .../bindings/net/pse-pd/pse-controller.yaml        | 101 ++++++++++++++++++++-
 1 file changed, 98 insertions(+), 3 deletions(-)

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:
./Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml:80:13: [warning] wrong indentation: expected 14 but found 12 (indentation) ./Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml:80:15: [error] string value is redundantly quoted with any quotes (quoted-strings) ./Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml:81:15: [error] string value is redundantly quoted with any quotes (quoted-strings)

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml: $defs:pse_pi:properties:pairset-names: {'description': 'Names of the pairsets as per IEEE 802.3-2022, Section 145.2.4. Valid values are "alternative-a" and "alternative-b". Each name should correspond to a phandle in the \'pairset\' property pointing to the power supply for that pairset.', '$ref': '/schemas/types.yaml#/definitions/string-array', 'minItems': 1, 'maxItems': 2, 'items': [{'enum': ['alternative-a', 'alternative-b']}]} should not be valid under {'required': ['maxItems']}
hint: "maxItems" is not needed with an "items" list
from schema $id: http://devicetree.org/meta-schemas/items.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml: $defs:pse_pi:properties:pairset-names: 'oneOf' conditional failed, one must be fixed:
[{'enum': ['alternative-a', 'alternative-b']}] is too short
False schema does not allow 1
hint: "minItems" is only needed if less than the "items" list length
from schema $id: http://devicetree.org/meta-schemas/items.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

maintainer
#20 lore raw

Re: [PATCH net-next v3 10/17] dt-bindings: net: pse-pd: Add another way of describing several PSE PIs

In reply to Kory Maincent
Quoted 1 line · Kory Maincent

Before hand we set "#pse-cell" to 1 to define a PSE controller with

#pse-cells

Quoted 2 lines

several PIs (Power Interface). The drawback of this was that we could not have any information on the PI except its number.

Then increase it to what you need. The whole point of #foo-cells is that it is variable depending on what the provider needs.

Quoted 2 lines

Add support for pse_pis and pse_pi node to be able to have more information on the PI like the number of pairset used and the pairset pinout.

Please explain the problem you are trying to solve, not your solution. I don't understand what the problem is to provide any useful suggestions on the design.

Quoted 2 lines

Is this a recognized tag? First I've seen it.

Quoted 26 lines

---

Changes in v3:
- New patch

---
 .../bindings/net/pse-pd/pse-controller.yaml        | 101 ++++++++++++++++++++-
 1 file changed, 98 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml +1 -1
index 2d382faca0e6..dd5fb53e527a 100644
@@ -13,6 +13,7 @@ description: Binding for the Power Sourcing Equipment (PSE) as defined in the
 
 maintainers:
   - Oleksij Rempel <[email protected]>
+  - Kory Maincent <[email protected]>
 
 properties:
   $nodename:
@@ -22,11 +23,105 @@ properties:
     description:
       Used to uniquely identify a PSE instance within an IC. Will be
       0 on PSE nodes with only a single output and at least 1 on nodes
-      controlling several outputs.

Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml properties: · line 33

Quoted 10 lines
Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml +6 -2
+      controlling several outputs which are not described in the pse_pis
+      subnode. This property is deprecated, please use pse_pis instead.
     enum: [0, 1]
 
-required:
-  - "#pse-cells"
+  pse_pis:
+    $ref: "#/$defs/pse_pis"
+
+$defs:

$defs is for when you need multiple copies of the same thing. I don't see that here.

Quoted 5 lines
Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml +5 -0
+  pse_pis:
+    type: object
+    description:
+      Kind of a matrix to identify the concordance between a PSE Power
+      Interface and one or two (PoE4) physical ports.

Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml properties: · line 48

Quoted 10 lines
Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml +10 -0
+
+    properties:
+      "#address-cells":
+        const: 1
+
+      "#size-cells":
+        const: 0
+
+    patternProperties:
+      "^pse_pi@[0-9]+$":

Unit-addresses are hex.

Quoted 6 lines
Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml +6 -0
+        $ref: "#/$defs/pse_pi"
+
+    required:
+      - "#address-cells"
+      - "#size-cells"
+

Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml properties: · line 64

Quoted 10 lines
Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml +10 -0
+  pse_pi:
+    description:
+      PSE PI device for power delivery via pairsets, compliant with IEEE
+      802.3-2022, Section 145.2.4. Each pairset comprises a positive and a
+      negative VPSE pair, adhering to the pinout configurations detailed in
+      the standard.
+    type: object
+    properties:
+      reg:
+        maxItems: 1

As you are defining the addressing here, you need to define what the "addresses" are.

Quoted 7 lines
Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml +7 -0
+
+      "#pse-cells":
+        const: 0
+
+      pairset-names:
+        description:
+          Names of the pairsets as per IEEE 802.3-2022, Section 145.2.4. Valid

Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml properties: · line 81

Quoted 10 lines
Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml +10 -0
+          values are "alternative-a" and "alternative-b". Each name should
+          correspond to a phandle in the 'pairset' property pointing to the
+          power supply for that pairset.
+        $ref: /schemas/types.yaml#/definitions/string-array
+        minItems: 1
+        maxItems: 2
+        items:
+          - enum:
+            - "alternative-a"
+            - "alternative-b"

This leaves the 2nd entry undefined. You need the dictionary form of 'items' rather than a list. IOW, Drop the '-' under items.

Quoted 50 lines
Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml +43 -0
+
+      pairsets:
+        description:
+          List of phandles, each pointing to the power supply for the
+          corresponding pairset named in 'pairset-names'. This property aligns
+          with IEEE 802.3-2022, Section 33.2.3 and 145.2.4.
+          PSE Pinout Alternatives (as per IEEE 802.3-2022 Table 145–3)
+          | Conductor | Alternative A (MDI-X) | Alternative A (MDI) | Alternative B(X) | Alternative B(S) |
+          |-----------|-----------------------|---------------------|------------------|------------------|
+          | 1         | Negative VPSE         | Positive VPSE       | —                | —                |
+          | 2         | Negative VPSE         | Positive VPSE       | —                | —                |
+          | 3         | Positive VPSE         | Negative VPSE       | —                | —                |
+          | 4         | —                     | —                   | Negative VPSE    | Positive VPSE    |
+          | 5         | —                     | —                   | Negative VPSE    | Positive VPSE    |
+          | 6         | Positive VPSE         | Negative VPSE       | —                | —                |
+          | 7         | —                     | —                   | Positive VPSE    | Negative VPSE    |
+          | 8         | —                     | —                   | Positive VPSE    | Negative VPSE    |
+        $ref: /schemas/types.yaml#/definitions/phandle-array
+        minItems: 1
+        maxItems: 2
+
+    required:
+      - reg
+      - "#pse-cells"
+      - pairset-names
+      - pairsets
+
+allOf:
+  - if:
+      required:
+        - "#pse-cells"
+    then:
+      not:
+        required:
+          - pse-pis
+
+  - if:
+      required:
+        - pse-pis
+    then:
+      not:
+        required:
+          - "#pse-cells"
 
 additionalProperties: true
 
Signature · 2 lines
-- 
2.25.1
author maintainer
#21 lore raw

Re: [PATCH net-next v3 10/17] dt-bindings: net: pse-pd: Add another way of describing several PSE PIs

Hello Rob,

Thanks for your review!

Quoted 11 lines · On Fri, 9 Feb 2024 14:43:49 +0000 Rob Herring <[email protected]> wrote:
Quoted 1 line · Kory Maincent

Before hand we set "#pse-cell" to 1 to define a PSE controller with

#pse-cells

Quoted 2 lines

several PIs (Power Interface). The drawback of this was that we could not have any information on the PI except its number.

Then increase it to what you need. The whole point of #foo-cells is that it is variable depending on what the provider needs.

Quoted 6 lines
Quoted 2 lines

Add support for pse_pis and pse_pi node to be able to have more information on the PI like the number of pairset used and the pairset pinout.

Please explain the problem you are trying to solve, not your solution. I don't understand what the problem is to provide any useful suggestions on the design.

Please see Oleksij's reply.
Thank you Oleksij, for the documentation!!

Quoted 4 lines
Quoted 2 lines

Is this a recognized tag? First I've seen it.

This is not a standard tag but it has been used several times in the past.

Quoted 10 lines

Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml properties: · line 33

Quoted 7 lines
Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml +4 -2
-required:
-  - "#pse-cells"
+  pse_pis:
+    $ref: "#/$defs/pse_pis"
+
+$defs:  

$defs is for when you need multiple copies of the same thing. I don't see that here.

I made this choice for better readability but indeed it is used only once. I will remove it then.

Quoted 9 lines
Quoted 9 lines
Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml +9 -0
+  pse_pis:
+    type: object
+    description:
+      Kind of a matrix to identify the concordance between a PSE Power
+      Interface and one or two (PoE4) physical ports.
+
+    properties:
+      "#address-cells":
+        const: 1
Quoted 8 lines

Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml properties: · line 48

Quoted 6 lines
Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml +6 -0
+
+      "#size-cells":
+        const: 0
+
+    patternProperties:
+      "^pse_pi@[0-9]+$":  

Unit-addresses are hex.

Oops sorry for the mistake.

Quoted 12 lines
Quoted 12 lines
Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml +11 -0
+        $ref: "#/$defs/pse_pi"
+
+    required:
+      - "#address-cells"
+      - "#size-cells"
+
+  pse_pi:
+    description:
+      PSE PI device for power delivery via pairsets, compliant with IEEE
+      802.3-2022, Section 145.2.4. Each pairset comprises a positive and a
+      negative VPSE pair, adhering to the pinout configurations detailed in
Quoted 8 lines

Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml properties: · line 64

Quoted 5 lines
Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml +5 -0
+      the standard.
+    type: object
+    properties:
+      reg:
+        maxItems: 1  

As you are defining the addressing here, you need to define what the "addresses" are.

Yes I will add some documentation in next version.

Quoted 11 lines

Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml properties: · line 81

Quoted 10 lines
Documentation/devicetree/bindings/net/pse-pd/pse-controller.yaml +10 -0
+          values are "alternative-a" and "alternative-b". Each name should
+          correspond to a phandle in the 'pairset' property pointing to the
+          power supply for that pairset.
+        $ref: /schemas/types.yaml#/definitions/string-array
+        minItems: 1
+        maxItems: 2
+        items:
+          - enum:
+            - "alternative-a"
+            - "alternative-b"  
Quoted 2 lines

This leaves the 2nd entry undefined. You need the dictionary form of 'items' rather than a list. IOW, Drop the '-' under items.

Oh thanks! That is what I was looking for. I was struggling using the right description.

Regards,

Signature · 3 lines
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
author maintainer
#22 lore raw

Re: [PATCH net-next v3 10/17] dt-bindings: net: pse-pd: Add another way of describing several PSE PIs

Quoted 30 lines · On Wed, 14 Feb 2024 14:13:10 +0100 Köry Maincent <[email protected]>…

Hello Rob,

Thanks for your review!

Quoted 11 lines · On Fri, 9 Feb 2024 14:43:49 +0000 Rob Herring <[email protected]> wrote:
Quoted 1 line · Kory Maincent

Before hand we set "#pse-cell" to 1 to define a PSE controller with

#pse-cells

Quoted 2 lines

several PIs (Power Interface). The drawback of this was that we could not have any information on the PI except its number.

Then increase it to what you need. The whole point of #foo-cells is that it is variable depending on what the provider needs.

Quoted 7 lines
Quoted 3 lines

Add support for pse_pis and pse_pi node to be able to have more information on the PI like the number of pairset used and the pairset pinout.

Please explain the problem you are trying to solve, not your solution. I don't understand what the problem is to provide any useful suggestions on the design.

Please see Oleksij's reply.
Thank you Oleksij, for the documentation!!

Quoted 1 line
Quoted 1 line
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Is this a recognized tag? First I've seen it.

This is not a standard tag but it has been used several times in the past.

Not so much used indeed:

$ git log --grep="Sponsored" | grep Sponsored     
    Sponsored by:  The FreeBSD Foundation
    Sponsored by:  The FreeBSD Foundation
    Sponsored by:  The FreeBSD Foundation
    Sponsored by:  The FreeBSD Foundation
    Sponsored-by: Google Chromium project
    Sponsored: Google ChromeOS
    Sponsored: Google ChromeOS

Is it ok to keep it?

Regards,

Signature · 3 lines
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
maintainer
#23 lore raw

Re: [PATCH net-next v3 10/17] dt-bindings: net: pse-pd: Add another way of describing several PSE PIs

Quoted 49 lines · Köry Maincent
Quoted 30 lines · On Wed, 14 Feb 2024 14:13:10 +0100 Köry Maincent <[email protected]>…

Hello Rob,

Thanks for your review!

Quoted 11 lines · On Fri, 9 Feb 2024 14:43:49 +0000 Rob Herring <[email protected]> wrote:
Quoted 1 line · Kory Maincent

Before hand we set "#pse-cell" to 1 to define a PSE controller with

#pse-cells

Quoted 2 lines

several PIs (Power Interface). The drawback of this was that we could not have any information on the PI except its number.

Then increase it to what you need. The whole point of #foo-cells is that it is variable depending on what the provider needs.

Quoted 7 lines
Quoted 3 lines

Add support for pse_pis and pse_pi node to be able to have more information on the PI like the number of pairset used and the pairset pinout.

Please explain the problem you are trying to solve, not your solution. I don't understand what the problem is to provide any useful suggestions on the design.

Please see Oleksij's reply.
Thank you Oleksij, for the documentation!!

Quoted 1 line
Quoted 1 line
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Is this a recognized tag? First I've seen it.

This is not a standard tag but it has been used several times in the past.

Not so much used indeed:

$ git log --grep="Sponsored" | grep Sponsored     
    Sponsored by:  The FreeBSD Foundation
    Sponsored by:  The FreeBSD Foundation
    Sponsored by:  The FreeBSD Foundation
    Sponsored by:  The FreeBSD Foundation
    Sponsored-by: Google Chromium project
    Sponsored: Google ChromeOS
    Sponsored: Google ChromeOS
Quoted 1 line

Is it ok to keep it?

IMO, its use should be documented like other tags, or it should not be used. Just write a sentence to the same effect.

Rob

maintainer
#24 lore raw

Re: [PATCH net-next v3 10/17] dt-bindings: net: pse-pd: Add another way of describing several PSE PIs

Quoted 10 lines
Quoted 10 lines

Not so much used indeed:

$ git log --grep="Sponsored" | grep Sponsored     
    Sponsored by:  The FreeBSD Foundation
    Sponsored by:  The FreeBSD Foundation
    Sponsored by:  The FreeBSD Foundation
    Sponsored by:  The FreeBSD Foundation
    Sponsored-by: Google Chromium project
    Sponsored: Google ChromeOS
    Sponsored: Google ChromeOS
Quoted 4 lines
Quoted 1 line

Is it ok to keep it?

IMO, its use should be documented like other tags, or it should not be used. Just write a sentence to the same effect.

Or include a patch to document it :-)

Andrew

author maintainer
#25 lore raw

Re: [PATCH net-next v3 10/17] dt-bindings: net: pse-pd: Add another way of describing several PSE PIs

Quoted 10 lines · On Thu, 15 Feb 2024 15:01:08 +0100 Andrew Lunn <[email protected]> wrote:
Quoted 10 lines
Quoted 10 lines

Not so much used indeed:

$ git log --grep="Sponsored" | grep Sponsored     
    Sponsored by:  The FreeBSD Foundation
    Sponsored by:  The FreeBSD Foundation
    Sponsored by:  The FreeBSD Foundation
    Sponsored by:  The FreeBSD Foundation
    Sponsored-by: Google Chromium project
    Sponsored: Google ChromeOS
    Sponsored: Google ChromeOS
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Is it ok to keep it?

IMO, its use should be documented like other tags, or it should not be used. Just write a sentence to the same effect.

Or include a patch to document it :-)

It seems someone has already tried to send a patch to add this tag but it has not been accepted due to maintainers extra works bring by the tag:
https://lore.kernel.org/lkml/[email protected]/

I will replace it by a small sentence then.

Regards,

Signature · 3 lines
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
author maintainer
#26 lore raw

PATCH v3 11/17 net: pse-pd: Add support for PSE PIs

In reply to Kory Maincent

Add support for getting the PSE controller node through PSE PI device subnode.
This supports adds a way to get the PSE PI id from the pse_pi devicetree subnode of a PSE controller node simply by reading the reg property.

---

Changes in v3:
- New patch

---
 drivers/net/pse-pd/pse_core.c | 223 ++++++++++++++++++++++++++++++++++--------
 include/linux/pse-pd/pse.h    |  38 ++++++-
 2 files changed, 217 insertions(+), 44 deletions(-)
drivers/net/pse-pd/pse_core.c +183 -40
index 090e04c32f9e..e03d36793d18 100644
@@ -27,38 +27,137 @@ struct pse_control {
 	struct kref refcnt;
 };
 
-/**
- * of_pse_zero_xlate - dummy function for controllers with one only control
- * @pcdev: a pointer to the PSE controller device
- * @pse_spec: PSE line specifier as found in the device tree
- *
- * This static translation function is used by default if of_xlate in
- * :c:type:`pse_controller_dev` is not set. It is useful for all PSE
- * controllers with #pse-cells = <0>.
- */
-static int of_pse_zero_xlate(struct pse_controller_dev *pcdev,
-			     const struct of_phandle_args *pse_spec)
+static int of_load_pse_pi_pairsets(struct device_node *node,
+				   struct pse_pi *pi,
+				   int npairsets)
 {
-	return 0;
+	struct device_node *pairset_np;
+	const char *name;
+	int i, ret;
+
+	for (i = 0; i < npairsets; i++) {
+		ret = of_property_read_string_index(node,
+						    "pairset-names",
+						     i, &name);
+		if (ret)
+			break;
+
+		if (strcmp(name, "alternative-a")) {
+			pi->pairset[i].pinout = ALTERNATIVE_A;
+		} else if (strcmp(name, "alternative-b")) {
+			pi->pairset[i].pinout = ALTERNATIVE_B;
+		} else {
+			pr_err("pse: wrong pairset-names value %s\n", name);
+			ret = -EINVAL;
+			break;
+		}
+
+		pairset_np = of_parse_phandle(node, "pairsets", i);
+		if (!pairset_np) {
+			ret = -ENODEV;
+			break;
+		}
+
+		pi->pairset[i].np = pairset_np;
+	}
+
+	if (i == 2 && pi->pairset[0].pinout == pi->pairset[1].pinout) {
+		pr_err("pse: two PI pairsets can not have identical pinout");
+		ret = -EINVAL;
+	}
+
+	/* If an error appears on the second pairset load, release the first
+	 * pairset device node kref
+	 */
+	if (ret) {
+		of_node_put(pi->pairset[0].np);
+		pi->pairset[0].np = NULL;
+		of_node_put(pi->pairset[1].np);
+		pi->pairset[1].np = NULL;
+	}
+
+	return ret;
 }
 
-/**
- * of_pse_simple_xlate - translate pse_spec to the PSE line number
- * @pcdev: a pointer to the PSE controller device
- * @pse_spec: PSE line specifier as found in the device tree
- *
- * This static translation function is used by default if of_xlate in
- * :c:type:`pse_controller_dev` is not set. It is useful for all PSE
- * controllers with 1:1 mapping, where PSE lines can be indexed by number
- * without gaps.
- */
-static int of_pse_simple_xlate(struct pse_controller_dev *pcdev,
-			       const struct of_phandle_args *pse_spec)
+static int of_load_pse_pis(struct pse_controller_dev *pcdev)
 {
-	if (pse_spec->args[0] >= pcdev->nr_lines)
-		return -EINVAL;
+	struct device_node *np = pcdev->dev->of_node;
+	struct device_node *node, *pis;
+	int ret, i;
 
-	return pse_spec->args[0];
+	if (!np)
+		return -ENODEV;
+
+	pcdev->pi = kcalloc(pcdev->nr_lines, sizeof(*pcdev->pi), GFP_KERNEL);
+	if (!pcdev->pi)
+		return -ENOMEM;
+
+	pis = of_get_child_by_name(np, "pse_pis");
+	if (!pis) {
+		/* Legacy OF description of PSE PIs */
+		pcdev->of_legacy = true;
+		return 0;
+	}
+
+	for_each_child_of_node(pis, node) {
+		struct pse_pi pi = {0};
+		int npairsets;
+		u32 id;
+
+		if (!of_node_name_eq(node, "pse_pi"))
+			continue;
+
+		ret = of_property_read_u32(node, "reg", &id);
+		if (ret)
+			goto out;
+
+		if (id >= pcdev->nr_lines || pcdev->pi[id].np) {
+			dev_err(pcdev->dev, "wrong id of pse pi: %u\n",
+				id);
+			ret = -EINVAL;
+			goto out;
+		}
+
+		ret = of_property_count_strings(node, "pairset-names");
+		if (ret <= 0)
+			goto out;
+		npairsets = ret;
+
+		ret = of_count_phandle_with_args(node, "pairsets", NULL);
+		if (ret <= 0)
+			goto out;
+
+		/* npairsets is limited to value one or two */
+		if (ret != npairsets || ret > 2) {
+			dev_err(pcdev->dev,
+				"wrong number of pairsets or pairset-names for pse pi %d\n",
+				id);
+			ret = -EINVAL;
+			goto out;
+		}
+
+		ret = of_load_pse_pi_pairsets(node, &pi, npairsets);
+		if (ret)
+			goto out;
+
+		of_node_get(node);
+		pi.np = node;
+		memcpy(&pcdev->pi[id], &pi, sizeof(pi));
+	}
+
+	of_node_put(pis);
+	return 0;
+
+out:
+	for (i = 0; i <= pcdev->nr_lines; i++) {
+		of_node_put(pcdev->pi[i].pairset[0].np);
+		of_node_put(pcdev->pi[i].pairset[1].np);
+		of_node_put(pcdev->pi[i].np);
+	}
+	of_node_put(node);
+	of_node_put(pis);
+	kfree(pcdev->pi);
+	return ret;
 }
 
 /**
@@ -67,16 +166,18 @@ static int of_pse_simple_xlate(struct pse_controller_dev *pcdev,
  */
 int pse_controller_register(struct pse_controller_dev *pcdev)
 {
-	if (!pcdev->of_xlate) {
-		if (pcdev->of_pse_n_cells == 0)
-			pcdev->of_xlate = of_pse_zero_xlate;
-		else if (pcdev->of_pse_n_cells == 1)
-			pcdev->of_xlate = of_pse_simple_xlate;
-	}
+	int ret;
 
 	mutex_init(&pcdev->lock);
 	INIT_LIST_HEAD(&pcdev->pse_control_head);
 
+	if (!pcdev->nr_lines)
+		pcdev->nr_lines = 1;
+
+	ret = of_load_pse_pis(pcdev);
+	if (ret)
+		return ret;
+
 	mutex_lock(&pse_list_mutex);
 	list_add(&pcdev->list, &pse_controller_list);
 	mutex_unlock(&pse_list_mutex);
@@ -91,6 +192,14 @@ EXPORT_SYMBOL_GPL(pse_controller_register);
  */
 void pse_controller_unregister(struct pse_controller_dev *pcdev)
 {
+	int i;
+
+	for (i = 0; i <= pcdev->nr_lines; i++) {
+		of_node_put(pcdev->pi[i].pairset[0].np);
+		of_node_put(pcdev->pi[i].pairset[1].np);
+		of_node_put(pcdev->pi[i].np);
+	}
+	kfree(pcdev->pi);
 	mutex_lock(&pse_list_mutex);
 	list_del(&pcdev->list);
 	mutex_unlock(&pse_list_mutex);
@@ -203,8 +312,33 @@ pse_control_get_internal(struct pse_controller_dev *pcdev, unsigned int index)
 	return psec;
 }
 
-struct pse_control *
-of_pse_control_get(struct device_node *node)
+static int of_pse_match_pi(struct pse_controller_dev *pcdev,
+			   struct device_node *np)
+{
+	int i;
+
+	for (i = 0; i <= pcdev->nr_lines; i++) {
+		if (pcdev->pi[i].np == np)
+			return i;
+	}
+
+	return -EINVAL;
+}
+
+static int psec_id_legacy_xlate(struct pse_controller_dev *pcdev,
+				const struct of_phandle_args *pse_spec)
+{
+	if (!pcdev->of_pse_n_cells)
+		return 0;
+
+	if (pcdev->of_pse_n_cells > 1 ||
+	    pse_spec->args[0] >= pcdev->nr_lines)
+		return -EINVAL;
+
+	return pse_spec->args[0];
+}
+
+struct pse_control *of_pse_control_get(struct device_node *node)
 {
 	struct pse_controller_dev *r, *pcdev;
 	struct of_phandle_args args;
@@ -222,7 +356,14 @@ of_pse_control_get(struct device_node *node)
 	mutex_lock(&pse_list_mutex);
 	pcdev = NULL;
 	list_for_each_entry(r, &pse_controller_list, list) {
-		if (args.np == r->dev->of_node) {
+		if (!r->of_legacy) {
+			ret = of_pse_match_pi(r, args.np);
+			if (ret >= 0) {
+				pcdev = r;
+				psec_id = ret;
+				break;
+			}
+		} else if (args.np == r->dev->of_node) {
 			pcdev = r;
 			break;
 		}
@@ -238,10 +379,12 @@ of_pse_control_get(struct device_node *node)
 		goto out;
 	}
 
-	psec_id = pcdev->of_xlate(pcdev, &args);
-	if (psec_id < 0) {
-		psec = ERR_PTR(psec_id);
-		goto out;
+	if (pcdev->of_legacy) {
+		psec_id = psec_id_legacy_xlate(pcdev, &args);
+		if (psec_id < 0) {
+			psec = ERR_PTR(psec_id);
+			goto out;
+		}
 	}
 
 	/* pse_list_mutex also protects the pcdev's pse_control list */
include/linux/pse-pd/pse.h +34 -4
index f006cbdf8b3b..6c48668cebe3 100644
@@ -65,6 +65,36 @@ struct device_node;
 struct of_phandle_args;
 struct pse_control;
 
+/* PSE PI pairset pinout can either be Alternative A or Alternative B */
+enum pse_pi_pairset_pinout {
+	ALTERNATIVE_A,
+	ALTERNATIVE_B,
+};
+
+/**
+ * struct pse_pi_pairset - PSE PI pairset entity describing the pinout
+ *			   alternative ant its phandle
+ *
+ * @pinout: description of the pinout alternative
+ * @np: device node pointer describing the pairset phandle
+ */
+struct pse_pi_pairset {
+	enum pse_pi_pairset_pinout pinout;
+	struct device_node *np;
+};
+
+/**
+ * struct pse_pi - PSE PI (Power Interface) entity as described in
+ *		   IEEE 802.3-2022 145.2.4
+ *
+ * @pairset: table of the PSE PI pinout alternative for the two pairset
+ * @np: device node pointer of the PSE PI node
+ */
+struct pse_pi {
+	struct pse_pi_pairset pairset[2];
+	struct device_node *np;
+};
+
 /**
  * struct pse_controller_dev - PSE controller entity that might
  *                             provide multiple PSE controls
@@ -74,11 +104,11 @@ struct pse_control;
  * @pse_control_head: head of internal list of requested PSE controls
  * @dev: corresponding driver model device struct
  * @of_pse_n_cells: number of cells in PSE line specifiers
- * @of_xlate: translation function to translate from specifier as found in the
- *            device tree to id as given to the PSE control ops
  * @nr_lines: number of PSE controls in this controller device
  * @lock: Mutex for serialization access to the PSE controller
  * @types: types of the PSE controller
+ * @pi: table of PSE PIs described in this controller device
+ * @of_legacy: flag set if the pse_pis devicetree node is not used
  */
 struct pse_controller_dev {
 	const struct pse_controller_ops *ops;
@@ -87,11 +117,11 @@ struct pse_controller_dev {
 	struct list_head pse_control_head;
 	struct device *dev;
 	int of_pse_n_cells;
-	int (*of_xlate)(struct pse_controller_dev *pcdev,
-			const struct of_phandle_args *pse_spec);
 	unsigned int nr_lines;
 	struct mutex lock;
 	u32 types;
+	struct pse_pi *pi;
+	bool of_legacy;
 };
 
 #if IS_ENABLED(CONFIG_PSE_CONTROLLER)
Signature · 1 line
2.25.1
author maintainer
#27 lore raw

PATCH v3 12/17 net: pse-pd: Add support for setup_pi_matrix callback

In reply to Kory Maincent

Implement setup_pi_matrix callback to configure the PSE PI matrix. This functionality is invoked before registering the PSE and following the core parsing of the pse_pis devicetree subnode.

---

Changes in v3:
- New patch

---
 drivers/net/pse-pd/pse_core.c | 6 ++++++
 include/linux/pse-pd/pse.h    | 2 ++
 2 files changed, 8 insertions(+)
drivers/net/pse-pd/pse_core.c +6 -0
index e03d36793d18..59427c79858c 100644
@@ -178,6 +178,12 @@ int pse_controller_register(struct pse_controller_dev *pcdev)
 	if (ret)
 		return ret;
 
+	if (pcdev->ops->setup_pi_matrix) {
+		ret = pcdev->ops->setup_pi_matrix(pcdev);
+		if (ret)
+			return ret;
+	}
+
 	mutex_lock(&pse_list_mutex);
 	list_add(&pcdev->list, &pse_controller_list);
 	mutex_unlock(&pse_list_mutex);
include/linux/pse-pd/pse.h +2 -0
index 6c48668cebe3..cf0eebb3b0a9 100644
@@ -50,6 +50,7 @@ struct pse_control_status {
  *
  * @ethtool_get_status: get PSE control status for ethtool interface
  * @ethtool_set_config: set PSE control configuration over ethtool interface
+ * @setup_pi_matrix: setup PI matrix of the PSE controller
  */
 struct pse_controller_ops {
 	int (*ethtool_get_status)(struct pse_controller_dev *pcdev,
@@ -58,6 +59,7 @@ struct pse_controller_ops {
 	int (*ethtool_set_config)(struct pse_controller_dev *pcdev,
 		unsigned long id, struct netlink_ext_ack *extack,
 		const struct pse_control_config *config);
+	int (*setup_pi_matrix)(struct pse_controller_dev *pcdev);
 };
 
 struct module;
Signature · 1 line
2.25.1
author maintainer
#28 lore raw

PATCH v3 13/17 net: pse-pd: Use regulator framework within PSE framework

In reply to Kory Maincent

Integrate the regulator framework to the PSE framework for enhanced access to features such as voltage, power measurement, and limits, which are akin to regulators. Additionally, PSE features like port priorities could potentially enhance the regulator framework. Note that this integration introduces some implementation complexity, including wrapper callbacks and nested locks, but the potential benefits make it worthwhile.

Regulator are using enable counter with specific behavior.
Two calls to regulator_disable will trigger kernel warnings. If the counter exceeds one, regulator_disable call won't disable the PSE PI. These behavior isn't suitable for PSE control.
Added a boolean 'enabled' state to prevent multiple calls to regulator_enable/disable. PSE mutex safeguards this boolean. However, ethtool command or regulator sysfs framework can set/get this boolean, leading to nested locking. The PSE nested lock function is a copy of regulator_lock_nested function, ensuring no issues with its usage.

regulator_get uses the consumer device pointer therefore of_pse_control_get is modified accordingly to pass the PSE consumer device alongside its device node.

---

Changes in v3:
- New patch

---
 drivers/net/mdio/fwnode_mdio.c     |  29 ++--
 drivers/net/pse-pd/pse_core.c      | 264 ++++++++++++++++++++++++++++++++++---
 drivers/net/pse-pd/pse_regulator.c |  48 ++++---
 include/linux/pse-pd/pse.h         |  20 ++-
 4 files changed, 302 insertions(+), 59 deletions(-)
drivers/net/mdio/fwnode_mdio.c +14 -15
index fd02f5cbc853..aa20b2ac7f2d 100644
@@ -17,19 +17,17 @@ MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("FWNODE MDIO bus (Ethernet PHY) accessors");
 
 static struct pse_control *
-fwnode_find_pse_control(struct fwnode_handle *fwnode)
+dev_find_pse_control(struct device *dev)
 {
 	struct pse_control *psec;
-	struct device_node *np;
 
 	if (!IS_ENABLED(CONFIG_PSE_CONTROLLER))
 		return NULL;
 
-	np = to_of_node(fwnode);
-	if (!np)
+	if (!dev->of_node)
 		return NULL;
 
-	psec = of_pse_control_get(np);
+	psec = of_pse_control_get(dev, dev->of_node);
 	if (PTR_ERR(psec) == -ENOENT)
 		return NULL;
 
@@ -120,15 +118,9 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus,
 	u32 phy_id;
 	int rc;
 
-	psec = fwnode_find_pse_control(child);
-	if (IS_ERR(psec))
-		return PTR_ERR(psec);
-
 	mii_ts = fwnode_find_mii_timestamper(child);
-	if (IS_ERR(mii_ts)) {
-		rc = PTR_ERR(mii_ts);
-		goto clean_pse;
-	}
+	if (IS_ERR(mii_ts))
+		return PTR_ERR(mii_ts);
 
 	is_c45 = fwnode_device_is_compatible(child, "ethernet-phy-ieee802.3-c45");
 	if (is_c45 || fwnode_get_phy_id(child, &phy_id))
@@ -161,6 +153,12 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus,
 			goto clean_phy;
 	}
 
+	psec = dev_find_pse_control(&phy->mdio.dev);
+	if (IS_ERR(psec)) {
+		rc = PTR_ERR(psec);
+		goto unregister_phy;
+	}
+
 	phy->psec = psec;
 
 	/* phy->mii_ts may already be defined by the PHY driver. A
@@ -172,12 +170,13 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus,
 
 	return 0;
 
+unregister_phy:
+	if (is_acpi_node(child) || is_of_node(child))
+		phy_device_remove(phy);
 clean_phy:
 	phy_device_free(phy);
 clean_mii_ts:
 	unregister_mii_timestamper(mii_ts);
-clean_pse:
-	pse_control_put(psec);
 
 	return rc;
 }
drivers/net/pse-pd/pse_core.c +246 -18

354 lines not on this page · raw message

drivers/net/pse-pd/pse_regulator.c +27 -21

71 lines not on this page · raw message

include/linux/pse-pd/pse.h +15 -5
index cf0eebb3b0a9..c64c709dbbc1 100644
@@ -56,10 +56,10 @@ struct pse_controller_ops {
 	int (*ethtool_get_status)(struct pse_controller_dev *pcdev,
 		unsigned long id, struct netlink_ext_ack *extack,
 		struct pse_control_status *status);
-	int (*ethtool_set_config)(struct pse_controller_dev *pcdev,
-		unsigned long id, struct netlink_ext_ack *extack,
-		const struct pse_control_config *config);
 	int (*setup_pi_matrix)(struct pse_controller_dev *pcdev);
+	int (*pi_is_enabled)(struct pse_controller_dev *pcdev, int id);
+	int (*pi_enable)(struct pse_controller_dev *pcdev, int id);
+	int (*pi_disable)(struct pse_controller_dev *pcdev, int id);
 };
 
 struct module;
@@ -91,10 +91,14 @@ struct pse_pi_pairset {
  *
  * @pairset: table of the PSE PI pinout alternative for the two pairset
  * @np: device node pointer of the PSE PI node
+ * @rdev: regulator represented by the PSE PI
+ * @enabled: PI enabled state
  */
 struct pse_pi {
 	struct pse_pi_pairset pairset[2];
 	struct device_node *np;
+	struct regulator_dev *rdev;
+	bool enabled;
 };
 
 /**
@@ -108,6 +112,8 @@ struct pse_pi {
  * @of_pse_n_cells: number of cells in PSE line specifiers
  * @nr_lines: number of PSE controls in this controller device
  * @lock: Mutex for serialization access to the PSE controller
+ * @lock_owner: current owner of the mutex
+ * @ref_cnt: mutex's reference count
  * @types: types of the PSE controller
  * @pi: table of PSE PIs described in this controller device
  * @of_legacy: flag set if the pse_pis devicetree node is not used
@@ -121,6 +127,8 @@ struct pse_controller_dev {
 	int of_pse_n_cells;
 	unsigned int nr_lines;
 	struct mutex lock;
+	struct task_struct *lock_owner;
+	int ref_cnt;
 	u32 types;
 	struct pse_pi *pi;
 	bool of_legacy;
@@ -133,7 +141,8 @@ struct device;
 int devm_pse_controller_register(struct device *dev,
 				 struct pse_controller_dev *pcdev);
 
-struct pse_control *of_pse_control_get(struct device_node *node);
+struct pse_control *of_pse_control_get(struct device *dev,
+				       struct device_node *node);
 void pse_control_put(struct pse_control *psec);
 
 int pse_ethtool_get_status(struct pse_control *psec,
@@ -148,7 +157,8 @@ bool pse_has_c33(struct pse_control *psec);
 
 #else
 
-static inline struct pse_control *of_pse_control_get(struct device_node *node)
+static inline struct pse_control *of_pse_control_get(struct device *dev,
+						     struct device_node *node)
 {
 	return ERR_PTR(-ENOENT);
 }
Signature · 1 line
2.25.1
author maintainer
#29 lore raw

PATCH v3 14/17 dt-bindings: net: pse-pd: Add bindings for PD692x0 PSE controller

In reply to Kory Maincent

Add the PD692x0 I2C Power Sourcing Equipment controller device tree bindings documentation.

---

Changes in v2:
- Enhance ports-matrix description.
- Replace additionalProperties by unevaluatedProperties.
- Drop i2c suffix.

Changes in v3:
- Remove ports-matrix parameter.
- Add description of all physical ports and managers.
- Add pse_pis subnode moving to the API of pse-controller binding.
- Remove the MAINTAINERS section for this driver as I will be maintaining all pse-pd subsystem.

---
 .../bindings/net/pse-pd/microchip,pd692x0.yaml     | 157 +++++++++++++++++++++
 1 file changed, 157 insertions(+)
Documentation/devicetree/bindings/net/pse-pd/microchip,pd692x0.yaml new file +157 -0
new file mode 100644
index 000000000000..57ba5365157c
@@ -0,0 +1,157 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/pse-pd/microchip,pd692x0.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip PD692x0 Power Sourcing Equipment controller
+
+maintainers:
+  - Kory Maincent <[email protected]>
+
+allOf:
+  - $ref: pse-controller.yaml#
+
+properties:
+  compatible:
+    enum:
+      - microchip,pd69200
+      - microchip,pd69210
+      - microchip,pd69220
+
+  reg:
+    maxItems: 1
+
+  managers:
+    $ref: "#/$defs/managers"
+    description:
+      List of the PD69208T4/PD69204T4/PD69208M PSE managers. Each manager
+      have 4 or 8 physical ports according to the chip version. No need to
+      specify the SPI chip select as it is automatically detected by the
+      PD692x0 PSE controller. The PSE managers have to be described from
+      the lowest chip select to the greatest one, which is the detection
+      behavior of the PD692x0 PSE controller. The PD692x0 support up to
+      12 PSE managers which can expose up to 96 physical ports. All
+      physical ports available on a manager have to be described in the
+      incremental order even if they are not used.
+
+required:
+  - compatible
+  - reg
+  - pse_pis
+
+$defs:
+  manager:
+    $ref: /schemas/graph.yaml#/properties/ports
+
+    properties:
+      reg:
+        maxItems: 1
+
+    patternProperties:
+      '^port@[0-7]$':
+        type: object
+        required:
+          - reg
+
+    required:
+      - reg
+
+  managers:
+    type: object
+
+    properties:
+      "#address-cells":
+        const: 1
+
+      "#size-cells":
+        const: 0
+
+    patternProperties:
+      "^manager@0[0-9]|1[0-2]$":
+        $ref: "#/$defs/manager"
+
+    required:
+      - "#address-cells"
+      - "#size-cells"
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      ethernet-pse@3c {
+        compatible = "microchip,pd69200";
+        reg = <0x3c>;
+
+        managers {
+          #address-cells = <1>;
+          #size-cells = <0>;
+
+          manager@0 {
+            reg = <0>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            phys0: port@0 {
+              reg = <0>;
+            };
+
+            phys1: port@1 {
+              reg = <1>;
+            };
+
+            phys2: port@2 {
+              reg = <2>;
+            };
+
+            phys3: port@3 {
+              reg = <3>;
+            };
+          };
+
+          manager@1 {
+            reg = <1>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            phys4: port@0 {
+              reg = <0>;
+            };
+
+            phys5: port@1 {
+              reg = <1>;
+            };
+
+            phys6: port@2 {
+              reg = <2>;
+            };
+
+            phys7: port@3 {
+              reg = <3>;
+            };
+          };
+        };
+
+        pse_pis {
+          #address-cells = <1>;
+          #size-cells = <0>;
+
+          pse_pi0: pse_pi@0 {
+            reg = <0>;
+            #pse-cells = <0>;
+            pairset-names = "alternative-a", "alternative-b";
+            pairsets = <&phys0>, <&phys1>;
+          };
+          pse_pi1: pse_pi@1 {
+            reg = <1>;
+            #pse-cells = <0>;
+            pairset-names = "alternative-a";
+            pairsets = <&phys2>;
+          };
+        };
+      };
+    };
Signature · 1 line
2.25.1
maintainer
#30 lore raw

Re: [PATCH net-next v3 14/17] dt-bindings: net: pse-pd: Add bindings for PD692x0 PSE controller

Quoted 54 lines · Kory Maincent

Add the PD692x0 I2C Power Sourcing Equipment controller device tree bindings documentation.

---

Changes in v2:
- Enhance ports-matrix description.
- Replace additionalProperties by unevaluatedProperties.
- Drop i2c suffix.

Changes in v3:
- Remove ports-matrix parameter.
- Add description of all physical ports and managers.
- Add pse_pis subnode moving to the API of pse-controller binding.
- Remove the MAINTAINERS section for this driver as I will be maintaining all pse-pd subsystem.

---
 .../bindings/net/pse-pd/microchip,pd692x0.yaml     | 157 +++++++++++++++++++++
 1 file changed, 157 insertions(+)
Documentation/devicetree/bindings/net/pse-pd/microchip,pd692x0.yaml new file +26 -0
new file mode 100644
index 000000000000..57ba5365157c
@@ -0,0 +1,157 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/pse-pd/microchip,pd692x0.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip PD692x0 Power Sourcing Equipment controller
+
+maintainers:
+  - Kory Maincent <[email protected]>
+
+allOf:
+  - $ref: pse-controller.yaml#
+
+properties:
+  compatible:
+    enum:
+      - microchip,pd69200
+      - microchip,pd69210
+      - microchip,pd69220
+
+  reg:
+    maxItems: 1
+
+  managers:
+    $ref: "#/$defs/managers"

Documentation/devicetree/bindings/net/pse-pd/microchip,pd692x0.yaml line 36

Quoted 10 lines
Documentation/devicetree/bindings/net/pse-pd/microchip,pd692x0.yaml new file +10 -0
+    description:
+      List of the PD69208T4/PD69204T4/PD69208M PSE managers. Each manager
+      have 4 or 8 physical ports according to the chip version. No need to
+      specify the SPI chip select as it is automatically detected by the
+      PD692x0 PSE controller. The PSE managers have to be described from
+      the lowest chip select to the greatest one, which is the detection
+      behavior of the PD692x0 PSE controller. The PD692x0 support up to
+      12 PSE managers which can expose up to 96 physical ports. All
+      physical ports available on a manager have to be described in the
+      incremental order even if they are not used.

Looks to me like you just need 3 PSE cells: <manager> <port> <A|B>

Really, no need for each piece of data to its own cell, so it could be merged into 1 or 2 cells.

But cell data is generally supposed to be meaningful to the provider and opaque to the consumer. It's not clear to me who needs to know alternative A vs. B. That seems more like a property of the PHY than the power provider?

Rob

maintainer
#31 lore raw

Re: [PATCH net-next v3 14/17] dt-bindings: net: pse-pd: Add bindings for PD692x0 PSE controller

Quoted 68 lines · Rob Herring
Quoted 54 lines · Kory Maincent

Add the PD692x0 I2C Power Sourcing Equipment controller device tree bindings documentation.

---

Changes in v2:
- Enhance ports-matrix description.
- Replace additionalProperties by unevaluatedProperties.
- Drop i2c suffix.

Changes in v3:
- Remove ports-matrix parameter.
- Add description of all physical ports and managers.
- Add pse_pis subnode moving to the API of pse-controller binding.
- Remove the MAINTAINERS section for this driver as I will be maintaining all pse-pd subsystem.

---
 .../bindings/net/pse-pd/microchip,pd692x0.yaml     | 157 +++++++++++++++++++++
 1 file changed, 157 insertions(+)
Documentation/devicetree/bindings/net/pse-pd/microchip,pd692x0.yaml new file +26 -0
new file mode 100644
index 000000000000..57ba5365157c
@@ -0,0 +1,157 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/pse-pd/microchip,pd692x0.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip PD692x0 Power Sourcing Equipment controller
+
+maintainers:
+  - Kory Maincent <[email protected]>
+
+allOf:
+  - $ref: pse-controller.yaml#
+
+properties:
+  compatible:
+    enum:
+      - microchip,pd69200
+      - microchip,pd69210
+      - microchip,pd69220
+
+  reg:
+    maxItems: 1
+
+  managers:
+    $ref: "#/$defs/managers"

Documentation/devicetree/bindings/net/pse-pd/microchip,pd692x0.yaml line 36

Quoted 10 lines
Documentation/devicetree/bindings/net/pse-pd/microchip,pd692x0.yaml new file +10 -0
+    description:
+      List of the PD69208T4/PD69204T4/PD69208M PSE managers. Each manager
+      have 4 or 8 physical ports according to the chip version. No need to
+      specify the SPI chip select as it is automatically detected by the
+      PD692x0 PSE controller. The PSE managers have to be described from
+      the lowest chip select to the greatest one, which is the detection
+      behavior of the PD692x0 PSE controller. The PD692x0 support up to
+      12 PSE managers which can expose up to 96 physical ports. All
+      physical ports available on a manager have to be described in the
+      incremental order even if they are not used.

Looks to me like you just need 3 PSE cells: <manager> <port> <A|B>

Quoted 7 lines

Really, no need for each piece of data to its own cell, so it could be merged into 1 or 2 cells.

But cell data is generally supposed to be meaningful to the provider and opaque to the consumer. It's not clear to me who needs to know alternative A vs. B. That seems more like a property of the PHY than the power provider?

This is a bit complex question, so I decided to answer it with freshly created documentation which should be included to this patch set:

PSE Power Interface (PSE PI) Documentation
==========================================

The Power Sourcing Equipment Power Interface (PSE PI) plays a pivotal role in the architecture of Power over Ethernet (PoE) systems. It is essentially a blueprint that outlines how one or multiple power sources are connected to the eight-pin modular jack, commonly known as the Ethernet RJ45 port. This connection scheme is crucial for enabling the delivery of power alongside data over Ethernet cables.

Documentation and Standards
---------------------------

The IEEE 802.3 standard provides detailed documentation on the PSE PI. Specifically:

- Section "33.2.3 PI pin assignments" covers the pin assignments for PoE systems that utilize two pairs for power delivery.
- Section "145.2.4 PSE PI" addresses the configuration for PoE systems that deliver power over all four pairs of an Ethernet cable.

PSE PI and Single Pair Ethernet
-------------------------------

Single Pair Ethernet (SPE) represents a different approach to Ethernet connectivity, utilizing just one pair of conductors for both data and power transmission. Unlike the configurations detailed in the PSE PI for standard Ethernet, which can involve multiple power sourcing arrangements across four or two pairs of wires, SPE operates on a simpler model due to its single-pair design. As a result, the complexities of choosing between alternative pin assignments for power delivery, as described in the PSE PI for multi-pair Ethernet, are not applicable to SPE.

Understanding PSE PI
--------------------

The Power Sourcing Equipment Power Interface (PSE PI) is a framework defining how Power Sourcing Equipment (PSE) delivers power to Powered Devices (PDs) over Ethernet cables. It details two main configurations for power delivery, known as Alternative A and Alternative B, which are distinguished not only by their method of power transmission but also by the implications for polarity and data transmission direction.

Alternative A and B Overview
----------------------------

- **Alternative A:** Utilizes the data-carrying pairs for power transmission in 10/100BaseT networks. The power delivery's polarity in this alternative can vary based on the MDI (Medium Dependent Interface) or MDI-X (Medium Dependent Interface Crossover) configuration.

- **Alternative B:** Delivers power over the spare pairs not used for data in 10/100BaseT networks. Unlike Alternative A, Alternative B's method separates power from data lines within the cable. Though it is less influenced by data transmission direction, Alternative B includes two configurations with different polarities, known as variant X and variant S, to accommodate different network requirements and device specifications.

Table 145–3—PSE Pinout Alternatives
-----------------------------------

The following table outlines the pin configurations for both Alternative A and Alternative B.

+------------+-------------------+-----------------+-----------------+-----------------+
| Conductor  | Alternative A     | Alternative A   | Alternative B   | Alternative B   |
|            |    (MDI-X)        |      (MDI)      |        (X)      |        (S)      |
+============+===================+=================+=================+=================+
| 1          | Negative V        | Positive V      | -               | -               |
+------------+-------------------+-----------------+-----------------+-----------------+
| 2          | Negative V        | Positive V      | -               | -               |
+------------+-------------------+-----------------+-----------------+-----------------+
| 3          | Positive V        | Negative V      | -               | -               |
+------------+-------------------+-----------------+-----------------+-----------------+
| 4          | -                 | -               | Negative V      | Positive V      |
+------------+-------------------+-----------------+-----------------+-----------------+
| 5          | -                 | -               | Negative V      | Positive V      |
+------------+-------------------+-----------------+-----------------+-----------------+
| 6          | Positive V        | Negative V      | -               | -               |
+------------+-------------------+-----------------+-----------------+-----------------+
| 7          | -                 | -               | Positive V      | Negative V      |
+------------+-------------------+-----------------+-----------------+-----------------+
| 8          | -                 | -               | Positive V      | Negative V      |
+------------+-------------------+-----------------+-----------------+-----------------+

.. note::
- "Positive V" and "Negative V" indicate the voltage polarity for each pin.
- "-" indicates that the pin is not used for power delivery in that specific configuration.

PSE Power Interface (PSE PI) Connection Diagram
------------------------------------------------

The diagram below illustrates the connection architecture between the RJ45 port, the Ethernet PHY (Physical Layer), and the PSE PI (Power Sourcing Equipment Power Interface), demonstrating how power and data are delivered simultaneously through an Ethernet cable. The RJ45 port serves as the physical interface for these connections, with each of its eight pins connected to both the Ethernet PHY for data transmission and the PSE PI for power delivery.

.. code-block::

    +--------------------------+
    |                          |
    |          RJ45 Port       |
    |                          |
    +--+--+--+--+--+--+--+--+--+                +-------------+
      1| 2| 3| 4| 5| 6| 7| 8|                   |             |
       |  |  |  |  |  |  |  o-------------------+             |
       |  |  |  |  |  |  o--|-------------------+             +<--- PSE 1
       |  |  |  |  |  o--|--|-------------------+             |
       |  |  |  |  o--|--|--|-------------------+             |
       |  |  |  o--|--|--|--|-------------------+  PSE PI     |
       |  |  o--|--|--|--|--|-------------------+             |
       |  o--|--|--|--|--|--|-------------------+             +<--- PSE 2 (optional)
       o--|--|--|--|--|--|--|-------------------+             |
       |  |  |  |  |  |  |  |                   |             |
    +--+--+--+--+--+--+--+--+--+                +-------------+
    |                          |
    |       Ethernet PHY       |
    |                          |
    +--------------------------+

Simple PSE PI Configuration for Alternative A
---------------------------------------------

The diagram below illustrates a straightforward PSE PI (Power Sourcing Equipment Power Interface) configuration designed to support the Alternative A setup for Power over Ethernet (PoE). This implementation is tailored to provide power delivery through the data-carrying pairs of an Ethernet cable, suitable for either MDI or MDI-X configurations, albeit supporting one variation at a time.

.. code-block::

         +-------------+
         |    PSE PI   |
 8  -----+                             +-------------+
 7  -----+                    Rail 1   |             
 6  -----+------+----------------------+             
 5  -----+      |                      |             
 4  -----+     /              Rail 2   |  PSE 1       
 3  -----+----´          +-------------+             
 2  -----+----+---------´              |             
 1  -----+---´                         +-------------+
         |                                           
         +-------------+                            

In this configuration:

- Pins 1 and 2, as well as pins 3 and 6, are utilized for power delivery in addition to data transmission. This aligns with the standard wiring for 10/100BaseT Ethernet networks where these pairs are used for data.
- Rail 1 and Rail 2 represent the positive and negative voltage rails, with Rail 1 connected to pins 1 and 2, and Rail 2 connected to pins 3 and 6. More advanced PSE PI configurations may include integrated or external switches to change the polarity of the voltage rails, allowing for compatibility with both MDI and MDI-X configurations.

More complex PSE PI configurations may include additional components, to support Alternative B, or to provide additional features such as power management, or additional power delivery capabilities such as 2-pair or 4-pair power delivery.

.. code-block::

         +-------------+
         |    PSE PI   |
         |        +---+
 8  -----+--------+   |                 +-------------+
 7  -----+--------+   |       Rail 1   |             
 6  -----+--------+   +-----------------+             
 5  -----+--------+   |                |             
 4  -----+--------+   |       Rail 2   |  PSE 1       
 3  -----+--------+   +----------------+             
 2  -----+--------+   |                |             
 1  -----+--------+   |                 +-------------+
         |        +---+                               
         +-------------+                            

Device Tree Configuration: Describing PSE PI Configurations
------------------------------------------------------------

The necessity for a separate PSE PI node in the device tree is influenced by the intricacy of the Power over Ethernet (PoE) system's setup. Here are descriptions of both simple and complex PSE PI configurations to illustrate this decision-making process:

**Simple PSE PI Configuration:**
In a straightforward scenario, the PSE PI setup involves a direct, one-to-one connection between a single PSE controller and an Ethernet port. This setup typically supports basic PoE functionality without the need for dynamic configuration or management of multiple power delivery modes. For such simple configurations, detailing the PSE PI within the existing PSE controller's node may suffice, as the system does not encompass additional complexity that warrants a separate node. The primary focus here is on the clear and direct association of power delivery to a specific Ethernet port.

**Complex PSE PI Configuration:**
Contrastingly, a complex PSE PI setup may encompass multiple PSE controllers or auxiliary circuits that collectively manage power delivery to one Ethernet port. Such configurations might support a range of PoE standards and require the capability to dynamically configure power delivery based on the operational mode (e.g., PoE2 versus PoE4) or specific requirements of connected devices. In these instances, a dedicated PSE PI node becomes essential for accurately documenting the system architecture. This node would serve to detail the interactions between different PSE controllers, the support for various PoE modes, and any additional logic required to coordinate power delivery across the network infrastructure.

**Guidance:**

For simple PSE setups, including PSE PI information in the PSE controller node might suffice due to the straightforward nature of these systems. However, complex configurations, involving multiple components or advanced PoE features, benefit from a dedicated PSE PI node. This method adheres to IEEE 802.3 specifications, improving documentation clarity and ensuring accurate representation of the PoE system's complexity.

PSE PI Node: Essential Information
----------------------------------

The PSE PI (Power Sourcing Equipment Power Interface) node in a device tree can include several key pieces of information critical for defining the power delivery capabilities and configurations of a PoE (Power over Ethernet) system. Below is a list of such information, along with explanations for their necessity and reasons why they might not be found within a PSE controller node:

1. **Powered Pairs Configuration**
- *Description:* Identifies the pairs used for power delivery in the Ethernet cable.
- *Necessity:* Essential to ensure the correct pairs are powered according to the board's design.
- *PSE Controller Node:* Typically lacks details on physical pair usage, focusing on power regulation.

2. **Polarity of Powered Pairs**
- *Description:* Specifies the polarity (positive or negative) for each powered pair.
- *Necessity:* Critical for safe and effective power transmission to PDs.
- *PSE Controller Node:* Polarity management may exceed the standard functionalities of PSE controllers.

3. **PSE Cells Association**
- *Description:* Details the association of PSE cells with Ethernet ports or pairs in multi-cell configurations.
- *Necessity:* Allows for optimized power resource allocation in complex systems.
- *PSE Controller Node:* Controllers may not manage cell associations directly, focusing instead on power flow regulation.

4. **Support for PoE Standards**
- *Description:* Lists the PoE standards and configurations supported by the system.
- *Necessity:* Ensures system compatibility with various PDs and adherence to industry standards.
- *PSE Controller Node:* Specific capabilities may depend on the overall PSE PI design rather than the controller alone. Multiple PSE cells per PI do not necessarily imply support for multiple PoE standards.

5. **Protection Mechanisms**
- *Description:* Outlines additional protection mechanisms, such as overcurrent protection and thermal management.
- *Necessity:* Provides extra safety and stability, complementing PSE controller protections.
- *PSE Controller Node:* Some protections may be implemented via board-specific hardware or algorithms external to the controller.

Regards,
Oleksij

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
#32 lore raw

Re: [PATCH net-next v3 14/17] dt-bindings: net: pse-pd: Add bindings for PD692x0 PSE controller

Quoted 8 lines

Alternative A and B Overview
----------------------------

- **Alternative A:** Utilizes the data-carrying pairs for power transmission in 10/100BaseT networks. The power delivery's polarity in this alternative can vary based on the MDI (Medium Dependent Interface) or MDI-X (Medium Dependent Interface Crossover) configuration.

Quoted 6 lines

- **Alternative B:** Delivers power over the spare pairs not used for data in 10/100BaseT networks. Unlike Alternative A, Alternative B's method separates power from data lines within the cable. Though it is less influenced by data transmission direction, Alternative B includes two configurations with different polarities, known as variant X and variant S, to accommodate different network requirements and device specifications.

Thanks for this documentation.

It might be worth pointing out that RJ-45 supports up to 4 pairs. However, 10/100BaseT only makes use of two pairs for data transfer from the four. 1000BaseT and above make use of all four pairs for data transfer. If you don't know this, it is not so obvious what 'data-carrying pairs' and 'spare pairs' mean.

And what happens for 1000BaseT when all four pairs are in use?

Andrew

maintainer
#33 lore raw

Re: [PATCH net-next v3 14/17] dt-bindings: net: pse-pd: Add bindings for PD692x0 PSE controller

Quoted 15 lines · Andrew Lunn
Quoted 8 lines

Alternative A and B Overview
----------------------------

- **Alternative A:** Utilizes the data-carrying pairs for power transmission in 10/100BaseT networks. The power delivery's polarity in this alternative can vary based on the MDI (Medium Dependent Interface) or MDI-X (Medium Dependent Interface Crossover) configuration.

Quoted 6 lines

- **Alternative B:** Delivers power over the spare pairs not used for data in 10/100BaseT networks. Unlike Alternative A, Alternative B's method separates power from data lines within the cable. Though it is less influenced by data transmission direction, Alternative B includes two configurations with different polarities, known as variant X and variant S, to accommodate different network requirements and device specifications.

Quoted 7 lines

Thanks for this documentation.

It might be worth pointing out that RJ-45 supports up to 4 pairs. However, 10/100BaseT only makes use of two pairs for data transfer from the four. 1000BaseT and above make use of all four pairs for data transfer. If you don't know this, it is not so obvious what 'data-carrying pairs' and 'spare pairs' mean.

@Kory, can you please update it.

Quoted 1 line

And what happens for 1000BaseT when all four pairs are in use?

Hm.. good question. I didn't found the answer in the spec. By combining all puzzle parts I assume, different Alternative configurations are designed to handle conflict between "PSE Physical Layer classification" and PHY autoneg.

Here is how multi-pulse Physical Layer classification is done:
https://img.electronicdesign.com/files/base/ebm/electronicdesign/image/2020/07/Figure_5.5f2094553a61c.png

this is the source:
https://www.electronicdesign.com/technologies/power/whitepaper/21137799/silicon-labs-90-w-power-over-ethernet-explained

To avoid classification conflict with autoneg. Assuming, PHY on PD side will be not powered until classification is completed. The only source of pulses is the PHY on PSE side (if it is not under control of software on PSE side or Midspan PSE is used), so aneg pulses should be send on negative PoE pair? This all is just speculation, I would need to ask some expert or do testing.

If this assumption is correct, PHY framework will need to know exact layout of MDI-X setting and/or silent PHY until PSE classification is done.

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 |
author maintainer
#34 lore raw

Re: [PATCH net-next v3 14/17] dt-bindings: net: pse-pd: Add bindings for PD692x0 PSE controller

Quoted 25 lines · On Thu, 15 Feb 2024 09:17:48 +0100 Oleksij Rempel <[email protected]>…
Quoted 16 lines · Andrew Lunn
Quoted 8 lines

Alternative A and B Overview
----------------------------

- **Alternative A:** Utilizes the data-carrying pairs for power transmission in 10/100BaseT networks. The power delivery's polarity in this alternative can vary based on the MDI (Medium Dependent Interface) or MDI-X (Medium Dependent Interface Crossover) configuration.

Quoted 7 lines

- **Alternative B:** Delivers power over the spare pairs not used for data in 10/100BaseT networks. Unlike Alternative A, Alternative B's method separates power from data lines within the cable. Though it is less influenced by data transmission direction, Alternative B includes two configurations with different polarities, known as variant X and variant S, to accommodate different network requirements and device specifications.

Quoted 7 lines

Thanks for this documentation.

It might be worth pointing out that RJ-45 supports up to 4 pairs. However, 10/100BaseT only makes use of two pairs for data transfer from the four. 1000BaseT and above make use of all four pairs for data transfer. If you don't know this, it is not so obvious what 'data-carrying pairs' and 'spare pairs' mean.

Quoted 8 lines

@Kory, can you please update it.

Quoted 1 line

And what happens for 1000BaseT when all four pairs are in use?

Hm.. good question. I didn't found the answer in the spec. By combining all puzzle parts I assume, different Alternative configurations are designed to handle conflict between "PSE Physical Layer classification" and PHY autoneg.

Oleksij how did you get the definition of Alternative A uses the "data-carrying" pairs for power transmission and Alternative B Delivers power over the "spare pairs"?

On my understanding of the 2022 standard the definition is:
- Alternative A is for pinout conductors 1, 2, 3 and 6
- Alternative B is for pinout conductors 4, 5, 7, 8.

Then indeed if we are in 10/100BaseT Alternative A are "data-carrying pairs" and Alternative B are "spare pairs" but that's not the case on 1000BaseT.

You can see it in the figures in the paragraph 145.2.3.

Regards,

Signature · 3 lines
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
maintainer
#35 lore raw

Re: [PATCH net-next v3 14/17] dt-bindings: net: pse-pd: Add bindings for PD692x0 PSE controller

Quoted 28 lines · Köry Maincent
Quoted 25 lines · On Thu, 15 Feb 2024 09:17:48 +0100 Oleksij Rempel <[email protected]>…
Quoted 23 lines · Andrew Lunn
Quoted 8 lines

Alternative A and B Overview
----------------------------

- **Alternative A:** Utilizes the data-carrying pairs for power transmission in 10/100BaseT networks. The power delivery's polarity in this alternative can vary based on the MDI (Medium Dependent Interface) or MDI-X (Medium Dependent Interface Crossover) configuration.

Quoted 7 lines

- **Alternative B:** Delivers power over the spare pairs not used for data in 10/100BaseT networks. Unlike Alternative A, Alternative B's method separates power from data lines within the cable. Though it is less influenced by data transmission direction, Alternative B includes two configurations with different polarities, known as variant X and variant S, to accommodate different network requirements and device specifications.

Thanks for this documentation.

It might be worth pointing out that RJ-45 supports up to 4 pairs. However, 10/100BaseT only makes use of two pairs for data transfer from the four. 1000BaseT and above make use of all four pairs for data transfer. If you don't know this, it is not so obvious what 'data-carrying pairs' and 'spare pairs' mean.

Quoted 5 lines
Quoted 5 lines

@Kory, can you please update it.

Quoted 1 line

And what happens for 1000BaseT when all four pairs are in use?

Hm.. good question. I didn't found the answer in the spec. By combining all

                                                               ^^^^^^^^^^^^^^^^
Quoted 1 line
Quoted 1 line

puzzle parts I assume, different Alternative configurations are designed

    ^^^^^^^^^^^^^^^^^^^^^^
Quoted 11 lines
Quoted 2 lines

to handle conflict between "PSE Physical Layer classification" and PHY autoneg.

Oleksij how did you get the definition of Alternative A uses the "data-carrying" pairs for power transmission and Alternative B Delivers power over the "spare pairs"?

On my understanding of the 2022 standard the definition is:
- Alternative A is for pinout conductors 1, 2, 3 and 6
- Alternative B is for pinout conductors 4, 5, 7, 8.

Quoted 5 lines

Then indeed if we are in 10/100BaseT Alternative A are "data-carrying pairs" and Alternative B are "spare pairs" but that's not the case on 1000BaseT.

You can see it in the figures in the paragraph 145.2.3.

Please, re-read my answer :)

Autoneg for 1000Mbit is not done on all 4 pairs. The only MDI/-X dependent transfer processes only on one pair is autoneg. Every thing else is extrapolated out of it.

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
#36 lore raw

Re: [PATCH net-next v3 14/17] dt-bindings: net: pse-pd: Add bindings for PD692x0 PSE controller

In reply to Oleksij Rempel
Quoted 18 lines

Hm.. good question. I didn't found the answer in the spec. By combining all puzzle parts I assume, different Alternative configurations are designed to handle conflict between "PSE Physical Layer classification" and PHY autoneg.

Here is how multi-pulse Physical Layer classification is done:
https://img.electronicdesign.com/files/base/ebm/electronicdesign/image/2020/07/Figure_5.5f2094553a61c.png

this is the source:
https://www.electronicdesign.com/technologies/power/whitepaper/21137799/silicon-labs-90-w-power-over-ethernet-explained

To avoid classification conflict with autoneg. Assuming, PHY on PD side will be not powered until classification is completed. The only source of pulses is the PHY on PSE side (if it is not under control of software on PSE side or Midspan PSE is used), so aneg pulses should be send on negative PoE pair? This all is just speculation, I would need to ask some expert or do testing.

Quoted 2 lines

If this assumption is correct, PHY framework will need to know exact layout of MDI-X setting and/or silent PHY until PSE classification is done.

Ideally, we don't want to define a DT binding, and then find it is wrong for 1000BaseT and above and we need to change it.

So, either somebody needs to understand 1000BaseT and can say the proposed binding works, or we explicitly document the binding is limited to 10BaseT and 100BaseT.

I'm not sure the second solution will actually fly. This was being tested with Marvell Prestera switch. I doubt it even has any Fast Ethernet ports.

Andrew

maintainer
#37 lore raw

Re: [PATCH net-next v3 14/17] dt-bindings: net: pse-pd: Add bindings for PD692x0 PSE controller

Quoted 21 lines · Andrew Lunn
Quoted 18 lines

Hm.. good question. I didn't found the answer in the spec. By combining all puzzle parts I assume, different Alternative configurations are designed to handle conflict between "PSE Physical Layer classification" and PHY autoneg.

Here is how multi-pulse Physical Layer classification is done:
https://img.electronicdesign.com/files/base/ebm/electronicdesign/image/2020/07/Figure_5.5f2094553a61c.png

this is the source:
https://www.electronicdesign.com/technologies/power/whitepaper/21137799/silicon-labs-90-w-power-over-ethernet-explained

To avoid classification conflict with autoneg. Assuming, PHY on PD side will be not powered until classification is completed. The only source of pulses is the PHY on PSE side (if it is not under control of software on PSE side or Midspan PSE is used), so aneg pulses should be send on negative PoE pair? This all is just speculation, I would need to ask some expert or do testing.

Quoted 2 lines

If this assumption is correct, PHY framework will need to know exact layout of MDI-X setting and/or silent PHY until PSE classification is done.

Quoted 6 lines

Ideally, we don't want to define a DT binding, and then find it is wrong for 1000BaseT and above and we need to change it.

So, either somebody needs to understand 1000BaseT and can say the proposed binding works, or we explicitly document the binding is limited to 10BaseT and 100BaseT.

I asked the internet and found the answer: Some PSE/PD implementations are not compatible with 1000BaseT.

See Figure 33–4—10BASE-T/100BASE-TX Endpoint PSE location overview. Alternative B show a variant where power is injected directly to pairs without using magnetics as it is done for Alternative A (phantom delivery - over magnetics).

I assume, the reasoning for this kind of design is simple - price. Otherwise magnetics will have special requirements:
https://www.coilcraft.com/de-de/edu/series/magnetics-for-power-over-ethernet/

So, we have following variants of 2 pairs PoE:

+---------+---------------+-------------------+---------------------+--------------------+
| Variant | Alternative   | Polarity          | Power Feeding Type  | Compatibility with |
|         | (a/b)         | (Direct/Reverse)  | (Direct/Phantom)    | 1000BaseT          |
+=========+===============+===================+=====================+====================+
| 1       | a             | Direct            | Phantom             | Yes                |
+---------+---------------+-------------------+---------------------+--------------------+
| 2       | a             | Reverse           | Phantom             | Yes                |
+---------+---------------+-------------------+---------------------+--------------------+
| 3       | b             | Direct            | Phantom             | Yes                |
+---------+---------------+-------------------+---------------------+--------------------+
| 4       | b             | Reverse           | Phantom             | Yes                |
+---------+---------------+-------------------+---------------------+--------------------+
| 5       | b             | Direct            | Direct              | No                 |
+---------+---------------+-------------------+---------------------+--------------------+
| 6       | b             | Reverse           | Direct              | No                 |
+---------+---------------+-------------------+---------------------+--------------------+

An advanced PSE may implement range of different variants direct in the PSE controller or with additional ICs in the PSE PI. The same is about PD.

Let's take as example PD-IM-7608M eval board:
https://www.microchip.com/en-us/development-tool/PD-IM-7608M

According to the schematics:
https://ww1.microchip.com/downloads/en/DeviceDoc/PD-IM-7608M.zip
It supports only Variant 5 - Alternative B, with only one polarity, and direct feeding without magnetics.

The simple PD may support only one variant:
https://community.fs.com/article/troubleshooting-poe-errors.html
" the power modes of PSE and PD are other factors that may cause PoE faults. There are three PoE modes: Alternative A, alternative B, and 4-pair delivery. If a PD only supports PoE mode B power delivery, while a PoE switch is based on Alternative A, as a result, the PD and PoE switch can not work together."

For this case, it will be good if systems knows supported modes, so user can get this information directly. For example with ethtool

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
#38 lore raw

Re: [PATCH net-next v3 14/17] dt-bindings: net: pse-pd: Add bindings for PD692x0 PSE controller

Hi Kory,

Can you please integrated this new insights to the PSE PI documentation. Instead of 1000BaseT only, please use 1000/2.5G/5G/10GBASE-T as documented in the spec.

Quoted 86 lines · Oleksij Rempel
Quoted 21 lines · Andrew Lunn
Quoted 18 lines

Hm.. good question. I didn't found the answer in the spec. By combining all puzzle parts I assume, different Alternative configurations are designed to handle conflict between "PSE Physical Layer classification" and PHY autoneg.

Here is how multi-pulse Physical Layer classification is done:
https://img.electronicdesign.com/files/base/ebm/electronicdesign/image/2020/07/Figure_5.5f2094553a61c.png

this is the source:
https://www.electronicdesign.com/technologies/power/whitepaper/21137799/silicon-labs-90-w-power-over-ethernet-explained

To avoid classification conflict with autoneg. Assuming, PHY on PD side will be not powered until classification is completed. The only source of pulses is the PHY on PSE side (if it is not under control of software on PSE side or Midspan PSE is used), so aneg pulses should be send on negative PoE pair? This all is just speculation, I would need to ask some expert or do testing.

Quoted 2 lines

If this assumption is correct, PHY framework will need to know exact layout of MDI-X setting and/or silent PHY until PSE classification is done.

Quoted 6 lines

Ideally, we don't want to define a DT binding, and then find it is wrong for 1000BaseT and above and we need to change it.

So, either somebody needs to understand 1000BaseT and can say the proposed binding works, or we explicitly document the binding is limited to 10BaseT and 100BaseT.

I asked the internet and found the answer: Some PSE/PD implementations are not compatible with 1000BaseT.

See Figure 33–4—10BASE-T/100BASE-TX Endpoint PSE location overview. Alternative B show a variant where power is injected directly to pairs without using magnetics as it is done for Alternative A (phantom delivery - over magnetics).

I assume, the reasoning for this kind of design is simple - price. Otherwise magnetics will have special requirements:
https://www.coilcraft.com/de-de/edu/series/magnetics-for-power-over-ethernet/

So, we have following variants of 2 pairs PoE:

+---------+---------------+-------------------+---------------------+--------------------+
| Variant | Alternative   | Polarity          | Power Feeding Type  | Compatibility with |
|         | (a/b)         | (Direct/Reverse)  | (Direct/Phantom)    | 1000BaseT          |
+=========+===============+===================+=====================+====================+
| 1       | a             | Direct            | Phantom             | Yes                |
+---------+---------------+-------------------+---------------------+--------------------+
| 2       | a             | Reverse           | Phantom             | Yes                |
+---------+---------------+-------------------+---------------------+--------------------+
| 3       | b             | Direct            | Phantom             | Yes                |
+---------+---------------+-------------------+---------------------+--------------------+
| 4       | b             | Reverse           | Phantom             | Yes                |
+---------+---------------+-------------------+---------------------+--------------------+
| 5       | b             | Direct            | Direct              | No                 |
+---------+---------------+-------------------+---------------------+--------------------+
| 6       | b             | Reverse           | Direct              | No                 |
+---------+---------------+-------------------+---------------------+--------------------+

An advanced PSE may implement range of different variants direct in the PSE controller or with additional ICs in the PSE PI. The same is about PD.

Let's take as example PD-IM-7608M eval board:
https://www.microchip.com/en-us/development-tool/PD-IM-7608M

According to the schematics:
https://ww1.microchip.com/downloads/en/DeviceDoc/PD-IM-7608M.zip
It supports only Variant 5 - Alternative B, with only one polarity, and direct feeding without magnetics.

The simple PD may support only one variant:
https://community.fs.com/article/troubleshooting-poe-errors.html
" the power modes of PSE and PD are other factors that may cause PoE faults. There are three PoE modes: Alternative A, alternative B, and 4-pair delivery. If a PD only supports PoE mode B power delivery, while a PoE switch is based on Alternative A, as a result, the PD and PoE switch can not work together."

For this case, it will be good if systems knows supported modes, so user can get this information directly. For example with ethtool

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 |
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 |
author maintainer
#39 lore raw

Re: [PATCH net-next v3 14/17] dt-bindings: net: pse-pd: Add bindings for PD692x0 PSE controller

In reply to Oleksij Rempel
Quoted 29 lines · On Fri, 16 Feb 2024 08:47:14 +0100 Oleksij Rempel <[email protected]>…
Quoted 4 lines

So, either somebody needs to understand 1000BaseT and can say the proposed binding works, or we explicitly document the binding is limited to 10BaseT and 100BaseT.

I asked the internet and found the answer: Some PSE/PD implementations are not compatible with 1000BaseT.

See Figure 33–4—10BASE-T/100BASE-TX Endpoint PSE location overview. Alternative B show a variant where power is injected directly to pairs without using magnetics as it is done for Alternative A (phantom delivery - over magnetics).

So, we have following variants of 2 pairs PoE:

+---------+---------------+-------------------+---------------------+--------------------+
| Variant | Alternative   | Polarity          | Power Feeding Type  |
Compatibility with | |         | (a/b)         | (Direct/Reverse)  |
(Direct/Phantom)    | 1000BaseT          |
+=========+===============+===================+=====================+====================+
| 1       | a             | Direct            | Phantom             | Yes
           |
+---------+---------------+-------------------+---------------------+--------------------+
| 2       | a             | Reverse           | Phantom             | Yes
           |
+---------+---------------+-------------------+---------------------+--------------------+
| 3       | b             | Direct            | Phantom             | Yes
           |
+---------+---------------+-------------------+---------------------+--------------------+
| 4       | b             | Reverse           | Phantom             | Yes
Quoted 8 lines
           |
+---------+---------------+-------------------+---------------------+--------------------+
| 5       | b             | Direct            | Direct              | No
           |
+---------+---------------+-------------------+---------------------+--------------------+
| 6       | b             | Reverse           | Direct              | No
           |
+---------+---------------+-------------------+---------------------+--------------------+

Maybe we could remove the polarity column on this table as it does not bring more information. It is also already explained on the PI pinout alternatives table.

Also we should document that a 4pairs PSE supporting only 10/100BaseT (which mean no magnetics on pinout AlternativeB) may not be compatible with a 4pairs 1GBaseT PD.

Quoted 2 lines

For this case, it will be good if systems knows supported modes, so user can get this information directly. For example with ethtool

Yes.

Regards,

Signature · 3 lines
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
maintainer
#40 lore raw

Re: [PATCH net-next v3 14/17] dt-bindings: net: pse-pd: Add bindings for PD692x0 PSE controller

Quoted 40 lines · Köry Maincent
Quoted 29 lines · On Fri, 16 Feb 2024 08:47:14 +0100 Oleksij Rempel <[email protected]>…
Quoted 4 lines

So, either somebody needs to understand 1000BaseT and can say the proposed binding works, or we explicitly document the binding is limited to 10BaseT and 100BaseT.

I asked the internet and found the answer: Some PSE/PD implementations are not compatible with 1000BaseT.

See Figure 33–4—10BASE-T/100BASE-TX Endpoint PSE location overview. Alternative B show a variant where power is injected directly to pairs without using magnetics as it is done for Alternative A (phantom delivery - over magnetics).

So, we have following variants of 2 pairs PoE:

+---------+---------------+-------------------+---------------------+--------------------+
| Variant | Alternative   | Polarity          | Power Feeding Type  |
Compatibility with | |         | (a/b)         | (Direct/Reverse)  |
(Direct/Phantom)    | 1000BaseT          |
+=========+===============+===================+=====================+====================+
| 1       | a             | Direct            | Phantom             | Yes
           |
+---------+---------------+-------------------+---------------------+--------------------+
| 2       | a             | Reverse           | Phantom             | Yes
           |
+---------+---------------+-------------------+---------------------+--------------------+
| 3       | b             | Direct            | Phantom             | Yes
           |
+---------+---------------+-------------------+---------------------+--------------------+
| 4       | b             | Reverse           | Phantom             | Yes
Quoted 8 lines
           |
+---------+---------------+-------------------+---------------------+--------------------+
| 5       | b             | Direct            | Direct              | No
           |
+---------+---------------+-------------------+---------------------+--------------------+
| 6       | b             | Reverse           | Direct              | No
           |
+---------+---------------+-------------------+---------------------+--------------------+
Quoted 3 lines

Maybe we could remove the polarity column on this table as it does not bring more information. It is also already explained on the PI pinout alternatives table.

Ack. I'm still not sure if "Phantom" is correct description.

Quoted 4 lines

Also we should document that a 4pairs PSE supporting only 10/100BaseT (which mean no magnetics on pinout AlternativeB) may not be compatible with a 4pairs 1GBaseT PD.

Ack. s/may not/is not/ :) and 4pairs PSE is not always compatible with PoE4 as well. I assume this kind of knowledge we will get from PSE driver.

Regards,
Oleksij

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 |
author maintainer
#41 lore raw

PATCH v3 15/17 net: pse-pd: Add PD692x0 PSE controller driver

In reply to Kory Maincent

Add a new driver for the PD692x0 I2C Power Sourcing Equipment controller. This driver only support i2c communication for now.

---
Change in v2:
- Drop of_match_ptr
- Follow the "c33" PoE prefix naming change.
- Remove unused delay_recv variable. Then, remove struct pd692x0_msg_content which is similar to struct pd692x0_msg.
- Fix a weird sleep loop.
- Improve pd692x0_recv_msg for better readability.
- Fix a warning reported by Simon on a pd692x0_fw_write_line call.

Change in v3:
- Fix few nit.
- Change the return value of pd692x0_try_recv_msg function.
- Replace a dev_err() function to dev_err_probe().
- Replace pd692x0_update_matrix by the newly introduced setup_pi_matrix callback.
- Follow new bindings of managers subnode description.
- Update the pse ops with the newly introduced pi_enable, pi_is_enabled and pi_disable ones.
- Replace firmware version check by a softer one (< instead of =!).
- Rearrange the probe function, which had wrong ordering on error case between pcdcev registering and software version read.
- Fixed the probe function in the case it is call two times. The status won't be sent automatically on the second times so ask for it.

---
 drivers/net/pse-pd/Kconfig   |   11 +
 drivers/net/pse-pd/Makefile  |    1 +
 drivers/net/pse-pd/pd692x0.c | 1223 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1235 insertions(+)
drivers/net/pse-pd/Kconfig +11 -0
index 687dec49c1e1..e3a6ba669f20 100644
@@ -20,4 +20,15 @@ config PSE_REGULATOR
 	  Sourcing Equipment without automatic classification support. For
 	  example for basic implementation of PoDL (802.3bu) specification.
 
+config PSE_PD692X0
+	tristate "PD692X0 PSE controller"
+	depends on I2C
+	select FW_UPLOAD
+	help
+	  This module provides support for PD692x0 regulator based Ethernet
+	  Power Sourcing Equipment.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called pd692x0.
+
 endif
drivers/net/pse-pd/Makefile +1 -0
index 1b8aa4c70f0b..9c12c4a65730 100644
@@ -4,3 +4,4 @@
 obj-$(CONFIG_PSE_CONTROLLER) += pse_core.o
 
 obj-$(CONFIG_PSE_REGULATOR) += pse_regulator.o
+obj-$(CONFIG_PSE_PD692X0) += pd692x0.o
drivers/net/pse-pd/pd692x0.c new file +1223 -0

1,223 lines not on this page · raw message

Signature · 1 line
2.25.1
author maintainer
#42 lore raw

PATCH v3 16/17 dt-bindings: net: pse-pd: Add bindings for TPS23881 PSE controller

In reply to Kory Maincent

Add the TPS23881 I2C Power Sourcing Equipment controller device tree bindings documentation.

---
Change in v3:
- New patch.

---
 .../bindings/net/pse-pd/ti,tps2388x.yaml           | 112 +++++++++++++++++++++
 1 file changed, 112 insertions(+)
Documentation/devicetree/bindings/net/pse-pd/ti,tps2388x.yaml new file +112 -0
new file mode 100644
index 000000000000..ccd1a80befa5
@@ -0,0 +1,112 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/pse-pd/ti,tps2388x.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TI TPS2388x Power Sourcing Equipment controller
+
+maintainers:
+  - Kory Maincent <[email protected]>
+
+allOf:
+  - $ref: pse-controller.yaml#
+
+properties:
+  compatible:
+    enum:
+      - ti,tps23880
+      - ti,tps23881
+
+  reg:
+    maxItems: 1
+
+  '#pse-cells':
+    const: 1
+
+  channels:
+    description: each set of 8 ports can be assigned to one physical
+      channels or two for PoE4. This parameter describes the configuration
+      of the ports conversion matrix that establishes relationship between
+      the logical ports and the physical channels.
+    type: object
+
+    patternProperties:
+      '^channel@[0-7]$':
+        type: object
+        required:
+          - reg
+
+unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      ethernet-pse@20 {
+        compatible = "ti,tps2388x";
+        reg = <0x20>;
+
+        channels {
+          #address-cells = <1>;
+          #size-cells = <0>;
+
+          phys0: channel@0 {
+            reg = <0>;
+          };
+
+          phys1: channel@1 {
+            reg = <1>;
+          };
+
+          phys2: channel@2 {
+            reg = <2>;
+          };
+
+          phys3: channel@3 {
+            reg = <3>;
+          };
+
+          phys4: channel@4 {
+            reg = <4>;
+          };
+
+          phys5: channel@5 {
+            reg = <5>;
+          };
+
+          phys6: channel@6 {
+            reg = <6>;
+          };
+
+          phys7: channel@7 {
+            reg = <7>;
+          };
+        };
+
+        pse_pis {
+          #address-cells = <1>;
+          #size-cells = <0>;
+
+          pse_pi0: pse_pi@0 {
+            reg = <0>;
+            #pse-cells = <0>;
+            pairset-names = "alternative-a", "alternative-b";
+            pairsets = <&phys0>, <&phys1>;
+          };
+
+          pse_pi1: pse_pi@1 {
+            reg = <1>;
+            #pse-cells = <0>;
+            pairset-names = "alternative-a";
+            pairsets = <&phys2>;
+          };
+        };
+      };
+    };
Signature · 1 line
2.25.1
maintainer
#43 lore raw

Re: [PATCH net-next v3 16/17] dt-bindings: net: pse-pd: Add bindings for TPS23881 PSE controller

Quoted 6 lines · Kory Maincent

Add the TPS23881 I2C Power Sourcing Equipment controller device tree bindings documentation.

Quoted 7 lines

---
Change in v3:
- New patch.

---
 .../bindings/net/pse-pd/ti,tps2388x.yaml           | 112 +++++++++++++++++++++
 1 file changed, 112 insertions(+)

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/net/pse-pd/ti,tps2388x.example.dtb: /example-0/i2c/ethernet-pse@20: failed to match any schema with compatible: ['ti,tps2388x']

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

author maintainer
#44 lore raw

Re: [PATCH net-next v3 16/17] dt-bindings: net: pse-pd: Add bindings for TPS23881 PSE controller

In reply to Kory Maincent
Quoted 9 lines · On Thu, 08 Feb 2024 14:08:53 +0100 Kory Maincent <[email protected]>…

Add the TPS23881 I2C Power Sourcing Equipment controller device tree bindings documentation.

---
Change in v3:
- New patch.

Quoted 6 lines
---
 .../bindings/net/pse-pd/ti,tps2388x.yaml           | 112

+++++++++++++++++++++ 1 file changed, 112 insertions(+)

(quoted diff) +0 -0

b/Documentation/devicetree/bindings/net/pse-pd/ti,tps2388x.yaml new file mode

Oops forgot to rename this binding to ti,tps23881.yaml, sorry will do in next version.

Regards,

Signature · 3 lines
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
author maintainer
#45 lore raw

PATCH v3 17/17 net: pse-pd: Add TI TPS23881 PSE controller driver

In reply to Kory Maincent

Add a new driver for the TI TPS23881 I2C Power Sourcing Equipment controller.

---
Change in v3:
- New patch.

---
 drivers/net/pse-pd/Kconfig    |   9 +
 drivers/net/pse-pd/Makefile   |   1 +
 drivers/net/pse-pd/tps23881.c | 818 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 828 insertions(+)
drivers/net/pse-pd/Kconfig +9 -0
index e3a6ba669f20..80cf373a5a0e 100644
@@ -31,4 +31,13 @@ config PSE_PD692X0
 	  To compile this driver as a module, choose M here: the
 	  module will be called pd692x0.
 
+config PSE_TPS23881
+	tristate "TPS23881 PSE controller"
+	depends on I2C
+	help
+	  This module provides support for TPS23881 regulator based Ethernet
+	  Power Sourcing Equipment.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called tps23881.
 endif
drivers/net/pse-pd/Makefile +1 -0
index 9c12c4a65730..9d2898b36737 100644
@@ -5,3 +5,4 @@ obj-$(CONFIG_PSE_CONTROLLER) += pse_core.o
 
 obj-$(CONFIG_PSE_REGULATOR) += pse_regulator.o
 obj-$(CONFIG_PSE_PD692X0) += pd692x0.o
+obj-$(CONFIG_PSE_TPS23881) += tps23881.o
drivers/net/pse-pd/tps23881.c new file +818 -0

818 lines not on this page · raw message

Signature · 1 line
2.25.1