Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 95367
b: refs/heads/master
c: 679dce3
h: refs/heads/master
i:
  95365: b861792
  95363: ada4cf6
  95359: b582bf7
v: v3
  • Loading branch information
Bryan Wu authored and Jeff Garzik committed Apr 29, 2008
1 parent dc0fc86 commit 884a35c
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7ef0a7ee2f9ac7ee8e2a597821adb2a78b882791
refs/heads/master: 679dce39e3cdfcc641b2888ce04f1cd5ff0b3b92
47 changes: 47 additions & 0 deletions trunk/drivers/net/bfin_mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <linux/phy.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/ethtool.h>
#include <linux/skbuff.h>
#include <linux/platform_device.h>

Expand Down Expand Up @@ -454,6 +455,51 @@ static int mii_probe(struct net_device *dev)
return 0;
}

/*
* Ethtool support
*/

static int
bfin_mac_ethtool_getsettings(struct net_device *dev, struct ethtool_cmd *cmd)
{
struct bfin_mac_local *lp = netdev_priv(dev);

if (lp->phydev)
return phy_ethtool_gset(lp->phydev, cmd);

return -EINVAL;
}

static int
bfin_mac_ethtool_setsettings(struct net_device *dev, struct ethtool_cmd *cmd)
{
struct bfin_mac_local *lp = netdev_priv(dev);

if (!capable(CAP_NET_ADMIN))
return -EPERM;

if (lp->phydev)
return phy_ethtool_sset(lp->phydev, cmd);

return -EINVAL;
}

static void bfin_mac_ethtool_getdrvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
strcpy(info->driver, DRV_NAME);
strcpy(info->version, DRV_VERSION);
strcpy(info->fw_version, "N/A");
strcpy(info->bus_info, dev->dev.bus_id);
}

static struct ethtool_ops bfin_mac_ethtool_ops = {
.get_settings = bfin_mac_ethtool_getsettings,
.set_settings = bfin_mac_ethtool_setsettings,
.get_link = ethtool_op_get_link,
.get_drvinfo = bfin_mac_ethtool_getdrvinfo,
};

/**************************************************************************/
void setup_system_regs(struct net_device *dev)
{
Expand Down Expand Up @@ -997,6 +1043,7 @@ static int __init bfin_mac_probe(struct platform_device *pdev)
#ifdef CONFIG_NET_POLL_CONTROLLER
ndev->poll_controller = bfin_mac_poll;
#endif
ndev->ethtool_ops = &bfin_mac_ethtool_ops;

spin_lock_init(&lp->lock);

Expand Down

0 comments on commit 884a35c

Please sign in to comment.