mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Clément Léger" <clement.leger@bootlin.com>
To: Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: "Horatiu Vultur" <horatiu.vultur@microchip.com>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	"Allan Nielsen" <allan.nielsen@microchip.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Clément Léger" <clement.leger@bootlin.com>
Subject: [RFC PATCH net-next v2 05/11] net: mdio: fwnode: add fwnode_mdiobus_register()
Date: Thu, 31 Mar 2022 11:25:27 +0200	[thread overview]
Message-ID: <20220331092533.348626-6-clement.leger@bootlin.com> (raw)
In-Reply-To: <20220331092533.348626-1-clement.leger@bootlin.com>

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


  parent reply	other threads:[~2022-03-31  9:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-31  9:25 [RFC PATCH net-next v2 00/11] add fwnode based mdiobus registration Clément Léger
2022-03-31  9:25 ` [RFC PATCH net-next v2 01/11] net: mdio: fwnode: import of_mdiobus_register() and needed functions Clément Léger
2022-03-31  9:25 ` [RFC PATCH net-next v2 02/11] net: mdio: fwnode: remove legacy compatible checking for phy child Clément Léger
2022-03-31  9:25 ` [RFC PATCH net-next v2 03/11] net: mdio: fwnode: remove legacy phy scanning Clément Léger
2022-03-31  9:25 ` [RFC PATCH net-next v2 04/11] net: mdio: fwnode: convert fwnode_mdiobus_register() for fwnode Clément Léger
2022-03-31  9:25 ` Clément Léger [this message]
2022-03-31  9:25 ` [RFC PATCH net-next v2 06/11] net: mdio: of: wrap fwnode_mdio_parse_addr() in of_mdio_parse_addr() Clément Léger
2022-03-31  9:25 ` [RFC PATCH net-next v2 07/11] net: mdio: fwnode: avoid calling of_* functions with non OF nodes Clément Léger
2022-03-31  9:25 ` [RFC PATCH net-next v2 08/11] net: mdio: fwnode: allow phy device registration " Clément Léger
2022-03-31  9:25 ` [RFC PATCH net-next v2 09/11] net: mdio: of: use fwnode_mdiobus_child_is_phy() Clément Léger
2022-03-31  9:25 ` [RFC PATCH net-next v2 10/11] net: mdio: of: use fwnode_mdiobus_register() in of_mdiobus_register() Clément Léger
2022-03-31  9:25 ` [RFC PATCH net-next v2 11/11] net: mdio: mscc-miim: use fwnode_mdiobus_register() Clément Léger

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=20220331092533.348626-6-clement.leger@bootlin.com \
    --to=clement.leger@bootlin.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=allan.nielsen@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=hkallweit1@gmail.com \
    --cc=horatiu.vultur@microchip.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --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

all inboxes | Powered by JetHome®