diff options
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/net/Kconfig | 8 | ||||
-rw-r--r-- | drivers/usb/net/usbnet.c | 58 |
2 files changed, 39 insertions, 27 deletions
diff --git a/drivers/usb/net/Kconfig b/drivers/usb/net/Kconfig index 454a186b64ad..e081836014ac 100644 --- a/drivers/usb/net/Kconfig +++ b/drivers/usb/net/Kconfig | |||
@@ -92,8 +92,13 @@ config USB_RTL8150 | |||
92 | To compile this driver as a module, choose M here: the | 92 | To compile this driver as a module, choose M here: the |
93 | module will be called rtl8150. | 93 | module will be called rtl8150. |
94 | 94 | ||
95 | config USB_USBNET_MII | ||
96 | tristate | ||
97 | default n | ||
98 | |||
95 | config USB_USBNET | 99 | config USB_USBNET |
96 | tristate "Multi-purpose USB Networking Framework" | 100 | tristate "Multi-purpose USB Networking Framework" |
101 | select MII if USBNET_MII != n | ||
97 | ---help--- | 102 | ---help--- |
98 | This driver supports several kinds of network links over USB, | 103 | This driver supports several kinds of network links over USB, |
99 | with "minidrivers" built around a common network driver core | 104 | with "minidrivers" built around a common network driver core |
@@ -129,7 +134,7 @@ config USB_NET_AX8817X | |||
129 | tristate "ASIX AX88xxx Based USB 2.0 Ethernet Adapters" | 134 | tristate "ASIX AX88xxx Based USB 2.0 Ethernet Adapters" |
130 | depends on USB_USBNET && NET_ETHERNET | 135 | depends on USB_USBNET && NET_ETHERNET |
131 | select CRC32 | 136 | select CRC32 |
132 | select MII | 137 | select USB_USBNET_MII |
133 | default y | 138 | default y |
134 | help | 139 | help |
135 | This option adds support for ASIX AX88xxx based USB 2.0 | 140 | This option adds support for ASIX AX88xxx based USB 2.0 |
@@ -210,6 +215,7 @@ config USB_NET_PLUSB | |||
210 | config USB_NET_MCS7830 | 215 | config USB_NET_MCS7830 |
211 | tristate "MosChip MCS7830 based Ethernet adapters" | 216 | tristate "MosChip MCS7830 based Ethernet adapters" |
212 | depends on USB_USBNET | 217 | depends on USB_USBNET |
218 | select USB_USBNET_MII | ||
213 | help | 219 | help |
214 | Choose this option if you're using a 10/100 Ethernet USB2 | 220 | Choose this option if you're using a 10/100 Ethernet USB2 |
215 | adapter based on the MosChip 7830 controller. This includes | 221 | adapter based on the MosChip 7830 controller. This includes |
diff --git a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c index 40873635d80e..760b5327b81b 100644 --- a/drivers/usb/net/usbnet.c +++ b/drivers/usb/net/usbnet.c | |||
@@ -669,6 +669,9 @@ done: | |||
669 | * they'll probably want to use this base set. | 669 | * they'll probably want to use this base set. |
670 | */ | 670 | */ |
671 | 671 | ||
672 | #if defined(CONFIG_MII) || defined(CONFIG_MII_MODULE) | ||
673 | #define HAVE_MII | ||
674 | |||
672 | int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd) | 675 | int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd) |
673 | { | 676 | { |
674 | struct usbnet *dev = netdev_priv(net); | 677 | struct usbnet *dev = netdev_priv(net); |
@@ -699,20 +702,6 @@ int usbnet_set_settings (struct net_device *net, struct ethtool_cmd *cmd) | |||
699 | } | 702 | } |
700 | EXPORT_SYMBOL_GPL(usbnet_set_settings); | 703 | EXPORT_SYMBOL_GPL(usbnet_set_settings); |
701 | 704 | ||
702 | |||
703 | void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info) | ||
704 | { | ||
705 | struct usbnet *dev = netdev_priv(net); | ||
706 | |||
707 | /* REVISIT don't always return "usbnet" */ | ||
708 | strncpy (info->driver, driver_name, sizeof info->driver); | ||
709 | strncpy (info->version, DRIVER_VERSION, sizeof info->version); | ||
710 | strncpy (info->fw_version, dev->driver_info->description, | ||
711 | sizeof info->fw_version); | ||
712 | usb_make_path (dev->udev, info->bus_info, sizeof info->bus_info); | ||
713 | } | ||
714 | EXPORT_SYMBOL_GPL(usbnet_get_drvinfo); | ||
715 | |||
716 | u32 usbnet_get_link (struct net_device *net) | 705 | u32 usbnet_get_link (struct net_device *net) |
717 | { | 706 | { |
718 | struct usbnet *dev = netdev_priv(net); | 707 | struct usbnet *dev = netdev_priv(net); |
@@ -730,40 +719,57 @@ u32 usbnet_get_link (struct net_device *net) | |||
730 | } | 719 | } |
731 | EXPORT_SYMBOL_GPL(usbnet_get_link); | 720 | EXPORT_SYMBOL_GPL(usbnet_get_link); |
732 | 721 | ||
733 | u32 usbnet_get_msglevel (struct net_device *net) | 722 | int usbnet_nway_reset(struct net_device *net) |
734 | { | 723 | { |
735 | struct usbnet *dev = netdev_priv(net); | 724 | struct usbnet *dev = netdev_priv(net); |
736 | 725 | ||
737 | return dev->msg_enable; | 726 | if (!dev->mii.mdio_write) |
727 | return -EOPNOTSUPP; | ||
728 | |||
729 | return mii_nway_restart(&dev->mii); | ||
738 | } | 730 | } |
739 | EXPORT_SYMBOL_GPL(usbnet_get_msglevel); | 731 | EXPORT_SYMBOL_GPL(usbnet_nway_reset); |
740 | 732 | ||
741 | void usbnet_set_msglevel (struct net_device *net, u32 level) | 733 | #endif /* HAVE_MII */ |
734 | |||
735 | void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info) | ||
742 | { | 736 | { |
743 | struct usbnet *dev = netdev_priv(net); | 737 | struct usbnet *dev = netdev_priv(net); |
744 | 738 | ||
745 | dev->msg_enable = level; | 739 | /* REVISIT don't always return "usbnet" */ |
740 | strncpy (info->driver, driver_name, sizeof info->driver); | ||
741 | strncpy (info->version, DRIVER_VERSION, sizeof info->version); | ||
742 | strncpy (info->fw_version, dev->driver_info->description, | ||
743 | sizeof info->fw_version); | ||
744 | usb_make_path (dev->udev, info->bus_info, sizeof info->bus_info); | ||
746 | } | 745 | } |
747 | EXPORT_SYMBOL_GPL(usbnet_set_msglevel); | 746 | EXPORT_SYMBOL_GPL(usbnet_get_drvinfo); |
748 | 747 | ||
749 | int usbnet_nway_reset(struct net_device *net) | 748 | u32 usbnet_get_msglevel (struct net_device *net) |
750 | { | 749 | { |
751 | struct usbnet *dev = netdev_priv(net); | 750 | struct usbnet *dev = netdev_priv(net); |
752 | 751 | ||
753 | if (!dev->mii.mdio_write) | 752 | return dev->msg_enable; |
754 | return -EOPNOTSUPP; | 753 | } |
754 | EXPORT_SYMBOL_GPL(usbnet_get_msglevel); | ||
755 | 755 | ||
756 | return mii_nway_restart(&dev->mii); | 756 | void usbnet_set_msglevel (struct net_device *net, u32 level) |
757 | { | ||
758 | struct usbnet *dev = netdev_priv(net); | ||
759 | |||
760 | dev->msg_enable = level; | ||
757 | } | 761 | } |
758 | EXPORT_SYMBOL_GPL(usbnet_nway_reset); | 762 | EXPORT_SYMBOL_GPL(usbnet_set_msglevel); |
759 | 763 | ||
760 | /* drivers may override default ethtool_ops in their bind() routine */ | 764 | /* drivers may override default ethtool_ops in their bind() routine */ |
761 | static struct ethtool_ops usbnet_ethtool_ops = { | 765 | static struct ethtool_ops usbnet_ethtool_ops = { |
766 | #ifdef HAVE_MII | ||
762 | .get_settings = usbnet_get_settings, | 767 | .get_settings = usbnet_get_settings, |
763 | .set_settings = usbnet_set_settings, | 768 | .set_settings = usbnet_set_settings, |
764 | .get_drvinfo = usbnet_get_drvinfo, | ||
765 | .get_link = usbnet_get_link, | 769 | .get_link = usbnet_get_link, |
766 | .nway_reset = usbnet_nway_reset, | 770 | .nway_reset = usbnet_nway_reset, |
771 | #endif | ||
772 | .get_drvinfo = usbnet_get_drvinfo, | ||
767 | .get_msglevel = usbnet_get_msglevel, | 773 | .get_msglevel = usbnet_get_msglevel, |
768 | .set_msglevel = usbnet_set_msglevel, | 774 | .set_msglevel = usbnet_set_msglevel, |
769 | }; | 775 | }; |