netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gianfar: Add gfar_change_carrier()
@ 2018-12-06 15:31 Joakim Tjernlund
  2018-12-06 15:47 ` Andrew Lunn
  0 siblings, 1 reply; 14+ messages in thread
From: Joakim Tjernlund @ 2018-12-06 15:31 UTC (permalink / raw)
  To: netdev @ vger . kernel . org, Claudiu Manoil; +Cc: Joakim Tjernlund

This allows to control carrier from /sys/class/net/ethX/carrier

Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
---
 drivers/net/ethernet/freescale/gianfar.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 63daae120b2d..bdf9c226f8ef 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -492,6 +492,16 @@ static int gfar_set_mac_addr(struct net_device *dev, void *p)
 	return 0;
 }
 
+static int gfar_change_carrier(struct net_device *dev, bool new_carrier)
+{
+	struct phy_device *phydev = dev->phydev;
+
+	if (phydev && phydev->phy_link_change)
+		phydev->phy_link_change(phydev, new_carrier, 1);
+
+	return 0;
+}
+
 static const struct net_device_ops gfar_netdev_ops = {
 	.ndo_open = gfar_enet_open,
 	.ndo_start_xmit = gfar_start_xmit,
@@ -502,6 +512,7 @@ static const struct net_device_ops gfar_netdev_ops = {
 	.ndo_tx_timeout = gfar_timeout,
 	.ndo_do_ioctl = gfar_ioctl,
 	.ndo_get_stats = gfar_get_stats,
+	.ndo_change_carrier = gfar_change_carrier,
 	.ndo_set_mac_address = gfar_set_mac_addr,
 	.ndo_validate_addr = eth_validate_addr,
 #ifdef CONFIG_NET_POLL_CONTROLLER
-- 
2.18.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-12-10 15:37 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-06 15:31 [PATCH] gianfar: Add gfar_change_carrier() Joakim Tjernlund
2018-12-06 15:47 ` Andrew Lunn
2018-12-06 16:02   ` Joakim Tjernlund
2018-12-06 16:21     ` Andrew Lunn
2018-12-06 16:31       ` Joakim Tjernlund
2018-12-06 16:54         ` Andrew Lunn
2018-12-06 18:46           ` Joakim Tjernlund
2018-12-06 19:43             ` Andrew Lunn
2018-12-07 14:07               ` Joakim Tjernlund
2018-12-07 14:15                 ` Andrew Lunn
2018-12-07 17:01                   ` Joakim Tjernlund
2018-12-07 17:26                     ` Andrew Lunn
2018-12-07 20:40                       ` Florian Fainelli
2018-12-10 15:37                         ` Joakim Tjernlund

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).