summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Ardelean <alexandru.ardelean@analog.com>2019-04-08 11:01:57 +0200
committerDavid S. Miller <davem@davemloft.net>2019-04-08 19:00:10 +0200
commitfcf9782573eccb6a9a79140ff221898c02923fd0 (patch)
tree45b8fc03bb468baa73291a00a94d4e0ea8e7fc3f
parentnet: xilinx: emaclite: add minimal ethtool ops (diff)
downloadlinux-fcf9782573eccb6a9a79140ff221898c02923fd0.tar.xz
linux-fcf9782573eccb6a9a79140ff221898c02923fd0.zip
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: Alexandru Ardelean <alexandru.ardelean@analog.com> Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/xilinx/xilinx_emaclite.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index eece204d6239..fc38692da71e 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -1252,12 +1252,29 @@ xemaclite_poll_controller(struct net_device *ndev)
}
#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 = {
.ndo_open = xemaclite_open,
.ndo_stop = xemaclite_close,
.ndo_start_xmit = xemaclite_send,
.ndo_set_mac_address = xemaclite_set_mac_address,
.ndo_tx_timeout = xemaclite_tx_timeout,
+ .ndo_do_ioctl = xemaclite_ioctl,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = xemaclite_poll_controller,
#endif