diff options
author | Guo-Fu Tseng <cooldavid@cooldavid.org> | 2010-10-18 10:10:43 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-10-21 06:52:10 -0400 |
commit | 334fbbb747c978ae9171b9c29dfcea881f4a8d57 (patch) | |
tree | 59f9c3219c1298c68447d30a6f4f38090ffdc0a7 /drivers/net | |
parent | ea192aa89c3b26d56113e70c72238f6951d4097f (diff) |
jme: Adding mii-tool support
Adding mii-tool support for some distribution only have mii-tool
installed by default.
Signed-off-by: Guo-Fu Tseng <cooldavid@cooldavid.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/jme.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/drivers/net/jme.c b/drivers/net/jme.c index 095f8998714f..c34c70f84ee3 100644 --- a/drivers/net/jme.c +++ b/drivers/net/jme.c | |||
@@ -2411,8 +2411,37 @@ jme_set_settings(struct net_device *netdev, | |||
2411 | if (!rc) { | 2411 | if (!rc) { |
2412 | if (fdc) | 2412 | if (fdc) |
2413 | jme_reset_link(jme); | 2413 | jme_reset_link(jme); |
2414 | set_bit(JME_FLAG_SSET, &jme->flags); | ||
2415 | jme->old_ecmd = *ecmd; | 2414 | jme->old_ecmd = *ecmd; |
2415 | set_bit(JME_FLAG_SSET, &jme->flags); | ||
2416 | } | ||
2417 | |||
2418 | return rc; | ||
2419 | } | ||
2420 | |||
2421 | static int | ||
2422 | jme_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd) | ||
2423 | { | ||
2424 | int rc; | ||
2425 | struct jme_adapter *jme = netdev_priv(netdev); | ||
2426 | struct mii_ioctl_data *mii_data = if_mii(rq); | ||
2427 | unsigned int duplex_chg; | ||
2428 | |||
2429 | if (cmd == SIOCSMIIREG) { | ||
2430 | u16 val = mii_data->val_in; | ||
2431 | if (!(val & (BMCR_RESET|BMCR_ANENABLE)) && | ||
2432 | (val & BMCR_SPEED1000)) | ||
2433 | return -EINVAL; | ||
2434 | } | ||
2435 | |||
2436 | spin_lock_bh(&jme->phy_lock); | ||
2437 | rc = generic_mii_ioctl(&jme->mii_if, mii_data, cmd, &duplex_chg); | ||
2438 | spin_unlock_bh(&jme->phy_lock); | ||
2439 | |||
2440 | if (!rc && (cmd == SIOCSMIIREG)) { | ||
2441 | if (duplex_chg) | ||
2442 | jme_reset_link(jme); | ||
2443 | jme_get_settings(netdev, &jme->old_ecmd); | ||
2444 | set_bit(JME_FLAG_SSET, &jme->flags); | ||
2416 | } | 2445 | } |
2417 | 2446 | ||
2418 | return rc; | 2447 | return rc; |
@@ -2692,6 +2721,7 @@ static const struct net_device_ops jme_netdev_ops = { | |||
2692 | .ndo_open = jme_open, | 2721 | .ndo_open = jme_open, |
2693 | .ndo_stop = jme_close, | 2722 | .ndo_stop = jme_close, |
2694 | .ndo_validate_addr = eth_validate_addr, | 2723 | .ndo_validate_addr = eth_validate_addr, |
2724 | .ndo_do_ioctl = jme_ioctl, | ||
2695 | .ndo_start_xmit = jme_start_xmit, | 2725 | .ndo_start_xmit = jme_start_xmit, |
2696 | .ndo_set_mac_address = jme_set_macaddr, | 2726 | .ndo_set_mac_address = jme_set_macaddr, |
2697 | .ndo_set_multicast_list = jme_set_multi, | 2727 | .ndo_set_multicast_list = jme_set_multi, |
@@ -2883,6 +2913,8 @@ jme_init_one(struct pci_dev *pdev, | |||
2883 | jme->mii_if.supports_gmii = true; | 2913 | jme->mii_if.supports_gmii = true; |
2884 | else | 2914 | else |
2885 | jme->mii_if.supports_gmii = false; | 2915 | jme->mii_if.supports_gmii = false; |
2916 | jme->mii_if.phy_id_mask = 0x1F; | ||
2917 | jme->mii_if.reg_num_mask = 0x1F; | ||
2886 | jme->mii_if.mdio_read = jme_mdio_read; | 2918 | jme->mii_if.mdio_read = jme_mdio_read; |
2887 | jme->mii_if.mdio_write = jme_mdio_write; | 2919 | jme->mii_if.mdio_write = jme_mdio_write; |
2888 | 2920 | ||