Lines Matching +full:10 +full:- +full:gigabit
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * ASIX AX88179/178A USB 3.0/2.0 to Gigabit Ethernet Devices
5 * Copyright (C) 2011-2013 ASIX
139 #define GMII_LED2_LINK_1000 BIT(10)
152 #define LED2_ACTIVE BIT(10)
195 struct ax88179_data *ax179_data = dev->driver_priv; in ax88179_set_pm_mode()
197 ax179_data->in_pm = pm_mode; in ax88179_set_pm_mode()
202 struct ax88179_data *ax179_data = dev->driver_priv; in ax88179_in_pm()
204 return ax179_data->in_pm; in ax88179_in_pm()
212 struct ax88179_data *ax179_data = dev->driver_priv; in __ax88179_read_cmd()
224 if (unlikely((ret < 0) && !(ret == -ENODEV && ax179_data->disconnecting))) in __ax88179_read_cmd()
225 netdev_warn(dev->net, "Failed to read reg index 0x%04x: %d\n", in __ax88179_read_cmd()
236 struct ax88179_data *ax179_data = dev->driver_priv; in __ax88179_write_cmd()
248 if (unlikely((ret < 0) && !(ret == -ENODEV && ax179_data->disconnecting))) in __ax88179_write_cmd()
249 netdev_warn(dev->net, "Failed to write reg index 0x%04x: %d\n", in __ax88179_write_cmd()
319 if (urb->actual_length < 8) in ax88179_status()
322 event = urb->transfer_buffer; in ax88179_status()
323 le32_to_cpus((void *)&event->intdata1); in ax88179_status()
325 link = (((__force u32)event->intdata1) & AX_INT_PPLS_LINK) >> 16; in ax88179_status()
327 if (netif_carrier_ok(dev->net) != link) { in ax88179_status()
330 netdev_info(dev->net, "ax88179 - Link status is: 0\n"); in ax88179_status()
409 struct ax88179_data *priv = dev->driver_priv; in ax88179_suspend()
418 if (priv->wolopts) { in ax88179_suspend()
421 if (priv->wolopts & WAKE_PHY) in ax88179_suspend()
423 if (priv->wolopts & WAKE_MAGIC) in ax88179_suspend()
437 /* Force bulk-in zero length */ in ax88179_suspend()
507 ax179_data = dev->driver_priv; in ax88179_disconnect()
508 ax179_data->disconnecting = 1; in ax88179_disconnect()
517 struct ax88179_data *priv = dev->driver_priv; in ax88179_get_wol()
519 wolinfo->supported = priv->wol_supported; in ax88179_get_wol()
520 wolinfo->wolopts = priv->wolopts; in ax88179_get_wol()
527 struct ax88179_data *priv = dev->driver_priv; in ax88179_set_wol()
529 if (wolinfo->wolopts & ~(priv->wol_supported)) in ax88179_set_wol()
530 return -EINVAL; in ax88179_set_wol()
532 priv->wolopts = wolinfo->wolopts; in ax88179_set_wol()
551 if (eeprom->len == 0) in ax88179_get_eeprom()
552 return -EINVAL; in ax88179_get_eeprom()
554 eeprom->magic = AX88179_EEPROM_MAGIC; in ax88179_get_eeprom()
556 first_word = eeprom->offset >> 1; in ax88179_get_eeprom()
557 last_word = (eeprom->offset + eeprom->len - 1) >> 1; in ax88179_get_eeprom()
558 eeprom_buff = kmalloc_array(last_word - first_word + 1, sizeof(u16), in ax88179_get_eeprom()
561 return -ENOMEM; in ax88179_get_eeprom()
566 &eeprom_buff[i - first_word]); in ax88179_get_eeprom()
569 return -EIO; in ax88179_get_eeprom()
573 memcpy(data, (u8 *)eeprom_buff + (eeprom->offset & 1), eeprom->len); in ax88179_get_eeprom()
590 eeprom->len, eeprom->offset, eeprom->magic); in ax88179_set_eeprom()
592 if (eeprom->len == 0) in ax88179_set_eeprom()
593 return -EINVAL; in ax88179_set_eeprom()
595 if (eeprom->magic != AX88179_EEPROM_MAGIC) in ax88179_set_eeprom()
596 return -EINVAL; in ax88179_set_eeprom()
598 first_word = eeprom->offset >> 1; in ax88179_set_eeprom()
599 last_word = (eeprom->offset + eeprom->len - 1) >> 1; in ax88179_set_eeprom()
601 eeprom_buff = kmalloc_array(last_word - first_word + 1, sizeof(u16), in ax88179_set_eeprom()
604 return -ENOMEM; in ax88179_set_eeprom()
608 if (eeprom->offset & 1) { in ax88179_set_eeprom()
617 if ((eeprom->offset + eeprom->len) & 1) { in ax88179_set_eeprom()
619 &eeprom_buff[last_word - first_word]); in ax88179_set_eeprom()
626 memcpy((u8 *)eeprom_buff + (eeprom->offset & 1), data, eeprom->len); in ax88179_set_eeprom()
630 i, eeprom_buff[i - first_word]); in ax88179_set_eeprom()
632 &eeprom_buff[i - first_word]); in ax88179_set_eeprom()
658 mii_ethtool_get_link_ksettings(&dev->mii, cmd); in ax88179_get_link_ksettings()
667 return mii_ethtool_set_link_ksettings(&dev->mii, cmd); in ax88179_set_link_ksettings()
680 mii_eee_cap1_mod_linkmode_t(data->supported, val); in ax88179_ethtool_get_eee()
687 mii_eee_cap1_mod_linkmode_t(data->advertised, val); in ax88179_ethtool_get_eee()
694 mii_eee_cap1_mod_linkmode_t(data->lp_advertised, val); in ax88179_ethtool_get_eee()
702 u16 tmp16 = linkmode_to_mii_eee_cap1_t(data->advertised); in ax88179_ethtool_set_eee()
711 struct ax88179_data *priv = dev->driver_priv; in ax88179_chk_eee()
713 mii_ethtool_gset(&dev->mii, &ecmd); in ax88179_chk_eee()
723 priv->eee_active = 0; in ax88179_chk_eee()
729 priv->eee_active = 0; in ax88179_chk_eee()
737 priv->eee_active = 0; in ax88179_chk_eee()
746 priv->eee_active = 0; in ax88179_chk_eee()
757 priv->eee_active = 0; in ax88179_chk_eee()
761 priv->eee_active = 1; in ax88179_chk_eee()
765 priv->eee_active = 0; in ax88179_chk_eee()
814 struct ax88179_data *priv = dev->driver_priv; in ax88179_get_eee()
816 edata->eee_enabled = priv->eee_enabled; in ax88179_get_eee()
817 edata->eee_active = priv->eee_active; in ax88179_get_eee()
825 struct ax88179_data *priv = dev->driver_priv; in ax88179_set_eee()
828 priv->eee_enabled = edata->eee_enabled; in ax88179_set_eee()
829 if (!priv->eee_enabled) { in ax88179_set_eee()
832 priv->eee_enabled = ax88179_chk_eee(dev); in ax88179_set_eee()
833 if (!priv->eee_enabled) in ax88179_set_eee()
834 return -EOPNOTSUPP; in ax88179_set_eee()
843 mii_nway_restart(&dev->mii); in ax88179_set_eee()
853 return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL); in ax88179_ioctl()
876 struct ax88179_data *data = dev->driver_priv; in ax88179_set_multicast()
877 u8 *m_filter = ((u8 *)dev->data); in ax88179_set_multicast()
879 data->rxctl = (AX_RX_CTL_START | AX_RX_CTL_AB | AX_RX_CTL_IPE); in ax88179_set_multicast()
881 if (net->flags & IFF_PROMISC) { in ax88179_set_multicast()
882 data->rxctl |= AX_RX_CTL_PRO; in ax88179_set_multicast()
883 } else if (net->flags & IFF_ALLMULTI || in ax88179_set_multicast()
885 data->rxctl |= AX_RX_CTL_AMALL; in ax88179_set_multicast()
889 /* We use dev->data for our 8 byte filter buffer in ax88179_set_multicast()
898 crc_bits = ether_crc(ETH_ALEN, ha->addr) >> 26; in ax88179_set_multicast()
906 data->rxctl |= AX_RX_CTL_AM; in ax88179_set_multicast()
910 2, 2, &data->rxctl); in ax88179_set_multicast()
918 netdev_features_t changed = net->features ^ features; in ax88179_set_features()
947 WRITE_ONCE(net->mtu, new_mtu); in ax88179_change_mtu()
948 dev->hard_mtu = net->mtu + net->hard_header_len; in ax88179_change_mtu()
950 if (net->mtu > 1500) { in ax88179_change_mtu()
977 return -EBUSY; in ax88179_set_mac_addr()
978 if (!is_valid_ether_addr(addr->sa_data)) in ax88179_set_mac_addr()
979 return -EADDRNOTAVAIL; in ax88179_set_mac_addr()
981 eth_hw_addr_set(net, addr->sa_data); in ax88179_set_mac_addr()
985 ETH_ALEN, net->dev_addr); in ax88179_set_mac_addr()
1009 u16 csum, delay = HZ / 10; in ax88179_check_eeprom()
1017 return -EINVAL; in ax88179_check_eeprom()
1022 return -EINVAL; in ax88179_check_eeprom()
1030 return -EINVAL; in ax88179_check_eeprom()
1038 return -EINVAL; in ax88179_check_eeprom()
1043 if ((csum + eeprom[10]) != 0xff) in ax88179_check_eeprom()
1044 return -EINVAL; in ax88179_check_eeprom()
1056 return -EINVAL; in ax88179_check_efuse()
1059 return -EINVAL; in ax88179_check_efuse()
1068 return -EINVAL; in ax88179_check_efuse()
1081 return -EINVAL; in ax88179_convert_old_led()
1116 u16 tmp, ledact, ledlink, ledvalue = 0, delay = HZ / 10; in ax88179_led_setting()
1127 return -EINVAL; in ax88179_led_setting()
1135 return -EINVAL; in ax88179_led_setting()
1140 return -EINVAL; in ax88179_led_setting()
1148 return -EINVAL; in ax88179_led_setting()
1265 if (!eth_platform_get_mac_address(&dev->udev->dev, mac)) { in ax88179_get_mac_addr()
1266 netif_dbg(dev, ifup, dev->net, in ax88179_get_mac_addr()
1271 netif_dbg(dev, ifup, dev->net, in ax88179_get_mac_addr()
1276 eth_hw_addr_set(dev->net, mac); in ax88179_get_mac_addr()
1278 dev->net->addr_assign_type = NET_ADDR_PERM; in ax88179_get_mac_addr()
1280 netdev_info(dev->net, "invalid MAC address, using random\n"); in ax88179_get_mac_addr()
1284 dev->net->dev_addr); in ax88179_get_mac_addr()
1298 return -ENOMEM; in ax88179_bind()
1300 dev->driver_priv = ax179_data; in ax88179_bind()
1302 dev->net->netdev_ops = &ax88179_netdev_ops; in ax88179_bind()
1303 dev->net->ethtool_ops = &ax88179_ethtool_ops; in ax88179_bind()
1304 dev->net->needed_headroom = 8; in ax88179_bind()
1305 dev->net->max_mtu = 4088; in ax88179_bind()
1308 dev->mii.dev = dev->net; in ax88179_bind()
1309 dev->mii.mdio_read = ax88179_mdio_read; in ax88179_bind()
1310 dev->mii.mdio_write = ax88179_mdio_write; in ax88179_bind()
1311 dev->mii.phy_id_mask = 0xff; in ax88179_bind()
1312 dev->mii.reg_num_mask = 0xff; in ax88179_bind()
1313 dev->mii.phy_id = 0x03; in ax88179_bind()
1314 dev->mii.supports_gmii = 1; in ax88179_bind()
1316 dev->net->features |= NETIF_F_SG | NETIF_F_IP_CSUM | in ax88179_bind()
1319 dev->net->hw_features |= dev->net->features; in ax88179_bind()
1321 netif_set_tso_max_size(dev->net, 16384); in ax88179_bind()
1330 struct ax88179_data *ax179_data = dev->driver_priv; in ax88179_unbind()
1350 skb->ip_summed = CHECKSUM_NONE; in ax88179_rx_checksum()
1360 skb->ip_summed = CHECKSUM_UNNECESSARY; in ax88179_rx_checksum()
1373 * per-packet metadata (which contains elements encoded into u16). in ax88179_rx_fixup()
1380 * <per-packet metadata entry 1> <dummy header> in ax88179_rx_fixup()
1382 * <per-packet metadata entry N> <dummy header> in ax88179_rx_fixup()
1389 * <per-packet metadata entry N> contains 4 bytes: in ax88179_rx_fixup()
1391 * <padding> 0-7 bytes to terminate at in ax88179_rx_fixup()
1392 * 8 bytes boundary (64-bit). in ax88179_rx_fixup()
1394 * 8 bytes boundary (64-bit) in ax88179_rx_fixup()
1395 * <dummy-header> contains 4 bytes: in ax88179_rx_fixup()
1397 * <rx-hdr> contains 4 bytes: in ax88179_rx_fixup()
1399 * <per-packet metadata entry 1>) in ax88179_rx_fixup()
1401 * pkt_cnt is number of entrys in the per-packet metadata. in ax88179_rx_fixup()
1405 * This was done probably to align fields in 64-bit and in ax88179_rx_fixup()
1411 if (skb->len < 4) in ax88179_rx_fixup()
1413 skb_trim(skb, skb->len - 4); in ax88179_rx_fixup()
1424 if (pkt_cnt * 4 + hdr_off > skb->len) in ax88179_rx_fixup()
1426 pkt_hdr = (u32 *)(skb->data + hdr_off); in ax88179_rx_fixup()
1431 for (; pkt_cnt > 0; pkt_cnt--, pkt_hdr++) { in ax88179_rx_fixup()
1444 if (pkt_len_plus_padd > skb->len) in ax88179_rx_fixup()
1450 dev->net->stats.rx_errors++; in ax88179_rx_fixup()
1456 if (pkt_len_plus_padd == skb->len) { in ax88179_rx_fixup()
1466 ax_skb = netdev_alloc_skb_ip_align(dev->net, pkt_len); in ax88179_rx_fixup()
1470 memcpy(ax_skb->data, skb->data + 2, pkt_len); in ax88179_rx_fixup()
1485 int frame_size = dev->maxpacket; in ax88179_tx_fixup()
1489 tx_hdr1 = skb->len; in ax88179_tx_fixup()
1490 tx_hdr2 = skb_shinfo(skb)->gso_size; /* Set TSO mss */ in ax88179_tx_fixup()
1491 if (((skb->len + 8) % frame_size) == 0) in ax88179_tx_fixup()
1494 headroom = skb_headroom(skb) - 8; in ax88179_tx_fixup()
1496 if ((dev->net->features & NETIF_F_SG) && skb_linearize(skb)) in ax88179_tx_fixup()
1509 usbnet_set_skb_tx_stats(skb, (skb_shinfo(skb)->gso_segs ?: 1), 0); in ax88179_tx_fixup()
1516 struct ax88179_data *ax179_data = dev->driver_priv; in ax88179_link_reset()
1518 u16 mode, tmp16, delay = HZ / 10; in ax88179_link_reset()
1527 &ax179_data->rxctl); in ax88179_link_reset()
1546 netdev_info(dev->net, "ax88179 - Link status is: 0\n"); in ax88179_link_reset()
1550 if (dev->net->mtu > 1500) in ax88179_link_reset()
1573 dev->rx_urb_size = (1024 * (tmp[3] + 2)); in ax88179_link_reset()
1580 ax179_data->eee_enabled = ax88179_chk_eee(dev); in ax88179_link_reset()
1582 netif_carrier_on(dev->net); in ax88179_link_reset()
1584 netdev_info(dev->net, "ax88179 - Link status is: 1\n"); in ax88179_link_reset()
1594 struct ax88179_data *ax179_data = dev->driver_priv; in ax88179_reset()
1617 memcpy(dev->net->perm_addr, dev->net->dev_addr, ETH_ALEN); in ax88179_reset()
1623 dev->rx_urb_size = 1024 * 20; in ax88179_reset()
1658 ax179_data->wol_supported = 0; in ax88179_reset()
1661 ax179_data->wol_supported = WAKE_MAGIC | WAKE_PHY; in ax88179_reset()
1665 ax179_data->eee_enabled = 0; in ax88179_reset()
1666 ax179_data->eee_active = 0; in ax88179_reset()
1675 mii_nway_restart(&dev->mii); in ax88179_reset()
1717 .description = "ASIX AX88179 USB 3.0 Gigabit Ethernet",
1730 .description = "ASIX AX88178A USB 2.0 Gigabit Ethernet",
1743 .description = "Cypress GX3 SuperSpeed to Gigabit Ethernet Controller",
1756 .description = "D-Link DUB-1312 USB 3.0 to Gigabit Ethernet Adapter",
1769 .description = "Sitecom USB 3.0 to Gigabit Adapter",
1795 .description = "Lenovo OneLinkDock Gigabit LAN",
1834 .description = "MCT USB 3.0 Gigabit Ethernet Adapter",
1847 .description = "AT-UMC2000 USB 3.0/USB 3.1 Gen 1 to Gigabit Ethernet Adapter",
1860 .description = "AT-UMC200 USB 3.0/USB 3.1 Gen 1 to Fast Ethernet Adapter",
1873 .description = "AT-UMC2000/SP USB 3.0/USB 3.1 Gen 1 to Gigabit Ethernet Adapter",
1887 /* ASIX AX88179 10/100/1000 */
1891 /* ASIX AX88178A 10/100/1000 */
1895 /* Cypress GX3 SuperSpeed to Gigabit Ethernet Bridge Controller */
1899 /* D-Link DUB-1312 USB 3.0 to Gigabit Ethernet Adapter */
1903 /* Sitecom USB 3.0 to Gigabit Adapter */
1911 /* Lenovo OneLinkDock Gigabit LAN */
1915 /* Belkin B2B128 USB 3.0 Hub + Gigabit Ethernet Adapter */
1923 /* Magic Control Technology U3-A9003 USB 3.0 Gigabit Ethernet Adapter */
1927 /* Allied Telesis AT-UMC2000 USB 3.0/USB 3.1 Gen 1 to Gigabit Ethernet Adapter */
1931 /* Allied Telesis AT-UMC200 USB 3.0/USB 3.1 Gen 1 to Fast Ethernet Adapter */
1935 /* Allied Telesis AT-UMC2000/SP USB 3.0/USB 3.1 Gen 1 to Gigabit Ethernet Adapter */
1957 MODULE_DESCRIPTION("ASIX AX88179/178A based USB 3.0/2.0 Gigabit Ethernet Devices");