From: Kory Maincent <kory.maincent@bootlin.com>
To: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Jonathan Corbet <corbet@lwn.net>,
Luis Chamberlain <mcgrof@kernel.org>,
Russ Weight <russ.weight@linux.dev>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-doc@vger.kernel.org, devicetree@vger.kernel.org,
Kory Maincent <kory.maincent@bootlin.com>
Subject: [PATCH net-next 3/9] net: pse-pd: Introduce PSE types enumeration
Date: Thu, 16 Nov 2023 15:01:35 +0100 [thread overview]
Message-ID: <20231116-feature_poe-v1-3-be48044bf249@bootlin.com> (raw)
In-Reply-To: <20231116-feature_poe-v1-0-be48044bf249@bootlin.com>
Introduce an enumeration to define PSE types (PoE or PoDL),
utilizing a bitfield for potential future support of both types.
Include 'pse_get_types' helper for external access to PSE type info
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
drivers/net/pse-pd/pse_core.c | 9 +++++++++
drivers/net/pse-pd/pse_regulator.c | 1 +
include/linux/pse-pd/pse.h | 22 ++++++++++++++++++++++
3 files changed, 32 insertions(+)
diff --git a/drivers/net/pse-pd/pse_core.c b/drivers/net/pse-pd/pse_core.c
index 146b81f08a89..2959c94f7798 100644
--- a/drivers/net/pse-pd/pse_core.c
+++ b/drivers/net/pse-pd/pse_core.c
@@ -312,3 +312,12 @@ int pse_ethtool_set_config(struct pse_control *psec,
return err;
}
EXPORT_SYMBOL_GPL(pse_ethtool_set_config);
+
+u32 pse_get_types(struct pse_control *psec)
+{
+ if (!psec->pcdev)
+ return PSE_UNKNOWN;
+ else
+ return psec->pcdev->types;
+}
+EXPORT_SYMBOL_GPL(pse_get_types);
diff --git a/drivers/net/pse-pd/pse_regulator.c b/drivers/net/pse-pd/pse_regulator.c
index 1dedf4de296e..e34ab8526067 100644
--- a/drivers/net/pse-pd/pse_regulator.c
+++ b/drivers/net/pse-pd/pse_regulator.c
@@ -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",
diff --git a/include/linux/pse-pd/pse.h b/include/linux/pse-pd/pse.h
index 25490d0c682d..67a0ff5e480c 100644
--- a/include/linux/pse-pd/pse.h
+++ b/include/linux/pse-pd/pse.h
@@ -44,6 +44,19 @@ struct pse_control_status {
enum ethtool_pse_pw_d_status pw_status;
};
+/**
+ * enum - Types of PSE controller.
+ *
+ * @PSE_UNKNOWN: Type of PSE controller is unknown
+ * @PSE_PODL: PSE controller which support PoDL
+ * @PSE_POE: PSE controller which support PoE
+ */
+enum {
+ PSE_UNKNOWN = BIT(0),
+ PSE_PODL = BIT(1),
+ PSE_POE = BIT(2),
+};
+
/**
* struct pse_controller_ops - PSE controller driver callbacks
*
@@ -77,6 +90,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 +103,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 +123,8 @@ int pse_ethtool_set_config(struct pse_control *psec,
struct netlink_ext_ack *extack,
const struct pse_control_config *config);
+u32 pse_get_types(struct pse_control *psec);
+
#else
static inline struct pse_control *of_pse_control_get(struct device_node *node)
@@ -133,6 +150,11 @@ static inline int pse_ethtool_set_config(struct pse_control *psec,
return -ENOTSUPP;
}
+static u32 pse_get_types(struct pse_control *psec)
+{
+ return PSE_UNKNOWN;
+}
+
#endif
#endif
--
2.25.1
next prev parent reply other threads:[~2023-11-16 14:01 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-16 14:01 [PATCH net-next 0/9] net: Add support for Power over Ethernet (PoE) Kory Maincent
2023-11-16 14:01 ` [PATCH net-next 1/9] net: pse-pd: Rectify and adapt the naming of admin_cotrol member of struct pse_control_config Kory Maincent
2023-11-16 14:01 ` [PATCH net-next 2/9] ethtool: Expand Ethernet Power Equipment with PoE alongside PoDL Kory Maincent
2023-11-18 17:38 ` Andrew Lunn
2023-11-20 10:09 ` Köry Maincent
2023-11-20 11:10 ` Oleksij Rempel
2023-11-20 18:00 ` Andrew Lunn
2023-11-20 20:42 ` Oleksij Rempel
2023-11-20 22:14 ` Andrew Lunn
2023-11-21 5:12 ` Oleksij Rempel
2023-11-21 10:02 ` Köry Maincent
2023-11-21 14:19 ` Andrew Lunn
2023-11-21 14:56 ` Köry Maincent
2023-11-16 14:01 ` Kory Maincent [this message]
2023-11-24 16:35 ` [PATCH net-next 3/9] net: pse-pd: Introduce PSE types enumeration Simon Horman
2023-11-16 14:01 ` [PATCH net-next 4/9] net: ethtool: pse-pd: Expand pse commands with the PSE PoE interface Kory Maincent
2023-11-16 14:01 ` [PATCH net-next 5/9] netlink: specs: Modify pse attribute prefix Kory Maincent
2023-11-18 23:57 ` Jakub Kicinski
2023-11-20 10:19 ` Köry Maincent
2023-11-20 16:53 ` Jakub Kicinski
2023-11-16 14:01 ` [PATCH net-next 6/9] netlink: specs: Expand the pse netlink command with PoE interface Kory Maincent
2023-11-19 0:01 ` Jakub Kicinski
2023-11-20 10:13 ` Köry Maincent
2023-11-16 14:01 ` [PATCH net-next 7/9] firmware_loader: Expand Firmware upload error codes Kory Maincent
2023-11-16 16:30 ` Luis Chamberlain
2023-11-16 16:37 ` Greg Kroah-Hartman
2023-11-16 17:44 ` Conor Dooley
2023-11-16 21:56 ` Andrew Lunn
2023-11-17 8:56 ` Köry Maincent
2023-11-16 14:01 ` [PATCH net-next 8/9] dt-bindings: net: pse-pd: Add bindings for PD692x0 PSE controller Kory Maincent
2023-11-16 14:31 ` Krzysztof Kozlowski
2023-11-18 17:47 ` Andrew Lunn
2023-11-16 14:01 ` [PATCH net-next 9/9] net: pse-pd: Add PD692x0 PSE controller driver Kory Maincent
2023-11-16 14:29 ` Krzysztof Kozlowski
2023-11-16 14:59 ` Köry Maincent
2023-11-16 22:38 ` Andrew Lunn
2023-11-17 11:15 ` Köry Maincent
2023-11-16 22:41 ` Andrew Lunn
2023-11-17 11:22 ` Köry Maincent
2023-11-17 14:50 ` Andrew Lunn
2023-11-16 22:54 ` Andrew Lunn
2023-11-22 16:11 ` Köry Maincent
2023-11-22 16:54 ` Andrew Lunn
2023-11-22 17:16 ` Köry Maincent
2023-11-22 17:49 ` Andrew Lunn
2023-11-18 18:54 ` Andrew Lunn
2023-11-22 16:48 ` Köry Maincent
2023-11-22 17:11 ` Andrew Lunn
2023-11-27 17:28 ` Köry Maincent
2023-11-24 16:30 ` Simon Horman
2023-11-18 23:59 ` [PATCH net-next 0/9] net: Add support for Power over Ethernet (PoE) Jakub Kicinski
2023-11-20 9:22 ` Köry Maincent
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231116-feature_poe-v1-3-be48044bf249@bootlin.com \
--to=kory.maincent@bootlin.com \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rafael@kernel.org \
--cc=robh+dt@kernel.org \
--cc=russ.weight@linux.dev \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).