aboutsummaryrefslogtreecommitdiff
path: root/include/net
diff options
context:
space:
mode:
authorVladimir Oltean <vladimir.oltean@nxp.com>2021-09-29 18:04:38 +0300
committerRamon Fried <rfried.dev@gmail.com>2021-11-23 09:57:55 +0200
commit0783b16509a1e6d9821084ec64f5be1cc091c7f9 (patch)
treece7951d829048a1c82ddc0e133725b80b1df246e /include/net
parent8a5c0570333a2c37ff8d8d53018df4b65ce77a47 (diff)
downloadu-boot-0783b16509a1e6d9821084ec64f5be1cc091c7f9.zip
u-boot-0783b16509a1e6d9821084ec64f5be1cc091c7f9.tar.gz
u-boot-0783b16509a1e6d9821084ec64f5be1cc091c7f9.tar.bz2
net: dsa: allow drivers to get the port OF node
In the current DSA switch driver API, only the udevice of the switch (belonging to UCLASS_DSA) is exposed, as well as an "int port" argument. So drivers do not have access to the udevice of individual ports (belonging to UCLASS_ETH), one of the reasons being that not all ports have an associated UCLASS_ETH udevice. However, all DSA ports have an OF node, and in some cases the driver needs a handle to it, for all ports including the CPU port. Example: the following Linux per-port device tree property: managed = "in-band-status"; states whether a port should operate with clause 37 in-band autoneg enabled or not. This patch exposes a function which can be called by individual drivers as needed. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/dsa.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/net/dsa.h b/include/net/dsa.h
index a339a49..1b1068c 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -6,6 +6,7 @@
#ifndef __DSA_H__
#define __DSA_H__
+#include <dm/ofnode.h>
#include <phy.h>
#include <net.h>
@@ -146,6 +147,17 @@ int dsa_set_tagging(struct udevice *dev, ushort headroom, ushort tailroom);
struct udevice *dsa_get_master(struct udevice *dev);
/**
+ * dsa_port_get_ofnode() - Return a reference to the given port's OF node
+ *
+ * Can be called at driver probe time or later.
+ *
+ * @dev: DSA switch udevice pointer
+ * @port: Port index
+ * @return OF node reference if OK, NULL on error
+ */
+ofnode dsa_port_get_ofnode(struct udevice *dev, int port);
+
+/**
* dsa_port_get_pdata() - Helper that returns the platdata of an active
* (non-CPU) DSA port device.
*