asix_devices.c 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118
  1. /*
  2. * ASIX AX8817X based USB 2.0 Ethernet Devices
  3. * Copyright (C) 2003-2006 David Hollis <dhollis@davehollis.com>
  4. * Copyright (C) 2005 Phil Chang <pchang23@sbcglobal.net>
  5. * Copyright (C) 2006 James Painter <jamie.painter@iname.com>
  6. * Copyright (c) 2002-2003 TiVo Inc.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. */
  22. #include "asix.h"
  23. #define PHY_MODE_MARVELL 0x0000
  24. #define MII_MARVELL_LED_CTRL 0x0018
  25. #define MII_MARVELL_STATUS 0x001b
  26. #define MII_MARVELL_CTRL 0x0014
  27. #define MARVELL_LED_MANUAL 0x0019
  28. #define MARVELL_STATUS_HWCFG 0x0004
  29. #define MARVELL_CTRL_TXDELAY 0x0002
  30. #define MARVELL_CTRL_RXDELAY 0x0080
  31. #define PHY_MODE_RTL8211CL 0x000C
  32. struct ax88172_int_data {
  33. __le16 res1;
  34. u8 link;
  35. __le16 res2;
  36. u8 status;
  37. __le16 res3;
  38. } __packed;
  39. static void asix_status(struct usbnet *dev, struct urb *urb)
  40. {
  41. struct ax88172_int_data *event;
  42. int link;
  43. if (urb->actual_length < 8)
  44. return;
  45. event = urb->transfer_buffer;
  46. link = event->link & 0x01;
  47. if (netif_carrier_ok(dev->net) != link) {
  48. usbnet_link_change(dev, link, 1);
  49. netdev_dbg(dev->net, "Link Status is: %d\n", link);
  50. }
  51. }
  52. static void asix_set_netdev_dev_addr(struct usbnet *dev, u8 *addr)
  53. {
  54. if (is_valid_ether_addr(addr)) {
  55. memcpy(dev->net->dev_addr, addr, ETH_ALEN);
  56. } else {
  57. netdev_info(dev->net, "invalid hw address, using random\n");
  58. eth_hw_addr_random(dev->net);
  59. }
  60. }
  61. /* Get the PHY Identifier from the PHYSID1 & PHYSID2 MII registers */
  62. static u32 asix_get_phyid(struct usbnet *dev)
  63. {
  64. int phy_reg;
  65. u32 phy_id;
  66. int i;
  67. /* Poll for the rare case the FW or phy isn't ready yet. */
  68. for (i = 0; i < 100; i++) {
  69. phy_reg = asix_mdio_read(dev->net, dev->mii.phy_id, MII_PHYSID1);
  70. if (phy_reg != 0 && phy_reg != 0xFFFF)
  71. break;
  72. mdelay(1);
  73. }
  74. if (phy_reg <= 0 || phy_reg == 0xFFFF)
  75. return 0;
  76. phy_id = (phy_reg & 0xffff) << 16;
  77. phy_reg = asix_mdio_read(dev->net, dev->mii.phy_id, MII_PHYSID2);
  78. if (phy_reg < 0)
  79. return 0;
  80. phy_id |= (phy_reg & 0xffff);
  81. return phy_id;
  82. }
  83. static u32 asix_get_link(struct net_device *net)
  84. {
  85. struct usbnet *dev = netdev_priv(net);
  86. return mii_link_ok(&dev->mii);
  87. }
  88. static int asix_ioctl (struct net_device *net, struct ifreq *rq, int cmd)
  89. {
  90. struct usbnet *dev = netdev_priv(net);
  91. return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL);
  92. }
  93. /* We need to override some ethtool_ops so we require our
  94. own structure so we don't interfere with other usbnet
  95. devices that may be connected at the same time. */
  96. static const struct ethtool_ops ax88172_ethtool_ops = {
  97. .get_drvinfo = asix_get_drvinfo,
  98. .get_link = asix_get_link,
  99. .get_msglevel = usbnet_get_msglevel,
  100. .set_msglevel = usbnet_set_msglevel,
  101. .get_wol = asix_get_wol,
  102. .set_wol = asix_set_wol,
  103. .get_eeprom_len = asix_get_eeprom_len,
  104. .get_eeprom = asix_get_eeprom,
  105. .set_eeprom = asix_set_eeprom,
  106. .get_settings = usbnet_get_settings,
  107. .set_settings = usbnet_set_settings,
  108. .nway_reset = usbnet_nway_reset,
  109. };
  110. static void ax88172_set_multicast(struct net_device *net)
  111. {
  112. struct usbnet *dev = netdev_priv(net);
  113. struct asix_data *data = (struct asix_data *)&dev->data;
  114. u8 rx_ctl = 0x8c;
  115. if (net->flags & IFF_PROMISC) {
  116. rx_ctl |= 0x01;
  117. } else if (net->flags & IFF_ALLMULTI ||
  118. netdev_mc_count(net) > AX_MAX_MCAST) {
  119. rx_ctl |= 0x02;
  120. } else if (netdev_mc_empty(net)) {
  121. /* just broadcast and directed */
  122. } else {
  123. /* We use the 20 byte dev->data
  124. * for our 8 byte filter buffer
  125. * to avoid allocating memory that
  126. * is tricky to free later */
  127. struct netdev_hw_addr *ha;
  128. u32 crc_bits;
  129. memset(data->multi_filter, 0, AX_MCAST_FILTER_SIZE);
  130. /* Build the multicast hash filter. */
  131. netdev_for_each_mc_addr(ha, net) {
  132. crc_bits = ether_crc(ETH_ALEN, ha->addr) >> 26;
  133. data->multi_filter[crc_bits >> 3] |=
  134. 1 << (crc_bits & 7);
  135. }
  136. asix_write_cmd_async(dev, AX_CMD_WRITE_MULTI_FILTER, 0, 0,
  137. AX_MCAST_FILTER_SIZE, data->multi_filter);
  138. rx_ctl |= 0x10;
  139. }
  140. asix_write_cmd_async(dev, AX_CMD_WRITE_RX_CTL, rx_ctl, 0, 0, NULL);
  141. }
  142. static int ax88172_link_reset(struct usbnet *dev)
  143. {
  144. u8 mode;
  145. struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET };
  146. mii_check_media(&dev->mii, 1, 1);
  147. mii_ethtool_gset(&dev->mii, &ecmd);
  148. mode = AX88172_MEDIUM_DEFAULT;
  149. if (ecmd.duplex != DUPLEX_FULL)
  150. mode |= ~AX88172_MEDIUM_FD;
  151. netdev_dbg(dev->net, "ax88172_link_reset() speed: %u duplex: %d setting mode to 0x%04x\n",
  152. ethtool_cmd_speed(&ecmd), ecmd.duplex, mode);
  153. asix_write_medium_mode(dev, mode);
  154. return 0;
  155. }
  156. static const struct net_device_ops ax88172_netdev_ops = {
  157. .ndo_open = usbnet_open,
  158. .ndo_stop = usbnet_stop,
  159. .ndo_start_xmit = usbnet_start_xmit,
  160. .ndo_tx_timeout = usbnet_tx_timeout,
  161. .ndo_change_mtu = usbnet_change_mtu,
  162. .ndo_set_mac_address = eth_mac_addr,
  163. .ndo_validate_addr = eth_validate_addr,
  164. .ndo_do_ioctl = asix_ioctl,
  165. .ndo_set_rx_mode = ax88172_set_multicast,
  166. };
  167. static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf)
  168. {
  169. int ret = 0;
  170. u8 buf[ETH_ALEN];
  171. int i;
  172. unsigned long gpio_bits = dev->driver_info->data;
  173. usbnet_get_endpoints(dev,intf);
  174. /* Toggle the GPIOs in a manufacturer/model specific way */
  175. for (i = 2; i >= 0; i--) {
  176. ret = asix_write_cmd(dev, AX_CMD_WRITE_GPIOS,
  177. (gpio_bits >> (i * 8)) & 0xff, 0, 0, NULL);
  178. if (ret < 0)
  179. goto out;
  180. msleep(5);
  181. }
  182. ret = asix_write_rx_ctl(dev, 0x80);
  183. if (ret < 0)
  184. goto out;
  185. /* Get the MAC address */
  186. ret = asix_read_cmd(dev, AX88172_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf);
  187. if (ret < 0) {
  188. netdev_dbg(dev->net, "read AX_CMD_READ_NODE_ID failed: %d\n",
  189. ret);
  190. goto out;
  191. }
  192. asix_set_netdev_dev_addr(dev, buf);
  193. /* Initialize MII structure */
  194. dev->mii.dev = dev->net;
  195. dev->mii.mdio_read = asix_mdio_read;
  196. dev->mii.mdio_write = asix_mdio_write;
  197. dev->mii.phy_id_mask = 0x3f;
  198. dev->mii.reg_num_mask = 0x1f;
  199. dev->mii.phy_id = asix_get_phy_addr(dev);
  200. dev->net->netdev_ops = &ax88172_netdev_ops;
  201. dev->net->ethtool_ops = &ax88172_ethtool_ops;
  202. dev->net->needed_headroom = 4; /* cf asix_tx_fixup() */
  203. dev->net->needed_tailroom = 4; /* cf asix_tx_fixup() */
  204. asix_mdio_write(dev->net, dev->mii.phy_id, MII_BMCR, BMCR_RESET);
  205. asix_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE,
  206. ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP);
  207. mii_nway_restart(&dev->mii);
  208. return 0;
  209. out:
  210. return ret;
  211. }
  212. static const struct ethtool_ops ax88772_ethtool_ops = {
  213. .get_drvinfo = asix_get_drvinfo,
  214. .get_link = asix_get_link,
  215. .get_msglevel = usbnet_get_msglevel,
  216. .set_msglevel = usbnet_set_msglevel,
  217. .get_wol = asix_get_wol,
  218. .set_wol = asix_set_wol,
  219. .get_eeprom_len = asix_get_eeprom_len,
  220. .get_eeprom = asix_get_eeprom,
  221. .set_eeprom = asix_set_eeprom,
  222. .get_settings = usbnet_get_settings,
  223. .set_settings = usbnet_set_settings,
  224. .nway_reset = usbnet_nway_reset,
  225. };
  226. static int ax88772_link_reset(struct usbnet *dev)
  227. {
  228. u16 mode;
  229. struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET };
  230. mii_check_media(&dev->mii, 1, 1);
  231. mii_ethtool_gset(&dev->mii, &ecmd);
  232. mode = AX88772_MEDIUM_DEFAULT;
  233. if (ethtool_cmd_speed(&ecmd) != SPEED_100)
  234. mode &= ~AX_MEDIUM_PS;
  235. if (ecmd.duplex != DUPLEX_FULL)
  236. mode &= ~AX_MEDIUM_FD;
  237. netdev_dbg(dev->net, "ax88772_link_reset() speed: %u duplex: %d setting mode to 0x%04x\n",
  238. ethtool_cmd_speed(&ecmd), ecmd.duplex, mode);
  239. asix_write_medium_mode(dev, mode);
  240. return 0;
  241. }
  242. static int ax88772_reset(struct usbnet *dev)
  243. {
  244. struct asix_data *data = (struct asix_data *)&dev->data;
  245. int ret, embd_phy;
  246. u16 rx_ctl;
  247. ret = asix_write_gpio(dev,
  248. AX_GPIO_RSE | AX_GPIO_GPO_2 | AX_GPIO_GPO2EN, 5);
  249. if (ret < 0)
  250. goto out;
  251. embd_phy = ((asix_get_phy_addr(dev) & 0x1f) == 0x10 ? 1 : 0);
  252. ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, embd_phy, 0, 0, NULL);
  253. if (ret < 0) {
  254. netdev_dbg(dev->net, "Select PHY #1 failed: %d\n", ret);
  255. goto out;
  256. }
  257. ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL);
  258. if (ret < 0)
  259. goto out;
  260. msleep(150);
  261. ret = asix_sw_reset(dev, AX_SWRESET_CLEAR);
  262. if (ret < 0)
  263. goto out;
  264. msleep(150);
  265. if (embd_phy) {
  266. ret = asix_sw_reset(dev, AX_SWRESET_IPRL);
  267. if (ret < 0)
  268. goto out;
  269. } else {
  270. ret = asix_sw_reset(dev, AX_SWRESET_PRTE);
  271. if (ret < 0)
  272. goto out;
  273. }
  274. msleep(150);
  275. rx_ctl = asix_read_rx_ctl(dev);
  276. netdev_dbg(dev->net, "RX_CTL is 0x%04x after software reset\n", rx_ctl);
  277. ret = asix_write_rx_ctl(dev, 0x0000);
  278. if (ret < 0)
  279. goto out;
  280. rx_ctl = asix_read_rx_ctl(dev);
  281. netdev_dbg(dev->net, "RX_CTL is 0x%04x setting to 0x0000\n", rx_ctl);
  282. ret = asix_sw_reset(dev, AX_SWRESET_PRL);
  283. if (ret < 0)
  284. goto out;
  285. msleep(150);
  286. ret = asix_sw_reset(dev, AX_SWRESET_IPRL | AX_SWRESET_PRL);
  287. if (ret < 0)
  288. goto out;
  289. msleep(150);
  290. asix_mdio_write(dev->net, dev->mii.phy_id, MII_BMCR, BMCR_RESET);
  291. asix_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE,
  292. ADVERTISE_ALL | ADVERTISE_CSMA);
  293. mii_nway_restart(&dev->mii);
  294. ret = asix_write_medium_mode(dev, AX88772_MEDIUM_DEFAULT);
  295. if (ret < 0)
  296. goto out;
  297. ret = asix_write_cmd(dev, AX_CMD_WRITE_IPG0,
  298. AX88772_IPG0_DEFAULT | AX88772_IPG1_DEFAULT,
  299. AX88772_IPG2_DEFAULT, 0, NULL);
  300. if (ret < 0) {
  301. netdev_dbg(dev->net, "Write IPG,IPG1,IPG2 failed: %d\n", ret);
  302. goto out;
  303. }
  304. /* Rewrite MAC address */
  305. memcpy(data->mac_addr, dev->net->dev_addr, ETH_ALEN);
  306. ret = asix_write_cmd(dev, AX_CMD_WRITE_NODE_ID, 0, 0, ETH_ALEN,
  307. data->mac_addr);
  308. if (ret < 0)
  309. goto out;
  310. /* Set RX_CTL to default values with 2k buffer, and enable cactus */
  311. ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL);
  312. if (ret < 0)
  313. goto out;
  314. rx_ctl = asix_read_rx_ctl(dev);
  315. netdev_dbg(dev->net, "RX_CTL is 0x%04x after all initializations\n",
  316. rx_ctl);
  317. rx_ctl = asix_read_medium_status(dev);
  318. netdev_dbg(dev->net,
  319. "Medium Status is 0x%04x after all initializations\n",
  320. rx_ctl);
  321. return 0;
  322. out:
  323. return ret;
  324. }
  325. static const struct net_device_ops ax88772_netdev_ops = {
  326. .ndo_open = usbnet_open,
  327. .ndo_stop = usbnet_stop,
  328. .ndo_start_xmit = usbnet_start_xmit,
  329. .ndo_tx_timeout = usbnet_tx_timeout,
  330. .ndo_change_mtu = usbnet_change_mtu,
  331. .ndo_set_mac_address = asix_set_mac_address,
  332. .ndo_validate_addr = eth_validate_addr,
  333. .ndo_do_ioctl = asix_ioctl,
  334. .ndo_set_rx_mode = asix_set_multicast,
  335. };
  336. static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
  337. {
  338. int ret, embd_phy, i;
  339. u8 buf[ETH_ALEN];
  340. u32 phyid;
  341. usbnet_get_endpoints(dev,intf);
  342. /* Get the MAC address */
  343. if (dev->driver_info->data & FLAG_EEPROM_MAC) {
  344. for (i = 0; i < (ETH_ALEN >> 1); i++) {
  345. ret = asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x04 + i,
  346. 0, 2, buf + i * 2);
  347. if (ret < 0)
  348. break;
  349. }
  350. } else {
  351. ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID,
  352. 0, 0, ETH_ALEN, buf);
  353. }
  354. if (ret < 0) {
  355. netdev_dbg(dev->net, "Failed to read MAC address: %d\n", ret);
  356. return ret;
  357. }
  358. asix_set_netdev_dev_addr(dev, buf);
  359. /* Initialize MII structure */
  360. dev->mii.dev = dev->net;
  361. dev->mii.mdio_read = asix_mdio_read;
  362. dev->mii.mdio_write = asix_mdio_write;
  363. dev->mii.phy_id_mask = 0x1f;
  364. dev->mii.reg_num_mask = 0x1f;
  365. dev->mii.phy_id = asix_get_phy_addr(dev);
  366. dev->net->netdev_ops = &ax88772_netdev_ops;
  367. dev->net->ethtool_ops = &ax88772_ethtool_ops;
  368. dev->net->needed_headroom = 4; /* cf asix_tx_fixup() */
  369. dev->net->needed_tailroom = 4; /* cf asix_tx_fixup() */
  370. embd_phy = ((dev->mii.phy_id & 0x1f) == 0x10 ? 1 : 0);
  371. /* Reset the PHY to normal operation mode */
  372. ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, embd_phy, 0, 0, NULL);
  373. if (ret < 0) {
  374. netdev_dbg(dev->net, "Select PHY #1 failed: %d\n", ret);
  375. return ret;
  376. }
  377. ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL);
  378. if (ret < 0)
  379. return ret;
  380. msleep(150);
  381. ret = asix_sw_reset(dev, AX_SWRESET_CLEAR);
  382. if (ret < 0)
  383. return ret;
  384. msleep(150);
  385. ret = asix_sw_reset(dev, embd_phy ? AX_SWRESET_IPRL : AX_SWRESET_PRTE);
  386. /* Read PHYID register *AFTER* the PHY was reset properly */
  387. phyid = asix_get_phyid(dev);
  388. netdev_dbg(dev->net, "PHYID=0x%08x\n", phyid);
  389. /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */
  390. if (dev->driver_info->flags & FLAG_FRAMING_AX) {
  391. /* hard_mtu is still the default - the device does not support
  392. jumbo eth frames */
  393. dev->rx_urb_size = 2048;
  394. }
  395. dev->driver_priv = kzalloc(sizeof(struct asix_common_private), GFP_KERNEL);
  396. if (!dev->driver_priv)
  397. return -ENOMEM;
  398. return 0;
  399. }
  400. static void ax88772_unbind(struct usbnet *dev, struct usb_interface *intf)
  401. {
  402. if (dev->driver_priv)
  403. kfree(dev->driver_priv);
  404. }
  405. static const struct ethtool_ops ax88178_ethtool_ops = {
  406. .get_drvinfo = asix_get_drvinfo,
  407. .get_link = asix_get_link,
  408. .get_msglevel = usbnet_get_msglevel,
  409. .set_msglevel = usbnet_set_msglevel,
  410. .get_wol = asix_get_wol,
  411. .set_wol = asix_set_wol,
  412. .get_eeprom_len = asix_get_eeprom_len,
  413. .get_eeprom = asix_get_eeprom,
  414. .set_eeprom = asix_set_eeprom,
  415. .get_settings = usbnet_get_settings,
  416. .set_settings = usbnet_set_settings,
  417. .nway_reset = usbnet_nway_reset,
  418. };
  419. static int marvell_phy_init(struct usbnet *dev)
  420. {
  421. struct asix_data *data = (struct asix_data *)&dev->data;
  422. u16 reg;
  423. netdev_dbg(dev->net, "marvell_phy_init()\n");
  424. reg = asix_mdio_read(dev->net, dev->mii.phy_id, MII_MARVELL_STATUS);
  425. netdev_dbg(dev->net, "MII_MARVELL_STATUS = 0x%04x\n", reg);
  426. asix_mdio_write(dev->net, dev->mii.phy_id, MII_MARVELL_CTRL,
  427. MARVELL_CTRL_RXDELAY | MARVELL_CTRL_TXDELAY);
  428. if (data->ledmode) {
  429. reg = asix_mdio_read(dev->net, dev->mii.phy_id,
  430. MII_MARVELL_LED_CTRL);
  431. netdev_dbg(dev->net, "MII_MARVELL_LED_CTRL (1) = 0x%04x\n", reg);
  432. reg &= 0xf8ff;
  433. reg |= (1 + 0x0100);
  434. asix_mdio_write(dev->net, dev->mii.phy_id,
  435. MII_MARVELL_LED_CTRL, reg);
  436. reg = asix_mdio_read(dev->net, dev->mii.phy_id,
  437. MII_MARVELL_LED_CTRL);
  438. netdev_dbg(dev->net, "MII_MARVELL_LED_CTRL (2) = 0x%04x\n", reg);
  439. reg &= 0xfc0f;
  440. }
  441. return 0;
  442. }
  443. static int rtl8211cl_phy_init(struct usbnet *dev)
  444. {
  445. struct asix_data *data = (struct asix_data *)&dev->data;
  446. netdev_dbg(dev->net, "rtl8211cl_phy_init()\n");
  447. asix_mdio_write (dev->net, dev->mii.phy_id, 0x1f, 0x0005);
  448. asix_mdio_write (dev->net, dev->mii.phy_id, 0x0c, 0);
  449. asix_mdio_write (dev->net, dev->mii.phy_id, 0x01,
  450. asix_mdio_read (dev->net, dev->mii.phy_id, 0x01) | 0x0080);
  451. asix_mdio_write (dev->net, dev->mii.phy_id, 0x1f, 0);
  452. if (data->ledmode == 12) {
  453. asix_mdio_write (dev->net, dev->mii.phy_id, 0x1f, 0x0002);
  454. asix_mdio_write (dev->net, dev->mii.phy_id, 0x1a, 0x00cb);
  455. asix_mdio_write (dev->net, dev->mii.phy_id, 0x1f, 0);
  456. }
  457. return 0;
  458. }
  459. static int marvell_led_status(struct usbnet *dev, u16 speed)
  460. {
  461. u16 reg = asix_mdio_read(dev->net, dev->mii.phy_id, MARVELL_LED_MANUAL);
  462. netdev_dbg(dev->net, "marvell_led_status() read 0x%04x\n", reg);
  463. /* Clear out the center LED bits - 0x03F0 */
  464. reg &= 0xfc0f;
  465. switch (speed) {
  466. case SPEED_1000:
  467. reg |= 0x03e0;
  468. break;
  469. case SPEED_100:
  470. reg |= 0x03b0;
  471. break;
  472. default:
  473. reg |= 0x02f0;
  474. }
  475. netdev_dbg(dev->net, "marvell_led_status() writing 0x%04x\n", reg);
  476. asix_mdio_write(dev->net, dev->mii.phy_id, MARVELL_LED_MANUAL, reg);
  477. return 0;
  478. }
  479. static int ax88178_reset(struct usbnet *dev)
  480. {
  481. struct asix_data *data = (struct asix_data *)&dev->data;
  482. int ret;
  483. __le16 eeprom;
  484. u8 status;
  485. int gpio0 = 0;
  486. u32 phyid;
  487. asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status);
  488. netdev_dbg(dev->net, "GPIO Status: 0x%04x\n", status);
  489. asix_write_cmd(dev, AX_CMD_WRITE_ENABLE, 0, 0, 0, NULL);
  490. asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x0017, 0, 2, &eeprom);
  491. asix_write_cmd(dev, AX_CMD_WRITE_DISABLE, 0, 0, 0, NULL);
  492. netdev_dbg(dev->net, "EEPROM index 0x17 is 0x%04x\n", eeprom);
  493. if (eeprom == cpu_to_le16(0xffff)) {
  494. data->phymode = PHY_MODE_MARVELL;
  495. data->ledmode = 0;
  496. gpio0 = 1;
  497. } else {
  498. data->phymode = le16_to_cpu(eeprom) & 0x7F;
  499. data->ledmode = le16_to_cpu(eeprom) >> 8;
  500. gpio0 = (le16_to_cpu(eeprom) & 0x80) ? 0 : 1;
  501. }
  502. netdev_dbg(dev->net, "GPIO0: %d, PhyMode: %d\n", gpio0, data->phymode);
  503. /* Power up external GigaPHY through AX88178 GPIO pin */
  504. asix_write_gpio(dev, AX_GPIO_RSE | AX_GPIO_GPO_1 | AX_GPIO_GPO1EN, 40);
  505. if ((le16_to_cpu(eeprom) >> 8) != 1) {
  506. asix_write_gpio(dev, 0x003c, 30);
  507. asix_write_gpio(dev, 0x001c, 300);
  508. asix_write_gpio(dev, 0x003c, 30);
  509. } else {
  510. netdev_dbg(dev->net, "gpio phymode == 1 path\n");
  511. asix_write_gpio(dev, AX_GPIO_GPO1EN, 30);
  512. asix_write_gpio(dev, AX_GPIO_GPO1EN | AX_GPIO_GPO_1, 30);
  513. }
  514. /* Read PHYID register *AFTER* powering up PHY */
  515. phyid = asix_get_phyid(dev);
  516. netdev_dbg(dev->net, "PHYID=0x%08x\n", phyid);
  517. /* Set AX88178 to enable MII/GMII/RGMII interface for external PHY */
  518. asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, 0, 0, 0, NULL);
  519. asix_sw_reset(dev, 0);
  520. msleep(150);
  521. asix_sw_reset(dev, AX_SWRESET_PRL | AX_SWRESET_IPPD);
  522. msleep(150);
  523. asix_write_rx_ctl(dev, 0);
  524. if (data->phymode == PHY_MODE_MARVELL) {
  525. marvell_phy_init(dev);
  526. msleep(60);
  527. } else if (data->phymode == PHY_MODE_RTL8211CL)
  528. rtl8211cl_phy_init(dev);
  529. asix_mdio_write(dev->net, dev->mii.phy_id, MII_BMCR,
  530. BMCR_RESET | BMCR_ANENABLE);
  531. asix_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE,
  532. ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP);
  533. asix_mdio_write(dev->net, dev->mii.phy_id, MII_CTRL1000,
  534. ADVERTISE_1000FULL);
  535. mii_nway_restart(&dev->mii);
  536. ret = asix_write_medium_mode(dev, AX88178_MEDIUM_DEFAULT);
  537. if (ret < 0)
  538. return ret;
  539. /* Rewrite MAC address */
  540. memcpy(data->mac_addr, dev->net->dev_addr, ETH_ALEN);
  541. ret = asix_write_cmd(dev, AX_CMD_WRITE_NODE_ID, 0, 0, ETH_ALEN,
  542. data->mac_addr);
  543. if (ret < 0)
  544. return ret;
  545. ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL);
  546. if (ret < 0)
  547. return ret;
  548. return 0;
  549. }
  550. static int ax88178_link_reset(struct usbnet *dev)
  551. {
  552. u16 mode;
  553. struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET };
  554. struct asix_data *data = (struct asix_data *)&dev->data;
  555. u32 speed;
  556. netdev_dbg(dev->net, "ax88178_link_reset()\n");
  557. mii_check_media(&dev->mii, 1, 1);
  558. mii_ethtool_gset(&dev->mii, &ecmd);
  559. mode = AX88178_MEDIUM_DEFAULT;
  560. speed = ethtool_cmd_speed(&ecmd);
  561. if (speed == SPEED_1000)
  562. mode |= AX_MEDIUM_GM;
  563. else if (speed == SPEED_100)
  564. mode |= AX_MEDIUM_PS;
  565. else
  566. mode &= ~(AX_MEDIUM_PS | AX_MEDIUM_GM);
  567. mode |= AX_MEDIUM_ENCK;
  568. if (ecmd.duplex == DUPLEX_FULL)
  569. mode |= AX_MEDIUM_FD;
  570. else
  571. mode &= ~AX_MEDIUM_FD;
  572. netdev_dbg(dev->net, "ax88178_link_reset() speed: %u duplex: %d setting mode to 0x%04x\n",
  573. speed, ecmd.duplex, mode);
  574. asix_write_medium_mode(dev, mode);
  575. if (data->phymode == PHY_MODE_MARVELL && data->ledmode)
  576. marvell_led_status(dev, speed);
  577. return 0;
  578. }
  579. static void ax88178_set_mfb(struct usbnet *dev)
  580. {
  581. u16 mfb = AX_RX_CTL_MFB_16384;
  582. u16 rxctl;
  583. u16 medium;
  584. int old_rx_urb_size = dev->rx_urb_size;
  585. if (dev->hard_mtu < 2048) {
  586. dev->rx_urb_size = 2048;
  587. mfb = AX_RX_CTL_MFB_2048;
  588. } else if (dev->hard_mtu < 4096) {
  589. dev->rx_urb_size = 4096;
  590. mfb = AX_RX_CTL_MFB_4096;
  591. } else if (dev->hard_mtu < 8192) {
  592. dev->rx_urb_size = 8192;
  593. mfb = AX_RX_CTL_MFB_8192;
  594. } else if (dev->hard_mtu < 16384) {
  595. dev->rx_urb_size = 16384;
  596. mfb = AX_RX_CTL_MFB_16384;
  597. }
  598. rxctl = asix_read_rx_ctl(dev);
  599. asix_write_rx_ctl(dev, (rxctl & ~AX_RX_CTL_MFB_16384) | mfb);
  600. medium = asix_read_medium_status(dev);
  601. if (dev->net->mtu > 1500)
  602. medium |= AX_MEDIUM_JFE;
  603. else
  604. medium &= ~AX_MEDIUM_JFE;
  605. asix_write_medium_mode(dev, medium);
  606. if (dev->rx_urb_size > old_rx_urb_size)
  607. usbnet_unlink_rx_urbs(dev);
  608. }
  609. static int ax88178_change_mtu(struct net_device *net, int new_mtu)
  610. {
  611. struct usbnet *dev = netdev_priv(net);
  612. int ll_mtu = new_mtu + net->hard_header_len + 4;
  613. netdev_dbg(dev->net, "ax88178_change_mtu() new_mtu=%d\n", new_mtu);
  614. if (new_mtu <= 0 || ll_mtu > 16384)
  615. return -EINVAL;
  616. if ((ll_mtu % dev->maxpacket) == 0)
  617. return -EDOM;
  618. net->mtu = new_mtu;
  619. dev->hard_mtu = net->mtu + net->hard_header_len;
  620. ax88178_set_mfb(dev);
  621. /* max qlen depend on hard_mtu and rx_urb_size */
  622. usbnet_update_max_qlen(dev);
  623. return 0;
  624. }
  625. static const struct net_device_ops ax88178_netdev_ops = {
  626. .ndo_open = usbnet_open,
  627. .ndo_stop = usbnet_stop,
  628. .ndo_start_xmit = usbnet_start_xmit,
  629. .ndo_tx_timeout = usbnet_tx_timeout,
  630. .ndo_set_mac_address = asix_set_mac_address,
  631. .ndo_validate_addr = eth_validate_addr,
  632. .ndo_set_rx_mode = asix_set_multicast,
  633. .ndo_do_ioctl = asix_ioctl,
  634. .ndo_change_mtu = ax88178_change_mtu,
  635. };
  636. static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
  637. {
  638. int ret;
  639. u8 buf[ETH_ALEN];
  640. usbnet_get_endpoints(dev,intf);
  641. /* Get the MAC address */
  642. ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf);
  643. if (ret < 0) {
  644. netdev_dbg(dev->net, "Failed to read MAC address: %d\n", ret);
  645. return ret;
  646. }
  647. asix_set_netdev_dev_addr(dev, buf);
  648. /* Initialize MII structure */
  649. dev->mii.dev = dev->net;
  650. dev->mii.mdio_read = asix_mdio_read;
  651. dev->mii.mdio_write = asix_mdio_write;
  652. dev->mii.phy_id_mask = 0x1f;
  653. dev->mii.reg_num_mask = 0xff;
  654. dev->mii.supports_gmii = 1;
  655. dev->mii.phy_id = asix_get_phy_addr(dev);
  656. dev->net->netdev_ops = &ax88178_netdev_ops;
  657. dev->net->ethtool_ops = &ax88178_ethtool_ops;
  658. /* Blink LEDS so users know driver saw dongle */
  659. asix_sw_reset(dev, 0);
  660. msleep(150);
  661. asix_sw_reset(dev, AX_SWRESET_PRL | AX_SWRESET_IPPD);
  662. msleep(150);
  663. /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */
  664. if (dev->driver_info->flags & FLAG_FRAMING_AX) {
  665. /* hard_mtu is still the default - the device does not support
  666. jumbo eth frames */
  667. dev->rx_urb_size = 2048;
  668. }
  669. dev->driver_priv = kzalloc(sizeof(struct asix_common_private), GFP_KERNEL);
  670. if (!dev->driver_priv)
  671. return -ENOMEM;
  672. return 0;
  673. }
  674. static const struct driver_info ax8817x_info = {
  675. .description = "ASIX AX8817x USB 2.0 Ethernet",
  676. .bind = ax88172_bind,
  677. .status = asix_status,
  678. .link_reset = ax88172_link_reset,
  679. .reset = ax88172_link_reset,
  680. .flags = FLAG_ETHER | FLAG_LINK_INTR,
  681. .data = 0x00130103,
  682. };
  683. static const struct driver_info dlink_dub_e100_info = {
  684. .description = "DLink DUB-E100 USB Ethernet",
  685. .bind = ax88172_bind,
  686. .status = asix_status,
  687. .link_reset = ax88172_link_reset,
  688. .reset = ax88172_link_reset,
  689. .flags = FLAG_ETHER | FLAG_LINK_INTR,
  690. .data = 0x009f9d9f,
  691. };
  692. static const struct driver_info netgear_fa120_info = {
  693. .description = "Netgear FA-120 USB Ethernet",
  694. .bind = ax88172_bind,
  695. .status = asix_status,
  696. .link_reset = ax88172_link_reset,
  697. .reset = ax88172_link_reset,
  698. .flags = FLAG_ETHER | FLAG_LINK_INTR,
  699. .data = 0x00130103,
  700. };
  701. static const struct driver_info hawking_uf200_info = {
  702. .description = "Hawking UF200 USB Ethernet",
  703. .bind = ax88172_bind,
  704. .status = asix_status,
  705. .link_reset = ax88172_link_reset,
  706. .reset = ax88172_link_reset,
  707. .flags = FLAG_ETHER | FLAG_LINK_INTR,
  708. .data = 0x001f1d1f,
  709. };
  710. static const struct driver_info ax88772_info = {
  711. .description = "ASIX AX88772 USB 2.0 Ethernet",
  712. .bind = ax88772_bind,
  713. .unbind = ax88772_unbind,
  714. .status = asix_status,
  715. .link_reset = ax88772_link_reset,
  716. .reset = ax88772_reset,
  717. .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_LINK_INTR | FLAG_MULTI_PACKET,
  718. .rx_fixup = asix_rx_fixup_common,
  719. .tx_fixup = asix_tx_fixup,
  720. };
  721. static const struct driver_info ax88772b_info = {
  722. .description = "ASIX AX88772B USB 2.0 Ethernet",
  723. .bind = ax88772_bind,
  724. .unbind = ax88772_unbind,
  725. .status = asix_status,
  726. .link_reset = ax88772_link_reset,
  727. .reset = ax88772_reset,
  728. .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_LINK_INTR |
  729. FLAG_MULTI_PACKET,
  730. .rx_fixup = asix_rx_fixup_common,
  731. .tx_fixup = asix_tx_fixup,
  732. .data = FLAG_EEPROM_MAC,
  733. };
  734. static const struct driver_info ax88178_info = {
  735. .description = "ASIX AX88178 USB 2.0 Ethernet",
  736. .bind = ax88178_bind,
  737. .unbind = ax88772_unbind,
  738. .status = asix_status,
  739. .link_reset = ax88178_link_reset,
  740. .reset = ax88178_reset,
  741. .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_LINK_INTR,
  742. .rx_fixup = asix_rx_fixup_common,
  743. .tx_fixup = asix_tx_fixup,
  744. };
  745. /*
  746. * USBLINK 20F9 "USB 2.0 LAN" USB ethernet adapter, typically found in
  747. * no-name packaging.
  748. * USB device strings are:
  749. * 1: Manufacturer: USBLINK
  750. * 2: Product: HG20F9 USB2.0
  751. * 3: Serial: 000003
  752. * Appears to be compatible with Asix 88772B.
  753. */
  754. static const struct driver_info hg20f9_info = {
  755. .description = "HG20F9 USB 2.0 Ethernet",
  756. .bind = ax88772_bind,
  757. .unbind = ax88772_unbind,
  758. .status = asix_status,
  759. .link_reset = ax88772_link_reset,
  760. .reset = ax88772_reset,
  761. .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_LINK_INTR |
  762. FLAG_MULTI_PACKET,
  763. .rx_fixup = asix_rx_fixup_common,
  764. .tx_fixup = asix_tx_fixup,
  765. .data = FLAG_EEPROM_MAC,
  766. };
  767. extern const struct driver_info ax88172a_info;
  768. static const struct usb_device_id products [] = {
  769. {
  770. // Linksys USB200M
  771. USB_DEVICE (0x077b, 0x2226),
  772. .driver_info = (unsigned long) &ax8817x_info,
  773. }, {
  774. // Netgear FA120
  775. USB_DEVICE (0x0846, 0x1040),
  776. .driver_info = (unsigned long) &netgear_fa120_info,
  777. }, {
  778. // DLink DUB-E100
  779. USB_DEVICE (0x2001, 0x1a00),
  780. .driver_info = (unsigned long) &dlink_dub_e100_info,
  781. }, {
  782. // Intellinet, ST Lab USB Ethernet
  783. USB_DEVICE (0x0b95, 0x1720),
  784. .driver_info = (unsigned long) &ax8817x_info,
  785. }, {
  786. // Hawking UF200, TrendNet TU2-ET100
  787. USB_DEVICE (0x07b8, 0x420a),
  788. .driver_info = (unsigned long) &hawking_uf200_info,
  789. }, {
  790. // Billionton Systems, USB2AR
  791. USB_DEVICE (0x08dd, 0x90ff),
  792. .driver_info = (unsigned long) &ax8817x_info,
  793. }, {
  794. // ATEN UC210T
  795. USB_DEVICE (0x0557, 0x2009),
  796. .driver_info = (unsigned long) &ax8817x_info,
  797. }, {
  798. // Buffalo LUA-U2-KTX
  799. USB_DEVICE (0x0411, 0x003d),
  800. .driver_info = (unsigned long) &ax8817x_info,
  801. }, {
  802. // Buffalo LUA-U2-GT 10/100/1000
  803. USB_DEVICE (0x0411, 0x006e),
  804. .driver_info = (unsigned long) &ax88178_info,
  805. }, {
  806. // Sitecom LN-029 "USB 2.0 10/100 Ethernet adapter"
  807. USB_DEVICE (0x6189, 0x182d),
  808. .driver_info = (unsigned long) &ax8817x_info,
  809. }, {
  810. // Sitecom LN-031 "USB 2.0 10/100/1000 Ethernet adapter"
  811. USB_DEVICE (0x0df6, 0x0056),
  812. .driver_info = (unsigned long) &ax88178_info,
  813. }, {
  814. // corega FEther USB2-TX
  815. USB_DEVICE (0x07aa, 0x0017),
  816. .driver_info = (unsigned long) &ax8817x_info,
  817. }, {
  818. // Surecom EP-1427X-2
  819. USB_DEVICE (0x1189, 0x0893),
  820. .driver_info = (unsigned long) &ax8817x_info,
  821. }, {
  822. // goodway corp usb gwusb2e
  823. USB_DEVICE (0x1631, 0x6200),
  824. .driver_info = (unsigned long) &ax8817x_info,
  825. }, {
  826. // JVC MP-PRX1 Port Replicator
  827. USB_DEVICE (0x04f1, 0x3008),
  828. .driver_info = (unsigned long) &ax8817x_info,
  829. }, {
  830. // Lenovo U2L100P 10/100
  831. USB_DEVICE (0x17ef, 0x7203),
  832. .driver_info = (unsigned long) &ax88772_info,
  833. }, {
  834. // ASIX AX88772B 10/100
  835. USB_DEVICE (0x0b95, 0x772b),
  836. .driver_info = (unsigned long) &ax88772b_info,
  837. }, {
  838. // ASIX AX88772 10/100
  839. USB_DEVICE (0x0b95, 0x7720),
  840. .driver_info = (unsigned long) &ax88772_info,
  841. }, {
  842. // ASIX AX88178 10/100/1000
  843. USB_DEVICE (0x0b95, 0x1780),
  844. .driver_info = (unsigned long) &ax88178_info,
  845. }, {
  846. // Logitec LAN-GTJ/U2A
  847. USB_DEVICE (0x0789, 0x0160),
  848. .driver_info = (unsigned long) &ax88178_info,
  849. }, {
  850. // Linksys USB200M Rev 2
  851. USB_DEVICE (0x13b1, 0x0018),
  852. .driver_info = (unsigned long) &ax88772_info,
  853. }, {
  854. // 0Q0 cable ethernet
  855. USB_DEVICE (0x1557, 0x7720),
  856. .driver_info = (unsigned long) &ax88772_info,
  857. }, {
  858. // DLink DUB-E100 H/W Ver B1
  859. USB_DEVICE (0x07d1, 0x3c05),
  860. .driver_info = (unsigned long) &ax88772_info,
  861. }, {
  862. // DLink DUB-E100 H/W Ver B1 Alternate
  863. USB_DEVICE (0x2001, 0x3c05),
  864. .driver_info = (unsigned long) &ax88772_info,
  865. }, {
  866. // DLink DUB-E100 H/W Ver C1
  867. USB_DEVICE (0x2001, 0x1a02),
  868. .driver_info = (unsigned long) &ax88772_info,
  869. }, {
  870. // Linksys USB1000
  871. USB_DEVICE (0x1737, 0x0039),
  872. .driver_info = (unsigned long) &ax88178_info,
  873. }, {
  874. // IO-DATA ETG-US2
  875. USB_DEVICE (0x04bb, 0x0930),
  876. .driver_info = (unsigned long) &ax88178_info,
  877. }, {
  878. // Belkin F5D5055
  879. USB_DEVICE(0x050d, 0x5055),
  880. .driver_info = (unsigned long) &ax88178_info,
  881. }, {
  882. // Apple USB Ethernet Adapter
  883. USB_DEVICE(0x05ac, 0x1402),
  884. .driver_info = (unsigned long) &ax88772_info,
  885. }, {
  886. // Cables-to-Go USB Ethernet Adapter
  887. USB_DEVICE(0x0b95, 0x772a),
  888. .driver_info = (unsigned long) &ax88772_info,
  889. }, {
  890. // ABOCOM for pci
  891. USB_DEVICE(0x14ea, 0xab11),
  892. .driver_info = (unsigned long) &ax88178_info,
  893. }, {
  894. // ASIX 88772a
  895. USB_DEVICE(0x0db0, 0xa877),
  896. .driver_info = (unsigned long) &ax88772_info,
  897. }, {
  898. // Asus USB Ethernet Adapter
  899. USB_DEVICE (0x0b95, 0x7e2b),
  900. .driver_info = (unsigned long) &ax88772_info,
  901. }, {
  902. /* ASIX 88172a demo board */
  903. USB_DEVICE(0x0b95, 0x172a),
  904. .driver_info = (unsigned long) &ax88172a_info,
  905. }, {
  906. /*
  907. * USBLINK HG20F9 "USB 2.0 LAN"
  908. * Appears to have gazumped Linksys's manufacturer ID but
  909. * doesn't (yet) conflict with any known Linksys product.
  910. */
  911. USB_DEVICE(0x066b, 0x20f9),
  912. .driver_info = (unsigned long) &hg20f9_info,
  913. },
  914. { }, // END
  915. };
  916. MODULE_DEVICE_TABLE(usb, products);
  917. static struct usb_driver asix_driver = {
  918. .name = DRIVER_NAME,
  919. .id_table = products,
  920. .probe = usbnet_probe,
  921. .suspend = usbnet_suspend,
  922. .resume = usbnet_resume,
  923. .disconnect = usbnet_disconnect,
  924. .supports_autosuspend = 1,
  925. .disable_hub_initiated_lpm = 1,
  926. };
  927. module_usb_driver(asix_driver);
  928. MODULE_AUTHOR("David Hollis");
  929. MODULE_VERSION(DRIVER_VERSION);
  930. MODULE_DESCRIPTION("ASIX AX8817X based USB 2.0 Ethernet Devices");
  931. MODULE_LICENSE("GPL");