[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181206153125.5649-1-joakim.tjernlund@infinera.com>
Date: Thu, 6 Dec 2018 16:31:25 +0100
From: Joakim Tjernlund <joakim.tjernlund@...inera.com>
To: "netdev @ vger . kernel . org" <netdev@...r.kernel.org>,
Claudiu Manoil <claudiu.manoil@...escale.com>
Cc: Joakim Tjernlund <joakim.tjernlund@...inera.com>
Subject: [PATCH] gianfar: Add gfar_change_carrier()
This allows to control carrier from /sys/class/net/ethX/carrier
Signed-off-by: Joakim Tjernlund <joakim.tjernlund@...inera.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
Powered by blists - more mailing lists