Patchwork ucc_geth: Add ucc_geth_change_carrier()

login
register
mail settings
Submitter Joakim Tjernlund
Date Dec. 6, 2018, 3:33 p.m.
Message ID <20181206153325.5785-1-joakim.tjernlund@infinera.com>
Download mbox | patch
Permalink /patch/674245/
State New
Headers show

Comments

Joakim Tjernlund - Dec. 6, 2018, 3:33 p.m.
This allows to control carrier from /sys/class/net/ethX/carrier

Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
---
 drivers/net/ethernet/freescale/ucc_geth.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
Andrew Lunn - Dec. 7, 2018, 9:15 a.m.
On Thu, Dec 06, 2018 at 04:33:25PM +0100, Joakim Tjernlund wrote:
> This allows to control carrier from /sys/class/net/ethX/carrier
> 
> Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>

See the discussion for [PATCH] gianfar: Add gfar_change_carrier().

For the moment:

NACK

	Andrew

Patch

diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
index e8debbde0a34..2f4c2f550be6 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.c
+++ b/drivers/net/ethernet/freescale/ucc_geth.c
@@ -3680,11 +3680,22 @@  static int ucc_geth_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 	return phy_mii_ioctl(ugeth->phydev, rq, cmd);
 }
 
+static int ucc_geth_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 ucc_geth_netdev_ops = {
 	.ndo_open		= ucc_geth_open,
 	.ndo_stop		= ucc_geth_close,
 	.ndo_start_xmit		= ucc_geth_start_xmit,
 	.ndo_validate_addr	= eth_validate_addr,
+	.ndo_change_carrier     = ucc_geth_change_carrier,
 	.ndo_set_mac_address	= ucc_geth_set_mac_addr,
 	.ndo_set_rx_mode	= ucc_geth_set_multi,
 	.ndo_tx_timeout		= ucc_geth_timeout,