Commit fcf97825 authored by Alexandru Ardelean's avatar Alexandru Ardelean Committed by David S. Miller

net: xilinx: emaclite: add minimal ndo_do_ioctl hook

This hook only implements a minimal set of ioctl hooks to be able to access
MII regs by using phytool.
When using this simple MAC controller, it's pretty difficult to do
debugging of the PHY chip without checking MII regs.
Signed-off-by: default avatarAlexandru Ardelean <alexandru.ardelean@analog.com>
Reviewed-by: default avatarRadhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9a80ba06
...@@ -1252,12 +1252,29 @@ xemaclite_poll_controller(struct net_device *ndev) ...@@ -1252,12 +1252,29 @@ xemaclite_poll_controller(struct net_device *ndev)
} }
#endif #endif
/* Ioctl MII Interface */
static int xemaclite_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
if (!dev->phydev || !netif_running(dev))
return -EINVAL;
switch (cmd) {
case SIOCGMIIPHY:
case SIOCGMIIREG:
case SIOCSMIIREG:
return phy_mii_ioctl(dev->phydev, rq, cmd);
default:
return -EOPNOTSUPP;
}
}
static const struct net_device_ops xemaclite_netdev_ops = { static const struct net_device_ops xemaclite_netdev_ops = {
.ndo_open = xemaclite_open, .ndo_open = xemaclite_open,
.ndo_stop = xemaclite_close, .ndo_stop = xemaclite_close,
.ndo_start_xmit = xemaclite_send, .ndo_start_xmit = xemaclite_send,
.ndo_set_mac_address = xemaclite_set_mac_address, .ndo_set_mac_address = xemaclite_set_mac_address,
.ndo_tx_timeout = xemaclite_tx_timeout, .ndo_tx_timeout = xemaclite_tx_timeout,
.ndo_do_ioctl = xemaclite_ioctl,
#ifdef CONFIG_NET_POLL_CONTROLLER #ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = xemaclite_poll_controller, .ndo_poll_controller = xemaclite_poll_controller,
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment