18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * MOSCHIP MCS7830 based (7730/7830/7832) USB 2.0 Ethernet Devices 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * based on usbnet.c, asix.c and the vendor provided mcs7830 driver 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Copyright (C) 2010 Andreas Mohr <andi@lisas.de> 88c2ecf20Sopenharmony_ci * Copyright (C) 2006 Arnd Bergmann <arnd@arndb.de> 98c2ecf20Sopenharmony_ci * Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com> 108c2ecf20Sopenharmony_ci * Copyright (C) 2005 Phil Chang <pchang23@sbcglobal.net> 118c2ecf20Sopenharmony_ci * Copyright (c) 2002-2003 TiVo Inc. 128c2ecf20Sopenharmony_ci * 138c2ecf20Sopenharmony_ci * Definitions gathered from MOSCHIP, Data Sheet_7830DA.pdf (thanks!). 148c2ecf20Sopenharmony_ci * 158c2ecf20Sopenharmony_ci * 2010-12-19: add 7832 USB PID ("functionality same as MCS7830"), 168c2ecf20Sopenharmony_ci * per active notification by manufacturer 178c2ecf20Sopenharmony_ci * 188c2ecf20Sopenharmony_ci * TODO: 198c2ecf20Sopenharmony_ci * - support HIF_REG_CONFIG_SLEEPMODE/HIF_REG_CONFIG_TXENABLE (via autopm?) 208c2ecf20Sopenharmony_ci * - implement ethtool_ops get_pauseparam/set_pauseparam 218c2ecf20Sopenharmony_ci * via HIF_REG_PAUSE_THRESHOLD (>= revision C only!) 228c2ecf20Sopenharmony_ci * - implement get_eeprom/[set_eeprom] 238c2ecf20Sopenharmony_ci * - switch PHY on/off on ifup/ifdown (perhaps in usbnet.c, via MII) 248c2ecf20Sopenharmony_ci * - mcs7830_get_regs() handling is weird: for rev 2 we return 32 regs, 258c2ecf20Sopenharmony_ci * can access only ~ 24, remaining user buffer is uninitialized garbage 268c2ecf20Sopenharmony_ci * - anything else? 278c2ecf20Sopenharmony_ci */ 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#include <linux/crc32.h> 308c2ecf20Sopenharmony_ci#include <linux/etherdevice.h> 318c2ecf20Sopenharmony_ci#include <linux/ethtool.h> 328c2ecf20Sopenharmony_ci#include <linux/mii.h> 338c2ecf20Sopenharmony_ci#include <linux/module.h> 348c2ecf20Sopenharmony_ci#include <linux/netdevice.h> 358c2ecf20Sopenharmony_ci#include <linux/slab.h> 368c2ecf20Sopenharmony_ci#include <linux/usb.h> 378c2ecf20Sopenharmony_ci#include <linux/usb/usbnet.h> 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci/* requests */ 408c2ecf20Sopenharmony_ci#define MCS7830_RD_BMREQ (USB_DIR_IN | USB_TYPE_VENDOR | \ 418c2ecf20Sopenharmony_ci USB_RECIP_DEVICE) 428c2ecf20Sopenharmony_ci#define MCS7830_WR_BMREQ (USB_DIR_OUT | USB_TYPE_VENDOR | \ 438c2ecf20Sopenharmony_ci USB_RECIP_DEVICE) 448c2ecf20Sopenharmony_ci#define MCS7830_RD_BREQ 0x0E 458c2ecf20Sopenharmony_ci#define MCS7830_WR_BREQ 0x0D 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci#define MCS7830_CTRL_TIMEOUT 1000 488c2ecf20Sopenharmony_ci#define MCS7830_MAX_MCAST 64 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci#define MCS7830_VENDOR_ID 0x9710 518c2ecf20Sopenharmony_ci#define MCS7832_PRODUCT_ID 0x7832 528c2ecf20Sopenharmony_ci#define MCS7830_PRODUCT_ID 0x7830 538c2ecf20Sopenharmony_ci#define MCS7730_PRODUCT_ID 0x7730 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci#define SITECOM_VENDOR_ID 0x0DF6 568c2ecf20Sopenharmony_ci#define LN_030_PRODUCT_ID 0x0021 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci#define MCS7830_MII_ADVERTISE (ADVERTISE_PAUSE_CAP | ADVERTISE_100FULL | \ 598c2ecf20Sopenharmony_ci ADVERTISE_100HALF | ADVERTISE_10FULL | \ 608c2ecf20Sopenharmony_ci ADVERTISE_10HALF | ADVERTISE_CSMA) 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci/* HIF_REG_XX corresponding index value */ 638c2ecf20Sopenharmony_cienum { 648c2ecf20Sopenharmony_ci HIF_REG_MULTICAST_HASH = 0x00, 658c2ecf20Sopenharmony_ci HIF_REG_PACKET_GAP1 = 0x08, 668c2ecf20Sopenharmony_ci HIF_REG_PACKET_GAP2 = 0x09, 678c2ecf20Sopenharmony_ci HIF_REG_PHY_DATA = 0x0a, 688c2ecf20Sopenharmony_ci HIF_REG_PHY_CMD1 = 0x0c, 698c2ecf20Sopenharmony_ci HIF_REG_PHY_CMD1_READ = 0x40, 708c2ecf20Sopenharmony_ci HIF_REG_PHY_CMD1_WRITE = 0x20, 718c2ecf20Sopenharmony_ci HIF_REG_PHY_CMD1_PHYADDR = 0x01, 728c2ecf20Sopenharmony_ci HIF_REG_PHY_CMD2 = 0x0d, 738c2ecf20Sopenharmony_ci HIF_REG_PHY_CMD2_PEND_FLAG_BIT = 0x80, 748c2ecf20Sopenharmony_ci HIF_REG_PHY_CMD2_READY_FLAG_BIT = 0x40, 758c2ecf20Sopenharmony_ci HIF_REG_CONFIG = 0x0e, 768c2ecf20Sopenharmony_ci /* hmm, spec sez: "R/W", "Except bit 3" (likely TXENABLE). */ 778c2ecf20Sopenharmony_ci HIF_REG_CONFIG_CFG = 0x80, 788c2ecf20Sopenharmony_ci HIF_REG_CONFIG_SPEED100 = 0x40, 798c2ecf20Sopenharmony_ci HIF_REG_CONFIG_FULLDUPLEX_ENABLE = 0x20, 808c2ecf20Sopenharmony_ci HIF_REG_CONFIG_RXENABLE = 0x10, 818c2ecf20Sopenharmony_ci HIF_REG_CONFIG_TXENABLE = 0x08, 828c2ecf20Sopenharmony_ci HIF_REG_CONFIG_SLEEPMODE = 0x04, 838c2ecf20Sopenharmony_ci HIF_REG_CONFIG_ALLMULTICAST = 0x02, 848c2ecf20Sopenharmony_ci HIF_REG_CONFIG_PROMISCUOUS = 0x01, 858c2ecf20Sopenharmony_ci HIF_REG_ETHERNET_ADDR = 0x0f, 868c2ecf20Sopenharmony_ci HIF_REG_FRAME_DROP_COUNTER = 0x15, /* 0..ff; reset: 0 */ 878c2ecf20Sopenharmony_ci HIF_REG_PAUSE_THRESHOLD = 0x16, 888c2ecf20Sopenharmony_ci HIF_REG_PAUSE_THRESHOLD_DEFAULT = 0, 898c2ecf20Sopenharmony_ci}; 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci/* Trailing status byte in Ethernet Rx frame */ 928c2ecf20Sopenharmony_cienum { 938c2ecf20Sopenharmony_ci MCS7830_RX_SHORT_FRAME = 0x01, /* < 64 bytes */ 948c2ecf20Sopenharmony_ci MCS7830_RX_LENGTH_ERROR = 0x02, /* framelen != Ethernet length field */ 958c2ecf20Sopenharmony_ci MCS7830_RX_ALIGNMENT_ERROR = 0x04, /* non-even number of nibbles */ 968c2ecf20Sopenharmony_ci MCS7830_RX_CRC_ERROR = 0x08, 978c2ecf20Sopenharmony_ci MCS7830_RX_LARGE_FRAME = 0x10, /* > 1518 bytes */ 988c2ecf20Sopenharmony_ci MCS7830_RX_FRAME_CORRECT = 0x20, /* frame is correct */ 998c2ecf20Sopenharmony_ci /* [7:6] reserved */ 1008c2ecf20Sopenharmony_ci}; 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_cistruct mcs7830_data { 1038c2ecf20Sopenharmony_ci u8 multi_filter[8]; 1048c2ecf20Sopenharmony_ci u8 config; 1058c2ecf20Sopenharmony_ci}; 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_cistatic const char driver_name[] = "MOSCHIP usb-ethernet driver"; 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_cistatic int mcs7830_get_reg(struct usbnet *dev, u16 index, u16 size, void *data) 1108c2ecf20Sopenharmony_ci{ 1118c2ecf20Sopenharmony_ci int ret; 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci ret = usbnet_read_cmd(dev, MCS7830_RD_BREQ, MCS7830_RD_BMREQ, 1148c2ecf20Sopenharmony_ci 0x0000, index, data, size); 1158c2ecf20Sopenharmony_ci if (ret < 0) 1168c2ecf20Sopenharmony_ci return ret; 1178c2ecf20Sopenharmony_ci else if (ret < size) 1188c2ecf20Sopenharmony_ci return -ENODATA; 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci return ret; 1218c2ecf20Sopenharmony_ci} 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_cistatic int mcs7830_set_reg(struct usbnet *dev, u16 index, u16 size, const void *data) 1248c2ecf20Sopenharmony_ci{ 1258c2ecf20Sopenharmony_ci return usbnet_write_cmd(dev, MCS7830_WR_BREQ, MCS7830_WR_BMREQ, 1268c2ecf20Sopenharmony_ci 0x0000, index, data, size); 1278c2ecf20Sopenharmony_ci} 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_cistatic void mcs7830_set_reg_async(struct usbnet *dev, u16 index, u16 size, void *data) 1308c2ecf20Sopenharmony_ci{ 1318c2ecf20Sopenharmony_ci usbnet_write_cmd_async(dev, MCS7830_WR_BREQ, MCS7830_WR_BMREQ, 1328c2ecf20Sopenharmony_ci 0x0000, index, data, size); 1338c2ecf20Sopenharmony_ci} 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_cistatic int mcs7830_hif_get_mac_address(struct usbnet *dev, unsigned char *addr) 1368c2ecf20Sopenharmony_ci{ 1378c2ecf20Sopenharmony_ci int ret = mcs7830_get_reg(dev, HIF_REG_ETHERNET_ADDR, ETH_ALEN, addr); 1388c2ecf20Sopenharmony_ci if (ret < 0) 1398c2ecf20Sopenharmony_ci return ret; 1408c2ecf20Sopenharmony_ci return 0; 1418c2ecf20Sopenharmony_ci} 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_cistatic int mcs7830_hif_set_mac_address(struct usbnet *dev, unsigned char *addr) 1448c2ecf20Sopenharmony_ci{ 1458c2ecf20Sopenharmony_ci int ret = mcs7830_set_reg(dev, HIF_REG_ETHERNET_ADDR, ETH_ALEN, addr); 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ci if (ret < 0) 1488c2ecf20Sopenharmony_ci return ret; 1498c2ecf20Sopenharmony_ci return 0; 1508c2ecf20Sopenharmony_ci} 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_cistatic int mcs7830_set_mac_address(struct net_device *netdev, void *p) 1538c2ecf20Sopenharmony_ci{ 1548c2ecf20Sopenharmony_ci int ret; 1558c2ecf20Sopenharmony_ci struct usbnet *dev = netdev_priv(netdev); 1568c2ecf20Sopenharmony_ci struct sockaddr *addr = p; 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_ci if (netif_running(netdev)) 1598c2ecf20Sopenharmony_ci return -EBUSY; 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_ci if (!is_valid_ether_addr(addr->sa_data)) 1628c2ecf20Sopenharmony_ci return -EADDRNOTAVAIL; 1638c2ecf20Sopenharmony_ci 1648c2ecf20Sopenharmony_ci ret = mcs7830_hif_set_mac_address(dev, addr->sa_data); 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ci if (ret < 0) 1678c2ecf20Sopenharmony_ci return ret; 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ci /* it worked --> adopt it on netdev side */ 1708c2ecf20Sopenharmony_ci memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci return 0; 1738c2ecf20Sopenharmony_ci} 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_cistatic int mcs7830_read_phy(struct usbnet *dev, u8 index) 1768c2ecf20Sopenharmony_ci{ 1778c2ecf20Sopenharmony_ci int ret; 1788c2ecf20Sopenharmony_ci int i; 1798c2ecf20Sopenharmony_ci __le16 val; 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_ci u8 cmd[2] = { 1828c2ecf20Sopenharmony_ci HIF_REG_PHY_CMD1_READ | HIF_REG_PHY_CMD1_PHYADDR, 1838c2ecf20Sopenharmony_ci HIF_REG_PHY_CMD2_PEND_FLAG_BIT | index, 1848c2ecf20Sopenharmony_ci }; 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci mutex_lock(&dev->phy_mutex); 1878c2ecf20Sopenharmony_ci /* write the MII command */ 1888c2ecf20Sopenharmony_ci ret = mcs7830_set_reg(dev, HIF_REG_PHY_CMD1, 2, cmd); 1898c2ecf20Sopenharmony_ci if (ret < 0) 1908c2ecf20Sopenharmony_ci goto out; 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_ci /* wait for the data to become valid, should be within < 1ms */ 1938c2ecf20Sopenharmony_ci for (i = 0; i < 10; i++) { 1948c2ecf20Sopenharmony_ci ret = mcs7830_get_reg(dev, HIF_REG_PHY_CMD1, 2, cmd); 1958c2ecf20Sopenharmony_ci if ((ret < 0) || (cmd[1] & HIF_REG_PHY_CMD2_READY_FLAG_BIT)) 1968c2ecf20Sopenharmony_ci break; 1978c2ecf20Sopenharmony_ci ret = -EIO; 1988c2ecf20Sopenharmony_ci msleep(1); 1998c2ecf20Sopenharmony_ci } 2008c2ecf20Sopenharmony_ci if (ret < 0) 2018c2ecf20Sopenharmony_ci goto out; 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_ci /* read actual register contents */ 2048c2ecf20Sopenharmony_ci ret = mcs7830_get_reg(dev, HIF_REG_PHY_DATA, 2, &val); 2058c2ecf20Sopenharmony_ci if (ret < 0) 2068c2ecf20Sopenharmony_ci goto out; 2078c2ecf20Sopenharmony_ci ret = le16_to_cpu(val); 2088c2ecf20Sopenharmony_ci dev_dbg(&dev->udev->dev, "read PHY reg %02x: %04x (%d tries)\n", 2098c2ecf20Sopenharmony_ci index, val, i); 2108c2ecf20Sopenharmony_ciout: 2118c2ecf20Sopenharmony_ci mutex_unlock(&dev->phy_mutex); 2128c2ecf20Sopenharmony_ci return ret; 2138c2ecf20Sopenharmony_ci} 2148c2ecf20Sopenharmony_ci 2158c2ecf20Sopenharmony_cistatic int mcs7830_write_phy(struct usbnet *dev, u8 index, u16 val) 2168c2ecf20Sopenharmony_ci{ 2178c2ecf20Sopenharmony_ci int ret; 2188c2ecf20Sopenharmony_ci int i; 2198c2ecf20Sopenharmony_ci __le16 le_val; 2208c2ecf20Sopenharmony_ci 2218c2ecf20Sopenharmony_ci u8 cmd[2] = { 2228c2ecf20Sopenharmony_ci HIF_REG_PHY_CMD1_WRITE | HIF_REG_PHY_CMD1_PHYADDR, 2238c2ecf20Sopenharmony_ci HIF_REG_PHY_CMD2_PEND_FLAG_BIT | (index & 0x1F), 2248c2ecf20Sopenharmony_ci }; 2258c2ecf20Sopenharmony_ci 2268c2ecf20Sopenharmony_ci mutex_lock(&dev->phy_mutex); 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_ci /* write the new register contents */ 2298c2ecf20Sopenharmony_ci le_val = cpu_to_le16(val); 2308c2ecf20Sopenharmony_ci ret = mcs7830_set_reg(dev, HIF_REG_PHY_DATA, 2, &le_val); 2318c2ecf20Sopenharmony_ci if (ret < 0) 2328c2ecf20Sopenharmony_ci goto out; 2338c2ecf20Sopenharmony_ci 2348c2ecf20Sopenharmony_ci /* write the MII command */ 2358c2ecf20Sopenharmony_ci ret = mcs7830_set_reg(dev, HIF_REG_PHY_CMD1, 2, cmd); 2368c2ecf20Sopenharmony_ci if (ret < 0) 2378c2ecf20Sopenharmony_ci goto out; 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_ci /* wait for the command to be accepted by the PHY */ 2408c2ecf20Sopenharmony_ci for (i = 0; i < 10; i++) { 2418c2ecf20Sopenharmony_ci ret = mcs7830_get_reg(dev, HIF_REG_PHY_CMD1, 2, cmd); 2428c2ecf20Sopenharmony_ci if ((ret < 0) || (cmd[1] & HIF_REG_PHY_CMD2_READY_FLAG_BIT)) 2438c2ecf20Sopenharmony_ci break; 2448c2ecf20Sopenharmony_ci ret = -EIO; 2458c2ecf20Sopenharmony_ci msleep(1); 2468c2ecf20Sopenharmony_ci } 2478c2ecf20Sopenharmony_ci if (ret < 0) 2488c2ecf20Sopenharmony_ci goto out; 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_ci ret = 0; 2518c2ecf20Sopenharmony_ci dev_dbg(&dev->udev->dev, "write PHY reg %02x: %04x (%d tries)\n", 2528c2ecf20Sopenharmony_ci index, val, i); 2538c2ecf20Sopenharmony_ciout: 2548c2ecf20Sopenharmony_ci mutex_unlock(&dev->phy_mutex); 2558c2ecf20Sopenharmony_ci return ret; 2568c2ecf20Sopenharmony_ci} 2578c2ecf20Sopenharmony_ci 2588c2ecf20Sopenharmony_ci/* 2598c2ecf20Sopenharmony_ci * This algorithm comes from the original mcs7830 version 1.4 driver, 2608c2ecf20Sopenharmony_ci * not sure if it is needed. 2618c2ecf20Sopenharmony_ci */ 2628c2ecf20Sopenharmony_cistatic int mcs7830_set_autoneg(struct usbnet *dev, int ptrUserPhyMode) 2638c2ecf20Sopenharmony_ci{ 2648c2ecf20Sopenharmony_ci int ret; 2658c2ecf20Sopenharmony_ci /* Enable all media types */ 2668c2ecf20Sopenharmony_ci ret = mcs7830_write_phy(dev, MII_ADVERTISE, MCS7830_MII_ADVERTISE); 2678c2ecf20Sopenharmony_ci 2688c2ecf20Sopenharmony_ci /* First reset BMCR */ 2698c2ecf20Sopenharmony_ci if (!ret) 2708c2ecf20Sopenharmony_ci ret = mcs7830_write_phy(dev, MII_BMCR, 0x0000); 2718c2ecf20Sopenharmony_ci /* Enable Auto Neg */ 2728c2ecf20Sopenharmony_ci if (!ret) 2738c2ecf20Sopenharmony_ci ret = mcs7830_write_phy(dev, MII_BMCR, BMCR_ANENABLE); 2748c2ecf20Sopenharmony_ci /* Restart Auto Neg (Keep the Enable Auto Neg Bit Set) */ 2758c2ecf20Sopenharmony_ci if (!ret) 2768c2ecf20Sopenharmony_ci ret = mcs7830_write_phy(dev, MII_BMCR, 2778c2ecf20Sopenharmony_ci BMCR_ANENABLE | BMCR_ANRESTART ); 2788c2ecf20Sopenharmony_ci return ret; 2798c2ecf20Sopenharmony_ci} 2808c2ecf20Sopenharmony_ci 2818c2ecf20Sopenharmony_ci 2828c2ecf20Sopenharmony_ci/* 2838c2ecf20Sopenharmony_ci * if we can read register 22, the chip revision is C or higher 2848c2ecf20Sopenharmony_ci */ 2858c2ecf20Sopenharmony_cistatic int mcs7830_get_rev(struct usbnet *dev) 2868c2ecf20Sopenharmony_ci{ 2878c2ecf20Sopenharmony_ci u8 dummy[2]; 2888c2ecf20Sopenharmony_ci int ret; 2898c2ecf20Sopenharmony_ci ret = mcs7830_get_reg(dev, HIF_REG_FRAME_DROP_COUNTER, 2, dummy); 2908c2ecf20Sopenharmony_ci if (ret > 0) 2918c2ecf20Sopenharmony_ci return 2; /* Rev C or later */ 2928c2ecf20Sopenharmony_ci return 1; /* earlier revision */ 2938c2ecf20Sopenharmony_ci} 2948c2ecf20Sopenharmony_ci 2958c2ecf20Sopenharmony_ci/* 2968c2ecf20Sopenharmony_ci * On rev. C we need to set the pause threshold 2978c2ecf20Sopenharmony_ci */ 2988c2ecf20Sopenharmony_cistatic void mcs7830_rev_C_fixup(struct usbnet *dev) 2998c2ecf20Sopenharmony_ci{ 3008c2ecf20Sopenharmony_ci u8 pause_threshold = HIF_REG_PAUSE_THRESHOLD_DEFAULT; 3018c2ecf20Sopenharmony_ci int retry; 3028c2ecf20Sopenharmony_ci 3038c2ecf20Sopenharmony_ci for (retry = 0; retry < 2; retry++) { 3048c2ecf20Sopenharmony_ci if (mcs7830_get_rev(dev) == 2) { 3058c2ecf20Sopenharmony_ci dev_info(&dev->udev->dev, "applying rev.C fixup\n"); 3068c2ecf20Sopenharmony_ci mcs7830_set_reg(dev, HIF_REG_PAUSE_THRESHOLD, 3078c2ecf20Sopenharmony_ci 1, &pause_threshold); 3088c2ecf20Sopenharmony_ci } 3098c2ecf20Sopenharmony_ci msleep(1); 3108c2ecf20Sopenharmony_ci } 3118c2ecf20Sopenharmony_ci} 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_cistatic int mcs7830_mdio_read(struct net_device *netdev, int phy_id, 3148c2ecf20Sopenharmony_ci int location) 3158c2ecf20Sopenharmony_ci{ 3168c2ecf20Sopenharmony_ci struct usbnet *dev = netdev_priv(netdev); 3178c2ecf20Sopenharmony_ci return mcs7830_read_phy(dev, location); 3188c2ecf20Sopenharmony_ci} 3198c2ecf20Sopenharmony_ci 3208c2ecf20Sopenharmony_cistatic void mcs7830_mdio_write(struct net_device *netdev, int phy_id, 3218c2ecf20Sopenharmony_ci int location, int val) 3228c2ecf20Sopenharmony_ci{ 3238c2ecf20Sopenharmony_ci struct usbnet *dev = netdev_priv(netdev); 3248c2ecf20Sopenharmony_ci mcs7830_write_phy(dev, location, val); 3258c2ecf20Sopenharmony_ci} 3268c2ecf20Sopenharmony_ci 3278c2ecf20Sopenharmony_cistatic int mcs7830_ioctl(struct net_device *net, struct ifreq *rq, int cmd) 3288c2ecf20Sopenharmony_ci{ 3298c2ecf20Sopenharmony_ci struct usbnet *dev = netdev_priv(net); 3308c2ecf20Sopenharmony_ci return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL); 3318c2ecf20Sopenharmony_ci} 3328c2ecf20Sopenharmony_ci 3338c2ecf20Sopenharmony_cistatic inline struct mcs7830_data *mcs7830_get_data(struct usbnet *dev) 3348c2ecf20Sopenharmony_ci{ 3358c2ecf20Sopenharmony_ci return (struct mcs7830_data *)&dev->data; 3368c2ecf20Sopenharmony_ci} 3378c2ecf20Sopenharmony_ci 3388c2ecf20Sopenharmony_cistatic void mcs7830_hif_update_multicast_hash(struct usbnet *dev) 3398c2ecf20Sopenharmony_ci{ 3408c2ecf20Sopenharmony_ci struct mcs7830_data *data = mcs7830_get_data(dev); 3418c2ecf20Sopenharmony_ci mcs7830_set_reg_async(dev, HIF_REG_MULTICAST_HASH, 3428c2ecf20Sopenharmony_ci sizeof data->multi_filter, 3438c2ecf20Sopenharmony_ci data->multi_filter); 3448c2ecf20Sopenharmony_ci} 3458c2ecf20Sopenharmony_ci 3468c2ecf20Sopenharmony_cistatic void mcs7830_hif_update_config(struct usbnet *dev) 3478c2ecf20Sopenharmony_ci{ 3488c2ecf20Sopenharmony_ci /* implementation specific to data->config 3498c2ecf20Sopenharmony_ci (argument needs to be heap-based anyway - USB DMA!) */ 3508c2ecf20Sopenharmony_ci struct mcs7830_data *data = mcs7830_get_data(dev); 3518c2ecf20Sopenharmony_ci mcs7830_set_reg_async(dev, HIF_REG_CONFIG, 1, &data->config); 3528c2ecf20Sopenharmony_ci} 3538c2ecf20Sopenharmony_ci 3548c2ecf20Sopenharmony_cistatic void mcs7830_data_set_multicast(struct net_device *net) 3558c2ecf20Sopenharmony_ci{ 3568c2ecf20Sopenharmony_ci struct usbnet *dev = netdev_priv(net); 3578c2ecf20Sopenharmony_ci struct mcs7830_data *data = mcs7830_get_data(dev); 3588c2ecf20Sopenharmony_ci 3598c2ecf20Sopenharmony_ci memset(data->multi_filter, 0, sizeof data->multi_filter); 3608c2ecf20Sopenharmony_ci 3618c2ecf20Sopenharmony_ci data->config = HIF_REG_CONFIG_TXENABLE; 3628c2ecf20Sopenharmony_ci 3638c2ecf20Sopenharmony_ci /* this should not be needed, but it doesn't work otherwise */ 3648c2ecf20Sopenharmony_ci data->config |= HIF_REG_CONFIG_ALLMULTICAST; 3658c2ecf20Sopenharmony_ci 3668c2ecf20Sopenharmony_ci if (net->flags & IFF_PROMISC) { 3678c2ecf20Sopenharmony_ci data->config |= HIF_REG_CONFIG_PROMISCUOUS; 3688c2ecf20Sopenharmony_ci } else if (net->flags & IFF_ALLMULTI || 3698c2ecf20Sopenharmony_ci netdev_mc_count(net) > MCS7830_MAX_MCAST) { 3708c2ecf20Sopenharmony_ci data->config |= HIF_REG_CONFIG_ALLMULTICAST; 3718c2ecf20Sopenharmony_ci } else if (netdev_mc_empty(net)) { 3728c2ecf20Sopenharmony_ci /* just broadcast and directed */ 3738c2ecf20Sopenharmony_ci } else { 3748c2ecf20Sopenharmony_ci /* We use the 20 byte dev->data 3758c2ecf20Sopenharmony_ci * for our 8 byte filter buffer 3768c2ecf20Sopenharmony_ci * to avoid allocating memory that 3778c2ecf20Sopenharmony_ci * is tricky to free later */ 3788c2ecf20Sopenharmony_ci struct netdev_hw_addr *ha; 3798c2ecf20Sopenharmony_ci u32 crc_bits; 3808c2ecf20Sopenharmony_ci 3818c2ecf20Sopenharmony_ci /* Build the multicast hash filter. */ 3828c2ecf20Sopenharmony_ci netdev_for_each_mc_addr(ha, net) { 3838c2ecf20Sopenharmony_ci crc_bits = ether_crc(ETH_ALEN, ha->addr) >> 26; 3848c2ecf20Sopenharmony_ci data->multi_filter[crc_bits >> 3] |= 1 << (crc_bits & 7); 3858c2ecf20Sopenharmony_ci } 3868c2ecf20Sopenharmony_ci } 3878c2ecf20Sopenharmony_ci} 3888c2ecf20Sopenharmony_ci 3898c2ecf20Sopenharmony_cistatic int mcs7830_apply_base_config(struct usbnet *dev) 3908c2ecf20Sopenharmony_ci{ 3918c2ecf20Sopenharmony_ci int ret; 3928c2ecf20Sopenharmony_ci 3938c2ecf20Sopenharmony_ci /* re-configure known MAC (suspend case etc.) */ 3948c2ecf20Sopenharmony_ci ret = mcs7830_hif_set_mac_address(dev, dev->net->dev_addr); 3958c2ecf20Sopenharmony_ci if (ret) { 3968c2ecf20Sopenharmony_ci dev_info(&dev->udev->dev, "Cannot set MAC address\n"); 3978c2ecf20Sopenharmony_ci goto out; 3988c2ecf20Sopenharmony_ci } 3998c2ecf20Sopenharmony_ci 4008c2ecf20Sopenharmony_ci /* Set up PHY */ 4018c2ecf20Sopenharmony_ci ret = mcs7830_set_autoneg(dev, 0); 4028c2ecf20Sopenharmony_ci if (ret) { 4038c2ecf20Sopenharmony_ci dev_info(&dev->udev->dev, "Cannot set autoneg\n"); 4048c2ecf20Sopenharmony_ci goto out; 4058c2ecf20Sopenharmony_ci } 4068c2ecf20Sopenharmony_ci 4078c2ecf20Sopenharmony_ci mcs7830_hif_update_multicast_hash(dev); 4088c2ecf20Sopenharmony_ci mcs7830_hif_update_config(dev); 4098c2ecf20Sopenharmony_ci 4108c2ecf20Sopenharmony_ci mcs7830_rev_C_fixup(dev); 4118c2ecf20Sopenharmony_ci ret = 0; 4128c2ecf20Sopenharmony_ciout: 4138c2ecf20Sopenharmony_ci return ret; 4148c2ecf20Sopenharmony_ci} 4158c2ecf20Sopenharmony_ci 4168c2ecf20Sopenharmony_ci/* credits go to asix_set_multicast */ 4178c2ecf20Sopenharmony_cistatic void mcs7830_set_multicast(struct net_device *net) 4188c2ecf20Sopenharmony_ci{ 4198c2ecf20Sopenharmony_ci struct usbnet *dev = netdev_priv(net); 4208c2ecf20Sopenharmony_ci 4218c2ecf20Sopenharmony_ci mcs7830_data_set_multicast(net); 4228c2ecf20Sopenharmony_ci 4238c2ecf20Sopenharmony_ci mcs7830_hif_update_multicast_hash(dev); 4248c2ecf20Sopenharmony_ci mcs7830_hif_update_config(dev); 4258c2ecf20Sopenharmony_ci} 4268c2ecf20Sopenharmony_ci 4278c2ecf20Sopenharmony_cistatic int mcs7830_get_regs_len(struct net_device *net) 4288c2ecf20Sopenharmony_ci{ 4298c2ecf20Sopenharmony_ci struct usbnet *dev = netdev_priv(net); 4308c2ecf20Sopenharmony_ci 4318c2ecf20Sopenharmony_ci switch (mcs7830_get_rev(dev)) { 4328c2ecf20Sopenharmony_ci case 1: 4338c2ecf20Sopenharmony_ci return 21; 4348c2ecf20Sopenharmony_ci case 2: 4358c2ecf20Sopenharmony_ci return 32; 4368c2ecf20Sopenharmony_ci } 4378c2ecf20Sopenharmony_ci return 0; 4388c2ecf20Sopenharmony_ci} 4398c2ecf20Sopenharmony_ci 4408c2ecf20Sopenharmony_cistatic void mcs7830_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *drvinfo) 4418c2ecf20Sopenharmony_ci{ 4428c2ecf20Sopenharmony_ci usbnet_get_drvinfo(net, drvinfo); 4438c2ecf20Sopenharmony_ci} 4448c2ecf20Sopenharmony_ci 4458c2ecf20Sopenharmony_cistatic void mcs7830_get_regs(struct net_device *net, struct ethtool_regs *regs, void *data) 4468c2ecf20Sopenharmony_ci{ 4478c2ecf20Sopenharmony_ci struct usbnet *dev = netdev_priv(net); 4488c2ecf20Sopenharmony_ci 4498c2ecf20Sopenharmony_ci regs->version = mcs7830_get_rev(dev); 4508c2ecf20Sopenharmony_ci mcs7830_get_reg(dev, 0, regs->len, data); 4518c2ecf20Sopenharmony_ci} 4528c2ecf20Sopenharmony_ci 4538c2ecf20Sopenharmony_cistatic const struct ethtool_ops mcs7830_ethtool_ops = { 4548c2ecf20Sopenharmony_ci .get_drvinfo = mcs7830_get_drvinfo, 4558c2ecf20Sopenharmony_ci .get_regs_len = mcs7830_get_regs_len, 4568c2ecf20Sopenharmony_ci .get_regs = mcs7830_get_regs, 4578c2ecf20Sopenharmony_ci 4588c2ecf20Sopenharmony_ci /* common usbnet calls */ 4598c2ecf20Sopenharmony_ci .get_link = usbnet_get_link, 4608c2ecf20Sopenharmony_ci .get_msglevel = usbnet_get_msglevel, 4618c2ecf20Sopenharmony_ci .set_msglevel = usbnet_set_msglevel, 4628c2ecf20Sopenharmony_ci .nway_reset = usbnet_nway_reset, 4638c2ecf20Sopenharmony_ci .get_link_ksettings = usbnet_get_link_ksettings, 4648c2ecf20Sopenharmony_ci .set_link_ksettings = usbnet_set_link_ksettings, 4658c2ecf20Sopenharmony_ci}; 4668c2ecf20Sopenharmony_ci 4678c2ecf20Sopenharmony_cistatic const struct net_device_ops mcs7830_netdev_ops = { 4688c2ecf20Sopenharmony_ci .ndo_open = usbnet_open, 4698c2ecf20Sopenharmony_ci .ndo_stop = usbnet_stop, 4708c2ecf20Sopenharmony_ci .ndo_start_xmit = usbnet_start_xmit, 4718c2ecf20Sopenharmony_ci .ndo_tx_timeout = usbnet_tx_timeout, 4728c2ecf20Sopenharmony_ci .ndo_change_mtu = usbnet_change_mtu, 4738c2ecf20Sopenharmony_ci .ndo_get_stats64 = usbnet_get_stats64, 4748c2ecf20Sopenharmony_ci .ndo_validate_addr = eth_validate_addr, 4758c2ecf20Sopenharmony_ci .ndo_do_ioctl = mcs7830_ioctl, 4768c2ecf20Sopenharmony_ci .ndo_set_rx_mode = mcs7830_set_multicast, 4778c2ecf20Sopenharmony_ci .ndo_set_mac_address = mcs7830_set_mac_address, 4788c2ecf20Sopenharmony_ci}; 4798c2ecf20Sopenharmony_ci 4808c2ecf20Sopenharmony_cistatic int mcs7830_bind(struct usbnet *dev, struct usb_interface *udev) 4818c2ecf20Sopenharmony_ci{ 4828c2ecf20Sopenharmony_ci struct net_device *net = dev->net; 4838c2ecf20Sopenharmony_ci int ret; 4848c2ecf20Sopenharmony_ci int retry; 4858c2ecf20Sopenharmony_ci 4868c2ecf20Sopenharmony_ci /* Initial startup: Gather MAC address setting from EEPROM */ 4878c2ecf20Sopenharmony_ci ret = -EINVAL; 4888c2ecf20Sopenharmony_ci for (retry = 0; retry < 5 && ret; retry++) 4898c2ecf20Sopenharmony_ci ret = mcs7830_hif_get_mac_address(dev, net->dev_addr); 4908c2ecf20Sopenharmony_ci if (ret) { 4918c2ecf20Sopenharmony_ci dev_warn(&dev->udev->dev, "Cannot read MAC address\n"); 4928c2ecf20Sopenharmony_ci goto out; 4938c2ecf20Sopenharmony_ci } 4948c2ecf20Sopenharmony_ci 4958c2ecf20Sopenharmony_ci mcs7830_data_set_multicast(net); 4968c2ecf20Sopenharmony_ci 4978c2ecf20Sopenharmony_ci ret = mcs7830_apply_base_config(dev); 4988c2ecf20Sopenharmony_ci if (ret) 4998c2ecf20Sopenharmony_ci goto out; 5008c2ecf20Sopenharmony_ci 5018c2ecf20Sopenharmony_ci net->ethtool_ops = &mcs7830_ethtool_ops; 5028c2ecf20Sopenharmony_ci net->netdev_ops = &mcs7830_netdev_ops; 5038c2ecf20Sopenharmony_ci 5048c2ecf20Sopenharmony_ci /* reserve space for the status byte on rx */ 5058c2ecf20Sopenharmony_ci dev->rx_urb_size = ETH_FRAME_LEN + 1; 5068c2ecf20Sopenharmony_ci 5078c2ecf20Sopenharmony_ci dev->mii.mdio_read = mcs7830_mdio_read; 5088c2ecf20Sopenharmony_ci dev->mii.mdio_write = mcs7830_mdio_write; 5098c2ecf20Sopenharmony_ci dev->mii.dev = net; 5108c2ecf20Sopenharmony_ci dev->mii.phy_id_mask = 0x3f; 5118c2ecf20Sopenharmony_ci dev->mii.reg_num_mask = 0x1f; 5128c2ecf20Sopenharmony_ci dev->mii.phy_id = *((u8 *) net->dev_addr + 1); 5138c2ecf20Sopenharmony_ci 5148c2ecf20Sopenharmony_ci ret = usbnet_get_endpoints(dev, udev); 5158c2ecf20Sopenharmony_ciout: 5168c2ecf20Sopenharmony_ci return ret; 5178c2ecf20Sopenharmony_ci} 5188c2ecf20Sopenharmony_ci 5198c2ecf20Sopenharmony_ci/* The chip always appends a status byte that we need to strip */ 5208c2ecf20Sopenharmony_cistatic int mcs7830_rx_fixup(struct usbnet *dev, struct sk_buff *skb) 5218c2ecf20Sopenharmony_ci{ 5228c2ecf20Sopenharmony_ci u8 status; 5238c2ecf20Sopenharmony_ci 5248c2ecf20Sopenharmony_ci /* This check is no longer done by usbnet */ 5258c2ecf20Sopenharmony_ci if (skb->len < dev->net->hard_header_len) { 5268c2ecf20Sopenharmony_ci dev_err(&dev->udev->dev, "unexpected tiny rx frame\n"); 5278c2ecf20Sopenharmony_ci return 0; 5288c2ecf20Sopenharmony_ci } 5298c2ecf20Sopenharmony_ci 5308c2ecf20Sopenharmony_ci skb_trim(skb, skb->len - 1); 5318c2ecf20Sopenharmony_ci status = skb->data[skb->len]; 5328c2ecf20Sopenharmony_ci 5338c2ecf20Sopenharmony_ci if (status != MCS7830_RX_FRAME_CORRECT) { 5348c2ecf20Sopenharmony_ci dev_dbg(&dev->udev->dev, "rx fixup status %x\n", status); 5358c2ecf20Sopenharmony_ci 5368c2ecf20Sopenharmony_ci /* hmm, perhaps usbnet.c already sees a globally visible 5378c2ecf20Sopenharmony_ci frame error and increments rx_errors on its own already? */ 5388c2ecf20Sopenharmony_ci dev->net->stats.rx_errors++; 5398c2ecf20Sopenharmony_ci 5408c2ecf20Sopenharmony_ci if (status & (MCS7830_RX_SHORT_FRAME 5418c2ecf20Sopenharmony_ci |MCS7830_RX_LENGTH_ERROR 5428c2ecf20Sopenharmony_ci |MCS7830_RX_LARGE_FRAME)) 5438c2ecf20Sopenharmony_ci dev->net->stats.rx_length_errors++; 5448c2ecf20Sopenharmony_ci if (status & MCS7830_RX_ALIGNMENT_ERROR) 5458c2ecf20Sopenharmony_ci dev->net->stats.rx_frame_errors++; 5468c2ecf20Sopenharmony_ci if (status & MCS7830_RX_CRC_ERROR) 5478c2ecf20Sopenharmony_ci dev->net->stats.rx_crc_errors++; 5488c2ecf20Sopenharmony_ci } 5498c2ecf20Sopenharmony_ci 5508c2ecf20Sopenharmony_ci return skb->len > 0; 5518c2ecf20Sopenharmony_ci} 5528c2ecf20Sopenharmony_ci 5538c2ecf20Sopenharmony_cistatic void mcs7830_status(struct usbnet *dev, struct urb *urb) 5548c2ecf20Sopenharmony_ci{ 5558c2ecf20Sopenharmony_ci u8 *buf = urb->transfer_buffer; 5568c2ecf20Sopenharmony_ci bool link, link_changed; 5578c2ecf20Sopenharmony_ci 5588c2ecf20Sopenharmony_ci if (urb->actual_length < 16) 5598c2ecf20Sopenharmony_ci return; 5608c2ecf20Sopenharmony_ci 5618c2ecf20Sopenharmony_ci link = !(buf[1] == 0x20); 5628c2ecf20Sopenharmony_ci link_changed = netif_carrier_ok(dev->net) != link; 5638c2ecf20Sopenharmony_ci if (link_changed) { 5648c2ecf20Sopenharmony_ci usbnet_link_change(dev, link, 0); 5658c2ecf20Sopenharmony_ci netdev_dbg(dev->net, "Link Status is: %d\n", link); 5668c2ecf20Sopenharmony_ci } 5678c2ecf20Sopenharmony_ci} 5688c2ecf20Sopenharmony_ci 5698c2ecf20Sopenharmony_cistatic const struct driver_info moschip_info = { 5708c2ecf20Sopenharmony_ci .description = "MOSCHIP 7830/7832/7730 usb-NET adapter", 5718c2ecf20Sopenharmony_ci .bind = mcs7830_bind, 5728c2ecf20Sopenharmony_ci .rx_fixup = mcs7830_rx_fixup, 5738c2ecf20Sopenharmony_ci .flags = FLAG_ETHER | FLAG_LINK_INTR, 5748c2ecf20Sopenharmony_ci .status = mcs7830_status, 5758c2ecf20Sopenharmony_ci .in = 1, 5768c2ecf20Sopenharmony_ci .out = 2, 5778c2ecf20Sopenharmony_ci}; 5788c2ecf20Sopenharmony_ci 5798c2ecf20Sopenharmony_cistatic const struct driver_info sitecom_info = { 5808c2ecf20Sopenharmony_ci .description = "Sitecom LN-30 usb-NET adapter", 5818c2ecf20Sopenharmony_ci .bind = mcs7830_bind, 5828c2ecf20Sopenharmony_ci .rx_fixup = mcs7830_rx_fixup, 5838c2ecf20Sopenharmony_ci .flags = FLAG_ETHER | FLAG_LINK_INTR, 5848c2ecf20Sopenharmony_ci .status = mcs7830_status, 5858c2ecf20Sopenharmony_ci .in = 1, 5868c2ecf20Sopenharmony_ci .out = 2, 5878c2ecf20Sopenharmony_ci}; 5888c2ecf20Sopenharmony_ci 5898c2ecf20Sopenharmony_cistatic const struct usb_device_id products[] = { 5908c2ecf20Sopenharmony_ci { 5918c2ecf20Sopenharmony_ci USB_DEVICE(MCS7830_VENDOR_ID, MCS7832_PRODUCT_ID), 5928c2ecf20Sopenharmony_ci .driver_info = (unsigned long) &moschip_info, 5938c2ecf20Sopenharmony_ci }, 5948c2ecf20Sopenharmony_ci { 5958c2ecf20Sopenharmony_ci USB_DEVICE(MCS7830_VENDOR_ID, MCS7830_PRODUCT_ID), 5968c2ecf20Sopenharmony_ci .driver_info = (unsigned long) &moschip_info, 5978c2ecf20Sopenharmony_ci }, 5988c2ecf20Sopenharmony_ci { 5998c2ecf20Sopenharmony_ci USB_DEVICE(MCS7830_VENDOR_ID, MCS7730_PRODUCT_ID), 6008c2ecf20Sopenharmony_ci .driver_info = (unsigned long) &moschip_info, 6018c2ecf20Sopenharmony_ci }, 6028c2ecf20Sopenharmony_ci { 6038c2ecf20Sopenharmony_ci USB_DEVICE(SITECOM_VENDOR_ID, LN_030_PRODUCT_ID), 6048c2ecf20Sopenharmony_ci .driver_info = (unsigned long) &sitecom_info, 6058c2ecf20Sopenharmony_ci }, 6068c2ecf20Sopenharmony_ci {}, 6078c2ecf20Sopenharmony_ci}; 6088c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(usb, products); 6098c2ecf20Sopenharmony_ci 6108c2ecf20Sopenharmony_cistatic int mcs7830_reset_resume (struct usb_interface *intf) 6118c2ecf20Sopenharmony_ci{ 6128c2ecf20Sopenharmony_ci /* YES, this function is successful enough that ethtool -d 6138c2ecf20Sopenharmony_ci does show same output pre-/post-suspend */ 6148c2ecf20Sopenharmony_ci 6158c2ecf20Sopenharmony_ci struct usbnet *dev = usb_get_intfdata(intf); 6168c2ecf20Sopenharmony_ci 6178c2ecf20Sopenharmony_ci mcs7830_apply_base_config(dev); 6188c2ecf20Sopenharmony_ci 6198c2ecf20Sopenharmony_ci usbnet_resume(intf); 6208c2ecf20Sopenharmony_ci 6218c2ecf20Sopenharmony_ci return 0; 6228c2ecf20Sopenharmony_ci} 6238c2ecf20Sopenharmony_ci 6248c2ecf20Sopenharmony_cistatic struct usb_driver mcs7830_driver = { 6258c2ecf20Sopenharmony_ci .name = driver_name, 6268c2ecf20Sopenharmony_ci .id_table = products, 6278c2ecf20Sopenharmony_ci .probe = usbnet_probe, 6288c2ecf20Sopenharmony_ci .disconnect = usbnet_disconnect, 6298c2ecf20Sopenharmony_ci .suspend = usbnet_suspend, 6308c2ecf20Sopenharmony_ci .resume = usbnet_resume, 6318c2ecf20Sopenharmony_ci .reset_resume = mcs7830_reset_resume, 6328c2ecf20Sopenharmony_ci .disable_hub_initiated_lpm = 1, 6338c2ecf20Sopenharmony_ci}; 6348c2ecf20Sopenharmony_ci 6358c2ecf20Sopenharmony_cimodule_usb_driver(mcs7830_driver); 6368c2ecf20Sopenharmony_ci 6378c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("USB to network adapter MCS7830)"); 6388c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL"); 639