Blob Blame History Raw
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Tue, 12 Dec 2017 16:00:25 -0800
Subject: net: phy: phylink: Allow specifying PHY device flags
Patch-mainline: v4.16-rc1
Git-commit: 0a62964c9020208c08c8b0323db9ea0c5980876f
References: bsc#1119113 FATE#326472

In order to let subsystems like DSA fully utilize PHYLINK, we need to be able
to communicate phy_device::flags from of_phy_{connect,attach} even when using
PHYLINK APIs.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
 drivers/net/phy/phylink.c |    7 +++++--
 include/linux/phylink.h   |    2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -732,6 +732,7 @@ EXPORT_SYMBOL_GPL(phylink_connect_phy);
  * phylink_of_phy_connect() - connect the PHY specified in the DT mode.
  * @pl: a pointer to a &struct phylink returned from phylink_create()
  * @dn: a pointer to a &struct device_node.
+ * @flags: PHY-specific flags to communicate to the PHY device driver
  *
  * Connect the phy specified in the device node @dn to the phylink instance
  * specified by @pl. Actions specified in phylink_connect_phy() will be
@@ -739,7 +740,8 @@ EXPORT_SYMBOL_GPL(phylink_connect_phy);
  *
  * Returns 0 on success or a negative errno.
  */
-int phylink_of_phy_connect(struct phylink *pl, struct device_node *dn)
+int phylink_of_phy_connect(struct phylink *pl, struct device_node *dn,
+			   u32 flags)
 {
 	struct device_node *phy_node;
 	struct phy_device *phy_dev;
@@ -765,7 +767,8 @@ int phylink_of_phy_connect(struct phylin
 		return 0;
 	}
 
-	phy_dev = of_phy_attach(pl->netdev, phy_node, 0, pl->link_interface);
+	phy_dev = of_phy_attach(pl->netdev, phy_node, flags,
+				pl->link_interface);
 	/* We're done with the phy_node handle */
 	of_node_put(phy_node);
 
--- a/include/linux/phylink.h
+++ b/include/linux/phylink.h
@@ -188,7 +188,7 @@ struct phylink *phylink_create(struct ne
 void phylink_destroy(struct phylink *);
 
 int phylink_connect_phy(struct phylink *, struct phy_device *);
-int phylink_of_phy_connect(struct phylink *, struct device_node *);
+int phylink_of_phy_connect(struct phylink *, struct device_node *, u32 flags);
 void phylink_disconnect_phy(struct phylink *);
 
 void phylink_mac_change(struct phylink *, bool up);