Commit 7ff4f3f3 authored by Antoine Tenart's avatar Antoine Tenart Committed by David S. Miller
Browse files

net: mscc: use the PHY MII ioctl interface when possible



Allow ioctl to be implemented by the PHY, when a PHY is attached to the
Ocelot switch. In case the ioctl is a request to set or get the hardware
timestamp, use the Ocelot switch implementation for now.

Signed-off-by: default avatarAntoine Tenart <antoine.tenart@bootlin.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 626a8323
Loading
Loading
Loading
Loading
+9 −11
Original line number Diff line number Diff line
@@ -1204,20 +1204,18 @@ static int ocelot_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
	struct ocelot *ocelot = priv->port.ocelot;
	int port = priv->chip_port;

	/* The function is only used for PTP operations for now */
	if (!ocelot->ptp)
		return -EOPNOTSUPP;

	if (ocelot->ptp) {
		switch (cmd) {
		case SIOCSHWTSTAMP:
			return ocelot_hwstamp_set(ocelot, port, ifr);
		case SIOCGHWTSTAMP:
			return ocelot_hwstamp_get(ocelot, port, ifr);
	default:
		return -EOPNOTSUPP;
		}
	}

	return phy_mii_ioctl(dev->phydev, ifr, cmd);
}

static const struct net_device_ops ocelot_port_netdev_ops = {
	.ndo_open			= ocelot_port_open,
	.ndo_stop			= ocelot_port_stop,