lkml.org 
[lkml]   [2022]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH net-next v2 05/11] net: mdio: fwnode: add fwnode_mdiobus_register()
Date
In order to support software node description transparently, add fwnode
support with fwnode_mdiobus_register(). This function behaves exactly
like of_mdiobus_register() function but using the fwnode node agnostic
API. This support might also be used to merge ACPI mdiobus support
which is quite similar to the fwnode one.

Some part such as the whitelist matching are kept exclusively for OF
nodes since it uses an of_device_id struct and seems tightly coupled
with OF. Other parts are generic and will allow to move the existing
OF support on top of this fwnode version.

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
---
include/linux/fwnode_mdio.h | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)

diff --git a/include/linux/fwnode_mdio.h b/include/linux/fwnode_mdio.h
index faf603c48c86..cc50a0833a43 100644
--- a/include/linux/fwnode_mdio.h
+++ b/include/linux/fwnode_mdio.h
@@ -9,6 +9,9 @@
#include <linux/phy.h>

#if IS_ENABLED(CONFIG_FWNODE_MDIO)
+int fwnode_mdio_parse_addr(struct device *dev,
+ const struct fwnode_handle *fwnode);
+bool fwnode_mdiobus_child_is_phy(struct fwnode_handle *child);
int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio,
struct phy_device *phy,
struct fwnode_handle *child, u32 addr);
@@ -16,10 +19,23 @@ int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio,
int fwnode_mdiobus_register_phy(struct mii_bus *bus,
struct fwnode_handle *child, u32 addr);

+int fwnode_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode);
#else /* CONFIG_FWNODE_MDIO */
-int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio,
- struct phy_device *phy,
- struct fwnode_handle *child, u32 addr)
+
+static inline int fwnode_mdio_parse_addr(struct device *dev,
+ const struct fwnode_handle *fwnode)
+{
+ return -EINVAL;
+}
+
+static inline bool fwnode_mdiobus_child_is_phy(struct fwnode_handle *child)
+{
+ return false;
+}
+
+static inline int
+fwnode_mdiobus_phy_device_register(struct mii_bus *mdio, struct phy_device *phy,
+ struct fwnode_handle *child, u32 addr)
{
return -EINVAL;
}
@@ -30,6 +46,12 @@ static inline int fwnode_mdiobus_register_phy(struct mii_bus *bus,
{
return -EINVAL;
}
+
+static inline int fwnode_mdiobus_register(struct mii_bus *mdio,
+ struct fwnode_handle *fwnode)
+{
+ return -EINVAL;
+}
#endif

#endif /* __LINUX_FWNODE_MDIO_H */
--
2.34.1
\
 
 \ /
  Last update: 2022-03-31 11:33    [W:0.061 / U:0.376 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site