25 #define PHY_MODE_MARVELL 0x0000
26 #define MII_MARVELL_LED_CTRL 0x0018
27 #define MII_MARVELL_STATUS 0x001b
28 #define MII_MARVELL_CTRL 0x0014
30 #define MARVELL_LED_MANUAL 0x0019
32 #define MARVELL_STATUS_HWCFG 0x0004
34 #define MARVELL_CTRL_TXDELAY 0x0002
35 #define MARVELL_CTRL_RXDELAY 0x0080
37 #define PHY_MODE_RTL8211CL 0x000C
52 if (urb->actual_length < 8)
55 event = urb->transfer_buffer;
56 link =
event->link & 0x01;
57 if (netif_carrier_ok(dev->
net) != link) {
75 for (i = 0; i < 100; i++) {
77 if (phy_reg != 0 && phy_reg != 0xFFFF)
82 if (phy_reg <= 0 || phy_reg == 0xFFFF)
85 phy_id = (phy_reg & 0xffff) << 16;
91 phy_id |= (phy_reg & 0xffff);
98 struct usbnet *dev = netdev_priv(net);
105 struct usbnet *dev = netdev_priv(net);
113 static const struct ethtool_ops ax88172_ethtool_ops = {
115 .get_link = asix_get_link,
128 static void ax88172_set_multicast(
struct net_device *net)
130 struct usbnet *dev = netdev_priv(net);
167 static int ax88172_link_reset(
struct usbnet *dev)
179 netdev_dbg(dev->
net,
"ax88172_link_reset() speed: %u duplex: %d setting mode to 0x%04x\n",
180 ethtool_cmd_speed(&ecmd), ecmd.
duplex, mode);
195 .ndo_do_ioctl = asix_ioctl,
196 .ndo_set_rx_mode = ax88172_set_multicast,
209 for (i = 2; i >= 0; i--) {
211 (gpio_bits >> (i * 8)) & 0xff, 0, 0,
NULL);
224 netdev_dbg(dev->
net,
"read AX_CMD_READ_NODE_ID failed: %d\n",
234 dev->
mii.phy_id_mask = 0x3f;
235 dev->
mii.reg_num_mask = 0x1f;
238 dev->
net->netdev_ops = &ax88172_netdev_ops;
239 dev->
net->ethtool_ops = &ax88172_ethtool_ops;
240 dev->
net->needed_headroom = 4;
241 dev->
net->needed_tailroom = 4;
254 static const struct ethtool_ops ax88772_ethtool_ops = {
256 .get_link = asix_get_link,
269 static int ax88772_link_reset(
struct usbnet *dev)
278 if (ethtool_cmd_speed(&ecmd) !=
SPEED_100)
284 netdev_dbg(dev->
net,
"ax88772_link_reset() speed: %u duplex: %d setting mode to 0x%04x\n",
285 ethtool_cmd_speed(&ecmd), ecmd.
duplex, mode);
292 static int ax88772_reset(
struct usbnet *dev)
368 netdev_dbg(dev->
net,
"Write IPG,IPG1,IPG2 failed: %d\n", ret);
385 netdev_dbg(dev->
net,
"RX_CTL is 0x%04x after all initializations\n",
390 "Medium Status is 0x%04x after all initializations\n",
408 .ndo_do_ioctl = asix_ioctl,
423 netdev_dbg(dev->
net,
"Failed to read MAC address: %d\n", ret);
432 dev->
mii.phy_id_mask = 0x1f;
433 dev->
mii.reg_num_mask = 0x1f;
436 dev->
net->netdev_ops = &ax88772_netdev_ops;
437 dev->
net->ethtool_ops = &ax88772_ethtool_ops;
438 dev->
net->needed_headroom = 4;
439 dev->
net->needed_tailroom = 4;
441 embd_phy = ((dev->
mii.phy_id & 0x1f) == 0x10 ? 1 : 0);
465 phyid = asix_get_phyid(dev);
478 static const struct ethtool_ops ax88178_ethtool_ops = {
480 .get_link = asix_get_link,
493 static int marvell_phy_init(
struct usbnet *dev)
525 static int rtl8211cl_phy_init(
struct usbnet *dev)
546 static int marvell_led_status(
struct usbnet *dev,
u16 speed)
550 netdev_dbg(dev->
net,
"marvell_led_status() read 0x%04x\n", reg);
566 netdev_dbg(dev->
net,
"marvell_led_status() writing 0x%04x\n", reg);
572 static int ax88178_reset(
struct usbnet *dev)
614 phyid = asix_get_phyid(dev);
629 marvell_phy_init(dev);
632 rtl8211cl_phy_init(dev);
661 static int ax88178_link_reset(
struct usbnet *dev)
673 speed = ethtool_cmd_speed(&ecmd);
689 netdev_dbg(dev->
net,
"ax88178_link_reset() speed: %u duplex: %d setting mode to 0x%04x\n",
690 speed, ecmd.
duplex, mode);
695 marvell_led_status(dev, speed);
700 static void ax88178_set_mfb(
struct usbnet *dev)
725 if (dev->
net->mtu > 1500)
735 static int ax88178_change_mtu(
struct net_device *net,
int new_mtu)
737 struct usbnet *dev = netdev_priv(net);
740 netdev_dbg(dev->
net,
"ax88178_change_mtu() new_mtu=%d\n", new_mtu);
742 if (new_mtu <= 0 || ll_mtu > 16384)
750 ax88178_set_mfb(dev);
763 .ndo_do_ioctl = asix_ioctl,
764 .ndo_change_mtu = ax88178_change_mtu,
777 netdev_dbg(dev->
net,
"Failed to read MAC address: %d\n", ret);
786 dev->
mii.phy_id_mask = 0x1f;
787 dev->
mii.reg_num_mask = 0xff;
788 dev->
mii.supports_gmii = 1;
791 dev->
net->netdev_ops = &ax88178_netdev_ops;
792 dev->
net->ethtool_ops = &ax88178_ethtool_ops;
812 .description =
"ASIX AX8817x USB 2.0 Ethernet",
813 .bind = ax88172_bind,
814 .status = asix_status,
815 .link_reset = ax88172_link_reset,
816 .reset = ax88172_link_reset,
821 static const struct driver_info dlink_dub_e100_info = {
822 .description =
"DLink DUB-E100 USB Ethernet",
823 .bind = ax88172_bind,
824 .status = asix_status,
825 .link_reset = ax88172_link_reset,
826 .reset = ax88172_link_reset,
831 static const struct driver_info netgear_fa120_info = {
832 .description =
"Netgear FA-120 USB Ethernet",
833 .bind = ax88172_bind,
834 .status = asix_status,
835 .link_reset = ax88172_link_reset,
836 .reset = ax88172_link_reset,
841 static const struct driver_info hawking_uf200_info = {
842 .description =
"Hawking UF200 USB Ethernet",
843 .bind = ax88172_bind,
844 .status = asix_status,
845 .link_reset = ax88172_link_reset,
846 .reset = ax88172_link_reset,
852 .description =
"ASIX AX88772 USB 2.0 Ethernet",
853 .bind = ax88772_bind,
854 .status = asix_status,
855 .link_reset = ax88772_link_reset,
856 .reset = ax88772_reset,
863 .description =
"ASIX AX88178 USB 2.0 Ethernet",
864 .bind = ax88178_bind,
865 .status = asix_status,
866 .link_reset = ax88178_link_reset,
867 .reset = ax88178_reset,
878 USB_DEVICE (0x077b, 0x2226),
879 .driver_info = (
unsigned long) &ax8817x_info,
882 USB_DEVICE (0x0846, 0x1040),
883 .driver_info = (
unsigned long) &netgear_fa120_info,
886 USB_DEVICE (0x2001, 0x1a00),
887 .driver_info = (
unsigned long) &dlink_dub_e100_info,
890 USB_DEVICE (0x0b95, 0x1720),
891 .driver_info = (
unsigned long) &ax8817x_info,
894 USB_DEVICE (0x07b8, 0x420a),
895 .driver_info = (
unsigned long) &hawking_uf200_info,
898 USB_DEVICE (0x08dd, 0x90ff),
899 .driver_info = (
unsigned long) &ax8817x_info,
902 USB_DEVICE (0x0557, 0x2009),
903 .driver_info = (
unsigned long) &ax8817x_info,
906 USB_DEVICE (0x0411, 0x003d),
907 .driver_info = (
unsigned long) &ax8817x_info,
910 USB_DEVICE (0x0411, 0x006e),
911 .driver_info = (
unsigned long) &ax88178_info,
914 USB_DEVICE (0x6189, 0x182d),
915 .driver_info = (
unsigned long) &ax8817x_info,
918 USB_DEVICE (0x0df6, 0x0056),
919 .driver_info = (
unsigned long) &ax88178_info,
922 USB_DEVICE (0x07aa, 0x0017),
923 .driver_info = (
unsigned long) &ax8817x_info,
926 USB_DEVICE (0x1189, 0x0893),
927 .driver_info = (
unsigned long) &ax8817x_info,
930 USB_DEVICE (0x1631, 0x6200),
931 .driver_info = (
unsigned long) &ax8817x_info,
934 USB_DEVICE (0x04f1, 0x3008),
935 .driver_info = (
unsigned long) &ax8817x_info,
938 USB_DEVICE (0x17ef, 0x7203),
939 .driver_info = (
unsigned long) &ax88772_info,
942 USB_DEVICE (0x0b95, 0x772b),
943 .driver_info = (
unsigned long) &ax88772_info,
946 USB_DEVICE (0x0b95, 0x7720),
947 .driver_info = (
unsigned long) &ax88772_info,
950 USB_DEVICE (0x0b95, 0x1780),
951 .driver_info = (
unsigned long) &ax88178_info,
954 USB_DEVICE (0x0789, 0x0160),
955 .driver_info = (
unsigned long) &ax88178_info,
958 USB_DEVICE (0x13b1, 0x0018),
959 .driver_info = (
unsigned long) &ax88772_info,
962 USB_DEVICE (0x1557, 0x7720),
963 .driver_info = (
unsigned long) &ax88772_info,
966 USB_DEVICE (0x07d1, 0x3c05),
967 .driver_info = (
unsigned long) &ax88772_info,
970 USB_DEVICE (0x2001, 0x3c05),
971 .driver_info = (
unsigned long) &ax88772_info,
974 USB_DEVICE (0x2001, 0x1a02),
975 .driver_info = (
unsigned long) &ax88772_info,
978 USB_DEVICE (0x1737, 0x0039),
979 .driver_info = (
unsigned long) &ax88178_info,
982 USB_DEVICE (0x04bb, 0x0930),
983 .driver_info = (
unsigned long) &ax88178_info,
986 USB_DEVICE(0x050d, 0x5055),
987 .driver_info = (
unsigned long) &ax88178_info,
990 USB_DEVICE(0x05ac, 0x1402),
991 .driver_info = (
unsigned long) &ax88772_info,
994 USB_DEVICE(0x0b95, 0x772a),
995 .driver_info = (
unsigned long) &ax88772_info,
998 USB_DEVICE(0x14ea, 0xab11),
999 .driver_info = (
unsigned long) &ax88178_info,
1002 USB_DEVICE(0x0db0, 0xa877),
1003 .driver_info = (
unsigned long) &ax88772_info,
1006 USB_DEVICE (0x0b95, 0x7e2b),
1007 .driver_info = (
unsigned long) &ax88772_info,
1010 USB_DEVICE(0x0b95, 0x172a),
1017 static struct usb_driver asix_driver = {
1019 .id_table = products,
1024 .supports_autosuspend = 1,
1025 .disable_hub_initiated_lpm = 1,